@metamask/snaps-utils 7.0.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/dist/array.js +2 -2
- package/dist/array.mjs +2 -2
- package/dist/auxiliary-files.js +6 -6
- package/dist/auxiliary-files.mjs +6 -6
- package/dist/base64.js +5 -5
- package/dist/base64.mjs +5 -5
- package/dist/bytes.js +4 -4
- package/dist/bytes.mjs +4 -4
- package/dist/caveats.js +2 -2
- package/dist/caveats.mjs +2 -2
- package/dist/checksum.js +5 -5
- package/dist/checksum.mjs +5 -5
- package/dist/{chunk-Y3F7VUZB.mjs → chunk-224DMTNJ.mjs} +10 -10
- package/dist/{chunk-FJH6DDEL.mjs → chunk-2IWSQJKQ.mjs} +3 -3
- package/dist/{chunk-2QS3W66J.js → chunk-2LBN5T56.js} +4 -4
- package/dist/{chunk-3TH3NLQL.js → chunk-2PCPD5XY.js} +6 -6
- package/dist/{chunk-KWQKGJSV.js → chunk-3SOYDY4W.js} +1 -1
- package/dist/{chunk-ZXCNX3ZB.mjs → chunk-44GPX66J.mjs} +1 -1
- package/dist/{chunk-WDGBH5CP.js → chunk-44VFHYJO.js} +9 -9
- package/dist/chunk-44VFHYJO.js.map +1 -0
- package/dist/{chunk-R4BBIGBN.js → chunk-473MIETW.js} +3 -3
- package/dist/{chunk-KEXZDQAN.js → chunk-4BDR6KRH.js} +2 -2
- package/dist/chunk-4CMD46B2.js +1 -0
- package/dist/{chunk-TUAHXE75.mjs → chunk-5R7UF7KM.mjs} +1 -1
- package/dist/{chunk-P5V6S2PA.mjs → chunk-63OXILAY.mjs} +2 -2
- package/dist/{chunk-QWEXXUTO.mjs → chunk-6CHO3LOX.mjs} +1 -1
- package/dist/{chunk-B3YQVRPE.js → chunk-6LOYTBS3.js} +4 -4
- package/dist/{chunk-VGWELVCX.mjs → chunk-6YRUDGNL.mjs} +2 -2
- package/dist/{chunk-7H5TGXZ5.js → chunk-772OPTGX.js} +3 -3
- package/dist/{chunk-XC5E26VE.mjs → chunk-7LG4D4XA.mjs} +1 -1
- package/dist/chunk-7LOABHVW.js +1 -0
- package/dist/chunk-7MTAHOWC.mjs +1 -0
- package/dist/{chunk-F33RMB76.js → chunk-7P62OIGX.js} +7 -7
- package/dist/{chunk-32B4YQM7.mjs → chunk-7Y3WSN44.mjs} +3 -3
- package/dist/chunk-A3RRMELT.mjs +1 -0
- package/dist/{chunk-GMC2A3D7.js → chunk-A6E325SZ.js} +3 -3
- package/dist/{chunk-RS5HE55U.js → chunk-AFQY2CNY.js} +3 -3
- package/dist/{chunk-I3BUOULW.js → chunk-AOGVLPQZ.js} +1 -1
- package/dist/{chunk-QF3LHIJ5.mjs → chunk-AS5P6JRP.mjs} +1 -1
- package/dist/{chunk-MJABESWH.js → chunk-ASZWZ7JT.js} +1 -1
- package/dist/{chunk-3ZSMMNQB.mjs → chunk-BGSO2GQC.mjs} +1 -1
- package/dist/{chunk-4UMDRHDR.js → chunk-CMOSYNZR.js} +2 -2
- package/dist/{chunk-GK4IJQVW.js → chunk-CNNMLOQ6.js} +43 -43
- package/dist/{chunk-ZRVOIW3H.js → chunk-CQRPSEH3.js} +3 -3
- package/dist/{chunk-DKSB4FMW.mjs → chunk-DKDGMZFU.mjs} +1 -1
- package/dist/{chunk-IWENO6LT.js → chunk-E3BDBG6T.js} +1 -1
- package/dist/{chunk-YLT6CNSL.mjs → chunk-EA2FOAEG.mjs} +1 -1
- package/dist/chunk-EFRPCO3C.js +1 -0
- package/dist/{chunk-OQSLMZJN.js → chunk-ENKAY3PI.js} +18 -18
- package/dist/{chunk-7T3N2ZGQ.mjs → chunk-EXUEHPZ4.mjs} +1 -1
- package/dist/{chunk-JGMGNLZW.mjs → chunk-FOWIC2SO.mjs} +2 -2
- package/dist/{chunk-2IVFF3AA.mjs → chunk-GTAYOKI4.mjs} +2 -2
- package/dist/{chunk-6H32HLTZ.js → chunk-HF7HUZ5Z.js} +1 -1
- package/dist/{chunk-LHIPBIPS.mjs → chunk-HJRCBSNA.mjs} +2 -2
- package/dist/chunk-HJYRGKCX.js +50 -0
- package/dist/chunk-HYF7Q6VY.mjs +1 -0
- package/dist/{chunk-Z4J4GUGG.mjs → chunk-I77AVJKV.mjs} +1 -1
- package/dist/{chunk-HOTDTMNP.mjs → chunk-IGMAXVPP.mjs} +2 -2
- package/dist/{chunk-7KKLGQNE.js → chunk-IHQPAJ2B.js} +3 -3
- package/dist/{chunk-6WBLB5BX.js → chunk-IJX3CXOY.js} +1 -1
- package/dist/{chunk-WJOAEPZ7.js → chunk-IPOE62V4.js} +1 -1
- package/dist/{chunk-7XA5VYYV.mjs → chunk-IV3FSWZ7.mjs} +1 -1
- package/dist/{chunk-7PNGOFLU.js → chunk-IXBJNVHK.js} +3 -3
- package/dist/chunk-JI5NQ2C3.mjs +1 -0
- package/dist/{chunk-4GBOSMF7.mjs → chunk-JMDSN227.mjs} +2 -10
- package/dist/{chunk-XRGYWWT7.js → chunk-K6BCBPXF.js} +1 -1
- package/dist/{chunk-2G4HD42C.mjs → chunk-KMLVVVK3.mjs} +2 -2
- package/dist/{chunk-ZLFA4R5X.js → chunk-LBRWAC27.js} +3 -3
- package/dist/{chunk-HWFLO7W5.mjs → chunk-LCWDLIK5.mjs} +8 -8
- package/dist/{chunk-XEY3KVEH.js → chunk-LEKZPKS2.js} +1 -1
- package/dist/{chunk-TURGGK5F.mjs → chunk-LSPOXPJJ.mjs} +9 -5
- package/dist/chunk-LSPOXPJJ.mjs.map +1 -0
- package/dist/{chunk-UGQQ5DJ4.mjs → chunk-MCEKOGEG.mjs} +1 -1
- package/dist/{chunk-224S5XKL.js → chunk-MLOQHUOY.js} +5 -5
- package/dist/{chunk-QYFDFOWT.js → chunk-N722KRZW.js} +1 -1
- package/dist/{chunk-Q7FGULTV.js → chunk-NUCLSR2G.js} +1 -1
- package/dist/{chunk-XKXHM3PC.mjs → chunk-P252LKUT.mjs} +1 -1
- package/dist/{chunk-IUNNN6HN.mjs → chunk-PJMEJVOB.mjs} +1 -1
- package/dist/{chunk-RRPU7M4Y.js → chunk-PLBSSUVY.js} +1 -1
- package/dist/chunk-Q7RCL5IE.js +30 -0
- package/dist/{chunk-R7UAMO2U.js → chunk-QSCKTRRU.js} +3 -3
- package/dist/{chunk-H34N3OWO.mjs → chunk-QX6MAFJU.mjs} +2 -2
- package/dist/{chunk-O3XKEEJV.mjs → chunk-QYPLUMB7.mjs} +2 -2
- package/dist/chunk-QYPLUMB7.mjs.map +1 -0
- package/dist/chunk-RAZ7XG4Z.mjs +1 -0
- package/dist/chunk-RAZ7XG4Z.mjs.map +1 -0
- package/dist/{chunk-6CTV7VW5.mjs → chunk-SRMDDOVO.mjs} +1 -1
- package/dist/chunk-T3VM5YXY.js +1 -0
- package/dist/{chunk-FTY3BOF7.js → chunk-T3YY4JIJ.js} +1 -1
- package/dist/{chunk-ZVXX2CTH.mjs → chunk-T6FWIDA6.mjs} +1 -1
- package/dist/chunk-TFP64TMV.js +1 -0
- package/dist/{chunk-H636DAOG.js → chunk-TG4BDSYJ.js} +12 -12
- package/dist/{chunk-43EBXDVP.mjs → chunk-UMZNVWEM.mjs} +1 -1
- package/dist/{chunk-3SARO5TJ.mjs → chunk-UW74NLTC.mjs} +1 -1
- package/dist/{chunk-GW5NQXN4.mjs → chunk-VWGXNUMD.mjs} +2 -2
- package/dist/{chunk-N52KMB25.mjs → chunk-WEOCOYES.mjs} +2 -2
- package/dist/{chunk-4IKNNAVC.mjs → chunk-WF56W2AR.mjs} +5 -5
- package/dist/{chunk-VMUXXXJC.js → chunk-X44Z53IG.js} +5 -5
- package/dist/{chunk-B2DMAQNK.mjs → chunk-Z2JQNSVL.mjs} +1 -1
- package/dist/{chunk-LOW2T4MV.mjs → chunk-ZJRWU4AJ.mjs} +2 -2
- package/dist/{chunk-MSUZTHYT.js → chunk-ZT3KKTS2.js} +1 -1
- package/dist/cronjob.js +2 -2
- package/dist/cronjob.mjs +2 -2
- package/dist/deep-clone.js +2 -2
- package/dist/deep-clone.mjs +2 -2
- package/dist/default-endowments.js +2 -2
- package/dist/default-endowments.mjs +2 -2
- package/dist/derivation-paths.js +3 -3
- package/dist/derivation-paths.mjs +3 -3
- package/dist/entropy.js +2 -2
- package/dist/entropy.mjs +2 -2
- package/dist/errors.js +2 -2
- package/dist/errors.mjs +2 -2
- package/dist/eval-worker.js +5 -5
- package/dist/eval-worker.mjs +4 -4
- package/dist/eval.js +9 -9
- package/dist/eval.mjs +9 -9
- package/dist/fs.js +8 -8
- package/dist/fs.mjs +8 -8
- package/dist/handler-types.js +2 -2
- package/dist/handler-types.mjs +2 -2
- package/dist/handlers.js +3 -3
- package/dist/handlers.mjs +3 -3
- package/dist/icon.js +2 -2
- package/dist/icon.mjs +2 -2
- package/dist/iframe.js +2 -2
- package/dist/iframe.mjs +2 -2
- package/dist/index.executionenv.js +8 -8
- package/dist/index.executionenv.mjs +8 -8
- package/dist/index.js +35 -35
- package/dist/index.mjs +35 -35
- package/dist/json-rpc.js +2 -2
- package/dist/json-rpc.mjs +2 -2
- package/dist/json.js +2 -2
- package/dist/json.mjs +2 -2
- package/dist/localization.js +3 -3
- package/dist/localization.mjs +3 -3
- package/dist/logging.js +2 -2
- package/dist/logging.mjs +2 -2
- package/dist/manifest/index.js +15 -15
- package/dist/manifest/index.mjs +15 -15
- package/dist/manifest/manifest.js +22 -22
- package/dist/manifest/manifest.mjs +22 -22
- package/dist/manifest/node.js +24 -24
- package/dist/manifest/node.mjs +24 -24
- package/dist/manifest/validation.js +14 -14
- package/dist/manifest/validation.mjs +14 -14
- package/dist/mock.js +3 -3
- package/dist/mock.mjs +3 -3
- package/dist/namespace.js +2 -2
- package/dist/namespace.mjs +2 -2
- package/dist/node.js +43 -43
- package/dist/node.mjs +43 -43
- package/dist/npm.js +22 -22
- package/dist/npm.mjs +22 -22
- package/dist/path.js +2 -2
- package/dist/path.mjs +2 -2
- package/dist/post-process.js +2 -2
- package/dist/post-process.mjs +2 -2
- package/dist/snaps.js +8 -8
- package/dist/snaps.mjs +8 -8
- package/dist/strings.js +2 -2
- package/dist/strings.mjs +2 -2
- package/dist/structs.js +3 -3
- package/dist/structs.mjs +3 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types.js +2 -2
- package/dist/types.mjs +2 -2
- package/dist/ui.js +2 -2
- package/dist/ui.mjs +2 -2
- package/dist/validation.js +18 -18
- package/dist/validation.mjs +18 -18
- package/dist/versions.js +2 -2
- package/dist/versions.mjs +2 -2
- package/dist/virtual-file/VirtualFile.js +3 -3
- package/dist/virtual-file/VirtualFile.mjs +3 -3
- package/dist/virtual-file/index.js +4 -4
- package/dist/virtual-file/index.mjs +4 -4
- package/dist/virtual-file/node.js +6 -6
- package/dist/virtual-file/node.mjs +6 -6
- package/dist/virtual-file/toVirtualFile.js +4 -4
- package/dist/virtual-file/toVirtualFile.mjs +4 -4
- package/package.json +2 -2
- package/dist/chunk-2XF32FCF.js +0 -1
- package/dist/chunk-4GBOSMF7.mjs.map +0 -1
- package/dist/chunk-DK3IYVMP.mjs +0 -1
- package/dist/chunk-IIDK6BRC.mjs +0 -1
- package/dist/chunk-JV7OA3FD.js +0 -1
- package/dist/chunk-LEFOMYX3.mjs +0 -1
- package/dist/chunk-MYSBDK36.mjs +0 -1
- package/dist/chunk-O3XKEEJV.mjs.map +0 -1
- package/dist/chunk-O4PW77JW.mjs +0 -1
- package/dist/chunk-Q5T57UNN.js +0 -1
- package/dist/chunk-QJTAFTW7.js +0 -30
- package/dist/chunk-TURGGK5F.mjs.map +0 -1
- package/dist/chunk-WDGBH5CP.js.map +0 -1
- package/dist/chunk-XDEHYKW2.js +0 -1
- package/dist/chunk-XWFKTDB3.js +0 -50
- package/dist/chunk-YF4PGFCO.js +0 -1
- /package/dist/{chunk-Y3F7VUZB.mjs.map → chunk-224DMTNJ.mjs.map} +0 -0
- /package/dist/{chunk-FJH6DDEL.mjs.map → chunk-2IWSQJKQ.mjs.map} +0 -0
- /package/dist/{chunk-2QS3W66J.js.map → chunk-2LBN5T56.js.map} +0 -0
- /package/dist/{chunk-3TH3NLQL.js.map → chunk-2PCPD5XY.js.map} +0 -0
- /package/dist/{chunk-KWQKGJSV.js.map → chunk-3SOYDY4W.js.map} +0 -0
- /package/dist/{chunk-ZXCNX3ZB.mjs.map → chunk-44GPX66J.mjs.map} +0 -0
- /package/dist/{chunk-R4BBIGBN.js.map → chunk-473MIETW.js.map} +0 -0
- /package/dist/{chunk-KEXZDQAN.js.map → chunk-4BDR6KRH.js.map} +0 -0
- /package/dist/{chunk-2XF32FCF.js.map → chunk-4CMD46B2.js.map} +0 -0
- /package/dist/{chunk-TUAHXE75.mjs.map → chunk-5R7UF7KM.mjs.map} +0 -0
- /package/dist/{chunk-P5V6S2PA.mjs.map → chunk-63OXILAY.mjs.map} +0 -0
- /package/dist/{chunk-QWEXXUTO.mjs.map → chunk-6CHO3LOX.mjs.map} +0 -0
- /package/dist/{chunk-B3YQVRPE.js.map → chunk-6LOYTBS3.js.map} +0 -0
- /package/dist/{chunk-VGWELVCX.mjs.map → chunk-6YRUDGNL.mjs.map} +0 -0
- /package/dist/{chunk-7H5TGXZ5.js.map → chunk-772OPTGX.js.map} +0 -0
- /package/dist/{chunk-XC5E26VE.mjs.map → chunk-7LG4D4XA.mjs.map} +0 -0
- /package/dist/{chunk-JV7OA3FD.js.map → chunk-7LOABHVW.js.map} +0 -0
- /package/dist/{chunk-DK3IYVMP.mjs.map → chunk-7MTAHOWC.mjs.map} +0 -0
- /package/dist/{chunk-F33RMB76.js.map → chunk-7P62OIGX.js.map} +0 -0
- /package/dist/{chunk-32B4YQM7.mjs.map → chunk-7Y3WSN44.mjs.map} +0 -0
- /package/dist/{chunk-IIDK6BRC.mjs.map → chunk-A3RRMELT.mjs.map} +0 -0
- /package/dist/{chunk-GMC2A3D7.js.map → chunk-A6E325SZ.js.map} +0 -0
- /package/dist/{chunk-RS5HE55U.js.map → chunk-AFQY2CNY.js.map} +0 -0
- /package/dist/{chunk-I3BUOULW.js.map → chunk-AOGVLPQZ.js.map} +0 -0
- /package/dist/{chunk-QF3LHIJ5.mjs.map → chunk-AS5P6JRP.mjs.map} +0 -0
- /package/dist/{chunk-MJABESWH.js.map → chunk-ASZWZ7JT.js.map} +0 -0
- /package/dist/{chunk-3ZSMMNQB.mjs.map → chunk-BGSO2GQC.mjs.map} +0 -0
- /package/dist/{chunk-4UMDRHDR.js.map → chunk-CMOSYNZR.js.map} +0 -0
- /package/dist/{chunk-GK4IJQVW.js.map → chunk-CNNMLOQ6.js.map} +0 -0
- /package/dist/{chunk-ZRVOIW3H.js.map → chunk-CQRPSEH3.js.map} +0 -0
- /package/dist/{chunk-DKSB4FMW.mjs.map → chunk-DKDGMZFU.mjs.map} +0 -0
- /package/dist/{chunk-IWENO6LT.js.map → chunk-E3BDBG6T.js.map} +0 -0
- /package/dist/{chunk-YLT6CNSL.mjs.map → chunk-EA2FOAEG.mjs.map} +0 -0
- /package/dist/{chunk-Q5T57UNN.js.map → chunk-EFRPCO3C.js.map} +0 -0
- /package/dist/{chunk-OQSLMZJN.js.map → chunk-ENKAY3PI.js.map} +0 -0
- /package/dist/{chunk-7T3N2ZGQ.mjs.map → chunk-EXUEHPZ4.mjs.map} +0 -0
- /package/dist/{chunk-JGMGNLZW.mjs.map → chunk-FOWIC2SO.mjs.map} +0 -0
- /package/dist/{chunk-2IVFF3AA.mjs.map → chunk-GTAYOKI4.mjs.map} +0 -0
- /package/dist/{chunk-6H32HLTZ.js.map → chunk-HF7HUZ5Z.js.map} +0 -0
- /package/dist/{chunk-LHIPBIPS.mjs.map → chunk-HJRCBSNA.mjs.map} +0 -0
- /package/dist/{chunk-XWFKTDB3.js.map → chunk-HJYRGKCX.js.map} +0 -0
- /package/dist/{chunk-LEFOMYX3.mjs.map → chunk-HYF7Q6VY.mjs.map} +0 -0
- /package/dist/{chunk-Z4J4GUGG.mjs.map → chunk-I77AVJKV.mjs.map} +0 -0
- /package/dist/{chunk-HOTDTMNP.mjs.map → chunk-IGMAXVPP.mjs.map} +0 -0
- /package/dist/{chunk-7KKLGQNE.js.map → chunk-IHQPAJ2B.js.map} +0 -0
- /package/dist/{chunk-6WBLB5BX.js.map → chunk-IJX3CXOY.js.map} +0 -0
- /package/dist/{chunk-WJOAEPZ7.js.map → chunk-IPOE62V4.js.map} +0 -0
- /package/dist/{chunk-7XA5VYYV.mjs.map → chunk-IV3FSWZ7.mjs.map} +0 -0
- /package/dist/{chunk-7PNGOFLU.js.map → chunk-IXBJNVHK.js.map} +0 -0
- /package/dist/{chunk-MYSBDK36.mjs.map → chunk-JI5NQ2C3.mjs.map} +0 -0
- /package/dist/{chunk-O4PW77JW.mjs.map → chunk-JMDSN227.mjs.map} +0 -0
- /package/dist/{chunk-XRGYWWT7.js.map → chunk-K6BCBPXF.js.map} +0 -0
- /package/dist/{chunk-2G4HD42C.mjs.map → chunk-KMLVVVK3.mjs.map} +0 -0
- /package/dist/{chunk-ZLFA4R5X.js.map → chunk-LBRWAC27.js.map} +0 -0
- /package/dist/{chunk-HWFLO7W5.mjs.map → chunk-LCWDLIK5.mjs.map} +0 -0
- /package/dist/{chunk-XEY3KVEH.js.map → chunk-LEKZPKS2.js.map} +0 -0
- /package/dist/{chunk-UGQQ5DJ4.mjs.map → chunk-MCEKOGEG.mjs.map} +0 -0
- /package/dist/{chunk-224S5XKL.js.map → chunk-MLOQHUOY.js.map} +0 -0
- /package/dist/{chunk-QYFDFOWT.js.map → chunk-N722KRZW.js.map} +0 -0
- /package/dist/{chunk-Q7FGULTV.js.map → chunk-NUCLSR2G.js.map} +0 -0
- /package/dist/{chunk-XKXHM3PC.mjs.map → chunk-P252LKUT.mjs.map} +0 -0
- /package/dist/{chunk-IUNNN6HN.mjs.map → chunk-PJMEJVOB.mjs.map} +0 -0
- /package/dist/{chunk-RRPU7M4Y.js.map → chunk-PLBSSUVY.js.map} +0 -0
- /package/dist/{chunk-QJTAFTW7.js.map → chunk-Q7RCL5IE.js.map} +0 -0
- /package/dist/{chunk-R7UAMO2U.js.map → chunk-QSCKTRRU.js.map} +0 -0
- /package/dist/{chunk-H34N3OWO.mjs.map → chunk-QX6MAFJU.mjs.map} +0 -0
- /package/dist/{chunk-6CTV7VW5.mjs.map → chunk-SRMDDOVO.mjs.map} +0 -0
- /package/dist/{chunk-XDEHYKW2.js.map → chunk-T3VM5YXY.js.map} +0 -0
- /package/dist/{chunk-FTY3BOF7.js.map → chunk-T3YY4JIJ.js.map} +0 -0
- /package/dist/{chunk-ZVXX2CTH.mjs.map → chunk-T6FWIDA6.mjs.map} +0 -0
- /package/dist/{chunk-YF4PGFCO.js.map → chunk-TFP64TMV.js.map} +0 -0
- /package/dist/{chunk-H636DAOG.js.map → chunk-TG4BDSYJ.js.map} +0 -0
- /package/dist/{chunk-43EBXDVP.mjs.map → chunk-UMZNVWEM.mjs.map} +0 -0
- /package/dist/{chunk-3SARO5TJ.mjs.map → chunk-UW74NLTC.mjs.map} +0 -0
- /package/dist/{chunk-GW5NQXN4.mjs.map → chunk-VWGXNUMD.mjs.map} +0 -0
- /package/dist/{chunk-N52KMB25.mjs.map → chunk-WEOCOYES.mjs.map} +0 -0
- /package/dist/{chunk-4IKNNAVC.mjs.map → chunk-WF56W2AR.mjs.map} +0 -0
- /package/dist/{chunk-VMUXXXJC.js.map → chunk-X44Z53IG.js.map} +0 -0
- /package/dist/{chunk-B2DMAQNK.mjs.map → chunk-Z2JQNSVL.mjs.map} +0 -0
- /package/dist/{chunk-LOW2T4MV.mjs.map → chunk-ZJRWU4AJ.mjs.map} +0 -0
- /package/dist/{chunk-MSUZTHYT.js.map → chunk-ZT3KKTS2.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [7.0.1]
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fix minor build configuration problems ([#2220](https://github.com/MetaMask/snaps/pull/2220))
|
|
12
|
+
- Fix regex for HTML comment tokens ([#2222](https://github.com/MetaMask/snaps/pull/2222))
|
|
13
|
+
|
|
9
14
|
## [7.0.0]
|
|
10
15
|
### Changed
|
|
11
16
|
- **BREAKING:** Update ESM build to be fully compliant with the ESM standard ([#2210](https://github.com/MetaMask/snaps/pull/2210))
|
|
@@ -185,7 +190,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
185
190
|
- The version of the package no longer needs to match the version of all other
|
|
186
191
|
MetaMask Snaps packages.
|
|
187
192
|
|
|
188
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@7.0.
|
|
193
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@7.0.1...HEAD
|
|
194
|
+
[7.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@7.0.0...@metamask/snaps-utils@7.0.1
|
|
189
195
|
[7.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@6.1.0...@metamask/snaps-utils@7.0.0
|
|
190
196
|
[6.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@6.0.0...@metamask/snaps-utils@6.1.0
|
|
191
197
|
[6.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-utils@5.2.0...@metamask/snaps-utils@6.0.0
|
package/dist/array.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkT3YY4JIJjs = require('./chunk-T3YY4JIJ.js');
|
|
4
4
|
require('./chunk-PHUTP7NB.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
exports.isEqual =
|
|
7
|
+
exports.isEqual = _chunkT3YY4JIJjs.isEqual;
|
|
8
8
|
//# sourceMappingURL=array.js.map
|
package/dist/array.mjs
CHANGED
package/dist/auxiliary-files.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
3
|
+
var _chunkIXBJNVHKjs = require('./chunk-IXBJNVHK.js');
|
|
4
|
+
require('./chunk-IHQPAJ2B.js');
|
|
5
|
+
require('./chunk-473MIETW.js');
|
|
6
|
+
require('./chunk-HJYRGKCX.js');
|
|
7
|
+
require('./chunk-NUCLSR2G.js');
|
|
8
8
|
require('./chunk-PHUTP7NB.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.encodeAuxiliaryFile =
|
|
11
|
+
exports.encodeAuxiliaryFile = _chunkIXBJNVHKjs.encodeAuxiliaryFile;
|
|
12
12
|
//# sourceMappingURL=auxiliary-files.js.map
|
package/dist/auxiliary-files.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodeAuxiliaryFile
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KMLVVVK3.mjs";
|
|
4
|
+
import "./chunk-FOWIC2SO.mjs";
|
|
5
|
+
import "./chunk-6YRUDGNL.mjs";
|
|
6
|
+
import "./chunk-ZJRWU4AJ.mjs";
|
|
7
|
+
import "./chunk-Z2JQNSVL.mjs";
|
|
8
|
+
import "./chunk-JMDSN227.mjs";
|
|
9
9
|
export {
|
|
10
10
|
encodeAuxiliaryFile
|
|
11
11
|
};
|
package/dist/base64.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
4
|
+
var _chunkIHQPAJ2Bjs = require('./chunk-IHQPAJ2B.js');
|
|
5
|
+
require('./chunk-473MIETW.js');
|
|
6
|
+
require('./chunk-HJYRGKCX.js');
|
|
7
|
+
require('./chunk-NUCLSR2G.js');
|
|
8
8
|
require('./chunk-PHUTP7NB.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.decodeBase64 =
|
|
12
|
+
exports.decodeBase64 = _chunkIHQPAJ2Bjs.decodeBase64; exports.encodeBase64 = _chunkIHQPAJ2Bjs.encodeBase64;
|
|
13
13
|
//# sourceMappingURL=base64.js.map
|
package/dist/base64.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeBase64,
|
|
3
3
|
encodeBase64
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-FOWIC2SO.mjs";
|
|
5
|
+
import "./chunk-6YRUDGNL.mjs";
|
|
6
|
+
import "./chunk-ZJRWU4AJ.mjs";
|
|
7
|
+
import "./chunk-Z2JQNSVL.mjs";
|
|
8
|
+
import "./chunk-JMDSN227.mjs";
|
|
9
9
|
export {
|
|
10
10
|
decodeBase64,
|
|
11
11
|
encodeBase64
|
package/dist/bytes.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunk473MIETWjs = require('./chunk-473MIETW.js');
|
|
4
|
+
require('./chunk-HJYRGKCX.js');
|
|
5
|
+
require('./chunk-NUCLSR2G.js');
|
|
6
6
|
require('./chunk-PHUTP7NB.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.getBytes =
|
|
9
|
+
exports.getBytes = _chunk473MIETWjs.getBytes;
|
|
10
10
|
//# sourceMappingURL=bytes.js.map
|
package/dist/bytes.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBytes
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-6YRUDGNL.mjs";
|
|
4
|
+
import "./chunk-ZJRWU4AJ.mjs";
|
|
5
|
+
import "./chunk-Z2JQNSVL.mjs";
|
|
6
|
+
import "./chunk-JMDSN227.mjs";
|
|
7
7
|
export {
|
|
8
8
|
getBytes
|
|
9
9
|
};
|
package/dist/caveats.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkASZWZ7JTjs = require('./chunk-ASZWZ7JT.js');
|
|
4
4
|
require('./chunk-PHUTP7NB.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
exports.SnapCaveatType =
|
|
7
|
+
exports.SnapCaveatType = _chunkASZWZ7JTjs.SnapCaveatType;
|
|
8
8
|
//# sourceMappingURL=caveats.js.map
|
package/dist/caveats.mjs
CHANGED
package/dist/checksum.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
4
|
+
var _chunkMLOQHUOYjs = require('./chunk-MLOQHUOY.js');
|
|
5
|
+
require('./chunk-473MIETW.js');
|
|
6
|
+
require('./chunk-HJYRGKCX.js');
|
|
7
|
+
require('./chunk-NUCLSR2G.js');
|
|
8
8
|
require('./chunk-PHUTP7NB.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.checksum =
|
|
12
|
+
exports.checksum = _chunkMLOQHUOYjs.checksum; exports.checksumFiles = _chunkMLOQHUOYjs.checksumFiles;
|
|
13
13
|
//# sourceMappingURL=checksum.js.map
|
package/dist/checksum.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
checksum,
|
|
3
3
|
checksumFiles
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-HJRCBSNA.mjs";
|
|
5
|
+
import "./chunk-6YRUDGNL.mjs";
|
|
6
|
+
import "./chunk-ZJRWU4AJ.mjs";
|
|
7
|
+
import "./chunk-Z2JQNSVL.mjs";
|
|
8
|
+
import "./chunk-JMDSN227.mjs";
|
|
9
9
|
export {
|
|
10
10
|
checksum,
|
|
11
11
|
checksumFiles
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertIsSnapManifest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LCWDLIK5.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ProgrammaticallyFixableSnapError,
|
|
6
6
|
getSnapChecksum,
|
|
7
7
|
validateSnapShasum
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2IWSQJKQ.mjs";
|
|
9
9
|
import {
|
|
10
10
|
assertIsSnapIcon,
|
|
11
11
|
getSvgDimensions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MCEKOGEG.mjs";
|
|
13
13
|
import {
|
|
14
14
|
SnapValidationFailureReason,
|
|
15
15
|
assertIsNpmSnapPackageJson
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-T6FWIDA6.mjs";
|
|
17
17
|
import {
|
|
18
18
|
getValidatedLocalizationFiles,
|
|
19
19
|
validateSnapManifestLocalizations
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WEOCOYES.mjs";
|
|
21
21
|
import {
|
|
22
22
|
readJsonFile
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7Y3WSN44.mjs";
|
|
24
24
|
import {
|
|
25
25
|
readVirtualFile
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IGMAXVPP.mjs";
|
|
27
27
|
import {
|
|
28
28
|
VirtualFile
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-ZJRWU4AJ.mjs";
|
|
30
30
|
import {
|
|
31
31
|
deepClone
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-Z2JQNSVL.mjs";
|
|
33
33
|
|
|
34
34
|
// src/manifest/manifest.ts
|
|
35
35
|
import { getErrorMessage } from "@metamask/snaps-sdk";
|
|
@@ -406,4 +406,4 @@ export {
|
|
|
406
406
|
getWritableManifest,
|
|
407
407
|
validateNpmSnapManifest
|
|
408
408
|
};
|
|
409
|
-
//# sourceMappingURL=chunk-
|
|
409
|
+
//# sourceMappingURL=chunk-224DMTNJ.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SnapIdPrefixes,
|
|
3
3
|
uri
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-T6FWIDA6.mjs";
|
|
5
5
|
import {
|
|
6
6
|
checksumFiles
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HJRCBSNA.mjs";
|
|
8
8
|
|
|
9
9
|
// src/snaps.ts
|
|
10
10
|
import { assert, isObject, assertStruct } from "@metamask/utils";
|
|
@@ -190,4 +190,4 @@ export {
|
|
|
190
190
|
isSnapPermitted,
|
|
191
191
|
verifyRequestedSnapPermissions
|
|
192
192
|
};
|
|
193
|
-
//# sourceMappingURL=chunk-
|
|
193
|
+
//# sourceMappingURL=chunk-2IWSQJKQ.mjs.map
|
|
@@ -19,7 +19,7 @@ var CronExpressionStruct = _superstruct.refine.call(void 0,
|
|
|
19
19
|
try {
|
|
20
20
|
_cronparser.parseExpression.call(void 0, value);
|
|
21
21
|
return true;
|
|
22
|
-
} catch
|
|
22
|
+
} catch {
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -36,7 +36,7 @@ function isCronjobSpecification(value) {
|
|
|
36
36
|
try {
|
|
37
37
|
_superstruct.create.call(void 0, value, CronjobSpecificationStruct);
|
|
38
38
|
return true;
|
|
39
|
-
} catch
|
|
39
|
+
} catch {
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -47,7 +47,7 @@ function isCronjobSpecificationArray(value) {
|
|
|
47
47
|
try {
|
|
48
48
|
_superstruct.create.call(void 0, value, CronjobSpecificationArrayStruct);
|
|
49
49
|
return true;
|
|
50
|
-
} catch
|
|
50
|
+
} catch {
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -61,4 +61,4 @@ function isCronjobSpecificationArray(value) {
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
exports.CronjobRpcRequestStruct = CronjobRpcRequestStruct; exports.CronExpressionStruct = CronExpressionStruct; exports.parseCronExpression = parseCronExpression; exports.CronjobSpecificationStruct = CronjobSpecificationStruct; exports.isCronjobSpecification = isCronjobSpecification; exports.CronjobSpecificationArrayStruct = CronjobSpecificationArrayStruct; exports.isCronjobSpecificationArray = isCronjobSpecificationArray;
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-2LBN5T56.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkT3YY4JIJjs = require('./chunk-T3YY4JIJ.js');
|
|
4
4
|
|
|
5
5
|
// src/derivation-paths.ts
|
|
6
6
|
var _slip44 = require('@metamask/slip44'); var _slip442 = _interopRequireDefault(_slip44);
|
|
@@ -143,14 +143,14 @@ var SNAPS_DERIVATION_PATHS = [
|
|
|
143
143
|
];
|
|
144
144
|
function getSnapDerivationPathName(path, curve) {
|
|
145
145
|
const pathMetadata = SNAPS_DERIVATION_PATHS.find(
|
|
146
|
-
(derivationPath) => derivationPath.curve === curve &&
|
|
146
|
+
(derivationPath) => derivationPath.curve === curve && _chunkT3YY4JIJjs.isEqual.call(void 0, derivationPath.path, path)
|
|
147
147
|
);
|
|
148
148
|
if (pathMetadata) {
|
|
149
149
|
return pathMetadata.name;
|
|
150
150
|
}
|
|
151
151
|
if (curve === "secp256k1" && path[0] === "m" && path[1] === `44'` && path[2].endsWith(`'`)) {
|
|
152
152
|
const coinType = path[2].slice(0, -1);
|
|
153
|
-
return
|
|
153
|
+
return getSlip44ProtocolName(coinType) ?? null;
|
|
154
154
|
}
|
|
155
155
|
return null;
|
|
156
156
|
}
|
|
@@ -158,7 +158,7 @@ function getSlip44ProtocolName(coinType) {
|
|
|
158
158
|
if (String(coinType) === "1") {
|
|
159
159
|
return "Test Networks";
|
|
160
160
|
}
|
|
161
|
-
return
|
|
161
|
+
return _slip442.default[coinType]?.name ?? null;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
|
|
@@ -166,4 +166,4 @@ function getSlip44ProtocolName(coinType) {
|
|
|
166
166
|
|
|
167
167
|
|
|
168
168
|
exports.SNAPS_DERIVATION_PATHS = SNAPS_DERIVATION_PATHS; exports.getSnapDerivationPathName = getSnapDerivationPathName; exports.getSlip44ProtocolName = getSlip44ProtocolName;
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
//# sourceMappingURL=chunk-2PCPD5XY.js.map
|
|
@@ -149,4 +149,4 @@ var OnNameLookupResponseStruct = _superstruct.nullable.call(void 0,
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
exports.SNAP_EXPORTS = SNAP_EXPORTS; exports.OnTransactionSeverityResponseStruct = OnTransactionSeverityResponseStruct; exports.OnTransactionResponseWithIdStruct = OnTransactionResponseWithIdStruct; exports.OnTransactionResponseWithContentStruct = OnTransactionResponseWithContentStruct; exports.OnTransactionResponseStruct = OnTransactionResponseStruct; exports.OnSignatureResponseStruct = OnSignatureResponseStruct; exports.OnHomePageResponseWithContentStruct = OnHomePageResponseWithContentStruct; exports.OnHomePageResponseWithIdStruct = OnHomePageResponseWithIdStruct; exports.OnHomePageResponseStruct = OnHomePageResponseStruct; exports.AddressResolutionStruct = AddressResolutionStruct; exports.DomainResolutionStruct = DomainResolutionStruct; exports.AddressResolutionResponseStruct = AddressResolutionResponseStruct; exports.DomainResolutionResponseStruct = DomainResolutionResponseStruct; exports.OnNameLookupResponseStruct = OnNameLookupResponseStruct;
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
152
|
+
//# sourceMappingURL=chunk-3SOYDY4W.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/post-process.ts
|
|
2
2
|
var _core = require('@babel/core');
|
|
3
3
|
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ var PostProcessWarning = /* @__PURE__ */ ((PostProcessWarning2) => {
|
|
|
12
12
|
PostProcessWarning2["UnsafeMathRandom"] = "`Math.random` was detected in the Snap bundle. This is not a secure source of randomness, and should not be used in a secure context. Use `crypto.getRandomValues` instead.";
|
|
13
13
|
return PostProcessWarning2;
|
|
14
14
|
})(PostProcessWarning || {});
|
|
15
|
-
var TOKEN_REGEX = /(<!)(--)|(--)(>)|(import)(\(.*?\))/gu;
|
|
15
|
+
var TOKEN_REGEX = /(<!)(--)|(--)(>)|(--)(!)(>)|(import)(\(.*?\))/gu;
|
|
16
16
|
var EMPTY_TEMPLATE_ELEMENT = _types.templateElement.call(void 0, { raw: "", cooked: "" });
|
|
17
17
|
var evalWrapper = _core.template.statement(`
|
|
18
18
|
(1, REF)(ARGS)
|
|
@@ -78,14 +78,14 @@ function postProcessBundle(code, {
|
|
|
78
78
|
} = {}) {
|
|
79
79
|
const warnings = /* @__PURE__ */ new Set();
|
|
80
80
|
const pre = ({ ast }) => {
|
|
81
|
-
|
|
81
|
+
ast.comments?.forEach((comment) => {
|
|
82
82
|
comment.value = comment.value.replace(new RegExp(`<!${"--"}`, "gu"), "< !--").replace(new RegExp(`${"--"}>`, "gu"), "-- >").replace(/import(\(.*\))/gu, "import\\$1");
|
|
83
|
-
})
|
|
83
|
+
});
|
|
84
84
|
};
|
|
85
85
|
const visitor = {
|
|
86
86
|
FunctionExpression(path) {
|
|
87
87
|
const { node } = path;
|
|
88
|
-
if (node.type === "FunctionExpression" &&
|
|
88
|
+
if (node.type === "FunctionExpression" && node.extra?.parenthesized) {
|
|
89
89
|
node.params = node.params.filter(
|
|
90
90
|
(param) => !(param.type === "Identifier" && param.name === "Buffer")
|
|
91
91
|
);
|
|
@@ -123,12 +123,12 @@ function postProcessBundle(code, {
|
|
|
123
123
|
const program = path.findParent(
|
|
124
124
|
(parent) => parent.node.type === "Program"
|
|
125
125
|
);
|
|
126
|
-
if (
|
|
126
|
+
if (program?.node.type === "Program") {
|
|
127
127
|
const body = program.node.body[0];
|
|
128
128
|
if (body.type === "VariableDeclaration" && body.declarations[0].id.name === "regeneratorRuntime") {
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
program?.node.body.unshift(regeneratorRuntimeWrapper());
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
},
|
|
@@ -228,7 +228,7 @@ function postProcessBundle(code, {
|
|
|
228
228
|
})
|
|
229
229
|
]
|
|
230
230
|
});
|
|
231
|
-
if (!
|
|
231
|
+
if (!file?.code) {
|
|
232
232
|
throw new Error("Bundled code is empty.");
|
|
233
233
|
}
|
|
234
234
|
return {
|
|
@@ -246,4 +246,4 @@ ${error.message}`);
|
|
|
246
246
|
|
|
247
247
|
|
|
248
248
|
exports.PostProcessWarning = PostProcessWarning; exports.postProcessBundle = postProcessBundle;
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
249
|
+
//# sourceMappingURL=chunk-44VFHYJO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/post-process.ts"],"names":["PostProcessWarning"],"mappings":";AAEA,SAAS,eAAe,gBAAgB;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgDA,IAAK,qBAAL,kBAAKA,wBAAL;AACL,EAAAA,oBAAA,sBAAmB;AADT,SAAAA;AAAA,GAAA;AAOZ,IAAM,cAAc;AAIpB,IAAM,yBAAyB,gBAAgB,EAAE,KAAK,IAAI,QAAQ,GAAG,CAAC;AAEtE,IAAM,cAAc,SAAS,UAAU;AAAA;AAAA,CAEtC;AAED,IAAM,oBAAoB,SAAS,UAAU;AAAA;AAAA,CAE5C;AAED,IAAM,4BAA4B,SAAS,UAAU;AAAA;AAAA,CAEpD;AAcD,SAAS,YAAY,OAAyB;AAC5C,QAAM,SAAS,MAAM,MAAM,WAAW;AACtC,SACE,OAGG,OAAO,CAAC,UAAU,UAAU,MAAM,UAAU,MAAS;AAE5D;AAaA,SAAS,2BACP,OACmC;AAInC,QAAM,UAA8B,MAAM,KAAK,MAAM,SAAS,WAAW,CAAC;AAE1E,MAAI,QAAQ,SAAS,GAAG;AACtB,UAAM,SAAS,QAAQ;AAAA,MACrB,CAAC,CAAC,UAAU,WAAW,GAAG,UAAU,OAAO,WAAW;AACpD,cAAM,CAAC,EAAE,OAAO,IAAI,IAAI,SAAS,OAAO,CAAC,QAAQ,QAAQ,MAAS;AAIlE,cAAM,SAAS,MAAM;AAA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AAA,MAEA,SAAS;AAAA,QACP,OAAO;AAAA,UACL;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,QAAI,CAAC,MAAM,MAAM;AACf,YAAM,IAAI,MAAM,wBAAwB;AAAA,IAC1C;AAEA,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,WAAW,KAAK;AAAA,MAChB,UAAU,MAAM,KAAK,QAAQ;AAAA,IAC/B;AAAA,EACF,SAAS,OAAO;AACd,UAAM,IAAI,MAAM;AAAA,EAAiC,MAAM,OAAO,EAAE;AAAA,EAClE;AACF","sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-shadow\nimport type { Node, Visitor, PluginObj } from '@babel/core';\nimport { transformSync, template } from '@babel/core';\nimport type { Expression, Identifier, TemplateElement } from '@babel/types';\nimport {\n binaryExpression,\n isUnaryExpression,\n isUpdateExpression,\n stringLiteral,\n templateElement,\n templateLiteral,\n} from '@babel/types';\n\n/**\n * Source map declaration taken from `@babel/core`. Babel doesn't export the\n * type for this, so it's copied from the source code instead here.\n */\nexport type SourceMap = {\n version: number;\n sources: string[];\n names: string[];\n sourceRoot?: string | undefined;\n sourcesContent?: string[] | undefined;\n mappings: string;\n file: string;\n};\n\n/**\n * The post process options.\n *\n * @property stripComments - Whether to strip comments. Defaults to `true`.\n * @property sourceMap - Whether to generate a source map for the modified code.\n * See also `inputSourceMap`.\n * @property inputSourceMap - The source map for the input code. When provided,\n * the source map will be used to generate a source map for the modified code.\n * This ensures that the source map is correct for the modified code, and still\n * points to the original source. If not provided, a new source map will be\n * generated instead.\n */\nexport type PostProcessOptions = {\n stripComments?: boolean;\n sourceMap?: boolean | 'inline';\n inputSourceMap?: SourceMap;\n};\n\n/**\n * The post processed bundle output.\n *\n * @property code - The modified code.\n * @property sourceMap - The source map for the modified code, if the source map\n * option was enabled.\n * @property warnings - Any warnings that occurred during the post-processing.\n */\nexport type PostProcessedBundle = {\n code: string;\n sourceMap?: SourceMap | null;\n warnings: PostProcessWarning[];\n};\n\nexport enum PostProcessWarning {\n UnsafeMathRandom = '`Math.random` was detected in the Snap bundle. This is not a secure source of randomness, and should not be used in a secure context. Use `crypto.getRandomValues` instead.',\n}\n\n// The RegEx below consists of multiple groups joined by a boolean OR.\n// Each part consists of two groups which capture a part of each string\n// which needs to be split up, e.g., `<!--` is split into `<!` and `--`.\nconst TOKEN_REGEX = /(<!)(--)|(--)(>)|(--)(!)(>)|(import)(\\(.*?\\))/gu;\n\n// An empty template element, i.e., a part of a template literal without any\n// value (\"\").\nconst EMPTY_TEMPLATE_ELEMENT = templateElement({ raw: '', cooked: '' });\n\nconst evalWrapper = template.statement(`\n (1, REF)(ARGS)\n`);\n\nconst objectEvalWrapper = template.statement(`\n (1, OBJECT.REF)\n`);\n\nconst regeneratorRuntimeWrapper = template.statement(`\n var regeneratorRuntime;\n`);\n\n/**\n * Breaks up tokens that would otherwise result in SES errors. The tokens are\n * broken up in a non-destructive way where possible. Currently works with:\n * - HTML comment tags `<!--` and `-->`, broken up into `<!`, `--`, and `--`,\n * `>`.\n * - `import(n)` statements, broken up into `import`, `(n)`.\n *\n * @param value - The string value to break up.\n * @returns The string split into an array, in a way that it can be joined\n * together to form the same string, but with the tokens separated into single\n * array elements.\n */\nfunction breakTokens(value: string): string[] {\n const tokens = value.split(TOKEN_REGEX);\n return (\n tokens\n // TODO: The `split` above results in some values being `undefined`.\n // There may be a better solution to avoid having to filter those out.\n .filter((token) => token !== '' && token !== undefined)\n );\n}\n\n/**\n * Breaks up tokens that would otherwise result in SES errors. The tokens are\n * broken up in a non-destructive way where possible. Currently works with:\n * - HTML comment tags `<!--` and `-->`, broken up into `<!`, `--`, and `--`,\n * `>`.\n * - `import(n)` statements, broken up into `import`, `(n)`.\n *\n * @param value - The string value to break up.\n * @returns The string split into a tuple consisting of the new template\n * elements and string literal expressions.\n */\nfunction breakTokensTemplateLiteral(\n value: string,\n): [TemplateElement[], Expression[]] {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore `matchAll` is not available in ES2017, but this code\n // should only be used in environments where the function is supported.\n const matches: RegExpMatchArray[] = Array.from(value.matchAll(TOKEN_REGEX));\n\n if (matches.length > 0) {\n const output = matches.reduce<[TemplateElement[], Expression[]]>(\n ([elements, expressions], rawMatch, index, values) => {\n const [, first, last] = rawMatch.filter((raw) => raw !== undefined);\n\n // Slice the text in front of the match, which does not need to be\n // broken up.\n const prefix = value.slice(\n index === 0\n ? 0\n : (values[index - 1].index as number) + values[index - 1][0].length,\n rawMatch.index,\n );\n\n return [\n [\n ...elements,\n templateElement({\n raw: getRawTemplateValue(prefix),\n cooked: prefix,\n }),\n EMPTY_TEMPLATE_ELEMENT,\n ],\n [...expressions, stringLiteral(first), stringLiteral(last)],\n ];\n },\n [[], []],\n );\n\n // Add the text after the last match to the output.\n const lastMatch = matches[matches.length - 1];\n const suffix = value.slice(\n (lastMatch.index as number) + lastMatch[0].length,\n );\n\n return [\n [\n ...output[0],\n templateElement({ raw: getRawTemplateValue(suffix), cooked: suffix }),\n ],\n output[1],\n ];\n }\n\n // If there are no matches, simply return the original value.\n return [\n [templateElement({ raw: getRawTemplateValue(value), cooked: value })],\n [],\n ];\n}\n\n/**\n * Get a raw template literal value from a cooked value. This adds a backslash\n * before every '`', '\\' and '${' characters.\n *\n * @see https://github.com/babel/babel/issues/9242#issuecomment-532529613\n * @param value - The cooked string to get the raw string for.\n * @returns The value as raw value.\n */\nfunction getRawTemplateValue(value: string) {\n return value.replace(/\\\\|`|\\$\\{/gu, '\\\\$&');\n}\n\n/**\n * Post process code with AST such that it can be evaluated in SES.\n *\n * Currently:\n * - Makes all direct calls to eval indirect.\n * - Handles certain Babel-related edge cases.\n * - Removes the `Buffer` provided by Browserify.\n * - Optionally removes comments.\n * - Breaks up tokens that would otherwise result in SES errors, such as HTML\n * comment tags `<!--` and `-->` and `import(n)` statements.\n *\n * @param code - The code to post process.\n * @param options - The post-process options.\n * @param options.stripComments - Whether to strip comments. Defaults to `true`.\n * @param options.sourceMap - Whether to generate a source map for the modified\n * code. See also `inputSourceMap`.\n * @param options.inputSourceMap - The source map for the input code. When\n * provided, the source map will be used to generate a source map for the\n * modified code. This ensures that the source map is correct for the modified\n * code, and still points to the original source. If not provided, a new source\n * map will be generated instead.\n * @returns An object containing the modified code, and source map, or null if\n * the provided code is null.\n */\nexport function postProcessBundle(\n code: string,\n {\n stripComments = true,\n sourceMap: sourceMaps,\n inputSourceMap,\n }: Partial<PostProcessOptions> = {},\n): PostProcessedBundle {\n const warnings = new Set<PostProcessWarning>();\n\n const pre: PluginObj['pre'] = ({ ast }) => {\n ast.comments?.forEach((comment) => {\n // Break up tokens that could be parsed as HTML comment terminators. The\n // regular expressions below are written strangely so as to avoid the\n // appearance of such tokens in our source code. For reference:\n // https://github.com/endojs/endo/blob/70cc86eb400655e922413b99c38818d7b2e79da0/packages/ses/error-codes/SES_HTML_COMMENT_REJECTED.md\n comment.value = comment.value\n .replace(new RegExp(`<!${'--'}`, 'gu'), '< !--')\n .replace(new RegExp(`${'--'}>`, 'gu'), '-- >')\n .replace(/import(\\(.*\\))/gu, 'import\\\\$1');\n });\n };\n\n const visitor: Visitor<Node> = {\n FunctionExpression(path) {\n const { node } = path;\n\n // Browserify provides the `Buffer` global as an argument to modules that\n // use it, but this does not work in SES. Since we pass in `Buffer` as an\n // endowment, we can simply remove the argument.\n //\n // Note that this only removes `Buffer` from a wrapped function\n // expression, e.g., `(function (Buffer) { ... })`. Regular functions\n // are not affected.\n //\n // TODO: Since we're working on the AST level, we could check the scope\n // of the function expression, and possibly prevent false positives?\n if (node.type === 'FunctionExpression' && node.extra?.parenthesized) {\n node.params = node.params.filter(\n (param) => !(param.type === 'Identifier' && param.name === 'Buffer'),\n );\n }\n },\n\n CallExpression(path) {\n const { node } = path;\n\n // Replace `eval(foo)` with `(1, eval)(foo)`.\n if (node.callee.type === 'Identifier' && node.callee.name === 'eval') {\n path.replaceWith(\n evalWrapper({\n REF: node.callee,\n ARGS: node.arguments,\n }),\n );\n }\n\n // Detect the use of `Math.random()` and add a warning.\n if (\n node.callee.type === 'MemberExpression' &&\n node.callee.object.type === 'Identifier' &&\n node.callee.object.name === 'Math' &&\n node.callee.property.type === 'Identifier' &&\n node.callee.property.name === 'random'\n ) {\n warnings.add(PostProcessWarning.UnsafeMathRandom);\n }\n },\n\n MemberExpression(path) {\n const { node } = path;\n\n // Replace `object.eval(foo)` with `(1, object.eval)(foo)`.\n if (\n node.property.type === 'Identifier' &&\n node.property.name === 'eval' &&\n // We only apply this to MemberExpressions that are the callee of CallExpression\n path.parent.type === 'CallExpression' &&\n path.parent.callee === node\n ) {\n path.replaceWith(\n objectEvalWrapper({\n OBJECT: node.object,\n REF: node.property,\n }),\n );\n }\n },\n\n Identifier(path) {\n const { node } = path;\n\n // Insert `regeneratorRuntime` global if it's used in the code.\n if (node.name === 'regeneratorRuntime') {\n const program = path.findParent(\n (parent) => parent.node.type === 'Program',\n );\n\n // We know that `program` is a Program node here, but this keeps\n // TypeScript happy.\n if (program?.node.type === 'Program') {\n const body = program.node.body[0];\n\n // This stops it from inserting `regeneratorRuntime` multiple times.\n if (\n body.type === 'VariableDeclaration' &&\n (body.declarations[0].id as Identifier).name ===\n 'regeneratorRuntime'\n ) {\n return;\n }\n\n program?.node.body.unshift(regeneratorRuntimeWrapper());\n }\n }\n },\n\n TemplateLiteral(path) {\n const { node } = path;\n\n // This checks if the template literal was visited before. Without this,\n // it would cause an infinite loop resulting in a stack overflow. We can't\n // skip the path here, because we need to visit the children of the node.\n if (path.getData('visited')) {\n return;\n }\n\n // Break up tokens that could be parsed as HTML comment terminators, or\n // `import()` statements.\n // For reference:\n // - https://github.com/endojs/endo/blob/70cc86eb400655e922413b99c38818d7b2e79da0/packages/ses/error-codes/SES_HTML_COMMENT_REJECTED.md\n // - https://github.com/MetaMask/snaps-monorepo/issues/505\n const [replacementQuasis, replacementExpressions] = node.quasis.reduce<\n [TemplateElement[], Expression[]]\n >(\n ([elements, expressions], quasi, index) => {\n // Note: Template literals have two variants, \"cooked\" and \"raw\". Here\n // we use the cooked version.\n // https://exploringjs.com/impatient-js/ch_template-literals.html#template-strings-cooked-vs-raw\n const tokens = breakTokensTemplateLiteral(\n quasi.value.cooked as string,\n );\n\n // Only update the node if something changed.\n if (tokens[0].length <= 1) {\n return [\n [...elements, quasi],\n [...expressions, node.expressions[index] as Expression],\n ];\n }\n\n return [\n [...elements, ...tokens[0]],\n [\n ...expressions,\n ...tokens[1],\n node.expressions[index] as Expression,\n ],\n ];\n },\n [[], []],\n );\n\n path.replaceWith(\n templateLiteral(\n replacementQuasis,\n replacementExpressions.filter(\n (expression) => expression !== undefined,\n ),\n ) as Node,\n );\n\n path.setData('visited', true);\n },\n\n StringLiteral(path) {\n const { node } = path;\n\n // Break up tokens that could be parsed as HTML comment terminators, or\n // `import()` statements.\n // For reference:\n // - https://github.com/endojs/endo/blob/70cc86eb400655e922413b99c38818d7b2e79da0/packages/ses/error-codes/SES_HTML_COMMENT_REJECTED.md\n // - https://github.com/MetaMask/snaps-monorepo/issues/505\n const tokens = breakTokens(node.value);\n\n // Only update the node if the string literal was broken up.\n if (tokens.length <= 1) {\n return;\n }\n\n const replacement = tokens\n .slice(1)\n .reduce<Expression>(\n (acc, value) => binaryExpression('+', acc, stringLiteral(value)),\n stringLiteral(tokens[0]),\n );\n\n path.replaceWith(replacement as Node);\n path.skip();\n },\n\n BinaryExpression(path) {\n const { node } = path;\n\n const errorMessage =\n 'Using HTML comments (`<!--` and `-->`) as operators is not allowed. The behaviour of ' +\n 'these comments is ambiguous, and differs per browser and environment. If you want ' +\n 'to use them as operators, break them up into separate characters, i.e., `a-- > b` ' +\n 'and `a < ! --b`.';\n\n if (\n node.operator === '<' &&\n isUnaryExpression(node.right) &&\n isUpdateExpression(node.right.argument) &&\n node.right.argument.operator === '--' &&\n node.left.end &&\n node.right.argument.argument.start\n ) {\n const expression = code.slice(\n node.left.end,\n node.right.argument.argument.start,\n );\n\n if (expression.includes('<!--')) {\n throw new Error(errorMessage);\n }\n }\n\n if (\n node.operator === '>' &&\n isUpdateExpression(node.left) &&\n node.left.operator === '--' &&\n node.left.argument.end &&\n node.right.start\n ) {\n const expression = code.slice(node.left.argument.end, node.right.start);\n\n if (expression.includes('-->')) {\n throw new Error(errorMessage);\n }\n }\n },\n };\n\n try {\n const file = transformSync(code, {\n // Prevent Babel from searching for a config file.\n configFile: false,\n\n parserOpts: {\n // Strict mode isn't enabled by default, so we need to enable it here.\n strictMode: true,\n\n // If this is disabled, the AST does not include any comments. This is\n // useful for performance reasons, and we use it for stripping comments.\n attachComment: !stripComments,\n },\n\n // By default, Babel optimises bundles that exceed 500 KB, but that\n // results in characters which look like HTML comments, which breaks SES.\n compact: false,\n\n // This configures Babel to generate a new source map from the existing\n // source map if specified. If `sourceMap` is `true` but an input source\n // map is not provided, a new source map will be generated instead.\n inputSourceMap,\n sourceMaps,\n\n plugins: [\n () => ({\n pre,\n visitor,\n }),\n ],\n });\n\n if (!file?.code) {\n throw new Error('Bundled code is empty.');\n }\n\n return {\n code: file.code,\n sourceMap: file.map,\n warnings: Array.from(warnings),\n };\n } catch (error) {\n throw new Error(`Failed to post process code:\\n${error.message}`);\n }\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHJYRGKCXjs = require('./chunk-HJYRGKCX.js');
|
|
4
4
|
|
|
5
5
|
// src/bytes.ts
|
|
6
6
|
var _utils = require('@metamask/utils');
|
|
7
7
|
function getBytes(bytes) {
|
|
8
|
-
const unwrapped = bytes instanceof
|
|
8
|
+
const unwrapped = bytes instanceof _chunkHJYRGKCXjs.VirtualFile ? bytes.value : bytes;
|
|
9
9
|
if (typeof unwrapped === "string") {
|
|
10
10
|
return _utils.stringToBytes.call(void 0, unwrapped);
|
|
11
11
|
}
|
|
@@ -15,4 +15,4 @@ function getBytes(bytes) {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
exports.getBytes = getBytes;
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-473MIETW.js.map
|
|
@@ -35,7 +35,7 @@ function getSvgDimensions(svg) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
} catch
|
|
38
|
+
} catch {
|
|
39
39
|
throw new Error("Snap icon must be a valid SVG.");
|
|
40
40
|
}
|
|
41
41
|
return null;
|
|
@@ -47,4 +47,4 @@ function getSvgDimensions(svg) {
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
exports.SVG_MAX_BYTE_SIZE = SVG_MAX_BYTE_SIZE; exports.SVG_MAX_BYTE_SIZE_TEXT = SVG_MAX_BYTE_SIZE_TEXT; exports.assertIsSnapIcon = assertIsSnapIcon; exports.getSvgDimensions = getSvgDimensions;
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-4BDR6KRH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";//# sourceMappingURL=chunk-4CMD46B2.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_ENDOWMENTS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BGSO2GQC.mjs";
|
|
4
4
|
|
|
5
5
|
// src/mock.ts
|
|
6
6
|
import crypto from "crypto";
|
|
@@ -66,4 +66,4 @@ export {
|
|
|
66
66
|
isConstructor,
|
|
67
67
|
generateMockEndowments
|
|
68
68
|
};
|
|
69
|
-
//# sourceMappingURL=chunk-
|
|
69
|
+
//# sourceMappingURL=chunk-63OXILAY.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/namespace.ts
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ var ACCOUNT_ID_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-
|
|
|
14
14
|
var ACCOUNT_ADDRESS_REGEX = /^(?<accountAddress>[a-zA-Z0-9]{1,64})$/u;
|
|
15
15
|
function parseChainId(chainId) {
|
|
16
16
|
const match = CHAIN_ID_REGEX.exec(chainId);
|
|
17
|
-
if (!
|
|
17
|
+
if (!match?.groups) {
|
|
18
18
|
throw new Error("Invalid chain ID.");
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
@@ -24,7 +24,7 @@ function parseChainId(chainId) {
|
|
|
24
24
|
}
|
|
25
25
|
function parseAccountId(accountId) {
|
|
26
26
|
const match = ACCOUNT_ID_REGEX.exec(accountId);
|
|
27
|
-
if (!
|
|
27
|
+
if (!match?.groups) {
|
|
28
28
|
throw new Error("Invalid account ID.");
|
|
29
29
|
}
|
|
30
30
|
return {
|
|
@@ -104,4 +104,4 @@ function isNamespace(value) {
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
exports.CHAIN_ID_REGEX = CHAIN_ID_REGEX; exports.ACCOUNT_ID_REGEX = ACCOUNT_ID_REGEX; exports.ACCOUNT_ADDRESS_REGEX = ACCOUNT_ADDRESS_REGEX; exports.parseChainId = parseChainId; exports.parseAccountId = parseAccountId; exports.LimitedString = LimitedString; exports.ChainIdStringStruct = ChainIdStringStruct; exports.ChainIdStruct = ChainIdStruct; exports.AccountIdStruct = AccountIdStruct; exports.AccountIdArrayStruct = AccountIdArrayStruct; exports.AccountAddressStruct = AccountAddressStruct; exports.ChainStruct = ChainStruct; exports.NamespaceStruct = NamespaceStruct; exports.NamespaceIdStruct = NamespaceIdStruct; exports.isNamespaceId = isNamespaceId; exports.isChainId = isChainId; exports.isAccountId = isAccountId; exports.isAccountIdArray = isAccountIdArray; exports.isNamespace = isNamespace;
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-6LOYTBS3.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
VirtualFile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZJRWU4AJ.mjs";
|
|
4
4
|
|
|
5
5
|
// src/bytes.ts
|
|
6
6
|
import { stringToBytes } from "@metamask/utils";
|
|
@@ -15,4 +15,4 @@ function getBytes(bytes) {
|
|
|
15
15
|
export {
|
|
16
16
|
getBytes
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-6YRUDGNL.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/ui.ts
|
|
2
2
|
var _snapssdk = require('@metamask/snaps-sdk');
|
|
3
3
|
var _utils = require('@metamask/utils');
|
|
4
4
|
var MARKDOWN_LINK_REGEX = /\[(?<name>[^\]]*)\]\((?<url>[^)]+)\)/giu;
|
|
@@ -6,7 +6,7 @@ var ALLOWED_PROTOCOLS = ["https:", "mailto:"];
|
|
|
6
6
|
function validateTextLinks(text, isOnPhishingList) {
|
|
7
7
|
const matches = String.prototype.matchAll.call(text, MARKDOWN_LINK_REGEX);
|
|
8
8
|
for (const { groups } of matches) {
|
|
9
|
-
const link =
|
|
9
|
+
const link = groups?.url;
|
|
10
10
|
if (!link) {
|
|
11
11
|
continue;
|
|
12
12
|
}
|
|
@@ -67,4 +67,4 @@ function getTotalTextLength(component) {
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
exports.validateTextLinks = validateTextLinks; exports.validateComponentLinks = validateComponentLinks; exports.getTotalTextLength = getTotalTextLength;
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-772OPTGX.js.map
|