@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
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- getYargsErrorMessage: function() {
13
- return getYargsErrorMessage;
14
- },
15
- getErrorMessage: function() {
16
- return getErrorMessage;
17
- }
18
- });
19
- const _utils = require("@metamask/utils");
20
- const _errors = require("../errors");
21
- function getYargsErrorMessage(message, error) {
22
- if (error) {
23
- if (error instanceof _errors.CLIError) {
24
- return error.message;
25
- }
26
- return getErrorMessage(error);
27
- }
28
- return message;
29
- }
30
- function getErrorMessage(error) {
31
- if ((0, _utils.isObject)(error)) {
32
- if ((0, _utils.hasProperty)(error, 'stack') && typeof error.stack === 'string') {
33
- return error.stack;
34
- }
35
- if ((0, _utils.hasProperty)(error, 'message') && typeof error.message === 'string') {
36
- return error.message;
37
- }
38
- }
39
- return String(error);
40
- }
41
-
42
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/errors.ts"],"sourcesContent":["import { hasProperty, isObject } from '@metamask/utils';\n\nimport { CLIError } from '../errors';\n\n/**\n * Get the error message from an error in a Yargs `fail` handler. If the error\n * is not `undefined`, {@link getErrorMessage} is used to get the error message.\n * Otherwise, the given message is returned.\n *\n * @param message - The error message.\n * @param error - The error object. This may be `undefined`.\n * @returns The error message.\n */\nexport function getYargsErrorMessage(message: string, error?: unknown): string {\n if (error) {\n if (error instanceof CLIError) {\n return error.message;\n }\n\n return getErrorMessage(error);\n }\n\n return message;\n}\n\n/**\n * Get the error message from an error.\n *\n * - If the error is an object with a `stack` property, the `stack` property is\n * returned.\n * - If the error is an object with a `message` property, the `message`\n * property is returned.\n * - Otherwise, the error is converted to a string and returned.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n */\nexport function getErrorMessage(error: unknown): string {\n if (isObject(error)) {\n if (hasProperty(error, 'stack') && typeof error.stack === 'string') {\n return error.stack;\n }\n\n if (hasProperty(error, 'message') && typeof error.message === 'string') {\n return error.message;\n }\n }\n\n return String(error);\n}\n"],"names":["getYargsErrorMessage","getErrorMessage","message","error","CLIError","isObject","hasProperty","stack","String"],"mappings":";;;;;;;;;;;IAagBA,oBAAoB;eAApBA;;IAwBAC,eAAe;eAAfA;;;uBArCsB;wBAEb;AAWlB,SAASD,qBAAqBE,OAAe,EAAEC,KAAe;IACnE,IAAIA,OAAO;QACT,IAAIA,iBAAiBC,gBAAQ,EAAE;YAC7B,OAAOD,MAAMD,OAAO;QACtB;QAEA,OAAOD,gBAAgBE;IACzB;IAEA,OAAOD;AACT;AAcO,SAASD,gBAAgBE,KAAc;IAC5C,IAAIE,IAAAA,eAAQ,EAACF,QAAQ;QACnB,IAAIG,IAAAA,kBAAW,EAACH,OAAO,YAAY,OAAOA,MAAMI,KAAK,KAAK,UAAU;YAClE,OAAOJ,MAAMI,KAAK;QACpB;QAEA,IAAID,IAAAA,kBAAW,EAACH,OAAO,cAAc,OAAOA,MAAMD,OAAO,KAAK,UAAU;YACtE,OAAOC,MAAMD,OAAO;QACtB;IACF;IAEA,OAAOM,OAAOL;AAChB"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./cli"), exports);
6
- _export_star(require("./errors"), exports);
7
- _export_star(require("./legacy"), exports);
8
- _export_star(require("./logging"), exports);
9
- _export_star(require("./path"), exports);
10
- _export_star(require("./steps"), exports);
11
- function _export_star(from, to) {
12
- Object.keys(from).forEach(function(k) {
13
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
14
- Object.defineProperty(to, k, {
15
- enumerable: true,
16
- get: function() {
17
- return from[k];
18
- }
19
- });
20
- }
21
- });
22
- return from;
23
- }
24
-
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from './cli';\nexport * from './errors';\nexport * from './legacy';\nexport * from './logging';\nexport * from './path';\nexport * from './steps';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- processDependencies: function() {
13
- return processDependencies;
14
- },
15
- getDependencyRegExp: function() {
16
- return getDependencyRegExp;
17
- },
18
- sanitizeDependencyPaths: function() {
19
- return sanitizeDependencyPaths;
20
- }
21
- });
22
- const _builders = require("../builders");
23
- function processDependencies(config) {
24
- const { depsToTranspile, transpilationMode } = config;
25
- if (transpilationMode === _builders.TranspilationModes.LocalAndDeps) {
26
- const regex = getDependencyRegExp(depsToTranspile);
27
- if (regex !== null) {
28
- return [
29
- regex
30
- ];
31
- }
32
- }
33
- return [];
34
- }
35
- function getDependencyRegExp(dependencies) {
36
- if (!dependencies || dependencies.includes('.') || !dependencies.length) {
37
- return null;
38
- }
39
- const paths = sanitizeDependencyPaths(dependencies);
40
- return RegExp(`/node_modules/(?!${paths.join('|')})`, 'u');
41
- }
42
- function sanitizeDependencyPaths(dependencies) {
43
- return dependencies.map((dependency)=>{
44
- return dependency.replace(/^[/\\]+/u, '').replace(/[/\\]+$/u, '');
45
- });
46
- }
47
-
48
- //# sourceMappingURL=legacy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/legacy.ts"],"sourcesContent":["import { TranspilationModes } from '../builders';\nimport type { LegacyOptions } from '../config';\n\n/**\n * Get the dependencies to transpile, as well as the regular input file.\n *\n * If `transpilationMode` is not set to `localAndDeps`, this will return an\n * empty array.\n *\n * @param config - The config object.\n * @returns An array with regular expressions of dependencies that should be\n * transpiled.\n */\nexport function processDependencies(config: LegacyOptions) {\n const { depsToTranspile, transpilationMode } = config;\n if (transpilationMode === TranspilationModes.LocalAndDeps) {\n const regex = getDependencyRegExp(depsToTranspile);\n if (regex !== null) {\n return [regex];\n }\n }\n\n return [];\n}\n\n/**\n * Processes a string of space delimited dependencies into one RegExp string.\n *\n * @param dependencies - An array of dependencies to add to the RegExp.\n * @returns A RegExp object.\n */\nexport function getDependencyRegExp(dependencies: string[]): RegExp | null {\n if (!dependencies || dependencies.includes('.') || !dependencies.length) {\n return null;\n }\n\n const paths: string[] = sanitizeDependencyPaths(dependencies);\n return RegExp(`/node_modules/(?!${paths.join('|')})`, 'u');\n}\n\n/**\n * Helper function to remove any leading and trailing slashes from dependency\n * list.\n *\n * @param dependencies - An array of dependencies to sanitize.\n * @returns An array of sanitized paths.\n */\nexport function sanitizeDependencyPaths(dependencies: string[]): string[] {\n return dependencies.map((dependency) => {\n return dependency.replace(/^[/\\\\]+/u, '').replace(/[/\\\\]+$/u, '');\n });\n}\n"],"names":["processDependencies","getDependencyRegExp","sanitizeDependencyPaths","config","depsToTranspile","transpilationMode","TranspilationModes","LocalAndDeps","regex","dependencies","includes","length","paths","RegExp","join","map","dependency","replace"],"mappings":";;;;;;;;;;;IAagBA,mBAAmB;eAAnBA;;IAkBAC,mBAAmB;eAAnBA;;IAgBAC,uBAAuB;eAAvBA;;;0BA/CmB;AAa5B,SAASF,oBAAoBG,MAAqB;IACvD,MAAM,EAAEC,eAAe,EAAEC,iBAAiB,EAAE,GAAGF;IAC/C,IAAIE,sBAAsBC,4BAAkB,CAACC,YAAY,EAAE;QACzD,MAAMC,QAAQP,oBAAoBG;QAClC,IAAII,UAAU,MAAM;YAClB,OAAO;gBAACA;aAAM;QAChB;IACF;IAEA,OAAO,EAAE;AACX;AAQO,SAASP,oBAAoBQ,YAAsB;IACxD,IAAI,CAACA,gBAAgBA,aAAaC,QAAQ,CAAC,QAAQ,CAACD,aAAaE,MAAM,EAAE;QACvE,OAAO;IACT;IAEA,MAAMC,QAAkBV,wBAAwBO;IAChD,OAAOI,OAAO,CAAC,iBAAiB,EAAED,MAAME,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;AACxD;AASO,SAASZ,wBAAwBO,YAAsB;IAC5D,OAAOA,aAAaM,GAAG,CAAC,CAACC;QACvB,OAAOA,WAAWC,OAAO,CAAC,YAAY,IAAIA,OAAO,CAAC,YAAY;IAChE;AACF"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- warn: function() {
13
- return warn;
14
- },
15
- info: function() {
16
- return info;
17
- },
18
- error: function() {
19
- return error;
20
- }
21
- });
22
- const _snapsutils = require("@metamask/snaps-utils");
23
- const _chalk = require("chalk");
24
- function warn(message, spinner) {
25
- if (spinner) {
26
- spinner.clear();
27
- spinner.frame();
28
- }
29
- (0, _snapsutils.logWarning)(`${(0, _chalk.yellow)('⚠')} ${message}`);
30
- }
31
- function info(message, spinner) {
32
- if (spinner) {
33
- spinner.clear();
34
- spinner.frame();
35
- }
36
- (0, _snapsutils.logInfo)(`${(0, _chalk.blue)('ℹ')} ${(0, _chalk.dim)(message)}`);
37
- }
38
- function error(message, spinner) {
39
- if (spinner) {
40
- spinner.clear();
41
- spinner.frame();
42
- }
43
- (0, _snapsutils.logError)(`${(0, _chalk.red)('✖')} ${message}`);
44
- }
45
-
46
- //# sourceMappingURL=logging.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/logging.ts"],"sourcesContent":["import { logError, logInfo, logWarning } from '@metamask/snaps-utils';\nimport { blue, dim, red, yellow } from 'chalk';\nimport type { Ora } from 'ora';\n\n/**\n * Log a warning message. The message is prefixed with \"Warning:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function warn(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logWarning(`${yellow('⚠')} ${message}`);\n}\n\n/**\n * Log an info message.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function info(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logInfo(`${blue('ℹ')} ${dim(message)}`);\n}\n\n/**\n * Log an error message. The message is prefixed with \"Error:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function error(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logError(`${red('✖')} ${message}`);\n}\n"],"names":["warn","info","error","message","spinner","clear","frame","logWarning","yellow","logInfo","blue","dim","logError","red"],"mappings":";;;;;;;;;;;IAUgBA,IAAI;eAAJA;;IAeAC,IAAI;eAAJA;;IAeAC,KAAK;eAALA;;;4BAxC8B;uBACP;AAShC,SAASF,KAAKG,OAAe,EAAEC,OAAa;IACjD,IAAIA,SAAS;QACXA,QAAQC,KAAK;QACbD,QAAQE,KAAK;IACf;IAEAC,IAAAA,sBAAU,EAAC,CAAC,EAAEC,IAAAA,aAAM,EAAC,KAAK,CAAC,EAAEL,QAAQ,CAAC;AACxC;AAQO,SAASF,KAAKE,OAAe,EAAEC,OAAa;IACjD,IAAIA,SAAS;QACXA,QAAQC,KAAK;QACbD,QAAQE,KAAK;IACf;IAEAG,IAAAA,mBAAO,EAAC,CAAC,EAAEC,IAAAA,WAAI,EAAC,KAAK,CAAC,EAAEC,IAAAA,UAAG,EAACR,SAAS,CAAC;AACxC;AAQO,SAASD,MAAMC,OAAe,EAAEC,OAAa;IAClD,IAAIA,SAAS;QACXA,QAAQC,KAAK;QACbD,QAAQE,KAAK;IACf;IAEAM,IAAAA,oBAAQ,EAAC,CAAC,EAAEC,IAAAA,UAAG,EAAC,KAAK,CAAC,EAAEV,QAAQ,CAAC;AACnC"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getRelativePath", {
6
- enumerable: true,
7
- get: function() {
8
- return getRelativePath;
9
- }
10
- });
11
- const _path = require("path");
12
- function getRelativePath(absolutePath, cwd = process.cwd()) {
13
- return (0, _path.relative)(cwd, absolutePath);
14
- }
15
-
16
- //# sourceMappingURL=path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/path.ts"],"sourcesContent":["import { relative } from 'path';\n\n/**\n * Get the relative path from the current working directory to the given\n * absolute path.\n *\n * @param absolutePath - The absolute path.\n * @param cwd - The current working directory. Defaults to `process.cwd()`.\n * @returns The relative path.\n */\nexport function getRelativePath(absolutePath: string, cwd = process.cwd()) {\n return relative(cwd, absolutePath);\n}\n"],"names":["getRelativePath","absolutePath","cwd","process","relative"],"mappings":";;;;+BAUgBA;;;eAAAA;;;sBAVS;AAUlB,SAASA,gBAAgBC,YAAoB,EAAEC,MAAMC,QAAQD,GAAG,EAAE;IACvE,OAAOE,IAAAA,cAAQ,EAACF,KAAKD;AACvB"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "executeSteps", {
6
- enumerable: true,
7
- get: function() {
8
- return executeSteps;
9
- }
10
- });
11
- const _chalk = require("chalk");
12
- const _ora = /*#__PURE__*/ _interop_require_default(require("ora"));
13
- const _errors = require("./errors");
14
- const _logging = require("./logging");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
20
- async function executeSteps(steps, context) {
21
- const spinner = (0, _ora.default)({
22
- // Ora writes to `process.stderr` by default.
23
- stream: process.stdout
24
- });
25
- spinner.start();
26
- try {
27
- for (const step of steps){
28
- // If the step has a condition, and it returns false, we skip the step.
29
- if (step.condition && !step.condition(context)) {
30
- continue;
31
- }
32
- // Calling `start` here instead of setting `spinner.text` seems to work
33
- // better when the process doesn't have a TTY.
34
- spinner.start((0, _chalk.dim)(step.name));
35
- await step.task({
36
- ...context,
37
- spinner
38
- });
39
- }
40
- // The spinner may have been stopped by a step, so we only succeed if it's
41
- // still spinning.
42
- if (spinner.isSpinning) {
43
- spinner.succeed('Done!');
44
- }
45
- } catch (_error) {
46
- (0, _logging.error)((0, _errors.getErrorMessage)(_error), spinner);
47
- spinner.stop();
48
- process.exitCode = 1;
49
- }
50
- }
51
-
52
- //# sourceMappingURL=steps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/steps.ts"],"sourcesContent":["import { dim } from 'chalk';\nimport type { Ora } from 'ora';\nimport createSpinner from 'ora';\n\nimport { getErrorMessage } from './errors';\nimport { error } from './logging';\n\nexport type Step<Context extends Record<string, unknown>> = {\n name: string;\n condition?: (context: Context) => boolean;\n task: (context: Context & { spinner: Ora }) => Promise<void>;\n};\n\nexport type Steps<Context extends Record<string, unknown>> = Readonly<\n Step<Context>[]\n>;\n\n/**\n * Execute a list of steps in series. Each step receives the context object and\n * a spinner instance.\n *\n * @param steps - The steps to execute.\n * @param context - The context object that will be passed to each step.\n */\nexport async function executeSteps<Context extends Record<string, unknown>>(\n steps: Steps<Context>,\n context: Context,\n) {\n const spinner = createSpinner({\n // Ora writes to `process.stderr` by default.\n stream: process.stdout,\n });\n\n spinner.start();\n\n try {\n for (const step of steps) {\n // If the step has a condition, and it returns false, we skip the step.\n if (step.condition && !step.condition(context)) {\n continue;\n }\n\n // Calling `start` here instead of setting `spinner.text` seems to work\n // better when the process doesn't have a TTY.\n spinner.start(dim(step.name));\n\n await step.task({\n ...context,\n spinner,\n });\n }\n\n // The spinner may have been stopped by a step, so we only succeed if it's\n // still spinning.\n if (spinner.isSpinning) {\n spinner.succeed('Done!');\n }\n } catch (_error) {\n error(getErrorMessage(_error), spinner);\n spinner.stop();\n process.exitCode = 1;\n }\n}\n"],"names":["executeSteps","steps","context","spinner","createSpinner","stream","process","stdout","start","step","condition","dim","name","task","isSpinning","succeed","_error","error","getErrorMessage","stop","exitCode"],"mappings":";;;;+BAwBsBA;;;eAAAA;;;uBAxBF;4DAEM;wBAEM;yBACV;;;;;;AAmBf,eAAeA,aACpBC,KAAqB,EACrBC,OAAgB;IAEhB,MAAMC,UAAUC,IAAAA,YAAa,EAAC;QAC5B,6CAA6C;QAC7CC,QAAQC,QAAQC,MAAM;IACxB;IAEAJ,QAAQK,KAAK;IAEb,IAAI;QACF,KAAK,MAAMC,QAAQR,MAAO;YACxB,uEAAuE;YACvE,IAAIQ,KAAKC,SAAS,IAAI,CAACD,KAAKC,SAAS,CAACR,UAAU;gBAC9C;YACF;YAEA,uEAAuE;YACvE,8CAA8C;YAC9CC,QAAQK,KAAK,CAACG,IAAAA,UAAG,EAACF,KAAKG,IAAI;YAE3B,MAAMH,KAAKI,IAAI,CAAC;gBACd,GAAGX,OAAO;gBACVC;YACF;QACF;QAEA,0EAA0E;QAC1E,kBAAkB;QAClB,IAAIA,QAAQW,UAAU,EAAE;YACtBX,QAAQY,OAAO,CAAC;QAClB;IACF,EAAE,OAAOC,QAAQ;QACfC,IAAAA,cAAK,EAACC,IAAAA,uBAAe,EAACF,SAASb;QAC/BA,QAAQgB,IAAI;QACZb,QAAQc,QAAQ,GAAG;IACrB;AACF"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getCompiler", {
6
- enumerable: true,
7
- get: function() {
8
- return getCompiler;
9
- }
10
- });
11
- const _webpack = require("webpack");
12
- const _config = require("./config");
13
- async function getCompiler(config, options) {
14
- const baseWebpackConfig = await (0, _config.getDefaultConfiguration)(config, options);
15
- const webpackConfig = config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;
16
- return (0, _webpack.webpack)(webpackConfig);
17
- }
18
-
19
- //# sourceMappingURL=compiler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/webpack/compiler.ts"],"sourcesContent":["import { webpack } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport type { WebpackOptions } from './config';\nimport { getDefaultConfiguration } from './config';\n\n/**\n * Get a Webpack compiler for the given config.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns The Webpack compiler.\n */\nexport async function getCompiler(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const baseWebpackConfig = await getDefaultConfiguration(config, options);\n const webpackConfig =\n config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;\n\n return webpack(webpackConfig);\n}\n"],"names":["getCompiler","config","options","baseWebpackConfig","getDefaultConfiguration","webpackConfig","customizeWebpackConfig","webpack"],"mappings":";;;;+BAasBA;;;eAAAA;;;yBAbE;wBAIgB;AASjC,eAAeA,YACpBC,MAA8B,EAC9BC,OAAwB;IAExB,MAAMC,oBAAoB,MAAMC,IAAAA,+BAAuB,EAACH,QAAQC;IAChE,MAAMG,gBACJJ,OAAOK,sBAAsB,GAAGH,sBAAsBA;IAExD,OAAOI,IAAAA,gBAAO,EAACF;AACjB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/webpack/config.ts"],"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 {\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: {\n loader: resolve(__dirname, 'loaders', 'wasm'),\n },\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"],"names":["getDefaultConfiguration","config","options","evaluate","spinnerText","spinner","text","builtInResolver","stats","builtIns","SnapsBuiltInResolver","target","BROWSERSLIST_FILE","mode","entry","input","devtool","getDevTool","sourceMap","output","clean","filename","path","publicPath","library","type","chunkFormat","module","rules","test","exclude","use","getDefaultLoader","resolve","fullySpecified","experimental","wasm","loader","__dirname","extensions","fallback","getFallbacks","polyfills","plugins","SnapsWebpackPlugin","manifestPath","manifest","writeManifest","update","eval","watch","SnapsStatsPlugin","verbose","DefinePlugin","getEnvironmentVariables","environment","ProgressPlugin","handler","getProgressHandler","SnapsBundleWarningsPlugin","Boolean","buffer","SnapsWatchPlugin","bundle","files","ProvidePlugin","Buffer","filter","optimization","minimize","minimizer","TerserPlugin","parallel","performance","hints","infrastructureLogging","level"],"mappings":";;;;+BA2DsBA;;;eAAAA;;;2EA3DS;sBAEP;4EACC;yBAEmC;yBAQrD;uBAQA;;;;;;AAsCA,eAAeA,wBACpBC,MAA8B,EAC9BC,UAA0B;IACxBC,UAAUF,OAAOE,QAAQ;AAC3B,CAAC;IAED,MAAMC,cAAcF,QAAQG,OAAO,EAAEC;IACrC,MAAMC,kBACJN,OAAOO,KAAK,CAACC,QAAQ,IACrB,IAAIC,6BAAoB,CAACT,OAAOO,KAAK,CAACC,QAAQ,EAAEP,QAAQG,OAAO;IAEjE,OAAO;QACL;;;;;;;KAOC,GACDM,QAAQ,CAAC,aAAa,EAAEC,wBAAiB,CAAC,CAAC;QAE3C;;;;;KAKC,GACDC,MAAM;QAEN;;;;KAIC,GACDC,OAAOb,OAAOc,KAAK;QAEnB;;;;;KAKC,GACDC,SAASC,IAAAA,iBAAU,EAAChB,OAAOiB,SAAS;QAEpC;;;;;;KAMC,GACDV,OAAO;QAEP;;;;KAIC,GACDW,QAAQ;YACN;;;;;;OAMC,GACDC,OAAOnB,OAAOkB,MAAM,CAACC,KAAK;YAE1B;;;;;OAKC,GACDC,UAAUpB,OAAOkB,MAAM,CAACE,QAAQ;YAEhC;;;;;OAKC,GACDC,MAAMrB,OAAOkB,MAAM,CAACG,IAAI;YAExB;;;;;OAKC,GACDC,YAAY;YAEZ;;;;;OAKC,GACDC,SAAS;gBACP;;;;;SAKC,GACDC,MAAM;YACR;YAEA;;;;;;;OAOC,GACDC,aAAa;QACf;QAEA;;;;;KAKC,GACDC,QAAQ;YACNC,OAAO;gBACL;oBACEC,MAAM;oBACNC,SAAS;oBACTC,KAAK,MAAMC,IAAAA,uBAAgB,EAAC/B;gBAC9B;gBAEA;;;;;SAKC,GACD;oBACE4B,MAAM;oBACNI,SAAS;wBACPC,gBAAgB;oBAClB;gBACF;gBAEAjC,OAAOkC,YAAY,CAACC,IAAI,IAAI;oBAC1BP,MAAM;oBACNE,KAAK;wBACHM,QAAQJ,IAAAA,aAAO,EAACK,WAAW,WAAW;oBACxC;gBACF;aACD;QACH;QAEA;;;;;KAKC,GACDL,SAAS;YACP;;;OAGC,GACDM,YAAY;gBAAC;gBAAO;gBAAQ;gBAAQ;aAAM;YAE1C;;;;OAIC,GACDC,UAAUC,IAAAA,mBAAY,EAACxC,OAAOyC,SAAS;YAEvC;;;OAGC,GACDC,SAAS;gBAACpC;aAAgB;QAC5B;QAEA;;;;KAIC,GACDoC,SAAS;YACP;;;;OAIC,GACD,IAAIC,2BAAkB,CAAC;gBACrBC,cAAc5C,OAAO6C,QAAQ,CAACxB,IAAI;gBAClCyB,eAAe9C,OAAO6C,QAAQ,CAACE,MAAM;gBACrCC,MAAM,CAAC/C,QAAQgD,KAAK,IAAIhD,QAAQC,QAAQ;YAC1C;YAEA;;;;OAIC,GACD,IAAIgD,yBAAgB,CAAC;gBAAEC,SAASnD,OAAOO,KAAK,CAAC4C,OAAO;YAAC,GAAGlD,QAAQG,OAAO;YAEvE;;;;;OAKC,GACD,IAAIgD,qBAAY,CAACC,IAAAA,8BAAuB,EAACrD,OAAOsD,WAAW;YAE3D;;;OAGC,GACD,IAAIC,uBAAc,CAAC;gBACjBC,SAASC,IAAAA,yBAAkB,EAACxD,QAAQG,OAAO,EAAED;YAC/C;YAEA;;;;OAIC,GACD,IAAIuD,kCAAyB,CAAC;gBAC5BpD;gBACAE,UAAUmD,QAAQ3D,OAAOO,KAAK,CAACC,QAAQ;gBACvCoD,QAAQ5D,OAAOO,KAAK,CAACqD,MAAM;YAC7B;YAEA;;;;OAIC,GACD3D,QAAQgD,KAAK,IACX,IAAIY,yBAAgB,CAClB;gBACEC,QAAQ9B,IAAAA,aAAO,EAAChC,OAAOkB,MAAM,CAACG,IAAI,EAAErB,OAAOkB,MAAM,CAACE,QAAQ;gBAC1DlB,UAAUD,QAAQC,QAAQ;gBAC1B6D,OAAO;oBAAC/D,OAAO6C,QAAQ,CAACxB,IAAI;iBAAC;YAC/B,GACApB,QAAQG,OAAO;YAGnB;;;OAGC,GACAJ,CAAAA,OAAOyC,SAAS,KAAK,QACnBzC,OAAOyC,SAAS,KAAK,SAASzC,OAAOyC,SAAS,CAACmB,MAAM,KACtD,IAAII,sBAAa,CAAC;gBAChBC,QAAQ;oBAAC;oBAAU;iBAAS;YAC9B;SACH,CAACC,MAAM,CAACP;QAET;;;;KAIC,GACDQ,cAAc;YACZC,UAAUpE,OAAOkB,MAAM,CAACkD,QAAQ;YAEhC;;OAEC,GACDC,WAAW;gBACT,IAAIC,4BAAY,CAAC;oBACfC,UAAU;gBACZ;aACD;QACH;QAEA;;;;;KAKC,GACDC,aAAa;YACX;;;;;OAKC,GACDC,OAAO;QACT;QAEA;;;;;KAKC,GACDC,uBAAuB;YACrB;;;OAGC,GACDC,OAAO;QACT;IACF;AACF"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./compiler"), exports);
6
- _export_star(require("./config"), exports);
7
- _export_star(require("./plugins"), exports);
8
- _export_star(require("./server"), exports);
9
- function _export_star(from, to) {
10
- Object.keys(from).forEach(function(k) {
11
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
12
- Object.defineProperty(to, k, {
13
- enumerable: true,
14
- get: function() {
15
- return from[k];
16
- }
17
- });
18
- }
19
- });
20
- return from;
21
- }
22
-
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/webpack/index.ts"],"sourcesContent":["export * from './compiler';\nexport * from './config';\nexport * from './plugins';\nexport * from './server';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA"}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- const _browserify = /*#__PURE__*/ _interop_require_default(require("browserify"));
12
- const _readablestream = require("readable-stream");
13
- const _builders = require("../../builders");
14
- const _utils = require("../../utils");
15
- const _utils1 = require("../utils");
16
- function _interop_require_default(obj) {
17
- return obj && obj.__esModule ? obj : {
18
- default: obj
19
- };
20
- }
21
- /**
22
- * A Browserify loader for Webpack. This exists for backwards compatibility with
23
- * the legacy configuration format, in order to support the `bundlerCustomizer`
24
- * function.
25
- *
26
- * When this loader is used, the input file will be processed by Browserify, and
27
- * written to disk by Webpack. Most processing will be handled by Browserify, so
28
- * there are no benefits like tree-shaking.
29
- *
30
- * @param content - The input file contents as a string.
31
- * @param sourceMap - The source map of the input file.
32
- */ const loader = async function(content, sourceMap) {
33
- const config = this.getOptions();
34
- const { transpilationMode } = config;
35
- const bundler = (0, _browserify.default)({
36
- extensions: [
37
- '.js',
38
- '.ts'
39
- ],
40
- debug: Boolean(sourceMap),
41
- standalone: '<snap>'
42
- });
43
- if (transpilationMode !== _builders.TranspilationModes.None) {
44
- const babelifyOptions = (0, _utils.processDependencies)(config);
45
- // We need to statically import all Browserify transforms, and all Babel
46
- // presets and plugins, and calling `require` is the sanest way to do that.
47
- /* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */ bundler.transform(require('babelify'), {
48
- global: transpilationMode === _builders.TranspilationModes.LocalAndDeps,
49
- extensions: [
50
- '.js',
51
- '.ts'
52
- ],
53
- presets: [
54
- require('@babel/preset-typescript'),
55
- [
56
- require('@babel/preset-env'),
57
- {
58
- targets: {
59
- browsers: await (0, _utils1.getBrowserslistTargets)()
60
- }
61
- }
62
- ]
63
- ],
64
- plugins: [
65
- require('@babel/plugin-transform-runtime'),
66
- require('@babel/plugin-transform-class-properties'),
67
- require('@babel/plugin-transform-private-methods'),
68
- require('@babel/plugin-transform-class-static-block'),
69
- require('@babel/plugin-transform-private-property-in-object')
70
- ],
71
- ...babelifyOptions
72
- });
73
- /* eslint-enable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */ }
74
- config.bundlerCustomizer?.(bundler);
75
- // Browserify doesn't accept a string as an entry point, so we need to convert
76
- // it to a stream.
77
- const stream = new _readablestream.Readable();
78
- stream.push(content);
79
- stream.push(null);
80
- bundler.add(stream, {
81
- file: this.resourcePath
82
- });
83
- return new Promise((resolve, reject)=>{
84
- bundler.bundle((bundleError, buffer)=>{
85
- if (bundleError) {
86
- reject(bundleError);
87
- return;
88
- }
89
- // Browserify inlines the source map, so we just pass the output buffer back
90
- // to Webpack.
91
- resolve(buffer);
92
- });
93
- });
94
- };
95
- const _default = loader;
96
-
97
- //# sourceMappingURL=browserify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/webpack/loaders/browserify.ts"],"sourcesContent":["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"],"names":["loader","content","sourceMap","config","getOptions","transpilationMode","bundler","browserify","extensions","debug","Boolean","standalone","TranspilationModes","None","babelifyOptions","processDependencies","transform","require","global","LocalAndDeps","presets","targets","browsers","getBrowserslistTargets","plugins","bundlerCustomizer","stream","Readable","push","add","file","resourcePath","Promise","resolve","reject","bundle","bundleError","buffer"],"mappings":";;;;+BA6FA;;;eAAA;;;mEA7FuB;gCACE;0BAGU;uBAEC;wBACG;;;;;;AAEvC;;;;;;;;;;;CAWC,GACD,MAAMA,SAAkD,eACtDC,OAAO,EACPC,SAAS;IAET,MAAMC,SAAS,IAAI,CAACC,UAAU;IAE9B,MAAM,EAAEC,iBAAiB,EAAE,GAAGF;IAE9B,MAAMG,UAAUC,IAAAA,mBAAU,EAAC;QACzBC,YAAY;YAAC;YAAO;SAAM;QAC1BC,OAAOC,QAAQR;QACfS,YAAY;IACd;IAEA,IAAIN,sBAAsBO,4BAAkB,CAACC,IAAI,EAAE;QACjD,MAAMC,kBAAkBC,IAAAA,0BAAmB,EAACZ;QAE5C,wEAAwE;QACxE,2EAA2E;QAC3E,8GAA8G,GAC9GG,QAAQU,SAAS,CAACC,QAAQ,aAAa;YACrCC,QAAQb,sBAAsBO,4BAAkB,CAACO,YAAY;YAC7DX,YAAY;gBAAC;gBAAO;aAAM;YAC1BY,SAAS;gBACPH,QAAQ;gBACR;oBACEA,QAAQ;oBACR;wBACEI,SAAS;4BACPC,UAAU,MAAMC,IAAAA,8BAAsB;wBACxC;oBACF;iBACD;aACF;YACDC,SAAS;gBACPP,QAAQ;gBACRA,QAAQ;gBACRA,QAAQ;gBACRA,QAAQ;gBACRA,QAAQ;aACT;YACD,GAAIH,eAAe;QACrB;IACA,6GAA6G,GAC/G;IAEAX,OAAOsB,iBAAiB,GAAGnB;IAE3B,8EAA8E;IAC9E,kBAAkB;IAClB,MAAMoB,SAAS,IAAIC,wBAAQ;IAC3BD,OAAOE,IAAI,CAAC3B;IACZyB,OAAOE,IAAI,CAAC;IAEZtB,QAAQuB,GAAG,CAACH,QAAQ;QAClBI,MAAM,IAAI,CAACC,YAAY;IACzB;IAEA,OAAO,IAAIC,QAAgB,CAACC,SAASC;QACnC5B,QAAQ6B,MAAM,CAAC,CAACC,aAAaC;YAC3B,IAAID,aAAa;gBACfF,OAAOE;gBACP;YACF;YAEA,4EAA4E;YAC5E,cAAc;YACdH,QAAQI;QACV;IACF;AACF;MAEA,WAAerC"}
@@ -1,92 +0,0 @@
1
- /* eslint-disable no-restricted-globals */ "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- getImports: function() {
13
- return getImports;
14
- },
15
- getModuleImports: function() {
16
- return getModuleImports;
17
- },
18
- getExports: function() {
19
- return getExports;
20
- },
21
- default: function() {
22
- return _default;
23
- },
24
- raw: function() {
25
- return raw;
26
- }
27
- });
28
- const _utils = require("@metamask/utils");
29
- const _path = require("path");
30
- function getImports(importMap) {
31
- return Object.entries(importMap).map(([moduleName, exportNames])=>`import { ${exportNames.join(', ')} } from ${JSON.stringify(moduleName)};`).join('\n');
32
- }
33
- function getModuleImports(importMap) {
34
- return Object.entries(importMap).map(([moduleName, exportNames])=>`${JSON.stringify(moduleName)}: { ${exportNames.join(', ')} },`).join('\n');
35
- }
36
- function getExports(descriptors) {
37
- return descriptors.map((descriptor)=>{
38
- if (descriptor.name === 'default') {
39
- return `export default exports[${JSON.stringify(descriptor.name)}];`;
40
- }
41
- return `export const ${descriptor.name} = exports[${JSON.stringify(descriptor.name)}];`;
42
- }).join('\n');
43
- }
44
- /**
45
- * A Webpack loader that synchronously loads the WASM module. This makes it
46
- * possible to import the WASM module directly.
47
- *
48
- * @param source - The WASM module as `Uint8Array`.
49
- * @returns The WASM module as a JavaScript string.
50
- * @example
51
- * ```ts
52
- * import * as wasm from './program.wasm';
53
- *
54
- * // Do something with the WASM module...
55
- * ```
56
- */ // Note: This function needs to be defined like this, so that Webpack can bind
57
- // `this` to the loader context, and TypeScript can infer the type of `this`.
58
- const loader = async function loader(source) {
59
- (0, _utils.assert)(source instanceof Uint8Array, 'Expected source to be a Uint8Array.');
60
- const bytes = new Uint8Array(source);
61
- const wasmModule = await WebAssembly.compile(bytes);
62
- // eslint-disable-next-line @typescript-eslint/no-shadow
63
- const exports1 = WebAssembly.Module.exports(wasmModule);
64
- const imports = WebAssembly.Module.imports(wasmModule).reduce((target, descriptor)=>{
65
- var _target, _descriptor_module;
66
- (_target = target)[_descriptor_module = descriptor.module] ?? (_target[_descriptor_module] = []);
67
- target[descriptor.module].push(descriptor.name);
68
- return target;
69
- }, {});
70
- // Add the WASM import as a dependency so that Webpack will watch it for
71
- // changes.
72
- const path = (0, _path.dirname)(this.resourcePath);
73
- for (const name of Object.keys(imports)){
74
- this.addDependency((0, _path.resolve)(path, name));
75
- }
76
- return `
77
- ${getImports(imports)}
78
-
79
- const bytes = new Uint8Array(${JSON.stringify(Array.from(source))});
80
- const module = new WebAssembly.Module(bytes);
81
- const instance = new WebAssembly.Instance(module, {
82
- ${getModuleImports(imports)}
83
- });
84
-
85
- const exports = instance.exports;
86
- ${getExports(exports1)}
87
- `;
88
- };
89
- const _default = loader;
90
- const raw = true;
91
-
92
- //# sourceMappingURL=wasm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/webpack/loaders/wasm.ts"],"sourcesContent":["/* eslint-disable no-restricted-globals */\n\nimport { assert } from '@metamask/utils';\nimport { dirname, resolve } from 'path';\nimport type { LoaderDefinitionFunction } from 'webpack';\n\n/**\n * Get the imports code for the WASM module. This code imports each of the\n * imports from the WASM module.\n *\n * @param importMap - The import map for the WASM module.\n * @returns The imports code for the WASM module.\n */\nexport function getImports(importMap: Record<string, string[]>) {\n return Object.entries(importMap)\n .map(\n ([moduleName, exportNames]) =>\n `import { ${exportNames.join(', ')} } from ${JSON.stringify(\n moduleName,\n )};`,\n )\n .join('\\n');\n}\n\n/**\n * Get the imports code to use in `WebAssembly.Instance`. This code adds each of\n * the imports to the `imports` object.\n *\n * @param importMap - The import map for the WASM module.\n * @returns The imports code for the WASM module.\n */\nexport function getModuleImports(importMap: Record<string, string[]>) {\n return Object.entries(importMap)\n .map(\n ([moduleName, exportNames]) =>\n `${JSON.stringify(moduleName)}: { ${exportNames.join(', ')} },`,\n )\n .join('\\n');\n}\n\n/**\n * Get the exports code for the WASM module. This code exports each of the\n * exports from the WASM module as a variable. This function assumes that the\n * exports are available in a variable named `exports`.\n *\n * @param descriptors - The export descriptors from the WASM module.\n * @returns The exports code for the WASM module.\n */\nexport function getExports(descriptors: WebAssembly.ModuleExportDescriptor[]) {\n return descriptors\n .map((descriptor) => {\n if (descriptor.name === 'default') {\n return `export default exports[${JSON.stringify(descriptor.name)}];`;\n }\n\n return `export const ${descriptor.name} = exports[${JSON.stringify(\n descriptor.name,\n )}];`;\n })\n .join('\\n');\n}\n\n/**\n * A Webpack loader that synchronously loads the WASM module. This makes it\n * possible to import the WASM module directly.\n *\n * @param source - The WASM module as `Uint8Array`.\n * @returns The WASM module as a JavaScript string.\n * @example\n * ```ts\n * import * as wasm from './program.wasm';\n *\n * // Do something with the WASM module...\n * ```\n */\n// Note: This function needs to be defined like this, so that Webpack can bind\n// `this` to the loader context, and TypeScript can infer the type of `this`.\nconst loader: LoaderDefinitionFunction = async function loader(\n source: unknown,\n) {\n assert(source instanceof Uint8Array, 'Expected source to be a Uint8Array.');\n\n const bytes = new Uint8Array(source);\n const wasmModule = await WebAssembly.compile(bytes);\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const exports = WebAssembly.Module.exports(wasmModule);\n const imports = WebAssembly.Module.imports(wasmModule).reduce<\n Record<string, string[]>\n >((target, descriptor) => {\n target[descriptor.module] ??= [];\n target[descriptor.module].push(descriptor.name);\n\n return target;\n }, {});\n\n // Add the WASM import as a dependency so that Webpack will watch it for\n // changes.\n const path = dirname(this.resourcePath);\n for (const name of Object.keys(imports)) {\n this.addDependency(resolve(path, name));\n }\n\n return `\n ${getImports(imports)}\n\n const bytes = new Uint8Array(${JSON.stringify(Array.from(source))});\n const module = new WebAssembly.Module(bytes);\n const instance = new WebAssembly.Instance(module, {\n ${getModuleImports(imports)}\n });\n\n const exports = instance.exports;\n ${getExports(exports)}\n `;\n};\n\nexport default loader;\n\n// By setting `raw` to `true`, we are telling Webpack to provide the source as a\n// `Uint8Array` instead of converting it to a string. This allows us to avoid\n// having to convert the source back to a `Uint8Array` in the loader.\nexport const raw = true;\n"],"names":["getImports","getModuleImports","getExports","raw","importMap","Object","entries","map","moduleName","exportNames","join","JSON","stringify","descriptors","descriptor","name","loader","source","assert","Uint8Array","bytes","wasmModule","WebAssembly","compile","exports","Module","imports","reduce","target","module","push","path","dirname","resourcePath","keys","addDependency","resolve","Array","from"],"mappings":"AAAA,wCAAwC;;;;;;;;;;;IAaxBA,UAAU;eAAVA;;IAkBAC,gBAAgB;eAAhBA;;IAiBAC,UAAU;eAAVA;;IAqEhB,OAAsB;eAAtB;;IAKaC,GAAG;eAAHA;;;uBAxHU;sBACU;AAU1B,SAASH,WAAWI,SAAmC;IAC5D,OAAOC,OAAOC,OAAO,CAACF,WACnBG,GAAG,CACF,CAAC,CAACC,YAAYC,YAAY,GACxB,CAAC,SAAS,EAAEA,YAAYC,IAAI,CAAC,MAAM,QAAQ,EAAEC,KAAKC,SAAS,CACzDJ,YACA,CAAC,CAAC,EAEPE,IAAI,CAAC;AACV;AASO,SAAST,iBAAiBG,SAAmC;IAClE,OAAOC,OAAOC,OAAO,CAACF,WACnBG,GAAG,CACF,CAAC,CAACC,YAAYC,YAAY,GACxB,CAAC,EAAEE,KAAKC,SAAS,CAACJ,YAAY,IAAI,EAAEC,YAAYC,IAAI,CAAC,MAAM,GAAG,CAAC,EAElEA,IAAI,CAAC;AACV;AAUO,SAASR,WAAWW,WAAiD;IAC1E,OAAOA,YACJN,GAAG,CAAC,CAACO;QACJ,IAAIA,WAAWC,IAAI,KAAK,WAAW;YACjC,OAAO,CAAC,uBAAuB,EAAEJ,KAAKC,SAAS,CAACE,WAAWC,IAAI,EAAE,EAAE,CAAC;QACtE;QAEA,OAAO,CAAC,aAAa,EAAED,WAAWC,IAAI,CAAC,WAAW,EAAEJ,KAAKC,SAAS,CAChEE,WAAWC,IAAI,EACf,EAAE,CAAC;IACP,GACCL,IAAI,CAAC;AACV;AAEA;;;;;;;;;;;;CAYC,GACD,8EAA8E;AAC9E,6EAA6E;AAC7E,MAAMM,SAAmC,eAAeA,OACtDC,MAAe;IAEfC,IAAAA,aAAM,EAACD,kBAAkBE,YAAY;IAErC,MAAMC,QAAQ,IAAID,WAAWF;IAC7B,MAAMI,aAAa,MAAMC,YAAYC,OAAO,CAACH;IAE7C,wDAAwD;IACxD,MAAMI,WAAUF,YAAYG,MAAM,CAACD,OAAO,CAACH;IAC3C,MAAMK,UAAUJ,YAAYG,MAAM,CAACC,OAAO,CAACL,YAAYM,MAAM,CAE3D,CAACC,QAAQd;YACTc,SAAOd;QAAPc,CAAAA,UAAAA,OAAM,CAACd,qBAAAA,WAAWe,MAAM,CAAC,KAAzBD,OAAM,CAACd,mBAAkB,GAAK,EAAE;QAChCc,MAAM,CAACd,WAAWe,MAAM,CAAC,CAACC,IAAI,CAAChB,WAAWC,IAAI;QAE9C,OAAOa;IACT,GAAG,CAAC;IAEJ,wEAAwE;IACxE,WAAW;IACX,MAAMG,OAAOC,IAAAA,aAAO,EAAC,IAAI,CAACC,YAAY;IACtC,KAAK,MAAMlB,QAAQV,OAAO6B,IAAI,CAACR,SAAU;QACvC,IAAI,CAACS,aAAa,CAACC,IAAAA,aAAO,EAACL,MAAMhB;IACnC;IAEA,OAAO,CAAC;IACN,EAAEf,WAAW0B,SAAS;;iCAEO,EAAEf,KAAKC,SAAS,CAACyB,MAAMC,IAAI,CAACrB,SAAS;;;MAGhE,EAAEhB,iBAAiByB,SAAS;;;;IAI9B,EAAExB,WAAWsB,UAAS;EACxB,CAAC;AACH;MAEA,WAAeR;AAKR,MAAMb,MAAM"}