solve-engine 1.2.0 → 2.1.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 (385) hide show
  1. package/README.md +12 -17
  2. package/dist/{BytecodeBuilder-Bp9xeTmX.d.cts → BytecodeBuilder-DGGeByAP.d.cts} +18 -0
  3. package/dist/{BytecodeBuilder-Bp9xeTmX.d.ts → BytecodeBuilder-DGGeByAP.d.ts} +18 -0
  4. package/dist/{Configuration-C9W8tJv_.d.cts → Configuration-B6W0-T67.d.cts} +17 -4
  5. package/dist/{Configuration-C9W8tJv_.d.ts → Configuration-B6W0-T67.d.ts} +17 -4
  6. package/dist/{EngineError-CNA_rHY-.d.cts → EngineError-Ce1lPkjZ.d.cts} +2 -0
  7. package/dist/{EngineError-CNA_rHY-.d.ts → EngineError-Ce1lPkjZ.d.ts} +2 -0
  8. package/dist/{PackageCompatibility-B6NX9IaN.d.cts → PackageCompatibility-Bn5jnBtA.d.cts} +2 -2
  9. package/dist/{PackageCompatibility-Ceg5XdAp.d.ts → PackageCompatibility-CIvq2MP5.d.ts} +2 -2
  10. package/dist/{PackageRegistry-DrCPQNyy.d.ts → PackageRegistry-DzeiWcv4.d.ts} +93 -172
  11. package/dist/{PackageRegistry-DnJYVw9G.d.cts → PackageRegistry-dpdurBVO.d.cts} +93 -172
  12. package/dist/{Parselet-Bhf7d0_W.d.ts → Parselet-B-zoPrTa.d.ts} +8 -5
  13. package/dist/{Parselet-Cv7S7KRt.d.cts → Parselet-C4Wu055_.d.cts} +8 -5
  14. package/dist/{ScopeManager-Bzq87GfA.d.ts → ScopeManager-C2LDOrDx.d.ts} +7 -16
  15. package/dist/{ScopeManager-DRDBVfan.d.cts → ScopeManager-D7uMXbhS.d.cts} +7 -16
  16. package/dist/{VMCheckpoints-C6c17Hbo.d.ts → VMCheckpoints-CGyFhivM.d.ts} +3 -3
  17. package/dist/{VMCheckpoints-dZxSMGHG.d.cts → VMCheckpoints-I9jg3jWR.d.cts} +3 -3
  18. package/dist/{Value-DZNQ_PU7.d.cts → Value-CCi_Eecs.d.cts} +40 -0
  19. package/dist/{Value-DZNQ_PU7.d.ts → Value-CCi_Eecs.d.ts} +40 -0
  20. package/dist/{WorkerError-Djd7GGGa.d.cts → WorkerError-B4p6PNfx.d.cts} +1 -1
  21. package/dist/{WorkerError-B7t7R2-m.d.ts → WorkerError-Dhj9BQ_A.d.ts} +1 -1
  22. package/dist/chunk-2JMFUQZH.js +2 -0
  23. package/dist/chunk-2JMFUQZH.js.map +1 -0
  24. package/dist/chunk-2LFLR3VZ.cjs +2 -0
  25. package/dist/chunk-2LFLR3VZ.cjs.map +1 -0
  26. package/dist/chunk-2RWAXT6O.js +0 -1
  27. package/dist/chunk-32GC2FHC.cjs +2 -0
  28. package/dist/chunk-32GC2FHC.cjs.map +1 -0
  29. package/dist/chunk-4BZIYU7S.cjs +3 -0
  30. package/dist/chunk-4BZIYU7S.cjs.map +1 -0
  31. package/dist/chunk-4E4YVQKK.js +5 -0
  32. package/dist/chunk-4E4YVQKK.js.map +1 -0
  33. package/dist/chunk-4QVBSG6B.cjs +2 -0
  34. package/dist/chunk-4QVBSG6B.cjs.map +1 -0
  35. package/dist/chunk-5FO4PDIG.js +2 -0
  36. package/dist/chunk-5FO4PDIG.js.map +1 -0
  37. package/dist/chunk-5IJD5L3O.cjs +2 -0
  38. package/dist/chunk-5IJD5L3O.cjs.map +1 -0
  39. package/dist/chunk-62LMTO4F.js +2 -0
  40. package/dist/chunk-62LMTO4F.js.map +1 -0
  41. package/dist/chunk-6G3PMEPA.js +2 -0
  42. package/dist/chunk-6G3PMEPA.js.map +1 -0
  43. package/dist/chunk-6INX773F.cjs +2 -0
  44. package/dist/chunk-6INX773F.cjs.map +1 -0
  45. package/dist/chunk-76F3LCIL.js +4 -0
  46. package/dist/chunk-76F3LCIL.js.map +1 -0
  47. package/dist/chunk-7BXPCWKM.cjs +2 -0
  48. package/dist/chunk-7BXPCWKM.cjs.map +1 -0
  49. package/dist/chunk-7GK3XEZF.js +2 -0
  50. package/dist/chunk-7GK3XEZF.js.map +1 -0
  51. package/dist/chunk-AXMQG5TS.cjs +2 -0
  52. package/dist/chunk-AXMQG5TS.cjs.map +1 -0
  53. package/dist/chunk-CIQOK7Q4.cjs +2 -0
  54. package/dist/chunk-CIQOK7Q4.cjs.map +1 -0
  55. package/dist/chunk-E2Q3PQ2G.js +3 -0
  56. package/dist/chunk-E2Q3PQ2G.js.map +1 -0
  57. package/dist/chunk-E6Z4NQAS.js +2 -0
  58. package/dist/chunk-E6Z4NQAS.js.map +1 -0
  59. package/dist/chunk-EFJCC6FJ.cjs +2 -0
  60. package/dist/chunk-EFJCC6FJ.cjs.map +1 -0
  61. package/dist/chunk-ESUN2THE.cjs +2 -0
  62. package/dist/chunk-ESUN2THE.cjs.map +1 -0
  63. package/dist/chunk-EVAOPEO4.js +2 -0
  64. package/dist/chunk-EVAOPEO4.js.map +1 -0
  65. package/dist/chunk-EVI6OHQH.cjs +2 -0
  66. package/dist/chunk-EVI6OHQH.cjs.map +1 -0
  67. package/dist/chunk-FDE5HWDI.cjs +2 -0
  68. package/dist/chunk-FDE5HWDI.cjs.map +1 -0
  69. package/dist/chunk-FWW3M36J.cjs +2 -0
  70. package/dist/chunk-FWW3M36J.cjs.map +1 -0
  71. package/dist/chunk-G7TBEQRQ.js +2 -0
  72. package/dist/chunk-G7TBEQRQ.js.map +1 -0
  73. package/dist/chunk-GK2OHWRF.cjs +5 -0
  74. package/dist/chunk-GK2OHWRF.cjs.map +1 -0
  75. package/dist/chunk-HFKDWQUL.js +2 -0
  76. package/dist/chunk-HFKDWQUL.js.map +1 -0
  77. package/dist/chunk-HLBYHXQD.cjs +3 -0
  78. package/dist/chunk-HLBYHXQD.cjs.map +1 -0
  79. package/dist/chunk-I52MYCVI.js +3 -0
  80. package/dist/chunk-I52MYCVI.js.map +1 -0
  81. package/dist/chunk-IANAMBJQ.cjs +2 -0
  82. package/dist/chunk-IANAMBJQ.cjs.map +1 -0
  83. package/dist/chunk-IJMNVBIS.js +2 -0
  84. package/dist/chunk-IJMNVBIS.js.map +1 -0
  85. package/dist/chunk-J4LZD4ZY.js +3 -0
  86. package/dist/chunk-J4LZD4ZY.js.map +1 -0
  87. package/dist/chunk-JAK3RAFA.cjs +2 -0
  88. package/dist/chunk-JAK3RAFA.cjs.map +1 -0
  89. package/dist/chunk-JFAJN3C2.cjs +2 -0
  90. package/dist/chunk-JFAJN3C2.cjs.map +1 -0
  91. package/dist/chunk-JPFCXLJV.js +2 -0
  92. package/dist/chunk-JPFCXLJV.js.map +1 -0
  93. package/dist/chunk-JUIJ6NRD.cjs +3 -0
  94. package/dist/chunk-JUIJ6NRD.cjs.map +1 -0
  95. package/dist/chunk-MIQBJGGR.js +2 -0
  96. package/dist/chunk-MIQBJGGR.js.map +1 -0
  97. package/dist/chunk-MPB7KUN5.js +3 -0
  98. package/dist/chunk-MPB7KUN5.js.map +1 -0
  99. package/dist/chunk-MSYX32PF.cjs +2 -0
  100. package/dist/chunk-MSYX32PF.cjs.map +1 -0
  101. package/dist/chunk-MVZUTETT.js +2 -0
  102. package/dist/chunk-MVZUTETT.js.map +1 -0
  103. package/dist/chunk-N7N7MPMK.cjs +2 -0
  104. package/dist/chunk-N7N7MPMK.cjs.map +1 -0
  105. package/dist/chunk-NGBBNL4K.cjs +1 -3
  106. package/dist/chunk-OVKDDTXO.cjs +3 -0
  107. package/dist/chunk-OVKDDTXO.cjs.map +1 -0
  108. package/dist/chunk-P6WPEUAJ.cjs +2 -0
  109. package/dist/chunk-P6WPEUAJ.cjs.map +1 -0
  110. package/dist/chunk-PS272DZJ.cjs +2 -0
  111. package/dist/chunk-PS272DZJ.cjs.map +1 -0
  112. package/dist/chunk-R2ENWQ76.js +2 -0
  113. package/dist/chunk-R2ENWQ76.js.map +1 -0
  114. package/dist/chunk-R2SZFJTT.cjs +2 -0
  115. package/dist/chunk-R2SZFJTT.cjs.map +1 -0
  116. package/dist/chunk-RAF57WYO.js +2 -0
  117. package/dist/chunk-RAF57WYO.js.map +1 -0
  118. package/dist/chunk-RSF25YSJ.js +2 -0
  119. package/dist/chunk-RSF25YSJ.js.map +1 -0
  120. package/dist/chunk-SOMGSIO4.cjs +3 -0
  121. package/dist/chunk-SOMGSIO4.cjs.map +1 -0
  122. package/dist/chunk-SYYE3QAX.cjs +2 -0
  123. package/dist/chunk-SYYE3QAX.cjs.map +1 -0
  124. package/dist/chunk-TCZSPH4A.js +2 -0
  125. package/dist/chunk-TCZSPH4A.js.map +1 -0
  126. package/dist/chunk-TLG7VZRX.cjs +2 -0
  127. package/dist/chunk-TLG7VZRX.cjs.map +1 -0
  128. package/dist/chunk-TN5E6JU6.js +2 -0
  129. package/dist/chunk-TN5E6JU6.js.map +1 -0
  130. package/dist/chunk-TRBXW6HW.js +2 -0
  131. package/dist/{chunk-AQNHHJMJ.cjs.map → chunk-TRBXW6HW.js.map} +1 -1
  132. package/dist/chunk-TTFO4YDP.cjs +2 -0
  133. package/dist/chunk-TTFO4YDP.cjs.map +1 -0
  134. package/dist/chunk-TWC7K3ZX.js +2 -0
  135. package/dist/chunk-TWC7K3ZX.js.map +1 -0
  136. package/dist/chunk-U4AEVL5Z.js +2 -0
  137. package/dist/chunk-U4AEVL5Z.js.map +1 -0
  138. package/dist/chunk-UURM7P3P.cjs +4 -0
  139. package/dist/chunk-UURM7P3P.cjs.map +1 -0
  140. package/dist/chunk-VAGS5JS7.cjs +2 -0
  141. package/dist/chunk-VAGS5JS7.cjs.map +1 -0
  142. package/dist/chunk-W2JAR233.js +2 -0
  143. package/dist/chunk-W2JAR233.js.map +1 -0
  144. package/dist/chunk-WGZ3FNHI.js +2 -0
  145. package/dist/chunk-WGZ3FNHI.js.map +1 -0
  146. package/dist/chunk-XEIDV5JP.js +2 -0
  147. package/dist/chunk-XEIDV5JP.js.map +1 -0
  148. package/dist/chunk-XNIWQHXY.js +2 -0
  149. package/dist/chunk-XNIWQHXY.js.map +1 -0
  150. package/dist/chunk-Y7O4D3BJ.cjs +2 -0
  151. package/dist/chunk-Y7O4D3BJ.cjs.map +1 -0
  152. package/dist/chunk-YAHGSBMC.js +2 -0
  153. package/dist/chunk-YAHGSBMC.js.map +1 -0
  154. package/dist/chunk-YAYBVVG2.js +3 -0
  155. package/dist/chunk-YAYBVVG2.js.map +1 -0
  156. package/dist/chunk-YJ2OPULK.js +2 -0
  157. package/dist/chunk-YJ2OPULK.js.map +1 -0
  158. package/dist/chunk-YVKHEAFT.js +2 -0
  159. package/dist/chunk-YVKHEAFT.js.map +1 -0
  160. package/dist/chunk-ZCNBT44X.cjs +2 -0
  161. package/dist/chunk-ZCNBT44X.cjs.map +1 -0
  162. package/dist/chunk-ZLRJ7TDP.cjs +2 -0
  163. package/dist/chunk-ZLRJ7TDP.cjs.map +1 -0
  164. package/dist/constants.cjs +1 -21
  165. package/dist/constants.d.cts +1 -1
  166. package/dist/constants.d.ts +1 -1
  167. package/dist/constants.js +1 -4
  168. package/dist/engine.cjs +1 -94
  169. package/dist/engine.d.cts +10 -11
  170. package/dist/engine.d.ts +10 -11
  171. package/dist/engine.js +1 -37
  172. package/dist/errors.cjs +1 -105
  173. package/dist/errors.d.cts +3 -3
  174. package/dist/errors.d.ts +3 -3
  175. package/dist/errors.js +1 -4
  176. package/dist/format.cjs +1 -26
  177. package/dist/format.d.cts +2 -2
  178. package/dist/format.d.ts +2 -2
  179. package/dist/format.js +1 -9
  180. package/dist/index.cjs +1 -314
  181. package/dist/index.cjs.map +1 -1
  182. package/dist/index.d.cts +52 -20
  183. package/dist/index.d.ts +52 -20
  184. package/dist/index.js +1 -278
  185. package/dist/index.js.map +1 -1
  186. package/dist/language.cjs +1 -369
  187. package/dist/language.cjs.map +1 -1
  188. package/dist/language.d.cts +9 -10
  189. package/dist/language.d.ts +9 -10
  190. package/dist/language.js +1 -348
  191. package/dist/language.js.map +1 -1
  192. package/dist/lexer.cjs +1 -63
  193. package/dist/lexer.js +1 -10
  194. package/dist/normalizer.cjs +1 -39
  195. package/dist/normalizer.js +1 -10
  196. package/dist/packages.cjs +1 -132
  197. package/dist/packages.d.cts +8 -9
  198. package/dist/packages.d.ts +8 -9
  199. package/dist/packages.js +1 -23
  200. package/dist/parser.cjs +1 -54
  201. package/dist/parser.d.cts +8 -8
  202. package/dist/parser.d.ts +8 -8
  203. package/dist/parser.js +1 -9
  204. package/dist/{pipeline-D-PS9gVw.d.ts → pipeline-72QmQlGx.d.ts} +1 -1
  205. package/dist/{pipeline-DtSBJ8TS.d.cts → pipeline-DCQicwWX.d.cts} +1 -1
  206. package/dist/resolvers.cjs +1 -12
  207. package/dist/resolvers.d.cts +2 -2
  208. package/dist/resolvers.d.ts +2 -2
  209. package/dist/resolvers.js +1 -3
  210. package/dist/services.cjs +1 -20
  211. package/dist/services.js +1 -3
  212. package/dist/testing.cjs +3 -477
  213. package/dist/testing.cjs.map +1 -1
  214. package/dist/testing.d.cts +9 -10
  215. package/dist/testing.d.ts +9 -10
  216. package/dist/testing.js +3 -469
  217. package/dist/testing.js.map +1 -1
  218. package/dist/uom.cjs +1 -55
  219. package/dist/uom.d.cts +2 -2
  220. package/dist/uom.d.ts +2 -2
  221. package/dist/uom.js +1 -10
  222. package/dist/utilities.cjs +1 -36
  223. package/dist/utilities.js +1 -7
  224. package/dist/vm.cjs +1 -295
  225. package/dist/vm.cjs.map +1 -1
  226. package/dist/vm.d.cts +22 -10
  227. package/dist/vm.d.ts +22 -10
  228. package/dist/vm.js +1 -193
  229. package/dist/vm.js.map +1 -1
  230. package/dist/worker.cjs +2 -492
  231. package/dist/worker.cjs.map +1 -1
  232. package/dist/worker.d.cts +16 -17
  233. package/dist/worker.d.ts +16 -17
  234. package/dist/worker.js +2 -483
  235. package/dist/worker.js.map +1 -1
  236. package/package.json +1 -13
  237. package/dist/chunk-3BOK2LDK.js +0 -17
  238. package/dist/chunk-3BOK2LDK.js.map +0 -1
  239. package/dist/chunk-3VGDNEE3.js +0 -84
  240. package/dist/chunk-3VGDNEE3.js.map +0 -1
  241. package/dist/chunk-4K5W7EH2.cjs +0 -112
  242. package/dist/chunk-4K5W7EH2.cjs.map +0 -1
  243. package/dist/chunk-5EFKSKMA.js +0 -413
  244. package/dist/chunk-5EFKSKMA.js.map +0 -1
  245. package/dist/chunk-5HRB36DK.js +0 -405
  246. package/dist/chunk-5HRB36DK.js.map +0 -1
  247. package/dist/chunk-5ON7PUAZ.js +0 -12
  248. package/dist/chunk-5ON7PUAZ.js.map +0 -1
  249. package/dist/chunk-7AXJNQMF.cjs +0 -297
  250. package/dist/chunk-7AXJNQMF.cjs.map +0 -1
  251. package/dist/chunk-7JM3F4KL.js +0 -1795
  252. package/dist/chunk-7JM3F4KL.js.map +0 -1
  253. package/dist/chunk-7USV76HV.cjs +0 -341
  254. package/dist/chunk-7USV76HV.cjs.map +0 -1
  255. package/dist/chunk-A2DZ5BEJ.cjs +0 -1930
  256. package/dist/chunk-A2DZ5BEJ.cjs.map +0 -1
  257. package/dist/chunk-ADBA3XBE.cjs +0 -20
  258. package/dist/chunk-ADBA3XBE.cjs.map +0 -1
  259. package/dist/chunk-AKNGX4TZ.cjs +0 -236
  260. package/dist/chunk-AKNGX4TZ.cjs.map +0 -1
  261. package/dist/chunk-ALYRJ72W.cjs +0 -434
  262. package/dist/chunk-ALYRJ72W.cjs.map +0 -1
  263. package/dist/chunk-AMOJYLG2.cjs +0 -1692
  264. package/dist/chunk-AMOJYLG2.cjs.map +0 -1
  265. package/dist/chunk-AOH6UR2L.js +0 -825
  266. package/dist/chunk-AOH6UR2L.js.map +0 -1
  267. package/dist/chunk-AQNHHJMJ.cjs +0 -261
  268. package/dist/chunk-B7LXJ6LC.cjs +0 -36
  269. package/dist/chunk-B7LXJ6LC.cjs.map +0 -1
  270. package/dist/chunk-BESTLPRK.cjs +0 -6919
  271. package/dist/chunk-BESTLPRK.cjs.map +0 -1
  272. package/dist/chunk-BLI4NIQY.js +0 -98
  273. package/dist/chunk-BLI4NIQY.js.map +0 -1
  274. package/dist/chunk-BSPXMGIS.js +0 -455
  275. package/dist/chunk-BSPXMGIS.js.map +0 -1
  276. package/dist/chunk-C2OMO3WN.cjs +0 -2806
  277. package/dist/chunk-C2OMO3WN.cjs.map +0 -1
  278. package/dist/chunk-CSDQMDU2.js +0 -204
  279. package/dist/chunk-CSDQMDU2.js.map +0 -1
  280. package/dist/chunk-EJ3ILXX6.cjs +0 -223
  281. package/dist/chunk-EJ3ILXX6.cjs.map +0 -1
  282. package/dist/chunk-ENRIK36Q.cjs +0 -94
  283. package/dist/chunk-ENRIK36Q.cjs.map +0 -1
  284. package/dist/chunk-F4UB4XIL.js +0 -109
  285. package/dist/chunk-F4UB4XIL.js.map +0 -1
  286. package/dist/chunk-FD5ZZHEU.js +0 -92
  287. package/dist/chunk-FD5ZZHEU.js.map +0 -1
  288. package/dist/chunk-FE4RC37D.js +0 -2801
  289. package/dist/chunk-FE4RC37D.js.map +0 -1
  290. package/dist/chunk-FEAIOR7N.cjs +0 -91
  291. package/dist/chunk-FEAIOR7N.cjs.map +0 -1
  292. package/dist/chunk-FR7RNOPT.cjs +0 -3303
  293. package/dist/chunk-FR7RNOPT.cjs.map +0 -1
  294. package/dist/chunk-G2YPPLGX.cjs +0 -484
  295. package/dist/chunk-G2YPPLGX.cjs.map +0 -1
  296. package/dist/chunk-GCM5JHMX.js +0 -88
  297. package/dist/chunk-GCM5JHMX.js.map +0 -1
  298. package/dist/chunk-GDEU72RG.cjs +0 -829
  299. package/dist/chunk-GDEU72RG.cjs.map +0 -1
  300. package/dist/chunk-HKTQCQ4Z.cjs +0 -8383
  301. package/dist/chunk-HKTQCQ4Z.cjs.map +0 -1
  302. package/dist/chunk-HWHU642X.cjs +0 -316
  303. package/dist/chunk-HWHU642X.cjs.map +0 -1
  304. package/dist/chunk-ICEKS6YC.cjs +0 -507
  305. package/dist/chunk-ICEKS6YC.cjs.map +0 -1
  306. package/dist/chunk-IJGOFP2J.js +0 -6904
  307. package/dist/chunk-IJGOFP2J.js.map +0 -1
  308. package/dist/chunk-IQJGDZOP.js +0 -333
  309. package/dist/chunk-IQJGDZOP.js.map +0 -1
  310. package/dist/chunk-IT74O4BE.cjs +0 -456
  311. package/dist/chunk-IT74O4BE.cjs.map +0 -1
  312. package/dist/chunk-KXDQKVNX.cjs +0 -459
  313. package/dist/chunk-KXDQKVNX.cjs.map +0 -1
  314. package/dist/chunk-L2TE7PMO.cjs +0 -14
  315. package/dist/chunk-L2TE7PMO.cjs.map +0 -1
  316. package/dist/chunk-L5YHV6BQ.js +0 -499
  317. package/dist/chunk-L5YHV6BQ.js.map +0 -1
  318. package/dist/chunk-LO7HU5WB.cjs +0 -209
  319. package/dist/chunk-LO7HU5WB.cjs.map +0 -1
  320. package/dist/chunk-LSALB3IN.js +0 -292
  321. package/dist/chunk-LSALB3IN.js.map +0 -1
  322. package/dist/chunk-MI7OTUHL.cjs +0 -339
  323. package/dist/chunk-MI7OTUHL.cjs.map +0 -1
  324. package/dist/chunk-MIGXCBXT.cjs +0 -381
  325. package/dist/chunk-MIGXCBXT.cjs.map +0 -1
  326. package/dist/chunk-MVTOCRV2.js +0 -213
  327. package/dist/chunk-MVTOCRV2.js.map +0 -1
  328. package/dist/chunk-N7FNVFXW.cjs +0 -32
  329. package/dist/chunk-N7FNVFXW.cjs.map +0 -1
  330. package/dist/chunk-N7OA4WPJ.js +0 -362
  331. package/dist/chunk-N7OA4WPJ.js.map +0 -1
  332. package/dist/chunk-NAWZATKT.js +0 -478
  333. package/dist/chunk-NAWZATKT.js.map +0 -1
  334. package/dist/chunk-NLNDMWZC.js +0 -31
  335. package/dist/chunk-NLNDMWZC.js.map +0 -1
  336. package/dist/chunk-ORM7CHYZ.js +0 -1531
  337. package/dist/chunk-ORM7CHYZ.js.map +0 -1
  338. package/dist/chunk-OUHT5Z36.cjs +0 -393
  339. package/dist/chunk-OUHT5Z36.cjs.map +0 -1
  340. package/dist/chunk-PCZVMMWU.cjs +0 -74
  341. package/dist/chunk-PCZVMMWU.cjs.map +0 -1
  342. package/dist/chunk-RNKDIXDV.js +0 -336
  343. package/dist/chunk-RNKDIXDV.js.map +0 -1
  344. package/dist/chunk-SBUFNJVE.js +0 -258
  345. package/dist/chunk-SBUFNJVE.js.map +0 -1
  346. package/dist/chunk-TC6BTUSU.cjs +0 -1799
  347. package/dist/chunk-TC6BTUSU.cjs.map +0 -1
  348. package/dist/chunk-TPOK3UNI.js +0 -8355
  349. package/dist/chunk-TPOK3UNI.js.map +0 -1
  350. package/dist/chunk-UF6JG5SG.js +0 -312
  351. package/dist/chunk-UF6JG5SG.js.map +0 -1
  352. package/dist/chunk-UKQHXPGW.js +0 -30
  353. package/dist/chunk-UKQHXPGW.js.map +0 -1
  354. package/dist/chunk-V4XG5QF6.js +0 -1685
  355. package/dist/chunk-V4XG5QF6.js.map +0 -1
  356. package/dist/chunk-VEKIWQ3F.cjs +0 -39
  357. package/dist/chunk-VEKIWQ3F.cjs.map +0 -1
  358. package/dist/chunk-WMQRJTAO.js +0 -3266
  359. package/dist/chunk-WMQRJTAO.js.map +0 -1
  360. package/dist/chunk-X6K3HUOY.cjs +0 -86
  361. package/dist/chunk-X6K3HUOY.cjs.map +0 -1
  362. package/dist/chunk-XBTEO4OB.js +0 -391
  363. package/dist/chunk-XBTEO4OB.js.map +0 -1
  364. package/dist/chunk-XIYYHA65.cjs +0 -101
  365. package/dist/chunk-XIYYHA65.cjs.map +0 -1
  366. package/dist/chunk-YJHY7CMN.cjs +0 -1534
  367. package/dist/chunk-YJHY7CMN.cjs.map +0 -1
  368. package/dist/chunk-YLJ4XMA6.js +0 -33
  369. package/dist/chunk-YLJ4XMA6.js.map +0 -1
  370. package/dist/chunk-YNIWOYW6.js +0 -232
  371. package/dist/chunk-YNIWOYW6.js.map +0 -1
  372. package/dist/chunk-Z2XP767T.cjs +0 -35
  373. package/dist/chunk-Z2XP767T.cjs.map +0 -1
  374. package/dist/chunk-Z4X2RWOF.js +0 -37
  375. package/dist/chunk-Z4X2RWOF.js.map +0 -1
  376. package/dist/chunk-ZN6YYPIW.js +0 -67
  377. package/dist/chunk-ZN6YYPIW.js.map +0 -1
  378. package/dist/chunk-ZNFFTYWH.js +0 -1854
  379. package/dist/chunk-ZNFFTYWH.js.map +0 -1
  380. package/dist/variables.cjs +0 -17
  381. package/dist/variables.cjs.map +0 -1
  382. package/dist/variables.d.cts +0 -87
  383. package/dist/variables.d.ts +0 -87
  384. package/dist/variables.js +0 -4
  385. package/dist/variables.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/testing/index.ts"],"names":["ExpressionEngine","BUILTIN_PACKAGES","Value","EngineError","checkPackageCompatibility","ENGINE_VERSION","checkEngineVersionCompatibility"],"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,iBACf,QAAA,GAA6B,EAAC,EAC9B,OAAA,GAA6B,EAAC,EACX;AACnB,EAAA,MAAM,EAAE,MAAA,GAAS,IAAA,EAAM,eAAA,GAAkB,MAAK,GAAI,OAAA;AAKlD,EAAA,MAAM,MAAA,GAAS,IAAIA,kCAAA,CAAiB,MAAA,EAAQ,KAAA,EAAO,QAAW,MAAA,EAAW,eAAA,GAAkBC,kCAAA,GAAmB,EAAE,CAAA;AAChH,EAAA,KAAA,MAAW,OAAO,QAAA,EAAU;AAC3B,IAAA,MAAA,CAAO,gBAAgB,GAAG,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AA,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.cjs","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"]}
1
+ {"version":3,"sources":["../src/testing/index.ts"],"names":["ExpectationError","_ExpectationError","init","createTestEngine","packages","options","locale","includeBuiltins","engine","ExpressionEngine","BUILTIN_PACKAGES","pkg","evaluate","expression","value","error","EngineError","message","Value","numbersEqual","a","b","epsilon","describeValue","describeOutcome","outcome","ExpressionAssertion","expected","unit","describeExpected","matches","valueToComparableString","code","base","expectExpression","COMMON_PROSE_WORDS","SEVERITY_ORDER","claimedWords","claimed","vocab","word","tokenType","phrase","PackageAssertion","words","prose","w","shadowed","c","list","s","others","strictness","report","checkPackageCompatibility","threshold","failing","engineVersion","ENGINE_VERSION","result","checkEngineVersionCompatibility","detail","expectPackage"],"mappings":"2pCA8DO,IAAMA,CAAAA,CAAN,MAAMC,CAAAA,SAAyB,KAAM,CAQ3C,WAAA,CAAYC,CAAAA,CAA6E,CACxF,KAAA,CAAMA,CAAAA,CAAK,OAAO,CAAA,CAClB,IAAA,CAAK,IAAA,CAAO,kBAAA,CACZ,IAAA,CAAK,IAAA,CAAOA,CAAAA,CAAK,IAAA,CACjB,IAAA,CAAK,QAAA,CAAWA,CAAAA,CAAK,QAAA,CACrB,IAAA,CAAK,MAAA,CAASA,CAAAA,CAAK,MAAA,CAGnB,MAAA,CAAO,eAAe,IAAA,CAAMD,CAAAA,CAAiB,SAAS,EACvD,CACD,EAyCO,SAASE,CAAAA,CACfC,CAAAA,CAA6B,EAAC,CAC9BC,CAAAA,CAA6B,EAAC,CACX,CACnB,GAAM,CAAE,MAAA,CAAAC,CAAAA,CAAS,IAAA,CAAM,eAAA,CAAAC,CAAAA,CAAkB,IAAK,CAAA,CAAIF,CAAAA,CAK5CG,CAAAA,CAAS,IAAIC,mBAAAA,CAAiB,CAAE,MAAA,CAAAH,CAAAA,CAAQ,QAAA,CAAUC,EAAkBG,mBAAAA,CAAmB,EAAG,CAAC,CAAA,CACjG,IAAA,IAAWC,CAAAA,IAAOP,CAAAA,CACjBI,CAAAA,CAAO,eAAA,CAAgBG,CAAG,CAAA,CAE3B,OAAOH,CACR,CAwBA,SAASI,CAAAA,CAASJ,CAAAA,CAA0BK,CAAAA,CAA6B,CACxE,GA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CAAA,CAAA,CAC3E,QAAA,CAAU,6BAA6BG,CAAU,CAAA,UAAA,CAAA,CACjD,OAAQ,CAAA,EAAGI,CAAAA,CAAQ,MAAM,CAAA,YAAA,CAC1B,CAAC,CACF,CACA,OAAOH,CACR,CAYA,iCAAiCI,CAAAA,CAAwBC,mBAAAA,CAAsB,CAC9E,IAAMC,EAASC,mBAAAA,CAAgC,IAAA,CAAK,IAAKH,CAAa,CAAA,CACtE,GAAI,CAACE,CAAAA,CAAO,WAAY,CACvB,IAAME,EACLF,CAAAA,CAAO,MAAA,GAAW,gBACf,CAAA,WAAA,EAAcA,CAAAA,CAAO,aAAa,CAAA,qBAAA,CAAA,CAClC,CAAA,WAAA,EAAcA,CAAAA,CAAO,aAAa,yCAAyCA,CAAAA,CAAO,aAAa,IACnG,MAAM,IAAI3D,EAAiB,CAC1B,IAAA,CAAM,sCACN,OAAA,CAAS,CAAA,SAAA,EAAY,KAAK,GAAA,CAAI,IAAI,sEAAsE6D,CAAM,CAAA,CAAA,CAAA,CAC9G,SAAU,CAAA,+BAAA,EAAkCJ,CAAa,CAAA,CAAA,CAAA,CACzD,MAAA,CAAQ,IAAIE,CAAAA,CAAO,aAAa,GACjC,CAAC,CACF,CACA,OAAO,IACR,CACD,EAYO,SAASG,EAAcnD,CAAAA,CAAuC,CACpE,OAAO,IAAIgC,CAAAA,CAAiBhC,CAAG,CAChC","file":"testing.cjs","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, packages: 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.isError()) {\n\t\t\treturn {\n\t\t\t\tstatus: \"error\",\n\t\t\t\tcode: value.errorCode ?? \"\",\n\t\t\t\tmessage: value.errorMessage ?? \"\",\n\t\t\t\tsource: value,\n\t\t\t};\n\t\t}\n\t\tif (value.isPending()) {\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"]}
@@ -1,18 +1,17 @@
1
- import { I as IEnginePackage, E as ExpressionEngine } from './PackageRegistry-DnJYVw9G.cjs';
2
- import { V as Value } from './Value-DZNQ_PU7.cjs';
3
- import { E as EngineError } from './EngineError-CNA_rHY-.cjs';
4
- import { C as CompatibilityReport } from './PackageCompatibility-B6NX9IaN.cjs';
5
- import './Parselet-Cv7S7KRt.cjs';
6
- import './BytecodeBuilder-Bp9xeTmX.cjs';
1
+ import { I as IEnginePackage, E as ExpressionEngine } from './PackageRegistry-dpdurBVO.cjs';
2
+ import { V as Value } from './Value-CCi_Eecs.cjs';
3
+ import { E as EngineError } from './EngineError-Ce1lPkjZ.cjs';
4
+ import { C as CompatibilityReport } from './PackageCompatibility-Bn5jnBtA.cjs';
5
+ import './Parselet-C4Wu055_.cjs';
6
+ import './BytecodeBuilder-DGGeByAP.cjs';
7
7
  import './Token-CbP_OutD.cjs';
8
- import './pipeline-DtSBJ8TS.cjs';
9
- import './variables.cjs';
8
+ import './pipeline-DCQicwWX.cjs';
10
9
  import './Lexer-B4C1qHXu.cjs';
11
10
  import './resolvers.cjs';
12
11
  import '@tanstack/query-core';
13
12
  import './TokenNormalizer-DnlL7_8c.cjs';
14
- import './ScopeManager-DRDBVfan.cjs';
15
- import './Configuration-C9W8tJv_.cjs';
13
+ import './ScopeManager-D7uMXbhS.cjs';
14
+ import './Configuration-B6W0-T67.cjs';
16
15
 
17
16
  /**
18
17
  * A test kit for package authors, the supported way to test a package by the
package/dist/testing.d.ts CHANGED
@@ -1,18 +1,17 @@
1
- import { I as IEnginePackage, E as ExpressionEngine } from './PackageRegistry-DrCPQNyy.js';
2
- import { V as Value } from './Value-DZNQ_PU7.js';
3
- import { E as EngineError } from './EngineError-CNA_rHY-.js';
4
- import { C as CompatibilityReport } from './PackageCompatibility-Ceg5XdAp.js';
5
- import './Parselet-Bhf7d0_W.js';
6
- import './BytecodeBuilder-Bp9xeTmX.js';
1
+ import { I as IEnginePackage, E as ExpressionEngine } from './PackageRegistry-DzeiWcv4.js';
2
+ import { V as Value } from './Value-CCi_Eecs.js';
3
+ import { E as EngineError } from './EngineError-Ce1lPkjZ.js';
4
+ import { C as CompatibilityReport } from './PackageCompatibility-CIvq2MP5.js';
5
+ import './Parselet-B-zoPrTa.js';
6
+ import './BytecodeBuilder-DGGeByAP.js';
7
7
  import './Token-CbP_OutD.js';
8
- import './pipeline-D-PS9gVw.js';
9
- import './variables.js';
8
+ import './pipeline-72QmQlGx.js';
10
9
  import './Lexer-DKMlj7Sy.js';
11
10
  import './resolvers.js';
12
11
  import '@tanstack/query-core';
13
12
  import './TokenNormalizer-DCWdZjGz.js';
14
- import './ScopeManager-Bzq87GfA.js';
15
- import './Configuration-C9W8tJv_.js';
13
+ import './ScopeManager-C2LDOrDx.js';
14
+ import './Configuration-B6W0-T67.js';
16
15
 
17
16
  /**
18
17
  * A test kit for package authors, the supported way to test a package by the