@metamask/snaps-cli 5.1.1 → 6.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 +13 -1
- package/dist/builders.js +10 -0
- package/dist/builders.js.map +1 -0
- package/dist/builders.mjs +10 -0
- package/dist/builders.mjs.map +1 -0
- package/dist/chunk-26C34AS7.mjs +287 -0
- package/dist/chunk-26C34AS7.mjs.map +1 -0
- package/dist/chunk-2SUDRRT6.mjs +50 -0
- package/dist/chunk-2SUDRRT6.mjs.map +1 -0
- package/dist/chunk-3WWFQLH4.mjs +30 -0
- package/dist/chunk-3WWFQLH4.mjs.map +1 -0
- package/dist/chunk-45LOTCC4.mjs +1 -0
- package/dist/chunk-45LOTCC4.mjs.map +1 -0
- package/dist/chunk-4QUVE3EK.js +53 -0
- package/dist/chunk-4QUVE3EK.js.map +1 -0
- package/dist/chunk-5CLEKHXE.js +54 -0
- package/dist/chunk-5CLEKHXE.js.map +1 -0
- package/dist/chunk-5KQNAW4C.mjs +346 -0
- package/dist/chunk-5KQNAW4C.mjs.map +1 -0
- package/dist/chunk-6EEZHGF5.js +23 -0
- package/dist/chunk-6EEZHGF5.js.map +1 -0
- package/dist/chunk-7NQQGJZJ.mjs +35 -0
- package/dist/chunk-7NQQGJZJ.mjs.map +1 -0
- package/dist/chunk-7RHK2YTB.mjs +32 -0
- package/dist/chunk-7RHK2YTB.mjs.map +1 -0
- package/dist/chunk-AZMQTZXZ.mjs +28 -0
- package/dist/chunk-AZMQTZXZ.mjs.map +1 -0
- package/dist/chunk-B3NNVTA6.js +32 -0
- package/dist/chunk-B3NNVTA6.js.map +1 -0
- package/dist/chunk-BALQOCUO.js +22 -0
- package/dist/chunk-BALQOCUO.js.map +1 -0
- package/dist/chunk-BVPYLBE5.js +365 -0
- package/dist/chunk-BVPYLBE5.js.map +1 -0
- package/dist/chunk-BYNQODL3.mjs +23 -0
- package/dist/chunk-BYNQODL3.mjs.map +1 -0
- package/dist/chunk-C44RRX3H.js +18 -0
- package/dist/chunk-C44RRX3H.js.map +1 -0
- package/dist/chunk-C46KEPAC.js +37 -0
- package/dist/chunk-C46KEPAC.js.map +1 -0
- package/dist/chunk-CGJKCIHP.js +28 -0
- package/dist/chunk-CGJKCIHP.js.map +1 -0
- package/dist/chunk-CIYE263O.js +30 -0
- package/dist/chunk-CIYE263O.js.map +1 -0
- package/dist/chunk-DBLADLQ4.js +10 -0
- package/dist/chunk-DBLADLQ4.js.map +1 -0
- package/dist/chunk-EDEA4QTA.js +35 -0
- package/dist/chunk-EDEA4QTA.js.map +1 -0
- package/dist/chunk-ERSRIVYH.mjs +64 -0
- package/dist/chunk-ERSRIVYH.mjs.map +1 -0
- package/dist/chunk-G3COWLG5.mjs +23 -0
- package/dist/chunk-G3COWLG5.mjs.map +1 -0
- package/dist/chunk-GKRRE4WN.mjs +30 -0
- package/dist/chunk-GKRRE4WN.mjs.map +1 -0
- package/dist/chunk-HQBA5RU6.mjs +54 -0
- package/dist/chunk-HQBA5RU6.mjs.map +1 -0
- package/dist/chunk-HYPSSFE5.mjs +13 -0
- package/dist/chunk-HYPSSFE5.mjs.map +1 -0
- package/dist/chunk-JAHNVVLT.mjs +18 -0
- package/dist/chunk-JAHNVVLT.mjs.map +1 -0
- package/dist/chunk-JCVSYVPD.mjs +24 -0
- package/dist/chunk-JCVSYVPD.mjs.map +1 -0
- package/dist/chunk-JI3B665Z.js +24 -0
- package/dist/chunk-JI3B665Z.js.map +1 -0
- package/dist/chunk-JL3URCHO.mjs +53 -0
- package/dist/chunk-JL3URCHO.mjs.map +1 -0
- package/dist/chunk-K26BOY6Z.mjs +51 -0
- package/dist/chunk-K26BOY6Z.mjs.map +1 -0
- package/dist/chunk-K5QMGTQL.mjs +22 -0
- package/dist/chunk-K5QMGTQL.mjs.map +1 -0
- package/dist/chunk-KLOPX6DO.js +51 -0
- package/dist/chunk-KLOPX6DO.js.map +1 -0
- package/dist/chunk-KUSHMQXD.js +64 -0
- package/dist/chunk-KUSHMQXD.js.map +1 -0
- package/dist/chunk-L72RLBV5.mjs +37 -0
- package/dist/chunk-L72RLBV5.mjs.map +1 -0
- package/dist/chunk-MDHJ5HLM.js +287 -0
- package/dist/chunk-MDHJ5HLM.js.map +1 -0
- package/dist/chunk-MR44GPM3.mjs +135 -0
- package/dist/chunk-MR44GPM3.mjs.map +1 -0
- package/dist/chunk-MUYXNION.js +30 -0
- package/dist/chunk-MUYXNION.js.map +1 -0
- package/dist/chunk-OKDY7C7S.js +346 -0
- package/dist/chunk-OKDY7C7S.js.map +1 -0
- package/dist/chunk-OPE2PGM6.mjs +24 -0
- package/dist/chunk-OPE2PGM6.mjs.map +1 -0
- package/dist/chunk-PDYQXXLP.js +30 -0
- package/dist/chunk-PDYQXXLP.js.map +1 -0
- package/dist/chunk-PFB25A2Q.mjs +52 -0
- package/dist/chunk-PFB25A2Q.mjs.map +1 -0
- package/dist/chunk-QFK7JVP3.js +52 -0
- package/dist/chunk-QFK7JVP3.js.map +1 -0
- package/dist/chunk-QHCKVO3P.js +28 -0
- package/dist/chunk-QHCKVO3P.js.map +1 -0
- package/dist/chunk-QMD3VO6R.mjs +30 -0
- package/dist/chunk-QMD3VO6R.mjs.map +1 -0
- package/dist/chunk-R6NBQKVH.js +16 -0
- package/dist/chunk-R6NBQKVH.js.map +1 -0
- package/dist/chunk-R77RJHC5.mjs +44 -0
- package/dist/chunk-R77RJHC5.mjs.map +1 -0
- package/dist/chunk-S45DIQPN.js +13 -0
- package/dist/chunk-S45DIQPN.js.map +1 -0
- package/dist/chunk-S76EZ6HY.js +23 -0
- package/dist/chunk-S76EZ6HY.js.map +1 -0
- package/dist/chunk-S7UP2YYF.js +135 -0
- package/dist/chunk-S7UP2YYF.js.map +1 -0
- package/dist/chunk-SVYNCWMH.js +61 -0
- package/dist/chunk-SVYNCWMH.js.map +1 -0
- package/dist/chunk-SYRWT2KT.mjs +124 -0
- package/dist/chunk-SYRWT2KT.mjs.map +1 -0
- package/dist/chunk-T7NEPTM5.mjs +61 -0
- package/dist/chunk-T7NEPTM5.mjs.map +1 -0
- package/dist/chunk-TDSL55B3.mjs +10 -0
- package/dist/chunk-TDSL55B3.mjs.map +1 -0
- package/dist/chunk-TJ2F3J6X.js +31 -0
- package/dist/chunk-TJ2F3J6X.js.map +1 -0
- package/dist/chunk-U4VFMIGO.js +24 -0
- package/dist/chunk-U4VFMIGO.js.map +1 -0
- package/dist/chunk-VXOV3ZCB.js +1 -0
- package/dist/chunk-VXOV3ZCB.js.map +1 -0
- package/dist/chunk-WO7DMSQU.mjs +16 -0
- package/dist/chunk-WO7DMSQU.mjs.map +1 -0
- package/dist/chunk-WP2N4NCO.js +50 -0
- package/dist/chunk-WP2N4NCO.js.map +1 -0
- package/dist/chunk-WYDHPUWV.mjs +28 -0
- package/dist/chunk-WYDHPUWV.mjs.map +1 -0
- package/dist/chunk-X3D3MHWF.js +44 -0
- package/dist/chunk-X3D3MHWF.js.map +1 -0
- package/dist/chunk-X7TESUC7.mjs +22 -0
- package/dist/chunk-X7TESUC7.mjs.map +1 -0
- package/dist/chunk-X7VYAL2L.mjs +365 -0
- package/dist/chunk-X7VYAL2L.mjs.map +1 -0
- package/dist/chunk-XGWLFH7Y.js +41 -0
- package/dist/chunk-XGWLFH7Y.js.map +1 -0
- package/dist/{cjs/webpack/config.js → chunk-XUYXKO4F.js} +181 -153
- package/dist/chunk-XUYXKO4F.js.map +1 -0
- package/dist/chunk-XZJLYKES.mjs +64 -0
- package/dist/chunk-XZJLYKES.mjs.map +1 -0
- package/dist/chunk-YCYGKEXF.mjs +41 -0
- package/dist/chunk-YCYGKEXF.mjs.map +1 -0
- package/dist/chunk-YGEAZQSC.js +124 -0
- package/dist/chunk-YGEAZQSC.js.map +1 -0
- package/dist/chunk-YQ2E7NEA.js +64 -0
- package/dist/chunk-YQ2E7NEA.js.map +1 -0
- package/dist/chunk-YQVCFM6L.js +22 -0
- package/dist/chunk-YQVCFM6L.js.map +1 -0
- package/dist/{esm/webpack/config.js → chunk-YWCNJELN.mjs} +182 -156
- package/dist/chunk-YWCNJELN.mjs.map +1 -0
- package/dist/chunk-ZAW4ZWQX.mjs +31 -0
- package/dist/chunk-ZAW4ZWQX.mjs.map +1 -0
- package/dist/cli.js +21 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.mjs +21 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/commands/build/build.js +29 -0
- package/dist/commands/build/build.js.map +1 -0
- package/dist/commands/build/build.mjs +29 -0
- package/dist/commands/build/build.mjs.map +1 -0
- package/dist/commands/build/implementation.js +28 -0
- package/dist/commands/build/implementation.js.map +1 -0
- package/dist/commands/build/implementation.mjs +28 -0
- package/dist/commands/build/implementation.mjs.map +1 -0
- package/dist/commands/build/index.js +33 -0
- package/dist/commands/build/index.js.map +1 -0
- package/dist/commands/build/index.mjs +33 -0
- package/dist/commands/build/index.mjs.map +1 -0
- package/dist/commands/eval/eval.js +18 -0
- package/dist/commands/eval/eval.js.map +1 -0
- package/dist/commands/eval/eval.mjs +18 -0
- package/dist/commands/eval/eval.mjs.map +1 -0
- package/dist/commands/eval/implementation.js +9 -0
- package/dist/commands/eval/implementation.js.map +1 -0
- package/dist/commands/eval/implementation.mjs +9 -0
- package/dist/commands/eval/implementation.mjs.map +1 -0
- package/dist/commands/eval/index.js +22 -0
- package/dist/commands/eval/index.js.map +1 -0
- package/dist/commands/eval/index.mjs +22 -0
- package/dist/commands/eval/index.mjs.map +1 -0
- package/dist/commands/index.js +39 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/index.mjs +39 -0
- package/dist/commands/index.mjs.map +1 -0
- package/dist/commands/manifest/implementation.js +17 -0
- package/dist/commands/manifest/implementation.js.map +1 -0
- package/dist/commands/manifest/implementation.mjs +17 -0
- package/dist/commands/manifest/implementation.mjs.map +1 -0
- package/dist/commands/manifest/index.js +22 -0
- package/dist/commands/manifest/index.js.map +1 -0
- package/dist/commands/manifest/index.mjs +22 -0
- package/dist/commands/manifest/index.mjs.map +1 -0
- package/dist/commands/manifest/manifest.js +18 -0
- package/dist/commands/manifest/manifest.js.map +1 -0
- package/dist/commands/manifest/manifest.mjs +18 -0
- package/dist/commands/manifest/manifest.mjs.map +1 -0
- package/dist/commands/serve/index.js +29 -0
- package/dist/commands/serve/index.js.map +1 -0
- package/dist/commands/serve/index.mjs +29 -0
- package/dist/commands/serve/index.mjs.map +1 -0
- package/dist/commands/serve/serve.js +28 -0
- package/dist/commands/serve/serve.js.map +1 -0
- package/dist/commands/serve/serve.mjs +28 -0
- package/dist/commands/serve/serve.mjs.map +1 -0
- package/dist/commands/watch/implementation.js +28 -0
- package/dist/commands/watch/implementation.js.map +1 -0
- package/dist/commands/watch/implementation.mjs +28 -0
- package/dist/commands/watch/implementation.mjs.map +1 -0
- package/dist/commands/watch/index.js +33 -0
- package/dist/commands/watch/index.js.map +1 -0
- package/dist/commands/watch/index.mjs +33 -0
- package/dist/commands/watch/index.mjs.map +1 -0
- package/dist/commands/watch/watch.js +29 -0
- package/dist/commands/watch/watch.js.map +1 -0
- package/dist/commands/watch/watch.mjs +29 -0
- package/dist/commands/watch/watch.mjs.map +1 -0
- package/dist/config.js +36 -0
- package/dist/config.js.map +1 -0
- package/dist/config.mjs +36 -0
- package/dist/config.mjs.map +1 -0
- package/dist/errors.js +12 -0
- package/dist/errors.js.map +1 -0
- package/dist/errors.mjs +12 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +43 -0
- package/dist/index.mjs.map +1 -0
- package/dist/main.js +49 -0
- package/dist/main.js.map +1 -0
- package/dist/main.mjs +49 -0
- package/dist/main.mjs.map +1 -0
- package/dist/structs.js +8 -0
- package/dist/structs.js.map +1 -0
- package/dist/structs.mjs +8 -0
- package/dist/structs.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/commands/eval/implementation.d.ts +1 -1
- package/dist/types/config.d.ts +2 -2
- package/dist/types/structs.d.ts +20 -0
- package/dist/types/webpack/loaders/function.d.ts +34 -0
- package/dist/types/webpack/loaders/index.d.ts +3 -0
- package/dist/types/webpack/utils.d.ts +13 -11
- package/dist/types/yargs.d.js +1 -0
- package/dist/types/yargs.d.js.map +1 -0
- package/dist/types/yargs.d.mjs +1 -0
- package/dist/types/yargs.d.mjs.map +1 -0
- package/dist/utils/cli.js +14 -0
- package/dist/utils/cli.js.map +1 -0
- package/dist/utils/cli.mjs +14 -0
- package/dist/utils/cli.mjs.map +1 -0
- package/dist/utils/errors.js +11 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/errors.mjs +11 -0
- package/dist/utils/errors.mjs.map +1 -0
- package/dist/utils/index.js +47 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +47 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/legacy.js +13 -0
- package/dist/utils/legacy.js.map +1 -0
- package/dist/utils/legacy.mjs +13 -0
- package/dist/utils/legacy.mjs.map +1 -0
- package/dist/utils/logging.js +12 -0
- package/dist/utils/logging.js.map +1 -0
- package/dist/utils/logging.mjs +12 -0
- package/dist/utils/logging.mjs.map +1 -0
- package/dist/utils/path.js +8 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/path.mjs +8 -0
- package/dist/utils/path.mjs.map +1 -0
- package/dist/utils/steps.js +11 -0
- package/dist/utils/steps.js.map +1 -0
- package/dist/utils/steps.mjs +11 -0
- package/dist/utils/steps.mjs.map +1 -0
- package/dist/webpack/compiler.js +25 -0
- package/dist/webpack/compiler.js.map +1 -0
- package/dist/webpack/compiler.mjs +25 -0
- package/dist/webpack/compiler.mjs.map +1 -0
- package/dist/webpack/config.js +24 -0
- package/dist/webpack/config.js.map +1 -0
- package/dist/webpack/config.mjs +24 -0
- package/dist/webpack/config.mjs.map +1 -0
- package/dist/webpack/index.js +44 -0
- package/dist/webpack/index.js.map +1 -0
- package/dist/webpack/index.mjs +44 -0
- package/dist/webpack/index.mjs.map +1 -0
- package/dist/webpack/loaders/browserify.js +19 -0
- package/dist/webpack/loaders/browserify.js.map +1 -0
- package/dist/webpack/loaders/browserify.mjs +19 -0
- package/dist/webpack/loaders/browserify.mjs.map +1 -0
- package/dist/webpack/loaders/function.js +10 -0
- package/dist/webpack/loaders/function.js.map +1 -0
- package/dist/webpack/loaders/function.mjs +10 -0
- package/dist/webpack/loaders/function.mjs.map +1 -0
- package/dist/webpack/loaders/index.js +25 -0
- package/dist/webpack/loaders/index.js.map +1 -0
- package/dist/webpack/loaders/index.mjs +25 -0
- package/dist/webpack/loaders/index.mjs.map +1 -0
- package/dist/webpack/loaders/wasm.js +16 -0
- package/dist/webpack/loaders/wasm.js.map +1 -0
- package/dist/webpack/loaders/wasm.mjs +16 -0
- package/dist/webpack/loaders/wasm.mjs.map +1 -0
- package/dist/webpack/plugins.js +29 -0
- package/dist/webpack/plugins.js.map +1 -0
- package/dist/webpack/plugins.mjs +29 -0
- package/dist/webpack/plugins.mjs.map +1 -0
- package/dist/webpack/server.js +10 -0
- package/dist/webpack/server.js.map +1 -0
- package/dist/webpack/server.mjs +10 -0
- package/dist/webpack/server.mjs.map +1 -0
- package/dist/webpack/utils.js +37 -0
- package/dist/webpack/utils.js.map +1 -0
- package/dist/webpack/utils.mjs +37 -0
- package/dist/webpack/utils.mjs.map +1 -0
- package/package.json +21 -21
- package/.browserslistrc +0 -3
- package/dist/cjs/builders.js +0 -148
- package/dist/cjs/builders.js.map +0 -1
- package/dist/cjs/cli.js +0 -68
- package/dist/cjs/cli.js.map +0 -1
- package/dist/cjs/commands/build/build.js +0 -54
- package/dist/cjs/commands/build/build.js.map +0 -1
- package/dist/cjs/commands/build/implementation.js +0 -31
- package/dist/cjs/commands/build/implementation.js.map +0 -1
- package/dist/cjs/commands/build/index.js +0 -45
- package/dist/cjs/commands/build/index.js.map +0 -1
- package/dist/cjs/commands/eval/eval.js +0 -57
- package/dist/cjs/commands/eval/eval.js.map +0 -1
- package/dist/cjs/commands/eval/implementation.js +0 -27
- package/dist/cjs/commands/eval/implementation.js.map +0 -1
- package/dist/cjs/commands/eval/index.js +0 -50
- package/dist/cjs/commands/eval/index.js.map +0 -1
- package/dist/cjs/commands/index.js +0 -30
- package/dist/cjs/commands/index.js.map +0 -1
- package/dist/cjs/commands/manifest/implementation.js +0 -34
- package/dist/cjs/commands/manifest/implementation.js.map +0 -1
- package/dist/cjs/commands/manifest/index.js +0 -50
- package/dist/cjs/commands/manifest/index.js.map +0 -1
- package/dist/cjs/commands/manifest/manifest.js +0 -55
- package/dist/cjs/commands/manifest/manifest.js.map +0 -1
- package/dist/cjs/commands/serve/index.js +0 -33
- package/dist/cjs/commands/serve/index.js.map +0 -1
- package/dist/cjs/commands/serve/serve.js +0 -21
- package/dist/cjs/commands/serve/serve.js.map +0 -1
- package/dist/cjs/commands/watch/implementation.js +0 -35
- package/dist/cjs/commands/watch/implementation.js.map +0 -1
- package/dist/cjs/commands/watch/index.js +0 -47
- package/dist/cjs/commands/watch/index.js.map +0 -1
- package/dist/cjs/commands/watch/watch.js +0 -51
- package/dist/cjs/commands/watch/watch.js.map +0 -1
- package/dist/cjs/config.js +0 -320
- package/dist/cjs/config.js.map +0 -1
- package/dist/cjs/errors.js +0 -37
- package/dist/cjs/errors.js.map +0 -1
- package/dist/cjs/index.js +0 -77
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/main.js +0 -19
- package/dist/cjs/main.js.map +0 -1
- package/dist/cjs/utils/cli.js +0 -61
- package/dist/cjs/utils/cli.js.map +0 -1
- package/dist/cjs/utils/errors.js +0 -42
- package/dist/cjs/utils/errors.js.map +0 -1
- package/dist/cjs/utils/index.js +0 -25
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/legacy.js +0 -48
- package/dist/cjs/utils/legacy.js.map +0 -1
- package/dist/cjs/utils/logging.js +0 -46
- package/dist/cjs/utils/logging.js.map +0 -1
- package/dist/cjs/utils/path.js +0 -16
- package/dist/cjs/utils/path.js.map +0 -1
- package/dist/cjs/utils/steps.js +0 -52
- package/dist/cjs/utils/steps.js.map +0 -1
- package/dist/cjs/webpack/compiler.js +0 -19
- package/dist/cjs/webpack/compiler.js.map +0 -1
- package/dist/cjs/webpack/config.js.map +0 -1
- package/dist/cjs/webpack/index.js +0 -23
- package/dist/cjs/webpack/index.js.map +0 -1
- package/dist/cjs/webpack/loaders/browserify.js +0 -97
- package/dist/cjs/webpack/loaders/browserify.js.map +0 -1
- package/dist/cjs/webpack/loaders/wasm.js +0 -92
- package/dist/cjs/webpack/loaders/wasm.js.map +0 -1
- package/dist/cjs/webpack/plugins.js +0 -341
- package/dist/cjs/webpack/plugins.js.map +0 -1
- package/dist/cjs/webpack/server.js +0 -139
- package/dist/cjs/webpack/server.js.map +0 -1
- package/dist/cjs/webpack/utils.js +0 -254
- package/dist/cjs/webpack/utils.js.map +0 -1
- package/dist/esm/builders.js +0 -130
- package/dist/esm/builders.js.map +0 -1
- package/dist/esm/cli.js +0 -56
- package/dist/esm/cli.js.map +0 -1
- package/dist/esm/commands/build/build.js +0 -51
- package/dist/esm/commands/build/build.js.map +0 -1
- package/dist/esm/commands/build/implementation.js +0 -27
- package/dist/esm/commands/build/implementation.js.map +0 -1
- package/dist/esm/commands/build/index.js +0 -17
- package/dist/esm/commands/build/index.js.map +0 -1
- package/dist/esm/commands/eval/eval.js +0 -54
- package/dist/esm/commands/eval/eval.js.map +0 -1
- package/dist/esm/commands/eval/implementation.js +0 -24
- package/dist/esm/commands/eval/implementation.js.map +0 -1
- package/dist/esm/commands/eval/index.js +0 -22
- package/dist/esm/commands/eval/index.js.map +0 -1
- package/dist/esm/commands/index.js +0 -15
- package/dist/esm/commands/index.js.map +0 -1
- package/dist/esm/commands/manifest/implementation.js +0 -33
- package/dist/esm/commands/manifest/implementation.js.map +0 -1
- package/dist/esm/commands/manifest/index.js +0 -22
- package/dist/esm/commands/manifest/index.js.map +0 -1
- package/dist/esm/commands/manifest/manifest.js +0 -52
- package/dist/esm/commands/manifest/manifest.js.map +0 -1
- package/dist/esm/commands/serve/index.js +0 -18
- package/dist/esm/commands/serve/index.js.map +0 -1
- package/dist/esm/commands/serve/serve.js +0 -17
- package/dist/esm/commands/serve/serve.js.map +0 -1
- package/dist/esm/commands/watch/implementation.js +0 -34
- package/dist/esm/commands/watch/implementation.js.map +0 -1
- package/dist/esm/commands/watch/index.js +0 -19
- package/dist/esm/commands/watch/index.js.map +0 -1
- package/dist/esm/commands/watch/watch.js +0 -50
- package/dist/esm/commands/watch/watch.js.map +0 -1
- package/dist/esm/config.js +0 -324
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/errors.js +0 -30
- package/dist/esm/errors.js.map +0 -1
- package/dist/esm/index.js +0 -6
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/main.js +0 -10
- package/dist/esm/main.js.map +0 -1
- package/dist/esm/utils/cli.js +0 -43
- package/dist/esm/utils/cli.js.map +0 -1
- package/dist/esm/utils/errors.js +0 -43
- package/dist/esm/utils/errors.js.map +0 -1
- package/dist/esm/utils/index.js +0 -8
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/legacy.js +0 -47
- package/dist/esm/utils/legacy.js.map +0 -1
- package/dist/esm/utils/logging.js +0 -40
- package/dist/esm/utils/logging.js.map +0 -1
- package/dist/esm/utils/path.js +0 -13
- package/dist/esm/utils/path.js.map +0 -1
- package/dist/esm/utils/steps.js +0 -43
- package/dist/esm/utils/steps.js.map +0 -1
- package/dist/esm/webpack/compiler.js +0 -15
- package/dist/esm/webpack/compiler.js.map +0 -1
- package/dist/esm/webpack/config.js.map +0 -1
- package/dist/esm/webpack/index.js +0 -6
- package/dist/esm/webpack/index.js.map +0 -1
- package/dist/esm/webpack/loaders/browserify.js +0 -82
- package/dist/esm/webpack/loaders/browserify.js.map +0 -1
- package/dist/esm/webpack/loaders/wasm.js +0 -87
- package/dist/esm/webpack/loaders/wasm.js.map +0 -1
- package/dist/esm/webpack/plugins.js +0 -344
- package/dist/esm/webpack/plugins.js.map +0 -1
- package/dist/esm/webpack/server.js +0 -133
- package/dist/esm/webpack/server.js.map +0 -1
- package/dist/esm/webpack/utils.js +0 -285
- package/dist/esm/webpack/utils.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkR6NBQKVHjs = require('./chunk-R6NBQKVH.js');
|
|
4
|
+
|
|
5
|
+
// src/commands/watch/implementation.ts
|
|
6
|
+
var _path = require('path');
|
|
7
|
+
async function watch(config, options) {
|
|
8
|
+
const compiler = await _chunkR6NBQKVHjs.getCompiler.call(void 0, config, {
|
|
9
|
+
evaluate: config.evaluate,
|
|
10
|
+
watch: true,
|
|
11
|
+
spinner: options?.spinner
|
|
12
|
+
});
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
compiler.watch(
|
|
15
|
+
{
|
|
16
|
+
ignored: [
|
|
17
|
+
"**/node_modules/**/*",
|
|
18
|
+
`**/${_path.basename.call(void 0, config.output.path)}/**/*`
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
(watchError) => {
|
|
22
|
+
if (watchError) {
|
|
23
|
+
reject(watchError);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
resolve(compiler.watching);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
exports.watch = watch;
|
|
35
|
+
//# sourceMappingURL=chunk-EDEA4QTA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/watch/implementation.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,gBAAgB;AAiBzB,eAAsB,MACpB,QACA,SACA;AACA,QAAM,WAAW,MAAM,YAAY,QAAQ;AAAA,IACzC,UAAU,OAAO;AAAA,IACjB,OAAO;AAAA,IACP,SAAS,SAAS;AAAA,EACpB,CAAC;AAED,SAAO,IAAI,QAAkB,CAAC,SAAS,WAAW;AAChD,aAAS;AAAA,MACP;AAAA,QACE,SAAS;AAAA,UACP;AAAA,UACA,MAAM,SAAS,OAAO,OAAO,IAAI,CAAC;AAAA,QACpC;AAAA,MACF;AAAA,MACA,CAAC,eAAe;AACd,YAAI,YAAY;AACd,iBAAO,UAAU;AACjB;AAAA,QACF;AAEA,gBAAQ,SAAS,QAAQ;AAAA,MAC3B;AAAA,IACF;AAAA,EACF,CAAC;AACH","sourcesContent":["import { basename } from 'path';\nimport type { Watching } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle and watch for changes. This uses Webpack to build the\n * bundle.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns A promise that resolves when the bundle is built for the first time.\n * The promise resolves with a Webpack watching instance that can be used to\n * close the watcher.\n */\nexport async function watch(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, {\n evaluate: config.evaluate,\n watch: true,\n spinner: options?.spinner,\n });\n\n return new Promise<Watching>((resolve, reject) => {\n compiler.watch(\n {\n ignored: [\n '**/node_modules/**/*',\n `**/${basename(config.output.path)}/**/*`,\n ],\n },\n (watchError) => {\n if (watchError) {\n reject(watchError);\n return;\n }\n\n resolve(compiler.watching);\n },\n );\n });\n}\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/webpack/loaders/wasm.ts
|
|
2
|
+
import { assert } from "@metamask/utils";
|
|
3
|
+
import { dirname, resolve } from "path";
|
|
4
|
+
function getImports(importMap) {
|
|
5
|
+
return Object.entries(importMap).map(
|
|
6
|
+
([moduleName, exportNames]) => `import { ${exportNames.join(", ")} } from ${JSON.stringify(
|
|
7
|
+
moduleName
|
|
8
|
+
)};`
|
|
9
|
+
).join("\n");
|
|
10
|
+
}
|
|
11
|
+
function getModuleImports(importMap) {
|
|
12
|
+
return Object.entries(importMap).map(
|
|
13
|
+
([moduleName, exportNames]) => `${JSON.stringify(moduleName)}: { ${exportNames.join(", ")} },`
|
|
14
|
+
).join("\n");
|
|
15
|
+
}
|
|
16
|
+
function getExports(descriptors) {
|
|
17
|
+
return descriptors.map((descriptor) => {
|
|
18
|
+
if (descriptor.name === "default") {
|
|
19
|
+
return `export default exports[${JSON.stringify(descriptor.name)}];`;
|
|
20
|
+
}
|
|
21
|
+
return `export const ${descriptor.name} = exports[${JSON.stringify(
|
|
22
|
+
descriptor.name
|
|
23
|
+
)}];`;
|
|
24
|
+
}).join("\n");
|
|
25
|
+
}
|
|
26
|
+
var loader = async function loader2(source) {
|
|
27
|
+
assert(source instanceof Uint8Array, "Expected source to be a Uint8Array.");
|
|
28
|
+
const bytes = new Uint8Array(source);
|
|
29
|
+
const wasmModule = await WebAssembly.compile(bytes);
|
|
30
|
+
const exports = WebAssembly.Module.exports(wasmModule);
|
|
31
|
+
const imports = WebAssembly.Module.imports(wasmModule).reduce((target, descriptor) => {
|
|
32
|
+
var _a;
|
|
33
|
+
target[_a = descriptor.module] ?? (target[_a] = []);
|
|
34
|
+
target[descriptor.module].push(descriptor.name);
|
|
35
|
+
return target;
|
|
36
|
+
}, {});
|
|
37
|
+
const path = dirname(this.resourcePath);
|
|
38
|
+
for (const name of Object.keys(imports)) {
|
|
39
|
+
this.addDependency(resolve(path, name));
|
|
40
|
+
}
|
|
41
|
+
return `
|
|
42
|
+
${getImports(imports)}
|
|
43
|
+
|
|
44
|
+
const bytes = new Uint8Array(${JSON.stringify(Array.from(source))});
|
|
45
|
+
const module = new WebAssembly.Module(bytes);
|
|
46
|
+
const instance = new WebAssembly.Instance(module, {
|
|
47
|
+
${getModuleImports(imports)}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const exports = instance.exports;
|
|
51
|
+
${getExports(exports)}
|
|
52
|
+
`;
|
|
53
|
+
};
|
|
54
|
+
var wasm_default = loader;
|
|
55
|
+
var raw = true;
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
getImports,
|
|
59
|
+
getModuleImports,
|
|
60
|
+
getExports,
|
|
61
|
+
wasm_default,
|
|
62
|
+
raw
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=chunk-ERSRIVYH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webpack/loaders/wasm.ts"],"sourcesContent":["/* eslint-disable no-restricted-globals */\n\nimport { assert } from '@metamask/utils';\nimport { dirname, resolve } from 'path';\nimport type { LoaderDefinitionFunction } from 'webpack';\n\n/**\n * Get the imports code for the WASM module. This code imports each of the\n * imports from the WASM module.\n *\n * @param importMap - The import map for the WASM module.\n * @returns The imports code for the WASM module.\n */\nexport function getImports(importMap: Record<string, string[]>) {\n return Object.entries(importMap)\n .map(\n ([moduleName, exportNames]) =>\n `import { ${exportNames.join(', ')} } from ${JSON.stringify(\n moduleName,\n )};`,\n )\n .join('\\n');\n}\n\n/**\n * Get the imports code to use in `WebAssembly.Instance`. This code adds each of\n * the imports to the `imports` object.\n *\n * @param importMap - The import map for the WASM module.\n * @returns The imports code for the WASM module.\n */\nexport function getModuleImports(importMap: Record<string, string[]>) {\n return Object.entries(importMap)\n .map(\n ([moduleName, exportNames]) =>\n `${JSON.stringify(moduleName)}: { ${exportNames.join(', ')} },`,\n )\n .join('\\n');\n}\n\n/**\n * Get the exports code for the WASM module. This code exports each of the\n * exports from the WASM module as a variable. This function assumes that the\n * exports are available in a variable named `exports`.\n *\n * @param descriptors - The export descriptors from the WASM module.\n * @returns The exports code for the WASM module.\n */\nexport function getExports(descriptors: WebAssembly.ModuleExportDescriptor[]) {\n return descriptors\n .map((descriptor) => {\n if (descriptor.name === 'default') {\n return `export default exports[${JSON.stringify(descriptor.name)}];`;\n }\n\n return `export const ${descriptor.name} = exports[${JSON.stringify(\n descriptor.name,\n )}];`;\n })\n .join('\\n');\n}\n\n/**\n * A Webpack loader that synchronously loads the WASM module. This makes it\n * possible to import the WASM module directly.\n *\n * @param source - The WASM module as `Uint8Array`.\n * @returns The WASM module as a JavaScript string.\n * @example\n * ```ts\n * import * as wasm from './program.wasm';\n *\n * // Do something with the WASM module...\n * ```\n */\n// Note: This function needs to be defined like this, so that Webpack can bind\n// `this` to the loader context, and TypeScript can infer the type of `this`.\nconst loader: LoaderDefinitionFunction = async function loader(\n source: unknown,\n) {\n assert(source instanceof Uint8Array, 'Expected source to be a Uint8Array.');\n\n const bytes = new Uint8Array(source);\n const wasmModule = await WebAssembly.compile(bytes);\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const exports = WebAssembly.Module.exports(wasmModule);\n const imports = WebAssembly.Module.imports(wasmModule).reduce<\n Record<string, string[]>\n >((target, descriptor) => {\n target[descriptor.module] ??= [];\n target[descriptor.module].push(descriptor.name);\n\n return target;\n }, {});\n\n // Add the WASM import as a dependency so that Webpack will watch it for\n // changes.\n const path = dirname(this.resourcePath);\n for (const name of Object.keys(imports)) {\n this.addDependency(resolve(path, name));\n }\n\n return `\n ${getImports(imports)}\n\n const bytes = new Uint8Array(${JSON.stringify(Array.from(source))});\n const module = new WebAssembly.Module(bytes);\n const instance = new WebAssembly.Instance(module, {\n ${getModuleImports(imports)}\n });\n\n const exports = instance.exports;\n ${getExports(exports)}\n `;\n};\n\nexport default loader;\n\n// By setting `raw` to `true`, we are telling Webpack to provide the source as a\n// `Uint8Array` instead of converting it to a string. This allows us to avoid\n// having to convert the source back to a `Uint8Array` in the loader.\nexport const raw = true;\n"],"mappings":";AAEA,SAAS,cAAc;AACvB,SAAS,SAAS,eAAe;AAU1B,SAAS,WAAW,WAAqC;AAC9D,SAAO,OAAO,QAAQ,SAAS,EAC5B;AAAA,IACC,CAAC,CAAC,YAAY,WAAW,MACvB,YAAY,YAAY,KAAK,IAAI,CAAC,WAAW,KAAK;AAAA,MAChD;AAAA,IACF,CAAC;AAAA,EACL,EACC,KAAK,IAAI;AACd;AASO,SAAS,iBAAiB,WAAqC;AACpE,SAAO,OAAO,QAAQ,SAAS,EAC5B;AAAA,IACC,CAAC,CAAC,YAAY,WAAW,MACvB,GAAG,KAAK,UAAU,UAAU,CAAC,OAAO,YAAY,KAAK,IAAI,CAAC;AAAA,EAC9D,EACC,KAAK,IAAI;AACd;AAUO,SAAS,WAAW,aAAmD;AAC5E,SAAO,YACJ,IAAI,CAAC,eAAe;AACnB,QAAI,WAAW,SAAS,WAAW;AACjC,aAAO,0BAA0B,KAAK,UAAU,WAAW,IAAI,CAAC;AAAA,IAClE;AAEA,WAAO,gBAAgB,WAAW,IAAI,cAAc,KAAK;AAAA,MACvD,WAAW;AAAA,IACb,CAAC;AAAA,EACH,CAAC,EACA,KAAK,IAAI;AACd;AAiBA,IAAM,SAAmC,eAAeA,QACtD,QACA;AACA,SAAO,kBAAkB,YAAY,qCAAqC;AAE1E,QAAM,QAAQ,IAAI,WAAW,MAAM;AACnC,QAAM,aAAa,MAAM,YAAY,QAAQ,KAAK;AAGlD,QAAM,UAAU,YAAY,OAAO,QAAQ,UAAU;AACrD,QAAM,UAAU,YAAY,OAAO,QAAQ,UAAU,EAAE,OAErD,CAAC,QAAQ,eAAe;AAzF5B;AA0FI,gBAAO,WAAW,YAAlB,aAA8B,CAAC;AAC/B,WAAO,WAAW,MAAM,EAAE,KAAK,WAAW,IAAI;AAE9C,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AAIL,QAAM,OAAO,QAAQ,KAAK,YAAY;AACtC,aAAW,QAAQ,OAAO,KAAK,OAAO,GAAG;AACvC,SAAK,cAAc,QAAQ,MAAM,IAAI,CAAC;AAAA,EACxC;AAEA,SAAO;AAAA,MACH,WAAW,OAAO,CAAC;AAAA;AAAA,mCAEU,KAAK,UAAU,MAAM,KAAK,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,QAG7D,iBAAiB,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA,MAI3B,WAAW,OAAO,CAAC;AAAA;AAEzB;AAEA,IAAO,eAAQ;AAKR,IAAM,MAAM;","names":["loader"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
manifestHandler
|
|
3
|
+
} from "./chunk-PFB25A2Q.mjs";
|
|
4
|
+
import {
|
|
5
|
+
builders_default
|
|
6
|
+
} from "./chunk-MR44GPM3.mjs";
|
|
7
|
+
|
|
8
|
+
// src/commands/manifest/index.ts
|
|
9
|
+
var command = {
|
|
10
|
+
command: ["manifest", "m"],
|
|
11
|
+
desc: "Validate the snap.manifest.json file",
|
|
12
|
+
builder: (yarg) => {
|
|
13
|
+
yarg.option("writeManifest", builders_default.writeManifest);
|
|
14
|
+
yarg.option("fix", builders_default.fix);
|
|
15
|
+
},
|
|
16
|
+
handler: async (argv) => manifestHandler(argv.context.config, { fix: argv.fix })
|
|
17
|
+
};
|
|
18
|
+
var manifest_default = command;
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
manifest_default
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=chunk-G3COWLG5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/manifest/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { manifestHandler } from './manifest';\n\nconst command = {\n command: ['manifest', 'm'],\n desc: 'Validate the snap.manifest.json file',\n builder: (yarg: yargs.Argv) => {\n // Browserify options. These are merged into the config object.\n yarg.option('writeManifest', builders.writeManifest);\n\n // Webpack options.\n yarg.option('fix', builders.fix);\n },\n handler: async (argv: YargsArgs) =>\n manifestHandler(argv.context.config, { fix: argv.fix }),\n};\n\nexport * from './implementation';\nexport default command;\n"],"mappings":";;;;;;;;AAMA,IAAM,UAAU;AAAA,EACd,SAAS,CAAC,YAAY,GAAG;AAAA,EACzB,MAAM;AAAA,EACN,SAAS,CAAC,SAAqB;AAE7B,SAAK,OAAO,iBAAiB,iBAAS,aAAa;AAGnD,SAAK,OAAO,OAAO,iBAAS,GAAG;AAAA,EACjC;AAAA,EACA,SAAS,OAAO,SACd,gBAAgB,KAAK,QAAQ,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;AAC1D;AAGA,IAAO,mBAAQ;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
watch_default
|
|
3
|
+
} from "./chunk-OPE2PGM6.mjs";
|
|
4
|
+
import {
|
|
5
|
+
build_default
|
|
6
|
+
} from "./chunk-K5QMGTQL.mjs";
|
|
7
|
+
import {
|
|
8
|
+
manifest_default
|
|
9
|
+
} from "./chunk-G3COWLG5.mjs";
|
|
10
|
+
import {
|
|
11
|
+
serve_default
|
|
12
|
+
} from "./chunk-JCVSYVPD.mjs";
|
|
13
|
+
import {
|
|
14
|
+
eval_default
|
|
15
|
+
} from "./chunk-BYNQODL3.mjs";
|
|
16
|
+
|
|
17
|
+
// src/commands/index.ts
|
|
18
|
+
var commands = [
|
|
19
|
+
build_default,
|
|
20
|
+
eval_default,
|
|
21
|
+
manifest_default,
|
|
22
|
+
serve_default,
|
|
23
|
+
watch_default
|
|
24
|
+
];
|
|
25
|
+
var commands_default = commands;
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
commands_default
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-GKRRE4WN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/index.ts"],"sourcesContent":["import buildCommand from './build';\nimport evaluateCommand from './eval';\nimport manifestCommand from './manifest';\nimport serveCommand from './serve';\nimport watchCommand from './watch';\n\nconst commands = [\n buildCommand,\n evaluateCommand,\n manifestCommand,\n serveCommand,\n watchCommand,\n];\n\nexport default commands;\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAM,WAAW;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAO,mBAAQ;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
watch
|
|
3
|
+
} from "./chunk-7NQQGJZJ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getServer
|
|
6
|
+
} from "./chunk-SYRWT2KT.mjs";
|
|
7
|
+
import {
|
|
8
|
+
executeSteps
|
|
9
|
+
} from "./chunk-YCYGKEXF.mjs";
|
|
10
|
+
import {
|
|
11
|
+
info
|
|
12
|
+
} from "./chunk-ZAW4ZWQX.mjs";
|
|
13
|
+
import {
|
|
14
|
+
CommandError
|
|
15
|
+
} from "./chunk-X7TESUC7.mjs";
|
|
16
|
+
|
|
17
|
+
// src/commands/watch/watch.ts
|
|
18
|
+
import { isFile } from "@metamask/snaps-utils/node";
|
|
19
|
+
var steps = [
|
|
20
|
+
{
|
|
21
|
+
name: "Checking the input file.",
|
|
22
|
+
task: async ({ config }) => {
|
|
23
|
+
const { input } = config;
|
|
24
|
+
if (!await isFile(input)) {
|
|
25
|
+
throw new CommandError(
|
|
26
|
+
`Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "Starting the development server.",
|
|
33
|
+
condition: ({ config }) => config.server.enabled,
|
|
34
|
+
task: async ({ config, options, spinner }) => {
|
|
35
|
+
const server = getServer(config);
|
|
36
|
+
const { port } = await server.listen(options.port ?? config.server.port);
|
|
37
|
+
info(`The server is listening on http://localhost:${port}.`, spinner);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "Building the snap bundle.",
|
|
42
|
+
task: async ({ config, spinner }) => {
|
|
43
|
+
await watch(config, { spinner });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
async function watchHandler(config, options) {
|
|
48
|
+
await executeSteps(steps, { config, options });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
watchHandler
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=chunk-HQBA5RU6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/watch/watch.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\nimport { watch } from './implementation';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedWebpackConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AAqBvB,IAAM,QAA6B;AAAA,EACjC;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,OAAO,MAAM;AAC1B,YAAM,EAAE,MAAM,IAAI;AAElB,UAAI,CAAE,MAAM,OAAO,KAAK,GAAI;AAC1B,cAAM,IAAI;AAAA,UACR,0BAA0B,KAAK;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO,OAAO;AAAA,IACzC,MAAM,OAAO,EAAE,QAAQ,SAAS,QAAQ,MAAM;AAC5C,YAAM,SAAS,UAAU,MAAM;AAC/B,YAAM,EAAE,KAAK,IAAI,MAAM,OAAO,OAAO,QAAQ,QAAQ,OAAO,OAAO,IAAI;AAEvE,WAAK,+CAA+C,IAAI,KAAK,OAAO;AAAA,IACtE;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AACnC,YAAM,MAAM,QAAQ,EAAE,QAAQ,CAAC;AAAA,IACjC;AAAA,EACF;AACF;AAYA,eAAsB,aACpB,QACA,SACe;AACf,QAAM,aAAa,OAAO,EAAE,QAAQ,QAAQ,CAAC;AAC/C;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/structs.ts
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
import { coerce, string } from "superstruct";
|
|
4
|
+
function file() {
|
|
5
|
+
return coerce(string(), string(), (value) => {
|
|
6
|
+
return resolve(process.cwd(), value);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
file
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-HYPSSFE5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { coerce, string } from 'superstruct';\n\n/**\n * A wrapper of `superstruct`'s `string` struct that coerces a value to a string\n * and resolves it relative to the current working directory. This is useful\n * for specifying file paths in a configuration file, as it allows the user to\n * use both relative and absolute paths.\n *\n * @returns The `superstruct` struct, which validates that the value is a\n * string, and resolves it relative to the current working directory.\n * @example\n * ```ts\n * const config = struct({\n * file: file(),\n * // ...\n * });\n *\n * const value = create({ file: 'path/to/file' }, config);\n * console.log(value.file); // /process/cwd/path/to/file\n * ```\n */\nexport function file() {\n return coerce(string(), string(), (value) => {\n return resolve(process.cwd(), value);\n });\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,QAAQ,cAAc;AAqBxB,SAAS,OAAO;AACrB,SAAO,OAAO,OAAO,GAAG,OAAO,GAAG,CAAC,UAAU;AAC3C,WAAO,QAAQ,QAAQ,IAAI,GAAG,KAAK;AAAA,EACrC,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getServer
|
|
3
|
+
} from "./chunk-SYRWT2KT.mjs";
|
|
4
|
+
import {
|
|
5
|
+
info
|
|
6
|
+
} from "./chunk-ZAW4ZWQX.mjs";
|
|
7
|
+
|
|
8
|
+
// src/commands/serve/serve.ts
|
|
9
|
+
async function serveHandler(config, options) {
|
|
10
|
+
const server = getServer(config);
|
|
11
|
+
const { port } = await server.listen(options.port);
|
|
12
|
+
info(`The server is listening on http://localhost:${port}.`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
serveHandler
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=chunk-JAHNVVLT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/serve/serve.ts"],"sourcesContent":["import type { ProcessedConfig } from '../../config';\nimport { info } from '../../utils';\nimport { getServer } from '../../webpack';\n\ntype ServeOptions = {\n /**\n * The port to listen on.\n */\n port: number;\n};\n\n/**\n * Starts a local, static HTTP server on the given port with the given root\n * directory.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function serveHandler(\n config: ProcessedConfig,\n options: ServeOptions,\n): Promise<void> {\n const server = getServer(config);\n\n // If the `configPort` is `0`, the OS will choose a random port for us, so we\n // need to get the port from the server after it starts.\n const { port } = await server.listen(options.port);\n\n info(`The server is listening on http://localhost:${port}.`);\n}\n"],"mappings":";;;;;;;;AAkBA,eAAsB,aACpB,QACA,SACe;AACf,QAAM,SAAS,UAAU,MAAM;AAI/B,QAAM,EAAE,KAAK,IAAI,MAAM,OAAO,OAAO,QAAQ,IAAI;AAEjD,OAAK,+CAA+C,IAAI,GAAG;AAC7D;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
serveHandler
|
|
3
|
+
} from "./chunk-JAHNVVLT.mjs";
|
|
4
|
+
import {
|
|
5
|
+
builders_default
|
|
6
|
+
} from "./chunk-MR44GPM3.mjs";
|
|
7
|
+
|
|
8
|
+
// src/commands/serve/index.ts
|
|
9
|
+
var command = {
|
|
10
|
+
command: ["serve", "s"],
|
|
11
|
+
desc: "Locally serve Snap file(s) for testing",
|
|
12
|
+
builder: (yarg) => {
|
|
13
|
+
yarg.option("root", builders_default.root).option("port", builders_default.port);
|
|
14
|
+
},
|
|
15
|
+
handler: async (argv) => serveHandler(argv.context.config, {
|
|
16
|
+
port: argv.port ?? argv.context.config.server.port
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
var serve_default = command;
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
serve_default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-JCVSYVPD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/serve/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { serveHandler } from './serve';\n\nconst command = {\n command: ['serve', 's'],\n desc: 'Locally serve Snap file(s) for testing',\n builder: (yarg: yargs.Argv) => {\n yarg.option('root', builders.root).option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n serveHandler(argv.context.config, {\n port: argv.port ?? argv.context.config.server.port,\n }),\n};\n\nexport default command;\n"],"mappings":";;;;;;;;AAMA,IAAM,UAAU;AAAA,EACd,SAAS,CAAC,SAAS,GAAG;AAAA,EACtB,MAAM;AAAA,EACN,SAAS,CAAC,SAAqB;AAC7B,SAAK,OAAO,QAAQ,iBAAS,IAAI,EAAE,OAAO,QAAQ,iBAAS,IAAI;AAAA,EACjE;AAAA,EACA,SAAS,OAAO,SACd,aAAa,KAAK,QAAQ,QAAQ;AAAA,IAChC,MAAM,KAAK,QAAQ,KAAK,QAAQ,OAAO,OAAO;AAAA,EAChD,CAAC;AACL;AAEA,IAAO,gBAAQ;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk5CLEKHXEjs = require('./chunk-5CLEKHXE.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkS7UP2YYFjs = require('./chunk-S7UP2YYF.js');
|
|
7
|
+
|
|
8
|
+
// src/commands/watch/index.ts
|
|
9
|
+
var command = {
|
|
10
|
+
command: ["watch", "w"],
|
|
11
|
+
desc: "Build Snap on change",
|
|
12
|
+
builder: (yarg) => {
|
|
13
|
+
yarg.option("src", _chunkS7UP2YYFjs.builders_default.src).option("eval", _chunkS7UP2YYFjs.builders_default.eval).option("dist", _chunkS7UP2YYFjs.builders_default.dist).option("outfileName", _chunkS7UP2YYFjs.builders_default.outfileName).option("sourceMaps", _chunkS7UP2YYFjs.builders_default.sourceMaps).option("stripComments", _chunkS7UP2YYFjs.builders_default.stripComments).option("transpilationMode", _chunkS7UP2YYFjs.builders_default.transpilationMode).option("depsToTranspile", _chunkS7UP2YYFjs.builders_default.depsToTranspile).option("manifest", _chunkS7UP2YYFjs.builders_default.manifest).option("writeManifest", _chunkS7UP2YYFjs.builders_default.writeManifest).option("serve", _chunkS7UP2YYFjs.builders_default.serve).option("root", _chunkS7UP2YYFjs.builders_default.root).option("port", _chunkS7UP2YYFjs.builders_default.port).implies("writeManifest", "manifest").implies("depsToTranspile", "transpilationMode");
|
|
14
|
+
},
|
|
15
|
+
handler: async (argv) => _chunk5CLEKHXEjs.watchHandler.call(void 0, argv.context.config, {
|
|
16
|
+
port: argv.port
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
var watch_default = command;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.watch_default = watch_default;
|
|
24
|
+
//# sourceMappingURL=chunk-JI3B665Z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/watch/index.ts"],"names":[],"mappings":";;;;;;;;AAMA,IAAM,UAAU;AAAA,EACd,SAAS,CAAC,SAAS,GAAG;AAAA,EACtB,MAAM;AAAA,EACN,SAAS,CAAC,SAAqB;AAC7B,SACG,OAAO,OAAO,iBAAS,GAAG,EAC1B,OAAO,QAAQ,iBAAS,IAAI,EAC5B,OAAO,QAAQ,iBAAS,IAAI,EAC5B,OAAO,eAAe,iBAAS,WAAW,EAC1C,OAAO,cAAc,iBAAS,UAAU,EACxC,OAAO,iBAAiB,iBAAS,aAAa,EAC9C,OAAO,qBAAqB,iBAAS,iBAAiB,EACtD,OAAO,mBAAmB,iBAAS,eAAe,EAClD,OAAO,YAAY,iBAAS,QAAQ,EACpC,OAAO,iBAAiB,iBAAS,aAAa,EAC9C,OAAO,SAAS,iBAAS,KAAK,EAC9B,OAAO,QAAQ,iBAAS,IAAI,EAC5B,OAAO,QAAQ,iBAAS,IAAI,EAC5B,QAAQ,iBAAiB,UAAU,EACnC,QAAQ,mBAAmB,mBAAmB;AAAA,EACnD;AAAA,EACA,SAAS,OAAO,SACd,aAAa,KAAK,QAAQ,QAAQ;AAAA,IAChC,MAAM,KAAK;AAAA,EACb,CAAC;AACL;AAGA,IAAO,gBAAQ","sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { watchHandler } from './watch';\n\nconst command = {\n command: ['watch', 'w'],\n desc: 'Build Snap on change',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('src', builders.src)\n .option('eval', builders.eval)\n .option('dist', builders.dist)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('manifest', builders.manifest)\n .option('writeManifest', builders.writeManifest)\n .option('serve', builders.serve)\n .option('root', builders.root)\n .option('port', builders.port)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) =>\n watchHandler(argv.context.config, {\n port: argv.port,\n }),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CONFIG_FILE,
|
|
3
|
+
TS_CONFIG_FILE,
|
|
4
|
+
sanitizeInputs,
|
|
5
|
+
trimPathString
|
|
6
|
+
} from "./chunk-L72RLBV5.mjs";
|
|
7
|
+
import {
|
|
8
|
+
getDependencyRegExp,
|
|
9
|
+
processDependencies,
|
|
10
|
+
sanitizeDependencyPaths
|
|
11
|
+
} from "./chunk-QMD3VO6R.mjs";
|
|
12
|
+
import {
|
|
13
|
+
getRelativePath
|
|
14
|
+
} from "./chunk-TDSL55B3.mjs";
|
|
15
|
+
import {
|
|
16
|
+
executeSteps
|
|
17
|
+
} from "./chunk-YCYGKEXF.mjs";
|
|
18
|
+
import {
|
|
19
|
+
getErrorMessage,
|
|
20
|
+
getYargsErrorMessage
|
|
21
|
+
} from "./chunk-7RHK2YTB.mjs";
|
|
22
|
+
import {
|
|
23
|
+
error,
|
|
24
|
+
info,
|
|
25
|
+
warn
|
|
26
|
+
} from "./chunk-ZAW4ZWQX.mjs";
|
|
27
|
+
import {
|
|
28
|
+
__export
|
|
29
|
+
} from "./chunk-R77RJHC5.mjs";
|
|
30
|
+
|
|
31
|
+
// src/utils/index.ts
|
|
32
|
+
var utils_exports = {};
|
|
33
|
+
__export(utils_exports, {
|
|
34
|
+
CONFIG_FILE: () => CONFIG_FILE,
|
|
35
|
+
TS_CONFIG_FILE: () => TS_CONFIG_FILE,
|
|
36
|
+
error: () => error,
|
|
37
|
+
executeSteps: () => executeSteps,
|
|
38
|
+
getDependencyRegExp: () => getDependencyRegExp,
|
|
39
|
+
getErrorMessage: () => getErrorMessage,
|
|
40
|
+
getRelativePath: () => getRelativePath,
|
|
41
|
+
getYargsErrorMessage: () => getYargsErrorMessage,
|
|
42
|
+
info: () => info,
|
|
43
|
+
processDependencies: () => processDependencies,
|
|
44
|
+
sanitizeDependencyPaths: () => sanitizeDependencyPaths,
|
|
45
|
+
sanitizeInputs: () => sanitizeInputs,
|
|
46
|
+
trimPathString: () => trimPathString,
|
|
47
|
+
warn: () => warn
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
utils_exports
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=chunk-JL3URCHO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export * from './cli';\nexport * from './errors';\nexport * from './legacy';\nexport * from './logging';\nexport * from './path';\nexport * from './steps';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
evaluate
|
|
3
|
+
} from "./chunk-3WWFQLH4.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getRelativePath
|
|
6
|
+
} from "./chunk-TDSL55B3.mjs";
|
|
7
|
+
import {
|
|
8
|
+
executeSteps
|
|
9
|
+
} from "./chunk-YCYGKEXF.mjs";
|
|
10
|
+
import {
|
|
11
|
+
CommandError
|
|
12
|
+
} from "./chunk-X7TESUC7.mjs";
|
|
13
|
+
|
|
14
|
+
// src/commands/eval/eval.ts
|
|
15
|
+
import { isFile } from "@metamask/snaps-utils/node";
|
|
16
|
+
import { resolve } from "path";
|
|
17
|
+
var steps = [
|
|
18
|
+
{
|
|
19
|
+
name: "Checking the input file.",
|
|
20
|
+
task: async ({ input }) => {
|
|
21
|
+
if (!await isFile(input)) {
|
|
22
|
+
const relativePath = getRelativePath(input);
|
|
23
|
+
throw new CommandError(
|
|
24
|
+
`Input file not found: "${relativePath}". Make sure that the "input" field in your snap config or the specified input file is correct.`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "Evaluating the snap bundle.",
|
|
31
|
+
task: async ({ input, spinner }) => {
|
|
32
|
+
await evaluate(input);
|
|
33
|
+
spinner.succeed("Snap bundle evaluated successfully.");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
function getBundlePath(config, options) {
|
|
38
|
+
if (options.input) {
|
|
39
|
+
return resolve(process.cwd(), options.input);
|
|
40
|
+
}
|
|
41
|
+
return resolve(config.output.path, config.output.filename);
|
|
42
|
+
}
|
|
43
|
+
async function evaluateHandler(config, options = {}) {
|
|
44
|
+
const input = getBundlePath(config, options);
|
|
45
|
+
await executeSteps(steps, { input });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
evaluateHandler
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=chunk-K26BOY6Z.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/eval/eval.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\nimport { resolve } from 'path';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, getRelativePath } from '../../utils';\nimport { evaluate } from './implementation';\n\nexport type EvalOptions = {\n input?: string;\n};\n\nexport type EvalContext = Required<EvalOptions>;\n\nconst steps: Steps<EvalContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n const relativePath = getRelativePath(input);\n throw new CommandError(\n `Input file not found: \"${relativePath}\". Make sure that the \"input\" field in your snap config or the specified input file is correct.`,\n );\n }\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n task: async ({ input, spinner }) => {\n await evaluate(input);\n spinner.succeed('Snap bundle evaluated successfully.');\n },\n },\n];\n\n/**\n * Returns the path to the bundle, based on the config and options.\n *\n * - If `options.input` is specified, it is used as the bundle path.\n * - Otherwise, the bundle path is resolved from the config's output path and\n * filename.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns The path to the bundle.\n */\nfunction getBundlePath(config: ProcessedConfig, options: EvalOptions): string {\n if (options.input) {\n return resolve(process.cwd(), options.input);\n }\n\n return resolve(config.output.path, config.output.filename);\n}\n\n/**\n * Runs the snap in a worker, to ensure SES compatibility.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns A promise that resolves once the eval has finished.\n * @throws If the eval failed.\n */\nexport async function evaluateHandler(\n config: ProcessedConfig,\n options: EvalOptions = {},\n): Promise<void> {\n const input = getBundlePath(config, options);\n await executeSteps(steps, { input });\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,eAAe;AAcxB,IAAM,QAA4B;AAAA,EAChC;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,MAAM,MAAM;AACzB,UAAI,CAAE,MAAM,OAAO,KAAK,GAAI;AAC1B,cAAM,eAAe,gBAAgB,KAAK;AAC1C,cAAM,IAAI;AAAA,UACR,0BAA0B,YAAY;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,OAAO,QAAQ,MAAM;AAClC,YAAM,SAAS,KAAK;AACpB,cAAQ,QAAQ,qCAAqC;AAAA,IACvD;AAAA,EACF;AACF;AAaA,SAAS,cAAc,QAAyB,SAA8B;AAC5E,MAAI,QAAQ,OAAO;AACjB,WAAO,QAAQ,QAAQ,IAAI,GAAG,QAAQ,KAAK;AAAA,EAC7C;AAEA,SAAO,QAAQ,OAAO,OAAO,MAAM,OAAO,OAAO,QAAQ;AAC3D;AAUA,eAAsB,gBACpB,QACA,UAAuB,CAAC,GACT;AACf,QAAM,QAAQ,cAAc,QAAQ,OAAO;AAC3C,QAAM,aAAa,OAAO,EAAE,MAAM,CAAC;AACrC;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildHandler
|
|
3
|
+
} from "./chunk-T7NEPTM5.mjs";
|
|
4
|
+
import {
|
|
5
|
+
builders_default
|
|
6
|
+
} from "./chunk-MR44GPM3.mjs";
|
|
7
|
+
|
|
8
|
+
// src/commands/build/index.ts
|
|
9
|
+
var command = {
|
|
10
|
+
command: ["build", "b"],
|
|
11
|
+
desc: "Build snap from source",
|
|
12
|
+
builder: (yarg) => {
|
|
13
|
+
yarg.option("dist", builders_default.dist).option("eval", builders_default.eval).option("manifest", builders_default.manifest).option("outfileName", builders_default.outfileName).option("sourceMaps", builders_default.sourceMaps).option("src", builders_default.src).option("stripComments", builders_default.stripComments).option("transpilationMode", builders_default.transpilationMode).option("depsToTranspile", builders_default.depsToTranspile).option("writeManifest", builders_default.writeManifest).implies("writeManifest", "manifest").implies("depsToTranspile", "transpilationMode");
|
|
14
|
+
},
|
|
15
|
+
handler: async (argv) => buildHandler(argv.context.config)
|
|
16
|
+
};
|
|
17
|
+
var build_default = command;
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
build_default
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-K5QMGTQL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/build/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { buildHandler } from './build';\n\nconst command = {\n command: ['build', 'b'],\n desc: 'Build snap from source',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('dist', builders.dist)\n .option('eval', builders.eval)\n .option('manifest', builders.manifest)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('src', builders.src)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('writeManifest', builders.writeManifest)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) => buildHandler(argv.context.config),\n};\n\nexport * from './implementation';\nexport default command;\n"],"mappings":";;;;;;;;AAMA,IAAM,UAAU;AAAA,EACd,SAAS,CAAC,SAAS,GAAG;AAAA,EACtB,MAAM;AAAA,EACN,SAAS,CAAC,SAAqB;AAC7B,SACG,OAAO,QAAQ,iBAAS,IAAI,EAC5B,OAAO,QAAQ,iBAAS,IAAI,EAC5B,OAAO,YAAY,iBAAS,QAAQ,EACpC,OAAO,eAAe,iBAAS,WAAW,EAC1C,OAAO,cAAc,iBAAS,UAAU,EACxC,OAAO,OAAO,iBAAS,GAAG,EAC1B,OAAO,iBAAiB,iBAAS,aAAa,EAC9C,OAAO,qBAAqB,iBAAS,iBAAiB,EACtD,OAAO,mBAAmB,iBAAS,eAAe,EAClD,OAAO,iBAAiB,iBAAS,aAAa,EAC9C,QAAQ,iBAAiB,UAAU,EACnC,QAAQ,mBAAmB,mBAAmB;AAAA,EACnD;AAAA,EACA,SAAS,OAAO,SAAoB,aAAa,KAAK,QAAQ,MAAM;AACtE;AAGA,IAAO,gBAAQ;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkMUYXNIONjs = require('./chunk-MUYXNION.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkDBLADLQ4js = require('./chunk-DBLADLQ4.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkXGWLFH7Yjs = require('./chunk-XGWLFH7Y.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkBALQOCUOjs = require('./chunk-BALQOCUO.js');
|
|
13
|
+
|
|
14
|
+
// src/commands/eval/eval.ts
|
|
15
|
+
var _node = require('@metamask/snaps-utils/node');
|
|
16
|
+
var _path = require('path');
|
|
17
|
+
var steps = [
|
|
18
|
+
{
|
|
19
|
+
name: "Checking the input file.",
|
|
20
|
+
task: async ({ input }) => {
|
|
21
|
+
if (!await _node.isFile.call(void 0, input)) {
|
|
22
|
+
const relativePath = _chunkDBLADLQ4js.getRelativePath.call(void 0, input);
|
|
23
|
+
throw new (0, _chunkBALQOCUOjs.CommandError)(
|
|
24
|
+
`Input file not found: "${relativePath}". Make sure that the "input" field in your snap config or the specified input file is correct.`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "Evaluating the snap bundle.",
|
|
31
|
+
task: async ({ input, spinner }) => {
|
|
32
|
+
await _chunkMUYXNIONjs.evaluate.call(void 0, input);
|
|
33
|
+
spinner.succeed("Snap bundle evaluated successfully.");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
function getBundlePath(config, options) {
|
|
38
|
+
if (options.input) {
|
|
39
|
+
return _path.resolve.call(void 0, process.cwd(), options.input);
|
|
40
|
+
}
|
|
41
|
+
return _path.resolve.call(void 0, config.output.path, config.output.filename);
|
|
42
|
+
}
|
|
43
|
+
async function evaluateHandler(config, options = {}) {
|
|
44
|
+
const input = getBundlePath(config, options);
|
|
45
|
+
await _chunkXGWLFH7Yjs.executeSteps.call(void 0, steps, { input });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
exports.evaluateHandler = evaluateHandler;
|
|
51
|
+
//# sourceMappingURL=chunk-KLOPX6DO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/eval/eval.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,eAAe;AAcxB,IAAM,QAA4B;AAAA,EAChC;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,MAAM,MAAM;AACzB,UAAI,CAAE,MAAM,OAAO,KAAK,GAAI;AAC1B,cAAM,eAAe,gBAAgB,KAAK;AAC1C,cAAM,IAAI;AAAA,UACR,0BAA0B,YAAY;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,OAAO,QAAQ,MAAM;AAClC,YAAM,SAAS,KAAK;AACpB,cAAQ,QAAQ,qCAAqC;AAAA,IACvD;AAAA,EACF;AACF;AAaA,SAAS,cAAc,QAAyB,SAA8B;AAC5E,MAAI,QAAQ,OAAO;AACjB,WAAO,QAAQ,QAAQ,IAAI,GAAG,QAAQ,KAAK;AAAA,EAC7C;AAEA,SAAO,QAAQ,OAAO,OAAO,MAAM,OAAO,OAAO,QAAQ;AAC3D;AAUA,eAAsB,gBACpB,QACA,UAAuB,CAAC,GACT;AACf,QAAM,QAAQ,cAAc,QAAQ,OAAO;AAC3C,QAAM,aAAa,OAAO,EAAE,MAAM,CAAC;AACrC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\nimport { resolve } from 'path';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, getRelativePath } from '../../utils';\nimport { evaluate } from './implementation';\n\nexport type EvalOptions = {\n input?: string;\n};\n\nexport type EvalContext = Required<EvalOptions>;\n\nconst steps: Steps<EvalContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n const relativePath = getRelativePath(input);\n throw new CommandError(\n `Input file not found: \"${relativePath}\". Make sure that the \"input\" field in your snap config or the specified input file is correct.`,\n );\n }\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n task: async ({ input, spinner }) => {\n await evaluate(input);\n spinner.succeed('Snap bundle evaluated successfully.');\n },\n },\n];\n\n/**\n * Returns the path to the bundle, based on the config and options.\n *\n * - If `options.input` is specified, it is used as the bundle path.\n * - Otherwise, the bundle path is resolved from the config's output path and\n * filename.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns The path to the bundle.\n */\nfunction getBundlePath(config: ProcessedConfig, options: EvalOptions): string {\n if (options.input) {\n return resolve(process.cwd(), options.input);\n }\n\n return resolve(config.output.path, config.output.filename);\n}\n\n/**\n * Runs the snap in a worker, to ensure SES compatibility.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns A promise that resolves once the eval has finished.\n * @throws If the eval failed.\n */\nexport async function evaluateHandler(\n config: ProcessedConfig,\n options: EvalOptions = {},\n): Promise<void> {\n const input = getBundlePath(config, options);\n await executeSteps(steps, { input });\n}\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
var _chunkBVPYLBE5js = require('./chunk-BVPYLBE5.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkC46KEPACjs = require('./chunk-C46KEPAC.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkB3NNVTA6js = require('./chunk-B3NNVTA6.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkTJ2F3J6Xjs = require('./chunk-TJ2F3J6X.js');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkS7UP2YYFjs = require('./chunk-S7UP2YYF.js');
|
|
16
|
+
|
|
17
|
+
// src/cli.ts
|
|
18
|
+
var _semver = require('semver'); var _semver2 = _interopRequireDefault(_semver);
|
|
19
|
+
var _yargs = require('yargs'); var _yargs2 = _interopRequireDefault(_yargs);
|
|
20
|
+
var _helpers = require('yargs/helpers');
|
|
21
|
+
var MINIMUM_NODE_16_VERSION = "16.17.0";
|
|
22
|
+
var MINIMUM_NODE_18_VERSION = "18.6.0";
|
|
23
|
+
function checkNodeVersion(nodeVersion = process.version.slice(1)) {
|
|
24
|
+
const majorVersion = _semver2.default.major(nodeVersion);
|
|
25
|
+
const message = `Node version ${nodeVersion} is not supported. Please use Node ${MINIMUM_NODE_16_VERSION} or later.`;
|
|
26
|
+
if (majorVersion < 16) {
|
|
27
|
+
_chunkTJ2F3J6Xjs.error.call(void 0, message);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
if (majorVersion === 16 && _semver2.default.lt(nodeVersion, MINIMUM_NODE_16_VERSION)) {
|
|
31
|
+
_chunkTJ2F3J6Xjs.error.call(void 0, message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
if (majorVersion === 18 && _semver2.default.lt(nodeVersion, MINIMUM_NODE_18_VERSION)) {
|
|
35
|
+
_chunkTJ2F3J6Xjs.error.call(void 0,
|
|
36
|
+
`Node version ${nodeVersion} is not supported. Please use Node ${MINIMUM_NODE_18_VERSION} or later.`
|
|
37
|
+
);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function cli(argv, commands) {
|
|
42
|
+
checkNodeVersion();
|
|
43
|
+
await _yargs2.default.call(void 0, _helpers.hideBin.call(void 0, argv)).scriptName("mm-snap").usage("Usage: $0 <command> [options]").example("$0 build", `Build './src/index.js' as './dist/bundle.js'`).example(
|
|
44
|
+
"$0 build --config ./snap.config.build.ts",
|
|
45
|
+
`Build './src/index.js' as './dist/bundle.js' using the config in './snap.config.build.ts'`
|
|
46
|
+
).example("$0 manifest --fix", `Check the snap manifest, and fix any errors`).example(
|
|
47
|
+
"$0 watch --port 8000",
|
|
48
|
+
`The snap input file for changes, and serve it on port 8000`
|
|
49
|
+
).example("$0 serve --port 8000", `Serve the snap bundle on port 8000`).command(commands).option("config", _chunkS7UP2YYFjs.builders_default.config).option("verboseErrors", _chunkS7UP2YYFjs.builders_default.verboseErrors).option("suppressWarnings", _chunkS7UP2YYFjs.builders_default.suppressWarnings).strict().middleware(async (args) => {
|
|
50
|
+
args.context = {
|
|
51
|
+
config: await _chunkBVPYLBE5js.getConfigByArgv.call(void 0, args)
|
|
52
|
+
};
|
|
53
|
+
_chunkC46KEPACjs.sanitizeInputs.call(void 0, args);
|
|
54
|
+
}, false).demandCommand(1, "You must specify at least one command.").fail((message, failure) => {
|
|
55
|
+
_chunkTJ2F3J6Xjs.error.call(void 0, _chunkB3NNVTA6js.getYargsErrorMessage.call(void 0, message, failure));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}).help().alias("help", "h").parseAsync();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
exports.checkNodeVersion = checkNodeVersion; exports.cli = cli;
|
|
64
|
+
//# sourceMappingURL=chunk-KUSHMQXD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,SAAS,eAAe;AAMxB,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAQzB,SAAS,iBACd,cAAsB,QAAQ,QAAQ,MAAM,CAAC,GAC7C;AACA,QAAM,eAAe,OAAO,MAAM,WAAW;AAC7C,QAAM,UAAU,gBAAgB,WAAW,sCAAsC,uBAAuB;AAExG,MAAI,eAAe,IAAI;AACrB,UAAM,OAAO;AAEb,YAAQ,KAAK,CAAC;AAAA,EAChB;AAIA,MAAI,iBAAiB,MAAM,OAAO,GAAG,aAAa,uBAAuB,GAAG;AAC1E,UAAM,OAAO;AAEb,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,MAAI,iBAAiB,MAAM,OAAO,GAAG,aAAa,uBAAuB,GAAG;AAC1E;AAAA,MACE,gBAAgB,WAAW,sCAAsC,uBAAuB;AAAA,IAC1F;AAEA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AASA,eAAsB,IAAI,MAAgB,UAAe;AACvD,mBAAiB;AAEjB,QAAM,MAAM,QAAQ,IAAI,CAAC,EACtB,WAAW,SAAS,EACpB,MAAM,+BAA+B,EAErC,QAAQ,YAAY,8CAA8C,EAClE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,QAAQ,qBAAqB,6CAA6C,EAC1E;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,QAAQ,wBAAwB,oCAAoC,EAEpE,QAAQ,QAAQ,EAEhB,OAAO,UAAU,iBAAS,MAAM,EAChC,OAAO,iBAAiB,iBAAS,aAAa,EAC9C,OAAO,oBAAoB,iBAAS,gBAAgB,EAEpD,OAAO,EAEP,WAAW,OAAO,SAAc;AAE/B,SAAK,UAAU;AAAA,MACb,QAAQ,MAAM,gBAAgB,IAAI;AAAA,IACpC;AAEA,mBAAe,IAAI;AAAA,EACrB,GAAG,KAAK,EAEP,cAAc,GAAG,wCAAwC,EAEzD,KAAK,CAAC,SAAS,YAAY;AAC1B,UAAM,qBAAqB,SAAS,OAAO,CAAC;AAE5C,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC,EAEA,KAAK,EACL,MAAM,QAAQ,GAAG,EACjB,WAAW;AAChB","sourcesContent":["import semver from 'semver';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport builders from './builders';\nimport { getConfigByArgv } from './config';\nimport { error, getYargsErrorMessage, sanitizeInputs } from './utils';\n\nconst MINIMUM_NODE_16_VERSION = '16.17.0';\nconst MINIMUM_NODE_18_VERSION = '18.6.0';\n\n/**\n * Check the Node version. If the Node version is less than the minimum required\n * version, this logs an error and exits the process.\n *\n * @param nodeVersion - The Node version to check.\n */\nexport function checkNodeVersion(\n nodeVersion: string = process.version.slice(1),\n) {\n const majorVersion = semver.major(nodeVersion);\n const message = `Node version ${nodeVersion} is not supported. Please use Node ${MINIMUM_NODE_16_VERSION} or later.`;\n\n if (majorVersion < 16) {\n error(message);\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n }\n\n // Node 16 and 18 have a different minimum version requirement, so we need to\n // check for both.\n if (majorVersion === 16 && semver.lt(nodeVersion, MINIMUM_NODE_16_VERSION)) {\n error(message);\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n }\n\n if (majorVersion === 18 && semver.lt(nodeVersion, MINIMUM_NODE_18_VERSION)) {\n error(\n `Node version ${nodeVersion} is not supported. Please use Node ${MINIMUM_NODE_18_VERSION} or later.`,\n );\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n }\n}\n\n/**\n * The main CLI entry point function. This processes the command line args, and\n * runs the appropriate function.\n *\n * @param argv - The raw command line arguments, i.e., `process.argv`.\n * @param commands - The list of commands to use.\n */\nexport async function cli(argv: string[], commands: any) {\n checkNodeVersion();\n\n await yargs(hideBin(argv))\n .scriptName('mm-snap')\n .usage('Usage: $0 <command> [options]')\n\n .example('$0 build', `Build './src/index.js' as './dist/bundle.js'`)\n .example(\n '$0 build --config ./snap.config.build.ts',\n `Build './src/index.js' as './dist/bundle.js' using the config in './snap.config.build.ts'`,\n )\n .example('$0 manifest --fix', `Check the snap manifest, and fix any errors`)\n .example(\n '$0 watch --port 8000',\n `The snap input file for changes, and serve it on port 8000`,\n )\n .example('$0 serve --port 8000', `Serve the snap bundle on port 8000`)\n\n .command(commands)\n\n .option('config', builders.config)\n .option('verboseErrors', builders.verboseErrors)\n .option('suppressWarnings', builders.suppressWarnings)\n\n .strict()\n\n .middleware(async (args: any) => {\n // eslint-disable-next-line require-atomic-updates\n args.context = {\n config: await getConfigByArgv(args),\n };\n\n sanitizeInputs(args);\n }, false)\n\n .demandCommand(1, 'You must specify at least one command.')\n\n .fail((message, failure) => {\n error(getYargsErrorMessage(message, failure));\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n })\n\n .help()\n .alias('help', 'h')\n .parseAsync();\n}\n"]}
|