@metamask/snaps-cli 5.1.1 → 6.0.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 (456) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/builders.js +10 -0
  3. package/dist/builders.js.map +1 -0
  4. package/dist/builders.mjs +10 -0
  5. package/dist/builders.mjs.map +1 -0
  6. package/dist/chunk-26C34AS7.mjs +287 -0
  7. package/dist/chunk-26C34AS7.mjs.map +1 -0
  8. package/dist/chunk-2SUDRRT6.mjs +50 -0
  9. package/dist/chunk-2SUDRRT6.mjs.map +1 -0
  10. package/dist/chunk-3WWFQLH4.mjs +30 -0
  11. package/dist/chunk-3WWFQLH4.mjs.map +1 -0
  12. package/dist/chunk-45LOTCC4.mjs +1 -0
  13. package/dist/chunk-45LOTCC4.mjs.map +1 -0
  14. package/dist/chunk-4QUVE3EK.js +53 -0
  15. package/dist/chunk-4QUVE3EK.js.map +1 -0
  16. package/dist/chunk-5CLEKHXE.js +54 -0
  17. package/dist/chunk-5CLEKHXE.js.map +1 -0
  18. package/dist/chunk-5KQNAW4C.mjs +346 -0
  19. package/dist/chunk-5KQNAW4C.mjs.map +1 -0
  20. package/dist/chunk-6EEZHGF5.js +23 -0
  21. package/dist/chunk-6EEZHGF5.js.map +1 -0
  22. package/dist/chunk-7NQQGJZJ.mjs +35 -0
  23. package/dist/chunk-7NQQGJZJ.mjs.map +1 -0
  24. package/dist/chunk-7RHK2YTB.mjs +32 -0
  25. package/dist/chunk-7RHK2YTB.mjs.map +1 -0
  26. package/dist/chunk-AZMQTZXZ.mjs +28 -0
  27. package/dist/chunk-AZMQTZXZ.mjs.map +1 -0
  28. package/dist/chunk-B3NNVTA6.js +32 -0
  29. package/dist/chunk-B3NNVTA6.js.map +1 -0
  30. package/dist/chunk-BALQOCUO.js +22 -0
  31. package/dist/chunk-BALQOCUO.js.map +1 -0
  32. package/dist/chunk-BVPYLBE5.js +365 -0
  33. package/dist/chunk-BVPYLBE5.js.map +1 -0
  34. package/dist/chunk-BYNQODL3.mjs +23 -0
  35. package/dist/chunk-BYNQODL3.mjs.map +1 -0
  36. package/dist/chunk-C44RRX3H.js +18 -0
  37. package/dist/chunk-C44RRX3H.js.map +1 -0
  38. package/dist/chunk-C46KEPAC.js +37 -0
  39. package/dist/chunk-C46KEPAC.js.map +1 -0
  40. package/dist/chunk-CGJKCIHP.js +28 -0
  41. package/dist/chunk-CGJKCIHP.js.map +1 -0
  42. package/dist/chunk-CIYE263O.js +30 -0
  43. package/dist/chunk-CIYE263O.js.map +1 -0
  44. package/dist/chunk-DBLADLQ4.js +10 -0
  45. package/dist/chunk-DBLADLQ4.js.map +1 -0
  46. package/dist/chunk-EDEA4QTA.js +35 -0
  47. package/dist/chunk-EDEA4QTA.js.map +1 -0
  48. package/dist/chunk-ERSRIVYH.mjs +64 -0
  49. package/dist/chunk-ERSRIVYH.mjs.map +1 -0
  50. package/dist/chunk-G3COWLG5.mjs +23 -0
  51. package/dist/chunk-G3COWLG5.mjs.map +1 -0
  52. package/dist/chunk-GKRRE4WN.mjs +30 -0
  53. package/dist/chunk-GKRRE4WN.mjs.map +1 -0
  54. package/dist/chunk-HQBA5RU6.mjs +54 -0
  55. package/dist/chunk-HQBA5RU6.mjs.map +1 -0
  56. package/dist/chunk-HYPSSFE5.mjs +13 -0
  57. package/dist/chunk-HYPSSFE5.mjs.map +1 -0
  58. package/dist/chunk-JAHNVVLT.mjs +18 -0
  59. package/dist/chunk-JAHNVVLT.mjs.map +1 -0
  60. package/dist/chunk-JCVSYVPD.mjs +24 -0
  61. package/dist/chunk-JCVSYVPD.mjs.map +1 -0
  62. package/dist/chunk-JI3B665Z.js +24 -0
  63. package/dist/chunk-JI3B665Z.js.map +1 -0
  64. package/dist/chunk-JL3URCHO.mjs +53 -0
  65. package/dist/chunk-JL3URCHO.mjs.map +1 -0
  66. package/dist/chunk-K26BOY6Z.mjs +51 -0
  67. package/dist/chunk-K26BOY6Z.mjs.map +1 -0
  68. package/dist/chunk-K5QMGTQL.mjs +22 -0
  69. package/dist/chunk-K5QMGTQL.mjs.map +1 -0
  70. package/dist/chunk-KLOPX6DO.js +51 -0
  71. package/dist/chunk-KLOPX6DO.js.map +1 -0
  72. package/dist/chunk-KUSHMQXD.js +64 -0
  73. package/dist/chunk-KUSHMQXD.js.map +1 -0
  74. package/dist/chunk-L72RLBV5.mjs +37 -0
  75. package/dist/chunk-L72RLBV5.mjs.map +1 -0
  76. package/dist/chunk-MDHJ5HLM.js +287 -0
  77. package/dist/chunk-MDHJ5HLM.js.map +1 -0
  78. package/dist/chunk-MR44GPM3.mjs +135 -0
  79. package/dist/chunk-MR44GPM3.mjs.map +1 -0
  80. package/dist/chunk-MUYXNION.js +30 -0
  81. package/dist/chunk-MUYXNION.js.map +1 -0
  82. package/dist/chunk-OKDY7C7S.js +346 -0
  83. package/dist/chunk-OKDY7C7S.js.map +1 -0
  84. package/dist/chunk-OPE2PGM6.mjs +24 -0
  85. package/dist/chunk-OPE2PGM6.mjs.map +1 -0
  86. package/dist/chunk-PDYQXXLP.js +30 -0
  87. package/dist/chunk-PDYQXXLP.js.map +1 -0
  88. package/dist/chunk-PFB25A2Q.mjs +52 -0
  89. package/dist/chunk-PFB25A2Q.mjs.map +1 -0
  90. package/dist/chunk-QFK7JVP3.js +52 -0
  91. package/dist/chunk-QFK7JVP3.js.map +1 -0
  92. package/dist/chunk-QHCKVO3P.js +28 -0
  93. package/dist/chunk-QHCKVO3P.js.map +1 -0
  94. package/dist/chunk-QMD3VO6R.mjs +30 -0
  95. package/dist/chunk-QMD3VO6R.mjs.map +1 -0
  96. package/dist/chunk-R6NBQKVH.js +16 -0
  97. package/dist/chunk-R6NBQKVH.js.map +1 -0
  98. package/dist/chunk-R77RJHC5.mjs +44 -0
  99. package/dist/chunk-R77RJHC5.mjs.map +1 -0
  100. package/dist/chunk-S45DIQPN.js +13 -0
  101. package/dist/chunk-S45DIQPN.js.map +1 -0
  102. package/dist/chunk-S76EZ6HY.js +23 -0
  103. package/dist/chunk-S76EZ6HY.js.map +1 -0
  104. package/dist/chunk-S7UP2YYF.js +135 -0
  105. package/dist/chunk-S7UP2YYF.js.map +1 -0
  106. package/dist/chunk-SVYNCWMH.js +61 -0
  107. package/dist/chunk-SVYNCWMH.js.map +1 -0
  108. package/dist/chunk-SYRWT2KT.mjs +124 -0
  109. package/dist/chunk-SYRWT2KT.mjs.map +1 -0
  110. package/dist/chunk-T7NEPTM5.mjs +61 -0
  111. package/dist/chunk-T7NEPTM5.mjs.map +1 -0
  112. package/dist/chunk-TDSL55B3.mjs +10 -0
  113. package/dist/chunk-TDSL55B3.mjs.map +1 -0
  114. package/dist/chunk-TJ2F3J6X.js +31 -0
  115. package/dist/chunk-TJ2F3J6X.js.map +1 -0
  116. package/dist/chunk-U4VFMIGO.js +24 -0
  117. package/dist/chunk-U4VFMIGO.js.map +1 -0
  118. package/dist/chunk-VXOV3ZCB.js +1 -0
  119. package/dist/chunk-VXOV3ZCB.js.map +1 -0
  120. package/dist/chunk-WO7DMSQU.mjs +16 -0
  121. package/dist/chunk-WO7DMSQU.mjs.map +1 -0
  122. package/dist/chunk-WP2N4NCO.js +50 -0
  123. package/dist/chunk-WP2N4NCO.js.map +1 -0
  124. package/dist/chunk-WYDHPUWV.mjs +28 -0
  125. package/dist/chunk-WYDHPUWV.mjs.map +1 -0
  126. package/dist/chunk-X3D3MHWF.js +44 -0
  127. package/dist/chunk-X3D3MHWF.js.map +1 -0
  128. package/dist/chunk-X7TESUC7.mjs +22 -0
  129. package/dist/chunk-X7TESUC7.mjs.map +1 -0
  130. package/dist/chunk-X7VYAL2L.mjs +365 -0
  131. package/dist/chunk-X7VYAL2L.mjs.map +1 -0
  132. package/dist/chunk-XGWLFH7Y.js +41 -0
  133. package/dist/chunk-XGWLFH7Y.js.map +1 -0
  134. package/dist/{cjs/webpack/config.js → chunk-XUYXKO4F.js} +181 -153
  135. package/dist/chunk-XUYXKO4F.js.map +1 -0
  136. package/dist/chunk-XZJLYKES.mjs +64 -0
  137. package/dist/chunk-XZJLYKES.mjs.map +1 -0
  138. package/dist/chunk-YCYGKEXF.mjs +41 -0
  139. package/dist/chunk-YCYGKEXF.mjs.map +1 -0
  140. package/dist/chunk-YGEAZQSC.js +124 -0
  141. package/dist/chunk-YGEAZQSC.js.map +1 -0
  142. package/dist/chunk-YQ2E7NEA.js +64 -0
  143. package/dist/chunk-YQ2E7NEA.js.map +1 -0
  144. package/dist/chunk-YQVCFM6L.js +22 -0
  145. package/dist/chunk-YQVCFM6L.js.map +1 -0
  146. package/dist/{esm/webpack/config.js → chunk-YWCNJELN.mjs} +182 -156
  147. package/dist/chunk-YWCNJELN.mjs.map +1 -0
  148. package/dist/chunk-ZAW4ZWQX.mjs +31 -0
  149. package/dist/chunk-ZAW4ZWQX.mjs.map +1 -0
  150. package/dist/cli.js +21 -0
  151. package/dist/cli.js.map +1 -0
  152. package/dist/cli.mjs +21 -0
  153. package/dist/cli.mjs.map +1 -0
  154. package/dist/commands/build/build.js +29 -0
  155. package/dist/commands/build/build.js.map +1 -0
  156. package/dist/commands/build/build.mjs +29 -0
  157. package/dist/commands/build/build.mjs.map +1 -0
  158. package/dist/commands/build/implementation.js +28 -0
  159. package/dist/commands/build/implementation.js.map +1 -0
  160. package/dist/commands/build/implementation.mjs +28 -0
  161. package/dist/commands/build/implementation.mjs.map +1 -0
  162. package/dist/commands/build/index.js +33 -0
  163. package/dist/commands/build/index.js.map +1 -0
  164. package/dist/commands/build/index.mjs +33 -0
  165. package/dist/commands/build/index.mjs.map +1 -0
  166. package/dist/commands/eval/eval.js +18 -0
  167. package/dist/commands/eval/eval.js.map +1 -0
  168. package/dist/commands/eval/eval.mjs +18 -0
  169. package/dist/commands/eval/eval.mjs.map +1 -0
  170. package/dist/commands/eval/implementation.js +9 -0
  171. package/dist/commands/eval/implementation.js.map +1 -0
  172. package/dist/commands/eval/implementation.mjs +9 -0
  173. package/dist/commands/eval/implementation.mjs.map +1 -0
  174. package/dist/commands/eval/index.js +22 -0
  175. package/dist/commands/eval/index.js.map +1 -0
  176. package/dist/commands/eval/index.mjs +22 -0
  177. package/dist/commands/eval/index.mjs.map +1 -0
  178. package/dist/commands/index.js +39 -0
  179. package/dist/commands/index.js.map +1 -0
  180. package/dist/commands/index.mjs +39 -0
  181. package/dist/commands/index.mjs.map +1 -0
  182. package/dist/commands/manifest/implementation.js +17 -0
  183. package/dist/commands/manifest/implementation.js.map +1 -0
  184. package/dist/commands/manifest/implementation.mjs +17 -0
  185. package/dist/commands/manifest/implementation.mjs.map +1 -0
  186. package/dist/commands/manifest/index.js +22 -0
  187. package/dist/commands/manifest/index.js.map +1 -0
  188. package/dist/commands/manifest/index.mjs +22 -0
  189. package/dist/commands/manifest/index.mjs.map +1 -0
  190. package/dist/commands/manifest/manifest.js +18 -0
  191. package/dist/commands/manifest/manifest.js.map +1 -0
  192. package/dist/commands/manifest/manifest.mjs +18 -0
  193. package/dist/commands/manifest/manifest.mjs.map +1 -0
  194. package/dist/commands/serve/index.js +29 -0
  195. package/dist/commands/serve/index.js.map +1 -0
  196. package/dist/commands/serve/index.mjs +29 -0
  197. package/dist/commands/serve/index.mjs.map +1 -0
  198. package/dist/commands/serve/serve.js +28 -0
  199. package/dist/commands/serve/serve.js.map +1 -0
  200. package/dist/commands/serve/serve.mjs +28 -0
  201. package/dist/commands/serve/serve.mjs.map +1 -0
  202. package/dist/commands/watch/implementation.js +28 -0
  203. package/dist/commands/watch/implementation.js.map +1 -0
  204. package/dist/commands/watch/implementation.mjs +28 -0
  205. package/dist/commands/watch/implementation.mjs.map +1 -0
  206. package/dist/commands/watch/index.js +33 -0
  207. package/dist/commands/watch/index.js.map +1 -0
  208. package/dist/commands/watch/index.mjs +33 -0
  209. package/dist/commands/watch/index.mjs.map +1 -0
  210. package/dist/commands/watch/watch.js +29 -0
  211. package/dist/commands/watch/watch.js.map +1 -0
  212. package/dist/commands/watch/watch.mjs +29 -0
  213. package/dist/commands/watch/watch.mjs.map +1 -0
  214. package/dist/config.js +36 -0
  215. package/dist/config.js.map +1 -0
  216. package/dist/config.mjs +36 -0
  217. package/dist/config.mjs.map +1 -0
  218. package/dist/errors.js +12 -0
  219. package/dist/errors.js.map +1 -0
  220. package/dist/errors.mjs +12 -0
  221. package/dist/errors.mjs.map +1 -0
  222. package/dist/index.js +43 -0
  223. package/dist/index.js.map +1 -0
  224. package/dist/index.mjs +43 -0
  225. package/dist/index.mjs.map +1 -0
  226. package/dist/main.js +49 -0
  227. package/dist/main.js.map +1 -0
  228. package/dist/main.mjs +49 -0
  229. package/dist/main.mjs.map +1 -0
  230. package/dist/structs.js +8 -0
  231. package/dist/structs.js.map +1 -0
  232. package/dist/structs.mjs +8 -0
  233. package/dist/structs.mjs.map +1 -0
  234. package/dist/tsconfig.build.tsbuildinfo +1 -0
  235. package/dist/types/commands/eval/implementation.d.ts +1 -1
  236. package/dist/types/config.d.ts +2 -2
  237. package/dist/types/structs.d.ts +20 -0
  238. package/dist/types/webpack/loaders/function.d.ts +34 -0
  239. package/dist/types/webpack/loaders/index.d.ts +3 -0
  240. package/dist/types/webpack/utils.d.ts +13 -11
  241. package/dist/types/yargs.d.js +1 -0
  242. package/dist/types/yargs.d.js.map +1 -0
  243. package/dist/types/yargs.d.mjs +1 -0
  244. package/dist/types/yargs.d.mjs.map +1 -0
  245. package/dist/utils/cli.js +14 -0
  246. package/dist/utils/cli.js.map +1 -0
  247. package/dist/utils/cli.mjs +14 -0
  248. package/dist/utils/cli.mjs.map +1 -0
  249. package/dist/utils/errors.js +11 -0
  250. package/dist/utils/errors.js.map +1 -0
  251. package/dist/utils/errors.mjs +11 -0
  252. package/dist/utils/errors.mjs.map +1 -0
  253. package/dist/utils/index.js +47 -0
  254. package/dist/utils/index.js.map +1 -0
  255. package/dist/utils/index.mjs +47 -0
  256. package/dist/utils/index.mjs.map +1 -0
  257. package/dist/utils/legacy.js +13 -0
  258. package/dist/utils/legacy.js.map +1 -0
  259. package/dist/utils/legacy.mjs +13 -0
  260. package/dist/utils/legacy.mjs.map +1 -0
  261. package/dist/utils/logging.js +12 -0
  262. package/dist/utils/logging.js.map +1 -0
  263. package/dist/utils/logging.mjs +12 -0
  264. package/dist/utils/logging.mjs.map +1 -0
  265. package/dist/utils/path.js +8 -0
  266. package/dist/utils/path.js.map +1 -0
  267. package/dist/utils/path.mjs +8 -0
  268. package/dist/utils/path.mjs.map +1 -0
  269. package/dist/utils/steps.js +11 -0
  270. package/dist/utils/steps.js.map +1 -0
  271. package/dist/utils/steps.mjs +11 -0
  272. package/dist/utils/steps.mjs.map +1 -0
  273. package/dist/webpack/compiler.js +25 -0
  274. package/dist/webpack/compiler.js.map +1 -0
  275. package/dist/webpack/compiler.mjs +25 -0
  276. package/dist/webpack/compiler.mjs.map +1 -0
  277. package/dist/webpack/config.js +24 -0
  278. package/dist/webpack/config.js.map +1 -0
  279. package/dist/webpack/config.mjs +24 -0
  280. package/dist/webpack/config.mjs.map +1 -0
  281. package/dist/webpack/index.js +44 -0
  282. package/dist/webpack/index.js.map +1 -0
  283. package/dist/webpack/index.mjs +44 -0
  284. package/dist/webpack/index.mjs.map +1 -0
  285. package/dist/webpack/loaders/browserify.js +19 -0
  286. package/dist/webpack/loaders/browserify.js.map +1 -0
  287. package/dist/webpack/loaders/browserify.mjs +19 -0
  288. package/dist/webpack/loaders/browserify.mjs.map +1 -0
  289. package/dist/webpack/loaders/function.js +10 -0
  290. package/dist/webpack/loaders/function.js.map +1 -0
  291. package/dist/webpack/loaders/function.mjs +10 -0
  292. package/dist/webpack/loaders/function.mjs.map +1 -0
  293. package/dist/webpack/loaders/index.js +25 -0
  294. package/dist/webpack/loaders/index.js.map +1 -0
  295. package/dist/webpack/loaders/index.mjs +25 -0
  296. package/dist/webpack/loaders/index.mjs.map +1 -0
  297. package/dist/webpack/loaders/wasm.js +16 -0
  298. package/dist/webpack/loaders/wasm.js.map +1 -0
  299. package/dist/webpack/loaders/wasm.mjs +16 -0
  300. package/dist/webpack/loaders/wasm.mjs.map +1 -0
  301. package/dist/webpack/plugins.js +29 -0
  302. package/dist/webpack/plugins.js.map +1 -0
  303. package/dist/webpack/plugins.mjs +29 -0
  304. package/dist/webpack/plugins.mjs.map +1 -0
  305. package/dist/webpack/server.js +10 -0
  306. package/dist/webpack/server.js.map +1 -0
  307. package/dist/webpack/server.mjs +10 -0
  308. package/dist/webpack/server.mjs.map +1 -0
  309. package/dist/webpack/utils.js +37 -0
  310. package/dist/webpack/utils.js.map +1 -0
  311. package/dist/webpack/utils.mjs +37 -0
  312. package/dist/webpack/utils.mjs.map +1 -0
  313. package/package.json +21 -21
  314. package/.browserslistrc +0 -3
  315. package/dist/cjs/builders.js +0 -148
  316. package/dist/cjs/builders.js.map +0 -1
  317. package/dist/cjs/cli.js +0 -68
  318. package/dist/cjs/cli.js.map +0 -1
  319. package/dist/cjs/commands/build/build.js +0 -54
  320. package/dist/cjs/commands/build/build.js.map +0 -1
  321. package/dist/cjs/commands/build/implementation.js +0 -31
  322. package/dist/cjs/commands/build/implementation.js.map +0 -1
  323. package/dist/cjs/commands/build/index.js +0 -45
  324. package/dist/cjs/commands/build/index.js.map +0 -1
  325. package/dist/cjs/commands/eval/eval.js +0 -57
  326. package/dist/cjs/commands/eval/eval.js.map +0 -1
  327. package/dist/cjs/commands/eval/implementation.js +0 -27
  328. package/dist/cjs/commands/eval/implementation.js.map +0 -1
  329. package/dist/cjs/commands/eval/index.js +0 -50
  330. package/dist/cjs/commands/eval/index.js.map +0 -1
  331. package/dist/cjs/commands/index.js +0 -30
  332. package/dist/cjs/commands/index.js.map +0 -1
  333. package/dist/cjs/commands/manifest/implementation.js +0 -34
  334. package/dist/cjs/commands/manifest/implementation.js.map +0 -1
  335. package/dist/cjs/commands/manifest/index.js +0 -50
  336. package/dist/cjs/commands/manifest/index.js.map +0 -1
  337. package/dist/cjs/commands/manifest/manifest.js +0 -55
  338. package/dist/cjs/commands/manifest/manifest.js.map +0 -1
  339. package/dist/cjs/commands/serve/index.js +0 -33
  340. package/dist/cjs/commands/serve/index.js.map +0 -1
  341. package/dist/cjs/commands/serve/serve.js +0 -21
  342. package/dist/cjs/commands/serve/serve.js.map +0 -1
  343. package/dist/cjs/commands/watch/implementation.js +0 -35
  344. package/dist/cjs/commands/watch/implementation.js.map +0 -1
  345. package/dist/cjs/commands/watch/index.js +0 -47
  346. package/dist/cjs/commands/watch/index.js.map +0 -1
  347. package/dist/cjs/commands/watch/watch.js +0 -51
  348. package/dist/cjs/commands/watch/watch.js.map +0 -1
  349. package/dist/cjs/config.js +0 -320
  350. package/dist/cjs/config.js.map +0 -1
  351. package/dist/cjs/errors.js +0 -37
  352. package/dist/cjs/errors.js.map +0 -1
  353. package/dist/cjs/index.js +0 -77
  354. package/dist/cjs/index.js.map +0 -1
  355. package/dist/cjs/main.js +0 -19
  356. package/dist/cjs/main.js.map +0 -1
  357. package/dist/cjs/utils/cli.js +0 -61
  358. package/dist/cjs/utils/cli.js.map +0 -1
  359. package/dist/cjs/utils/errors.js +0 -42
  360. package/dist/cjs/utils/errors.js.map +0 -1
  361. package/dist/cjs/utils/index.js +0 -25
  362. package/dist/cjs/utils/index.js.map +0 -1
  363. package/dist/cjs/utils/legacy.js +0 -48
  364. package/dist/cjs/utils/legacy.js.map +0 -1
  365. package/dist/cjs/utils/logging.js +0 -46
  366. package/dist/cjs/utils/logging.js.map +0 -1
  367. package/dist/cjs/utils/path.js +0 -16
  368. package/dist/cjs/utils/path.js.map +0 -1
  369. package/dist/cjs/utils/steps.js +0 -52
  370. package/dist/cjs/utils/steps.js.map +0 -1
  371. package/dist/cjs/webpack/compiler.js +0 -19
  372. package/dist/cjs/webpack/compiler.js.map +0 -1
  373. package/dist/cjs/webpack/config.js.map +0 -1
  374. package/dist/cjs/webpack/index.js +0 -23
  375. package/dist/cjs/webpack/index.js.map +0 -1
  376. package/dist/cjs/webpack/loaders/browserify.js +0 -97
  377. package/dist/cjs/webpack/loaders/browserify.js.map +0 -1
  378. package/dist/cjs/webpack/loaders/wasm.js +0 -92
  379. package/dist/cjs/webpack/loaders/wasm.js.map +0 -1
  380. package/dist/cjs/webpack/plugins.js +0 -341
  381. package/dist/cjs/webpack/plugins.js.map +0 -1
  382. package/dist/cjs/webpack/server.js +0 -139
  383. package/dist/cjs/webpack/server.js.map +0 -1
  384. package/dist/cjs/webpack/utils.js +0 -254
  385. package/dist/cjs/webpack/utils.js.map +0 -1
  386. package/dist/esm/builders.js +0 -130
  387. package/dist/esm/builders.js.map +0 -1
  388. package/dist/esm/cli.js +0 -56
  389. package/dist/esm/cli.js.map +0 -1
  390. package/dist/esm/commands/build/build.js +0 -51
  391. package/dist/esm/commands/build/build.js.map +0 -1
  392. package/dist/esm/commands/build/implementation.js +0 -27
  393. package/dist/esm/commands/build/implementation.js.map +0 -1
  394. package/dist/esm/commands/build/index.js +0 -17
  395. package/dist/esm/commands/build/index.js.map +0 -1
  396. package/dist/esm/commands/eval/eval.js +0 -54
  397. package/dist/esm/commands/eval/eval.js.map +0 -1
  398. package/dist/esm/commands/eval/implementation.js +0 -24
  399. package/dist/esm/commands/eval/implementation.js.map +0 -1
  400. package/dist/esm/commands/eval/index.js +0 -22
  401. package/dist/esm/commands/eval/index.js.map +0 -1
  402. package/dist/esm/commands/index.js +0 -15
  403. package/dist/esm/commands/index.js.map +0 -1
  404. package/dist/esm/commands/manifest/implementation.js +0 -33
  405. package/dist/esm/commands/manifest/implementation.js.map +0 -1
  406. package/dist/esm/commands/manifest/index.js +0 -22
  407. package/dist/esm/commands/manifest/index.js.map +0 -1
  408. package/dist/esm/commands/manifest/manifest.js +0 -52
  409. package/dist/esm/commands/manifest/manifest.js.map +0 -1
  410. package/dist/esm/commands/serve/index.js +0 -18
  411. package/dist/esm/commands/serve/index.js.map +0 -1
  412. package/dist/esm/commands/serve/serve.js +0 -17
  413. package/dist/esm/commands/serve/serve.js.map +0 -1
  414. package/dist/esm/commands/watch/implementation.js +0 -34
  415. package/dist/esm/commands/watch/implementation.js.map +0 -1
  416. package/dist/esm/commands/watch/index.js +0 -19
  417. package/dist/esm/commands/watch/index.js.map +0 -1
  418. package/dist/esm/commands/watch/watch.js +0 -50
  419. package/dist/esm/commands/watch/watch.js.map +0 -1
  420. package/dist/esm/config.js +0 -324
  421. package/dist/esm/config.js.map +0 -1
  422. package/dist/esm/errors.js +0 -30
  423. package/dist/esm/errors.js.map +0 -1
  424. package/dist/esm/index.js +0 -6
  425. package/dist/esm/index.js.map +0 -1
  426. package/dist/esm/main.js +0 -10
  427. package/dist/esm/main.js.map +0 -1
  428. package/dist/esm/utils/cli.js +0 -43
  429. package/dist/esm/utils/cli.js.map +0 -1
  430. package/dist/esm/utils/errors.js +0 -43
  431. package/dist/esm/utils/errors.js.map +0 -1
  432. package/dist/esm/utils/index.js +0 -8
  433. package/dist/esm/utils/index.js.map +0 -1
  434. package/dist/esm/utils/legacy.js +0 -47
  435. package/dist/esm/utils/legacy.js.map +0 -1
  436. package/dist/esm/utils/logging.js +0 -40
  437. package/dist/esm/utils/logging.js.map +0 -1
  438. package/dist/esm/utils/path.js +0 -13
  439. package/dist/esm/utils/path.js.map +0 -1
  440. package/dist/esm/utils/steps.js +0 -43
  441. package/dist/esm/utils/steps.js.map +0 -1
  442. package/dist/esm/webpack/compiler.js +0 -15
  443. package/dist/esm/webpack/compiler.js.map +0 -1
  444. package/dist/esm/webpack/config.js.map +0 -1
  445. package/dist/esm/webpack/index.js +0 -6
  446. package/dist/esm/webpack/index.js.map +0 -1
  447. package/dist/esm/webpack/loaders/browserify.js +0 -82
  448. package/dist/esm/webpack/loaders/browserify.js.map +0 -1
  449. package/dist/esm/webpack/loaders/wasm.js +0 -87
  450. package/dist/esm/webpack/loaders/wasm.js.map +0 -1
  451. package/dist/esm/webpack/plugins.js +0 -344
  452. package/dist/esm/webpack/plugins.js.map +0 -1
  453. package/dist/esm/webpack/server.js +0 -133
  454. package/dist/esm/webpack/server.js.map +0 -1
  455. package/dist/esm/webpack/utils.js +0 -285
  456. package/dist/esm/webpack/utils.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [6.0.1]
10
+ ### Fixed
11
+ - Fix minor build configuration problems ([#2220](https://github.com/MetaMask/snaps/pull/2220))
12
+
13
+ ## [6.0.0]
14
+ ### Changed
15
+ - **BREAKING:** Update ESM build to be fully compliant with the ESM standard ([#2210](https://github.com/MetaMask/snaps/pull/2210))
16
+ - **BREAKING:** Change config to use Webpack by default ([#2214](https://github.com/MetaMask/snaps/pull/2214))
17
+ - You can still use Browserify by specifying `bundler: 'browserify'`.
18
+
9
19
  ## [5.1.1]
10
20
  ### Fixed
11
21
  - Support new lines in CLI message formatting ([#2194](https://github.com/MetaMask/snaps/pull/2194))
@@ -113,7 +123,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
113
123
  - The version of the package no longer needs to match the version of all other
114
124
  MetaMask Snaps packages.
115
125
 
116
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@5.1.1...HEAD
126
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.0.1...HEAD
127
+ [6.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.0.0...@metamask/snaps-cli@6.0.1
128
+ [6.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@5.1.1...@metamask/snaps-cli@6.0.0
117
129
  [5.1.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@5.1.0...@metamask/snaps-cli@5.1.1
118
130
  [5.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@5.0.0...@metamask/snaps-cli@5.1.0
119
131
  [5.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@4.0.1...@metamask/snaps-cli@5.0.0
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkS7UP2YYFjs = require('./chunk-S7UP2YYF.js');
5
+ require('./chunk-X3D3MHWF.js');
6
+
7
+
8
+
9
+ exports.TranspilationModes = _chunkS7UP2YYFjs.TranspilationModes; exports.default = _chunkS7UP2YYFjs.builders_default;
10
+ //# sourceMappingURL=builders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import {
2
+ TranspilationModes,
3
+ builders_default
4
+ } from "./chunk-MR44GPM3.mjs";
5
+ import "./chunk-R77RJHC5.mjs";
6
+ export {
7
+ TranspilationModes,
8
+ builders_default as default
9
+ };
10
+ //# sourceMappingURL=builders.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,287 @@
1
+ import {
2
+ getFunctionLoader
3
+ } from "./chunk-AZMQTZXZ.mjs";
4
+ import {
5
+ processDependencies
6
+ } from "./chunk-QMD3VO6R.mjs";
7
+ import {
8
+ __require
9
+ } from "./chunk-R77RJHC5.mjs";
10
+
11
+ // src/webpack/utils.ts
12
+ import { dim } from "chalk";
13
+ import { promises as fs } from "fs";
14
+ import { builtinModules } from "module";
15
+ import { dirname, resolve } from "path";
16
+ import stripAnsi from "strip-ansi";
17
+
18
+ // src/webpack/loaders/browserify.ts
19
+ import browserify from "browserify";
20
+ import { Readable } from "readable-stream";
21
+ var loader = async function(content, sourceMap) {
22
+ const config = this.getOptions();
23
+ const { transpilationMode } = config;
24
+ const bundler = browserify({
25
+ extensions: [".js", ".ts"],
26
+ debug: Boolean(sourceMap),
27
+ standalone: "<snap>"
28
+ });
29
+ if (transpilationMode !== "none" /* None */) {
30
+ const babelifyOptions = processDependencies(config);
31
+ bundler.transform(__require("babelify"), {
32
+ global: transpilationMode === "localAndDeps" /* LocalAndDeps */,
33
+ extensions: [".js", ".ts"],
34
+ presets: [
35
+ __require("@babel/preset-typescript"),
36
+ [
37
+ __require("@babel/preset-env"),
38
+ {
39
+ targets: {
40
+ browsers: await getBrowserslistTargets()
41
+ }
42
+ }
43
+ ]
44
+ ],
45
+ plugins: [
46
+ __require("@babel/plugin-transform-runtime"),
47
+ __require("@babel/plugin-transform-class-properties"),
48
+ __require("@babel/plugin-transform-private-methods"),
49
+ __require("@babel/plugin-transform-class-static-block"),
50
+ __require("@babel/plugin-transform-private-property-in-object")
51
+ ],
52
+ ...babelifyOptions
53
+ });
54
+ }
55
+ config.bundlerCustomizer?.(bundler);
56
+ const stream = new Readable();
57
+ stream.push(content);
58
+ stream.push(null);
59
+ bundler.add(stream, {
60
+ file: this.resourcePath
61
+ });
62
+ return new Promise((resolve2, reject) => {
63
+ bundler.bundle((bundleError, buffer) => {
64
+ if (bundleError) {
65
+ reject(bundleError);
66
+ return;
67
+ }
68
+ resolve2(buffer);
69
+ });
70
+ });
71
+ };
72
+ var browserify_default = loader;
73
+
74
+ // src/webpack/utils.ts
75
+ var BROWSERSLIST_FILE = resolve(
76
+ dirname(
77
+ // eslint-disable-next-line n/no-extraneous-require
78
+ __require.resolve("@metamask/snaps-cli/package.json")
79
+ ),
80
+ ".browserslistrc"
81
+ );
82
+ var WEBPACK_FALLBACKS = {
83
+ assert: __require.resolve("assert/"),
84
+ buffer: __require.resolve("buffer/"),
85
+ console: __require.resolve("console-browserify"),
86
+ constants: __require.resolve("constants-browserify"),
87
+ crypto: __require.resolve("crypto-browserify"),
88
+ domain: __require.resolve("domain-browser"),
89
+ events: __require.resolve("events/"),
90
+ http: __require.resolve("stream-http"),
91
+ https: __require.resolve("https-browserify"),
92
+ os: __require.resolve("os-browserify/browser"),
93
+ path: __require.resolve("path-browserify"),
94
+ punycode: __require.resolve("punycode/"),
95
+ process: __require.resolve("process/browser"),
96
+ querystring: __require.resolve("querystring-es3"),
97
+ stream: __require.resolve("stream-browserify"),
98
+ /* eslint-disable @typescript-eslint/naming-convention */
99
+ _stream_duplex: __require.resolve("readable-stream/lib/_stream_duplex"),
100
+ _stream_passthrough: __require.resolve(
101
+ "readable-stream/lib/_stream_passthrough"
102
+ ),
103
+ _stream_readable: __require.resolve("readable-stream/lib/_stream_readable"),
104
+ _stream_transform: __require.resolve("readable-stream/lib/_stream_transform"),
105
+ _stream_writable: __require.resolve("readable-stream/lib/_stream_writable"),
106
+ string_decoder: __require.resolve("string_decoder/"),
107
+ /* eslint-enable @typescript-eslint/naming-convention */
108
+ sys: __require.resolve("util/"),
109
+ timers: __require.resolve("timers-browserify"),
110
+ tty: __require.resolve("tty-browserify"),
111
+ url: __require.resolve("url/"),
112
+ util: __require.resolve("util/"),
113
+ vm: __require.resolve("vm-browserify"),
114
+ zlib: __require.resolve("browserify-zlib")
115
+ };
116
+ async function getDefaultLoader({
117
+ legacy,
118
+ sourceMap
119
+ }) {
120
+ if (legacy) {
121
+ return getFunctionLoader(browserify_default, legacy);
122
+ }
123
+ const targets = await getBrowserslistTargets();
124
+ return {
125
+ /**
126
+ * We use the `swc-loader` to transpile TypeScript and JavaScript files.
127
+ * This is a Webpack loader that uses the `SWC` compiler, which is a much
128
+ * faster alternative to Babel and TypeScript's own compiler.
129
+ */
130
+ loader: __require.resolve("swc-loader"),
131
+ /**
132
+ * The options for the `swc-loader`. These can be overridden in the
133
+ * `.swcrc` file.
134
+ *
135
+ * @see https://swc.rs/docs/configuration/swcrc
136
+ */
137
+ options: {
138
+ sync: false,
139
+ /**
140
+ * This tells SWC to generate source maps. We set it to the
141
+ * `sourceMap` value from the config object.
142
+ *
143
+ * This must be enabled if source maps are enabled in the config.
144
+ */
145
+ sourceMaps: Boolean(getDevTool(sourceMap)),
146
+ jsc: {
147
+ parser: {
148
+ /**
149
+ * This tells the parser to parse TypeScript files. If you
150
+ * don't need to support TypeScript, you can set this to
151
+ * `ecmascript` instead, but there's no harm in leaving it
152
+ * as `typescript`.
153
+ *
154
+ * @see https://swc.rs/docs/configuration/compilation#jscparser
155
+ */
156
+ syntax: "typescript"
157
+ }
158
+ },
159
+ /**
160
+ * The module configuration. This tells SWC how to output the
161
+ * transpiled code.
162
+ *
163
+ * @see https://swc.rs/docs/configuration/modules
164
+ */
165
+ module: {
166
+ /**
167
+ * This tells SWC to output ES6 modules. This will allow Webpack to
168
+ * optimize the output code better. Snaps don't support ES6 however, so
169
+ * the output code will be transpiled to CommonJS by Webpack later in
170
+ * the build process.
171
+ *
172
+ * @see https://swc.rs/docs/configuration/modules#es6
173
+ */
174
+ type: "es6"
175
+ },
176
+ env: {
177
+ targets: targets.join(", ")
178
+ }
179
+ }
180
+ };
181
+ }
182
+ function getDevTool(sourceMap) {
183
+ if (sourceMap === "inline") {
184
+ return "inline-source-map";
185
+ }
186
+ if (sourceMap === true) {
187
+ return "source-map";
188
+ }
189
+ return false;
190
+ }
191
+ function getProgressHandler(spinner, spinnerText) {
192
+ return (percentage) => {
193
+ if (spinner && spinnerText) {
194
+ spinner.text = `${spinnerText} ${dim(
195
+ `(${Math.round(percentage * 100)}%)`
196
+ )}`;
197
+ }
198
+ };
199
+ }
200
+ async function getBrowserslistTargets() {
201
+ const contents = await fs.readFile(BROWSERSLIST_FILE, "utf8");
202
+ return contents.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
203
+ }
204
+ function pluralize(count, singular, plural = `${singular}s`) {
205
+ return count === 1 ? singular : plural;
206
+ }
207
+ function getFallbacks(polyfills) {
208
+ if (polyfills === true) {
209
+ return Object.fromEntries(
210
+ builtinModules.map((name) => [
211
+ name,
212
+ WEBPACK_FALLBACKS[name] ?? false
213
+ ])
214
+ );
215
+ }
216
+ if (polyfills === false) {
217
+ return Object.fromEntries(builtinModules.map((name) => [name, false]));
218
+ }
219
+ return Object.fromEntries(
220
+ builtinModules.map((name) => [
221
+ name,
222
+ polyfills[name] ? WEBPACK_FALLBACKS[name] : false
223
+ ])
224
+ );
225
+ }
226
+ function getEnvironmentVariables(environment, defaults = {
227
+ NODE_DEBUG: "false",
228
+ NODE_ENV: "production",
229
+ DEBUG: "false"
230
+ }) {
231
+ return Object.fromEntries(
232
+ Object.entries({
233
+ ...defaults,
234
+ ...environment
235
+ }).map(([key, value]) => [`process.env.${key}`, JSON.stringify(value)])
236
+ );
237
+ }
238
+ function formatLine(line, indent, initialIndent) {
239
+ const terminalWidth = process.stdout.columns;
240
+ if (!terminalWidth) {
241
+ return `${" ".repeat(initialIndent)}${line}`;
242
+ }
243
+ return line.split(" ").reduce(
244
+ ({ formattedText, currentLineLength }, word, index) => {
245
+ const visibleWord = stripAnsi(word);
246
+ const spaceBeforeWord = index > 0 ? " " : "";
247
+ const wordLengthWithSpace = visibleWord.length + spaceBeforeWord.length;
248
+ if (currentLineLength + wordLengthWithSpace > terminalWidth) {
249
+ return {
250
+ formattedText: `${formattedText}
251
+ ${" ".repeat(indent)}${word}`,
252
+ currentLineLength: indent + visibleWord.length
253
+ };
254
+ }
255
+ return {
256
+ formattedText: formattedText + spaceBeforeWord + word,
257
+ currentLineLength: currentLineLength + wordLengthWithSpace
258
+ };
259
+ },
260
+ {
261
+ formattedText: " ".repeat(initialIndent),
262
+ currentLineLength: initialIndent
263
+ }
264
+ ).formattedText;
265
+ }
266
+ function formatText(text, indent, initialIndent = indent) {
267
+ const lines = text.split("\n");
268
+ return lines.map((line, index) => {
269
+ const lineIndent = index === 0 ? initialIndent : indent;
270
+ return formatLine(line, indent, lineIndent);
271
+ }).join("\n");
272
+ }
273
+
274
+ export {
275
+ BROWSERSLIST_FILE,
276
+ WEBPACK_FALLBACKS,
277
+ getDefaultLoader,
278
+ getDevTool,
279
+ getProgressHandler,
280
+ getBrowserslistTargets,
281
+ pluralize,
282
+ getFallbacks,
283
+ getEnvironmentVariables,
284
+ formatText,
285
+ browserify_default
286
+ };
287
+ //# sourceMappingURL=chunk-26C34AS7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/webpack/utils.ts","../src/webpack/loaders/browserify.ts"],"sourcesContent":["import { dim } from 'chalk';\nimport { promises as fs } from 'fs';\nimport { builtinModules } from 'module';\nimport type { Ora } from 'ora';\nimport { dirname, resolve } from 'path';\nimport stripAnsi from 'strip-ansi';\nimport type { Configuration } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { browserify, getFunctionLoader } from './loaders';\n\nexport const BROWSERSLIST_FILE = resolve(\n dirname(\n // eslint-disable-next-line n/no-extraneous-require\n require.resolve('@metamask/snaps-cli/package.json'),\n ),\n '.browserslistrc',\n);\n\nexport const WEBPACK_FALLBACKS = {\n assert: require.resolve('assert/'),\n buffer: require.resolve('buffer/'),\n console: require.resolve('console-browserify'),\n constants: require.resolve('constants-browserify'),\n crypto: require.resolve('crypto-browserify'),\n domain: require.resolve('domain-browser'),\n events: require.resolve('events/'),\n http: require.resolve('stream-http'),\n https: require.resolve('https-browserify'),\n os: require.resolve('os-browserify/browser'),\n path: require.resolve('path-browserify'),\n punycode: require.resolve('punycode/'),\n process: require.resolve('process/browser'),\n querystring: require.resolve('querystring-es3'),\n stream: require.resolve('stream-browserify'),\n /* eslint-disable @typescript-eslint/naming-convention */\n _stream_duplex: require.resolve('readable-stream/lib/_stream_duplex'),\n _stream_passthrough: require.resolve(\n 'readable-stream/lib/_stream_passthrough',\n ),\n _stream_readable: require.resolve('readable-stream/lib/_stream_readable'),\n _stream_transform: require.resolve('readable-stream/lib/_stream_transform'),\n _stream_writable: require.resolve('readable-stream/lib/_stream_writable'),\n string_decoder: require.resolve('string_decoder/'),\n /* eslint-enable @typescript-eslint/naming-convention */\n sys: require.resolve('util/'),\n timers: require.resolve('timers-browserify'),\n tty: require.resolve('tty-browserify'),\n url: require.resolve('url/'),\n util: require.resolve('util/'),\n vm: require.resolve('vm-browserify'),\n zlib: require.resolve('browserify-zlib'),\n};\n\n/**\n * Get the default loader for JavaScript and TypeScript files, based on the\n * config object.\n *\n * - If the `legacy` option is set, we use the custom `browserify` loader. This\n * uses the legacy Browserify config to transpile the code.\n * - Otherwise, we use the `swc-loader`. This is a Webpack loader that uses the\n * `SWC` compiler, which is a much faster alternative to Babel and TypeScript's\n * own compiler.\n *\n * @param config - The processed snap Webpack config.\n * @param config.legacy - The legacy config object, if any.\n * @param config.sourceMap - Whether to generate source maps.\n * @see https://swc.rs/docs/usage/swc-loader\n * @returns The default loader.\n */\nexport async function getDefaultLoader({\n legacy,\n sourceMap,\n}: ProcessedWebpackConfig) {\n if (legacy) {\n /**\n * If the snap uses the legacy config, we use the custom `browserify`\n * loader. This uses the legacy Browserify config to transpile the code.\n * This is necessary for backwards compatibility with the\n * `bundlerCustomizer` function.\n */\n return getFunctionLoader(browserify, legacy);\n }\n\n const targets = await getBrowserslistTargets();\n return {\n /**\n * We use the `swc-loader` to transpile TypeScript and JavaScript files.\n * This is a Webpack loader that uses the `SWC` compiler, which is a much\n * faster alternative to Babel and TypeScript's own compiler.\n */\n loader: require.resolve('swc-loader'),\n\n /**\n * The options for the `swc-loader`. These can be overridden in the\n * `.swcrc` file.\n *\n * @see https://swc.rs/docs/configuration/swcrc\n */\n options: {\n sync: false,\n\n /**\n * This tells SWC to generate source maps. We set it to the\n * `sourceMap` value from the config object.\n *\n * This must be enabled if source maps are enabled in the config.\n */\n sourceMaps: Boolean(getDevTool(sourceMap)),\n\n jsc: {\n parser: {\n /**\n * This tells the parser to parse TypeScript files. If you\n * don't need to support TypeScript, you can set this to\n * `ecmascript` instead, but there's no harm in leaving it\n * as `typescript`.\n *\n * @see https://swc.rs/docs/configuration/compilation#jscparser\n */\n syntax: 'typescript',\n },\n },\n\n /**\n * The module configuration. This tells SWC how to output the\n * transpiled code.\n *\n * @see https://swc.rs/docs/configuration/modules\n */\n module: {\n /**\n * This tells SWC to output ES6 modules. This will allow Webpack to\n * optimize the output code better. Snaps don't support ES6 however, so\n * the output code will be transpiled to CommonJS by Webpack later in\n * the build process.\n *\n * @see https://swc.rs/docs/configuration/modules#es6\n */\n type: 'es6',\n },\n\n env: {\n targets: targets.join(', '),\n },\n },\n };\n}\n\n/**\n * Get the Webpack devtool configuration based on the given snap config.\n *\n * - If `sourceMap` is `inline`, return `inline-source-map`.\n * - If `sourceMap` is `true`, return `source-map`.\n * - Otherwise, return `false`.\n *\n * @param sourceMap - The `sourceMap` value from the snap config.\n * @returns The Webpack devtool configuration.\n */\nexport function getDevTool(\n sourceMap: ProcessedWebpackConfig['sourceMap'],\n): Configuration['devtool'] {\n if (sourceMap === 'inline') {\n return 'inline-source-map';\n }\n\n if (sourceMap === true) {\n return 'source-map';\n }\n\n return false;\n}\n\n/**\n * Get a function that can be used as handler function for Webpack's\n * `ProgressPlugin`.\n *\n * @param spinner - The spinner to update.\n * @param spinnerText - The initial spinner text. This will be prepended to the\n * percentage.\n * @returns A function that can be used as handler function for Webpack's\n * `ProgressPlugin`.\n */\n// Note: This is extracted for testing purposes.\nexport function getProgressHandler(spinner?: Ora, spinnerText?: string) {\n return (percentage: number) => {\n if (spinner && spinnerText) {\n spinner.text = `${spinnerText} ${dim(\n `(${Math.round(percentage * 100)}%)`,\n )}`;\n }\n };\n}\n\n/**\n * Get the targets from the `.browserslistrc` file.\n *\n * @returns The browser targets as an array of strings.\n */\nexport async function getBrowserslistTargets() {\n const contents = await fs.readFile(BROWSERSLIST_FILE, 'utf8');\n return contents\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line && !line.startsWith('#'));\n}\n\n/**\n * Get a singular or plural string based on the given count. This is useful for\n * generating messages like \"1 error\" or \"2 errors\". By default, the plural\n * string is the singular string with an \"s\" appended to it.\n *\n * This assumes that the text is in English, and likely won't work for some\n * other languages.\n *\n * @param count - The count.\n * @param singular - The singular string.\n * @param plural - The plural string.\n * @returns The singular or plural string.\n * @example\n * ```typescript\n * pluralize(1, 'error'); // => 'error'\n * pluralize(2, 'error'); // => 'errors'\n * pluralize(1, 'error', 'problem'); // => 'error'\n * pluralize(2, 'error', 'problems'); // => 'problems'\n * ```\n */\nexport function pluralize(\n count: number,\n singular: string,\n plural = `${singular}s`,\n) {\n return count === 1 ? singular : plural;\n}\n\n/**\n * Get an object that can be used as fallback config for Webpack's\n * `fallback` config.\n *\n * @param polyfills - The polyfill object from the snap config.\n * @returns The webpack fallback config.\n */\nexport function getFallbacks(polyfills: ProcessedWebpackConfig['polyfills']): {\n [index: string]: string | false;\n} {\n if (polyfills === true) {\n return Object.fromEntries(\n builtinModules.map((name) => [\n name,\n WEBPACK_FALLBACKS[name as keyof typeof WEBPACK_FALLBACKS] ?? false,\n ]),\n );\n }\n\n if (polyfills === false) {\n return Object.fromEntries(builtinModules.map((name) => [name, false]));\n }\n\n return Object.fromEntries(\n builtinModules.map((name) => [\n name,\n polyfills[name as keyof ProcessedWebpackConfig['polyfills']]\n ? WEBPACK_FALLBACKS[name as keyof typeof WEBPACK_FALLBACKS]\n : false,\n ]),\n );\n}\n\n/**\n * Get an object that can be used as environment variables for Webpack's\n * `DefinePlugin`.\n *\n * @param environment - The environment object from the Snap config.\n * @param defaults - The default environment variables.\n * @returns The Webpack environment variables.\n */\nexport function getEnvironmentVariables(\n environment: Record<string, unknown>,\n defaults = {\n NODE_DEBUG: 'false',\n NODE_ENV: 'production',\n DEBUG: 'false',\n },\n) {\n return Object.fromEntries(\n Object.entries({\n ...defaults,\n ...environment,\n }).map(([key, value]) => [`process.env.${key}`, JSON.stringify(value)]),\n );\n}\n\n/**\n * Format the given line to fit within the terminal width.\n *\n * @param line - The line to format.\n * @param indent - The indentation to use.\n * @param initialIndent - The initial indentation to use, i.e., the indentation\n * for the first line.\n * @returns The formatted line.\n */\nfunction formatLine(line: string, indent: number, initialIndent: number) {\n const terminalWidth = process.stdout.columns;\n if (!terminalWidth) {\n return `${' '.repeat(initialIndent)}${line}`;\n }\n\n return line.split(' ').reduce(\n ({ formattedText, currentLineLength }, word, index) => {\n // `chalk` adds ANSI escape codes to the text, which are not visible\n // characters. We need to strip them to get the visible length of the\n // text.\n const visibleWord = stripAnsi(word);\n\n // Determine if a space should be added before the word.\n const spaceBeforeWord = index > 0 ? ' ' : '';\n const wordLengthWithSpace = visibleWord.length + spaceBeforeWord.length;\n\n // If the word would exceed the terminal width, start a new line.\n if (currentLineLength + wordLengthWithSpace > terminalWidth) {\n return {\n formattedText: `${formattedText}\\n${' '.repeat(indent)}${word}`,\n currentLineLength: indent + visibleWord.length,\n };\n }\n\n // Otherwise, add the word to the current line.\n return {\n formattedText: formattedText + spaceBeforeWord + word,\n currentLineLength: currentLineLength + wordLengthWithSpace,\n };\n },\n {\n formattedText: ' '.repeat(initialIndent),\n currentLineLength: initialIndent,\n },\n ).formattedText;\n}\n\n/**\n * Format the given text to fit within the terminal width.\n *\n * @param text - The text to format.\n * @param indent - The indentation to use.\n * @param initialIndent - The initial indentation to use, i.e., the indentation\n * for the first line.\n * @returns The formatted text.\n */\nexport function formatText(\n text: string,\n indent: number,\n initialIndent = indent,\n) {\n const lines = text.split('\\n');\n\n // Apply formatting to each line separately and then join them.\n return lines\n .map((line, index) => {\n const lineIndent = index === 0 ? initialIndent : indent;\n return formatLine(line, indent, lineIndent);\n })\n .join('\\n');\n}\n","import browserify from 'browserify';\nimport { Readable } from 'readable-stream';\nimport type { LoaderDefinitionFunction } from 'webpack';\n\nimport { TranspilationModes } from '../../builders';\nimport type { LegacyOptions } from '../../config';\nimport { processDependencies } from '../../utils';\nimport { getBrowserslistTargets } from '../utils';\n\n/**\n * A Browserify loader for Webpack. This exists for backwards compatibility with\n * the legacy configuration format, in order to support the `bundlerCustomizer`\n * function.\n *\n * When this loader is used, the input file will be processed by Browserify, and\n * written to disk by Webpack. Most processing will be handled by Browserify, so\n * there are no benefits like tree-shaking.\n *\n * @param content - The input file contents as a string.\n * @param sourceMap - The source map of the input file.\n */\nconst loader: LoaderDefinitionFunction<LegacyOptions> = async function (\n content,\n sourceMap,\n) {\n const config = this.getOptions();\n\n const { transpilationMode } = config;\n\n const bundler = browserify({\n extensions: ['.js', '.ts'],\n debug: Boolean(sourceMap),\n standalone: '<snap>',\n });\n\n if (transpilationMode !== TranspilationModes.None) {\n const babelifyOptions = processDependencies(config);\n\n // We need to statically import all Browserify transforms, and all Babel\n // presets and plugins, and calling `require` is the sanest way to do that.\n /* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */\n bundler.transform(require('babelify'), {\n global: transpilationMode === TranspilationModes.LocalAndDeps,\n extensions: ['.js', '.ts'],\n presets: [\n require('@babel/preset-typescript'),\n [\n require('@babel/preset-env'),\n {\n targets: {\n browsers: await getBrowserslistTargets(),\n },\n },\n ],\n ],\n plugins: [\n require('@babel/plugin-transform-runtime'),\n require('@babel/plugin-transform-class-properties'),\n require('@babel/plugin-transform-private-methods'),\n require('@babel/plugin-transform-class-static-block'),\n require('@babel/plugin-transform-private-property-in-object'),\n ],\n ...(babelifyOptions as any),\n });\n /* eslint-enable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */\n }\n\n config.bundlerCustomizer?.(bundler);\n\n // Browserify doesn't accept a string as an entry point, so we need to convert\n // it to a stream.\n const stream = new Readable();\n stream.push(content);\n stream.push(null);\n\n bundler.add(stream, {\n file: this.resourcePath,\n });\n\n return new Promise<Buffer>((resolve, reject) => {\n bundler.bundle((bundleError, buffer: Buffer) => {\n if (bundleError) {\n reject(bundleError);\n return;\n }\n\n // Browserify inlines the source map, so we just pass the output buffer back\n // to Webpack.\n resolve(buffer);\n });\n });\n};\n\nexport default loader;\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,WAAW;AACpB,SAAS,YAAY,UAAU;AAC/B,SAAS,sBAAsB;AAE/B,SAAS,SAAS,eAAe;AACjC,OAAO,eAAe;;;ACLtB,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AAoBzB,IAAM,SAAkD,eACtD,SACA,WACA;AACA,QAAM,SAAS,KAAK,WAAW;AAE/B,QAAM,EAAE,kBAAkB,IAAI;AAE9B,QAAM,UAAU,WAAW;AAAA,IACzB,YAAY,CAAC,OAAO,KAAK;AAAA,IACzB,OAAO,QAAQ,SAAS;AAAA,IACxB,YAAY;AAAA,EACd,CAAC;AAED,MAAI,yCAA+C;AACjD,UAAM,kBAAkB,oBAAoB,MAAM;AAKlD,YAAQ,UAAU,UAAQ,UAAU,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,mBAAmB,oBAAoB;AAAA,MACzC;AAAA,IACF;AAAA,IACA;AAAA,MACE,eAAe,IAAI,OAAO,aAAa;AAAA,MACvC,mBAAmB;AAAA,IACrB;AAAA,EACF,EAAE;AACJ;AAWO,SAAS,WACd,MACA,QACA,gBAAgB,QAChB;AACA,QAAM,QAAQ,KAAK,MAAM,IAAI;AAG7B,SAAO,MACJ,IAAI,CAAC,MAAM,UAAU;AACpB,UAAM,aAAa,UAAU,IAAI,gBAAgB;AACjD,WAAO,WAAW,MAAM,QAAQ,UAAU;AAAA,EAC5C,CAAC,EACA,KAAK,IAAI;AACd;","names":["resolve"]}
@@ -0,0 +1,50 @@
1
+ import {
2
+ error,
3
+ info,
4
+ warn
5
+ } from "./chunk-ZAW4ZWQX.mjs";
6
+
7
+ // src/commands/manifest/implementation.ts
8
+ import { checkManifest, indent } from "@metamask/snaps-utils/node";
9
+ import { red, yellow } from "chalk";
10
+ import { dirname } from "path";
11
+ async function manifest(path, write, spinner) {
12
+ const { warnings, errors, updated } = await checkManifest(
13
+ dirname(path),
14
+ write
15
+ );
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(`\u2022 ${manifestError}`))).join("\n");
21
+ error(
22
+ `The snap manifest file is invalid.
23
+
24
+ ${formattedErrors}
25
+
26
+ Run the command with the \`--fix\` flag to attempt to fix the manifest.`,
27
+ spinner
28
+ );
29
+ spinner?.stop();
30
+ process.exitCode = 1;
31
+ return false;
32
+ }
33
+ if (warnings.length > 0) {
34
+ const formattedWarnings = warnings.map(
35
+ (manifestWarning) => indent(yellow(`\u2022 ${manifestWarning}`))
36
+ );
37
+ warn(
38
+ `The snap manifest file has warnings.
39
+
40
+ ${formattedWarnings.join("\n")}`,
41
+ spinner
42
+ );
43
+ }
44
+ return true;
45
+ }
46
+
47
+ export {
48
+ manifest
49
+ };
50
+ //# sourceMappingURL=chunk-2SUDRRT6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/manifest/implementation.ts"],"sourcesContent":["import { checkManifest, indent } from '@metamask/snaps-utils/node';\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"],"mappings":";;;;;;;AAAA,SAAS,eAAe,cAAc;AACtC,SAAS,KAAK,cAAc;AAE5B,SAAS,eAAe;AAcxB,eAAsB,SACpB,MACA,OACA,SACkB;AAClB,QAAM,EAAE,UAAU,QAAQ,QAAQ,IAAI,MAAM;AAAA,IAC1C,QAAQ,IAAI;AAAA,IACZ;AAAA,EACF;AAEA,MAAI,SAAS,SAAS;AACpB,SAAK,4CAA4C,OAAO;AAAA,EAC1D;AAEA,MAAI,CAAC,SAAS,OAAO,SAAS,GAAG;AAC/B,UAAM,kBAAkB,OACrB,IAAI,CAAC,kBAAkB,OAAO,IAAI,UAAK,aAAa,EAAE,CAAC,CAAC,EACxD,KAAK,IAAI;AAEZ;AAAA,MACE;AAAA;AAAA,EAAyC,eAAe;AAAA;AAAA;AAAA,MACxD;AAAA,IACF;AAEA,aAAS,KAAK;AACd,YAAQ,WAAW;AACnB,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,SAAS,GAAG;AACvB,UAAM,oBAAoB,SAAS;AAAA,MAAI,CAAC,oBACtC,OAAO,OAAO,UAAK,eAAe,EAAE,CAAC;AAAA,IACvC;AAEA;AAAA,MACE;AAAA;AAAA,EAA2C,kBAAkB,KAAK,IAAI,CAAC;AAAA,MACvE;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,30 @@
1
+ import {
2
+ CommandError
3
+ } from "./chunk-X7TESUC7.mjs";
4
+
5
+ // src/commands/eval/implementation.ts
6
+ import { evalBundle, SnapEvalError, indent } from "@metamask/snaps-utils/node";
7
+ import { red } from "chalk";
8
+ async function evaluate(path) {
9
+ try {
10
+ return await evalBundle(path);
11
+ } catch (evalError) {
12
+ if (evalError instanceof SnapEvalError) {
13
+ throw new CommandError(
14
+ `Failed to evaluate snap bundle in SES. This is likely due to an incompatibility with the SES environment in your snap.
15
+ Received the following error from the SES environment:
16
+
17
+ ${indent(
18
+ red(evalError.output.stderr),
19
+ 2
20
+ )}`
21
+ );
22
+ }
23
+ throw evalError;
24
+ }
25
+ }
26
+
27
+ export {
28
+ evaluate
29
+ };
30
+ //# sourceMappingURL=chunk-3WWFQLH4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/eval/implementation.ts"],"sourcesContent":["import { evalBundle, SnapEvalError, indent } from '@metamask/snaps-utils/node';\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"],"mappings":";;;;;AAAA,SAAS,YAAY,eAAe,cAAc;AAClD,SAAS,WAAW;AAYpB,eAAsB,SAAS,MAAc;AAC3C,MAAI;AACF,WAAO,MAAM,WAAW,IAAI;AAAA,EAC9B,SAAS,WAAW;AAClB,QAAI,qBAAqB,eAAe;AACtC,YAAM,IAAI;AAAA,QACR;AAAA;AAAA;AAAA,EAAqL;AAAA,UACnL,IAAI,UAAU,OAAO,MAAM;AAAA,UAC3B;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAIA,UAAM;AAAA,EACR;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-45LOTCC4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,53 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkC46KEPACjs = require('./chunk-C46KEPAC.js');
7
+
8
+
9
+
10
+
11
+ var _chunkPDYQXXLPjs = require('./chunk-PDYQXXLP.js');
12
+
13
+
14
+ var _chunkDBLADLQ4js = require('./chunk-DBLADLQ4.js');
15
+
16
+
17
+ var _chunkXGWLFH7Yjs = require('./chunk-XGWLFH7Y.js');
18
+
19
+
20
+
21
+ var _chunkB3NNVTA6js = require('./chunk-B3NNVTA6.js');
22
+
23
+
24
+
25
+
26
+ var _chunkTJ2F3J6Xjs = require('./chunk-TJ2F3J6X.js');
27
+
28
+
29
+ var _chunkX3D3MHWFjs = require('./chunk-X3D3MHWF.js');
30
+
31
+ // src/utils/index.ts
32
+ var utils_exports = {};
33
+ _chunkX3D3MHWFjs.__export.call(void 0, utils_exports, {
34
+ CONFIG_FILE: () => _chunkC46KEPACjs.CONFIG_FILE,
35
+ TS_CONFIG_FILE: () => _chunkC46KEPACjs.TS_CONFIG_FILE,
36
+ error: () => _chunkTJ2F3J6Xjs.error,
37
+ executeSteps: () => _chunkXGWLFH7Yjs.executeSteps,
38
+ getDependencyRegExp: () => _chunkPDYQXXLPjs.getDependencyRegExp,
39
+ getErrorMessage: () => _chunkB3NNVTA6js.getErrorMessage,
40
+ getRelativePath: () => _chunkDBLADLQ4js.getRelativePath,
41
+ getYargsErrorMessage: () => _chunkB3NNVTA6js.getYargsErrorMessage,
42
+ info: () => _chunkTJ2F3J6Xjs.info,
43
+ processDependencies: () => _chunkPDYQXXLPjs.processDependencies,
44
+ sanitizeDependencyPaths: () => _chunkPDYQXXLPjs.sanitizeDependencyPaths,
45
+ sanitizeInputs: () => _chunkC46KEPACjs.sanitizeInputs,
46
+ trimPathString: () => _chunkC46KEPACjs.trimPathString,
47
+ warn: () => _chunkTJ2F3J6Xjs.warn
48
+ });
49
+
50
+
51
+
52
+ exports.utils_exports = utils_exports;
53
+ //# sourceMappingURL=chunk-4QUVE3EK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './cli';\nexport * from './errors';\nexport * from './legacy';\nexport * from './logging';\nexport * from './path';\nexport * from './steps';\n"]}
@@ -0,0 +1,54 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkEDEA4QTAjs = require('./chunk-EDEA4QTA.js');
4
+
5
+
6
+ var _chunkYGEAZQSCjs = require('./chunk-YGEAZQSC.js');
7
+
8
+
9
+ var _chunkXGWLFH7Yjs = require('./chunk-XGWLFH7Y.js');
10
+
11
+
12
+ var _chunkTJ2F3J6Xjs = require('./chunk-TJ2F3J6X.js');
13
+
14
+
15
+ var _chunkBALQOCUOjs = require('./chunk-BALQOCUO.js');
16
+
17
+ // src/commands/watch/watch.ts
18
+ var _node = require('@metamask/snaps-utils/node');
19
+ var steps = [
20
+ {
21
+ name: "Checking the input file.",
22
+ task: async ({ config }) => {
23
+ const { input } = config;
24
+ if (!await _node.isFile.call(void 0, input)) {
25
+ throw new (0, _chunkBALQOCUOjs.CommandError)(
26
+ `Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`
27
+ );
28
+ }
29
+ }
30
+ },
31
+ {
32
+ name: "Starting the development server.",
33
+ condition: ({ config }) => config.server.enabled,
34
+ task: async ({ config, options, spinner }) => {
35
+ const server = _chunkYGEAZQSCjs.getServer.call(void 0, config);
36
+ const { port } = await server.listen(options.port ?? config.server.port);
37
+ _chunkTJ2F3J6Xjs.info.call(void 0, `The server is listening on http://localhost:${port}.`, spinner);
38
+ }
39
+ },
40
+ {
41
+ name: "Building the snap bundle.",
42
+ task: async ({ config, spinner }) => {
43
+ await _chunkEDEA4QTAjs.watch.call(void 0, config, { spinner });
44
+ }
45
+ }
46
+ ];
47
+ async function watchHandler(config, options) {
48
+ await _chunkXGWLFH7Yjs.executeSteps.call(void 0, steps, { config, options });
49
+ }
50
+
51
+
52
+
53
+ exports.watchHandler = watchHandler;
54
+ //# sourceMappingURL=chunk-5CLEKHXE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/watch/watch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AAqBvB,IAAM,QAA6B;AAAA,EACjC;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,OAAO,MAAM;AAC1B,YAAM,EAAE,MAAM,IAAI;AAElB,UAAI,CAAE,MAAM,OAAO,KAAK,GAAI;AAC1B,cAAM,IAAI;AAAA,UACR,0BAA0B,KAAK;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO,OAAO;AAAA,IACzC,MAAM,OAAO,EAAE,QAAQ,SAAS,QAAQ,MAAM;AAC5C,YAAM,SAAS,UAAU,MAAM;AAC/B,YAAM,EAAE,KAAK,IAAI,MAAM,OAAO,OAAO,QAAQ,QAAQ,OAAO,OAAO,IAAI;AAEvE,WAAK,+CAA+C,IAAI,KAAK,OAAO;AAAA,IACtE;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AACnC,YAAM,MAAM,QAAQ,EAAE,QAAQ,CAAC;AAAA,IACjC;AAAA,EACF;AACF;AAYA,eAAsB,aACpB,QACA,SACe;AACf,QAAM,aAAa,OAAO,EAAE,QAAQ,QAAQ,CAAC;AAC/C","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\nimport { watch } from './implementation';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedWebpackConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\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: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"]}