@metamask/snaps-cli 5.1.1 → 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 +8 -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 -254
- package/dist/cjs/webpack/utils.js.map +0 -1
- package/dist/esm/builders.js +0 -130
- package/dist/esm/builders.js.map +0 -1
- package/dist/esm/cli.js +0 -56
- package/dist/esm/cli.js.map +0 -1
- package/dist/esm/commands/build/build.js +0 -51
- package/dist/esm/commands/build/build.js.map +0 -1
- package/dist/esm/commands/build/implementation.js +0 -27
- package/dist/esm/commands/build/implementation.js.map +0 -1
- package/dist/esm/commands/build/index.js +0 -17
- package/dist/esm/commands/build/index.js.map +0 -1
- package/dist/esm/commands/eval/eval.js +0 -54
- package/dist/esm/commands/eval/eval.js.map +0 -1
- package/dist/esm/commands/eval/implementation.js +0 -24
- package/dist/esm/commands/eval/implementation.js.map +0 -1
- package/dist/esm/commands/eval/index.js +0 -22
- package/dist/esm/commands/eval/index.js.map +0 -1
- package/dist/esm/commands/index.js +0 -15
- package/dist/esm/commands/index.js.map +0 -1
- package/dist/esm/commands/manifest/implementation.js +0 -33
- package/dist/esm/commands/manifest/implementation.js.map +0 -1
- package/dist/esm/commands/manifest/index.js +0 -22
- package/dist/esm/commands/manifest/index.js.map +0 -1
- package/dist/esm/commands/manifest/manifest.js +0 -52
- package/dist/esm/commands/manifest/manifest.js.map +0 -1
- package/dist/esm/commands/serve/index.js +0 -18
- package/dist/esm/commands/serve/index.js.map +0 -1
- package/dist/esm/commands/serve/serve.js +0 -17
- package/dist/esm/commands/serve/serve.js.map +0 -1
- package/dist/esm/commands/watch/implementation.js +0 -34
- package/dist/esm/commands/watch/implementation.js.map +0 -1
- package/dist/esm/commands/watch/index.js +0 -19
- package/dist/esm/commands/watch/index.js.map +0 -1
- package/dist/esm/commands/watch/watch.js +0 -50
- package/dist/esm/commands/watch/watch.js.map +0 -1
- package/dist/esm/config.js +0 -324
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/errors.js +0 -30
- package/dist/esm/errors.js.map +0 -1
- package/dist/esm/index.js +0 -6
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/main.js +0 -10
- package/dist/esm/main.js.map +0 -1
- package/dist/esm/utils/cli.js +0 -43
- package/dist/esm/utils/cli.js.map +0 -1
- package/dist/esm/utils/errors.js +0 -43
- package/dist/esm/utils/errors.js.map +0 -1
- package/dist/esm/utils/index.js +0 -8
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/legacy.js +0 -47
- package/dist/esm/utils/legacy.js.map +0 -1
- package/dist/esm/utils/logging.js +0 -40
- package/dist/esm/utils/logging.js.map +0 -1
- package/dist/esm/utils/path.js +0 -13
- package/dist/esm/utils/path.js.map +0 -1
- package/dist/esm/utils/steps.js +0 -43
- package/dist/esm/utils/steps.js.map +0 -1
- package/dist/esm/webpack/compiler.js +0 -15
- package/dist/esm/webpack/compiler.js.map +0 -1
- package/dist/esm/webpack/config.js.map +0 -1
- package/dist/esm/webpack/index.js +0 -6
- package/dist/esm/webpack/index.js.map +0 -1
- package/dist/esm/webpack/loaders/browserify.js +0 -82
- package/dist/esm/webpack/loaders/browserify.js.map +0 -1
- package/dist/esm/webpack/loaders/wasm.js +0 -87
- package/dist/esm/webpack/loaders/wasm.js.map +0 -1
- package/dist/esm/webpack/plugins.js +0 -344
- package/dist/esm/webpack/plugins.js.map +0 -1
- package/dist/esm/webpack/server.js +0 -133
- package/dist/esm/webpack/server.js.map +0 -1
- package/dist/esm/webpack/utils.js +0 -285
- package/dist/esm/webpack/utils.js.map +0 -1
|
@@ -1,274 +1,302 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import {
|
|
2
|
+
SnapsBuiltInResolver,
|
|
3
|
+
SnapsBundleWarningsPlugin,
|
|
4
|
+
SnapsStatsPlugin,
|
|
5
|
+
SnapsWatchPlugin
|
|
6
|
+
} from "./chunk-VI3ZJJYO.mjs";
|
|
7
|
+
import {
|
|
8
|
+
BROWSERSLIST_FILE,
|
|
9
|
+
getDefaultLoader,
|
|
10
|
+
getDevTool,
|
|
11
|
+
getEnvironmentVariables,
|
|
12
|
+
getFallbacks,
|
|
13
|
+
getProgressHandler
|
|
14
|
+
} from "./chunk-MCN7UXG3.mjs";
|
|
15
|
+
import {
|
|
16
|
+
getFunctionLoader
|
|
17
|
+
} from "./chunk-UBWM7UOC.mjs";
|
|
18
|
+
import {
|
|
19
|
+
wasm_default
|
|
20
|
+
} from "./chunk-DWS4BJTE.mjs";
|
|
21
|
+
|
|
22
|
+
// src/webpack/config.ts
|
|
23
|
+
import SnapsWebpackPlugin from "@metamask/snaps-webpack-plugin";
|
|
24
|
+
import { resolve } from "path";
|
|
25
|
+
import TerserPlugin from "terser-webpack-plugin";
|
|
26
|
+
import { DefinePlugin, ProgressPlugin, ProvidePlugin } from "webpack";
|
|
22
27
|
async function getDefaultConfiguration(config, options = {
|
|
23
|
-
|
|
28
|
+
evaluate: config.evaluate
|
|
24
29
|
}) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
const spinnerText = options.spinner?.text;
|
|
31
|
+
const builtInResolver = config.stats.builtIns && new SnapsBuiltInResolver(config.stats.builtIns, options.spinner);
|
|
32
|
+
return {
|
|
33
|
+
/**
|
|
29
34
|
* The target is set to `browserslist` so that Webpack will compile the
|
|
30
35
|
* bundle to support the browsers specified in the `.browserslistrc` file.
|
|
31
36
|
* This Browserslist file contains the browsers that are supported by
|
|
32
37
|
* MetaMask Snaps.
|
|
33
38
|
*
|
|
34
39
|
* @see https://webpack.js.org/configuration/target/
|
|
35
|
-
*/
|
|
36
|
-
|
|
40
|
+
*/
|
|
41
|
+
target: `browserslist:${BROWSERSLIST_FILE}`,
|
|
42
|
+
/**
|
|
37
43
|
* The mode is set to `production` by default, so that Webpack will minify
|
|
38
44
|
* and optimize the bundle.
|
|
39
45
|
*
|
|
40
46
|
* @see https://webpack.js.org/configuration/mode/
|
|
41
|
-
*/
|
|
42
|
-
|
|
47
|
+
*/
|
|
48
|
+
mode: "production",
|
|
49
|
+
/**
|
|
43
50
|
* The entry point is set to the `input` value from the config object.
|
|
44
51
|
*
|
|
45
52
|
* @see https://webpack.js.org/configuration/entry-context/
|
|
46
|
-
*/
|
|
47
|
-
|
|
53
|
+
*/
|
|
54
|
+
entry: config.input,
|
|
55
|
+
/**
|
|
48
56
|
* The devtool option controls how source maps are generated. We set it to
|
|
49
57
|
* the `sourceMap` value from the config object.
|
|
50
58
|
*
|
|
51
59
|
* @see https://webpack.js.org/configuration/devtool/
|
|
52
|
-
*/
|
|
53
|
-
|
|
60
|
+
*/
|
|
61
|
+
devtool: getDevTool(config.sourceMap),
|
|
62
|
+
/**
|
|
54
63
|
* The stats option controls how much information is printed to the console
|
|
55
64
|
* when Webpack is running. We set it to `none` so that we can control the
|
|
56
65
|
* output ourselves.
|
|
57
66
|
*
|
|
58
67
|
* @see https://webpack.js.org/configuration/stats/
|
|
59
|
-
*/
|
|
60
|
-
|
|
68
|
+
*/
|
|
69
|
+
stats: "none",
|
|
70
|
+
/**
|
|
61
71
|
* The output options.
|
|
62
72
|
*
|
|
63
73
|
* @see https://webpack.js.org/configuration/output/
|
|
64
|
-
*/
|
|
65
|
-
|
|
74
|
+
*/
|
|
75
|
+
output: {
|
|
76
|
+
/**
|
|
66
77
|
* This indicates whether Webpack should clear the output directory
|
|
67
78
|
* before building. We set it to the `clean` value from the config
|
|
68
79
|
* object.
|
|
69
80
|
*
|
|
70
81
|
* @see https://webpack.js.org/configuration/output/#outputclean
|
|
71
|
-
*/
|
|
72
|
-
|
|
82
|
+
*/
|
|
83
|
+
clean: config.output.clean,
|
|
84
|
+
/**
|
|
73
85
|
* The filename of the bundle. We set it to the `filename` value from
|
|
74
86
|
* the config object.
|
|
75
87
|
*
|
|
76
88
|
* @see https://webpack.js.org/configuration/output/#outputfilename
|
|
77
|
-
*/
|
|
78
|
-
|
|
89
|
+
*/
|
|
90
|
+
filename: config.output.filename,
|
|
91
|
+
/**
|
|
79
92
|
* The path to the output directory. We set it to the `path` value from
|
|
80
93
|
* the config object.
|
|
81
94
|
*
|
|
82
95
|
* @see https://webpack.js.org/configuration/output/#outputpath
|
|
83
|
-
*/
|
|
84
|
-
|
|
96
|
+
*/
|
|
97
|
+
path: config.output.path,
|
|
98
|
+
/**
|
|
85
99
|
* The public path of the bundle. We set it to `/` by default, so that
|
|
86
100
|
* the bundle can be loaded from the root of the server.
|
|
87
101
|
*
|
|
88
102
|
* @see https://webpack.js.org/configuration/output/#outputpublicpath
|
|
89
|
-
*/
|
|
90
|
-
|
|
103
|
+
*/
|
|
104
|
+
publicPath: "/",
|
|
105
|
+
/**
|
|
91
106
|
* The library configuration. This tells Webpack how to export the
|
|
92
107
|
* bundle.
|
|
93
108
|
*
|
|
94
109
|
* @see https://webpack.js.org/configuration/output/#outputlibrary
|
|
95
|
-
*/
|
|
96
|
-
|
|
110
|
+
*/
|
|
111
|
+
library: {
|
|
112
|
+
/**
|
|
97
113
|
* This tells Webpack to export the bundle as a CommonJS module. This
|
|
98
114
|
* is necessary for MetaMask Snaps.
|
|
99
115
|
*
|
|
100
116
|
* @see https://webpack.js.org/configuration/output/#outputlibrarytarget
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
|
|
117
|
+
*/
|
|
118
|
+
type: "commonjs"
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
104
121
|
* The chunk format. This tells Webpack how to export chunks. This is
|
|
105
122
|
* required because we use browserslist to target browsers, but Snaps are
|
|
106
123
|
* not fully compatible with browser APIs (such as `window` and
|
|
107
124
|
* `document`).
|
|
108
125
|
*
|
|
109
126
|
* @see https://webpack.js.org/configuration/output/#outputchunkformat
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
*/
|
|
128
|
+
chunkFormat: "commonjs"
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
113
131
|
* The module configuration. This is where we tell Webpack how to handle
|
|
114
132
|
* different types of files.
|
|
115
133
|
*
|
|
116
134
|
* @see https://webpack.js.org/configuration/module/
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
*/
|
|
136
|
+
module: {
|
|
137
|
+
rules: [
|
|
138
|
+
{
|
|
139
|
+
test: /\.(js|mjs|cjs|ts)$/u,
|
|
140
|
+
exclude: /node_modules/u,
|
|
141
|
+
use: await getDefaultLoader(config)
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
125
144
|
* This allows importing modules that uses `.js` and not `.mjs` for the
|
|
126
145
|
* ES build.
|
|
127
146
|
*
|
|
128
147
|
* @see https://webpack.js.org/configuration/module/#resolvefullyspecified
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
config.experimental.wasm && {
|
|
136
|
-
test: /\.wasm$/u,
|
|
137
|
-
use: {
|
|
138
|
-
loader: (0, _path.resolve)(__dirname, 'loaders', 'wasm')
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
]
|
|
148
|
+
*/
|
|
149
|
+
{
|
|
150
|
+
test: /\.m?js/u,
|
|
151
|
+
resolve: {
|
|
152
|
+
fullySpecified: false
|
|
153
|
+
}
|
|
142
154
|
},
|
|
143
|
-
|
|
155
|
+
config.experimental.wasm && {
|
|
156
|
+
test: /\.wasm$/u,
|
|
157
|
+
use: getFunctionLoader(wasm_default, {})
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
144
162
|
* The resolve configuration. This tells Webpack how to resolve imports.
|
|
145
163
|
* We set it to resolve `.js` and `.ts` files.
|
|
146
164
|
*
|
|
147
165
|
* @see https://webpack.js.org/configuration/resolve/
|
|
148
|
-
*/
|
|
149
|
-
|
|
166
|
+
*/
|
|
167
|
+
resolve: {
|
|
168
|
+
/**
|
|
150
169
|
* The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`
|
|
151
170
|
* files.
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
'.cjs',
|
|
156
|
-
'.ts'
|
|
157
|
-
],
|
|
158
|
-
/**
|
|
171
|
+
*/
|
|
172
|
+
extensions: [".js", ".mjs", ".cjs", ".ts"],
|
|
173
|
+
/**
|
|
159
174
|
* The fallback options. This tells Webpack how to handle imports that
|
|
160
175
|
* aren't resolved. By default, we set Node.js built-ins to `false`, so
|
|
161
176
|
* that they are ignored.
|
|
162
|
-
*/
|
|
163
|
-
|
|
177
|
+
*/
|
|
178
|
+
fallback: getFallbacks(config.polyfills),
|
|
179
|
+
/**
|
|
164
180
|
* The plugins to use. We use the {@link SnapsBuiltInResolver} to show
|
|
165
181
|
* warnings about using Node.js built-ins, when no fallback is specified.
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
/**
|
|
182
|
+
*/
|
|
183
|
+
plugins: [builtInResolver]
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
171
186
|
* The plugins to use.
|
|
172
187
|
*
|
|
173
188
|
* @see https://webpack.js.org/configuration/plugins/
|
|
174
|
-
*/
|
|
175
|
-
|
|
189
|
+
*/
|
|
190
|
+
plugins: [
|
|
191
|
+
/**
|
|
176
192
|
* The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates
|
|
177
193
|
* the manifest file, and evaluates the bundle in SES. While not strictly
|
|
178
194
|
* required, it's highly recommended to use this plugin.
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
195
|
+
*/
|
|
196
|
+
new SnapsWebpackPlugin({
|
|
197
|
+
manifestPath: config.manifest.path,
|
|
198
|
+
writeManifest: config.manifest.update,
|
|
199
|
+
eval: !options.watch && options.evaluate
|
|
200
|
+
}),
|
|
201
|
+
/**
|
|
185
202
|
* The `SnapsStatsPlugin` is a Webpack plugin that handles the stats
|
|
186
203
|
* output. It's used to show the stats in the terminal, in a format that
|
|
187
204
|
* is easy to read.
|
|
188
|
-
*/
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
/**
|
|
205
|
+
*/
|
|
206
|
+
new SnapsStatsPlugin({ verbose: config.stats.verbose }, options.spinner),
|
|
207
|
+
/**
|
|
192
208
|
* The `DefinePlugin` is a Webpack plugin that adds static values to the
|
|
193
209
|
* bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`
|
|
194
210
|
* environment variables, as well as any custom environment
|
|
195
211
|
* variables (as `process.env`).
|
|
196
|
-
*/
|
|
197
|
-
|
|
212
|
+
*/
|
|
213
|
+
new DefinePlugin(getEnvironmentVariables(config.environment)),
|
|
214
|
+
/**
|
|
198
215
|
* The `ProgressPlugin` is a Webpack plugin that logs the progress of
|
|
199
216
|
* the build. We set it to log the progress to the spinner.
|
|
200
|
-
*/
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
217
|
+
*/
|
|
218
|
+
new ProgressPlugin({
|
|
219
|
+
handler: getProgressHandler(options.spinner, spinnerText)
|
|
220
|
+
}),
|
|
221
|
+
/**
|
|
204
222
|
* The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a
|
|
205
223
|
* warning when the bundle is potentially incompatible with MetaMask
|
|
206
224
|
* Snaps.
|
|
207
|
-
*/
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
225
|
+
*/
|
|
226
|
+
new SnapsBundleWarningsPlugin({
|
|
227
|
+
builtInResolver,
|
|
228
|
+
builtIns: Boolean(config.stats.builtIns),
|
|
229
|
+
buffer: config.stats.buffer
|
|
230
|
+
}),
|
|
231
|
+
/**
|
|
213
232
|
* The `WatchPlugin` is a Webpack plugin that adds extra files to watch
|
|
214
233
|
* for changes. This is useful for rebuilding the bundle when the
|
|
215
234
|
* manifest file changes.
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
235
|
+
*/
|
|
236
|
+
options.watch && new SnapsWatchPlugin(
|
|
237
|
+
{
|
|
238
|
+
bundle: resolve(config.output.path, config.output.filename),
|
|
239
|
+
evaluate: options.evaluate,
|
|
240
|
+
files: [config.manifest.path]
|
|
241
|
+
},
|
|
242
|
+
options.spinner
|
|
243
|
+
),
|
|
244
|
+
/**
|
|
224
245
|
* The `ProviderPlugin` is a Webpack plugin that automatically load
|
|
225
246
|
* modules instead of having to import or require them everywhere.
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
].filter(Boolean),
|
|
233
|
-
/**
|
|
247
|
+
*/
|
|
248
|
+
(config.polyfills === true || config.polyfills !== false && config.polyfills.buffer) && new ProvidePlugin({
|
|
249
|
+
Buffer: ["buffer", "Buffer"]
|
|
250
|
+
})
|
|
251
|
+
].filter(Boolean),
|
|
252
|
+
/**
|
|
234
253
|
* The optimization configuration. This tells Webpack how to optimize the
|
|
235
254
|
* bundle. Most of the time, you won't need to change this, as the default
|
|
236
255
|
* options set by the `mode` option are sufficient.
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
|
|
256
|
+
*/
|
|
257
|
+
optimization: {
|
|
258
|
+
minimize: config.output.minimize,
|
|
259
|
+
/**
|
|
240
260
|
* The minimizer to use. We set it to use the `TerserPlugin`.
|
|
241
|
-
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
261
|
+
*/
|
|
262
|
+
minimizer: [
|
|
263
|
+
new TerserPlugin({
|
|
264
|
+
parallel: true
|
|
265
|
+
})
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
/**
|
|
248
269
|
* The performance configuration. This tells Webpack how to handle
|
|
249
270
|
* performance hints.
|
|
250
271
|
*
|
|
251
272
|
* @see https://webpack.js.org/configuration/performance/
|
|
252
|
-
*/
|
|
253
|
-
|
|
273
|
+
*/
|
|
274
|
+
performance: {
|
|
275
|
+
/**
|
|
254
276
|
* The hints to show. We set it to `false`, so that we don't get
|
|
255
277
|
* performance hints, as they are not relevant for Snaps.
|
|
256
278
|
*
|
|
257
279
|
* @see https://webpack.js.org/configuration/performance/#performancehints
|
|
258
|
-
*/
|
|
259
|
-
|
|
260
|
-
|
|
280
|
+
*/
|
|
281
|
+
hints: false
|
|
282
|
+
},
|
|
283
|
+
/**
|
|
261
284
|
* The infrastructure logging configuration. This tells Webpack how to
|
|
262
285
|
* log messages.
|
|
263
286
|
*
|
|
264
287
|
* @see https://webpack.js.org/configuration/infrastructure-logging
|
|
265
|
-
*/
|
|
266
|
-
|
|
288
|
+
*/
|
|
289
|
+
infrastructureLogging: {
|
|
290
|
+
/**
|
|
267
291
|
* The level of logging to use. We set it to `none`, so that we can
|
|
268
292
|
* control the output ourselves.
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
|
-
}
|
|
293
|
+
*/
|
|
294
|
+
level: "none"
|
|
295
|
+
}
|
|
296
|
+
};
|
|
272
297
|
}
|
|
273
298
|
|
|
274
|
-
|
|
299
|
+
export {
|
|
300
|
+
getDefaultConfiguration
|
|
301
|
+
};
|
|
302
|
+
//# sourceMappingURL=chunk-KKTPKAZN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webpack/config.ts"],"sourcesContent":["import SnapsWebpackPlugin from '@metamask/snaps-webpack-plugin';\nimport type { Ora } from 'ora';\nimport { resolve } from 'path';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport type { Configuration } from 'webpack';\nimport { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { getFunctionLoader, wasm } from './loaders';\nimport {\n SnapsBuiltInResolver,\n SnapsBundleWarningsPlugin,\n SnapsStatsPlugin,\n SnapsWatchPlugin,\n} from './plugins';\nimport {\n BROWSERSLIST_FILE,\n getDefaultLoader,\n getDevTool,\n getEnvironmentVariables,\n getFallbacks,\n getProgressHandler,\n} from './utils';\n\nexport type WebpackOptions = {\n /**\n * Whether to watch for changes.\n */\n watch?: boolean;\n\n /**\n * Whether to evaluate the bundle. If this is set, it will override the\n * `evaluate` option in the config object.\n */\n evaluate?: boolean;\n\n /**\n * The spinner to use for logging.\n */\n spinner?: Ora;\n};\n\n/**\n * Get the default Webpack configuration. This is the configuration that will\n * be used if the user doesn't provide a custom Webpack configuration. The\n * configuration is based on the snap config.\n *\n * The default configuration includes:\n *\n * - `SWC` to transpile TypeScript and JavaScript files.\n * - `TerserPlugin` to minify the bundle.\n * - `SnapsWebpackPlugin` to validate the bundle and update the manifest.\n *\n * It can be customized through the `customizeWebpackConfig` function in the\n * snap config, but in most cases, you shouldn't need to do that.\n *\n * @param config - The processed snap Webpack config.\n * @param options - The Webpack options.\n * @returns The default Webpack configuration.\n */\nexport async function getDefaultConfiguration(\n config: ProcessedWebpackConfig,\n options: WebpackOptions = {\n evaluate: config.evaluate,\n },\n): Promise<Configuration> {\n const spinnerText = options.spinner?.text;\n const builtInResolver =\n config.stats.builtIns &&\n new SnapsBuiltInResolver(config.stats.builtIns, options.spinner);\n\n return {\n /**\n * The target is set to `browserslist` so that Webpack will compile the\n * bundle to support the browsers specified in the `.browserslistrc` file.\n * This Browserslist file contains the browsers that are supported by\n * MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/target/\n */\n target: `browserslist:${BROWSERSLIST_FILE}`,\n\n /**\n * The mode is set to `production` by default, so that Webpack will minify\n * and optimize the bundle.\n *\n * @see https://webpack.js.org/configuration/mode/\n */\n mode: 'production',\n\n /**\n * The entry point is set to the `input` value from the config object.\n *\n * @see https://webpack.js.org/configuration/entry-context/\n */\n entry: config.input,\n\n /**\n * The devtool option controls how source maps are generated. We set it to\n * the `sourceMap` value from the config object.\n *\n * @see https://webpack.js.org/configuration/devtool/\n */\n devtool: getDevTool(config.sourceMap),\n\n /**\n * The stats option controls how much information is printed to the console\n * when Webpack is running. We set it to `none` so that we can control the\n * output ourselves.\n *\n * @see https://webpack.js.org/configuration/stats/\n */\n stats: 'none',\n\n /**\n * The output options.\n *\n * @see https://webpack.js.org/configuration/output/\n */\n output: {\n /**\n * This indicates whether Webpack should clear the output directory\n * before building. We set it to the `clean` value from the config\n * object.\n *\n * @see https://webpack.js.org/configuration/output/#outputclean\n */\n clean: config.output.clean,\n\n /**\n * The filename of the bundle. We set it to the `filename` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputfilename\n */\n filename: config.output.filename,\n\n /**\n * The path to the output directory. We set it to the `path` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputpath\n */\n path: config.output.path,\n\n /**\n * The public path of the bundle. We set it to `/` by default, so that\n * the bundle can be loaded from the root of the server.\n *\n * @see https://webpack.js.org/configuration/output/#outputpublicpath\n */\n publicPath: '/',\n\n /**\n * The library configuration. This tells Webpack how to export the\n * bundle.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrary\n */\n library: {\n /**\n * This tells Webpack to export the bundle as a CommonJS module. This\n * is necessary for MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrarytarget\n */\n type: 'commonjs',\n },\n\n /**\n * The chunk format. This tells Webpack how to export chunks. This is\n * required because we use browserslist to target browsers, but Snaps are\n * not fully compatible with browser APIs (such as `window` and\n * `document`).\n *\n * @see https://webpack.js.org/configuration/output/#outputchunkformat\n */\n chunkFormat: 'commonjs',\n },\n\n /**\n * The module configuration. This is where we tell Webpack how to handle\n * different types of files.\n *\n * @see https://webpack.js.org/configuration/module/\n */\n module: {\n rules: [\n {\n test: /\\.(js|mjs|cjs|ts)$/u,\n exclude: /node_modules/u,\n use: await getDefaultLoader(config),\n },\n\n /**\n * This allows importing modules that uses `.js` and not `.mjs` for the\n * ES build.\n *\n * @see https://webpack.js.org/configuration/module/#resolvefullyspecified\n */\n {\n test: /\\.m?js/u,\n resolve: {\n fullySpecified: false,\n },\n },\n\n config.experimental.wasm && {\n test: /\\.wasm$/u,\n use: getFunctionLoader(wasm, {}),\n },\n ],\n },\n\n /**\n * The resolve configuration. This tells Webpack how to resolve imports.\n * We set it to resolve `.js` and `.ts` files.\n *\n * @see https://webpack.js.org/configuration/resolve/\n */\n resolve: {\n /**\n * The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`\n * files.\n */\n extensions: ['.js', '.mjs', '.cjs', '.ts'],\n\n /**\n * The fallback options. This tells Webpack how to handle imports that\n * aren't resolved. By default, we set Node.js built-ins to `false`, so\n * that they are ignored.\n */\n fallback: getFallbacks(config.polyfills),\n\n /**\n * The plugins to use. We use the {@link SnapsBuiltInResolver} to show\n * warnings about using Node.js built-ins, when no fallback is specified.\n */\n plugins: [builtInResolver],\n },\n\n /**\n * The plugins to use.\n *\n * @see https://webpack.js.org/configuration/plugins/\n */\n plugins: [\n /**\n * The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates\n * the manifest file, and evaluates the bundle in SES. While not strictly\n * required, it's highly recommended to use this plugin.\n */\n new SnapsWebpackPlugin({\n manifestPath: config.manifest.path,\n writeManifest: config.manifest.update,\n eval: !options.watch && options.evaluate,\n }),\n\n /**\n * The `SnapsStatsPlugin` is a Webpack plugin that handles the stats\n * output. It's used to show the stats in the terminal, in a format that\n * is easy to read.\n */\n new SnapsStatsPlugin({ verbose: config.stats.verbose }, options.spinner),\n\n /**\n * The `DefinePlugin` is a Webpack plugin that adds static values to the\n * bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`\n * environment variables, as well as any custom environment\n * variables (as `process.env`).\n */\n new DefinePlugin(getEnvironmentVariables(config.environment)),\n\n /**\n * The `ProgressPlugin` is a Webpack plugin that logs the progress of\n * the build. We set it to log the progress to the spinner.\n */\n new ProgressPlugin({\n handler: getProgressHandler(options.spinner, spinnerText),\n }),\n\n /**\n * The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a\n * warning when the bundle is potentially incompatible with MetaMask\n * Snaps.\n */\n new SnapsBundleWarningsPlugin({\n builtInResolver,\n builtIns: Boolean(config.stats.builtIns),\n buffer: config.stats.buffer,\n }),\n\n /**\n * The `WatchPlugin` is a Webpack plugin that adds extra files to watch\n * for changes. This is useful for rebuilding the bundle when the\n * manifest file changes.\n */\n options.watch &&\n new SnapsWatchPlugin(\n {\n bundle: resolve(config.output.path, config.output.filename),\n evaluate: options.evaluate,\n files: [config.manifest.path],\n },\n options.spinner,\n ),\n\n /**\n * The `ProviderPlugin` is a Webpack plugin that automatically load\n * modules instead of having to import or require them everywhere.\n */\n (config.polyfills === true ||\n (config.polyfills !== false && config.polyfills.buffer)) &&\n new ProvidePlugin({\n Buffer: ['buffer', 'Buffer'],\n }),\n ].filter(Boolean),\n\n /**\n * The optimization configuration. This tells Webpack how to optimize the\n * bundle. Most of the time, you won't need to change this, as the default\n * options set by the `mode` option are sufficient.\n */\n optimization: {\n minimize: config.output.minimize,\n\n /**\n * The minimizer to use. We set it to use the `TerserPlugin`.\n */\n minimizer: [\n new TerserPlugin({\n parallel: true,\n }),\n ],\n },\n\n /**\n * The performance configuration. This tells Webpack how to handle\n * performance hints.\n *\n * @see https://webpack.js.org/configuration/performance/\n */\n performance: {\n /**\n * The hints to show. We set it to `false`, so that we don't get\n * performance hints, as they are not relevant for Snaps.\n *\n * @see https://webpack.js.org/configuration/performance/#performancehints\n */\n hints: false,\n },\n\n /**\n * The infrastructure logging configuration. This tells Webpack how to\n * log messages.\n *\n * @see https://webpack.js.org/configuration/infrastructure-logging\n */\n infrastructureLogging: {\n /**\n * The level of logging to use. We set it to `none`, so that we can\n * control the output ourselves.\n */\n level: 'none',\n },\n };\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkK3TSXPMEjs = require('./chunk-K3TSXPME.js');
|
|
4
|
+
|
|
5
|
+
// src/commands/build/implementation.ts
|
|
6
|
+
async function build(config, options) {
|
|
7
|
+
const compiler = await _chunkK3TSXPMEjs.getCompiler.call(void 0, config, options);
|
|
8
|
+
return await new Promise((resolve, reject) => {
|
|
9
|
+
compiler.run((runError) => {
|
|
10
|
+
if (runError) {
|
|
11
|
+
reject(runError);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
compiler.close((closeError) => {
|
|
15
|
+
if (closeError) {
|
|
16
|
+
reject(closeError);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
resolve();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
exports.build = build;
|
|
28
|
+
//# sourceMappingURL=chunk-KZFWI73A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/build/implementation.ts"],"names":[],"mappings":";;;;;AAWA,eAAsB,MACpB,QACA,SACA;AACA,QAAM,WAAW,MAAM,YAAY,QAAQ,OAAO;AAClD,SAAO,MAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAClD,aAAS,IAAI,CAAC,aAAa;AACzB,UAAI,UAAU;AACZ,eAAO,QAAQ;AACf;AAAA,MACF;AAEA,eAAS,MAAM,CAAC,eAAe;AAC7B,YAAI,YAAY;AACd,iBAAO,UAAU;AACjB;AAAA,QACF;AAEA,gBAAQ;AAAA,MACV,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH","sourcesContent":["import type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle. This uses Webpack to build the 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.\n */\nexport async function build(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, options);\n return await new Promise<void>((resolve, reject) => {\n compiler.run((runError) => {\n if (runError) {\n reject(runError);\n return;\n }\n\n compiler.close((closeError) => {\n if (closeError) {\n reject(closeError);\n return;\n }\n\n resolve();\n });\n });\n });\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/utils/cli.ts
|
|
2
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
3
|
+
var CONFIG_FILE = "snap.config.js";
|
|
4
|
+
var TS_CONFIG_FILE = "snap.config.ts";
|
|
5
|
+
var pathArguments = /* @__PURE__ */ new Set([
|
|
6
|
+
"src",
|
|
7
|
+
"s",
|
|
8
|
+
"dist",
|
|
9
|
+
"d",
|
|
10
|
+
"bundle",
|
|
11
|
+
"b",
|
|
12
|
+
"root",
|
|
13
|
+
"r"
|
|
14
|
+
]);
|
|
15
|
+
function sanitizeInputs(argv) {
|
|
16
|
+
Object.keys(argv).forEach((key) => {
|
|
17
|
+
if (typeof argv[key] === "string") {
|
|
18
|
+
if (argv[key] === "./") {
|
|
19
|
+
argv[key] = ".";
|
|
20
|
+
}
|
|
21
|
+
if (pathArguments.has(key)) {
|
|
22
|
+
argv[key] = _path2.default.normalize(argv[key]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function trimPathString(pathString) {
|
|
28
|
+
return pathString.replace(/^[./]+|[./]+$/gu, "");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
exports.CONFIG_FILE = CONFIG_FILE; exports.TS_CONFIG_FILE = TS_CONFIG_FILE; exports.sanitizeInputs = sanitizeInputs; exports.trimPathString = trimPathString;
|
|
37
|
+
//# sourceMappingURL=chunk-L5TMG6BQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/cli.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU;AAEV,IAAM,cAAc;AACpB,IAAM,iBAAiB;AAG9B,IAAM,gBAAgB,oBAAI,IAAI;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,eAAe,MAA+B;AAC5D,SAAO,KAAK,IAAI,EAAE,QAAQ,CAAC,QAAQ;AACjC,QAAI,OAAO,KAAK,GAAG,MAAM,UAAU;AAEjC,UAAI,KAAK,GAAG,MAAM,MAAM;AACtB,aAAK,GAAG,IAAI;AAAA,MACd;AAEA,UAAI,cAAc,IAAI,GAAG,GAAG;AAC1B,aAAK,GAAG,IAAI,KAAK,UAAU,KAAK,GAAG,CAAW;AAAA,MAChD;AAAA,IACF;AAAA,EACF,CAAC;AACH;AASO,SAAS,eAAe,YAA4B;AACzD,SAAO,WAAW,QAAQ,mBAAmB,EAAE;AACjD","sourcesContent":["import path from 'path';\n\nexport const CONFIG_FILE = 'snap.config.js';\nexport const TS_CONFIG_FILE = 'snap.config.ts';\n\n// CLI arguments whose values are file paths.\nconst pathArguments = new Set([\n 'src',\n 's',\n 'dist',\n 'd',\n 'bundle',\n 'b',\n 'root',\n 'r',\n]);\n\n/**\n * Sanitizes inputs. Currently normalizes \"./\" paths to \".\".\n * Yargs handles other path normalization as specified in builders.\n *\n * @param argv - Arguments as an object generated by yargs.\n */\nexport function sanitizeInputs(argv: Record<string, unknown>) {\n Object.keys(argv).forEach((key) => {\n if (typeof argv[key] === 'string') {\n // Node's path.normalize() does not do this\n if (argv[key] === './') {\n argv[key] = '.';\n }\n\n if (pathArguments.has(key)) {\n argv[key] = path.normalize(argv[key] as string);\n }\n }\n });\n}\n\n/**\n * Trims leading and trailing periods \".\" and forward slashes \"/\" from the\n * given path string.\n *\n * @param pathString - The path string to trim.\n * @returns The trimmed path string.\n */\nexport function trimPathString(pathString: string): string {\n return pathString.replace(/^[./]+|[./]+$/gu, '');\n}\n"]}
|