@metamask/snaps-cli 6.3.1 → 6.3.3
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 +14 -1
- package/dist/__fixtures__/configs/cjs.cjs +9 -0
- package/dist/__fixtures__/configs/cjs.cjs.map +1 -0
- package/dist/__fixtures__/configs/cjs.d.cts +2 -0
- package/dist/__fixtures__/configs/cjs.d.cts.map +1 -0
- package/dist/__fixtures__/configs/cjs.d.mts +2 -0
- package/dist/__fixtures__/configs/cjs.d.mts.map +1 -0
- package/dist/__fixtures__/configs/cjs.mjs +8 -0
- package/dist/__fixtures__/configs/cjs.mjs.map +1 -0
- package/dist/__fixtures__/configs/esm.cjs +7 -0
- package/dist/__fixtures__/configs/esm.cjs.map +1 -0
- package/dist/__fixtures__/configs/esm.d.cts +4 -0
- package/dist/__fixtures__/configs/esm.d.cts.map +1 -0
- package/dist/__fixtures__/configs/esm.d.mts +4 -0
- package/dist/__fixtures__/configs/esm.d.mts.map +1 -0
- package/dist/__fixtures__/configs/esm.mjs +5 -0
- package/dist/__fixtures__/configs/esm.mjs.map +1 -0
- package/dist/__fixtures__/configs/invalid.cjs +8 -0
- package/dist/__fixtures__/configs/invalid.cjs.map +1 -0
- package/dist/__fixtures__/configs/invalid.d.cts +4 -0
- package/dist/__fixtures__/configs/invalid.d.cts.map +1 -0
- package/dist/__fixtures__/configs/invalid.d.mts +4 -0
- package/dist/__fixtures__/configs/invalid.d.mts.map +1 -0
- package/dist/__fixtures__/configs/invalid.mjs +6 -0
- package/dist/__fixtures__/configs/invalid.mjs.map +1 -0
- package/dist/__fixtures__/configs/javascript/snap.config.cjs +6 -0
- package/dist/__fixtures__/configs/javascript/snap.config.cjs.map +1 -0
- package/dist/__fixtures__/configs/javascript/snap.config.d.cts +2 -0
- package/dist/__fixtures__/configs/javascript/snap.config.d.cts.map +1 -0
- package/dist/__fixtures__/configs/javascript/snap.config.d.mts +2 -0
- package/dist/__fixtures__/configs/javascript/snap.config.d.mts.map +1 -0
- package/dist/__fixtures__/configs/javascript/snap.config.mjs +5 -0
- package/dist/__fixtures__/configs/javascript/snap.config.mjs.map +1 -0
- package/dist/__fixtures__/configs/typescript/snap.config.cjs +7 -0
- package/dist/__fixtures__/configs/typescript/snap.config.cjs.map +1 -0
- package/dist/__fixtures__/configs/typescript/snap.config.d.cts +4 -0
- package/dist/__fixtures__/configs/typescript/snap.config.d.cts.map +1 -0
- package/dist/__fixtures__/configs/typescript/snap.config.d.mts +4 -0
- package/dist/__fixtures__/configs/typescript/snap.config.d.mts.map +1 -0
- package/dist/__fixtures__/configs/typescript/snap.config.mjs +5 -0
- package/dist/__fixtures__/configs/typescript/snap.config.mjs.map +1 -0
- package/dist/builders.cjs +132 -0
- package/dist/builders.cjs.map +1 -0
- package/dist/{types/builders.d.ts → builders.d.cts} +2 -1
- package/dist/builders.d.cts.map +1 -0
- package/dist/builders.d.mts +9 -0
- package/dist/builders.d.mts.map +1 -0
- package/dist/builders.mjs +127 -8
- package/dist/builders.mjs.map +1 -1
- package/dist/cli.cjs +71 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/{types/cli.d.ts → cli.d.cts} +1 -0
- package/dist/cli.d.cts.map +1 -0
- package/dist/cli.d.mts +16 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +69 -20
- package/dist/cli.mjs.map +1 -1
- package/dist/commands/build/build.cjs +53 -0
- package/dist/commands/build/build.cjs.map +1 -0
- package/dist/{types/commands/build/build.d.ts → commands/build/build.d.cts} +3 -1
- package/dist/commands/build/build.d.cts.map +1 -0
- package/dist/commands/build/build.d.mts +12 -0
- package/dist/commands/build/build.d.mts.map +1 -0
- package/dist/commands/build/build.mjs +48 -28
- package/dist/commands/build/build.mjs.map +1 -1
- package/dist/commands/build/implementation.cjs +31 -0
- package/dist/commands/build/implementation.cjs.map +1 -0
- package/dist/{types/commands/build/implementation.d.ts → commands/build/implementation.d.cts} +3 -2
- package/dist/commands/build/implementation.d.cts.map +1 -0
- package/dist/commands/build/implementation.d.mts +11 -0
- package/dist/commands/build/implementation.d.mts.map +1 -0
- package/dist/commands/build/implementation.mjs +26 -27
- package/dist/commands/build/implementation.mjs.map +1 -1
- package/dist/commands/build/index.cjs +44 -0
- package/dist/commands/build/index.cjs.map +1 -0
- package/dist/{types/commands/eval/index.d.ts → commands/build/index.d.cts} +4 -3
- package/dist/commands/build/index.d.cts.map +1 -0
- package/dist/{types/commands/manifest/index.d.ts → commands/build/index.d.mts} +4 -3
- package/dist/commands/build/index.d.mts.map +1 -0
- package/dist/commands/build/index.mjs +23 -31
- package/dist/commands/build/index.mjs.map +1 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs +10 -0
- package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs.map +1 -0
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts +4 -0
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts.map +1 -0
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts +4 -0
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts.map +1 -0
- package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs +8 -0
- package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs.map +1 -0
- package/dist/commands/eval/__test__/browserify/good/snap.config.cjs +10 -0
- package/dist/commands/eval/__test__/browserify/good/snap.config.cjs.map +1 -0
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts +4 -0
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts.map +1 -0
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts +4 -0
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts.map +1 -0
- package/dist/commands/eval/__test__/browserify/good/snap.config.mjs +8 -0
- package/dist/commands/eval/__test__/browserify/good/snap.config.mjs.map +1 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs +12 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs.map +1 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.cts +4 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.cts.map +1 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.mts +4 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.mts.map +1 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs +28 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs.map +1 -0
- package/dist/commands/eval/__test__/webpack/good/snap.config.cjs +12 -0
- package/dist/commands/eval/__test__/webpack/good/snap.config.cjs.map +1 -0
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.cts +4 -0
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.cts.map +1 -0
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.mts +4 -0
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.mts.map +1 -0
- package/dist/commands/eval/__test__/webpack/good/snap.config.mjs +28 -0
- package/dist/commands/eval/__test__/webpack/good/snap.config.mjs.map +1 -0
- package/dist/commands/eval/__test__/webpack/snap.config.cjs +8 -0
- package/dist/commands/eval/__test__/webpack/snap.config.cjs.map +1 -0
- package/dist/commands/eval/__test__/webpack/snap.config.d.cts +4 -0
- package/dist/commands/eval/__test__/webpack/snap.config.d.cts.map +1 -0
- package/dist/commands/eval/__test__/webpack/snap.config.d.mts +4 -0
- package/dist/commands/eval/__test__/webpack/snap.config.d.mts.map +1 -0
- package/dist/commands/eval/__test__/webpack/snap.config.mjs +6 -0
- package/dist/commands/eval/__test__/webpack/snap.config.mjs.map +1 -0
- package/dist/commands/eval/eval.cjs +57 -0
- package/dist/commands/eval/eval.cjs.map +1 -0
- package/dist/{types/commands/eval/eval.d.ts → commands/eval/eval.d.cts} +2 -1
- package/dist/commands/eval/eval.d.cts.map +1 -0
- package/dist/commands/eval/eval.d.mts +15 -0
- package/dist/commands/eval/eval.d.mts.map +1 -0
- package/dist/commands/eval/eval.mjs +52 -17
- package/dist/commands/eval/eval.mjs.map +1 -1
- package/dist/commands/eval/implementation.cjs +30 -0
- package/dist/commands/eval/implementation.cjs.map +1 -0
- package/dist/{types/commands/eval/implementation.d.ts → commands/eval/implementation.d.cts} +2 -0
- package/dist/commands/eval/implementation.d.cts.map +1 -0
- package/dist/commands/eval/implementation.d.mts +11 -0
- package/dist/commands/eval/implementation.d.mts.map +1 -0
- package/dist/commands/eval/implementation.mjs +26 -8
- package/dist/commands/eval/implementation.mjs.map +1 -1
- package/dist/commands/eval/index.cjs +35 -0
- package/dist/commands/eval/index.cjs.map +1 -0
- package/dist/commands/eval/index.d.cts +11 -0
- package/dist/commands/eval/index.d.cts.map +1 -0
- package/dist/commands/eval/index.d.mts +11 -0
- package/dist/commands/eval/index.d.mts.map +1 -0
- package/dist/commands/eval/index.mjs +14 -20
- package/dist/commands/eval/index.mjs.map +1 -1
- package/dist/commands/index.cjs +19 -0
- package/dist/commands/index.cjs.map +1 -0
- package/dist/{types/commands/index.d.ts → commands/index.d.cts} +2 -1
- package/dist/commands/index.d.cts.map +1 -0
- package/dist/commands/index.d.mts +9 -0
- package/dist/commands/index.d.mts.map +1 -0
- package/dist/commands/index.mjs +13 -38
- package/dist/commands/index.mjs.map +1 -1
- package/dist/commands/manifest/implementation.cjs +64 -0
- package/dist/commands/manifest/implementation.cjs.map +1 -0
- package/dist/{types/commands/manifest/implementation.d.ts → commands/manifest/implementation.d.cts} +3 -1
- package/dist/commands/manifest/implementation.d.cts.map +1 -0
- package/dist/commands/manifest/implementation.d.mts +14 -0
- package/dist/commands/manifest/implementation.d.mts.map +1 -0
- package/dist/commands/manifest/implementation.mjs +60 -16
- package/dist/commands/manifest/implementation.mjs.map +1 -1
- package/dist/commands/manifest/index.cjs +35 -0
- package/dist/commands/manifest/index.cjs.map +1 -0
- package/dist/commands/manifest/index.d.cts +11 -0
- package/dist/commands/manifest/index.d.cts.map +1 -0
- package/dist/commands/manifest/index.d.mts +11 -0
- package/dist/commands/manifest/index.d.mts.map +1 -0
- package/dist/commands/manifest/index.mjs +14 -20
- package/dist/commands/manifest/index.mjs.map +1 -1
- package/dist/commands/manifest/manifest.cjs +57 -0
- package/dist/commands/manifest/manifest.cjs.map +1 -0
- package/dist/{types/commands/manifest/manifest.d.ts → commands/manifest/manifest.d.cts} +2 -1
- package/dist/commands/manifest/manifest.d.cts.map +1 -0
- package/dist/commands/manifest/manifest.d.mts +15 -0
- package/dist/commands/manifest/manifest.d.mts.map +1 -0
- package/dist/commands/manifest/manifest.mjs +52 -17
- package/dist/commands/manifest/manifest.mjs.map +1 -1
- package/dist/commands/serve/index.cjs +19 -0
- package/dist/commands/serve/index.cjs.map +1 -0
- package/dist/{types/commands/serve/index.d.ts → commands/serve/index.d.cts} +3 -2
- package/dist/commands/serve/index.d.cts.map +1 -0
- package/dist/{types/commands/build/index.d.ts → commands/serve/index.d.mts} +3 -3
- package/dist/commands/serve/index.d.mts.map +1 -0
- package/dist/commands/serve/index.mjs +12 -27
- package/dist/commands/serve/index.mjs.map +1 -1
- package/dist/commands/serve/serve.cjs +21 -0
- package/dist/commands/serve/serve.cjs.map +1 -0
- package/dist/{types/commands/serve/serve.d.ts → commands/serve/serve.d.cts} +2 -1
- package/dist/commands/serve/serve.d.cts.map +1 -0
- package/dist/commands/serve/serve.d.mts +17 -0
- package/dist/commands/serve/serve.d.mts.map +1 -0
- package/dist/commands/serve/serve.mjs +16 -27
- package/dist/commands/serve/serve.mjs.map +1 -1
- package/dist/commands/watch/implementation.cjs +38 -0
- package/dist/{chunk-BAEGXYL7.mjs.map → commands/watch/implementation.cjs.map} +1 -1
- package/dist/{types/commands/watch/implementation.d.ts → commands/watch/implementation.d.cts} +4 -3
- package/dist/commands/watch/implementation.d.cts.map +1 -0
- package/dist/commands/watch/implementation.d.mts +15 -0
- package/dist/commands/watch/implementation.d.mts.map +1 -0
- package/dist/commands/watch/implementation.mjs +33 -27
- package/dist/commands/watch/implementation.mjs.map +1 -1
- package/dist/commands/watch/index.cjs +49 -0
- package/dist/commands/watch/index.cjs.map +1 -0
- package/dist/commands/watch/index.d.cts +11 -0
- package/dist/commands/watch/index.d.cts.map +1 -0
- package/dist/commands/watch/index.d.mts +11 -0
- package/dist/commands/watch/index.d.mts.map +1 -0
- package/dist/commands/watch/index.mjs +28 -31
- package/dist/commands/watch/index.mjs.map +1 -1
- package/dist/commands/watch/watch.cjs +49 -0
- package/dist/commands/watch/watch.cjs.map +1 -0
- package/dist/{types/commands/watch/watch.d.ts → commands/watch/watch.d.cts} +2 -1
- package/dist/commands/watch/watch.d.cts.map +1 -0
- package/dist/commands/watch/watch.d.mts +20 -0
- package/dist/commands/watch/watch.d.mts.map +1 -0
- package/dist/commands/watch/watch.mjs +44 -28
- package/dist/commands/watch/watch.mjs.map +1 -1
- package/dist/config.cjs +334 -0
- package/dist/config.cjs.map +1 -0
- package/dist/{types/config.d.ts → config.d.cts} +44 -43
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +821 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +322 -35
- package/dist/config.mjs.map +1 -1
- package/dist/errors.cjs +38 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/{types/errors.d.ts → errors.d.cts} +1 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +26 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +32 -11
- package/dist/errors.mjs.map +1 -1
- package/dist/index.cjs +39 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +4 -44
- package/dist/index.mjs.map +1 -1
- package/dist/main.cjs +24 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.d.cts +3 -0
- package/dist/main.d.cts.map +1 -0
- package/dist/main.d.mts +3 -0
- package/dist/main.d.mts.map +1 -0
- package/dist/main.mjs +15 -46
- package/dist/main.mjs.map +1 -1
- package/dist/structs.cjs +31 -0
- package/dist/structs.cjs.map +1 -0
- package/dist/{types/structs.d.ts → structs.d.cts} +1 -0
- package/dist/structs.d.cts.map +1 -0
- package/dist/structs.d.mts +21 -0
- package/dist/structs.d.mts.map +1 -0
- package/dist/structs.mjs +26 -7
- package/dist/structs.mjs.map +1 -1
- package/dist/utils/cli.cjs +52 -0
- package/dist/utils/cli.cjs.map +1 -0
- package/dist/{types/utils/cli.d.ts → utils/cli.d.cts} +1 -0
- package/dist/utils/cli.d.cts.map +1 -0
- package/dist/utils/cli.d.mts +18 -0
- package/dist/utils/cli.d.mts.map +1 -0
- package/dist/utils/cli.mjs +43 -13
- package/dist/utils/cli.mjs.map +1 -1
- package/dist/utils/errors.cjs +49 -0
- package/dist/utils/errors.cjs.map +1 -0
- package/dist/{types/utils/errors.d.ts → utils/errors.d.cts} +1 -0
- package/dist/utils/errors.d.cts.map +1 -0
- package/dist/utils/errors.d.mts +24 -0
- package/dist/utils/errors.d.mts.map +1 -0
- package/dist/utils/errors.mjs +43 -10
- package/dist/utils/errors.mjs.map +1 -1
- package/dist/utils/index.cjs +23 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +7 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +7 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +6 -46
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/legacy.cjs +53 -0
- package/dist/utils/legacy.cjs.map +1 -0
- package/dist/{types/utils/legacy.d.ts → utils/legacy.d.cts} +2 -1
- package/dist/utils/legacy.d.cts.map +1 -0
- package/dist/utils/legacy.d.mts +28 -0
- package/dist/utils/legacy.d.mts.map +1 -0
- package/dist/utils/legacy.mjs +46 -12
- package/dist/utils/legacy.mjs.map +1 -1
- package/dist/utils/logging.cjs +48 -0
- package/dist/utils/logging.cjs.map +1 -0
- package/dist/{types/utils/logging.d.ts → utils/logging.d.cts} +2 -1
- package/dist/utils/logging.d.cts.map +1 -0
- package/dist/utils/logging.d.mts +23 -0
- package/dist/utils/logging.d.mts.map +1 -0
- package/dist/utils/logging.mjs +42 -11
- package/dist/utils/logging.mjs.map +1 -1
- package/dist/utils/path.cjs +17 -0
- package/dist/utils/path.cjs.map +1 -0
- package/dist/{types/utils/path.d.ts → utils/path.d.cts} +1 -0
- package/dist/utils/path.d.cts.map +1 -0
- package/dist/utils/path.d.mts +10 -0
- package/dist/utils/path.d.mts.map +1 -0
- package/dist/utils/path.mjs +12 -7
- package/dist/utils/path.mjs.map +1 -1
- package/dist/utils/steps.cjs +51 -0
- package/dist/utils/steps.cjs.map +1 -0
- package/dist/{types/utils/steps.d.ts → utils/steps.d.cts} +2 -1
- package/dist/utils/steps.d.cts.map +1 -0
- package/dist/utils/steps.d.mts +18 -0
- package/dist/utils/steps.d.mts.map +1 -0
- package/dist/utils/steps.mjs +51 -10
- package/dist/utils/steps.mjs.map +1 -1
- package/dist/webpack/compiler.cjs +19 -0
- package/dist/webpack/compiler.cjs.map +1 -0
- package/dist/{types/webpack/compiler.d.ts → webpack/compiler.d.cts} +3 -2
- package/dist/webpack/compiler.d.cts.map +1 -0
- package/dist/webpack/compiler.d.mts +11 -0
- package/dist/webpack/compiler.d.mts.map +1 -0
- package/dist/webpack/compiler.mjs +15 -24
- package/dist/webpack/compiler.mjs.map +1 -1
- package/dist/webpack/config.cjs +349 -0
- package/dist/webpack/config.cjs.map +1 -0
- package/dist/{types/webpack/config.d.ts → webpack/config.d.cts} +4 -3
- package/dist/webpack/config.d.cts.map +1 -0
- package/dist/webpack/config.d.mts +38 -0
- package/dist/webpack/config.d.mts.map +1 -0
- package/dist/webpack/config.mjs +349 -23
- package/dist/webpack/config.mjs.map +1 -1
- package/dist/webpack/index.cjs +21 -0
- package/dist/webpack/index.cjs.map +1 -0
- package/dist/webpack/index.d.cts +5 -0
- package/dist/webpack/index.d.cts.map +1 -0
- package/dist/webpack/index.d.mts +5 -0
- package/dist/webpack/index.d.mts.map +1 -0
- package/dist/webpack/index.mjs +4 -43
- package/dist/webpack/index.mjs.map +1 -1
- package/dist/webpack/loaders/browserify.cjs +84 -0
- package/dist/webpack/loaders/browserify.cjs.map +1 -0
- package/dist/{types/webpack/loaders/browserify.d.ts → webpack/loaders/browserify.d.cts} +4 -2
- package/dist/webpack/loaders/browserify.d.cts.map +1 -0
- package/dist/webpack/loaders/browserify.d.mts +18 -0
- package/dist/webpack/loaders/browserify.d.mts.map +1 -0
- package/dist/webpack/loaders/browserify.mjs +86 -17
- package/dist/webpack/loaders/browserify.mjs.map +1 -1
- package/dist/webpack/loaders/function.cjs +45 -0
- package/dist/webpack/loaders/function.cjs.map +1 -0
- package/dist/{types/webpack/loaders/function.d.ts → webpack/loaders/function.d.cts} +2 -1
- package/dist/webpack/loaders/function.d.cts.map +1 -0
- package/dist/webpack/loaders/function.d.mts +35 -0
- package/dist/webpack/loaders/function.d.mts.map +1 -0
- package/dist/webpack/loaders/function.mjs +43 -8
- package/dist/webpack/loaders/function.mjs.map +1 -1
- package/dist/webpack/loaders/index.cjs +26 -0
- package/dist/webpack/loaders/index.cjs.map +1 -0
- package/dist/webpack/loaders/index.d.cts +4 -0
- package/dist/webpack/loaders/index.d.cts.map +1 -0
- package/dist/webpack/loaders/index.d.mts +4 -0
- package/dist/webpack/loaders/index.d.mts.map +1 -0
- package/dist/webpack/loaders/index.mjs +3 -24
- package/dist/webpack/loaders/index.mjs.map +1 -1
- package/dist/webpack/loaders/wasm.cjs +103 -0
- package/dist/webpack/loaders/wasm.cjs.map +1 -0
- package/dist/{types/webpack/loaders/wasm.d.ts → webpack/loaders/wasm.d.cts} +2 -1
- package/dist/webpack/loaders/wasm.d.cts.map +1 -0
- package/dist/webpack/loaders/wasm.d.mts +43 -0
- package/dist/webpack/loaders/wasm.d.mts.map +1 -0
- package/dist/webpack/loaders/wasm.mjs +95 -14
- package/dist/webpack/loaders/wasm.mjs.map +1 -1
- package/dist/webpack/plugins.cjs +277 -0
- package/dist/webpack/plugins.cjs.map +1 -0
- package/dist/{types/webpack/plugins.d.ts → webpack/plugins.d.cts} +3 -2
- package/dist/webpack/plugins.d.cts.map +1 -0
- package/dist/webpack/plugins.d.mts +148 -0
- package/dist/webpack/plugins.d.mts.map +1 -0
- package/dist/webpack/plugins.mjs +270 -27
- package/dist/webpack/plugins.mjs.map +1 -1
- package/dist/webpack/server.cjs +144 -0
- package/dist/webpack/server.cjs.map +1 -0
- package/dist/{types/webpack/server.d.ts → webpack/server.d.cts} +5 -3
- package/dist/webpack/server.d.cts.map +1 -0
- package/dist/webpack/server.d.mts +32 -0
- package/dist/webpack/server.d.mts.map +1 -0
- package/dist/webpack/server.mjs +142 -9
- package/dist/webpack/server.mjs.map +1 -1
- package/dist/webpack/utils.cjs +359 -0
- package/dist/webpack/utils.cjs.map +1 -0
- package/dist/{types/webpack/utils.d.ts → webpack/utils.d.cts} +8 -7
- package/dist/webpack/utils.d.cts.map +1 -0
- package/dist/webpack/utils.d.mts +259 -0
- package/dist/webpack/utils.d.mts.map +1 -0
- package/dist/webpack/utils.mjs +350 -37
- package/dist/webpack/utils.mjs.map +1 -1
- package/package.json +22 -22
- package/dist/builders.js +0 -10
- package/dist/builders.js.map +0 -1
- package/dist/chunk-24QJ2ZUZ.mjs +0 -55
- package/dist/chunk-24QJ2ZUZ.mjs.map +0 -1
- package/dist/chunk-2P3D6FNV.mjs +0 -23
- package/dist/chunk-2P3D6FNV.mjs.map +0 -1
- package/dist/chunk-2ZBAKBVW.js +0 -28
- package/dist/chunk-2ZBAKBVW.js.map +0 -1
- package/dist/chunk-3WWFQLH4.mjs +0 -30
- package/dist/chunk-3WWFQLH4.mjs.map +0 -1
- package/dist/chunk-45LOTCC4.mjs +0 -1
- package/dist/chunk-45LOTCC4.mjs.map +0 -1
- package/dist/chunk-4A5QZUC7.mjs +0 -68
- package/dist/chunk-4A5QZUC7.mjs.map +0 -1
- package/dist/chunk-4JEJ7WKR.js +0 -61
- package/dist/chunk-4JEJ7WKR.js.map +0 -1
- package/dist/chunk-4QUVE3EK.js +0 -53
- package/dist/chunk-4QUVE3EK.js.map +0 -1
- package/dist/chunk-5IN3GGMV.js +0 -68
- package/dist/chunk-5IN3GGMV.js.map +0 -1
- package/dist/chunk-6ABGZTV7.mjs +0 -16
- package/dist/chunk-6ABGZTV7.mjs.map +0 -1
- package/dist/chunk-6EEZHGF5.js +0 -23
- package/dist/chunk-6EEZHGF5.js.map +0 -1
- package/dist/chunk-7H5FH7RY.js +0 -22
- package/dist/chunk-7H5FH7RY.js.map +0 -1
- package/dist/chunk-7RHK2YTB.mjs +0 -32
- package/dist/chunk-7RHK2YTB.mjs.map +0 -1
- package/dist/chunk-AQSQ7YYP.mjs +0 -24
- package/dist/chunk-AQSQ7YYP.mjs.map +0 -1
- package/dist/chunk-AZMQTZXZ.mjs +0 -28
- package/dist/chunk-AZMQTZXZ.mjs.map +0 -1
- package/dist/chunk-B3NNVTA6.js +0 -32
- package/dist/chunk-B3NNVTA6.js.map +0 -1
- package/dist/chunk-BAEGXYL7.mjs +0 -35
- package/dist/chunk-BALQOCUO.js +0 -22
- package/dist/chunk-BALQOCUO.js.map +0 -1
- package/dist/chunk-BYNQODL3.mjs +0 -23
- package/dist/chunk-BYNQODL3.mjs.map +0 -1
- package/dist/chunk-C44RRX3H.js +0 -18
- package/dist/chunk-C44RRX3H.js.map +0 -1
- package/dist/chunk-C46KEPAC.js +0 -37
- package/dist/chunk-C46KEPAC.js.map +0 -1
- package/dist/chunk-CB77QR32.js +0 -52
- package/dist/chunk-CB77QR32.js.map +0 -1
- package/dist/chunk-CZRGAFVI.mjs +0 -28
- package/dist/chunk-CZRGAFVI.mjs.map +0 -1
- package/dist/chunk-D2ZIM5W2.js +0 -370
- package/dist/chunk-D2ZIM5W2.js.map +0 -1
- package/dist/chunk-DBLADLQ4.js +0 -10
- package/dist/chunk-DBLADLQ4.js.map +0 -1
- package/dist/chunk-ERSRIVYH.mjs +0 -64
- package/dist/chunk-ERSRIVYH.mjs.map +0 -1
- package/dist/chunk-G62Q4YO5.js +0 -30
- package/dist/chunk-G62Q4YO5.js.map +0 -1
- package/dist/chunk-HAYK73YO.js +0 -23
- package/dist/chunk-HAYK73YO.js.map +0 -1
- package/dist/chunk-HLQEI6DV.js +0 -54
- package/dist/chunk-HLQEI6DV.js.map +0 -1
- package/dist/chunk-HLSCFGA7.mjs +0 -13
- package/dist/chunk-HLSCFGA7.mjs.map +0 -1
- package/dist/chunk-HOVEQTF3.mjs +0 -346
- package/dist/chunk-HOVEQTF3.mjs.map +0 -1
- package/dist/chunk-JAHNVVLT.mjs +0 -18
- package/dist/chunk-JAHNVVLT.mjs.map +0 -1
- package/dist/chunk-JCVSYVPD.mjs +0 -24
- package/dist/chunk-JCVSYVPD.mjs.map +0 -1
- package/dist/chunk-JL3URCHO.mjs +0 -53
- package/dist/chunk-JL3URCHO.mjs.map +0 -1
- package/dist/chunk-K26BOY6Z.mjs +0 -51
- package/dist/chunk-K26BOY6Z.mjs.map +0 -1
- package/dist/chunk-KLOPX6DO.js +0 -51
- package/dist/chunk-KLOPX6DO.js.map +0 -1
- package/dist/chunk-KWHAT6UJ.mjs +0 -22
- package/dist/chunk-KWHAT6UJ.mjs.map +0 -1
- package/dist/chunk-L72RLBV5.mjs +0 -37
- package/dist/chunk-L72RLBV5.mjs.map +0 -1
- package/dist/chunk-MECBOP7G.js +0 -35
- package/dist/chunk-MECBOP7G.js.map +0 -1
- package/dist/chunk-MR44GPM3.mjs +0 -135
- package/dist/chunk-MR44GPM3.mjs.map +0 -1
- package/dist/chunk-MR5TAGOG.mjs +0 -54
- package/dist/chunk-MR5TAGOG.mjs.map +0 -1
- package/dist/chunk-MUYXNION.js +0 -30
- package/dist/chunk-MUYXNION.js.map +0 -1
- package/dist/chunk-MXOKUCLH.js +0 -347
- package/dist/chunk-MXOKUCLH.js.map +0 -1
- package/dist/chunk-NGS23BTR.js +0 -13
- package/dist/chunk-NGS23BTR.js.map +0 -1
- package/dist/chunk-NOBUMOYX.mjs +0 -61
- package/dist/chunk-NOBUMOYX.mjs.map +0 -1
- package/dist/chunk-NR4OJOGX.mjs +0 -370
- package/dist/chunk-NR4OJOGX.mjs.map +0 -1
- package/dist/chunk-OIFTFHZ4.mjs +0 -30
- package/dist/chunk-OIFTFHZ4.mjs.map +0 -1
- package/dist/chunk-PDYQXXLP.js +0 -30
- package/dist/chunk-PDYQXXLP.js.map +0 -1
- package/dist/chunk-QAM2JJRA.mjs +0 -52
- package/dist/chunk-QAM2JJRA.mjs.map +0 -1
- package/dist/chunk-QHCKVO3P.js +0 -28
- package/dist/chunk-QHCKVO3P.js.map +0 -1
- package/dist/chunk-QMB2ZRWW.js +0 -16
- package/dist/chunk-QMB2ZRWW.js.map +0 -1
- package/dist/chunk-QMD3VO6R.mjs +0 -30
- package/dist/chunk-QMD3VO6R.mjs.map +0 -1
- package/dist/chunk-QRW2GKA3.mjs +0 -347
- package/dist/chunk-QRW2GKA3.mjs.map +0 -1
- package/dist/chunk-R77RJHC5.mjs +0 -44
- package/dist/chunk-R77RJHC5.mjs.map +0 -1
- package/dist/chunk-RANTKN66.js +0 -24
- package/dist/chunk-RANTKN66.js.map +0 -1
- package/dist/chunk-S7UP2YYF.js +0 -135
- package/dist/chunk-S7UP2YYF.js.map +0 -1
- package/dist/chunk-SQXMNT7M.js +0 -326
- package/dist/chunk-SQXMNT7M.js.map +0 -1
- package/dist/chunk-SYRWT2KT.mjs +0 -124
- package/dist/chunk-SYRWT2KT.mjs.map +0 -1
- package/dist/chunk-TDSL55B3.mjs +0 -10
- package/dist/chunk-TDSL55B3.mjs.map +0 -1
- package/dist/chunk-TJ2F3J6X.js +0 -31
- package/dist/chunk-TJ2F3J6X.js.map +0 -1
- package/dist/chunk-U4VFMIGO.js +0 -24
- package/dist/chunk-U4VFMIGO.js.map +0 -1
- package/dist/chunk-V6SYDSWM.mjs +0 -326
- package/dist/chunk-V6SYDSWM.mjs.map +0 -1
- package/dist/chunk-VXOV3ZCB.js +0 -1
- package/dist/chunk-VXOV3ZCB.js.map +0 -1
- package/dist/chunk-X3D3MHWF.js +0 -44
- package/dist/chunk-X3D3MHWF.js.map +0 -1
- package/dist/chunk-X7TESUC7.mjs +0 -22
- package/dist/chunk-X7TESUC7.mjs.map +0 -1
- package/dist/chunk-XGWLFH7Y.js +0 -41
- package/dist/chunk-XGWLFH7Y.js.map +0 -1
- package/dist/chunk-YCOC4VEP.js +0 -346
- package/dist/chunk-YCOC4VEP.js.map +0 -1
- package/dist/chunk-YCYGKEXF.mjs +0 -41
- package/dist/chunk-YCYGKEXF.mjs.map +0 -1
- package/dist/chunk-YGEAZQSC.js +0 -124
- package/dist/chunk-YGEAZQSC.js.map +0 -1
- package/dist/chunk-YQ2E7NEA.js +0 -64
- package/dist/chunk-YQ2E7NEA.js.map +0 -1
- package/dist/chunk-ZAW4ZWQX.mjs +0 -31
- package/dist/chunk-ZAW4ZWQX.mjs.map +0 -1
- package/dist/chunk-ZVUF6JDJ.js +0 -55
- package/dist/chunk-ZVUF6JDJ.js.map +0 -1
- package/dist/cli.js +0 -21
- package/dist/cli.js.map +0 -1
- package/dist/commands/build/build.js +0 -29
- package/dist/commands/build/build.js.map +0 -1
- package/dist/commands/build/implementation.js +0 -28
- package/dist/commands/build/implementation.js.map +0 -1
- package/dist/commands/build/index.js +0 -33
- package/dist/commands/build/index.js.map +0 -1
- package/dist/commands/eval/eval.js +0 -18
- package/dist/commands/eval/eval.js.map +0 -1
- package/dist/commands/eval/implementation.js +0 -9
- package/dist/commands/eval/implementation.js.map +0 -1
- package/dist/commands/eval/index.js +0 -22
- package/dist/commands/eval/index.js.map +0 -1
- package/dist/commands/index.js +0 -39
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/manifest/implementation.js +0 -17
- package/dist/commands/manifest/implementation.js.map +0 -1
- package/dist/commands/manifest/index.js +0 -22
- package/dist/commands/manifest/index.js.map +0 -1
- package/dist/commands/manifest/manifest.js +0 -18
- package/dist/commands/manifest/manifest.js.map +0 -1
- package/dist/commands/serve/index.js +0 -29
- package/dist/commands/serve/index.js.map +0 -1
- package/dist/commands/serve/serve.js +0 -28
- package/dist/commands/serve/serve.js.map +0 -1
- package/dist/commands/watch/implementation.js +0 -28
- package/dist/commands/watch/implementation.js.map +0 -1
- package/dist/commands/watch/index.js +0 -33
- package/dist/commands/watch/index.js.map +0 -1
- package/dist/commands/watch/watch.js +0 -29
- package/dist/commands/watch/watch.js.map +0 -1
- package/dist/config.js +0 -36
- package/dist/config.js.map +0 -1
- package/dist/errors.js +0 -12
- package/dist/errors.js.map +0 -1
- package/dist/index.js +0 -45
- package/dist/index.js.map +0 -1
- package/dist/main.js +0 -50
- package/dist/main.js.map +0 -1
- package/dist/structs.js +0 -8
- package/dist/structs.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/__fixtures__/configs/cjs.d.ts +0 -1
- package/dist/types/__fixtures__/configs/esm.d.ts +0 -3
- package/dist/types/__fixtures__/configs/invalid.d.ts +0 -3
- package/dist/types/__fixtures__/configs/javascript/snap.config.d.ts +0 -0
- package/dist/types/__fixtures__/configs/typescript/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/browserify/bad/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/browserify/good/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/webpack/bad/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/webpack/good/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/webpack/snap.config.d.ts +0 -3
- package/dist/types/commands/watch/index.d.ts +0 -10
- package/dist/types/index.d.ts +0 -5
- package/dist/types/main.d.ts +0 -2
- package/dist/types/utils/index.d.ts +0 -6
- package/dist/types/webpack/index.d.ts +0 -4
- package/dist/types/webpack/loaders/index.d.ts +0 -3
- package/dist/types/yargs.d.js +0 -1
- package/dist/types/yargs.d.js.map +0 -1
- package/dist/types/yargs.d.mjs +0 -1
- package/dist/types/yargs.d.mjs.map +0 -1
- package/dist/utils/cli.js +0 -14
- package/dist/utils/cli.js.map +0 -1
- package/dist/utils/errors.js +0 -11
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/index.js +0 -47
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/legacy.js +0 -13
- package/dist/utils/legacy.js.map +0 -1
- package/dist/utils/logging.js +0 -12
- package/dist/utils/logging.js.map +0 -1
- package/dist/utils/path.js +0 -8
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/steps.js +0 -11
- package/dist/utils/steps.js.map +0 -1
- package/dist/webpack/compiler.js +0 -25
- package/dist/webpack/compiler.js.map +0 -1
- package/dist/webpack/config.js +0 -24
- package/dist/webpack/config.js.map +0 -1
- package/dist/webpack/index.js +0 -44
- package/dist/webpack/index.js.map +0 -1
- package/dist/webpack/loaders/browserify.js +0 -19
- package/dist/webpack/loaders/browserify.js.map +0 -1
- package/dist/webpack/loaders/function.js +0 -10
- package/dist/webpack/loaders/function.js.map +0 -1
- package/dist/webpack/loaders/index.js +0 -25
- package/dist/webpack/loaders/index.js.map +0 -1
- package/dist/webpack/loaders/wasm.js +0 -16
- package/dist/webpack/loaders/wasm.js.map +0 -1
- package/dist/webpack/plugins.js +0 -29
- package/dist/webpack/plugins.js.map +0 -1
- package/dist/webpack/server.js +0 -10
- package/dist/webpack/server.js.map +0 -1
- package/dist/webpack/utils.js +0 -39
- package/dist/webpack/utils.js.map +0 -1
package/dist/chunk-MXOKUCLH.js
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkYCOC4VEPjs = require('./chunk-YCOC4VEP.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkSQXMNT7Mjs = require('./chunk-SQXMNT7M.js');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _chunkQHCKVO3Pjs = require('./chunk-QHCKVO3P.js');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _chunkYQ2E7NEAjs = require('./chunk-YQ2E7NEA.js');
|
|
22
|
-
|
|
23
|
-
// src/webpack/config.ts
|
|
24
|
-
var _snapswebpackplugin = require('@metamask/snaps-webpack-plugin'); var _snapswebpackplugin2 = _interopRequireDefault(_snapswebpackplugin);
|
|
25
|
-
var _path = require('path');
|
|
26
|
-
var _terserwebpackplugin = require('terser-webpack-plugin'); var _terserwebpackplugin2 = _interopRequireDefault(_terserwebpackplugin);
|
|
27
|
-
var _webpack = require('webpack');
|
|
28
|
-
async function getDefaultConfiguration(config, options = {
|
|
29
|
-
evaluate: config.evaluate
|
|
30
|
-
}) {
|
|
31
|
-
const spinnerText = options.spinner?.text;
|
|
32
|
-
const builtInResolver = config.stats.builtIns && new (0, _chunkYCOC4VEPjs.SnapsBuiltInResolver)(config.stats.builtIns, options.spinner);
|
|
33
|
-
return {
|
|
34
|
-
/**
|
|
35
|
-
* The target is set to `browserslist` so that Webpack will compile the
|
|
36
|
-
* bundle to support the browsers specified in the `.browserslistrc` file.
|
|
37
|
-
* This Browserslist file contains the browsers that are supported by
|
|
38
|
-
* MetaMask Snaps.
|
|
39
|
-
*
|
|
40
|
-
* @see https://webpack.js.org/configuration/target/
|
|
41
|
-
*/
|
|
42
|
-
target: `browserslist:${_chunkSQXMNT7Mjs.BROWSERSLIST_FILE}`,
|
|
43
|
-
/**
|
|
44
|
-
* The mode is set to `production` by default, so that Webpack will minify
|
|
45
|
-
* and optimize the bundle.
|
|
46
|
-
*
|
|
47
|
-
* @see https://webpack.js.org/configuration/mode/
|
|
48
|
-
*/
|
|
49
|
-
mode: "production",
|
|
50
|
-
/**
|
|
51
|
-
* The entry point is set to the `input` value from the config object.
|
|
52
|
-
*
|
|
53
|
-
* @see https://webpack.js.org/configuration/entry-context/
|
|
54
|
-
*/
|
|
55
|
-
entry: config.input,
|
|
56
|
-
/**
|
|
57
|
-
* The devtool option controls how source maps are generated. We set it to
|
|
58
|
-
* the `sourceMap` value from the config object.
|
|
59
|
-
*
|
|
60
|
-
* @see https://webpack.js.org/configuration/devtool/
|
|
61
|
-
*/
|
|
62
|
-
devtool: _chunkSQXMNT7Mjs.getDevTool.call(void 0, config.sourceMap),
|
|
63
|
-
/**
|
|
64
|
-
* The stats option controls how much information is printed to the console
|
|
65
|
-
* when Webpack is running. We set it to `none` so that we can control the
|
|
66
|
-
* output ourselves.
|
|
67
|
-
*
|
|
68
|
-
* @see https://webpack.js.org/configuration/stats/
|
|
69
|
-
*/
|
|
70
|
-
stats: "none",
|
|
71
|
-
/**
|
|
72
|
-
* The output options.
|
|
73
|
-
*
|
|
74
|
-
* @see https://webpack.js.org/configuration/output/
|
|
75
|
-
*/
|
|
76
|
-
output: {
|
|
77
|
-
/**
|
|
78
|
-
* This indicates whether Webpack should clear the output directory
|
|
79
|
-
* before building. We set it to the `clean` value from the config
|
|
80
|
-
* object.
|
|
81
|
-
*
|
|
82
|
-
* @see https://webpack.js.org/configuration/output/#outputclean
|
|
83
|
-
*/
|
|
84
|
-
clean: config.output.clean,
|
|
85
|
-
/**
|
|
86
|
-
* The filename of the bundle. We set it to the `filename` value from
|
|
87
|
-
* the config object.
|
|
88
|
-
*
|
|
89
|
-
* @see https://webpack.js.org/configuration/output/#outputfilename
|
|
90
|
-
*/
|
|
91
|
-
filename: config.output.filename,
|
|
92
|
-
/**
|
|
93
|
-
* The path to the output directory. We set it to the `path` value from
|
|
94
|
-
* the config object.
|
|
95
|
-
*
|
|
96
|
-
* @see https://webpack.js.org/configuration/output/#outputpath
|
|
97
|
-
*/
|
|
98
|
-
path: config.output.path,
|
|
99
|
-
/**
|
|
100
|
-
* The public path of the bundle. We set it to `/` by default, so that
|
|
101
|
-
* the bundle can be loaded from the root of the server.
|
|
102
|
-
*
|
|
103
|
-
* @see https://webpack.js.org/configuration/output/#outputpublicpath
|
|
104
|
-
*/
|
|
105
|
-
publicPath: "/",
|
|
106
|
-
/**
|
|
107
|
-
* The library configuration. This tells Webpack how to export the
|
|
108
|
-
* bundle.
|
|
109
|
-
*
|
|
110
|
-
* @see https://webpack.js.org/configuration/output/#outputlibrary
|
|
111
|
-
*/
|
|
112
|
-
library: {
|
|
113
|
-
/**
|
|
114
|
-
* This tells Webpack to export the bundle as a CommonJS module. This
|
|
115
|
-
* is necessary for MetaMask Snaps.
|
|
116
|
-
*
|
|
117
|
-
* @see https://webpack.js.org/configuration/output/#outputlibrarytarget
|
|
118
|
-
*/
|
|
119
|
-
type: "commonjs"
|
|
120
|
-
},
|
|
121
|
-
/**
|
|
122
|
-
* The chunk format. This tells Webpack how to export chunks. This is
|
|
123
|
-
* required because we use browserslist to target browsers, but Snaps are
|
|
124
|
-
* not fully compatible with browser APIs (such as `window` and
|
|
125
|
-
* `document`).
|
|
126
|
-
*
|
|
127
|
-
* @see https://webpack.js.org/configuration/output/#outputchunkformat
|
|
128
|
-
*/
|
|
129
|
-
chunkFormat: "commonjs"
|
|
130
|
-
},
|
|
131
|
-
/**
|
|
132
|
-
* The module configuration. This is where we tell Webpack how to handle
|
|
133
|
-
* different types of files.
|
|
134
|
-
*
|
|
135
|
-
* @see https://webpack.js.org/configuration/module/
|
|
136
|
-
*/
|
|
137
|
-
module: {
|
|
138
|
-
rules: [
|
|
139
|
-
{
|
|
140
|
-
test: /\.(js|jsx|mjs|cjs|ts|tsx)$/u,
|
|
141
|
-
exclude: /node_modules/u,
|
|
142
|
-
use: await _chunkSQXMNT7Mjs.getDefaultLoader.call(void 0, config)
|
|
143
|
-
},
|
|
144
|
-
/**
|
|
145
|
-
* This allows importing modules that uses `.js` and not `.mjs` for the
|
|
146
|
-
* ES build.
|
|
147
|
-
*
|
|
148
|
-
* @see https://webpack.js.org/configuration/module/#resolvefullyspecified
|
|
149
|
-
*/
|
|
150
|
-
{
|
|
151
|
-
test: /\.m?js$/u,
|
|
152
|
-
resolve: {
|
|
153
|
-
fullySpecified: false
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* This allows importing `.svg` files as a string.
|
|
158
|
-
*/
|
|
159
|
-
config.features.images && {
|
|
160
|
-
test: /\.svg$/u,
|
|
161
|
-
// `asset/source` returns the source as a UTF-8 string.
|
|
162
|
-
type: "asset/source"
|
|
163
|
-
},
|
|
164
|
-
/**
|
|
165
|
-
* This allows importing `.png` files as a data URL.
|
|
166
|
-
*/
|
|
167
|
-
config.features.images && {
|
|
168
|
-
test: /\.png$/u,
|
|
169
|
-
type: "asset/inline",
|
|
170
|
-
generator: {
|
|
171
|
-
dataUrl: _chunkSQXMNT7Mjs.getImageSVG.bind(null, "image/png")
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* This allows importing `.jpe?g` files as a data URL.
|
|
176
|
-
*/
|
|
177
|
-
config.features.images && {
|
|
178
|
-
test: /\.jpe?g$/u,
|
|
179
|
-
type: "asset/inline",
|
|
180
|
-
generator: {
|
|
181
|
-
dataUrl: _chunkSQXMNT7Mjs.getImageSVG.bind(null, "image/jpeg")
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
config.experimental.wasm && {
|
|
185
|
-
test: /\.wasm$/u,
|
|
186
|
-
use: _chunkQHCKVO3Pjs.getFunctionLoader.call(void 0, _chunkYQ2E7NEAjs.wasm_default, {})
|
|
187
|
-
}
|
|
188
|
-
]
|
|
189
|
-
},
|
|
190
|
-
/**
|
|
191
|
-
* The resolve configuration. This tells Webpack how to resolve imports.
|
|
192
|
-
* We set it to resolve `.js` and `.ts` files.
|
|
193
|
-
*
|
|
194
|
-
* @see https://webpack.js.org/configuration/resolve/
|
|
195
|
-
*/
|
|
196
|
-
resolve: {
|
|
197
|
-
/**
|
|
198
|
-
* The extensions to resolve. We set it to resolve `.(c|m)?jsx?` and
|
|
199
|
-
* `.tsx?` files.
|
|
200
|
-
*/
|
|
201
|
-
extensions: [".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx"],
|
|
202
|
-
/**
|
|
203
|
-
* The fallback options. This tells Webpack how to handle imports that
|
|
204
|
-
* aren't resolved. By default, we set Node.js built-ins to `false`, so
|
|
205
|
-
* that they are ignored.
|
|
206
|
-
*/
|
|
207
|
-
fallback: _chunkSQXMNT7Mjs.getFallbacks.call(void 0, config.polyfills),
|
|
208
|
-
/**
|
|
209
|
-
* The plugins to use. We use the {@link SnapsBuiltInResolver} to show
|
|
210
|
-
* warnings about using Node.js built-ins, when no fallback is specified.
|
|
211
|
-
*/
|
|
212
|
-
plugins: [builtInResolver]
|
|
213
|
-
},
|
|
214
|
-
/**
|
|
215
|
-
* The plugins to use.
|
|
216
|
-
*
|
|
217
|
-
* @see https://webpack.js.org/configuration/plugins/
|
|
218
|
-
*/
|
|
219
|
-
plugins: [
|
|
220
|
-
/**
|
|
221
|
-
* The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates
|
|
222
|
-
* the manifest file, and evaluates the bundle in SES. While not strictly
|
|
223
|
-
* required, it's highly recommended to use this plugin.
|
|
224
|
-
*/
|
|
225
|
-
new (0, _snapswebpackplugin2.default)({
|
|
226
|
-
manifestPath: config.manifest.path,
|
|
227
|
-
writeManifest: config.manifest.update,
|
|
228
|
-
eval: !options.watch && options.evaluate
|
|
229
|
-
}),
|
|
230
|
-
/**
|
|
231
|
-
* The `SnapsStatsPlugin` is a Webpack plugin that handles the stats
|
|
232
|
-
* output. It's used to show the stats in the terminal, in a format that
|
|
233
|
-
* is easy to read.
|
|
234
|
-
*/
|
|
235
|
-
new (0, _chunkYCOC4VEPjs.SnapsStatsPlugin)({ verbose: config.stats.verbose }, options.spinner),
|
|
236
|
-
/**
|
|
237
|
-
* The `DefinePlugin` is a Webpack plugin that adds static values to the
|
|
238
|
-
* bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`
|
|
239
|
-
* environment variables, as well as any custom environment
|
|
240
|
-
* variables (as `process.env`).
|
|
241
|
-
*/
|
|
242
|
-
new (0, _webpack.DefinePlugin)(_chunkSQXMNT7Mjs.getEnvironmentVariables.call(void 0, config.environment)),
|
|
243
|
-
/**
|
|
244
|
-
* The `ProgressPlugin` is a Webpack plugin that logs the progress of
|
|
245
|
-
* the build. We set it to log the progress to the spinner.
|
|
246
|
-
*/
|
|
247
|
-
new (0, _webpack.ProgressPlugin)({
|
|
248
|
-
handler: _chunkSQXMNT7Mjs.getProgressHandler.call(void 0, options.spinner, spinnerText)
|
|
249
|
-
}),
|
|
250
|
-
/**
|
|
251
|
-
* The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a
|
|
252
|
-
* warning when the bundle is potentially incompatible with MetaMask
|
|
253
|
-
* Snaps.
|
|
254
|
-
*/
|
|
255
|
-
new (0, _chunkYCOC4VEPjs.SnapsBundleWarningsPlugin)({
|
|
256
|
-
builtInResolver,
|
|
257
|
-
builtIns: Boolean(config.stats.builtIns),
|
|
258
|
-
buffer: config.stats.buffer
|
|
259
|
-
}),
|
|
260
|
-
/**
|
|
261
|
-
* The `WatchPlugin` is a Webpack plugin that adds extra files to watch
|
|
262
|
-
* for changes. This is useful for rebuilding the bundle when the
|
|
263
|
-
* manifest file changes.
|
|
264
|
-
*/
|
|
265
|
-
options.watch && new (0, _chunkYCOC4VEPjs.SnapsWatchPlugin)(
|
|
266
|
-
{
|
|
267
|
-
bundle: _path.resolve.call(void 0, config.output.path, config.output.filename),
|
|
268
|
-
evaluate: options.evaluate,
|
|
269
|
-
files: [config.manifest.path]
|
|
270
|
-
},
|
|
271
|
-
options.spinner
|
|
272
|
-
),
|
|
273
|
-
/**
|
|
274
|
-
* The `ProviderPlugin` is a Webpack plugin that automatically load
|
|
275
|
-
* modules instead of having to import or require them everywhere.
|
|
276
|
-
*/
|
|
277
|
-
(config.polyfills === true || config.polyfills !== false && config.polyfills.buffer) && new (0, _webpack.ProvidePlugin)({
|
|
278
|
-
Buffer: ["buffer", "Buffer"]
|
|
279
|
-
})
|
|
280
|
-
].filter(Boolean),
|
|
281
|
-
/**
|
|
282
|
-
* The optimization configuration. This tells Webpack how to optimize the
|
|
283
|
-
* bundle. Most of the time, you won't need to change this, as the default
|
|
284
|
-
* options set by the `mode` option are sufficient.
|
|
285
|
-
*/
|
|
286
|
-
optimization: {
|
|
287
|
-
minimize: config.output.minimize,
|
|
288
|
-
/**
|
|
289
|
-
* The minimizer to use. We set it to use the `TerserPlugin`.
|
|
290
|
-
*/
|
|
291
|
-
minimizer: [
|
|
292
|
-
new (0, _terserwebpackplugin2.default)({
|
|
293
|
-
parallel: true
|
|
294
|
-
})
|
|
295
|
-
]
|
|
296
|
-
},
|
|
297
|
-
/**
|
|
298
|
-
* The experiments configuration. This configures which Webpack
|
|
299
|
-
* experiments to enable/disable.
|
|
300
|
-
*
|
|
301
|
-
* @see https://webpack.js.org/configuration/experiments
|
|
302
|
-
*/
|
|
303
|
-
experiments: {
|
|
304
|
-
/**
|
|
305
|
-
* Experimental support for top level await.
|
|
306
|
-
*
|
|
307
|
-
* This is unsupported in Snaps and therefore disabled.
|
|
308
|
-
*
|
|
309
|
-
* @see https://webpack.js.org/configuration/experiments/#experimentstoplevelawait
|
|
310
|
-
*/
|
|
311
|
-
topLevelAwait: false
|
|
312
|
-
},
|
|
313
|
-
/**
|
|
314
|
-
* The performance configuration. This tells Webpack how to handle
|
|
315
|
-
* performance hints.
|
|
316
|
-
*
|
|
317
|
-
* @see https://webpack.js.org/configuration/performance/
|
|
318
|
-
*/
|
|
319
|
-
performance: {
|
|
320
|
-
/**
|
|
321
|
-
* The hints to show. We set it to `false`, so that we don't get
|
|
322
|
-
* performance hints, as they are not relevant for Snaps.
|
|
323
|
-
*
|
|
324
|
-
* @see https://webpack.js.org/configuration/performance/#performancehints
|
|
325
|
-
*/
|
|
326
|
-
hints: false
|
|
327
|
-
},
|
|
328
|
-
/**
|
|
329
|
-
* The infrastructure logging configuration. This tells Webpack how to
|
|
330
|
-
* log messages.
|
|
331
|
-
*
|
|
332
|
-
* @see https://webpack.js.org/configuration/infrastructure-logging
|
|
333
|
-
*/
|
|
334
|
-
infrastructureLogging: {
|
|
335
|
-
/**
|
|
336
|
-
* The level of logging to use. We set it to `none`, so that we can
|
|
337
|
-
* control the output ourselves.
|
|
338
|
-
*/
|
|
339
|
-
level: "none"
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
exports.getDefaultConfiguration = getDefaultConfiguration;
|
|
347
|
-
//# sourceMappingURL=chunk-MXOKUCLH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/webpack/config.ts"],"names":[],"mappings":"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","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 getImageSVG,\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|jsx|mjs|cjs|ts|tsx)$/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 /**\n * This allows importing `.svg` files as a string.\n */\n config.features.images && {\n test: /\\.svg$/u,\n // `asset/source` returns the source as a UTF-8 string.\n type: 'asset/source',\n },\n\n /**\n * This allows importing `.png` files as a data URL.\n */\n config.features.images && {\n test: /\\.png$/u,\n type: 'asset/inline',\n generator: {\n dataUrl: getImageSVG.bind(null, 'image/png'),\n },\n },\n\n /**\n * This allows importing `.jpe?g` files as a data URL.\n */\n config.features.images && {\n test: /\\.jpe?g$/u,\n type: 'asset/inline',\n generator: {\n dataUrl: getImageSVG.bind(null, 'image/jpeg'),\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)?jsx?` and\n * `.tsx?` files.\n */\n extensions: ['.js', '.jsx', '.mjs', '.cjs', '.ts', '.tsx'],\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 experiments configuration. This configures which Webpack\n * experiments to enable/disable.\n *\n * @see https://webpack.js.org/configuration/experiments\n */\n experiments: {\n /**\n * Experimental support for top level await.\n *\n * This is unsupported in Snaps and therefore disabled.\n *\n * @see https://webpack.js.org/configuration/experiments/#experimentstoplevelawait\n */\n topLevelAwait: false,\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"]}
|
package/dist/chunk-NGS23BTR.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/structs.ts
|
|
2
|
-
var _superstruct = require('@metamask/superstruct');
|
|
3
|
-
var _path = require('path');
|
|
4
|
-
function file() {
|
|
5
|
-
return _superstruct.coerce.call(void 0, _superstruct.string.call(void 0, ), _superstruct.string.call(void 0, ), (value) => {
|
|
6
|
-
return _path.resolve.call(void 0, process.cwd(), value);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.file = file;
|
|
13
|
-
//# sourceMappingURL=chunk-NGS23BTR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";AAAA,SAAS,QAAQ,cAAc;AAC/B,SAAS,eAAe;AAqBjB,SAAS,OAAO;AACrB,SAAO,OAAO,OAAO,GAAG,OAAO,GAAG,CAAC,UAAU;AAC3C,WAAO,QAAQ,QAAQ,IAAI,GAAG,KAAK;AAAA,EACrC,CAAC;AACH","sourcesContent":["import { coerce, string } from '@metamask/superstruct';\nimport { resolve } from 'path';\n\n/**\n * A wrapper of `superstruct`'s `string` struct that coerces a value to a string\n * and resolves it relative to the current working directory. This is useful\n * for specifying file paths in a configuration file, as it allows the user to\n * use both relative and absolute paths.\n *\n * @returns The `superstruct` struct, which validates that the value is a\n * string, and resolves it relative to the current working directory.\n * @example\n * ```ts\n * const config = struct({\n * file: file(),\n * // ...\n * });\n *\n * const value = create({ file: 'path/to/file' }, config);\n * console.log(value.file); // /process/cwd/path/to/file\n * ```\n */\nexport function file() {\n return coerce(string(), string(), (value) => {\n return resolve(process.cwd(), value);\n });\n}\n"]}
|
package/dist/chunk-NOBUMOYX.mjs
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
build
|
|
3
|
-
} from "./chunk-CZRGAFVI.mjs";
|
|
4
|
-
import {
|
|
5
|
-
evaluate
|
|
6
|
-
} from "./chunk-3WWFQLH4.mjs";
|
|
7
|
-
import {
|
|
8
|
-
executeSteps
|
|
9
|
-
} from "./chunk-YCYGKEXF.mjs";
|
|
10
|
-
import {
|
|
11
|
-
info
|
|
12
|
-
} from "./chunk-ZAW4ZWQX.mjs";
|
|
13
|
-
import {
|
|
14
|
-
CommandError
|
|
15
|
-
} from "./chunk-X7TESUC7.mjs";
|
|
16
|
-
|
|
17
|
-
// src/commands/build/build.ts
|
|
18
|
-
import { isFile } from "@metamask/snaps-utils/node";
|
|
19
|
-
import { resolve as pathResolve } from "path";
|
|
20
|
-
var steps = [
|
|
21
|
-
{
|
|
22
|
-
name: "Checking the input file.",
|
|
23
|
-
task: async ({ config }) => {
|
|
24
|
-
const { input } = config;
|
|
25
|
-
if (!await isFile(input)) {
|
|
26
|
-
throw new CommandError(
|
|
27
|
-
`Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "Building the snap bundle.",
|
|
34
|
-
task: async ({ config, spinner }) => {
|
|
35
|
-
return await build(config, { evaluate: false, spinner });
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "Evaluating the snap bundle.",
|
|
40
|
-
condition: ({ config }) => config.evaluate,
|
|
41
|
-
task: async ({ config, spinner }) => {
|
|
42
|
-
const path = pathResolve(
|
|
43
|
-
process.cwd(),
|
|
44
|
-
config.output.path,
|
|
45
|
-
config.output.filename
|
|
46
|
-
);
|
|
47
|
-
await evaluate(path);
|
|
48
|
-
info(`Snap bundle evaluated successfully.`, spinner);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
];
|
|
52
|
-
async function buildHandler(config) {
|
|
53
|
-
return await executeSteps(steps, {
|
|
54
|
-
config
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export {
|
|
59
|
-
buildHandler
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=chunk-NOBUMOYX.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/build/build.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\nimport { resolve as pathResolve } from 'path';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { evaluate } from '../eval';\nimport { build } from './implementation';\n\ntype BuildContext = {\n config: ProcessedWebpackConfig;\n};\n\nconst steps: Steps<BuildContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n // We don't evaluate the bundle here, because it's done in a separate\n // step.\n return await build(config, { evaluate: false, spinner });\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n condition: ({ config }) => config.evaluate,\n task: async ({ config, spinner }) => {\n const path = pathResolve(\n process.cwd(),\n config.output.path,\n config.output.filename,\n );\n\n await evaluate(path);\n\n info(`Snap bundle evaluated successfully.`, spinner);\n },\n },\n] as const;\n\n/**\n * Build all files in the given source directory to the given destination\n * directory.\n *\n * This creates the destination directory if it doesn't exist.\n *\n * @param config - The config object.\n */\nexport async function buildHandler(config: ProcessedConfig): Promise<void> {\n return await executeSteps(steps, {\n config,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,WAAW,mBAAmB;AAavC,IAAM,QAA6B;AAAA,EACjC;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,OAAO,MAAM;AAC1B,YAAM,EAAE,MAAM,IAAI;AAElB,UAAI,CAAE,MAAM,OAAO,KAAK,GAAI;AAC1B,cAAM,IAAI;AAAA,UACR,0BAA0B,KAAK;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AAGnC,aAAO,MAAM,MAAM,QAAQ,EAAE,UAAU,OAAO,QAAQ,CAAC;AAAA,IACzD;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO;AAAA,IAClC,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AACnC,YAAM,OAAO;AAAA,QACX,QAAQ,IAAI;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,OAAO,OAAO;AAAA,MAChB;AAEA,YAAM,SAAS,IAAI;AAEnB,WAAK,uCAAuC,OAAO;AAAA,IACrD;AAAA,EACF;AACF;AAUA,eAAsB,aAAa,QAAwC;AACzE,SAAO,MAAM,aAAa,OAAO;AAAA,IAC/B;AAAA,EACF,CAAC;AACH;","names":[]}
|