@metamask/snaps-cli 5.1.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-25SLEORF.mjs +28 -0
- package/dist/chunk-25SLEORF.mjs.map +1 -0
- package/dist/chunk-2QVYYMUD.js +365 -0
- package/dist/chunk-2QVYYMUD.js.map +1 -0
- package/dist/{esm/webpack/config.js → chunk-3LNPS7AX.js} +182 -156
- package/dist/chunk-3LNPS7AX.js.map +1 -0
- package/dist/chunk-46JUPGRY.js +22 -0
- package/dist/chunk-46JUPGRY.js.map +1 -0
- package/dist/chunk-4NHBPMKT.js +54 -0
- package/dist/chunk-4NHBPMKT.js.map +1 -0
- package/dist/chunk-4OKAI7AP.js +52 -0
- package/dist/chunk-4OKAI7AP.js.map +1 -0
- package/dist/chunk-5DDAAM2X.js +41 -0
- package/dist/chunk-5DDAAM2X.js.map +1 -0
- package/dist/chunk-5DSV76XV.mjs +10 -0
- package/dist/chunk-5DSV76XV.mjs.map +1 -0
- package/dist/chunk-5JPLNWCO.js +24 -0
- package/dist/chunk-5JPLNWCO.js.map +1 -0
- package/dist/chunk-5VAZH7L7.js +64 -0
- package/dist/chunk-5VAZH7L7.js.map +1 -0
- package/dist/chunk-5YUHRLH6.js +22 -0
- package/dist/chunk-5YUHRLH6.js.map +1 -0
- package/dist/chunk-6IF2UBYA.mjs +13 -0
- package/dist/chunk-6IF2UBYA.mjs.map +1 -0
- package/dist/chunk-6NJAXMSB.js +135 -0
- package/dist/chunk-6NJAXMSB.js.map +1 -0
- package/dist/chunk-6VFUO2H5.mjs +124 -0
- package/dist/chunk-6VFUO2H5.mjs.map +1 -0
- package/dist/chunk-7SN4Y44H.js +287 -0
- package/dist/chunk-7SN4Y44H.js.map +1 -0
- package/dist/chunk-ASOCIPDR.js +10 -0
- package/dist/chunk-ASOCIPDR.js.map +1 -0
- package/dist/chunk-B455GFXP.mjs +54 -0
- package/dist/chunk-B455GFXP.mjs.map +1 -0
- package/dist/chunk-DWS4BJTE.mjs +64 -0
- package/dist/chunk-DWS4BJTE.mjs.map +1 -0
- package/dist/chunk-EQRMXKXY.js +346 -0
- package/dist/chunk-EQRMXKXY.js.map +1 -0
- package/dist/chunk-EXGQAOQS.js +64 -0
- package/dist/chunk-EXGQAOQS.js.map +1 -0
- package/dist/chunk-EXJCMAUI.mjs +23 -0
- package/dist/chunk-EXJCMAUI.mjs.map +1 -0
- package/dist/chunk-FPG4GBXZ.js +30 -0
- package/dist/chunk-FPG4GBXZ.js.map +1 -0
- package/dist/chunk-FYTQTDZU.mjs +52 -0
- package/dist/chunk-FYTQTDZU.mjs.map +1 -0
- package/dist/chunk-G3IYVYVR.js +31 -0
- package/dist/chunk-G3IYVYVR.js.map +1 -0
- package/dist/chunk-GC7BNDLY.js +23 -0
- package/dist/chunk-GC7BNDLY.js.map +1 -0
- package/dist/chunk-GKG7TO7T.js +28 -0
- package/dist/chunk-GKG7TO7T.js.map +1 -0
- package/dist/chunk-GU2KH52B.mjs +53 -0
- package/dist/chunk-GU2KH52B.mjs.map +1 -0
- package/dist/chunk-GUXDSKV4.mjs +51 -0
- package/dist/chunk-GUXDSKV4.mjs.map +1 -0
- package/dist/chunk-HGYXRW5B.js +50 -0
- package/dist/chunk-HGYXRW5B.js.map +1 -0
- package/dist/chunk-HJ4276TR.mjs +41 -0
- package/dist/chunk-HJ4276TR.mjs.map +1 -0
- package/dist/chunk-HNLMKJBX.js +30 -0
- package/dist/chunk-HNLMKJBX.js.map +1 -0
- package/dist/chunk-IJYBCHVM.js +32 -0
- package/dist/chunk-IJYBCHVM.js.map +1 -0
- package/dist/chunk-IQTGFRWK.js +18 -0
- package/dist/chunk-IQTGFRWK.js.map +1 -0
- package/dist/chunk-IYAFFTJU.js +23 -0
- package/dist/chunk-IYAFFTJU.js.map +1 -0
- package/dist/chunk-JMISQ4HT.mjs +31 -0
- package/dist/chunk-JMISQ4HT.mjs.map +1 -0
- package/dist/chunk-K3TSXPME.js +16 -0
- package/dist/chunk-K3TSXPME.js.map +1 -0
- package/dist/{cjs/webpack/config.js → chunk-KKTPKAZN.mjs} +181 -153
- package/dist/chunk-KKTPKAZN.mjs.map +1 -0
- package/dist/chunk-KZFWI73A.js +28 -0
- package/dist/chunk-KZFWI73A.js.map +1 -0
- package/dist/chunk-L5TMG6BQ.js +37 -0
- package/dist/chunk-L5TMG6BQ.js.map +1 -0
- package/dist/chunk-MCN7UXG3.mjs +287 -0
- package/dist/chunk-MCN7UXG3.mjs.map +1 -0
- package/dist/chunk-MIV2UFTA.js +13 -0
- package/dist/chunk-MIV2UFTA.js.map +1 -0
- package/dist/chunk-MMBQXT2G.mjs +30 -0
- package/dist/chunk-MMBQXT2G.mjs.map +1 -0
- package/dist/chunk-NO53G7NT.js +61 -0
- package/dist/chunk-NO53G7NT.js.map +1 -0
- package/dist/chunk-O2QUFUOY.js +53 -0
- package/dist/chunk-O2QUFUOY.js.map +1 -0
- package/dist/chunk-OF4BF57X.mjs +22 -0
- package/dist/chunk-OF4BF57X.mjs.map +1 -0
- package/dist/chunk-OVCYXVWI.mjs +1 -0
- package/dist/chunk-OVCYXVWI.mjs.map +1 -0
- package/dist/chunk-PDNDGMB2.mjs +365 -0
- package/dist/chunk-PDNDGMB2.mjs.map +1 -0
- package/dist/chunk-QCP4QKMQ.mjs +24 -0
- package/dist/chunk-QCP4QKMQ.mjs.map +1 -0
- package/dist/chunk-QH4AQR33.mjs +61 -0
- package/dist/chunk-QH4AQR33.mjs.map +1 -0
- package/dist/chunk-S5ERYB6I.mjs +64 -0
- package/dist/chunk-S5ERYB6I.mjs.map +1 -0
- package/dist/chunk-SAEZHRJJ.mjs +23 -0
- package/dist/chunk-SAEZHRJJ.mjs.map +1 -0
- package/dist/chunk-T3KPXUAU.js +24 -0
- package/dist/chunk-T3KPXUAU.js.map +1 -0
- package/dist/chunk-T74IXMA3.mjs +50 -0
- package/dist/chunk-T74IXMA3.mjs.map +1 -0
- package/dist/chunk-TLTTWAEI.mjs +37 -0
- package/dist/chunk-TLTTWAEI.mjs.map +1 -0
- package/dist/chunk-TX4BG5GS.mjs +50 -0
- package/dist/chunk-TX4BG5GS.mjs.map +1 -0
- package/dist/chunk-UA5FEKKH.mjs +30 -0
- package/dist/chunk-UA5FEKKH.mjs.map +1 -0
- package/dist/chunk-UBWM7UOC.mjs +32 -0
- package/dist/chunk-UBWM7UOC.mjs.map +1 -0
- package/dist/chunk-USFFVX52.mjs +35 -0
- package/dist/chunk-USFFVX52.mjs.map +1 -0
- package/dist/chunk-V5Q5HRXB.mjs +30 -0
- package/dist/chunk-V5Q5HRXB.mjs.map +1 -0
- package/dist/chunk-VI3ZJJYO.mjs +346 -0
- package/dist/chunk-VI3ZJJYO.mjs.map +1 -0
- package/dist/chunk-VTJFPUIA.mjs +22 -0
- package/dist/chunk-VTJFPUIA.mjs.map +1 -0
- package/dist/chunk-WH7GOZP7.js +51 -0
- package/dist/chunk-WH7GOZP7.js.map +1 -0
- package/dist/chunk-WJNHZ4YF.js +35 -0
- package/dist/chunk-WJNHZ4YF.js.map +1 -0
- package/dist/chunk-WKL7DYYW.mjs +16 -0
- package/dist/chunk-WKL7DYYW.mjs.map +1 -0
- package/dist/chunk-X2RPNWBJ.mjs +24 -0
- package/dist/chunk-X2RPNWBJ.mjs.map +1 -0
- package/dist/chunk-X3D3MHWF.js +44 -0
- package/dist/chunk-X3D3MHWF.js.map +1 -0
- package/dist/chunk-X4FWMO4H.mjs +18 -0
- package/dist/chunk-X4FWMO4H.mjs.map +1 -0
- package/dist/chunk-Y5PQG4KA.js +1 -0
- package/dist/chunk-Y5PQG4KA.js.map +1 -0
- package/dist/chunk-YDLKS46R.js +30 -0
- package/dist/chunk-YDLKS46R.js.map +1 -0
- package/dist/chunk-YURDB35F.js +124 -0
- package/dist/chunk-YURDB35F.js.map +1 -0
- package/dist/chunk-YYYOE2GO.mjs +32 -0
- package/dist/chunk-YYYOE2GO.mjs.map +1 -0
- package/dist/chunk-ZOQ32RQI.mjs +135 -0
- package/dist/chunk-ZOQ32RQI.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 +2 -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 -240
- 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 -271
- package/dist/esm/webpack/utils.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { isFile } from '@metamask/snaps-utils';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
import { CommandError } from '../../errors';
|
|
4
|
-
import { executeSteps, getRelativePath } from '../../utils';
|
|
5
|
-
import { evaluate } from './implementation';
|
|
6
|
-
const steps = [
|
|
7
|
-
{
|
|
8
|
-
name: 'Checking the input file.',
|
|
9
|
-
task: async ({ input })=>{
|
|
10
|
-
if (!await isFile(input)) {
|
|
11
|
-
const relativePath = getRelativePath(input);
|
|
12
|
-
throw new CommandError(`Input file not found: "${relativePath}". Make sure that the "input" field in your snap config or the specified input file is correct.`);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: 'Evaluating the snap bundle.',
|
|
18
|
-
task: async ({ input, spinner })=>{
|
|
19
|
-
await evaluate(input);
|
|
20
|
-
spinner.succeed('Snap bundle evaluated successfully.');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
];
|
|
24
|
-
/**
|
|
25
|
-
* Returns the path to the bundle, based on the config and options.
|
|
26
|
-
*
|
|
27
|
-
* - If `options.input` is specified, it is used as the bundle path.
|
|
28
|
-
* - Otherwise, the bundle path is resolved from the config's output path and
|
|
29
|
-
* filename.
|
|
30
|
-
*
|
|
31
|
-
* @param config - The processed config object.
|
|
32
|
-
* @param options - The eval options.
|
|
33
|
-
* @returns The path to the bundle.
|
|
34
|
-
*/ function getBundlePath(config, options) {
|
|
35
|
-
if (options.input) {
|
|
36
|
-
return resolve(process.cwd(), options.input);
|
|
37
|
-
}
|
|
38
|
-
return resolve(config.output.path, config.output.filename);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Runs the snap in a worker, to ensure SES compatibility.
|
|
42
|
-
*
|
|
43
|
-
* @param config - The processed config object.
|
|
44
|
-
* @param options - The eval options.
|
|
45
|
-
* @returns A promise that resolves once the eval has finished.
|
|
46
|
-
* @throws If the eval failed.
|
|
47
|
-
*/ export async function evaluateHandler(config, options = {}) {
|
|
48
|
-
const input = getBundlePath(config, options);
|
|
49
|
-
await executeSteps(steps, {
|
|
50
|
-
input
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=eval.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/eval/eval.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils';\nimport { resolve } from 'path';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, getRelativePath } from '../../utils';\nimport { evaluate } from './implementation';\n\nexport type EvalOptions = {\n input?: string;\n};\n\nexport type EvalContext = Required<EvalOptions>;\n\nconst steps: Steps<EvalContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n const relativePath = getRelativePath(input);\n throw new CommandError(\n `Input file not found: \"${relativePath}\". Make sure that the \"input\" field in your snap config or the specified input file is correct.`,\n );\n }\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n task: async ({ input, spinner }) => {\n await evaluate(input);\n spinner.succeed('Snap bundle evaluated successfully.');\n },\n },\n];\n\n/**\n * Returns the path to the bundle, based on the config and options.\n *\n * - If `options.input` is specified, it is used as the bundle path.\n * - Otherwise, the bundle path is resolved from the config's output path and\n * filename.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns The path to the bundle.\n */\nfunction getBundlePath(config: ProcessedConfig, options: EvalOptions): string {\n if (options.input) {\n return resolve(process.cwd(), options.input);\n }\n\n return resolve(config.output.path, config.output.filename);\n}\n\n/**\n * Runs the snap in a worker, to ensure SES compatibility.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns A promise that resolves once the eval has finished.\n * @throws If the eval failed.\n */\nexport async function evaluateHandler(\n config: ProcessedConfig,\n options: EvalOptions = {},\n): Promise<void> {\n const input = getBundlePath(config, options);\n await executeSteps(steps, { input });\n}\n"],"names":["isFile","resolve","CommandError","executeSteps","getRelativePath","evaluate","steps","name","task","input","relativePath","spinner","succeed","getBundlePath","config","options","process","cwd","output","path","filename","evaluateHandler"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,OAAO,QAAQ,OAAO;AAG/B,SAASC,YAAY,QAAQ,eAAe;AAE5C,SAASC,YAAY,EAAEC,eAAe,QAAQ,cAAc;AAC5D,SAASC,QAAQ,QAAQ,mBAAmB;AAQ5C,MAAMC,QAA4B;IAChC;QACEC,MAAM;QACNC,MAAM,OAAO,EAAEC,KAAK,EAAE;YACpB,IAAI,CAAE,MAAMT,OAAOS,QAAS;gBAC1B,MAAMC,eAAeN,gBAAgBK;gBACrC,MAAM,IAAIP,aACR,CAAC,uBAAuB,EAAEQ,aAAa,+FAA+F,CAAC;YAE3I;QACF;IACF;IACA;QACEH,MAAM;QACNC,MAAM,OAAO,EAAEC,KAAK,EAAEE,OAAO,EAAE;YAC7B,MAAMN,SAASI;YACfE,QAAQC,OAAO,CAAC;QAClB;IACF;CACD;AAED;;;;;;;;;;CAUC,GACD,SAASC,cAAcC,MAAuB,EAAEC,OAAoB;IAClE,IAAIA,QAAQN,KAAK,EAAE;QACjB,OAAOR,QAAQe,QAAQC,GAAG,IAAIF,QAAQN,KAAK;IAC7C;IAEA,OAAOR,QAAQa,OAAOI,MAAM,CAACC,IAAI,EAAEL,OAAOI,MAAM,CAACE,QAAQ;AAC3D;AAEA;;;;;;;CAOC,GACD,OAAO,eAAeC,gBACpBP,MAAuB,EACvBC,UAAuB,CAAC,CAAC;IAEzB,MAAMN,QAAQI,cAAcC,QAAQC;IACpC,MAAMZ,aAAaG,OAAO;QAAEG;IAAM;AACpC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { evalBundle, SnapEvalError, indent } from '@metamask/snaps-utils';
|
|
2
|
-
import { red } from 'chalk';
|
|
3
|
-
import { CommandError } from '../../errors';
|
|
4
|
-
/**
|
|
5
|
-
* Evaluate the given bundle in the SES environment. This is a wrapper around
|
|
6
|
-
* {@link evalBundle} that throws a {@link CommandError} if the bundle cannot be
|
|
7
|
-
* evaluated.
|
|
8
|
-
*
|
|
9
|
-
* @param path - The path to the bundle.
|
|
10
|
-
* @throws If the bundle cannot be evaluated.
|
|
11
|
-
*/ export async function evaluate(path) {
|
|
12
|
-
try {
|
|
13
|
-
return await evalBundle(path);
|
|
14
|
-
} catch (evalError) {
|
|
15
|
-
if (evalError instanceof SnapEvalError) {
|
|
16
|
-
throw new CommandError(`Failed to evaluate snap bundle in SES. This is likely due to an incompatibility with the SES environment in your snap.\nReceived the following error from the SES environment:\n\n${indent(red(evalError.output.stderr), 2)}`);
|
|
17
|
-
}
|
|
18
|
-
// If the error is not a `SnapEvalError`, we don't know what it is, so
|
|
19
|
-
// we just throw it.
|
|
20
|
-
throw evalError;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=implementation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/eval/implementation.ts"],"sourcesContent":["import { evalBundle, SnapEvalError, indent } from '@metamask/snaps-utils';\nimport { red } from 'chalk';\n\nimport { CommandError } from '../../errors';\n\n/**\n * Evaluate the given bundle in the SES environment. This is a wrapper around\n * {@link evalBundle} that throws a {@link CommandError} if the bundle cannot be\n * evaluated.\n *\n * @param path - The path to the bundle.\n * @throws If the bundle cannot be evaluated.\n */\nexport async function evaluate(path: string) {\n try {\n return await evalBundle(path);\n } catch (evalError) {\n if (evalError instanceof SnapEvalError) {\n throw new CommandError(\n `Failed to evaluate snap bundle in SES. This is likely due to an incompatibility with the SES environment in your snap.\\nReceived the following error from the SES environment:\\n\\n${indent(\n red(evalError.output.stderr),\n 2,\n )}`,\n );\n }\n\n // If the error is not a `SnapEvalError`, we don't know what it is, so\n // we just throw it.\n throw evalError;\n }\n}\n"],"names":["evalBundle","SnapEvalError","indent","red","CommandError","evaluate","path","evalError","output","stderr"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,EAAEC,MAAM,QAAQ,wBAAwB;AAC1E,SAASC,GAAG,QAAQ,QAAQ;AAE5B,SAASC,YAAY,QAAQ,eAAe;AAE5C;;;;;;;CAOC,GACD,OAAO,eAAeC,SAASC,IAAY;IACzC,IAAI;QACF,OAAO,MAAMN,WAAWM;IAC1B,EAAE,OAAOC,WAAW;QAClB,IAAIA,qBAAqBN,eAAe;YACtC,MAAM,IAAIG,aACR,CAAC,kLAAkL,EAAEF,OACnLC,IAAII,UAAUC,MAAM,CAACC,MAAM,GAC3B,GACA,CAAC;QAEP;QAEA,sEAAsE;QACtE,oBAAoB;QACpB,MAAMF;IACR;AACF"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import builders from '../../builders';
|
|
2
|
-
import { evaluateHandler } from './eval';
|
|
3
|
-
const command = {
|
|
4
|
-
command: [
|
|
5
|
-
'eval',
|
|
6
|
-
'e'
|
|
7
|
-
],
|
|
8
|
-
desc: 'Attempt to evaluate snap bundle in SES',
|
|
9
|
-
builder: (yarg)=>{
|
|
10
|
-
// Browserify options. These are merged into the config object.
|
|
11
|
-
yarg.option('bundle', builders.bundle);
|
|
12
|
-
// Webpack options.
|
|
13
|
-
yarg.option('input', builders.input);
|
|
14
|
-
},
|
|
15
|
-
handler: async (argv)=>evaluateHandler(argv.context.config, {
|
|
16
|
-
input: argv.input
|
|
17
|
-
})
|
|
18
|
-
};
|
|
19
|
-
export * from './implementation';
|
|
20
|
-
export default command;
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/eval/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { evaluateHandler } from './eval';\n\nconst command = {\n command: ['eval', 'e'],\n desc: 'Attempt to evaluate snap bundle in SES',\n builder: (yarg: yargs.Argv) => {\n // Browserify options. These are merged into the config object.\n yarg.option('bundle', builders.bundle);\n\n // Webpack options.\n yarg.option('input', builders.input);\n },\n handler: async (argv: YargsArgs) =>\n evaluateHandler(argv.context.config, { input: argv.input }),\n};\n\nexport * from './implementation';\nexport default command;\n"],"names":["builders","evaluateHandler","command","desc","builder","yarg","option","bundle","input","handler","argv","context","config"],"mappings":"AAEA,OAAOA,cAAc,iBAAiB;AAEtC,SAASC,eAAe,QAAQ,SAAS;AAEzC,MAAMC,UAAU;IACdA,SAAS;QAAC;QAAQ;KAAI;IACtBC,MAAM;IACNC,SAAS,CAACC;QACR,+DAA+D;QAC/DA,KAAKC,MAAM,CAAC,UAAUN,SAASO,MAAM;QAErC,mBAAmB;QACnBF,KAAKC,MAAM,CAAC,SAASN,SAASQ,KAAK;IACrC;IACAC,SAAS,OAAOC,OACdT,gBAAgBS,KAAKC,OAAO,CAACC,MAAM,EAAE;YAAEJ,OAAOE,KAAKF,KAAK;QAAC;AAC7D;AAEA,cAAc,mBAAmB;AACjC,eAAeN,QAAQ"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import buildCommand from './build';
|
|
2
|
-
import evaluateCommand from './eval';
|
|
3
|
-
import manifestCommand from './manifest';
|
|
4
|
-
import serveCommand from './serve';
|
|
5
|
-
import watchCommand from './watch';
|
|
6
|
-
const commands = [
|
|
7
|
-
buildCommand,
|
|
8
|
-
evaluateCommand,
|
|
9
|
-
manifestCommand,
|
|
10
|
-
serveCommand,
|
|
11
|
-
watchCommand
|
|
12
|
-
];
|
|
13
|
-
export default commands;
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/index.ts"],"sourcesContent":["import buildCommand from './build';\nimport evaluateCommand from './eval';\nimport manifestCommand from './manifest';\nimport serveCommand from './serve';\nimport watchCommand from './watch';\n\nconst commands = [\n buildCommand,\n evaluateCommand,\n manifestCommand,\n serveCommand,\n watchCommand,\n];\n\nexport default commands;\n"],"names":["buildCommand","evaluateCommand","manifestCommand","serveCommand","watchCommand","commands"],"mappings":"AAAA,OAAOA,kBAAkB,UAAU;AACnC,OAAOC,qBAAqB,SAAS;AACrC,OAAOC,qBAAqB,aAAa;AACzC,OAAOC,kBAAkB,UAAU;AACnC,OAAOC,kBAAkB,UAAU;AAEnC,MAAMC,WAAW;IACfL;IACAC;IACAC;IACAC;IACAC;CACD;AAED,eAAeC,SAAS"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { checkManifest, indent } from '@metamask/snaps-utils';
|
|
2
|
-
import { red, yellow } from 'chalk';
|
|
3
|
-
import { dirname } from 'path';
|
|
4
|
-
import { error, info, warn } from '../../utils';
|
|
5
|
-
/**
|
|
6
|
-
* Check the snap manifest file at the given path. If `write` is `true`, the
|
|
7
|
-
* manifest will be written to disk if it is invalid. If `write` is `false`,
|
|
8
|
-
* the manifest will not be written to disk, and the function will log any
|
|
9
|
-
* errors and warnings to the console.
|
|
10
|
-
*
|
|
11
|
-
* @param path - The path to the manifest file.
|
|
12
|
-
* @param write - Whether to write the manifest to disk if it is invalid.
|
|
13
|
-
* @param spinner - An optional spinner to use for logging.
|
|
14
|
-
*/ export async function manifest(path, write, spinner) {
|
|
15
|
-
const { warnings, errors, updated } = await checkManifest(dirname(path), write);
|
|
16
|
-
if (write && updated) {
|
|
17
|
-
info('The snap manifest file has been updated.', spinner);
|
|
18
|
-
}
|
|
19
|
-
if (!write && errors.length > 0) {
|
|
20
|
-
const formattedErrors = errors.map((manifestError)=>indent(red(`• ${manifestError}`))).join('\n');
|
|
21
|
-
error(`The snap manifest file is invalid.\n\n${formattedErrors}\n\nRun the command with the \`--fix\` flag to attempt to fix the manifest.`, spinner);
|
|
22
|
-
spinner?.stop();
|
|
23
|
-
process.exitCode = 1;
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
if (warnings.length > 0) {
|
|
27
|
-
const formattedWarnings = warnings.map((manifestWarning)=>indent(yellow(`• ${manifestWarning}`)));
|
|
28
|
-
warn(`The snap manifest file has warnings.\n\n${formattedWarnings.join('\n')}`, spinner);
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=implementation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/manifest/implementation.ts"],"sourcesContent":["import { checkManifest, indent } from '@metamask/snaps-utils';\nimport { red, yellow } from 'chalk';\nimport type { Ora } from 'ora';\nimport { dirname } from 'path';\n\nimport { error, info, warn } from '../../utils';\n\n/**\n * Check the snap manifest file at the given path. If `write` is `true`, the\n * manifest will be written to disk if it is invalid. If `write` is `false`,\n * the manifest will not be written to disk, and the function will log any\n * errors and warnings to the console.\n *\n * @param path - The path to the manifest file.\n * @param write - Whether to write the manifest to disk if it is invalid.\n * @param spinner - An optional spinner to use for logging.\n */\nexport async function manifest(\n path: string,\n write: boolean,\n spinner?: Ora,\n): Promise<boolean> {\n const { warnings, errors, updated } = await checkManifest(\n dirname(path),\n write,\n );\n\n if (write && updated) {\n info('The snap manifest file has been updated.', spinner);\n }\n\n if (!write && errors.length > 0) {\n const formattedErrors = errors\n .map((manifestError) => indent(red(`• ${manifestError}`)))\n .join('\\n');\n\n error(\n `The snap manifest file is invalid.\\n\\n${formattedErrors}\\n\\nRun the command with the \\`--fix\\` flag to attempt to fix the manifest.`,\n spinner,\n );\n\n spinner?.stop();\n process.exitCode = 1;\n return false;\n }\n\n if (warnings.length > 0) {\n const formattedWarnings = warnings.map((manifestWarning) =>\n indent(yellow(`• ${manifestWarning}`)),\n );\n\n warn(\n `The snap manifest file has warnings.\\n\\n${formattedWarnings.join('\\n')}`,\n spinner,\n );\n }\n\n return true;\n}\n"],"names":["checkManifest","indent","red","yellow","dirname","error","info","warn","manifest","path","write","spinner","warnings","errors","updated","length","formattedErrors","map","manifestError","join","stop","process","exitCode","formattedWarnings","manifestWarning"],"mappings":"AAAA,SAASA,aAAa,EAAEC,MAAM,QAAQ,wBAAwB;AAC9D,SAASC,GAAG,EAAEC,MAAM,QAAQ,QAAQ;AAEpC,SAASC,OAAO,QAAQ,OAAO;AAE/B,SAASC,KAAK,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEhD;;;;;;;;;CASC,GACD,OAAO,eAAeC,SACpBC,IAAY,EACZC,KAAc,EACdC,OAAa;IAEb,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAG,MAAMd,cAC1CI,QAAQK,OACRC;IAGF,IAAIA,SAASI,SAAS;QACpBR,KAAK,4CAA4CK;IACnD;IAEA,IAAI,CAACD,SAASG,OAAOE,MAAM,GAAG,GAAG;QAC/B,MAAMC,kBAAkBH,OACrBI,GAAG,CAAC,CAACC,gBAAkBjB,OAAOC,IAAI,CAAC,EAAE,EAAEgB,cAAc,CAAC,IACtDC,IAAI,CAAC;QAERd,MACE,CAAC,sCAAsC,EAAEW,gBAAgB,2EAA2E,CAAC,EACrIL;QAGFA,SAASS;QACTC,QAAQC,QAAQ,GAAG;QACnB,OAAO;IACT;IAEA,IAAIV,SAASG,MAAM,GAAG,GAAG;QACvB,MAAMQ,oBAAoBX,SAASK,GAAG,CAAC,CAACO,kBACtCvB,OAAOE,OAAO,CAAC,EAAE,EAAEqB,gBAAgB,CAAC;QAGtCjB,KACE,CAAC,wCAAwC,EAAEgB,kBAAkBJ,IAAI,CAAC,MAAM,CAAC,EACzER;IAEJ;IAEA,OAAO;AACT"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import builders from '../../builders';
|
|
2
|
-
import { manifestHandler } from './manifest';
|
|
3
|
-
const command = {
|
|
4
|
-
command: [
|
|
5
|
-
'manifest',
|
|
6
|
-
'm'
|
|
7
|
-
],
|
|
8
|
-
desc: 'Validate the snap.manifest.json file',
|
|
9
|
-
builder: (yarg)=>{
|
|
10
|
-
// Browserify options. These are merged into the config object.
|
|
11
|
-
yarg.option('writeManifest', builders.writeManifest);
|
|
12
|
-
// Webpack options.
|
|
13
|
-
yarg.option('fix', builders.fix);
|
|
14
|
-
},
|
|
15
|
-
handler: async (argv)=>manifestHandler(argv.context.config, {
|
|
16
|
-
fix: argv.fix
|
|
17
|
-
})
|
|
18
|
-
};
|
|
19
|
-
export * from './implementation';
|
|
20
|
-
export default command;
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/manifest/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { manifestHandler } from './manifest';\n\nconst command = {\n command: ['manifest', 'm'],\n desc: 'Validate the snap.manifest.json file',\n builder: (yarg: yargs.Argv) => {\n // Browserify options. These are merged into the config object.\n yarg.option('writeManifest', builders.writeManifest);\n\n // Webpack options.\n yarg.option('fix', builders.fix);\n },\n handler: async (argv: YargsArgs) =>\n manifestHandler(argv.context.config, { fix: argv.fix }),\n};\n\nexport * from './implementation';\nexport default command;\n"],"names":["builders","manifestHandler","command","desc","builder","yarg","option","writeManifest","fix","handler","argv","context","config"],"mappings":"AAEA,OAAOA,cAAc,iBAAiB;AAEtC,SAASC,eAAe,QAAQ,aAAa;AAE7C,MAAMC,UAAU;IACdA,SAAS;QAAC;QAAY;KAAI;IAC1BC,MAAM;IACNC,SAAS,CAACC;QACR,+DAA+D;QAC/DA,KAAKC,MAAM,CAAC,iBAAiBN,SAASO,aAAa;QAEnD,mBAAmB;QACnBF,KAAKC,MAAM,CAAC,OAAON,SAASQ,GAAG;IACjC;IACAC,SAAS,OAAOC,OACdT,gBAAgBS,KAAKC,OAAO,CAACC,MAAM,EAAE;YAAEJ,KAAKE,KAAKF,GAAG;QAAC;AACzD;AAEA,cAAc,mBAAmB;AACjC,eAAeN,QAAQ"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { isFile } from '@metamask/snaps-utils';
|
|
2
|
-
import { CommandError } from '../../errors';
|
|
3
|
-
import { executeSteps } from '../../utils';
|
|
4
|
-
import { manifest } from './implementation';
|
|
5
|
-
const steps = [
|
|
6
|
-
{
|
|
7
|
-
name: 'Checking the input file.',
|
|
8
|
-
task: async ({ input })=>{
|
|
9
|
-
if (!await isFile(input)) {
|
|
10
|
-
throw new CommandError(`Manifest file not found: "${input}". Make sure that the \`snap.manifest.json\` file exists.`);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'Validating the snap manifest.',
|
|
16
|
-
task: async ({ input, config, options, spinner })=>{
|
|
17
|
-
const write = getWriteManifest(config, options);
|
|
18
|
-
const valid = await manifest(input, write, spinner);
|
|
19
|
-
if (valid) {
|
|
20
|
-
spinner.succeed('The snap manifest file is valid.');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
];
|
|
25
|
-
/**
|
|
26
|
-
* Get whether to write the manifest to disk.
|
|
27
|
-
*
|
|
28
|
-
* @param config - The config object.
|
|
29
|
-
* @param options - The options object.
|
|
30
|
-
* @returns Whether to write the manifest to disk.
|
|
31
|
-
*/ function getWriteManifest(config, options) {
|
|
32
|
-
if (typeof options.fix === 'boolean') {
|
|
33
|
-
return options.fix;
|
|
34
|
-
}
|
|
35
|
-
return config.legacy?.writeManifest ?? false;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Validates a snap.manifest.json file. Attempts to fix the manifest and write
|
|
39
|
-
* the fixed version to disk if `writeManifest` is true. Throws if validation
|
|
40
|
-
* fails.
|
|
41
|
-
*
|
|
42
|
-
* @param config - The config object.
|
|
43
|
-
* @param options - The options object.
|
|
44
|
-
*/ export async function manifestHandler(config, options) {
|
|
45
|
-
await executeSteps(steps, {
|
|
46
|
-
input: config.manifest.path,
|
|
47
|
-
config,
|
|
48
|
-
options
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
//# sourceMappingURL=manifest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/manifest/manifest.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps } from '../../utils';\nimport { manifest } from './implementation';\n\ntype ManifestOptions = {\n fix?: boolean;\n};\n\ntype ManifestContext = {\n input: string;\n config: ProcessedConfig;\n options: ManifestOptions;\n};\n\nconst steps: Steps<ManifestContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n throw new CommandError(\n `Manifest file not found: \"${input}\". Make sure that the \\`snap.manifest.json\\` file exists.`,\n );\n }\n },\n },\n {\n name: 'Validating the snap manifest.',\n task: async ({ input, config, options, spinner }) => {\n const write = getWriteManifest(config, options);\n const valid = await manifest(input, write, spinner);\n\n if (valid) {\n spinner.succeed('The snap manifest file is valid.');\n }\n },\n },\n];\n\n/**\n * Get whether to write the manifest to disk.\n *\n * @param config - The config object.\n * @param options - The options object.\n * @returns Whether to write the manifest to disk.\n */\nfunction getWriteManifest(config: ProcessedConfig, options: ManifestOptions) {\n if (typeof options.fix === 'boolean') {\n return options.fix;\n }\n\n return config.legacy?.writeManifest ?? false;\n}\n\n/**\n * Validates a snap.manifest.json file. Attempts to fix the manifest and write\n * the fixed version to disk if `writeManifest` is true. Throws if validation\n * fails.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function manifestHandler(\n config: ProcessedConfig,\n options: ManifestOptions,\n) {\n await executeSteps(steps, {\n input: config.manifest.path,\n config,\n options,\n });\n}\n"],"names":["isFile","CommandError","executeSteps","manifest","steps","name","task","input","config","options","spinner","write","getWriteManifest","valid","succeed","fix","legacy","writeManifest","manifestHandler","path"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAG/C,SAASC,YAAY,QAAQ,eAAe;AAE5C,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,QAAQ,QAAQ,mBAAmB;AAY5C,MAAMC,QAAgC;IACpC;QACEC,MAAM;QACNC,MAAM,OAAO,EAAEC,KAAK,EAAE;YACpB,IAAI,CAAE,MAAMP,OAAOO,QAAS;gBAC1B,MAAM,IAAIN,aACR,CAAC,0BAA0B,EAAEM,MAAM,yDAAyD,CAAC;YAEjG;QACF;IACF;IACA;QACEF,MAAM;QACNC,MAAM,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE;YAC9C,MAAMC,QAAQC,iBAAiBJ,QAAQC;YACvC,MAAMI,QAAQ,MAAMV,SAASI,OAAOI,OAAOD;YAE3C,IAAIG,OAAO;gBACTH,QAAQI,OAAO,CAAC;YAClB;QACF;IACF;CACD;AAED;;;;;;CAMC,GACD,SAASF,iBAAiBJ,MAAuB,EAAEC,OAAwB;IACzE,IAAI,OAAOA,QAAQM,GAAG,KAAK,WAAW;QACpC,OAAON,QAAQM,GAAG;IACpB;IAEA,OAAOP,OAAOQ,MAAM,EAAEC,iBAAiB;AACzC;AAEA;;;;;;;CAOC,GACD,OAAO,eAAeC,gBACpBV,MAAuB,EACvBC,OAAwB;IAExB,MAAMP,aAAaE,OAAO;QACxBG,OAAOC,OAAOL,QAAQ,CAACgB,IAAI;QAC3BX;QACAC;IACF;AACF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import builders from '../../builders';
|
|
2
|
-
import { serveHandler } from './serve';
|
|
3
|
-
const command = {
|
|
4
|
-
command: [
|
|
5
|
-
'serve',
|
|
6
|
-
's'
|
|
7
|
-
],
|
|
8
|
-
desc: 'Locally serve Snap file(s) for testing',
|
|
9
|
-
builder: (yarg)=>{
|
|
10
|
-
yarg.option('root', builders.root).option('port', builders.port);
|
|
11
|
-
},
|
|
12
|
-
handler: async (argv)=>serveHandler(argv.context.config, {
|
|
13
|
-
port: argv.port ?? argv.context.config.server.port
|
|
14
|
-
})
|
|
15
|
-
};
|
|
16
|
-
export default command;
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/serve/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { serveHandler } from './serve';\n\nconst command = {\n command: ['serve', 's'],\n desc: 'Locally serve Snap file(s) for testing',\n builder: (yarg: yargs.Argv) => {\n yarg.option('root', builders.root).option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n serveHandler(argv.context.config, {\n port: argv.port ?? argv.context.config.server.port,\n }),\n};\n\nexport default command;\n"],"names":["builders","serveHandler","command","desc","builder","yarg","option","root","port","handler","argv","context","config","server"],"mappings":"AAEA,OAAOA,cAAc,iBAAiB;AAEtC,SAASC,YAAY,QAAQ,UAAU;AAEvC,MAAMC,UAAU;IACdA,SAAS;QAAC;QAAS;KAAI;IACvBC,MAAM;IACNC,SAAS,CAACC;QACRA,KAAKC,MAAM,CAAC,QAAQN,SAASO,IAAI,EAAED,MAAM,CAAC,QAAQN,SAASQ,IAAI;IACjE;IACAC,SAAS,OAAOC,OACdT,aAAaS,KAAKC,OAAO,CAACC,MAAM,EAAE;YAChCJ,MAAME,KAAKF,IAAI,IAAIE,KAAKC,OAAO,CAACC,MAAM,CAACC,MAAM,CAACL,IAAI;QACpD;AACJ;AAEA,eAAeN,QAAQ"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { info } from '../../utils';
|
|
2
|
-
import { getServer } from '../../webpack';
|
|
3
|
-
/**
|
|
4
|
-
* Starts a local, static HTTP server on the given port with the given root
|
|
5
|
-
* directory.
|
|
6
|
-
*
|
|
7
|
-
* @param config - The config object.
|
|
8
|
-
* @param options - The options object.
|
|
9
|
-
*/ export async function serveHandler(config, options) {
|
|
10
|
-
const server = getServer(config);
|
|
11
|
-
// If the `configPort` is `0`, the OS will choose a random port for us, so we
|
|
12
|
-
// need to get the port from the server after it starts.
|
|
13
|
-
const { port } = await server.listen(options.port);
|
|
14
|
-
info(`The server is listening on http://localhost:${port}.`);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=serve.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/serve/serve.ts"],"sourcesContent":["import type { ProcessedConfig } from '../../config';\nimport { info } from '../../utils';\nimport { getServer } from '../../webpack';\n\ntype ServeOptions = {\n /**\n * The port to listen on.\n */\n port: number;\n};\n\n/**\n * Starts a local, static HTTP server on the given port with the given root\n * directory.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function serveHandler(\n config: ProcessedConfig,\n options: ServeOptions,\n): Promise<void> {\n const server = getServer(config);\n\n // If the `configPort` is `0`, the OS will choose a random port for us, so we\n // need to get the port from the server after it starts.\n const { port } = await server.listen(options.port);\n\n info(`The server is listening on http://localhost:${port}.`);\n}\n"],"names":["info","getServer","serveHandler","config","options","server","port","listen"],"mappings":"AACA,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,SAAS,QAAQ,gBAAgB;AAS1C;;;;;;CAMC,GACD,OAAO,eAAeC,aACpBC,MAAuB,EACvBC,OAAqB;IAErB,MAAMC,SAASJ,UAAUE;IAEzB,6EAA6E;IAC7E,wDAAwD;IACxD,MAAM,EAAEG,IAAI,EAAE,GAAG,MAAMD,OAAOE,MAAM,CAACH,QAAQE,IAAI;IAEjDN,KAAK,CAAC,4CAA4C,EAAEM,KAAK,CAAC,CAAC;AAC7D"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { basename } from 'path';
|
|
2
|
-
import { getCompiler } from '../../webpack';
|
|
3
|
-
/**
|
|
4
|
-
* Build the snap bundle and watch for changes. This uses Webpack to build the
|
|
5
|
-
* bundle.
|
|
6
|
-
*
|
|
7
|
-
* @param config - The config object.
|
|
8
|
-
* @param options - The Webpack options.
|
|
9
|
-
* @returns A promise that resolves when the bundle is built for the first time.
|
|
10
|
-
* The promise resolves with a Webpack watching instance that can be used to
|
|
11
|
-
* close the watcher.
|
|
12
|
-
*/ export async function watch(config, options) {
|
|
13
|
-
const compiler = await getCompiler(config, {
|
|
14
|
-
evaluate: config.evaluate,
|
|
15
|
-
watch: true,
|
|
16
|
-
spinner: options?.spinner
|
|
17
|
-
});
|
|
18
|
-
return new Promise((resolve, reject)=>{
|
|
19
|
-
compiler.watch({
|
|
20
|
-
ignored: [
|
|
21
|
-
'**/node_modules/**/*',
|
|
22
|
-
`**/${basename(config.output.path)}/**/*`
|
|
23
|
-
]
|
|
24
|
-
}, (watchError)=>{
|
|
25
|
-
if (watchError) {
|
|
26
|
-
reject(watchError);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
resolve(compiler.watching);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=implementation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/watch/implementation.ts"],"sourcesContent":["import { basename } from 'path';\nimport type { Watching } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle and watch for changes. This uses Webpack to build the\n * bundle.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns A promise that resolves when the bundle is built for the first time.\n * The promise resolves with a Webpack watching instance that can be used to\n * close the watcher.\n */\nexport async function watch(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, {\n evaluate: config.evaluate,\n watch: true,\n spinner: options?.spinner,\n });\n\n return new Promise<Watching>((resolve, reject) => {\n compiler.watch(\n {\n ignored: [\n '**/node_modules/**/*',\n `**/${basename(config.output.path)}/**/*`,\n ],\n },\n (watchError) => {\n if (watchError) {\n reject(watchError);\n return;\n }\n\n resolve(compiler.watching);\n },\n );\n });\n}\n"],"names":["basename","getCompiler","watch","config","options","compiler","evaluate","spinner","Promise","resolve","reject","ignored","output","path","watchError","watching"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,OAAO;AAKhC,SAASC,WAAW,QAAQ,gBAAgB;AAE5C;;;;;;;;;CASC,GACD,OAAO,eAAeC,MACpBC,MAA8B,EAC9BC,OAAwB;IAExB,MAAMC,WAAW,MAAMJ,YAAYE,QAAQ;QACzCG,UAAUH,OAAOG,QAAQ;QACzBJ,OAAO;QACPK,SAASH,SAASG;IACpB;IAEA,OAAO,IAAIC,QAAkB,CAACC,SAASC;QACrCL,SAASH,KAAK,CACZ;YACES,SAAS;gBACP;gBACA,CAAC,GAAG,EAAEX,SAASG,OAAOS,MAAM,CAACC,IAAI,EAAE,KAAK,CAAC;aAC1C;QACH,GACA,CAACC;YACC,IAAIA,YAAY;gBACdJ,OAAOI;gBACP;YACF;YAEAL,QAAQJ,SAASU,QAAQ;QAC3B;IAEJ;AACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import builders from '../../builders';
|
|
2
|
-
import { watchHandler } from './watch';
|
|
3
|
-
const command = {
|
|
4
|
-
command: [
|
|
5
|
-
'watch',
|
|
6
|
-
'w'
|
|
7
|
-
],
|
|
8
|
-
desc: 'Build Snap on change',
|
|
9
|
-
builder: (yarg)=>{
|
|
10
|
-
yarg.option('src', builders.src).option('eval', builders.eval).option('dist', builders.dist).option('outfileName', builders.outfileName).option('sourceMaps', builders.sourceMaps).option('stripComments', builders.stripComments).option('transpilationMode', builders.transpilationMode).option('depsToTranspile', builders.depsToTranspile).option('manifest', builders.manifest).option('writeManifest', builders.writeManifest).option('serve', builders.serve).option('root', builders.root).option('port', builders.port).implies('writeManifest', 'manifest').implies('depsToTranspile', 'transpilationMode');
|
|
11
|
-
},
|
|
12
|
-
handler: async (argv)=>watchHandler(argv.context.config, {
|
|
13
|
-
port: argv.port
|
|
14
|
-
})
|
|
15
|
-
};
|
|
16
|
-
export * from './implementation';
|
|
17
|
-
export default command;
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/watch/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { watchHandler } from './watch';\n\nconst command = {\n command: ['watch', 'w'],\n desc: 'Build Snap on change',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('src', builders.src)\n .option('eval', builders.eval)\n .option('dist', builders.dist)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('manifest', builders.manifest)\n .option('writeManifest', builders.writeManifest)\n .option('serve', builders.serve)\n .option('root', builders.root)\n .option('port', builders.port)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) =>\n watchHandler(argv.context.config, {\n port: argv.port,\n }),\n};\n\nexport * from './implementation';\nexport default command;\n"],"names":["builders","watchHandler","command","desc","builder","yarg","option","src","eval","dist","outfileName","sourceMaps","stripComments","transpilationMode","depsToTranspile","manifest","writeManifest","serve","root","port","implies","handler","argv","context","config"],"mappings":"AAEA,OAAOA,cAAc,iBAAiB;AAEtC,SAASC,YAAY,QAAQ,UAAU;AAEvC,MAAMC,UAAU;IACdA,SAAS;QAAC;QAAS;KAAI;IACvBC,MAAM;IACNC,SAAS,CAACC;QACRA,KACGC,MAAM,CAAC,OAAON,SAASO,GAAG,EAC1BD,MAAM,CAAC,QAAQN,SAASQ,IAAI,EAC5BF,MAAM,CAAC,QAAQN,SAASS,IAAI,EAC5BH,MAAM,CAAC,eAAeN,SAASU,WAAW,EAC1CJ,MAAM,CAAC,cAAcN,SAASW,UAAU,EACxCL,MAAM,CAAC,iBAAiBN,SAASY,aAAa,EAC9CN,MAAM,CAAC,qBAAqBN,SAASa,iBAAiB,EACtDP,MAAM,CAAC,mBAAmBN,SAASc,eAAe,EAClDR,MAAM,CAAC,YAAYN,SAASe,QAAQ,EACpCT,MAAM,CAAC,iBAAiBN,SAASgB,aAAa,EAC9CV,MAAM,CAAC,SAASN,SAASiB,KAAK,EAC9BX,MAAM,CAAC,QAAQN,SAASkB,IAAI,EAC5BZ,MAAM,CAAC,QAAQN,SAASmB,IAAI,EAC5BC,OAAO,CAAC,iBAAiB,YACzBA,OAAO,CAAC,mBAAmB;IAChC;IACAC,SAAS,OAAOC,OACdrB,aAAaqB,KAAKC,OAAO,CAACC,MAAM,EAAE;YAChCL,MAAMG,KAAKH,IAAI;QACjB;AACJ;AAEA,cAAc,mBAAmB;AACjC,eAAejB,QAAQ"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { isFile } from '@metamask/snaps-utils';
|
|
2
|
-
import { CommandError } from '../../errors';
|
|
3
|
-
import { executeSteps, info } from '../../utils';
|
|
4
|
-
import { getServer } from '../../webpack';
|
|
5
|
-
import { watch } from './implementation';
|
|
6
|
-
const steps = [
|
|
7
|
-
{
|
|
8
|
-
name: 'Checking the input file.',
|
|
9
|
-
task: async ({ config })=>{
|
|
10
|
-
const { input } = config;
|
|
11
|
-
if (!await isFile(input)) {
|
|
12
|
-
throw new CommandError(`Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: 'Starting the development server.',
|
|
18
|
-
condition: ({ config })=>config.server.enabled,
|
|
19
|
-
task: async ({ config, options, spinner })=>{
|
|
20
|
-
const server = getServer(config);
|
|
21
|
-
const { port } = await server.listen(options.port ?? config.server.port);
|
|
22
|
-
info(`The server is listening on http://localhost:${port}.`, spinner);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: 'Building the snap bundle.',
|
|
27
|
-
task: async ({ config, spinner })=>{
|
|
28
|
-
await watch(config, {
|
|
29
|
-
spinner
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
];
|
|
34
|
-
/**
|
|
35
|
-
* Watch a directory and its subdirectories for changes, and build when files
|
|
36
|
-
* are added or changed.
|
|
37
|
-
*
|
|
38
|
-
* Ignores 'node_modules' and dotfiles.
|
|
39
|
-
* Creates destination directory if it doesn't exist.
|
|
40
|
-
*
|
|
41
|
-
* @param config - The config object.
|
|
42
|
-
* @param options - The options object.
|
|
43
|
-
*/ export async function watchHandler(config, options) {
|
|
44
|
-
await executeSteps(steps, {
|
|
45
|
-
config,
|
|
46
|
-
options
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=watch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/watch/watch.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\nimport { watch } from './implementation';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedWebpackConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"],"names":["isFile","CommandError","executeSteps","info","getServer","watch","steps","name","task","config","input","condition","server","enabled","options","spinner","port","listen","watchHandler"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAG/C,SAASC,YAAY,QAAQ,eAAe;AAE5C,SAASC,YAAY,EAAEC,IAAI,QAAQ,cAAc;AACjD,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,KAAK,QAAQ,mBAAmB;AAczC,MAAMC,QAA6B;IACjC;QACEC,MAAM;QACNC,MAAM,OAAO,EAAEC,MAAM,EAAE;YACrB,MAAM,EAAEC,KAAK,EAAE,GAAGD;YAElB,IAAI,CAAE,MAAMT,OAAOU,QAAS;gBAC1B,MAAM,IAAIT,aACR,CAAC,uBAAuB,EAAES,MAAM,mEAAmE,CAAC;YAExG;QACF;IACF;IACA;QACEH,MAAM;QACNI,WAAW,CAAC,EAAEF,MAAM,EAAE,GAAKA,OAAOG,MAAM,CAACC,OAAO;QAChDL,MAAM,OAAO,EAAEC,MAAM,EAAEK,OAAO,EAAEC,OAAO,EAAE;YACvC,MAAMH,SAASR,UAAUK;YACzB,MAAM,EAAEO,IAAI,EAAE,GAAG,MAAMJ,OAAOK,MAAM,CAACH,QAAQE,IAAI,IAAIP,OAAOG,MAAM,CAACI,IAAI;YAEvEb,KAAK,CAAC,4CAA4C,EAAEa,KAAK,CAAC,CAAC,EAAED;QAC/D;IACF;IACA;QACER,MAAM;QACNC,MAAM,OAAO,EAAEC,MAAM,EAAEM,OAAO,EAAE;YAC9B,MAAMV,MAAMI,QAAQ;gBAAEM;YAAQ;QAChC;IACF;CACD;AAED;;;;;;;;;CASC,GACD,OAAO,eAAeG,aACpBT,MAAuB,EACvBK,OAAqB;IAErB,MAAMZ,aAAaI,OAAO;QAAEG;QAAQK;IAAQ;AAC9C"}
|