@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,276 +1,302 @@
1
- import SnapsWebpackPlugin from '@metamask/snaps-webpack-plugin';
2
- import { resolve } from 'path';
3
- import TerserPlugin from 'terser-webpack-plugin';
4
- import { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack';
5
- import { SnapsBuiltInResolver, SnapsBundleWarningsPlugin, SnapsStatsPlugin, SnapsWatchPlugin } from './plugins';
6
- import { BROWSERSLIST_FILE, getDefaultLoader, getDevTool, getEnvironmentVariables, getFallbacks, getProgressHandler } from './utils';
7
- /**
8
- * Get the default Webpack configuration. This is the configuration that will
9
- * be used if the user doesn't provide a custom Webpack configuration. The
10
- * configuration is based on the snap config.
11
- *
12
- * The default configuration includes:
13
- *
14
- * - `SWC` to transpile TypeScript and JavaScript files.
15
- * - `TerserPlugin` to minify the bundle.
16
- * - `SnapsWebpackPlugin` to validate the bundle and update the manifest.
17
- *
18
- * It can be customized through the `customizeWebpackConfig` function in the
19
- * snap config, but in most cases, you shouldn't need to do that.
20
- *
21
- * @param config - The processed snap Webpack config.
22
- * @param options - The Webpack options.
23
- * @returns The default Webpack configuration.
24
- */ export async function getDefaultConfiguration(config, options = {
25
- evaluate: config.evaluate
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+
6
+ var _chunkEQRMXKXYjs = require('./chunk-EQRMXKXY.js');
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ var _chunk7SN4Y44Hjs = require('./chunk-7SN4Y44H.js');
15
+
16
+
17
+ var _chunkGKG7TO7Tjs = require('./chunk-GKG7TO7T.js');
18
+
19
+
20
+ var _chunk5VAZH7L7js = require('./chunk-5VAZH7L7.js');
21
+
22
+ // src/webpack/config.ts
23
+ var _snapswebpackplugin = require('@metamask/snaps-webpack-plugin'); var _snapswebpackplugin2 = _interopRequireDefault(_snapswebpackplugin);
24
+ var _path = require('path');
25
+ var _terserwebpackplugin = require('terser-webpack-plugin'); var _terserwebpackplugin2 = _interopRequireDefault(_terserwebpackplugin);
26
+ var _webpack = require('webpack');
27
+ async function getDefaultConfiguration(config, options = {
28
+ evaluate: config.evaluate
26
29
  }) {
27
- const spinnerText = options.spinner?.text;
28
- const builtInResolver = config.stats.builtIns && new SnapsBuiltInResolver(config.stats.builtIns, options.spinner);
29
- return {
30
- /**
30
+ const spinnerText = _optionalChain([options, 'access', _ => _.spinner, 'optionalAccess', _2 => _2.text]);
31
+ const builtInResolver = config.stats.builtIns && new (0, _chunkEQRMXKXYjs.SnapsBuiltInResolver)(config.stats.builtIns, options.spinner);
32
+ return {
33
+ /**
31
34
  * The target is set to `browserslist` so that Webpack will compile the
32
35
  * bundle to support the browsers specified in the `.browserslistrc` file.
33
36
  * This Browserslist file contains the browsers that are supported by
34
37
  * MetaMask Snaps.
35
38
  *
36
39
  * @see https://webpack.js.org/configuration/target/
37
- */ target: `browserslist:${BROWSERSLIST_FILE}`,
38
- /**
40
+ */
41
+ target: `browserslist:${_chunk7SN4Y44Hjs.BROWSERSLIST_FILE}`,
42
+ /**
39
43
  * The mode is set to `production` by default, so that Webpack will minify
40
44
  * and optimize the bundle.
41
45
  *
42
46
  * @see https://webpack.js.org/configuration/mode/
43
- */ mode: 'production',
44
- /**
47
+ */
48
+ mode: "production",
49
+ /**
45
50
  * The entry point is set to the `input` value from the config object.
46
51
  *
47
52
  * @see https://webpack.js.org/configuration/entry-context/
48
- */ entry: config.input,
49
- /**
53
+ */
54
+ entry: config.input,
55
+ /**
50
56
  * The devtool option controls how source maps are generated. We set it to
51
57
  * the `sourceMap` value from the config object.
52
58
  *
53
59
  * @see https://webpack.js.org/configuration/devtool/
54
- */ devtool: getDevTool(config.sourceMap),
55
- /**
60
+ */
61
+ devtool: _chunk7SN4Y44Hjs.getDevTool.call(void 0, config.sourceMap),
62
+ /**
56
63
  * The stats option controls how much information is printed to the console
57
64
  * when Webpack is running. We set it to `none` so that we can control the
58
65
  * output ourselves.
59
66
  *
60
67
  * @see https://webpack.js.org/configuration/stats/
61
- */ stats: 'none',
62
- /**
68
+ */
69
+ stats: "none",
70
+ /**
63
71
  * The output options.
64
72
  *
65
73
  * @see https://webpack.js.org/configuration/output/
66
- */ output: {
67
- /**
74
+ */
75
+ output: {
76
+ /**
68
77
  * This indicates whether Webpack should clear the output directory
69
78
  * before building. We set it to the `clean` value from the config
70
79
  * object.
71
80
  *
72
81
  * @see https://webpack.js.org/configuration/output/#outputclean
73
- */ clean: config.output.clean,
74
- /**
82
+ */
83
+ clean: config.output.clean,
84
+ /**
75
85
  * The filename of the bundle. We set it to the `filename` value from
76
86
  * the config object.
77
87
  *
78
88
  * @see https://webpack.js.org/configuration/output/#outputfilename
79
- */ filename: config.output.filename,
80
- /**
89
+ */
90
+ filename: config.output.filename,
91
+ /**
81
92
  * The path to the output directory. We set it to the `path` value from
82
93
  * the config object.
83
94
  *
84
95
  * @see https://webpack.js.org/configuration/output/#outputpath
85
- */ path: config.output.path,
86
- /**
96
+ */
97
+ path: config.output.path,
98
+ /**
87
99
  * The public path of the bundle. We set it to `/` by default, so that
88
100
  * the bundle can be loaded from the root of the server.
89
101
  *
90
102
  * @see https://webpack.js.org/configuration/output/#outputpublicpath
91
- */ publicPath: '/',
92
- /**
103
+ */
104
+ publicPath: "/",
105
+ /**
93
106
  * The library configuration. This tells Webpack how to export the
94
107
  * bundle.
95
108
  *
96
109
  * @see https://webpack.js.org/configuration/output/#outputlibrary
97
- */ library: {
98
- /**
110
+ */
111
+ library: {
112
+ /**
99
113
  * This tells Webpack to export the bundle as a CommonJS module. This
100
114
  * is necessary for MetaMask Snaps.
101
115
  *
102
116
  * @see https://webpack.js.org/configuration/output/#outputlibrarytarget
103
- */ type: 'commonjs'
104
- },
105
- /**
117
+ */
118
+ type: "commonjs"
119
+ },
120
+ /**
106
121
  * The chunk format. This tells Webpack how to export chunks. This is
107
122
  * required because we use browserslist to target browsers, but Snaps are
108
123
  * not fully compatible with browser APIs (such as `window` and
109
124
  * `document`).
110
125
  *
111
126
  * @see https://webpack.js.org/configuration/output/#outputchunkformat
112
- */ chunkFormat: 'commonjs'
113
- },
114
- /**
127
+ */
128
+ chunkFormat: "commonjs"
129
+ },
130
+ /**
115
131
  * The module configuration. This is where we tell Webpack how to handle
116
132
  * different types of files.
117
133
  *
118
134
  * @see https://webpack.js.org/configuration/module/
119
- */ module: {
120
- rules: [
121
- {
122
- test: /\.(js|mjs|cjs|ts)$/u,
123
- exclude: /node_modules/u,
124
- use: await getDefaultLoader(config)
125
- },
126
- /**
135
+ */
136
+ module: {
137
+ rules: [
138
+ {
139
+ test: /\.(js|mjs|cjs|ts)$/u,
140
+ exclude: /node_modules/u,
141
+ use: await _chunk7SN4Y44Hjs.getDefaultLoader.call(void 0, config)
142
+ },
143
+ /**
127
144
  * This allows importing modules that uses `.js` and not `.mjs` for the
128
145
  * ES build.
129
146
  *
130
147
  * @see https://webpack.js.org/configuration/module/#resolvefullyspecified
131
- */ {
132
- test: /\.m?js/u,
133
- resolve: {
134
- fullySpecified: false
135
- }
136
- },
137
- config.experimental.wasm && {
138
- test: /\.wasm$/u,
139
- use: {
140
- loader: resolve(__dirname, 'loaders', 'wasm')
141
- }
142
- }
143
- ]
148
+ */
149
+ {
150
+ test: /\.m?js/u,
151
+ resolve: {
152
+ fullySpecified: false
153
+ }
144
154
  },
145
- /**
155
+ config.experimental.wasm && {
156
+ test: /\.wasm$/u,
157
+ use: _chunkGKG7TO7Tjs.getFunctionLoader.call(void 0, _chunk5VAZH7L7js.wasm_default, {})
158
+ }
159
+ ]
160
+ },
161
+ /**
146
162
  * The resolve configuration. This tells Webpack how to resolve imports.
147
163
  * We set it to resolve `.js` and `.ts` files.
148
164
  *
149
165
  * @see https://webpack.js.org/configuration/resolve/
150
- */ resolve: {
151
- /**
166
+ */
167
+ resolve: {
168
+ /**
152
169
  * The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`
153
170
  * files.
154
- */ extensions: [
155
- '.js',
156
- '.mjs',
157
- '.cjs',
158
- '.ts'
159
- ],
160
- /**
171
+ */
172
+ extensions: [".js", ".mjs", ".cjs", ".ts"],
173
+ /**
161
174
  * The fallback options. This tells Webpack how to handle imports that
162
175
  * aren't resolved. By default, we set Node.js built-ins to `false`, so
163
176
  * that they are ignored.
164
- */ fallback: getFallbacks(config.polyfills),
165
- /**
177
+ */
178
+ fallback: _chunk7SN4Y44Hjs.getFallbacks.call(void 0, config.polyfills),
179
+ /**
166
180
  * The plugins to use. We use the {@link SnapsBuiltInResolver} to show
167
181
  * warnings about using Node.js built-ins, when no fallback is specified.
168
- */ plugins: [
169
- builtInResolver
170
- ]
171
- },
172
- /**
182
+ */
183
+ plugins: [builtInResolver]
184
+ },
185
+ /**
173
186
  * The plugins to use.
174
187
  *
175
188
  * @see https://webpack.js.org/configuration/plugins/
176
- */ plugins: [
177
- /**
189
+ */
190
+ plugins: [
191
+ /**
178
192
  * The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates
179
193
  * the manifest file, and evaluates the bundle in SES. While not strictly
180
194
  * required, it's highly recommended to use this plugin.
181
- */ new SnapsWebpackPlugin({
182
- manifestPath: config.manifest.path,
183
- writeManifest: config.manifest.update,
184
- eval: !options.watch && options.evaluate
185
- }),
186
- /**
195
+ */
196
+ new (0, _snapswebpackplugin2.default)({
197
+ manifestPath: config.manifest.path,
198
+ writeManifest: config.manifest.update,
199
+ eval: !options.watch && options.evaluate
200
+ }),
201
+ /**
187
202
  * The `SnapsStatsPlugin` is a Webpack plugin that handles the stats
188
203
  * output. It's used to show the stats in the terminal, in a format that
189
204
  * is easy to read.
190
- */ new SnapsStatsPlugin({
191
- verbose: config.stats.verbose
192
- }, options.spinner),
193
- /**
205
+ */
206
+ new (0, _chunkEQRMXKXYjs.SnapsStatsPlugin)({ verbose: config.stats.verbose }, options.spinner),
207
+ /**
194
208
  * The `DefinePlugin` is a Webpack plugin that adds static values to the
195
209
  * bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`
196
210
  * environment variables, as well as any custom environment
197
211
  * variables (as `process.env`).
198
- */ new DefinePlugin(getEnvironmentVariables(config.environment)),
199
- /**
212
+ */
213
+ new (0, _webpack.DefinePlugin)(_chunk7SN4Y44Hjs.getEnvironmentVariables.call(void 0, config.environment)),
214
+ /**
200
215
  * The `ProgressPlugin` is a Webpack plugin that logs the progress of
201
216
  * the build. We set it to log the progress to the spinner.
202
- */ new ProgressPlugin({
203
- handler: getProgressHandler(options.spinner, spinnerText)
204
- }),
205
- /**
217
+ */
218
+ new (0, _webpack.ProgressPlugin)({
219
+ handler: _chunk7SN4Y44Hjs.getProgressHandler.call(void 0, options.spinner, spinnerText)
220
+ }),
221
+ /**
206
222
  * The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a
207
223
  * warning when the bundle is potentially incompatible with MetaMask
208
224
  * Snaps.
209
- */ new SnapsBundleWarningsPlugin({
210
- builtInResolver,
211
- builtIns: Boolean(config.stats.builtIns),
212
- buffer: config.stats.buffer
213
- }),
214
- /**
225
+ */
226
+ new (0, _chunkEQRMXKXYjs.SnapsBundleWarningsPlugin)({
227
+ builtInResolver,
228
+ builtIns: Boolean(config.stats.builtIns),
229
+ buffer: config.stats.buffer
230
+ }),
231
+ /**
215
232
  * The `WatchPlugin` is a Webpack plugin that adds extra files to watch
216
233
  * for changes. This is useful for rebuilding the bundle when the
217
234
  * manifest file changes.
218
- */ options.watch && new SnapsWatchPlugin({
219
- bundle: resolve(config.output.path, config.output.filename),
220
- evaluate: options.evaluate,
221
- files: [
222
- config.manifest.path
223
- ]
224
- }, options.spinner),
225
- /**
235
+ */
236
+ options.watch && new (0, _chunkEQRMXKXYjs.SnapsWatchPlugin)(
237
+ {
238
+ bundle: _path.resolve.call(void 0, config.output.path, config.output.filename),
239
+ evaluate: options.evaluate,
240
+ files: [config.manifest.path]
241
+ },
242
+ options.spinner
243
+ ),
244
+ /**
226
245
  * The `ProviderPlugin` is a Webpack plugin that automatically load
227
246
  * modules instead of having to import or require them everywhere.
228
- */ (config.polyfills === true || config.polyfills !== false && config.polyfills.buffer) && new ProvidePlugin({
229
- Buffer: [
230
- 'buffer',
231
- 'Buffer'
232
- ]
233
- })
234
- ].filter(Boolean),
235
- /**
247
+ */
248
+ (config.polyfills === true || config.polyfills !== false && config.polyfills.buffer) && new (0, _webpack.ProvidePlugin)({
249
+ Buffer: ["buffer", "Buffer"]
250
+ })
251
+ ].filter(Boolean),
252
+ /**
236
253
  * The optimization configuration. This tells Webpack how to optimize the
237
254
  * bundle. Most of the time, you won't need to change this, as the default
238
255
  * options set by the `mode` option are sufficient.
239
- */ optimization: {
240
- minimize: config.output.minimize,
241
- /**
256
+ */
257
+ optimization: {
258
+ minimize: config.output.minimize,
259
+ /**
242
260
  * The minimizer to use. We set it to use the `TerserPlugin`.
243
- */ minimizer: [
244
- new TerserPlugin({
245
- parallel: true
246
- })
247
- ]
248
- },
249
- /**
261
+ */
262
+ minimizer: [
263
+ new (0, _terserwebpackplugin2.default)({
264
+ parallel: true
265
+ })
266
+ ]
267
+ },
268
+ /**
250
269
  * The performance configuration. This tells Webpack how to handle
251
270
  * performance hints.
252
271
  *
253
272
  * @see https://webpack.js.org/configuration/performance/
254
- */ performance: {
255
- /**
273
+ */
274
+ performance: {
275
+ /**
256
276
  * The hints to show. We set it to `false`, so that we don't get
257
277
  * performance hints, as they are not relevant for Snaps.
258
278
  *
259
279
  * @see https://webpack.js.org/configuration/performance/#performancehints
260
- */ hints: false
261
- },
262
- /**
280
+ */
281
+ hints: false
282
+ },
283
+ /**
263
284
  * The infrastructure logging configuration. This tells Webpack how to
264
285
  * log messages.
265
286
  *
266
287
  * @see https://webpack.js.org/configuration/infrastructure-logging
267
- */ infrastructureLogging: {
268
- /**
288
+ */
289
+ infrastructureLogging: {
290
+ /**
269
291
  * The level of logging to use. We set it to `none`, so that we can
270
292
  * control the output ourselves.
271
- */ level: 'none'
272
- }
273
- };
293
+ */
294
+ level: "none"
295
+ }
296
+ };
274
297
  }
275
298
 
276
- //# sourceMappingURL=config.js.map
299
+
300
+
301
+ exports.getDefaultConfiguration = getDefaultConfiguration;
302
+ //# sourceMappingURL=chunk-3LNPS7AX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/webpack/config.ts"],"names":[],"mappings":"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","sourcesContent":["import SnapsWebpackPlugin from '@metamask/snaps-webpack-plugin';\nimport type { Ora } from 'ora';\nimport { resolve } from 'path';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport type { Configuration } from 'webpack';\nimport { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { getFunctionLoader, wasm } from './loaders';\nimport {\n SnapsBuiltInResolver,\n SnapsBundleWarningsPlugin,\n SnapsStatsPlugin,\n SnapsWatchPlugin,\n} from './plugins';\nimport {\n BROWSERSLIST_FILE,\n getDefaultLoader,\n getDevTool,\n getEnvironmentVariables,\n getFallbacks,\n getProgressHandler,\n} from './utils';\n\nexport type WebpackOptions = {\n /**\n * Whether to watch for changes.\n */\n watch?: boolean;\n\n /**\n * Whether to evaluate the bundle. If this is set, it will override the\n * `evaluate` option in the config object.\n */\n evaluate?: boolean;\n\n /**\n * The spinner to use for logging.\n */\n spinner?: Ora;\n};\n\n/**\n * Get the default Webpack configuration. This is the configuration that will\n * be used if the user doesn't provide a custom Webpack configuration. The\n * configuration is based on the snap config.\n *\n * The default configuration includes:\n *\n * - `SWC` to transpile TypeScript and JavaScript files.\n * - `TerserPlugin` to minify the bundle.\n * - `SnapsWebpackPlugin` to validate the bundle and update the manifest.\n *\n * It can be customized through the `customizeWebpackConfig` function in the\n * snap config, but in most cases, you shouldn't need to do that.\n *\n * @param config - The processed snap Webpack config.\n * @param options - The Webpack options.\n * @returns The default Webpack configuration.\n */\nexport async function getDefaultConfiguration(\n config: ProcessedWebpackConfig,\n options: WebpackOptions = {\n evaluate: config.evaluate,\n },\n): Promise<Configuration> {\n const spinnerText = options.spinner?.text;\n const builtInResolver =\n config.stats.builtIns &&\n new SnapsBuiltInResolver(config.stats.builtIns, options.spinner);\n\n return {\n /**\n * The target is set to `browserslist` so that Webpack will compile the\n * bundle to support the browsers specified in the `.browserslistrc` file.\n * This Browserslist file contains the browsers that are supported by\n * MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/target/\n */\n target: `browserslist:${BROWSERSLIST_FILE}`,\n\n /**\n * The mode is set to `production` by default, so that Webpack will minify\n * and optimize the bundle.\n *\n * @see https://webpack.js.org/configuration/mode/\n */\n mode: 'production',\n\n /**\n * The entry point is set to the `input` value from the config object.\n *\n * @see https://webpack.js.org/configuration/entry-context/\n */\n entry: config.input,\n\n /**\n * The devtool option controls how source maps are generated. We set it to\n * the `sourceMap` value from the config object.\n *\n * @see https://webpack.js.org/configuration/devtool/\n */\n devtool: getDevTool(config.sourceMap),\n\n /**\n * The stats option controls how much information is printed to the console\n * when Webpack is running. We set it to `none` so that we can control the\n * output ourselves.\n *\n * @see https://webpack.js.org/configuration/stats/\n */\n stats: 'none',\n\n /**\n * The output options.\n *\n * @see https://webpack.js.org/configuration/output/\n */\n output: {\n /**\n * This indicates whether Webpack should clear the output directory\n * before building. We set it to the `clean` value from the config\n * object.\n *\n * @see https://webpack.js.org/configuration/output/#outputclean\n */\n clean: config.output.clean,\n\n /**\n * The filename of the bundle. We set it to the `filename` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputfilename\n */\n filename: config.output.filename,\n\n /**\n * The path to the output directory. We set it to the `path` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputpath\n */\n path: config.output.path,\n\n /**\n * The public path of the bundle. We set it to `/` by default, so that\n * the bundle can be loaded from the root of the server.\n *\n * @see https://webpack.js.org/configuration/output/#outputpublicpath\n */\n publicPath: '/',\n\n /**\n * The library configuration. This tells Webpack how to export the\n * bundle.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrary\n */\n library: {\n /**\n * This tells Webpack to export the bundle as a CommonJS module. This\n * is necessary for MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrarytarget\n */\n type: 'commonjs',\n },\n\n /**\n * The chunk format. This tells Webpack how to export chunks. This is\n * required because we use browserslist to target browsers, but Snaps are\n * not fully compatible with browser APIs (such as `window` and\n * `document`).\n *\n * @see https://webpack.js.org/configuration/output/#outputchunkformat\n */\n chunkFormat: 'commonjs',\n },\n\n /**\n * The module configuration. This is where we tell Webpack how to handle\n * different types of files.\n *\n * @see https://webpack.js.org/configuration/module/\n */\n module: {\n rules: [\n {\n test: /\\.(js|mjs|cjs|ts)$/u,\n exclude: /node_modules/u,\n use: await getDefaultLoader(config),\n },\n\n /**\n * This allows importing modules that uses `.js` and not `.mjs` for the\n * ES build.\n *\n * @see https://webpack.js.org/configuration/module/#resolvefullyspecified\n */\n {\n test: /\\.m?js/u,\n resolve: {\n fullySpecified: false,\n },\n },\n\n config.experimental.wasm && {\n test: /\\.wasm$/u,\n use: getFunctionLoader(wasm, {}),\n },\n ],\n },\n\n /**\n * The resolve configuration. This tells Webpack how to resolve imports.\n * We set it to resolve `.js` and `.ts` files.\n *\n * @see https://webpack.js.org/configuration/resolve/\n */\n resolve: {\n /**\n * The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`\n * files.\n */\n extensions: ['.js', '.mjs', '.cjs', '.ts'],\n\n /**\n * The fallback options. This tells Webpack how to handle imports that\n * aren't resolved. By default, we set Node.js built-ins to `false`, so\n * that they are ignored.\n */\n fallback: getFallbacks(config.polyfills),\n\n /**\n * The plugins to use. We use the {@link SnapsBuiltInResolver} to show\n * warnings about using Node.js built-ins, when no fallback is specified.\n */\n plugins: [builtInResolver],\n },\n\n /**\n * The plugins to use.\n *\n * @see https://webpack.js.org/configuration/plugins/\n */\n plugins: [\n /**\n * The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates\n * the manifest file, and evaluates the bundle in SES. While not strictly\n * required, it's highly recommended to use this plugin.\n */\n new SnapsWebpackPlugin({\n manifestPath: config.manifest.path,\n writeManifest: config.manifest.update,\n eval: !options.watch && options.evaluate,\n }),\n\n /**\n * The `SnapsStatsPlugin` is a Webpack plugin that handles the stats\n * output. It's used to show the stats in the terminal, in a format that\n * is easy to read.\n */\n new SnapsStatsPlugin({ verbose: config.stats.verbose }, options.spinner),\n\n /**\n * The `DefinePlugin` is a Webpack plugin that adds static values to the\n * bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`\n * environment variables, as well as any custom environment\n * variables (as `process.env`).\n */\n new DefinePlugin(getEnvironmentVariables(config.environment)),\n\n /**\n * The `ProgressPlugin` is a Webpack plugin that logs the progress of\n * the build. We set it to log the progress to the spinner.\n */\n new ProgressPlugin({\n handler: getProgressHandler(options.spinner, spinnerText),\n }),\n\n /**\n * The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a\n * warning when the bundle is potentially incompatible with MetaMask\n * Snaps.\n */\n new SnapsBundleWarningsPlugin({\n builtInResolver,\n builtIns: Boolean(config.stats.builtIns),\n buffer: config.stats.buffer,\n }),\n\n /**\n * The `WatchPlugin` is a Webpack plugin that adds extra files to watch\n * for changes. This is useful for rebuilding the bundle when the\n * manifest file changes.\n */\n options.watch &&\n new SnapsWatchPlugin(\n {\n bundle: resolve(config.output.path, config.output.filename),\n evaluate: options.evaluate,\n files: [config.manifest.path],\n },\n options.spinner,\n ),\n\n /**\n * The `ProviderPlugin` is a Webpack plugin that automatically load\n * modules instead of having to import or require them everywhere.\n */\n (config.polyfills === true ||\n (config.polyfills !== false && config.polyfills.buffer)) &&\n new ProvidePlugin({\n Buffer: ['buffer', 'Buffer'],\n }),\n ].filter(Boolean),\n\n /**\n * The optimization configuration. This tells Webpack how to optimize the\n * bundle. Most of the time, you won't need to change this, as the default\n * options set by the `mode` option are sufficient.\n */\n optimization: {\n minimize: config.output.minimize,\n\n /**\n * The minimizer to use. We set it to use the `TerserPlugin`.\n */\n minimizer: [\n new TerserPlugin({\n parallel: true,\n }),\n ],\n },\n\n /**\n * The performance configuration. This tells Webpack how to handle\n * performance hints.\n *\n * @see https://webpack.js.org/configuration/performance/\n */\n performance: {\n /**\n * The hints to show. We set it to `false`, so that we don't get\n * performance hints, as they are not relevant for Snaps.\n *\n * @see https://webpack.js.org/configuration/performance/#performancehints\n */\n hints: false,\n },\n\n /**\n * The infrastructure logging configuration. This tells Webpack how to\n * log messages.\n *\n * @see https://webpack.js.org/configuration/infrastructure-logging\n */\n infrastructureLogging: {\n /**\n * The level of logging to use. We set it to `none`, so that we can\n * control the output ourselves.\n */\n level: 'none',\n },\n };\n}\n"]}
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/errors.ts
2
+ var _chalk = require('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 = _chalk.bold.call(void 0, _chalk.red.call(void 0, name));
9
+ }
10
+ };
11
+ var ConfigError = class extends CommandError {
12
+ constructor(message) {
13
+ super(message, "Config Error");
14
+ }
15
+ };
16
+
17
+
18
+
19
+
20
+
21
+ exports.CLIError = CLIError; exports.CommandError = CommandError; exports.ConfigError = ConfigError;
22
+ //# sourceMappingURL=chunk-46JUPGRY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts"],"names":[],"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","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"]}
@@ -0,0 +1,54 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkWJNHZ4YFjs = require('./chunk-WJNHZ4YF.js');
4
+
5
+
6
+ var _chunkYURDB35Fjs = require('./chunk-YURDB35F.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/watch/watch.ts
18
+ var _node = require('@metamask/snaps-utils/node');
19
+ var steps = [
20
+ {
21
+ name: "Checking the input file.",
22
+ task: async ({ config }) => {
23
+ const { input } = config;
24
+ if (!await _node.isFile.call(void 0, input)) {
25
+ throw new (0, _chunk46JUPGRYjs.CommandError)(
26
+ `Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`
27
+ );
28
+ }
29
+ }
30
+ },
31
+ {
32
+ name: "Starting the development server.",
33
+ condition: ({ config }) => config.server.enabled,
34
+ task: async ({ config, options, spinner }) => {
35
+ const server = _chunkYURDB35Fjs.getServer.call(void 0, config);
36
+ const { port } = await server.listen(_nullishCoalesce(options.port, () => ( config.server.port)));
37
+ _chunkG3IYVYVRjs.info.call(void 0, `The server is listening on http://localhost:${port}.`, spinner);
38
+ }
39
+ },
40
+ {
41
+ name: "Building the snap bundle.",
42
+ task: async ({ config, spinner }) => {
43
+ await _chunkWJNHZ4YFjs.watch.call(void 0, config, { spinner });
44
+ }
45
+ }
46
+ ];
47
+ async function watchHandler(config, options) {
48
+ await _chunk5DDAAM2Xjs.executeSteps.call(void 0, steps, { config, options });
49
+ }
50
+
51
+
52
+
53
+ exports.watchHandler = watchHandler;
54
+ //# sourceMappingURL=chunk-4NHBPMKT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/watch/watch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AAqBvB,IAAM,QAA6B;AAAA,EACjC;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,OAAO,MAAM;AAC1B,YAAM,EAAE,MAAM,IAAI;AAElB,UAAI,CAAE,MAAM,OAAO,KAAK,GAAI;AAC1B,cAAM,IAAI;AAAA,UACR,0BAA0B,KAAK;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO,OAAO;AAAA,IACzC,MAAM,OAAO,EAAE,QAAQ,SAAS,QAAQ,MAAM;AAC5C,YAAM,SAAS,UAAU,MAAM;AAC/B,YAAM,EAAE,KAAK,IAAI,MAAM,OAAO,OAAO,QAAQ,QAAQ,OAAO,OAAO,IAAI;AAEvE,WAAK,+CAA+C,IAAI,KAAK,OAAO;AAAA,IACtE;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,QAAQ,QAAQ,MAAM;AACnC,YAAM,MAAM,QAAQ,EAAE,QAAQ,CAAC;AAAA,IACjC;AAAA,EACF;AACF;AAYA,eAAsB,aACpB,QACA,SACe;AACf,QAAM,aAAa,OAAO,EAAE,QAAQ,QAAQ,CAAC;AAC/C","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\nimport { watch } from './implementation';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedWebpackConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"]}
@@ -0,0 +1,52 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkHGYXRW5Bjs = require('./chunk-HGYXRW5B.js');
4
+
5
+
6
+ var _chunk5DDAAM2Xjs = require('./chunk-5DDAAM2X.js');
7
+
8
+
9
+ var _chunk46JUPGRYjs = require('./chunk-46JUPGRY.js');
10
+
11
+ // src/commands/manifest/manifest.ts
12
+ var _node = require('@metamask/snaps-utils/node');
13
+ var steps = [
14
+ {
15
+ name: "Checking the input file.",
16
+ task: async ({ input }) => {
17
+ if (!await _node.isFile.call(void 0, input)) {
18
+ throw new (0, _chunk46JUPGRYjs.CommandError)(
19
+ `Manifest file not found: "${input}". Make sure that the \`snap.manifest.json\` file exists.`
20
+ );
21
+ }
22
+ }
23
+ },
24
+ {
25
+ name: "Validating the snap manifest.",
26
+ task: async ({ input, config, options, spinner }) => {
27
+ const write = getWriteManifest(config, options);
28
+ const valid = await _chunkHGYXRW5Bjs.manifest.call(void 0, input, write, spinner);
29
+ if (valid) {
30
+ spinner.succeed("The snap manifest file is valid.");
31
+ }
32
+ }
33
+ }
34
+ ];
35
+ function getWriteManifest(config, options) {
36
+ if (typeof options.fix === "boolean") {
37
+ return options.fix;
38
+ }
39
+ return _nullishCoalesce(_optionalChain([config, 'access', _ => _.legacy, 'optionalAccess', _2 => _2.writeManifest]), () => ( false));
40
+ }
41
+ async function manifestHandler(config, options) {
42
+ await _chunk5DDAAM2Xjs.executeSteps.call(void 0, steps, {
43
+ input: config.manifest.path,
44
+ config,
45
+ options
46
+ });
47
+ }
48
+
49
+
50
+
51
+ exports.manifestHandler = manifestHandler;
52
+ //# sourceMappingURL=chunk-4OKAI7AP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/manifest/manifest.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,SAAS,cAAc;AAkBvB,IAAM,QAAgC;AAAA,EACpC;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,MAAM,MAAM;AACzB,UAAI,CAAE,MAAM,OAAO,KAAK,GAAI;AAC1B,cAAM,IAAI;AAAA,UACR,6BAA6B,KAAK;AAAA,QACpC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM,OAAO,EAAE,OAAO,QAAQ,SAAS,QAAQ,MAAM;AACnD,YAAM,QAAQ,iBAAiB,QAAQ,OAAO;AAC9C,YAAM,QAAQ,MAAM,SAAS,OAAO,OAAO,OAAO;AAElD,UAAI,OAAO;AACT,gBAAQ,QAAQ,kCAAkC;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AACF;AASA,SAAS,iBAAiB,QAAyB,SAA0B;AAC3E,MAAI,OAAO,QAAQ,QAAQ,WAAW;AACpC,WAAO,QAAQ;AAAA,EACjB;AAEA,SAAO,OAAO,QAAQ,iBAAiB;AACzC;AAUA,eAAsB,gBACpB,QACA,SACA;AACA,QAAM,aAAa,OAAO;AAAA,IACxB,OAAO,OAAO,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,EACF,CAAC;AACH","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps } from '../../utils';\nimport { manifest } from './implementation';\n\ntype ManifestOptions = {\n fix?: boolean;\n};\n\ntype ManifestContext = {\n input: string;\n config: ProcessedConfig;\n options: ManifestOptions;\n};\n\nconst steps: Steps<ManifestContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n throw new CommandError(\n `Manifest file not found: \"${input}\". Make sure that the \\`snap.manifest.json\\` file exists.`,\n );\n }\n },\n },\n {\n name: 'Validating the snap manifest.',\n task: async ({ input, config, options, spinner }) => {\n const write = getWriteManifest(config, options);\n const valid = await manifest(input, write, spinner);\n\n if (valid) {\n spinner.succeed('The snap manifest file is valid.');\n }\n },\n },\n];\n\n/**\n * Get whether to write the manifest to disk.\n *\n * @param config - The config object.\n * @param options - The options object.\n * @returns Whether to write the manifest to disk.\n */\nfunction getWriteManifest(config: ProcessedConfig, options: ManifestOptions) {\n if (typeof options.fix === 'boolean') {\n return options.fix;\n }\n\n return config.legacy?.writeManifest ?? false;\n}\n\n/**\n * Validates a snap.manifest.json file. Attempts to fix the manifest and write\n * the fixed version to disk if `writeManifest` is true. Throws if validation\n * fails.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function manifestHandler(\n config: ProcessedConfig,\n options: ManifestOptions,\n) {\n await executeSteps(steps, {\n input: config.manifest.path,\n config,\n options,\n });\n}\n"]}