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/worker.js
CHANGED
|
@@ -1,484 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import './chunk-I4GAWIPW.js';
|
|
4
|
-
import './chunk-2RWAXT6O.js';
|
|
5
|
-
import './chunk-3VGDNEE3.js';
|
|
6
|
-
import './chunk-FD5ZZHEU.js';
|
|
7
|
-
import './chunk-WXEHD6TT.js';
|
|
8
|
-
import './chunk-CCBZZQAE.js';
|
|
9
|
-
import { formatValue } from './chunk-3OWCDIPN.js';
|
|
10
|
-
import './chunk-UKQHXPGW.js';
|
|
11
|
-
import { BUILTIN_PACKAGES } from './chunk-4HQKTMWG.js';
|
|
12
|
-
import './chunk-ENKKJYD3.js';
|
|
13
|
-
import './chunk-BYJBUL7U.js';
|
|
14
|
-
import './chunk-3BOK2LDK.js';
|
|
15
|
-
import './chunk-7KYSUDQO.js';
|
|
16
|
-
import './chunk-NLNDMWZC.js';
|
|
17
|
-
import './chunk-NKW7LKYU.js';
|
|
18
|
-
import './chunk-GCM5JHMX.js';
|
|
19
|
-
import './chunk-Z7XGGLI2.js';
|
|
20
|
-
import './chunk-BLI4NIQY.js';
|
|
21
|
-
import './chunk-Z4X2RWOF.js';
|
|
22
|
-
import { formatColour, toHexString } from './chunk-5HRB36DK.js';
|
|
23
|
-
import { formatSymbolic } from './chunk-NNQ2TYDF.js';
|
|
24
|
-
import './chunk-267JPOTF.js';
|
|
25
|
-
import './chunk-MVTOCRV2.js';
|
|
26
|
-
import './chunk-GLA4JXBO.js';
|
|
27
|
-
import './chunk-DLEBSLF4.js';
|
|
28
|
-
import './chunk-UO6BUV6K.js';
|
|
29
|
-
import './chunk-JG6ZJ2WU.js';
|
|
30
|
-
import './chunk-4D6NIHE2.js';
|
|
31
|
-
import './chunk-XBTEO4OB.js';
|
|
32
|
-
import './chunk-SBUFNJVE.js';
|
|
33
|
-
import './chunk-V4XG5QF6.js';
|
|
34
|
-
import { ErrorFactory, normalizeUnknownError } from './chunk-ERCOHGXD.js';
|
|
35
|
-
import './chunk-YLJ4XMA6.js';
|
|
36
|
-
|
|
37
|
-
// src/worker/client.ts
|
|
38
|
-
var WorkerEngineClient = class {
|
|
39
|
-
constructor(transport) {
|
|
40
|
-
this.nextId = 1;
|
|
41
|
-
this.pending = /* @__PURE__ */ new Map();
|
|
42
|
-
// Broadcast subscribers for async resolutions. Sets, not one callback each, so
|
|
43
|
-
// several views can watch the same worker; a resolution is not tied to a
|
|
44
|
-
// request id, so these live outside `pending`.
|
|
45
|
-
this.resolvedListeners = /* @__PURE__ */ new Set();
|
|
46
|
-
this.asyncErrorListeners = /* @__PURE__ */ new Set();
|
|
47
|
-
this.terminated = false;
|
|
48
|
-
this.transport = transport;
|
|
49
|
-
this.transport.onMessage((raw) => this.onMessage(raw));
|
|
50
|
-
}
|
|
51
|
-
/** Perform the init handshake, resolving once the worker posts `ready`. */
|
|
52
|
-
init(options) {
|
|
53
|
-
const id = this.nextId++;
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
55
|
-
this.pending.set(id, { resolve: () => resolve(), reject });
|
|
56
|
-
this.transport.postMessage({
|
|
57
|
-
kind: "init",
|
|
58
|
-
id,
|
|
59
|
-
localeCode: options.localeCode,
|
|
60
|
-
diagnosticMode: options.diagnosticMode,
|
|
61
|
-
config: options.config,
|
|
62
|
-
packages: options.packages,
|
|
63
|
-
formatting: options.formatting
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
parseDocument(input, options) {
|
|
68
|
-
const { signal, ...parsing } = options ?? {};
|
|
69
|
-
const parseOptions = Object.keys(parsing).length > 0 ? parsing : void 0;
|
|
70
|
-
return this.call("parseDocument", [input, parseOptions], signal);
|
|
71
|
-
}
|
|
72
|
-
evaluateLines(lines, options) {
|
|
73
|
-
return this.call("evaluateLines", [lines], options?.signal);
|
|
74
|
-
}
|
|
75
|
-
evaluateExpression(expression, options) {
|
|
76
|
-
return this.call("evaluateExpression", [expression], options?.signal);
|
|
77
|
-
}
|
|
78
|
-
onResolved(listener) {
|
|
79
|
-
this.resolvedListeners.add(listener);
|
|
80
|
-
return () => this.resolvedListeners.delete(listener);
|
|
81
|
-
}
|
|
82
|
-
onAsyncError(listener) {
|
|
83
|
-
this.asyncErrorListeners.add(listener);
|
|
84
|
-
return () => this.asyncErrorListeners.delete(listener);
|
|
85
|
-
}
|
|
86
|
-
terminate() {
|
|
87
|
-
if (this.terminated) return;
|
|
88
|
-
this.terminated = true;
|
|
89
|
-
const error = workerTerminatedError();
|
|
90
|
-
for (const entry of this.pending.values()) {
|
|
91
|
-
this.unhook(entry);
|
|
92
|
-
entry.reject(error);
|
|
93
|
-
}
|
|
94
|
-
this.pending.clear();
|
|
95
|
-
this.resolvedListeners.clear();
|
|
96
|
-
this.asyncErrorListeners.clear();
|
|
97
|
-
this.transport.terminate();
|
|
98
|
-
}
|
|
99
|
-
/** Dispatch one request and return the promise that settles on its answer. */
|
|
100
|
-
call(method, args, signal) {
|
|
101
|
-
if (this.terminated) return Promise.reject(workerTerminatedError());
|
|
102
|
-
if (signal?.aborted) return Promise.reject(workerCancelledError(method));
|
|
103
|
-
const id = this.nextId++;
|
|
104
|
-
return new Promise((resolve, reject) => {
|
|
105
|
-
const entry = { resolve, reject };
|
|
106
|
-
if (signal) {
|
|
107
|
-
const onAbort = () => {
|
|
108
|
-
if (!this.pending.has(id)) return;
|
|
109
|
-
this.pending.delete(id);
|
|
110
|
-
this.transport.postMessage({ kind: "cancel", id });
|
|
111
|
-
reject(workerCancelledError(method));
|
|
112
|
-
};
|
|
113
|
-
entry.signal = signal;
|
|
114
|
-
entry.onAbort = onAbort;
|
|
115
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
116
|
-
}
|
|
117
|
-
this.pending.set(id, entry);
|
|
118
|
-
this.transport.postMessage({ kind: "request", id, method, args });
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
/** Route one incoming message to the request that is waiting on its id. */
|
|
122
|
-
onMessage(raw) {
|
|
123
|
-
const message = raw;
|
|
124
|
-
switch (message.kind) {
|
|
125
|
-
case "ready":
|
|
126
|
-
case "result": {
|
|
127
|
-
const value = message.kind === "result" ? message.value : void 0;
|
|
128
|
-
this.settle(message.id, (entry) => entry.resolve(value));
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
case "error":
|
|
132
|
-
this.settle(message.id, (entry) => entry.reject(deserializeEngineError(message.error)));
|
|
133
|
-
break;
|
|
134
|
-
case "async-update":
|
|
135
|
-
for (const listener of [...this.resolvedListeners]) listener(message.lines);
|
|
136
|
-
break;
|
|
137
|
-
case "async-error":
|
|
138
|
-
for (const listener of [...this.asyncErrorListeners]) {
|
|
139
|
-
listener({
|
|
140
|
-
queryKey: message.queryKey,
|
|
141
|
-
packageId: message.packageId,
|
|
142
|
-
error: deserializeEngineError(message.error)
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
/** Remove a pending request by id and run the settle callback, if it is still pending. */
|
|
149
|
-
settle(id, apply) {
|
|
150
|
-
const entry = this.pending.get(id);
|
|
151
|
-
if (!entry) return;
|
|
152
|
-
this.pending.delete(id);
|
|
153
|
-
this.unhook(entry);
|
|
154
|
-
apply(entry);
|
|
155
|
-
}
|
|
156
|
-
/** Detach an entry's abort listener so a settled request leaves nothing on the signal. */
|
|
157
|
-
unhook(entry) {
|
|
158
|
-
if (entry.signal && entry.onAbort) entry.signal.removeEventListener("abort", entry.onAbort);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
async function createWorkerEngine(options) {
|
|
162
|
-
const client = new WorkerEngineClient(options.transport);
|
|
163
|
-
await client.init(options);
|
|
164
|
-
return client;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// src/worker/serialize.ts
|
|
168
|
-
function nonFiniteTag(n) {
|
|
169
|
-
return n > 0 ? "Infinity" : n < 0 ? "-Infinity" : "NaN";
|
|
170
|
-
}
|
|
171
|
-
function serializeMatrix(m) {
|
|
172
|
-
const cells = m.data.map((cell) => {
|
|
173
|
-
if (typeof cell === "object" && cell !== null) return formatSymbolic(cell);
|
|
174
|
-
if (typeof cell === "number" && !Number.isFinite(cell)) return nonFiniteTag(cell);
|
|
175
|
-
return cell;
|
|
176
|
-
});
|
|
177
|
-
return { rows: m.rows, cols: m.cols, cells, hasSymbolic: m.hasSymbolic };
|
|
178
|
-
}
|
|
179
|
-
function serializeValue(value, settings) {
|
|
180
|
-
const reading = value.toNumber();
|
|
181
|
-
const dto = {
|
|
182
|
-
type: value.type,
|
|
183
|
-
text: formatValue(value, settings),
|
|
184
|
-
// A non-finite reading (1/0, 0/0, an overflow) cannot cross JSON, which
|
|
185
|
-
// turns it into null and breaks the round-trip the DTO guarantees. Keep
|
|
186
|
-
// `number` finite and name the real value in `nonFinite` instead.
|
|
187
|
-
number: Number.isFinite(reading) ? reading : 0
|
|
188
|
-
};
|
|
189
|
-
if (!Number.isFinite(reading)) {
|
|
190
|
-
dto.nonFinite = nonFiniteTag(reading);
|
|
191
|
-
}
|
|
192
|
-
if (value.unit !== void 0) dto.unit = value.unit;
|
|
193
|
-
if (value.timedOut !== void 0) dto.timedOut = value.timedOut;
|
|
194
|
-
const raw = value.value;
|
|
195
|
-
if (typeof raw === "bigint") {
|
|
196
|
-
dto.bigint = raw.toString();
|
|
197
|
-
} else if (value.type === 7 /* Matrix */) {
|
|
198
|
-
dto.matrix = serializeMatrix(raw);
|
|
199
|
-
} else if (value.type === 8 /* Range */) {
|
|
200
|
-
const r = raw;
|
|
201
|
-
dto.range = { min: r.min, max: r.max };
|
|
202
|
-
} else if (value.type === 14 /* Colour */) {
|
|
203
|
-
const c = raw;
|
|
204
|
-
dto.colour = { hex: toHexString(c), r: c.r, g: c.g, b: c.b, a: c.a, format: c.format, css: formatColour(c) };
|
|
205
|
-
}
|
|
206
|
-
return dto;
|
|
207
|
-
}
|
|
208
|
-
function serializeMaybe(value, settings) {
|
|
209
|
-
return value ? serializeValue(value, settings) : null;
|
|
210
|
-
}
|
|
211
|
-
function serializeInlineSolve(solve, settings) {
|
|
212
|
-
return {
|
|
213
|
-
start: solve.start,
|
|
214
|
-
end: solve.end,
|
|
215
|
-
expression: solve.expression,
|
|
216
|
-
lineNumber: solve.lineNumber,
|
|
217
|
-
columnNumber: solve.columnNumber,
|
|
218
|
-
result: serializeMaybe(solve.result, settings),
|
|
219
|
-
error: solve.error ?? null
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
function serializeParsedLine(line, settings) {
|
|
223
|
-
return {
|
|
224
|
-
lineNumber: line.lineNumber,
|
|
225
|
-
text: line.text,
|
|
226
|
-
startPosition: line.startPosition,
|
|
227
|
-
endPosition: line.endPosition,
|
|
228
|
-
isEmpty: line.isEmpty,
|
|
229
|
-
hasInlineSolves: line.hasInlineSolves,
|
|
230
|
-
inlineSolves: line.inlineSolves.map((solve) => serializeInlineSolve(solve, settings)),
|
|
231
|
-
expression: line.expression,
|
|
232
|
-
result: serializeMaybe(line.result, settings),
|
|
233
|
-
error: line.error
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function serializeParsingResult(result, settings) {
|
|
237
|
-
const dto = {
|
|
238
|
-
lines: result.lines.map((line) => serializeParsedLine(line, settings)),
|
|
239
|
-
totalLines: result.totalLines,
|
|
240
|
-
errors: [...result.errors]
|
|
241
|
-
};
|
|
242
|
-
if (result.diagnostics !== void 0) dto.diagnostics = result.diagnostics;
|
|
243
|
-
return dto;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// src/worker/runtime.ts
|
|
247
|
-
function resolvePackages(available, names) {
|
|
248
|
-
if (names === void 0) return available;
|
|
249
|
-
const byName = new Map(available.map((pkg) => [pkg.name, pkg]));
|
|
250
|
-
const resolved = [];
|
|
251
|
-
for (const name of names) {
|
|
252
|
-
const pkg = byName.get(name);
|
|
253
|
-
if (!pkg) {
|
|
254
|
-
throw ErrorFactory.config(
|
|
255
|
-
WorkerErrorCodes.WORKER_UNKNOWN_PACKAGE,
|
|
256
|
-
`No package named "${name}" is available in this worker runtime`,
|
|
257
|
-
{ name, available: [...byName.keys()] }
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
resolved.push(pkg);
|
|
261
|
-
}
|
|
262
|
-
return resolved;
|
|
263
|
-
}
|
|
264
|
-
function startWorkerRuntime(transport, options = {}) {
|
|
265
|
-
const available = options.packages ?? BUILTIN_PACKAGES;
|
|
266
|
-
let engine = null;
|
|
267
|
-
let formatting;
|
|
268
|
-
const inFlight = /* @__PURE__ */ new Map();
|
|
269
|
-
let retainedLines = /* @__PURE__ */ new Map();
|
|
270
|
-
let documentController = null;
|
|
271
|
-
let stopEventPump = null;
|
|
272
|
-
const post = (message) => transport.postMessage(message);
|
|
273
|
-
const fail = (id, error) => {
|
|
274
|
-
post({ kind: "error", id, error: serializeEngineError(normalizeUnknownError(error)) });
|
|
275
|
-
};
|
|
276
|
-
const retainLines = (message) => {
|
|
277
|
-
const map = /* @__PURE__ */ new Map();
|
|
278
|
-
if (message.method === "parseDocument") {
|
|
279
|
-
message.args[0].split("\n").forEach((text, index) => map.set(index + 1, text));
|
|
280
|
-
} else if (message.method === "evaluateLines") {
|
|
281
|
-
message.args[0].forEach((text, index) => map.set(index + 1, text));
|
|
282
|
-
} else {
|
|
283
|
-
map.set(-1, message.args[0]);
|
|
284
|
-
}
|
|
285
|
-
return map;
|
|
286
|
-
};
|
|
287
|
-
const handleAsyncEvent = (eng, event) => {
|
|
288
|
-
if (event.type === "error") {
|
|
289
|
-
post({
|
|
290
|
-
kind: "async-error",
|
|
291
|
-
queryKey: event.queryKey,
|
|
292
|
-
packageId: event.packageId,
|
|
293
|
-
error: serializeEngineError(normalizeUnknownError(event.error))
|
|
294
|
-
});
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
const lines = [];
|
|
298
|
-
for (const lineNumber of event.lineNumbers) {
|
|
299
|
-
const text = retainedLines.get(lineNumber);
|
|
300
|
-
if (text === void 0) continue;
|
|
301
|
-
try {
|
|
302
|
-
const value = eng.evaluateLine(lineNumber, text)[0];
|
|
303
|
-
if (value) lines.push({ lineNumber, value: serializeValue(value, formatting) });
|
|
304
|
-
} catch {
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if (lines.length > 0) post({ kind: "async-update", lines });
|
|
308
|
-
};
|
|
309
|
-
const startEventPump = (eng) => {
|
|
310
|
-
stopEventPump?.();
|
|
311
|
-
const reader = eng.getEventStream().getReader();
|
|
312
|
-
stopEventPump = () => void reader.cancel();
|
|
313
|
-
void (async () => {
|
|
314
|
-
try {
|
|
315
|
-
for (; ; ) {
|
|
316
|
-
const { done, value } = await reader.read();
|
|
317
|
-
if (done) return;
|
|
318
|
-
handleAsyncEvent(eng, value);
|
|
319
|
-
}
|
|
320
|
-
} catch {
|
|
321
|
-
}
|
|
322
|
-
})();
|
|
323
|
-
};
|
|
324
|
-
const handleInit = (message) => {
|
|
325
|
-
try {
|
|
326
|
-
const packages = resolvePackages(available, message.packages);
|
|
327
|
-
engine = new ExpressionEngine(
|
|
328
|
-
message.localeCode ?? "en",
|
|
329
|
-
message.diagnosticMode ?? false,
|
|
330
|
-
message.config,
|
|
331
|
-
void 0,
|
|
332
|
-
packages
|
|
333
|
-
);
|
|
334
|
-
formatting = message.formatting;
|
|
335
|
-
startEventPump(engine);
|
|
336
|
-
post({ kind: "ready", id: message.id });
|
|
337
|
-
} catch (error) {
|
|
338
|
-
fail(message.id, error);
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
const runMethod = (eng, message) => {
|
|
342
|
-
const { method, args } = message;
|
|
343
|
-
switch (method) {
|
|
344
|
-
case "parseDocument":
|
|
345
|
-
return serializeParsingResult(eng.parseDocument(args[0], args[1]), formatting);
|
|
346
|
-
case "evaluateLines":
|
|
347
|
-
return eng.evaluateLines(args[0]).map((line) => serializeParsedLine(line, formatting));
|
|
348
|
-
case "evaluateExpression":
|
|
349
|
-
return eng.evaluateExpression(args[0]).map((value) => serializeValue(value, formatting));
|
|
350
|
-
default:
|
|
351
|
-
throw ErrorFactory.execution(
|
|
352
|
-
WorkerErrorCodes.WORKER_UNKNOWN_METHOD,
|
|
353
|
-
`The worker runtime has no method named "${String(method)}"`,
|
|
354
|
-
{ method }
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
const handleRequest = (message) => {
|
|
359
|
-
const eng = engine;
|
|
360
|
-
if (!eng) {
|
|
361
|
-
fail(
|
|
362
|
-
message.id,
|
|
363
|
-
ErrorFactory.execution(
|
|
364
|
-
WorkerErrorCodes.WORKER_NOT_INITIALISED,
|
|
365
|
-
"The worker received a request before its engine finished initialising"
|
|
366
|
-
)
|
|
367
|
-
);
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
documentController?.abort();
|
|
371
|
-
const controller = new AbortController();
|
|
372
|
-
documentController = controller;
|
|
373
|
-
retainedLines = retainLines(message);
|
|
374
|
-
inFlight.set(message.id, controller);
|
|
375
|
-
eng.setKeystrokeSignal(controller.signal);
|
|
376
|
-
try {
|
|
377
|
-
const value = runMethod(eng, message);
|
|
378
|
-
post({ kind: "result", id: message.id, value });
|
|
379
|
-
} catch (error) {
|
|
380
|
-
fail(message.id, error);
|
|
381
|
-
} finally {
|
|
382
|
-
inFlight.delete(message.id);
|
|
383
|
-
eng.setKeystrokeSignal(null);
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
transport.onMessage((raw) => {
|
|
387
|
-
const message = raw;
|
|
388
|
-
switch (message.kind) {
|
|
389
|
-
case "init":
|
|
390
|
-
handleInit(message);
|
|
391
|
-
break;
|
|
392
|
-
case "request":
|
|
393
|
-
handleRequest(message);
|
|
394
|
-
break;
|
|
395
|
-
case "cancel":
|
|
396
|
-
inFlight.get(message.id)?.abort();
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
return () => {
|
|
401
|
-
stopEventPump?.();
|
|
402
|
-
stopEventPump = null;
|
|
403
|
-
documentController?.abort();
|
|
404
|
-
documentController = null;
|
|
405
|
-
retainedLines = /* @__PURE__ */ new Map();
|
|
406
|
-
for (const controller of inFlight.values()) controller.abort();
|
|
407
|
-
inFlight.clear();
|
|
408
|
-
engine?.clear();
|
|
409
|
-
engine = null;
|
|
410
|
-
transport.terminate();
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// src/worker/transport.ts
|
|
415
|
-
function cloneMessage(value) {
|
|
416
|
-
return typeof globalThis.structuredClone === "function" ? globalThis.structuredClone(value) : JSON.parse(JSON.stringify(value));
|
|
417
|
-
}
|
|
418
|
-
function createLinkedTransports() {
|
|
419
|
-
let clientHandler = null;
|
|
420
|
-
let hostHandler = null;
|
|
421
|
-
let alive = true;
|
|
422
|
-
const deliver = (target, message) => {
|
|
423
|
-
const cloned = cloneMessage(message);
|
|
424
|
-
queueMicrotask(() => {
|
|
425
|
-
if (!alive) return;
|
|
426
|
-
target()?.(cloned);
|
|
427
|
-
});
|
|
428
|
-
};
|
|
429
|
-
const client = {
|
|
430
|
-
postMessage: (message) => deliver(() => hostHandler, message),
|
|
431
|
-
onMessage: (handler) => {
|
|
432
|
-
clientHandler = handler;
|
|
433
|
-
},
|
|
434
|
-
terminate: () => {
|
|
435
|
-
alive = false;
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
const host = {
|
|
439
|
-
postMessage: (message) => deliver(() => clientHandler, message),
|
|
440
|
-
onMessage: (handler) => {
|
|
441
|
-
hostHandler = handler;
|
|
442
|
-
},
|
|
443
|
-
terminate: () => {
|
|
444
|
-
alive = false;
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
return { client, host };
|
|
448
|
-
}
|
|
449
|
-
function eventTargetTransport(target) {
|
|
450
|
-
return {
|
|
451
|
-
postMessage: (message) => target.postMessage(message),
|
|
452
|
-
onMessage: (handler) => {
|
|
453
|
-
const listener = (event) => handler(event.data);
|
|
454
|
-
if (typeof target.addEventListener === "function") {
|
|
455
|
-
target.addEventListener("message", listener);
|
|
456
|
-
} else {
|
|
457
|
-
target.onmessage = listener;
|
|
458
|
-
}
|
|
459
|
-
target.start?.();
|
|
460
|
-
},
|
|
461
|
-
// A main-side Worker terminates; a worker's own `self` closes. Calling
|
|
462
|
-
// whichever exists keeps one adapter usable from both ends.
|
|
463
|
-
terminate: () => {
|
|
464
|
-
target.terminate?.();
|
|
465
|
-
target.close?.();
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
function messagePortTransport(port) {
|
|
470
|
-
return {
|
|
471
|
-
postMessage: (message) => port.postMessage(message),
|
|
472
|
-
onMessage: (handler) => {
|
|
473
|
-
port.on("message", (message) => handler(message));
|
|
474
|
-
},
|
|
475
|
-
terminate: () => {
|
|
476
|
-
port.terminate?.();
|
|
477
|
-
port.close?.();
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
export { createLinkedTransports, createWorkerEngine, eventTargetTransport, messagePortTransport, serializeParsedLine, serializeParsingResult, serializeValue, startWorkerRuntime };
|
|
483
|
-
//# sourceMappingURL=worker.js.map
|
|
1
|
+
import {a,e,d,c as c$2,b}from'./chunk-MVZUTETT.js';import {n}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 {c}from'./chunk-J4LZD4ZY.js';import'./chunk-XEIDV5JP.js';import {y as y$1}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 {g,f}from'./chunk-R2ENWQ76.js';import {R}from'./chunk-RSF25YSJ.js';import'./chunk-EVAOPEO4.js';import'./chunk-WGZ3FNHI.js';import'./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 {c as c$1,d as d$1}from'./chunk-MPB7KUN5.js';var W=class{constructor(r){this.nextId=1;this.pending=new Map;this.resolvedListeners=new Set;this.asyncErrorListeners=new Set;this.terminated=false;this.transport=r,this.transport.onMessage(n=>this.onMessage(n));}init(r){let n=this.nextId++;return new Promise((t,o)=>{this.pending.set(n,{resolve:()=>t(),reject:o}),this.transport.postMessage({kind:"init",id:n,localeCode:r.localeCode,diagnostics:r.diagnostics,config:r.config,packages:r.packages,formatting:r.formatting});})}parseDocument(r,n){let{signal:t,...o}=n??{},a=Object.keys(o).length>0?o:void 0;return this.call("parseDocument",[r,a],t)}evaluateLines(r,n){return this.call("evaluateLines",[r],n?.signal)}evaluateExpression(r,n){return this.call("evaluateExpression",[r],n?.signal)}onResolved(r){return this.resolvedListeners.add(r),()=>this.resolvedListeners.delete(r)}onAsyncError(r){return this.asyncErrorListeners.add(r),()=>this.asyncErrorListeners.delete(r)}terminate(){if(this.terminated)return;this.terminated=true;let r=e();for(let n of this.pending.values())this.unhook(n),n.reject(r);this.pending.clear(),this.resolvedListeners.clear(),this.asyncErrorListeners.clear(),this.transport.terminate();}call(r,n,t){if(this.terminated)return Promise.reject(e());if(t?.aborted)return Promise.reject(d(r));let o=this.nextId++;return new Promise((a,u)=>{let c={resolve:a,reject:u};if(t){let g=()=>{this.pending.has(o)&&(this.pending.delete(o),this.transport.postMessage({kind:"cancel",id:o}),u(d(r)));};c.signal=t,c.onAbort=g,t.addEventListener("abort",g,{once:true});}this.pending.set(o,c),this.transport.postMessage({kind:"request",id:o,method:r,args:n});})}onMessage(r){let n=r;switch(n.kind){case "ready":case "result":{let t=n.kind==="result"?n.value:void 0;this.settle(n.id,o=>o.resolve(t));break}case "error":this.settle(n.id,t=>t.reject(c$2(n.error)));break;case "async-update":for(let t of [...this.resolvedListeners])t(n.lines);break;case "async-error":for(let t of [...this.asyncErrorListeners])t({queryKey:n.queryKey,packageId:n.packageId,error:c$2(n.error)});break}}settle(r,n){let t=this.pending.get(r);t&&(this.pending.delete(r),this.unhook(t),n(t));}unhook(r){r.signal&&r.onAbort&&r.signal.removeEventListener("abort",r.onAbort);}};async function K(e){let r=new W(e.transport);return await r.init(e),r}function O(e){return e>0?"Infinity":e<0?"-Infinity":"NaN"}function U(e){let r=e.data.map(n=>typeof n=="object"&&n!==null?R(n):typeof n=="number"&&!Number.isFinite(n)?O(n):n);return {rows:e.rows,cols:e.cols,cells:r,hasSymbolic:e.hasSymbolic}}function m(e,r){let n=e.toNumber(),t={type:e.type,text:c(e,r),number:Number.isFinite(n)?n:0};Number.isFinite(n)||(t.nonFinite=O(n)),e.unit!==void 0&&(t.unit=e.unit),e.timedOut!==void 0&&(t.timedOut=e.timedOut);let o=e.value;if(typeof o=="bigint")t.bigint=o.toString();else if(e.type===7)t.matrix=U(o);else if(e.type===8){let a=o;t.range={min:a.min,max:a.max};}else if(e.type===14){let a=o;t.colour={hex:f(a),r:a.r,g:a.g,b:a.b,a:a.a,format:a.format,css:g(a)};}return t}function N(e,r){return e?m(e,r):null}function _(e,r){return {start:e.start,end:e.end,expression:e.expression,lineNumber:e.lineNumber,columnNumber:e.columnNumber,result:N(e.result,r),error:e.error??null}}function y(e,r){return {lineNumber:e.lineNumber,text:e.text,startPosition:e.startPosition,endPosition:e.endPosition,isEmpty:e.isEmpty,hasInlineSolves:e.hasInlineSolves,inlineSolves:e.inlineSolves.map(n=>_(n,r)),expression:e.expression,result:N(e.result,r),error:e.error}}function x(e,r){let n={lines:e.lines.map(t=>y(t,r)),totalLines:e.totalLines,errors:[...e.errors]};return e.diagnostics!==void 0&&(n.diagnostics=e.diagnostics),n}function H(e,r){if(r===void 0)return e;let n=new Map(e.map(o=>[o.name,o])),t=[];for(let o of r){let a$1=n.get(o);if(!a$1)throw c$1.config(a.WORKER_UNKNOWN_PACKAGE,`No package named "${o}" is available in this worker runtime`,{name:o,available:[...n.keys()]});t.push(a$1);}return t}function B(e,r={}){let n$1=r.packages??y$1,t=null,o,a$1=new Map,u=new Map,c=null,g=null,p=i=>e.postMessage(i),h=(i,s)=>{p({kind:"error",id:i,error:b(d$1(s))});},C=i=>{let s=new Map;return i.method==="parseDocument"?i.args[0].split(`
|
|
2
|
+
`).forEach((d,l)=>s.set(l+1,d)):i.method==="evaluateLines"?i.args[0].forEach((d,l)=>s.set(l+1,d)):s.set(-1,i.args[0]),s},q=(i,s)=>{if(s.type==="error"){p({kind:"async-error",queryKey:s.queryKey,packageId:s.packageId,error:b(d$1(s.error))});return}let d=[];for(let l of s.lineNumbers){let f=u.get(l);if(f!==void 0)try{let R=i.evaluateLine(l,f);R&&d.push({lineNumber:l,value:m(R,o)});}catch{}}d.length>0&&p({kind:"async-update",lines:d});},F=i=>{g?.();let s=i.getEventStream().getReader();g=()=>{s.cancel();},(async()=>{try{for(;;){let{done:d,value:l}=await s.read();if(d)return;q(i,l);}}catch{}})();},V=i=>{try{let s=H(n$1,i.packages);t=new n({locale:i.localeCode??"en",diagnostics:i.diagnostics??!1,config:i.config,packages:s}),o=i.formatting,F(t),p({kind:"ready",id:i.id});}catch(s){h(i.id,s);}},j=(i,s)=>{let{method:d,args:l}=s;switch(d){case "parseDocument":return x(i.parseDocument(l[0],l[1]),o);case "evaluateLines":return i.evaluateLines(l[0]).map(f=>y(f,o));case "evaluateExpression":return m(i.evaluateExpression(l[0]),o);default:throw c$1.execution(a.WORKER_UNKNOWN_METHOD,`The worker runtime has no method named "${String(d)}"`,{method:d})}},D=i=>{let s=t;if(!s){h(i.id,c$1.execution(a.WORKER_NOT_INITIALISED,"The worker received a request before its engine finished initialising"));return}c?.abort();let d=new AbortController;c=d,u=C(i),a$1.set(i.id,d),s.setKeystrokeSignal(d.signal);try{let l=j(s,i);p({kind:"result",id:i.id,value:l});}catch(l){h(i.id,l);}finally{a$1.delete(i.id),s.setKeystrokeSignal(null);}};return e.onMessage(i=>{let s=i;switch(s.kind){case "init":V(s);break;case "request":D(s);break;case "cancel":a$1.get(s.id)?.abort();break}}),()=>{g?.(),g=null,c?.abort(),c=null,u=new Map;for(let i of a$1.values())i.abort();a$1.clear(),t?.clear(),t=null,e.terminate();}}function G(e){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e))}function J(){let e=null,r=null,n=true,t=(u,c)=>{let g=G(c);queueMicrotask(()=>{n&&u()?.(g);});};return {client:{postMessage:u=>t(()=>r,u),onMessage:u=>{e=u;},terminate:()=>{n=false;}},host:{postMessage:u=>t(()=>e,u),onMessage:u=>{r=u;},terminate:()=>{n=false;}}}}function $(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{let n=t=>r(t.data);typeof e.addEventListener=="function"?e.addEventListener("message",n):e.onmessage=n,e.start?.();},terminate:()=>{e.terminate?.(),e.close?.();}}}function Q(e){return {postMessage:r=>e.postMessage(r),onMessage:r=>{e.on("message",n=>r(n));},terminate:()=>{e.terminate?.(),e.close?.();}}}export{J as createLinkedTransports,K as createWorkerEngine,$ as eventTargetTransport,Q as messagePortTransport,y as serializeParsedLine,x as serializeParsingResult,m as serializeValue,B as startWorkerRuntime};//# sourceMappingURL=worker.js.map
|
|
484
3
|
//# sourceMappingURL=worker.js.map
|