@metamask/snaps-cli 6.3.3 → 6.4.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 +82 -1
- package/dist/commands/manifest/implementation.cjs +2 -0
- package/dist/commands/manifest/implementation.cjs.map +1 -1
- package/dist/commands/manifest/implementation.d.cts.map +1 -1
- package/dist/commands/manifest/implementation.d.mts.map +1 -1
- package/dist/commands/manifest/implementation.mjs +2 -0
- package/dist/commands/manifest/implementation.mjs.map +1 -1
- package/package.json +30 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
2
3
|
All notable changes to this project will be documented in this file.
|
|
3
4
|
|
|
4
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
@@ -6,43 +7,72 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
7
|
|
|
7
8
|
## [Unreleased]
|
|
8
9
|
|
|
10
|
+
## [6.4.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Format Snap manifests with Prettier ([#2787](https://github.com/MetaMask/snaps/pull/2787))
|
|
15
|
+
|
|
16
|
+
## [6.3.4]
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Bump `@metamask/snaps-sdk` to `^6.7.0` ([#2770](https://github.com/MetaMask/snaps/pull/2770))
|
|
21
|
+
- Bump `@metamask/snaps-utils` to `^8.3.0` ([#2770](https://github.com/MetaMask/snaps/pull/2770))
|
|
22
|
+
|
|
9
23
|
## [6.3.3]
|
|
24
|
+
|
|
10
25
|
### Fixed
|
|
26
|
+
|
|
11
27
|
- Fix invalid types in type declaration in some cases ([#2714](https://github.com/MetaMask/snaps/pull/2714))
|
|
12
28
|
|
|
13
29
|
## [6.3.2]
|
|
30
|
+
|
|
14
31
|
### Fixed
|
|
32
|
+
|
|
15
33
|
- Fix ESM version of the package ([#2682](https://github.com/MetaMask/snaps/pull/2682))
|
|
16
34
|
- This fixes the ESM version of the package to be fully compliant with the ESM
|
|
17
35
|
standard.
|
|
18
36
|
- Bump `@metamask/utils` from `^9.1.0` to `^9.2.1` ([#2680](https://github.com/MetaMask/snaps/pull/2680))
|
|
19
37
|
|
|
20
38
|
## [6.3.1]
|
|
39
|
+
|
|
21
40
|
### Fixed
|
|
41
|
+
|
|
22
42
|
- Hide browserlist warning where applicable ([#2664](https://github.com/MetaMask/snaps/pull/2664))
|
|
23
43
|
|
|
24
44
|
## [6.3.0]
|
|
45
|
+
|
|
25
46
|
### Changed
|
|
47
|
+
|
|
26
48
|
- Improve manifest validation output ([#2572](https://github.com/MetaMask/snaps/pull/2572))
|
|
27
49
|
- Replace `superstruct` with ESM-compatible fork `@metamask/superstruct` ([#2445](https://github.com/MetaMask/snaps/pull/2445))
|
|
28
50
|
|
|
29
51
|
## [6.2.1]
|
|
52
|
+
|
|
30
53
|
### Fixed
|
|
54
|
+
|
|
31
55
|
- Improve validation of `endowment:rpc` ([#2512](https://github.com/MetaMask/snaps/pull/2512))
|
|
32
56
|
|
|
33
57
|
## [6.2.0]
|
|
58
|
+
|
|
34
59
|
### Added
|
|
60
|
+
|
|
35
61
|
- Add support for building Snaps with JSX ([#2258](https://github.com/MetaMask/snaps/pull/2258))
|
|
36
62
|
- It's now possible to use JSX components from `@metamask/snaps-sdk` to build
|
|
37
63
|
user interfaces for Snaps.
|
|
38
64
|
|
|
39
65
|
## [6.1.1]
|
|
66
|
+
|
|
40
67
|
### Fixed
|
|
68
|
+
|
|
41
69
|
- Disable `topLevelAwait` configuration option ([#2358](https://github.com/MetaMask/snaps/pull/2358))
|
|
42
70
|
- Before this the CLI would produce invalid builds when using top-level await.
|
|
43
71
|
|
|
44
72
|
## [6.1.0]
|
|
73
|
+
|
|
45
74
|
### Added
|
|
75
|
+
|
|
46
76
|
- Add support for importing SVG, PNG, and JPEG files directly ([#2284](https://github.com/MetaMask/snaps/pull/2284))
|
|
47
77
|
- You can now import these files using a regular import declaration when using the Webpack-based config.
|
|
48
78
|
- To opt out of this feature (i.e., to use custom image loading logic), add the following to your config:
|
|
@@ -55,116 +85,164 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
55
85
|
```
|
|
56
86
|
|
|
57
87
|
### Changed
|
|
88
|
+
|
|
58
89
|
- Update CLI docs link ([#2294](https://github.com/MetaMask/snaps/pull/2294))
|
|
59
90
|
|
|
60
91
|
### Fixed
|
|
92
|
+
|
|
61
93
|
- Fix detection of minimum Node.js version ([#2292](https://github.com/MetaMask/snaps/pull/2292))
|
|
62
94
|
|
|
63
95
|
## [6.0.2]
|
|
96
|
+
|
|
64
97
|
### Fixed
|
|
98
|
+
|
|
65
99
|
- Publish `.browserslistrc` ([#2227](https://github.com/MetaMask/snaps/pull/2227))
|
|
66
100
|
|
|
67
101
|
## [6.0.1]
|
|
102
|
+
|
|
68
103
|
### Fixed
|
|
104
|
+
|
|
69
105
|
- Fix minor build configuration problems ([#2220](https://github.com/MetaMask/snaps/pull/2220))
|
|
70
106
|
|
|
71
107
|
## [6.0.0]
|
|
108
|
+
|
|
72
109
|
### Changed
|
|
110
|
+
|
|
73
111
|
- **BREAKING:** Update ESM build to be fully compliant with the ESM standard ([#2210](https://github.com/MetaMask/snaps/pull/2210))
|
|
74
112
|
- **BREAKING:** Change config to use Webpack by default ([#2214](https://github.com/MetaMask/snaps/pull/2214))
|
|
75
113
|
- You can still use Browserify by specifying `bundler: 'browserify'`.
|
|
76
114
|
|
|
77
115
|
## [5.1.1]
|
|
116
|
+
|
|
78
117
|
### Fixed
|
|
118
|
+
|
|
79
119
|
- Support new lines in CLI message formatting ([#2194](https://github.com/MetaMask/snaps/pull/2194))
|
|
80
120
|
|
|
81
121
|
## [5.1.0]
|
|
122
|
+
|
|
82
123
|
### Changed
|
|
124
|
+
|
|
83
125
|
- Optimize CLI Webpack configuration ([#2175](https://github.com/MetaMask/snaps/pull/2175))
|
|
84
126
|
- This can reduce the size of Snaps in certain cases.
|
|
85
127
|
- Show Webpack compilation warnings in CLI ([#2186](https://github.com/MetaMask/snaps/pull/2186), [#2192](https://github.com/MetaMask/snaps/pull/2192))
|
|
86
128
|
- Add a warning when no icon is found and when icon is not square ([#2185](https://github.com/MetaMask/snaps/pull/2185))
|
|
87
129
|
|
|
88
130
|
## [5.0.0]
|
|
131
|
+
|
|
89
132
|
### Changed
|
|
133
|
+
|
|
90
134
|
- **BREAKING:** Disable source maps by default ([#2166](https://github.com/MetaMask/snaps/pull/2166))
|
|
91
135
|
- This slightly speeds up the build process.
|
|
92
136
|
- You can enable source maps again by setting `sourceMap: true` in your Snap config.
|
|
93
137
|
- Set `output.chunkFormat` to `commonjs` by default ([#2136](https://github.com/MetaMask/snaps/pull/2136))
|
|
94
138
|
|
|
95
139
|
## [4.0.1]
|
|
140
|
+
|
|
96
141
|
### Fixed
|
|
142
|
+
|
|
97
143
|
- Fix missing `global` during snap evaluation ([#2072](https://github.com/MetaMask/snaps/pull/2072))
|
|
98
144
|
|
|
99
145
|
## [4.0.0]
|
|
146
|
+
|
|
100
147
|
### Changed
|
|
148
|
+
|
|
101
149
|
- **BREAKING:** Synchronously initialize WASM modules ([#2024](https://github.com/MetaMask/snaps/pull/2024))
|
|
102
150
|
- When the `experimental.wasm` flag in the Snaps CLI is enabled, the WASM module will now be synchronously initialized, rather than being inlined as a Uint8Array.
|
|
103
151
|
|
|
104
152
|
## [3.0.5]
|
|
153
|
+
|
|
105
154
|
### Fixed
|
|
155
|
+
|
|
106
156
|
- Include Snap icon in allowed server paths ([#2003](https://github.com/MetaMask/snaps/pull/2003))
|
|
107
157
|
|
|
108
158
|
## [3.0.4]
|
|
159
|
+
|
|
109
160
|
### Fixed
|
|
161
|
+
|
|
110
162
|
- Only serve Snap files from CLI ([#1979](https://github.com/MetaMask/snaps/pull/1979))
|
|
111
163
|
|
|
112
164
|
## [3.0.3]
|
|
165
|
+
|
|
113
166
|
### Changed
|
|
167
|
+
|
|
114
168
|
- Bump several MetaMask dependencies ([#1964](https://github.com/MetaMask/snaps/pull/1964))
|
|
115
169
|
|
|
116
170
|
### Fixed
|
|
171
|
+
|
|
117
172
|
- Fix issues generating checksum with binary auxiliary files ([#1975](https://github.com/MetaMask/snaps/pull/1975))
|
|
118
173
|
|
|
119
174
|
## [3.0.2]
|
|
175
|
+
|
|
120
176
|
### Changed
|
|
177
|
+
|
|
121
178
|
- Use `@metamask/snaps-sdk` package ([#1951](https://github.com/MetaMask/snaps/pull/1951))
|
|
122
179
|
- This package replaces the `@metamask/snaps-types` and
|
|
123
180
|
`@metamask/snaps-ui` packages.
|
|
124
181
|
|
|
125
182
|
## [3.0.1]
|
|
183
|
+
|
|
126
184
|
### Changed
|
|
185
|
+
|
|
127
186
|
- Bump Babel packages from `^7.20.12` to `^7.23.2` ([#1862](https://github.com/MetaMask/snaps/pull/1862))
|
|
128
187
|
- Update multiple MetaMask dependencies ([#1841](https://github.com/MetaMask/snaps/pull/1841))
|
|
129
188
|
|
|
130
189
|
## [3.0.0]
|
|
190
|
+
|
|
131
191
|
### Changed
|
|
192
|
+
|
|
132
193
|
- **BREAKING:** Bump minimum Node.js version to `^18.16.0` ([#1741](https://github.com/MetaMask/snaps/pull/1741))
|
|
133
194
|
|
|
134
195
|
## [2.0.2]
|
|
196
|
+
|
|
135
197
|
### Fixed
|
|
198
|
+
|
|
136
199
|
- Fix Webpack being unable to find `swc-loader` in some cases ([#1798](https://github.com/MetaMask/snaps/pull/1798))
|
|
137
200
|
- Check minimum Node version in CLI ([#1797](https://github.com/MetaMask/snaps/pull/1797))
|
|
138
201
|
|
|
139
202
|
## [2.0.1]
|
|
203
|
+
|
|
140
204
|
### Fixed
|
|
205
|
+
|
|
141
206
|
- Disable the `fullySpecified` rule for `.js` imports in the default Webpack config ([#1780](https://github.com/MetaMask/snaps/pull/1780))
|
|
142
207
|
|
|
143
208
|
## [2.0.0]
|
|
209
|
+
|
|
144
210
|
### Changed
|
|
211
|
+
|
|
145
212
|
- Initial stable release from main branch ([#1757](https://github.com/MetaMask/snaps/pull/1757))
|
|
146
213
|
|
|
147
214
|
## [0.38.4-flask.1]
|
|
215
|
+
|
|
148
216
|
### Changed
|
|
217
|
+
|
|
149
218
|
- Bump `metamask/utils` and `metamask/snaps-registry` ([#1738](https://github.com/MetaMask/snaps/pull/1738), [#1694](https://github.com/MetaMask/snaps/pull/1694))
|
|
150
219
|
|
|
151
220
|
## [0.38.3-flask.1]
|
|
221
|
+
|
|
152
222
|
### Fixed
|
|
223
|
+
|
|
153
224
|
- Remove unused dependencies ([#1680](https://github.com/MetaMask/snaps/pull/1680))
|
|
154
225
|
|
|
155
226
|
## [0.38.2-flask.1]
|
|
227
|
+
|
|
156
228
|
### Added
|
|
229
|
+
|
|
157
230
|
- Add `polyfills` option to Webpack configuration ([#1650](https://github.com/MetaMask/snaps/pull/1650))
|
|
158
231
|
|
|
159
232
|
### Fixed
|
|
233
|
+
|
|
160
234
|
- Fix breaking change to SWC causing the CLI to break ([#1677](https://github.com/MetaMask/snaps/pull/1677))
|
|
161
235
|
|
|
162
236
|
## [0.38.1-flask.1]
|
|
237
|
+
|
|
163
238
|
### Changed
|
|
239
|
+
|
|
164
240
|
- Update all examples to use Webpack ([#1632](https://github.com/MetaMask/snaps/pull/1632))
|
|
165
241
|
|
|
166
242
|
## [0.38.0-flask.1]
|
|
243
|
+
|
|
167
244
|
### Added
|
|
245
|
+
|
|
168
246
|
- Add support for bundling with Webpack ([#1521](https://github.com/MetaMask/snaps/pull/1521))
|
|
169
247
|
- For backwards compatibility, the Webpack bundler is opt-in. To use it, add
|
|
170
248
|
`"bundler": "webpack"` to your snap configuration file, and follow the new
|
|
@@ -177,11 +255,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
177
255
|
- Support TypeScript snap configuration files ([#1521](https://github.com/MetaMask/snaps/pull/1521))
|
|
178
256
|
|
|
179
257
|
### Changed
|
|
258
|
+
|
|
180
259
|
- Release package independently ([#1600](https://github.com/MetaMask/snaps/pull/1600))
|
|
181
260
|
- The version of the package no longer needs to match the version of all other
|
|
182
261
|
MetaMask Snaps packages.
|
|
183
262
|
|
|
184
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.
|
|
263
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.4.0...HEAD
|
|
264
|
+
[6.4.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.3.4...@metamask/snaps-cli@6.4.0
|
|
265
|
+
[6.3.4]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.3.3...@metamask/snaps-cli@6.3.4
|
|
185
266
|
[6.3.3]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.3.2...@metamask/snaps-cli@6.3.3
|
|
186
267
|
[6.3.2]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.3.1...@metamask/snaps-cli@6.3.2
|
|
187
268
|
[6.3.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.3.0...@metamask/snaps-cli@6.3.1
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.manifest = void 0;
|
|
4
4
|
const node_1 = require("@metamask/snaps-utils/node");
|
|
5
|
+
const snaps_webpack_plugin_1 = require("@metamask/snaps-webpack-plugin");
|
|
5
6
|
const utils_1 = require("@metamask/utils");
|
|
6
7
|
const chalk_1 = require("chalk");
|
|
7
8
|
const path_1 = require("path");
|
|
@@ -20,6 +21,7 @@ const utils_2 = require("../../utils/index.cjs");
|
|
|
20
21
|
async function manifest(path, write, spinner) {
|
|
21
22
|
const { reports, updated } = await (0, node_1.checkManifest)((0, path_1.dirname)(path), {
|
|
22
23
|
updateAndWriteManifest: write,
|
|
24
|
+
writeFileFn: snaps_webpack_plugin_1.writeManifest,
|
|
23
25
|
});
|
|
24
26
|
const errors = [];
|
|
25
27
|
const fixed = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.cjs","sourceRoot":"","sources":["../../../src/commands/manifest/implementation.ts"],"names":[],"mappings":";;;AAAA,qDAAmE;AACnE,2CAAyC;AACzC,iCAA2C;AAE3C,+BAA+B;AAE/B,iDAAgD;AAEhD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,QAAQ,CAC5B,IAAY,EACZ,KAAc,EACd,OAAa;IAEb,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,oBAAa,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QAC9D,sBAAsB,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"implementation.cjs","sourceRoot":"","sources":["../../../src/commands/manifest/implementation.ts"],"names":[],"mappings":";;;AAAA,qDAAmE;AACnE,yEAA+D;AAC/D,2CAAyC;AACzC,iCAA2C;AAE3C,+BAA+B;AAE/B,iDAAgD;AAEhD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,QAAQ,CAC5B,IAAY,EACZ,KAAc,EACd,OAAa;IAEb,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,oBAAa,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QAC9D,sBAAsB,EAAE,KAAK;QAC7B,WAAW,EAAE,oCAAa;KAC3B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpD,MAAM,CAAC,IAAI,CAAC,IAAA,aAAM,EAAC,IAAA,WAAG,EAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,C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,OAAO,EAAE,IAAI,EAAE,CAAC;QAChB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AA5DD,4BA4DC","sourcesContent":["import { checkManifest, indent } from '@metamask/snaps-utils/node';\nimport { writeManifest } from '@metamask/snaps-webpack-plugin';\nimport { assert } from '@metamask/utils';\nimport { red, yellow, green } from 'chalk';\nimport type { Ora } from 'ora';\nimport { dirname } from 'path';\n\nimport { error, info, warn } from '../../utils';\n\n/**\n * Check the snap manifest file at the given path. If `write` is `true`, the\n * manifest will be written to disk if it is invalid. If `write` is `false`,\n * the manifest will not be written to disk, and the function will log any\n * errors and warnings to the console.\n *\n * @param path - The path to the manifest file.\n * @param write - Whether to write the manifest to disk if it is invalid.\n * @param spinner - An optional spinner to use for logging.\n * @returns Whether the manifest is valid.\n */\nexport async function manifest(\n path: string,\n write: boolean,\n spinner?: Ora,\n): Promise<boolean> {\n const { reports, updated } = await checkManifest(dirname(path), {\n updateAndWriteManifest: write,\n writeFileFn: writeManifest,\n });\n\n const errors = [];\n const fixed = [];\n const warnings = [];\n\n for (const report of reports) {\n if (report.severity === 'error' && !report.wasFixed) {\n errors.push(indent(red(`• ${report.message}`)));\n } else if (report.wasFixed) {\n fixed.push(indent(yellow(`• ${report.message}`) + green(' (fixed)')));\n } else {\n assert(report.severity === 'warning');\n warnings.push(indent(yellow(`• ${report.message}`)));\n }\n }\n\n if (errors.length > 0) {\n const formattedErrors = errors.join('\\n');\n let message = `The snap manifest file is invalid.\\n\\n${formattedErrors}`;\n if (!write) {\n message +=\n '\\n\\nRun the command with the `--fix` flag to attempt to fix the manifest.';\n }\n\n error(message, spinner);\n }\n\n if (write && updated) {\n const formattedFixed = fixed.join('\\n');\n info(\n `The snap manifest file has been updated.\\n\\n${formattedFixed}`,\n spinner,\n );\n }\n\n if (warnings.length > 0) {\n const formattedWarnings = warnings.join('\\n');\n\n warn(\n `The snap manifest file has warnings.\\n\\n${formattedWarnings}`,\n spinner,\n );\n }\n\n if (errors.length > 0) {\n spinner?.stop();\n process.exitCode = 1;\n return false;\n }\n\n return true;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.cts","sourceRoot":"","sources":["../../../src/commands/manifest/implementation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"implementation.d.cts","sourceRoot":"","sources":["../../../src/commands/manifest/implementation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAK/B;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAAC,OAAO,CAAC,CAwDlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.mts","sourceRoot":"","sources":["../../../src/commands/manifest/implementation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"implementation.d.mts","sourceRoot":"","sources":["../../../src/commands/manifest/implementation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAK/B;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAAC,OAAO,CAAC,CAwDlB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { checkManifest, indent } from "@metamask/snaps-utils/node";
|
|
2
|
+
import { writeManifest } from "@metamask/snaps-webpack-plugin";
|
|
2
3
|
import { assert } from "@metamask/utils";
|
|
3
4
|
import $chalk from "chalk";
|
|
4
5
|
const { red, yellow, green } = $chalk;
|
|
@@ -18,6 +19,7 @@ import { error, info, warn } from "../../utils/index.mjs";
|
|
|
18
19
|
export async function manifest(path, write, spinner) {
|
|
19
20
|
const { reports, updated } = await checkManifest(dirname(path), {
|
|
20
21
|
updateAndWriteManifest: write,
|
|
22
|
+
writeFileFn: writeManifest,
|
|
21
23
|
});
|
|
22
24
|
const errors = [];
|
|
23
25
|
const fixed = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.mjs","sourceRoot":"","sources":["../../../src/commands/manifest/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,mCAAmC;AACnE,OAAO,EAAE,MAAM,EAAE,wBAAwB;;;AAGzC,OAAO,EAAE,OAAO,EAAE,aAAa;AAE/B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,8BAAoB;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,IAAY,EACZ,KAAc,EACd,OAAa;IAEb,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC9D,sBAAsB,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"implementation.mjs","sourceRoot":"","sources":["../../../src/commands/manifest/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,mCAAmC;AACnE,OAAO,EAAE,aAAa,EAAE,uCAAuC;AAC/D,OAAO,EAAE,MAAM,EAAE,wBAAwB;;;AAGzC,OAAO,EAAE,OAAO,EAAE,aAAa;AAE/B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,8BAAoB;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,IAAY,EACZ,KAAc,EACd,OAAa;IAEb,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC9D,sBAAsB,EAAE,KAAK;QAC7B,WAAW,EAAE,a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,cAAc,EAAE,EAC/D,OAAO,CACR,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,CACF,2CAA2C,iBAAiB,EAAE,EAC9D,OAAO,CACR,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,CAAC;QAChB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { checkManifest, indent } from '@metamask/snaps-utils/node';\nimport { writeManifest } from '@metamask/snaps-webpack-plugin';\nimport { assert } from '@metamask/utils';\nimport { red, yellow, green } from 'chalk';\nimport type { Ora } from 'ora';\nimport { dirname } from 'path';\n\nimport { error, info, warn } from '../../utils';\n\n/**\n * Check the snap manifest file at the given path. If `write` is `true`, the\n * manifest will be written to disk if it is invalid. If `write` is `false`,\n * the manifest will not be written to disk, and the function will log any\n * errors and warnings to the console.\n *\n * @param path - The path to the manifest file.\n * @param write - Whether to write the manifest to disk if it is invalid.\n * @param spinner - An optional spinner to use for logging.\n * @returns Whether the manifest is valid.\n */\nexport async function manifest(\n path: string,\n write: boolean,\n spinner?: Ora,\n): Promise<boolean> {\n const { reports, updated } = await checkManifest(dirname(path), {\n updateAndWriteManifest: write,\n writeFileFn: writeManifest,\n });\n\n const errors = [];\n const fixed = [];\n const warnings = [];\n\n for (const report of reports) {\n if (report.severity === 'error' && !report.wasFixed) {\n errors.push(indent(red(`• ${report.message}`)));\n } else if (report.wasFixed) {\n fixed.push(indent(yellow(`• ${report.message}`) + green(' (fixed)')));\n } else {\n assert(report.severity === 'warning');\n warnings.push(indent(yellow(`• ${report.message}`)));\n }\n }\n\n if (errors.length > 0) {\n const formattedErrors = errors.join('\\n');\n let message = `The snap manifest file is invalid.\\n\\n${formattedErrors}`;\n if (!write) {\n message +=\n '\\n\\nRun the command with the `--fix` flag to attempt to fix the manifest.';\n }\n\n error(message, spinner);\n }\n\n if (write && updated) {\n const formattedFixed = fixed.join('\\n');\n info(\n `The snap manifest file has been updated.\\n\\n${formattedFixed}`,\n spinner,\n );\n }\n\n if (warnings.length > 0) {\n const formattedWarnings = warnings.join('\\n');\n\n warn(\n `The snap manifest file has warnings.\\n\\n${formattedWarnings}`,\n spinner,\n );\n }\n\n if (errors.length > 0) {\n spinner?.stop();\n process.exitCode = 1;\n return false;\n }\n\n return true;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-cli",
|
|
3
|
-
"version": "6.
|
|
4
|
-
"description": "A CLI for developing MetaMask Snaps
|
|
3
|
+
"version": "6.4.0",
|
|
4
|
+
"description": "A CLI for developing MetaMask Snaps",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"MetaMask",
|
|
7
|
+
"Snaps",
|
|
8
|
+
"Ethereum"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/MetaMask/snaps/tree/main/packages/snaps-cli#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/MetaMask/snaps/issues"
|
|
13
|
+
},
|
|
5
14
|
"repository": {
|
|
6
15
|
"type": "git",
|
|
7
16
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
@@ -33,22 +42,26 @@
|
|
|
33
42
|
".browserslistrc"
|
|
34
43
|
],
|
|
35
44
|
"scripts": {
|
|
36
|
-
"build": "ts-bridge --project tsconfig.build.json --verbose --no-references
|
|
45
|
+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
|
|
37
46
|
"build:chmod": "chmod +x ./dist/main.mjs && chmod +x ./dist/main.js",
|
|
47
|
+
"build:post": "yarn build:chmod && yarn build:readme",
|
|
38
48
|
"build:readme": "node ./scripts/updateReadme.js",
|
|
39
49
|
"build:watch": "tsc-watch --onSuccess 'yarn build:chmod'",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"lint:
|
|
50
|
+
"changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-cli",
|
|
51
|
+
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-cli",
|
|
52
|
+
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies",
|
|
53
|
+
"lint:ci": "yarn lint",
|
|
54
|
+
"lint:dependencies": "depcheck",
|
|
45
55
|
"lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx",
|
|
46
|
-
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
47
|
-
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies",
|
|
48
56
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
57
|
+
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
49
58
|
"publish:preview": "yarn npm publish --tag preview",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
59
|
+
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
60
|
+
"test": "jest --reporters=jest-silent-reporter",
|
|
61
|
+
"test:clean": "jest --clearCache",
|
|
62
|
+
"test:post": "jest-it-up",
|
|
63
|
+
"test:verbose": "jest --verbose",
|
|
64
|
+
"test:watch": "jest --watch"
|
|
52
65
|
},
|
|
53
66
|
"dependencies": {
|
|
54
67
|
"@babel/core": "^7.23.2",
|
|
@@ -59,8 +72,8 @@
|
|
|
59
72
|
"@babel/plugin-transform-runtime": "^7.13.2",
|
|
60
73
|
"@babel/preset-env": "^7.23.2",
|
|
61
74
|
"@babel/preset-typescript": "^7.23.2",
|
|
62
|
-
"@metamask/snaps-sdk": "^6.
|
|
63
|
-
"@metamask/snaps-utils": "^8.
|
|
75
|
+
"@metamask/snaps-sdk": "^6.8.0",
|
|
76
|
+
"@metamask/snaps-utils": "^8.4.0",
|
|
64
77
|
"@metamask/snaps-webpack-plugin": "^4.1.2",
|
|
65
78
|
"@metamask/superstruct": "^3.1.0",
|
|
66
79
|
"@metamask/utils": "^9.2.1",
|
|
@@ -131,9 +144,10 @@
|
|
|
131
144
|
"execa": "^5.1.1",
|
|
132
145
|
"jest": "^29.0.2",
|
|
133
146
|
"jest-it-up": "^2.0.0",
|
|
147
|
+
"jest-silent-reporter": "^0.6.0",
|
|
134
148
|
"memfs": "^3.4.13",
|
|
135
|
-
"prettier": "^2.
|
|
136
|
-
"prettier-plugin-packagejson": "^2.2
|
|
149
|
+
"prettier": "^2.8.8",
|
|
150
|
+
"prettier-plugin-packagejson": "^2.5.2",
|
|
137
151
|
"ts-node": "^10.9.1",
|
|
138
152
|
"tsc-watch": "^4.5.0",
|
|
139
153
|
"typescript": "~5.3.3"
|