@metamask/snaps-cli 0.16.0 → 0.18.1

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.
Files changed (71) hide show
  1. package/README.md +2 -0
  2. package/dist/builders.d.ts +6 -0
  3. package/dist/builders.js +20 -1
  4. package/dist/builders.js.map +1 -1
  5. package/dist/cli.d.ts +7 -0
  6. package/dist/cli.js +8 -0
  7. package/dist/cli.js.map +1 -1
  8. package/dist/cmds/build/buildHandler.d.ts +4 -4
  9. package/dist/cmds/build/buildHandler.js +5 -5
  10. package/dist/cmds/build/buildHandler.js.map +1 -1
  11. package/dist/cmds/build/bundle.d.ts +3 -2
  12. package/dist/cmds/build/bundle.js +7 -12
  13. package/dist/cmds/build/bundle.js.map +1 -1
  14. package/dist/cmds/build/utils.d.ts +21 -8
  15. package/dist/cmds/build/utils.js +22 -9
  16. package/dist/cmds/build/utils.js.map +1 -1
  17. package/dist/cmds/eval/eval-worker.js +16 -21
  18. package/dist/cmds/eval/eval-worker.js.map +1 -1
  19. package/dist/cmds/eval/evalHandler.d.ts +7 -0
  20. package/dist/cmds/eval/evalHandler.js +7 -0
  21. package/dist/cmds/eval/evalHandler.js.map +1 -1
  22. package/dist/cmds/eval/mock.d.ts +11 -0
  23. package/dist/cmds/eval/mock.js +39 -3
  24. package/dist/cmds/eval/mock.js.map +1 -1
  25. package/dist/cmds/eval/workerEval.d.ts +7 -0
  26. package/dist/cmds/eval/workerEval.js +11 -6
  27. package/dist/cmds/eval/workerEval.js.map +1 -1
  28. package/dist/cmds/init/index.js +14 -6
  29. package/dist/cmds/init/index.js.map +1 -1
  30. package/dist/cmds/init/init-template.json +5 -1
  31. package/dist/cmds/init/initHandler.d.ts +11 -0
  32. package/dist/cmds/init/initHandler.js +39 -4
  33. package/dist/cmds/init/initHandler.js.map +1 -1
  34. package/dist/cmds/init/initUtils.d.ts +21 -4
  35. package/dist/cmds/init/initUtils.js +55 -7
  36. package/dist/cmds/init/initUtils.js.map +1 -1
  37. package/dist/cmds/manifest/index.js +1 -1
  38. package/dist/cmds/manifest/index.js.map +1 -1
  39. package/dist/cmds/manifest/manifestHandler.d.ts +1 -0
  40. package/dist/cmds/manifest/manifestHandler.js +24 -7
  41. package/dist/cmds/manifest/manifestHandler.js.map +1 -1
  42. package/dist/cmds/serve/index.js +2 -44
  43. package/dist/cmds/serve/index.js.map +1 -1
  44. package/dist/cmds/serve/serveHandler.d.ts +10 -0
  45. package/dist/cmds/serve/serveHandler.js +51 -0
  46. package/dist/cmds/serve/serveHandler.js.map +1 -0
  47. package/dist/cmds/serve/serveUtils.d.ts +17 -0
  48. package/dist/cmds/serve/serveUtils.js +17 -0
  49. package/dist/cmds/serve/serveUtils.js.map +1 -1
  50. package/dist/cmds/watch/index.js +3 -0
  51. package/dist/cmds/watch/index.js.map +1 -1
  52. package/dist/cmds/watch/watchHandler.d.ts +4 -4
  53. package/dist/cmds/watch/watchHandler.js +13 -7
  54. package/dist/cmds/watch/watchHandler.js.map +1 -1
  55. package/dist/utils/fs.d.ts +5 -5
  56. package/dist/utils/fs.js +5 -5
  57. package/dist/utils/fs.js.map +1 -1
  58. package/dist/utils/misc.d.ts +16 -13
  59. package/dist/utils/misc.js +16 -13
  60. package/dist/utils/misc.js.map +1 -1
  61. package/dist/utils/readline.d.ts +25 -0
  62. package/dist/utils/readline.js +25 -0
  63. package/dist/utils/readline.js.map +1 -1
  64. package/dist/utils/snap-config.d.ts +14 -0
  65. package/dist/utils/snap-config.js +15 -1
  66. package/dist/utils/snap-config.js.map +1 -1
  67. package/dist/utils/validate-fs.d.ts +19 -18
  68. package/dist/utils/validate-fs.js +21 -20
  69. package/dist/utils/validate-fs.js.map +1 -1
  70. package/package.json +11 -11
  71. package/CHANGELOG.md +0 -227
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/snaps-cli",
3
- "version": "0.16.0",
3
+ "version": "0.18.1",
4
4
  "description": "A CLI for developing MetaMask Snaps.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,6 @@
14
14
  "dist/"
15
15
  ],
16
16
  "scripts": {
17
- "setup": "yarn install && yarn allow-scripts",
18
17
  "shasum": "node ./scripts/computeSnapShasum.js",
19
18
  "build:init-template": "node ./scripts/createInitTemplate.js && yarn prettier --check src/cmds/init/init-template.json",
20
19
  "build:guards": "ts-auto-guard --guard-file-name=__GENERATED__ ./src/utils/snap-config.ts",
@@ -36,7 +35,7 @@
36
35
  "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",
37
36
  "lint": "yarn lint:eslint && yarn lint:misc --check",
38
37
  "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
39
- "publish": "../../scripts/publish-package.sh"
38
+ "publish:package": "../../scripts/publish-package.sh"
40
39
  },
41
40
  "dependencies": {
42
41
  "@babel/core": "^7.16.7",
@@ -47,12 +46,12 @@
47
46
  "@babel/plugin-transform-runtime": "^7.16.7",
48
47
  "@babel/preset-env": "^7.16.7",
49
48
  "@babel/preset-typescript": "^7.16.7",
50
- "@metamask/snap-controllers": "^0.16.0",
51
- "@metamask/snaps-browserify-plugin": "^0.16.0",
49
+ "@metamask/snap-controllers": "^0.18.1",
50
+ "@metamask/snaps-browserify-plugin": "^0.18.1",
52
51
  "@metamask/utils": "^2.0.0",
53
52
  "babelify": "^10.0.0",
54
53
  "browserify": "^17.0.0",
55
- "chokidar": "^3.0.2",
54
+ "chokidar": "^3.5.2",
56
55
  "init-package-json": "^1.10.3",
57
56
  "is-url": "^1.2.4",
58
57
  "mkdirp": "^1.0.4",
@@ -66,10 +65,10 @@
66
65
  "devDependencies": {
67
66
  "@lavamoat/allow-scripts": "^2.0.3",
68
67
  "@metamask/auto-changelog": "^2.6.0",
69
- "@metamask/eslint-config": "^8.0.0",
70
- "@metamask/eslint-config-jest": "^8.0.0",
71
- "@metamask/eslint-config-nodejs": "^8.0.0",
72
- "@metamask/eslint-config-typescript": "^8.0.0",
68
+ "@metamask/eslint-config": "^9.0.0",
69
+ "@metamask/eslint-config-jest": "^9.0.0",
70
+ "@metamask/eslint-config-nodejs": "^9.0.0",
71
+ "@metamask/eslint-config-typescript": "^9.0.1",
73
72
  "@types/browserify": "^12.0.36",
74
73
  "@types/init-package-json": "^1.10.0",
75
74
  "@types/is-url": "^1.2.28",
@@ -86,6 +85,7 @@
86
85
  "eslint-config-prettier": "^8.3.0",
87
86
  "eslint-plugin-import": "^2.23.4",
88
87
  "eslint-plugin-jest": "^24.4.0",
88
+ "eslint-plugin-jsdoc": "^36.1.0",
89
89
  "eslint-plugin-node": "^11.1.0",
90
90
  "eslint-plugin-prettier": "^3.4.0",
91
91
  "execa": "^5.1.1",
@@ -102,7 +102,7 @@
102
102
  "typescript": "^4.4.0"
103
103
  },
104
104
  "engines": {
105
- "node": ">=14.0.0"
105
+ "node": ">=16.0.0"
106
106
  },
107
107
  "publishConfig": {
108
108
  "access": "public",
package/CHANGELOG.md DELETED
@@ -1,227 +0,0 @@
1
- # Changelog
2
- All notable changes to this project will be documented in this file.
3
-
4
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
-
7
- ## [Unreleased]
8
-
9
- ## [0.16.0]
10
- ### Changed
11
- - **BREAKING:** Snaps are now required to export `onRpcRequest` to receive RPC requests ([#481](https://github.com/MetaMask/snaps-skunkworks/pull/481), [#533](https://github.com/MetaMask/snaps-skunkworks/pull/533), [#538](https://github.com/MetaMask/snaps-skunkworks/pull/538), [#541](https://github.com/MetaMask/snaps-skunkworks/pull/541), [#544](https://github.com/MetaMask/snaps-skunkworks/pull/544))
12
- - The type of the function is available in `@metamask/snap-types` as `OnRpcRequestHandler`.
13
-
14
- ### Fixed
15
- - Fix importing local files in TypeScript Snaps ([#527](https://github.com/MetaMask/snaps-skunkworks/pull/527))
16
- - Fix `build` command when the CLI is installed globally ([#542](https://github.com/MetaMask/snaps-skunkworks/pull/542))
17
-
18
- ## [0.15.0]
19
- ### Added
20
- - Add support for building TypeScript Snaps ([#443](https://github.com/MetaMask/snaps-skunkworks/pull/443))
21
-
22
- ### Fixed
23
- - Fix an issue where comment stripping would break for large files ([#468](https://github.com/MetaMask/snaps-skunkworks/pull/468))
24
-
25
- ## [0.14.0]
26
- ### Changed
27
- - **BREAKING:** Increase TypeScript compilation target to ES2020 ([#449](https://github.com/MetaMask/snaps-skunkworks/pull/449))
28
- - This should not be breaking for consumers on any non-deprecated browser or Node.js version.
29
-
30
- ## [0.13.0]
31
- ### Changed
32
- - No changes this release.
33
-
34
- ## [0.12.0]
35
- ### Changed
36
- - No changes this release.
37
-
38
- ## [0.11.1]
39
- ### Changed
40
- - No changes this release.
41
-
42
- ## [0.11.0]
43
- ### Added
44
- - Add self to mock endowments ([#341](https://github.com/MetaMask/snaps-skunkworks/pull/341))
45
-
46
- ### Changed
47
- - Bump `ses` to `0.15.15` ([#396](https://github.com/MetaMask/snaps-skunkworks/pull/396))
48
- - Upgraded TypeScript version to minimum 4.4 ([#360](https://github.com/MetaMask/snaps-skunkworks/pull/360))
49
- - Update template files ([#350](https://github.com/MetaMask/snaps-skunkworks/pull/350))
50
-
51
- ## [0.10.7]
52
- ### Changed
53
- - **BREAKING:** Bump minimum Node version from 12 to 14 ([#331](https://github.com/MetaMask/snaps-skunkworks/pull/331))
54
- - Update `mm-snap init` template files ([#330](https://github.com/MetaMask/snaps-skunkworks/pull/330))
55
-
56
- ### Fixed
57
- - Fix issue where comment stripping would create invalid bundles ([#336](https://github.com/MetaMask/snaps-skunkworks/pull/336))
58
-
59
- ## [0.10.6]
60
- ### Fixed
61
- - Fix endowment mocking during `mm-snap eval` ([#311](https://github.com/MetaMask/snaps-skunkworks/pull/311))
62
-
63
- ## [0.10.5]
64
- ### Changed
65
- - No changes this release.
66
-
67
- ## [0.10.3]
68
- ### Fixed
69
- - Improve dynamic mocking ([#262](https://github.com/MetaMask/snaps-skunkworks/pull/262))
70
-
71
- ## [0.10.2]
72
- ### Fixed
73
- - Installation failure ([#279](https://github.com/MetaMask/snaps-skunkworks/pull/279))
74
- - A faulty installation script in a dependency caused the installation of this package to fail.
75
-
76
- ## [0.10.1]
77
- ### Fixed
78
- - Comment stripping will no longer remove empty block comments in strings ([#276](https://github.com/MetaMask/snaps-skunkworks/pull/276))
79
-
80
- ## [0.10.0]
81
- ### Added
82
- - **BREAKING:** Transform HTML comments by default ([#237](https://github.com/MetaMask/snaps-skunkworks/pull/237))
83
- - The strings `<!--` and `-->` will be transformed into `< !--` and `-- >` respectively by default. If these strings appear as operands in an expression or in a string literal, this transform will change the behavior of your program. This behavior was added because these strings are rejected by SES. The behavior can be toggled using the `--transformHtmlComments` option.
84
- - `--transpiledDeps` flag to `build` and `watch` commands ([#221](https://github.com/MetaMask/snaps-skunkworks/pull/221))
85
- - This flag allows the user to specify which dependencies will be transpiled at build time if the `--transpilationMode` is `--localAndDeps`.
86
- - Add CLI usage instructions to readme ([#228](https://github.com/MetaMask/snaps-skunkworks/pull/228))
87
- - Build process customization ([#251](https://github.com/MetaMask/snaps-skunkworks/pull/251))
88
- - Builds can now be customized by adding a `bundlerCustomizer` function to `snap.config.js`. See the README for details.
89
-
90
- ### Changed
91
- - **BREAKING:** Change Snap config file format ([#251](https://github.com/MetaMask/snaps-skunkworks/pull/251))
92
- - The CLI now expects a file `snap.config.js` instead of `snap.config.json`, with a different structure. See the README for details.
93
- - **BREAKING:** Strip comments in source code by default ([#243](https://github.com/MetaMask/snaps-skunkworks/pull/243))
94
- - All comments will now be stripped from snap source code (including dependencies) by default.
95
- - Enable `--verboseErrors` by default ([#249](https://github.com/MetaMask/snaps-skunkworks/pull/249))
96
-
97
- ### Fixed
98
- - Comment stripping bug ([#270](https://github.com/MetaMask/snaps-skunkworks/pull/270))
99
- - Prior to this change, if the `--strip-comments` option was provided to `mm-snap build` and an empty block comment of the form `/**/` appeared anywhere in the source code (including dependencies), the remainder of the string after the empty block comment would be truncated. This was resolved by removing all instances of the string `/**/` from the raw bundle string.
100
- - In an upcoming release, the string `/**/` will only be removed if it is in fact an empty block comment, and not if it e.g. appears in a string literal.
101
- - `watch` command parity with `build` command ([#241](https://github.com/MetaMask/snaps-skunkworks/pull/241))
102
- - The `build` command had received a number of options that were not made available to the `watch` command. They now have the same options.
103
- - Update dead link in readme ([#240](https://github.com/MetaMask/snaps-skunkworks/pull/240))
104
-
105
- ## [0.9.0]
106
- ### Added
107
- - Transpilation configuration ([#213](https://github.com/MetaMask/snaps-skunkworks/pull/213))
108
- - `mm-snap build` now takes a `--transpilationMode` argument which determines what will be transpiled by Babel during building: all source code (including dependencies), local source code only, or nothing.
109
-
110
- ### Fixed
111
- - `mm-snap build` command when CLI is installed globally ([#216](https://github.com/MetaMask/snaps-skunkworks/pull/216))
112
- - Update installation command in readme ([#205](https://github.com/MetaMask/snaps-skunkworks/pull/205))
113
-
114
- ## [0.8.0]
115
- ### Changed
116
- - Update template snap created by `mm-snap init` ([#195](https://github.com/MetaMask/snaps-skunkworks/pull/195))
117
- - Exit by throwing errors instead of calling `process.exit` ([#190](https://github.com/MetaMask/snaps-skunkworks/pull/190))
118
-
119
- ## [0.7.0]
120
- ### Added
121
- - ESM support for `mm-snap build` ([#185](https://github.com/MetaMask/snaps-skunkworks/pull/185))
122
- - The `build` command can now handle snap source code that includes ESM import / export statements. They will be transpiled to their CommonJS equivalents via Babel.
123
-
124
- ### Fixed
125
- - Fix `mm-snap init` `src` default value ([#186](https://github.com/MetaMask/snaps-skunkworks/pull/186))
126
- - It now correctly defaults to `src/index.js` instead of just `index.js`.
127
- - Fix comment stripping ([#189](https://github.com/MetaMask/snaps-skunkworks/pull/189))
128
- - Comments wouldn't be stripped under certain circumstances due to a RegEx error, details [here](https://github.com/jonschlinkert/strip-comments/pull/49).
129
-
130
- ## [0.6.3]
131
- ### Changed
132
- - No changes this release.
133
-
134
- ## [0.6.2]
135
- ### Changed
136
- - No changes this release.
137
-
138
- ## [0.6.1]
139
- ### Fixed
140
- - `mm-snap init` Snap `snap_confirm` call ([#168](https://github.com/MetaMask/snaps-skunkworks/pull/168))
141
- - The generated Snap was passing invalid parameters to the method.
142
-
143
- ## [0.6.0]
144
- ### Added
145
- - Snap SVG icon support ([#163](https://github.com/MetaMask/snaps-skunkworks/pull/163))
146
-
147
- ### Changed
148
- - **BREAKING:** Support the new Snaps publishing specification ([#140](https://github.com/MetaMask/snaps-skunkworks/pull/140), [#160](https://github.com/MetaMask/snaps-skunkworks/pull/160))
149
- - This introduces several breaking changes to how Snaps are developed, hosted, and represented at runtime. See [the specification](https://github.com/MetaMask/specifications/blob/d4a5bf5d6990bb5b02a98bd3f95a24ffb28c701c/snaps/publishing.md) and the referenced pull requests for details.
150
- - **BREAKING:** Rename Snap `name` property to `id` ([#147](https://github.com/MetaMask/snaps-skunkworks/pull/147))
151
- - **BREAKING:** Update `ses` to version `^0.15.3` ([#159](https://github.com/MetaMask/snaps-skunkworks/pull/159))
152
- - This will cause behavioral changes for code executed under SES, and may require modifications to code that previously executed without issues.
153
-
154
- ## [0.5.0]
155
- ### Changed
156
- - **BREAKING:** Convert all TypeScript `interface` declarations to `type` equivalents ([#143](https://github.com/MetaMask/snaps-skunkworks/pull/143))
157
-
158
- ## [0.4.0]
159
- ### Fixed
160
- - Make Windows-compatible ([#131](https://github.com/MetaMask/snaps-skunkworks/pull/131))
161
-
162
- ## [0.3.1]
163
- ### Changed
164
- - No changes this release.
165
-
166
- ## [0.3.0]
167
- ### Changed
168
- - **BREAKING:** Enforce consistent naming for Snaps-related functionality ([#119](https://github.com/MetaMask/snaps-skunkworks/pull/119))
169
-
170
- ## [0.2.2]
171
- ### Fixed
172
- - Package script issues ([#97](https://github.com/MetaMask/snaps-skunkworks/pull/97), [#98](https://github.com/MetaMask/snaps-skunkworks/pull/98))
173
-
174
- ## [0.2.1]
175
- ### Fixed
176
- - Snap produced by `mm-snap init` ([#94](https://github.com/MetaMask/snaps-skunkworks/pull/94))
177
- - The template used to create the "Hello, world!" snap had become outdated due to a build-time bug.
178
-
179
- ## [0.2.0]
180
- ### Changed
181
- - Update publish scripts ([#92](https://github.com/MetaMask/snaps-skunkworks/pull/92))
182
-
183
- ## [0.1.1]
184
- ### Added
185
- - Missing publish scripts to new packages
186
-
187
- ## [0.1.0]
188
- ### Changed
189
- - **BREAKING:** Rename package to `@metamask/snaps-cli` ([#72](https://github.com/MetaMask/snaps-skunkworks/pull/72))
190
- - This package was previously named [`snaps-cli`](https://npmjs.com/package/snaps-cli).
191
- - As part of the renaming, and due to the scope of the changes to both this package and MetaMask Snaps generally, its versioning and changelog have been reset. The original changelog can be found [here](https://github.com/MetaMask/snaps-cli/blob/main/CHANGELOG.md).
192
-
193
- ### Removed
194
- - Example snaps ([#72](https://github.com/MetaMask/snaps-skunkworks/pull/72))
195
- - The examples now live in their own package, [`@metamask/snap-examples`](https://npmjs.com/package/@metamask/snap-examples).
196
-
197
- [Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.16.0...HEAD
198
- [0.16.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.15.0...v0.16.0
199
- [0.15.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.14.0...v0.15.0
200
- [0.14.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.13.0...v0.14.0
201
- [0.13.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.12.0...v0.13.0
202
- [0.12.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.11.1...v0.12.0
203
- [0.11.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.11.0...v0.11.1
204
- [0.11.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.7...v0.11.0
205
- [0.10.7]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.6...v0.10.7
206
- [0.10.6]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.5...v0.10.6
207
- [0.10.5]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.3...v0.10.5
208
- [0.10.3]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.2...v0.10.3
209
- [0.10.2]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.1...v0.10.2
210
- [0.10.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.0...v0.10.1
211
- [0.10.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.9.0...v0.10.0
212
- [0.9.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.8.0...v0.9.0
213
- [0.8.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.7.0...v0.8.0
214
- [0.7.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.3...v0.7.0
215
- [0.6.3]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.2...v0.6.3
216
- [0.6.2]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.1...v0.6.2
217
- [0.6.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.0...v0.6.1
218
- [0.6.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.5.0...v0.6.0
219
- [0.5.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.4.0...v0.5.0
220
- [0.4.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.3.1...v0.4.0
221
- [0.3.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.3.0...v0.3.1
222
- [0.3.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.2.2...v0.3.0
223
- [0.2.2]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.2.1...v0.2.2
224
- [0.2.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.2.0...v0.2.1
225
- [0.2.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.1.1...v0.2.0
226
- [0.1.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.1.0...v0.1.1
227
- [0.1.0]: https://github.com/MetaMask/snaps-skunkworks/releases/tag/v0.1.0