@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-HLQEI6DV.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkMECBOP7Gjs = require('./chunk-MECBOP7G.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkYGEAZQSCjs = require('./chunk-YGEAZQSC.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkXGWLFH7Yjs = require('./chunk-XGWLFH7Y.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunkTJ2F3J6Xjs = require('./chunk-TJ2F3J6X.js');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkBALQOCUOjs = require('./chunk-BALQOCUO.js');
|
|
16
|
-
|
|
17
|
-
// src/commands/watch/watch.ts
|
|
18
|
-
var _node = require('@metamask/snaps-utils/node');
|
|
19
|
-
var steps = [
|
|
20
|
-
{
|
|
21
|
-
name: "Checking the input file.",
|
|
22
|
-
task: async ({ config }) => {
|
|
23
|
-
const { input } = config;
|
|
24
|
-
if (!await _node.isFile.call(void 0, input)) {
|
|
25
|
-
throw new (0, _chunkBALQOCUOjs.CommandError)(
|
|
26
|
-
`Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: "Starting the development server.",
|
|
33
|
-
condition: ({ config }) => config.server.enabled,
|
|
34
|
-
task: async ({ config, options, spinner }) => {
|
|
35
|
-
const server = _chunkYGEAZQSCjs.getServer.call(void 0, config);
|
|
36
|
-
const { port } = await server.listen(options.port ?? config.server.port);
|
|
37
|
-
_chunkTJ2F3J6Xjs.info.call(void 0, `The server is listening on http://localhost:${port}.`, spinner);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "Building the snap bundle.",
|
|
42
|
-
task: async ({ config, spinner }) => {
|
|
43
|
-
await _chunkMECBOP7Gjs.watch.call(void 0, config, { spinner });
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
];
|
|
47
|
-
async function watchHandler(config, options) {
|
|
48
|
-
await _chunkXGWLFH7Yjs.executeSteps.call(void 0, steps, { config, options });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
exports.watchHandler = watchHandler;
|
|
54
|
-
//# sourceMappingURL=chunk-HLQEI6DV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/watch/watch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AAqBvB,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,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO,OAAO;AAAA,IACzC,MAAM,OAAO,EAAE,QAAQ,SAAS,QAAQ,MAAM;AAC5C,YAAM,SAAS,UAAU,MAAM;AAC/B,YAAM,EAAE,KAAK,IAAI,MAAM,OAAO,OAAO,QAAQ,QAAQ,OAAO,OAAO,IAAI;AAEvE,WAAK,+CAA+C,IAAI,KAAK,OAAO;AAAA,IACtE;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AACnC,YAAM,MAAM,QAAQ,EAAE,QAAQ,CAAC;AAAA,IACjC;AAAA,EACF;AACF;AAYA,eAAsB,aACpB,QACA,SACe;AACf,QAAM,aAAa,OAAO,EAAE,QAAQ,QAAQ,CAAC;AAC/C","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\nimport { watch } from './implementation';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedWebpackConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"]}
|
package/dist/chunk-HLSCFGA7.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/structs.ts
|
|
2
|
-
import { coerce, string } from "@metamask/superstruct";
|
|
3
|
-
import { resolve } from "path";
|
|
4
|
-
function file() {
|
|
5
|
-
return coerce(string(), string(), (value) => {
|
|
6
|
-
return resolve(process.cwd(), value);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
file
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=chunk-HLSCFGA7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/structs.ts"],"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"],"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;","names":[]}
|
package/dist/chunk-HOVEQTF3.mjs
DELETED
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
evaluate
|
|
3
|
-
} from "./chunk-3WWFQLH4.mjs";
|
|
4
|
-
import {
|
|
5
|
-
formatText,
|
|
6
|
-
pluralize
|
|
7
|
-
} from "./chunk-V6SYDSWM.mjs";
|
|
8
|
-
import {
|
|
9
|
-
getErrorMessage
|
|
10
|
-
} from "./chunk-7RHK2YTB.mjs";
|
|
11
|
-
import {
|
|
12
|
-
error,
|
|
13
|
-
info,
|
|
14
|
-
warn
|
|
15
|
-
} from "./chunk-ZAW4ZWQX.mjs";
|
|
16
|
-
import {
|
|
17
|
-
__privateAdd,
|
|
18
|
-
__privateGet,
|
|
19
|
-
__privateMethod,
|
|
20
|
-
__privateSet
|
|
21
|
-
} from "./chunk-R77RJHC5.mjs";
|
|
22
|
-
|
|
23
|
-
// src/webpack/plugins.ts
|
|
24
|
-
import { assert, hasProperty, isObject } from "@metamask/utils";
|
|
25
|
-
import { bold, dim, red, yellow } from "chalk";
|
|
26
|
-
import { isBuiltin } from "module";
|
|
27
|
-
import { WebpackError } from "webpack";
|
|
28
|
-
var _spinner, _getStatsErrorMessage, getStatsErrorMessage_fn;
|
|
29
|
-
var SnapsStatsPlugin = class {
|
|
30
|
-
constructor(options = {
|
|
31
|
-
verbose: false
|
|
32
|
-
}, spinner) {
|
|
33
|
-
/**
|
|
34
|
-
* Get the error message for the given stats error.
|
|
35
|
-
*
|
|
36
|
-
* @param statsError - The stats error.
|
|
37
|
-
* @param color - The color to use for the error message.
|
|
38
|
-
* @returns The error message.
|
|
39
|
-
*/
|
|
40
|
-
__privateAdd(this, _getStatsErrorMessage);
|
|
41
|
-
/**
|
|
42
|
-
* The spinner to use for logging.
|
|
43
|
-
*/
|
|
44
|
-
__privateAdd(this, _spinner, void 0);
|
|
45
|
-
this.options = options;
|
|
46
|
-
__privateSet(this, _spinner, spinner);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Apply the plugin to the Webpack compiler.
|
|
50
|
-
*
|
|
51
|
-
* @param compiler - The Webpack compiler.
|
|
52
|
-
*/
|
|
53
|
-
apply(compiler) {
|
|
54
|
-
compiler.hooks.afterDone.tap(this.constructor.name, (stats) => {
|
|
55
|
-
if (!stats) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const { modules, time, errors, warnings } = stats.toJson();
|
|
59
|
-
assert(modules, "Modules must be defined in stats.");
|
|
60
|
-
assert(time, "Time must be defined in stats.");
|
|
61
|
-
if (errors?.length) {
|
|
62
|
-
const formattedErrors = errors.map((statsError) => __privateMethod(this, _getStatsErrorMessage, getStatsErrorMessage_fn).call(this, statsError)).join("\n\n");
|
|
63
|
-
error(
|
|
64
|
-
`Compiled ${modules.length} ${pluralize(
|
|
65
|
-
modules.length,
|
|
66
|
-
"file"
|
|
67
|
-
)} in ${time}ms with ${errors.length} ${pluralize(
|
|
68
|
-
errors.length,
|
|
69
|
-
"error"
|
|
70
|
-
)}.
|
|
71
|
-
|
|
72
|
-
${formattedErrors}
|
|
73
|
-
`,
|
|
74
|
-
__privateGet(this, _spinner)
|
|
75
|
-
);
|
|
76
|
-
__privateGet(this, _spinner)?.stop();
|
|
77
|
-
process.exitCode = 1;
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (warnings?.length) {
|
|
81
|
-
const formattedWarnings = warnings.map(
|
|
82
|
-
(statsWarning) => __privateMethod(this, _getStatsErrorMessage, getStatsErrorMessage_fn).call(this, statsWarning, yellow)
|
|
83
|
-
).join("\n\n");
|
|
84
|
-
warn(
|
|
85
|
-
`Compiled ${modules.length} ${pluralize(
|
|
86
|
-
modules.length,
|
|
87
|
-
"file"
|
|
88
|
-
)} in ${time}ms with ${warnings.length} ${pluralize(
|
|
89
|
-
warnings.length,
|
|
90
|
-
"warning"
|
|
91
|
-
)}.
|
|
92
|
-
|
|
93
|
-
${formattedWarnings}
|
|
94
|
-
`,
|
|
95
|
-
__privateGet(this, _spinner)
|
|
96
|
-
);
|
|
97
|
-
} else {
|
|
98
|
-
info(
|
|
99
|
-
`Compiled ${modules.length} ${pluralize(
|
|
100
|
-
modules.length,
|
|
101
|
-
"file"
|
|
102
|
-
)} in ${time}ms.`,
|
|
103
|
-
__privateGet(this, _spinner)
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
if (compiler.watchMode) {
|
|
107
|
-
__privateGet(this, _spinner)?.succeed("Done!");
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
_spinner = new WeakMap();
|
|
113
|
-
_getStatsErrorMessage = new WeakSet();
|
|
114
|
-
getStatsErrorMessage_fn = function(statsError, color = red) {
|
|
115
|
-
const baseMessage = this.options.verbose ? getErrorMessage(statsError) : statsError.message;
|
|
116
|
-
const [first, ...rest] = baseMessage.split("\n");
|
|
117
|
-
return [
|
|
118
|
-
color(formatText(`\u2022 ${first}`, 4, 2)),
|
|
119
|
-
...rest.map((message) => formatText(color(message), 4)),
|
|
120
|
-
statsError.details && `
|
|
121
|
-
${formatText(dim(statsError.details), 6)}`
|
|
122
|
-
].filter(Boolean).join("\n");
|
|
123
|
-
};
|
|
124
|
-
var _spinner2, _safeEvaluate, safeEvaluate_fn;
|
|
125
|
-
var SnapsWatchPlugin = class {
|
|
126
|
-
constructor(options, spinner) {
|
|
127
|
-
/**
|
|
128
|
-
* Safely evaluate the bundle at the given path. If an error occurs, it will
|
|
129
|
-
* be logged to the console, rather than throwing an error.
|
|
130
|
-
*
|
|
131
|
-
* This function should never throw an error.
|
|
132
|
-
*
|
|
133
|
-
* @param bundlePath - The path to the bundle.
|
|
134
|
-
*/
|
|
135
|
-
__privateAdd(this, _safeEvaluate);
|
|
136
|
-
/**
|
|
137
|
-
* The spinner to use for logging.
|
|
138
|
-
*/
|
|
139
|
-
__privateAdd(this, _spinner2, void 0);
|
|
140
|
-
this.options = options;
|
|
141
|
-
__privateSet(this, _spinner2, spinner);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Apply the plugin to the Webpack compiler.
|
|
145
|
-
*
|
|
146
|
-
* @param compiler - The Webpack compiler.
|
|
147
|
-
*/
|
|
148
|
-
apply(compiler) {
|
|
149
|
-
compiler.hooks.invalid.tap(this.constructor.name, (file) => {
|
|
150
|
-
__privateGet(this, _spinner2)?.start();
|
|
151
|
-
info(`Changes detected in ${yellow(file)}, recompiling.`, __privateGet(this, _spinner2));
|
|
152
|
-
});
|
|
153
|
-
compiler.hooks.afterEmit.tapPromise(
|
|
154
|
-
this.constructor.name,
|
|
155
|
-
async ({ fileDependencies }) => {
|
|
156
|
-
this.options.files?.forEach(
|
|
157
|
-
fileDependencies.add.bind(fileDependencies)
|
|
158
|
-
);
|
|
159
|
-
if (this.options.bundle && this.options.evaluate) {
|
|
160
|
-
await __privateMethod(this, _safeEvaluate, safeEvaluate_fn).call(this, this.options.bundle);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
_spinner2 = new WeakMap();
|
|
167
|
-
_safeEvaluate = new WeakSet();
|
|
168
|
-
safeEvaluate_fn = async function(bundlePath) {
|
|
169
|
-
try {
|
|
170
|
-
await evaluate(bundlePath);
|
|
171
|
-
info(`Snap bundle evaluated successfully.`, __privateGet(this, _spinner2));
|
|
172
|
-
} catch (evaluateError) {
|
|
173
|
-
error(evaluateError.message, __privateGet(this, _spinner2));
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
var _source, _spinner3;
|
|
177
|
-
var SnapsBuiltInResolver = class {
|
|
178
|
-
constructor(options = {
|
|
179
|
-
ignore: []
|
|
180
|
-
}, spinner) {
|
|
181
|
-
/**
|
|
182
|
-
* The built-in modules that have been imported, but not resolved.
|
|
183
|
-
*/
|
|
184
|
-
this.unresolvedModules = /* @__PURE__ */ new Set();
|
|
185
|
-
/**
|
|
186
|
-
* The name of the resolver hook to tap into.
|
|
187
|
-
*/
|
|
188
|
-
__privateAdd(this, _source, "described-resolve");
|
|
189
|
-
/**
|
|
190
|
-
* The spinner to use for logging.
|
|
191
|
-
*/
|
|
192
|
-
__privateAdd(this, _spinner3, void 0);
|
|
193
|
-
this.options = options;
|
|
194
|
-
__privateSet(this, _spinner3, spinner);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Apply the plugin to the Webpack resolver.
|
|
198
|
-
*
|
|
199
|
-
* @param resolver - The Webpack resolver.
|
|
200
|
-
*/
|
|
201
|
-
apply(resolver) {
|
|
202
|
-
resolver.getHook(__privateGet(this, _source)).tapAsync(
|
|
203
|
-
this.constructor.name,
|
|
204
|
-
({ module: isModule, request }, _, callback) => {
|
|
205
|
-
if (!isModule || !request) {
|
|
206
|
-
return callback();
|
|
207
|
-
}
|
|
208
|
-
const baseRequest = request.split("/")[0];
|
|
209
|
-
if (isBuiltin(baseRequest) && !this.options.ignore?.includes(baseRequest)) {
|
|
210
|
-
const fallback = resolver.options.fallback.find(
|
|
211
|
-
({ name }) => name === baseRequest
|
|
212
|
-
);
|
|
213
|
-
if (fallback && !fallback.alias) {
|
|
214
|
-
this.unresolvedModules.add(baseRequest);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return callback();
|
|
218
|
-
}
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
_source = new WeakMap();
|
|
223
|
-
_spinner3 = new WeakMap();
|
|
224
|
-
var _checkBuiltIns, checkBuiltIns_fn, _isProvidePlugin, isProvidePlugin_fn, _checkBuffer, checkBuffer_fn;
|
|
225
|
-
var SnapsBundleWarningsPlugin = class {
|
|
226
|
-
constructor(options = {
|
|
227
|
-
buffer: true,
|
|
228
|
-
builtIns: true
|
|
229
|
-
}) {
|
|
230
|
-
/**
|
|
231
|
-
* Check if a built-in module is used, but not provided by Webpack's
|
|
232
|
-
* `fallback` configuration.
|
|
233
|
-
*
|
|
234
|
-
* @param compiler - The Webpack compiler.
|
|
235
|
-
*/
|
|
236
|
-
__privateAdd(this, _checkBuiltIns);
|
|
237
|
-
/**
|
|
238
|
-
* Check if the given instance is a `ProvidePlugin`. This is not guaranteed to
|
|
239
|
-
* be accurate, but it's good enough for our purposes. If we were to use
|
|
240
|
-
* `instanceof` instead, it might not work if multiple versions of Webpack are
|
|
241
|
-
* installed.
|
|
242
|
-
*
|
|
243
|
-
* @param instance - The instance to check.
|
|
244
|
-
* @returns Whether the instance is a `ProvidePlugin`, i.e., whether it's an
|
|
245
|
-
* object with the name `ProvidePlugin` and a `definitions` property.
|
|
246
|
-
*/
|
|
247
|
-
__privateAdd(this, _isProvidePlugin);
|
|
248
|
-
/**
|
|
249
|
-
* Check if the `Buffer` global is used, but not provided by Webpack's
|
|
250
|
-
* `DefinePlugin`.
|
|
251
|
-
*
|
|
252
|
-
* @param compiler - The Webpack compiler.
|
|
253
|
-
*/
|
|
254
|
-
__privateAdd(this, _checkBuffer);
|
|
255
|
-
this.options = options;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Apply the plugin to the Webpack compiler.
|
|
259
|
-
*
|
|
260
|
-
* @param compiler - The Webpack compiler.
|
|
261
|
-
*/
|
|
262
|
-
apply(compiler) {
|
|
263
|
-
if (this.options.builtIns) {
|
|
264
|
-
__privateMethod(this, _checkBuiltIns, checkBuiltIns_fn).call(this, compiler);
|
|
265
|
-
}
|
|
266
|
-
if (this.options.buffer) {
|
|
267
|
-
__privateMethod(this, _checkBuffer, checkBuffer_fn).call(this, compiler);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
_checkBuiltIns = new WeakSet();
|
|
272
|
-
checkBuiltIns_fn = function(compiler) {
|
|
273
|
-
compiler.hooks.afterCompile.tap(this.constructor.name, (compilation) => {
|
|
274
|
-
if (!this.options.builtInResolver) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
const { unresolvedModules } = this.options.builtInResolver;
|
|
278
|
-
if (unresolvedModules.size === 0) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const formattedModules = new Array(...unresolvedModules).map((name) => `\u2022 ${name}`).join("\n");
|
|
282
|
-
const webpackError = new WebpackError(
|
|
283
|
-
`The snap attempted to use one or more Node.js builtins, but no browser fallback has been provided. The MetaMask Snaps CLI does not support Node.js builtins by default. If you want to use this module, you must set ${bold(
|
|
284
|
-
"`polyfills`"
|
|
285
|
-
)} to ${bold(
|
|
286
|
-
"`true`"
|
|
287
|
-
)} or an object with the builtins to polyfill as the key and ${bold(
|
|
288
|
-
"`true`"
|
|
289
|
-
)} as the value. To disable this warning, set ${bold(
|
|
290
|
-
"`stats.builtIns`"
|
|
291
|
-
)} to ${bold(
|
|
292
|
-
"`false`"
|
|
293
|
-
)} in your snap config file, or add the module to the ${bold(
|
|
294
|
-
"`stats.builtIns.ignore`"
|
|
295
|
-
)} array.`
|
|
296
|
-
);
|
|
297
|
-
webpackError.details = formattedModules;
|
|
298
|
-
compilation.warnings.push(webpackError);
|
|
299
|
-
});
|
|
300
|
-
};
|
|
301
|
-
_isProvidePlugin = new WeakSet();
|
|
302
|
-
isProvidePlugin_fn = function(instance) {
|
|
303
|
-
return isObject(instance) && instance.constructor.name === "ProvidePlugin" && hasProperty(instance, "definitions");
|
|
304
|
-
};
|
|
305
|
-
_checkBuffer = new WeakSet();
|
|
306
|
-
checkBuffer_fn = function(compiler) {
|
|
307
|
-
const plugin = compiler.options.plugins?.find(
|
|
308
|
-
(instance) => __privateMethod(this, _isProvidePlugin, isProvidePlugin_fn).call(this, instance)
|
|
309
|
-
);
|
|
310
|
-
if (plugin) {
|
|
311
|
-
const { definitions } = plugin;
|
|
312
|
-
if (definitions.Buffer) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
compiler.hooks.compilation.tap(this.constructor.name, (compilation) => {
|
|
317
|
-
compilation.hooks.afterProcessAssets.tap(
|
|
318
|
-
this.constructor.name,
|
|
319
|
-
(assets) => {
|
|
320
|
-
const bufferAssets = Object.entries(assets).filter(([name]) => name.endsWith(".js")).filter(([, asset]) => asset.source().includes("Buffer"));
|
|
321
|
-
if (bufferAssets.length === 0) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
compilation.warnings.push(
|
|
325
|
-
new WebpackError(
|
|
326
|
-
`The snap attempted to use the Node.js Buffer global, which is not supported in the MetaMask Snaps CLI by default. To use the Buffer global, you must polyfill Buffer by setting ${bold(
|
|
327
|
-
"`buffer`"
|
|
328
|
-
)} to ${bold("`true`")} in the ${bold(
|
|
329
|
-
"`polyfills`"
|
|
330
|
-
)} config object in your snap config. To disable this warning, set ${bold(
|
|
331
|
-
"`stats.buffer`"
|
|
332
|
-
)} to ${bold("`false`")} in your snap config file.`
|
|
333
|
-
)
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
);
|
|
337
|
-
});
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
export {
|
|
341
|
-
SnapsStatsPlugin,
|
|
342
|
-
SnapsWatchPlugin,
|
|
343
|
-
SnapsBuiltInResolver,
|
|
344
|
-
SnapsBundleWarningsPlugin
|
|
345
|
-
};
|
|
346
|
-
//# sourceMappingURL=chunk-HOVEQTF3.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/webpack/plugins.ts"],"sourcesContent":["import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { bold, dim, red, yellow } from 'chalk';\nimport { isBuiltin } from 'module';\nimport type { Ora } from 'ora';\nimport type {\n Compiler,\n ProvidePlugin,\n ResolvePluginInstance,\n Resolver,\n StatsError,\n WebpackPluginInstance,\n} from 'webpack';\nimport { WebpackError } from 'webpack';\n\nimport { evaluate } from '../commands/eval';\nimport { error, getErrorMessage, info, warn } from '../utils';\nimport { formatText, pluralize } from './utils';\n\nexport type SnapsStatsPluginOptions = {\n /**\n * Whether to log the verbose stats.\n */\n verbose?: boolean;\n};\n\n/**\n * A plugin that logs the stats after compilation. This is useful for logging\n * the number of files compiled, and the time taken to compile them.\n */\nexport class SnapsStatsPlugin implements WebpackPluginInstance {\n /**\n * The options for the plugin.\n */\n readonly options: SnapsStatsPluginOptions;\n\n /**\n * The spinner to use for logging.\n */\n readonly #spinner?: Ora;\n\n constructor(\n options: SnapsStatsPluginOptions = {\n verbose: false,\n },\n spinner?: Ora,\n ) {\n this.options = options;\n this.#spinner = spinner;\n }\n\n /**\n * Apply the plugin to the Webpack compiler.\n *\n * @param compiler - The Webpack compiler.\n */\n apply(compiler: Compiler) {\n compiler.hooks.afterDone.tap(this.constructor.name, (stats) => {\n if (!stats) {\n return;\n }\n\n const { modules, time, errors, warnings } = stats.toJson();\n\n assert(modules, 'Modules must be defined in stats.');\n assert(time, 'Time must be defined in stats.');\n\n if (errors?.length) {\n const formattedErrors = errors\n .map((statsError) => this.#getStatsErrorMessage(statsError))\n .join('\\n\\n');\n\n error(\n `Compiled ${modules.length} ${pluralize(\n modules.length,\n 'file',\n )} in ${time}ms with ${errors.length} ${pluralize(\n errors.length,\n 'error',\n )}.\\n\\n${formattedErrors}\\n`,\n this.#spinner,\n );\n\n this.#spinner?.stop();\n\n process.exitCode = 1;\n return;\n }\n\n if (warnings?.length) {\n const formattedWarnings = warnings\n .map((statsWarning) =>\n this.#getStatsErrorMessage(statsWarning, yellow),\n )\n .join('\\n\\n');\n\n warn(\n `Compiled ${modules.length} ${pluralize(\n modules.length,\n 'file',\n )} in ${time}ms with ${warnings.length} ${pluralize(\n warnings.length,\n 'warning',\n )}.\\n\\n${formattedWarnings}\\n`,\n this.#spinner,\n );\n } else {\n info(\n `Compiled ${modules.length} ${pluralize(\n modules.length,\n 'file',\n )} in ${time}ms.`,\n this.#spinner,\n );\n }\n\n if (compiler.watchMode) {\n // The spinner may be restarted by the watch plugin, outside of the\n // `executeSteps` flow, so we stop it here just in case.\n this.#spinner?.succeed('Done!');\n }\n });\n }\n\n /**\n * Get the error message for the given stats error.\n *\n * @param statsError - The stats error.\n * @param color - The color to use for the error message.\n * @returns The error message.\n */\n #getStatsErrorMessage(statsError: StatsError, color = red) {\n const baseMessage = this.options.verbose\n ? getErrorMessage(statsError)\n : statsError.message;\n\n const [first, ...rest] = baseMessage.split('\\n');\n\n return [\n color(formatText(`• ${first}`, 4, 2)),\n ...rest.map((message) => formatText(color(message), 4)),\n statsError.details && `\\n${formatText(dim(statsError.details), 6)}`,\n ]\n .filter(Boolean)\n .join('\\n');\n }\n}\n\n/**\n * The options for the {@link SnapsWatchPlugin}.\n */\nexport type SnapsWatchPluginOptions = {\n /**\n * The bundle path. This is the file that will be evaluated, if the `evaluate`\n * option is set.\n */\n bundle?: string;\n\n /**\n * Whether to evaluate the bundle. This only applies if the `bundle` option is\n * set.\n */\n evaluate?: boolean;\n\n /**\n * The extra files to watch.\n */\n files?: string[];\n};\n\n/**\n * A plugin that adds extra files to watch. This is useful for watching files\n * that are not imported by the entry point, such as the `snap.manifest.json`\n * file.\n */\nexport class SnapsWatchPlugin implements WebpackPluginInstance {\n /**\n * The options for the plugin.\n */\n readonly options: SnapsWatchPluginOptions;\n\n /**\n * The spinner to use for logging.\n */\n readonly #spinner?: Ora;\n\n constructor(options: SnapsWatchPluginOptions, spinner?: Ora) {\n this.options = options;\n this.#spinner = spinner;\n }\n\n /**\n * Apply the plugin to the Webpack compiler.\n *\n * @param compiler - The Webpack compiler.\n */\n apply(compiler: Compiler) {\n compiler.hooks.invalid.tap(this.constructor.name, (file) => {\n this.#spinner?.start();\n info(`Changes detected in ${yellow(file)}, recompiling.`, this.#spinner);\n });\n\n compiler.hooks.afterEmit.tapPromise(\n this.constructor.name,\n async ({ fileDependencies }) => {\n this.options.files?.forEach(\n fileDependencies.add.bind(fileDependencies),\n );\n\n if (this.options.bundle && this.options.evaluate) {\n await this.#safeEvaluate(this.options.bundle);\n }\n },\n );\n }\n\n /**\n * Safely evaluate the bundle at the given path. If an error occurs, it will\n * be logged to the console, rather than throwing an error.\n *\n * This function should never throw an error.\n *\n * @param bundlePath - The path to the bundle.\n */\n async #safeEvaluate(bundlePath: string) {\n try {\n await evaluate(bundlePath);\n info(`Snap bundle evaluated successfully.`, this.#spinner);\n } catch (evaluateError) {\n error(evaluateError.message, this.#spinner);\n }\n }\n}\n\n/**\n * The options for the {@link SnapsBuiltInResolver}.\n */\nexport type SnapsBuiltInResolverOptions = {\n /**\n * The built-in modules to ignore.\n */\n ignore?: string[];\n};\n\n/**\n * A plugin that logs a message when a built-in module is not resolved. The\n * MetaMask Snaps CLI does not support built-in modules by default, and this\n * plugin is used to warn the user when they try to import a built-in module,\n * when no fallback is configured.\n */\nexport class SnapsBuiltInResolver implements ResolvePluginInstance {\n /**\n * The built-in modules that have been imported, but not resolved.\n */\n readonly unresolvedModules = new Set<string>();\n\n /**\n * The name of the resolver hook to tap into.\n */\n readonly #source = 'described-resolve';\n\n /**\n * The options for the plugin.\n */\n readonly options: SnapsBuiltInResolverOptions;\n\n /**\n * The spinner to use for logging.\n */\n readonly #spinner?: Ora;\n\n constructor(\n options: SnapsBuiltInResolverOptions = {\n ignore: [],\n },\n spinner?: Ora,\n ) {\n this.options = options;\n this.#spinner = spinner;\n }\n\n /**\n * Apply the plugin to the Webpack resolver.\n *\n * @param resolver - The Webpack resolver.\n */\n apply(resolver: Resolver) {\n resolver\n .getHook(this.#source)\n .tapAsync(\n this.constructor.name,\n ({ module: isModule, request }, _, callback) => {\n if (!isModule || !request) {\n return callback();\n }\n\n const baseRequest = request.split('/')[0];\n if (\n isBuiltin(baseRequest) &&\n !this.options.ignore?.includes(baseRequest)\n ) {\n const fallback = resolver.options.fallback.find(\n ({ name }) => name === baseRequest,\n );\n\n if (fallback && !fallback.alias) {\n this.unresolvedModules.add(baseRequest);\n }\n }\n\n return callback();\n },\n );\n }\n}\n\n/**\n * The options for the {@link SnapsBundleWarningsPlugin}.\n */\nexport type SnapsBundleWarningsPluginOptions = {\n /**\n * The {@link SnapsBuiltInResolver} instance to use for detecting built-in\n * modules.\n */\n builtInResolver?: SnapsBuiltInResolver | false;\n\n /**\n * Whether to show warnings if built-in modules are used, but not provided by\n * Webpack's `fallback` configuration.\n */\n builtIns?: boolean;\n\n /**\n * Whether to show warnings if the `Buffer` global is used, but not provided\n * by Webpack's `DefinePlugin`.\n */\n buffer?: boolean;\n};\n\n/**\n * A plugin that logs a message when:\n *\n * - A built-in module is not resolved. The MetaMask Snaps CLI does not support\n * built-in modules by default, and this plugin is used to warn the user when\n * they try to import a built-in module, when no fallback is configured.\n * - A snap uses the `Buffer` global. The MetaMask Snaps CLI does not support\n * the `Buffer` global by default, and this plugin is used to warn the user when\n * they try to use the `Buffer` global.\n *\n * We use both a resolver and a plugin, because the resolver is used to detect\n * when a built-in module is imported, and the plugin is used to log a single\n * message when the compilation is complete. We can't do everything in a single\n * plugin, because the resolver doesn't have access to the compilation, and the\n * plugin doesn't have access to the resolver.\n */\n\nexport class SnapsBundleWarningsPlugin implements WebpackPluginInstance {\n /**\n * The options for the plugin.\n */\n readonly options: SnapsBundleWarningsPluginOptions;\n\n constructor(\n options: SnapsBundleWarningsPluginOptions = {\n buffer: true,\n builtIns: true,\n },\n ) {\n this.options = options;\n }\n\n /**\n * Apply the plugin to the Webpack compiler.\n *\n * @param compiler - The Webpack compiler.\n */\n apply(compiler: Compiler) {\n if (this.options.builtIns) {\n this.#checkBuiltIns(compiler);\n }\n\n if (this.options.buffer) {\n this.#checkBuffer(compiler);\n }\n }\n\n /**\n * Check if a built-in module is used, but not provided by Webpack's\n * `fallback` configuration.\n *\n * @param compiler - The Webpack compiler.\n */\n #checkBuiltIns(compiler: Compiler) {\n compiler.hooks.afterCompile.tap(this.constructor.name, (compilation) => {\n if (!this.options.builtInResolver) {\n return;\n }\n\n const { unresolvedModules } = this.options.builtInResolver;\n if (unresolvedModules.size === 0) {\n return;\n }\n\n const formattedModules = new Array(...unresolvedModules)\n .map((name) => `• ${name}`)\n .join('\\n');\n\n const webpackError = new WebpackError(\n `The snap attempted to use one or more Node.js builtins, but no browser fallback has been provided. The MetaMask Snaps CLI does not support Node.js builtins by default. If you want to use this module, you must set ${bold(\n '`polyfills`',\n )} to ${bold(\n '`true`',\n )} or an object with the builtins to polyfill as the key and ${bold(\n '`true`',\n )} as the value. To disable this warning, set ${bold(\n '`stats.builtIns`',\n )} to ${bold(\n '`false`',\n )} in your snap config file, or add the module to the ${bold(\n '`stats.builtIns.ignore`',\n )} array.`,\n );\n\n webpackError.details = formattedModules;\n compilation.warnings.push(webpackError);\n });\n }\n\n /**\n * Check if the given instance is a `ProvidePlugin`. This is not guaranteed to\n * be accurate, but it's good enough for our purposes. If we were to use\n * `instanceof` instead, it might not work if multiple versions of Webpack are\n * installed.\n *\n * @param instance - The instance to check.\n * @returns Whether the instance is a `ProvidePlugin`, i.e., whether it's an\n * object with the name `ProvidePlugin` and a `definitions` property.\n */\n #isProvidePlugin(instance: unknown): instance is ProvidePlugin {\n return (\n isObject(instance) &&\n instance.constructor.name === 'ProvidePlugin' &&\n hasProperty(instance, 'definitions')\n );\n }\n\n /**\n * Check if the `Buffer` global is used, but not provided by Webpack's\n * `DefinePlugin`.\n *\n * @param compiler - The Webpack compiler.\n */\n #checkBuffer(compiler: Compiler) {\n const plugin = compiler.options.plugins?.find((instance) =>\n this.#isProvidePlugin(instance),\n ) as ProvidePlugin | undefined;\n\n // If the `ProvidePlugin` is configured to provide `Buffer`, then we don't\n // need to warn the user.\n if (plugin) {\n const { definitions } = plugin;\n if (definitions.Buffer) {\n return;\n }\n }\n\n compiler.hooks.compilation.tap(this.constructor.name, (compilation) => {\n compilation.hooks.afterProcessAssets.tap(\n this.constructor.name,\n (assets) => {\n // Check if assets use `Buffer`.\n const bufferAssets = Object.entries(assets)\n .filter(([name]) => name.endsWith('.js'))\n .filter(([, asset]) => asset.source().includes('Buffer'));\n\n if (bufferAssets.length === 0) {\n return;\n }\n\n compilation.warnings.push(\n new WebpackError(\n `The snap attempted to use the Node.js Buffer global, which is not supported in the MetaMask Snaps CLI by default. To use the Buffer global, you must polyfill Buffer by setting ${bold(\n '`buffer`',\n )} to ${bold('`true`')} in the ${bold(\n '`polyfills`',\n )} config object in your snap config. To disable this warning, set ${bold(\n '`stats.buffer`',\n )} to ${bold('`false`')} in your snap config file.`,\n ),\n );\n },\n );\n });\n }\n}\n"],"mappings":"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","names":["_spinner"]}
|
package/dist/chunk-JAHNVVLT.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getServer
|
|
3
|
-
} from "./chunk-SYRWT2KT.mjs";
|
|
4
|
-
import {
|
|
5
|
-
info
|
|
6
|
-
} from "./chunk-ZAW4ZWQX.mjs";
|
|
7
|
-
|
|
8
|
-
// src/commands/serve/serve.ts
|
|
9
|
-
async function serveHandler(config, options) {
|
|
10
|
-
const server = getServer(config);
|
|
11
|
-
const { port } = await server.listen(options.port);
|
|
12
|
-
info(`The server is listening on http://localhost:${port}.`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
serveHandler
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=chunk-JAHNVVLT.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/serve/serve.ts"],"sourcesContent":["import type { ProcessedConfig } from '../../config';\nimport { info } from '../../utils';\nimport { getServer } from '../../webpack';\n\ntype ServeOptions = {\n /**\n * The port to listen on.\n */\n port: number;\n};\n\n/**\n * Starts a local, static HTTP server on the given port with the given root\n * directory.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function serveHandler(\n config: ProcessedConfig,\n options: ServeOptions,\n): Promise<void> {\n const server = getServer(config);\n\n // If the `configPort` is `0`, the OS will choose a random port for us, so we\n // need to get the port from the server after it starts.\n const { port } = await server.listen(options.port);\n\n info(`The server is listening on http://localhost:${port}.`);\n}\n"],"mappings":";;;;;;;;AAkBA,eAAsB,aACpB,QACA,SACe;AACf,QAAM,SAAS,UAAU,MAAM;AAI/B,QAAM,EAAE,KAAK,IAAI,MAAM,OAAO,OAAO,QAAQ,IAAI;AAEjD,OAAK,+CAA+C,IAAI,GAAG;AAC7D;","names":[]}
|
package/dist/chunk-JCVSYVPD.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
serveHandler
|
|
3
|
-
} from "./chunk-JAHNVVLT.mjs";
|
|
4
|
-
import {
|
|
5
|
-
builders_default
|
|
6
|
-
} from "./chunk-MR44GPM3.mjs";
|
|
7
|
-
|
|
8
|
-
// src/commands/serve/index.ts
|
|
9
|
-
var command = {
|
|
10
|
-
command: ["serve", "s"],
|
|
11
|
-
desc: "Locally serve Snap file(s) for testing",
|
|
12
|
-
builder: (yarg) => {
|
|
13
|
-
yarg.option("root", builders_default.root).option("port", builders_default.port);
|
|
14
|
-
},
|
|
15
|
-
handler: async (argv) => serveHandler(argv.context.config, {
|
|
16
|
-
port: argv.port ?? argv.context.config.server.port
|
|
17
|
-
})
|
|
18
|
-
};
|
|
19
|
-
var serve_default = command;
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
serve_default
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=chunk-JCVSYVPD.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/serve/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { serveHandler } from './serve';\n\nconst command = {\n command: ['serve', 's'],\n desc: 'Locally serve Snap file(s) for testing',\n builder: (yarg: yargs.Argv) => {\n yarg.option('root', builders.root).option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n serveHandler(argv.context.config, {\n port: argv.port ?? argv.context.config.server.port,\n }),\n};\n\nexport default command;\n"],"mappings":";;;;;;;;AAMA,IAAM,UAAU;AAAA,EACd,SAAS,CAAC,SAAS,GAAG;AAAA,EACtB,MAAM;AAAA,EACN,SAAS,CAAC,SAAqB;AAC7B,SAAK,OAAO,QAAQ,iBAAS,IAAI,EAAE,OAAO,QAAQ,iBAAS,IAAI;AAAA,EACjE;AAAA,EACA,SAAS,OAAO,SACd,aAAa,KAAK,QAAQ,QAAQ;AAAA,IAChC,MAAM,KAAK,QAAQ,KAAK,QAAQ,OAAO,OAAO;AAAA,EAChD,CAAC;AACL;AAEA,IAAO,gBAAQ;","names":[]}
|
package/dist/chunk-JL3URCHO.mjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CONFIG_FILE,
|
|
3
|
-
TS_CONFIG_FILE,
|
|
4
|
-
sanitizeInputs,
|
|
5
|
-
trimPathString
|
|
6
|
-
} from "./chunk-L72RLBV5.mjs";
|
|
7
|
-
import {
|
|
8
|
-
getDependencyRegExp,
|
|
9
|
-
processDependencies,
|
|
10
|
-
sanitizeDependencyPaths
|
|
11
|
-
} from "./chunk-QMD3VO6R.mjs";
|
|
12
|
-
import {
|
|
13
|
-
getRelativePath
|
|
14
|
-
} from "./chunk-TDSL55B3.mjs";
|
|
15
|
-
import {
|
|
16
|
-
executeSteps
|
|
17
|
-
} from "./chunk-YCYGKEXF.mjs";
|
|
18
|
-
import {
|
|
19
|
-
getErrorMessage,
|
|
20
|
-
getYargsErrorMessage
|
|
21
|
-
} from "./chunk-7RHK2YTB.mjs";
|
|
22
|
-
import {
|
|
23
|
-
error,
|
|
24
|
-
info,
|
|
25
|
-
warn
|
|
26
|
-
} from "./chunk-ZAW4ZWQX.mjs";
|
|
27
|
-
import {
|
|
28
|
-
__export
|
|
29
|
-
} from "./chunk-R77RJHC5.mjs";
|
|
30
|
-
|
|
31
|
-
// src/utils/index.ts
|
|
32
|
-
var utils_exports = {};
|
|
33
|
-
__export(utils_exports, {
|
|
34
|
-
CONFIG_FILE: () => CONFIG_FILE,
|
|
35
|
-
TS_CONFIG_FILE: () => TS_CONFIG_FILE,
|
|
36
|
-
error: () => error,
|
|
37
|
-
executeSteps: () => executeSteps,
|
|
38
|
-
getDependencyRegExp: () => getDependencyRegExp,
|
|
39
|
-
getErrorMessage: () => getErrorMessage,
|
|
40
|
-
getRelativePath: () => getRelativePath,
|
|
41
|
-
getYargsErrorMessage: () => getYargsErrorMessage,
|
|
42
|
-
info: () => info,
|
|
43
|
-
processDependencies: () => processDependencies,
|
|
44
|
-
sanitizeDependencyPaths: () => sanitizeDependencyPaths,
|
|
45
|
-
sanitizeInputs: () => sanitizeInputs,
|
|
46
|
-
trimPathString: () => trimPathString,
|
|
47
|
-
warn: () => warn
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
utils_exports
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=chunk-JL3URCHO.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export * from './cli';\nexport * from './errors';\nexport * from './legacy';\nexport * from './logging';\nexport * from './path';\nexport * from './steps';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
|
package/dist/chunk-K26BOY6Z.mjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
evaluate
|
|
3
|
-
} from "./chunk-3WWFQLH4.mjs";
|
|
4
|
-
import {
|
|
5
|
-
getRelativePath
|
|
6
|
-
} from "./chunk-TDSL55B3.mjs";
|
|
7
|
-
import {
|
|
8
|
-
executeSteps
|
|
9
|
-
} from "./chunk-YCYGKEXF.mjs";
|
|
10
|
-
import {
|
|
11
|
-
CommandError
|
|
12
|
-
} from "./chunk-X7TESUC7.mjs";
|
|
13
|
-
|
|
14
|
-
// src/commands/eval/eval.ts
|
|
15
|
-
import { isFile } from "@metamask/snaps-utils/node";
|
|
16
|
-
import { resolve } from "path";
|
|
17
|
-
var steps = [
|
|
18
|
-
{
|
|
19
|
-
name: "Checking the input file.",
|
|
20
|
-
task: async ({ input }) => {
|
|
21
|
-
if (!await isFile(input)) {
|
|
22
|
-
const relativePath = getRelativePath(input);
|
|
23
|
-
throw new CommandError(
|
|
24
|
-
`Input file not found: "${relativePath}". Make sure that the "input" field in your snap config or the specified input file is correct.`
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "Evaluating the snap bundle.",
|
|
31
|
-
task: async ({ input, spinner }) => {
|
|
32
|
-
await evaluate(input);
|
|
33
|
-
spinner.succeed("Snap bundle evaluated successfully.");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
function getBundlePath(config, options) {
|
|
38
|
-
if (options.input) {
|
|
39
|
-
return resolve(process.cwd(), options.input);
|
|
40
|
-
}
|
|
41
|
-
return resolve(config.output.path, config.output.filename);
|
|
42
|
-
}
|
|
43
|
-
async function evaluateHandler(config, options = {}) {
|
|
44
|
-
const input = getBundlePath(config, options);
|
|
45
|
-
await executeSteps(steps, { input });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
evaluateHandler
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=chunk-K26BOY6Z.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/eval/eval.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\nimport { resolve } from 'path';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, getRelativePath } from '../../utils';\nimport { evaluate } from './implementation';\n\nexport type EvalOptions = {\n input?: string;\n};\n\nexport type EvalContext = Required<EvalOptions>;\n\nconst steps: Steps<EvalContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n const relativePath = getRelativePath(input);\n throw new CommandError(\n `Input file not found: \"${relativePath}\". Make sure that the \"input\" field in your snap config or the specified input file is correct.`,\n );\n }\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n task: async ({ input, spinner }) => {\n await evaluate(input);\n spinner.succeed('Snap bundle evaluated successfully.');\n },\n },\n];\n\n/**\n * Returns the path to the bundle, based on the config and options.\n *\n * - If `options.input` is specified, it is used as the bundle path.\n * - Otherwise, the bundle path is resolved from the config's output path and\n * filename.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns The path to the bundle.\n */\nfunction getBundlePath(config: ProcessedConfig, options: EvalOptions): string {\n if (options.input) {\n return resolve(process.cwd(), options.input);\n }\n\n return resolve(config.output.path, config.output.filename);\n}\n\n/**\n * Runs the snap in a worker, to ensure SES compatibility.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns A promise that resolves once the eval has finished.\n * @throws If the eval failed.\n */\nexport async function evaluateHandler(\n config: ProcessedConfig,\n options: EvalOptions = {},\n): Promise<void> {\n const input = getBundlePath(config, options);\n await executeSteps(steps, { input });\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,eAAe;AAcxB,IAAM,QAA4B;AAAA,EAChC;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,MAAM,MAAM;AACzB,UAAI,CAAE,MAAM,OAAO,KAAK,GAAI;AAC1B,cAAM,eAAe,gBAAgB,KAAK;AAC1C,cAAM,IAAI;AAAA,UACR,0BAA0B,YAAY;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,OAAO,QAAQ,MAAM;AAClC,YAAM,SAAS,KAAK;AACpB,cAAQ,QAAQ,qCAAqC;AAAA,IACvD;AAAA,EACF;AACF;AAaA,SAAS,cAAc,QAAyB,SAA8B;AAC5E,MAAI,QAAQ,OAAO;AACjB,WAAO,QAAQ,QAAQ,IAAI,GAAG,QAAQ,KAAK;AAAA,EAC7C;AAEA,SAAO,QAAQ,OAAO,OAAO,MAAM,OAAO,OAAO,QAAQ;AAC3D;AAUA,eAAsB,gBACpB,QACA,UAAuB,CAAC,GACT;AACf,QAAM,QAAQ,cAAc,QAAQ,OAAO;AAC3C,QAAM,aAAa,OAAO,EAAE,MAAM,CAAC;AACrC;","names":[]}
|