@metamask/snaps-cli 1.0.1 → 2.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.
Files changed (253) hide show
  1. package/.browserslistrc +3 -0
  2. package/CHANGELOG.md +32 -372
  3. package/README.md +548 -69
  4. package/dist/cjs/builders.js +148 -0
  5. package/dist/cjs/builders.js.map +1 -0
  6. package/dist/cjs/cli.js +35 -0
  7. package/dist/cjs/cli.js.map +1 -0
  8. package/dist/cjs/commands/build/build.js +54 -0
  9. package/dist/cjs/commands/build/build.js.map +1 -0
  10. package/dist/cjs/commands/build/implementation.js +31 -0
  11. package/dist/cjs/commands/build/implementation.js.map +1 -0
  12. package/dist/cjs/commands/build/index.js +45 -0
  13. package/dist/cjs/commands/build/index.js.map +1 -0
  14. package/dist/cjs/commands/eval/eval.js +57 -0
  15. package/dist/cjs/commands/eval/eval.js.map +1 -0
  16. package/dist/cjs/commands/eval/implementation.js +27 -0
  17. package/dist/cjs/commands/eval/implementation.js.map +1 -0
  18. package/dist/cjs/commands/eval/index.js +50 -0
  19. package/dist/cjs/commands/eval/index.js.map +1 -0
  20. package/dist/cjs/commands/index.js +30 -0
  21. package/dist/cjs/commands/index.js.map +1 -0
  22. package/dist/cjs/commands/manifest/implementation.js +34 -0
  23. package/dist/cjs/commands/manifest/implementation.js.map +1 -0
  24. package/dist/cjs/commands/manifest/index.js +50 -0
  25. package/dist/cjs/commands/manifest/index.js.map +1 -0
  26. package/dist/cjs/commands/manifest/manifest.js +55 -0
  27. package/dist/cjs/commands/manifest/manifest.js.map +1 -0
  28. package/dist/cjs/commands/serve/index.js +33 -0
  29. package/dist/cjs/commands/serve/index.js.map +1 -0
  30. package/dist/cjs/commands/serve/serve.js +21 -0
  31. package/dist/cjs/commands/serve/serve.js.map +1 -0
  32. package/dist/cjs/commands/watch/implementation.js +35 -0
  33. package/dist/cjs/commands/watch/implementation.js.map +1 -0
  34. package/dist/cjs/commands/watch/index.js +47 -0
  35. package/dist/cjs/commands/watch/index.js.map +1 -0
  36. package/dist/cjs/commands/watch/watch.js +51 -0
  37. package/dist/cjs/commands/watch/watch.js.map +1 -0
  38. package/dist/cjs/config.js +323 -0
  39. package/dist/cjs/config.js.map +1 -0
  40. package/dist/cjs/errors.js +37 -0
  41. package/dist/cjs/errors.js.map +1 -0
  42. package/dist/cjs/index.js +77 -0
  43. package/dist/cjs/index.js.map +1 -0
  44. package/dist/cjs/main.js +19 -0
  45. package/dist/cjs/main.js.map +1 -0
  46. package/dist/cjs/utils/cli.js +61 -0
  47. package/dist/cjs/utils/cli.js.map +1 -0
  48. package/dist/cjs/utils/errors.js +42 -0
  49. package/dist/cjs/utils/errors.js.map +1 -0
  50. package/dist/cjs/utils/index.js +25 -0
  51. package/dist/cjs/utils/index.js.map +1 -0
  52. package/dist/cjs/utils/legacy.js +48 -0
  53. package/dist/cjs/utils/legacy.js.map +1 -0
  54. package/dist/cjs/utils/logging.js +46 -0
  55. package/dist/cjs/utils/logging.js.map +1 -0
  56. package/dist/cjs/utils/path.js +16 -0
  57. package/dist/cjs/utils/path.js.map +1 -0
  58. package/dist/cjs/utils/steps.js +52 -0
  59. package/dist/cjs/utils/steps.js.map +1 -0
  60. package/dist/cjs/webpack/compiler.js +96 -0
  61. package/dist/cjs/webpack/compiler.js.map +1 -0
  62. package/dist/cjs/webpack/config.js +239 -0
  63. package/dist/cjs/webpack/config.js.map +1 -0
  64. package/dist/cjs/webpack/index.js +22 -0
  65. package/dist/cjs/webpack/index.js.map +1 -0
  66. package/dist/cjs/webpack/loaders/browserify.js +97 -0
  67. package/dist/cjs/webpack/loaders/browserify.js.map +1 -0
  68. package/dist/cjs/webpack/loaders/wasm.js +36 -0
  69. package/dist/cjs/webpack/loaders/wasm.js.map +1 -0
  70. package/dist/cjs/webpack/plugins.js +340 -0
  71. package/dist/cjs/webpack/plugins.js.map +1 -0
  72. package/dist/cjs/webpack/utils.js +181 -0
  73. package/dist/cjs/webpack/utils.js.map +1 -0
  74. package/dist/{builders.js → esm/builders.js} +48 -51
  75. package/dist/esm/builders.js.map +1 -0
  76. package/dist/esm/cli.js +26 -0
  77. package/dist/esm/cli.js.map +1 -0
  78. package/dist/esm/commands/build/build.js +51 -0
  79. package/dist/esm/commands/build/build.js.map +1 -0
  80. package/dist/esm/commands/build/implementation.js +27 -0
  81. package/dist/esm/commands/build/implementation.js.map +1 -0
  82. package/dist/esm/commands/build/index.js +17 -0
  83. package/dist/esm/commands/build/index.js.map +1 -0
  84. package/dist/esm/commands/eval/eval.js +54 -0
  85. package/dist/esm/commands/eval/eval.js.map +1 -0
  86. package/dist/esm/commands/eval/implementation.js +24 -0
  87. package/dist/esm/commands/eval/implementation.js.map +1 -0
  88. package/dist/esm/commands/eval/index.js +22 -0
  89. package/dist/esm/commands/eval/index.js.map +1 -0
  90. package/dist/esm/commands/index.js +15 -0
  91. package/dist/esm/commands/index.js.map +1 -0
  92. package/dist/esm/commands/manifest/implementation.js +33 -0
  93. package/dist/esm/commands/manifest/implementation.js.map +1 -0
  94. package/dist/esm/commands/manifest/index.js +22 -0
  95. package/dist/esm/commands/manifest/index.js.map +1 -0
  96. package/dist/esm/commands/manifest/manifest.js +52 -0
  97. package/dist/esm/commands/manifest/manifest.js.map +1 -0
  98. package/dist/esm/commands/serve/index.js +18 -0
  99. package/dist/esm/commands/serve/index.js.map +1 -0
  100. package/dist/esm/commands/serve/serve.js +17 -0
  101. package/dist/esm/commands/serve/serve.js.map +1 -0
  102. package/dist/esm/commands/watch/implementation.js +34 -0
  103. package/dist/esm/commands/watch/implementation.js.map +1 -0
  104. package/dist/esm/commands/watch/index.js +19 -0
  105. package/dist/esm/commands/watch/index.js.map +1 -0
  106. package/dist/esm/commands/watch/watch.js +50 -0
  107. package/dist/esm/commands/watch/watch.js.map +1 -0
  108. package/dist/esm/config.js +327 -0
  109. package/dist/esm/config.js.map +1 -0
  110. package/dist/esm/errors.js +30 -0
  111. package/dist/esm/errors.js.map +1 -0
  112. package/dist/esm/index.js +6 -0
  113. package/dist/esm/index.js.map +1 -0
  114. package/dist/esm/main.js +10 -0
  115. package/dist/esm/main.js.map +1 -0
  116. package/dist/esm/utils/cli.js +43 -0
  117. package/dist/esm/utils/cli.js.map +1 -0
  118. package/dist/esm/utils/errors.js +43 -0
  119. package/dist/esm/utils/errors.js.map +1 -0
  120. package/dist/esm/utils/index.js +8 -0
  121. package/dist/esm/utils/index.js.map +1 -0
  122. package/dist/esm/utils/legacy.js +47 -0
  123. package/dist/esm/utils/legacy.js.map +1 -0
  124. package/dist/esm/utils/logging.js +40 -0
  125. package/dist/esm/utils/logging.js.map +1 -0
  126. package/dist/esm/utils/path.js +13 -0
  127. package/dist/esm/utils/path.js.map +1 -0
  128. package/dist/esm/utils/steps.js +43 -0
  129. package/dist/esm/utils/steps.js.map +1 -0
  130. package/dist/esm/webpack/compiler.js +89 -0
  131. package/dist/esm/webpack/compiler.js.map +1 -0
  132. package/dist/esm/webpack/config.js +241 -0
  133. package/dist/esm/webpack/config.js.map +1 -0
  134. package/dist/esm/webpack/index.js +5 -0
  135. package/dist/esm/webpack/index.js.map +1 -0
  136. package/dist/esm/webpack/loaders/browserify.js +82 -0
  137. package/dist/esm/webpack/loaders/browserify.js.map +1 -0
  138. package/dist/esm/webpack/loaders/wasm.js +26 -0
  139. package/dist/esm/webpack/loaders/wasm.js.map +1 -0
  140. package/dist/esm/webpack/plugins.js +343 -0
  141. package/dist/esm/webpack/plugins.js.map +1 -0
  142. package/dist/esm/webpack/utils.js +208 -0
  143. package/dist/esm/webpack/utils.js.map +1 -0
  144. package/dist/types/__fixtures__/configs/cjs.d.ts +1 -0
  145. package/dist/types/__fixtures__/configs/esm.d.ts +3 -0
  146. package/dist/types/__fixtures__/configs/invalid.d.ts +3 -0
  147. package/dist/types/__fixtures__/configs/javascript/snap.config.d.ts +0 -0
  148. package/dist/types/__fixtures__/configs/typescript/snap.config.d.ts +3 -0
  149. package/dist/types/builders.d.ts +8 -0
  150. package/dist/{cli.d.ts → types/cli.d.ts} +1 -1
  151. package/dist/types/commands/build/build.d.ts +10 -0
  152. package/dist/types/commands/build/implementation.d.ts +10 -0
  153. package/dist/types/commands/build/index.d.ts +10 -0
  154. package/dist/types/commands/eval/__test__/browserify/bad/snap.config.d.ts +3 -0
  155. package/dist/types/commands/eval/__test__/browserify/good/snap.config.d.ts +3 -0
  156. package/dist/types/commands/eval/__test__/webpack/bad/snap.config.d.ts +3 -0
  157. package/dist/types/commands/eval/__test__/webpack/good/snap.config.d.ts +3 -0
  158. package/dist/types/commands/eval/__test__/webpack/snap.config.d.ts +3 -0
  159. package/dist/types/commands/eval/eval.d.ts +14 -0
  160. package/dist/types/commands/eval/implementation.d.ts +9 -0
  161. package/dist/types/commands/eval/index.d.ts +10 -0
  162. package/dist/types/commands/manifest/implementation.d.ts +12 -0
  163. package/dist/types/commands/manifest/index.d.ts +10 -0
  164. package/dist/types/commands/manifest/manifest.d.ts +14 -0
  165. package/dist/{cmds/build → types/commands/serve}/index.d.ts +4 -4
  166. package/dist/types/commands/serve/serve.d.ts +16 -0
  167. package/dist/types/commands/watch/implementation.d.ts +14 -0
  168. package/dist/types/commands/watch/index.d.ts +10 -0
  169. package/dist/types/commands/watch/watch.d.ts +19 -0
  170. package/dist/types/config.d.ts +792 -0
  171. package/dist/types/errors.d.ts +25 -0
  172. package/dist/types/index.d.ts +5 -0
  173. package/dist/types/utils/cli.d.ts +17 -0
  174. package/dist/types/utils/errors.d.ts +23 -0
  175. package/dist/types/utils/index.d.ts +6 -0
  176. package/dist/types/utils/legacy.d.ts +27 -0
  177. package/dist/types/utils/logging.d.ts +22 -0
  178. package/dist/types/utils/path.d.ts +9 -0
  179. package/dist/types/utils/steps.d.ts +17 -0
  180. package/dist/types/webpack/compiler.d.ts +29 -0
  181. package/dist/types/webpack/config.d.ts +37 -0
  182. package/dist/types/webpack/index.d.ts +3 -0
  183. package/dist/types/webpack/loaders/browserify.d.ts +16 -0
  184. package/dist/types/webpack/loaders/wasm.d.ts +20 -0
  185. package/dist/types/webpack/plugins.d.ts +147 -0
  186. package/dist/types/webpack/utils.d.ts +188 -0
  187. package/package.json +83 -43
  188. package/dist/builders.d.ts +0 -27
  189. package/dist/builders.js.map +0 -1
  190. package/dist/cli.js +0 -51
  191. package/dist/cli.js.map +0 -1
  192. package/dist/cmds/build/buildHandler.d.ts +0 -13
  193. package/dist/cmds/build/buildHandler.js +0 -37
  194. package/dist/cmds/build/buildHandler.js.map +0 -1
  195. package/dist/cmds/build/bundle.d.ts +0 -15
  196. package/dist/cmds/build/bundle.js +0 -80
  197. package/dist/cmds/build/bundle.js.map +0 -1
  198. package/dist/cmds/build/index.js +0 -29
  199. package/dist/cmds/build/index.js.map +0 -1
  200. package/dist/cmds/build/utils.d.ts +0 -56
  201. package/dist/cmds/build/utils.js +0 -100
  202. package/dist/cmds/build/utils.js.map +0 -1
  203. package/dist/cmds/eval/evalHandler.d.ts +0 -9
  204. package/dist/cmds/eval/evalHandler.js +0 -25
  205. package/dist/cmds/eval/evalHandler.js.map +0 -1
  206. package/dist/cmds/eval/index.d.ts +0 -9
  207. package/dist/cmds/eval/index.js +0 -15
  208. package/dist/cmds/eval/index.js.map +0 -1
  209. package/dist/cmds/index.js +0 -14
  210. package/dist/cmds/index.js.map +0 -1
  211. package/dist/cmds/init/index.d.ts +0 -9
  212. package/dist/cmds/init/index.js +0 -34
  213. package/dist/cmds/init/index.js.map +0 -1
  214. package/dist/cmds/init/initHandler.d.ts +0 -26
  215. package/dist/cmds/init/initHandler.js +0 -69
  216. package/dist/cmds/init/initHandler.js.map +0 -1
  217. package/dist/cmds/init/initUtils.d.ts +0 -39
  218. package/dist/cmds/init/initUtils.js +0 -122
  219. package/dist/cmds/init/initUtils.js.map +0 -1
  220. package/dist/cmds/manifest/index.d.ts +0 -9
  221. package/dist/cmds/manifest/index.js +0 -24
  222. package/dist/cmds/manifest/index.js.map +0 -1
  223. package/dist/cmds/manifest/manifestHandler.d.ts +0 -10
  224. package/dist/cmds/manifest/manifestHandler.js +0 -50
  225. package/dist/cmds/manifest/manifestHandler.js.map +0 -1
  226. package/dist/cmds/serve/index.d.ts +0 -9
  227. package/dist/cmds/serve/index.js +0 -15
  228. package/dist/cmds/serve/index.js.map +0 -1
  229. package/dist/cmds/serve/serveHandler.d.ts +0 -10
  230. package/dist/cmds/serve/serveHandler.js +0 -59
  231. package/dist/cmds/serve/serveHandler.js.map +0 -1
  232. package/dist/cmds/serve/serveUtils.d.ts +0 -22
  233. package/dist/cmds/serve/serveUtils.js +0 -39
  234. package/dist/cmds/serve/serveUtils.js.map +0 -1
  235. package/dist/cmds/watch/index.d.ts +0 -9
  236. package/dist/cmds/watch/index.js +0 -32
  237. package/dist/cmds/watch/index.js.map +0 -1
  238. package/dist/cmds/watch/watchHandler.d.ts +0 -14
  239. package/dist/cmds/watch/watchHandler.js +0 -100
  240. package/dist/cmds/watch/watchHandler.js.map +0 -1
  241. package/dist/main.js +0 -15
  242. package/dist/main.js.map +0 -1
  243. package/dist/utils/index.d.ts +0 -2
  244. package/dist/utils/index.js +0 -19
  245. package/dist/utils/index.js.map +0 -1
  246. package/dist/utils/misc.d.ts +0 -53
  247. package/dist/utils/misc.js +0 -156
  248. package/dist/utils/misc.js.map +0 -1
  249. package/dist/utils/snap-config.d.ts +0 -48
  250. package/dist/utils/snap-config.js +0 -117
  251. package/dist/utils/snap-config.js.map +0 -1
  252. /package/dist/{cmds → types/commands}/index.d.ts +0 -0
  253. /package/dist/{main.d.ts → types/main.d.ts} +0 -0
@@ -1,133 +1,130 @@
1
- "use strict";
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 || (exports.TranspilationModes = {}));
1
+ export var TranspilationModes;
2
+ (function(TranspilationModes) {
3
+ TranspilationModes["LocalAndDeps"] = 'localAndDeps';
4
+ TranspilationModes["LocalOnly"] = 'localOnly';
5
+ TranspilationModes["None"] = 'none';
6
+ })(TranspilationModes || (TranspilationModes = {}));
10
7
  const builders = {
8
+ // eslint-disable-next-line @typescript-eslint/naming-convention
9
+ config: {
10
+ alias: 'c',
11
+ describe: 'Path to config file',
12
+ type: 'string',
13
+ normalize: true
14
+ },
15
+ fix: {
16
+ describe: 'Attempt to fix snap.manifest.json',
17
+ type: 'boolean'
18
+ },
19
+ input: {
20
+ alias: 'i',
21
+ describe: 'Snap bundle file to evaluate',
22
+ type: 'string',
23
+ normalize: true
24
+ },
25
+ // Deprecated Browserify options.
11
26
  bundle: {
12
27
  alias: 'b',
13
28
  describe: 'Snap bundle file',
14
29
  type: 'string',
15
- demandOption: true,
16
30
  normalize: true,
17
- default: 'dist/bundle.js',
31
+ deprecated: 'Use --input instead.'
18
32
  },
19
33
  dist: {
20
34
  alias: 'd',
21
35
  describe: 'Output directory',
22
36
  type: 'string',
23
- demandOption: true,
24
37
  normalize: true,
25
- default: 'dist',
38
+ deprecated: true
26
39
  },
27
40
  eval: {
28
41
  alias: 'e',
29
42
  describe: 'Attempt to evaluate Snap bundle in SES',
30
43
  type: 'boolean',
31
- demandOption: false,
32
- default: true,
44
+ deprecated: true
33
45
  },
34
46
  manifest: {
35
47
  alias: 'm',
36
48
  describe: 'Validate snap.manifest.json',
37
49
  type: 'boolean',
38
- demandOption: false,
39
- default: true,
50
+ deprecated: true
40
51
  },
41
52
  port: {
42
53
  alias: 'p',
43
54
  describe: 'Local server port for testing',
44
55
  type: 'number',
45
- demandOption: true,
46
- default: 8081,
47
- coerce: (arg) => {
56
+ coerce: (arg)=>{
48
57
  const port = Number.parseInt(String(arg), 10);
49
58
  if (Number.isNaN(port)) {
50
- throw new Error(`Invalid port: ${String(arg)}`);
59
+ throw new Error(`Invalid port: "${String(arg)}".`);
51
60
  }
52
61
  return port;
53
62
  },
63
+ deprecated: true
54
64
  },
55
65
  outfileName: {
56
66
  alias: 'n',
57
67
  describe: 'Output file name',
58
68
  type: 'string',
59
- demandOption: false,
60
- default: 'bundle.js',
69
+ deprecated: true
61
70
  },
62
71
  root: {
63
72
  alias: 'r',
64
73
  describe: 'Server root directory',
65
74
  type: 'string',
66
- demandOption: true,
67
75
  normalize: true,
68
- default: '.',
76
+ deprecated: true
69
77
  },
70
78
  sourceMaps: {
71
79
  describe: 'Whether builds include sourcemaps',
72
80
  type: 'boolean',
73
- demandOption: false,
74
- default: false,
81
+ deprecated: true
75
82
  },
76
83
  src: {
77
84
  alias: 's',
78
85
  describe: 'Source file',
79
86
  type: 'string',
80
- demandOption: true,
81
87
  normalize: true,
82
- default: 'src/index.js',
88
+ deprecated: true
83
89
  },
84
90
  stripComments: {
85
91
  alias: 'strip',
86
92
  describe: 'Whether to remove code comments from the build output',
87
93
  type: 'boolean',
88
- demandOption: false,
89
- default: true,
94
+ deprecated: true
90
95
  },
91
96
  suppressWarnings: {
92
97
  type: 'boolean',
93
98
  describe: 'Whether to suppress warnings',
94
- demandOption: false,
95
- default: false,
99
+ deprecated: true
96
100
  },
97
101
  transpilationMode: {
98
102
  type: 'string',
99
- describe: 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing.',
100
- demandOption: false,
101
- default: TranspilationModes.LocalOnly,
103
+ describe: 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',
102
104
  choices: Object.values(TranspilationModes),
105
+ deprecated: true
103
106
  },
104
107
  depsToTranspile: {
105
108
  type: 'array',
106
109
  describe: 'Transpile only the listed dependencies.',
107
- demandOption: false,
110
+ deprecated: true
108
111
  },
109
112
  verboseErrors: {
110
113
  type: 'boolean',
111
114
  describe: 'Display original errors',
112
- demandOption: false,
113
- default: true,
115
+ deprecated: true
114
116
  },
115
117
  writeManifest: {
116
- describe: 'Make necessary changes to the Snap manifest file',
118
+ describe: 'Make necessary changes to the snap manifest file',
117
119
  type: 'boolean',
118
- demandOption: false,
119
- default: true,
120
+ deprecated: true
120
121
  },
121
122
  serve: {
122
- describe: 'Serve Snap file(s) locally for testing',
123
+ describe: 'Serve snap file(s) locally for testing',
123
124
  type: 'boolean',
124
- demandOption: false,
125
- default: true,
126
- },
127
- directory: {
128
- describe: 'the directory to use',
129
- type: 'string',
130
- },
125
+ deprecated: true
126
+ }
131
127
  };
132
- exports.default = builders;
128
+ export default builders;
129
+
133
130
  //# sourceMappingURL=builders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/builders.ts"],"sourcesContent":["import type { Options } from 'yargs';\n\nexport enum TranspilationModes {\n LocalAndDeps = 'localAndDeps',\n LocalOnly = 'localOnly',\n None = 'none',\n}\n\nconst builders: Record<string, Readonly<Options>> = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\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 // Deprecated Browserify options.\n bundle: {\n alias: 'b',\n describe: 'Snap bundle file',\n type: 'string',\n normalize: true,\n deprecated: 'Use --input instead.',\n },\n\n dist: {\n alias: 'd',\n describe: 'Output directory',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n eval: {\n alias: 'e',\n describe: 'Attempt to evaluate Snap bundle in SES',\n type: 'boolean',\n deprecated: true,\n },\n\n manifest: {\n alias: 'm',\n describe: 'Validate snap.manifest.json',\n type: 'boolean',\n deprecated: 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 deprecated: true,\n },\n\n outfileName: {\n alias: 'n',\n describe: 'Output file name',\n type: 'string',\n deprecated: true,\n },\n\n root: {\n alias: 'r',\n describe: 'Server root directory',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n sourceMaps: {\n describe: 'Whether builds include sourcemaps',\n type: 'boolean',\n deprecated: true,\n },\n\n src: {\n alias: 's',\n describe: 'Source file',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n stripComments: {\n alias: 'strip',\n describe: 'Whether to remove code comments from the build output',\n type: 'boolean',\n deprecated: true,\n },\n\n suppressWarnings: {\n type: 'boolean',\n describe: 'Whether to suppress warnings',\n deprecated: true,\n },\n\n transpilationMode: {\n type: 'string',\n describe:\n 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',\n choices: Object.values(TranspilationModes),\n deprecated: true,\n },\n\n depsToTranspile: {\n type: 'array',\n describe: 'Transpile only the listed dependencies.',\n deprecated: true,\n },\n\n verboseErrors: {\n type: 'boolean',\n describe: 'Display original errors',\n deprecated: true,\n },\n\n writeManifest: {\n describe: 'Make necessary changes to the snap manifest file',\n type: 'boolean',\n deprecated: true,\n },\n\n serve: {\n describe: 'Serve snap file(s) locally for testing',\n type: 'boolean',\n deprecated: true,\n },\n};\n\nexport default builders;\n"],"names":["TranspilationModes","LocalAndDeps","LocalOnly","None","builders","config","alias","describe","type","normalize","fix","input","bundle","deprecated","dist","eval","manifest","port","coerce","arg","Number","parseInt","String","isNaN","Error","outfileName","root","sourceMaps","src","stripComments","suppressWarnings","transpilationMode","choices","Object","values","depsToTranspile","verboseErrors","writeManifest","serve"],"mappings":"WAEO;UAAKA,kBAAkB;IAAlBA,mBACVC,kBAAe;IADLD,mBAEVE,eAAY;IAFFF,mBAGVG,UAAO;GAHGH,uBAAAA;AAMZ,MAAMI,WAA8C;IAClD,gEAAgE;IAChEC,QAAQ;QACNC,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;IACb;IAEAC,KAAK;QACHH,UAAU;QACVC,MAAM;IACR;IAEAG,OAAO;QACLL,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;IACb;IAEA,iCAAiC;IACjCG,QAAQ;QACNN,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;QACXI,YAAY;IACd;IAEAC,MAAM;QACJR,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;QACXI,YAAY;IACd;IAEAE,MAAM;QACJT,OAAO;QACPC,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAG,UAAU;QACRV,OAAO;QACPC,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAI,MAAM;QACJX,OAAO;QACPC,UAAU;QACVC,MAAM;QACNU,QAAQ,CAACC;YACP,MAAMF,OAAOG,OAAOC,QAAQ,CAACC,OAAOH,MAAM;YAC1C,IAAIC,OAAOG,KAAK,CAACN,OAAO;gBACtB,MAAM,IAAIO,MAAM,CAAC,eAAe,EAAEF,OAAOH,KAAK,EAAE,CAAC;YACnD;YAEA,OAAOF;QACT;QACAJ,YAAY;IACd;IAEAY,aAAa;QACXnB,OAAO;QACPC,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAa,MAAM;QACJpB,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;QACXI,YAAY;IACd;IAEAc,YAAY;QACVpB,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAe,KAAK;QACHtB,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;QACXI,YAAY;IACd;IAEAgB,eAAe;QACbvB,OAAO;QACPC,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAiB,kBAAkB;QAChBtB,MAAM;QACND,UAAU;QACVM,YAAY;IACd;IAEAkB,mBAAmB;QACjBvB,MAAM;QACND,UACE;QACFyB,SAASC,OAAOC,MAAM,CAAClC;QACvBa,YAAY;IACd;IAEAsB,iBAAiB;QACf3B,MAAM;QACND,UAAU;QACVM,YAAY;IACd;IAEAuB,eAAe;QACb5B,MAAM;QACND,UAAU;QACVM,YAAY;IACd;IAEAwB,eAAe;QACb9B,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAyB,OAAO;QACL/B,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;AACF;AAEA,eAAeT,SAAS"}
@@ -0,0 +1,26 @@
1
+ import yargs from 'yargs';
2
+ import { hideBin } from 'yargs/helpers';
3
+ import builders from './builders';
4
+ import { getConfigByArgv } from './config';
5
+ import { error, getYargsErrorMessage, sanitizeInputs } from './utils';
6
+ /**
7
+ * The main CLI entry point function. This processes the command line args, and
8
+ * runs the appropriate function.
9
+ *
10
+ * @param argv - The raw command line arguments, i.e., `process.argv`.
11
+ * @param commands - The list of commands to use.
12
+ */ export async function cli(argv, commands) {
13
+ await yargs(hideBin(argv)).scriptName('mm-snap').usage('Usage: $0 <command> [options]').example('$0 build', `Build './src/index.js' as './dist/bundle.js'`).example('$0 build --config ./snap.config.build.ts', `Build './src/index.js' as './dist/bundle.js' using the config in './snap.config.build.ts'`).example('$0 manifest --fix', `Check the snap manifest, and fix any errors`).example('$0 watch --port 8000', `The snap input file for changes, and serve it on port 8000`).example('$0 serve --port 8000', `Serve the snap bundle on port 8000`).command(commands).option('config', builders.config).option('verboseErrors', builders.verboseErrors).option('suppressWarnings', builders.suppressWarnings).strict().middleware(async (args)=>{
14
+ // eslint-disable-next-line require-atomic-updates
15
+ args.context = {
16
+ config: await getConfigByArgv(args)
17
+ };
18
+ sanitizeInputs(args);
19
+ }, false).demandCommand(1, 'You must specify at least one command.').fail((message, failure)=>{
20
+ error(getYargsErrorMessage(message, failure));
21
+ // eslint-disable-next-line n/no-process-exit
22
+ process.exit(1);
23
+ }).help().alias('help', 'h').parseAsync();
24
+ }
25
+
26
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli.ts"],"sourcesContent":["import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport builders from './builders';\nimport { getConfigByArgv } from './config';\nimport { error, getYargsErrorMessage, sanitizeInputs } from './utils';\n\n/**\n * The main CLI entry point function. This processes the command line args, and\n * runs the appropriate function.\n *\n * @param argv - The raw command line arguments, i.e., `process.argv`.\n * @param commands - The list of commands to use.\n */\nexport async function cli(argv: string[], commands: any) {\n await yargs(hideBin(argv))\n .scriptName('mm-snap')\n .usage('Usage: $0 <command> [options]')\n\n .example('$0 build', `Build './src/index.js' as './dist/bundle.js'`)\n .example(\n '$0 build --config ./snap.config.build.ts',\n `Build './src/index.js' as './dist/bundle.js' using the config in './snap.config.build.ts'`,\n )\n .example('$0 manifest --fix', `Check the snap manifest, and fix any errors`)\n .example(\n '$0 watch --port 8000',\n `The snap input file for changes, and serve it on port 8000`,\n )\n .example('$0 serve --port 8000', `Serve the snap bundle on port 8000`)\n\n .command(commands)\n\n .option('config', builders.config)\n .option('verboseErrors', builders.verboseErrors)\n .option('suppressWarnings', builders.suppressWarnings)\n\n .strict()\n\n .middleware(async (args: any) => {\n // eslint-disable-next-line require-atomic-updates\n args.context = {\n config: await getConfigByArgv(args),\n };\n\n sanitizeInputs(args);\n }, false)\n\n .demandCommand(1, 'You must specify at least one command.')\n\n .fail((message, failure) => {\n error(getYargsErrorMessage(message, failure));\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n })\n\n .help()\n .alias('help', 'h')\n .parseAsync();\n}\n"],"names":["yargs","hideBin","builders","getConfigByArgv","error","getYargsErrorMessage","sanitizeInputs","cli","argv","commands","scriptName","usage","example","command","option","config","verboseErrors","suppressWarnings","strict","middleware","args","context","demandCommand","fail","message","failure","process","exit","help","alias","parseAsync"],"mappings":"AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,OAAO,QAAQ,gBAAgB;AAExC,OAAOC,cAAc,aAAa;AAClC,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,KAAK,EAAEC,oBAAoB,EAAEC,cAAc,QAAQ,UAAU;AAEtE;;;;;;CAMC,GACD,OAAO,eAAeC,IAAIC,IAAc,EAAEC,QAAa;IACrD,MAAMT,MAAMC,QAAQO,OACjBE,UAAU,CAAC,WACXC,KAAK,CAAC,iCAENC,OAAO,CAAC,YAAY,CAAC,4CAA4C,CAAC,EAClEA,OAAO,CACN,4CACA,CAAC,yFAAyF,CAAC,EAE5FA,OAAO,CAAC,qBAAqB,CAAC,2CAA2C,CAAC,EAC1EA,OAAO,CACN,wBACA,CAAC,0DAA0D,CAAC,EAE7DA,OAAO,CAAC,wBAAwB,CAAC,kCAAkC,CAAC,EAEpEC,OAAO,CAACJ,UAERK,MAAM,CAAC,UAAUZ,SAASa,MAAM,EAChCD,MAAM,CAAC,iBAAiBZ,SAASc,aAAa,EAC9CF,MAAM,CAAC,oBAAoBZ,SAASe,gBAAgB,EAEpDC,MAAM,GAENC,UAAU,CAAC,OAAOC;QACjB,kDAAkD;QAClDA,KAAKC,OAAO,GAAG;YACbN,QAAQ,MAAMZ,gBAAgBiB;QAChC;QAEAd,eAAec;IACjB,GAAG,OAEFE,aAAa,CAAC,GAAG,0CAEjBC,IAAI,CAAC,CAACC,SAASC;QACdrB,MAAMC,qBAAqBmB,SAASC;QACpC,6CAA6C;QAC7CC,QAAQC,IAAI,CAAC;IACf,GAECC,IAAI,GACJC,KAAK,CAAC,QAAQ,KACdC,UAAU;AACf"}
@@ -0,0 +1,51 @@
1
+ import { isFile } from '@metamask/snaps-utils';
2
+ import { resolve as pathResolve } from 'path';
3
+ import { CommandError } from '../../errors';
4
+ import { executeSteps, info } from '../../utils';
5
+ import { evaluate } from '../eval';
6
+ import { build } from './implementation';
7
+ const steps = [
8
+ {
9
+ name: 'Checking the input file.',
10
+ task: async ({ config })=>{
11
+ const { input } = config;
12
+ if (!await isFile(input)) {
13
+ throw new CommandError(`Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`);
14
+ }
15
+ }
16
+ },
17
+ {
18
+ name: 'Building the snap bundle.',
19
+ task: async ({ config, spinner })=>{
20
+ // We don't evaluate the bundle here, because it's done in a separate
21
+ // step.
22
+ return await build(config, {
23
+ evaluate: false,
24
+ spinner
25
+ });
26
+ }
27
+ },
28
+ {
29
+ name: 'Evaluating the snap bundle.',
30
+ condition: ({ config })=>config.evaluate,
31
+ task: async ({ config, spinner })=>{
32
+ const path = pathResolve(process.cwd(), config.output.path, config.output.filename);
33
+ await evaluate(path);
34
+ info(`Snap bundle evaluated successfully.`, spinner);
35
+ }
36
+ }
37
+ ];
38
+ /**
39
+ * Build all files in the given source directory to the given destination
40
+ * directory.
41
+ *
42
+ * This creates the destination directory if it doesn't exist.
43
+ *
44
+ * @param config - The config object.
45
+ */ export async function buildHandler(config) {
46
+ return await executeSteps(steps, {
47
+ config
48
+ });
49
+ }
50
+
51
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/build/build.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils';\nimport { resolve as pathResolve } from 'path';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { evaluate } from '../eval';\nimport { build } from './implementation';\n\ntype BuildContext = {\n config: ProcessedWebpackConfig;\n};\n\nconst steps: Steps<BuildContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n // We don't evaluate the bundle here, because it's done in a separate\n // step.\n return await build(config, { evaluate: false, spinner });\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n condition: ({ config }) => config.evaluate,\n task: async ({ config, spinner }) => {\n const path = pathResolve(\n process.cwd(),\n config.output.path,\n config.output.filename,\n );\n\n await evaluate(path);\n\n info(`Snap bundle evaluated successfully.`, spinner);\n },\n },\n] as const;\n\n/**\n * Build all files in the given source directory to the given destination\n * directory.\n *\n * This creates the destination directory if it doesn't exist.\n *\n * @param config - The config object.\n */\nexport async function buildHandler(config: ProcessedConfig): Promise<void> {\n return await executeSteps(steps, {\n config,\n });\n}\n"],"names":["isFile","resolve","pathResolve","CommandError","executeSteps","info","evaluate","build","steps","name","task","config","input","spinner","condition","path","process","cwd","output","filename","buildHandler"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,WAAWC,WAAW,QAAQ,OAAO;AAG9C,SAASC,YAAY,QAAQ,eAAe;AAE5C,SAASC,YAAY,EAAEC,IAAI,QAAQ,cAAc;AACjD,SAASC,QAAQ,QAAQ,UAAU;AACnC,SAASC,KAAK,QAAQ,mBAAmB;AAMzC,MAAMC,QAA6B;IACjC;QACEC,MAAM;QACNC,MAAM,OAAO,EAAEC,MAAM,EAAE;YACrB,MAAM,EAAEC,KAAK,EAAE,GAAGD;YAElB,IAAI,CAAE,MAAMX,OAAOY,QAAS;gBAC1B,MAAM,IAAIT,aACR,CAAC,uBAAuB,EAAES,MAAM,mEAAmE,CAAC;YAExG;QACF;IACF;IACA;QACEH,MAAM;QACNC,MAAM,OAAO,EAAEC,MAAM,EAAEE,OAAO,EAAE;YAC9B,qEAAqE;YACrE,QAAQ;YACR,OAAO,MAAMN,MAAMI,QAAQ;gBAAEL,UAAU;gBAAOO;YAAQ;QACxD;IACF;IACA;QACEJ,MAAM;QACNK,WAAW,CAAC,EAAEH,MAAM,EAAE,GAAKA,OAAOL,QAAQ;QAC1CI,MAAM,OAAO,EAAEC,MAAM,EAAEE,OAAO,EAAE;YAC9B,MAAME,OAAOb,YACXc,QAAQC,GAAG,IACXN,OAAOO,MAAM,CAACH,IAAI,EAClBJ,OAAOO,MAAM,CAACC,QAAQ;YAGxB,MAAMb,SAASS;YAEfV,KAAK,CAAC,mCAAmC,CAAC,EAAEQ;QAC9C;IACF;CACD;AAED;;;;;;;CAOC,GACD,OAAO,eAAeO,aAAaT,MAAuB;IACxD,OAAO,MAAMP,aAAaI,OAAO;QAC/BG;IACF;AACF"}
@@ -0,0 +1,27 @@
1
+ import { getCompiler } from '../../webpack';
2
+ /**
3
+ * Build the snap bundle. This uses Webpack to build the bundle.
4
+ *
5
+ * @param config - The config object.
6
+ * @param options - The Webpack options.
7
+ * @returns A promise that resolves when the bundle is built.
8
+ */ export async function build(config, options) {
9
+ const compiler = await getCompiler(config, options);
10
+ return await new Promise((resolve, reject)=>{
11
+ compiler.run((runError)=>{
12
+ if (runError) {
13
+ reject(runError);
14
+ return;
15
+ }
16
+ compiler.close((closeError)=>{
17
+ if (closeError) {
18
+ reject(closeError);
19
+ return;
20
+ }
21
+ resolve();
22
+ });
23
+ });
24
+ });
25
+ }
26
+
27
+ //# sourceMappingURL=implementation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/build/implementation.ts"],"sourcesContent":["import type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle. This uses Webpack to build the bundle.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns A promise that resolves when the bundle is built.\n */\nexport async function build(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, options);\n return await new Promise<void>((resolve, reject) => {\n compiler.run((runError) => {\n if (runError) {\n reject(runError);\n return;\n }\n\n compiler.close((closeError) => {\n if (closeError) {\n reject(closeError);\n return;\n }\n\n resolve();\n });\n });\n });\n}\n"],"names":["getCompiler","build","config","options","compiler","Promise","resolve","reject","run","runError","close","closeError"],"mappings":"AAEA,SAASA,WAAW,QAAQ,gBAAgB;AAE5C;;;;;;CAMC,GACD,OAAO,eAAeC,MACpBC,MAA8B,EAC9BC,OAAwB;IAExB,MAAMC,WAAW,MAAMJ,YAAYE,QAAQC;IAC3C,OAAO,MAAM,IAAIE,QAAc,CAACC,SAASC;QACvCH,SAASI,GAAG,CAAC,CAACC;YACZ,IAAIA,UAAU;gBACZF,OAAOE;gBACP;YACF;YAEAL,SAASM,KAAK,CAAC,CAACC;gBACd,IAAIA,YAAY;oBACdJ,OAAOI;oBACP;gBACF;gBAEAL;YACF;QACF;IACF;AACF"}
@@ -0,0 +1,17 @@
1
+ import builders from '../../builders';
2
+ import { buildHandler } from './build';
3
+ const command = {
4
+ command: [
5
+ 'build',
6
+ 'b'
7
+ ],
8
+ desc: 'Build snap from source',
9
+ builder: (yarg)=>{
10
+ yarg.option('dist', builders.dist).option('eval', builders.eval).option('manifest', builders.manifest).option('outfileName', builders.outfileName).option('sourceMaps', builders.sourceMaps).option('src', builders.src).option('stripComments', builders.stripComments).option('transpilationMode', builders.transpilationMode).option('depsToTranspile', builders.depsToTranspile).option('writeManifest', builders.writeManifest).implies('writeManifest', 'manifest').implies('depsToTranspile', 'transpilationMode');
11
+ },
12
+ handler: async (argv)=>buildHandler(argv.context.config)
13
+ };
14
+ export * from './implementation';
15
+ export default command;
16
+
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/build/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { buildHandler } from './build';\n\nconst command = {\n command: ['build', 'b'],\n desc: 'Build snap from source',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('dist', builders.dist)\n .option('eval', builders.eval)\n .option('manifest', builders.manifest)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('src', builders.src)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('writeManifest', builders.writeManifest)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) => buildHandler(argv.context.config),\n};\n\nexport * from './implementation';\nexport default command;\n"],"names":["builders","buildHandler","command","desc","builder","yarg","option","dist","eval","manifest","outfileName","sourceMaps","src","stripComments","transpilationMode","depsToTranspile","writeManifest","implies","handler","argv","context","config"],"mappings":"AAEA,OAAOA,cAAc,iBAAiB;AAEtC,SAASC,YAAY,QAAQ,UAAU;AAEvC,MAAMC,UAAU;IACdA,SAAS;QAAC;QAAS;KAAI;IACvBC,MAAM;IACNC,SAAS,CAACC;QACRA,KACGC,MAAM,CAAC,QAAQN,SAASO,IAAI,EAC5BD,MAAM,CAAC,QAAQN,SAASQ,IAAI,EAC5BF,MAAM,CAAC,YAAYN,SAASS,QAAQ,EACpCH,MAAM,CAAC,eAAeN,SAASU,WAAW,EAC1CJ,MAAM,CAAC,cAAcN,SAASW,UAAU,EACxCL,MAAM,CAAC,OAAON,SAASY,GAAG,EAC1BN,MAAM,CAAC,iBAAiBN,SAASa,aAAa,EAC9CP,MAAM,CAAC,qBAAqBN,SAASc,iBAAiB,EACtDR,MAAM,CAAC,mBAAmBN,SAASe,eAAe,EAClDT,MAAM,CAAC,iBAAiBN,SAASgB,aAAa,EAC9CC,OAAO,CAAC,iBAAiB,YACzBA,OAAO,CAAC,mBAAmB;IAChC;IACAC,SAAS,OAAOC,OAAoBlB,aAAakB,KAAKC,OAAO,CAACC,MAAM;AACtE;AAEA,cAAc,mBAAmB;AACjC,eAAenB,QAAQ"}
@@ -0,0 +1,54 @@
1
+ import { isFile } from '@metamask/snaps-utils';
2
+ import { resolve } from 'path';
3
+ import { CommandError } from '../../errors';
4
+ import { executeSteps, getRelativePath } from '../../utils';
5
+ import { evaluate } from './implementation';
6
+ const steps = [
7
+ {
8
+ name: 'Checking the input file.',
9
+ task: async ({ input })=>{
10
+ if (!await isFile(input)) {
11
+ const relativePath = getRelativePath(input);
12
+ throw new CommandError(`Input file not found: "${relativePath}". Make sure that the "input" field in your snap config or the specified input file is correct.`);
13
+ }
14
+ }
15
+ },
16
+ {
17
+ name: 'Evaluating the snap bundle.',
18
+ task: async ({ input, spinner })=>{
19
+ await evaluate(input);
20
+ spinner.succeed('Snap bundle evaluated successfully.');
21
+ }
22
+ }
23
+ ];
24
+ /**
25
+ * Returns the path to the bundle, based on the config and options.
26
+ *
27
+ * - If `options.input` is specified, it is used as the bundle path.
28
+ * - Otherwise, the bundle path is resolved from the config's output path and
29
+ * filename.
30
+ *
31
+ * @param config - The processed config object.
32
+ * @param options - The eval options.
33
+ * @returns The path to the bundle.
34
+ */ function getBundlePath(config, options) {
35
+ if (options.input) {
36
+ return resolve(process.cwd(), options.input);
37
+ }
38
+ return resolve(config.output.path, config.output.filename);
39
+ }
40
+ /**
41
+ * Runs the snap in a worker, to ensure SES compatibility.
42
+ *
43
+ * @param config - The processed config object.
44
+ * @param options - The eval options.
45
+ * @returns A promise that resolves once the eval has finished.
46
+ * @throws If the eval failed.
47
+ */ export async function evaluateHandler(config, options = {}) {
48
+ const input = getBundlePath(config, options);
49
+ await executeSteps(steps, {
50
+ input
51
+ });
52
+ }
53
+
54
+ //# sourceMappingURL=eval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/eval/eval.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils';\nimport { resolve } from 'path';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, getRelativePath } from '../../utils';\nimport { evaluate } from './implementation';\n\nexport type EvalOptions = {\n input?: string;\n};\n\nexport type EvalContext = Required<EvalOptions>;\n\nconst steps: Steps<EvalContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n const relativePath = getRelativePath(input);\n throw new CommandError(\n `Input file not found: \"${relativePath}\". Make sure that the \"input\" field in your snap config or the specified input file is correct.`,\n );\n }\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n task: async ({ input, spinner }) => {\n await evaluate(input);\n spinner.succeed('Snap bundle evaluated successfully.');\n },\n },\n];\n\n/**\n * Returns the path to the bundle, based on the config and options.\n *\n * - If `options.input` is specified, it is used as the bundle path.\n * - Otherwise, the bundle path is resolved from the config's output path and\n * filename.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns The path to the bundle.\n */\nfunction getBundlePath(config: ProcessedConfig, options: EvalOptions): string {\n if (options.input) {\n return resolve(process.cwd(), options.input);\n }\n\n return resolve(config.output.path, config.output.filename);\n}\n\n/**\n * Runs the snap in a worker, to ensure SES compatibility.\n *\n * @param config - The processed config object.\n * @param options - The eval options.\n * @returns A promise that resolves once the eval has finished.\n * @throws If the eval failed.\n */\nexport async function evaluateHandler(\n config: ProcessedConfig,\n options: EvalOptions = {},\n): Promise<void> {\n const input = getBundlePath(config, options);\n await executeSteps(steps, { input });\n}\n"],"names":["isFile","resolve","CommandError","executeSteps","getRelativePath","evaluate","steps","name","task","input","relativePath","spinner","succeed","getBundlePath","config","options","process","cwd","output","path","filename","evaluateHandler"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,OAAO,QAAQ,OAAO;AAG/B,SAASC,YAAY,QAAQ,eAAe;AAE5C,SAASC,YAAY,EAAEC,eAAe,QAAQ,cAAc;AAC5D,SAASC,QAAQ,QAAQ,mBAAmB;AAQ5C,MAAMC,QAA4B;IAChC;QACEC,MAAM;QACNC,MAAM,OAAO,EAAEC,KAAK,EAAE;YACpB,IAAI,CAAE,MAAMT,OAAOS,QAAS;gBAC1B,MAAMC,eAAeN,gBAAgBK;gBACrC,MAAM,IAAIP,aACR,CAAC,uBAAuB,EAAEQ,aAAa,+FAA+F,CAAC;YAE3I;QACF;IACF;IACA;QACEH,MAAM;QACNC,MAAM,OAAO,EAAEC,KAAK,EAAEE,OAAO,EAAE;YAC7B,MAAMN,SAASI;YACfE,QAAQC,OAAO,CAAC;QAClB;IACF;CACD;AAED;;;;;;;;;;CAUC,GACD,SAASC,cAAcC,MAAuB,EAAEC,OAAoB;IAClE,IAAIA,QAAQN,KAAK,EAAE;QACjB,OAAOR,QAAQe,QAAQC,GAAG,IAAIF,QAAQN,KAAK;IAC7C;IAEA,OAAOR,QAAQa,OAAOI,MAAM,CAACC,IAAI,EAAEL,OAAOI,MAAM,CAACE,QAAQ;AAC3D;AAEA;;;;;;;CAOC,GACD,OAAO,eAAeC,gBACpBP,MAAuB,EACvBC,UAAuB,CAAC,CAAC;IAEzB,MAAMN,QAAQI,cAAcC,QAAQC;IACpC,MAAMZ,aAAaG,OAAO;QAAEG;IAAM;AACpC"}
@@ -0,0 +1,24 @@
1
+ import { evalBundle, SnapEvalError, indent } from '@metamask/snaps-utils';
2
+ import { red } from 'chalk';
3
+ import { CommandError } from '../../errors';
4
+ /**
5
+ * Evaluate the given bundle in the SES environment. This is a wrapper around
6
+ * {@link evalBundle} that throws a {@link CommandError} if the bundle cannot be
7
+ * evaluated.
8
+ *
9
+ * @param path - The path to the bundle.
10
+ * @throws If the bundle cannot be evaluated.
11
+ */ export async function evaluate(path) {
12
+ try {
13
+ return await evalBundle(path);
14
+ } catch (evalError) {
15
+ if (evalError instanceof SnapEvalError) {
16
+ throw new CommandError(`Failed to evaluate snap bundle in SES. This is likely due to an incompatibility with the SES environment in your snap.\nReceived the following error from the SES environment:\n\n${indent(red(evalError.output.stderr), 2)}`);
17
+ }
18
+ // If the error is not a `SnapEvalError`, we don't know what it is, so
19
+ // we just throw it.
20
+ throw evalError;
21
+ }
22
+ }
23
+
24
+ //# sourceMappingURL=implementation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/eval/implementation.ts"],"sourcesContent":["import { evalBundle, SnapEvalError, indent } from '@metamask/snaps-utils';\nimport { red } from 'chalk';\n\nimport { CommandError } from '../../errors';\n\n/**\n * Evaluate the given bundle in the SES environment. This is a wrapper around\n * {@link evalBundle} that throws a {@link CommandError} if the bundle cannot be\n * evaluated.\n *\n * @param path - The path to the bundle.\n * @throws If the bundle cannot be evaluated.\n */\nexport async function evaluate(path: string) {\n try {\n return await evalBundle(path);\n } catch (evalError) {\n if (evalError instanceof SnapEvalError) {\n throw new CommandError(\n `Failed to evaluate snap bundle in SES. This is likely due to an incompatibility with the SES environment in your snap.\\nReceived the following error from the SES environment:\\n\\n${indent(\n red(evalError.output.stderr),\n 2,\n )}`,\n );\n }\n\n // If the error is not a `SnapEvalError`, we don't know what it is, so\n // we just throw it.\n throw evalError;\n }\n}\n"],"names":["evalBundle","SnapEvalError","indent","red","CommandError","evaluate","path","evalError","output","stderr"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,EAAEC,MAAM,QAAQ,wBAAwB;AAC1E,SAASC,GAAG,QAAQ,QAAQ;AAE5B,SAASC,YAAY,QAAQ,eAAe;AAE5C;;;;;;;CAOC,GACD,OAAO,eAAeC,SAASC,IAAY;IACzC,IAAI;QACF,OAAO,MAAMN,WAAWM;IAC1B,EAAE,OAAOC,WAAW;QAClB,IAAIA,qBAAqBN,eAAe;YACtC,MAAM,IAAIG,aACR,CAAC,kLAAkL,EAAEF,OACnLC,IAAII,UAAUC,MAAM,CAACC,MAAM,GAC3B,GACA,CAAC;QAEP;QAEA,sEAAsE;QACtE,oBAAoB;QACpB,MAAMF;IACR;AACF"}
@@ -0,0 +1,22 @@
1
+ import builders from '../../builders';
2
+ import { evaluateHandler } from './eval';
3
+ const command = {
4
+ command: [
5
+ 'eval',
6
+ 'e'
7
+ ],
8
+ desc: 'Attempt to evaluate snap bundle in SES',
9
+ builder: (yarg)=>{
10
+ // Browserify options. These are merged into the config object.
11
+ yarg.option('bundle', builders.bundle);
12
+ // Webpack options.
13
+ yarg.option('input', builders.input);
14
+ },
15
+ handler: async (argv)=>evaluateHandler(argv.context.config, {
16
+ input: argv.input
17
+ })
18
+ };
19
+ export * from './implementation';
20
+ export default command;
21
+
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/eval/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { evaluateHandler } from './eval';\n\nconst command = {\n command: ['eval', 'e'],\n desc: 'Attempt to evaluate snap bundle in SES',\n builder: (yarg: yargs.Argv) => {\n // Browserify options. These are merged into the config object.\n yarg.option('bundle', builders.bundle);\n\n // Webpack options.\n yarg.option('input', builders.input);\n },\n handler: async (argv: YargsArgs) =>\n evaluateHandler(argv.context.config, { input: argv.input }),\n};\n\nexport * from './implementation';\nexport default command;\n"],"names":["builders","evaluateHandler","command","desc","builder","yarg","option","bundle","input","handler","argv","context","config"],"mappings":"AAEA,OAAOA,cAAc,iBAAiB;AAEtC,SAASC,eAAe,QAAQ,SAAS;AAEzC,MAAMC,UAAU;IACdA,SAAS;QAAC;QAAQ;KAAI;IACtBC,MAAM;IACNC,SAAS,CAACC;QACR,+DAA+D;QAC/DA,KAAKC,MAAM,CAAC,UAAUN,SAASO,MAAM;QAErC,mBAAmB;QACnBF,KAAKC,MAAM,CAAC,SAASN,SAASQ,KAAK;IACrC;IACAC,SAAS,OAAOC,OACdT,gBAAgBS,KAAKC,OAAO,CAACC,MAAM,EAAE;YAAEJ,OAAOE,KAAKF,KAAK;QAAC;AAC7D;AAEA,cAAc,mBAAmB;AACjC,eAAeN,QAAQ"}
@@ -0,0 +1,15 @@
1
+ import buildCommand from './build';
2
+ import evaluateCommand from './eval';
3
+ import manifestCommand from './manifest';
4
+ import serveCommand from './serve';
5
+ import watchCommand from './watch';
6
+ const commands = [
7
+ buildCommand,
8
+ evaluateCommand,
9
+ manifestCommand,
10
+ serveCommand,
11
+ watchCommand
12
+ ];
13
+ export default commands;
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/commands/index.ts"],"sourcesContent":["import buildCommand from './build';\nimport evaluateCommand from './eval';\nimport manifestCommand from './manifest';\nimport serveCommand from './serve';\nimport watchCommand from './watch';\n\nconst commands = [\n buildCommand,\n evaluateCommand,\n manifestCommand,\n serveCommand,\n watchCommand,\n];\n\nexport default commands;\n"],"names":["buildCommand","evaluateCommand","manifestCommand","serveCommand","watchCommand","commands"],"mappings":"AAAA,OAAOA,kBAAkB,UAAU;AACnC,OAAOC,qBAAqB,SAAS;AACrC,OAAOC,qBAAqB,aAAa;AACzC,OAAOC,kBAAkB,UAAU;AACnC,OAAOC,kBAAkB,UAAU;AAEnC,MAAMC,WAAW;IACfL;IACAC;IACAC;IACAC;IACAC;CACD;AAED,eAAeC,SAAS"}
@@ -0,0 +1,33 @@
1
+ import { checkManifest, indent } from '@metamask/snaps-utils';
2
+ import { red, yellow } from 'chalk';
3
+ import { dirname } from 'path';
4
+ import { error, info, warn } from '../../utils';
5
+ /**
6
+ * Check the snap manifest file at the given path. If `write` is `true`, the
7
+ * manifest will be written to disk if it is invalid. If `write` is `false`,
8
+ * the manifest will not be written to disk, and the function will log any
9
+ * errors and warnings to the console.
10
+ *
11
+ * @param path - The path to the manifest file.
12
+ * @param write - Whether to write the manifest to disk if it is invalid.
13
+ * @param spinner - An optional spinner to use for logging.
14
+ */ export async function manifest(path, write, spinner) {
15
+ const { warnings, errors, updated } = await checkManifest(dirname(path), write);
16
+ if (write && updated) {
17
+ info('The snap manifest file has been updated.', spinner);
18
+ }
19
+ if (!write && errors.length > 0) {
20
+ const formattedErrors = errors.map((manifestError)=>indent(red(`• ${manifestError}`))).join('\n');
21
+ error(`The snap manifest file is invalid.\n\n${formattedErrors}\n\nRun the command with the \`--fix\` flag to attempt to fix the manifest.`, spinner);
22
+ spinner?.stop();
23
+ process.exitCode = 1;
24
+ return false;
25
+ }
26
+ if (warnings.length > 0) {
27
+ const formattedWarnings = warnings.map((manifestWarning)=>indent(yellow(`• ${manifestWarning}`)));
28
+ warn(`The snap manifest file has warnings.\n\n${formattedWarnings.join('\n')}`, spinner);
29
+ }
30
+ return true;
31
+ }
32
+
33
+ //# sourceMappingURL=implementation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/manifest/implementation.ts"],"sourcesContent":["import { checkManifest, indent } from '@metamask/snaps-utils';\nimport { red, yellow } 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 */\nexport async function manifest(\n path: string,\n write: boolean,\n spinner?: Ora,\n): Promise<boolean> {\n const { warnings, errors, updated } = await checkManifest(\n dirname(path),\n write,\n );\n\n if (write && updated) {\n info('The snap manifest file has been updated.', spinner);\n }\n\n if (!write && errors.length > 0) {\n const formattedErrors = errors\n .map((manifestError) => indent(red(`• ${manifestError}`)))\n .join('\\n');\n\n error(\n `The snap manifest file is invalid.\\n\\n${formattedErrors}\\n\\nRun the command with the \\`--fix\\` flag to attempt to fix the manifest.`,\n spinner,\n );\n\n spinner?.stop();\n process.exitCode = 1;\n return false;\n }\n\n if (warnings.length > 0) {\n const formattedWarnings = warnings.map((manifestWarning) =>\n indent(yellow(`• ${manifestWarning}`)),\n );\n\n warn(\n `The snap manifest file has warnings.\\n\\n${formattedWarnings.join('\\n')}`,\n spinner,\n );\n }\n\n return true;\n}\n"],"names":["checkManifest","indent","red","yellow","dirname","error","info","warn","manifest","path","write","spinner","warnings","errors","updated","length","formattedErrors","map","manifestError","join","stop","process","exitCode","formattedWarnings","manifestWarning"],"mappings":"AAAA,SAASA,aAAa,EAAEC,MAAM,QAAQ,wBAAwB;AAC9D,SAASC,GAAG,EAAEC,MAAM,QAAQ,QAAQ;AAEpC,SAASC,OAAO,QAAQ,OAAO;AAE/B,SAASC,KAAK,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEhD;;;;;;;;;CASC,GACD,OAAO,eAAeC,SACpBC,IAAY,EACZC,KAAc,EACdC,OAAa;IAEb,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAG,MAAMd,cAC1CI,QAAQK,OACRC;IAGF,IAAIA,SAASI,SAAS;QACpBR,KAAK,4CAA4CK;IACnD;IAEA,IAAI,CAACD,SAASG,OAAOE,MAAM,GAAG,GAAG;QAC/B,MAAMC,kBAAkBH,OACrBI,GAAG,CAAC,CAACC,gBAAkBjB,OAAOC,IAAI,CAAC,EAAE,EAAEgB,cAAc,CAAC,IACtDC,IAAI,CAAC;QAERd,MACE,CAAC,sCAAsC,EAAEW,gBAAgB,2EAA2E,CAAC,EACrIL;QAGFA,SAASS;QACTC,QAAQC,QAAQ,GAAG;QACnB,OAAO;IACT;IAEA,IAAIV,SAASG,MAAM,GAAG,GAAG;QACvB,MAAMQ,oBAAoBX,SAASK,GAAG,CAAC,CAACO,kBACtCvB,OAAOE,OAAO,CAAC,EAAE,EAAEqB,gBAAgB,CAAC;QAGtCjB,KACE,CAAC,wCAAwC,EAAEgB,kBAAkBJ,IAAI,CAAC,MAAM,CAAC,EACzER;IAEJ;IAEA,OAAO;AACT"}
@@ -0,0 +1,22 @@
1
+ import builders from '../../builders';
2
+ import { manifestHandler } from './manifest';
3
+ const command = {
4
+ command: [
5
+ 'manifest',
6
+ 'm'
7
+ ],
8
+ desc: 'Validate the snap.manifest.json file',
9
+ builder: (yarg)=>{
10
+ // Browserify options. These are merged into the config object.
11
+ yarg.option('writeManifest', builders.writeManifest);
12
+ // Webpack options.
13
+ yarg.option('fix', builders.fix);
14
+ },
15
+ handler: async (argv)=>manifestHandler(argv.context.config, {
16
+ fix: argv.fix
17
+ })
18
+ };
19
+ export * from './implementation';
20
+ export default command;
21
+
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/manifest/index.ts"],"sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { manifestHandler } from './manifest';\n\nconst command = {\n command: ['manifest', 'm'],\n desc: 'Validate the snap.manifest.json file',\n builder: (yarg: yargs.Argv) => {\n // Browserify options. These are merged into the config object.\n yarg.option('writeManifest', builders.writeManifest);\n\n // Webpack options.\n yarg.option('fix', builders.fix);\n },\n handler: async (argv: YargsArgs) =>\n manifestHandler(argv.context.config, { fix: argv.fix }),\n};\n\nexport * from './implementation';\nexport default command;\n"],"names":["builders","manifestHandler","command","desc","builder","yarg","option","writeManifest","fix","handler","argv","context","config"],"mappings":"AAEA,OAAOA,cAAc,iBAAiB;AAEtC,SAASC,eAAe,QAAQ,aAAa;AAE7C,MAAMC,UAAU;IACdA,SAAS;QAAC;QAAY;KAAI;IAC1BC,MAAM;IACNC,SAAS,CAACC;QACR,+DAA+D;QAC/DA,KAAKC,MAAM,CAAC,iBAAiBN,SAASO,aAAa;QAEnD,mBAAmB;QACnBF,KAAKC,MAAM,CAAC,OAAON,SAASQ,GAAG;IACjC;IACAC,SAAS,OAAOC,OACdT,gBAAgBS,KAAKC,OAAO,CAACC,MAAM,EAAE;YAAEJ,KAAKE,KAAKF,GAAG;QAAC;AACzD;AAEA,cAAc,mBAAmB;AACjC,eAAeN,QAAQ"}
@@ -0,0 +1,52 @@
1
+ import { isFile } from '@metamask/snaps-utils';
2
+ import { CommandError } from '../../errors';
3
+ import { executeSteps } from '../../utils';
4
+ import { manifest } from './implementation';
5
+ const steps = [
6
+ {
7
+ name: 'Checking the input file.',
8
+ task: async ({ input })=>{
9
+ if (!await isFile(input)) {
10
+ throw new CommandError(`Manifest file not found: "${input}". Make sure that the \`snap.manifest.json\` file exists.`);
11
+ }
12
+ }
13
+ },
14
+ {
15
+ name: 'Validating the snap manifest.',
16
+ task: async ({ input, config, options, spinner })=>{
17
+ const write = getWriteManifest(config, options);
18
+ const valid = await manifest(input, write, spinner);
19
+ if (valid) {
20
+ spinner.succeed('The snap manifest file is valid.');
21
+ }
22
+ }
23
+ }
24
+ ];
25
+ /**
26
+ * Get whether to write the manifest to disk.
27
+ *
28
+ * @param config - The config object.
29
+ * @param options - The options object.
30
+ * @returns Whether to write the manifest to disk.
31
+ */ function getWriteManifest(config, options) {
32
+ if (typeof options.fix === 'boolean') {
33
+ return options.fix;
34
+ }
35
+ return config.legacy?.writeManifest ?? false;
36
+ }
37
+ /**
38
+ * Validates a snap.manifest.json file. Attempts to fix the manifest and write
39
+ * the fixed version to disk if `writeManifest` is true. Throws if validation
40
+ * fails.
41
+ *
42
+ * @param config - The config object.
43
+ * @param options - The options object.
44
+ */ export async function manifestHandler(config, options) {
45
+ await executeSteps(steps, {
46
+ input: config.manifest.path,
47
+ config,
48
+ options
49
+ });
50
+ }
51
+
52
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/manifest/manifest.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps } from '../../utils';\nimport { manifest } from './implementation';\n\ntype ManifestOptions = {\n fix?: boolean;\n};\n\ntype ManifestContext = {\n input: string;\n config: ProcessedConfig;\n options: ManifestOptions;\n};\n\nconst steps: Steps<ManifestContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n throw new CommandError(\n `Manifest file not found: \"${input}\". Make sure that the \\`snap.manifest.json\\` file exists.`,\n );\n }\n },\n },\n {\n name: 'Validating the snap manifest.',\n task: async ({ input, config, options, spinner }) => {\n const write = getWriteManifest(config, options);\n const valid = await manifest(input, write, spinner);\n\n if (valid) {\n spinner.succeed('The snap manifest file is valid.');\n }\n },\n },\n];\n\n/**\n * Get whether to write the manifest to disk.\n *\n * @param config - The config object.\n * @param options - The options object.\n * @returns Whether to write the manifest to disk.\n */\nfunction getWriteManifest(config: ProcessedConfig, options: ManifestOptions) {\n if (typeof options.fix === 'boolean') {\n return options.fix;\n }\n\n return config.legacy?.writeManifest ?? false;\n}\n\n/**\n * Validates a snap.manifest.json file. Attempts to fix the manifest and write\n * the fixed version to disk if `writeManifest` is true. Throws if validation\n * fails.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function manifestHandler(\n config: ProcessedConfig,\n options: ManifestOptions,\n) {\n await executeSteps(steps, {\n input: config.manifest.path,\n config,\n options,\n });\n}\n"],"names":["isFile","CommandError","executeSteps","manifest","steps","name","task","input","config","options","spinner","write","getWriteManifest","valid","succeed","fix","legacy","writeManifest","manifestHandler","path"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAG/C,SAASC,YAAY,QAAQ,eAAe;AAE5C,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,QAAQ,QAAQ,mBAAmB;AAY5C,MAAMC,QAAgC;IACpC;QACEC,MAAM;QACNC,MAAM,OAAO,EAAEC,KAAK,EAAE;YACpB,IAAI,CAAE,MAAMP,OAAOO,QAAS;gBAC1B,MAAM,IAAIN,aACR,CAAC,0BAA0B,EAAEM,MAAM,yDAAyD,CAAC;YAEjG;QACF;IACF;IACA;QACEF,MAAM;QACNC,MAAM,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE;YAC9C,MAAMC,QAAQC,iBAAiBJ,QAAQC;YACvC,MAAMI,QAAQ,MAAMV,SAASI,OAAOI,OAAOD;YAE3C,IAAIG,OAAO;gBACTH,QAAQI,OAAO,CAAC;YAClB;QACF;IACF;CACD;AAED;;;;;;CAMC,GACD,SAASF,iBAAiBJ,MAAuB,EAAEC,OAAwB;IACzE,IAAI,OAAOA,QAAQM,GAAG,KAAK,WAAW;QACpC,OAAON,QAAQM,GAAG;IACpB;IAEA,OAAOP,OAAOQ,MAAM,EAAEC,iBAAiB;AACzC;AAEA;;;;;;;CAOC,GACD,OAAO,eAAeC,gBACpBV,MAAuB,EACvBC,OAAwB;IAExB,MAAMP,aAAaE,OAAO;QACxBG,OAAOC,OAAOL,QAAQ,CAACgB,IAAI;QAC3BX;QACAC;IACF;AACF"}