solve-engine 1.1.1 → 2.0.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.
- package/README.md +12 -17
- package/dist/{BytecodeBuilder-Bp9xeTmX.d.cts → BytecodeBuilder-DGGeByAP.d.cts} +18 -0
- package/dist/{BytecodeBuilder-Bp9xeTmX.d.ts → BytecodeBuilder-DGGeByAP.d.ts} +18 -0
- package/dist/{Configuration-C9W8tJv_.d.cts → Configuration-B6W0-T67.d.cts} +17 -4
- package/dist/{Configuration-C9W8tJv_.d.ts → Configuration-B6W0-T67.d.ts} +17 -4
- package/dist/{EngineError-B61GS1jp.d.cts → EngineError-Ce1lPkjZ.d.cts} +8 -0
- package/dist/{EngineError-B61GS1jp.d.ts → EngineError-Ce1lPkjZ.d.ts} +8 -0
- package/dist/{Lexer-BOs7euZe.d.cts → Lexer-B4C1qHXu.d.cts} +1 -1
- package/dist/{Lexer-CSI_lwbW.d.ts → Lexer-DKMlj7Sy.d.ts} +1 -1
- package/dist/{PackageCompatibility-B-7rK1TD.d.cts → PackageCompatibility-Bn5jnBtA.d.cts} +2 -2
- package/dist/{PackageCompatibility-Dh59eF-X.d.ts → PackageCompatibility-CIvq2MP5.d.ts} +2 -2
- package/dist/{PackageRegistry-_8rDlvxI.d.ts → PackageRegistry-DzeiWcv4.d.ts} +143 -175
- package/dist/{PackageRegistry-BHWJP83F.d.cts → PackageRegistry-dpdurBVO.d.cts} +143 -175
- package/dist/{Parselet-BBT8riYh.d.ts → Parselet-B-zoPrTa.d.ts} +9 -6
- package/dist/{Parselet-BHcgK9S7.d.cts → Parselet-C4Wu055_.d.cts} +9 -6
- package/dist/{ScopeManager-CxA24W5n.d.ts → ScopeManager-C2LDOrDx.d.ts} +14 -16
- package/dist/{ScopeManager-8vf02dwj.d.cts → ScopeManager-D7uMXbhS.d.cts} +14 -16
- package/dist/{Token-B1hdkedD.d.cts → Token-CbP_OutD.d.cts} +9 -0
- package/dist/{Token-B1hdkedD.d.ts → Token-CbP_OutD.d.ts} +9 -0
- package/dist/{TokenNormalizer-C6VzZgHa.d.ts → TokenNormalizer-DCWdZjGz.d.ts} +1 -1
- package/dist/{TokenNormalizer-DRc1Js1V.d.cts → TokenNormalizer-DnlL7_8c.d.cts} +1 -1
- package/dist/{VMCheckpoints-MK--EBH2.d.ts → VMCheckpoints-CGyFhivM.d.ts} +3 -3
- package/dist/{VMCheckpoints-ELYqITdF.d.cts → VMCheckpoints-I9jg3jWR.d.cts} +3 -3
- package/dist/{Value-BUi1RA3S.d.cts → Value-CCi_Eecs.d.cts} +72 -5
- package/dist/{Value-BUi1RA3S.d.ts → Value-CCi_Eecs.d.ts} +72 -5
- package/dist/{WorkerError-gzmaopj2.d.cts → WorkerError-B4p6PNfx.d.cts} +1 -1
- package/dist/{WorkerError-_-RkoQ5P.d.ts → WorkerError-Dhj9BQ_A.d.ts} +1 -1
- package/dist/chunk-2JMFUQZH.js +2 -0
- package/dist/chunk-2JMFUQZH.js.map +1 -0
- package/dist/chunk-2RWAXT6O.js +0 -1
- package/dist/chunk-4BZIYU7S.cjs +3 -0
- package/dist/chunk-4BZIYU7S.cjs.map +1 -0
- package/dist/chunk-4J7XZSZJ.cjs +5 -0
- package/dist/chunk-4J7XZSZJ.cjs.map +1 -0
- package/dist/chunk-4QVBSG6B.cjs +2 -0
- package/dist/chunk-4QVBSG6B.cjs.map +1 -0
- package/dist/chunk-5IJD5L3O.cjs +2 -0
- package/dist/chunk-5IJD5L3O.cjs.map +1 -0
- package/dist/chunk-62LMTO4F.js +2 -0
- package/dist/chunk-62LMTO4F.js.map +1 -0
- package/dist/chunk-6CY44ZPG.js +2 -0
- package/dist/chunk-6CY44ZPG.js.map +1 -0
- package/dist/chunk-6G3PMEPA.js +2 -0
- package/dist/chunk-6G3PMEPA.js.map +1 -0
- package/dist/chunk-6INX773F.cjs +2 -0
- package/dist/chunk-6INX773F.cjs.map +1 -0
- package/dist/chunk-6KFVG6UY.cjs +2 -0
- package/dist/chunk-6KFVG6UY.cjs.map +1 -0
- package/dist/chunk-76F3LCIL.js +4 -0
- package/dist/chunk-76F3LCIL.js.map +1 -0
- package/dist/chunk-7GK3XEZF.js +2 -0
- package/dist/chunk-7GK3XEZF.js.map +1 -0
- package/dist/chunk-APN442VD.cjs +2 -0
- package/dist/chunk-APN442VD.cjs.map +1 -0
- package/dist/chunk-AXMQG5TS.cjs +2 -0
- package/dist/chunk-AXMQG5TS.cjs.map +1 -0
- package/dist/chunk-CIQOK7Q4.cjs +2 -0
- package/dist/chunk-CIQOK7Q4.cjs.map +1 -0
- package/dist/chunk-E6Z4NQAS.js +2 -0
- package/dist/chunk-E6Z4NQAS.js.map +1 -0
- package/dist/chunk-EFJCC6FJ.cjs +2 -0
- package/dist/chunk-EFJCC6FJ.cjs.map +1 -0
- package/dist/chunk-ESUN2THE.cjs +2 -0
- package/dist/chunk-ESUN2THE.cjs.map +1 -0
- package/dist/chunk-EVAOPEO4.js +2 -0
- package/dist/chunk-EVAOPEO4.js.map +1 -0
- package/dist/chunk-EYRBENHC.js +3 -0
- package/dist/chunk-EYRBENHC.js.map +1 -0
- package/dist/chunk-FDE5HWDI.cjs +2 -0
- package/dist/chunk-FDE5HWDI.cjs.map +1 -0
- package/dist/chunk-FWW3M36J.cjs +2 -0
- package/dist/chunk-FWW3M36J.cjs.map +1 -0
- package/dist/chunk-GOIQYUWV.js +2 -0
- package/dist/chunk-GOIQYUWV.js.map +1 -0
- package/dist/chunk-HFKDWQUL.js +2 -0
- package/dist/chunk-HFKDWQUL.js.map +1 -0
- package/dist/chunk-HLBYHXQD.cjs +3 -0
- package/dist/chunk-HLBYHXQD.cjs.map +1 -0
- package/dist/chunk-IANAMBJQ.cjs +2 -0
- package/dist/chunk-IANAMBJQ.cjs.map +1 -0
- package/dist/chunk-IJMNVBIS.js +2 -0
- package/dist/chunk-IJMNVBIS.js.map +1 -0
- package/dist/chunk-J4LZD4ZY.js +3 -0
- package/dist/chunk-J4LZD4ZY.js.map +1 -0
- package/dist/chunk-JAK3RAFA.cjs +2 -0
- package/dist/chunk-JAK3RAFA.cjs.map +1 -0
- package/dist/chunk-JFAJN3C2.cjs +2 -0
- package/dist/chunk-JFAJN3C2.cjs.map +1 -0
- package/dist/chunk-JPFCXLJV.js +2 -0
- package/dist/chunk-JPFCXLJV.js.map +1 -0
- package/dist/chunk-JSPKKNPQ.js +3 -0
- package/dist/chunk-JSPKKNPQ.js.map +1 -0
- package/dist/chunk-L3FPQSGN.js +2 -0
- package/dist/chunk-L3FPQSGN.js.map +1 -0
- package/dist/chunk-LR4E4A4W.cjs +2 -0
- package/dist/chunk-LR4E4A4W.cjs.map +1 -0
- package/dist/chunk-MIQBJGGR.js +2 -0
- package/dist/chunk-MIQBJGGR.js.map +1 -0
- package/dist/chunk-MPB7KUN5.js +3 -0
- package/dist/chunk-MPB7KUN5.js.map +1 -0
- package/dist/chunk-MSYX32PF.cjs +2 -0
- package/dist/chunk-MSYX32PF.cjs.map +1 -0
- package/dist/chunk-MVZUTETT.js +2 -0
- package/dist/chunk-MVZUTETT.js.map +1 -0
- package/dist/chunk-N7N7MPMK.cjs +2 -0
- package/dist/chunk-N7N7MPMK.cjs.map +1 -0
- package/dist/chunk-NGBBNL4K.cjs +1 -3
- package/dist/chunk-P6WPEUAJ.cjs +2 -0
- package/dist/chunk-P6WPEUAJ.cjs.map +1 -0
- package/dist/chunk-PS272DZJ.cjs +2 -0
- package/dist/chunk-PS272DZJ.cjs.map +1 -0
- package/dist/chunk-QXQE7X4S.js +2 -0
- package/dist/chunk-QXQE7X4S.js.map +1 -0
- package/dist/chunk-R2ENWQ76.js +2 -0
- package/dist/chunk-R2ENWQ76.js.map +1 -0
- package/dist/chunk-R2SZFJTT.cjs +2 -0
- package/dist/chunk-R2SZFJTT.cjs.map +1 -0
- package/dist/chunk-RAF57WYO.js +2 -0
- package/dist/chunk-RAF57WYO.js.map +1 -0
- package/dist/chunk-RSF25YSJ.js +2 -0
- package/dist/chunk-RSF25YSJ.js.map +1 -0
- package/dist/chunk-SOMGSIO4.cjs +3 -0
- package/dist/chunk-SOMGSIO4.cjs.map +1 -0
- package/dist/chunk-SUXRZWH2.cjs +3 -0
- package/dist/chunk-SUXRZWH2.cjs.map +1 -0
- package/dist/chunk-SYYE3QAX.cjs +2 -0
- package/dist/chunk-SYYE3QAX.cjs.map +1 -0
- package/dist/chunk-SZGK6RIP.cjs +2 -0
- package/dist/chunk-SZGK6RIP.cjs.map +1 -0
- package/dist/chunk-TCZSPH4A.js +2 -0
- package/dist/chunk-TCZSPH4A.js.map +1 -0
- package/dist/chunk-TLG7VZRX.cjs +2 -0
- package/dist/chunk-TLG7VZRX.cjs.map +1 -0
- package/dist/chunk-TRBXW6HW.js +2 -0
- package/dist/{chunk-AQNHHJMJ.cjs.map → chunk-TRBXW6HW.js.map} +1 -1
- package/dist/chunk-TTFO4YDP.cjs +2 -0
- package/dist/chunk-TTFO4YDP.cjs.map +1 -0
- package/dist/chunk-TWC7K3ZX.js +2 -0
- package/dist/chunk-TWC7K3ZX.js.map +1 -0
- package/dist/chunk-UDQ57ZRX.cjs +2 -0
- package/dist/chunk-UDQ57ZRX.cjs.map +1 -0
- package/dist/chunk-UI6IFGBT.js +2 -0
- package/dist/chunk-UI6IFGBT.js.map +1 -0
- package/dist/chunk-UURM7P3P.cjs +4 -0
- package/dist/chunk-UURM7P3P.cjs.map +1 -0
- package/dist/chunk-W2JAR233.js +2 -0
- package/dist/chunk-W2JAR233.js.map +1 -0
- package/dist/chunk-WGZ3FNHI.js +2 -0
- package/dist/chunk-WGZ3FNHI.js.map +1 -0
- package/dist/chunk-WN5CMP4T.cjs +3 -0
- package/dist/chunk-WN5CMP4T.cjs.map +1 -0
- package/dist/chunk-XEIDV5JP.js +2 -0
- package/dist/chunk-XEIDV5JP.js.map +1 -0
- package/dist/chunk-XNIWQHXY.js +2 -0
- package/dist/chunk-XNIWQHXY.js.map +1 -0
- package/dist/chunk-XR7HEC7B.js +5 -0
- package/dist/chunk-XR7HEC7B.js.map +1 -0
- package/dist/chunk-Y7O4D3BJ.cjs +2 -0
- package/dist/chunk-Y7O4D3BJ.cjs.map +1 -0
- package/dist/chunk-YAYBVVG2.js +3 -0
- package/dist/chunk-YAYBVVG2.js.map +1 -0
- package/dist/chunk-YJ2OPULK.js +2 -0
- package/dist/chunk-YJ2OPULK.js.map +1 -0
- package/dist/chunk-YVKHEAFT.js +2 -0
- package/dist/chunk-YVKHEAFT.js.map +1 -0
- package/dist/chunk-ZCNBT44X.cjs +2 -0
- package/dist/chunk-ZCNBT44X.cjs.map +1 -0
- package/dist/chunk-ZLRJ7TDP.cjs +2 -0
- package/dist/chunk-ZLRJ7TDP.cjs.map +1 -0
- package/dist/constants.cjs +1 -21
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -4
- package/dist/engine.cjs +1 -94
- package/dist/engine.d.cts +29 -14
- package/dist/engine.d.ts +29 -14
- package/dist/engine.js +1 -37
- package/dist/errors.cjs +1 -105
- package/dist/errors.d.cts +3 -3
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +1 -4
- package/dist/format.cjs +1 -26
- package/dist/format.d.cts +2 -2
- package/dist/format.d.ts +2 -2
- package/dist/format.js +1 -9
- package/dist/index.cjs +1 -314
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -23
- package/dist/index.d.ts +55 -23
- package/dist/index.js +1 -278
- package/dist/index.js.map +1 -1
- package/dist/language.cjs +1 -369
- package/dist/language.cjs.map +1 -1
- package/dist/language.d.cts +12 -13
- package/dist/language.d.ts +12 -13
- package/dist/language.js +1 -348
- package/dist/language.js.map +1 -1
- package/dist/lexer.cjs +1 -63
- package/dist/lexer.d.cts +3 -3
- package/dist/lexer.d.ts +3 -3
- package/dist/lexer.js +1 -10
- package/dist/normalizer.cjs +1 -39
- package/dist/normalizer.d.cts +3 -3
- package/dist/normalizer.d.ts +3 -3
- package/dist/normalizer.js +1 -10
- package/dist/packages.cjs +1 -128
- package/dist/packages.d.cts +39 -14
- package/dist/packages.d.ts +39 -14
- package/dist/packages.js +1 -23
- package/dist/parser.cjs +1 -54
- package/dist/parser.d.cts +9 -9
- package/dist/parser.d.ts +9 -9
- package/dist/parser.js +1 -9
- package/dist/{pipeline-CtfJtPQc.d.cts → pipeline-72QmQlGx.d.ts} +3 -3
- package/dist/{pipeline-DCd5M6Gk.d.ts → pipeline-DCQicwWX.d.cts} +3 -3
- package/dist/resolvers.cjs +1 -12
- package/dist/resolvers.d.cts +3 -3
- package/dist/resolvers.d.ts +3 -3
- package/dist/resolvers.js +1 -3
- package/dist/services.cjs +1 -20
- package/dist/services.js +1 -3
- package/dist/testing.cjs +3 -477
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +12 -13
- package/dist/testing.d.ts +12 -13
- package/dist/testing.js +3 -469
- package/dist/testing.js.map +1 -1
- package/dist/uom.cjs +1 -55
- package/dist/uom.d.cts +3 -3
- package/dist/uom.d.ts +3 -3
- package/dist/uom.js +1 -10
- package/dist/utilities.cjs +1 -36
- package/dist/utilities.js +1 -7
- package/dist/vm.cjs +1 -295
- package/dist/vm.cjs.map +1 -1
- package/dist/vm.d.cts +22 -10
- package/dist/vm.d.ts +22 -10
- package/dist/vm.js +1 -193
- package/dist/vm.js.map +1 -1
- package/dist/worker.cjs +2 -492
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +19 -20
- package/dist/worker.d.ts +19 -20
- package/dist/worker.js +2 -483
- package/dist/worker.js.map +1 -1
- package/package.json +1 -13
- package/dist/chunk-267JPOTF.js +0 -406
- package/dist/chunk-267JPOTF.js.map +0 -1
- package/dist/chunk-2TZKENDH.cjs +0 -448
- package/dist/chunk-2TZKENDH.cjs.map +0 -1
- package/dist/chunk-3BOK2LDK.js +0 -17
- package/dist/chunk-3BOK2LDK.js.map +0 -1
- package/dist/chunk-3OWCDIPN.js +0 -215
- package/dist/chunk-3OWCDIPN.js.map +0 -1
- package/dist/chunk-3VGDNEE3.js +0 -84
- package/dist/chunk-3VGDNEE3.js.map +0 -1
- package/dist/chunk-4D6NIHE2.js +0 -451
- package/dist/chunk-4D6NIHE2.js.map +0 -1
- package/dist/chunk-4HQKTMWG.js +0 -7985
- package/dist/chunk-4HQKTMWG.js.map +0 -1
- package/dist/chunk-536WPM2V.cjs +0 -283
- package/dist/chunk-536WPM2V.cjs.map +0 -1
- package/dist/chunk-5HRB36DK.js +0 -405
- package/dist/chunk-5HRB36DK.js.map +0 -1
- package/dist/chunk-5ON7PUAZ.js +0 -12
- package/dist/chunk-5ON7PUAZ.js.map +0 -1
- package/dist/chunk-7KYSUDQO.js +0 -109
- package/dist/chunk-7KYSUDQO.js.map +0 -1
- package/dist/chunk-7ZX6B7SY.cjs +0 -3222
- package/dist/chunk-7ZX6B7SY.cjs.map +0 -1
- package/dist/chunk-ADBA3XBE.cjs +0 -20
- package/dist/chunk-ADBA3XBE.cjs.map +0 -1
- package/dist/chunk-ALYRJ72W.cjs +0 -434
- package/dist/chunk-ALYRJ72W.cjs.map +0 -1
- package/dist/chunk-AMOJYLG2.cjs +0 -1692
- package/dist/chunk-AMOJYLG2.cjs.map +0 -1
- package/dist/chunk-AQNHHJMJ.cjs +0 -261
- package/dist/chunk-B4HBEFTB.cjs +0 -375
- package/dist/chunk-B4HBEFTB.cjs.map +0 -1
- package/dist/chunk-B7LXJ6LC.cjs +0 -36
- package/dist/chunk-B7LXJ6LC.cjs.map +0 -1
- package/dist/chunk-B7NLZMQ3.cjs +0 -74
- package/dist/chunk-B7NLZMQ3.cjs.map +0 -1
- package/dist/chunk-BLI4NIQY.js +0 -98
- package/dist/chunk-BLI4NIQY.js.map +0 -1
- package/dist/chunk-BYJBUL7U.js +0 -499
- package/dist/chunk-BYJBUL7U.js.map +0 -1
- package/dist/chunk-CCBZZQAE.js +0 -312
- package/dist/chunk-CCBZZQAE.js.map +0 -1
- package/dist/chunk-CKQMXMHR.cjs +0 -219
- package/dist/chunk-CKQMXMHR.cjs.map +0 -1
- package/dist/chunk-CUR2WLI4.cjs +0 -507
- package/dist/chunk-CUR2WLI4.cjs.map +0 -1
- package/dist/chunk-DLEBSLF4.js +0 -336
- package/dist/chunk-DLEBSLF4.js.map +0 -1
- package/dist/chunk-E23GZEWL.cjs +0 -209
- package/dist/chunk-E23GZEWL.cjs.map +0 -1
- package/dist/chunk-EJ3ILXX6.cjs +0 -223
- package/dist/chunk-EJ3ILXX6.cjs.map +0 -1
- package/dist/chunk-ENKKJYD3.js +0 -333
- package/dist/chunk-ENKKJYD3.js.map +0 -1
- package/dist/chunk-ENRIK36Q.cjs +0 -94
- package/dist/chunk-ENRIK36Q.cjs.map +0 -1
- package/dist/chunk-ERCOHGXD.js +0 -356
- package/dist/chunk-ERCOHGXD.js.map +0 -1
- package/dist/chunk-FD5ZZHEU.js +0 -92
- package/dist/chunk-FD5ZZHEU.js.map +0 -1
- package/dist/chunk-FEAIOR7N.cjs +0 -91
- package/dist/chunk-FEAIOR7N.cjs.map +0 -1
- package/dist/chunk-GCM5JHMX.js +0 -88
- package/dist/chunk-GCM5JHMX.js.map +0 -1
- package/dist/chunk-GLA4JXBO.js +0 -204
- package/dist/chunk-GLA4JXBO.js.map +0 -1
- package/dist/chunk-HIQ5HSZL.cjs +0 -1923
- package/dist/chunk-HIQ5HSZL.cjs.map +0 -1
- package/dist/chunk-HVRVSI2Z.cjs +0 -829
- package/dist/chunk-HVRVSI2Z.cjs.map +0 -1
- package/dist/chunk-I4GAWIPW.js +0 -825
- package/dist/chunk-I4GAWIPW.js.map +0 -1
- package/dist/chunk-J45BCEZ4.cjs +0 -339
- package/dist/chunk-J45BCEZ4.cjs.map +0 -1
- package/dist/chunk-JG6ZJ2WU.js +0 -1513
- package/dist/chunk-JG6ZJ2WU.js.map +0 -1
- package/dist/chunk-L2TE7PMO.cjs +0 -14
- package/dist/chunk-L2TE7PMO.cjs.map +0 -1
- package/dist/chunk-LHZ6VOA7.js +0 -1764
- package/dist/chunk-LHZ6VOA7.js.map +0 -1
- package/dist/chunk-MN3LHRGV.cjs +0 -8012
- package/dist/chunk-MN3LHRGV.cjs.map +0 -1
- package/dist/chunk-MVTOCRV2.js +0 -213
- package/dist/chunk-MVTOCRV2.js.map +0 -1
- package/dist/chunk-N5NNW4VG.cjs +0 -341
- package/dist/chunk-N5NNW4VG.cjs.map +0 -1
- package/dist/chunk-N7FNVFXW.cjs +0 -32
- package/dist/chunk-N7FNVFXW.cjs.map +0 -1
- package/dist/chunk-NKW7LKYU.js +0 -3185
- package/dist/chunk-NKW7LKYU.js.map +0 -1
- package/dist/chunk-NLNDMWZC.js +0 -31
- package/dist/chunk-NLNDMWZC.js.map +0 -1
- package/dist/chunk-NNQ2TYDF.js +0 -1848
- package/dist/chunk-NNQ2TYDF.js.map +0 -1
- package/dist/chunk-NNZAEUDW.js +0 -6792
- package/dist/chunk-NNZAEUDW.js.map +0 -1
- package/dist/chunk-OUHT5Z36.cjs +0 -393
- package/dist/chunk-OUHT5Z36.cjs.map +0 -1
- package/dist/chunk-QFTDTX6K.cjs +0 -457
- package/dist/chunk-QFTDTX6K.cjs.map +0 -1
- package/dist/chunk-SBUFNJVE.js +0 -258
- package/dist/chunk-SBUFNJVE.js.map +0 -1
- package/dist/chunk-SRGQ72IR.cjs +0 -2800
- package/dist/chunk-SRGQ72IR.cjs.map +0 -1
- package/dist/chunk-SSV46KFA.cjs +0 -112
- package/dist/chunk-SSV46KFA.cjs.map +0 -1
- package/dist/chunk-T6ZYQJ63.cjs +0 -6807
- package/dist/chunk-T6ZYQJ63.cjs.map +0 -1
- package/dist/chunk-UKQHXPGW.js +0 -30
- package/dist/chunk-UKQHXPGW.js.map +0 -1
- package/dist/chunk-UO6BUV6K.js +0 -278
- package/dist/chunk-UO6BUV6K.js.map +0 -1
- package/dist/chunk-V4XG5QF6.js +0 -1685
- package/dist/chunk-V4XG5QF6.js.map +0 -1
- package/dist/chunk-VEKIWQ3F.cjs +0 -39
- package/dist/chunk-VEKIWQ3F.cjs.map +0 -1
- package/dist/chunk-WWQEY7BV.js +0 -67
- package/dist/chunk-WWQEY7BV.js.map +0 -1
- package/dist/chunk-WXEHD6TT.js +0 -2795
- package/dist/chunk-WXEHD6TT.js.map +0 -1
- package/dist/chunk-X6K3HUOY.cjs +0 -86
- package/dist/chunk-X6K3HUOY.cjs.map +0 -1
- package/dist/chunk-XA4CKRML.cjs +0 -316
- package/dist/chunk-XA4CKRML.cjs.map +0 -1
- package/dist/chunk-XBTEO4OB.js +0 -391
- package/dist/chunk-XBTEO4OB.js.map +0 -1
- package/dist/chunk-XIYYHA65.cjs +0 -101
- package/dist/chunk-XIYYHA65.cjs.map +0 -1
- package/dist/chunk-YLJ4XMA6.js +0 -33
- package/dist/chunk-YLJ4XMA6.js.map +0 -1
- package/dist/chunk-YRIKITGF.cjs +0 -1768
- package/dist/chunk-YRIKITGF.cjs.map +0 -1
- package/dist/chunk-Z2XP767T.cjs +0 -35
- package/dist/chunk-Z2XP767T.cjs.map +0 -1
- package/dist/chunk-Z4X2RWOF.js +0 -37
- package/dist/chunk-Z4X2RWOF.js.map +0 -1
- package/dist/chunk-Z7XGGLI2.js +0 -455
- package/dist/chunk-Z7XGGLI2.js.map +0 -1
- package/dist/chunk-ZMW6NU2K.cjs +0 -1516
- package/dist/chunk-ZMW6NU2K.cjs.map +0 -1
- package/dist/chunk-ZVTWQLK4.cjs +0 -459
- package/dist/chunk-ZVTWQLK4.cjs.map +0 -1
- package/dist/variables.cjs +0 -17
- package/dist/variables.cjs.map +0 -1
- package/dist/variables.d.cts +0 -87
- package/dist/variables.d.ts +0 -87
- package/dist/variables.js +0 -4
- package/dist/variables.js.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,470 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
1
|
+
import {n as n$1,a,b}from'./chunk-XR7HEC7B.js';import'./chunk-XNIWQHXY.js';import'./chunk-2RWAXT6O.js';import'./chunk-7GK3XEZF.js';import'./chunk-MIQBJGGR.js';import'./chunk-YJ2OPULK.js';import'./chunk-TWC7K3ZX.js';import'./chunk-J4LZD4ZY.js';import'./chunk-XEIDV5JP.js';import {y}from'./chunk-EYRBENHC.js';import'./chunk-6G3PMEPA.js';import'./chunk-6CY44ZPG.js';import'./chunk-YVKHEAFT.js';import'./chunk-QXQE7X4S.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-W2JAR233.js';import'./chunk-YAYBVVG2.js';import'./chunk-E6Z4NQAS.js';import'./chunk-HFKDWQUL.js';import'./chunk-R2ENWQ76.js';import'./chunk-RSF25YSJ.js';import {m}from'./chunk-EVAOPEO4.js';import'./chunk-WGZ3FNHI.js';import {a as a$1}from'./chunk-L3FPQSGN.js';import'./chunk-GOIQYUWV.js';import'./chunk-JPFCXLJV.js';import'./chunk-UI6IFGBT.js';import'./chunk-IJMNVBIS.js';import'./chunk-62LMTO4F.js';import'./chunk-TRBXW6HW.js';import'./chunk-2JMFUQZH.js';import {b as b$1}from'./chunk-MPB7KUN5.js';var i=class o extends Error{constructor(t){super(t.message),this.name="ExpectationError",this.code=t.code,this.expected=t.expected,this.actual=t.actual,Object.setPrototypeOf(this,o.prototype);}};function V(o=[],t={}){let{locale:e="en",includeBuiltins:r=true}=t,s=new n$1({locale:e,packages:r?y:[]});for(let a of o)s.registerPackage(a);return s}function v(o,t){try{let e=o.evaluateExpression(t);return e.isError()?{status:"error",code:e.errorCode??"",message:e.errorMessage??"",source:e}:e.isPending()?{status:"pending",value:e}:{status:"value",value:e}}catch(e){if(e instanceof b$1)return {status:"error",code:e.code,message:e.message,source:e};let r=e instanceof Error?e.message:String(e);return {status:"error",code:"UNKNOWN_ERROR",message:r,source:new m(13,"UNKNOWN_ERROR",r)}}}function x(o,t){if(Object.is(o,t))return true;if(!Number.isFinite(o)||!Number.isFinite(t))return false;let e=1e-9*Math.max(1,Math.abs(o),Math.abs(t));return Math.abs(o-t)<=e}function l(o){return o.type===3?JSON.stringify(o.value):o.type===6&&typeof o.unit=="string"?`${String(o.value)} ${o.unit}`:String(o.value)}function n(o){switch(o.status){case "value":return l(o.value);case "pending":return "a pending async value";case "error":return `an error (${o.code}: ${o.message})`}}var d=class{constructor(t,e){this.expression=t;this.outcome=e;}get value(){if(this.outcome.status==="error")throw new i({code:"EXPECTED_VALUE",message:`Expected "${this.expression}" to evaluate, but it failed with ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this.outcome.value}toEvaluate(){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EVALUATE",message:`Expected "${this.expression}" to evaluate to a value, but got ${n(this.outcome)}.`,expected:"a resolved value",actual:n(this.outcome)});return this}toEqual(t,e){if(this.outcome.status!=="value")throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but got ${n(this.outcome)}.`,expected:c(t,e),actual:n(this.outcome)});let r=this.outcome.value,s;if(typeof t=="number"?s=x(r.toNumber(),t):typeof t=="boolean"?s=r.type===10&&r.value===t:s=C(r)===t,!s)throw new i({code:"EXPECTED_EQUAL",message:`Expected "${this.expression}" to equal ${c(t,e)}, but it was ${l(r)}.`,expected:c(t,e),actual:l(r)});if(e!==void 0&&r.unit!==e)throw new i({code:"EXPECTED_UNIT",message:`Expected "${this.expression}" to carry the unit "${e}", but it was ${r.unit===void 0?"unitless":`"${r.unit}"`}.`,expected:`unit "${e}"`,actual:r.unit===void 0?"no unit":`unit "${r.unit}"`});return this}toBeError(){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_ERROR",message:`Expected "${this.expression}" to fail, but it produced ${n(this.outcome)}.`,expected:"an error",actual:n(this.outcome)});return this}toFailWith(t){if(this.outcome.status!=="error")throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it produced ${n(this.outcome)}.`,expected:`error code "${t}"`,actual:n(this.outcome)});if(this.outcome.code!==t)throw new i({code:"EXPECTED_FAIL_WITH",message:`Expected "${this.expression}" to fail with "${t}", but it failed with "${this.outcome.code}" (${this.outcome.message}).`,expected:`error code "${t}"`,actual:`error code "${this.outcome.code}"`});return this}toBePending(){if(this.outcome.status!=="pending")throw new i({code:"EXPECTED_PENDING",message:`Expected "${this.expression}" to be pending, but got ${n(this.outcome)}.`,expected:"a pending async value",actual:n(this.outcome)});return this}};function c(o,t){let e=typeof o=="string"?JSON.stringify(o):String(o);return t===void 0?e:`${e} ${t}`}function C(o){return String(o.value)}function D(o,t){return new d(t,v(o,t))}var O=["a","an","and","or","but","if","then","the","this","that","these","those","in","on","at","to","of","for","from","with","by","as","per","into","over","is","are","was","were","be","been","being","do","does","did","have","has","had","will","would","can","could","should","may","might","must","price","cost","value","total","sum","count","rate","amount","number","time","date","day","week","month","year","hour","minute","second","add","buy","sell","hold","make","take","give","get","set","run","up","down","out","off","all","some","any","no","not","more","less","one","two","three","first","last","next","each","every","here","there"],$=["error","warning","info"];function k(o){let t=[],e=o.lexerVocabulary;if(e?.keywords)for(let[r,s]of Object.entries(e.keywords))t.push({word:r,via:"keyword",tokenType:s});if(e?.units)for(let r of e.units)t.push({word:r,via:"unit"});if(e?.operators)for(let[r,s]of Object.entries(e.operators))t.push({word:r,via:"operator",tokenType:s});if(o.phrases)for(let[r,s]of Object.entries(o.phrases))r.includes(" ")||t.push({word:r,via:"phrase",tokenType:s});return t}var p=class{constructor(t){this.pkg=t;}notToShadow(t=O){let e=new Set(t.map(s=>s.toLowerCase())),r=k(this.pkg).filter(s=>e.has(s.word.toLowerCase()));if(r.length>0){let s=r.map(a=>`"${a.word}" (${a.via})`).join(", ");throw new i({code:"PACKAGE_SHADOWS_PROSE",message:`Package "${this.pkg.name}" claims prose word(s) as syntax: ${s}. A word that is also ordinary English turns prose into arithmetic; prefer a multi-word phrase or a form that requires a parenthesis.`,expected:"no prose words claimed as syntax",actual:s})}return r}notToCollideWith(t,e="error"){let r=a(this.pkg,t),s=$.indexOf(e),a$1=r.conflicts.filter(u=>$.indexOf(u.severity)<=s);if(a$1.length>0){let u=a$1.map(g=>`[${g.severity}] ${g.detail}`).join(`
|
|
2
|
+
`);throw new i({code:"PACKAGE_VOCABULARY_COLLISION",message:`Package "${this.pkg.name}" collides with another package:
|
|
3
|
+
${u}`,expected:`no conflicts at or above "${e}" severity`,actual:`${a$1.length} conflict(s)`})}return r}toDeclareCompatibleEngineVersion(t=a$1){let e=b(this.pkg,t);if(!e.compatible){let r=e.reason==="invalid-range"?`its range "${e.declaredRange}" is not valid semver`:`its range "${e.declaredRange}" is not satisfied by engine version "${e.engineVersion}"`;throw new i({code:"PACKAGE_ENGINE_VERSION_INCOMPATIBLE",message:`Package "${this.pkg.name}" declares an engineVersion that will be rejected at registration: ${r}.`,expected:`an engineVersion satisfied by "${t}"`,actual:`"${e.declaredRange}"`})}return this}};function L(o){return new p(o)}export{O as COMMON_PROSE_WORDS,i as ExpectationError,d as ExpressionAssertion,p as PackageAssertion,V as createTestEngine,D as expectExpression,L as expectPackage};//# sourceMappingURL=testing.js.map
|
|
470
4
|
//# sourceMappingURL=testing.js.map
|