@metamask/snaps-cli 6.7.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -1
- package/README.md +11 -244
- package/dist/builders.cjs +0 -97
- package/dist/builders.cjs.map +1 -1
- package/dist/builders.d.cts +0 -94
- package/dist/builders.d.cts.map +1 -1
- package/dist/builders.d.mts +0 -94
- package/dist/builders.d.mts.map +1 -1
- package/dist/builders.mjs +0 -96
- package/dist/builders.mjs.map +1 -1
- package/dist/cli.cjs +4 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts.map +1 -1
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +4 -16
- package/dist/cli.mjs.map +1 -1
- package/dist/commands/build/build.cjs +7 -7
- package/dist/commands/build/build.cjs.map +1 -1
- package/dist/commands/build/build.d.cts.map +1 -1
- package/dist/commands/build/build.d.mts.map +1 -1
- package/dist/commands/build/build.mjs +2 -2
- package/dist/commands/build/build.mjs.map +1 -1
- package/dist/commands/build/implementation.cjs.map +1 -1
- package/dist/commands/build/implementation.d.cts +2 -2
- package/dist/commands/build/implementation.d.cts.map +1 -1
- package/dist/commands/build/implementation.d.mts +2 -2
- package/dist/commands/build/implementation.d.mts.map +1 -1
- package/dist/commands/build/implementation.mjs.map +1 -1
- package/dist/commands/build/index.cjs +2 -14
- package/dist/commands/build/index.cjs.map +1 -1
- package/dist/commands/build/index.d.cts.map +1 -1
- package/dist/commands/build/index.d.mts.map +1 -1
- package/dist/commands/build/index.mjs +2 -14
- package/dist/commands/build/index.mjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.mjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/snap.config.mjs.map +1 -1
- package/dist/commands/eval/eval.cjs +1 -1
- package/dist/commands/eval/eval.cjs.map +1 -1
- package/dist/commands/eval/eval.d.cts.map +1 -1
- package/dist/commands/eval/eval.d.mts.map +1 -1
- package/dist/commands/eval/eval.mjs +1 -1
- package/dist/commands/eval/eval.mjs.map +1 -1
- package/dist/commands/eval/index.cjs +1 -4
- package/dist/commands/eval/index.cjs.map +1 -1
- package/dist/commands/eval/index.d.cts.map +1 -1
- package/dist/commands/eval/index.d.mts.map +1 -1
- package/dist/commands/eval/index.mjs +1 -4
- package/dist/commands/eval/index.mjs.map +1 -1
- package/dist/commands/manifest/index.cjs +1 -4
- package/dist/commands/manifest/index.cjs.map +1 -1
- package/dist/commands/manifest/index.d.cts.map +1 -1
- package/dist/commands/manifest/index.d.mts.map +1 -1
- package/dist/commands/manifest/index.mjs +1 -4
- package/dist/commands/manifest/index.mjs.map +1 -1
- package/dist/commands/manifest/manifest.cjs +5 -6
- package/dist/commands/manifest/manifest.cjs.map +1 -1
- package/dist/commands/manifest/manifest.d.cts.map +1 -1
- package/dist/commands/manifest/manifest.d.mts.map +1 -1
- package/dist/commands/manifest/manifest.mjs +5 -6
- package/dist/commands/manifest/manifest.mjs.map +1 -1
- package/dist/commands/serve/index.cjs +2 -2
- package/dist/commands/serve/index.cjs.map +1 -1
- package/dist/commands/serve/index.d.cts.map +1 -1
- package/dist/commands/serve/index.d.mts.map +1 -1
- package/dist/commands/serve/index.mjs +2 -2
- package/dist/commands/serve/index.mjs.map +1 -1
- package/dist/commands/watch/implementation.cjs +2 -0
- package/dist/commands/watch/implementation.cjs.map +1 -1
- package/dist/commands/watch/implementation.d.cts +2 -2
- package/dist/commands/watch/implementation.d.cts.map +1 -1
- package/dist/commands/watch/implementation.d.mts +2 -2
- package/dist/commands/watch/implementation.d.mts.map +1 -1
- package/dist/commands/watch/implementation.mjs +2 -0
- package/dist/commands/watch/implementation.mjs.map +1 -1
- package/dist/commands/watch/index.cjs +2 -17
- package/dist/commands/watch/index.cjs.map +1 -1
- package/dist/commands/watch/index.d.cts.map +1 -1
- package/dist/commands/watch/index.d.mts.map +1 -1
- package/dist/commands/watch/index.mjs +2 -17
- package/dist/commands/watch/index.mjs.map +1 -1
- package/dist/commands/watch/watch.cjs +1 -1
- package/dist/commands/watch/watch.cjs.map +1 -1
- package/dist/commands/watch/watch.d.cts.map +1 -1
- package/dist/commands/watch/watch.d.mts.map +1 -1
- package/dist/commands/watch/watch.mjs +1 -1
- package/dist/commands/watch/watch.mjs.map +1 -1
- package/dist/config.cjs +11 -155
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +216 -314
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +216 -314
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +13 -155
- package/dist/config.mjs.map +1 -1
- package/dist/main.cjs +0 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +0 -1
- package/dist/main.mjs.map +1 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +0 -1
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +0 -1
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +0 -1
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/steps.cjs.map +1 -1
- package/dist/utils/steps.d.cts +1 -1
- package/dist/utils/steps.d.cts.map +1 -1
- package/dist/utils/steps.d.mts +1 -1
- package/dist/utils/steps.d.mts.map +1 -1
- package/dist/utils/steps.mjs.map +1 -1
- package/dist/webpack/compiler.cjs.map +1 -1
- package/dist/webpack/compiler.d.cts +2 -2
- package/dist/webpack/compiler.d.cts.map +1 -1
- package/dist/webpack/compiler.d.mts +2 -2
- package/dist/webpack/compiler.d.mts.map +1 -1
- package/dist/webpack/compiler.mjs.map +1 -1
- package/dist/webpack/config.cjs +1 -2
- package/dist/webpack/config.cjs.map +1 -1
- package/dist/webpack/config.d.cts +2 -2
- package/dist/webpack/config.d.cts.map +1 -1
- package/dist/webpack/config.d.mts +2 -2
- package/dist/webpack/config.d.mts.map +1 -1
- package/dist/webpack/config.mjs +1 -2
- package/dist/webpack/config.mjs.map +1 -1
- package/dist/webpack/loaders/function.cjs +7 -10
- package/dist/webpack/loaders/function.cjs.map +1 -1
- package/dist/webpack/loaders/function.d.cts +1 -0
- package/dist/webpack/loaders/function.d.cts.map +1 -1
- package/dist/webpack/loaders/function.d.mts +1 -0
- package/dist/webpack/loaders/function.d.mts.map +1 -1
- package/dist/webpack/loaders/function.mjs +6 -9
- package/dist/webpack/loaders/function.mjs.map +1 -1
- package/dist/webpack/loaders/index.cjs +1 -3
- package/dist/webpack/loaders/index.cjs.map +1 -1
- package/dist/webpack/loaders/index.d.cts +0 -1
- package/dist/webpack/loaders/index.d.cts.map +1 -1
- package/dist/webpack/loaders/index.d.mts +0 -1
- package/dist/webpack/loaders/index.d.mts.map +1 -1
- package/dist/webpack/loaders/index.mjs +0 -1
- package/dist/webpack/loaders/index.mjs.map +1 -1
- package/dist/webpack/loaders/wasm.cjs +0 -2
- package/dist/webpack/loaders/wasm.cjs.map +1 -1
- package/dist/webpack/loaders/wasm.d.cts.map +1 -1
- package/dist/webpack/loaders/wasm.d.mts.map +1 -1
- package/dist/webpack/loaders/wasm.mjs +0 -2
- package/dist/webpack/loaders/wasm.mjs.map +1 -1
- package/dist/webpack/plugins.cjs +15 -20
- package/dist/webpack/plugins.cjs.map +1 -1
- package/dist/webpack/plugins.d.cts +13 -3
- package/dist/webpack/plugins.d.cts.map +1 -1
- package/dist/webpack/plugins.d.mts +13 -3
- package/dist/webpack/plugins.d.mts.map +1 -1
- package/dist/webpack/plugins.mjs +4 -9
- package/dist/webpack/plugins.mjs.map +1 -1
- package/dist/webpack/utils.cjs +5 -21
- package/dist/webpack/utils.cjs.map +1 -1
- package/dist/webpack/utils.d.cts +6 -36
- package/dist/webpack/utils.d.cts.map +1 -1
- package/dist/webpack/utils.d.mts +6 -36
- package/dist/webpack/utils.d.mts.map +1 -1
- package/dist/webpack/utils.mjs +4 -18
- package/dist/webpack/utils.mjs.map +1 -1
- package/package.json +13 -38
- package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs +0 -10
- package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts +0 -4
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts +0 -4
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs +0 -8
- package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.cjs +0 -10
- package/dist/commands/eval/__test__/browserify/good/snap.config.cjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts +0 -4
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts +0 -4
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.mjs +0 -8
- package/dist/commands/eval/__test__/browserify/good/snap.config.mjs.map +0 -1
- package/dist/utils/legacy.cjs +0 -53
- package/dist/utils/legacy.cjs.map +0 -1
- package/dist/utils/legacy.d.cts +0 -28
- package/dist/utils/legacy.d.cts.map +0 -1
- package/dist/utils/legacy.d.mts +0 -28
- package/dist/utils/legacy.d.mts.map +0 -1
- package/dist/utils/legacy.mjs +0 -47
- package/dist/utils/legacy.mjs.map +0 -1
- package/dist/webpack/loaders/browserify.cjs +0 -84
- package/dist/webpack/loaders/browserify.cjs.map +0 -1
- package/dist/webpack/loaders/browserify.d.cts +0 -18
- package/dist/webpack/loaders/browserify.d.cts.map +0 -1
- package/dist/webpack/loaders/browserify.d.mts +0 -18
- package/dist/webpack/loaders/browserify.d.mts.map +0 -1
- package/dist/webpack/loaders/browserify.mjs +0 -88
- package/dist/webpack/loaders/browserify.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.0.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** Remove deprecated Browserify configuration ([#3313](https://github.com/MetaMask/snaps/pull/3313))
|
|
15
|
+
- The Browserify bundler is no longer supported. Snaps using the Browserify
|
|
16
|
+
bundler will need to be migrated to the new configuration format based on
|
|
17
|
+
Webpack.
|
|
18
|
+
- The `bundler` option in the Snap configuration file was removed, and the CLI
|
|
19
|
+
will show an error if it's used in config.
|
|
20
|
+
- Several command line flags that were used to configure the Browserify
|
|
21
|
+
bundler were removed.
|
|
22
|
+
- Use the config file to provide these options instead.
|
|
23
|
+
- The removed options are:
|
|
24
|
+
- `--bundle`
|
|
25
|
+
- `--dist`
|
|
26
|
+
- `--eval`
|
|
27
|
+
- `--manifest`
|
|
28
|
+
- `--outfileName`
|
|
29
|
+
- `--root`
|
|
30
|
+
- `--sourceMaps`
|
|
31
|
+
- `--src`
|
|
32
|
+
- `--stripComments`
|
|
33
|
+
- `--suppressWarnings`
|
|
34
|
+
- `--transpilationMode`
|
|
35
|
+
- `--depsToTranspile`
|
|
36
|
+
- `--verboseErrors`
|
|
37
|
+
- `--writeManifest`
|
|
38
|
+
- `--serve`
|
|
39
|
+
|
|
10
40
|
## [6.7.0]
|
|
11
41
|
|
|
12
42
|
### Added
|
|
@@ -320,7 +350,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
320
350
|
- The version of the package no longer needs to match the version of all other
|
|
321
351
|
MetaMask Snaps packages.
|
|
322
352
|
|
|
323
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@
|
|
353
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@7.0.0...HEAD
|
|
354
|
+
[7.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.7.0...@metamask/snaps-cli@7.0.0
|
|
324
355
|
[6.7.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.6.1...@metamask/snaps-cli@6.7.0
|
|
325
356
|
[6.6.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.6.0...@metamask/snaps-cli@6.6.1
|
|
326
357
|
[6.6.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.5.4...@metamask/snaps-cli@6.6.0
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A CLI for developing MetaMask Snaps.
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
Use Node.js `16.0
|
|
7
|
+
Use Node.js `18.16.0` or later.
|
|
8
8
|
We recommend [nvm](https://github.com/nvm-sh/nvm) for managing Node.js versions.
|
|
9
9
|
|
|
10
10
|
Install a dev dependency in your snap project using `yarn` or `npm`:
|
|
@@ -25,22 +25,20 @@ Commands:
|
|
|
25
25
|
mm-snap watch Build Snap on change [aliases: w]
|
|
26
26
|
|
|
27
27
|
Options:
|
|
28
|
-
--version
|
|
29
|
-
-c, --config
|
|
30
|
-
|
|
31
|
-
--suppressWarnings Whether to suppress warnings [deprecated] [boolean]
|
|
32
|
-
-h, --help Show help [boolean]
|
|
28
|
+
--version Show version number [boolean]
|
|
29
|
+
-c, --config Path to config file [string]
|
|
30
|
+
-h, --help Show help [boolean]
|
|
33
31
|
|
|
34
32
|
Examples:
|
|
35
|
-
mm-snap build Build './src/index.js' as
|
|
36
|
-
|
|
37
|
-
mm-snap build --config
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
mm-snap build Build './src/index.js' as './dist/bu
|
|
34
|
+
ndle.js'
|
|
35
|
+
mm-snap build --config ./snap.config.bui Build './src/index.js' as './dist/bu
|
|
36
|
+
ld.ts ndle.js' using the config in './snap
|
|
37
|
+
.config.build.ts'
|
|
40
38
|
mm-snap manifest --fix Check the snap manifest, and fix any
|
|
41
|
-
|
|
39
|
+
errors
|
|
42
40
|
mm-snap watch --port 8000 The snap input file for changes, and
|
|
43
|
-
|
|
41
|
+
serve it on port 8000
|
|
44
42
|
mm-snap serve --port 8000 Serve the snap bundle on port 8000
|
|
45
43
|
```
|
|
46
44
|
|
|
@@ -134,7 +132,6 @@ The file should be placed in the project root directory.
|
|
|
134
132
|
|
|
135
133
|
```javascript
|
|
136
134
|
module.exports = {
|
|
137
|
-
bundler: 'webpack', // default: 'browserify'
|
|
138
135
|
input: 'src/index.js',
|
|
139
136
|
output: {
|
|
140
137
|
path: 'dist',
|
|
@@ -154,7 +151,6 @@ exports a `SnapConfig` type that can be used to type the configuration object.
|
|
|
154
151
|
import type { SnapConfig } from '@metamask/snaps-cli';
|
|
155
152
|
|
|
156
153
|
const config: SnapConfig = {
|
|
157
|
-
bundler: 'webpack', // default: 'browserify'
|
|
158
154
|
input: 'src/index.js',
|
|
159
155
|
output: {
|
|
160
156
|
path: 'dist',
|
|
@@ -171,7 +167,6 @@ The configuration file should not be published.
|
|
|
171
167
|
|
|
172
168
|
### Options
|
|
173
169
|
|
|
174
|
-
- [`bundler`](#bundler)
|
|
175
170
|
- [`input`](#input)
|
|
176
171
|
- [`output`](#output)
|
|
177
172
|
- [`output.path`](#outputpath)
|
|
@@ -191,18 +186,6 @@ The configuration file should not be published.
|
|
|
191
186
|
- [`experimental`](#experimental)
|
|
192
187
|
- [`experimental.wasm`](#experimentalwasm)
|
|
193
188
|
|
|
194
|
-
#### `bundler`
|
|
195
|
-
|
|
196
|
-
- Type: `"browserify"` | `"webpack"`
|
|
197
|
-
- Default: `"browserify"`
|
|
198
|
-
|
|
199
|
-
The bundler to use. The MetaMask Snaps CLI supports both Browserify and
|
|
200
|
-
Webpack. For backwards compatibility, Browserify is the default, but we
|
|
201
|
-
recommend using Webpack. Browserify support will be removed in the future.
|
|
202
|
-
|
|
203
|
-
This section describes the options for the Webpack bundler. For Browserify,
|
|
204
|
-
refer to the [legacy options](#legacy-options) section.
|
|
205
|
-
|
|
206
189
|
#### `input`
|
|
207
190
|
|
|
208
191
|
- Type: `string`
|
|
@@ -425,219 +408,3 @@ import program from './program.wasm';
|
|
|
425
408
|
// Program is initialised synchronously.
|
|
426
409
|
// ...
|
|
427
410
|
```
|
|
428
|
-
|
|
429
|
-
### Legacy Options
|
|
430
|
-
|
|
431
|
-
> **Warning**: Using the Browserify-based build system is deprecated, and will
|
|
432
|
-
> be removed in a future version. Please migrate to the Webpack-based build
|
|
433
|
-
> system.
|
|
434
|
-
|
|
435
|
-
- [`bundler`](#bundler)
|
|
436
|
-
- [`cliOptions`](#clioptions)
|
|
437
|
-
- [`cliOptions.bundle`](#clioptionsbundle)
|
|
438
|
-
- [`cliOptions.dist`](#clioptionsdist)
|
|
439
|
-
- [`cliOptions.eval`](#clioptionseval)
|
|
440
|
-
- [`cliOptions.manifest`](#clioptionsmanifest)
|
|
441
|
-
- [`cliOptions.outfileName`](#clioptionsoutfilename)
|
|
442
|
-
- [`cliOptions.port`](#clioptionsport)
|
|
443
|
-
- [`cliOptions.root`](#clioptionsroot)
|
|
444
|
-
- [`cliOptions.sourceMaps`](#clioptionssourcemaps)
|
|
445
|
-
- [`cliOptions.src`](#clioptionssrc)
|
|
446
|
-
- [`cliOptions.stripComments`](#clioptionsstripcomments)
|
|
447
|
-
- [`cliOptions.transpilationMode`](#clioptionstranspilationmode)
|
|
448
|
-
- [`cliOptions.depsToTranspile`](#clioptionsdepstotranspile)
|
|
449
|
-
- [`cliOptions.writeManifest`](#clioptionswritemanifest)
|
|
450
|
-
- [`cliOptions.serve`](#clioptionsserve)
|
|
451
|
-
- [`cliOptions.verboseErrors`](#clioptionsverboseerrors)
|
|
452
|
-
- [`cliOptions.suppressWarnings`](#clioptionssuppresswarnings)
|
|
453
|
-
- [`bundlerCustomizer`](#bundlercustomizer)
|
|
454
|
-
|
|
455
|
-
#### `bundler`
|
|
456
|
-
|
|
457
|
-
- Type: `"browserify"` | `"webpack"`
|
|
458
|
-
- Default: `"browserify"`
|
|
459
|
-
|
|
460
|
-
The bundler to use. The MetaMask Snaps CLI supports both Browserify and
|
|
461
|
-
Webpack. For backwards compatibility, Browserify is the default, but we
|
|
462
|
-
recommend using Webpack. Browserify support will be removed in the future.
|
|
463
|
-
|
|
464
|
-
This section describes the options for the Browserify bundler. For Webpack,
|
|
465
|
-
refer to the [options](#options) section.
|
|
466
|
-
|
|
467
|
-
#### `cliOptions`
|
|
468
|
-
|
|
469
|
-
- Type: `object`
|
|
470
|
-
|
|
471
|
-
The CLI options. These can be specified using the CLI, but can also be
|
|
472
|
-
specified in the configuration file. For example, the `--port` option can be
|
|
473
|
-
specified in the configuration file as follows:
|
|
474
|
-
|
|
475
|
-
```ts
|
|
476
|
-
export default {
|
|
477
|
-
cliOptions: {
|
|
478
|
-
port: 8081,
|
|
479
|
-
},
|
|
480
|
-
};
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
But can also be specified using the CLI:
|
|
484
|
-
|
|
485
|
-
```bash
|
|
486
|
-
$ mm-snap serve --port 8081
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
If the same option is specified in both the configuration file and the CLI,
|
|
490
|
-
the CLI option takes precedence.
|
|
491
|
-
|
|
492
|
-
##### `cliOptions.bundle`
|
|
493
|
-
|
|
494
|
-
- Type: `string`
|
|
495
|
-
- Default: `dist/bundle.js`
|
|
496
|
-
|
|
497
|
-
The path to the bundle file. This is where the bundle will be written to.
|
|
498
|
-
|
|
499
|
-
##### `cliOptions.dist`
|
|
500
|
-
|
|
501
|
-
- Type: `string`
|
|
502
|
-
- Default: `dist`
|
|
503
|
-
|
|
504
|
-
The path to the distribution directory. This is where the bundle file will be
|
|
505
|
-
written to, if the `bundle` option is not specified.
|
|
506
|
-
|
|
507
|
-
##### `cliOptions.eval`
|
|
508
|
-
|
|
509
|
-
- Type: `boolean`
|
|
510
|
-
- Default: `true`
|
|
511
|
-
|
|
512
|
-
Whether to evaluate the bundle. If `true`, the bundle will be evaluated in the
|
|
513
|
-
MetaMask Snaps runtime, to check for any compatibility issues.
|
|
514
|
-
|
|
515
|
-
##### `cliOptions.manifest`
|
|
516
|
-
|
|
517
|
-
- Type: `boolean`
|
|
518
|
-
- Default: `true`
|
|
519
|
-
|
|
520
|
-
Whether to validate the snap manifest. If `true`, the snap manifest will be
|
|
521
|
-
validated, and any errors or warnings will be shown.
|
|
522
|
-
|
|
523
|
-
##### `cliOptions.outfileName`
|
|
524
|
-
|
|
525
|
-
- Type: `string`
|
|
526
|
-
- Default: `bundle.js`
|
|
527
|
-
|
|
528
|
-
The name of the bundle file. This is used to generate the bundle file path,
|
|
529
|
-
using the `dist` option. For example, if `dist` is `dist`, and `outfileName`
|
|
530
|
-
is `bundle.js`, the bundle file path will be `dist/bundle.js`. This option is
|
|
531
|
-
ignored if the `bundle` option is specified.
|
|
532
|
-
|
|
533
|
-
##### `cliOptions.port`
|
|
534
|
-
|
|
535
|
-
- Type: `number`
|
|
536
|
-
- Default: `8081`
|
|
537
|
-
|
|
538
|
-
The port to use for the development server.
|
|
539
|
-
|
|
540
|
-
##### `cliOptions.root`
|
|
541
|
-
|
|
542
|
-
- Type: `string`
|
|
543
|
-
- Default: `.`
|
|
544
|
-
|
|
545
|
-
The root directory. This should be the directory that contains the snap
|
|
546
|
-
manifest, and the `dist` directory. This will be served by the development
|
|
547
|
-
server.
|
|
548
|
-
|
|
549
|
-
##### `cliOptions.sourceMaps`
|
|
550
|
-
|
|
551
|
-
- Type: `boolean`
|
|
552
|
-
- Default: `false`
|
|
553
|
-
|
|
554
|
-
Whether to generate source maps. If `true`, source maps will be generated for
|
|
555
|
-
the bundle.
|
|
556
|
-
|
|
557
|
-
##### `cliOptions.src`
|
|
558
|
-
|
|
559
|
-
- Type: `string`
|
|
560
|
-
- Default: `src/index.js`
|
|
561
|
-
|
|
562
|
-
The path to the entry file. This is the file that will be bundled.
|
|
563
|
-
|
|
564
|
-
##### `cliOptions.stripComments`
|
|
565
|
-
|
|
566
|
-
- Type: `boolean`
|
|
567
|
-
- Default: `true`
|
|
568
|
-
|
|
569
|
-
Whether to strip comments from the bundle. If `true`, comments will be stripped
|
|
570
|
-
from the bundle, and the bundle will be minified.
|
|
571
|
-
|
|
572
|
-
##### `cliOptions.transpilationMode`
|
|
573
|
-
|
|
574
|
-
- Type: `'localAndDeps' | 'localOnly' | 'none'`
|
|
575
|
-
- Default: `'localOnly'`
|
|
576
|
-
|
|
577
|
-
The transpilation mode to use. This determines which files will be transpiled
|
|
578
|
-
by Babel. The possible values are:
|
|
579
|
-
|
|
580
|
-
- `'localAndDeps'`: Transpile all files, including dependencies.
|
|
581
|
-
- `'localOnly'`: Transpile only local files.
|
|
582
|
-
- `'none'`: Do not transpile any files.
|
|
583
|
-
|
|
584
|
-
##### `cliOptions.depsToTranspile`
|
|
585
|
-
|
|
586
|
-
- Type: `string[]`
|
|
587
|
-
- Default: `[]`
|
|
588
|
-
|
|
589
|
-
If `transpilationMode` is `'localAndDeps'`, this option can be used to specify
|
|
590
|
-
which dependencies should be transpiled. This is useful if you want to transpile
|
|
591
|
-
a limited set of dependencies, but not all of them.
|
|
592
|
-
|
|
593
|
-
##### `cliOptions.writeManifest`
|
|
594
|
-
|
|
595
|
-
- Type: `boolean`
|
|
596
|
-
- Default: `true`
|
|
597
|
-
|
|
598
|
-
Whether to write the snap manifest. If `true`, the snap manifest will be written
|
|
599
|
-
with any changes made by the CLI, if the manifest is invalid.
|
|
600
|
-
|
|
601
|
-
##### `cliOptions.serve`
|
|
602
|
-
|
|
603
|
-
- Type: `boolean`
|
|
604
|
-
- Default: `true`
|
|
605
|
-
|
|
606
|
-
Whether to serve the snap. If `true`, the snap will be served by the development
|
|
607
|
-
server, when running `mm-snap watch`.
|
|
608
|
-
|
|
609
|
-
##### `cliOptions.suppressWarnings`
|
|
610
|
-
|
|
611
|
-
- Type: `boolean`
|
|
612
|
-
- Default: `false`
|
|
613
|
-
|
|
614
|
-
This option exists for backwards compatibility, and is ignored.
|
|
615
|
-
|
|
616
|
-
##### `cliOptions.verboseErrors`
|
|
617
|
-
|
|
618
|
-
- Type: `boolean`
|
|
619
|
-
- Default: `false`
|
|
620
|
-
|
|
621
|
-
This option exists for backwards compatibility, and is ignored.
|
|
622
|
-
|
|
623
|
-
#### `bundlerCustomizer`
|
|
624
|
-
|
|
625
|
-
- Type: `(bundler: BrowserifyObject) => void`
|
|
626
|
-
|
|
627
|
-
A function that customizes the bundler. This function is called after the
|
|
628
|
-
bundler is created, but before the bundle is written to disk. This can be used
|
|
629
|
-
to customize the bundler, for example to add plugins or transforms.
|
|
630
|
-
|
|
631
|
-
```typescript
|
|
632
|
-
import type { SnapConfig } from '@metamask/snaps-cli';
|
|
633
|
-
import type { BrowserifyObject } from 'browserify';
|
|
634
|
-
|
|
635
|
-
const config: SnapConfig = {
|
|
636
|
-
bundlerCustomizer: (bundler: BrowserifyObject) => {
|
|
637
|
-
// Add the BRFS transform to Browserify.
|
|
638
|
-
bundler.transform('brfs');
|
|
639
|
-
},
|
|
640
|
-
};
|
|
641
|
-
|
|
642
|
-
export default config;
|
|
643
|
-
```
|
package/dist/builders.cjs
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TranspilationModes = void 0;
|
|
4
|
-
var TranspilationModes;
|
|
5
|
-
(function (TranspilationModes) {
|
|
6
|
-
TranspilationModes["LocalAndDeps"] = "localAndDeps";
|
|
7
|
-
TranspilationModes["LocalOnly"] = "localOnly";
|
|
8
|
-
TranspilationModes["None"] = "none";
|
|
9
|
-
})(TranspilationModes || (exports.TranspilationModes = TranspilationModes = {}));
|
|
10
3
|
const builders = {
|
|
11
4
|
analyze: {
|
|
12
5
|
describe: 'Analyze the Snap bundle',
|
|
@@ -28,33 +21,6 @@ const builders = {
|
|
|
28
21
|
type: 'string',
|
|
29
22
|
normalize: true,
|
|
30
23
|
},
|
|
31
|
-
// Deprecated Browserify options.
|
|
32
|
-
bundle: {
|
|
33
|
-
alias: 'b',
|
|
34
|
-
describe: 'Snap bundle file',
|
|
35
|
-
type: 'string',
|
|
36
|
-
normalize: true,
|
|
37
|
-
deprecated: 'Use --input instead.',
|
|
38
|
-
},
|
|
39
|
-
dist: {
|
|
40
|
-
alias: 'd',
|
|
41
|
-
describe: 'Output directory',
|
|
42
|
-
type: 'string',
|
|
43
|
-
normalize: true,
|
|
44
|
-
deprecated: true,
|
|
45
|
-
},
|
|
46
|
-
eval: {
|
|
47
|
-
alias: 'e',
|
|
48
|
-
describe: 'Attempt to evaluate Snap bundle in SES',
|
|
49
|
-
type: 'boolean',
|
|
50
|
-
deprecated: true,
|
|
51
|
-
},
|
|
52
|
-
manifest: {
|
|
53
|
-
alias: 'm',
|
|
54
|
-
describe: 'Validate snap.manifest.json',
|
|
55
|
-
type: 'boolean',
|
|
56
|
-
deprecated: true,
|
|
57
|
-
},
|
|
58
24
|
port: {
|
|
59
25
|
alias: 'p',
|
|
60
26
|
describe: 'Local server port for testing',
|
|
@@ -66,69 +32,6 @@ const builders = {
|
|
|
66
32
|
}
|
|
67
33
|
return port;
|
|
68
34
|
},
|
|
69
|
-
deprecated: true,
|
|
70
|
-
},
|
|
71
|
-
outfileName: {
|
|
72
|
-
alias: 'n',
|
|
73
|
-
describe: 'Output file name',
|
|
74
|
-
type: 'string',
|
|
75
|
-
deprecated: true,
|
|
76
|
-
},
|
|
77
|
-
root: {
|
|
78
|
-
alias: 'r',
|
|
79
|
-
describe: 'Server root directory',
|
|
80
|
-
type: 'string',
|
|
81
|
-
normalize: true,
|
|
82
|
-
deprecated: true,
|
|
83
|
-
},
|
|
84
|
-
sourceMaps: {
|
|
85
|
-
describe: 'Whether builds include sourcemaps',
|
|
86
|
-
type: 'boolean',
|
|
87
|
-
deprecated: true,
|
|
88
|
-
},
|
|
89
|
-
src: {
|
|
90
|
-
alias: 's',
|
|
91
|
-
describe: 'Source file',
|
|
92
|
-
type: 'string',
|
|
93
|
-
normalize: true,
|
|
94
|
-
deprecated: true,
|
|
95
|
-
},
|
|
96
|
-
stripComments: {
|
|
97
|
-
alias: 'strip',
|
|
98
|
-
describe: 'Whether to remove code comments from the build output',
|
|
99
|
-
type: 'boolean',
|
|
100
|
-
deprecated: true,
|
|
101
|
-
},
|
|
102
|
-
suppressWarnings: {
|
|
103
|
-
type: 'boolean',
|
|
104
|
-
describe: 'Whether to suppress warnings',
|
|
105
|
-
deprecated: true,
|
|
106
|
-
},
|
|
107
|
-
transpilationMode: {
|
|
108
|
-
type: 'string',
|
|
109
|
-
describe: 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',
|
|
110
|
-
choices: Object.values(TranspilationModes),
|
|
111
|
-
deprecated: true,
|
|
112
|
-
},
|
|
113
|
-
depsToTranspile: {
|
|
114
|
-
type: 'array',
|
|
115
|
-
describe: 'Transpile only the listed dependencies.',
|
|
116
|
-
deprecated: true,
|
|
117
|
-
},
|
|
118
|
-
verboseErrors: {
|
|
119
|
-
type: 'boolean',
|
|
120
|
-
describe: 'Display original errors',
|
|
121
|
-
deprecated: true,
|
|
122
|
-
},
|
|
123
|
-
writeManifest: {
|
|
124
|
-
describe: 'Make necessary changes to the snap manifest file',
|
|
125
|
-
type: 'boolean',
|
|
126
|
-
deprecated: true,
|
|
127
|
-
},
|
|
128
|
-
serve: {
|
|
129
|
-
describe: 'Serve snap file(s) locally for testing',
|
|
130
|
-
type: 'boolean',
|
|
131
|
-
deprecated: true,
|
|
132
35
|
},
|
|
133
36
|
};
|
|
134
37
|
exports.default = builders;
|
package/dist/builders.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.cjs","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"builders.cjs","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":";;AAEA,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE;QACP,QAAQ,EAAE,yBAAyB;QACnC,IAAI,EAAE,SAAS;KAChB;IAED,MAAM,EAAE;QACN,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,qBAAqB;QAC/B,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,IAAI;KAChB;IAED,GAAG,EAAE;QACH,QAAQ,EAAE,mCAAmC;QAC7C,IAAI,EAAE,SAAS;KAChB;IAED,KAAK,EAAE;QACL,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,8BAA8B;QACxC,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,IAAI;KAChB;IAED,IAAI,EAAE;QACJ,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,+BAA+B;QACzC,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,CAAC,GAAY,EAAE,EAAE;YACvB,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;YAC9C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF;CACmD,CAAC;AAEvD,kBAAe,QAAQ,CAAC","sourcesContent":["import type { Options } from 'yargs';\n\nconst builders = {\n analyze: {\n describe: 'Analyze the Snap bundle',\n type: 'boolean',\n },\n\n config: {\n alias: 'c',\n describe: 'Path to config file',\n type: 'string',\n normalize: true,\n },\n\n fix: {\n describe: 'Attempt to fix snap.manifest.json',\n type: 'boolean',\n },\n\n input: {\n alias: 'i',\n describe: 'Snap bundle file to evaluate',\n type: 'string',\n normalize: true,\n },\n\n port: {\n alias: 'p',\n describe: 'Local server port for testing',\n type: 'number',\n coerce: (arg: unknown) => {\n const port = Number.parseInt(String(arg), 10);\n if (Number.isNaN(port)) {\n throw new Error(`Invalid port: \"${String(arg)}\".`);\n }\n\n return port;\n },\n },\n} as const satisfies Record<string, Readonly<Options>>;\n\nexport default builders;\n"]}
|
package/dist/builders.d.cts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export declare enum TranspilationModes {
|
|
2
|
-
LocalAndDeps = "localAndDeps",
|
|
3
|
-
LocalOnly = "localOnly",
|
|
4
|
-
None = "none"
|
|
5
|
-
}
|
|
6
1
|
declare const builders: {
|
|
7
2
|
readonly analyze: {
|
|
8
3
|
readonly describe: "Analyze the Snap bundle";
|
|
@@ -24,100 +19,11 @@ declare const builders: {
|
|
|
24
19
|
readonly type: "string";
|
|
25
20
|
readonly normalize: true;
|
|
26
21
|
};
|
|
27
|
-
readonly bundle: {
|
|
28
|
-
readonly alias: "b";
|
|
29
|
-
readonly describe: "Snap bundle file";
|
|
30
|
-
readonly type: "string";
|
|
31
|
-
readonly normalize: true;
|
|
32
|
-
readonly deprecated: "Use --input instead.";
|
|
33
|
-
};
|
|
34
|
-
readonly dist: {
|
|
35
|
-
readonly alias: "d";
|
|
36
|
-
readonly describe: "Output directory";
|
|
37
|
-
readonly type: "string";
|
|
38
|
-
readonly normalize: true;
|
|
39
|
-
readonly deprecated: true;
|
|
40
|
-
};
|
|
41
|
-
readonly eval: {
|
|
42
|
-
readonly alias: "e";
|
|
43
|
-
readonly describe: "Attempt to evaluate Snap bundle in SES";
|
|
44
|
-
readonly type: "boolean";
|
|
45
|
-
readonly deprecated: true;
|
|
46
|
-
};
|
|
47
|
-
readonly manifest: {
|
|
48
|
-
readonly alias: "m";
|
|
49
|
-
readonly describe: "Validate snap.manifest.json";
|
|
50
|
-
readonly type: "boolean";
|
|
51
|
-
readonly deprecated: true;
|
|
52
|
-
};
|
|
53
22
|
readonly port: {
|
|
54
23
|
readonly alias: "p";
|
|
55
24
|
readonly describe: "Local server port for testing";
|
|
56
25
|
readonly type: "number";
|
|
57
26
|
readonly coerce: (arg: unknown) => number;
|
|
58
|
-
readonly deprecated: true;
|
|
59
|
-
};
|
|
60
|
-
readonly outfileName: {
|
|
61
|
-
readonly alias: "n";
|
|
62
|
-
readonly describe: "Output file name";
|
|
63
|
-
readonly type: "string";
|
|
64
|
-
readonly deprecated: true;
|
|
65
|
-
};
|
|
66
|
-
readonly root: {
|
|
67
|
-
readonly alias: "r";
|
|
68
|
-
readonly describe: "Server root directory";
|
|
69
|
-
readonly type: "string";
|
|
70
|
-
readonly normalize: true;
|
|
71
|
-
readonly deprecated: true;
|
|
72
|
-
};
|
|
73
|
-
readonly sourceMaps: {
|
|
74
|
-
readonly describe: "Whether builds include sourcemaps";
|
|
75
|
-
readonly type: "boolean";
|
|
76
|
-
readonly deprecated: true;
|
|
77
|
-
};
|
|
78
|
-
readonly src: {
|
|
79
|
-
readonly alias: "s";
|
|
80
|
-
readonly describe: "Source file";
|
|
81
|
-
readonly type: "string";
|
|
82
|
-
readonly normalize: true;
|
|
83
|
-
readonly deprecated: true;
|
|
84
|
-
};
|
|
85
|
-
readonly stripComments: {
|
|
86
|
-
readonly alias: "strip";
|
|
87
|
-
readonly describe: "Whether to remove code comments from the build output";
|
|
88
|
-
readonly type: "boolean";
|
|
89
|
-
readonly deprecated: true;
|
|
90
|
-
};
|
|
91
|
-
readonly suppressWarnings: {
|
|
92
|
-
readonly type: "boolean";
|
|
93
|
-
readonly describe: "Whether to suppress warnings";
|
|
94
|
-
readonly deprecated: true;
|
|
95
|
-
};
|
|
96
|
-
readonly transpilationMode: {
|
|
97
|
-
readonly type: "string";
|
|
98
|
-
readonly describe: "Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing";
|
|
99
|
-
readonly choices: TranspilationModes[];
|
|
100
|
-
readonly deprecated: true;
|
|
101
|
-
};
|
|
102
|
-
readonly depsToTranspile: {
|
|
103
|
-
readonly type: "array";
|
|
104
|
-
readonly describe: "Transpile only the listed dependencies.";
|
|
105
|
-
readonly deprecated: true;
|
|
106
|
-
};
|
|
107
|
-
readonly verboseErrors: {
|
|
108
|
-
readonly type: "boolean";
|
|
109
|
-
readonly describe: "Display original errors";
|
|
110
|
-
readonly deprecated: true;
|
|
111
|
-
};
|
|
112
|
-
readonly writeManifest: {
|
|
113
|
-
readonly describe: "Make necessary changes to the snap manifest file";
|
|
114
|
-
readonly type: "boolean";
|
|
115
|
-
readonly deprecated: true;
|
|
116
|
-
};
|
|
117
|
-
readonly serve: {
|
|
118
|
-
readonly describe: "Serve snap file(s) locally for testing";
|
|
119
|
-
readonly type: "boolean";
|
|
120
|
-
readonly deprecated: true;
|
|
121
27
|
};
|
|
122
28
|
};
|
|
123
29
|
export default builders;
|
package/dist/builders.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.cts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"builders.d.cts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;+BA6BI,OAAO;;CAS6B,CAAC;AAEvD,eAAe,QAAQ,CAAC"}
|