@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
|
@@ -1,274 +1,302 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkOKDY7C7Sjs = require('./chunk-OKDY7C7S.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkMDHJ5HLMjs = require('./chunk-MDHJ5HLM.js');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkQHCKVO3Pjs = require('./chunk-QHCKVO3P.js');
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunkYQ2E7NEAjs = require('./chunk-YQ2E7NEA.js');
|
|
21
|
+
|
|
22
|
+
// src/webpack/config.ts
|
|
23
|
+
var _snapswebpackplugin = require('@metamask/snaps-webpack-plugin'); var _snapswebpackplugin2 = _interopRequireDefault(_snapswebpackplugin);
|
|
24
|
+
var _path = require('path');
|
|
25
|
+
var _terserwebpackplugin = require('terser-webpack-plugin'); var _terserwebpackplugin2 = _interopRequireDefault(_terserwebpackplugin);
|
|
26
|
+
var _webpack = require('webpack');
|
|
22
27
|
async function getDefaultConfiguration(config, options = {
|
|
23
|
-
|
|
28
|
+
evaluate: config.evaluate
|
|
24
29
|
}) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
const spinnerText = options.spinner?.text;
|
|
31
|
+
const builtInResolver = config.stats.builtIns && new (0, _chunkOKDY7C7Sjs.SnapsBuiltInResolver)(config.stats.builtIns, options.spinner);
|
|
32
|
+
return {
|
|
33
|
+
/**
|
|
29
34
|
* The target is set to `browserslist` so that Webpack will compile the
|
|
30
35
|
* bundle to support the browsers specified in the `.browserslistrc` file.
|
|
31
36
|
* This Browserslist file contains the browsers that are supported by
|
|
32
37
|
* MetaMask Snaps.
|
|
33
38
|
*
|
|
34
39
|
* @see https://webpack.js.org/configuration/target/
|
|
35
|
-
*/
|
|
36
|
-
|
|
40
|
+
*/
|
|
41
|
+
target: `browserslist:${_chunkMDHJ5HLMjs.BROWSERSLIST_FILE}`,
|
|
42
|
+
/**
|
|
37
43
|
* The mode is set to `production` by default, so that Webpack will minify
|
|
38
44
|
* and optimize the bundle.
|
|
39
45
|
*
|
|
40
46
|
* @see https://webpack.js.org/configuration/mode/
|
|
41
|
-
*/
|
|
42
|
-
|
|
47
|
+
*/
|
|
48
|
+
mode: "production",
|
|
49
|
+
/**
|
|
43
50
|
* The entry point is set to the `input` value from the config object.
|
|
44
51
|
*
|
|
45
52
|
* @see https://webpack.js.org/configuration/entry-context/
|
|
46
|
-
*/
|
|
47
|
-
|
|
53
|
+
*/
|
|
54
|
+
entry: config.input,
|
|
55
|
+
/**
|
|
48
56
|
* The devtool option controls how source maps are generated. We set it to
|
|
49
57
|
* the `sourceMap` value from the config object.
|
|
50
58
|
*
|
|
51
59
|
* @see https://webpack.js.org/configuration/devtool/
|
|
52
|
-
*/
|
|
53
|
-
|
|
60
|
+
*/
|
|
61
|
+
devtool: _chunkMDHJ5HLMjs.getDevTool.call(void 0, config.sourceMap),
|
|
62
|
+
/**
|
|
54
63
|
* The stats option controls how much information is printed to the console
|
|
55
64
|
* when Webpack is running. We set it to `none` so that we can control the
|
|
56
65
|
* output ourselves.
|
|
57
66
|
*
|
|
58
67
|
* @see https://webpack.js.org/configuration/stats/
|
|
59
|
-
*/
|
|
60
|
-
|
|
68
|
+
*/
|
|
69
|
+
stats: "none",
|
|
70
|
+
/**
|
|
61
71
|
* The output options.
|
|
62
72
|
*
|
|
63
73
|
* @see https://webpack.js.org/configuration/output/
|
|
64
|
-
*/
|
|
65
|
-
|
|
74
|
+
*/
|
|
75
|
+
output: {
|
|
76
|
+
/**
|
|
66
77
|
* This indicates whether Webpack should clear the output directory
|
|
67
78
|
* before building. We set it to the `clean` value from the config
|
|
68
79
|
* object.
|
|
69
80
|
*
|
|
70
81
|
* @see https://webpack.js.org/configuration/output/#outputclean
|
|
71
|
-
*/
|
|
72
|
-
|
|
82
|
+
*/
|
|
83
|
+
clean: config.output.clean,
|
|
84
|
+
/**
|
|
73
85
|
* The filename of the bundle. We set it to the `filename` value from
|
|
74
86
|
* the config object.
|
|
75
87
|
*
|
|
76
88
|
* @see https://webpack.js.org/configuration/output/#outputfilename
|
|
77
|
-
*/
|
|
78
|
-
|
|
89
|
+
*/
|
|
90
|
+
filename: config.output.filename,
|
|
91
|
+
/**
|
|
79
92
|
* The path to the output directory. We set it to the `path` value from
|
|
80
93
|
* the config object.
|
|
81
94
|
*
|
|
82
95
|
* @see https://webpack.js.org/configuration/output/#outputpath
|
|
83
|
-
*/
|
|
84
|
-
|
|
96
|
+
*/
|
|
97
|
+
path: config.output.path,
|
|
98
|
+
/**
|
|
85
99
|
* The public path of the bundle. We set it to `/` by default, so that
|
|
86
100
|
* the bundle can be loaded from the root of the server.
|
|
87
101
|
*
|
|
88
102
|
* @see https://webpack.js.org/configuration/output/#outputpublicpath
|
|
89
|
-
*/
|
|
90
|
-
|
|
103
|
+
*/
|
|
104
|
+
publicPath: "/",
|
|
105
|
+
/**
|
|
91
106
|
* The library configuration. This tells Webpack how to export the
|
|
92
107
|
* bundle.
|
|
93
108
|
*
|
|
94
109
|
* @see https://webpack.js.org/configuration/output/#outputlibrary
|
|
95
|
-
*/
|
|
96
|
-
|
|
110
|
+
*/
|
|
111
|
+
library: {
|
|
112
|
+
/**
|
|
97
113
|
* This tells Webpack to export the bundle as a CommonJS module. This
|
|
98
114
|
* is necessary for MetaMask Snaps.
|
|
99
115
|
*
|
|
100
116
|
* @see https://webpack.js.org/configuration/output/#outputlibrarytarget
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
|
|
117
|
+
*/
|
|
118
|
+
type: "commonjs"
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
104
121
|
* The chunk format. This tells Webpack how to export chunks. This is
|
|
105
122
|
* required because we use browserslist to target browsers, but Snaps are
|
|
106
123
|
* not fully compatible with browser APIs (such as `window` and
|
|
107
124
|
* `document`).
|
|
108
125
|
*
|
|
109
126
|
* @see https://webpack.js.org/configuration/output/#outputchunkformat
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
*/
|
|
128
|
+
chunkFormat: "commonjs"
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
113
131
|
* The module configuration. This is where we tell Webpack how to handle
|
|
114
132
|
* different types of files.
|
|
115
133
|
*
|
|
116
134
|
* @see https://webpack.js.org/configuration/module/
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
*/
|
|
136
|
+
module: {
|
|
137
|
+
rules: [
|
|
138
|
+
{
|
|
139
|
+
test: /\.(js|mjs|cjs|ts)$/u,
|
|
140
|
+
exclude: /node_modules/u,
|
|
141
|
+
use: await _chunkMDHJ5HLMjs.getDefaultLoader.call(void 0, config)
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
125
144
|
* This allows importing modules that uses `.js` and not `.mjs` for the
|
|
126
145
|
* ES build.
|
|
127
146
|
*
|
|
128
147
|
* @see https://webpack.js.org/configuration/module/#resolvefullyspecified
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
config.experimental.wasm && {
|
|
136
|
-
test: /\.wasm$/u,
|
|
137
|
-
use: {
|
|
138
|
-
loader: (0, _path.resolve)(__dirname, 'loaders', 'wasm')
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
]
|
|
148
|
+
*/
|
|
149
|
+
{
|
|
150
|
+
test: /\.m?js/u,
|
|
151
|
+
resolve: {
|
|
152
|
+
fullySpecified: false
|
|
153
|
+
}
|
|
142
154
|
},
|
|
143
|
-
|
|
155
|
+
config.experimental.wasm && {
|
|
156
|
+
test: /\.wasm$/u,
|
|
157
|
+
use: _chunkQHCKVO3Pjs.getFunctionLoader.call(void 0, _chunkYQ2E7NEAjs.wasm_default, {})
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
144
162
|
* The resolve configuration. This tells Webpack how to resolve imports.
|
|
145
163
|
* We set it to resolve `.js` and `.ts` files.
|
|
146
164
|
*
|
|
147
165
|
* @see https://webpack.js.org/configuration/resolve/
|
|
148
|
-
*/
|
|
149
|
-
|
|
166
|
+
*/
|
|
167
|
+
resolve: {
|
|
168
|
+
/**
|
|
150
169
|
* The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`
|
|
151
170
|
* files.
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
'.cjs',
|
|
156
|
-
'.ts'
|
|
157
|
-
],
|
|
158
|
-
/**
|
|
171
|
+
*/
|
|
172
|
+
extensions: [".js", ".mjs", ".cjs", ".ts"],
|
|
173
|
+
/**
|
|
159
174
|
* The fallback options. This tells Webpack how to handle imports that
|
|
160
175
|
* aren't resolved. By default, we set Node.js built-ins to `false`, so
|
|
161
176
|
* that they are ignored.
|
|
162
|
-
*/
|
|
163
|
-
|
|
177
|
+
*/
|
|
178
|
+
fallback: _chunkMDHJ5HLMjs.getFallbacks.call(void 0, config.polyfills),
|
|
179
|
+
/**
|
|
164
180
|
* The plugins to use. We use the {@link SnapsBuiltInResolver} to show
|
|
165
181
|
* warnings about using Node.js built-ins, when no fallback is specified.
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
/**
|
|
182
|
+
*/
|
|
183
|
+
plugins: [builtInResolver]
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
171
186
|
* The plugins to use.
|
|
172
187
|
*
|
|
173
188
|
* @see https://webpack.js.org/configuration/plugins/
|
|
174
|
-
*/
|
|
175
|
-
|
|
189
|
+
*/
|
|
190
|
+
plugins: [
|
|
191
|
+
/**
|
|
176
192
|
* The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates
|
|
177
193
|
* the manifest file, and evaluates the bundle in SES. While not strictly
|
|
178
194
|
* required, it's highly recommended to use this plugin.
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
195
|
+
*/
|
|
196
|
+
new (0, _snapswebpackplugin2.default)({
|
|
197
|
+
manifestPath: config.manifest.path,
|
|
198
|
+
writeManifest: config.manifest.update,
|
|
199
|
+
eval: !options.watch && options.evaluate
|
|
200
|
+
}),
|
|
201
|
+
/**
|
|
185
202
|
* The `SnapsStatsPlugin` is a Webpack plugin that handles the stats
|
|
186
203
|
* output. It's used to show the stats in the terminal, in a format that
|
|
187
204
|
* is easy to read.
|
|
188
|
-
*/
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
/**
|
|
205
|
+
*/
|
|
206
|
+
new (0, _chunkOKDY7C7Sjs.SnapsStatsPlugin)({ verbose: config.stats.verbose }, options.spinner),
|
|
207
|
+
/**
|
|
192
208
|
* The `DefinePlugin` is a Webpack plugin that adds static values to the
|
|
193
209
|
* bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`
|
|
194
210
|
* environment variables, as well as any custom environment
|
|
195
211
|
* variables (as `process.env`).
|
|
196
|
-
*/
|
|
197
|
-
|
|
212
|
+
*/
|
|
213
|
+
new (0, _webpack.DefinePlugin)(_chunkMDHJ5HLMjs.getEnvironmentVariables.call(void 0, config.environment)),
|
|
214
|
+
/**
|
|
198
215
|
* The `ProgressPlugin` is a Webpack plugin that logs the progress of
|
|
199
216
|
* the build. We set it to log the progress to the spinner.
|
|
200
|
-
*/
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
217
|
+
*/
|
|
218
|
+
new (0, _webpack.ProgressPlugin)({
|
|
219
|
+
handler: _chunkMDHJ5HLMjs.getProgressHandler.call(void 0, options.spinner, spinnerText)
|
|
220
|
+
}),
|
|
221
|
+
/**
|
|
204
222
|
* The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a
|
|
205
223
|
* warning when the bundle is potentially incompatible with MetaMask
|
|
206
224
|
* Snaps.
|
|
207
|
-
*/
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
225
|
+
*/
|
|
226
|
+
new (0, _chunkOKDY7C7Sjs.SnapsBundleWarningsPlugin)({
|
|
227
|
+
builtInResolver,
|
|
228
|
+
builtIns: Boolean(config.stats.builtIns),
|
|
229
|
+
buffer: config.stats.buffer
|
|
230
|
+
}),
|
|
231
|
+
/**
|
|
213
232
|
* The `WatchPlugin` is a Webpack plugin that adds extra files to watch
|
|
214
233
|
* for changes. This is useful for rebuilding the bundle when the
|
|
215
234
|
* manifest file changes.
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
235
|
+
*/
|
|
236
|
+
options.watch && new (0, _chunkOKDY7C7Sjs.SnapsWatchPlugin)(
|
|
237
|
+
{
|
|
238
|
+
bundle: _path.resolve.call(void 0, config.output.path, config.output.filename),
|
|
239
|
+
evaluate: options.evaluate,
|
|
240
|
+
files: [config.manifest.path]
|
|
241
|
+
},
|
|
242
|
+
options.spinner
|
|
243
|
+
),
|
|
244
|
+
/**
|
|
224
245
|
* The `ProviderPlugin` is a Webpack plugin that automatically load
|
|
225
246
|
* modules instead of having to import or require them everywhere.
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
].filter(Boolean),
|
|
233
|
-
/**
|
|
247
|
+
*/
|
|
248
|
+
(config.polyfills === true || config.polyfills !== false && config.polyfills.buffer) && new (0, _webpack.ProvidePlugin)({
|
|
249
|
+
Buffer: ["buffer", "Buffer"]
|
|
250
|
+
})
|
|
251
|
+
].filter(Boolean),
|
|
252
|
+
/**
|
|
234
253
|
* The optimization configuration. This tells Webpack how to optimize the
|
|
235
254
|
* bundle. Most of the time, you won't need to change this, as the default
|
|
236
255
|
* options set by the `mode` option are sufficient.
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
|
|
256
|
+
*/
|
|
257
|
+
optimization: {
|
|
258
|
+
minimize: config.output.minimize,
|
|
259
|
+
/**
|
|
240
260
|
* The minimizer to use. We set it to use the `TerserPlugin`.
|
|
241
|
-
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
261
|
+
*/
|
|
262
|
+
minimizer: [
|
|
263
|
+
new (0, _terserwebpackplugin2.default)({
|
|
264
|
+
parallel: true
|
|
265
|
+
})
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
/**
|
|
248
269
|
* The performance configuration. This tells Webpack how to handle
|
|
249
270
|
* performance hints.
|
|
250
271
|
*
|
|
251
272
|
* @see https://webpack.js.org/configuration/performance/
|
|
252
|
-
*/
|
|
253
|
-
|
|
273
|
+
*/
|
|
274
|
+
performance: {
|
|
275
|
+
/**
|
|
254
276
|
* The hints to show. We set it to `false`, so that we don't get
|
|
255
277
|
* performance hints, as they are not relevant for Snaps.
|
|
256
278
|
*
|
|
257
279
|
* @see https://webpack.js.org/configuration/performance/#performancehints
|
|
258
|
-
*/
|
|
259
|
-
|
|
260
|
-
|
|
280
|
+
*/
|
|
281
|
+
hints: false
|
|
282
|
+
},
|
|
283
|
+
/**
|
|
261
284
|
* The infrastructure logging configuration. This tells Webpack how to
|
|
262
285
|
* log messages.
|
|
263
286
|
*
|
|
264
287
|
* @see https://webpack.js.org/configuration/infrastructure-logging
|
|
265
|
-
*/
|
|
266
|
-
|
|
288
|
+
*/
|
|
289
|
+
infrastructureLogging: {
|
|
290
|
+
/**
|
|
267
291
|
* The level of logging to use. We set it to `none`, so that we can
|
|
268
292
|
* control the output ourselves.
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
|
-
}
|
|
293
|
+
*/
|
|
294
|
+
level: "none"
|
|
295
|
+
}
|
|
296
|
+
};
|
|
272
297
|
}
|
|
273
298
|
|
|
274
|
-
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
exports.getDefaultConfiguration = getDefaultConfiguration;
|
|
302
|
+
//# sourceMappingURL=chunk-XUYXKO4F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webpack/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,wBAAwB;AAE/B,SAAS,eAAe;AACxB,OAAO,kBAAkB;AAEzB,SAAS,cAAc,gBAAgB,qBAAqB;AAuD5D,eAAsB,wBACpB,QACA,UAA0B;AAAA,EACxB,UAAU,OAAO;AACnB,GACwB;AACxB,QAAM,cAAc,QAAQ,SAAS;AACrC,QAAM,kBACJ,OAAO,MAAM,YACb,IAAI,qBAAqB,OAAO,MAAM,UAAU,QAAQ,OAAO;AAEjE,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASL,QAAQ,gBAAgB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAON,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQd,SAAS,WAAW,OAAO,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASpC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOP,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQN,OAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQrB,UAAU,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQxB,MAAM,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQpB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQZ,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOP,MAAM;AAAA,MACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAUA,aAAa;AAAA,IACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,QAAQ;AAAA,MACN,OAAO;AAAA,QACL;AAAA,UACE,MAAM;AAAA,UACN,SAAS;AAAA,UACT,KAAK,MAAM,iBAAiB,MAAM;AAAA,QACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQA;AAAA,UACE,MAAM;AAAA,UACN,SAAS;AAAA,YACP,gBAAgB;AAAA,UAClB;AAAA,QACF;AAAA,QAEA,OAAO,aAAa,QAAQ;AAAA,UAC1B,MAAM;AAAA,UACN,KAAK,kBAAkB,cAAM,CAAC,CAAC;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,MAKP,YAAY,CAAC,OAAO,QAAQ,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOzC,UAAU,aAAa,OAAO,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,MAMvC,SAAS,CAAC,eAAe;AAAA,IAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMP,IAAI,mBAAmB;AAAA,QACrB,cAAc,OAAO,SAAS;AAAA,QAC9B,eAAe,OAAO,SAAS;AAAA,QAC/B,MAAM,CAAC,QAAQ,SAAS,QAAQ;AAAA,MAClC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOD,IAAI,iBAAiB,EAAE,SAAS,OAAO,MAAM,QAAQ,GAAG,QAAQ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQvE,IAAI,aAAa,wBAAwB,OAAO,WAAW,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,MAM5D,IAAI,eAAe;AAAA,QACjB,SAAS,mBAAmB,QAAQ,SAAS,WAAW;AAAA,MAC1D,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOD,IAAI,0BAA0B;AAAA,QAC5B;AAAA,QACA,UAAU,QAAQ,OAAO,MAAM,QAAQ;AAAA,QACvC,QAAQ,OAAO,MAAM;AAAA,MACvB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOD,QAAQ,SACN,IAAI;AAAA,QACF;AAAA,UACE,QAAQ,QAAQ,OAAO,OAAO,MAAM,OAAO,OAAO,QAAQ;AAAA,UAC1D,UAAU,QAAQ;AAAA,UAClB,OAAO,CAAC,OAAO,SAAS,IAAI;AAAA,QAC9B;AAAA,QACA,QAAQ;AAAA,MACV;AAAA;AAAA;AAAA;AAAA;AAAA,OAMD,OAAO,cAAc,QACnB,OAAO,cAAc,SAAS,OAAO,UAAU,WAChD,IAAI,cAAc;AAAA,QAChB,QAAQ,CAAC,UAAU,QAAQ;AAAA,MAC7B,CAAC;AAAA,IACL,EAAE,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOhB,cAAc;AAAA,MACZ,UAAU,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,MAKxB,WAAW;AAAA,QACT,IAAI,aAAa;AAAA,UACf,UAAU;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOX,OAAO;AAAA,IACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,MAKrB,OAAO;AAAA,IACT;AAAA,EACF;AACF","sourcesContent":["import SnapsWebpackPlugin from '@metamask/snaps-webpack-plugin';\nimport type { Ora } from 'ora';\nimport { resolve } from 'path';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport type { Configuration } from 'webpack';\nimport { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { getFunctionLoader, wasm } from './loaders';\nimport {\n SnapsBuiltInResolver,\n SnapsBundleWarningsPlugin,\n SnapsStatsPlugin,\n SnapsWatchPlugin,\n} from './plugins';\nimport {\n BROWSERSLIST_FILE,\n getDefaultLoader,\n getDevTool,\n getEnvironmentVariables,\n getFallbacks,\n getProgressHandler,\n} from './utils';\n\nexport type WebpackOptions = {\n /**\n * Whether to watch for changes.\n */\n watch?: boolean;\n\n /**\n * Whether to evaluate the bundle. If this is set, it will override the\n * `evaluate` option in the config object.\n */\n evaluate?: boolean;\n\n /**\n * The spinner to use for logging.\n */\n spinner?: Ora;\n};\n\n/**\n * Get the default Webpack configuration. This is the configuration that will\n * be used if the user doesn't provide a custom Webpack configuration. The\n * configuration is based on the snap config.\n *\n * The default configuration includes:\n *\n * - `SWC` to transpile TypeScript and JavaScript files.\n * - `TerserPlugin` to minify the bundle.\n * - `SnapsWebpackPlugin` to validate the bundle and update the manifest.\n *\n * It can be customized through the `customizeWebpackConfig` function in the\n * snap config, but in most cases, you shouldn't need to do that.\n *\n * @param config - The processed snap Webpack config.\n * @param options - The Webpack options.\n * @returns The default Webpack configuration.\n */\nexport async function getDefaultConfiguration(\n config: ProcessedWebpackConfig,\n options: WebpackOptions = {\n evaluate: config.evaluate,\n },\n): Promise<Configuration> {\n const spinnerText = options.spinner?.text;\n const builtInResolver =\n config.stats.builtIns &&\n new SnapsBuiltInResolver(config.stats.builtIns, options.spinner);\n\n return {\n /**\n * The target is set to `browserslist` so that Webpack will compile the\n * bundle to support the browsers specified in the `.browserslistrc` file.\n * This Browserslist file contains the browsers that are supported by\n * MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/target/\n */\n target: `browserslist:${BROWSERSLIST_FILE}`,\n\n /**\n * The mode is set to `production` by default, so that Webpack will minify\n * and optimize the bundle.\n *\n * @see https://webpack.js.org/configuration/mode/\n */\n mode: 'production',\n\n /**\n * The entry point is set to the `input` value from the config object.\n *\n * @see https://webpack.js.org/configuration/entry-context/\n */\n entry: config.input,\n\n /**\n * The devtool option controls how source maps are generated. We set it to\n * the `sourceMap` value from the config object.\n *\n * @see https://webpack.js.org/configuration/devtool/\n */\n devtool: getDevTool(config.sourceMap),\n\n /**\n * The stats option controls how much information is printed to the console\n * when Webpack is running. We set it to `none` so that we can control the\n * output ourselves.\n *\n * @see https://webpack.js.org/configuration/stats/\n */\n stats: 'none',\n\n /**\n * The output options.\n *\n * @see https://webpack.js.org/configuration/output/\n */\n output: {\n /**\n * This indicates whether Webpack should clear the output directory\n * before building. We set it to the `clean` value from the config\n * object.\n *\n * @see https://webpack.js.org/configuration/output/#outputclean\n */\n clean: config.output.clean,\n\n /**\n * The filename of the bundle. We set it to the `filename` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputfilename\n */\n filename: config.output.filename,\n\n /**\n * The path to the output directory. We set it to the `path` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputpath\n */\n path: config.output.path,\n\n /**\n * The public path of the bundle. We set it to `/` by default, so that\n * the bundle can be loaded from the root of the server.\n *\n * @see https://webpack.js.org/configuration/output/#outputpublicpath\n */\n publicPath: '/',\n\n /**\n * The library configuration. This tells Webpack how to export the\n * bundle.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrary\n */\n library: {\n /**\n * This tells Webpack to export the bundle as a CommonJS module. This\n * is necessary for MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrarytarget\n */\n type: 'commonjs',\n },\n\n /**\n * The chunk format. This tells Webpack how to export chunks. This is\n * required because we use browserslist to target browsers, but Snaps are\n * not fully compatible with browser APIs (such as `window` and\n * `document`).\n *\n * @see https://webpack.js.org/configuration/output/#outputchunkformat\n */\n chunkFormat: 'commonjs',\n },\n\n /**\n * The module configuration. This is where we tell Webpack how to handle\n * different types of files.\n *\n * @see https://webpack.js.org/configuration/module/\n */\n module: {\n rules: [\n {\n test: /\\.(js|mjs|cjs|ts)$/u,\n exclude: /node_modules/u,\n use: await getDefaultLoader(config),\n },\n\n /**\n * This allows importing modules that uses `.js` and not `.mjs` for the\n * ES build.\n *\n * @see https://webpack.js.org/configuration/module/#resolvefullyspecified\n */\n {\n test: /\\.m?js/u,\n resolve: {\n fullySpecified: false,\n },\n },\n\n config.experimental.wasm && {\n test: /\\.wasm$/u,\n use: getFunctionLoader(wasm, {}),\n },\n ],\n },\n\n /**\n * The resolve configuration. This tells Webpack how to resolve imports.\n * We set it to resolve `.js` and `.ts` files.\n *\n * @see https://webpack.js.org/configuration/resolve/\n */\n resolve: {\n /**\n * The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`\n * files.\n */\n extensions: ['.js', '.mjs', '.cjs', '.ts'],\n\n /**\n * The fallback options. This tells Webpack how to handle imports that\n * aren't resolved. By default, we set Node.js built-ins to `false`, so\n * that they are ignored.\n */\n fallback: getFallbacks(config.polyfills),\n\n /**\n * The plugins to use. We use the {@link SnapsBuiltInResolver} to show\n * warnings about using Node.js built-ins, when no fallback is specified.\n */\n plugins: [builtInResolver],\n },\n\n /**\n * The plugins to use.\n *\n * @see https://webpack.js.org/configuration/plugins/\n */\n plugins: [\n /**\n * The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates\n * the manifest file, and evaluates the bundle in SES. While not strictly\n * required, it's highly recommended to use this plugin.\n */\n new SnapsWebpackPlugin({\n manifestPath: config.manifest.path,\n writeManifest: config.manifest.update,\n eval: !options.watch && options.evaluate,\n }),\n\n /**\n * The `SnapsStatsPlugin` is a Webpack plugin that handles the stats\n * output. It's used to show the stats in the terminal, in a format that\n * is easy to read.\n */\n new SnapsStatsPlugin({ verbose: config.stats.verbose }, options.spinner),\n\n /**\n * The `DefinePlugin` is a Webpack plugin that adds static values to the\n * bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`\n * environment variables, as well as any custom environment\n * variables (as `process.env`).\n */\n new DefinePlugin(getEnvironmentVariables(config.environment)),\n\n /**\n * The `ProgressPlugin` is a Webpack plugin that logs the progress of\n * the build. We set it to log the progress to the spinner.\n */\n new ProgressPlugin({\n handler: getProgressHandler(options.spinner, spinnerText),\n }),\n\n /**\n * The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a\n * warning when the bundle is potentially incompatible with MetaMask\n * Snaps.\n */\n new SnapsBundleWarningsPlugin({\n builtInResolver,\n builtIns: Boolean(config.stats.builtIns),\n buffer: config.stats.buffer,\n }),\n\n /**\n * The `WatchPlugin` is a Webpack plugin that adds extra files to watch\n * for changes. This is useful for rebuilding the bundle when the\n * manifest file changes.\n */\n options.watch &&\n new SnapsWatchPlugin(\n {\n bundle: resolve(config.output.path, config.output.filename),\n evaluate: options.evaluate,\n files: [config.manifest.path],\n },\n options.spinner,\n ),\n\n /**\n * The `ProviderPlugin` is a Webpack plugin that automatically load\n * modules instead of having to import or require them everywhere.\n */\n (config.polyfills === true ||\n (config.polyfills !== false && config.polyfills.buffer)) &&\n new ProvidePlugin({\n Buffer: ['buffer', 'Buffer'],\n }),\n ].filter(Boolean),\n\n /**\n * The optimization configuration. This tells Webpack how to optimize the\n * bundle. Most of the time, you won't need to change this, as the default\n * options set by the `mode` option are sufficient.\n */\n optimization: {\n minimize: config.output.minimize,\n\n /**\n * The minimizer to use. We set it to use the `TerserPlugin`.\n */\n minimizer: [\n new TerserPlugin({\n parallel: true,\n }),\n ],\n },\n\n /**\n * The performance configuration. This tells Webpack how to handle\n * performance hints.\n *\n * @see https://webpack.js.org/configuration/performance/\n */\n performance: {\n /**\n * The hints to show. We set it to `false`, so that we don't get\n * performance hints, as they are not relevant for Snaps.\n *\n * @see https://webpack.js.org/configuration/performance/#performancehints\n */\n hints: false,\n },\n\n /**\n * The infrastructure logging configuration. This tells Webpack how to\n * log messages.\n *\n * @see https://webpack.js.org/configuration/infrastructure-logging\n */\n infrastructureLogging: {\n /**\n * The level of logging to use. We set it to `none`, so that we can\n * control the output ourselves.\n */\n level: 'none',\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigByArgv
|
|
3
|
+
} from "./chunk-X7VYAL2L.mjs";
|
|
4
|
+
import {
|
|
5
|
+
sanitizeInputs
|
|
6
|
+
} from "./chunk-L72RLBV5.mjs";
|
|
7
|
+
import {
|
|
8
|
+
getYargsErrorMessage
|
|
9
|
+
} from "./chunk-7RHK2YTB.mjs";
|
|
10
|
+
import {
|
|
11
|
+
error
|
|
12
|
+
} from "./chunk-ZAW4ZWQX.mjs";
|
|
13
|
+
import {
|
|
14
|
+
builders_default
|
|
15
|
+
} from "./chunk-MR44GPM3.mjs";
|
|
16
|
+
|
|
17
|
+
// src/cli.ts
|
|
18
|
+
import semver from "semver";
|
|
19
|
+
import yargs from "yargs";
|
|
20
|
+
import { hideBin } from "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 = semver.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
|
+
error(message);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
if (majorVersion === 16 && semver.lt(nodeVersion, MINIMUM_NODE_16_VERSION)) {
|
|
31
|
+
error(message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
if (majorVersion === 18 && semver.lt(nodeVersion, MINIMUM_NODE_18_VERSION)) {
|
|
35
|
+
error(
|
|
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 yargs(hideBin(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", builders_default.config).option("verboseErrors", builders_default.verboseErrors).option("suppressWarnings", builders_default.suppressWarnings).strict().middleware(async (args) => {
|
|
50
|
+
args.context = {
|
|
51
|
+
config: await getConfigByArgv(args)
|
|
52
|
+
};
|
|
53
|
+
sanitizeInputs(args);
|
|
54
|
+
}, false).demandCommand(1, "You must specify at least one command.").fail((message, failure) => {
|
|
55
|
+
error(getYargsErrorMessage(message, failure));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}).help().alias("help", "h").parseAsync();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
checkNodeVersion,
|
|
62
|
+
cli
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=chunk-XZJLYKES.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"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"],"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;","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getErrorMessage
|
|
3
|
+
} from "./chunk-7RHK2YTB.mjs";
|
|
4
|
+
import {
|
|
5
|
+
error
|
|
6
|
+
} from "./chunk-ZAW4ZWQX.mjs";
|
|
7
|
+
|
|
8
|
+
// src/utils/steps.ts
|
|
9
|
+
import { dim } from "chalk";
|
|
10
|
+
import createSpinner from "ora";
|
|
11
|
+
async function executeSteps(steps, context) {
|
|
12
|
+
const spinner = createSpinner({
|
|
13
|
+
// Ora writes to `process.stderr` by default.
|
|
14
|
+
stream: process.stdout
|
|
15
|
+
});
|
|
16
|
+
spinner.start();
|
|
17
|
+
try {
|
|
18
|
+
for (const step of steps) {
|
|
19
|
+
if (step.condition && !step.condition(context)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
spinner.start(dim(step.name));
|
|
23
|
+
await step.task({
|
|
24
|
+
...context,
|
|
25
|
+
spinner
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (spinner.isSpinning) {
|
|
29
|
+
spinner.succeed("Done!");
|
|
30
|
+
}
|
|
31
|
+
} catch (_error) {
|
|
32
|
+
error(getErrorMessage(_error), spinner);
|
|
33
|
+
spinner.stop();
|
|
34
|
+
process.exitCode = 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
executeSteps
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=chunk-YCYGKEXF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/steps.ts"],"sourcesContent":["import { dim } from 'chalk';\nimport type { Ora } from 'ora';\nimport createSpinner from 'ora';\n\nimport { getErrorMessage } from './errors';\nimport { error } from './logging';\n\nexport type Step<Context extends Record<string, unknown>> = {\n name: string;\n condition?: (context: Context) => boolean;\n task: (context: Context & { spinner: Ora }) => Promise<void>;\n};\n\nexport type Steps<Context extends Record<string, unknown>> = Readonly<\n Step<Context>[]\n>;\n\n/**\n * Execute a list of steps in series. Each step receives the context object and\n * a spinner instance.\n *\n * @param steps - The steps to execute.\n * @param context - The context object that will be passed to each step.\n */\nexport async function executeSteps<Context extends Record<string, unknown>>(\n steps: Steps<Context>,\n context: Context,\n) {\n const spinner = createSpinner({\n // Ora writes to `process.stderr` by default.\n stream: process.stdout,\n });\n\n spinner.start();\n\n try {\n for (const step of steps) {\n // If the step has a condition, and it returns false, we skip the step.\n if (step.condition && !step.condition(context)) {\n continue;\n }\n\n // Calling `start` here instead of setting `spinner.text` seems to work\n // better when the process doesn't have a TTY.\n spinner.start(dim(step.name));\n\n await step.task({\n ...context,\n spinner,\n });\n }\n\n // The spinner may have been stopped by a step, so we only succeed if it's\n // still spinning.\n if (spinner.isSpinning) {\n spinner.succeed('Done!');\n }\n } catch (_error) {\n error(getErrorMessage(_error), spinner);\n spinner.stop();\n process.exitCode = 1;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,WAAW;AAEpB,OAAO,mBAAmB;AAsB1B,eAAsB,aACpB,OACA,SACA;AACA,QAAM,UAAU,cAAc;AAAA;AAAA,IAE5B,QAAQ,QAAQ;AAAA,EAClB,CAAC;AAED,UAAQ,MAAM;AAEd,MAAI;AACF,eAAW,QAAQ,OAAO;AAExB,UAAI,KAAK,aAAa,CAAC,KAAK,UAAU,OAAO,GAAG;AAC9C;AAAA,MACF;AAIA,cAAQ,MAAM,IAAI,KAAK,IAAI,CAAC;AAE5B,YAAM,KAAK,KAAK;AAAA,QACd,GAAG;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IACH;AAIA,QAAI,QAAQ,YAAY;AACtB,cAAQ,QAAQ,OAAO;AAAA,IACzB;AAAA,EACF,SAAS,QAAQ;AACf,UAAM,gBAAgB,MAAM,GAAG,OAAO;AACtC,YAAQ,KAAK;AACb,YAAQ,WAAW;AAAA,EACrB;AACF;","names":[]}
|