@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.d.mts","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAM/B,MAAM,MAAM,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;IAC1C,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,CACnE,IAAI,CAAC,OAAO,CAAC,EAAE,CAChB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACrB,OAAO,EAAE,OAAO,iBAoCjB"}
|
package/dist/utils/steps.mjs
CHANGED
|
@@ -1,11 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
function $importDefault(module) {
|
|
2
|
+
if (module?.__esModule) {
|
|
3
|
+
return module.default;
|
|
4
|
+
}
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
import $chalk from "chalk";
|
|
8
|
+
const { dim } = $chalk;
|
|
9
|
+
import $createSpinner from "ora/index.js";
|
|
10
|
+
const createSpinner = $importDefault($createSpinner);
|
|
11
|
+
import { getErrorMessage } from "./errors.mjs";
|
|
12
|
+
import { error } from "./logging.mjs";
|
|
13
|
+
/**
|
|
14
|
+
* Execute a list of steps in series. Each step receives the context object and
|
|
15
|
+
* a spinner instance.
|
|
16
|
+
*
|
|
17
|
+
* @param steps - The steps to execute.
|
|
18
|
+
* @param context - The context object that will be passed to each step.
|
|
19
|
+
*/
|
|
20
|
+
export async function executeSteps(steps, context) {
|
|
21
|
+
const spinner = createSpinner({
|
|
22
|
+
// Ora writes to `process.stderr` by default.
|
|
23
|
+
stream: process.stdout,
|
|
24
|
+
});
|
|
25
|
+
spinner.start();
|
|
26
|
+
try {
|
|
27
|
+
for (const step of steps) {
|
|
28
|
+
// If the step has a condition, and it returns false, we skip the step.
|
|
29
|
+
if (step.condition && !step.condition(context)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
// Calling `start` here instead of setting `spinner.text` seems to work
|
|
33
|
+
// better when the process doesn't have a TTY.
|
|
34
|
+
spinner.start(dim(step.name));
|
|
35
|
+
await step.task({
|
|
36
|
+
...context,
|
|
37
|
+
spinner,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
// The spinner may have been stopped by a step, so we only succeed if it's
|
|
41
|
+
// still spinning.
|
|
42
|
+
if (spinner.isSpinning) {
|
|
43
|
+
spinner.succeed('Done!');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (_error) {
|
|
47
|
+
error(getErrorMessage(_error), spinner);
|
|
48
|
+
spinner.stop();
|
|
49
|
+
process.exitCode = 1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
11
52
|
//# sourceMappingURL=steps.mjs.map
|
package/dist/utils/steps.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"steps.mjs","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":";;;;;;;;AAEA,OAAO,cAAa,qBAAY;;AAEhC,OAAO,EAAE,eAAe,EAAE,qBAAiB;AAC3C,OAAO,EAAE,KAAK,EAAE,sBAAkB;AAYlC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAqB,EACrB,OAAgB;IAEhB,MAAM,OAAO,GAAG,aAAa,CAAC;QAC5B,6CAA6C;QAC7C,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,IAAI,CAAC;QACH,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,uEAAuE;YACvE,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/C,SAAS;YACX,CAAC;YAED,uEAAuE;YACvE,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAE9B,MAAM,IAAI,CAAC,IAAI,CAAC;gBACd,GAAG,OAAO;gBACV,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAED,0EAA0E;QAC1E,kBAAkB;QAClB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["import { dim } from 'chalk';\nimport type { Ora } from 'ora';\nimport createSpinner from 'ora';\n\nimport { getErrorMessage } from './errors';\nimport { error } from './logging';\n\nexport type Step<Context extends Record<string, unknown>> = {\n name: string;\n condition?: (context: Context) => boolean;\n task: (context: Context & { spinner: Ora }) => Promise<void>;\n};\n\nexport type Steps<Context extends Record<string, unknown>> = Readonly<\n Step<Context>[]\n>;\n\n/**\n * Execute a list of steps in series. Each step receives the context object and\n * a spinner instance.\n *\n * @param steps - The steps to execute.\n * @param context - The context object that will be passed to each step.\n */\nexport async function executeSteps<Context extends Record<string, unknown>>(\n steps: Steps<Context>,\n context: Context,\n) {\n const spinner = createSpinner({\n // Ora writes to `process.stderr` by default.\n stream: process.stdout,\n });\n\n spinner.start();\n\n try {\n for (const step of steps) {\n // If the step has a condition, and it returns false, we skip the step.\n if (step.condition && !step.condition(context)) {\n continue;\n }\n\n // Calling `start` here instead of setting `spinner.text` seems to work\n // better when the process doesn't have a TTY.\n spinner.start(dim(step.name));\n\n await step.task({\n ...context,\n spinner,\n });\n }\n\n // The spinner may have been stopped by a step, so we only succeed if it's\n // still spinning.\n if (spinner.isSpinning) {\n spinner.succeed('Done!');\n }\n } catch (_error) {\n error(getErrorMessage(_error), spinner);\n spinner.stop();\n process.exitCode = 1;\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCompiler = void 0;
|
|
4
|
+
const webpack_1 = require("webpack");
|
|
5
|
+
const config_1 = require("./config.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Get a Webpack compiler for the given config.
|
|
8
|
+
*
|
|
9
|
+
* @param config - The config object.
|
|
10
|
+
* @param options - The Webpack options.
|
|
11
|
+
* @returns The Webpack compiler.
|
|
12
|
+
*/
|
|
13
|
+
async function getCompiler(config, options) {
|
|
14
|
+
const baseWebpackConfig = await (0, config_1.getDefaultConfiguration)(config, options);
|
|
15
|
+
const webpackConfig = config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;
|
|
16
|
+
return (0, webpack_1.webpack)(webpackConfig);
|
|
17
|
+
}
|
|
18
|
+
exports.getCompiler = getCompiler;
|
|
19
|
+
//# sourceMappingURL=compiler.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.cjs","sourceRoot":"","sources":["../../src/webpack/compiler.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAIlC,yCAAmD;AAEnD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,MAA8B,EAC9B,OAAwB;IAExB,MAAM,iBAAiB,GAAG,MAAM,IAAA,gCAAuB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,aAAa,GACjB,MAAM,CAAC,sBAAsB,EAAE,CAAC,iBAAiB,CAAC,IAAI,iBAAiB,CAAC;IAE1E,OAAO,IAAA,iBAAO,EAAC,aAAa,CAAC,CAAC;AAChC,CAAC;AATD,kCASC","sourcesContent":["import { webpack } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport type { WebpackOptions } from './config';\nimport { getDefaultConfiguration } from './config';\n\n/**\n * Get a Webpack compiler for the given config.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns The Webpack compiler.\n */\nexport async function getCompiler(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const baseWebpackConfig = await getDefaultConfiguration(config, options);\n const webpackConfig =\n config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;\n\n return webpack(webpackConfig);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProcessedWebpackConfig } from
|
|
2
|
-
import type { WebpackOptions } from
|
|
1
|
+
import type { ProcessedWebpackConfig } from "../config.cjs";
|
|
2
|
+
import type { WebpackOptions } from "./config.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Get a Webpack compiler for the given config.
|
|
5
5
|
*
|
|
@@ -8,3 +8,4 @@ import type { WebpackOptions } from './config';
|
|
|
8
8
|
* @returns The Webpack compiler.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getCompiler(config: ProcessedWebpackConfig, options?: WebpackOptions): Promise<import("webpack").Compiler>;
|
|
11
|
+
//# sourceMappingURL=compiler.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.cts","sourceRoot":"","sources":["../../src/webpack/compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAiB;AAG/C;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,uCAOzB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProcessedWebpackConfig } from "../config.mjs";
|
|
2
|
+
import type { WebpackOptions } from "./config.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Get a Webpack compiler for the given config.
|
|
5
|
+
*
|
|
6
|
+
* @param config - The config object.
|
|
7
|
+
* @param options - The Webpack options.
|
|
8
|
+
* @returns The Webpack compiler.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCompiler(config: ProcessedWebpackConfig, options?: WebpackOptions): Promise<import("webpack").Compiler>;
|
|
11
|
+
//# sourceMappingURL=compiler.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.mts","sourceRoot":"","sources":["../../src/webpack/compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAiB;AAG/C;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,uCAOzB"}
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import "../chunk-YCYGKEXF.mjs";
|
|
17
|
-
import "../chunk-7RHK2YTB.mjs";
|
|
18
|
-
import "../chunk-ZAW4ZWQX.mjs";
|
|
19
|
-
import "../chunk-MR44GPM3.mjs";
|
|
20
|
-
import "../chunk-X7TESUC7.mjs";
|
|
21
|
-
import "../chunk-R77RJHC5.mjs";
|
|
22
|
-
export {
|
|
23
|
-
getCompiler
|
|
24
|
-
};
|
|
1
|
+
import $webpack from "webpack";
|
|
2
|
+
const { webpack } = $webpack;
|
|
3
|
+
import { getDefaultConfiguration } from "./config.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Get a Webpack compiler for the given config.
|
|
6
|
+
*
|
|
7
|
+
* @param config - The config object.
|
|
8
|
+
* @param options - The Webpack options.
|
|
9
|
+
* @returns The Webpack compiler.
|
|
10
|
+
*/
|
|
11
|
+
export async function getCompiler(config, options) {
|
|
12
|
+
const baseWebpackConfig = await getDefaultConfiguration(config, options);
|
|
13
|
+
const webpackConfig = config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;
|
|
14
|
+
return webpack(webpackConfig);
|
|
15
|
+
}
|
|
25
16
|
//# sourceMappingURL=compiler.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"compiler.mjs","sourceRoot":"","sources":["../../src/webpack/compiler.ts"],"names":[],"mappings":";;AAIA,OAAO,EAAE,uBAAuB,EAAE,qBAAiB;AAEnD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAA8B,EAC9B,OAAwB;IAExB,MAAM,iBAAiB,GAAG,MAAM,uBAAuB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,aAAa,GACjB,MAAM,CAAC,sBAAsB,EAAE,CAAC,iBAAiB,CAAC,IAAI,iBAAiB,CAAC;IAE1E,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { webpack } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport type { WebpackOptions } from './config';\nimport { getDefaultConfiguration } from './config';\n\n/**\n * Get a Webpack compiler for the given config.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns The Webpack compiler.\n */\nexport async function getCompiler(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const baseWebpackConfig = await getDefaultConfiguration(config, options);\n const webpackConfig =\n config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;\n\n return webpack(webpackConfig);\n}\n"]}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDefaultConfiguration = void 0;
|
|
7
|
+
const snaps_webpack_plugin_1 = __importDefault(require("@metamask/snaps-webpack-plugin"));
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
|
|
10
|
+
const webpack_1 = require("webpack");
|
|
11
|
+
const loaders_1 = require("./loaders/index.cjs");
|
|
12
|
+
const plugins_1 = require("./plugins.cjs");
|
|
13
|
+
const utils_1 = require("./utils.cjs");
|
|
14
|
+
/**
|
|
15
|
+
* Get the default Webpack configuration. This is the configuration that will
|
|
16
|
+
* be used if the user doesn't provide a custom Webpack configuration. The
|
|
17
|
+
* configuration is based on the snap config.
|
|
18
|
+
*
|
|
19
|
+
* The default configuration includes:
|
|
20
|
+
*
|
|
21
|
+
* - `SWC` to transpile TypeScript and JavaScript files.
|
|
22
|
+
* - `TerserPlugin` to minify the bundle.
|
|
23
|
+
* - `SnapsWebpackPlugin` to validate the bundle and update the manifest.
|
|
24
|
+
*
|
|
25
|
+
* It can be customized through the `customizeWebpackConfig` function in the
|
|
26
|
+
* snap config, but in most cases, you shouldn't need to do that.
|
|
27
|
+
*
|
|
28
|
+
* @param config - The processed snap Webpack config.
|
|
29
|
+
* @param options - The Webpack options.
|
|
30
|
+
* @returns The default Webpack configuration.
|
|
31
|
+
*/
|
|
32
|
+
async function getDefaultConfiguration(config, options = {
|
|
33
|
+
evaluate: config.evaluate,
|
|
34
|
+
}) {
|
|
35
|
+
const spinnerText = options.spinner?.text;
|
|
36
|
+
const builtInResolver = config.stats.builtIns &&
|
|
37
|
+
new plugins_1.SnapsBuiltInResolver(config.stats.builtIns, options.spinner);
|
|
38
|
+
return {
|
|
39
|
+
/**
|
|
40
|
+
* The target is set to `browserslist` so that Webpack will compile the
|
|
41
|
+
* bundle to support the browsers specified in the `.browserslistrc` file.
|
|
42
|
+
* This Browserslist file contains the browsers that are supported by
|
|
43
|
+
* MetaMask Snaps.
|
|
44
|
+
*
|
|
45
|
+
* @see https://webpack.js.org/configuration/target/
|
|
46
|
+
*/
|
|
47
|
+
target: `browserslist:${utils_1.BROWSERSLIST_FILE}`,
|
|
48
|
+
/**
|
|
49
|
+
* The mode is set to `production` by default, so that Webpack will minify
|
|
50
|
+
* and optimize the bundle.
|
|
51
|
+
*
|
|
52
|
+
* @see https://webpack.js.org/configuration/mode/
|
|
53
|
+
*/
|
|
54
|
+
mode: 'production',
|
|
55
|
+
/**
|
|
56
|
+
* The entry point is set to the `input` value from the config object.
|
|
57
|
+
*
|
|
58
|
+
* @see https://webpack.js.org/configuration/entry-context/
|
|
59
|
+
*/
|
|
60
|
+
entry: config.input,
|
|
61
|
+
/**
|
|
62
|
+
* The devtool option controls how source maps are generated. We set it to
|
|
63
|
+
* the `sourceMap` value from the config object.
|
|
64
|
+
*
|
|
65
|
+
* @see https://webpack.js.org/configuration/devtool/
|
|
66
|
+
*/
|
|
67
|
+
devtool: (0, utils_1.getDevTool)(config.sourceMap),
|
|
68
|
+
/**
|
|
69
|
+
* The stats option controls how much information is printed to the console
|
|
70
|
+
* when Webpack is running. We set it to `none` so that we can control the
|
|
71
|
+
* output ourselves.
|
|
72
|
+
*
|
|
73
|
+
* @see https://webpack.js.org/configuration/stats/
|
|
74
|
+
*/
|
|
75
|
+
stats: 'none',
|
|
76
|
+
/**
|
|
77
|
+
* The output options.
|
|
78
|
+
*
|
|
79
|
+
* @see https://webpack.js.org/configuration/output/
|
|
80
|
+
*/
|
|
81
|
+
output: {
|
|
82
|
+
/**
|
|
83
|
+
* This indicates whether Webpack should clear the output directory
|
|
84
|
+
* before building. We set it to the `clean` value from the config
|
|
85
|
+
* object.
|
|
86
|
+
*
|
|
87
|
+
* @see https://webpack.js.org/configuration/output/#outputclean
|
|
88
|
+
*/
|
|
89
|
+
clean: config.output.clean,
|
|
90
|
+
/**
|
|
91
|
+
* The filename of the bundle. We set it to the `filename` value from
|
|
92
|
+
* the config object.
|
|
93
|
+
*
|
|
94
|
+
* @see https://webpack.js.org/configuration/output/#outputfilename
|
|
95
|
+
*/
|
|
96
|
+
filename: config.output.filename,
|
|
97
|
+
/**
|
|
98
|
+
* The path to the output directory. We set it to the `path` value from
|
|
99
|
+
* the config object.
|
|
100
|
+
*
|
|
101
|
+
* @see https://webpack.js.org/configuration/output/#outputpath
|
|
102
|
+
*/
|
|
103
|
+
path: config.output.path,
|
|
104
|
+
/**
|
|
105
|
+
* The public path of the bundle. We set it to `/` by default, so that
|
|
106
|
+
* the bundle can be loaded from the root of the server.
|
|
107
|
+
*
|
|
108
|
+
* @see https://webpack.js.org/configuration/output/#outputpublicpath
|
|
109
|
+
*/
|
|
110
|
+
publicPath: '/',
|
|
111
|
+
/**
|
|
112
|
+
* The library configuration. This tells Webpack how to export the
|
|
113
|
+
* bundle.
|
|
114
|
+
*
|
|
115
|
+
* @see https://webpack.js.org/configuration/output/#outputlibrary
|
|
116
|
+
*/
|
|
117
|
+
library: {
|
|
118
|
+
/**
|
|
119
|
+
* This tells Webpack to export the bundle as a CommonJS module. This
|
|
120
|
+
* is necessary for MetaMask Snaps.
|
|
121
|
+
*
|
|
122
|
+
* @see https://webpack.js.org/configuration/output/#outputlibrarytarget
|
|
123
|
+
*/
|
|
124
|
+
type: 'commonjs',
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* The chunk format. This tells Webpack how to export chunks. This is
|
|
128
|
+
* required because we use browserslist to target browsers, but Snaps are
|
|
129
|
+
* not fully compatible with browser APIs (such as `window` and
|
|
130
|
+
* `document`).
|
|
131
|
+
*
|
|
132
|
+
* @see https://webpack.js.org/configuration/output/#outputchunkformat
|
|
133
|
+
*/
|
|
134
|
+
chunkFormat: 'commonjs',
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* The module configuration. This is where we tell Webpack how to handle
|
|
138
|
+
* different types of files.
|
|
139
|
+
*
|
|
140
|
+
* @see https://webpack.js.org/configuration/module/
|
|
141
|
+
*/
|
|
142
|
+
module: {
|
|
143
|
+
rules: [
|
|
144
|
+
{
|
|
145
|
+
test: /\.(js|jsx|mjs|cjs|ts|tsx)$/u,
|
|
146
|
+
exclude: /node_modules/u,
|
|
147
|
+
use: await (0, utils_1.getDefaultLoader)(config),
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* This allows importing modules that uses `.js` and not `.mjs` for the
|
|
151
|
+
* ES build.
|
|
152
|
+
*
|
|
153
|
+
* @see https://webpack.js.org/configuration/module/#resolvefullyspecified
|
|
154
|
+
*/
|
|
155
|
+
{
|
|
156
|
+
test: /\.m?js$/u,
|
|
157
|
+
resolve: {
|
|
158
|
+
fullySpecified: false,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* This allows importing `.svg` files as a string.
|
|
163
|
+
*/
|
|
164
|
+
config.features.images && {
|
|
165
|
+
test: /\.svg$/u,
|
|
166
|
+
// `asset/source` returns the source as a UTF-8 string.
|
|
167
|
+
type: 'asset/source',
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* This allows importing `.png` files as a data URL.
|
|
171
|
+
*/
|
|
172
|
+
config.features.images && {
|
|
173
|
+
test: /\.png$/u,
|
|
174
|
+
type: 'asset/inline',
|
|
175
|
+
generator: {
|
|
176
|
+
dataUrl: utils_1.getImageSVG.bind(null, 'image/png'),
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* This allows importing `.jpe?g` files as a data URL.
|
|
181
|
+
*/
|
|
182
|
+
config.features.images && {
|
|
183
|
+
test: /\.jpe?g$/u,
|
|
184
|
+
type: 'asset/inline',
|
|
185
|
+
generator: {
|
|
186
|
+
dataUrl: utils_1.getImageSVG.bind(null, 'image/jpeg'),
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
config.experimental.wasm && {
|
|
190
|
+
test: /\.wasm$/u,
|
|
191
|
+
use: (0, loaders_1.getFunctionLoader)(loaders_1.wasm, {}),
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* The resolve configuration. This tells Webpack how to resolve imports.
|
|
197
|
+
* We set it to resolve `.js` and `.ts` files.
|
|
198
|
+
*
|
|
199
|
+
* @see https://webpack.js.org/configuration/resolve/
|
|
200
|
+
*/
|
|
201
|
+
resolve: {
|
|
202
|
+
/**
|
|
203
|
+
* The extensions to resolve. We set it to resolve `.(c|m)?jsx?` and
|
|
204
|
+
* `.tsx?` files.
|
|
205
|
+
*/
|
|
206
|
+
extensions: ['.js', '.jsx', '.mjs', '.cjs', '.ts', '.tsx'],
|
|
207
|
+
/**
|
|
208
|
+
* The fallback options. This tells Webpack how to handle imports that
|
|
209
|
+
* aren't resolved. By default, we set Node.js built-ins to `false`, so
|
|
210
|
+
* that they are ignored.
|
|
211
|
+
*/
|
|
212
|
+
fallback: (0, utils_1.getFallbacks)(config.polyfills),
|
|
213
|
+
/**
|
|
214
|
+
* The plugins to use. We use the {@link SnapsBuiltInResolver} to show
|
|
215
|
+
* warnings about using Node.js built-ins, when no fallback is specified.
|
|
216
|
+
*/
|
|
217
|
+
plugins: [builtInResolver],
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* The plugins to use.
|
|
221
|
+
*
|
|
222
|
+
* @see https://webpack.js.org/configuration/plugins/
|
|
223
|
+
*/
|
|
224
|
+
plugins: [
|
|
225
|
+
/**
|
|
226
|
+
* The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates
|
|
227
|
+
* the manifest file, and evaluates the bundle in SES. While not strictly
|
|
228
|
+
* required, it's highly recommended to use this plugin.
|
|
229
|
+
*/
|
|
230
|
+
new snaps_webpack_plugin_1.default({
|
|
231
|
+
manifestPath: config.manifest.path,
|
|
232
|
+
writeManifest: config.manifest.update,
|
|
233
|
+
eval: !options.watch && options.evaluate,
|
|
234
|
+
}),
|
|
235
|
+
/**
|
|
236
|
+
* The `SnapsStatsPlugin` is a Webpack plugin that handles the stats
|
|
237
|
+
* output. It's used to show the stats in the terminal, in a format that
|
|
238
|
+
* is easy to read.
|
|
239
|
+
*/
|
|
240
|
+
new plugins_1.SnapsStatsPlugin({ verbose: config.stats.verbose }, options.spinner),
|
|
241
|
+
/**
|
|
242
|
+
* The `DefinePlugin` is a Webpack plugin that adds static values to the
|
|
243
|
+
* bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`
|
|
244
|
+
* environment variables, as well as any custom environment
|
|
245
|
+
* variables (as `process.env`).
|
|
246
|
+
*/
|
|
247
|
+
new webpack_1.DefinePlugin((0, utils_1.getEnvironmentVariables)(config.environment)),
|
|
248
|
+
/**
|
|
249
|
+
* The `ProgressPlugin` is a Webpack plugin that logs the progress of
|
|
250
|
+
* the build. We set it to log the progress to the spinner.
|
|
251
|
+
*/
|
|
252
|
+
new webpack_1.ProgressPlugin({
|
|
253
|
+
handler: (0, utils_1.getProgressHandler)(options.spinner, spinnerText),
|
|
254
|
+
}),
|
|
255
|
+
/**
|
|
256
|
+
* The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a
|
|
257
|
+
* warning when the bundle is potentially incompatible with MetaMask
|
|
258
|
+
* Snaps.
|
|
259
|
+
*/
|
|
260
|
+
new plugins_1.SnapsBundleWarningsPlugin({
|
|
261
|
+
builtInResolver,
|
|
262
|
+
builtIns: Boolean(config.stats.builtIns),
|
|
263
|
+
buffer: config.stats.buffer,
|
|
264
|
+
}),
|
|
265
|
+
/**
|
|
266
|
+
* The `WatchPlugin` is a Webpack plugin that adds extra files to watch
|
|
267
|
+
* for changes. This is useful for rebuilding the bundle when the
|
|
268
|
+
* manifest file changes.
|
|
269
|
+
*/
|
|
270
|
+
options.watch &&
|
|
271
|
+
new plugins_1.SnapsWatchPlugin({
|
|
272
|
+
bundle: (0, path_1.resolve)(config.output.path, config.output.filename),
|
|
273
|
+
evaluate: options.evaluate,
|
|
274
|
+
files: [config.manifest.path],
|
|
275
|
+
}, options.spinner),
|
|
276
|
+
/**
|
|
277
|
+
* The `ProviderPlugin` is a Webpack plugin that automatically load
|
|
278
|
+
* modules instead of having to import or require them everywhere.
|
|
279
|
+
*/
|
|
280
|
+
(config.polyfills === true ||
|
|
281
|
+
(config.polyfills !== false && config.polyfills.buffer)) &&
|
|
282
|
+
new webpack_1.ProvidePlugin({
|
|
283
|
+
Buffer: ['buffer', 'Buffer'],
|
|
284
|
+
}),
|
|
285
|
+
].filter(Boolean),
|
|
286
|
+
/**
|
|
287
|
+
* The optimization configuration. This tells Webpack how to optimize the
|
|
288
|
+
* bundle. Most of the time, you won't need to change this, as the default
|
|
289
|
+
* options set by the `mode` option are sufficient.
|
|
290
|
+
*/
|
|
291
|
+
optimization: {
|
|
292
|
+
minimize: config.output.minimize,
|
|
293
|
+
/**
|
|
294
|
+
* The minimizer to use. We set it to use the `TerserPlugin`.
|
|
295
|
+
*/
|
|
296
|
+
minimizer: [
|
|
297
|
+
new terser_webpack_plugin_1.default({
|
|
298
|
+
parallel: true,
|
|
299
|
+
}),
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
/**
|
|
303
|
+
* The experiments configuration. This configures which Webpack
|
|
304
|
+
* experiments to enable/disable.
|
|
305
|
+
*
|
|
306
|
+
* @see https://webpack.js.org/configuration/experiments
|
|
307
|
+
*/
|
|
308
|
+
experiments: {
|
|
309
|
+
/**
|
|
310
|
+
* Experimental support for top level await.
|
|
311
|
+
*
|
|
312
|
+
* This is unsupported in Snaps and therefore disabled.
|
|
313
|
+
*
|
|
314
|
+
* @see https://webpack.js.org/configuration/experiments/#experimentstoplevelawait
|
|
315
|
+
*/
|
|
316
|
+
topLevelAwait: false,
|
|
317
|
+
},
|
|
318
|
+
/**
|
|
319
|
+
* The performance configuration. This tells Webpack how to handle
|
|
320
|
+
* performance hints.
|
|
321
|
+
*
|
|
322
|
+
* @see https://webpack.js.org/configuration/performance/
|
|
323
|
+
*/
|
|
324
|
+
performance: {
|
|
325
|
+
/**
|
|
326
|
+
* The hints to show. We set it to `false`, so that we don't get
|
|
327
|
+
* performance hints, as they are not relevant for Snaps.
|
|
328
|
+
*
|
|
329
|
+
* @see https://webpack.js.org/configuration/performance/#performancehints
|
|
330
|
+
*/
|
|
331
|
+
hints: false,
|
|
332
|
+
},
|
|
333
|
+
/**
|
|
334
|
+
* The infrastructure logging configuration. This tells Webpack how to
|
|
335
|
+
* log messages.
|
|
336
|
+
*
|
|
337
|
+
* @see https://webpack.js.org/configuration/infrastructure-logging
|
|
338
|
+
*/
|
|
339
|
+
infrastructureLogging: {
|
|
340
|
+
/**
|
|
341
|
+
* The level of logging to use. We set it to `none`, so that we can
|
|
342
|
+
* control the output ourselves.
|
|
343
|
+
*/
|
|
344
|
+
level: 'none',
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
exports.getDefaultConfiguration = getDefaultConfiguration;
|
|
349
|
+
//# sourceMappingURL=config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.cjs","sourceRoot":"","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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Ora } from
|
|
2
|
-
import type { Configuration } from
|
|
3
|
-
import type { ProcessedWebpackConfig } from
|
|
1
|
+
import type { Ora } from "ora/index.js";
|
|
2
|
+
import type { Configuration } from "webpack";
|
|
3
|
+
import type { ProcessedWebpackConfig } from "../config.cjs";
|
|
4
4
|
export type WebpackOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* Whether to watch for changes.
|
|
@@ -35,3 +35,4 @@ export type WebpackOptions = {
|
|
|
35
35
|
* @returns The default Webpack configuration.
|
|
36
36
|
*/
|
|
37
37
|
export declare function getDefaultConfiguration(config: ProcessedWebpackConfig, options?: WebpackOptions): Promise<Configuration>;
|
|
38
|
+
//# sourceMappingURL=config.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.cts","sourceRoot":"","sources":["../../src/webpack/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB;AAG7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AAkBxD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,sBAAsB,EAC9B,OAAO,GAAE,cAER,GACA,OAAO,CAAC,aAAa,CAAC,CA6VxB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Ora } from "ora/index.js";
|
|
2
|
+
import type { Configuration } from "webpack";
|
|
3
|
+
import type { ProcessedWebpackConfig } from "../config.mjs";
|
|
4
|
+
export type WebpackOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Whether to watch for changes.
|
|
7
|
+
*/
|
|
8
|
+
watch?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to evaluate the bundle. If this is set, it will override the
|
|
11
|
+
* `evaluate` option in the config object.
|
|
12
|
+
*/
|
|
13
|
+
evaluate?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The spinner to use for logging.
|
|
16
|
+
*/
|
|
17
|
+
spinner?: Ora;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Get the default Webpack configuration. This is the configuration that will
|
|
21
|
+
* be used if the user doesn't provide a custom Webpack configuration. The
|
|
22
|
+
* configuration is based on the snap config.
|
|
23
|
+
*
|
|
24
|
+
* The default configuration includes:
|
|
25
|
+
*
|
|
26
|
+
* - `SWC` to transpile TypeScript and JavaScript files.
|
|
27
|
+
* - `TerserPlugin` to minify the bundle.
|
|
28
|
+
* - `SnapsWebpackPlugin` to validate the bundle and update the manifest.
|
|
29
|
+
*
|
|
30
|
+
* It can be customized through the `customizeWebpackConfig` function in the
|
|
31
|
+
* snap config, but in most cases, you shouldn't need to do that.
|
|
32
|
+
*
|
|
33
|
+
* @param config - The processed snap Webpack config.
|
|
34
|
+
* @param options - The Webpack options.
|
|
35
|
+
* @returns The default Webpack configuration.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getDefaultConfiguration(config: ProcessedWebpackConfig, options?: WebpackOptions): Promise<Configuration>;
|
|
38
|
+
//# sourceMappingURL=config.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.mts","sourceRoot":"","sources":["../../src/webpack/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB;AAG7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AAkBxD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,sBAAsB,EAC9B,OAAO,GAAE,cAER,GACA,OAAO,CAAC,aAAa,CAAC,CA6VxB"}
|