solve-engine 1.0.2 → 1.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.
Files changed (237) hide show
  1. package/dist/{BytecodeBuilder-B0xskcv5.d.cts → BytecodeBuilder-Bp9xeTmX.d.cts} +4 -0
  2. package/dist/{BytecodeBuilder-B0xskcv5.d.ts → BytecodeBuilder-Bp9xeTmX.d.ts} +4 -0
  3. package/dist/{Configuration-B-G5gTRn.d.cts → Configuration-C9W8tJv_.d.cts} +53 -1
  4. package/dist/{Configuration-B-G5gTRn.d.ts → Configuration-C9W8tJv_.d.ts} +53 -1
  5. package/dist/{EngineError-LU7W7AgI.d.cts → EngineError-B61GS1jp.d.cts} +14 -0
  6. package/dist/{EngineError-LU7W7AgI.d.ts → EngineError-B61GS1jp.d.ts} +14 -0
  7. package/dist/FormattingSettings-CJHyxcYu.d.cts +27 -0
  8. package/dist/FormattingSettings-CJHyxcYu.d.ts +27 -0
  9. package/dist/{Lexer-DpjdaQ98.d.cts → Lexer-BOs7euZe.d.cts} +28 -1
  10. package/dist/{Lexer-CNmWxabg.d.ts → Lexer-CSI_lwbW.d.ts} +28 -1
  11. package/dist/PackageCompatibility-B-7rK1TD.d.cts +76 -0
  12. package/dist/PackageCompatibility-Dh59eF-X.d.ts +76 -0
  13. package/dist/{PackageRegistry-zuzqt51V.d.cts → PackageRegistry-BHWJP83F.d.cts} +449 -11
  14. package/dist/{PackageRegistry-ClIFXxAe.d.ts → PackageRegistry-_8rDlvxI.d.ts} +449 -11
  15. package/dist/{Parselet-BaySkMV3.d.ts → Parselet-BBT8riYh.d.ts} +12 -3
  16. package/dist/{Parselet-DuI1Pjiq.d.cts → Parselet-BHcgK9S7.d.cts} +12 -3
  17. package/dist/{ScopeManager-B6GzdhVG.d.cts → ScopeManager-8vf02dwj.d.cts} +56 -5
  18. package/dist/{ScopeManager-udv4Twwq.d.ts → ScopeManager-CxA24W5n.d.ts} +56 -5
  19. package/dist/{Token-BzG5G4ja.d.cts → Token-B1hdkedD.d.cts} +9 -0
  20. package/dist/{Token-BzG5G4ja.d.ts → Token-B1hdkedD.d.ts} +9 -0
  21. package/dist/{TokenNormalizer-t_GotBxr.d.ts → TokenNormalizer-C6VzZgHa.d.ts} +1 -1
  22. package/dist/{TokenNormalizer-DGVa24Q-.d.cts → TokenNormalizer-DRc1Js1V.d.cts} +1 -1
  23. package/dist/{VMCheckpoints-DwLjivM7.d.cts → VMCheckpoints-ELYqITdF.d.cts} +3 -3
  24. package/dist/{VMCheckpoints-BiaIlOOY.d.ts → VMCheckpoints-MK--EBH2.d.ts} +3 -3
  25. package/dist/{Value-CXJqDH9J.d.cts → Value-BUi1RA3S.d.cts} +124 -5
  26. package/dist/{Value-CXJqDH9J.d.ts → Value-BUi1RA3S.d.ts} +124 -5
  27. package/dist/WorkerError-_-RkoQ5P.d.ts +75 -0
  28. package/dist/WorkerError-gzmaopj2.d.cts +75 -0
  29. package/dist/{chunk-GQCOSXMG.js → chunk-267JPOTF.js} +43 -5
  30. package/dist/chunk-267JPOTF.js.map +1 -0
  31. package/dist/{chunk-JMXUNXQS.cjs → chunk-2TZKENDH.cjs} +51 -8
  32. package/dist/chunk-2TZKENDH.cjs.map +1 -0
  33. package/dist/chunk-3OWCDIPN.js +215 -0
  34. package/dist/chunk-3OWCDIPN.js.map +1 -0
  35. package/dist/{chunk-VB37OC6I.js → chunk-4D6NIHE2.js} +40 -3
  36. package/dist/chunk-4D6NIHE2.js.map +1 -0
  37. package/dist/{chunk-YXCTLWOH.js → chunk-4HQKTMWG.js} +1530 -57
  38. package/dist/chunk-4HQKTMWG.js.map +1 -0
  39. package/dist/{chunk-TY3TLZAW.cjs → chunk-536WPM2V.cjs} +18 -2
  40. package/dist/chunk-536WPM2V.cjs.map +1 -0
  41. package/dist/chunk-5HRB36DK.js +405 -0
  42. package/dist/chunk-5HRB36DK.js.map +1 -0
  43. package/dist/chunk-5ON7PUAZ.js +12 -0
  44. package/dist/chunk-5ON7PUAZ.js.map +1 -0
  45. package/dist/{chunk-KV7UW6T6.js → chunk-7KYSUDQO.js} +12 -5
  46. package/dist/chunk-7KYSUDQO.js.map +1 -0
  47. package/dist/{chunk-6WFMPTGB.cjs → chunk-7ZX6B7SY.cjs} +774 -528
  48. package/dist/chunk-7ZX6B7SY.cjs.map +1 -0
  49. package/dist/chunk-ALYRJ72W.cjs +434 -0
  50. package/dist/chunk-ALYRJ72W.cjs.map +1 -0
  51. package/dist/{chunk-5KMIY374.cjs → chunk-B4HBEFTB.cjs} +17 -2
  52. package/dist/chunk-B4HBEFTB.cjs.map +1 -0
  53. package/dist/chunk-B7NLZMQ3.cjs +74 -0
  54. package/dist/chunk-B7NLZMQ3.cjs.map +1 -0
  55. package/dist/{chunk-UQ3UIZJC.js → chunk-BLI4NIQY.js} +6 -2
  56. package/dist/chunk-BLI4NIQY.js.map +1 -0
  57. package/dist/{chunk-IP7ASJEW.js → chunk-BYJBUL7U.js} +5 -5
  58. package/dist/{chunk-IP7ASJEW.js.map → chunk-BYJBUL7U.js.map} +1 -1
  59. package/dist/{chunk-G535KJEG.js → chunk-CCBZZQAE.js} +2 -2
  60. package/dist/{chunk-G535KJEG.js.map → chunk-CCBZZQAE.js.map} +1 -1
  61. package/dist/chunk-CKQMXMHR.cjs +219 -0
  62. package/dist/chunk-CKQMXMHR.cjs.map +1 -0
  63. package/dist/{chunk-T556MJDZ.cjs → chunk-CUR2WLI4.cjs} +11 -11
  64. package/dist/{chunk-T556MJDZ.cjs.map → chunk-CUR2WLI4.cjs.map} +1 -1
  65. package/dist/{chunk-AA3KTWTX.js → chunk-DLEBSLF4.js} +4 -4
  66. package/dist/{chunk-AA3KTWTX.js.map → chunk-DLEBSLF4.js.map} +1 -1
  67. package/dist/{chunk-524F3ATQ.cjs → chunk-E23GZEWL.cjs} +15 -9
  68. package/dist/chunk-E23GZEWL.cjs.map +1 -0
  69. package/dist/{chunk-PFUESQTW.cjs → chunk-EJ3ILXX6.cjs} +48 -2
  70. package/dist/chunk-EJ3ILXX6.cjs.map +1 -0
  71. package/dist/{chunk-526PMQOA.js → chunk-ENKKJYD3.js} +10 -4
  72. package/dist/chunk-ENKKJYD3.js.map +1 -0
  73. package/dist/{chunk-5X2PTP6F.cjs → chunk-ENRIK36Q.cjs} +2 -12
  74. package/dist/chunk-ENRIK36Q.cjs.map +1 -0
  75. package/dist/{chunk-3D7V24DG.js → chunk-ERCOHGXD.js} +17 -2
  76. package/dist/chunk-ERCOHGXD.js.map +1 -0
  77. package/dist/{chunk-IF532O7C.js → chunk-FD5ZZHEU.js} +3 -12
  78. package/dist/chunk-FD5ZZHEU.js.map +1 -0
  79. package/dist/{chunk-7FSDNNNC.js → chunk-GLA4JXBO.js} +11 -5
  80. package/dist/chunk-GLA4JXBO.js.map +1 -0
  81. package/dist/{chunk-UM6BVY2S.cjs → chunk-HIQ5HSZL.cjs} +175 -43
  82. package/dist/chunk-HIQ5HSZL.cjs.map +1 -0
  83. package/dist/{chunk-HVQFNJKE.cjs → chunk-HVRVSI2Z.cjs} +104 -86
  84. package/dist/chunk-HVRVSI2Z.cjs.map +1 -0
  85. package/dist/{chunk-3LAEG75D.js → chunk-I4GAWIPW.js} +24 -6
  86. package/dist/chunk-I4GAWIPW.js.map +1 -0
  87. package/dist/{chunk-PA4VC73I.cjs → chunk-J45BCEZ4.cjs} +33 -27
  88. package/dist/chunk-J45BCEZ4.cjs.map +1 -0
  89. package/dist/{chunk-FQGX2PA2.js → chunk-JG6ZJ2WU.js} +128 -4
  90. package/dist/chunk-JG6ZJ2WU.js.map +1 -0
  91. package/dist/chunk-L2TE7PMO.cjs +14 -0
  92. package/dist/chunk-L2TE7PMO.cjs.map +1 -0
  93. package/dist/chunk-LHZ6VOA7.js +1764 -0
  94. package/dist/chunk-LHZ6VOA7.js.map +1 -0
  95. package/dist/{chunk-SESSWASV.cjs → chunk-MN3LHRGV.cjs} +1868 -393
  96. package/dist/chunk-MN3LHRGV.cjs.map +1 -0
  97. package/dist/{chunk-R3PY4G7J.js → chunk-MVTOCRV2.js} +48 -3
  98. package/dist/chunk-MVTOCRV2.js.map +1 -0
  99. package/dist/{chunk-FE23VSSA.cjs → chunk-N5NNW4VG.cjs} +6 -6
  100. package/dist/{chunk-FE23VSSA.cjs.map → chunk-N5NNW4VG.cjs.map} +1 -1
  101. package/dist/{chunk-Y7FT4IQT.js → chunk-NKW7LKYU.js} +266 -28
  102. package/dist/chunk-NKW7LKYU.js.map +1 -0
  103. package/dist/{chunk-O3ANBHSA.js → chunk-NNQ2TYDF.js} +123 -5
  104. package/dist/chunk-NNQ2TYDF.js.map +1 -0
  105. package/dist/{chunk-NG2JHZHE.js → chunk-NNZAEUDW.js} +1853 -2640
  106. package/dist/chunk-NNZAEUDW.js.map +1 -0
  107. package/dist/{chunk-5LI5EPGJ.cjs → chunk-QFTDTX6K.cjs} +40 -3
  108. package/dist/chunk-QFTDTX6K.cjs.map +1 -0
  109. package/dist/{chunk-HDP7VK3C.cjs → chunk-SRGQ72IR.cjs} +649 -349
  110. package/dist/chunk-SRGQ72IR.cjs.map +1 -0
  111. package/dist/{chunk-4B2CNWQU.cjs → chunk-SSV46KFA.cjs} +14 -7
  112. package/dist/chunk-SSV46KFA.cjs.map +1 -0
  113. package/dist/{chunk-HBVFFBRR.cjs → chunk-T6ZYQJ63.cjs} +1962 -2748
  114. package/dist/chunk-T6ZYQJ63.cjs.map +1 -0
  115. package/dist/{chunk-AJA6LUI7.js → chunk-UO6BUV6K.js} +18 -2
  116. package/dist/chunk-UO6BUV6K.js.map +1 -0
  117. package/dist/chunk-WWQEY7BV.js +67 -0
  118. package/dist/chunk-WWQEY7BV.js.map +1 -0
  119. package/dist/{chunk-5WVP4YHP.js → chunk-WXEHD6TT.js} +333 -33
  120. package/dist/chunk-WXEHD6TT.js.map +1 -0
  121. package/dist/{chunk-47LRVGOT.cjs → chunk-XA4CKRML.cjs} +2 -2
  122. package/dist/{chunk-47LRVGOT.cjs.map → chunk-XA4CKRML.cjs.map} +1 -1
  123. package/dist/{chunk-6KFYJ6TD.cjs → chunk-XIYYHA65.cjs} +6 -2
  124. package/dist/chunk-XIYYHA65.cjs.map +1 -0
  125. package/dist/chunk-YRIKITGF.cjs +1768 -0
  126. package/dist/chunk-YRIKITGF.cjs.map +1 -0
  127. package/dist/{chunk-TMA4RCEN.js → chunk-Z7XGGLI2.js} +3 -3
  128. package/dist/{chunk-TMA4RCEN.js.map → chunk-Z7XGGLI2.js.map} +1 -1
  129. package/dist/{chunk-R7YVBHCV.cjs → chunk-ZMW6NU2K.cjs} +197 -73
  130. package/dist/chunk-ZMW6NU2K.cjs.map +1 -0
  131. package/dist/{chunk-A2N2GFCG.cjs → chunk-ZVTWQLK4.cjs} +10 -10
  132. package/dist/{chunk-A2N2GFCG.cjs.map → chunk-ZVTWQLK4.cjs.map} +1 -1
  133. package/dist/constants.cjs +5 -5
  134. package/dist/constants.d.cts +1 -1
  135. package/dist/constants.d.ts +1 -1
  136. package/dist/constants.js +2 -2
  137. package/dist/engine.cjs +52 -35
  138. package/dist/engine.d.cts +13 -13
  139. package/dist/engine.d.ts +13 -13
  140. package/dist/engine.js +26 -21
  141. package/dist/errors.cjs +44 -19
  142. package/dist/errors.d.cts +3 -2
  143. package/dist/errors.d.ts +3 -2
  144. package/dist/errors.js +2 -1
  145. package/dist/format.cjs +19 -169
  146. package/dist/format.cjs.map +1 -1
  147. package/dist/format.d.cts +18 -26
  148. package/dist/format.d.ts +18 -26
  149. package/dist/format.js +7 -171
  150. package/dist/format.js.map +1 -1
  151. package/dist/index.cjs +250 -31
  152. package/dist/index.cjs.map +1 -1
  153. package/dist/index.d.cts +110 -74
  154. package/dist/index.d.ts +110 -74
  155. package/dist/index.js +228 -23
  156. package/dist/index.js.map +1 -1
  157. package/dist/language.cjs +9 -9
  158. package/dist/language.d.cts +12 -12
  159. package/dist/language.d.ts +12 -12
  160. package/dist/language.js +3 -3
  161. package/dist/lexer.cjs +16 -16
  162. package/dist/lexer.d.cts +3 -3
  163. package/dist/lexer.d.ts +3 -3
  164. package/dist/lexer.js +5 -5
  165. package/dist/normalizer.cjs +10 -10
  166. package/dist/normalizer.d.cts +3 -3
  167. package/dist/normalizer.d.ts +3 -3
  168. package/dist/normalizer.js +4 -4
  169. package/dist/packages.cjs +45 -36
  170. package/dist/packages.d.cts +135 -31
  171. package/dist/packages.d.ts +135 -31
  172. package/dist/packages.js +14 -13
  173. package/dist/parser.cjs +16 -16
  174. package/dist/parser.d.cts +6 -5
  175. package/dist/parser.d.ts +6 -5
  176. package/dist/parser.js +6 -6
  177. package/dist/{pipeline-BEb3hujr.d.cts → pipeline-CtfJtPQc.d.cts} +3 -3
  178. package/dist/{pipeline-B6k5lCB7.d.ts → pipeline-DCd5M6Gk.d.ts} +3 -3
  179. package/dist/resolvers.d.cts +3 -3
  180. package/dist/resolvers.d.ts +3 -3
  181. package/dist/testing.cjs +478 -0
  182. package/dist/testing.cjs.map +1 -0
  183. package/dist/testing.d.cts +271 -0
  184. package/dist/testing.d.ts +271 -0
  185. package/dist/testing.js +470 -0
  186. package/dist/testing.js.map +1 -0
  187. package/dist/uom.cjs +16 -16
  188. package/dist/uom.d.cts +3 -3
  189. package/dist/uom.d.ts +3 -3
  190. package/dist/uom.js +6 -6
  191. package/dist/utilities.cjs +6 -5
  192. package/dist/utilities.js +2 -1
  193. package/dist/vm.cjs +34 -34
  194. package/dist/vm.d.cts +8 -8
  195. package/dist/vm.d.ts +8 -8
  196. package/dist/vm.js +9 -9
  197. package/dist/worker.cjs +493 -0
  198. package/dist/worker.cjs.map +1 -0
  199. package/dist/worker.d.cts +509 -0
  200. package/dist/worker.d.ts +509 -0
  201. package/dist/worker.js +484 -0
  202. package/dist/worker.js.map +1 -0
  203. package/package.json +21 -1
  204. package/dist/chunk-3D7V24DG.js.map +0 -1
  205. package/dist/chunk-3LAEG75D.js.map +0 -1
  206. package/dist/chunk-4B2CNWQU.cjs.map +0 -1
  207. package/dist/chunk-524F3ATQ.cjs.map +0 -1
  208. package/dist/chunk-526PMQOA.js.map +0 -1
  209. package/dist/chunk-5KMIY374.cjs.map +0 -1
  210. package/dist/chunk-5LI5EPGJ.cjs.map +0 -1
  211. package/dist/chunk-5WVP4YHP.js.map +0 -1
  212. package/dist/chunk-5X2PTP6F.cjs.map +0 -1
  213. package/dist/chunk-6KFYJ6TD.cjs.map +0 -1
  214. package/dist/chunk-6WFMPTGB.cjs.map +0 -1
  215. package/dist/chunk-7FSDNNNC.js.map +0 -1
  216. package/dist/chunk-AJA6LUI7.js.map +0 -1
  217. package/dist/chunk-FQGX2PA2.js.map +0 -1
  218. package/dist/chunk-GQCOSXMG.js.map +0 -1
  219. package/dist/chunk-HBVFFBRR.cjs.map +0 -1
  220. package/dist/chunk-HDP7VK3C.cjs.map +0 -1
  221. package/dist/chunk-HVQFNJKE.cjs.map +0 -1
  222. package/dist/chunk-IF532O7C.js.map +0 -1
  223. package/dist/chunk-JMXUNXQS.cjs.map +0 -1
  224. package/dist/chunk-KV7UW6T6.js.map +0 -1
  225. package/dist/chunk-NG2JHZHE.js.map +0 -1
  226. package/dist/chunk-O3ANBHSA.js.map +0 -1
  227. package/dist/chunk-PA4VC73I.cjs.map +0 -1
  228. package/dist/chunk-PFUESQTW.cjs.map +0 -1
  229. package/dist/chunk-R3PY4G7J.js.map +0 -1
  230. package/dist/chunk-R7YVBHCV.cjs.map +0 -1
  231. package/dist/chunk-SESSWASV.cjs.map +0 -1
  232. package/dist/chunk-TY3TLZAW.cjs.map +0 -1
  233. package/dist/chunk-UM6BVY2S.cjs.map +0 -1
  234. package/dist/chunk-UQ3UIZJC.js.map +0 -1
  235. package/dist/chunk-VB37OC6I.js.map +0 -1
  236. package/dist/chunk-Y7FT4IQT.js.map +0 -1
  237. package/dist/chunk-YXCTLWOH.js.map +0 -1
@@ -0,0 +1,470 @@
1
+ import { ExpressionEngine, checkPackageCompatibility, checkEngineVersionCompatibility } from './chunk-NNZAEUDW.js';
2
+ import './chunk-I4GAWIPW.js';
3
+ import './chunk-2RWAXT6O.js';
4
+ import './chunk-3VGDNEE3.js';
5
+ import './chunk-FD5ZZHEU.js';
6
+ import './chunk-WXEHD6TT.js';
7
+ import './chunk-CCBZZQAE.js';
8
+ import './chunk-3OWCDIPN.js';
9
+ import './chunk-UKQHXPGW.js';
10
+ import { BUILTIN_PACKAGES } from './chunk-4HQKTMWG.js';
11
+ import './chunk-ENKKJYD3.js';
12
+ import './chunk-BYJBUL7U.js';
13
+ import './chunk-3BOK2LDK.js';
14
+ import './chunk-7KYSUDQO.js';
15
+ import './chunk-NLNDMWZC.js';
16
+ import './chunk-NKW7LKYU.js';
17
+ import './chunk-GCM5JHMX.js';
18
+ import './chunk-Z7XGGLI2.js';
19
+ import './chunk-BLI4NIQY.js';
20
+ import './chunk-Z4X2RWOF.js';
21
+ import './chunk-5HRB36DK.js';
22
+ import './chunk-NNQ2TYDF.js';
23
+ import { Value } from './chunk-267JPOTF.js';
24
+ import './chunk-MVTOCRV2.js';
25
+ import { ENGINE_VERSION } from './chunk-GLA4JXBO.js';
26
+ import './chunk-DLEBSLF4.js';
27
+ import './chunk-UO6BUV6K.js';
28
+ import './chunk-JG6ZJ2WU.js';
29
+ import './chunk-4D6NIHE2.js';
30
+ import './chunk-XBTEO4OB.js';
31
+ import './chunk-SBUFNJVE.js';
32
+ import './chunk-V4XG5QF6.js';
33
+ import { EngineError } from './chunk-ERCOHGXD.js';
34
+ import './chunk-YLJ4XMA6.js';
35
+
36
+ // src/testing/index.ts
37
+ var ExpectationError = class _ExpectationError extends Error {
38
+ constructor(init) {
39
+ super(init.message);
40
+ this.name = "ExpectationError";
41
+ this.code = init.code;
42
+ this.expected = init.expected;
43
+ this.actual = init.actual;
44
+ Object.setPrototypeOf(this, _ExpectationError.prototype);
45
+ }
46
+ };
47
+ function createTestEngine(packages = [], options = {}) {
48
+ const { locale = "en", includeBuiltins = true } = options;
49
+ const engine = new ExpressionEngine(locale, false, void 0, void 0, includeBuiltins ? BUILTIN_PACKAGES : []);
50
+ for (const pkg of packages) {
51
+ engine.registerPackage(pkg);
52
+ }
53
+ return engine;
54
+ }
55
+ function evaluate(engine, expression) {
56
+ try {
57
+ const [value] = engine.evaluateExpression(expression);
58
+ if (value === void 0) {
59
+ return {
60
+ status: "error",
61
+ code: "NO_RESULT",
62
+ message: "Evaluation returned no value.",
63
+ source: new Value(13 /* Error */, "NO_RESULT", "Evaluation returned no value.")
64
+ };
65
+ }
66
+ if (value.type === 13 /* Error */) {
67
+ return {
68
+ status: "error",
69
+ code: String(value.value),
70
+ message: typeof value.unit === "string" ? value.unit : "",
71
+ source: value
72
+ };
73
+ }
74
+ if (value.type === 12 /* Pending */) {
75
+ return { status: "pending", value };
76
+ }
77
+ return { status: "value", value };
78
+ } catch (error) {
79
+ if (error instanceof EngineError) {
80
+ return { status: "error", code: error.code, message: error.message, source: error };
81
+ }
82
+ const message = error instanceof Error ? error.message : String(error);
83
+ return {
84
+ status: "error",
85
+ code: "UNKNOWN_ERROR",
86
+ message,
87
+ source: new Value(13 /* Error */, "UNKNOWN_ERROR", message)
88
+ };
89
+ }
90
+ }
91
+ function numbersEqual(a, b) {
92
+ if (Object.is(a, b)) return true;
93
+ if (!Number.isFinite(a) || !Number.isFinite(b)) return false;
94
+ const epsilon = 1e-9 * Math.max(1, Math.abs(a), Math.abs(b));
95
+ return Math.abs(a - b) <= epsilon;
96
+ }
97
+ function describeValue(value) {
98
+ if (value.type === 3 /* String */) return JSON.stringify(value.value);
99
+ if (value.type === 6 /* Uom */ && typeof value.unit === "string") {
100
+ return `${String(value.value)} ${value.unit}`;
101
+ }
102
+ return String(value.value);
103
+ }
104
+ function describeOutcome(outcome) {
105
+ switch (outcome.status) {
106
+ case "value":
107
+ return describeValue(outcome.value);
108
+ case "pending":
109
+ return "a pending async value";
110
+ case "error":
111
+ return `an error (${outcome.code}: ${outcome.message})`;
112
+ }
113
+ }
114
+ var ExpressionAssertion = class {
115
+ constructor(expression, outcome) {
116
+ this.expression = expression;
117
+ this.outcome = outcome;
118
+ }
119
+ /** The raw resolved {@link Value}, for an assertion the matchers do not cover. Throws if the expression failed. */
120
+ get value() {
121
+ if (this.outcome.status === "error") {
122
+ throw new ExpectationError({
123
+ code: "EXPECTED_VALUE",
124
+ message: `Expected "${this.expression}" to evaluate, but it failed with ${describeOutcome(this.outcome)}.`,
125
+ expected: "a resolved value",
126
+ actual: describeOutcome(this.outcome)
127
+ });
128
+ }
129
+ return this.outcome.value;
130
+ }
131
+ /**
132
+ * Assert the expression evaluated to a value (not an error, not a pending
133
+ * async result). Says nothing about what the value is.
134
+ */
135
+ toEvaluate() {
136
+ if (this.outcome.status !== "value") {
137
+ throw new ExpectationError({
138
+ code: "EXPECTED_EVALUATE",
139
+ message: `Expected "${this.expression}" to evaluate to a value, but got ${describeOutcome(this.outcome)}.`,
140
+ expected: "a resolved value",
141
+ actual: describeOutcome(this.outcome)
142
+ });
143
+ }
144
+ return this;
145
+ }
146
+ /**
147
+ * Assert the expression evaluated to `expected`, and, when `unit` is given,
148
+ * that the result carries exactly that unit. A number compares against the
149
+ * value's numeric magnitude within a small floating-point tolerance; a
150
+ * string compares against the value's own string; a boolean against its
151
+ * boolean reading. Omitting `unit` leaves the unit unchecked, so
152
+ * `toEqual(5)` passes for both `5` and `5 gp`.
153
+ */
154
+ toEqual(expected, unit) {
155
+ if (this.outcome.status !== "value") {
156
+ throw new ExpectationError({
157
+ code: "EXPECTED_EQUAL",
158
+ message: `Expected "${this.expression}" to equal ${describeExpected(expected, unit)}, but got ${describeOutcome(this.outcome)}.`,
159
+ expected: describeExpected(expected, unit),
160
+ actual: describeOutcome(this.outcome)
161
+ });
162
+ }
163
+ const value = this.outcome.value;
164
+ let matches;
165
+ if (typeof expected === "number") {
166
+ matches = numbersEqual(value.toNumber(), expected);
167
+ } else if (typeof expected === "boolean") {
168
+ matches = value.type === 10 /* Boolean */ && value.value === expected;
169
+ } else {
170
+ matches = valueToComparableString(value) === expected;
171
+ }
172
+ if (!matches) {
173
+ throw new ExpectationError({
174
+ code: "EXPECTED_EQUAL",
175
+ message: `Expected "${this.expression}" to equal ${describeExpected(expected, unit)}, but it was ${describeValue(value)}.`,
176
+ expected: describeExpected(expected, unit),
177
+ actual: describeValue(value)
178
+ });
179
+ }
180
+ if (unit !== void 0 && value.unit !== unit) {
181
+ throw new ExpectationError({
182
+ code: "EXPECTED_UNIT",
183
+ message: `Expected "${this.expression}" to carry the unit "${unit}", but it was ${value.unit === void 0 ? "unitless" : `"${value.unit}"`}.`,
184
+ expected: `unit "${unit}"`,
185
+ actual: value.unit === void 0 ? "no unit" : `unit "${value.unit}"`
186
+ });
187
+ }
188
+ return this;
189
+ }
190
+ /** Assert the expression failed (a thrown engine error or a plugin-raised error value). Says nothing about the code. */
191
+ toBeError() {
192
+ if (this.outcome.status !== "error") {
193
+ throw new ExpectationError({
194
+ code: "EXPECTED_ERROR",
195
+ message: `Expected "${this.expression}" to fail, but it produced ${describeOutcome(this.outcome)}.`,
196
+ expected: "an error",
197
+ actual: describeOutcome(this.outcome)
198
+ });
199
+ }
200
+ return this;
201
+ }
202
+ /**
203
+ * Assert the expression failed with exactly `code`, the error catalog code
204
+ * (e.g. `"UNDEFINED_VARIABLE"`, or a package's own code). Reports the code
205
+ * it actually got when they differ, so a near-miss is obvious.
206
+ */
207
+ toFailWith(code) {
208
+ if (this.outcome.status !== "error") {
209
+ throw new ExpectationError({
210
+ code: "EXPECTED_FAIL_WITH",
211
+ message: `Expected "${this.expression}" to fail with "${code}", but it produced ${describeOutcome(this.outcome)}.`,
212
+ expected: `error code "${code}"`,
213
+ actual: describeOutcome(this.outcome)
214
+ });
215
+ }
216
+ if (this.outcome.code !== code) {
217
+ throw new ExpectationError({
218
+ code: "EXPECTED_FAIL_WITH",
219
+ message: `Expected "${this.expression}" to fail with "${code}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,
220
+ expected: `error code "${code}"`,
221
+ actual: `error code "${this.outcome.code}"`
222
+ });
223
+ }
224
+ return this;
225
+ }
226
+ /**
227
+ * Assert the expression returned a value still resolving asynchronously.
228
+ * The kit evaluates synchronously, so a package whose result comes from an
229
+ * async resolver reports pending on first evaluation, this is how a test
230
+ * confirms the async path was taken without resolving it.
231
+ */
232
+ toBePending() {
233
+ if (this.outcome.status !== "pending") {
234
+ throw new ExpectationError({
235
+ code: "EXPECTED_PENDING",
236
+ message: `Expected "${this.expression}" to be pending, but got ${describeOutcome(this.outcome)}.`,
237
+ expected: "a pending async value",
238
+ actual: describeOutcome(this.outcome)
239
+ });
240
+ }
241
+ return this;
242
+ }
243
+ };
244
+ function describeExpected(expected, unit) {
245
+ const base = typeof expected === "string" ? JSON.stringify(expected) : String(expected);
246
+ return unit === void 0 ? base : `${base} ${unit}`;
247
+ }
248
+ function valueToComparableString(value) {
249
+ return String(value.value);
250
+ }
251
+ function expectExpression(engine, expression) {
252
+ return new ExpressionAssertion(expression, evaluate(engine, expression));
253
+ }
254
+ var COMMON_PROSE_WORDS = [
255
+ "a",
256
+ "an",
257
+ "and",
258
+ "or",
259
+ "but",
260
+ "if",
261
+ "then",
262
+ "the",
263
+ "this",
264
+ "that",
265
+ "these",
266
+ "those",
267
+ "in",
268
+ "on",
269
+ "at",
270
+ "to",
271
+ "of",
272
+ "for",
273
+ "from",
274
+ "with",
275
+ "by",
276
+ "as",
277
+ "per",
278
+ "into",
279
+ "over",
280
+ "is",
281
+ "are",
282
+ "was",
283
+ "were",
284
+ "be",
285
+ "been",
286
+ "being",
287
+ "do",
288
+ "does",
289
+ "did",
290
+ "have",
291
+ "has",
292
+ "had",
293
+ "will",
294
+ "would",
295
+ "can",
296
+ "could",
297
+ "should",
298
+ "may",
299
+ "might",
300
+ "must",
301
+ "price",
302
+ "cost",
303
+ "value",
304
+ "total",
305
+ "sum",
306
+ "count",
307
+ "rate",
308
+ "amount",
309
+ "number",
310
+ "time",
311
+ "date",
312
+ "day",
313
+ "week",
314
+ "month",
315
+ "year",
316
+ "hour",
317
+ "minute",
318
+ "second",
319
+ "add",
320
+ "buy",
321
+ "sell",
322
+ "hold",
323
+ "make",
324
+ "take",
325
+ "give",
326
+ "get",
327
+ "set",
328
+ "run",
329
+ "up",
330
+ "down",
331
+ "out",
332
+ "off",
333
+ "all",
334
+ "some",
335
+ "any",
336
+ "no",
337
+ "not",
338
+ "more",
339
+ "less",
340
+ "one",
341
+ "two",
342
+ "three",
343
+ "first",
344
+ "last",
345
+ "next",
346
+ "each",
347
+ "every",
348
+ "here",
349
+ "there"
350
+ ];
351
+ var SEVERITY_ORDER = ["error", "warning", "info"];
352
+ function claimedWords(pkg) {
353
+ const claimed = [];
354
+ const vocab = pkg.lexerVocabulary;
355
+ if (vocab?.keywords) {
356
+ for (const [word, tokenType] of Object.entries(vocab.keywords)) {
357
+ claimed.push({ word, via: "keyword", tokenType });
358
+ }
359
+ }
360
+ if (vocab?.units) {
361
+ for (const word of vocab.units) {
362
+ claimed.push({ word, via: "unit" });
363
+ }
364
+ }
365
+ if (vocab?.operators) {
366
+ for (const [word, tokenType] of Object.entries(vocab.operators)) {
367
+ claimed.push({ word, via: "operator", tokenType });
368
+ }
369
+ }
370
+ if (pkg.phrases) {
371
+ for (const [phrase, tokenType] of Object.entries(pkg.phrases)) {
372
+ if (!phrase.includes(" ")) {
373
+ claimed.push({ word: phrase, via: "phrase", tokenType });
374
+ }
375
+ }
376
+ }
377
+ return claimed;
378
+ }
379
+ var PackageAssertion = class {
380
+ constructor(pkg) {
381
+ this.pkg = pkg;
382
+ }
383
+ /**
384
+ * Assert none of the package's claimed words shadow a prose word.
385
+ *
386
+ * A trigger word that is also an ordinary word turns a line of prose into
387
+ * arithmetic, the single most common package mistake and the subject of the
388
+ * trigger-words guide. This checks the words the package declares
389
+ * (lexer keywords, units, operators, and single-word phrases) against
390
+ * `words` (defaulting to {@link COMMON_PROSE_WORDS}), case-insensitively.
391
+ *
392
+ * @returns the shadowed words, empty when the package is clean, for a test
393
+ * that wants to inspect rather than assert.
394
+ */
395
+ notToShadow(words = COMMON_PROSE_WORDS) {
396
+ const prose = new Set(words.map((w) => w.toLowerCase()));
397
+ const shadowed = claimedWords(this.pkg).filter((c) => prose.has(c.word.toLowerCase()));
398
+ if (shadowed.length > 0) {
399
+ const list = shadowed.map((s) => `"${s.word}" (${s.via})`).join(", ");
400
+ throw new ExpectationError({
401
+ code: "PACKAGE_SHADOWS_PROSE",
402
+ message: `Package "${this.pkg.name}" claims prose word(s) as syntax: ${list}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,
403
+ expected: "no prose words claimed as syntax",
404
+ actual: list
405
+ });
406
+ }
407
+ return shadowed;
408
+ }
409
+ /**
410
+ * Assert the package does not collide with any of `others` in a way that
411
+ * would silently break one of them (two packages claiming the same lexer
412
+ * keyword, plugin-function index, async-resolver namespace, and so on).
413
+ *
414
+ * `strictness` sets which severities fail the assertion: `"error"` (the
415
+ * default) fails only on the collisions that always break something,
416
+ * `"warning"` also fails on the ones that silently pick a winner, `"info"`
417
+ * fails on cosmetic overlaps too.
418
+ *
419
+ * @returns the full compatibility report, so a test can inspect every
420
+ * conflict, including ones below the strictness threshold.
421
+ */
422
+ notToCollideWith(others, strictness = "error") {
423
+ const report = checkPackageCompatibility(this.pkg, others);
424
+ const threshold = SEVERITY_ORDER.indexOf(strictness);
425
+ const failing = report.conflicts.filter(
426
+ (c) => SEVERITY_ORDER.indexOf(c.severity) <= threshold
427
+ );
428
+ if (failing.length > 0) {
429
+ const list = failing.map((c) => `[${c.severity}] ${c.detail}`).join("\n");
430
+ throw new ExpectationError({
431
+ code: "PACKAGE_VOCABULARY_COLLISION",
432
+ message: `Package "${this.pkg.name}" collides with another package:
433
+ ${list}`,
434
+ expected: `no conflicts at or above "${strictness}" severity`,
435
+ actual: `${failing.length} conflict(s)`
436
+ });
437
+ }
438
+ return report;
439
+ }
440
+ /**
441
+ * Assert the package's declared `engineVersion` range is satisfied by the
442
+ * running engine (or by `engineVersion` when given).
443
+ *
444
+ * A package that declares a range and never checks it resolves is the third
445
+ * mistake the issue names: it looks fine until the one engine version it
446
+ * cannot run against, where the range either fails to match or turns out to
447
+ * be a malformed string. A package with no declared range passes (no
448
+ * constraint is always compatible).
449
+ */
450
+ toDeclareCompatibleEngineVersion(engineVersion = ENGINE_VERSION) {
451
+ const result = checkEngineVersionCompatibility(this.pkg, engineVersion);
452
+ if (!result.compatible) {
453
+ const detail = result.reason === "invalid-range" ? `its range "${result.declaredRange}" is not valid semver` : `its range "${result.declaredRange}" is not satisfied by engine version "${result.engineVersion}"`;
454
+ throw new ExpectationError({
455
+ code: "PACKAGE_ENGINE_VERSION_INCOMPATIBLE",
456
+ message: `Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${detail}.`,
457
+ expected: `an engineVersion satisfied by "${engineVersion}"`,
458
+ actual: `"${result.declaredRange}"`
459
+ });
460
+ }
461
+ return this;
462
+ }
463
+ };
464
+ function expectPackage(pkg) {
465
+ return new PackageAssertion(pkg);
466
+ }
467
+
468
+ export { COMMON_PROSE_WORDS, ExpectationError, ExpressionAssertion, PackageAssertion, createTestEngine, expectExpression, expectPackage };
469
+ //# sourceMappingURL=testing.js.map
470
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/testing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DO,IAAM,gBAAA,GAAN,MAAM,iBAAA,SAAyB,KAAA,CAAM;AAAA,EAQ3C,YAAY,IAAA,EAA6E;AACxF,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AACZ,IAAA,IAAA,CAAK,OAAO,IAAA,CAAK,IAAA;AACjB,IAAA,IAAA,CAAK,WAAW,IAAA,CAAK,QAAA;AACrB,IAAA,IAAA,CAAK,SAAS,IAAA,CAAK,MAAA;AAGnB,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,iBAAA,CAAiB,SAAS,CAAA;AAAA,EACvD;AACD;AAyCO,SAAS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,YAAA;AAAA,OACzB,CAAA;AAAA,IACF;AACA,IAAA,OAAO,MAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,gCAAA,CAAiC,gBAAwB,cAAA,EAAsB;AAC9E,IAAA,MAAM,MAAA,GAAS,+BAAA,CAAgC,IAAA,CAAK,GAAA,EAAK,aAAa,CAAA;AACtE,IAAA,IAAI,CAAC,OAAO,UAAA,EAAY;AACvB,MAAA,MAAM,MAAA,GACL,MAAA,CAAO,MAAA,KAAW,eAAA,GACf,CAAA,WAAA,EAAc,MAAA,CAAO,aAAa,CAAA,qBAAA,CAAA,GAClC,CAAA,WAAA,EAAc,MAAA,CAAO,aAAa,CAAA,sCAAA,EAAyC,OAAO,aAAa,CAAA,CAAA,CAAA;AACnG,MAAA,MAAM,IAAI,gBAAA,CAAiB;AAAA,QAC1B,IAAA,EAAM,qCAAA;AAAA,QACN,SAAS,CAAA,SAAA,EAAY,IAAA,CAAK,GAAA,CAAI,IAAI,sEAAsE,MAAM,CAAA,CAAA,CAAA;AAAA,QAC9G,QAAA,EAAU,kCAAkC,aAAa,CAAA,CAAA,CAAA;AAAA,QACzD,MAAA,EAAQ,CAAA,CAAA,EAAI,MAAA,CAAO,aAAa,CAAA,CAAA;AAAA,OAChC,CAAA;AAAA,IACF;AACA,IAAA,OAAO,IAAA;AAAA,EACR;AACD;AAYO,SAAS,cAAc,GAAA,EAAuC;AACpE,EAAA,OAAO,IAAI,iBAAiB,GAAG,CAAA;AAChC","file":"testing.js","sourcesContent":["/**\n * A test kit for package authors, the supported way to test a package by the\n * expressions it enables rather than by the opcodes it emits.\n *\n * Before this entry point a package author had two options, both bad: reach\n * into engine internals, or assert on whatever bytecode a parselet happened to\n * emit. The first is unstable across engine versions, the second pins the\n * implementation instead of the behaviour, so a refactor that keeps every\n * answer correct still breaks the tests. This module is a thin, dependency-free\n * layer over the same public surface a host uses: it constructs an\n * {@link ExpressionEngine} with the given packages and evaluates strings.\n *\n * It speaks in expressions. {@link expectExpression} evaluates a string and\n * asserts on the result or the failure code; {@link expectPackage} asserts on\n * the three mistakes a package actually makes (shadowing prose, colliding with\n * another package's vocabulary, and declaring an `engineVersion` range that the\n * running engine does not satisfy).\n *\n * Framework-agnostic on purpose. Nothing here imports jest, vitest or any\n * runner: an assertion that fails throws an {@link ExpectationError}, and one\n * that passes returns, so the kit drops into whatever runner the author already\n * has (or into a plain script, or `node:assert`). Runtime dependency-free and\n * side-effect free, so `solve-engine/testing` stays honest under the package's\n * `\"sideEffects\": false` contract.\n *\n * @example\n * ```ts\n * import { createTestEngine, expectExpression } from \"solve-engine/testing\";\n *\n * const engine = createTestEngine([myPackage]);\n * expectExpression(engine, \"2 gp + 3 gp\").toEqual(5, \"gp\");\n * expectExpression(engine, \"gp\").toFailWith(\"UNDEFINED_VARIABLE\");\n * ```\n */\n\nimport { ExpressionEngine } from \"@solve-js/engine/ExpressionEngine\";\nimport { BUILTIN_PACKAGES } from \"@solve-js/packages/builtins\";\nimport type { IEnginePackage } from \"@solve-js/api/PackageRegistry\";\nimport { Value, ValueType } from \"@solve-js/vm/Value\";\nimport { EngineError } from \"@solve-js/errors/EngineError\";\nimport {\n\tcheckPackageCompatibility,\n\ttype CompatibilityReport,\n\ttype CompatibilityConflict,\n\ttype CompatibilitySeverity,\n} from \"@solve-js/api/PackageCompatibility\";\nimport { checkEngineVersionCompatibility } from \"@solve-js/api/EngineVersionCompatibility\";\nimport { ENGINE_VERSION } from \"@solve-js/constants/version\";\n\n//#region Errors\n\n/**\n * The failure a matcher throws when an expectation is not met.\n *\n * A dedicated `Error` subclass rather than a bare `throw new Error`, so a\n * caller (or a reporter) can tell a kit assertion failure apart from an\n * unrelated exception with `instanceof`, and so the structured `expected` and\n * `actual` fields survive alongside the human-readable message. This is NOT an\n * {@link EngineError}: that type classifies pipeline-stage failures inside the\n * engine, whereas this classifies a test-assertion mismatch, a different\n * concern that would be miscategorised under any of `EngineError`'s categories.\n */\nexport class ExpectationError extends Error {\n\t/** A short, machine-readable label for which expectation failed. */\n\treadonly code: string;\n\t/** What the matcher was told to expect, in plain words. */\n\treadonly expected?: string;\n\t/** What it found instead. */\n\treadonly actual?: string;\n\n\tconstructor(init: { code: string; message: string; expected?: string; actual?: string }) {\n\t\tsuper(init.message);\n\t\tthis.name = \"ExpectationError\";\n\t\tthis.code = init.code;\n\t\tthis.expected = init.expected;\n\t\tthis.actual = init.actual;\n\t\t// Restore the prototype chain across the ES5 `Error` transpile target,\n\t\t// so `instanceof ExpectationError` holds for callers.\n\t\tObject.setPrototypeOf(this, ExpectationError.prototype);\n\t}\n}\n\n//#endregion\n\n//#region createTestEngine\n\n/** Options for {@link createTestEngine}. */\nexport interface TestEngineOptions {\n\t/** Locale passed to the engine. Defaults to `\"en\"`. */\n\tlocale?: string;\n\t/**\n\t * Whether to load the engine's built-in packages (arithmetic, units, dates,\n\t * and the rest) before the packages under test. Defaults to `true`, because\n\t * almost every package builds on arithmetic and most authors want a\n\t * realistic engine. Set `false` to test a package in isolation.\n\t */\n\tincludeBuiltins?: boolean;\n}\n\n/**\n * Build an {@link ExpressionEngine} loaded with the packages under test.\n *\n * The built-in packages load first (unless {@link TestEngineOptions.includeBuiltins}\n * is `false`), then each package in `packages` is registered in order, exactly\n * as a host would. Registration is honest: a package whose declared\n * `engineVersion` the running engine does not satisfy, or whose lexer keyword\n * collides with a built-in, throws here rather than being swallowed. That is\n * deliberately different from passing packages straight to the\n * `ExpressionEngine` constructor, which contains a bad package by logging and\n * continuing, useful in production, wrong for a test that needs to know the\n * package it is testing actually loaded.\n *\n * Call {@link ExpressionEngine.clear} when a test is finished with the engine\n * if the test creates many, see the engine's own lifecycle note.\n *\n * @example\n * ```ts\n * const engine = createTestEngine([myPackage]);\n * const engineOnly = createTestEngine([myPackage], { includeBuiltins: false });\n * ```\n */\nexport function createTestEngine(\n\tpackages: IEnginePackage[] = [],\n\toptions: TestEngineOptions = {},\n): ExpressionEngine {\n\tconst { locale = \"en\", includeBuiltins = true } = options;\n\n\t// Built-ins go through the constructor (their own containment applies);\n\t// the packages under test go through registerPackage() afterwards so their\n\t// failures surface as thrown errors instead of being logged and skipped.\n\tconst engine = new ExpressionEngine(locale, false, undefined, undefined, includeBuiltins ? BUILTIN_PACKAGES : []);\n\tfor (const pkg of packages) {\n\t\tengine.registerPackage(pkg);\n\t}\n\treturn engine;\n}\n\n//#endregion\n\n//#region expectExpression\n\n/**\n * The normalised outcome of evaluating one expression, computed once when\n * {@link expectExpression} runs and read by every matcher on the result.\n *\n * The engine surfaces a failure two different ways, and a package author should\n * not have to know which: a parse/eval error is THROWN as an\n * {@link EngineError} (with a `.code`), while a plugin-raised error is RETURNED\n * as a {@link Value} of {@link ValueType.Error} (its `value` is the code, its\n * `unit` is the message). Both collapse to the `\"error\"` status here. A value\n * still resolving asynchronously is its own `\"pending\"` status, since the kit\n * evaluates synchronously and cannot report a final number for it.\n */\ntype Outcome =\n\t| { status: \"value\"; value: Value }\n\t| { status: \"pending\"; value: Value }\n\t| { status: \"error\"; code: string; message: string; source: EngineError | Value };\n\n/** Evaluate `expression` on `engine` and collapse both failure shapes to one outcome. */\nfunction evaluate(engine: ExpressionEngine, expression: string): Outcome {\n\ttry {\n\t\tconst [value] = engine.evaluateExpression(expression);\n\t\tif (value === undefined) {\n\t\t\t// evaluateExpression() always returns a single-element array; an\n\t\t\t// empty one would be an engine invariant break, reported as such\n\t\t\t// rather than as a silent pass.\n\t\t\treturn {\n\t\t\t\tstatus: \"error\",\n\t\t\t\tcode: \"NO_RESULT\",\n\t\t\t\tmessage: \"Evaluation returned no value.\",\n\t\t\t\tsource: new Value(ValueType.Error, \"NO_RESULT\", \"Evaluation returned no value.\"),\n\t\t\t};\n\t\t}\n\t\tif (value.type === ValueType.Error) {\n\t\t\treturn {\n\t\t\t\tstatus: \"error\",\n\t\t\t\tcode: String(value.value),\n\t\t\t\tmessage: typeof value.unit === \"string\" ? value.unit : \"\",\n\t\t\t\tsource: value,\n\t\t\t};\n\t\t}\n\t\tif (value.type === ValueType.Pending) {\n\t\t\treturn { status: \"pending\", value };\n\t\t}\n\t\treturn { status: \"value\", value };\n\t} catch (error) {\n\t\tif (error instanceof EngineError) {\n\t\t\treturn { status: \"error\", code: error.code, message: error.message, source: error };\n\t\t}\n\t\t// Anything else thrown (a bug in a plugin handler, say) is still a\n\t\t// failure, wrapped so the matcher has a code and message to report.\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\treturn {\n\t\t\tstatus: \"error\",\n\t\t\tcode: \"UNKNOWN_ERROR\",\n\t\t\tmessage,\n\t\t\tsource: new Value(ValueType.Error, \"UNKNOWN_ERROR\", message),\n\t\t};\n\t}\n}\n\n/** Whether two numbers are equal within a small tolerance scaled to their magnitude. */\nfunction numbersEqual(a: number, b: number): boolean {\n\tif (Object.is(a, b)) return true;\n\tif (!Number.isFinite(a) || !Number.isFinite(b)) return false;\n\tconst epsilon = 1e-9 * Math.max(1, Math.abs(a), Math.abs(b));\n\treturn Math.abs(a - b) <= epsilon;\n}\n\n/** A short, readable rendering of a value for an assertion message, e.g. `5 gp` or `\"abc\"`. */\nfunction describeValue(value: Value): string {\n\tif (value.type === ValueType.String) return JSON.stringify(value.value);\n\tif (value.type === ValueType.Uom && typeof value.unit === \"string\") {\n\t\treturn `${String(value.value)} ${value.unit}`;\n\t}\n\treturn String(value.value);\n}\n\n/** A short, readable rendering of an outcome for an assertion message. */\nfunction describeOutcome(outcome: Outcome): string {\n\tswitch (outcome.status) {\n\t\tcase \"value\":\n\t\t\treturn describeValue(outcome.value);\n\t\tcase \"pending\":\n\t\t\treturn \"a pending async value\";\n\t\tcase \"error\":\n\t\t\treturn `an error (${outcome.code}: ${outcome.message})`;\n\t}\n}\n\n/**\n * Assertions about the result of one evaluated expression, returned by\n * {@link expectExpression}. Every matcher returns `this`, so assertions chain,\n * and throws an {@link ExpectationError} when it fails.\n */\nexport class ExpressionAssertion {\n\tconstructor(\n\t\tprivate readonly expression: string,\n\t\tprivate readonly outcome: Outcome,\n\t) {}\n\n\t/** The raw resolved {@link Value}, for an assertion the matchers do not cover. Throws if the expression failed. */\n\tget value(): Value {\n\t\tif (this.outcome.status === \"error\") {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_VALUE\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to evaluate, but it failed with ${describeOutcome(this.outcome)}.`,\n\t\t\t\texpected: \"a resolved value\",\n\t\t\t\tactual: describeOutcome(this.outcome),\n\t\t\t});\n\t\t}\n\t\treturn this.outcome.value;\n\t}\n\n\t/**\n\t * Assert the expression evaluated to a value (not an error, not a pending\n\t * async result). Says nothing about what the value is.\n\t */\n\ttoEvaluate(): this {\n\t\tif (this.outcome.status !== \"value\") {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_EVALUATE\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to evaluate to a value, but got ${describeOutcome(this.outcome)}.`,\n\t\t\t\texpected: \"a resolved value\",\n\t\t\t\tactual: describeOutcome(this.outcome),\n\t\t\t});\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Assert the expression evaluated to `expected`, and, when `unit` is given,\n\t * that the result carries exactly that unit. A number compares against the\n\t * value's numeric magnitude within a small floating-point tolerance; a\n\t * string compares against the value's own string; a boolean against its\n\t * boolean reading. Omitting `unit` leaves the unit unchecked, so\n\t * `toEqual(5)` passes for both `5` and `5 gp`.\n\t */\n\ttoEqual(expected: number | string | boolean, unit?: string): this {\n\t\tif (this.outcome.status !== \"value\") {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_EQUAL\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to equal ${describeExpected(expected, unit)}, but got ${describeOutcome(this.outcome)}.`,\n\t\t\t\texpected: describeExpected(expected, unit),\n\t\t\t\tactual: describeOutcome(this.outcome),\n\t\t\t});\n\t\t}\n\n\t\tconst value = this.outcome.value;\n\t\tlet matches: boolean;\n\t\tif (typeof expected === \"number\") {\n\t\t\tmatches = numbersEqual(value.toNumber(), expected);\n\t\t} else if (typeof expected === \"boolean\") {\n\t\t\t// A Boolean value stores the primitive directly; anything else can\n\t\t\t// never equal a boolean, so a mismatch reports the real value.\n\t\t\tmatches = value.type === ValueType.Boolean && value.value === expected;\n\t\t} else {\n\t\t\tmatches = valueToComparableString(value) === expected;\n\t\t}\n\n\t\tif (!matches) {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_EQUAL\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to equal ${describeExpected(expected, unit)}, but it was ${describeValue(value)}.`,\n\t\t\t\texpected: describeExpected(expected, unit),\n\t\t\t\tactual: describeValue(value),\n\t\t\t});\n\t\t}\n\n\t\tif (unit !== undefined && value.unit !== unit) {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_UNIT\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to carry the unit \"${unit}\", but it was ${value.unit === undefined ? \"unitless\" : `\"${value.unit}\"`}.`,\n\t\t\t\texpected: `unit \"${unit}\"`,\n\t\t\t\tactual: value.unit === undefined ? \"no unit\" : `unit \"${value.unit}\"`,\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/** Assert the expression failed (a thrown engine error or a plugin-raised error value). Says nothing about the code. */\n\ttoBeError(): this {\n\t\tif (this.outcome.status !== \"error\") {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_ERROR\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to fail, but it produced ${describeOutcome(this.outcome)}.`,\n\t\t\t\texpected: \"an error\",\n\t\t\t\tactual: describeOutcome(this.outcome),\n\t\t\t});\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Assert the expression failed with exactly `code`, the error catalog code\n\t * (e.g. `\"UNDEFINED_VARIABLE\"`, or a package's own code). Reports the code\n\t * it actually got when they differ, so a near-miss is obvious.\n\t */\n\ttoFailWith(code: string): this {\n\t\tif (this.outcome.status !== \"error\") {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_FAIL_WITH\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to fail with \"${code}\", but it produced ${describeOutcome(this.outcome)}.`,\n\t\t\t\texpected: `error code \"${code}\"`,\n\t\t\t\tactual: describeOutcome(this.outcome),\n\t\t\t});\n\t\t}\n\t\tif (this.outcome.code !== code) {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_FAIL_WITH\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to fail with \"${code}\", but it failed with \"${this.outcome.code}\" (${this.outcome.message}).`,\n\t\t\t\texpected: `error code \"${code}\"`,\n\t\t\t\tactual: `error code \"${this.outcome.code}\"`,\n\t\t\t});\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Assert the expression returned a value still resolving asynchronously.\n\t * The kit evaluates synchronously, so a package whose result comes from an\n\t * async resolver reports pending on first evaluation, this is how a test\n\t * confirms the async path was taken without resolving it.\n\t */\n\ttoBePending(): this {\n\t\tif (this.outcome.status !== \"pending\") {\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"EXPECTED_PENDING\",\n\t\t\t\tmessage: `Expected \"${this.expression}\" to be pending, but got ${describeOutcome(this.outcome)}.`,\n\t\t\t\texpected: \"a pending async value\",\n\t\t\t\tactual: describeOutcome(this.outcome),\n\t\t\t});\n\t\t}\n\t\treturn this;\n\t}\n}\n\n/** Render an expected value (with optional unit) for an assertion message. */\nfunction describeExpected(expected: number | string | boolean, unit?: string): string {\n\tconst base = typeof expected === \"string\" ? JSON.stringify(expected) : String(expected);\n\treturn unit === undefined ? base : `${base} ${unit}`;\n}\n\n/** The string a non-numeric value compares against in {@link ExpressionAssertion.toEqual}. */\nfunction valueToComparableString(value: Value): string {\n\t// The stored primitive stringified. For a String value this is the string\n\t// itself; for a Hex value, its `0x...` text, which is what an author writes\n\t// in a `toEqual(\"0xff\")` assertion.\n\treturn String(value.value);\n}\n\n/**\n * Evaluate `expression` on `engine` and return an assertion object.\n *\n * The expression is evaluated once, immediately, and every matcher reads that\n * one outcome, so calling several matchers on the same result does not\n * re-evaluate.\n *\n * @example\n * ```ts\n * expectExpression(engine, \"2 gp + 3 gp\").toEqual(5, \"gp\");\n * expectExpression(engine, \"gp\").toFailWith(\"UNDEFINED_VARIABLE\");\n * ```\n */\nexport function expectExpression(engine: ExpressionEngine, expression: string): ExpressionAssertion {\n\treturn new ExpressionAssertion(expression, evaluate(engine, expression));\n}\n\n//#endregion\n\n//#region expectPackage\n\n/**\n * A modest set of everyday English words a package's keywords should not claim.\n *\n * A starting point for {@link PackageAssertion.notToShadow}, not an exhaustive\n * dictionary: it leans on the function words and common nouns/verbs a package\n * is most tempted to grab as a trigger (`price`, `of`, `per`, `sum`, `total`).\n * Pass your own list to check against the specific prose your package sits in.\n */\nexport const COMMON_PROSE_WORDS: readonly string[] = [\n\t\"a\", \"an\", \"and\", \"or\", \"but\", \"if\", \"then\", \"the\", \"this\", \"that\", \"these\", \"those\",\n\t\"in\", \"on\", \"at\", \"to\", \"of\", \"for\", \"from\", \"with\", \"by\", \"as\", \"per\", \"into\", \"over\",\n\t\"is\", \"are\", \"was\", \"were\", \"be\", \"been\", \"being\", \"do\", \"does\", \"did\", \"have\", \"has\", \"had\",\n\t\"will\", \"would\", \"can\", \"could\", \"should\", \"may\", \"might\", \"must\",\n\t\"price\", \"cost\", \"value\", \"total\", \"sum\", \"count\", \"rate\", \"amount\", \"number\",\n\t\"time\", \"date\", \"day\", \"week\", \"month\", \"year\", \"hour\", \"minute\", \"second\",\n\t\"add\", \"buy\", \"sell\", \"hold\", \"make\", \"take\", \"give\", \"get\", \"set\", \"run\",\n\t\"up\", \"down\", \"out\", \"off\", \"all\", \"some\", \"any\", \"no\", \"not\", \"more\", \"less\",\n\t\"one\", \"two\", \"three\", \"first\", \"last\", \"next\", \"each\", \"every\", \"here\", \"there\",\n];\n\n/** How strict {@link PackageAssertion.notToCollideWith} is about the conflicts it will accept. */\nexport type CollisionStrictness = \"error\" | \"warning\" | \"info\";\n\n/** One shadowed word found by {@link PackageAssertion.notToShadow}: the prose word and how the package claims it. */\nexport interface ShadowedWord {\n\t/** The prose word the package claims. */\n\tword: string;\n\t/** Which descriptor field claims it. */\n\tvia: \"keyword\" | \"unit\" | \"operator\" | \"phrase\";\n\t/** The token type the word becomes, when the field maps to one. */\n\ttokenType?: string;\n}\n\n/** Severities at or above the strictness threshold, ordered most to least severe. */\nconst SEVERITY_ORDER: CompatibilitySeverity[] = [\"error\", \"warning\", \"info\"];\n\n/** Gather the single words a package claims through its declared vocabulary, which is where prose shadowing comes from. */\nfunction claimedWords(pkg: IEnginePackage): ShadowedWord[] {\n\tconst claimed: ShadowedWord[] = [];\n\tconst vocab = pkg.lexerVocabulary;\n\tif (vocab?.keywords) {\n\t\tfor (const [word, tokenType] of Object.entries(vocab.keywords)) {\n\t\t\tclaimed.push({ word, via: \"keyword\", tokenType });\n\t\t}\n\t}\n\tif (vocab?.units) {\n\t\tfor (const word of vocab.units) {\n\t\t\tclaimed.push({ word, via: \"unit\" });\n\t\t}\n\t}\n\tif (vocab?.operators) {\n\t\tfor (const [word, tokenType] of Object.entries(vocab.operators)) {\n\t\t\tclaimed.push({ word, via: \"operator\", tokenType });\n\t\t}\n\t}\n\tif (pkg.phrases) {\n\t\tfor (const [phrase, tokenType] of Object.entries(pkg.phrases)) {\n\t\t\t// A multi-word phrase is the SAFE pattern the trigger-words guide\n\t\t\t// recommends (`next friday` reserves neither word), so only a\n\t\t\t// single-word phrase can shadow a prose word.\n\t\t\tif (!phrase.includes(\" \")) {\n\t\t\t\tclaimed.push({ word: phrase, via: \"phrase\", tokenType });\n\t\t\t}\n\t\t}\n\t}\n\treturn claimed;\n}\n\n/**\n * Assertions about a package's declared descriptor, returned by\n * {@link expectPackage}. These catch the three mistakes the issue calls out,\n * before the package is ever registered. Every matcher returns `this` and\n * throws an {@link ExpectationError} when it fails.\n */\nexport class PackageAssertion {\n\tconstructor(private readonly pkg: IEnginePackage) {}\n\n\t/**\n\t * Assert none of the package's claimed words shadow a prose word.\n\t *\n\t * A trigger word that is also an ordinary word turns a line of prose into\n\t * arithmetic, the single most common package mistake and the subject of the\n\t * trigger-words guide. This checks the words the package declares\n\t * (lexer keywords, units, operators, and single-word phrases) against\n\t * `words` (defaulting to {@link COMMON_PROSE_WORDS}), case-insensitively.\n\t *\n\t * @returns the shadowed words, empty when the package is clean, for a test\n\t * that wants to inspect rather than assert.\n\t */\n\tnotToShadow(words: readonly string[] = COMMON_PROSE_WORDS): ShadowedWord[] {\n\t\tconst prose = new Set(words.map((w) => w.toLowerCase()));\n\t\tconst shadowed = claimedWords(this.pkg).filter((c) => prose.has(c.word.toLowerCase()));\n\t\tif (shadowed.length > 0) {\n\t\t\tconst list = shadowed.map((s) => `\"${s.word}\" (${s.via})`).join(\", \");\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"PACKAGE_SHADOWS_PROSE\",\n\t\t\t\tmessage: `Package \"${this.pkg.name}\" claims prose word(s) as syntax: ${list}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,\n\t\t\t\texpected: \"no prose words claimed as syntax\",\n\t\t\t\tactual: list,\n\t\t\t});\n\t\t}\n\t\treturn shadowed;\n\t}\n\n\t/**\n\t * Assert the package does not collide with any of `others` in a way that\n\t * would silently break one of them (two packages claiming the same lexer\n\t * keyword, plugin-function index, async-resolver namespace, and so on).\n\t *\n\t * `strictness` sets which severities fail the assertion: `\"error\"` (the\n\t * default) fails only on the collisions that always break something,\n\t * `\"warning\"` also fails on the ones that silently pick a winner, `\"info\"`\n\t * fails on cosmetic overlaps too.\n\t *\n\t * @returns the full compatibility report, so a test can inspect every\n\t * conflict, including ones below the strictness threshold.\n\t */\n\tnotToCollideWith(\n\t\tothers: IEnginePackage[],\n\t\tstrictness: CollisionStrictness = \"error\",\n\t): CompatibilityReport {\n\t\tconst report = checkPackageCompatibility(this.pkg, others);\n\t\tconst threshold = SEVERITY_ORDER.indexOf(strictness);\n\t\tconst failing = report.conflicts.filter(\n\t\t\t(c: CompatibilityConflict) => SEVERITY_ORDER.indexOf(c.severity) <= threshold,\n\t\t);\n\t\tif (failing.length > 0) {\n\t\t\tconst list = failing.map((c) => `[${c.severity}] ${c.detail}`).join(\"\\n\");\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"PACKAGE_VOCABULARY_COLLISION\",\n\t\t\t\tmessage: `Package \"${this.pkg.name}\" collides with another package:\\n${list}`,\n\t\t\t\texpected: `no conflicts at or above \"${strictness}\" severity`,\n\t\t\t\tactual: `${failing.length} conflict(s)`,\n\t\t\t});\n\t\t}\n\t\treturn report;\n\t}\n\n\t/**\n\t * Assert the package's declared `engineVersion` range is satisfied by the\n\t * running engine (or by `engineVersion` when given).\n\t *\n\t * A package that declares a range and never checks it resolves is the third\n\t * mistake the issue names: it looks fine until the one engine version it\n\t * cannot run against, where the range either fails to match or turns out to\n\t * be a malformed string. A package with no declared range passes (no\n\t * constraint is always compatible).\n\t */\n\ttoDeclareCompatibleEngineVersion(engineVersion: string = ENGINE_VERSION): this {\n\t\tconst result = checkEngineVersionCompatibility(this.pkg, engineVersion);\n\t\tif (!result.compatible) {\n\t\t\tconst detail =\n\t\t\t\tresult.reason === \"invalid-range\"\n\t\t\t\t\t? `its range \"${result.declaredRange}\" is not valid semver`\n\t\t\t\t\t: `its range \"${result.declaredRange}\" is not satisfied by engine version \"${result.engineVersion}\"`;\n\t\t\tthrow new ExpectationError({\n\t\t\t\tcode: \"PACKAGE_ENGINE_VERSION_INCOMPATIBLE\",\n\t\t\t\tmessage: `Package \"${this.pkg.name}\" declares an engineVersion that will be rejected at registration: ${detail}.`,\n\t\t\t\texpected: `an engineVersion satisfied by \"${engineVersion}\"`,\n\t\t\t\tactual: `\"${result.declaredRange}\"`,\n\t\t\t});\n\t\t}\n\t\treturn this;\n\t}\n}\n\n/**\n * Begin an assertion about a package's declared descriptor.\n *\n * @example\n * ```ts\n * expectPackage(myPackage).notToShadow([\"price\", \"in\", \"of\"]);\n * expectPackage(myPackage).notToCollideWith(BUILTIN_PACKAGES);\n * expectPackage(myPackage).toDeclareCompatibleEngineVersion();\n * ```\n */\nexport function expectPackage(pkg: IEnginePackage): PackageAssertion {\n\treturn new PackageAssertion(pkg);\n}\n\n//#endregion\n"]}
package/dist/uom.cjs CHANGED
@@ -1,56 +1,56 @@
1
1
  'use strict';
2
2
 
3
- var chunk4B2CNWQU_cjs = require('./chunk-4B2CNWQU.cjs');
4
- var chunkA2N2GFCG_cjs = require('./chunk-A2N2GFCG.cjs');
5
- require('./chunk-6KFYJ6TD.cjs');
3
+ var chunkSSV46KFA_cjs = require('./chunk-SSV46KFA.cjs');
4
+ var chunkZVTWQLK4_cjs = require('./chunk-ZVTWQLK4.cjs');
5
+ require('./chunk-XIYYHA65.cjs');
6
6
  require('./chunk-VEKIWQ3F.cjs');
7
- require('./chunk-JMXUNXQS.cjs');
8
- var chunkPFUESQTW_cjs = require('./chunk-PFUESQTW.cjs');
7
+ require('./chunk-2TZKENDH.cjs');
8
+ var chunkEJ3ILXX6_cjs = require('./chunk-EJ3ILXX6.cjs');
9
9
  require('./chunk-AMOJYLG2.cjs');
10
- require('./chunk-5KMIY374.cjs');
10
+ require('./chunk-B4HBEFTB.cjs');
11
11
  require('./chunk-B7LXJ6LC.cjs');
12
12
 
13
13
 
14
14
 
15
15
  Object.defineProperty(exports, "CurrencyAsyncResolver", {
16
16
  enumerable: true,
17
- get: function () { return chunk4B2CNWQU_cjs.CurrencyAsyncResolver; }
17
+ get: function () { return chunkSSV46KFA_cjs.CurrencyAsyncResolver; }
18
18
  });
19
19
  Object.defineProperty(exports, "CurrencyExchangeService", {
20
20
  enumerable: true,
21
- get: function () { return chunkA2N2GFCG_cjs.CurrencyExchangeService; }
21
+ get: function () { return chunkZVTWQLK4_cjs.CurrencyExchangeService; }
22
22
  });
23
23
  Object.defineProperty(exports, "currencyExchangeService", {
24
24
  enumerable: true,
25
- get: function () { return chunkA2N2GFCG_cjs.currencyExchangeService; }
25
+ get: function () { return chunkZVTWQLK4_cjs.currencyExchangeService; }
26
26
  });
27
27
  Object.defineProperty(exports, "sharedCurrencyExchange", {
28
28
  enumerable: true,
29
- get: function () { return chunkA2N2GFCG_cjs.sharedCurrencyExchange; }
29
+ get: function () { return chunkZVTWQLK4_cjs.sharedCurrencyExchange; }
30
30
  });
31
31
  Object.defineProperty(exports, "canConvert", {
32
32
  enumerable: true,
33
- get: function () { return chunkPFUESQTW_cjs.canConvert; }
33
+ get: function () { return chunkEJ3ILXX6_cjs.canConvert; }
34
34
  });
35
35
  Object.defineProperty(exports, "convertUnit", {
36
36
  enumerable: true,
37
- get: function () { return chunkPFUESQTW_cjs.convertUnit; }
37
+ get: function () { return chunkEJ3ILXX6_cjs.convertUnit; }
38
38
  });
39
39
  Object.defineProperty(exports, "getBestUnit", {
40
40
  enumerable: true,
41
- get: function () { return chunkPFUESQTW_cjs.getBestUnit; }
41
+ get: function () { return chunkEJ3ILXX6_cjs.getBestUnit; }
42
42
  });
43
43
  Object.defineProperty(exports, "getMeasure", {
44
44
  enumerable: true,
45
- get: function () { return chunkPFUESQTW_cjs.getMeasure; }
45
+ get: function () { return chunkEJ3ILXX6_cjs.getMeasure; }
46
46
  });
47
47
  Object.defineProperty(exports, "isConvertibleUnit", {
48
48
  enumerable: true,
49
- get: function () { return chunkPFUESQTW_cjs.isConvertibleUnit; }
49
+ get: function () { return chunkEJ3ILXX6_cjs.isConvertibleUnit; }
50
50
  });
51
51
  Object.defineProperty(exports, "resolveUnit", {
52
52
  enumerable: true,
53
- get: function () { return chunkPFUESQTW_cjs.resolveUnit; }
53
+ get: function () { return chunkEJ3ILXX6_cjs.resolveUnit; }
54
54
  });
55
55
  //# sourceMappingURL=uom.cjs.map
56
56
  //# sourceMappingURL=uom.cjs.map
package/dist/uom.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { QueryClient } from '@tanstack/query-core';
2
- import { T as Token } from './Token-BzG5G4ja.cjs';
3
- import { a as BytecodeProgram } from './BytecodeBuilder-B0xskcv5.cjs';
2
+ import { T as Token } from './Token-B1hdkedD.cjs';
3
+ import { a as BytecodeProgram } from './BytecodeBuilder-Bp9xeTmX.cjs';
4
4
  import { IAsyncResolver, AsyncCheckResult } from './resolvers.cjs';
5
- import './Value-CXJqDH9J.cjs';
5
+ import './Value-BUi1RA3S.cjs';
6
6
 
7
7
  /**
8
8
  * Caches exchange rates fetched from an external source.
package/dist/uom.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { QueryClient } from '@tanstack/query-core';
2
- import { T as Token } from './Token-BzG5G4ja.js';
3
- import { a as BytecodeProgram } from './BytecodeBuilder-B0xskcv5.js';
2
+ import { T as Token } from './Token-B1hdkedD.js';
3
+ import { a as BytecodeProgram } from './BytecodeBuilder-Bp9xeTmX.js';
4
4
  import { IAsyncResolver, AsyncCheckResult } from './resolvers.js';
5
- import './Value-CXJqDH9J.js';
5
+ import './Value-BUi1RA3S.js';
6
6
 
7
7
  /**
8
8
  * Caches exchange rates fetched from an external source.