@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,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkXUYXKO4Fjs = require('./chunk-XUYXKO4F.js');
|
|
4
|
+
|
|
5
|
+
// src/webpack/compiler.ts
|
|
6
|
+
var _webpack = require('webpack');
|
|
7
|
+
async function getCompiler(config, options) {
|
|
8
|
+
const baseWebpackConfig = await _chunkXUYXKO4Fjs.getDefaultConfiguration.call(void 0, config, options);
|
|
9
|
+
const webpackConfig = config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;
|
|
10
|
+
return _webpack.webpack.call(void 0, webpackConfig);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.getCompiler = getCompiler;
|
|
16
|
+
//# sourceMappingURL=chunk-R6NBQKVH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webpack/compiler.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,eAAe;AAaxB,eAAsB,YACpB,QACA,SACA;AACA,QAAM,oBAAoB,MAAM,wBAAwB,QAAQ,OAAO;AACvE,QAAM,gBACJ,OAAO,yBAAyB,iBAAiB,KAAK;AAExD,SAAO,QAAQ,aAAa;AAC9B","sourcesContent":["import { webpack } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport type { WebpackOptions } from './config';\nimport { getDefaultConfiguration } from './config';\n\n/**\n * Get a Webpack compiler for the given config.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns The Webpack compiler.\n */\nexport async function getCompiler(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const baseWebpackConfig = await getDefaultConfiguration(config, options);\n const webpackConfig =\n config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;\n\n return webpack(webpackConfig);\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
+
}) : x)(function(x) {
|
|
5
|
+
if (typeof require !== "undefined")
|
|
6
|
+
return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __accessCheck = (obj, member, msg) => {
|
|
14
|
+
if (!member.has(obj))
|
|
15
|
+
throw TypeError("Cannot " + msg);
|
|
16
|
+
};
|
|
17
|
+
var __privateGet = (obj, member, getter) => {
|
|
18
|
+
__accessCheck(obj, member, "read from private field");
|
|
19
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
20
|
+
};
|
|
21
|
+
var __privateAdd = (obj, member, value) => {
|
|
22
|
+
if (member.has(obj))
|
|
23
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
24
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
25
|
+
};
|
|
26
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
27
|
+
__accessCheck(obj, member, "write to private field");
|
|
28
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
29
|
+
return value;
|
|
30
|
+
};
|
|
31
|
+
var __privateMethod = (obj, member, method) => {
|
|
32
|
+
__accessCheck(obj, member, "access private method");
|
|
33
|
+
return method;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
__require,
|
|
38
|
+
__export,
|
|
39
|
+
__privateGet,
|
|
40
|
+
__privateAdd,
|
|
41
|
+
__privateSet,
|
|
42
|
+
__privateMethod
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=chunk-R77RJHC5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/structs.ts
|
|
2
|
+
var _path = require('path');
|
|
3
|
+
var _superstruct = require('superstruct');
|
|
4
|
+
function file() {
|
|
5
|
+
return _superstruct.coerce.call(void 0, _superstruct.string.call(void 0, ), _superstruct.string.call(void 0, ), (value) => {
|
|
6
|
+
return _path.resolve.call(void 0, process.cwd(), value);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.file = file;
|
|
13
|
+
//# sourceMappingURL=chunk-S45DIQPN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/structs.ts"],"names":[],"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","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"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkQFK7JVP3js = require('./chunk-QFK7JVP3.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkS7UP2YYFjs = require('./chunk-S7UP2YYF.js');
|
|
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", _chunkS7UP2YYFjs.builders_default.writeManifest);
|
|
14
|
+
yarg.option("fix", _chunkS7UP2YYFjs.builders_default.fix);
|
|
15
|
+
},
|
|
16
|
+
handler: async (argv) => _chunkQFK7JVP3js.manifestHandler.call(void 0, argv.context.config, { fix: argv.fix })
|
|
17
|
+
};
|
|
18
|
+
var manifest_default = command;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.manifest_default = manifest_default;
|
|
23
|
+
//# sourceMappingURL=chunk-S76EZ6HY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/manifest/index.ts"],"names":[],"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","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"]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/builders.ts
|
|
2
|
+
var TranspilationModes = /* @__PURE__ */ ((TranspilationModes2) => {
|
|
3
|
+
TranspilationModes2["LocalAndDeps"] = "localAndDeps";
|
|
4
|
+
TranspilationModes2["LocalOnly"] = "localOnly";
|
|
5
|
+
TranspilationModes2["None"] = "none";
|
|
6
|
+
return TranspilationModes2;
|
|
7
|
+
})(TranspilationModes || {});
|
|
8
|
+
var builders = {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
+
config: {
|
|
11
|
+
alias: "c",
|
|
12
|
+
describe: "Path to config file",
|
|
13
|
+
type: "string",
|
|
14
|
+
normalize: true
|
|
15
|
+
},
|
|
16
|
+
fix: {
|
|
17
|
+
describe: "Attempt to fix snap.manifest.json",
|
|
18
|
+
type: "boolean"
|
|
19
|
+
},
|
|
20
|
+
input: {
|
|
21
|
+
alias: "i",
|
|
22
|
+
describe: "Snap bundle file to evaluate",
|
|
23
|
+
type: "string",
|
|
24
|
+
normalize: true
|
|
25
|
+
},
|
|
26
|
+
// Deprecated Browserify options.
|
|
27
|
+
bundle: {
|
|
28
|
+
alias: "b",
|
|
29
|
+
describe: "Snap bundle file",
|
|
30
|
+
type: "string",
|
|
31
|
+
normalize: true,
|
|
32
|
+
deprecated: "Use --input instead."
|
|
33
|
+
},
|
|
34
|
+
dist: {
|
|
35
|
+
alias: "d",
|
|
36
|
+
describe: "Output directory",
|
|
37
|
+
type: "string",
|
|
38
|
+
normalize: true,
|
|
39
|
+
deprecated: true
|
|
40
|
+
},
|
|
41
|
+
eval: {
|
|
42
|
+
alias: "e",
|
|
43
|
+
describe: "Attempt to evaluate Snap bundle in SES",
|
|
44
|
+
type: "boolean",
|
|
45
|
+
deprecated: true
|
|
46
|
+
},
|
|
47
|
+
manifest: {
|
|
48
|
+
alias: "m",
|
|
49
|
+
describe: "Validate snap.manifest.json",
|
|
50
|
+
type: "boolean",
|
|
51
|
+
deprecated: true
|
|
52
|
+
},
|
|
53
|
+
port: {
|
|
54
|
+
alias: "p",
|
|
55
|
+
describe: "Local server port for testing",
|
|
56
|
+
type: "number",
|
|
57
|
+
coerce: (arg) => {
|
|
58
|
+
const port = Number.parseInt(String(arg), 10);
|
|
59
|
+
if (Number.isNaN(port)) {
|
|
60
|
+
throw new Error(`Invalid port: "${String(arg)}".`);
|
|
61
|
+
}
|
|
62
|
+
return port;
|
|
63
|
+
},
|
|
64
|
+
deprecated: true
|
|
65
|
+
},
|
|
66
|
+
outfileName: {
|
|
67
|
+
alias: "n",
|
|
68
|
+
describe: "Output file name",
|
|
69
|
+
type: "string",
|
|
70
|
+
deprecated: true
|
|
71
|
+
},
|
|
72
|
+
root: {
|
|
73
|
+
alias: "r",
|
|
74
|
+
describe: "Server root directory",
|
|
75
|
+
type: "string",
|
|
76
|
+
normalize: true,
|
|
77
|
+
deprecated: true
|
|
78
|
+
},
|
|
79
|
+
sourceMaps: {
|
|
80
|
+
describe: "Whether builds include sourcemaps",
|
|
81
|
+
type: "boolean",
|
|
82
|
+
deprecated: true
|
|
83
|
+
},
|
|
84
|
+
src: {
|
|
85
|
+
alias: "s",
|
|
86
|
+
describe: "Source file",
|
|
87
|
+
type: "string",
|
|
88
|
+
normalize: true,
|
|
89
|
+
deprecated: true
|
|
90
|
+
},
|
|
91
|
+
stripComments: {
|
|
92
|
+
alias: "strip",
|
|
93
|
+
describe: "Whether to remove code comments from the build output",
|
|
94
|
+
type: "boolean",
|
|
95
|
+
deprecated: true
|
|
96
|
+
},
|
|
97
|
+
suppressWarnings: {
|
|
98
|
+
type: "boolean",
|
|
99
|
+
describe: "Whether to suppress warnings",
|
|
100
|
+
deprecated: true
|
|
101
|
+
},
|
|
102
|
+
transpilationMode: {
|
|
103
|
+
type: "string",
|
|
104
|
+
describe: "Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing",
|
|
105
|
+
choices: Object.values(TranspilationModes),
|
|
106
|
+
deprecated: true
|
|
107
|
+
},
|
|
108
|
+
depsToTranspile: {
|
|
109
|
+
type: "array",
|
|
110
|
+
describe: "Transpile only the listed dependencies.",
|
|
111
|
+
deprecated: true
|
|
112
|
+
},
|
|
113
|
+
verboseErrors: {
|
|
114
|
+
type: "boolean",
|
|
115
|
+
describe: "Display original errors",
|
|
116
|
+
deprecated: true
|
|
117
|
+
},
|
|
118
|
+
writeManifest: {
|
|
119
|
+
describe: "Make necessary changes to the snap manifest file",
|
|
120
|
+
type: "boolean",
|
|
121
|
+
deprecated: true
|
|
122
|
+
},
|
|
123
|
+
serve: {
|
|
124
|
+
describe: "Serve snap file(s) locally for testing",
|
|
125
|
+
type: "boolean",
|
|
126
|
+
deprecated: true
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var builders_default = builders;
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
exports.TranspilationModes = TranspilationModes; exports.builders_default = builders_default;
|
|
135
|
+
//# sourceMappingURL=chunk-S7UP2YYF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/builders.ts"],"names":["TranspilationModes"],"mappings":";AAEO,IAAK,qBAAL,kBAAKA,wBAAL;AACL,EAAAA,oBAAA,kBAAe;AACf,EAAAA,oBAAA,eAAY;AACZ,EAAAA,oBAAA,UAAO;AAHG,SAAAA;AAAA,GAAA;AAMZ,IAAM,WAA8C;AAAA;AAAA,EAElD,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EAEA,KAAK;AAAA,IACH,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EAEA,OAAO;AAAA,IACL,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA;AAAA,EAGA,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EAEA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EAEA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,YAAY;AAAA,EACd;AAAA,EAEA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,YAAY;AAAA,EACd;AAAA,EAEA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,QAAQ,CAAC,QAAiB;AACxB,YAAM,OAAO,OAAO,SAAS,OAAO,GAAG,GAAG,EAAE;AAC5C,UAAI,OAAO,MAAM,IAAI,GAAG;AACtB,cAAM,IAAI,MAAM,kBAAkB,OAAO,GAAG,CAAC,IAAI;AAAA,MACnD;AAEA,aAAO;AAAA,IACT;AAAA,IACA,YAAY;AAAA,EACd;AAAA,EAEA,aAAa;AAAA,IACX,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,YAAY;AAAA,EACd;AAAA,EAEA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EAEA,YAAY;AAAA,IACV,UAAU;AAAA,IACV,MAAM;AAAA,IACN,YAAY;AAAA,EACd;AAAA,EAEA,KAAK;AAAA,IACH,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EAEA,eAAe;AAAA,IACb,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,YAAY;AAAA,EACd;AAAA,EAEA,kBAAkB;AAAA,IAChB,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EAEA,mBAAmB;AAAA,IACjB,MAAM;AAAA,IACN,UACE;AAAA,IACF,SAAS,OAAO,OAAO,kBAAkB;AAAA,IACzC,YAAY;AAAA,EACd;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EAEA,eAAe;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EAEA,eAAe;AAAA,IACb,UAAU;AAAA,IACV,MAAM;AAAA,IACN,YAAY;AAAA,EACd;AAAA,EAEA,OAAO;AAAA,IACL,UAAU;AAAA,IACV,MAAM;AAAA,IACN,YAAY;AAAA,EACd;AACF;AAEA,IAAO,mBAAQ","sourcesContent":["import type { Options } from 'yargs';\n\nexport enum TranspilationModes {\n LocalAndDeps = 'localAndDeps',\n LocalOnly = 'localOnly',\n None = 'none',\n}\n\nconst builders: Record<string, Readonly<Options>> = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n config: {\n alias: 'c',\n describe: 'Path to config file',\n type: 'string',\n normalize: true,\n },\n\n fix: {\n describe: 'Attempt to fix snap.manifest.json',\n type: 'boolean',\n },\n\n input: {\n alias: 'i',\n describe: 'Snap bundle file to evaluate',\n type: 'string',\n normalize: true,\n },\n\n // Deprecated Browserify options.\n bundle: {\n alias: 'b',\n describe: 'Snap bundle file',\n type: 'string',\n normalize: true,\n deprecated: 'Use --input instead.',\n },\n\n dist: {\n alias: 'd',\n describe: 'Output directory',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n eval: {\n alias: 'e',\n describe: 'Attempt to evaluate Snap bundle in SES',\n type: 'boolean',\n deprecated: true,\n },\n\n manifest: {\n alias: 'm',\n describe: 'Validate snap.manifest.json',\n type: 'boolean',\n deprecated: true,\n },\n\n port: {\n alias: 'p',\n describe: 'Local server port for testing',\n type: 'number',\n coerce: (arg: unknown) => {\n const port = Number.parseInt(String(arg), 10);\n if (Number.isNaN(port)) {\n throw new Error(`Invalid port: \"${String(arg)}\".`);\n }\n\n return port;\n },\n deprecated: true,\n },\n\n outfileName: {\n alias: 'n',\n describe: 'Output file name',\n type: 'string',\n deprecated: true,\n },\n\n root: {\n alias: 'r',\n describe: 'Server root directory',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n sourceMaps: {\n describe: 'Whether builds include sourcemaps',\n type: 'boolean',\n deprecated: true,\n },\n\n src: {\n alias: 's',\n describe: 'Source file',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n stripComments: {\n alias: 'strip',\n describe: 'Whether to remove code comments from the build output',\n type: 'boolean',\n deprecated: true,\n },\n\n suppressWarnings: {\n type: 'boolean',\n describe: 'Whether to suppress warnings',\n deprecated: true,\n },\n\n transpilationMode: {\n type: 'string',\n describe:\n 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',\n choices: Object.values(TranspilationModes),\n deprecated: true,\n },\n\n depsToTranspile: {\n type: 'array',\n describe: 'Transpile only the listed dependencies.',\n deprecated: true,\n },\n\n verboseErrors: {\n type: 'boolean',\n describe: 'Display original errors',\n deprecated: true,\n },\n\n writeManifest: {\n describe: 'Make necessary changes to the snap manifest file',\n type: 'boolean',\n deprecated: true,\n },\n\n serve: {\n describe: 'Serve snap file(s) locally for testing',\n type: 'boolean',\n deprecated: true,\n },\n};\n\nexport default builders;\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkCGJKCIHPjs = require('./chunk-CGJKCIHP.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkMUYXNIONjs = require('./chunk-MUYXNION.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkXGWLFH7Yjs = require('./chunk-XGWLFH7Y.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkTJ2F3J6Xjs = require('./chunk-TJ2F3J6X.js');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkBALQOCUOjs = require('./chunk-BALQOCUO.js');
|
|
16
|
+
|
|
17
|
+
// src/commands/build/build.ts
|
|
18
|
+
var _node = require('@metamask/snaps-utils/node');
|
|
19
|
+
var _path = require('path');
|
|
20
|
+
var steps = [
|
|
21
|
+
{
|
|
22
|
+
name: "Checking the input file.",
|
|
23
|
+
task: async ({ config }) => {
|
|
24
|
+
const { input } = config;
|
|
25
|
+
if (!await _node.isFile.call(void 0, input)) {
|
|
26
|
+
throw new (0, _chunkBALQOCUOjs.CommandError)(
|
|
27
|
+
`Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Building the snap bundle.",
|
|
34
|
+
task: async ({ config, spinner }) => {
|
|
35
|
+
return await _chunkCGJKCIHPjs.build.call(void 0, config, { evaluate: false, spinner });
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Evaluating the snap bundle.",
|
|
40
|
+
condition: ({ config }) => config.evaluate,
|
|
41
|
+
task: async ({ config, spinner }) => {
|
|
42
|
+
const path = _path.resolve.call(void 0,
|
|
43
|
+
process.cwd(),
|
|
44
|
+
config.output.path,
|
|
45
|
+
config.output.filename
|
|
46
|
+
);
|
|
47
|
+
await _chunkMUYXNIONjs.evaluate.call(void 0, path);
|
|
48
|
+
_chunkTJ2F3J6Xjs.info.call(void 0, `Snap bundle evaluated successfully.`, spinner);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
async function buildHandler(config) {
|
|
53
|
+
return await _chunkXGWLFH7Yjs.executeSteps.call(void 0, steps, {
|
|
54
|
+
config
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
exports.buildHandler = buildHandler;
|
|
61
|
+
//# sourceMappingURL=chunk-SVYNCWMH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/build/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,WAAW,mBAAmB;AAavC,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,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AAGnC,aAAO,MAAM,MAAM,QAAQ,EAAE,UAAU,OAAO,QAAQ,CAAC;AAAA,IACzD;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO;AAAA,IAClC,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AACnC,YAAM,OAAO;AAAA,QACX,QAAQ,IAAI;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,OAAO,OAAO;AAAA,MAChB;AAEA,YAAM,SAAS,IAAI;AAEnB,WAAK,uCAAuC,OAAO;AAAA,IACrD;AAAA,EACF;AACF;AAUA,eAAsB,aAAa,QAAwC;AACzE,SAAO,MAAM,aAAa,OAAO;AAAA,IAC/B;AAAA,EACF,CAAC;AACH","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\nimport { resolve as pathResolve } from 'path';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { evaluate } from '../eval';\nimport { build } from './implementation';\n\ntype BuildContext = {\n config: ProcessedWebpackConfig;\n};\n\nconst steps: Steps<BuildContext> = [\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: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n // We don't evaluate the bundle here, because it's done in a separate\n // step.\n return await build(config, { evaluate: false, spinner });\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n condition: ({ config }) => config.evaluate,\n task: async ({ config, spinner }) => {\n const path = pathResolve(\n process.cwd(),\n config.output.path,\n config.output.filename,\n );\n\n await evaluate(path);\n\n info(`Snap bundle evaluated successfully.`, spinner);\n },\n },\n] as const;\n\n/**\n * Build all files in the given source directory to the given destination\n * directory.\n *\n * This creates the destination directory if it doesn't exist.\n *\n * @param config - The config object.\n */\nexport async function buildHandler(config: ProcessedConfig): Promise<void> {\n return await executeSteps(steps, {\n config,\n });\n}\n"]}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// src/webpack/server.ts
|
|
2
|
+
import {
|
|
3
|
+
logError,
|
|
4
|
+
NpmSnapFileNames,
|
|
5
|
+
readJsonFile
|
|
6
|
+
} from "@metamask/snaps-utils/node";
|
|
7
|
+
import { createServer } from "http";
|
|
8
|
+
import { join, relative, resolve as resolvePath, sep, posix } from "path";
|
|
9
|
+
import serveMiddleware from "serve-handler";
|
|
10
|
+
function getRelativePath(from, to) {
|
|
11
|
+
return relative(from, to).split(sep).join(posix.sep);
|
|
12
|
+
}
|
|
13
|
+
function getAllowedPaths(config, manifest) {
|
|
14
|
+
const auxiliaryFiles = manifest.source.files?.map(
|
|
15
|
+
(file) => getRelativePath(
|
|
16
|
+
config.server.root,
|
|
17
|
+
resolvePath(config.server.root, file)
|
|
18
|
+
)
|
|
19
|
+
) ?? [];
|
|
20
|
+
const localizationFiles = manifest.source.locales?.map(
|
|
21
|
+
(localization) => getRelativePath(
|
|
22
|
+
config.server.root,
|
|
23
|
+
resolvePath(config.server.root, localization)
|
|
24
|
+
)
|
|
25
|
+
) ?? [];
|
|
26
|
+
const otherFiles = manifest.source.location.npm.iconPath ? [
|
|
27
|
+
getRelativePath(
|
|
28
|
+
config.server.root,
|
|
29
|
+
resolvePath(
|
|
30
|
+
config.server.root,
|
|
31
|
+
manifest.source.location.npm.iconPath
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
] : [];
|
|
35
|
+
return [
|
|
36
|
+
getRelativePath(
|
|
37
|
+
config.server.root,
|
|
38
|
+
resolvePath(
|
|
39
|
+
config.server.root,
|
|
40
|
+
config.output.path,
|
|
41
|
+
config.output.filename
|
|
42
|
+
)
|
|
43
|
+
),
|
|
44
|
+
getRelativePath(
|
|
45
|
+
config.server.root,
|
|
46
|
+
resolvePath(config.server.root, NpmSnapFileNames.Manifest)
|
|
47
|
+
),
|
|
48
|
+
...auxiliaryFiles,
|
|
49
|
+
...localizationFiles,
|
|
50
|
+
...otherFiles
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
function getServer(config) {
|
|
54
|
+
async function getResponse(request, response) {
|
|
55
|
+
const manifestPath = join(config.server.root, NpmSnapFileNames.Manifest);
|
|
56
|
+
const { result } = await readJsonFile(manifestPath);
|
|
57
|
+
const allowedPaths = getAllowedPaths(config, result);
|
|
58
|
+
const path = request.url?.slice(1);
|
|
59
|
+
const allowed = allowedPaths.some((allowedPath) => path === allowedPath);
|
|
60
|
+
if (!allowed) {
|
|
61
|
+
response.statusCode = 404;
|
|
62
|
+
response.end();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
await serveMiddleware(request, response, {
|
|
66
|
+
public: config.server.root,
|
|
67
|
+
directoryListing: false,
|
|
68
|
+
headers: [
|
|
69
|
+
{
|
|
70
|
+
source: "**/*",
|
|
71
|
+
headers: [
|
|
72
|
+
{
|
|
73
|
+
key: "Cache-Control",
|
|
74
|
+
value: "no-cache"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: "Access-Control-Allow-Origin",
|
|
78
|
+
value: "*"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const server = createServer((request, response) => {
|
|
86
|
+
getResponse(request, response).catch(
|
|
87
|
+
/* istanbul ignore next */
|
|
88
|
+
(error) => {
|
|
89
|
+
logError(error);
|
|
90
|
+
response.statusCode = 500;
|
|
91
|
+
response.end();
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
const listen = async (port = config.server.port) => {
|
|
96
|
+
return new Promise((resolve, reject) => {
|
|
97
|
+
try {
|
|
98
|
+
server.listen(port, () => {
|
|
99
|
+
const close = async () => {
|
|
100
|
+
await new Promise((resolveClose, rejectClose) => {
|
|
101
|
+
server.close((closeError) => {
|
|
102
|
+
if (closeError) {
|
|
103
|
+
return rejectClose(closeError);
|
|
104
|
+
}
|
|
105
|
+
return resolveClose();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
const address = server.address();
|
|
110
|
+
resolve({ port: address.port, server, close });
|
|
111
|
+
});
|
|
112
|
+
} catch (listenError) {
|
|
113
|
+
reject(listenError);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
return { listen };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export {
|
|
121
|
+
getAllowedPaths,
|
|
122
|
+
getServer
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=chunk-SYRWT2KT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webpack/server.ts"],"sourcesContent":["import type { SnapManifest } from '@metamask/snaps-utils';\nimport {\n logError,\n NpmSnapFileNames,\n readJsonFile,\n} from '@metamask/snaps-utils/node';\nimport type { IncomingMessage, Server, ServerResponse } from 'http';\nimport { createServer } from 'http';\nimport type { AddressInfo } from 'net';\nimport { join, relative, resolve as resolvePath, sep, posix } from 'path';\nimport serveMiddleware from 'serve-handler';\n\nimport type { ProcessedConfig } from '../config';\n\n/**\n * Get the relative path from one path to another.\n *\n * Note: This is a modified version of `path.relative` that uses Posix\n * separators for URL-compatibility.\n *\n * @param from - The path to start from.\n * @param to - The path to end at.\n * @returns The relative path.\n */\nfunction getRelativePath(from: string, to: string) {\n return relative(from, to).split(sep).join(posix.sep);\n}\n\n/**\n * Get the allowed paths for the static server. This includes the output file,\n * the manifest file, and any auxiliary/localization files.\n *\n * @param config - The config object.\n * @param manifest - The Snap manifest object.\n * @returns An array of allowed paths.\n */\nexport function getAllowedPaths(\n config: ProcessedConfig,\n manifest: SnapManifest,\n) {\n const auxiliaryFiles =\n manifest.source.files?.map((file) =>\n getRelativePath(\n config.server.root,\n resolvePath(config.server.root, file),\n ),\n ) ?? [];\n\n const localizationFiles =\n manifest.source.locales?.map((localization) =>\n getRelativePath(\n config.server.root,\n resolvePath(config.server.root, localization),\n ),\n ) ?? [];\n\n const otherFiles = manifest.source.location.npm.iconPath\n ? [\n getRelativePath(\n config.server.root,\n resolvePath(\n config.server.root,\n manifest.source.location.npm.iconPath,\n ),\n ),\n ]\n : [];\n\n return [\n getRelativePath(\n config.server.root,\n resolvePath(\n config.server.root,\n config.output.path,\n config.output.filename,\n ),\n ),\n getRelativePath(\n config.server.root,\n resolvePath(config.server.root, NpmSnapFileNames.Manifest),\n ),\n ...auxiliaryFiles,\n ...localizationFiles,\n ...otherFiles,\n ];\n}\n\n/**\n * Get a static server for development purposes.\n *\n * Note: We're intentionally not using `webpack-dev-server` here because it\n * adds a lot of extra stuff to the output that we don't need, and it's\n * difficult to customize.\n *\n * @param config - The config object.\n * @returns An object with a `listen` method that returns a promise that\n * resolves when the server is listening.\n */\nexport function getServer(config: ProcessedConfig) {\n /**\n * Get the response for a request. This is extracted into a function so that\n * we can easily catch errors and send a 500 response.\n *\n * @param request - The request.\n * @param response - The response.\n * @returns A promise that resolves when the response is sent.\n */\n async function getResponse(\n request: IncomingMessage,\n response: ServerResponse,\n ) {\n const manifestPath = join(config.server.root, NpmSnapFileNames.Manifest);\n const { result } = await readJsonFile<SnapManifest>(manifestPath);\n const allowedPaths = getAllowedPaths(config, result);\n\n const path = request.url?.slice(1);\n const allowed = allowedPaths.some((allowedPath) => path === allowedPath);\n\n if (!allowed) {\n response.statusCode = 404;\n response.end();\n return;\n }\n\n await serveMiddleware(request, response, {\n public: config.server.root,\n directoryListing: false,\n headers: [\n {\n source: '**/*',\n headers: [\n {\n key: 'Cache-Control',\n value: 'no-cache',\n },\n {\n key: 'Access-Control-Allow-Origin',\n value: '*',\n },\n ],\n },\n ],\n });\n }\n\n const server = createServer((request, response) => {\n getResponse(request, response).catch(\n /* istanbul ignore next */\n (error) => {\n logError(error);\n response.statusCode = 500;\n response.end();\n },\n );\n });\n\n /**\n * Start the server on the port specified in the config.\n *\n * @param port - The port to listen on.\n * @returns A promise that resolves when the server is listening. The promise\n * resolves to an object with the port and the server instance. Note that if\n * the `config.server.port` is `0`, the OS will choose a random port for us,\n * so we need to get the port from the server after it starts.\n */\n const listen = async (port = config.server.port) => {\n return new Promise<{\n port: number;\n server: Server;\n close: () => Promise<void>;\n }>((resolve, reject) => {\n try {\n server.listen(port, () => {\n const close = async () => {\n await new Promise<void>((resolveClose, rejectClose) => {\n server.close((closeError) => {\n if (closeError) {\n return rejectClose(closeError);\n }\n\n return resolveClose();\n });\n });\n };\n\n const address = server.address() as AddressInfo;\n resolve({ port: address.port, server, close });\n });\n } catch (listenError) {\n reject(listenError);\n }\n });\n };\n\n return { listen };\n}\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;AAE7B,SAAS,MAAM,UAAU,WAAW,aAAa,KAAK,aAAa;AACnE,OAAO,qBAAqB;AAc5B,SAAS,gBAAgB,MAAc,IAAY;AACjD,SAAO,SAAS,MAAM,EAAE,EAAE,MAAM,GAAG,EAAE,KAAK,MAAM,GAAG;AACrD;AAUO,SAAS,gBACd,QACA,UACA;AACA,QAAM,iBACJ,SAAS,OAAO,OAAO;AAAA,IAAI,CAAC,SAC1B;AAAA,MACE,OAAO,OAAO;AAAA,MACd,YAAY,OAAO,OAAO,MAAM,IAAI;AAAA,IACtC;AAAA,EACF,KAAK,CAAC;AAER,QAAM,oBACJ,SAAS,OAAO,SAAS;AAAA,IAAI,CAAC,iBAC5B;AAAA,MACE,OAAO,OAAO;AAAA,MACd,YAAY,OAAO,OAAO,MAAM,YAAY;AAAA,IAC9C;AAAA,EACF,KAAK,CAAC;AAER,QAAM,aAAa,SAAS,OAAO,SAAS,IAAI,WAC5C;AAAA,IACE;AAAA,MACE,OAAO,OAAO;AAAA,MACd;AAAA,QACE,OAAO,OAAO;AAAA,QACd,SAAS,OAAO,SAAS,IAAI;AAAA,MAC/B;AAAA,IACF;AAAA,EACF,IACA,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,MACE,OAAO,OAAO;AAAA,MACd;AAAA,QACE,OAAO,OAAO;AAAA,QACd,OAAO,OAAO;AAAA,QACd,OAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAAA,IACA;AAAA,MACE,OAAO,OAAO;AAAA,MACd,YAAY,OAAO,OAAO,MAAM,iBAAiB,QAAQ;AAAA,IAC3D;AAAA,IACA,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAaO,SAAS,UAAU,QAAyB;AASjD,iBAAe,YACb,SACA,UACA;AACA,UAAM,eAAe,KAAK,OAAO,OAAO,MAAM,iBAAiB,QAAQ;AACvE,UAAM,EAAE,OAAO,IAAI,MAAM,aAA2B,YAAY;AAChE,UAAM,eAAe,gBAAgB,QAAQ,MAAM;AAEnD,UAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,UAAM,UAAU,aAAa,KAAK,CAAC,gBAAgB,SAAS,WAAW;AAEvE,QAAI,CAAC,SAAS;AACZ,eAAS,aAAa;AACtB,eAAS,IAAI;AACb;AAAA,IACF;AAEA,UAAM,gBAAgB,SAAS,UAAU;AAAA,MACvC,QAAQ,OAAO,OAAO;AAAA,MACtB,kBAAkB;AAAA,MAClB,SAAS;AAAA,QACP;AAAA,UACE,QAAQ;AAAA,UACR,SAAS;AAAA,YACP;AAAA,cACE,KAAK;AAAA,cACL,OAAO;AAAA,YACT;AAAA,YACA;AAAA,cACE,KAAK;AAAA,cACL,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,SAAS,aAAa,CAAC,SAAS,aAAa;AACjD,gBAAY,SAAS,QAAQ,EAAE;AAAA;AAAA,MAE7B,CAAC,UAAU;AACT,iBAAS,KAAK;AACd,iBAAS,aAAa;AACtB,iBAAS,IAAI;AAAA,MACf;AAAA,IACF;AAAA,EACF,CAAC;AAWD,QAAM,SAAS,OAAO,OAAO,OAAO,OAAO,SAAS;AAClD,WAAO,IAAI,QAIR,CAAC,SAAS,WAAW;AACtB,UAAI;AACF,eAAO,OAAO,MAAM,MAAM;AACxB,gBAAM,QAAQ,YAAY;AACxB,kBAAM,IAAI,QAAc,CAAC,cAAc,gBAAgB;AACrD,qBAAO,MAAM,CAAC,eAAe;AAC3B,oBAAI,YAAY;AACd,yBAAO,YAAY,UAAU;AAAA,gBAC/B;AAEA,uBAAO,aAAa;AAAA,cACtB,CAAC;AAAA,YACH,CAAC;AAAA,UACH;AAEA,gBAAM,UAAU,OAAO,QAAQ;AAC/B,kBAAQ,EAAE,MAAM,QAAQ,MAAM,QAAQ,MAAM,CAAC;AAAA,QAC/C,CAAC;AAAA,MACH,SAAS,aAAa;AACpB,eAAO,WAAW;AAAA,MACpB;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,OAAO;AAClB;","names":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
build
|
|
3
|
+
} from "./chunk-WYDHPUWV.mjs";
|
|
4
|
+
import {
|
|
5
|
+
evaluate
|
|
6
|
+
} from "./chunk-3WWFQLH4.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/build/build.ts
|
|
18
|
+
import { isFile } from "@metamask/snaps-utils/node";
|
|
19
|
+
import { resolve as pathResolve } from "path";
|
|
20
|
+
var steps = [
|
|
21
|
+
{
|
|
22
|
+
name: "Checking the input file.",
|
|
23
|
+
task: async ({ config }) => {
|
|
24
|
+
const { input } = config;
|
|
25
|
+
if (!await isFile(input)) {
|
|
26
|
+
throw new CommandError(
|
|
27
|
+
`Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "Building the snap bundle.",
|
|
34
|
+
task: async ({ config, spinner }) => {
|
|
35
|
+
return await build(config, { evaluate: false, spinner });
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Evaluating the snap bundle.",
|
|
40
|
+
condition: ({ config }) => config.evaluate,
|
|
41
|
+
task: async ({ config, spinner }) => {
|
|
42
|
+
const path = pathResolve(
|
|
43
|
+
process.cwd(),
|
|
44
|
+
config.output.path,
|
|
45
|
+
config.output.filename
|
|
46
|
+
);
|
|
47
|
+
await evaluate(path);
|
|
48
|
+
info(`Snap bundle evaluated successfully.`, spinner);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
async function buildHandler(config) {
|
|
53
|
+
return await executeSteps(steps, {
|
|
54
|
+
config
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
buildHandler
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=chunk-T7NEPTM5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/build/build.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\nimport { resolve as pathResolve } from 'path';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { evaluate } from '../eval';\nimport { build } from './implementation';\n\ntype BuildContext = {\n config: ProcessedWebpackConfig;\n};\n\nconst steps: Steps<BuildContext> = [\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: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n // We don't evaluate the bundle here, because it's done in a separate\n // step.\n return await build(config, { evaluate: false, spinner });\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n condition: ({ config }) => config.evaluate,\n task: async ({ config, spinner }) => {\n const path = pathResolve(\n process.cwd(),\n config.output.path,\n config.output.filename,\n );\n\n await evaluate(path);\n\n info(`Snap bundle evaluated successfully.`, spinner);\n },\n },\n] as const;\n\n/**\n * Build all files in the given source directory to the given destination\n * directory.\n *\n * This creates the destination directory if it doesn't exist.\n *\n * @param config - The config object.\n */\nexport async function buildHandler(config: ProcessedConfig): Promise<void> {\n return await executeSteps(steps, {\n config,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,WAAW,mBAAmB;AAavC,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,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AAGnC,aAAO,MAAM,MAAM,QAAQ,EAAE,UAAU,OAAO,QAAQ,CAAC;AAAA,IACzD;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO;AAAA,IAClC,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AACnC,YAAM,OAAO;AAAA,QACX,QAAQ,IAAI;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,OAAO,OAAO;AAAA,MAChB;AAEA,YAAM,SAAS,IAAI;AAEnB,WAAK,uCAAuC,OAAO;AAAA,IACrD;AAAA,EACF;AACF;AAUA,eAAsB,aAAa,QAAwC;AACzE,SAAO,MAAM,aAAa,OAAO;AAAA,IAC/B;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/path.ts"],"sourcesContent":["import { relative } from 'path';\n\n/**\n * Get the relative path from the current working directory to the given\n * absolute path.\n *\n * @param absolutePath - The absolute path.\n * @param cwd - The current working directory. Defaults to `process.cwd()`.\n * @returns The relative path.\n */\nexport function getRelativePath(absolutePath: string, cwd = process.cwd()) {\n return relative(cwd, absolutePath);\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAUlB,SAAS,gBAAgB,cAAsB,MAAM,QAAQ,IAAI,GAAG;AACzE,SAAO,SAAS,KAAK,YAAY;AACnC;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/logging.ts
|
|
2
|
+
var _snapsutils = require('@metamask/snaps-utils');
|
|
3
|
+
var _chalk = require('chalk');
|
|
4
|
+
function warn(message, spinner) {
|
|
5
|
+
if (spinner) {
|
|
6
|
+
spinner.clear();
|
|
7
|
+
spinner.frame();
|
|
8
|
+
}
|
|
9
|
+
_snapsutils.logWarning.call(void 0, `${_chalk.yellow.call(void 0, "\u26A0")} ${message}`);
|
|
10
|
+
}
|
|
11
|
+
function info(message, spinner) {
|
|
12
|
+
if (spinner) {
|
|
13
|
+
spinner.clear();
|
|
14
|
+
spinner.frame();
|
|
15
|
+
}
|
|
16
|
+
_snapsutils.logInfo.call(void 0, `${_chalk.blue.call(void 0, "\u2139")} ${_chalk.dim.call(void 0, message)}`);
|
|
17
|
+
}
|
|
18
|
+
function error(message, spinner) {
|
|
19
|
+
if (spinner) {
|
|
20
|
+
spinner.clear();
|
|
21
|
+
spinner.frame();
|
|
22
|
+
}
|
|
23
|
+
_snapsutils.logError.call(void 0, `${_chalk.red.call(void 0, "\u2716")} ${message}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
exports.warn = warn; exports.info = info; exports.error = error;
|
|
31
|
+
//# sourceMappingURL=chunk-TJ2F3J6X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/logging.ts"],"names":[],"mappings":";AAAA,SAAS,UAAU,SAAS,kBAAkB;AAC9C,SAAS,MAAM,KAAK,KAAK,cAAc;AAShC,SAAS,KAAK,SAAiB,SAAe;AACnD,MAAI,SAAS;AACX,YAAQ,MAAM;AACd,YAAQ,MAAM;AAAA,EAChB;AAEA,aAAW,GAAG,OAAO,QAAG,CAAC,IAAI,OAAO,EAAE;AACxC;AAQO,SAAS,KAAK,SAAiB,SAAe;AACnD,MAAI,SAAS;AACX,YAAQ,MAAM;AACd,YAAQ,MAAM;AAAA,EAChB;AAEA,UAAQ,GAAG,KAAK,QAAG,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE;AACxC;AAQO,SAAS,MAAM,SAAiB,SAAe;AACpD,MAAI,SAAS;AACX,YAAQ,MAAM;AACd,YAAQ,MAAM;AAAA,EAChB;AAEA,WAAS,GAAG,IAAI,QAAG,CAAC,IAAI,OAAO,EAAE;AACnC","sourcesContent":["import { logError, logInfo, logWarning } from '@metamask/snaps-utils';\nimport { blue, dim, red, yellow } from 'chalk';\nimport type { Ora } from 'ora';\n\n/**\n * Log a warning message. The message is prefixed with \"Warning:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function warn(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logWarning(`${yellow('⚠')} ${message}`);\n}\n\n/**\n * Log an info message.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function info(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logInfo(`${blue('ℹ')} ${dim(message)}`);\n}\n\n/**\n * Log an error message. The message is prefixed with \"Error:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function error(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logError(`${red('✖')} ${message}`);\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkC44RRX3Hjs = require('./chunk-C44RRX3H.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkS7UP2YYFjs = require('./chunk-S7UP2YYF.js');
|
|
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", _chunkS7UP2YYFjs.builders_default.root).option("port", _chunkS7UP2YYFjs.builders_default.port);
|
|
14
|
+
},
|
|
15
|
+
handler: async (argv) => _chunkC44RRX3Hjs.serveHandler.call(void 0, argv.context.config, {
|
|
16
|
+
port: argv.port ?? argv.context.config.server.port
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
var serve_default = command;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.serve_default = serve_default;
|
|
24
|
+
//# sourceMappingURL=chunk-U4VFMIGO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/serve/index.ts"],"names":[],"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","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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";//# sourceMappingURL=chunk-VXOV3ZCB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getDefaultConfiguration
|
|
3
|
+
} from "./chunk-YWCNJELN.mjs";
|
|
4
|
+
|
|
5
|
+
// src/webpack/compiler.ts
|
|
6
|
+
import { webpack } from "webpack";
|
|
7
|
+
async function getCompiler(config, options) {
|
|
8
|
+
const baseWebpackConfig = await getDefaultConfiguration(config, options);
|
|
9
|
+
const webpackConfig = config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;
|
|
10
|
+
return webpack(webpackConfig);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
getCompiler
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-WO7DMSQU.mjs.map
|