shopify 5.0.0 → 5.0.2

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 (330) hide show
  1. package/dist/{analytics-Q6QDIDYT.js → analytics-NMMVOF4B.js} +1 -1
  2. package/dist/{analytics-VKKJNJ62.js → analytics-UK77WNLG.js} +1 -1
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/{chunk-Q5MEFIMV.js → chunk-224UPIYS.js} +1 -1
  5. package/dist/{chunk-XBQDMGUN.js → chunk-26PWHH3B.js} +1 -1
  6. package/dist/{chunk-46MSIQ6Z.js → chunk-27NXPOAS.js} +1 -1
  7. package/dist/{chunk-SFPXYHHL.js → chunk-2A2JSAAA.js} +1 -1
  8. package/dist/{chunk-P33TONYG.js → chunk-2L6AN3QA.js} +1 -1
  9. package/dist/{chunk-43KLFFP7.js → chunk-2MT3LSMZ.js} +1 -1
  10. package/dist/{chunk-PGLWZMJU.js → chunk-2T4HDR6R.js} +1 -1
  11. package/dist/{chunk-5UWMXOHM.js → chunk-2WJOTJOD.js} +1 -1
  12. package/dist/{chunk-HIRTL45Q.js → chunk-2ZBXHCQZ.js} +1 -1
  13. package/dist/chunk-33ZE3DRQ.js +16 -0
  14. package/dist/{chunk-WFWISGLS.js → chunk-34MOWGRL.js} +1 -1
  15. package/dist/{chunk-AXC2MHHO.js → chunk-35XFNKNB.js} +1 -1
  16. package/dist/{chunk-LHKVXJPX.js → chunk-3JSKNXL7.js} +1 -1
  17. package/dist/{chunk-Q2SZCZE7.js → chunk-3KM5ZOW2.js} +1 -1
  18. package/dist/{chunk-KJQDS5HI.js → chunk-3MG4MTWQ.js} +1 -1
  19. package/dist/{chunk-MDRVCBDO.js → chunk-3MYDSQHF.js} +1 -1
  20. package/dist/{chunk-MYAIWSOO.js → chunk-3ODQKAEA.js} +1 -1
  21. package/dist/{chunk-6DXP7PQ7.js → chunk-3XRI3D44.js} +1 -1
  22. package/dist/{chunk-KGRIYAMA.js → chunk-3Z3MADXZ.js} +1 -1
  23. package/dist/{chunk-GB6E3ATN.js → chunk-4KECSZTL.js} +1 -1
  24. package/dist/{chunk-G6ZMSWEU.js → chunk-4WYKPIN3.js} +1 -1
  25. package/dist/{chunk-M3ACZWMR.js → chunk-5AEZJZNQ.js} +1 -1
  26. package/dist/chunk-5ED7SOQZ.js +20 -0
  27. package/dist/{chunk-FFHH5LOR.js → chunk-5IDJALJH.js} +1 -1
  28. package/dist/{chunk-GXORLBVN.js → chunk-62EOM3Y2.js} +1 -1
  29. package/dist/{chunk-EXFBZPZS.js → chunk-64G5TGFF.js} +1 -1
  30. package/dist/{chunk-QN3774QI.js → chunk-66TMIQMB.js} +1 -1
  31. package/dist/{chunk-L7MSPGDS.js → chunk-67L7FIB6.js} +1 -1
  32. package/dist/{chunk-7UOA4DI7.js → chunk-6ES4KRFW.js} +1 -1
  33. package/dist/{chunk-XMODGI45.js → chunk-74NRFUGQ.js} +1 -1
  34. package/dist/{chunk-YVY32DNA.js → chunk-7CCTPBCT.js} +1 -1
  35. package/dist/{chunk-2DID73ML.js → chunk-7GUMJ5E4.js} +1 -1
  36. package/dist/{chunk-IUTZIN2T.js → chunk-7NFTSBHQ.js} +1 -1
  37. package/dist/{chunk-TPSA4JN5.js → chunk-ACZNWIRY.js} +1 -1
  38. package/dist/{chunk-CCMDZX35.js → chunk-AQ6EVL73.js} +1 -1
  39. package/dist/{chunk-7WPUV7GY.js → chunk-AQKWPRZE.js} +1 -1
  40. package/dist/chunk-AUE7LM32.js +1 -0
  41. package/dist/{chunk-PIAD3F6M.js → chunk-AXL2VIWA.js} +1 -1
  42. package/dist/{chunk-CVVQQLCF.js → chunk-B2O3ANRZ.js} +1 -1
  43. package/dist/chunk-B3ZJGYZY.js +3 -0
  44. package/dist/{chunk-4SS6DXC7.js → chunk-BWN2QG6D.js} +1 -1
  45. package/dist/{chunk-6BNKBCCU.js → chunk-C3RFAKWR.js} +1 -1
  46. package/dist/{chunk-SNNZ4U2W.js → chunk-CCUQM4FX.js} +1 -1
  47. package/dist/{chunk-EITIW5OX.js → chunk-CGVROSPS.js} +1 -1
  48. package/dist/{chunk-7QUZWCJZ.js → chunk-CLUUA3HX.js} +1 -1
  49. package/dist/{chunk-X7HVAVSZ.js → chunk-CXI3RHPW.js} +1 -1
  50. package/dist/chunk-CYEEGTVZ.js +11 -0
  51. package/dist/{chunk-CZ22VZDA.js → chunk-D2KIGKBI.js} +108 -108
  52. package/dist/chunk-DBDTE3EE.js +5 -0
  53. package/dist/{chunk-YKS7MH3F.js → chunk-DLVB3237.js} +1 -1
  54. package/dist/{chunk-UZROQRLX.js → chunk-DN6X7SHW.js} +1 -1
  55. package/dist/{chunk-OGWPS55W.js → chunk-DZKFP6H2.js} +1 -1
  56. package/dist/{chunk-S67I4E7M.js → chunk-E5COIKGY.js} +1 -1
  57. package/dist/{chunk-CW2T7EOQ.js → chunk-E6RONHMT.js} +1 -1
  58. package/dist/{chunk-2CMEKSI7.js → chunk-EAZIQI2D.js} +1 -1
  59. package/dist/{chunk-FNLECT7B.js → chunk-EEY4FKAW.js} +1 -1
  60. package/dist/{chunk-YGYEM6QO.js → chunk-EKFPTBXC.js} +1 -1
  61. package/dist/{chunk-VW6QS7DO.js → chunk-ER6C5WS3.js} +1 -1
  62. package/dist/{chunk-MR2AUT7Q.js → chunk-ESFCYB46.js} +1 -1
  63. package/dist/{chunk-GRGFA26K.js → chunk-F3CK3EJJ.js} +1 -1
  64. package/dist/{chunk-M4BVLMPH.js → chunk-FEBOZ2XX.js} +1 -1
  65. package/dist/{chunk-5OMJFPQW.js → chunk-GNCVDN7U.js} +1 -1
  66. package/dist/{chunk-H4V55Y3Z.js → chunk-GQLNG537.js} +83 -83
  67. package/dist/{chunk-IEQ4UOH3.js → chunk-GVI3DWSB.js} +1 -1
  68. package/dist/{chunk-DFQ4WTET.js → chunk-GW7YIJPJ.js} +1 -1
  69. package/dist/{chunk-SFQEHDJY.js → chunk-H6GNKWYM.js} +1 -1
  70. package/dist/{chunk-5TB52UUV.js → chunk-H6GYBLVQ.js} +1 -1
  71. package/dist/chunk-HSKDFEXW.js +1 -0
  72. package/dist/{chunk-JYMDWR25.js → chunk-HTRJU4R4.js} +1 -1
  73. package/dist/{chunk-EMSF57ZB.js → chunk-HXZAY5OA.js} +1 -1
  74. package/dist/{chunk-WJSUIUBW.js → chunk-I4CEH7AK.js} +1 -1
  75. package/dist/{chunk-4ARCB6DT.js → chunk-I7PEEJVH.js} +1 -1
  76. package/dist/{chunk-CCQNP5YR.js → chunk-IHMATNOR.js} +1 -1
  77. package/dist/{chunk-N2RFDHRY.js → chunk-IHXGZW42.js} +1 -1
  78. package/dist/chunk-IJY3RJPJ.js +47 -0
  79. package/dist/{chunk-52FDK2LC.js → chunk-ISKQQXLZ.js} +1 -1
  80. package/dist/{chunk-UVRKTMF7.js → chunk-J55GQLP4.js} +1 -1
  81. package/dist/{chunk-3LVCG4JB.js → chunk-J5ERDFIC.js} +1 -1
  82. package/dist/{chunk-LWCTKI4Z.js → chunk-JLQRDFR5.js} +3 -3
  83. package/dist/{chunk-HCZG7YJ6.js → chunk-JPWRZ5SL.js} +1 -1
  84. package/dist/{chunk-BWRNXCVN.js → chunk-K7ZSPQKL.js} +1 -1
  85. package/dist/{chunk-4GCI2YCZ.js → chunk-KNWT7JLL.js} +1 -1
  86. package/dist/{chunk-U25W35TX.js → chunk-KZRLZWOU.js} +1 -1
  87. package/dist/chunk-L5TSPCSY.js +26 -0
  88. package/dist/{chunk-J6TW43TG.js → chunk-LEHBZKK3.js} +1 -1
  89. package/dist/chunk-LGXI7EGM.js +8 -0
  90. package/dist/{chunk-3A3DZVEJ.js → chunk-LHXFTFFM.js} +1 -1
  91. package/dist/{chunk-4RDFMBRG.js → chunk-LUGMXSRI.js} +1 -1
  92. package/dist/chunk-M2CWCOFU.js +11 -0
  93. package/dist/{chunk-2VSNFOKD.js → chunk-M5VIFG2V.js} +1 -1
  94. package/dist/{chunk-IWEKM5Y3.js → chunk-MADINS4Z.js} +1 -1
  95. package/dist/{chunk-VMMUJN4T.js → chunk-MEYVUHQH.js} +1 -1
  96. package/dist/{chunk-PEVIRAMR.js → chunk-MGHPF7HU.js} +1 -1
  97. package/dist/{chunk-ZT5WFUKJ.js → chunk-MHR5OHT5.js} +1 -1
  98. package/dist/{chunk-5NEGOQT6.js → chunk-MXEXP3HT.js} +1 -1
  99. package/dist/{chunk-IQVRP7CT.js → chunk-N57Y7THE.js} +1 -1
  100. package/dist/{chunk-FWB3GLMW.js → chunk-NVKJ7ZLP.js} +1 -1
  101. package/dist/{chunk-GQNOVEKP.js → chunk-NXAEBGMO.js} +1 -1
  102. package/dist/{chunk-PYIICTLX.js → chunk-OJULL7HT.js} +1 -1
  103. package/dist/{chunk-SL3VBI62.js → chunk-OMPQ7REW.js} +1 -1
  104. package/dist/{chunk-NK2MGR6A.js → chunk-OR4IJ4BQ.js} +1 -1
  105. package/dist/{chunk-CIK5BF7V.js → chunk-P2RMFHQP.js} +1 -1
  106. package/dist/{chunk-R7EMV77H.js → chunk-P4VZYOKO.js} +2 -2
  107. package/dist/{chunk-NDKSG4CC.js → chunk-PDZBKVWL.js} +1 -1
  108. package/dist/{chunk-QKVVJXWS.js → chunk-PF53E2DC.js} +1 -1
  109. package/dist/{chunk-XNNKLUTN.js → chunk-PLSS456F.js} +1 -1
  110. package/dist/{chunk-XM7YUXTF.js → chunk-PTSCGSQV.js} +2 -2
  111. package/dist/{chunk-KSDU4YOB.js → chunk-PWAT52M4.js} +1 -1
  112. package/dist/{chunk-NOH63WC6.js → chunk-Q2KWXZQB.js} +1 -1
  113. package/dist/{chunk-EGCWR5AS.js → chunk-Q4JYAUVL.js} +1 -1
  114. package/dist/{chunk-4CRBTSVP.js → chunk-Q5IC3IYY.js} +1 -1
  115. package/dist/{chunk-Z5SILNH2.js → chunk-QDCLL5OI.js} +1 -1
  116. package/dist/{chunk-VB7YQMAM.js → chunk-QEKGGTMN.js} +1 -1
  117. package/dist/{chunk-BJPDJIS4.js → chunk-QEVTBD33.js} +1 -1
  118. package/dist/{chunk-PZUGDE7N.js → chunk-QF5WKTPD.js} +1 -1
  119. package/dist/{chunk-7NSK77WG.js → chunk-QFSENE5T.js} +1 -1
  120. package/dist/{chunk-IUP7POIE.js → chunk-QQJNQNKP.js} +1 -1
  121. package/dist/{chunk-PSSYLJG4.js → chunk-QW52RPAU.js} +1 -1
  122. package/dist/{chunk-ULD7CIOY.js → chunk-R4UVIYZP.js} +1 -1
  123. package/dist/{chunk-M5TGCSUK.js → chunk-RLNIOJH3.js} +1 -1
  124. package/dist/{chunk-ZYQ2XWC5.js → chunk-RPCIFYCY.js} +1 -1
  125. package/dist/{chunk-C3KEDG33.js → chunk-RPVZ2JON.js} +1 -1
  126. package/dist/{chunk-I4OVLRQR.js → chunk-RW6G4ZPU.js} +1 -1
  127. package/dist/{chunk-4GOJQKY5.js → chunk-S4LOWCGS.js} +1 -1
  128. package/dist/{chunk-OQU3HLAE.js → chunk-S5P7KWY4.js} +1 -1
  129. package/dist/{chunk-UWMZ5CSB.js → chunk-SACNUF4I.js} +1 -1
  130. package/dist/chunk-SB27UOXX.js +1 -0
  131. package/dist/{chunk-YVVU4J5O.js → chunk-SHD4VV5V.js} +1 -1
  132. package/dist/{chunk-M7LPHCP2.js → chunk-SIL6HPMK.js} +2 -2
  133. package/dist/{chunk-AJMDF3QC.js → chunk-SK7EPN6C.js} +1 -1
  134. package/dist/{chunk-XITZIDCL.js → chunk-SLY27GDC.js} +1 -1
  135. package/dist/{chunk-C7V755IT.js → chunk-SNH4XZ6E.js} +1 -1
  136. package/dist/{chunk-POKY4RWR.js → chunk-T4XJKM6B.js} +1 -1
  137. package/dist/{chunk-7MVWDCI3.js → chunk-TAWCKJKP.js} +1 -1
  138. package/dist/{chunk-BCYTZ7LM.js → chunk-TFPW2VGN.js} +1 -1
  139. package/dist/{chunk-UOS2XLGG.js → chunk-TODZ3TJR.js} +1 -1
  140. package/dist/chunk-U2T5HPRD.js +319 -0
  141. package/dist/{chunk-XTREQ4A2.js → chunk-U6YOP562.js} +1 -1
  142. package/dist/{chunk-53BG3NLH.js → chunk-UBP3LQFY.js} +1 -1
  143. package/dist/{chunk-GFVKTWFT.js → chunk-UKWIWCOH.js} +1 -1
  144. package/dist/{chunk-GAMC2BNY.js → chunk-UPPO3BMT.js} +1 -1
  145. package/dist/{chunk-Q2XRITUG.js → chunk-URXM5A2K.js} +1 -1
  146. package/dist/chunk-USXIXANP.js +103 -0
  147. package/dist/{chunk-R2BDABJD.js → chunk-UUAKOX7E.js} +1 -1
  148. package/dist/{chunk-WGUOLSMG.js → chunk-UV5GAGAD.js} +1 -1
  149. package/dist/{chunk-AYL6KBPE.js → chunk-UXVXVI6O.js} +1 -1
  150. package/dist/{chunk-VWH3VPYI.js → chunk-UY6W2EVZ.js} +1 -1
  151. package/dist/{chunk-BVSKBX7T.js → chunk-UYELAINQ.js} +1 -1
  152. package/dist/{chunk-KDPQXURV.js → chunk-VAVXDIUX.js} +1 -1
  153. package/dist/{chunk-OX7UVDSU.js → chunk-VEUKT5EI.js} +1 -1
  154. package/dist/chunk-VGSH52JM.js +1 -0
  155. package/dist/chunk-VHZ6RL67.js +1 -0
  156. package/dist/{chunk-UK6576EO.js → chunk-VQA3X7O3.js} +1 -1
  157. package/dist/{chunk-TTEF7GTX.js → chunk-VZCMJRYV.js} +1 -1
  158. package/dist/{chunk-3G4HJO72.js → chunk-W37IFK3P.js} +1 -1
  159. package/dist/{chunk-LMQGNECW.js → chunk-W56ZGEQQ.js} +1 -1
  160. package/dist/{chunk-GCNA3HXH.js → chunk-WBVS5NBV.js} +1 -1
  161. package/dist/{chunk-XKRJKUA7.js → chunk-WCC52MR2.js} +1 -1
  162. package/dist/{chunk-LDU5T3DN.js → chunk-WESTVWWD.js} +1 -1
  163. package/dist/{chunk-24NUJTIH.js → chunk-WRZWHT6M.js} +1 -1
  164. package/dist/{chunk-4TI7U2PN.js → chunk-WSDKCQH6.js} +1 -1
  165. package/dist/{chunk-UIQL5ZF3.js → chunk-X2PFXSU4.js} +1 -1
  166. package/dist/{chunk-NB4BRW3H.js → chunk-X5NIAZA4.js} +1 -1
  167. package/dist/{chunk-RFGEM5JC.js → chunk-XBMD3FEZ.js} +1 -1
  168. package/dist/{chunk-I6FRVYGE.js → chunk-XDVPIGXE.js} +1 -1
  169. package/dist/chunk-XLIJYJ6Q.js +1 -0
  170. package/dist/chunk-XUHGWIWW.js +4 -0
  171. package/dist/{chunk-2ORRV7GH.js → chunk-XWSWXQCC.js} +1 -1
  172. package/dist/{chunk-Q66CI37F.js → chunk-Y55T4IIQ.js} +1 -1
  173. package/dist/{chunk-WMAFG2JD.js → chunk-Y5CVX5LJ.js} +1 -1
  174. package/dist/{chunk-VHUD3CBC.js → chunk-Y6J46XYF.js} +1 -1
  175. package/dist/{chunk-DJAZBPYA.js → chunk-YKMINHYY.js} +1 -1
  176. package/dist/{chunk-KKPOOIE4.js → chunk-YSWVYPWR.js} +1 -1
  177. package/dist/{chunk-D7NB7YR6.js → chunk-YV2TP44L.js} +1 -1
  178. package/dist/{chunk-7IFE4UQY.js → chunk-Z2WAW6MM.js} +1 -1
  179. package/dist/chunk-ZBL7XMJ6.js +25 -0
  180. package/dist/{chunk-YTUDXZLN.js → chunk-ZGBTO46A.js} +1 -1
  181. package/dist/{chunk-ZQDDRIBA.js → chunk-ZJOX5HW4.js} +4 -4
  182. package/dist/{chunk-MXJAH2GW.js → chunk-ZOOT3GBY.js} +1 -1
  183. package/dist/{chunk-ZAA2DXK5.js → chunk-ZRI3SSLG.js} +1 -1
  184. package/dist/cli/commands/app/build.js +1 -1
  185. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  186. package/dist/cli/commands/app/bulk/execute.js +1 -1
  187. package/dist/cli/commands/app/bulk/status.js +1 -1
  188. package/dist/cli/commands/app/config/link.js +1 -1
  189. package/dist/cli/commands/app/config/pull.js +1 -1
  190. package/dist/cli/commands/app/config/use.js +1 -1
  191. package/dist/cli/commands/app/config/validate.js +1 -1
  192. package/dist/cli/commands/app/demo/watcher.js +1 -1
  193. package/dist/cli/commands/app/deploy.js +1 -1
  194. package/dist/cli/commands/app/dev/clean.js +1 -1
  195. package/dist/cli/commands/app/dev.js +1 -1
  196. package/dist/cli/commands/app/env/pull.js +1 -1
  197. package/dist/cli/commands/app/env/show.js +1 -1
  198. package/dist/cli/commands/app/execute.js +1 -1
  199. package/dist/cli/commands/app/function/build.js +1 -1
  200. package/dist/cli/commands/app/function/info.js +1 -1
  201. package/dist/cli/commands/app/function/replay.js +1 -1
  202. package/dist/cli/commands/app/function/run.js +1 -1
  203. package/dist/cli/commands/app/function/schema.js +1 -1
  204. package/dist/cli/commands/app/function/typegen.js +1 -1
  205. package/dist/cli/commands/app/generate/extension.js +1 -1
  206. package/dist/cli/commands/app/graphiql.js +1 -1
  207. package/dist/cli/commands/app/import/channel-config.js +1 -1
  208. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  209. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  210. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  211. package/dist/cli/commands/app/import-extensions.js +1 -1
  212. package/dist/cli/commands/app/info.js +1 -1
  213. package/dist/cli/commands/app/init.js +1 -1
  214. package/dist/cli/commands/app/logs.js +1 -1
  215. package/dist/cli/commands/app/release.js +1 -1
  216. package/dist/cli/commands/app/security/check.js +1 -1
  217. package/dist/cli/commands/app/security/clean.js +1 -1
  218. package/dist/cli/commands/app/security/instructions.js +1 -1
  219. package/dist/cli/commands/app/security/record.js +1 -1
  220. package/dist/cli/commands/app/security/review.js +1 -1
  221. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  222. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  223. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  224. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  225. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  226. package/dist/cli/commands/app/versions/list.js +1 -1
  227. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  228. package/dist/cli/commands/auth/login.js +1 -1
  229. package/dist/cli/commands/auth/logout.js +1 -1
  230. package/dist/cli/commands/cache/clear.js +1 -1
  231. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  232. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  233. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  234. package/dist/cli/commands/debug/command-flags.js +1 -1
  235. package/dist/cli/commands/doc/fetch.js +1 -1
  236. package/dist/cli/commands/doc/search.js +1 -1
  237. package/dist/cli/commands/docs/generate.js +1 -1
  238. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  239. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  240. package/dist/cli/commands/help.js +1 -1
  241. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  242. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  243. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  244. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  245. package/dist/cli/commands/notifications/generate.js +1 -1
  246. package/dist/cli/commands/notifications/list.js +1 -1
  247. package/dist/cli/commands/organization/list.js +1 -1
  248. package/dist/cli/commands/search.js +1 -1
  249. package/dist/cli/commands/send-analytics.js +1 -1
  250. package/dist/cli/commands/theme/check.js +1 -1
  251. package/dist/cli/commands/theme/console.js +1 -1
  252. package/dist/cli/commands/theme/delete.js +1 -1
  253. package/dist/cli/commands/theme/dev.js +1 -1
  254. package/dist/cli/commands/theme/duplicate.js +1 -1
  255. package/dist/cli/commands/theme/info.js +1 -1
  256. package/dist/cli/commands/theme/init.js +1 -1
  257. package/dist/cli/commands/theme/language-server.js +1 -1
  258. package/dist/cli/commands/theme/list.js +1 -1
  259. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  260. package/dist/cli/commands/theme/open.js +1 -1
  261. package/dist/cli/commands/theme/package.js +1 -1
  262. package/dist/cli/commands/theme/preview.js +1 -1
  263. package/dist/cli/commands/theme/profile.js +1 -1
  264. package/dist/cli/commands/theme/publish.js +1 -1
  265. package/dist/cli/commands/theme/pull.js +1 -1
  266. package/dist/cli/commands/theme/push.js +1 -1
  267. package/dist/cli/commands/theme/rename.js +1 -1
  268. package/dist/cli/commands/theme/share.js +1 -1
  269. package/dist/cli/commands/upgrade.js +1 -1
  270. package/dist/cli/commands/version.js +1 -1
  271. package/dist/cli/help.js +1 -1
  272. package/dist/{command-json-schema-2UMKY7MY.js → command-json-schema-F5XF7XHL.js} +1 -1
  273. package/dist/command-registry.js +1 -1
  274. package/dist/{conf-store-RI3TL6I4.js → conf-store-5CBLWTOC.js} +1 -1
  275. package/dist/{custom-oclif-loader-IZCKN67O.js → custom-oclif-loader-UDVUFKMD.js} +1 -1
  276. package/dist/{deprecations-IFVUXXDB.js → deprecations-EOHPSTCS.js} +1 -1
  277. package/dist/dist-RNV3GFZ7.js +1 -0
  278. package/dist/dist-ZFKWJVNB.js +1 -0
  279. package/dist/{environments-CYMEN7NV.js → environments-4FLRZW4P.js} +1 -1
  280. package/dist/{error-IL6WQMSW.js → error-JY2ADS6S.js} +1 -1
  281. package/dist/{error-handler-74HKA23T.js → error-handler-4GCXKC6I.js} +1 -1
  282. package/dist/{fs-AINFLJ2E.js → fs-XS5YF34R.js} +1 -1
  283. package/dist/hooks/did-you-mean.js +1 -1
  284. package/dist/hooks/hydrogen-init.js +1 -1
  285. package/dist/hooks/postrun.js +1 -1
  286. package/dist/hooks/prerun.js +1 -1
  287. package/dist/hooks/public-metadata.js +1 -1
  288. package/dist/hooks/sensitive-metadata.js +1 -1
  289. package/dist/hooks/tunnel-provider.js +1 -1
  290. package/dist/hooks/tunnel-start.js +1 -1
  291. package/dist/index.js +12 -12
  292. package/dist/{is-global-2VLKV46Q.js → is-global-27MUENOK.js} +1 -1
  293. package/dist/{json-error-HZB5YIHV.js → json-error-S5XFS3UX.js} +1 -1
  294. package/dist/{local-KOZETREJ.js → local-OKPVB4NH.js} +1 -1
  295. package/dist/{metadata-IBPHZB7N.js → metadata-2YJBAKR7.js} +1 -1
  296. package/dist/{node-package-manager-DXSRNEDC.js → node-package-manager-B3OW3PFQ.js} +1 -1
  297. package/dist/{notifications-system-XA3EBOGJ.js → notifications-system-BWTDYBG2.js} +1 -1
  298. package/dist/{os-X73O7BAB.js → os-F6QKJCFW.js} +1 -1
  299. package/dist/{output-3OYXK3Z5.js → output-BRIPK7UC.js} +1 -1
  300. package/dist/{system-JWYYT4PM.js → system-466QKFDI.js} +1 -1
  301. package/dist/tsconfig.tsbuildinfo +1 -1
  302. package/dist/{ui-PCG5D6RZ.js → ui-VJTNGCS6.js} +1 -1
  303. package/dist/{upgrade-7U2TUNC4.js → upgrade-VHVJLXKX.js} +1 -1
  304. package/dist/{version-7DGU2KYH.js → version-FETZRLZO.js} +1 -1
  305. package/dist/version-T4XXTJMB.js +1 -0
  306. package/dist/{workerd-MQZ3NKJI.js → workerd-32DMKLMN.js} +1 -1
  307. package/oclif.manifest.json +6 -3
  308. package/package.json +7 -7
  309. package/dist/chunk-3C6VLJ5D.js +0 -319
  310. package/dist/chunk-4C2DAX5T.js +0 -1
  311. package/dist/chunk-7LAKWAKX.js +0 -25
  312. package/dist/chunk-7RPFJZLP.js +0 -1
  313. package/dist/chunk-CEIJKJOF.js +0 -11
  314. package/dist/chunk-DNMXVMJM.js +0 -47
  315. package/dist/chunk-FDXHQZTO.js +0 -26
  316. package/dist/chunk-JDR6UVZA.js +0 -8
  317. package/dist/chunk-JEA3C7ON.js +0 -3
  318. package/dist/chunk-JOJV5E2K.js +0 -1
  319. package/dist/chunk-LVLAOBJM.js +0 -103
  320. package/dist/chunk-OQ5CLM2H.js +0 -4
  321. package/dist/chunk-OVWUGAEU.js +0 -11
  322. package/dist/chunk-PMHP57MH.js +0 -20
  323. package/dist/chunk-RVQV6G5M.js +0 -1
  324. package/dist/chunk-T2IUXXCT.js +0 -1
  325. package/dist/chunk-WDFCOZAY.js +0 -16
  326. package/dist/chunk-X2H6I2WW.js +0 -5
  327. package/dist/chunk-ZGV3HNEV.js +0 -1
  328. package/dist/dist-4H2B7BMN.js +0 -1
  329. package/dist/dist-QNWOGQN3.js +0 -1
  330. package/dist/version-SXQTRBXB.js +0 -1
@@ -1 +0,0 @@
1
- import{g as I}from"./chunk-VKWPEFWQ.js";I();var o="5.0.0";export{o as a};
@@ -1,25 +0,0 @@
1
- import{a as R,b as V,c as H,d as i,e as O,f as _,g as q,h as x,i as C}from"./chunk-U25W35TX.js";import{a as M}from"./chunk-ZGV3HNEV.js";import{a as k}from"./chunk-FWB3GLMW.js";import{Ma as L,ja as F}from"./chunk-3C6VLJ5D.js";import{b as I,c as A,f as p}from"./chunk-Q2SZCZE7.js";import{E as m,G as b,K as w}from"./chunk-CZ22VZDA.js";import{a as g}from"./chunk-BN7ZXAZJ.js";import{h as P}from"./chunk-2VSNFOKD.js";import{Cb as S,Eb as E,wb as T,zb as h}from"./chunk-LWCTKI4Z.js";import{b as n}from"./chunk-FZCGRIOM.js";import{b as Q}from"./chunk-YTUUU33R.js";import{i as v}from"./chunk-IWTNUJGY.js";import{e as X,g as a}from"./chunk-VKWPEFWQ.js";a();a();a();a();async function D(e,t,r){let o={api_version:t},{webhookTopics:s}=await e.topics(o,r);return s}a();async function W(e){let t=e.map(o=>({label:o,value:o}));return await b({message:"Webhook Topic",choices:t})}async function B(e){return m({message:"Webhook ApiVersion",choices:e.map(t=>({label:t,value:t}))})}async function N(){return m({message:"Delivery method",choices:[{label:"HTTP",value:i.HTTP},{label:"Google Pub/Sub",value:i.PUBSUB},{label:"Amazon EventBridge",value:i.EVENTBRIDGE}]})}async function Y(e){return(await w({message:"Address for delivery",validate:r=>{let o=r.trim();if(o.length===0)return"Address can't be empty";if(!O(o,e))return`Invalid address.
2
- ${c(e)}`}})).trim()}function Z(e){return e===i.HTTP?["For remote HTTP testing, use a URL that starts with https://","For local HTTP testing, use http://localhost:{port}/{url-path}"]:e===i.PUBSUB?["For Google Pub/Sub, use pubsub://{project-id}:{topic-id}"]:e===i.EVENTBRIDGE?["For Amazon EventBridge, use an Amazon Resource Name (ARN) starting with arn:aws:events:"]:[]}function c(e){return Z(e).map(t=>` \xB7 ${E(t)}`).join(`
3
- `)}async function G(e,t){let{clientSecret:r,clientId:o,remoteApp:s,app:l}=e;return r&&(o||t!==i.EVENTBRIDGE)?{clientSecret:r,apiKey:o}:(F({appName:s.title,configFile:v(l.configPath)}),{clientSecret:s.apiSecretKeys.find(y=>y.secret).secret,apiKey:s.apiKey})}async function j(e,t,r){let o=await R(e,r);return t?q(t,o):B(o)}async function z(e,t,r,o){let s=await D(e,t,o);return r?x(r,t,s):W(s)}async function U(e,t){let r=e??C(t)??await N(),o=t??await Y(r);return _(o,r)}async function J(e){let t=await ee(e);return te(t)}async function ee(e){let t=await j(e.developerPlatformClient,e.apiVersion,e.organizationId),r=await z(e.developerPlatformClient,t,e.topic,e.organizationId),[o,s]=await U(e.deliveryMethod,e.address),l=await G(e,s);return{topic:r,apiVersion:t,deliveryMethod:s,address:o,apiKey:l.apiKey,clientSecret:l.clientSecret,developerPlatformClient:e.developerPlatformClient,organizationId:e.organizationId}}async function te(e){let t={topic:e.topic,api_version:e.apiVersion,address:e.address,delivery_method:e.deliveryMethod,shared_secret:e.clientSecret,api_key:e.apiKey},r=await V(e.developerPlatformClient,t,e.organizationId);if(!r.success)return{status:"failed",reason:"sample-request",userErrors:r.userErrors};let o={topic:e.topic,apiVersion:e.apiVersion,deliveryMethod:e.deliveryMethod,address:e.address,status:"enqueued"};return e.deliveryMethod===i.LOCALHOST?await H(e.address,r.samplePayload,r.headers)?{status:"success",delivery:{...o,status:"delivered"},samplePayloadIsEmpty:r.samplePayload===JSON.stringify({})}:{status:"failed",reason:"localhost-delivery"}:{status:"success",delivery:o,samplePayloadIsEmpty:r.samplePayload===JSON.stringify({})}}a();var K=n.object({topic:n.string(),apiVersion:n.string(),deliveryMethod:n.enum(["localhost","http","google-pub-sub","event-bridge"]),address:n.string(),status:n.enum(["delivered","enqueued"]).describe("Remote delivery is enqueued, not confirmed received.")}).strict(),u=g({name:"AppWebhookTriggerResult",schema:n.object({status:n.literal("success"),delivery:K}).strict(),definitions:{AppWebhookDelivery:K}});a();function $(e,t){if(e.status==="failed"){if(t==="json"){let r=new P(e.reason==="sample-request"?"Webhook sample request failed.":"Localhost delivery failed");throw e.reason==="sample-request"&&(r.details={userErrors:e.userErrors.map(({message:o,fields:s})=>({message:o,fieldPath:s}))}),r}S(e.reason==="sample-request"?`Request errors:
4
- ${re(e.userErrors)}`:"Localhost delivery failed");return}t==="json"?T(u.encode({status:e.status,delivery:e.delivery})):e.delivery.status==="delivered"?h("Localhost delivery sucessful"):e.samplePayloadIsEmpty&&h("Webhook has been enqueued for delivery")}function re(e){try{return e.map(t=>JSON.parse(t.message).map(r=>` \xB7 ${r}`).join(`
5
- `)).join(`
6
- `)}catch{return JSON.stringify(e)}}var d=X(Q(),1);var f=class e extends M{static summary="Trigger delivery of a sample webhook topic payload to a designated address.";static descriptionWithMarkdown=`
7
- Triggers the delivery of a sample Admin API event topic payload to a designated address.
8
-
9
- You should use this command to experiment with webhooks, to initially test your webhook configuration, or for unit testing. However, to test your webhook configuration from end to end, you should always trigger webhooks by performing the related action in Shopify.
10
-
11
- Because most webhook deliveries use remote endpoints, you can trigger the command from any directory where you can use Shopify CLI, and send the webhook to any of the supported endpoint types. For example, you can run the command from your app's local directory, but send the webhook to a staging environment endpoint.
12
-
13
- To learn more about using webhooks in a Shopify app, refer to [Webhooks overview](https://shopify.dev/docs/apps/webhooks).
14
-
15
- ### Limitations
16
-
17
- - Webhooks triggered using this method always have the same payload, so they can't be used to test scenarios that differ based on the payload contents.
18
- - Webhooks triggered using this method aren't retried when they fail.
19
- - Trigger requests are rate-limited using the [Partner API rate limit](https://shopify.dev/docs/api/partner#rate_limits).
20
- - You can't use this method to validate your API webhook subscriptions.
21
- `;static get jsonOutputSchema(){return u}static description=this.descriptionForHelp();static flags={...I,...k,...A,help:d.Flags.help({required:!1,hidden:!1,env:"SHOPIFY_FLAG_HELP",description:"This help. When you run the trigger command the CLI will prompt you for any information that isn't passed using flags."}),topic:p(d.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_TOPIC",description:"The requested webhook topic."})),"api-version":p(d.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_API_VERSION",description:"The API Version of the webhook topic."})),"delivery-method":d.Flags.string({required:!1,hidden:!1,options:[i.HTTP,i.PUBSUB,i.EVENTBRIDGE],env:"SHOPIFY_FLAG_DELIVERY_METHOD",description:"Method chosen to deliver the topic payload. If not passed, it's inferred from the address."}),"client-secret":d.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_CLIENT_SECRET",description:"Your app's client secret. This secret allows us to return the X-Shopify-Hmac-SHA256 header that lets you validate the origin of the response that you receive."}),address:p(d.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_ADDRESS",description:`The URL where the webhook payload should be sent.
22
- You will need a different address type for each delivery-method:
23
- ${c(i.HTTP)}
24
- ${c(i.PUBSUB)}
25
- ${c(i.EVENTBRIDGE)}`}))};async run(){let{flags:t}=await this.parse(e),r=await L({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),o={...r,topic:t.topic,apiVersion:t["api-version"],deliveryMethod:t["delivery-method"],address:t.address,clientId:t["client-id"],clientSecret:t["client-secret"],path:t.path,config:t.config,organizationId:r.organization.id},s=await J(o);return $(s,t.json?"json":"text"),{app:r.app}}};export{f as a};
@@ -1 +0,0 @@
1
- import{a as o}from"./chunk-MDRVCBDO.js";import{g as e}from"./chunk-VKWPEFWQ.js";e();var t=class extends o{};export{t as a};
@@ -1,11 +0,0 @@
1
- import{a as M}from"./chunk-L7MSPGDS.js";import{a as K}from"./chunk-ZGV3HNEV.js";import{a as D}from"./chunk-FWB3GLMW.js";import{Ma as $,i as m,ka as W}from"./chunk-3C6VLJ5D.js";import{s as b}from"./chunk-WDFCOZAY.js";import{G as F,H as O}from"./chunk-H4V55Y3Z.js";import{a as f}from"./chunk-4C2DAX5T.js";import{b as R,c as L}from"./chunk-Q2SZCZE7.js";import{z as N}from"./chunk-CZ22VZDA.js";import{c as g}from"./chunk-DFQ4WTET.js";import{a as C}from"./chunk-BN7ZXAZJ.js";import{Ib as k,L as x,N as w,rb as T,wb as U}from"./chunk-LWCTKI4Z.js";import{b as e}from"./chunk-FZCGRIOM.js";import{b as ie}from"./chunk-YTUUU33R.js";import{f as u,i as P}from"./chunk-IWTNUJGY.js";import{e as re,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();var l=e.record(e.unknown()),S=e.object({id:e.string(),name:e.string(),continueOnError:e.boolean().optional()}),H=e.array(e.object({lifecycle:e.literal("deploy"),steps:e.array(e.discriminatedUnion("type",[S.extend({type:e.literal("include_assets"),config:e.object({generatesAssetsManifest:e.boolean().optional(),inclusions:e.array(e.discriminatedUnion("type",[e.object({type:e.literal("pattern"),baseDir:e.string().optional(),include:e.array(e.string()).optional(),ignore:e.array(e.string()).optional(),destination:e.string().optional()}),e.object({type:e.literal("static"),source:e.string(),destination:e.string().optional()}),e.object({type:e.literal("configKey"),key:e.string(),destination:e.string().optional(),anchor:e.string().optional(),groupBy:e.string().optional(),preserveFilePaths:e.boolean().optional()})]))})}),S.extend({type:e.literal("bundle_ui"),config:e.object({generatesAssetsManifest:e.boolean().optional(),bundleFolder:e.string().optional()}).optional()}),S.extend({type:e.enum(["build_theme","bundle_theme","build_function","create_tax_stub"]),config:e.record(e.never()).optional()})]))})),A=e.object({identifier:e.string(),externalIdentifier:e.string(),externalName:e.string(),group:e.string().optional(),additionalIdentifiers:e.array(e.string()),partnersWebIdentifier:e.string(),surface:e.string(),registrationLimit:e.number(),experience:e.enum(["extension","configuration"]),uidStrategy:e.enum(["single","dynamic","uuid"]),dependency:e.string().optional(),graphQLType:e.string().optional(),clientSteps:H.optional(),loadedRemoteSpecs:e.boolean().optional()}),v=e.object({name:e.string(),type:e.string(),externalType:e.string(),humanName:e.string(),surface:e.string(),features:e.array(e.string()),dependency:e.string().optional(),entrySourceFilePath:e.string(),devUUID:e.string(),localIdentifier:e.string(),idEnvironmentVariableName:e.string(),directory:e.string(),configuration:l,configurationPath:e.string(),outputPath:e.string(),handle:e.string(),specification:A,uid:e.string()}).passthrough(),z=e.object({directory:e.string(),configuration:l.optional()}).passthrough(),J=e.object({file:e.string(),message:e.string()}).passthrough(),h=e.object({id:e.string(),title:e.string(),apiKey:e.string(),organizationId:e.string(),appType:e.string().optional(),newApp:e.boolean().optional(),grantedScopes:e.array(e.string()),developmentStorePreviewEnabled:e.boolean().optional(),applicationUrl:e.string().optional(),redirectUrlWhitelist:e.array(e.string()).optional(),requestedAccessScopes:e.array(e.string()).optional(),webhookApiVersion:e.string().optional(),embedded:e.boolean().optional(),posEmbedded:e.boolean().optional(),preferencesUrl:e.string().optional(),gdprWebhooks:e.object({customerDeletionUrl:e.string().optional(),customerDataRequestUrl:e.string().optional(),shopDeletionUrl:e.string().optional()}).optional(),appProxy:e.object({subPath:e.string(),subPathPrefix:e.string(),url:e.string()}).optional(),configuration:l.optional(),flags:e.array(e.string())}),q=e.object({path:e.string(),message:e.string()}),I=e.object({path:e.string(),content:l,errors:e.array(q)}),Q=e.object({directory:e.string(),appConfigFiles:e.array(I),extensionConfigFiles:e.array(I),webConfigFiles:e.array(I),dotenvFiles:e.array(e.object({path:e.string()})),errors:e.array(q)}),B=e.object({cliVersion:e.string(),nodeVersion:e.string(),platform:e.string(),arch:e.string(),shell:e.string().optional()}),Y=e.object({remoteApp:h,account:e.discriminatedUnion("type",[e.object({type:e.literal("UserAccount"),email:e.string()}),e.object({type:e.literal("ServiceAccount"),orgName:e.string()}),e.object({type:e.literal("UnknownAccount")})]),project:Q,system:B,devStoreUrl:e.string().optional(),name:e.string(),idEnvironmentVariableName:e.literal("SHOPIFY_API_KEY"),directory:e.string(),configPath:e.string(),configuration:l,webs:e.array(z),dotenv:e.object({path:e.string(),variables:e.record(e.string())}).passthrough().optional(),errors:e.object({errors:e.array(J)}).passthrough(),specifications:e.array(A),remoteFlags:e.array(e.string()),realExtensions:e.array(v),devApplicationURLs:l.optional(),_hiddenConfig:l,packageManager:e.string(),nodeDependencies:e.record(e.string()),usesWorkspaces:e.boolean(),organization:e.object({id:e.string(),businessName:e.string(),source:e.string()}),allExtensions:e.array(v)}).passthrough(),V=e.object({SHOPIFY_API_KEY:e.string(),SHOPIFY_API_SECRET:e.string().optional(),SCOPES:e.string()}),d=C({name:"AppInfoResult",schema:e.union([V,Y]),definitions:{AppInfo:Y,AppInfoRemoteApp:h,AppInfoProject:Q,AppInfoSystem:B,AppInfoWebEnvironment:V,AppInfoExtension:v,AppInfoSpecification:A,AppInfoClientSteps:H,AppInfoWeb:z,AppInfoConfigurationError:J}});async function X(r,t,o,n,i){if(i.webEnv)return await W(t,o.source),{SHOPIFY_API_KEY:t.apiKey,...t.apiSecretKeys[0]?{SHOPIFY_API_SECRET:t.apiSecretKeys[0].secret}:{},SCOPES:m(r.configuration)};let s={...r,packageManager:n.packageManager,nodeDependencies:n.nodeDependencies,usesWorkspaces:n.usesWorkspaces,organization:{id:o.id,businessName:o.businessName,source:o.source},remoteApp:h.parse(t),account:await t.developerPlatformClient.accountInfo(),project:{directory:n.directory,appConfigFiles:n.appConfigFiles.map(E),extensionConfigFiles:n.extensionConfigFiles.map(E),webConfigFiles:n.webConfigFiles.map(E),dotenvFiles:[...n.dotenvFiles.values()].map(({path:c})=>({path:c})),errors:(n.errors??[]).map(({path:c,message:oe})=>({path:c,message:oe}))},system:{cliVersion:f,nodeVersion:process.version,...g(),shell:process.env.SHELL},devStoreUrl:r.configuration.build?.dev_store_url??r.hiddenConfig.dev_store_url,allExtensions:G(r.allExtensions.filter(c=>c.isReturnedAsInfo())),realExtensions:G(r.realExtensions),specifications:r.specifications.map(Z)},a=JSON.parse(JSON.stringify(Object.fromEntries(Object.entries(s).filter(([c])=>c!=="configSchema"))));return d.validate(a)}function Z(r){return{identifier:r.identifier,externalIdentifier:r.externalIdentifier,externalName:r.externalName,group:r.group,additionalIdentifiers:r.additionalIdentifiers,partnersWebIdentifier:r.partnersWebIdentifier,surface:r.surface,registrationLimit:r.registrationLimit,experience:r.experience,uidStrategy:r.uidStrategy,dependency:r.dependency,graphQLType:r.graphQLType,clientSteps:r.clientSteps,..."loadedRemoteSpecs"in r?{loadedRemoteSpecs:r.loadedRemoteSpecs}:{}}}function E({path:r,content:t,errors:o}){return{path:r,content:t,errors:o.map(({path:n,message:i})=>({path:n,message:i}))}}function G(r){return r.map(t=>({...t,name:t.name,type:t.type,externalType:t.externalType,humanName:t.humanName,surface:t.surface,features:t.features,dependency:t.dependency,specification:Z(t.specification)}))}p();async function se(r){let{app:t,remoteApp:o,organization:n,project:i}=r,s=await o.developerPlatformClient.accountInfo();return new j(t,o,n,i,s).output()}async function ee(r){N({customSections:await se(r)})}function ae(r,t){if(t==="json")return d.encode(r);if(!("name"in r))return M({variables:Object.entries(r).map(([o,n])=>({name:o,value:n}))});throw new Error("App information text output requires the loaded app context.")}function te(r,t){U(ae(r,t))}var pe="unknown",y={subdued:"Not yet configured"},ce="NOT LOADED",j=class{app;remoteApp;organization;project;account;constructor(t,o,n,i,s){this.app=t,this.remoteApp=o,this.organization=n,this.project=i,this.account=s}async output(){return[...await this.devConfigsSection(),this.projectSettingsSection(),...await this.appComponentsSection(),await this.systemInfoSection()]}async devConfigsSection(){let t=y;this.app.configuration.build?.automatically_update_urls_on_dev!==void 0&&(t=this.app.configuration.build.automatically_update_urls_on_dev?"Yes":"No");let o=["User","unknown"],n=this.account;return O(n)?o=["Service account",n.orgName]:F(n)&&(o[1]=n.email),[this.tableSection("Current app configuration",[["Configuration file",{filePath:P(this.app.configPath)||b.app}],["App name",this.remoteApp.title?{userInput:this.remoteApp.title}:y],["Client ID",this.remoteApp.apiKey||y],["Organization",`${this.organization.businessName} (${this.organization.id})`],["Access scopes",m(this.app.configuration)],["Dev store",this.app.configuration.build?.dev_store_url??this.app.hiddenConfig.dev_store_url??y],["Update URLs",t],o],{isFirstItem:!0}),{body:["\u{1F4A1} To change these, run",{command:T(this.project.packageManager,"shopify app config link")}]}]}projectSettingsSection(){return this.tableSection("Your Project",[["Root location",{filePath:this.app.directory}]])}async appComponentsSection(){let t=this.webComponentsSection();return[{title:`
2
- Directory components`.toUpperCase(),body:""},...t?[t]:[],...this.extensionsSections()]}webComponentsSection(){let t=[],o=[];if(this.app.webs[0])return this.app.webs.forEach(n=>{if(n.configuration)if(n.configuration.name){let{name:i,roles:s}=n.configuration,a=u(this.app.directory,n.directory);o.push([` \u{1F4C2} ${i}`,{filePath:a||"/"}]),s.length>0&&o.push([" roles",s.join(", ")])}else n.configuration.roles.forEach(i=>{o.push([` \u{1F4C2} ${i}`,{filePath:u(this.app.directory,n.directory)}])});else o.push([{subdued:` \u{1F4C2} ${pe}`},{filePath:u(this.app.directory,n.directory)}]);if(!this.app.errors.isEmpty()){let i=this.app.errors.getErrors(`${n.directory}/${b.web}`);t.push(...i.map(s=>s.message))}}),this.subtableSection("web",[["\u{1F4C2} web",""],...o,...t.map(n=>[{error:"error"},{error:this.formattedError(n)}])])}extensionsSections(){let t=this.app.allExtensions.filter(i=>i.isReturnedAsInfo()),n=w(t.map(i=>i.type)).map(i=>{let s=t.filter(a=>a.type===i);if(s[0])return this.subtableSection(s[0].externalType,s.flatMap(a=>this.extensionSubSection(a)))});return x(n)}extensionSubSection(t){let o=t.configuration,n=[[`\u{1F4C2} ${t.handle||ce}`,{filePath:u(this.app.directory,t.directory)}],[" config file",{filePath:u(t.directory,t.configurationPath)}]];o&&"metafields"in o&&Array.isArray(o.metafields)&&o.metafields.length>0&&n.push([" metafields",`${o.metafields.length}`]);let i=this.app.errors.getErrors(t.configurationPath);for(let s of i)n.push([{error:" error"},{error:this.formattedError(s.message)}]);return n}formattedError(t){let o=t.trim();if(k())return o;let[n,...i]=o.split(`
3
- `);return[`! ${n}`,...i.map(s=>` ${s}`)].join(`
4
- `)}async systemInfoSection(){let{platform:t,arch:o}=g();return this.tableSection("Tooling and System",[["Shopify CLI",f],["Package manager",this.project.packageManager],["OS",`${t}-${o}`],["Shell",process.env.SHELL??"unknown"],["Node version",process.version]])}tableSection(t,o,{isFirstItem:n=!1}={}){return{title:`${n?"":`
5
- `}${t.toUpperCase()}
6
- `,body:{tabularData:o,firstColumnSubdued:!0}}}subtableSection(t,o){return{title:t,body:{tabularData:o,firstColumnSubdued:!0}}}};var ne=re(ie(),1);var _=class r extends K{static summary="Print basic information about your app and extensions.";static descriptionWithMarkdown=`The information returned includes the following:
7
-
8
- - The app and dev store that's used when you run the [dev](https://shopify.dev/docs/api/shopify-cli/app/app-dev) command. You can reset these configurations using [\`dev --reset\`](https://shopify.dev/docs/api/shopify-cli/app/app-dev#flags-propertydetail-reset).
9
- - The [structure](https://shopify.dev/docs/apps/tools/cli/structure) of your app project.
10
- - The [access scopes](https://shopify.dev/docs/api/usage) your app has requested.
11
- - System information, including the package manager and version of Shopify CLI used in the project.`;static get jsonOutputSchema(){return d}static description=this.descriptionForHelp();static flags={...R,...D,...L,"web-env":ne.Flags.boolean({hidden:!1,description:"Outputs environment variables necessary for running and deploying web/.",env:"SHOPIFY_FLAG_OUTPUT_WEB_ENV",default:!1})};async run(){let{flags:t}=await this.parse(r),{app:o,project:n,remoteApp:i,organization:s}=await $({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config,unsafeTolerateErrors:!0});if(t.json||t["web-env"]){let a=await X(o,i,s,n,{webEnv:t["web-env"]});te(a,t.json?"json":"text")}else await ee({app:o,remoteApp:i,organization:s,project:n});return o.errors.isEmpty()||process.exit(2),{app:o}}};export{_ as a};
@@ -1,47 +0,0 @@
1
- import{k as j,t as M}from"./chunk-5TB52UUV.js";import{a as F}from"./chunk-Q7BOSHWX.js";import{a as _}from"./chunk-AJMDF3QC.js";import{L as I,N as q,k as w,va as f,xa as h}from"./chunk-H4V55Y3Z.js";import{a as x}from"./chunk-4C2DAX5T.js";import{C as L,D as O,U as P}from"./chunk-CZ22VZDA.js";import{h as l,j as U}from"./chunk-2VSNFOKD.js";import{Bb as c,qb as R,sb as D}from"./chunk-LWCTKI4Z.js";import{i as H,j as v}from"./chunk-FZCGRIOM.js";import{u as N}from"./chunk-3A3DZVEJ.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();p();function G(e){let t=new URLSearchParams;for(let[r,o]of Object.entries(e.replaceTemplates??[]))t.append(`replace_templates[${r}]`,o);for(let[r,o]of Object.entries(e.replaceExtensionTemplates??[])){let s=r.split("/")[0];t.append(`replace_extension_templates[${s}][${r}]`,o)}return t.append("_method",e.method),t}function S(){return{"User-Agent":`Shopify CLI; v=${x}`}}function T(e){return delete e.cookie,delete e.authorization,e}p();function y(e){let t={};return e.split(";").forEach(r=>{let o=r.match(/(.*?)=(.*)$/)??[],s=o[1]?.trim(),n=o[2]?.trim()??"";s&&(t[s]=n)}),t}function E(e){return Object.entries(e).map(([t,r])=>`${t}=${r}`).join("; ")}var $=class extends l{};async function Ie(e){return M(e)}async function qe(e,t,r){let o=X(t),s=new URLSearchParams;s.append("form_type","storefront_password"),s.append("utf8","\u2713"),s.append("password",e??""),h("theme-service:storefront-session:check-storefront-password");let n={"cache-control":"no-cache","content-type":"application/x-www-form-urlencoded",...r},a=await w(`${o}/password`,{headers:n,body:s.toString(),method:"POST",redirect:"manual"});if(a.status===429)throw f(new l(`Too many incorrect password attempts. Please try again after ${a.headers.get("retry-after")} seconds.`));return V(a,o)}async function B(e,t,r,o,s={}){let n={},a=await W(e,r,s),i=X(t);if(n._shopify_essential=a,h(`theme-service:storefront-session:is-password-protected:${!!o}`),!o)return n;let u=await se(a,e,i,o,s);return{...n,...u}}var ne=1;async function W(e,t,r,o=1){let s=new URLSearchParams({preview_theme_id:t,_fd:"0",pb:"0"}),n=`${e}?${s}`;h("theme-service:storefront-session:get-session-essential-cookie");let a={...r,...S()},i=await w(n,{method:"HEAD",redirect:"manual",headers:a}),u=i.headers.raw()["set-cookie"]??[],d=C(u,"_shopify_essential");if(!d){if(c(`Failed to obtain _shopify_essential cookie.
2
-
3
- -Request ID: ${i.headers.get("x-request-id")??"unknown"}
4
-
5
- -Body: ${await i.text()}
6
-
7
- -Status: ${i.status}
8
- `),o>3)throw f(new $('Your development session could not be created because the "_shopify_essential" could not be defined. Please, check your internet connection.'));return c("Retrying to obtain the _shopify_essential cookie..."),await P(o),W(e,t,r,o+1)}return z(i,n,d,a)}async function z(e,t,r,o,s=0){let n=e.headers.get("location");if(!n||s>=ne)return r;let a=new URL(n,t);if(a.origin!==new URL(t).origin||!a.searchParams.has("preview_theme_id"))return r;let i=await w(a.toString(),{method:"HEAD",redirect:"manual",headers:{...o,Cookie:E({_shopify_essential:r})}}),u=i.headers.raw()["set-cookie"]??[],d=C(u,"_shopify_essential");return d||c(`Preview redirect to ${a.pathname} did not set a new _shopify_essential cookie; keeping the previous one.`),z(i,a.toString(),d??r,o,s+1)}async function se(e,t,r,o,s){let n=new URLSearchParams({password:o}),a={...s,...S(),Cookie:E({_shopify_essential:e})},i=await w(`${t}/password`,{method:"POST",redirect:"manual",body:n,headers:a});if(!V(i,r))throw f(new l("Your development session could not be created because the store password is invalid. Please, retry with a different password."));let u=i.headers.raw()["set-cookie"]??[],d=C(u,"storefront_digest"),m=C(u,"_shopify_essential"),g={};return d&&(g.storefront_digest=d),m&&(g._shopify_essential=m),g}function V(e,t){let r=e.headers.get("location")??"",o;try{o=new URL(r,t)}catch(n){if(n instanceof TypeError)return!1;throw n}let s=new URL(t).origin;return e.status===302&&o.origin===s}function C(e,t){let r=e.find(s=>y(s)[t]);return r?y(r)[t]:void 0}function X(e){return`https://${e}`}p();p();function ae(e,t){if(!(t instanceof U)){if(f(t),v()==="json"){H({type:"diagnostic",level:"error",message:`${e}
9
- ${t.message}`});return}t instanceof l?(t.message=`${e}
10
- ${t.message}`,O(t)):(L({headline:e,body:t.message}),c(`${e}
11
- ${t.stack??t.message}`))}}function Me(e,t){let r={delete:`Failed to delete file "${e}" from remote theme.`,upload:`Failed to upload file "${e}" to remote theme.`,default:e}[t??"default"]??e;return o=>{ae(r,o)}}function k(e,t){return F({status:e.status??502,statusText:e.statusText??"Bad Gateway",cause:e,data:{url:(t??e.url)?.toString(),requestId:e.headers?.get("x-request-id")??void 0}})}function Ge(e,t="Unexpected error during fetch"){let r=e,o=r.statusCode??502,s=r.statusMessage??"Bad Gateway",n=`${t.replace(/\.$/,"")} with status ${o} (${s}).`;r.data?.requestId&&(n+=`
12
- Request ID: ${r.data.requestId}`),r.data?.url&&(n+=`
13
- URL: ${r.data.url}`);let a=r.cause??e;return{headline:n,body:a.stack??r.stack??r.message??s,status:o,statusText:s,cause:a,requestId:r.data?.requestId,url:r.data?.url}}var ie={_fd:"0",pb:"0"};async function Je(e,t){let r=fe(e,t),s={...await ce(e,t),...S()},n,a=Object.keys({...t.replaceTemplates,...t.replaceExtensionTemplates});if(a.length>0){c(`\u2192 Rendering ${r} (with ${a})...`);let m=G(t);n=await fetch(r,{method:"POST",body:m,redirect:"manual",headers:s}).catch(g=>{throw k(f(g),r)})}else c(`\u2192 Rendering ${r}...`),n=await fetch(r,{method:t.method,redirect:"manual",headers:s}).catch(m=>{throw k(f(m),r)});let i=n.headers.get("x-request-id");c(`\u2190 ${n.status} (request_id: ${i})`);let d=n.headers.get("Content-Type")?.includes("application/json");return n=new Response(n.body,n),d||n.headers.delete("Content-Type"),n}async function ce(e,t){return K(e)?de(e,t):ue(e,t)}async function ue(e,t){let r=await Y(e,t),o=e.storefrontToken;return T({...t.headers,...e.crawlerSignatureHeaders,Authorization:`Bearer ${o}`,Cookie:r})}async function de(e,t){let r=await Y(e,t),o=e.storefrontToken,s={},n=["ACCEPT","CONTENT-TYPE","CONTENT-LENGTH"];for(let[a,i]of Object.entries(t.headers))n.includes(a.toUpperCase())&&(s[a]=i);return T({...s,...pe(e),...e.crawlerSignatureHeaders,Authorization:`Bearer ${o}`,Cookie:r})}function Y(e,t){let r=y(t.headers.cookie??t.headers.Cookie??""),o=e.sessionCookies??{};return E({...r,...o})}function fe(e,{path:t,sectionId:r,appBlockId:o,query:s}){let a=`${b(e)}${t}`,i=new URLSearchParams(ie);for(let[u,d]of s)i.append(u,d);return r?i.append("section_id",r):o&&i.append("app_block_id",o),`${a}?${i}`}function b(e){return K(e)?`https://${N()}/cli/sfr`:`https://${e.storeFqdn}`}function K(e){return e.token.startsWith("shptka_")}function pe(e){return{"X-Shopify-Shop":e.storeFqdn,"X-Shopify-Access-Token":e.token}}p();var A="Shopify CLI",le=720*60*60,Q=["Signature","Signature-Input","Signature-Agent"],J="unstable",me=`
14
- query StorefrontCrawlerSignatures($first: Int!, $expired: Boolean, $cli: Boolean, $domain: String) {
15
- storefrontCrawlerSignatures(first: $first, expired: $expired, cli: $cli, domain: $domain) {
16
- edges {
17
- node {
18
- id
19
- name
20
- domainHost
21
- signature
22
- signatureInput
23
- signatureAgent
24
- expiresAt
25
- }
26
- }
27
- }
28
- }
29
- `,he=`
30
- mutation StorefrontCrawlerSignatureGenerate($timeToLive: Int!, $name: String!, $domainHost: String!, $cli: Boolean) {
31
- storefrontCrawlerSignatureGenerate(timeToLive: $timeToLive, name: $name, domainHost: $domainHost, cli: $cli) {
32
- id
33
- signature
34
- signatureInput
35
- signatureAgent
36
- name
37
- expiresAt
38
- domainHost
39
- userErrors {
40
- field
41
- message
42
- code
43
- }
44
- }
45
- }
46
- `;async function te(e,t=e.storeFqdn){try{let o=(await _(me,e,{first:1,expired:!1,cli:!0,domain:t},J)).storefrontCrawlerSignatures;if(!o)throw f(new l("Could not fetch Shopify CLI crawler signatures."));let s=o.edges[0]?.node;if(s){h("theme-service:crawler-signature:reused");let u=ee(s);return c(`Reusing crawler signature "${A}" for ${s.domainHost} (${Z(u)}).`),u}let a=(await _(he,e,{timeToLive:le,name:A,domainHost:t,cli:!0},J)).storefrontCrawlerSignatureGenerate;if(!a)throw f(new l("Could not create a Shopify CLI crawler signature."));if(a.userErrors.length>0){let u=a.userErrors.map(d=>{let m=d.field?.join(".");return m?`${m}: ${d.message}`:d.message}).join(`
47
- `);throw f(new l("Could not create a Shopify CLI crawler signature.",u))}h("theme-service:crawler-signature:created");let i=ee(a);return c(`Created crawler signature "${A}" for ${a.domainHost} expiring at ${a.expiresAt} (${Z(i)}).`),i}catch(r){let o=r instanceof Error?r.message:String(r);c(`Could not obtain crawler signature headers; continuing without them. ${o}`);return}}function Z(e){let t=Object.keys(e),r=Q.filter(s=>t.some(n=>n.toLowerCase()===s.toLowerCase())),o=Q.filter(s=>!r.includes(s));return`present: ${r.join(", ")||"none"}; missing: ${o.join(", ")||"none"}`}function ee(e){if(!e.signature||!e.signatureInput||!e.signatureAgent)throw f(new l("The Shopify CLI crawler signature response did not include all required headers."));return{Signature:e.signature,"Signature-Input":e.signatureInput,"Signature-Agent":e.signatureAgent}}p();var ge=1800*1e3,re=["layout/theme.liquid","config/settings_schema.json"];async function ht(e,t,r,o,s){let n=await oe(e,t,r,o,s);return n.refresh=async()=>{c("Refreshing theme session...");let a=await oe(e,t,r,o,n.crawlerSignatureHeaders);return h("theme-service:session:refreshed"),Object.assign(n,a),a},setInterval(()=>{n.refresh&&n.refresh().then(()=>c("Refreshed theme session via auto-refresher...")).catch(()=>c("Session could not be refreshed."))},ge),n}async function oe(e,t,r,o,s){let n=b(t),a=s??await te(t),i=await q(t.storeFqdn,r,[],{forceRefresh:!1,noPrompt:!0}),u=await I([],r,{forceRefresh:!1,noPrompt:!0}),d=await we(n,e,t,u,o,a);return{...i,sessionCookies:d,storefrontToken:u,crawlerSignatureHeaders:a}}async function we(e,t,r,o,s,n){try{return await B(e,r.storeFqdn,t,s,{"X-Shopify-Shop":r.storeFqdn,"X-Shopify-Access-Token":r.token,Authorization:`Bearer ${o}`,...n})}catch(a){throw a instanceof $&&await Se(t,r),a}}async function Se(e,t){if(c(`Verifying if theme with id ${e} has required files...`),(await j(Number(e),re,t)).length!==re.length)throw f(new l(D`Theme ${R.cyan(e)} is missing required files. Run ${R.cyan(`shopify theme delete -t ${e}`)} to delete it, then try your command again.`.value));c(`Theme with id ${e} has required files.`)}export{S as a,T as b,Ie as c,qe as d,ae as e,Me as f,k as g,Ge as h,ie as i,Je as j,ce as k,Y as l,b as m,te as n,ht as o,oe as p};
@@ -1,26 +0,0 @@
1
- import{a as Yt}from"./chunk-UOHNRH6E.js";import{b as zr}from"./chunk-QKVVJXWS.js";import{a as Yr}from"./chunk-YKS7MH3F.js";import{a as Jr}from"./chunk-7WPUV7GY.js";import{a as Qr}from"./chunk-53BG3NLH.js";import{a as Mr}from"./chunk-AYL6KBPE.js";import{a as Or,b as Nr,c as Wr,d as qr}from"./chunk-PYIICTLX.js";import{a as Kr}from"./chunk-SL3VBI62.js";import{a as Hr}from"./chunk-4GCI2YCZ.js";import{a as jr}from"./chunk-Z5SILNH2.js";import{a as Vr}from"./chunk-HIRTL45Q.js";import{a as Gr}from"./chunk-ZYQ2XWC5.js";import{a as Br}from"./chunk-CCMDZX35.js";import{a as br}from"./chunk-PMHP57MH.js";import{a as Ir}from"./chunk-5NEGOQT6.js";import{a as Tr}from"./chunk-5UWMXOHM.js";import{a as Cr}from"./chunk-M4BVLMPH.js";import{g as _r}from"./chunk-LVLAOBJM.js";import{a as ct}from"./chunk-BCYTZ7LM.js";import{c as it,n as lt}from"./chunk-DNMXVMJM.js";import{a as kr}from"./chunk-RFGEM5JC.js";import{a as $r}from"./chunk-SFPXYHHL.js";import{a as Ar}from"./chunk-N2RFDHRY.js";import{b as Ur,g as Fe,j as at,u as Rr}from"./chunk-5TB52UUV.js";import{a as Dr}from"./chunk-GCNA3HXH.js";import{a as _o,b as Lo,c as Co,d as ko}from"./chunk-U25W35TX.js";import{d as Fr}from"./chunk-UWMZ5CSB.js";import{a as Er,b as Sr,c as Ao,d as Io,e as dt,f as To,g as $o}from"./chunk-3G4HJO72.js";import{a as M,b as st}from"./chunk-SFQEHDJY.js";import{a as gr,b as wr,d as ke,f as yr,m as $e,n as B,s as j,u as vr,v as Pr,w as xr}from"./chunk-Q7BOSHWX.js";import{a as hr}from"./chunk-R7EMV77H.js";import{a as Fo,b as Do,c as Mo,d as ft,e as Oo,f as No,g as Wo,h as qo,i as Ho,j as jo,k as Go,l as Bo,m as Ko,n as Vo,o as zo,p as mt}from"./chunk-MXJAH2GW.js";import{a as Po,b as ut,c as oe,d as xo}from"./chunk-PEVIRAMR.js";import{a as Eo,b as So,c as bo,d as Uo,e as Ro}from"./chunk-EMSF57ZB.js";import{a as Zr}from"./chunk-YVY32DNA.js";import{a as vo}from"./chunk-UVRKTMF7.js";import{a as yo}from"./chunk-ZGV3HNEV.js";import{a as Xr}from"./chunk-FWB3GLMW.js";import{Aa as Oe,L as po,Ma as wo,N as uo,P as re,Z as fo,_ as ho,i as eo,ia as go,j as G,k as to,n as oo,p as ls,t as pt,u as no,v as so,w as ao,x as io,y as co,z as lo,za as Me}from"./chunk-3C6VLJ5D.js";import{D as ro,oa as mo,r as De,w as de}from"./chunk-WDFCOZAY.js";import{a as Lr}from"./chunk-D7NB7YR6.js";import{d as dr}from"./chunk-UOS2XLGG.js";import{a as z}from"./chunk-IQVRP7CT.js";import{M as Bt,_ as ee,aa as Kt,c as Wt,h as qt,j as Ht,m as jt,o as Gt,p as Se,ta as Vt,u as be}from"./chunk-H4V55Y3Z.js";import{b as fr,c as mr,e as Ce}from"./chunk-Q2SZCZE7.js";import{B as pe,I as Te,M as sr,O as _e,T as Le,U as ue,V as nt,W as ir,Y as cr,a as Nt,d as D,e as Ue,f as tt,g as F,h as N,j as Re,k as Ae,l as Jt,m as Qt,n as Xt,o as Zt,p as er,q as tr,r as rt,s as ot,t as rr,u as or,w as nr,z as Ie}from"./chunk-CZ22VZDA.js";import{b as le,d as Ee,j as Mt,m as Ot}from"./chunk-335BUVBP.js";import{a as ge}from"./chunk-BN7ZXAZJ.js";import{a as cs}from"./chunk-7UNQOKZW.js";import{d as zt}from"./chunk-X7HVAVSZ.js";import{h as T,j as ar,k as te}from"./chunk-2VSNFOKD.js";import{a as Ne}from"./chunk-FFHH5LOR.js";import{Aa as Ct,Ba as kt,Bb as y,Cb as k,Da as $t,Hb as ur,Ma as xe,P as Xe,Sa as O,Va as ce,_a as Ft,bb as Dt,la as C,qb as R,sb as I,ta as Pe,va as Z,xa as Ze,ya as Lt,yb as V}from"./chunk-LWCTKI4Z.js";import{b as A,c as ae,d as ie,j as et}from"./chunk-FZCGRIOM.js";import{e as lr,g as pr}from"./chunk-3A3DZVEJ.js";import{b as is}from"./chunk-YTUUU33R.js";import{a as At}from"./chunk-JD5P5RAJ.js";import{c as U,e as Qe,f as It,h as we,i as ye,j as ve,n as Tt,o as _t}from"./chunk-IWTNUJGY.js";import{e as X,g as u}from"./chunk-VKWPEFWQ.js";u();u();u();u();u();u();var ps=300*1e3,us='The host theme could not be created to host your theme app extension. Please try again or use the "--theme" flag to use an existing theme as the host theme.';async function Yo(t,e,r=Date.now()){for(;await ds(t,e,r););}async function ds(t,e,r){let o=await Fe(t,e);if(!o||fs(o,r))throw new T(us);return await ue(3),o.processing}function fs(t,e){return t.processing&&Date.now()-e>=ps}var ms="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",hs="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",ht=3,We=class extends Ar{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=Or(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??=this.devPreview?await this.createHostTheme():await this.create(),e}setTheme(e){Nr(this.adminSession.storeFqdn,e)}removeTheme(){Wr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:Ur,name:this.generateThemeName(this.context),src:ms};for(let o=0;o<ht;o++){y(`Attempt ${o}/${ht}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await at(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),y(`Waiting for theme with id "${n.id}" to be processed`),await Yo(n.id,this.adminSession),n;throw new Error}catch(n){if(n instanceof ar||Rr(n))throw n;y(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}y(`Theme creation failed after ${ht} retries. Creating theme using fallback theme zip`);let r=await at({...e,src:hs},this.adminSession);if(!r)throw y("Theme creation failed. Exiting process."),new te(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};u();var gs={"theme:init":Dr,"theme:check":br,"theme:console":Ir,"theme:delete":Tr,"theme:dev":Cr,"theme:duplicate":kr,"theme:info":$r,"theme:language-server":Mr,"theme:list":qr,"theme:metafields:pull":Kr,"theme:open":Hr,"theme:package":jr,"theme:profile":Gr,"theme:publish":Br,"theme:preview":Vr,"theme:pull":zr,"theme:push":Yr,"theme:rename":Jr,"theme:share":Qr},Ii=gs;async function Jo(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(x=>x.isThemeExtension);if(n.length===0)return;let s=n[0].directory,i=t.themeExtensionPort??9293,[l,f]=await Promise.all([Bt(t.storeFqdn),vs(e)]),c=l.storeFqdn,[p,h]=await Promise.all([lt(l),it(l)]),g=h?await ct(t.storePassword,c,p):void 0,d=await ys(l,t.theme),m=d.id.toString();return Ie({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:f}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${c}/admin/themes/${m}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:ws,options:{theme:d,adminSession:l,storefrontPassword:g,crawlerSignatureHeaders:p,themeExtensionDirectory:s,themeExtensionPort:i}}}var ws=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:a,themeExtensionPort:s})=>{await(await _r(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:a,themeExtensionPort:s})).start()};async function ys(t,e){let r;if(e)y(`Fetching theme with provided id ${e}`),r=await Fe(parseInt(e,10),t);else{let o=new We(t,{devPreview:!0});await Te([{title:"Configuring host theme for theme app extension",task:async()=>{y("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new T("Could not find or create a host theme for theme app extensions");return r}async function vs(t){return t.developerPlatformClient?.clientName===mo.AppManagement?`https://${await Se()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Gt()}/${t.organizationId}/apps/${t.id}/test`}u();u();u();u();u();u();async function Ps(t){let e=U(t.directory,"locales");return ce([U(e,"*.json")])}async function Qo(t,e){let r=await Ps(t);if(!r.length)return{localization:void 0,status:""};let o=e.currentLocalizationPayload??{defaultLocale:"en",translations:{},lastUpdated:0},n="success";try{await Promise.all(r.map(async a=>{let[s,...i]=a.split("/").pop().split(".");if(s)return i[0]==="default"&&(o.defaultLocale=s),xs(s,a,o,t,e)})),o.lastUpdated=Date.now(),y(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function xs(t,e,r,o,n){let a;try{a=await C(e),r.translations[t]=JSON.parse(a)}catch(s){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${s.message}`;throw k(i,n.stderr),new Error(i)}}u();function qe(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}var gt=".js.map";async function ne(t,e,r,o){return D({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),a=`${r.url}/extensions/${t.devUUID}`,{localization:s,status:i}=await Qo(t,r),l=await to(t),f=t.outputRelativePath?we(n):n,c=await Es(t,a,f,o),p=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(p=Xo(t.configuration.metafields)),{assets:{main:fe(c)&&c[0]?.assets?.main?c[0].assets.main:{name:"main",url:`${a}/assets/${t.outputFileName}`,lastUpdated:await xe(n)??0}},supportedFeatures:{runsOffline:t.configuration.supported_features?.runs_offline??!1},capabilities:{blockProgress:t.configuration.capabilities?.block_progress??!1,networkAccess:t.configuration.capabilities?.network_access??!1,apiAccess:t.configuration.capabilities?.api_access??!1,collectBuyerConsent:{smsMarketing:t.configuration.capabilities?.collect_buyer_consent?.sms_marketing??!1,customerPrivacy:t.configuration.capabilities?.collect_buyer_consent?.customer_privacy??!1},iframe:{sources:t.configuration.capabilities?.iframe?.sources??[]}},development:{...r.currentDevelopmentPayload,resource:qe(t.type,r),root:{url:a},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:c,localization:s??null,metafields:p,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:l?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function Es(t,e,r,o){let n=t.configuration,a=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(a=[{target:"purchase.post.render"}]),fe(a)){let s=await Ss(r);return Promise.all(a.map(async i=>{let{target:l,resource:f}=i,c="metafields"in i?Xo(i.metafields??[]):void 0,p={...i,...c?{metafields:c}:{},surface:Oe(l),root:{url:`${e}/${l}`},resource:f||{url:""}},h=s?.[l];if(!h)return p;let d=await Ts(h,{target:l,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...p,...d}}))}return a}async function Ss(t){try{let e=U(t,"manifest.json"),r=await C(e);return JSON.parse(r)}catch(e){if(e instanceof SyntaxError)throw new Error(`Invalid manifest.json in ${t}: ${e.message}`);return null}}async function bs({target:t,extensionPoint:e,url:r,extension:o,resolver:n},a,s){let i=`${t}/${a}`,l=e[a];if(typeof l=="string"){let g=await He(a,i,typeof s=="string"?s:l,r,o,n,typeof s=="string"?l:void 0);return{assets:{[g.name]:g}}}let c=e.build_manifest?.assets?.[a];if(c?.filepath){let p=await He(a,i,c.filepath,r,o,n,c.module);return{assets:{[p.name]:p}}}return{}}async function Us({target:t,url:e,buildDirectory:r,resolver:o},n,a){if(a.length===0)return{};for(let i of a)o?.set(`${t}/${i}`,i);let s=await Promise.all(a.map(async i=>await xe(U(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...s)}}}}async function Rs({target:t,extensionPoint:e,url:r,extension:o,resolver:n},a){return e.intents?{intents:await Promise.all(e.intents.map(async(i,l)=>{let f=i.schema,c=a[l]?.schema,p=typeof c=="string"?c:f,h=typeof c=="string"?f:void 0;return{...i,schema:await He("schema",`${t}/intents/${l}/schema`,p,r,o,n,h)}}))}:{}}async function As({target:t,url:e,extension:r,resolver:o},n,a){let s=await He(n,`${t}/${n}`,a,e,r,o);return await Is(t,a,r,o),{assets:{[s.name]:s}}}async function Is(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(gt)&&await O(U(r.directory,n))&&o.set(`${t}/${ye(n)}`,n)}async function Ts(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return _s(o,n)?Rs(e,n):Ls(o,n)?As(e,o,n):Cs(o,n)?Us(e,o,n):bs(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function Xo(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function fe(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function He(t,e,r,o,n,a,s){let i=`${e}${ve(r)}`;return a?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await xe(U(n.directory,s??r))??0}}function _s(t,e){return t==="intents"&&Array.isArray(e)}function Ls(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function Cs(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as ks}from"events";var me;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(me||(me={}));async function Zo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:Ao(t.storeFqdn,t.apiKey),mobileUrl:To(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>ne(n,e,t,r&&wt(r,n.devUUID))))}}function wt(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var je=class extends ks{options;rawPayload;assetResolvers;constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=ee(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(a=>a.uuid===o.uuid);if(n){if(fe(n.extensionPoints)&&fe(o.extensionPoints)){let a=n.extensionPoints.reduce((l,f)=>({...l,[f.target]:f}),{});o.extensionPoints=ee(o.extensionPoints,n.extensionPoints,l=>l.map(f=>{let c=a[f.target];return c?ee(f,c,(p,h)=>h):f}));let{extensionPoints:s,...i}=n;return ee(o,i)}return ee(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let a=this.rawPayload.extensions,s=a.findIndex(i=>i.uuid===e.devUUID);if(s===-1){y(I`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}a[s]=await ne(e,o,{...this.options,currentDevelopmentPayload:n??{status:a[s]?.development.status},currentLocalizationPayload:a[s]?.localization},wt(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=a,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await ne(e,r,this.options,wt(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(me.Update,e)}};u();u();var Y;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(Y||(Y={}));function en(t,e){return(r,o,n)=>{r.url==="/extensions"&&(y("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,$s(t,e)))}}function $s(t,e){return r=>{y("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};y(I`Sending connected payload: ${R.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",Ns(t,e))}}function Fs(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?R.json(o).output():String(o)).join(" ");return I`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var Ds={debug:t=>R.gray(t),warn:t=>R.yellow(t),error:t=>R.errorText(t)};function Ms({type:t,message:e}){let r=Fs(e);switch(t){case"debug":case"warn":case"error":return I`${Ds[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function Os(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(Ms(t))})}function Ns(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:a}=o;if(y(I`Received websocket message with event type ${n} and data:
2
- ${R.json(a)}
3
- `,e.stdout),n===Y.Update){let s=e.payloadStore.getRawPayload().app.apiKey,i=a.app?.apiKey;if(a.app){if(s!==i)return;e.payloadStore.updateApp(a.app)}a.extensions&&e.payloadStore.updateExtensions(a.extensions)}else if(n===Y.Dispatch){let s=Ws(o,e);rn(t,s,e)}else n===Y.Log&&Os(a,e)}}function tn(t,e){return r=>{let o={event:Y.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};y(I`Sending websocket update event to the websocket clients:
4
- ${R.json(o)}
5
- `,e.stdout),rn(t,o,e)}}function rn(t,e,r){y(I`Sending websocket with event type ${e.event} and data:
6
- ${R.json(e.data)}
7
- `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function Ws(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var qs=10;function on(t){let e=new Yt.default({noServer:!0,clientTracking:!0}),r=Hs(e);return t.httpServer.on("upgrade",en(e,t)),t.payloadStore.on(me.Update,tn(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function Hs(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},qs*1e3)}u();u();u();function nn(t,e){let{url:r}=qe(t.type,e);if(t.surface==="checkout"&&r){let o=new URL(`https://${e.storeFqdn}/`);return o.pathname=r,o.searchParams.append("dev",`${e.url}/extensions`),o.toString()}else{let o=new URL(`https://${e.storeFqdn}/`);return o.pathname="admin/extensions-dev",o.searchParams.append("url",Ge(t,e)),o.toString()}}function sn(t,e,r){let o=Oe(t),n=new URL(`https://${r.storeFqdn}/`);switch(o){case"checkout":n.pathname=r.checkoutCartUrl,n.searchParams.append("dev",`${r.url}/extensions`);break;case"post_purchase":if(n.pathname=r.checkoutCartUrl,n.searchParams.set("script_url",`${r.url}/extensions/${e.devUUID}/assets/${e.localIdentifier}.js`),n.searchParams.set("post_purchase_dev_api_key",r.apiKey),e.devUUID&&r.websocketURL&&(n.searchParams.set("uuid",e.devUUID),n.searchParams.set("socket_url",r.websocketURL)),"metafields"in e.configuration){let a={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(a))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",Ge(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=js(e,r,t);break;default:return}return n.toString()}function js(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,a="shopify.com",s=new URL(`https://${a}/${n}/account/extensions-development`);return s.searchParams.append("origin",o),s.searchParams.append("extensionId",t.devUUID),s.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),s.searchParams.append("appId",e.id??""),r!==""&&s.searchParams.append("target",r),s}function Ge(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function H(t,e){wr(t,gr(e))}u();var yt=class extends te{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function an(t){let e=await Gs(t),r=await C(e);return hr(r,t.data)}async function Gs(t){let e=await Bs(),r=[];t.extensionSurface&&r.push(U(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(U(e,`${t.template}.html.liquid`));let o=await ce(r);if(o.length===0)throw new yt(t);return o[0]}async function Bs(){return await Ft("templates/ui-extensions/html",{type:"directory",cwd:_t(import.meta.url)})}var cn=j(t=>{B(t,"Access-Control-Allow-Origin","*"),B(t,"Access-Control-Allow-Methods","GET, OPTIONS"),B(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),ln=j(t=>{B(t,"Cache-Control","no-cache")}),vt=j(async t=>$e(t,"/extensions",307));async function Ks(t,e){let{filePath:r}=e;if(!await O(r))return H(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await $t(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await O(r)))return H(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await C(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".map":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},a=ve(r),s=n[a]||"text/plain";return B(t,"Content-Type",s),o}function pn({getExtensions:t,payloadStore:e}){return j(async r=>{let{extensionId:o,assetPath:n=""}=ke(r),a=t().find(h=>h.devUUID===o);if(!a)return H(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(a.devUUID)?.get(n),l=i??n,f=l.endsWith(gt);if(f&&i===void 0)return H(r,{statusCode:404,statusMessage:"Not Found"});let c=Qe(f?a.directory:oo(a.outputPath)),p=Qe(U(c,l));return Tt(c,p)?Ks(r,{filePath:p}):H(r,{statusCode:404,statusMessage:"Not Found"})})}function Pt({payloadStore:t}){return j(e=>(B(e,"content-type","application/json"),t.getRawPayload()))}function un({devOptions:t}){return j(e=>{y(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function xt({devOptions:t,getExtensions:e}){return j(async r=>{let{extensionId:o}=ke(r),n=e().find(i=>i.devUUID===o);if(!n)return H(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(yr(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return an({data:{url:Ge(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=nn(n,t);return $e(r,i,307)}}let s=t.appWatcher.buildOutputPath;return B(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:se(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await ne(n,s,t)}})}function dn({devOptions:t,getExtensions:e}){return j(async r=>{let{extensionId:o,extensionPointTarget:n=""}=ke(r),a=e().find(i=>i.devUUID===o);if(!a)return H(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(a.configuration.type!=="checkout_post_purchase"&&!a.hasExtensionPointTarget(n))return H(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let s=sn(n,a,t);return s?$e(r,s,307):H(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as Vs}from"http";function fn(t){let e=vr(),r=Pr();e.use(un(t)),e.use(cn),e.use(ln),r.use("/extensions/dev-console",vt),r.use("/extensions/:extensionId",xt(t)),r.use("/extensions/:extensionId/",xt(t)),r.use("/extensions/:extensionId/:extensionPointTarget",dn(t)),r.use("/extensions/:extensionId/assets/**:assetPath",pn(t)),r.use("/extensions",Pt(t)),r.use("/extensions/",Pt(t)),r.use("/",vt),e.use(r);let o=Vs(xr(e));return o.listen(t.devOptions.port,"localhost"),o}async function mn(t){let e={...t,websocketURL:se(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Zo(e,r,o),a=new je(n,e,o),s=e.extensions.filter(p=>p.isPreviewable),i=()=>s;y("Setting up the UI extensions HTTP server...",e.stdout);let l=fn({devOptions:e,payloadStore:a,getExtensions:i});y("Setting up the UI extensions Websocket server...",e.stdout);let f=on({...e,httpServer:l,payloadStore:a});y("Setting up the UI extensions bundler and file watching...",e.stdout);let c=async({appWasReloaded:p,app:h,extensionEvents:g})=>{p&&(s=h.allExtensions.filter(d=>d.isPreviewable));for(let d of g){if(!d.extension.isPreviewable)continue;let m=d.buildResult?.status==="ok"?"success":"error",x=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case oe.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl){let S=await Me(e.extensions,e.storeFqdn);e.checkoutCartUrl=S}await a.addExtension(d.extension,r);break;case oe.Updated:await a.updateExtension(d.extension,e,r,{status:m,error:x});break;case oe.Deleted:e.extensions=e.extensions.filter(S=>S.devUUID!==d.extension.devUUID),await a.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(c).onStart(c),e.signal.addEventListener("abort",()=>{y("Closing the UI extensions dev server..."),f.close(),l.close()})}function se(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var zs="3",Ys=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:a,subscriptionProductUrl:s,port:i,cartUrl:l,proxyUrl:f,appName:c,appDotEnvFile:p,appId:h,grantedScopes:g,allExtensions:d,appDirectory:m,appWatcher:x})=>{await mn({appName:c,appDotEnvFile:p,appDirectory:m,id:h,extensions:d,stdout:e,stderr:t,signal:r,url:f,port:i,storeFqdn:be(n),storeId:a,apiKey:o,grantedScopes:g,checkoutCartUrl:l,subscriptionProductUrl:s,manifestVersion:zs,appWatcher:x})};async function hn({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(s=>s.isPreviewable),a=await Me(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:Ys,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:a,...o}}}u();u();function J(t){let e=t.find(o=>re(o,G.Frontend)),r=t.find(o=>re(o,G.Backend));return{frontendConfig:e,backendConfig:r}}u();async function gn(t){let r={topic:"app/uninstalled",api_version:(await _o(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:ko.LOCALHOST,shared_secret:t.sharedSecret},o=await Lo(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await ue(3);let n=await Js(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function Js(t,e){let r=0;for(;r<3;){try{return await Co(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof qt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await ue(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var Qs=async({stdout:t},e)=>{await gn({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function wn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...a}){let{backendConfig:s,frontendConfig:i}=J(t),l=t.map(({configuration:c})=>c.webhooks_path).find(c=>c)??"/api/webhooks";if(l&&e&&(i??s))return{type:"send-webhook",prefix:"webhooks",function:Qs,options:{deliveryPort:s?r:o,webhooksPath:l,organizationId:n,...a}}}u();async function yn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Xs}}var Xs=async({stdout:t,abortSignal:e},r)=>{let o=$o({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=Sr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",()=>{n.close()})};u();async function Pn({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:a,scopes:s}){let{frontendConfig:i}=J(t),l=i?.configuration.hmr_server?await M():void 0,f=void 0,c=t.map(async p=>{let h=await Zs({web:p,frontendPort:r,backendPort:o}),g=l&&p.configuration.roles.includes(G.Frontend)?{port:l,httpPaths:p.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:p.configuration.name??["web",...p.configuration.roles].join("-"),function:ea,options:{port:h,portFromConfig:p.configuration.port,apiKey:n,apiSecret:a,hostname:e,backendPort:o,frontendServerPort:r,directory:p.directory,devCommand:p.configuration.commands.dev,preDevCommand:p.configuration.commands.predev,scopes:s,shopCustomDomain:f,hmrServerOptions:g,roles:p.configuration.roles}}});return Promise.all(c)}async function Zs({web:t,frontendPort:e,backendPort:r}){return re(t,G.Frontend)?e:re(t,G.Backend)?r:M()}async function ea({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:a,hostname:s,backendPort:i,frontendServerPort:l,directory:f,devCommand:c,preDevCommand:p,scopes:h,shopCustomDomain:g,hmrServerOptions:d}){let m=d?.port,x={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:a,HOST:s,SCOPES:h,NODE_ENV:"development",...g&&{SHOP_CUSTOM_DOMAIN:g},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${l}`,...m&&{HMR_SERVER_PORT:`${m}`},APP_URL:s,APP_ENV:"development",REMIX_DEV_ORIGIN:s},S={signal:r,directory:f,port:o,env:x,stdout:t,stderr:e};p&&(t.write(`Running pre-dev command: "${p}"`),await vn({...S,command:p,showOutput:lr()})),await vn({...S,command:c,showOutput:!0})}async function vn({command:t,signal:e,directory:r,port:o,env:n,showOutput:a,stdout:s,stderr:i}){let l=t.split("&&").map(f=>f.trim())??[];for(let f of l){let[c,...p]=f.split(" ");c?.length!==0&&await Le(c,p,{cwd:r,stdout:a?s:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}u();u();u();var Be=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(I`${R.yellow(e)}`.value)}async success(e){await this.log(I`${R.green(e)}`.value)}async debug(e){y(e,this.stdout)}async error(e,r){let o=R.errorText("\u274C Error"),n=R.errorText(`\u2514 ${e}`);await this.log(I`${o}`.value,r),await this.log(I`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let a=n.on?n.on[0]:void 0,s=r.find(i=>i.uid===a?.user_identifier);return{error:n.message,prefix:s?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let a=n.extension.handle,s=`Extension ${n.type}`;await this.log(s,a)})}async logExtensionUpdateMessages(e,r){if(!e||r.status==="remote-error"||r.status==="unknown-error")return;let o={status:r.status},n=e.extensionEvents??[],s=(await Promise.all(n.map(async l=>l.type===oe.Deleted?[]:(await l.extension.getDevSessionUpdateMessages(o))?.map(c=>({message:c,prefix:l.extension.handle}))??[]))).flat(),i=s.map((l,f)=>{let c=I`${R.gray(f===s.length-1?"\u2514 ":"\u2502 ")}${l.message}`.value;return this.log(c,l.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=R.errorText("\u274C Error");await this.log(I`${r}`.value,"app-preview");let o=e.map(n=>{let a=R.errorText(`\u2514 ${n.error}`);return this.log(I`${a}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(`${e}
8
- `)})}};u();var Ke=class{processBatch;queue=[];processingPromise=void 0;constructor(e){this.processBatch=e}enqueue(e){this.queue.push(e),this.processingPromise??=this.startProcessing()}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var Ve=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}statusManager;logger;options;appWatcher;bundlePath;appEventsProcessor;failedEvents=[];currentSessionState=null;constructor(e,r){this.statusManager=e.devSessionStatusManager,this.logger=new Be(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ke(o=>this.processEvents(o))}async start(){await this.logger.info(`Preparing dev preview on ${this.options.storeFqdn}`),this.statusManager.setMessage("LOADING"),this.appWatcher.onEvent(async e=>this.onEvent(e)).onStart(async e=>this.onStart(e)).onError(async e=>this.handleDevSessionResult({status:"unknown-error",error:e}))}async onEvent(e){await this.validateAppEvent(e)&&this.appEventsProcessor.enqueue(e)}async processEvents(e){let r=[...this.failedEvents,...e],o=this.consolidateAppEvents(r);if(this.failedEvents=[],!o)return;this.statusManager.setMessage("CHANGE_DETECTED"),this.updatePreviewURL(o),await this.logger.logExtensionEvents(o);let n=Po(),a=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(a,o),await this.logger.debug(`\u2705 Event handled [Network: ${ut(n)}ms - Total: ${ut(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let s of e)for(let i of s.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(s=>s.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new T(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:o.buildResult?.status==="error"&&o.buildResult.error||"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){if(e.status==="updated")await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage();else if(e.status==="created")this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r,e),this.statusManager.setMessage("READY");else if(e.status==="remote-error"||e.status==="unknown-error"){let o=e.error instanceof Error?[e.error.message]:e.error.map(n=>n.message);await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR",o):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR",o))}!this.statusManager.status.isReady&&!pr()&&setImmediate(()=>{throw new T("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:this.options.appPreviewURL,appEmbedded:e.app.configuration.embedded,hasExtensions:r})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),a=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),s=se(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:a,manifest:r,inheritedModuleUids:o,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:a,websocketUrl:s,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new T("Auth session expired. Please run `shopify app dev` again.");if(r instanceof Wt)throw r.response.status===401||r.response.status===403?new T("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new T("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await Eo(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let a=await Dt(this.bundlePath),s=n.modules.map(i=>i.assets).filter(i=>a.includes(i));return{manifest:n,inheritedModuleUids:o,assets:s}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=U(we(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(s=>`${s}/**`),...So];r&&n.push("manifest.json"),await bo(this.bundlePath,o,n);let a=await this.getSignedURLWithRetry();return await Uo(a,o),a}async getSignedURLWithRetry(){return Ro(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.warnings??[],a=r.devSessionUpdate?.devSession;if(a&&this.currentSessionState){let s=se(this.options.url),i=this.currentSessionState?.userId;if(a.websocketUrl!==s||a.user?.id!==i){let l=a.user?.email;await this.logger.error(`Another developer ${l?`(${l}) `:""}has taken ownership of this dev preview.`);let f=`Another user${l?` (${l})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,c=["You can restart by running",{command:"shopify app dev"},"again."];throw new T(f,c)}this.currentSessionState={websocketUrl:a.websocketUrl,userId:a.user?.id??null,userEmail:a.user?.email??null}}return n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],a=r.devSessionCreate?.devSession;return a&&(this.currentSessionState={websocketUrl:a.websocketUrl,userId:a.user?.id??null,userEmail:a.user?.email??null}),n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"created"}}async logWarnings(e){await Promise.all(e.map(r=>{let o=r.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${r.message}`:r.message;return this.logger.warning(o)}))}};async function xn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:ta,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var ta=async({stdout:t},e)=>{await Ve.start(e,t)};u();u();u();var En=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let a=Ee().substring(0,6),i=`${ra(t.log_timestamp)}_${t.source_namespace}_${t.source}_${a}.json`,l=zo({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),f=U(n,i);try{return await Z(n),await Pe(f,l),{fullOutputPath:f,identifier:a}}catch(c){throw r.write(`Error while writing log to file: ${c}
9
- `),c}};function ra(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),a=e.getUTCHours().toString().padStart(2,"0"),s=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),l=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${a}${s}${i}_${l}Z`}var ze=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:a,organizationId:s,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:f=0})=>{if(!i?.aborted)try{let c=e,p=Mo,h=f,g=await o.appLogs({jwtToken:e,cursor:r},s),{errors:d,status:m}=g;if(m===200){h=0;let{app_logs:S}=g;for(let v of S){let w=JSON.parse(v.payload);await D({outputPrefix:v.source,stripAnsi:!1},async()=>{v.log_type===Wo?(oa(v,w,t),w=new Fo(Do(w))):v.log_type.startsWith(qo)?na(v,w,t):t.write(JSON.stringify(w));let E=await En({appLog:v,appLogPayload:w,stdout:t,storeName:a,logsDir:l});t.write(I`${R.gray("\u2514 ")}${R.link("Open log file",`file://${E.fullOutputPath}`,`Log: ${E.fullOutputPath}`)} ${R.gray(`(${E.identifier})`)}\n`.value)})}}else{let S={errors:d.map(w=>({message:w,status:m}))},v=await Vo({response:S,onThrottle:w=>{k("Request throttled while polling app logs.",t),k(`Retrying in ${w/1e3} seconds.`,t)},onUnknownError:w=>{k("Error while polling app logs.",t),k(`Retrying in ${w/1e3} seconds.`,t)},onResubscribe:()=>n()});if(v.resubscribeResult==="failed"){if(h+=1,h>=Oo){k("App log streaming session has expired. Please restart your dev session.",t);return}}else v.resubscribeResult==="succeeded"&&(h=0);v.nextJwtToken&&(c=v.nextJwtToken),p=v.retryIntervalMs}let{cursor:x}=g;setTimeout(()=>{ze({stdout:t,appLogsFetchInput:{jwtToken:c,cursor:x??r},developerPlatformClient:o,resubscribeCallback:n,storeName:a,organizationId:s,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:h}).catch(S=>{y(`Unexpected error during polling: ${S}}
10
- `)})},p)}catch(c){k("Error while polling app logs.",t),k(`Retrying in ${ft/1e3} seconds.`,t),y(`${c}}
11
- `),setTimeout(()=>{ze({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:a,organizationId:s,abortSignal:i,logsDir:l}).catch(p=>{y(`Unexpected error during polling: ${p}}
12
- `)})},ft)}};function oa(t,e,r){let o=(e.fuel_consumed/No).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
13
- `).filter(Boolean).map(a=>I`${R.gray("\u2502 ")}${a}`.value).join(`
14
- `))}function na(t,e,r){t.log_type===Ho?r.write("Function network access response retrieved from cache."):t.log_type===jo?e.reason===Bo?r.write("Function network access request executing in background because there is no cached response."):e.reason===Ko&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===Go&&(t.status==="success"?r.write("Function network access request executed successfully."):t.status==="failure"&&r.write(`\u274C Function network access request failed to execute with error: ${e.error}.`))}function sa(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function Sn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:a,localApp:s}){return{type:"app-logs-subscribe",prefix:"app-logs",function:aa,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:a,localApp:s}}}var aa=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:a,organizationId:s,appWatcher:i,localApp:l})=>{async function f(c){let p=await mt(o,n,s,t),h=l.getLogsDir();await Z(h),await ze({stdout:t,appLogsFetchInput:{jwtToken:p},resubscribeCallback:()=>mt(o,n,s),developerPlatformClient:o,storeName:a,organizationId:s,abortSignal:c,logsDir:h})}try{let c=!1,p,h=async g=>{let d=sa(g.app);if(d&&!c){y("Function extensions detected, starting logs polling"),c=!0,p=new AbortController;try{await f(p.signal)}catch(m){y(`Failed to start function logs: ${m}`,e)}}else!d&&c&&(y("No function extensions detected, stopping logs polling"),c=!1,p?.abort(),p=void 0)};i.onStart(h).onEvent(h)}catch{}};u();async function bn(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:ia}}var ia=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};u();import{EventEmitter as ca}from"events";var la={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},Ye=class extends ca{currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0};constructor(e){super(),e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};Kt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e,r){let o=la[e],n=o.type==="success"?[]:r;this.updateStatus({statusMessage:o,...n?{errors:n}:{}})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};u();import*as Un from"http";import*as Rn from"https";function An(t){return"errors"in t&&Array.isArray(t.errors)}async function In(t,e,r,o){let a=(await import("./http-proxy-node16-D3JUYA5D.js")).default.createProxyServer(),s=ua(t,a,o),i=r?Rn.createServer(r,s):Un.createServer(s);return i.on("upgrade",pa(t,a,o)),e.addEventListener("abort",()=>{y("Closing reverse HTTP proxy"),i.close()}),{server:i}}function pa(t,e,r){return function(o,n,a){let s=Tn(t,o,!0);if(s)return e.ws(o,n,a,{target:s},i=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let f=(An(i)?i.errors[i.errors.length-1]:void 0)??i;k(`Error forwarding websocket request: ${f.message}`,r),k(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});n.destroy()}}function ua(t,e,r){return function(o,n){let a=Tn(t,o);if(a)return o.method==="OPTIONS"?(n.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin??"*","Access-Control-Allow-Methods":o.headers["access-control-request-method"]??"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]??"Content-Type, Authorization","Access-Control-Max-Age":"86400"}),n.end()):e.web(o,n,{target:a},s=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let l=(An(s)?s.errors[s.errors.length-1]:void 0)??s;k(`Error forwarding web request: ${l.message}`,r),k(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});y(I`
15
- Reverse HTTP proxy error - Invalid path: ${o.url??""}
16
- These are the allowed paths:
17
- ${R.json(JSON.stringify(t))}
18
- `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function Tn(t,e,r=!1){let o=e.url??"/";for(let n in t)if(o.startsWith(n))return t[n];return r&&t.websocket?t.websocket:t.default}async function _n({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:a,commandOptions:s,network:i,graphiqlPort:l,graphiqlKey:f}){let c=o.apiKey,p=o.apiSecretKeys[0]?.secret??"",h=Mt(),g=!At(h[De.disableGraphiQLExplorer]),d=await uo(t),m=new xo(d,i.proxyUrl),x=await Se(),S=Io(n,c,x),v=S,w=Er(f,p,n),E=g?`http://localhost:${l}/graphiql?key=${encodeURIComponent(w)}`:void 0,L=d.configuration.embedded,W=d.nonConfigExtensions.length>0,q=new Ye({isReady:!1,previewURL:v,graphiqlURL:E,appEmbedded:L,hasExtensions:W}),b=[...await Pn({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:c,apiSecret:p,scopes:eo(d.configuration)}),g?await yn({appName:o.title,appUrl:S,port:l,apiKey:c,apiSecret:p,key:w,storeFqdn:n}):void 0,await hn({allExtensions:d.realExtensions,storeFqdn:n,storeId:a,apiKey:c,subscriptionProductUrl:s.subscriptionProductUrl,checkoutCartUrl:s.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:m}),await xn({app:d,apiKey:c,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:m,appPreviewURL:S,devSessionStatusManager:q,unsafeValidation:s.unsafeValidation}),await Jo({remoteApp:o,localApp:d,storeFqdn:n,theme:s.theme,themeExtensionPort:s.themeExtensionPort,storePassword:s.storePassword}),wn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:p,remoteAppUpdated:e}),await Sn({developerPlatformClient:r,subscription:{shopIds:[Number(a)],apiKey:c},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:m}),await bn({appWatcher:m})].filter(da);return{processes:await fa(b,i.proxyPort,i.reverseProxyCert),previewUrl:v,graphiqlUrl:E,devSessionStatusManager:q}}var da=t=>t!==void 0&&t!==!1;async function fa(t,e,r){let o=await Promise.all(t.map(async s=>{let i={};if(s.type==="web"&&s.options.roles.includes(G.Frontend)){let l=s.options.portFromConfig??s.options.port;i.default=`http://localhost:${l}`;let f=s.options.hmrServerOptions;f&&(i.websocket=`http://localhost:${f.port}`,f.httpPaths.forEach(c=>i[c]=`http://localhost:${f.port}`)),s.options.port=l}else if(s.type==="previewable-extension"){let l=await M();i[s.options.pathPrefix]=`http://localhost:${l}`,s.options.port=l}return{process:s,rules:i}})),n=o.map(({process:s})=>s),a=o.map(({rules:s})=>s).reduce((s,i)=>({...s,...i}),{});return Object.keys(a).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:ma,options:{port:e,rules:a,localhostCert:r}}),n}var ma=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:a}=await In(o,t,n,e);V(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await a.listen(r,"localhost")};u();u();u();var _=X(tt(),1);var Ln=.9,Cn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Jt(),{isRawModeSupported:o}=Re(),[n,a]=(0,_.useState)(e),[s,i]=(0,_.useState)(Math.floor(r.columns*Ln)),[l,f]=(0,_.useState)(!0),c=(0,_.useRef)(null);if(!n)throw new Error("No tabs provided");Ae((d,m)=>{(async()=>{if(m?.leftArrow||m?.rightArrow||m?.tab){let w=Object.entries(t).filter(([b,K])=>K.content),E=w.findIndex(([b])=>b===n);if(E===-1)return;let L=m?.leftArrow?-1:1,W=(E+L+w.length)%w.length,q=w[W];q&&a(q[0])}let S=t[d];if(S){S.action?await S.action():a(d);return}let v=t[n];if(v?.shortcuts){let w=v.shortcuts.find(E=>E.key===d);w&&(!w.condition||w.condition())&&await w.action()}})()},{isActive:!!o}),(0,_.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*Ln)),!c.current)return;let m=Qt(c.current);f(m.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let p=Object.entries(t).map(([d,m])=>({...m,inputKey:d,header:` (${d}) ${m.label} `})),h=p.filter(d=>!d.action),g=p.filter(d=>d.action);return _.default.createElement(_.default.Fragment,null,_.default.createElement(F,{paddingTop:0,width:s,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},_.default.createElement(F,{ref:c,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},_.default.createElement(N,{wrap:"truncate-end"},"\u2502",h.map(d=>_.default.createElement(_.default.Fragment,{key:d.inputKey},_.default.createElement(N,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),l&&_.default.createElement(F,{flexGrow:1,justifyContent:"flex-end"},g.map((d,m)=>_.default.createElement(N,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,m<g.length-1&&" \u2502 ")))),_.default.createElement(F,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var P=X(tt(),1);var ha=({message:t,type:e})=>e==="loading"?P.default.createElement(nr,{title:t}):P.default.createElement(N,null,e==="success"?"\u2705":"\u274C"," ",t),kn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:a,organizationName:s,configPath:i,localURL:l,onAbort:f})=>{let{isRawModeSupported:c}=Re(),[p,h]=(0,P.useState)(void 0),[g,d]=(0,P.useState)(void 0),[m,x]=(0,P.useState)(r.status),[S,v]=(0,P.useState)(!1),{isAborted:w}=or(t.signal,async b=>{b&&d(typeof b=="string"?b:b.message),r.status.isReady?v(!0):(h("Shutting down dev ..."),await f()),Ne()}),E=(0,P.useMemo)(()=>e.map(b=>({...b,action:async(K,ns,ss)=>{try{return await b.action(K,ns,ss)}catch(as){t.abort(as)}}})),[e,t]);(0,P.useEffect)(()=>(r.on("dev-session-update",x),()=>{r.off("dev-session-update",x)}),[]),Ae((b,K)=>{Zt(b,K,()=>t.abort())},{isActive:!!c});let L=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:m.previewURL,condition:()=>!!(m.isReady&&m.previewURL),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),m.previewURL&&await _e(m.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:dt(o),condition:()=>!!(m.isReady&&m.appEmbedded===!1&&m.hasExtensions),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await _e(dt(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:m.graphiqlURL,condition:()=>!!(m.isReady&&m.graphiqlURL),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),m.graphiqlURL&&await _e(m.graphiqlURL)}}],W=L.filter(b=>b.condition?.()??!0),q={d:{label:"Dev status",shortcuts:L,content:P.default.createElement(P.default.Fragment,null,m.statusMessage&&P.default.createElement(ha,{message:m.statusMessage.message,type:m.statusMessage.type}),c&&W.length>0&&P.default.createElement(F,{marginTop:1,flexDirection:"column"},W.map(b=>P.default.createElement(N,{key:b.key},er.pointerSmall," ",P.default.createElement(N,{bold:!0},"(",b.key,")")," ",nt()&&b.url?P.default.createElement(rt,{url:b.url,label:b.shortcutLabel}):b.shortcutLabel))),P.default.createElement(F,{marginTop:c?1:0,flexDirection:"column"},p?P.default.createElement(N,null,p):P.default.createElement(P.default.Fragment,null,m.isReady&&!(c&&nt())&&P.default.createElement(P.default.Fragment,null,W.filter(b=>b.url).map(b=>P.default.createElement(N,{key:b.key},b.linkLabel," URL: ",P.default.createElement(rt,{url:b.url})))))))},a:{label:"App info",content:P.default.createElement(F,{flexDirection:"column"},P.default.createElement(ot,{tabularData:[["App:",a??""],["App URL:",n??""],["Local URL:",n?"":l??""],["Config:",i?.split("/").pop()??""],["Org:",s??""]].filter(([,b])=>b)}))},s:{label:"Store info",content:P.default.createElement(F,{flexDirection:"column"},P.default.createElement(ot,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",s??""]].filter(([,b])=>b)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return P.default.createElement(P.default.Fragment,null,P.default.createElement(tr,{processes:E,prefixColumnSize:ro,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),S&&P.default.createElement(F,{marginTop:1,flexDirection:"column"},P.default.createElement(rr,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),w?null:P.default.createElement(F,{paddingTop:1,flexDirection:"column",flexGrow:1},c?P.default.createElement(Cn,{tabs:q,initialActiveTab:"d"}):P.default.createElement(F,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},q.d?.content)),g?P.default.createElement(F,{marginTop:1,flexDirection:"column"},P.default.createElement(N,{color:"red"},g)):null)};var Fn=X(tt(),1);import{Writable as Dn}from"stream";async function Mn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:a,devSessionStatusManager:s,appURL:i,appName:l,organizationName:f,configPath:c,localURL:p}){let h=()=>o.abort();process.on("shopify:signal",h);try{if(et()!=="json"&&ir())return await Xt(Fn.default.createElement(kn,{processes:t,abortController:o,devSessionStatusManager:s,shopFqdn:a,appURL:i,appName:l,organizationName:f,configPath:c,localURL:p,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:a})}}),{exitOnCtrlC:!1});await ga({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o}),Ne()}finally{process.removeListener("shopify:signal",h)}}async function ga({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){let n=et()==="json";n||(process.stdout.write(`
19
- Preview URL: ${e}
20
- `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
21
- `));let{signal:a}=o,s=()=>o.abort();process.once("SIGINT",s),process.once("SIGTERM",s);let i=()=>{},l=new Promise(c=>{i=c,a.addEventListener("abort",i,{once:!0}),a.aborted&&c()}),f=t.map(async c=>{let p=new Dn({write:(h,g,d)=>d()});return c.action(n?p:$n(process.stdout),n?p:$n(process.stderr),a)});try{await Promise.all([...f,l])}catch(c){if(!a.aborted)throw c}finally{o.abort(),await Promise.allSettled(f),a.removeEventListener("abort",i),process.removeListener("SIGINT",s),process.removeListener("SIGTERM",s)}}function $n(t){return new Dn({decodeStrings:!1,write(e,r,o){let n=typeof e=="string"?Buffer.from(e,r):e,a=typeof e=="string"&&n.length>0&&n[n.length-1]!==10;t.write(a?Buffer.concat([n,Buffer.from(`
22
- `)]):n,o)}})}u();function On(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];pe({headline:[`A random port will be used for ${n.for} because ${n?.requested} is not available.`],body:["If you want to use a specific port, you can choose a different one by setting the ",{command:n?.flagToRemedy}," flag."]});return}let r=Xe(e.map(n=>n.for)).join(" "),o=Xe(e.map(n=>({command:n.flagToRemedy})));pe({headline:[`Random ports will be used for ${r} because the requested ports are not available.`],body:["If you want to use specific ports, you can choose different ports using the",...o,"flags."]})}u();async function Nn(t,e){return e?e.includes("localhost")?"localhost":(await jt(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}u();var Wn=X(cs(),1);var Q="v1.4.4",qn="FiloSottile/mkcert",Et=R.genericShellCommand("mkcert");async function wa(t,e,r,o){let n=e[De.mkcertBinaryPath];if(n)return n;let s=U(t,r==="win32"?"mkcert.exe":"mkcert");if(await O(s))return s;let i=await(0,Wn.default)("mkcert",{nothrow:!0});return i?(y(I`Found ${Et} at ${R.path(i)}`),i):(await ya(s,r,o),s)}async function ya(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${Q}-darwin-arm64`:`mkcert-${Q}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${Q}-linux-arm64`:`mkcert-${Q}-linux-amd64`;break;case"win32":o=`mkcert-${Q}-windows-amd64.exe`;break;default:throw new te(`Unsupported platform: ${e}`)}await Fr(qn,Q,o,t),y(I`${Et} saved to ${R.path(t)}`)}async function va(t){let e=U(t,"mkcert-LICENSE");if(await O(e))return;let r=`https://raw.githubusercontent.com/${qn}/refs/tags/${Q}/LICENSE`,o={headline:"Failed to download mkcert license.",body:["We tried to download the license for mkcert, but the request failed. You can ",{link:{url:r,label:"view the license here"}}]},n;try{if(n=await Ht(r),!n.ok)return o}catch{return o}let a=await n.text();await Pe(e,a)}async function Hn({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let a=U(".shopify","localhost-key.pem"),s=U(".shopify","localhost.pem"),i=U(t,a),l=U(t,s);if(await O(i)&&await O(l))return{keyContent:await C(i),certContent:await C(l),certPath:s};if(!(e??await fo()))throw new T(`Localhost certificate and key are required at ${s} and ${a}`);let c="",p;return await Te([{title:"Finding or downloading mkcert binary",task:async()=>{let g=U(t,".shopify");c=await wa(g,r,o,n),p=await va(g),y(I`${Et} found at: ${R.path(c)}`)}}]),p&&Ie(p),V(I`Generating self-signed certificate for localhost. You may be prompted for your password.`),await Le(c,["-install","-key-file",i,"-cert-file",l,"localhost"]),V(I`${R.successIcon()} Certificate generated at ${s}\n`),await cr()&&(pe({headline:"It looks like you're using WSL.",body:["Additional steps are required to configure certificate trust in Windows."],link:{label:"See Shopify CLI documentation",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development-with-windows-subsystem-for-linux-wsl"}}),V("\u{1F449} Press any key to continue"),await sr(),V("")),{keyContent:await C(i),certContent:await C(l),certPath:It(t,l)}}u();function jn(){let t=["Your app has extensions which need to be assigned",{command:"uid"},"identifiers."],e=["You must first map IDs to your existing extensions by running",{command:"shopify app deploy"},"interactively, without",{command:"--allow-updates"},"or",{command:"--allow-deletes"},", to finish the migration."],r={title:"Reference",body:{list:{items:[{link:{label:"Migrating from the Partner Dashboard",url:"https://shopify.dev/docs/apps/build/dev-dashboard/migrate-from-partners"}}]}}};throw new T(t,void 0,[e],[r])}u();u();import{createWriteStream as Pa}from"fs";import{Writable as xa}from"stream";import{finished as Ea}from"stream/promises";import{StringDecoder as Sa}from"string_decoder";import{once as ba}from"events";var he=ge({name:"DevInstanceLogEntry",schema:A.object({timestamp:ae,source:A.string().describe("What produced the line, for example a process prefix like web or extensions."),level:A.enum(["debug","info","warning","error"]).optional(),message:A.string()}).strict()});function Bn({logFile:t,logOutput:e,isActive:r,onError:o}){let n=Pa(t,{flags:"w",mode:384});n.on("error",o),e?.on("error",o);let a=ba(n,"open"),s=new Set,i=async l=>{if(!r())return;let f=he.validate({...l,timestamp:l.timestamp??ie(new Date)}),c=`${JSON.stringify(f)}
23
- `;try{await Je(n,c),e&&await Je(e,c)}catch(p){throw o(p),p}};return{opened:a,log:i,tee:(l,{source:f,stringWritesAreMessages:c=!1})=>{let p=new Sa("utf8"),h="",g=f,d=async v=>{let w=v.split(/\r?\n/);h=w.pop()??"",await Promise.all(w.map(async E=>{let L=ur(E).trimEnd();L.length>0&&await i({source:g,message:L})}))},m=()=>d(`${h}${p.end()}
24
- `),x=new St({decodeStrings:!c,write(v,w,E){let L=Ue()?.outputPrefix??f,W=c&&typeof v=="string",q=L!==g||W?m():Promise.resolve();g=L,Promise.all([q,Je(l,v,w),d(h+p.write(typeof v=="string"?Buffer.from(v,w):v)+(W?`
25
- `:""))]).then(()=>E()).catch(E)},final(v){m().then(()=>v()).catch(v)}}),S=v=>x.destroy(v);return l.on("error",S),x.on("error",v=>o(v)),x.once("close",()=>{l.off("error",S)}),s.add(x),x},flush:()=>Promise.allSettled([...s].map(l=>Gn(l))),close:async()=>{try{await Gn(n),e&&!e.destroyed&&await Je(e,"")}finally{e?.off("error",o)}}}}var St=class extends xa{contexts=[];constructor(e){super({...e,write:(r,o,n)=>{D(this.contexts.shift()??{},()=>e.write.call(this,r,o,n))}})}write(e,r,o){return this.contexts.push(Ue()),typeof r=="string"?super.write(e,r,o):super.write(e,r??o)}end(e,r,o){return e!=null&&typeof e!="function"&&this.contexts.push(Ue()),typeof e=="function"?super.end(e):typeof r=="string"?super.end(e,r,o):super.end(e,r??o)}};async function Je(t,e,r="utf8"){await new Promise((o,n)=>{t.write(e,r,a=>a?n(a):o())})}async function Gn(t){let e=Ea(t,{cleanup:!0});t.end(),await e}var Vn=X(ls());import bt,{readFileSync as Ua}from"fs";import{mkdir as Ra,rmdir as Aa,writeFile as Ia}from"fs/promises";var Ut="dev_instance_already_running",Ta="dev",_a=15e3;function La(t){let e=U(t.directory,".shopify",Ta),r=Fa(t);return{folder:e,infoFile:U(e,`${r}.json`),lockFile:U(e,`${r}.lock`),logFile:U(e,`${r}.jsonl`)}}async function Ca(t){let e=La(t);await Lr(t.directory),await Z(e.folder);let r=`${e.lockFile}.acquire`;try{await Ra(r,{mode:448})}catch(o){if(o.code!=="EEXIST")throw o;let n=new T(`Another \`shopify ${t.command}\` is starting, or a previous startup was interrupted.`,"Wait for other starts to finish. If none is running, remove the startup lock below and try again.",[["Startup lock",{filePath:r}]]);throw n.code=Ut,n}try{return await ka(t,e)}catch(o){if(!$a(o))throw o;let n=await Jn(e.infoFile);throw Qn(t,n&&Yn(n.pid)?n:void 0)}finally{await Aa(r)}}async function zn(t,e){let r=await Ca(t);try{return await e(r)}finally{await r.release()}}async function ka(t,e){let r=await Jn(e.infoFile);if(r&&Yn(r.pid))throw Qn(t,r);let o=Ee(),n=new AbortController,a=!1,s=()=>{if(a)return!1;try{return JSON.parse(Ua(e.infoFile,"utf8")).sessionId===o}catch{return!1}},i=!1,l=w=>{if(!(i&&!s()))try{bt.rmdirSync(w)}catch(E){if(E.code!=="ENOENT")throw E}},f={realpath:!1,lockfilePath:e.lockFile,stale:_a,retries:0,onCompromised:w=>{a=!0,y(`The ${t.command} instance lock was compromised: ${w.message}`),n.abort(new T(`The ${t.command} instance lost its lock.`,"Start the command again."))},fs:{...bt,rmdir:(w,E)=>{if(i&&!s())return E(null);bt.rmdir(w,E)},rmdirSync:l}};r&&await kt(e.lockFile,{force:!0});let c=await Vn.default.lock(e.infoFile,f),p=ie(new Date),h={schemaVersion:1,sessionId:o,command:t.command,...t.key?{key:t.key}:{},pid:process.pid,status:"starting",startedAt:p,updatedAt:p,directory:t.directory,logFile:e.logFile,details:{...t.details??{}}},g=Promise.resolve(),d=!1,m=Bn({logFile:e.logFile,logOutput:t.logOutput,isActive:()=>!d&&!a,onError:w=>n.abort(w)}),x,S=()=>{!d&&s()&&(l(e.lockFile),Ct(e.infoFile))};process.once("exit",S);let v={info:h,paths:e,abortSignal:n.signal,update:async w=>{if(x||a)return;w.status&&(h.status=w.status),w.details&&(h.details={...h.details,...w.details}),h.updatedAt=ie(new Date);let E={...h,details:{...h.details}},L=g.then(async()=>{a||await Kn(e.infoFile,E)});g=L.catch(()=>{}),await L},log:m.log,tee:m.tee,release:()=>(x??=(async()=>{try{let E=(await m.flush()).find(L=>L.status==="rejected");if(await g,E?.status==="rejected")throw E.reason}finally{d=!0,process.removeListener("exit",S);try{await m.close()}finally{let w=s();await c().catch(E=>y(`Failed to release the dev instance lock: ${E.message}`)),w&&await Ze(e.infoFile).catch(()=>{})}}})(),x)};try{return await m.opened,await Kn(e.infoFile,h),i=!0,v}catch(w){throw await v.release().catch(E=>y(E.message)),await Ze(`${e.infoFile}.${o}.tmp`),w}}function Yn(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}async function Jn(t){try{let e=JSON.parse(await C(t));return typeof e?.pid=="number"?e:void 0}catch{return}}async function Kn(t,e){let r=`${t}.${e.sessionId}.tmp`;await Ia(r,`${JSON.stringify(e,null,2)}
26
- `,{mode:384}),await Lt(r,t)}function $a(t){return t?.code==="ELOCKED"}function Fa({command:t,key:e}){let r=[t,e].filter(Boolean).join("-").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),o=le(JSON.stringify([t,e??""])).slice(0,4);return`${r}-${o}`}function Qn(t,e){let r=`shopify ${t.command}`;if(!e){let s=new T(`Another \`${r}\` is starting for this project.`,"Wait a few seconds and try again, or stop the other process first.");return s.code=Ut,s}let o=process.platform==="win32"?`taskkill /PID ${e.pid} /F`:`kill ${e.pid}`,n=Object.entries(e.details).filter(([,s])=>typeof s=="string"||typeof s=="number"||typeof s=="boolean").map(([s,i])=>[s,String(i)]),a=new T(`Another \`${r}\` is already running for this project.`,"Use the running instance, or stop it before starting a new one.",[["Read its output in",{filePath:e.logFile}],["Stop it with",{command:o}]],[{body:{tabularData:[["PID",String(e.pid)],["Started",e.startedAt],...n],firstColumnSubdued:!0}}]);return a.code=Ut,a.details={instance:e},a}function Zn({app:t,remoteApp:e,json:r=!1},o){return zn({command:"app dev",directory:t.directory,key:ye(t.configPath),details:{configPath:t.configPath,appName:e.title,clientId:e.apiKey},logOutput:r?process.stdout:void 0},o)}async function es(t){let e=await Da(t);await Ma(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:a}=await _n(e);await Na(e),await Ha({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:a})}async function Da(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:a,tunnel:s}=t,i;if(s.mode==="auto"){let S=await M();i=await lo(t.commandConfig,S,"cloudflare")}let l=await ho(r,o,a,r.flags);r.configuration=l,go({app:e,remoteApp:r,selectedStore:n,cachedInfo:pt(t.directory),organization:t.organization,tunnelMode:s.mode}),e.configuration.build?.dev_store_url&&(e.configuration.build={...e.configuration.build,dev_store_url:n.shopDomain},await(await dr.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Zr(t.project);let f=t.graphiqlPort??await M(de.graphiql),c=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??de.graphiql,actual:f}];s.mode==="use-localhost"&&c.push({for:"localhost",flagToRemedy:"--localhost-port",requested:s.requestedPort,actual:s.actualPort}),On(c);let{webs:p,...h}=await qa(e.directory,e.webs,f,s,i,r.configuration,t.installMkcert);e.webs=p;let g=e.configuration.build?.automatically_update_urls_on_dev,d=pt(t.directory)?.previousAppId,m=r.apiKey,x=await Wa(p,t.update,h,e,g,r,m);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==d,localApp:e,developerPlatformClient:o,commandOptions:t,network:h,partnerUrlsUpdated:x,graphiqlPort:f,graphiqlKey:t.graphiqlKey}}async function Ma(t){await Oa(t)}async function Oa(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||jn()}async function Na(t){no({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await ja({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Vt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Wa(t,e,r,o,n,a,s){let{backendConfig:i,frontendConfig:l}=J(t),f=!1;if((l??i)&&e){let c=ao(r.proxyUrl,t.map(({configuration:p})=>p.auth_callback_path).find(p=>p),o.configuration.app_proxy);f=await co({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:a.newApp,localApp:o,apiKey:s,newURLs:c}),f&&o.setDevApplicationURLs(c)}return f}async function qa(t,e,r,o,n,a,s){let{backendConfig:i,frontendConfig:l}=J(e);await Ga(e,r);let f=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:c,frontendPort:p,usingLocalhost:h},g,d]=await Promise.all([so(f),Ot()??i?.configuration.port??M(),io(a)]),m=h?`${c}:${p}`:c,x=l?.configuration.port;l&&(x??=l===i?g:await M(),l.configuration.port=x),x=x??await M();let S;if(o.mode==="use-localhost"){let{keyContent:v,certContent:w,certPath:E}=await Hn({appDirectory:t,forceInstall:s});S={key:v,cert:w,certPath:E,port:o.actualPort}}return{proxyUrl:m,proxyPort:p,frontendPort:x,backendPort:g,currentUrls:d,webs:e,reverseProxyCert:S}}async function Ha({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let a=new Nt,s=o.commandOptions.devInstance,i=t.map(g=>({prefix:g.prefix,action:async(m,x,S)=>{let v=g.function,w=s?s.tee(m,{source:g.prefix,stringWritesAreMessages:!0}):m,E=s?s.tee(x,{source:g.prefix,stringWritesAreMessages:!0}):x;return v({stdout:w,stderr:E,abortSignal:S},g.options)}}));if(s){let g={storeFqdn:o.storeFqdn,previewUrl:e,graphiqlUrl:r,appUrl:o.localApp.devApplicationURLs?.applicationUrl,localUrl:o.network.proxyUrl};await s.update({status:"running",details:{...g,preview:Xn(n.status)}}),await s.log({source:"app dev",level:"info",message:`Preview URL: ${e}`}),r&&await s.log({source:"app dev",level:"info",message:`GraphiQL URL (Admin API): ${r}`})}let l=o.developerPlatformClient,f={id:o.remoteApp.id,developerPlatformClient:l},c,p=g=>{let d=[s?.update({details:{preview:Xn(g)}})],m=g.statusMessage;m&&(m.message!==c?.message||m.type!==c?.type)&&d.push(s?.log({source:"app dev",level:m.type==="error"?"error":"info",message:m.message})),c=m,Promise.all(d).catch(x=>{y(`Failed to save dev status: ${x.message}`)})};s&&(n.on("dev-session-update",p),p(n.status));let h=()=>a.abort(s?.abortSignal.reason);try{s?.abortSignal.throwIfAborted(),s?.abortSignal.addEventListener("abort",h,{once:!0}),await Mn({processes:i,previewUrl:e,graphiqlUrl:r,app:f,abortController:a,shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl}),s?.abortSignal.throwIfAborted()}finally{s?.abortSignal.removeEventListener("abort",h),s&&n.off("dev-session-update",p)}}function Xn({isReady:t,statusMessage:e,errors:r}){let o=t?"ready":"starting";return t&&e?.type==="loading"&&(o="updating"),e?.type==="error"&&(o="error"),{state:o,message:e?.message??null,errors:r??[]}}async function ja(t){let e=await Nn(t.devOptions.commandConfig,t.tunnelUrl);await z.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?le(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:le(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await z.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function Ga(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,a)=>r.indexOf(n)!==a);if(o)throw new T(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await st(n))throw new T(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await st(e)){let a=`Port ${e} is not available for serving GraphiQL.`,s=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new T(a,s)}})()])}u();var ts=A.object({state:A.enum(["starting","updating","ready","error"]),message:A.string().nullable(),errors:A.array(A.string())}).strict().describe("The CLI-reported preview state in the instance file; this is not a health check."),Ba=A.object({schemaVersion:A.literal(1),sessionId:A.string(),command:A.literal("app dev"),key:A.string().optional(),pid:A.number().int().positive(),status:A.enum(["starting","running"]),startedAt:ae,updatedAt:ae,directory:A.string(),logFile:A.string(),details:A.object({configPath:A.string(),appName:A.string(),clientId:A.string(),storeFqdn:A.string().optional(),previewUrl:A.string().optional(),graphiqlUrl:A.string().optional(),appUrl:A.string().optional(),localUrl:A.string().optional(),preview:ts.optional()}).strict()}).strict().describe("The instance JSON file under .shopify/dev/. This object is not emitted to stdout."),rs=ge({name:he.name,schema:he.schema,definitions:{DevInstance:Ba,DevPreview:ts}});u();async function os({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??de.localhost,n=await M(o);if(e&&n!==o){let a=`Port ${e} is not available.`,s=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new T(a,s)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var $=X(is(),1);var Rt=class t extends yo{static get requiresSyncAnalytics(){return!0}static summary="Run the app.";static descriptionWithMarkdown="Builds and previews your app on a dev store, and watches for changes. [Read more about testing apps locally](https://shopify.dev/docs/apps/build/cli-for-apps/test-apps-locally).";static get jsonOutputSchema(){return rs}static description=this.descriptionForHelp();static flags={...fr,...Xr,...mr,"client-id":$.Flags.string({hidden:!1,description:"The Client ID of your app. Use with --config to run dev with that configuration for a different app than the one it is linked to.",env:"SHOPIFY_FLAG_CLIENT_ID"}),store:$.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>be(e)}),"skip-dependencies-installation":$.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":$.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"unsafe-validation":$.Flags.boolean({description:"Allow app dev to continue with warnings for eligible app version validation failures.",env:"SHOPIFY_FLAG_UNSAFE_VALIDATION",default:!1}),"subscription-product-url":$.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":$.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":$.Flags.string({description:'Use a custom tunnel, it must be running before executing dev. Format: "https://my-tunnel-url:port".',env:"SHOPIFY_FLAG_TUNNEL_URL",exclusive:["tunnel"]}),"use-localhost":$.Flags.boolean({description:"Service entry point will listen to localhost. A tunnel won't be used. Will work for testing many app features, but not those that directly invoke your app (E.g: Webhooks)",env:"SHOPIFY_FLAG_USE_LOCALHOST",exclusive:["tunnel-url"]}),"install-mkcert":$.Flags.boolean({description:"Install and use mkcert to generate localhost certificates when --use-localhost is enabled without prompting.",env:"SHOPIFY_FLAG_INSTALL_MKCERT",dependsOn:["use-localhost"]}),"localhost-port":Ce({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:$.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Ce({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":$.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:$.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":Ce({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":$.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(t),r=await os({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await zt(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await po(e.path);let o=await wo({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config});return Zn({...o,json:e.json},async n=>{let a=await vo({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option"}),s={...o,store:a,directory:e.path,update:!e["no-update"],unsafeValidation:e["unsafe-validation"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],storePassword:e["store-password"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],installMkcert:e["install-mkcert"],tunnel:r,devInstance:n};return await es(s),{app:o.app}})}};export{Ii as a,Rt as b};
@@ -1,8 +0,0 @@
1
- import{c as ae}from"./chunk-XM7YUXTF.js";import{b as P}from"./chunk-R7EMV77H.js";import{a as fe}from"./chunk-XBQDMGUN.js";import{a as de}from"./chunk-ZGV3HNEV.js";import{a as ie}from"./chunk-FWB3GLMW.js";import{a as re}from"./chunk-XTREQ4A2.js";import{L as le,Ma as ue,N as me,d as ce,e as pe}from"./chunk-3C6VLJ5D.js";import{s as k,u as oe,v as se}from"./chunk-WDFCOZAY.js";import{a as F}from"./chunk-IQVRP7CT.js";import{C as B,p as O,x as W,y as S}from"./chunk-IUP7POIE.js";import{b as te,c as ne,f as A}from"./chunk-Q2SZCZE7.js";import{A as H,B as z,E as X,G as K,I as R,K as Q}from"./chunk-CZ22VZDA.js";import{e as b}from"./chunk-335BUVBP.js";import{a as G}from"./chunk-BN7ZXAZJ.js";import{h as d}from"./chunk-2VSNFOKD.js";import{Na as Y,Sa as x,Ta as J,Va as V,X as h,_ as U,ja as w,pa as q,rb as T,va as v,wb as ee,xa as E}from"./chunk-LWCTKI4Z.js";import{b as f}from"./chunk-FZCGRIOM.js";import{f as Z}from"./chunk-3A3DZVEJ.js";import{b as Se}from"./chunk-YTUUU33R.js";import{c as m,e as N,g as D,m as L,p as $}from"./chunk-IWTNUJGY.js";import{e as Oe,g as l}from"./chunk-VKWPEFWQ.js";l();l();l();async function he(e,t,r,n={}){let{templates:a,groupOrder:i}=await e.templateSpecifications(t,n);return{templates:a.filter(o=>r.includes(o.identifier)||r.includes(o.type)),groupOrder:i}}l();l();async function ye(e,t){let r=e?.path??"",n=m(t,r);if(!await x(n))throw new d(`
2
- The extension is not available for ${e?.value}`);return n}async function xe({name:e,app:t}){let r=U(e),n=m(t.directory,se.extensions.directoryName,r);if(await x(n))throw new d(`
3
- A directory with this name (${r}) already exists.
4
- Choose a new name for your extension.`);return await v(n),await q(m(n,k.lockFile)),n}function C(e){switch(e){case"vanilla-js":case"preact":case"react":case"typescript":case"typescript-react":return"javascript";case"rust":case"wasm":return e;case void 0:case"liquid":case"config-only":return}}async function ge(e){let t=e.extensionChoices.name,r=e.extensionChoices.flavor,n=e.extensionTemplate.supportedFlavors.find(o=>o.value===r),a=await xe({app:e.app,name:t}),i=e.cloneUrl??e.extensionTemplate.url,s={directory:a,url:i,app:e.app,project:e.project,type:e.extensionTemplate.type,name:t,extensionFlavor:n,onGetTemplateRepository:e.onGetTemplateRepository??(async(o,p)=>{await ae({repoUrl:o,destination:p,shallow:!0})})};return await Re(s),{directory:L(a),extensionTemplate:e.extensionTemplate}}async function Re(e){try{switch(e.type){case"theme":await Ie(e);break;case"function":await je(e);break;default:await Me(e);break}let t=m(e.directory,k.lockFile);await E(t)}catch(t){throw await Ae(e.directory),e.project.packageManager==="pnpm"&&Ce(t)?new d("Your extension couldn't be generated because pnpm blocked the build scripts of some of its dependencies.",null,[["Run",{command:"pnpm approve-builds"},"in your app directory to approve the build scripts."],["Run",{command:T(e.project.packageManager,"shopify app generate extension")},"again."]]):t}}async function Ae(e){try{await E(e,{maxRetries:10,retryDelay:100})}catch{z({headline:["Couldn't remove",{filePath:e},{char:"."}],body:"Delete this directory manually before generating an extension with the same name."})}}function Ce(e){return e instanceof Error&&e.message.includes("ERR_PNPM_IGNORED_BUILDS")}async function Ie({directory:e,url:t,type:r,name:n,extensionFlavor:a,onGetTemplateRepository:i}){return w(async s=>{let o=await I(t,a,s,i);await P(o,e,{name:n,type:r,uid:b(h(n))})})}async function je({directory:e,url:t,app:r,project:n,name:a,extensionFlavor:i,onGetTemplateRepository:s}){let o=C(i?.value),p=[];p.push({title:"Generating function extension",task:async()=>{if(await w(async c=>{let u=await I(t,i,c,s);await P(u,e,{name:a,handle:h(a),flavor:i?.value,uid:b(h(a))})}),o==="javascript"){let c=we(i?.value??"rust");await ve(e,c,"!(*.graphql)")}}}),o==="javascript"&&p.push({title:"Installing additional dependencies",task:async()=>{n.usesWorkspaces&&await O({packageManager:n.packageManager,directory:n.directory});let c=Ge(o);await S(c,{packageManager:n.packageManager,type:"prod",directory:n.usesWorkspaces?e:n.directory})}}),o==="javascript"&&p.push({title:"Building GraphQL types",task:async()=>{let c=re();try{await pe({directory:e,isJavaScript:!0},{...c,app:r})}finally{c.stdout!==process.stdout&&c.stdout.end(),c.stderr!==process.stderr&&c.stderr.end()}}}),await R(p)}async function Me({directory:e,url:t,app:r,project:n,name:a,extensionFlavor:i,onGetTemplateRepository:s}){let o=C(i?.value),p=[{title:"Generating extension",task:async()=>{let c=we(i?.value??"vanilla-js");await w(async u=>{let y=await I(t,i,u,s);await P(y,e,{srcFileExtension:c,name:a,handle:h(a),flavor:i?.value??"",uid:b(h(a))})}),o==="javascript"&&await ve(e,c)}},{title:"Installing dependencies",task:async()=>{let c=n.packageManager;if(n.usesWorkspaces)C(i?.value)==="javascript"&&await O({packageManager:c,directory:n.directory});else{await Ne(n.directory,i?.value);let u=m(e,"package.json"),y=await De(u);await S(y,{packageManager:c,type:"prod",directory:n.directory}),await E(u)}}}];p.push({title:"Update shared type definition",task:async()=>{await me(r)}}),await R(p)}function we(e){return{"vanilla-js":"js",preact:"jsx",react:"jsx",typescript:"ts","typescript-react":"tsx",rust:"rs",wasm:"wasm",liquid:"liquid","config-only":""}[e]??"js"}function Ge(e){let t=[];return e==="javascript"&&t.push({name:"@shopify/shopify_function",version:`~${ce}.0.0`}),t}async function ve(e,t,r="*"){let n=await V(m(e,"src",r)),a=[];for(let i of n)a.push(Y(i,`${i}.${t}`));await Promise.all(a)}async function Ne(e,t){t==="typescript-react"&&await B(e,{"@types/react":oe.reactTypes})}async function De(e){if(!await x(e))return[];let t=await W(e);return Object.entries(t?.dependencies??{}).map(([r,n])=>({name:r,version:n}))}async function I(e,t,r,n){let a=m(r,"download");return await v(a),await n(e,a),ye(t,a)}l();function Le(e,t=[]){let r=[...e.map(a=>({label:a.name,value:a.identifier,group:a.group||"Other",sortPriority:a.sortPriority??Number.MAX_SAFE_INTEGER})),...t.map(a=>({label:`${a.name} (limit reached)`,value:a.identifier,group:a.group||"Other",disabled:!0,sortPriority:a.sortPriority??Number.MAX_SAFE_INTEGER}))],n=(a,i)=>a.sortPriority===i.sortPriority?a.label.localeCompare(i.label):a.sortPriority-i.sortPriority;return r.sort(n)}var $e=async e=>{let t=e.extensionTemplates,r=e.templateType,n=e.extensionFlavor;if(!r){if(n&&(t=t.filter(p=>p.supportedFlavors.map(c=>c.value).includes(n))),t.length===0)throw new d("You have reached the limit for the number of extensions you can create.");r=await K({message:"Type of extension?",choices:Le(t,e.unavailableExtensions),groupOrder:e.groupOrder})}let a=t.find(p=>p.identifier===r),i=e.name||await Ee(e.directory,a.defaultName),s=e.extensionFlavor??await Ue(a);return{extensionTemplate:a,extensionContent:{name:i,flavor:s}}};async function Ee(e,t,r=1){let n=t.includes(" ")?" ":"-",a=r<=1?t:`${t}${n}${r}`,i=m(e,h(a));return J(i)?Ee(e,t,r+1):Q({message:"Name your extension:",defaultValue:a})}async function Ue(e){if(e.supportedFlavors.length!==0)return e.supportedFlavors.length===1&&e.supportedFlavors[0]?e.supportedFlavors[0].value:X({message:"What would you like to work in?",choices:e.supportedFlavors.map(t=>({label:t.name,value:t.value})),defaultValue:"react"})}var be=$e;async function qe(e){let{app:t,developerPlatformClient:r,remoteApp:n,specifications:a,template:i}=e,s=a.map(_e=>_e.identifier),{templates:o,groupOrder:p}=await he(r,n,s,{requestedTemplate:i}),c=await Ye(o,p,a,t,e),u=await be(c);await Ve(u,i);let y=We(u,t,e,r),M=await ge(y);return{status:"success",extension:{directory:M.directory,extensionTemplate:M.extensionTemplate,name:u.extensionContent.name,flavor:u.extensionContent.flavor},packageManager:e.project.packageManager}}async function Ye(e,t,r,n,a){let i=await He(a.template,n,e,r);Be(i,a.flavor);let{validTemplates:s,templatesOverlimit:o}=Je(e,r,n);return{templateType:i?.identifier,name:a.name,extensionFlavor:a.flavor,directory:m(a.directory,"extensions"),app:n,extensionTemplates:s??[],unavailableExtensions:o??[],reset:a.reset,groupOrder:t}}function Je(e,t,r){return fe(e,a=>!Te(r,t,a)?"validTemplates":"templatesOverlimit")}function Te(e,t,r){let n=r.type,a=t.find(s=>s.identifier===n||s.externalIdentifier===n);return e.extensionsForType({identifier:n,externalIdentifier:n}).length>=(a?.registrationLimit??1)}async function Ve(e,t){let{extensionContent:r}=e;return F.addPublicMetadata(()=>({cmd_scaffold_template_flavor:r.flavor,cmd_scaffold_type:e.extensionTemplate.identifier,cmd_scaffold_used_prompts_for_type:!t}))}function We(e,t,r,n){return{app:t,project:r.project,cloneUrl:r.cloneUrl,extensionChoices:e.extensionContent,extensionTemplate:e.extensionTemplate,developerPlatformClient:n}}function Be(e,t){if(!t||!e)return;let r=e.supportedFlavors.map(n=>n.value);if(!r.includes(t))throw new d("Invalid template for extension type",`Expected template to be one of the following: ${r.join(", ")}.`)}async function He(e,t,r,n){if(!e)return;let a=r.find(i=>i.identifier===e);if(!a){let i=await Z(),s=r.map(p=>p.identifier),o=i?"You might need to enable some flags on your Organization or App":void 0;throw new d(`Unknown extension type: ${e}.
5
- The following extension types are supported: ${s.join(", ")}`,o)}if(Te(t,n,a))throw new d(`Invalid extension type: ${e}`,`You have reached the limit of extension(s) of type ${a.type} per app`);return a}var Pe=qe;l();var ke=f.object({name:f.string().min(1).describe("The name selected for the generated extension."),type:f.string().min(1).describe("The extension type, such as function, theme, or ui_extension."),template:f.string().min(1).describe("The identifier of the selected extension template."),flavor:f.string().nullable().describe("The selected template flavor, or null when the template has no flavors."),directory:f.string().refine(D,"Expected an absolute filesystem path.").describe("The absolute native filesystem path of the generated extension directory.")}).strict(),_=G({name:"AppGenerateExtensionResult",schema:f.object({status:f.literal("success"),extension:ke}).strict(),definitions:{GeneratedExtension:ke}});l();function Fe(e,t=!1){let{extension:r,packageManager:n}=e;if(t){ee(_.encode({status:e.status,extension:{name:r.name,type:r.extensionTemplate.type,template:r.extensionTemplate.identifier,flavor:r.flavor??null,directory:N($(),r.directory)}}));return}H(ze(r.extensionTemplate,r.directory,n))}function ze(e,t,r){let n={headline:["Your extension was created in",{filePath:t},{char:"."}],nextSteps:[],reference:[]};return e.type!=="function"&&n.nextSteps.push(["To preview this extension along with the rest of the project, run",{command:T(r,"shopify app dev")}]),e.supportLinks[0]&&n.reference.push(["For more details, see the",{link:{label:"docs",url:e.supportLinks[0]}}]),n}var g=Oe(Se(),1);var j=class e extends de{static summary="Generate a new app Extension.";static descriptionWithMarkdown=`Generates a new [app extension](https://shopify.dev/docs/apps/build/app-extensions). For a list of app extensions that you can generate using this command, refer to [Supported extensions](https://shopify.dev/docs/apps/build/app-extensions/list-of-app-extensions).
6
-
7
- Each new app extension is created in a folder under \`extensions/\`. To learn more about the extensions file structure, refer to [App structure](https://shopify.dev/docs/apps/build/cli-for-apps/app-structure) and the documentation for your extension.
8
- `;static get jsonOutputSchema(){return _}static description=this.descriptionForHelp();static flags={...te,...ie,...ne,template:A(g.Flags.string({char:"t",hidden:!1,description:"Extension template",env:"SHOPIFY_FLAG_EXTENSION_TEMPLATE"})),name:A(g.Flags.string({char:"n",hidden:!1,description:"name of your Extension",env:"SHOPIFY_FLAG_NAME"})),"clone-url":g.Flags.string({hidden:!0,char:"u",description:"The Git URL to clone the function extensions templates from. Defaults to: https://github.com/Shopify/function-examples",env:"SHOPIFY_FLAG_CLONE_URL"}),flavor:g.Flags.string({hidden:!1,description:"Choose a starting template for your extension, where applicable. Required if non interactive when the selected extension template supports multiple flavors.",options:["vanilla-js","react","typescript","typescript-react","wasm","rust"],env:"SHOPIFY_FLAG_FLAVOR"})};async run(){let{flags:t}=await this.parse(e);await F.addPublicMetadata(()=>({cmd_scaffold_required_auth:!0,cmd_scaffold_template_custom:t["clone-url"]!==void 0,cmd_scaffold_type_owner:"@shopify/app"})),await le(t.path);let{app:r,project:n,specifications:a,remoteApp:i,developerPlatformClient:s}=await ue({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),o=await Pe({directory:t.path,reset:t.reset,name:t.name,cloneUrl:t["clone-url"],template:t.template,flavor:t.flavor,app:r,project:n,specifications:a,remoteApp:i,developerPlatformClient:s});return Fe(o,t.json),{app:r}}};export{j as a};
@@ -1,3 +0,0 @@
1
- import{a as L,b as g,d as P,g as w}from"./chunk-3G4HJO72.js";import{a as A}from"./chunk-SFQEHDJY.js";import{t as G}from"./chunk-OGWPS55W.js";import{a as F}from"./chunk-ZGV3HNEV.js";import{a as S}from"./chunk-FWB3GLMW.js";import{p as l,u as d}from"./chunk-H4V55Y3Z.js";import{b as v,e as b}from"./chunk-Q2SZCZE7.js";import{O as u,a as c}from"./chunk-CZ22VZDA.js";import{Cb as y,qb as f,sb as h,yb as i}from"./chunk-LWCTKI4Z.js";import{b as q}from"./chunk-YTUUU33R.js";import{e as Q,g as o}from"./chunk-VKWPEFWQ.js";o();o();o();import{randomBytes as x}from"crypto";function K(){return x(32).toString("hex")}function C(e){let r=new URL(`http://localhost:${e.port}/graphiql`);return r.searchParams.set("key",e.key),e.query&&r.searchParams.set("query",e.query),e.variables&&r.searchParams.set("variables",e.variables),e.apiVersion&&r.searchParams.set("api_version",e.apiVersion),r.toString()}async function I(e){let r=await A(e.port),t=g({stdout:e.stdout??process.stdout,port:r,storeFqdn:e.storeFqdn,tokenProvider:e.tokenProvider,key:e.key,appContext:e.appContext,protectMutations:e.protectMutations}),a=C({port:r,key:e.key,query:e.query,variables:e.variables,apiVersion:e.apiVersion});try{i(h`GraphiQL is running at ${f.link(a)}`),e.additionalReadyMessages?.forEach(s=>i(s)),i("Press Ctrl+C to stop."),await u(a)||y("Browser did not open automatically. Open the URL above manually."),await T(e.abortSignal)}finally{t.close()}}async function T(e){let r=new c,t=()=>r.abort();process.once("SIGINT",t);try{await new Promise(a=>{if(r.signal.aborted||e?.aborted){a();return}r.signal.addEventListener("abort",()=>a(),{once:!0}),e?.addEventListener("abort",()=>r.abort(),{once:!0})})}finally{process.removeListener("SIGINT",t)}}async function k(e){let r=e.remoteApp.apiSecretKeys[0]?.secret??"",t=L(void 0,r,e.store),a=w({apiKey:e.remoteApp.apiKey,apiSecret:r,storeFqdn:e.store}),m=await l(),s=P(e.store,e.remoteApp.apiKey,m);await I({port:e.port,storeFqdn:e.store,tokenProvider:a,key:t,appContext:{appName:e.remoteApp.title,appUrl:s,apiSecret:r},variables:e.variables,apiVersion:e.apiVersion,abortSignal:e.abortSignal})}var n=Q(q(),1),p=class e extends F{static summary="Open a local GraphiQL UI for your app and store.";static descriptionWithMarkdown=`Opens an authenticated Admin API GraphiQL UI for your app and selected store.
2
-
3
- The app must be installed on the store.`;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --port 9123"];static flags={...v,...S,store:n.Flags.string({char:"s",description:"The myshopify.com domain of the store to open GraphiQL against. The app must be installed on the store. If not specified, you will be prompted to select a store.",env:"SHOPIFY_FLAG_STORE",parse:async r=>d(r)}),port:b({description:"Local port for the GraphiQL server.",env:"SHOPIFY_FLAG_PORT"}),variables:n.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES"}),version:n.Flags.string({description:"The API version to use in GraphiQL. Defaults to the latest stable version.",env:"SHOPIFY_FLAG_VERSION"})};async run(){let{flags:r}=await this.parse(e),{appContextResult:t,store:a}=await G(r);return await k({remoteApp:t.remoteApp,store:a.shopDomain,port:r.port,variables:r.variables,apiVersion:r.version}),{app:t.app}}};export{K as a,I as b,p as c};
@@ -1 +0,0 @@
1
- import{b as e}from"./chunk-ZQDDRIBA.js";import{sa as r}from"./chunk-H4V55Y3Z.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var t=class extends e{static hidden=!0;async run(){await r()}};export{t as a};