@metamask/snaps-cli 5.1.1 → 6.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 (456) hide show
  1. package/CHANGELOG.md +8 -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-25SLEORF.mjs +28 -0
  7. package/dist/chunk-25SLEORF.mjs.map +1 -0
  8. package/dist/chunk-2QVYYMUD.js +365 -0
  9. package/dist/chunk-2QVYYMUD.js.map +1 -0
  10. package/dist/{esm/webpack/config.js → chunk-3LNPS7AX.js} +182 -156
  11. package/dist/chunk-3LNPS7AX.js.map +1 -0
  12. package/dist/chunk-46JUPGRY.js +22 -0
  13. package/dist/chunk-46JUPGRY.js.map +1 -0
  14. package/dist/chunk-4NHBPMKT.js +54 -0
  15. package/dist/chunk-4NHBPMKT.js.map +1 -0
  16. package/dist/chunk-4OKAI7AP.js +52 -0
  17. package/dist/chunk-4OKAI7AP.js.map +1 -0
  18. package/dist/chunk-5DDAAM2X.js +41 -0
  19. package/dist/chunk-5DDAAM2X.js.map +1 -0
  20. package/dist/chunk-5DSV76XV.mjs +10 -0
  21. package/dist/chunk-5DSV76XV.mjs.map +1 -0
  22. package/dist/chunk-5JPLNWCO.js +24 -0
  23. package/dist/chunk-5JPLNWCO.js.map +1 -0
  24. package/dist/chunk-5VAZH7L7.js +64 -0
  25. package/dist/chunk-5VAZH7L7.js.map +1 -0
  26. package/dist/chunk-5YUHRLH6.js +22 -0
  27. package/dist/chunk-5YUHRLH6.js.map +1 -0
  28. package/dist/chunk-6IF2UBYA.mjs +13 -0
  29. package/dist/chunk-6IF2UBYA.mjs.map +1 -0
  30. package/dist/chunk-6NJAXMSB.js +135 -0
  31. package/dist/chunk-6NJAXMSB.js.map +1 -0
  32. package/dist/chunk-6VFUO2H5.mjs +124 -0
  33. package/dist/chunk-6VFUO2H5.mjs.map +1 -0
  34. package/dist/chunk-7SN4Y44H.js +287 -0
  35. package/dist/chunk-7SN4Y44H.js.map +1 -0
  36. package/dist/chunk-ASOCIPDR.js +10 -0
  37. package/dist/chunk-ASOCIPDR.js.map +1 -0
  38. package/dist/chunk-B455GFXP.mjs +54 -0
  39. package/dist/chunk-B455GFXP.mjs.map +1 -0
  40. package/dist/chunk-DWS4BJTE.mjs +64 -0
  41. package/dist/chunk-DWS4BJTE.mjs.map +1 -0
  42. package/dist/chunk-EQRMXKXY.js +346 -0
  43. package/dist/chunk-EQRMXKXY.js.map +1 -0
  44. package/dist/chunk-EXGQAOQS.js +64 -0
  45. package/dist/chunk-EXGQAOQS.js.map +1 -0
  46. package/dist/chunk-EXJCMAUI.mjs +23 -0
  47. package/dist/chunk-EXJCMAUI.mjs.map +1 -0
  48. package/dist/chunk-FPG4GBXZ.js +30 -0
  49. package/dist/chunk-FPG4GBXZ.js.map +1 -0
  50. package/dist/chunk-FYTQTDZU.mjs +52 -0
  51. package/dist/chunk-FYTQTDZU.mjs.map +1 -0
  52. package/dist/chunk-G3IYVYVR.js +31 -0
  53. package/dist/chunk-G3IYVYVR.js.map +1 -0
  54. package/dist/chunk-GC7BNDLY.js +23 -0
  55. package/dist/chunk-GC7BNDLY.js.map +1 -0
  56. package/dist/chunk-GKG7TO7T.js +28 -0
  57. package/dist/chunk-GKG7TO7T.js.map +1 -0
  58. package/dist/chunk-GU2KH52B.mjs +53 -0
  59. package/dist/chunk-GU2KH52B.mjs.map +1 -0
  60. package/dist/chunk-GUXDSKV4.mjs +51 -0
  61. package/dist/chunk-GUXDSKV4.mjs.map +1 -0
  62. package/dist/chunk-HGYXRW5B.js +50 -0
  63. package/dist/chunk-HGYXRW5B.js.map +1 -0
  64. package/dist/chunk-HJ4276TR.mjs +41 -0
  65. package/dist/chunk-HJ4276TR.mjs.map +1 -0
  66. package/dist/chunk-HNLMKJBX.js +30 -0
  67. package/dist/chunk-HNLMKJBX.js.map +1 -0
  68. package/dist/chunk-IJYBCHVM.js +32 -0
  69. package/dist/chunk-IJYBCHVM.js.map +1 -0
  70. package/dist/chunk-IQTGFRWK.js +18 -0
  71. package/dist/chunk-IQTGFRWK.js.map +1 -0
  72. package/dist/chunk-IYAFFTJU.js +23 -0
  73. package/dist/chunk-IYAFFTJU.js.map +1 -0
  74. package/dist/chunk-JMISQ4HT.mjs +31 -0
  75. package/dist/chunk-JMISQ4HT.mjs.map +1 -0
  76. package/dist/chunk-K3TSXPME.js +16 -0
  77. package/dist/chunk-K3TSXPME.js.map +1 -0
  78. package/dist/{cjs/webpack/config.js → chunk-KKTPKAZN.mjs} +181 -153
  79. package/dist/chunk-KKTPKAZN.mjs.map +1 -0
  80. package/dist/chunk-KZFWI73A.js +28 -0
  81. package/dist/chunk-KZFWI73A.js.map +1 -0
  82. package/dist/chunk-L5TMG6BQ.js +37 -0
  83. package/dist/chunk-L5TMG6BQ.js.map +1 -0
  84. package/dist/chunk-MCN7UXG3.mjs +287 -0
  85. package/dist/chunk-MCN7UXG3.mjs.map +1 -0
  86. package/dist/chunk-MIV2UFTA.js +13 -0
  87. package/dist/chunk-MIV2UFTA.js.map +1 -0
  88. package/dist/chunk-MMBQXT2G.mjs +30 -0
  89. package/dist/chunk-MMBQXT2G.mjs.map +1 -0
  90. package/dist/chunk-NO53G7NT.js +61 -0
  91. package/dist/chunk-NO53G7NT.js.map +1 -0
  92. package/dist/chunk-O2QUFUOY.js +53 -0
  93. package/dist/chunk-O2QUFUOY.js.map +1 -0
  94. package/dist/chunk-OF4BF57X.mjs +22 -0
  95. package/dist/chunk-OF4BF57X.mjs.map +1 -0
  96. package/dist/chunk-OVCYXVWI.mjs +1 -0
  97. package/dist/chunk-OVCYXVWI.mjs.map +1 -0
  98. package/dist/chunk-PDNDGMB2.mjs +365 -0
  99. package/dist/chunk-PDNDGMB2.mjs.map +1 -0
  100. package/dist/chunk-QCP4QKMQ.mjs +24 -0
  101. package/dist/chunk-QCP4QKMQ.mjs.map +1 -0
  102. package/dist/chunk-QH4AQR33.mjs +61 -0
  103. package/dist/chunk-QH4AQR33.mjs.map +1 -0
  104. package/dist/chunk-S5ERYB6I.mjs +64 -0
  105. package/dist/chunk-S5ERYB6I.mjs.map +1 -0
  106. package/dist/chunk-SAEZHRJJ.mjs +23 -0
  107. package/dist/chunk-SAEZHRJJ.mjs.map +1 -0
  108. package/dist/chunk-T3KPXUAU.js +24 -0
  109. package/dist/chunk-T3KPXUAU.js.map +1 -0
  110. package/dist/chunk-T74IXMA3.mjs +50 -0
  111. package/dist/chunk-T74IXMA3.mjs.map +1 -0
  112. package/dist/chunk-TLTTWAEI.mjs +37 -0
  113. package/dist/chunk-TLTTWAEI.mjs.map +1 -0
  114. package/dist/chunk-TX4BG5GS.mjs +50 -0
  115. package/dist/chunk-TX4BG5GS.mjs.map +1 -0
  116. package/dist/chunk-UA5FEKKH.mjs +30 -0
  117. package/dist/chunk-UA5FEKKH.mjs.map +1 -0
  118. package/dist/chunk-UBWM7UOC.mjs +32 -0
  119. package/dist/chunk-UBWM7UOC.mjs.map +1 -0
  120. package/dist/chunk-USFFVX52.mjs +35 -0
  121. package/dist/chunk-USFFVX52.mjs.map +1 -0
  122. package/dist/chunk-V5Q5HRXB.mjs +30 -0
  123. package/dist/chunk-V5Q5HRXB.mjs.map +1 -0
  124. package/dist/chunk-VI3ZJJYO.mjs +346 -0
  125. package/dist/chunk-VI3ZJJYO.mjs.map +1 -0
  126. package/dist/chunk-VTJFPUIA.mjs +22 -0
  127. package/dist/chunk-VTJFPUIA.mjs.map +1 -0
  128. package/dist/chunk-WH7GOZP7.js +51 -0
  129. package/dist/chunk-WH7GOZP7.js.map +1 -0
  130. package/dist/chunk-WJNHZ4YF.js +35 -0
  131. package/dist/chunk-WJNHZ4YF.js.map +1 -0
  132. package/dist/chunk-WKL7DYYW.mjs +16 -0
  133. package/dist/chunk-WKL7DYYW.mjs.map +1 -0
  134. package/dist/chunk-X2RPNWBJ.mjs +24 -0
  135. package/dist/chunk-X2RPNWBJ.mjs.map +1 -0
  136. package/dist/chunk-X3D3MHWF.js +44 -0
  137. package/dist/chunk-X3D3MHWF.js.map +1 -0
  138. package/dist/chunk-X4FWMO4H.mjs +18 -0
  139. package/dist/chunk-X4FWMO4H.mjs.map +1 -0
  140. package/dist/chunk-Y5PQG4KA.js +1 -0
  141. package/dist/chunk-Y5PQG4KA.js.map +1 -0
  142. package/dist/chunk-YDLKS46R.js +30 -0
  143. package/dist/chunk-YDLKS46R.js.map +1 -0
  144. package/dist/chunk-YURDB35F.js +124 -0
  145. package/dist/chunk-YURDB35F.js.map +1 -0
  146. package/dist/chunk-YYYOE2GO.mjs +32 -0
  147. package/dist/chunk-YYYOE2GO.mjs.map +1 -0
  148. package/dist/chunk-ZOQ32RQI.mjs +135 -0
  149. package/dist/chunk-ZOQ32RQI.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 +2 -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
@@ -1,254 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- BROWSERSLIST_FILE: function() {
13
- return BROWSERSLIST_FILE;
14
- },
15
- WEBPACK_FALLBACKS: function() {
16
- return WEBPACK_FALLBACKS;
17
- },
18
- getDefaultLoader: function() {
19
- return getDefaultLoader;
20
- },
21
- getDevTool: function() {
22
- return getDevTool;
23
- },
24
- getProgressHandler: function() {
25
- return getProgressHandler;
26
- },
27
- getBrowserslistTargets: function() {
28
- return getBrowserslistTargets;
29
- },
30
- pluralize: function() {
31
- return pluralize;
32
- },
33
- getFallbacks: function() {
34
- return getFallbacks;
35
- },
36
- getEnvironmentVariables: function() {
37
- return getEnvironmentVariables;
38
- },
39
- formatText: function() {
40
- return formatText;
41
- }
42
- });
43
- const _chalk = require("chalk");
44
- const _fs = require("fs");
45
- const _module = require("module");
46
- const _path = require("path");
47
- const _stripansi = /*#__PURE__*/ _interop_require_default(require("strip-ansi"));
48
- function _interop_require_default(obj) {
49
- return obj && obj.__esModule ? obj : {
50
- default: obj
51
- };
52
- }
53
- const BROWSERSLIST_FILE = (0, _path.resolve)((0, _path.dirname)(// eslint-disable-next-line n/no-extraneous-require
54
- require.resolve('@metamask/snaps-cli/package.json')), '.browserslistrc');
55
- const WEBPACK_FALLBACKS = {
56
- assert: require.resolve('assert/'),
57
- buffer: require.resolve('buffer/'),
58
- console: require.resolve('console-browserify'),
59
- constants: require.resolve('constants-browserify'),
60
- crypto: require.resolve('crypto-browserify'),
61
- domain: require.resolve('domain-browser'),
62
- events: require.resolve('events/'),
63
- http: require.resolve('stream-http'),
64
- https: require.resolve('https-browserify'),
65
- os: require.resolve('os-browserify/browser'),
66
- path: require.resolve('path-browserify'),
67
- punycode: require.resolve('punycode/'),
68
- process: require.resolve('process/browser'),
69
- querystring: require.resolve('querystring-es3'),
70
- stream: require.resolve('stream-browserify'),
71
- /* eslint-disable @typescript-eslint/naming-convention */ _stream_duplex: require.resolve('readable-stream/lib/_stream_duplex'),
72
- _stream_passthrough: require.resolve('readable-stream/lib/_stream_passthrough'),
73
- _stream_readable: require.resolve('readable-stream/lib/_stream_readable'),
74
- _stream_transform: require.resolve('readable-stream/lib/_stream_transform'),
75
- _stream_writable: require.resolve('readable-stream/lib/_stream_writable'),
76
- string_decoder: require.resolve('string_decoder/'),
77
- /* eslint-enable @typescript-eslint/naming-convention */ sys: require.resolve('util/'),
78
- timers: require.resolve('timers-browserify'),
79
- tty: require.resolve('tty-browserify'),
80
- url: require.resolve('url/'),
81
- util: require.resolve('util/'),
82
- vm: require.resolve('vm-browserify'),
83
- zlib: require.resolve('browserify-zlib')
84
- };
85
- async function getDefaultLoader({ legacy, sourceMap }) {
86
- if (legacy) {
87
- return {
88
- /**
89
- * If the snap uses the legacy config, we use the custom `browserify`
90
- * loader. This uses the legacy Browserify config to transpile the code.
91
- * This is necessary for backwards compatibility with the
92
- * `bundlerCustomizer` function.
93
- */ loader: (0, _path.resolve)(__dirname, 'loaders', 'browserify'),
94
- /**
95
- * The options for the `browserify` loader. These can be overridden in the
96
- * snap config.
97
- */ options: legacy
98
- };
99
- }
100
- const targets = await getBrowserslistTargets();
101
- return {
102
- /**
103
- * We use the `swc-loader` to transpile TypeScript and JavaScript files.
104
- * This is a Webpack loader that uses the `SWC` compiler, which is a much
105
- * faster alternative to Babel and TypeScript's own compiler.
106
- */ loader: require.resolve('swc-loader'),
107
- /**
108
- * The options for the `swc-loader`. These can be overridden in the
109
- * `.swcrc` file.
110
- *
111
- * @see https://swc.rs/docs/configuration/swcrc
112
- */ options: {
113
- sync: false,
114
- /**
115
- * This tells SWC to generate source maps. We set it to the
116
- * `sourceMap` value from the config object.
117
- *
118
- * This must be enabled if source maps are enabled in the config.
119
- */ sourceMaps: Boolean(getDevTool(sourceMap)),
120
- jsc: {
121
- parser: {
122
- /**
123
- * This tells the parser to parse TypeScript files. If you
124
- * don't need to support TypeScript, you can set this to
125
- * `ecmascript` instead, but there's no harm in leaving it
126
- * as `typescript`.
127
- *
128
- * @see https://swc.rs/docs/configuration/compilation#jscparser
129
- */ syntax: 'typescript'
130
- }
131
- },
132
- /**
133
- * The module configuration. This tells SWC how to output the
134
- * transpiled code.
135
- *
136
- * @see https://swc.rs/docs/configuration/modules
137
- */ module: {
138
- /**
139
- * This tells SWC to output ES6 modules. This will allow Webpack to
140
- * optimize the output code better. Snaps don't support ES6 however, so
141
- * the output code will be transpiled to CommonJS by Webpack later in
142
- * the build process.
143
- *
144
- * @see https://swc.rs/docs/configuration/modules#es6
145
- */ type: 'es6'
146
- },
147
- env: {
148
- targets: targets.join(', ')
149
- }
150
- }
151
- };
152
- }
153
- function getDevTool(sourceMap) {
154
- if (sourceMap === 'inline') {
155
- return 'inline-source-map';
156
- }
157
- if (sourceMap === true) {
158
- return 'source-map';
159
- }
160
- return false;
161
- }
162
- function getProgressHandler(spinner, spinnerText) {
163
- return (percentage)=>{
164
- if (spinner && spinnerText) {
165
- spinner.text = `${spinnerText} ${(0, _chalk.dim)(`(${Math.round(percentage * 100)}%)`)}`;
166
- }
167
- };
168
- }
169
- async function getBrowserslistTargets() {
170
- const contents = await _fs.promises.readFile(BROWSERSLIST_FILE, 'utf8');
171
- return contents.split('\n').map((line)=>line.trim()).filter((line)=>line && !line.startsWith('#'));
172
- }
173
- function pluralize(count, singular, plural = `${singular}s`) {
174
- return count === 1 ? singular : plural;
175
- }
176
- function getFallbacks(polyfills) {
177
- if (polyfills === true) {
178
- return Object.fromEntries(_module.builtinModules.map((name)=>[
179
- name,
180
- WEBPACK_FALLBACKS[name] ?? false
181
- ]));
182
- }
183
- if (polyfills === false) {
184
- return Object.fromEntries(_module.builtinModules.map((name)=>[
185
- name,
186
- false
187
- ]));
188
- }
189
- return Object.fromEntries(_module.builtinModules.map((name)=>[
190
- name,
191
- polyfills[name] ? WEBPACK_FALLBACKS[name] : false
192
- ]));
193
- }
194
- function getEnvironmentVariables(environment, defaults = {
195
- NODE_DEBUG: 'false',
196
- NODE_ENV: 'production',
197
- DEBUG: 'false'
198
- }) {
199
- return Object.fromEntries(Object.entries({
200
- ...defaults,
201
- ...environment
202
- }).map(([key, value])=>[
203
- `process.env.${key}`,
204
- JSON.stringify(value)
205
- ]));
206
- }
207
- /**
208
- * Format the given line to fit within the terminal width.
209
- *
210
- * @param line - The line to format.
211
- * @param indent - The indentation to use.
212
- * @param initialIndent - The initial indentation to use, i.e., the indentation
213
- * for the first line.
214
- * @returns The formatted line.
215
- */ function formatLine(line, indent, initialIndent) {
216
- const terminalWidth = process.stdout.columns;
217
- if (!terminalWidth) {
218
- return `${' '.repeat(initialIndent)}${line}`;
219
- }
220
- return line.split(' ').reduce(({ formattedText, currentLineLength }, word, index)=>{
221
- // `chalk` adds ANSI escape codes to the text, which are not visible
222
- // characters. We need to strip them to get the visible length of the
223
- // text.
224
- const visibleWord = (0, _stripansi.default)(word);
225
- // Determine if a space should be added before the word.
226
- const spaceBeforeWord = index > 0 ? ' ' : '';
227
- const wordLengthWithSpace = visibleWord.length + spaceBeforeWord.length;
228
- // If the word would exceed the terminal width, start a new line.
229
- if (currentLineLength + wordLengthWithSpace > terminalWidth) {
230
- return {
231
- formattedText: `${formattedText}\n${' '.repeat(indent)}${word}`,
232
- currentLineLength: indent + visibleWord.length
233
- };
234
- }
235
- // Otherwise, add the word to the current line.
236
- return {
237
- formattedText: formattedText + spaceBeforeWord + word,
238
- currentLineLength: currentLineLength + wordLengthWithSpace
239
- };
240
- }, {
241
- formattedText: ' '.repeat(initialIndent),
242
- currentLineLength: initialIndent
243
- }).formattedText;
244
- }
245
- function formatText(text, indent, initialIndent = indent) {
246
- const lines = text.split('\n');
247
- // Apply formatting to each line separately and then join them.
248
- return lines.map((line, index)=>{
249
- const lineIndent = index === 0 ? initialIndent : indent;
250
- return formatLine(line, indent, lineIndent);
251
- }).join('\n');
252
- }
253
-
254
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/webpack/utils.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';\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 return {\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 loader: resolve(__dirname, 'loaders', 'browserify'),\n\n /**\n * The options for the `browserify` loader. These can be overridden in the\n * snap config.\n */\n options: legacy,\n };\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"],"names":["BROWSERSLIST_FILE","WEBPACK_FALLBACKS","getDefaultLoader","getDevTool","getProgressHandler","getBrowserslistTargets","pluralize","getFallbacks","getEnvironmentVariables","formatText","resolve","dirname","require","assert","buffer","console","constants","crypto","domain","events","http","https","os","path","punycode","process","querystring","stream","_stream_duplex","_stream_passthrough","_stream_readable","_stream_transform","_stream_writable","string_decoder","sys","timers","tty","url","util","vm","zlib","legacy","sourceMap","loader","__dirname","options","targets","sync","sourceMaps","Boolean","jsc","parser","syntax","module","type","env","join","spinner","spinnerText","percentage","text","dim","Math","round","contents","fs","readFile","split","map","line","trim","filter","startsWith","count","singular","plural","polyfills","Object","fromEntries","builtinModules","name","environment","defaults","NODE_DEBUG","NODE_ENV","DEBUG","entries","key","value","JSON","stringify","formatLine","indent","initialIndent","terminalWidth","stdout","columns","repeat","reduce","formattedText","currentLineLength","word","index","visibleWord","stripAnsi","spaceBeforeWord","wordLengthWithSpace","length","lines","lineIndent"],"mappings":"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"}
@@ -1,130 +0,0 @@
1
- export var TranspilationModes;
2
- (function(TranspilationModes) {
3
- TranspilationModes["LocalAndDeps"] = 'localAndDeps';
4
- TranspilationModes["LocalOnly"] = 'localOnly';
5
- TranspilationModes["None"] = 'none';
6
- })(TranspilationModes || (TranspilationModes = {}));
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.
26
- bundle: {
27
- alias: 'b',
28
- describe: 'Snap bundle file',
29
- type: 'string',
30
- normalize: true,
31
- deprecated: 'Use --input instead.'
32
- },
33
- dist: {
34
- alias: 'd',
35
- describe: 'Output directory',
36
- type: 'string',
37
- normalize: true,
38
- deprecated: true
39
- },
40
- eval: {
41
- alias: 'e',
42
- describe: 'Attempt to evaluate Snap bundle in SES',
43
- type: 'boolean',
44
- deprecated: true
45
- },
46
- manifest: {
47
- alias: 'm',
48
- describe: 'Validate snap.manifest.json',
49
- type: 'boolean',
50
- deprecated: true
51
- },
52
- port: {
53
- alias: 'p',
54
- describe: 'Local server port for testing',
55
- type: 'number',
56
- coerce: (arg)=>{
57
- const port = Number.parseInt(String(arg), 10);
58
- if (Number.isNaN(port)) {
59
- throw new Error(`Invalid port: "${String(arg)}".`);
60
- }
61
- return port;
62
- },
63
- deprecated: true
64
- },
65
- outfileName: {
66
- alias: 'n',
67
- describe: 'Output file name',
68
- type: 'string',
69
- deprecated: true
70
- },
71
- root: {
72
- alias: 'r',
73
- describe: 'Server root directory',
74
- type: 'string',
75
- normalize: true,
76
- deprecated: true
77
- },
78
- sourceMaps: {
79
- describe: 'Whether builds include sourcemaps',
80
- type: 'boolean',
81
- deprecated: true
82
- },
83
- src: {
84
- alias: 's',
85
- describe: 'Source file',
86
- type: 'string',
87
- normalize: true,
88
- deprecated: true
89
- },
90
- stripComments: {
91
- alias: 'strip',
92
- describe: 'Whether to remove code comments from the build output',
93
- type: 'boolean',
94
- deprecated: true
95
- },
96
- suppressWarnings: {
97
- type: 'boolean',
98
- describe: 'Whether to suppress warnings',
99
- deprecated: true
100
- },
101
- transpilationMode: {
102
- type: 'string',
103
- describe: 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',
104
- choices: Object.values(TranspilationModes),
105
- deprecated: true
106
- },
107
- depsToTranspile: {
108
- type: 'array',
109
- describe: 'Transpile only the listed dependencies.',
110
- deprecated: true
111
- },
112
- verboseErrors: {
113
- type: 'boolean',
114
- describe: 'Display original errors',
115
- deprecated: true
116
- },
117
- writeManifest: {
118
- describe: 'Make necessary changes to the snap manifest file',
119
- type: 'boolean',
120
- deprecated: true
121
- },
122
- serve: {
123
- describe: 'Serve snap file(s) locally for testing',
124
- type: 'boolean',
125
- deprecated: true
126
- }
127
- };
128
- export default builders;
129
-
130
- //# sourceMappingURL=builders.js.map
@@ -1 +0,0 @@
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"}
package/dist/esm/cli.js DELETED
@@ -1,56 +0,0 @@
1
- import semver from 'semver';
2
- import yargs from 'yargs';
3
- import { hideBin } from 'yargs/helpers';
4
- import builders from './builders';
5
- import { getConfigByArgv } from './config';
6
- import { error, getYargsErrorMessage, sanitizeInputs } from './utils';
7
- const MINIMUM_NODE_16_VERSION = '16.17.0';
8
- const MINIMUM_NODE_18_VERSION = '18.6.0';
9
- /**
10
- * Check the Node version. If the Node version is less than the minimum required
11
- * version, this logs an error and exits the process.
12
- *
13
- * @param nodeVersion - The Node version to check.
14
- */ export function checkNodeVersion(nodeVersion = process.version.slice(1)) {
15
- const majorVersion = semver.major(nodeVersion);
16
- const message = `Node version ${nodeVersion} is not supported. Please use Node ${MINIMUM_NODE_16_VERSION} or later.`;
17
- if (majorVersion < 16) {
18
- error(message);
19
- // eslint-disable-next-line n/no-process-exit
20
- process.exit(1);
21
- }
22
- // Node 16 and 18 have a different minimum version requirement, so we need to
23
- // check for both.
24
- if (majorVersion === 16 && semver.lt(nodeVersion, MINIMUM_NODE_16_VERSION)) {
25
- error(message);
26
- // eslint-disable-next-line n/no-process-exit
27
- process.exit(1);
28
- }
29
- if (majorVersion === 18 && semver.lt(nodeVersion, MINIMUM_NODE_18_VERSION)) {
30
- error(`Node version ${nodeVersion} is not supported. Please use Node ${MINIMUM_NODE_18_VERSION} or later.`);
31
- // eslint-disable-next-line n/no-process-exit
32
- process.exit(1);
33
- }
34
- }
35
- /**
36
- * The main CLI entry point function. This processes the command line args, and
37
- * runs the appropriate function.
38
- *
39
- * @param argv - The raw command line arguments, i.e., `process.argv`.
40
- * @param commands - The list of commands to use.
41
- */ export async function cli(argv, commands) {
42
- checkNodeVersion();
43
- 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)=>{
44
- // eslint-disable-next-line require-atomic-updates
45
- args.context = {
46
- config: await getConfigByArgv(args)
47
- };
48
- sanitizeInputs(args);
49
- }, false).demandCommand(1, 'You must specify at least one command.').fail((message, failure)=>{
50
- error(getYargsErrorMessage(message, failure));
51
- // eslint-disable-next-line n/no-process-exit
52
- process.exit(1);
53
- }).help().alias('help', 'h').parseAsync();
54
- }
55
-
56
- //# sourceMappingURL=cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/cli.ts"],"sourcesContent":["import semver from 'semver';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport builders from './builders';\nimport { getConfigByArgv } from './config';\nimport { error, getYargsErrorMessage, sanitizeInputs } from './utils';\n\nconst MINIMUM_NODE_16_VERSION = '16.17.0';\nconst MINIMUM_NODE_18_VERSION = '18.6.0';\n\n/**\n * Check the Node version. If the Node version is less than the minimum required\n * version, this logs an error and exits the process.\n *\n * @param nodeVersion - The Node version to check.\n */\nexport function checkNodeVersion(\n nodeVersion: string = process.version.slice(1),\n) {\n const majorVersion = semver.major(nodeVersion);\n const message = `Node version ${nodeVersion} is not supported. Please use Node ${MINIMUM_NODE_16_VERSION} or later.`;\n\n if (majorVersion < 16) {\n error(message);\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n }\n\n // Node 16 and 18 have a different minimum version requirement, so we need to\n // check for both.\n if (majorVersion === 16 && semver.lt(nodeVersion, MINIMUM_NODE_16_VERSION)) {\n error(message);\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n }\n\n if (majorVersion === 18 && semver.lt(nodeVersion, MINIMUM_NODE_18_VERSION)) {\n error(\n `Node version ${nodeVersion} is not supported. Please use Node ${MINIMUM_NODE_18_VERSION} or later.`,\n );\n // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n }\n}\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 checkNodeVersion();\n\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":["semver","yargs","hideBin","builders","getConfigByArgv","error","getYargsErrorMessage","sanitizeInputs","MINIMUM_NODE_16_VERSION","MINIMUM_NODE_18_VERSION","checkNodeVersion","nodeVersion","process","version","slice","majorVersion","major","message","exit","lt","cli","argv","commands","scriptName","usage","example","command","option","config","verboseErrors","suppressWarnings","strict","middleware","args","context","demandCommand","fail","failure","help","alias","parseAsync"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,OAAOC,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,MAAMC,0BAA0B;AAChC,MAAMC,0BAA0B;AAEhC;;;;;CAKC,GACD,OAAO,SAASC,iBACdC,cAAsBC,QAAQC,OAAO,CAACC,KAAK,CAAC,EAAE;IAE9C,MAAMC,eAAef,OAAOgB,KAAK,CAACL;IAClC,MAAMM,UAAU,CAAC,aAAa,EAAEN,YAAY,mCAAmC,EAAEH,wBAAwB,UAAU,CAAC;IAEpH,IAAIO,eAAe,IAAI;QACrBV,MAAMY;QACN,6CAA6C;QAC7CL,QAAQM,IAAI,CAAC;IACf;IAEA,6EAA6E;IAC7E,kBAAkB;IAClB,IAAIH,iBAAiB,MAAMf,OAAOmB,EAAE,CAACR,aAAaH,0BAA0B;QAC1EH,MAAMY;QACN,6CAA6C;QAC7CL,QAAQM,IAAI,CAAC;IACf;IAEA,IAAIH,iBAAiB,MAAMf,OAAOmB,EAAE,CAACR,aAAaF,0BAA0B;QAC1EJ,MACE,CAAC,aAAa,EAAEM,YAAY,mCAAmC,EAAEF,wBAAwB,UAAU,CAAC;QAEtG,6CAA6C;QAC7CG,QAAQM,IAAI,CAAC;IACf;AACF;AAEA;;;;;;CAMC,GACD,OAAO,eAAeE,IAAIC,IAAc,EAAEC,QAAa;IACrDZ;IAEA,MAAMT,MAAMC,QAAQmB,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,UAAUxB,SAASyB,MAAM,EAChCD,MAAM,CAAC,iBAAiBxB,SAAS0B,aAAa,EAC9CF,MAAM,CAAC,oBAAoBxB,SAAS2B,gBAAgB,EAEpDC,MAAM,GAENC,UAAU,CAAC,OAAOC;QACjB,kDAAkD;QAClDA,KAAKC,OAAO,GAAG;YACbN,QAAQ,MAAMxB,gBAAgB6B;QAChC;QAEA1B,eAAe0B;IACjB,GAAG,OAEFE,aAAa,CAAC,GAAG,0CAEjBC,IAAI,CAAC,CAACnB,SAASoB;QACdhC,MAAMC,qBAAqBW,SAASoB;QACpC,6CAA6C;QAC7CzB,QAAQM,IAAI,CAAC;IACf,GAECoB,IAAI,GACJC,KAAK,CAAC,QAAQ,KACdC,UAAU;AACf"}
@@ -1,51 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,27 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}