@metamask/snaps-cli 5.1.0 → 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 +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-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 -240
  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 -271
  456. package/dist/esm/webpack/utils.js.map +0 -1
@@ -0,0 +1,287 @@
1
+ import {
2
+ getFunctionLoader
3
+ } from "./chunk-UBWM7UOC.mjs";
4
+ import {
5
+ processDependencies
6
+ } from "./chunk-V5Q5HRXB.mjs";
7
+ import {
8
+ __require
9
+ } from "./chunk-T74IXMA3.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-MCN7UXG3.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":"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","names":["resolve"]}
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/structs.ts
2
+ var _path = require('path');
3
+ var _superstruct = require('superstruct');
4
+ function file() {
5
+ return _superstruct.coerce.call(void 0, _superstruct.string.call(void 0, ), _superstruct.string.call(void 0, ), (value) => {
6
+ return _path.resolve.call(void 0, process.cwd(), value);
7
+ });
8
+ }
9
+
10
+
11
+
12
+ exports.file = file;
13
+ //# sourceMappingURL=chunk-MIV2UFTA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,QAAQ,cAAc;AAqBxB,SAAS,OAAO;AACrB,SAAO,OAAO,OAAO,GAAG,OAAO,GAAG,CAAC,UAAU;AAC3C,WAAO,QAAQ,QAAQ,IAAI,GAAG,KAAK;AAAA,EACrC,CAAC;AACH","sourcesContent":["import { resolve } from 'path';\nimport { coerce, string } from 'superstruct';\n\n/**\n * A wrapper of `superstruct`'s `string` struct that coerces a value to a string\n * and resolves it relative to the current working directory. This is useful\n * for specifying file paths in a configuration file, as it allows the user to\n * use both relative and absolute paths.\n *\n * @returns The `superstruct` struct, which validates that the value is a\n * string, and resolves it relative to the current working directory.\n * @example\n * ```ts\n * const config = struct({\n * file: file(),\n * // ...\n * });\n *\n * const value = create({ file: 'path/to/file' }, config);\n * console.log(value.file); // /process/cwd/path/to/file\n * ```\n */\nexport function file() {\n return coerce(string(), string(), (value) => {\n return resolve(process.cwd(), value);\n });\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import {
2
+ CommandError
3
+ } from "./chunk-OF4BF57X.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-MMBQXT2G.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,61 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkKZFWI73Ajs = require('./chunk-KZFWI73A.js');
4
+
5
+
6
+ var _chunkYDLKS46Rjs = require('./chunk-YDLKS46R.js');
7
+
8
+
9
+ var _chunk5DDAAM2Xjs = require('./chunk-5DDAAM2X.js');
10
+
11
+
12
+ var _chunkG3IYVYVRjs = require('./chunk-G3IYVYVR.js');
13
+
14
+
15
+ var _chunk46JUPGRYjs = require('./chunk-46JUPGRY.js');
16
+
17
+ // src/commands/build/build.ts
18
+ var _node = require('@metamask/snaps-utils/node');
19
+ var _path = require('path');
20
+ var steps = [
21
+ {
22
+ name: "Checking the input file.",
23
+ task: async ({ config }) => {
24
+ const { input } = config;
25
+ if (!await _node.isFile.call(void 0, input)) {
26
+ throw new (0, _chunk46JUPGRYjs.CommandError)(
27
+ `Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`
28
+ );
29
+ }
30
+ }
31
+ },
32
+ {
33
+ name: "Building the snap bundle.",
34
+ task: async ({ config, spinner }) => {
35
+ return await _chunkKZFWI73Ajs.build.call(void 0, config, { evaluate: false, spinner });
36
+ }
37
+ },
38
+ {
39
+ name: "Evaluating the snap bundle.",
40
+ condition: ({ config }) => config.evaluate,
41
+ task: async ({ config, spinner }) => {
42
+ const path = _path.resolve.call(void 0,
43
+ process.cwd(),
44
+ config.output.path,
45
+ config.output.filename
46
+ );
47
+ await _chunkYDLKS46Rjs.evaluate.call(void 0, path);
48
+ _chunkG3IYVYVRjs.info.call(void 0, `Snap bundle evaluated successfully.`, spinner);
49
+ }
50
+ }
51
+ ];
52
+ async function buildHandler(config) {
53
+ return await _chunk5DDAAM2Xjs.executeSteps.call(void 0, steps, {
54
+ config
55
+ });
56
+ }
57
+
58
+
59
+
60
+ exports.buildHandler = buildHandler;
61
+ //# sourceMappingURL=chunk-NO53G7NT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/build/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,WAAW,mBAAmB;AAavC,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,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AAGnC,aAAO,MAAM,MAAM,QAAQ,EAAE,UAAU,OAAO,QAAQ,CAAC;AAAA,IACzD;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO;AAAA,IAClC,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AACnC,YAAM,OAAO;AAAA,QACX,QAAQ,IAAI;AAAA,QACZ,OAAO,OAAO;AAAA,QACd,OAAO,OAAO;AAAA,MAChB;AAEA,YAAM,SAAS,IAAI;AAEnB,WAAK,uCAAuC,OAAO;AAAA,IACrD;AAAA,EACF;AACF;AAUA,eAAsB,aAAa,QAAwC;AACzE,SAAO,MAAM,aAAa,OAAO;AAAA,IAC/B;AAAA,EACF,CAAC;AACH","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\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"]}
@@ -0,0 +1,53 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkL5TMG6BQjs = require('./chunk-L5TMG6BQ.js');
7
+
8
+
9
+
10
+
11
+ var _chunkHNLMKJBXjs = require('./chunk-HNLMKJBX.js');
12
+
13
+
14
+ var _chunkASOCIPDRjs = require('./chunk-ASOCIPDR.js');
15
+
16
+
17
+ var _chunk5DDAAM2Xjs = require('./chunk-5DDAAM2X.js');
18
+
19
+
20
+
21
+ var _chunkIJYBCHVMjs = require('./chunk-IJYBCHVM.js');
22
+
23
+
24
+
25
+
26
+ var _chunkG3IYVYVRjs = require('./chunk-G3IYVYVR.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: () => _chunkL5TMG6BQjs.CONFIG_FILE,
35
+ TS_CONFIG_FILE: () => _chunkL5TMG6BQjs.TS_CONFIG_FILE,
36
+ error: () => _chunkG3IYVYVRjs.error,
37
+ executeSteps: () => _chunk5DDAAM2Xjs.executeSteps,
38
+ getDependencyRegExp: () => _chunkHNLMKJBXjs.getDependencyRegExp,
39
+ getErrorMessage: () => _chunkIJYBCHVMjs.getErrorMessage,
40
+ getRelativePath: () => _chunkASOCIPDRjs.getRelativePath,
41
+ getYargsErrorMessage: () => _chunkIJYBCHVMjs.getYargsErrorMessage,
42
+ info: () => _chunkG3IYVYVRjs.info,
43
+ processDependencies: () => _chunkHNLMKJBXjs.processDependencies,
44
+ sanitizeDependencyPaths: () => _chunkHNLMKJBXjs.sanitizeDependencyPaths,
45
+ sanitizeInputs: () => _chunkL5TMG6BQjs.sanitizeInputs,
46
+ trimPathString: () => _chunkL5TMG6BQjs.trimPathString,
47
+ warn: () => _chunkG3IYVYVRjs.warn
48
+ });
49
+
50
+
51
+
52
+ exports.utils_exports = utils_exports;
53
+ //# sourceMappingURL=chunk-O2QUFUOY.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,22 @@
1
+ // src/errors.ts
2
+ import { bold, red } from "chalk";
3
+ var CLIError = class extends Error {
4
+ };
5
+ var CommandError = class extends CLIError {
6
+ constructor(message, name = "Error") {
7
+ super(message);
8
+ this.name = bold(red(name));
9
+ }
10
+ };
11
+ var ConfigError = class extends CommandError {
12
+ constructor(message) {
13
+ super(message, "Config Error");
14
+ }
15
+ };
16
+
17
+ export {
18
+ CLIError,
19
+ CommandError,
20
+ ConfigError
21
+ };
22
+ //# sourceMappingURL=chunk-OF4BF57X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts"],"sourcesContent":["import { bold, red } from 'chalk';\n\n/**\n * An error that is thrown when the CLI fails. This is the base error for all\n * CLI errors. It is not thrown directly, but is instead extended by other\n * errors.\n *\n * This error is assumed to have all the information needed to display a\n * readable error message, so it does not include the stack trace when it is\n * thrown.\n */\nexport class CLIError extends Error {}\n\n/**\n * An error that is thrown when a command fails.\n *\n * It wraps the error prefix in a bold red \"Error\" string.\n */\nexport class CommandError extends CLIError {\n constructor(message: string, name = 'Error') {\n super(message);\n this.name = bold(red(name));\n }\n}\n\n/**\n * An error that is thrown when the config file cannot be loaded.\n */\nexport class ConfigError extends CommandError {\n constructor(message: string) {\n super(message, 'Config Error');\n }\n}\n"],"mappings":";AAAA,SAAS,MAAM,WAAW;AAWnB,IAAM,WAAN,cAAuB,MAAM;AAAC;AAO9B,IAAM,eAAN,cAA2B,SAAS;AAAA,EACzC,YAAY,SAAiB,OAAO,SAAS;AAC3C,UAAM,OAAO;AACb,SAAK,OAAO,KAAK,IAAI,IAAI,CAAC;AAAA,EAC5B;AACF;AAKO,IAAM,cAAN,cAA0B,aAAa;AAAA,EAC5C,YAAY,SAAiB;AAC3B,UAAM,SAAS,cAAc;AAAA,EAC/B;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-OVCYXVWI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}