shopify 4.9.1 → 4.9.3

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 (356) hide show
  1. package/dist/analytics-CLYTLX2B.js +1 -0
  2. package/dist/analytics-K6IFFIPX.js +1 -0
  3. package/dist/assets/hydrogen/starter/CHANGELOG.md +14 -0
  4. package/dist/assets/hydrogen/starter/package.json +2 -2
  5. package/dist/bootstrap.js +1 -1
  6. package/dist/{chunk-P6ID3ULA.js → chunk-2E2NYRQH.js} +1 -1
  7. package/dist/{chunk-VEIZLSMG.js → chunk-2GYIQINP.js} +1 -1
  8. package/dist/{chunk-MZJKZLCC.js → chunk-2NRFFAV4.js} +1 -1
  9. package/dist/{chunk-EVQPVO4P.js → chunk-2S7WRX2J.js} +1 -1
  10. package/dist/{chunk-23ITMFUO.js → chunk-2WQGEYBB.js} +1 -1
  11. package/dist/{chunk-JF47WERF.js → chunk-32HWTEOM.js} +1 -1
  12. package/dist/chunk-3B3CJS5I.js +1 -0
  13. package/dist/chunk-3FCN4NS6.js +6 -0
  14. package/dist/{chunk-K5KUOPEF.js → chunk-3FPVTPQO.js} +1 -1
  15. package/dist/{chunk-DUWU7CL7.js → chunk-3JN6OWIO.js} +1 -1
  16. package/dist/{chunk-MIMOKFDI.js → chunk-3U2OMG7L.js} +1 -1
  17. package/dist/{chunk-Z6VWYOKN.js → chunk-3YAD263J.js} +1 -1
  18. package/dist/{chunk-JCOQDVEB.js → chunk-43DSLBSX.js} +1 -1
  19. package/dist/{chunk-YQZPL4K3.js → chunk-46I3BQZH.js} +1 -1
  20. package/dist/{chunk-ADIHYUQC.js → chunk-4J7HQGWI.js} +1 -1
  21. package/dist/{chunk-4AXLWDKW.js → chunk-4LTQEQ4O.js} +1 -1
  22. package/dist/{chunk-2AZXDU2R.js → chunk-4MUH4E2U.js} +1 -1
  23. package/dist/{chunk-CUZQRXTV.js → chunk-4Q5TSWQL.js} +3 -3
  24. package/dist/{chunk-7H4IM6PX.js → chunk-4Q7NZI5A.js} +1 -1
  25. package/dist/{chunk-QZDFPNYT.js → chunk-4RFKEFWW.js} +1 -1
  26. package/dist/{chunk-N56BJ3F7.js → chunk-4TF7ER72.js} +1 -1
  27. package/dist/{chunk-AJOTU26E.js → chunk-52ZHZWF7.js} +1 -1
  28. package/dist/{chunk-IQ4VOPT7.js → chunk-543SYIY6.js} +1 -1
  29. package/dist/chunk-5BGUKF7L.js +1 -0
  30. package/dist/{chunk-QEF43PR2.js → chunk-5LONOHNN.js} +1 -1
  31. package/dist/chunk-5LZ5L2FF.js +70 -0
  32. package/dist/{chunk-DREP3FRJ.js → chunk-5RJ6KQHZ.js} +1 -1
  33. package/dist/{chunk-DCSSFNW7.js → chunk-66JMKA7C.js} +1 -1
  34. package/dist/{chunk-PTS7J2JO.js → chunk-6BVQSX7D.js} +1 -1
  35. package/dist/{chunk-254XYKPN.js → chunk-6HWDGTSX.js} +1 -1
  36. package/dist/{chunk-LRKJSNM3.js → chunk-6JOZHD34.js} +1 -1
  37. package/dist/{chunk-S6YUSGTF.js → chunk-6ZSI3C4G.js} +1 -1
  38. package/dist/{chunk-U2WUTGPI.js → chunk-73LX4DOM.js} +1 -1
  39. package/dist/{chunk-7IS6Q756.js → chunk-7AP5E5CF.js} +1 -1
  40. package/dist/chunk-7E4MJCVE.js +10 -0
  41. package/dist/{chunk-LOKVWZD2.js → chunk-7IYSJGFF.js} +1 -1
  42. package/dist/{chunk-SHDGD2WJ.js → chunk-7KCHSZ6H.js} +1 -1
  43. package/dist/{chunk-JJ4MYCVU.js → chunk-7KVTQDRW.js} +1 -1
  44. package/dist/{chunk-LIB64ZJW.js → chunk-7NHCYOKI.js} +1 -1
  45. package/dist/{chunk-LBBYCPZP.js → chunk-7SIY6GZD.js} +1 -1
  46. package/dist/{chunk-55JDA75S.js → chunk-A36J5FWZ.js} +1 -1
  47. package/dist/{chunk-IPWU2ALH.js → chunk-A6KNDSNT.js} +1 -1
  48. package/dist/{chunk-UJD7OQ3I.js → chunk-A6NAQ2Y3.js} +1 -1
  49. package/dist/{chunk-ICFM55ZS.js → chunk-A75SA57D.js} +1 -1
  50. package/dist/{chunk-2QV5FHXJ.js → chunk-A76YYGZT.js} +1 -1
  51. package/dist/{chunk-33D7HGAI.js → chunk-ACGPDJ6Q.js} +1 -1
  52. package/dist/{chunk-GF75CMTJ.js → chunk-ADGPOQ5M.js} +1 -1
  53. package/dist/{chunk-TGUAZMI2.js → chunk-ADL6JSX7.js} +1 -1
  54. package/dist/{chunk-NWBAD3AV.js → chunk-ADVNRGOU.js} +1 -1
  55. package/dist/{chunk-2TOIR7YQ.js → chunk-AF36J7R7.js} +1 -1
  56. package/dist/{chunk-VEQDI5AB.js → chunk-B32O5KET.js} +1 -1
  57. package/dist/{chunk-ZDRQUKLN.js → chunk-BHOZAIHS.js} +1 -1
  58. package/dist/{chunk-NYNSMHKY.js → chunk-BWCPDFEY.js} +1 -1
  59. package/dist/{chunk-DEY5P63E.js → chunk-BZSCRXYR.js} +3 -3
  60. package/dist/{chunk-GHO2S3W3.js → chunk-C4G7OKJD.js} +1 -1
  61. package/dist/{chunk-3WMFKHIM.js → chunk-CB6QT5K5.js} +1 -1
  62. package/dist/{chunk-DUWS6Q7C.js → chunk-CGCM5DB7.js} +1 -1
  63. package/dist/{chunk-JWQBRHVY.js → chunk-CNA5YGXA.js} +1 -1
  64. package/dist/{chunk-DP7SBNLN.js → chunk-CNHO3T4F.js} +1 -1
  65. package/dist/{chunk-3GVSG4S6.js → chunk-CPT2VBMR.js} +1 -1
  66. package/dist/{chunk-FNITLQDL.js → chunk-CQKZSB7Z.js} +1 -1
  67. package/dist/{chunk-NGQDG4CJ.js → chunk-CTDETNGR.js} +1 -1
  68. package/dist/{chunk-MEFJND2V.js → chunk-CTVOXVXG.js} +1 -1
  69. package/dist/{chunk-NZRQKFUB.js → chunk-DE5BUQL5.js} +1 -1
  70. package/dist/{chunk-OJ7KRWUH.js → chunk-DHWY73OS.js} +1 -1
  71. package/dist/chunk-DPGUL2TW.js +1 -0
  72. package/dist/{chunk-P676C7UT.js → chunk-DWDR7XMI.js} +1 -1
  73. package/dist/{chunk-CPKLTBLZ.js → chunk-E7PW5SVD.js} +1 -1
  74. package/dist/{chunk-2KBTFKSM.js → chunk-EA5LKCRF.js} +1 -1
  75. package/dist/{chunk-63GEZEYP.js → chunk-EJ46P6A3.js} +1 -1
  76. package/dist/{chunk-HJ3DOUAL.js → chunk-EM6KPZCM.js} +1 -1
  77. package/dist/{chunk-GILHUPUG.js → chunk-FHOBQUQT.js} +1 -1
  78. package/dist/{chunk-C4QR7Z4N.js → chunk-FKGN6F3F.js} +1 -1
  79. package/dist/{chunk-2NBNVDDA.js → chunk-FLPWT4AK.js} +1 -1
  80. package/dist/{chunk-HT2JVMLK.js → chunk-FMBC7LZB.js} +1 -1
  81. package/dist/{chunk-H3QLPW7Q.js → chunk-GB4WR6DY.js} +1 -1
  82. package/dist/{chunk-J4SJHG3M.js → chunk-GBG6SUK4.js} +1 -1
  83. package/dist/{chunk-GPRUQBQX.js → chunk-GIGA7EU3.js} +1 -1
  84. package/dist/{chunk-TH4D7IGZ.js → chunk-GOBTF2ZH.js} +1 -1
  85. package/dist/{chunk-WRVB4JCZ.js → chunk-GPJAWTR7.js} +1 -1
  86. package/dist/{chunk-EDLID4PK.js → chunk-GQZ3KCWJ.js} +3 -3
  87. package/dist/{chunk-GRKZRK4G.js → chunk-H3N5LKJD.js} +1 -1
  88. package/dist/{chunk-7AD5YCLL.js → chunk-H4PXFC7T.js} +1 -1
  89. package/dist/{chunk-OSA6BKSU.js → chunk-H5ZPH2EC.js} +1 -1
  90. package/dist/{chunk-5MJX7RKQ.js → chunk-HHNMV6GX.js} +1 -1
  91. package/dist/{chunk-WR2MMFJO.js → chunk-HJPAHR2V.js} +1 -1
  92. package/dist/{chunk-MDMKTILJ.js → chunk-HQ4JWC5M.js} +1 -1
  93. package/dist/{chunk-JA2QZ635.js → chunk-I3J63RFV.js} +1 -1
  94. package/dist/{chunk-ET2CGROE.js → chunk-IGE4Y5SE.js} +1 -1
  95. package/dist/{chunk-2AAHKMPP.js → chunk-IH2CB73H.js} +1 -1
  96. package/dist/{chunk-JCVQB6MX.js → chunk-IJM576XA.js} +1 -1
  97. package/dist/{chunk-W6TPRWEE.js → chunk-IKN6ICJR.js} +1 -1
  98. package/dist/{chunk-KCHERKZO.js → chunk-IN634BRF.js} +88 -88
  99. package/dist/{chunk-HVOYSAB3.js → chunk-IR6OW5R2.js} +1 -1
  100. package/dist/{chunk-RX27ER4R.js → chunk-ISU7Q2EB.js} +1 -1
  101. package/dist/{chunk-RDCHRPKV.js → chunk-J6BK6SNB.js} +1 -1
  102. package/dist/{chunk-TOLPNBZK.js → chunk-JFBCE4HN.js} +1 -1
  103. package/dist/{chunk-77QYKF34.js → chunk-JQ3DMPI6.js} +1 -1
  104. package/dist/{chunk-C7YSU4R5.js → chunk-JTXQPPKQ.js} +1 -1
  105. package/dist/{chunk-I4FS7HYY.js → chunk-JYWFR6VL.js} +1 -1
  106. package/dist/chunk-KD5AYVA2.js +1 -0
  107. package/dist/{chunk-AKSOCKVF.js → chunk-KEI3OJVP.js} +2 -2
  108. package/dist/{chunk-RNXWL6DS.js → chunk-KFOU4WLJ.js} +1 -1
  109. package/dist/{chunk-HQK6QRXN.js → chunk-KI3VRWBP.js} +1 -1
  110. package/dist/{chunk-QEEA2KEN.js → chunk-KRL7FE6M.js} +1 -1
  111. package/dist/{chunk-YFR53MWF.js → chunk-KWKRJYTY.js} +1 -1
  112. package/dist/{chunk-NHEUJKAO.js → chunk-KXZQKOKF.js} +1 -1
  113. package/dist/{chunk-OKX6PKAW.js → chunk-KY4WH4ZK.js} +1 -1
  114. package/dist/{chunk-OUSRNKZG.js → chunk-KZ54OSBH.js} +1 -1
  115. package/dist/{chunk-NE32WJR5.js → chunk-KZE6JT42.js} +1 -1
  116. package/dist/{chunk-OVOOQFRY.js → chunk-KZWYFH7M.js} +1 -1
  117. package/dist/chunk-L4DFMMOI.js +1 -0
  118. package/dist/{chunk-EYB45DUG.js → chunk-LGRZQTQL.js} +1 -1
  119. package/dist/{chunk-LAHZ6FO5.js → chunk-LIE6QSQ2.js} +1 -1
  120. package/dist/{chunk-RFDOSK57.js → chunk-LOTMFUSV.js} +1 -1
  121. package/dist/{chunk-F34MAI7X.js → chunk-MAQ3SRQF.js} +1 -1
  122. package/dist/{chunk-3MEL3WLG.js → chunk-MBE23GGW.js} +1 -1
  123. package/dist/{chunk-DZS4GBQX.js → chunk-MDGF3K45.js} +1 -1
  124. package/dist/{chunk-YACDI6IK.js → chunk-ME4EYPKZ.js} +1 -1
  125. package/dist/{chunk-S3IDGHAZ.js → chunk-MMCDBR23.js} +1 -1
  126. package/dist/{chunk-STLYSBD5.js → chunk-MNHZWEXI.js} +1 -1
  127. package/dist/{chunk-LEFAUWKH.js → chunk-MROQ2FRU.js} +1 -1
  128. package/dist/{chunk-VX2CDHRQ.js → chunk-MVFBLQ4J.js} +1 -1
  129. package/dist/{chunk-7WWPAHVE.js → chunk-MWVT5HYW.js} +1 -1
  130. package/dist/{chunk-RRBI2IRE.js → chunk-MYIN4HYW.js} +1 -1
  131. package/dist/{chunk-ISIPFEFB.js → chunk-MYP6QEJW.js} +1 -1
  132. package/dist/{chunk-77QKJLBG.js → chunk-NC64STMQ.js} +1 -1
  133. package/dist/{chunk-B7Y2LMPU.js → chunk-NL6DJQJG.js} +1 -1
  134. package/dist/{chunk-BATQEAGE.js → chunk-NO3QDX7R.js} +1 -1
  135. package/dist/{chunk-X6Y3HDXN.js → chunk-NYVG34OW.js} +1 -1
  136. package/dist/{chunk-5UDBNXNH.js → chunk-O36EB75H.js} +1 -1
  137. package/dist/{chunk-QNR3U4IO.js → chunk-O7YHDFOO.js} +1 -1
  138. package/dist/{chunk-VWYZCCRE.js → chunk-OSGXBBUJ.js} +5 -5
  139. package/dist/{chunk-SKK7CPUY.js → chunk-OUO2T3CC.js} +1 -1
  140. package/dist/{chunk-YS5RZ6D5.js → chunk-OVTWO3W7.js} +1 -1
  141. package/dist/{chunk-UVSXPMUN.js → chunk-P4MNJULR.js} +1 -1
  142. package/dist/{chunk-5ZSN73EA.js → chunk-P7YDAQ53.js} +1 -1
  143. package/dist/{chunk-S3J3BYQ3.js → chunk-PE6H7U6N.js} +1 -1
  144. package/dist/{chunk-UZTL2UET.js → chunk-PFBESNYV.js} +64 -53
  145. package/dist/{chunk-VL3XMULV.js → chunk-PFPVFPHV.js} +1 -1
  146. package/dist/{chunk-HDQXFGYG.js → chunk-PIZDYS7T.js} +60 -60
  147. package/dist/{chunk-X3WFHNF5.js → chunk-PQEFZTEJ.js} +1 -1
  148. package/dist/chunk-Q54LU5W4.js +1 -0
  149. package/dist/{chunk-XCXQPV5W.js → chunk-QKJ542VO.js} +1 -1
  150. package/dist/{chunk-ZQKZC2KN.js → chunk-QKSN6ZYW.js} +1 -1
  151. package/dist/{chunk-5I5HKOQU.js → chunk-QZGVZMB5.js} +1 -1
  152. package/dist/{chunk-JOEWOCHY.js → chunk-RJGFFGEN.js} +1 -1
  153. package/dist/{chunk-2RVMF4QP.js → chunk-S34ZYEZS.js} +1 -1
  154. package/dist/{chunk-XY2SSJQD.js → chunk-SZLNUMWO.js} +1 -1
  155. package/dist/{chunk-VXHLE5UQ.js → chunk-T3LZJIZN.js} +1 -1
  156. package/dist/{chunk-WGBUSO27.js → chunk-TFB4JJFQ.js} +1 -1
  157. package/dist/{chunk-LQ7ENG4V.js → chunk-TQ7URMGS.js} +1 -1
  158. package/dist/{chunk-3VOMVINB.js → chunk-TWT5LVEM.js} +1 -1
  159. package/dist/{chunk-IUUKRTKF.js → chunk-UGJN5Q6Y.js} +1 -1
  160. package/dist/{chunk-T7BUP75N.js → chunk-UKINO57E.js} +1 -1
  161. package/dist/chunk-UWHAOGO4.js +4 -0
  162. package/dist/{chunk-COFGQT76.js → chunk-UYWRJHAJ.js} +3 -3
  163. package/dist/{chunk-7UV53AU2.js → chunk-UZL4B7LA.js} +1 -1
  164. package/dist/{chunk-2FHVYY3B.js → chunk-V4F4LQBQ.js} +1 -1
  165. package/dist/chunk-VCAYMY7D.js +275 -0
  166. package/dist/{chunk-XUJURYN5.js → chunk-VDE7IIYQ.js} +1 -1
  167. package/dist/{chunk-B4YDR22W.js → chunk-VOOYVTYA.js} +1 -1
  168. package/dist/{chunk-3VXXYY6S.js → chunk-VWDVWHV7.js} +1 -1
  169. package/dist/{chunk-AZCPTV4A.js → chunk-WEB63XPH.js} +1 -1
  170. package/dist/{chunk-XW33ZO7F.js → chunk-WS54VCDC.js} +1 -1
  171. package/dist/{chunk-7ZONBOEZ.js → chunk-WUGFTI5M.js} +1 -1
  172. package/dist/{chunk-WBTR5JZ6.js → chunk-X5VBX2QA.js} +1 -1
  173. package/dist/{chunk-NSHKVJST.js → chunk-XBCFYD3T.js} +1 -1
  174. package/dist/{chunk-5CANB25O.js → chunk-XGFY6FV4.js} +1 -1
  175. package/dist/{chunk-DYHRCMH6.js → chunk-XMPLZWXP.js} +1 -1
  176. package/dist/{chunk-KXSUEB4Y.js → chunk-XSGYQXWO.js} +1 -1
  177. package/dist/{chunk-QF6EH4HX.js → chunk-XVOUKPGD.js} +1 -1
  178. package/dist/{chunk-3UZYLXCB.js → chunk-XZHUUA6U.js} +1 -1
  179. package/dist/{chunk-KVZXRZ7U.js → chunk-XZOSPVMV.js} +1 -1
  180. package/dist/{chunk-FJCNEHTH.js → chunk-Y45QFHVA.js} +1 -1
  181. package/dist/{chunk-WR6KP7RT.js → chunk-YKK4PGCQ.js} +1 -1
  182. package/dist/{chunk-5KILOX2V.js → chunk-YMAVVMN5.js} +1 -1
  183. package/dist/{chunk-ON3YXHON.js → chunk-YN3NT2RC.js} +1 -1
  184. package/dist/{chunk-46IUD46F.js → chunk-YPGZANN3.js} +1 -1
  185. package/dist/{chunk-CKLS5LTU.js → chunk-YS447QGN.js} +1 -1
  186. package/dist/{chunk-VPH2AAHJ.js → chunk-YUM5XGSV.js} +1 -1
  187. package/dist/{chunk-6WGHVCYY.js → chunk-YVX2OJ7N.js} +1 -1
  188. package/dist/{chunk-RFB7RXTA.js → chunk-YWS2OTSC.js} +1 -1
  189. package/dist/{chunk-QH5R32AA.js → chunk-YZXNXWDR.js} +1 -1
  190. package/dist/{chunk-HKNFZUAM.js → chunk-Z5M2VWQZ.js} +107 -107
  191. package/dist/{chunk-VY7UGJZK.js → chunk-ZBMEU2CE.js} +1 -1
  192. package/dist/{chunk-JSGOBMF6.js → chunk-ZIL2P7FL.js} +1 -1
  193. package/dist/{chunk-FROK2K3X.js → chunk-ZRW47MJT.js} +1 -1
  194. package/dist/{chunk-QPCDSJ4J.js → chunk-ZZWGNETX.js} +1 -1
  195. package/dist/cli/commands/app/app-logs/sources.js +1 -1
  196. package/dist/cli/commands/app/build.js +1 -1
  197. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  198. package/dist/cli/commands/app/bulk/execute.js +1 -1
  199. package/dist/cli/commands/app/bulk/status.js +1 -1
  200. package/dist/cli/commands/app/config/link.js +1 -1
  201. package/dist/cli/commands/app/config/pull.js +1 -1
  202. package/dist/cli/commands/app/config/use.js +1 -1
  203. package/dist/cli/commands/app/config/validate.js +1 -1
  204. package/dist/cli/commands/app/demo/watcher.js +1 -1
  205. package/dist/cli/commands/app/deploy.js +1 -1
  206. package/dist/cli/commands/app/dev/clean.js +1 -1
  207. package/dist/cli/commands/app/dev.js +1 -1
  208. package/dist/cli/commands/app/env/pull.js +1 -1
  209. package/dist/cli/commands/app/env/show.js +1 -1
  210. package/dist/cli/commands/app/execute.js +1 -1
  211. package/dist/cli/commands/app/function/build.js +1 -1
  212. package/dist/cli/commands/app/function/info.js +1 -1
  213. package/dist/cli/commands/app/function/replay.js +1 -1
  214. package/dist/cli/commands/app/function/run.js +1 -1
  215. package/dist/cli/commands/app/function/schema.js +1 -1
  216. package/dist/cli/commands/app/function/typegen.js +1 -1
  217. package/dist/cli/commands/app/generate/extension.js +1 -1
  218. package/dist/cli/commands/app/graphiql.js +1 -1
  219. package/dist/cli/commands/app/import/channel-config.js +1 -1
  220. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  221. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  222. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  223. package/dist/cli/commands/app/import-extensions.js +1 -1
  224. package/dist/cli/commands/app/info.js +1 -1
  225. package/dist/cli/commands/app/init.js +1 -1
  226. package/dist/cli/commands/app/logs.js +1 -1
  227. package/dist/cli/commands/app/release.js +1 -1
  228. package/dist/cli/commands/app/security/check.js +1 -1
  229. package/dist/cli/commands/app/security/clean.js +1 -1
  230. package/dist/cli/commands/app/security/instructions.js +1 -1
  231. package/dist/cli/commands/app/security/record.js +1 -1
  232. package/dist/cli/commands/app/security/review.js +1 -1
  233. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  234. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  235. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  236. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  237. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  238. package/dist/cli/commands/app/versions/list.js +1 -1
  239. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  240. package/dist/cli/commands/auth/login.js +1 -1
  241. package/dist/cli/commands/auth/logout.js +1 -1
  242. package/dist/cli/commands/cache/clear.js +1 -1
  243. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  244. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  245. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  246. package/dist/cli/commands/debug/command-flags.js +1 -1
  247. package/dist/cli/commands/doc/fetch.js +1 -1
  248. package/dist/cli/commands/doc/search.js +1 -1
  249. package/dist/cli/commands/docs/generate.js +1 -1
  250. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  251. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  252. package/dist/cli/commands/help.js +1 -1
  253. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  254. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  255. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  256. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  257. package/dist/cli/commands/notifications/generate.js +1 -1
  258. package/dist/cli/commands/notifications/list.js +1 -1
  259. package/dist/cli/commands/organization/list.js +1 -1
  260. package/dist/cli/commands/search.js +1 -1
  261. package/dist/cli/commands/send-analytics.js +1 -1
  262. package/dist/cli/commands/theme/check.js +1 -1
  263. package/dist/cli/commands/theme/console.js +1 -1
  264. package/dist/cli/commands/theme/delete.js +1 -1
  265. package/dist/cli/commands/theme/dev.js +1 -1
  266. package/dist/cli/commands/theme/duplicate.js +1 -1
  267. package/dist/cli/commands/theme/info.js +1 -1
  268. package/dist/cli/commands/theme/init.js +1 -1
  269. package/dist/cli/commands/theme/language-server.js +1 -1
  270. package/dist/cli/commands/theme/list.js +1 -1
  271. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  272. package/dist/cli/commands/theme/open.js +1 -1
  273. package/dist/cli/commands/theme/package.js +1 -1
  274. package/dist/cli/commands/theme/preview.js +1 -1
  275. package/dist/cli/commands/theme/profile.js +1 -1
  276. package/dist/cli/commands/theme/publish.js +1 -1
  277. package/dist/cli/commands/theme/pull.js +1 -1
  278. package/dist/cli/commands/theme/push.js +1 -1
  279. package/dist/cli/commands/theme/rename.js +1 -1
  280. package/dist/cli/commands/theme/share.js +1 -1
  281. package/dist/cli/commands/upgrade.js +1 -1
  282. package/dist/cli/commands/version.js +1 -1
  283. package/dist/cli/help.js +1 -1
  284. package/dist/{command-json-schema-SU56F3T4.js → command-json-schema-AWZEAYEU.js} +1 -1
  285. package/dist/command-registry.js +1 -1
  286. package/dist/{conf-store-WDYDHG6V.js → conf-store-TBERV4YJ.js} +1 -1
  287. package/dist/{custom-oclif-loader-CP4XJAPS.js → custom-oclif-loader-RHFO4GO3.js} +1 -1
  288. package/dist/{deprecations-CBSMNYL3.js → deprecations-FNYLBULK.js} +1 -1
  289. package/dist/dist-HV5W7PYL.js +1 -0
  290. package/dist/dist-VKKGDJQ2.js +1 -0
  291. package/dist/environments-XC6OMZY2.js +1 -0
  292. package/dist/{error-LNWX6IWE.js → error-SI2QH7DT.js} +1 -1
  293. package/dist/error-handler-XOEXJ4TY.js +1 -0
  294. package/dist/{fs-Y33QBYY5.js → fs-J67RRM6W.js} +1 -1
  295. package/dist/hooks/did-you-mean.js +1 -1
  296. package/dist/hooks/hydrogen-init.js +1 -1
  297. package/dist/hooks/plugin-plugins.js +1 -1
  298. package/dist/hooks/postrun.js +1 -1
  299. package/dist/hooks/prerun.js +1 -1
  300. package/dist/hooks/public-metadata.js +1 -1
  301. package/dist/hooks/sensitive-metadata.js +1 -1
  302. package/dist/hooks/tunnel-provider.js +1 -1
  303. package/dist/hooks/tunnel-start.js +1 -1
  304. package/dist/index.js +1 -1
  305. package/dist/is-global-BSY2VR5F.js +1 -0
  306. package/dist/{json-error-UR2OILQ6.js → json-error-BVX244JK.js} +1 -1
  307. package/dist/lib-55QUD4AJ.js +1 -0
  308. package/dist/lib-PH52G55H.js +1 -0
  309. package/dist/lib-TYM5B75S.js +1 -0
  310. package/dist/{local-77XQ4CX3.js → local-VCJXKA4Z.js} +1 -1
  311. package/dist/{metadata-BC3BGHRY.js → metadata-G7M7BSIE.js} +1 -1
  312. package/dist/{morph-42EXMN3K.js → morph-BABFBRSW.js} +1 -1
  313. package/dist/{node-package-manager-6UZUTDCP.js → node-package-manager-PMTBCYAX.js} +1 -1
  314. package/dist/notifications-system-O2R4VN7A.js +1 -0
  315. package/dist/os-MMNGCSNT.js +1 -0
  316. package/dist/{output-GGY66WEM.js → output-2Q6CSC33.js} +1 -1
  317. package/dist/system-DQ2SKK6C.js +1 -0
  318. package/dist/tsconfig.tsbuildinfo +1 -1
  319. package/dist/typescript-ISACCMJN.js +1 -0
  320. package/dist/ui-QOSX5V7Z.js +1 -0
  321. package/dist/upgrade-7HYLPUVK.js +1 -0
  322. package/dist/version-BPEZT4N3.js +1 -0
  323. package/dist/version-VNCEYJRH.js +1 -0
  324. package/dist/{workerd-MEAM3XYI.js → workerd-2RFRLQVH.js} +1 -1
  325. package/oclif.manifest.json +5 -5
  326. package/package.json +8 -8
  327. package/dist/analytics-EPKJADE2.js +0 -1
  328. package/dist/analytics-TVCGKQGZ.js +0 -1
  329. package/dist/chunk-32B4LIKH.js +0 -1
  330. package/dist/chunk-5XO6PAMV.js +0 -1
  331. package/dist/chunk-7UZO72KN.js +0 -278
  332. package/dist/chunk-7Y7AZRL3.js +0 -10
  333. package/dist/chunk-A6OSIGQI.js +0 -1
  334. package/dist/chunk-F3TMLDLC.js +0 -1
  335. package/dist/chunk-HSTNTHWM.js +0 -1
  336. package/dist/chunk-MFXBSQDH.js +0 -12
  337. package/dist/chunk-MINDMVTH.js +0 -1
  338. package/dist/chunk-NTFIW3VK.js +0 -6
  339. package/dist/chunk-PCKWLJW2.js +0 -1
  340. package/dist/chunk-SMZ74TME.js +0 -64
  341. package/dist/dist-HI6AAP5V.js +0 -1
  342. package/dist/dist-W25ND3PJ.js +0 -1
  343. package/dist/environments-PUH6A5BU.js +0 -1
  344. package/dist/error-handler-24QGAUUD.js +0 -1
  345. package/dist/is-global-KY3QE3OZ.js +0 -1
  346. package/dist/lib-AD2G3QH3.js +0 -1
  347. package/dist/lib-VEVNMHDE.js +0 -1
  348. package/dist/lib-ZQW4E7QU.js +0 -1
  349. package/dist/notifications-system-4UDT72DQ.js +0 -1
  350. package/dist/os-U3LELTCV.js +0 -1
  351. package/dist/system-MCWAHFXK.js +0 -1
  352. package/dist/typescript-5R4Y7PXE.js +0 -1
  353. package/dist/ui-SYB4LLWY.js +0 -1
  354. package/dist/upgrade-V4GCQJBN.js +0 -1
  355. package/dist/version-HQPFW4QN.js +0 -1
  356. package/dist/version-VOSHQCYM.js +0 -1
@@ -1 +1 @@
1
- import{g as l,ka as d,pa as z,qa as y}from"./chunk-WBTR5JZ6.js";import{b as g,c as f,d as h}from"./chunk-2KBTFKSM.js";import{b as n}from"./chunk-CUZQRXTV.js";import{G as c}from"./chunk-KCHERKZO.js";import{a as u}from"./chunk-IUUKRTKF.js";import{Ib as p,b as o}from"./chunk-COFGQT76.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();i();i();var L=o.object({id:o.string(),gid:o.string(),name:o.string(),status:o.enum(l),shopCount:o.number().nullable(),url:o.string()}).strict(),r=u({name:"OrganizationListResult",schema:o.object({organizations:o.array(L)}).strict(),definitions:{OrganizationListEntry:L}});function e(s,t){if(t==="json"){p(r.encode(s));return}c({rows:s.organizations.map(a=>({id:a.id,name:a.name})),columns:{id:{header:"ID"},name:{header:"NAME"}}})}i();async function O(){return{organizations:(await y()).map(t=>({id:t.id,gid:d(t.id),name:t.businessName,status:t.status,shopCount:t.shopCount,url:t.url}))}}var m=class s extends n{static baseFlags={...n.baseFlags,...h};static summary="List Shopify organizations you have access to.";static descriptionWithMarkdown="Lists the Shopify organizations that you have access to, along with their organization IDs.";static description=this.descriptionForHelp();static flags={...g,...f};static get jsonOutputSchema(){return r}async run(){let{flags:t}=await this.parse(s);try{let a=await O();e(a,t.json?"json":"text")}catch(a){if(t.json&&a instanceof z){e({organizations:[]},"json");return}throw a}}};export{m as a};
1
+ import{g as l,ka as d,pa as z,qa as y}from"./chunk-X5VBX2QA.js";import{b as g,c as f,d as h}from"./chunk-EA5LKCRF.js";import{b as n}from"./chunk-4Q5TSWQL.js";import{G as c}from"./chunk-IN634BRF.js";import{a as u}from"./chunk-UGJN5Q6Y.js";import{Ib as p,b as o}from"./chunk-UYWRJHAJ.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();i();i();var L=o.object({id:o.string(),gid:o.string(),name:o.string(),status:o.enum(l),shopCount:o.number().nullable(),url:o.string()}).strict(),r=u({name:"OrganizationListResult",schema:o.object({organizations:o.array(L)}).strict(),definitions:{OrganizationListEntry:L}});function e(s,t){if(t==="json"){p(r.encode(s));return}c({rows:s.organizations.map(a=>({id:a.id,name:a.name})),columns:{id:{header:"ID"},name:{header:"NAME"}}})}i();async function O(){return{organizations:(await y()).map(t=>({id:t.id,gid:d(t.id),name:t.businessName,status:t.status,shopCount:t.shopCount,url:t.url}))}}var m=class s extends n{static baseFlags={...n.baseFlags,...h};static summary="List Shopify organizations you have access to.";static descriptionWithMarkdown="Lists the Shopify organizations that you have access to, along with their organization IDs.";static description=this.descriptionForHelp();static flags={...g,...f};static get jsonOutputSchema(){return r}async run(){let{flags:t}=await this.parse(s);try{let a=await O();e(a,t.json?"json":"text")}catch(a){if(t.json&&a instanceof z){e({organizations:[]},"json");return}throw a}}};export{m as a};
@@ -1 +1 @@
1
- import{a as h,b as w}from"./chunk-SMZ74TME.js";import{j as f}from"./chunk-VWYZCCRE.js";import{T as d}from"./chunk-KCHERKZO.js";import{i}from"./chunk-XUJURYN5.js";import{Ka as m,ra as p}from"./chunk-COFGQT76.js";import{d as u}from"./chunk-3VYOLEQE.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();import{writeFile as g}from"fs/promises";var S=1024*1024,y=100,U=y*S,E=3,_=new Set([408,429,500,502,503,504]);async function j(o,e){let t=u(e,"manifest.json");await g(t,JSON.stringify(o,null,2))}var A=["!**/*.js.map","!**/*.metafile.json"];async function k(o,e,t){let n=t??["**/*",...A];e.endsWith(".br")?await w({inputDirectory:o,outputPath:e,matchFilePattern:n}):await h({inputDirectory:o,outputZipPath:e,matchFilePattern:n})}async function C(o,e){let t=await m(e);if(t>U){let s=`${(Math.ceil(t/S*100)/100).toFixed(2)} MB`;throw new i(`Your app bundle exceeds the ${y} MB upload limit (it is ${s}).`,"Check the asset paths in your extension configuration \u2014 a misconfigured source can pull in much more than intended. Exclude large files or directories from your bundle, then try again.")}let n=p(e),r;for(let s=1;s<=E;s++){if(r=await f(o,{method:"put",body:n},"slow-request"),r.ok)return;let T=s===E;if(_.has(r.status)&&!T){await r.text().catch(()=>{}),await d(2**s*.1);continue}break}let a=r?.status,c=(await r?.text().catch(()=>""))?.trim();throw new i(`Failed to upload your app bundle to storage${a?` (HTTP ${a})`:""}.`,"This is usually transient. Please try again, and check your network connection if it persists.",c?[`Storage responded with: ${c.slice(0,300)}`]:void 0)}async function D(o,e){let t=await o.generateSignedUploadUrl(e);if(!t.assetUrl||t.userErrors?.length>0){let n=t.userErrors.map(r=>r.message).join(", ");throw new i(n)}return t.assetUrl}export{j as a,A as b,k as c,C as d,D as e};
1
+ import{a as h,b as w}from"./chunk-5LZ5L2FF.js";import{j as f}from"./chunk-OSGXBBUJ.js";import{T as d}from"./chunk-IN634BRF.js";import{i}from"./chunk-VDE7IIYQ.js";import{Ka as m,ra as p}from"./chunk-UYWRJHAJ.js";import{d as u}from"./chunk-3VYOLEQE.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();import{writeFile as g}from"fs/promises";var S=1024*1024,y=100,U=y*S,E=3,_=new Set([408,429,500,502,503,504]);async function j(o,e){let t=u(e,"manifest.json");await g(t,JSON.stringify(o,null,2))}var A=["!**/*.js.map","!**/*.metafile.json"];async function k(o,e,t){let n=t??["**/*",...A];e.endsWith(".br")?await w({inputDirectory:o,outputPath:e,matchFilePattern:n}):await h({inputDirectory:o,outputZipPath:e,matchFilePattern:n})}async function C(o,e){let t=await m(e);if(t>U){let s=`${(Math.ceil(t/S*100)/100).toFixed(2)} MB`;throw new i(`Your app bundle exceeds the ${y} MB upload limit (it is ${s}).`,"Check the asset paths in your extension configuration \u2014 a misconfigured source can pull in much more than intended. Exclude large files or directories from your bundle, then try again.")}let n=p(e),r;for(let s=1;s<=E;s++){if(r=await f(o,{method:"put",body:n},"slow-request"),r.ok)return;let T=s===E;if(_.has(r.status)&&!T){await r.text().catch(()=>{}),await d(2**s*.1);continue}break}let a=r?.status,c=(await r?.text().catch(()=>""))?.trim();throw new i(`Failed to upload your app bundle to storage${a?` (HTTP ${a})`:""}.`,"This is usually transient. Please try again, and check your network connection if it persists.",c?[`Storage responded with: ${c.slice(0,300)}`]:void 0)}async function D(o,e){let t=await o.generateSignedUploadUrl(e);if(!t.assetUrl||t.userErrors?.length>0){let n=t.userErrors.map(r=>r.message).join(", ");throw new i(n)}return t.assetUrl}export{j as a,A as b,k as c,C as d,D as e};
@@ -0,0 +1,275 @@
1
+ import{b as Mn}from"./chunk-TQ7URMGS.js";import{$ as q,A as h,Aa as Ln,B as M,Ba as Nn,C as hn,D as he,E as Ut,F as He,G as Je,H as ve,Ha as dr,I as gn,Ia as Hn,J as $e,Ja as to,K as be,Ka as Ve,L as yn,La as et,M as Vt,Ma as ht,N as me,Na as oo,O as cr,Oa as tt,P as wn,Pa as ro,Q as Qe,Qa as Un,R as Ke,Ra as Vn,S as vn,Sa as Bn,T as Bt,Ta as no,U as bn,Ua as Gn,V as kn,Va as Yn,W as En,Wa as qn,X as Sn,Y as xn,Z as Me,_ as Pn,a as ae,aa as Xe,b as pt,ba as Cn,c as an,ca as Dn,d as Ne,da as Gt,e as we,ea as Yt,f as qe,fa as Tn,g as cn,ga as pe,h as ln,ha as In,i as rr,ia as On,j as We,ja as lr,k as ut,ka as $n,l as Oe,la as Rn,m as dn,ma as An,n as Nt,na as qt,o as nr,oa as Wt,p as ft,pa as zt,q as ir,qa as Fn,r as mn,ra as Jt,s as pn,sa as Qt,t as sr,ta as jn,u as un,ua as Kt,v as ar,va as Xt,w as Ht,wa as Ue,x as Mt,xa as Ze,y as ze,ya as Zt,z as fn,za as _n}from"./chunk-GQZ3KCWJ.js";import{a as Xr}from"./chunk-JLGA3B7P.js";import{b as sn}from"./chunk-CPT2VBMR.js";import{b as Zr,c as en,d as Lt,g as tn,i as on,j as rn,k as nn}from"./chunk-QZGVZMB5.js";import{a as Rs}from"./chunk-UWHAOGO4.js";import{a as io}from"./chunk-FKIVKNOV.js";import{a as eo,b as mr,c as pr}from"./chunk-JYWFR6VL.js";import{b as D}from"./chunk-4Q5TSWQL.js";import{ba as de,i as Vr,j as ue,wa as $s}from"./chunk-OSGXBBUJ.js";import{B as zr,l as Gr,m as ye,p as At,s as Yr,u as qr,x as Wr}from"./chunk-3FCN4NS6.js";import{A as G,B as Jr,C as Ce,D as De,E as Se,H as X,S as or,a as Rt,y as U,z as F}from"./chunk-IN634BRF.js";import{c as Ur}from"./chunk-YTJ3EPD3.js";import{i as w,l as jt}from"./chunk-VDE7IIYQ.js";import{Aa as Ot,Ca as ge,Cb as fe,Eb as Y,Ga as Zo,Gb as Te,Ia as $t,Ka as Hr,Kb as $,La as Mr,Lb as Qr,Mb as Ie,Nb as Kr,Oa as er,Ob as V,Pb as Z,Sa as tr,Xa as J,Y as Tt,_a as mt,ca as Lr,qa as se,ra as Nr,ta as It,ua as Xo,wb as Br,ya as Q,yb as Ft}from"./chunk-UYWRJHAJ.js";import{i as L}from"./chunk-B4OMIONW.js";import{s as _t}from"./chunk-FKGN6F3F.js";import{d as E,f as x,g as ne,i as Ko,j as Ye,k as jr,q as _r}from"./chunk-3VYOLEQE.js";import{a as Os}from"./chunk-CX5CC6P5.js";import{e as K,g as c}from"./chunk-VKWPEFWQ.js";c();c();var uo=K(ae(),1);c();c();var so=[{name:"npm",lockfile:"package-lock.json",alternativeLockfiles:["npm-shrinkwrap.json"],installCommand:"npm ci"},{name:"yarn",lockfile:"yarn.lock",installCommand:"yarn install --frozen-lockfile"},{name:"pnpm",lockfile:"pnpm-lock.yaml",installCommand:"pnpm install --frozen-lockfile"},{name:"bun",lockfile:"bun.lockb",alternativeLockfiles:["bun.lock"],installCommand:"bun install --frozen-lockfile"}];function As(e){let t="No lockfile found",o="If you don\u2019t commit a lockfile, then your app might install the wrong package versions when deploying. To avoid versioning issues, generate a new lockfile and commit it to your repository.",r=[["Generate a lockfile. Run",{command:"npm|yarn|pnpm install"}],"Commit the new file to your repository"];if(e)throw new w(t,o,r);G({headline:t,body:o,nextSteps:r})}function Fs(e,t){let o=e.map(({packageManager:s,foundLockfile:a})=>`${a} (created by ${s.name})`),r="Multiple lockfiles found",n=[`Your project contains more than one lockfile. This can cause version conflicts when installing and deploying your app. The following lockfiles were detected:
2
+ `,{list:{items:o}}],i=["Delete any unneeded lockfiles","Commit the change to your repository"];if(t)throw new w(r,n,i);G({headline:r,body:n,nextSteps:i})}function js(e){let t="Lockfile ignored by Git",o="Your project\u2019s lockfile isn\u2019t being tracked by Git. If you don\u2019t commit a lockfile, then your app might install the wrong package versions when deploying.",r=[`In your project\u2019s .gitignore file, delete any references to ${e}`,"Commit the change to your repository"];G({headline:t,body:o,nextSteps:r})}async function Wn(e,t=!1){if(Ne&&!process.env.SHOPIFY_UNIT_TEST)return;let o=[];for(let i of so){let s=[i.lockfile,...i.alternativeLockfiles||[]];for(let a of s)if(await J(x(e,a))){o.push({packageManager:i,foundLockfile:a});break}}if(o.length===0)return As(t);if(o.length>1)return Fs(o,t);let r=o[0].foundLockfile;(await Zr(e,[r]).catch(()=>[])).length>0&&js(r)}c();var _s=["^cdn/","^_t/"];function ao(e){let t=new Set;return Object.values(e.routes).filter(o=>_s.some(r=>new RegExp(r).test(o.path??""))).forEach(o=>{o.path&&t.add(o.path)}),[...t]}var Ls=["","cart","products/:productHandle","collections","collections/:collectionHandle","sitemap.xml","robots.txt","pages/:pageHandle","policies/:policyHandle","search","account","account/login","account/orders/:orderId","account/authorize"];function co(e,t=Ls){let o=Object.values(e.routes),r=new Set(t);for(let n of t)for(let i of o)if(!n&&!i.path)r.delete(n);else if(n&&i.path){let s={path:i.path,parentId:i.parentId};for(;s.parentId&&s.parentId!=="root";){let p=o.find(d=>d.id===s.parentId);if(!p)break;s.path=p.path==null?s.path:`${p.path}/${s.path}`,s.parentId=p.parentId}let a=":?[^\\/\\?]+\\?",l=`^(${a}\\/)?`+n.replaceAll(".","\\.").replace(/\//g,`\\/(${a}\\/)?`).replace(/:[^/)?]+/g,"(:[^\\/]+|\\*)")+`(\\/${a})?$`;new RegExp(l).test(s.path)&&r.delete(n)}return[...r]}var Re=100;function zn(e){e.length?G({headline:"Standard Shopify routes missing",body:`Your Hydrogen project is missing ${e.length} standard Shopify route${e.length>1?"s":""}.
3
+ Including these routes improves compatibility with Shopify\u2019s platform:
4
+
5
+ `+e.slice(0,Re-(e.length<=Re?0:1)).map(t=>`\u2022 /${t}`).join(`
6
+ `)+(e.length>Re?`
7
+ \u2022 ...and ${e.length-Re+1} more`:"")}):F({headline:"All standard Shopify routes present"})}function lo(e){e.length&&G({headline:"Reserved routes present",body:`Your Hydrogen project is using ${e.length} reserved route${e.length>1?"s":""}.
8
+ These routes are reserved by Shopify and may cause issues with your storefront:
9
+
10
+ `+e.slice(0,Re-(e.length<=Re?0:1)).map(t=>`\u2022 /${t}`).join(`
11
+ `)+(e.length>Re?`
12
+ \u2022 ...and ${e.length-Re+1} more`:"")})}c();c();var ur="metafile.server.json",mo="server-bundle-analyzer.html";async function Jn(){return se(await qe("bundle","analyzer.html"))}function Qn(e,t){return e.replace("globalThis.METAFILE = '';",`globalThis.METAFILE = '${Buffer.from(t,"utf-8").toString("base64")}';`)}async function Kn(e){try{return` \u2502
13
+ `+(await(await import("esbuild")).analyzeMetafile(await se(E(e,ur)),{color:!0})).split(`
14
+ `).filter(r=>!r.match(/(.*)(node_modules\/|server-assets-manifest:|server-entry-module:)(react-dom|@remix-run|@shopify\/hydrogen|react-router|react-router-dom)\/(.*)/g)).slice(2,12).join(`
15
+ `).replace(/dist\/worker\/_assets\/.*$/ms,`
16
+ `).replace(/\n/g,`
17
+ `).replace(/(\.\.\/)+node_modules\//g,r=>L.dim(r))}catch(t){console.warn("Could not generate bundle analysis summary:",t.message)}}function Zn(e){let t;return{name:"hydrogen:bundle-analyzer",configResolved(o){t=o},async generateBundle(o,r){if(!t.build.ssr)return;let{root:n}=t,i=Object.values(r).find(y=>y.type==="chunk");if(!i||i.type!=="chunk"||!i.facadeModuleId||!o.dir)return;let s=await Jn().catch(()=>null);if(!s){console.warn("Bundle analyzer template not found");return}let a=new Set(Object.keys(i.modules)),l=[];for(let y of a){if(fr(y)||hr(y))continue;let v=this.getModuleInfo(y);if(v?.id){l.push(v);for(let g of[...v.importedIds,...v.dynamicallyImportedIds])!fr(g)&&!hr(g)&&a.add(g)}}let p=new Map,d=new Map,u=await Promise.all(l.map(async y=>{let v=ne(n,y.id),g=i.modules[y.id],k=typeof g?.originalLength=="number"?g.originalLength:y.code?.length??0,b=g?.renderedLength??0;if(e?.minify&&g?.code){let A=await e.minify(g.code,y.id).catch(()=>null);A&&(b=A.length)}d.set(v,b);let I=A=>this.resolve(A,y.id),T=!y.code||/(^\s*export\s+[\w\{]|^\s*import\s+[\w\{'"]|\bimport\()|\bcreateRequire\(/ms.test(y.code)||!/((^|\b)exports\b|\brequire\()/.test(y.code),P=Xn(y.importedIds,"import-statement",n,I,y.code),C=Xn(y.dynamicallyImportedIds,"dynamic-import",n,I,y.code),S=(await Promise.all([...P,...C])).reduce((A,{importedId:j,...R})=>(fr(j)?T=!1:hr(j)||A.push(R),A),[]);p.set(v,{bytes:k,format:T?"esm":"cjs",imports:S})})).then(()=>null).catch(y=>y);if(u){console.warn("Bundle analyzer failed to analyze the bundle:",u);return}let m=Object.fromEntries(p.entries()),f={inputs:m,outputs:{[ne(n,E(o.dir,i.fileName))]:{imports:i.imports,exports:i.exports,entryPoint:ne(n,i.facadeModuleId),bytes:i.code.length??0,inputs:Object.entries(m).reduce((y,[v,g])=>(y[v]={bytesInOutput:d.get(v)??g.bytes??0},y),{})}}};this.emitFile({type:"asset",fileName:ur,source:JSON.stringify(f,null,2)}),this.emitFile({type:"asset",fileName:mo,source:Qn(s,JSON.stringify(f))})}}}function fr(e){return/(commonjsHelpers\.js$|\?commonjs\-)/.test(e)}function hr(e){return e.endsWith("?transform-only")}async function Ns(e,t,o){let r=t.matchAll(/import\s[^'"]*?['"]([^'"]+)['"]/g)??[];for(let[,n]of r)if(n&&(await o(n))?.id===e)return n;return e}function Xn(e,t,o,r,n){return e.map(async i=>({importedId:i,path:ne(o,i),kind:t,original:n?await Ns(i,n,r):i}))}c();import{spawn as Hs}from"node:child_process";import{fileURLToPath as ti}from"node:url";var Ms=process.argv[1],Us=ti(import.meta.url),Vs=Ms===Us;Vs&&gt({rootDirectory:process.argv[2],appDirectory:process.argv[3],configFilePath:process.argv[4],watch:!0});function oi(e,t){if(e.includes("AbortError: ")){let s=e.split("AbortError: ")[1]??"",a=s.split(`
18
+ `)[0],l=s.match(/tryMessage: '(.*)',$/m)?.[1];if(a)return{message:a,details:l}}let[o="",...r]=e.replaceAll("[FAILED]","").replace(/\s{2,}/g,`
19
+ `).replace(/\n,\n/,`
20
+ `).trim().split(`
21
+ `),n="[Codegen] "+o,i=r.join(`
22
+ `);if(t){let s=t.replaceAll("\\","/")+"/";i=i.replaceAll(s,"")}return{message:n,details:i}}function po({rootDirectory:e,appDirectory:t,configFilePath:o}){let r,n,i=process.argv.findIndex(a=>a==="hydrogen");i>=1?(r=process.argv[0],n=[...process.argv.slice(1,i+1),"codegen","--watch","--path",e],o&&n.push("--codegen-config-path",o)):(r="node",n=[ti(import.meta.url),e,t??x("app"),o??""]);let s=Hs(r,n,{stdio:["inherit","ignore","pipe"]});return s.stderr.on("data",a=>{let l=typeof a=="string"?a:a?.toString?.("utf8")??"";if(!l)return;let{message:p,details:d}=oi(l,e);/`punycode`/.test(p)||/\.body\[\d\]/.test(p)||/console\.time(End)?\(\)/.test(p)||/─ (warning|info|success) ───/.test(p)||(U({body:""}),G({headline:p,body:d}))}),s.on("close",a=>{a&&a>0&&G({headline:"Codegen process exited with code "+a,body:"There should be more logs above."})}),s}async function gt(e){return await Bs(e),Gs(e).catch(t=>{if(t instanceof w)throw t;let{message:o,details:r}=oi(t.message,e.rootDirectory);throw new w(o,r)})}async function Bs(e){let{execSync:t,exec:o}=await import("child_process");try{t("npx react-router --version",{cwd:e.rootDirectory,stdio:"ignore"})}catch{U({body:"React Router not found, skipping typegen"});return}e.watch?o("npx react-router typegen --watch",{cwd:e.rootDirectory}):t("npx react-router typegen",{cwd:e.rootDirectory,stdio:"inherit"})}async function Gs({watch:e,configFilePath:t,forceSfapiVersion:o,...r}){let{generate:n,loadCodegenConfig:i,CodegenContext:s}=await He("@graphql-codegen/cli",r.rootDirectory).catch(()=>{throw new w("Could not load GraphQL Codegen CLI.","Please make sure you have `@graphql-codegen/cli` installed as a dev dependency.")}),{config:a}=await i({configFilePath:t??r.rootDirectory})||await Ys(r,o);await qs(a,r);let l=new s({config:{...a,watch:e,silent:!e,cwd:r.rootDirectory},filepath:"not-used-but-must-be-set"});return l.cwd=r.rootDirectory,await n(l,!0),Object.entries(a.generates).reduce((p,[d,u])=>("documents"in u&&(p[d]=(Array.isArray(u.documents)?u.documents:[u.documents]).filter(m=>typeof m=="string")),p),{})}async function Ys({rootDirectory:e,appDirectory:t=x(e,"app")},o){let{getSchema:r,preset:n,pluckConfig:i}=await He("@shopify/hydrogen-codegen",e).catch(()=>{throw new w("Could not load Hydrogen Codegen.","Please make sure you have `@shopify/hydrogen-codegen` installed as a dev dependency.")}),{loadConfig:s}=await He("graphql-config",e).catch(()=>{throw new w("Could not load GraphQL Config.","Please make sure you have `graphql-config` installed as a dev dependency.")}),a=await s({rootDir:e,throwOnEmpty:!1,throwOnMissing:!1,legacy:!1}).catch(()=>{}),l=r("storefront"),p=ei(l,a),d=r("customer-account",{throwIfMissing:!1}),u=d?ei(d,a):void 0,m="*!(*.d).{ts,tsx,js,jsx}",f=ne(e,t),y=g=>{let k=Ye(l),b=d&&Ye(d);return!!(g.endsWith(k)||b&&g.endsWith(b))},v=Object.values(a?.projects??{}).filter(g=>g.hasExtension("codegen")&&(typeof g.schema!="string"||!y(g.schema)));return{filepath:"virtual:codegen",config:{overwrite:!0,pluckConfig:i,generates:{...gr(p)??{"storefrontapi.generated.d.ts":{preset:n,schema:l,documents:p?.documents??[m,E(f,"**",m)],...!!o&&{presetConfig:{importTypes:!1},schema:{[`https://hydrogen-preview.myshopify.com/api/${o.split(":")[0]}/graphql.json`]:{headers:{"content-type":"application/json","X-Shopify-Storefront-Access-Token":o.split(":")[1]??"3b580e70970c4528da70c98e097c2fa0"}}},config:{defaultScalarType:"string",scalars:{JSON:"unknown"}}}}},...gr(u)??(u?.documents?{"customer-accountapi.generated.d.ts":{preset:n,schema:d,documents:u.documents}}:{}),...v.reduce((g,k)=>({...g,...gr(k)}),{})}}}}function gr(e){if(e?.extensions?.codegen?.generates)return Object.entries(e.extensions.codegen.generates).reduce((t,[o,r])=>(t[o]={...e,...Array.isArray(r)?r[0]:r},t),{})}function ei(e,t){if(!t)return;let o=Ye(e);return Object.values(t.projects||{}).find(r=>typeof r.schema=="string"&&r.schema.endsWith(o))}async function qs(e,{rootDirectory:t}){let o=Symbol.for("name"),r=Object.values(e.generates).filter(n=>{let i=(Array.isArray(n)?n[0]:n)?.preset;if(typeof i=="object"&&o in i)return i[o]==="hydrogen"||i[o]==="@shopify/graphql-codegen"});for(let n of r){let i=Array.isArray(n)?n[0]:n;if(i){let s=await We(t);i.hooks={beforeOneFileWrite:(a,l)=>ut(l,s,a),...i.hooks}}}}c();function yt(){let{env:e}=process;return e.CI==="false"?!1:!!(e.CI||e.CI_NAME||e.BUILD_NUMBER||e.TF_BUILD)}c();function wt(){let e={state:"pending"};return e.promise=new Promise((t,o)=>{e.resolve=r=>(e.state==="pending"&&(e.state="resolved"),t(r)),e.reject=r=>(e.state==="pending"&&(e.state="rejected"),o(r))}),e}c();function Ae(e){let t,o=process.exit;process.exit=async r=>{t??=e();let n=setTimeout(()=>o(r),5e3);return await t,clearTimeout(n),o(r)}}var fo=class e extends D{static descriptionWithMarkdown="Builds a Hydrogen storefront for production. The client and app worker files are compiled to a `/dist` folder in your Hydrogen project directory.";static description="Builds a Hydrogen storefront for production.";static flags={...h.path,...h.entry,...h.sourcemap,...h.lockfileCheck,...h.disableRouteWarning,...h.codegen,watch:uo.Flags.boolean({description:"Watches for changes and rebuilds the project writing output to disk.",env:"SHOPIFY_HYDROGEN_FLAG_WATCH"}),"bundle-stats":uo.Flags.boolean({description:"Show a bundle size summary after building. Defaults to true, use `--no-bundle-stats` to disable.",allowNo:!0}),"force-client-sourcemap":uo.Flags.boolean({description:"Client sourcemapping is avoided by default because it makes backend code visible in the browser. Use this flag to force enabling it.",env:"SHOPIFY_HYDROGEN_FLAG_FORCE_CLIENT_SOURCEMAP"})};async run(){let{flags:t}=await this.parse(e),o=t.path?x(t.path):process.cwd(),r={...M(t),useCodegen:t.codegen,directory:o};if(!await Vt(o))throw new w(be);let i=await Be(r);r.watch?i?.close&&Ae(async()=>{await i?.close()}):process.exit(0)}},Ws=5;async function Be({entry:e,directory:t,useCodegen:o=!1,codegenConfigPath:r,sourcemap:n=!0,forceClientSourcemap:i,disableRouteWarning:s=!1,lockfileCheck:a=!0,assetPath:l,bundleStats:p=!yt(),watch:d=!1,onServerBuildStart:u,onServerBuildFinish:m}){process.env.NODE_ENV||(process.env.NODE_ENV="production"),l=l??process.env.HYDROGEN_ASSET_BASE_URL??"/";let f=t??process.cwd();a&&await Wn(f,yt());let[y,{userViteConfig:v,remixConfig:g,clientOutDir:k,serverOutDir:b,serverOutFile:I}]=await Promise.all([Ut(f),me(f,e)]),T=y.createLogger(d?"warn":void 0);process.env.SHOPIFY_UNIT_TEST&&(T.info=H=>Te("info",H),T.warn=H=>Te("warn",H),T.error=H=>Te("error",H));let P=v.build?.minify??!0,C={root:f,mode:process.env.NODE_ENV,base:l,customLogger:T},S,A=await y.build({...C,build:{emptyOutDir:!0,copyPublicDir:!0,sourcemap:i??(process.env.NODE_ENV!=="production"&&n),watch:d?{}:null},server:{watch:d?{}:null},plugins:[{name:"hydrogen:cli:client",buildStart(){S?.resolve(),S=wt()},buildEnd(H){H&&S.reject(H)},writeBundle(){S.resolve()},closeWatcher(){this.error(new Error("Process exited before client build finished."))}}]});console.log("");let j,R=await y.build({...C,build:{sourcemap:n,ssr:e??!0,emptyOutDir:!1,copyPublicDir:!1,minify:P,watch:d?{buildDelay:100}:null},server:{watch:d?{}:null},plugins:[{name:"hydrogen:cli:server",async buildStart(){await S.promise,j?.resolve(),j=wt(),await u?.()},async writeBundle(){j?.state!=="rejected"&&await m?.(),j.resolve()},closeWatcher(){this.error(new Error("Process exited before server build finished."))}},...p?[Zn({minify:P?(H,oe)=>y.transformWithEsbuild(H,oe,{minify:!0,minifyWhitespace:!0,minifySyntax:!0,minifyIdentifiers:!0,sourcemap:!1,treeShaking:!1,legalComments:"none",target:"esnext"}).then(ie=>ie.code):void 0})]:[]]});d||await Promise.all([ge(E(k,".vite")),ge(E(b,".vite")),ge(E(b,"assets"))]);let _={rootDirectory:f,appDirectory:g.appDirectory,configFilePath:r},W=o?d?po(_):await gt(_).then(()=>{}):void 0;if(!d&&process.env.NODE_ENV!=="development"){if(p){let oe="file://"+E(b,mo);$(Y`${await Kn(b)||`
23
+ `}\n │\n └─── ${fe.link("Complete analysis: "+oe,oe)}\n\n`)}await Hr(I)/(1024*1024)>=Ws&&V(`\u{1F6A8} Smaller worker bundles are faster to deploy and run.${P?"":"\n Minify your bundle by adding `build.minify: true` to vite.config.js."}
24
+ Learn more about optimizing your worker bundle file: https://h2o.fyi/debugging/bundle-size
25
+ `)}if(!d&&!s){let H=co(g);if(H.length){let oe=await ye(f),ie=oe==="npm"?"npx":oe;V(`Heads up: Shopify stores have a number of standard routes that aren\u2019t set up yet.
26
+ Some functionality and backlinks might not work as expected until these are created or redirects are set up.
27
+ This build is missing ${H.length} route${H.length>1?"s":""}. For more details, run \`${ie} shopify hydrogen check routes\`.
28
+ `)}}return!d&&!s&&lo(ao(g)),{async close(){W?.removeAllListeners("close"),W?.kill("SIGINT");let H=[];"close"in A&&H.push(A.close()),"close"in R&&H.push(R.close()),await Promise.allSettled(H),(S?.state==="pending"||j?.state==="pending")&&(S?.promise.catch(()=>{}),S?.reject(),j?.promise.catch(()=>{}),j?.reject(),await new Promise(oe=>setTimeout(oe,500)))}}}c();var ri=K(ae(),1),ho=class e extends D{static descriptionWithMarkdown="Checks whether your Hydrogen app includes a set of standard Shopify routes.";static description="Returns diagnostic information about a Hydrogen storefront.";static flags={...h.path};static args={resource:ri.Args.string({name:"resource",description:"The resource to check. Currently only 'routes' is supported.",required:!0,options:["routes"]})};async run(){let{flags:t,args:o}=await this.parse(e),r=t.path?x(t.path):process.cwd();if(o.resource==="routes")await zs({directory:r});else throw new Error("Invalid command argument.")}};async function zs({directory:e}){let t=await $e(e);zn(co(t)),lo(ao(t))}c();var go=K(ae(),1);var yo=class e extends D{static descriptionWithMarkdown="Automatically generates GraphQL types for your project\u2019s Storefront API queries.";static description="Generate types for the Storefront API queries found in your project.";static flags={...h.path,"codegen-config-path":go.Flags.string({description:"Specify a path to a codegen configuration file. Defaults to `<root>/codegen.ts` if it exists.",required:!1}),"force-sfapi-version":go.Flags.string({description:"Force generating Storefront API types for a specific version instead of using the one provided in Hydrogen. A token can also be provided with this format: `<version>:<token>`.",hidden:!0}),watch:go.Flags.boolean({description:"Watch the project for changes to update types on file save.",required:!1,default:!1})};async run(){let{flags:t}=await this.parse(e),o=t.path?x(t.path):process.cwd();await Js({...M(t),directory:o})}};async function Js({directory:e,codegenConfigPath:t,forceSfapiVersion:o,watch:r}){let{root:n}=ve(e),i=await $e(n);console.log("");let s=await gt({...i,configFilePath:t,forceSfapiVersion:o,watch:r});r||F({headline:"Generated types for GraphQL:",body:{list:{items:Object.entries(s).map(([a,l])=>a+`
29
+ `+l.map(p=>L.dim(`- ${p}`)).join(`
30
+ `))}}})}c();var si=K(ae(),1);c();import{Session as Qs}from"node:inspector";async function ni(e){let{createMiniOxygen:t}=await He("@shopify/mini-oxygen/node",e).catch(dr),o=t({script:"export default {}",modules:!0,log:()=>{}});return{async run(r,n){let[i]=await Promise.all([se(r),o.ready()]),s=await Ks();await o.reload({script:i});let a=await s();return Xs(a,r+".map",n)},async close(){await o.dispose()}}}function Ks(){let e=new Qs;return e.connect(),new Promise(t=>{e.post("Profiler.enable",()=>{e.post("Profiler.start",()=>{t(()=>new Promise((o,r)=>{e.post("Profiler.stop",(n,{profile:i})=>{if(e.disconnect(),n)return r(n);o(i)})}))})})})}async function Xs(e,t,o){let{SourceMapConsumer:r}=await import("./source-map-E7FCCJL7.js"),n=JSON.parse(await se(t)),i=await new r(n,"file://"+t),s=new Set,a=0,l=e.endTime-e.startTime,p=e.samples?.length?l/e.samples.length:0;for(let d of e.nodes)(d.callFrame.url==="<script>"||s.has(d.id))&&(s.add(d.id),d.children?.forEach(u=>s.add(u))),s.has(d.id)?(Zs(d,i),d.callFrame.url==="<script>"&&!d.callFrame.functionName&&!d.callFrame.lineNumber&&!d.callFrame.columnNumber&&(d.callFrame.url=o??"",d.callFrame.functionName="(top-level app code)"),a+=Math.round((d.hitCount??0)*p*1e3)/1e3):ea(d);return i.destroy(),{profile:e,totalTimeMs:l/1e3,totalScriptTimeMs:a/1e3}}function Zs(e,t){let o=t.originalPositionFor({line:e.callFrame.lineNumber+1,column:e.callFrame.columnNumber+1});e.callFrame.url=o.source||e.callFrame.url,e.callFrame.functionName=o.name||e.callFrame.functionName,e.callFrame.lineNumber=o.line?o.line-1:e.callFrame.lineNumber,e.callFrame.columnNumber=o.column??e.callFrame.columnNumber}function ea(e){Object.assign(e,{children:[],callFrame:{functionName:"(profiler)",scriptId:"0",url:"",lineNumber:-1,columnNumber:-1}})}var ii="startup.cpuprofile",wo=class e extends D{static descriptionWithMarkdown="Builds the app and runs the resulting code to profile the server startup time, watching for changes. This command can be used to [debug slow app startup times](https://shopify.dev/docs/custom-storefronts/hydrogen/debugging/cpu-startup) that cause failed deployments in Oxygen.\n\n The profiling results are written to a `.cpuprofile` file that can be viewed with certain tools such as [Flame Chart Visualizer for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-js-profile-flame).";static description="Builds and profiles the server startup time the app.";static flags={...h.path,...h.entry,output:si.Flags.string({description:`Specify a path to generate the profile file. Defaults to "${ii}".`,default:ii,required:!1})};async run(){let{flags:t}=await this.parse(e),o=t.path?x(t.path):process.cwd(),{close:r}=await ta({...M(t),directory:o,output:x(o,t.output)});Ae(async()=>{await r()})}};async function ta({directory:e,entry:t,output:o}){process.env.NODE_ENV||(process.env.NODE_ENV="production"),Xe({workerReload:!1});let{buildPath:r,buildPathWorkerFile:n}=ve(e);$(`\u23F3\uFE0F Starting profiler for CPU startup... Profile will be written to:
31
+ `+L.dim(o));let i=0,s,a=await ni(e),l={onServerBuildStart(){i>0&&process.stdout.write(Ft.eraseLines(4)),$(`
32
+ #${++i} Building and profiling...`)},async onServerBuildFinish(){let{profile:m,totalScriptTimeMs:f}=await a.run(n,s);process.stdout.write(Ft.eraseLines(2)),$(`#${i} Total time: ${f.toLocaleString()} ms
33
+ ${L.dim(o)}`),await Q(o,JSON.stringify(m,null,2)),$(`
34
+ Waiting for changes...`)}};if(await Je(e))throw new w(be);let d=await me(e).catch(()=>null);n=d?.serverOutFile??E(r,"server","index.js"),s=d?.remixConfig.serverEntryPoint??"";let u=await Be({entry:t,directory:e,watch:!0,sourcemap:!0,disableRouteWarning:!0,lockfileCheck:!1,bundleStats:!1,...l,onServerBuildStart(){return i===0&&process.stdout.write(Ft.eraseLines(1)),l.onServerBuildStart()}});return{async close(){await Promise.allSettled([u.close(),a.close()])}}}c();var ee=K(ae(),1);c();c();import ai from"fs";import ci,{dirname as oa}from"path";import{fileURLToPath as ra}from"url";var vo={assetsDirDefault:"dist/client/",buildCommandDefault:"npm build",verificationDurationDefault:180,maxUploadAttempts:3,maxResumabeUploadAttempts:9,workerDirDefault:"dist/worker/"};function ke(e){if(na(e)){if(e.statusCode===401)throw new w("You are not authorized to perform this action. Please check your deployment token.");if(e.statusCode===429)throw new w("You've made too many requests. Please try again later")}if(e instanceof w&&e.message.includes("503"))throw new w("The server is currently unavailable. Please try again later.")}var ce=(e=>(e.OxygenNamespaceHandle="X-Oxygen-Namespace-Handle",e))(ce||{});function na(e){return typeof e=="object"&&e!==null&&"statusCode"in e}function vt(e){let t;if(e)t=ci.join(e,"package.json");else{let r=ra(import.meta.url),n=oa(r);t=ci.join(n,"../../package.json")}if(!ai.existsSync(t))return{};let o=ai.readFileSync(t,"utf8");return JSON.parse(o)}function yr(e){process.stderr.write(`${e}
35
+ `)}var ot=375;function wr(e){try{let t=Buffer.from(e,"base64").toString("utf-8"),o=JSON.parse(t);return mi(o)}catch{throw new Error("Error processing deployment token. Please check your token and try again.")}}function li(e){if(!e)return;let t=Number(e);if(isNaN(t))throw new w("Invalid duration format. Please specify the duration in hours (e.g., '10').");if(t>12||t<1)throw new w("Invalid duration length. Please specify the duration (in hours) between 1 to 12 hours.");return t}async function di({config:e,performedBuild:t=!1}){let{rootPath:o,workerDir:r,assetsDir:n,skipBuild:i,workerOnly:s}=e,a={root:o};(i||t)&&(a.worker=E(o,r),s||(a.assets=E(o,n)));for(let p of Object.keys(a))await ia(a[p],p);if(!/^https:\/\/(?:[\w-]+\.)*[\w-]+|^https:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/.test(e.deploymentUrl))throw new Error(`Invalid deployment service URL: ${e.deploymentUrl}`)}async function ia(e,t){if(!await J(e))throw t==="assets"&&V('Use the "workerOnly" flag to perform a worker-only deployment.',yr),new Error(`Path not found: ${e}`)}function mi(e){return typeof e=="object"?Object.keys(e).reduce((t,o)=>{let r=o.replace(/([-_][a-z])/gi,n=>n.toUpperCase().replace("-","").replace("_",""));if(e[o]===void 0)throw new Error(`Invalid token: ${o} is undefined`);return t[r]=mi(e[o]),t},{}):e}c();var bo=K($s(),1);var pi;function sa(e){if(e)return;if(bo.default._client)return bo.default;let o={apiKey:"21fd37fe87ead4b9c5a8eed90752b455",autoDetectErrors:!0,appVersion:vt().version,endpoints:{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com"},logger:null};return bo.default.start(o)}function ui(e){pi=sa(e)}function rt(){return pi}function fi(e,t){if(!t)return e;let o=r=>r.replace(new RegExp(t,"g"),"***");if(e instanceof Error){let r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e,{message:o(e.message),stack:e.stack?o(e.stack):void 0}),r}return o(e)}c();var re=(e=>(e.BuildTime="build_time",e.NumFilesRequested="num_files_requested",e.NumFilesUploaded="num_files_uploaded",e.TotalSizeUploaded="total_size_uploaded",e.TotalSizeRequested="total_size_requested",e.TotalTime="total_time",e.UploadTime="upload_time",e.DeploymentCompletedTime="deployment_completed_time",e.DeploymentRoutableTime="deployment_routable_time",e))(re||{}),ko=class{metrics={};metricPrefix="oxygen.cli";defaultTags;exportUrl;constructor(t){let{version:o}=vt(),{version:r}=vt(`${t.rootPath}/node_modules/@shopify/hydrogen`);this.defaultTags={ci_provider:t.ciProvider,cli_version:`oxygen-cli@${o||"unknown"}`,hydrogen_version:r||"unknown"},this.exportUrl="https://metrics.myshopify.dev"}add(t,o,r={}){let n={value:o,tags:r};this.metrics[t]?this.metrics[t].push(n):this.metrics[t]=[n]}formatTags(t){return Object.entries(t).map(([o,r])=>`${o}:${r}`)}async export(){let t=Object.entries(this.metrics).map(([o,r])=>{let n=`${this.metricPrefix}.${o}`;return r.map(({value:i,tags:s})=>({name:n,type:"gauge",value:i,tags:this.formatTags({...s,...this.defaultTags})}))}).flat();try{await ue(this.exportUrl,{method:"POST",body:JSON.stringify({events:t})})}catch(o){let r=rt();r&&(o instanceof Error||typeof o=="string")&&r.notify(o)}}};c();c();var hi=`
36
+ mutation BuildInitiate($environment: EnvironmentSelectorInput, $labels: [String!]) {
37
+ buildInitiate(environment: $environment, labels: $labels) {
38
+ build {
39
+ id
40
+ assetPath
41
+ }
42
+ userErrors {
43
+ message
44
+ }
45
+ }
46
+ }
47
+ `;async function gi(e){let{config:t,logger:o,environment:r,labels:n=[]}=e,i={environment:r,labels:n};try{let s=await de({query:hi,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:i,addedHeaders:{[ce.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(s.buildInitiate.userErrors.length>=1)throw new w(`Failed to create build. ${s.buildInitiate.userErrors[0]?.message}`);return Ie(`Build initiated successfully with id ${s.buildInitiate.build.id}.`,o),s.buildInitiate}catch(s){throw ke(s),s}}c();c();var yi=`
48
+ mutation BuildCancel($buildId: ID!, $reason: String!) {
49
+ buildCancel(id: $buildId, reason: $reason) {
50
+ build {
51
+ id
52
+ }
53
+ userErrors {
54
+ message
55
+ }
56
+ }
57
+ }
58
+ `;async function wi(e){let{config:t,buildId:o,reason:r,logger:n}=e,i={buildId:o,reason:r};try{let s=await de({query:yi,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,addedHeaders:{[ce.OxygenNamespaceHandle]:t.deploymentToken.namespace},variables:i});if(s.buildCancel.userErrors.length>=1)throw new w(`Failed to cancel build: ${s.buildCancel.userErrors[0]?.message}`);return $(`Build with id ${o} cancelled.`,n),s.buildCancel}catch(s){throw ke(s),s}}c();c();var Eo=(e=>(e.Worker="WORKER",e.Asset="ASSET",e))(Eo||{}),nt=class extends Error{},Ge=class extends Error{};async function bi(e,t){let o=E(e.rootPath,e.workerDir),r=await mt(`${o}/**`),n=vi({files:r,basePath:o,type:Eo.Worker,filter:ca});if(!e.workerOnly){let s=E(e.rootPath,e.assetsDir),a=await mt(`${s}/**`);n=[...n,...vi({files:a,basePath:s,type:Eo.Asset,filter:la})]}t?.add(re.NumFilesRequested,n.length);let i=n.reduce((s,a)=>s+a.fileSize,0)/1024;return t?.add(re.TotalSizeRequested,i),n}function aa(e){let t=Nr(e);return Ur(t)}function vi(e){let{files:t,basePath:o,type:r,filter:n}=e,i=[];return t.forEach(s=>{let a=ne(o,s);n&&!n(a)||i.push({filePath:a,fileSize:Mr(s),mimeType:Xr(s),fileType:r,fileHash:aa(s)})}),i}function ca(e){let t=["oxygen.json"],o=[".js.map",".mjs.map",".map",".js",".mjs"],n=`^(${["index"].join("|")})(${o.join("|")})$`;return new RegExp(n).test(e.toLowerCase())||t.includes(e)}function la(e){let o=`(${[".map"].join("|")})$`;return!new RegExp(o).test(e.toLowerCase())}c();c();var ki=`
59
+ mutation DeploymentInitiate($buildId: ID, $environment: EnvironmentSelectorInput, $labels: [String!], $files: [FileInput!]!) {
60
+ deploymentInitiate(buildId: $buildId, environment: $environment, labels: $labels, files: $files) {
61
+ deployment {
62
+ id
63
+ }
64
+ deploymentTargets {
65
+ filePath
66
+ fileSize
67
+ uploadUrl
68
+ fileType
69
+ parameters {
70
+ name
71
+ value
72
+ }
73
+ }
74
+ deploymentConfiguration {
75
+ timeoutInSeconds
76
+ }
77
+ userErrors {
78
+ message
79
+ }
80
+ }
81
+ }
82
+ `;async function Ei(e){let{config:t,input:o,logger:r}=e,n={buildId:o.buildId,environment:o.environment,files:o.manifest,labels:o.labels};try{let i=await de({query:ki,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:n,addedHeaders:{[ce.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(i.deploymentInitiate.userErrors.length>=1)throw new w(`Failed to create deployment. ${i.deploymentInitiate.userErrors[0]?.message}`);return Ie(`Deployment initiated, ${i.deploymentInitiate.deploymentTargets.length} files to upload.`,r),i.deploymentInitiate}catch(i){throw ke(i),i}}c();c();var Si=`
83
+ mutation DeploymentComplete($deploymentId: ID!, $generateAuthBypassToken: Boolean, $authBypassTokenDuration: Int, $environmentVariables: [EnvironmentVariableInput!]) {
84
+ deploymentComplete(id: $deploymentId, generateAuthBypassToken: $generateAuthBypassToken, authBypassTokenDuration: $authBypassTokenDuration, environmentVariables: $environmentVariables) {
85
+ deployment {
86
+ id
87
+ url
88
+ }
89
+ authBypassToken
90
+ userErrors {
91
+ message
92
+ }
93
+ }
94
+ }
95
+ `;async function xi(e,t){let o={deploymentId:t,generateAuthBypassToken:e.generateAuthBypassToken};if(e.generateAuthBypassToken)o.authBypassTokenDuration=li(e.authBypassTokenDuration);else if(e.authBypassTokenDuration)throw new w("authBypassTokenDuration is set but generateAuthBypassToken is not enabled");e.overriddenEnvironmentVariables&&(o.environmentVariables=e.overriddenEnvironmentVariables);try{let r=await de({query:Si,api:"Oxygen",url:`${e.deploymentUrl}/api/v2/admin/graphql`,token:e.deploymentToken.accessToken,variables:o,addedHeaders:{[ce.OxygenNamespaceHandle]:e.deploymentToken.namespace}});if(r.deploymentComplete.userErrors.length>=1)throw new w(`Failed to complete deployment: ${r.deploymentComplete.userErrors[0]?.message}`);return r.deploymentComplete}catch(r){throw ke(r),r}}c();async function Pi(e){let{config:t,url:o,logger:r,hooks:n}=e;n?.onVerificationStart?.(),$("Verifying worker deployment is routable...",r);let i=0,s=0,a=!1,l=Date.now(),p=async()=>{if(i<10?s=500:i%5===0&&(s+=5e3),(Date.now()-l)/1e3+s/1e3>t.verificationMaxDuration){let m=new nt("Unable to verify that the worker is accessible.");throw a||(a=!0,n?.onVerificationError?.(m)),m}i++,await new Promise(m=>setTimeout(m,s)),await d()},d=async()=>{try{if((await ue(`${o}/.oxygen/deployment`,{method:"HEAD"})).status===200)return $("Deployment verification check passed",r),n?.onVerificationComplete?.(),Promise.resolve();await p()}catch{await p()}};await d()}c();c();var Ci=`
96
+ mutation DeploymentCancel($deploymentId: ID!, $reason: String!) {
97
+ deploymentCancel(id: $deploymentId, reason: $reason) {
98
+ deployment {
99
+ id
100
+ }
101
+ userErrors {
102
+ message
103
+ }
104
+ }
105
+ }
106
+ `;async function Di(e){let{config:t,deploymentId:o,reason:r,logger:n}=e,i={deploymentId:o,reason:r};try{let s=await de({query:Ci,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:i,addedHeaders:{[ce.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(s.deploymentCancel.userErrors.length>=1)throw new w(s.deploymentCancel.userErrors[0]?.message||"");return $(`Deployment with id ${o} cancelled.`,n),s.deploymentCancel}catch(s){throw ke(s),s}}c();import{Agent as da}from"https";var Ti=K(Rs(),1);async function Ii(e){let{config:t,logger:o,targets:r,hooks:n}=e;$(`Uploading ${r.length} files...`,o);let i=r.reduce((l,p)=>l+p.fileSize,0)/1024;e.metricsExporter?.add(re.TotalSizeUploaded,i),e.metricsExporter?.add(re.NumFilesUploaded,r.length);let s=new da({keepAlive:!0});n?.onUploadFilesStart?.();let a=performance.now();return(0,Ti.mapLimit)(r,6,async l=>{await ma(t,l,s)}).then(()=>{let l=performance.now();n?.onUploadFilesComplete?.(),e.metricsExporter?.add(re.UploadTime,l-a),Ie("Files uploaded successfully",o)}).catch(l=>{throw n?.onUploadFilesError?.(l),l}).finally(()=>{s.destroy()})}async function ma(e,t,o){let r=t.fileType==="WORKER"?E(e.rootPath,e.workerDir):E(e.rootPath,e.assetsDir);if(t.parameters!==null&&t.parameters.length>0){let n=Vr();t.parameters.forEach(i=>{n.append(i.name,i.value)}),n.append("file",er(E(r,t.filePath))),await Oi(n,t,o)}else{let n=await pa(t,o);await $i(E(r,t.filePath),n,o)}}async function Oi(e,t,o,r=0){try{let i=new AbortController,s=setTimeout(()=>{i.abort()},12e4),a=await ue(t.uploadUrl,{method:"POST",body:e,signal:i.signal,headers:{Connection:"keep-alive"},agent:o});if(clearTimeout(s),!a.ok)throw new Error(`${a.status}`)}catch(n){if(Ri(n,"ENOENT"))throw new Error(`File not found: ${t.filePath}`);if(r<Number(vo.maxUploadAttempts))await Oi(e,t,o,r+1);else throw n instanceof Error&&n.name==="AbortError"?new Error(`Request timeout whilst uploading ${t.filePath}`):new Error(`Failed to upload file ${t.filePath}`)}}async function pa(e,t){return ue(e.uploadUrl,{method:"POST",headers:{"x-goog-resumable":"start","X-Goog-Content-Length-Range":`0,${e.fileSize}`,"User-Agent":"oxygen-cli"},agent:t}).then(o=>({sessionUri:o.headers.get("x-guploader-uploadid"),location:o.headers.get("location"),target:e})).catch(o=>{throw new Error(`Failed to initiate resumable upload for file ${e.filePath} (status code ${o.statusCode})`)})}async function $i(e,t,o,r=0,n=0){await ua(t.location,e,r,o).catch(async i=>{if(Ri(i,"ENOENT"))throw new Error(`File not found: ${t.target.filePath}`);if(i&&n>=Number(vo.maxResumabeUploadAttempts))throw new Error(`Failed to upload file ${t.target.filePath} after ${vo.maxResumabeUploadAttempts} attempts`);let s=await fa(t.location,t.target.fileSize,o);if(!s.complete){let a=s.lastReceivedByte,l=n+1;await $i(e,t,o,a,l)}})}async function ua(e,t,o,r){let n=er(t,{start:o});return ue(e,{method:"PUT",body:n,agent:r}).then(i=>i.status)}async function fa(e,t,o){let r=n=>{if(!n||n.split("-").length!==2)return 0;let i=n.split("-");return parseInt(i[1],10)};return ue(e,{method:"PUT",headers:{"Content-Length":"0","Content-Range":`bytes */${t}`},agent:o}).then(n=>({complete:n.status===200,lastReceivedByte:r(n.headers.get("range"))})).catch(n=>(console.error(n),{complete:!1,lastReceivedByte:0}))}function Ri(e,t){return e instanceof Error&&"code"in e&&e.code===t}c();c();var Ai=`
107
+ query DeploymentVerificationDetails($deploymentId: ID!) {
108
+ deploymentVerificationDetails(id: $deploymentId) {
109
+ url
110
+ status
111
+ error
112
+ startupTime
113
+ }
114
+ }
115
+ `,bt=(e=>(e.Pending="PENDING",e.Deployed="DEPLOYED",e.Failed="FAILED",e.Cancelled="CANCELLED",e))(bt||{});async function Fi(e,t){let{config:o,logger:r,timeoutInSeconds:n,hooks:i}=e,s={deploymentId:t};i?.onDeploymentCompletedVerificationStart?.(),$("Verifying deployment completed...",r);let a=Date.now(),l=async()=>{if((Date.now()-a)/1e3+3e3/1e3>n)throw i?.onDeploymentCompletedVerificationError?.(),new Error(`Deployment not completed after ${n} seconds.`);return await new Promise(m=>setTimeout(m,3e3)),p()},p=async()=>{let u=(await de({query:Ai,api:"Oxygen",url:`${o.deploymentUrl}/api/v2/admin/graphql`,token:o.deploymentToken.accessToken,variables:s,addedHeaders:{[ce.OxygenNamespaceHandle]:o.deploymentToken.namespace}})).deploymentVerificationDetails;if(u==null)throw i?.onDeploymentCompletedVerificationError?.(),new Ge("Deployment not found");if(u.status===bt.Deployed)return Ie("Deployment to Oxygen completed successfully",r),i?.onDeploymentCompleted?.(),u;if(u.status===bt.Failed||u.status===bt.Cancelled)throw i?.onDeploymentFailed?.(u),new Ge(u.error?`Deployment ${u.status.toLocaleLowerCase()}, error: ${u.error}${u.startupTime&&u.error.includes("exceeded CPU time limit")?` (Startup time: ${u.startupTime}ms exceeded CPU time limit)`:""}`:`Deployment ${u.status.toLocaleLowerCase()}`);return l()};return p()}c();import{spawn as ha}from"child_process";import{PassThrough as ga}from"stream";async function ji(e){let{config:t,assetPath:o,hooks:r}=e,n=rt();if(r?.buildFunction){let s=performance.now();return r.buildFunction(o).then(()=>{e.metricsExporter?.add(re.BuildTime,performance.now()-s)}).catch(a=>{throw new Error(`Build function failed with error: ${a}`)})}let i=o?{HYDROGEN_ASSET_BASE_URL:o}:{};try{await new Promise((s,a)=>{let l="",p=new ga;p.on("data",m=>{l+=m,process.stderr.write(m)});let d=performance.now(),u=ha(t.buildCommand,[],{stdio:["inherit","pipe","pipe"],env:{...process.env,...i},cwd:t.rootPath,shell:!0});u.stderr?.pipe(p),u.stdout?.pipe(p),u.on("close",m=>{if(m===0&&e.metricsExporter?.add(re.BuildTime,performance.now()-d),n?.addMetadata("buildCommand",{command:t.buildCommand,stderr:l,code:m}),m!==0){a(m);return}s(m)})})}catch(s){throw new Error(`Build failed with error code: ${s}`)}}c();async function _i(e,t){let o=_t(),r=o.metadata??{};try{let n=await ya(e.rootPath);r.actor||(r.actor=n.author_name),r.commitDate||(r.commitDate=n.date),r.commitMessage||(r.commitMessage=n.message),n.branch&&(r.branch=n.branch),n.hash&&(r.commitSha=n.hash)}catch{V("Could not retrieve Git history, commit message will be unavailable.",t)}return{name:o.isCI?o.name:"none",...r,actor:e.metadata.user??r.actor,commitMessage:wa(e.metadata.description??r.commitMessage),commitSha:e.metadata.version??r.commitSha,hydrogenVersion:e.metadata.hydrogenVersion,url:e.metadata.url??r.url}}async function ya(e){let t=await Lt(e),o=(/HEAD -> ([^,]*)/.exec(t.refs)||[])[1],r=process.env.GITHUB_HEAD_REF;if(!r)return{...t,branch:o};let n=/Merge ([\w\d]+) into [\w\d]+/.exec(t.message);return{...t,branch:r,hash:n?n[1]:t.hash}}function wa(e){if(!e)return;let t=e.split(/\r?\n/)[0]?.trim()||"",o=JSON.stringify(t),r=!1;for(;o.length>ot;){let n=t.lastIndexOf(" ",ot-3);t=`${t.substring(0,n>-1?n:ot-3)}`.trimEnd(),r=!0,o=JSON.stringify(t)}return r?`${t}...`:t}function Li(e,t){if(e.defaultEnvironment)return;let o=e.environmentTag||t.branch;return o?{tag:o}:void 0}function Ni(e){let t=[],o=(n,i)=>{let s=JSON.stringify(i);if(s.length>ot)throw new Error(`Provided ${n} metadata exceeds maximum length (max ${ot} characters).`);let a=`${n}=${s}`;t.push(a)};if(e.name!=="none"&&t.push(`ci-platform=${JSON.stringify(e.name)}`),e.name!=="unknown"){let n={attempt:"attempt",run:"runId"};for(let[i,s]of Object.entries(n)){let a=i;e[a]&&t.push(`${e.name}-${s}=${JSON.stringify(e[a])}`)}}let r={actor:"user",branch:"branch",commitDate:"commit-date",commitMessage:"description",commitSha:"version",hydrogenVersion:"hydrogen-version",url:"url"};for(let[n,i]of Object.entries(r)){let s=n;e[s]&&o(i,e[s])}return t}async function Hi(e){let t=performance.now();ui(!e.config.bugsnag);let o=rt();o?.addMetadata("config",{...e.config,deploymentToken:{...e.config.deploymentToken,accessToken:"***"},rootPath:"***"});let{config:r,hooks:n}=e,i=e.logger??yr,s={},a,l,p;try{let d=await _i(r,i),u=Ni(d),m=Li(r,d);if(o?.addMetadata("metadata",{environment:m,labels:u,metadata:d}),p=new ko({ciProvider:d.name||"unknown",rootPath:r.rootPath}),!r.workerOnly&&!r.skipBuild){let I=await gi({config:r,environment:m,labels:u,logger:i});s.id=I.build.id,s.assetPath=I.build.assetPath}r.skipBuild||(await ji({config:r,assetPath:s.assetPath,hooks:n,metricsExporter:p}),await di({config:r,performedBuild:!0})),a=!0;let f=await bi(r,p);o?.addMetadata("manifest",f);let y=s.id?{buildId:s.id,manifest:f}:{environment:m,manifest:f,labels:u};l=await Ei({config:r,input:y,logger:i}),await Ii({config:r,targets:l.deploymentTargets,hooks:n,logger:i,metricsExporter:p});let v=performance.now(),g=await xi(r,l.deployment.id);p.add(re.TotalTime,performance.now()-t),await Fi({config:r,hooks:n,logger:i,timeoutInSeconds:l.deploymentConfiguration.timeoutInSeconds},l.deployment.id),p.add(re.DeploymentCompletedTime,performance.now()-v),r.skipVerification||(await Pi({config:r,url:g.deployment.url,logger:i,hooks:n}),p.add(re.DeploymentRoutableTime,performance.now()-v));let k={url:g.deployment.url},b=`
116
+ The deployment can be reached at the ${k.url} preview URL`;return g.authBypassToken&&(k.authBypassToken=g.authBypassToken,b+=`. The auth bypass token for the deployment is ${k.authBypassToken}`),Qr(b,i),k}catch(d){return r.bugsnag&&o&&(d instanceof Error||typeof d=="string")&&o.notify(fi(d,r.rootPath)),d instanceof Error?(d instanceof nt||d instanceof Ge?V(d.message,i):s.id&&!a?(V(`Build failed with: ${d.message}, cancelling build.`,i),await wi({config:r,buildId:s.id,reason:d.message,logger:i}).catch(u=>{u instanceof Error&&V(`Failed to cancel build: ${u.message}`,i)})):l?.deployment.id&&(V(`Deployment failed with: ${d.message}, cancelling deployment.`,i),await Di({config:r,deploymentId:l.deployment.id,reason:d.message,logger:i}).catch(u=>{u instanceof Error&&V(`Failed to cancel deployment: ${u.message}`,i)})),Promise.reject(d)):(console.error("Unknown error",d),Promise.reject(new Error("Unknown error")))}finally{p?.export()}}import{createRequire as ba}from"node:module";c();c();c();function Mi(e){let{storeFqdn:t}=e;return`https://${t}/admin/custom_storefronts/new`}function Ui(e){let{storeFqdn:t}=e;return`https://${t}/admin/custom_storefronts`}function it({session:e,storefront:t,cliCommand:o}){Ce({name:"NoStorefrontError",type:0,message:Y`${fe.errorText("Couldn\u2019t find Hydrogen storefront.")}`.value,skipOclifErrorHandling:!0,tryMessage:Y`Couldn’t find ${t.title} (ID: ${Ke(t.id)}) on ${e.storeFqdn}. Check that the storefront exists and run ${fe.genericShellCommand(`${o} link`)} to link this project to it.\n\n${fe.link("Hydrogen Storefronts Admin",Ui(e))}`.value})}function Vi({noStorefronts:e=!1}){U({headline:e?"You don't have a Hydrogen storefront to link to":"You haven't linked your project to a storefront yet",body:["Link your local environment to a Hydrogen storefront. Enable automatic environment variable injection and access to",{command:"env list"},",",{command:"env pull"},",",{command:"env push"},", and",{command:"deploy"},"commands. Use",{command:"unlink"},"to disconnect from the storefront."]})}c();var va=`#graphql
117
+ query GetDeploymentToken($id: ID!) {
118
+ hydrogenStorefront(id: $id) {
119
+ oxygenDeploymentToken
120
+ environments {
121
+ name
122
+ handle
123
+ branch
124
+ type
125
+ }
126
+ }
127
+ }
128
+ `;async function Bi(e,t){let{hydrogenStorefront:o}=await Qe(va,e,{id:t});return{storefront:o}}c();async function Fe({root:e,session:t,config:o,cliCommand:r}){let n=await vn(t),i=o.storefront?.id?n.find(({id:s})=>s===o.storefront.id):void 0;return i||(Vi({noStorefronts:!n.length}),await Ln(e,t,o,{force:!0,cliCommand:r,storefronts:n}))}async function Gi({root:e}){let[{session:t,config:o},r]=await Promise.all([pe(e),q()]),n=await Fe({root:e,session:t,config:o,cliCommand:r});if(!n)return;o.storefront=n;let{storefront:i}=await Bi(t,o.storefront.id);if(!i){it({session:t,storefront:o.storefront,cliCommand:r});return}if(!i.oxygenDeploymentToken){V("Could not retrieve a deployment token.");return}return i}var Yi="h2_deploy_log.json",ka="node --run build",Ea=(e,t="info")=>{(t==="error"||t==="warn")&&V(e)},So=class e extends D{static descriptionWithMarkdown="Builds and deploys your Hydrogen storefront to Oxygen. Requires an Oxygen deployment token to be set with the `--token` flag or an environment variable (`SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN`). If the storefront is [linked](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-link) then the Oxygen deployment token for the linked storefront will be used automatically.";static description="Builds and deploys a Hydrogen storefront to Oxygen.";static flags={...h.entry,...h.env,...h.envBranch,...he(h.envFile,{"env-file":{description:"Path to an environment file to override existing environment variables for the deployment.",default:void 0}}),preview:ee.Flags.boolean({description:"Deploys to the Preview environment.",required:!1,default:!1}),force:ee.Flags.boolean({char:"f",description:"Forces a deployment to proceed if there are uncommitted changes in its Git repository, and skips confirmation prompts for non-preview environments.",default:!1,env:"SHOPIFY_HYDROGEN_FLAG_FORCE",required:!1}),"no-verify":ee.Flags.boolean({description:"Skip the routability verification step after deployment.",default:!1,required:!1}),"auth-bypass-token":ee.Flags.boolean({description:"Generate an authentication bypass token, which can be used to perform end-to-end tests against the deployment.",required:!1,default:!1,env:"AUTH_BYPASS_TOKEN"}),"auth-bypass-token-duration":ee.Flags.string({description:"Specify the duration (in hours) up to 12 hours for the authentication bypass token. Defaults to `2`",required:!1,env:"AUTH_BYPASS_TOKEN_DURATION",dependsOn:["auth-bypass-token"]}),"build-command":ee.Flags.string({description:"Specify a build command to run before deploying. If not specified, the Hydrogen build pipeline will be used. When custom output directories are configured, defaults to `node --run build`.",required:!1}),"assets-dir":ee.Flags.string({description:"Directory containing the client assets to deploy, relative to the project root. Defaults to the detected Vite client output directory, then falls back to `dist/client`.",env:"SHOPIFY_HYDROGEN_FLAG_ASSETS_DIR",required:!1}),"worker-dir":ee.Flags.string({description:"Directory containing the Oxygen worker entry point (`index.js` or `index.mjs`), relative to the project root. Defaults to the detected Vite server output directory, then falls back to `dist/server`.",env:"SHOPIFY_HYDROGEN_FLAG_WORKER_DIR",required:!1}),...h.lockfileCheck,...h.path,...h.shop,"json-output":ee.Flags.boolean({allowNo:!0,description:"Create a JSON file containing the deployment details in CI environments. Defaults to true, use `--no-json-output` to disable.",required:!1,default:!0}),token:ee.Flags.string({char:"t",description:"Oxygen deployment token. Defaults to the linked storefront's token if available.",env:"SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN",required:!1}),"metadata-description":ee.Flags.string({description:"Description of the changes in the deployment. Defaults to the commit message of the latest commit if there are no uncommitted changes.",required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_DESCRIPTION"}),"metadata-url":ee.Flags.string({required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_URL",hidden:!0}),"metadata-user":ee.Flags.string({description:"User that initiated the deployment. Will be saved and displayed in the Shopify admin",required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_USER"}),"metadata-version":ee.Flags.string({required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_VERSION",hidden:!0}),"force-client-sourcemap":ee.Flags.boolean({description:"Client sourcemapping is avoided by default because it makes backend code visible in the browser. Use this flag to force enabling it.",env:"SHOPIFY_HYDROGEN_FLAG_FORCE_CLIENT_SOURCEMAP"})};async run(){let{flags:t}=await this.parse(e),o=this.flagsToOxygenDeploymentOptions(t);await Sa(o),process.exit(0)}flagsToOxygenDeploymentOptions(t){return{...M(t),defaultEnvironment:t.preview,environmentFile:t["env-file"],path:t.path?x(t.path):process.cwd()}}};function qi(e){return new w(e||"The deployment failed due to an unexpected error.","Retrying the deployment may succeed.",[["If the issue persists, please check the",{link:{label:"Shopify status page",url:"https://status.shopify.com/"}},"for any known issues."]])}async function Sa(e){let{authBypassTokenDuration:t,authBypassToken:o,buildCommand:r,defaultEnvironment:n,env:i,envBranch:s,environmentFile:a,force:l,forceClientSourcemap:p=!1,noVerify:d,lockfileCheck:u,jsonOutput:m,path:f,shop:y,assetsDir:v,metadataUrl:g,metadataUser:k,metadataVersion:b,entry:I,workerDir:T}=e,{metadataDescription:P}=e,C=!0;try{await rn(f)}catch(O){if(O instanceof on&&(C=!1),!l&&!C){let B="Uncommitted changes detected",Ee,dt=[["Commit your changes before deploying or use the",{command:"--force"},"flag to deploy with uncommitted changes."]];try{Ee=(await pt("git status -s",{cwd:f})).stdout}catch{}throw Ee&&(B+=`:
129
+
130
+ ${Ee.trimEnd()}`,so.forEach(({name:Jo,lockfile:Qo,alternativeLockfiles:Ds,installCommand:Ts})=>{let Fr=[Qo,...Ds||[]].find(Is=>Ee.includes(Is));Fr&&dt.push([`If you are using ${Jo}, try running`,{command:Ts},`to avoid changes to ${Fr}.`])})),new w(B,null,dt)}}let S=_t().isCI,A=e.token,j,R,_,W,H;try{H=await Lt(f),j=(/HEAD -> ([^,]*)/.exec(H.refs)||[])[1],R=H.hash}catch{V("Could not retrieve Git history."),j=void 0}!P&&!C&&(G({headline:"No deployment description provided",body:["Deploying uncommitted changes, but no description has been provided. Use the ",{command:"--metadata-description"},"flag to provide a description. If no description is provided, the description defaults to ",{userInput:"<sha> with additional changes"}," using the SHA of the last commit."]}),P=`${R} with additional changes`);let oe;if(a){let{variables:O}=await eo(a);oe=Object.entries(O).map(([B,Ee])=>({isSecret:!0,key:B,value:Ee}))}let ie=null,Pe=!1;if(S&&i)throw new w("Can't specify an environment handle in CI","Environments are automatically picked up by the current Git branch.");if(S&&s&&(ie=s),!S){if(_=await Gi({root:f,flagShop:y}),!_)return;A=A||_.oxygenDeploymentToken,i?(ie=et(_.environments||[],i).branch,ie===null&&(Pe=!0)):s&&(ie=ht(_.environments||[],s).branch)}if(!A){let O=S?["No deployment token provided. Use the ",{command:"--token"}," flag to provide a token."]:"Could not obtain an Oxygen deployment token, please try again or contact Shopify support.";throw new w(O)}if(!S&&!n&&!i&&!s&&_?.environments)if(_.environments.length>1){let B=to(_.environments).map(({name:Ee,branch:dt,handle:Jo,type:Qo})=>({label:Ve(Ee,Jo,dt),value:Qo==="PREVIEW"?"shopify-preview-environment.":dt}));W=await De({message:"Select an environment to deploy to",choices:B,defaultValue:j})}else $(`Using current checked out branch ${j} as environment tag`);let Pt="https://oxygen.shopifyapps.com";process.env.UNSAFE_SHOPIFY_HYDROGEN_DEPLOYMENT_URL&&(Pt=process.env.UNSAFE_SHOPIFY_HYDROGEN_DEPLOYMENT_URL,V("Using a custom deployment service. Don't do this in production!"));let Ct=j;W==="shopify-preview-environment."&&(Ct=void 0,W=void 0,Pe=!0);let _e="dist/client",z="dist/worker",le=await Je(f),Dt=Ca({appPath:f}),Wo=!r&&!le&&(v||T||Pa(Dt));if(le)_e=v??_e,z=T??z;else{let O=await me(f,I).catch(()=>null),B=xa({root:f,viteOutputDirs:O,assetsDirFlag:v,workerDirFlag:T});_e=B.assetsDir,z=B.workerDir}let Le={assetsDir:_e,bugsnag:!0,deploymentUrl:Pt,defaultEnvironment:n||Pe,deploymentToken:wr(A),environmentTag:ie||W||Ct,generateAuthBypassToken:o,authBypassTokenDuration:t,verificationMaxDuration:180,metadata:{...P?{description:P}:{},...g?{url:g}:{},...k?{user:k}:{},...b?{version:b}:{},...Dt?{hydrogenVersion:Dt}:{}},skipVerification:d,rootPath:f,skipBuild:!1,workerOnly:!1,workerDir:z,overriddenEnvironmentVariables:oe};if(!S&&!Le.defaultEnvironment&&(ie||W)&&!l){let O=ht(_.environments,Le.environmentTag),B=`Creating a deployment against ${Ve(O.name,O.handle,O.branch)}`;if(!await Se({confirmationMessage:"Yes, confirm deploy",cancellationMessage:"No, cancel deploy",message:Y`${B}
131
+
132
+ Continue?`.value}))return}let Tr,Es=new Promise(O=>{Tr=O}),Ir,Ss=new Promise(O=>{Ir=O}),Or,xs=new Promise(O=>{Or=O}),lt=null,$r=null,Rr,zo,Ps=new Promise((O,B)=>{Rr=O,zo=B}),Ar={onDeploymentCompleted:()=>Or(),onVerificationComplete:()=>Ir(),onDeploymentCompletedVerificationError(){lt=new w("Unable to verify the deployment was completed successfully","Please verify the deployment status in the Shopify Admin and retry deploying if necessary.")},onDeploymentFailed:O=>{lt=qi(O.error||O.status)},onUploadFilesStart:()=>Cs(),onUploadFilesComplete:()=>Tr(),onVerificationError:O=>{lt=new w(O.message,"Please verify the deployment status in the Shopify Admin and retry deploying if necessary.")},onUploadFilesError:O=>{lt=new w(O.message,"Check your connection and try again. If the problem persists, try again later or contact support.")}};r||Wo?(p&&(console.log(""),U({headline:"The `--force-client-sourcemap` flag is not supported with a custom build command",body:"Client sourcemaps will not be generated."})),Le.buildCommand=r??ka):Ar.buildFunction=async O=>{try{if($(Y`${L.whiteBright("Building project...")}`.value),le)throw new w(be);await Be({directory:f,assetPath:O,lockfileCheck:u,sourcemap:!0,forceClientSourcemap:p,useCodegen:!1,entry:I})}catch(B){throw $r=B,B}};let Cs=async()=>{$(Y`${L.whiteBright(`Deploying to Oxygen..
133
+ `)}`.value),await X([{title:"Uploading files",task:async()=>await Es},{title:"Verifying deployment has been completed",task:async()=>await xs},{title:"Verifying deployment is routable",task:async()=>await Ss,skip:()=>d}])};return await Hi({config:Le,hooks:Ar,logger:Ea}).then(async O=>{if(!O){zo(qi());return}let B=[];S?m&&B.push(["View the deployment information in",{subdued:Yi}]):(B.push(["Open",{link:{url:O.url}},"in your browser to view your deployment."]),O?.authBypassToken&&B.push(["Use the",{subdued:O.authBypassToken},"token to perform end-to-end tests against the deployment."])),F({body:["Successfully deployed to Oxygen"],nextSteps:B}),S&&m&&await Q(Yi,JSON.stringify(O)),Rr()}).catch(O=>{zo(lt||$r||O)}),Ps}function xa({root:e,viteOutputDirs:t,assetsDirFlag:o,workerDirFlag:r}){let n=t&&ne(e,t.clientOutDir),i=t&&ne(e,t.serverOutDir);return{assetsDir:o??n??"dist/client",workerDir:r??i??"dist/server"}}function Pa(e){return e?.startsWith("0.0.0-preview-")??!1}function Ca({appPath:e}){let{root:t}=ve(e);try{let o=ba(import.meta.url),r=o(o.resolve("@shopify/hydrogen/package.json",{paths:[t]}));return typeof r.version=="string"?r.version:void 0}catch{return}}c();var St=K(ae(),1);c();var te=K(Os(),1);import{createRequire as Da}from"node:module";var br=K(ae(),1);function Qi(e){return[...e.removeDependencies,...e.removeDevDependencies]}var Wi=".hydrogen",xo=class e extends D{static descriptionWithMarkdown="Upgrade Hydrogen project dependencies, preview features, fixes and breaking changes. The command also generates an instruction file for each upgrade.";static description="Upgrade Remix and Hydrogen npm dependencies.";static flags={...h.path,version:br.Flags.string({description:"A target hydrogen version to update to",required:!1,char:"v"}),force:br.Flags.boolean({description:"Ignore warnings and force the upgrade to the target version",env:"SHOPIFY_HYDROGEN_FLAG_FORCE",char:"f"})};async run(){let{flags:t}=await this.parse(e);await Ta({...M(t),appPath:t.path?x(t.path):process.cwd()})}},kt=null;async function Ta({appPath:e,version:t,force:o=!1}){if(t==="next"){let f=process.env.SHOPIFY_UNIT_TEST==="1",y=yt();if(!await Ia()&&!f&&!y)throw new w("--version=next is only available when running from the Hydrogen monorepo","This feature is designed for internal development and testing of unreleased versions")}o||(await $a(e),await Ra(e));let{currentVersion:r,currentDependencies:n}=await Ki({appPath:e});if(t==="next"){let f=n["@shopify/hydrogen"]==="next",y=n["@shopify/mini-oxygen"]==="next";if(f||y)throw new w("Project already uses next versions",'Cannot upgrade to --version=next when @shopify/hydrogen or @shopify/mini-oxygen are already using "next" versions')}if(te.default.prerelease(r))throw new w("The upgrade command cannot be run over a prerelease Hydrogen version");let s=await Xi(),{availableUpgrades:a}=es({releases:s.releases,currentVersion:r,currentDependencies:n});if(!a?.length){F({headline:`You are on the latest Hydrogen version: ${N(r)}`});return}let l=!1,p,d;do p=await Fa({currentVersion:r,targetVersion:t,availableUpgrades:a,currentDependencies:n}),d=ja({availableUpgrades:a,currentVersion:r,currentDependencies:n,selectedRelease:p}),l=o||await _a({cumulativeRelease:d,selectedRelease:p,targetVersion:t});while(!l);let u=Ya({appPath:e,cumulativeRelease:d,currentVersion:r,selectedRelease:p,force:o});await Na({appPath:e,selectedRelease:p,currentDependencies:n,targetVersion:t,cumulativeRemoveDependencies:d.removeDependencies,cumulativeRemoveDevDependencies:d.removeDevDependencies,cumulativeDependencies:d.dependencies,cumulativeDevDependencies:d.devDependencies}),await Ga({appPath:e,selectedRelease:p,targetVersion:t});let m=await u;await Ba({appPath:e,currentVersion:r,instrunctionsFilePath:m,selectedRelease:p})}async function Ia(){try{let e=process.cwd(),t=[e,E(e,"../"),E(e,"../../")];for(let o of t)try{let r=E(o,"templates/skeleton"),n=E(o,"packages/cli"),i=await $t(r),s=await $t(n);if(i&&s)return!0}catch{continue}return!1}catch{return!1}}function Oa(e){let t={...e.dependencies},o={...e.devDependencies??{}};return t["@shopify/hydrogen"]&&(t["@shopify/hydrogen"]="next"),o["@shopify/mini-oxygen"]&&(o["@shopify/mini-oxygen"]="next"),{...e,title:`${e.title} (next versions)`,dependencies:t,devDependencies:o}}function $a(e){return tn(e).catch(()=>{throw new w("The upgrade command can only be run on a git repository","Please run the command inside a git repository or run 'git init' to create one")})}async function Ra(e){if(!await nn(e))throw new w("The upgrade command can only be run on a clean git branch","Please commit your changes or re-run the command on a clean branch")}async function Ki({appPath:e}){let{root:t}=ve(e),o=E(t,"package.json"),r;try{r=JSON.parse(await se(o))}catch{throw new w("Could not find a valid package.json","Please make sure you are running the command in a npm project")}let n={...r?.dependencies,...r?.devDependencies},i=n["@shopify/hydrogen"];if(!i)throw new w("Could not find a valid Hydrogen version in package.json","Please make sure you are running the command in a Hydrogen project");return{currentVersion:i,currentDependencies:n}}async function Xi(){if(kt)return kt;if(process.env.FORCE_CHANGELOG_SOURCE==="local"||Ne&&we&&process.env.FORCE_CHANGELOG_SOURCE!=="remote"){let e=Da(import.meta.url),t=Ne&&we?E(Ko(we),"docs","changelog.json"):E(process.cwd(),"docs","changelog.json");try{let o=e(t);return kt=o,o}catch(o){if(console.warn(`Failed to load local changelog from ${t}:`,o.message),process.env.FORCE_CHANGELOG_SOURCE==="local")throw new w("Failed to load local changelog",`Could not read changelog from ${t}`)}}try{let e=await ue("https://hydrogen.shopify.dev/changelog.json");if(!e.ok)throw new Error("Failed to fetch changelog.json");let t=await e.json();if("releases"in t&&"url"in t)return kt=t,kt}catch{}throw new w("Failed to fetch Hydrogen changelog","Ensure you have internet connection and try again")}function Zi({release:e,currentDependencies:t}){return Object.entries({...e.dependencies,...e.devDependencies??{}}).some(([o,r])=>{if(o==="@shopify/cli")return!1;let n=t?.[o];return n?te.default.gt(N(r),N(n)):!1})}function Aa({currentDependencies:e,currentPinnedVersion:t,release:o}){return te.default.gt(o.version,t)?!0:N(o.version)===t?Zi({release:o,currentDependencies:e}):!1}function es({releases:e,currentVersion:t,currentDependencies:o}){let r=N(t),n="",i=e.filter(a=>Aa({release:a,currentPinnedVersion:r,currentDependencies:o})&&n!==a.version?(n=a.version,!0):!1),s=i.reduce((a,l)=>(a[l.version]||(a[l.version]=l),a),{});return{availableUpgrades:i,uniqueAvailableUpgrades:s}}async function Fa({targetVersion:e,availableUpgrades:t,currentVersion:o,currentDependencies:r}){return(e?e==="next"?Oa(t[0]):t.find(i=>N(i.version)===N(e)):void 0)??Va(o,t)}function ja({availableUpgrades:e,selectedRelease:t,currentVersion:o,currentDependencies:r}){let n=N(o),i={features:[],fixes:[],removeDependencies:[],removeDevDependencies:[],dependencies:{},devDependencies:{}};if(!e?.length)return i;if(t.dependencies?.["@shopify/hydrogen"]==="next")return{...i,features:t.features||[],fixes:t.fixes||[],removeDependencies:t.removeDependencies??[],removeDevDependencies:t.removeDevDependencies??[],dependencies:t.dependencies??{},devDependencies:t.devDependencies??{}};let s=e.filter(b=>te.default.gt(b.version,n)&&te.default.lte(b.version,t.version)?!0:!(N(b.version)===n)||!r?!1:Zi({release:b,currentDependencies:r})),a=s.flatMap(b=>b.features),l=s.flatMap(b=>b.fixes),p=[...s].sort((b,I)=>te.default.compare(b.version,I.version)),d=new Map,u=new Map;p.forEach((b,I)=>{b.removeDependencies?.forEach(T=>{d.set(T,I)}),b.removeDevDependencies?.forEach(T=>{u.set(T,I)})});let m=new Set,f=new Set;for(let b=0;b<p.length;b++){let I=p[b];if(!I)continue;let T=I.dependencies??{},P=I.devDependencies??{};Object.keys(T).forEach(C=>{let S=d.get(C);S!==void 0&&b>=S&&m.add(C)}),Object.keys(P).forEach(C=>{let S=u.get(C);S!==void 0&&b>=S&&f.add(C)})}let y=[...new Set(p.flatMap(b=>b.removeDependencies??[]).filter(b=>!m.has(b)))],v=[...new Set(p.flatMap(b=>b.removeDevDependencies??[]).filter(b=>!f.has(b)))],g={},k={};for(let b of p)Object.assign(g,b.dependencies??{}),Object.assign(k,b.devDependencies??{});return{features:a,fixes:l,removeDependencies:y,removeDevDependencies:v,dependencies:g,devDependencies:k}}function _a({cumulativeRelease:e,selectedRelease:t,targetVersion:o}){let{features:r,fixes:n}=e,i=Qi(e);return(r.length||n.length||i.length)&&U({headline:"Included in this upgrade:",customSections:[r.length&&{title:"Features",body:[{list:{items:r.map(s=>s.title)}}]},n.length&&{title:"Fixes",body:[{list:{items:n.map(s=>s.title)}}]},i.length&&{title:"Removed packages",body:[{list:{items:i}}]}].filter(Boolean)}),o==="next"?!0:Se({message:`Are you sure you want to upgrade to ${t.version}?`,cancellationMessage:"No, choose another version",defaultValue:!0})}function Po([e]){return!!e.includes("@remix-run")}function kr([e]){return!!e.includes("react-router")}function zi(e,t,o){return o==="next"&&(e==="@shopify/hydrogen"||e==="@shopify/mini-oxygen")?"next":N(t)}function Ji({currentDependencies:e,dependency:[t,o],selectedRelease:r,targetVersion:n}){let i=e[t];return Po([t,o])||kr([t,o])||i==="next"&&!(n==="next")?!1:r.dependenciesMeta?.[t]?!r.dependenciesMeta?.[t]?.required?!1:!!(!i||n==="next"&&(t==="@shopify/hydrogen"||t==="@shopify/mini-oxygen")||te.default.lt(N(i),N(o))):!0}function La({selectedRelease:e,currentDependencies:t,targetVersion:o,cumulativeDependencies:r,cumulativeDevDependencies:n}){let i=[],s={...r??{},...e.dependencies},a={...n??{},...e.devDependencies??{}};for(let m of Object.entries(s))Ji({currentDependencies:t,dependency:m,selectedRelease:e,targetVersion:o})&&i.push(`${m[0]}@${zi(m[0],m[1],o)}`);for(let m of Object.entries(a))Ji({currentDependencies:t,dependency:m,selectedRelease:e,targetVersion:o})&&i.push(`${m[0]}@${zi(m[0],m[1],o)}`);let l=Object.entries(t).find(Po),p=Object.entries(s).find(Po);l&&p&&te.default.lt(N(l[1]),N(p[1]))&&i.push(...Ma({currentDependencies:t,selectedRemix:p}));let d=Object.entries(t).find(kr),u=Object.entries(s).find(kr);return u&&(!d||te.default.lt(N(d[1]),N(u[1])))&&i.push(...Ua({currentDependencies:t,selectedReactRouter:u})),i}async function Na({appPath:e,selectedRelease:t,currentDependencies:o,targetVersion:r,cumulativeRemoveDependencies:n,cumulativeRemoveDevDependencies:i,cumulativeDependencies:s,cumulativeDevDependencies:a}){let l=[],p=[...n,...i].filter(u=>u in o);p.length>0&&l.push({title:"Removing deprecated dependencies",task:async()=>{await Ha({directory:e,packageManager:await ye(e),args:p})}});let d=La({selectedRelease:t,currentDependencies:o,targetVersion:r,cumulativeDependencies:s,cumulativeDevDependencies:a});d.length>0&&l.push({title:"Upgrading dependencies",task:async()=>{let u=await ye(e),m=u==="npm"?"install":u==="yarn"||u==="pnpm"?"add":"install",f=u==="npm"||u==="unknown"?["--legacy-peer-deps"]:[];await or(ts(u),[m,...f,...d],{cwd:e})}}),l.length>0&&await X(l,{})}function ts(e){return e==="unknown"?"npm":e}async function Ha({directory:e,packageManager:t,args:o}){if(o.length===0)return;let r=t==="npm"?"uninstall":t==="yarn"||t==="pnpm"||t==="bun"?"remove":"uninstall",n=t==="npm"||t==="unknown"?["--legacy-peer-deps"]:[];await or(ts(t),[r,...n,...o],{cwd:e})}function Ma({currentDependencies:e,selectedRemix:t}){let o=[];for(let[r,n]of Object.entries(e))Po([r,n])&&o.push(`${r}@${N(t[1])}`);return o}function Ua({currentDependencies:e,selectedReactRouter:t}){let o=[],r=N(t[1]),n=["react-router","react-router-dom","@react-router/dev","@react-router/fs-routes"];for(let i of n)o.push(`${i}@${r}`);return o}function N(e){if(e==="next")return"next";if(e.match(/^[\^~]?0\.0\.0-next-([a-f0-9]+)-(\d+)$/))return e.replace(/^[\^~]?/,"");let o=te.default.minVersion(e);if(!o)throw new w(`Invalid version: ${e}`);return o.version}async function Va(e,t){if(!t?.length)throw new w("No upgrade options available");let o=t.map((r,n)=>{let{version:i,title:s}=r,a=n===0?"(latest)":te.default.patch(i)===0?"(major)":N(e)===N(i)?"(outdated)":"";return`${te.default.major(i)}${te.default.minor(i)}`,{label:`${i} ${a} - ${Mn(s,54)}`,value:r}});return De({message:`Available Hydrogen versions (current: ${e})`,choices:o,defaultValue:o[0]?.value})}async function Ba({appPath:e,currentVersion:t,selectedRelease:o,instrunctionsFilePath:r}){let n=[...Object.entries(o.dependencies||{}).map(([f,y])=>`${f}@${y}`),...Object.entries(o.devDependencies||{}).map(([f,y])=>`${f}@${y}`)],i=[];if(typeof r=="string"){let f=`Upgrade instructions created at:
134
+ file://${r}`;i.push(f)}let s=`https://hydrogen.shopify.dev/releases/${o.version}`;i.push(`Release notes:
135
+ ${s}`);let a=N(t),l=N(o.version),p=a===l,d=`${a} \u2192 ${l}`,u=p?`You've upgraded Hydrogen ${l} dependencies`:`You've upgraded from ${d}`,m=await ye(e);return F({headline:u,customSections:[{title:"Updated dependencies",body:[{list:{items:n}}]},{title:"What\u2019s next?",body:[{list:{items:i}}]},{title:"Undo these upgrades?",body:[{list:{items:[`Run \`git restore . && git clean -df && ${m} i\``]}}]}].filter(Boolean)})}async function Ga({appPath:e,selectedRelease:t,targetVersion:o}){let n=(await Yr(E(e,"package.json")))["@shopify/hydrogen"];if(!n)throw new w("Hydrogen version not found in package.json");let i=N(n);i.match(/^0\.0\.0-next-[a-f0-9]+-\d+$/);let s=t.dependencies?.["@shopify/hydrogen"]==="next";if(!(o==="next"&&s)&&i!==t.version)throw new w(`Failed to upgrade to Hydrogen version ${t.version}`,`You are still on version ${i}`)}function vr(e){let{steps:t}=e,o=`### ${e.title} [#${e.id}](${e.pr})
136
+ `,r=t?.map((n,i)=>{let s=e.pr?`[#${e.id}](${e.pr})
137
+ `:"",l=t.length>1?`#### Step: ${i+1}. ${n.title} ${s}
138
+ `:`#### ${n.title.trim()}
139
+ `,p=n.info?`> ${n.info}
140
+ `:"",d=n.code?`${Buffer.from(n.code,"base64")}
141
+ `:"",u=e.docs?`[docs](${e.docs})
142
+ `:"";return`${l}${p}${u}${s}${d}`}).join(`
143
+ `);return`${o}
144
+ ${r}`}async function Ya({appPath:e,cumulativeRelease:t,currentVersion:o,selectedRelease:r,force:n=!1}){let i="",{featuresMd:s,breakingChangesMd:a}=t.features.filter(g=>g.steps).reduce((g,k)=>(k.breaking?g.breakingChangesMd.push(vr(k)):g.featuresMd.push(vr(k)),g),{featuresMd:[],breakingChangesMd:[]}),l=t.fixes.filter(g=>g.steps).map(vr),p=Qi(t);if(!s.length&&!l.length&&!a.length&&!p.length){U({headline:"No upgrade instructions generated",body:"There are no additional upgrade instructions for this version."});return}let d=N(o),u=N(r.version);i=`upgrade-${d}-to-${u}.md`;let m=E(e,Wi),y=`${`# Hydrogen upgrade guide: ${d} to ${u}`}
145
+
146
+ ----
147
+ `;a.length&&(y+=`
148
+ ## Breaking changes
149
+
150
+ ${a.join(`
151
+ `)}
152
+ ----
153
+ `),s.length&&(y+=`
154
+ ## Features
155
+
156
+ ${s.join(`
157
+ `)}
158
+ ----
159
+ `),l.length&&(y+=`
160
+ ${s.length?`----
161
+
162
+ `:""}## Fixes
163
+
164
+ ${l.join(`
165
+ `)}`),p.length&&(y+=l.length?`
166
+
167
+ ----
168
+
169
+ `:`
170
+ `,y+=`## Removed packages
171
+
172
+ The following packages have been removed as part of this upgrade:
173
+
174
+ `,y+=p.map(g=>`- \`${g}\``).join(`
175
+ `),y+=`
176
+ `);let v=E(m,i);try{await $t(m)}catch{await Ot(m)}if(!await J(v))await Xo(v);else{if(n||await Se({message:`A previous upgrade instructions file already exists for this version.
177
+ Do you want to overwrite it?`,defaultValue:!1}))await ge(`${v}.old`);else return;await Xo(v)}return await Q(v,y),`${Wi}/${i}`}async function os({targetPath:e}){try{let t=e?x(e):process.cwd(),{currentVersion:o,currentDependencies:r}=await Ki({appPath:t});if(o.startsWith("workspace:")){U({headline:"Using monorepo @shopify/hydrogen dependency",body:"This project uses the workspace protocol for @shopify/hydrogen, so upgrade notices are skipped during local monorepo development."});return}if(te.default.prerelease(o)||/^[a-z]+$/i.test(o))return;let i=await Xi(),{availableUpgrades:s,uniqueAvailableUpgrades:a}=es({releases:i.releases,currentVersion:o,currentDependencies:r});if(s.length===0||!s[0]?.version)return;let l=N(s[0].version),p=N(o),d=p===l,u=d?i.releases.findIndex(g=>N(g.version)!==p):i.releases.findIndex(g=>N(g.version)===p),m;if(u===-1){let g=i.releases.findIndex(k=>te.default.lte(N(k.version),p));m=g===-1?i.releases:i.releases.slice(0,g)}else m=i.releases.slice(0,u);let f=Object.values([...m].reverse().reduce((g,k)=>(g[k.version]??=`${k.version} - ${k.title}`,g),{})).reverse().slice(0,5),y=Object.keys(a).length>1?`There are ${Object.keys(a).length} new @shopify/hydrogen versions available.`:"There's a new @shopify/hydrogen version available.",v=await q();U({headline:y,body:[`Current: ${o} | Latest: ${l}`+(d?" with updated dependencies":"")],customSections:[...f.length>0?[{title:`The next ${f.length} version(s) include`,body:[{list:{items:[...f,s.length>5?"...more":""].flat().filter(Boolean)}}].filter(Boolean)}]:[],{title:"Next steps",body:[{list:{items:[`Run \`${v} upgrade\` or \`${v} upgrade --version ${m[0]?.version??"<version>"}\``,"Read release notes at https://hydrogen.shopify.dev/releases"]}}]}]})}catch(t){let o=t;G({headline:o.message,body:o.tryMessage??void 0})}}c();c();import qa from"node:net";import Wa from"node:os";var To=class extends Error{constructor(t){super(`${t} is locked`)}},st={old:new Set,young:new Set},za=1e3*15,Co=1024,Do=65535,Et,Ja=()=>{let e=Wa.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let o of Object.values(e))for(let r of o)t.add(r.address);return t},rs=e=>new Promise((t,o)=>{let r=qa.createServer();r.unref(),r.on("error",o),r.listen(e,()=>{let{port:n}=r.address();r.close(()=>{t(n)})})}),ns=async(e,t)=>{if(e.host||e.port===0)return rs(e);for(let o of t)try{await rs({port:e.port,host:o})}catch(r){if(!["EADDRNOTAVAIL","EINVAL"].includes(r.code))throw r}return e.port},Qa=function*(e){e&&(yield*e),yield 0};async function Er(e){let t,o=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let n=e.exclude;if(typeof n[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let i of n){if(typeof i!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(i))throw new TypeError(`Number ${i} in the exclude option is not a safe integer and can't be used`)}o=new Set(n)}Et===void 0&&(Et=setTimeout(()=>{Et=void 0,st.old=st.young,st.young=new Set},za),Et.unref&&Et.unref());let r=Ja();for(let n of Qa(t))try{if(o.has(n))continue;let i=await ns({...e,port:n},r);for(;st.old.has(i)||st.young.has(i);){if(n!==0)throw new To(n);i=await ns({...e,port:n},r)}return st.young.add(i),i}catch(i){if(!["EADDRINUSE","EACCES"].includes(i.code)&&!(i instanceof To))throw i}throw new Error("No available ports found")}function is(e,t){if(!Number.isInteger(e)||!Number.isInteger(t))throw new TypeError("`from` and `to` must be integer numbers");if(e<Co||e>Do)throw new RangeError(`'from' must be between ${Co} and ${Do}`);if(t<Co||t>Do)throw new RangeError(`'to' must be between ${Co} and ${Do}`);if(e>t)throw new RangeError("`to` must be greater than or equal to `from`");return function*(r,n){for(let i=r;i<=n;i++)yield i}(e,t)}function at(e,t=100){return Er({port:is(e,e+t)})}c();var Sr=new Set,xr;function ss({disableDepsOptimizer:e,showSuccessBanner:t,configFile:o,formatOptionsPromise:r}){return async function({optimizableDependency:i,stack:s}){let a=s.split(`
178
+ `)[0]??s,l=s.split(`
179
+ `).filter(d=>!d.includes("virtual:remix")).join(`
180
+ `),p="MiniOxygen encountered an error while running your app's entry point";if(i)if(e||!o){let d=new jt(`${p}:
181
+
182
+ ${L.dim(a)}`,`Try adding '${L.yellow(i)}' to your Vite config in ssr.optimizeDeps.include`);d.stack=l,Ce(d)}else Sr.has(i)||(Sr.add(i),setTimeout(()=>Sr.delete(i),2e3),Xa(i,o,await r,l).then(()=>{setTimeout(()=>{$(`
183
+ Added '${L.yellow(i)}' to your Vite config in ssr.optimizeDeps.include
184
+ `)},200),clearTimeout(xr),xr=setTimeout(t,2e3)}).catch(d=>{clearTimeout(xr),Ce(d)}));else{let d=new jt(p+`:
185
+
186
+ `+L.dim(a));d.stack=l,Ce(d)}}}var Ka={rule:{pattern:"[$$$]",inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"include",stopBy:"end"},inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"optimizeDeps",stopBy:"end"},inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"ssr",stopBy:"end"}}}}}};async function Xa(e,t,o,r){let n=jr(t).replace(/^\.m?/,""),i=await Nt(n);await Oe(t,o,s=>{let l=i.parse(s).root().find(Ka);if(!l)throw new w(`The dependency '${L.yellow(e)}' needs to be optimized by Vite, but couldn't be added to the Vite config.`,`Add the following code manually to your Vite config:
187
+
188
+ `+L.yellow(`ssr: {optimizeDeps: {include: ['${e}']}}`));if(!!l.find({rule:{kind:"string_fragment",regex:`^${e}$`}})){let u=new jt(`A dependency related to '${L.yellow(e)}' might need to be optimized by Vite but couldn't be configured automatically:
189
+
190
+ ${L.dim(r.split(`
191
+ `)[0])}`,"If your app doesn't load, check the following stack trace and try fixing the problem by adding the imported dependency to the `ssr.optimizeDeps.include` array in your Vite config file.");throw u.stack=r,u}let{start:d}=l.range();return s.slice(0,d.index+1)+`'${e}',`+s.slice(d.index+1)})}var Io=class e extends D{static descriptionWithMarkdown=`Runs a Hydrogen storefront in a local runtime that emulates an Oxygen worker for development.
192
+
193
+ If your project is [linked](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-link) to a Hydrogen storefront, then its environment variables will be loaded with the runtime.`;static description="Runs Hydrogen storefront in an Oxygen worker for development.";static flags={...h.path,...h.entry,...he(h.port,{port:{default:void 0,required:!1}}),...h.codegen,"disable-virtual-routes":St.Flags.boolean({description:"Disable rendering fallback routes when a route file doesn't exist.",env:"SHOPIFY_HYDROGEN_FLAG_DISABLE_VIRTUAL_ROUTES",default:!1}),...h.debug,...h.inspectorPort,...h.env,...h.envBranch,...h.envFile,"disable-version-check":St.Flags.boolean({description:"Skip the version check when running `hydrogen dev`",default:!1,required:!1}),...h.customerAccountPush,...h.verbose,host:St.Flags.boolean({description:"Expose the server to the local network",default:!1,required:!1}),"disable-deps-optimizer":St.Flags.boolean({description:"Disable adding dependencies to Vite's `ssr.optimizeDeps.include` automatically",env:"SHOPIFY_HYDROGEN_FLAG_DISABLE_DEPS_OPTIMIZER",default:!1})};async run(){let{flags:t}=await this.parse(e),o=t.path?x(t.path):process.cwd(),r={...M(t),customerAccountPush:t["customer-account-push"],path:o,cliConfig:this.config};if(!await Vt(o))throw new w(be);let{close:i}=await Za(r);Ae(async()=>{await i()})}};async function Za({entry:e,port:t,path:o,host:r,codegen:n=!1,codegenConfigPath:i,disableVirtualRoutes:s,disableDepsOptimizer:a=!1,envBranch:l,env:p,debug:d=!1,disableVersionCheck:u=!1,inspectorPort:m,customerAccountPush:f=!1,envFile:y,cliConfig:v,verbose:g}){process.env.NODE_ENV||(process.env.NODE_ENV="development"),g&&Gt(),Yt()||Xe(),t===0&&(t=await at(ze));let k=o??process.cwd(),b=q(k),I=Bn(k,f,y),T=I.then(({fetchRemote:z,localVariables:le})=>ro({root:k,envBranch:l,envHandle:p,fetchRemote:z,localVariables:le,envFile:y}));d&&!m&&(m=await at(fn));let P=await Ut(k);we&&await ge(E(k,"node_modules/.vite"));let C=Promise.resolve().then(()=>We(k)),S=await P.createServer({root:k,clearScreen:!1,cacheDir:process.env.SHOPIFY_UNIT_TEST?E(k,".vite"):void 0,customLogger:process.env.SHOPIFY_UNIT_TEST?Object.assign(P.createLogger(),{info:z=>Te("info",z),warn:z=>Te("warn",z),error:z=>Te("error",z)}):void 0,server:{port:t??ze,host:r?!0:void 0,fs:we?{allow:[k,we]}:void 0},plugins:[{name:"hydrogen:cli",configResolved(z){cr(z)?.api?.registerPluginOptions({disableVirtualRoutes:s}),wn(z)?.api?.registerPluginOptions({debug:d,entry:e,envPromise:T.then(({allVariables:le})=>le),inspectorPort:m,logRequestLine:Hn,entryPointErrorHandler:ss({disableDepsOptimizer:a,configFile:z.configFile,formatOptionsPromise:C,showSuccessBanner:()=>as({disableVirtualRoutes:s,debug:d,inspectorPort:m,finalHost:Pe,storefrontTitle:_e})})})},configureServer:z=>{f&&z.middlewares.use((le,Dt,Wo)=>{let Le=le.headers.host;Le?.includes(no.ORIGINAL)&&(le.headers.host=Le.replace(no.ORIGINAL,no.REBRANDED)),Wo()})}}]});if(!cr(S.config))throw await S.close(),new w("Hydrogen plugin not found.","Add `hydrogen()` plugin to your Vite config.");let j=(await me(k)).remixConfig,R,_=n?()=>{R?.kill(0),R=po({rootDirectory:k,configFilePath:i,appDirectory:j?.appDirectory})}:void 0;_?.(),we&&ec(S,we,_);let W=t??S.config.server.port??ze,[H,oe]=await Promise.all([I.then(({customerAccountPush:z,storefrontId:le})=>z?Gn(k,v,W,le):void 0),b,S.listen(W)]),ie=new URL(S.resolvedUrls.local[0]??S.resolvedUrls.network[0]),Pe=H?.host||ie.toString()||ie.origin;Dn({rootDirectory:k,host:Pe,cliCommand:oe});let{logInjectedVariables:Pt,allVariables:Ct}=await T;Pt(),console.log(""),S.printUrls(),S.bindCLIShortcuts({print:!0}),console.log(`
194
+ `);let _e=(await I).storefrontTitle;return as({disableVirtualRoutes:s,debug:d,inspectorPort:m,finalHost:Pe,storefrontTitle:_e}),u||os({targetPath:k}),f&&Un(Ct)&&Vn(oe),{getUrl:()=>Pe,async close(){R?.removeAllListeners("close"),R?.kill("SIGINT"),await Promise.allSettled([S.close(),H?.cleanup?.()]),S.watcher.close()}}}function as({disableVirtualRoutes:e,debug:t,inspectorPort:o,finalHost:r,storefrontTitle:n}){let i=[];e||i.push({body:qn(r)}),t&&o&&i.push({body:{warn:Yn(o)}}),F({body:[`View ${n?L.cyan(n):"Hydrogen"} app:`,{link:{url:r}}],customSections:i})}function ec(e,t,o){e.httpServer?.once("listening",()=>{e.watcher.add(t+"hydrogen/dist/vite/plugin.js"),e.watcher.add(t+"mini-oxygen/dist/vite/plugin.js"),e.watcher.add(t+"mini-oxygen/dist/vite/worker-entry.js"),e.watcher.add(t+"hydrogen-codegen/dist/esm/index.js");let r;e.watcher.on("change",async n=>{n.includes(t)&&(n.includes("/packages/hydrogen-codegen/")?o&&(o(),U({headline:"The Hydrogen Codegen source has been modified.",body:"The codegen process has been restarted."})):(await e.restart(!0),clearTimeout(r),r=setTimeout(()=>{console.log(""),U({headline:"The H2O Vite plugins have been modified.",body:"The Vite server has been restarted to reflect the changes."})},100)))})})}c();var Oo=class e extends D{static descriptionWithMarkdown="Lists all environments available on the linked Hydrogen storefront.";static description="List the environments on your linked Hydrogen storefront.";static flags={...h.path};async run(){let{flags:t}=await this.parse(e);await tc(t)}};async function tc({path:e=process.cwd()}){let[{session:t,config:o},r]=await Promise.all([pe(e),q()]),n=await Fe({root:e,session:t,config:o,cliCommand:r});if(!n)return;o.storefront=n;let i=await tt(t,o.storefront.id);if(!i){it({session:t,storefront:o.storefront,cliCommand:r});return}let s=i.environments.findIndex(l=>l.type==="PREVIEW"),a=i.environments.splice(s,1);i.environments.push(a[0]),$(oc({environments:i.environments,storefrontTitle:o.storefront.title}).toString()),i.environments.forEach(({name:l,handle:p,branch:d,type:u,url:m})=>{Z();let f=u==="PRODUCTION"?i.productionUrl:m;$(Y`${Ve(l,p,d)}`.value),f&&$(Y` ${f}`.value)}),Z()}var oc=({environments:e,storefrontTitle:t})=>Tt(e,o=>`Showing ${o.length} environments for the Hydrogen storefront ${t}`,o=>`Showing 1 environment for the Hydrogen storefront ${t}`,()=>`There are no environments for the Hydrogen storefront ${t}`);c();function rc(e){return/[{}@#\s"'\\$`|;&<>()!?*\[\]]/.test(e)||/[\x00-\x1F\x7F]/.test(e)}function nc(e){return rc(e)?/['\r\n]/.test(e)?`"${e.replaceAll("\r","\\r").replaceAll(`
195
+ `,"\\n")}"`:`'${e}'`:e}var $o=class e extends D{static descriptionWithMarkdown="Pulls environment variables from the linked Hydrogen storefront and writes them to an `.env` file.";static description="Populate your .env with variables from your Hydrogen storefront.";static flags={...h.env,...h.envBranch,...h.envFile,...h.path,...h.force};async run(){let{flags:t}=await this.parse(e);await ic({...M(t)})}};async function ic({env:e,envBranch:t,path:o=process.cwd(),envFile:r,force:n}){let[{session:i,config:s},a]=await Promise.all([pe(o),q()]),l=await Fe({root:o,session:i,config:s,cliCommand:a});if(!l)return;if(s.storefront=l,e||t){let v=(await tt(i,s.storefront.id))?.environments||[];e?et(v,e):t&&(e=ht(v,t).handle)}let p=await oo(i,s.storefront.id,e);if(!p){it({session:i,storefront:s.storefront,cliCommand:a});return}if(!p.environmentVariables.length){$("No environment variables found.");return}let d=p.environmentVariables;if(!d.length)return;let u=L.whiteBright(r),m=x(o,r),f={};if(d.forEach(({isSecret:v,key:g,value:k})=>{f[g]=v?'""':nc(k)}),await J(m)&&!n){let v=await se(m),g=mr(v,f);if(v===g){U({body:`No changes to your ${u} file`});return}let k=io(v,g);if(!await Se({confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later",message:Y`We'll make the following changes to your ${u} file:
196
+
197
+ ${fe.linesDiff(k)}
198
+ Continue?`.value}))return;await Q(m,g)}else{let v=mr(null,f);await Q(m,v)}d.some(({isSecret:v})=>v)&&G({body:`${s.storefront.title} contains environment variables marked as secret, so their values weren\u2019t pulled.`}),F({body:["Changes have been made to your",{filePath:u},"file"]})}c();var Pr=K(ae(),1);c();var sc=`#graphql
199
+ mutation PushVariables(
200
+ $storefrontId: ID!,
201
+ $environmentId: ID!,
202
+ $environmentVariablesInput: [HydrogenStorefrontEnvironmentVariableInput!]!,
203
+ ) {
204
+ hydrogenStorefrontEnvironmentVariableBulkReplace(
205
+ storefrontId: $storefrontId,
206
+ environmentId: $environmentId,
207
+ environmentVariablesInput: $environmentVariablesInput,
208
+ ) {
209
+ userErrors {
210
+ code
211
+ message
212
+ }
213
+ }
214
+ }
215
+ `;async function cs(e,t,o,r){let{hydrogenStorefrontEnvironmentVariableBulkReplace:n}=await Qe(sc,e,{storefrontId:t,environmentId:o,environmentVariablesInput:r}),{userErrors:i}=n;return{userErrors:i}}var Ro=class e extends D{static description="Push environment variables from the local .env file to your linked Hydrogen storefront.";static flags={...h.env,...h.envFile,...h.path,force:Pr.Flags.boolean({char:"f",description:"Push environment variable changes without confirmation.",env:"SHOPIFY_HYDROGEN_FLAG_FORCE"}),"dry-run":Pr.Flags.boolean({description:"Preview environment variable changes without pushing them.",env:"SHOPIFY_HYDROGEN_FLAG_DRY_RUN",exclusive:["force"]})};async run(){let{flags:t}=await this.parse(e);await ac({...M(t)})}};async function ac({dryRun:e=!1,env:t,envFile:o,force:r=!1,path:n=process.cwd()}){let i,s=x(n,o),{variables:a}=await eo(s),[{session:l,config:p},d]=await Promise.all([pe(n),q()]),u=await Fe({root:n,session:l,config:p,cliCommand:d});if(!u)return;p.storefront=u;let{environments:m}=await tt(l,p.storefront.id)??{};if(!m)throw new w("Failed to fetch environments");let f=to(m);if(f.length===0)throw new w("No environments found");if(t)i=et(f,t);else{let P=[...f.map(({id:S,name:A,branch:j,handle:R})=>({label:Ve(A,R,j),value:S}))],C=await De({message:"Select an environment to overwrite its environment variables:",choices:P});i=f.find(({id:S})=>S===C)}let{environmentVariables:y=[]}=await oo(l,p.storefront.id,i.handle)??{},g=y.filter(({isSecret:P,readOnly:C})=>!P&&!C).sort((P,C)=>P.key.localeCompare(C.key)).map(({key:P,value:C})=>pr(P,C)).join(`
216
+ `)+`
217
+ `,k=Object.keys(a).sort((P,C)=>P.localeCompare(C)).reduce((P,C)=>{let{isSecret:S,readOnly:A}=y.find(j=>j.key===C)??{};return S||A?P:[...P,pr(C,a[C])]},[]).join(`
218
+ `)+`
219
+ `;if(!i.name)throw new w("Missing environment name");let b=y.reduce((P,{isSecret:C,readOnly:S,key:A})=>{if(!C&&!S)return P;let j=a[A],R=y.find(_=>_.key===A);return j===R?.value?P:[...P,A]},[]);if(b.length&&V(`Variables that are read only or contain secret values cannot be pushed from the CLI: ${b.join(", ")}.
220
+ `),k===g){U({body:"No changes to your environment variables."});return}let I=io(g,k);if(e){U({body:Y`The following changes would be made to your environment variables for ${i.name}:
221
+
222
+ ${fe.linesDiff(I)}
223
+ No changes were pushed because --dry-run was used.`.value});return}if(!r&&!await Se({confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later",message:Y`We'll make the following changes to your environment variables for ${i.name}:
224
+
225
+ ${fe.linesDiff(I)}
226
+ Continue?`.value}))return;if(!i.id)throw new w("Missing environment ID");let{userErrors:T}=await cs(l,p.storefront.id,i.id,Object.entries(a).map(([P,C])=>({key:P,value:C})));if(T.length)throw new w("Failed to upload and save environment variables.",T[0]?.message);F({body:`Environment variables push to ${i.name??"Preview"} was successful.`})}c();c();var ct=K(ae(),1);var xe=class e extends D{static descriptionWithMarkdown="Generates a set of default routes from the starter template.";static description="Generates a standard Shopify route.";static flags={adapter:ct.Flags.string({description:"React Router adapter used in the route. The default is `react-router`.",env:"SHOPIFY_HYDROGEN_FLAG_ADAPTER"}),typescript:ct.Flags.boolean({description:"Generate TypeScript files",env:"SHOPIFY_HYDROGEN_FLAG_TYPESCRIPT"}),"locale-param":ct.Flags.string({description:"The param name in Remix routes for the i18n locale, if any. Example: `locale` becomes ($locale).",env:"SHOPIFY_HYDROGEN_FLAG_ADAPTER"}),...h.force,...h.path};static hidden;static args={routeName:ct.Args.string({name:"routeName",description:`The route to generate. One of ${lr.join()}.`,required:!0,options:lr,env:"SHOPIFY_HYDROGEN_ARG_ROUTE"})};async run(){let{flags:t,args:{routeName:o}}=await this.parse(e),r=t.path?x(t.path):process.cwd();await cc({...t,directory:r,routeName:o,localePrefix:t["locale-param"]})}};async function cc(e){let{routes:t}=await $n({...e,v1RouteConvention:On()}),o=3+t.reduce((n,i)=>Math.max(n,i.destinationRoute.length),0),r=t.filter(({operation:n})=>n!=="skipped").length;F({headline:`${r} of ${t.length} route${t.length>1?"s":""} generated`,body:{list:{items:t.map(({operation:n,destinationRoute:i})=>i.padEnd(o)+L.dim(`[${n}]`))}}})}var Ao=class extends D{static description="Shortcut for `hydrogen generate`. See `hydrogen generate --help` for more information.";static strict=!1;static hidden=!0;async run(){let[t,...o]=this.argv;if(t==="r"||t==="route")return new xe(o,this.config).run();throw new Error(`Invalid command argument "${t}".`)}};c();var Fo=class e extends D{static description="Generates all supported standard shopify routes.";static hidden;static flags=xe.flags;async run(){let{flags:t}=await this.parse(e);await xe.run(["all",...Object.entries(t).map(([o,r])=>r===!0?`--${o}`:`--${o}=${r}`)])}};c();var je=K(ae(),1);c();import{fileURLToPath as lc}from"node:url";var xt={cli:"@shopify/cli",cliHydrogen:"@shopify/cli-hydrogen",createApp:"@shopify/create-hydrogen"};async function ls(){if(Ne&&!process.env.SHOPIFY_UNIT_TEST)return;let{content:e}=await zr(lc(import.meta.url)).catch(()=>({content:void 0})),t=e?.name,o=e?.version;if(!t||!o||!Object.values(xt).some(i=>i===t)||o.includes("next")||o.includes("experimental")||o.includes("snapshot"))return;let r=await qr(t,o);if(!r)return;let n=[{link:{label:"Hydrogen releases",url:"https://github.com/Shopify/hydrogen/releases"}}];return t===xt.cli&&n.push({link:{label:"Global CLI reference",url:"https://shopify.dev/docs/api/shopify-cli/"}}),i=>{i??=Gr(),(i==="unknown"||!i)&&(i=Br()),i==="unknown"&&(i="npm");let s=t===xt.cli?`Please install the latest Shopify CLI version with \`${i==="yarn"?`yarn global add ${xt.cli}`:`${i} install -g ${xt.cli}`}\` and try again.`:`Please use the latest version with \`${i} create @shopify/hydrogen@latest\``;return U({headline:"Upgrade available",body:`Version ${r} of ${t} is now available.
227
+ You are currently running v${o}.
228
+
229
+ `+s,reference:n}),{currentVersion:o,newVersion:r}}}c();c();import{cp as dc}from"node:fs/promises";async function ds(e,t){let o=e.mockShop?"mock":await De({message:"Connect to Shopify",choices:[{label:"Use sample data from mock.shop (You can connect a Shopify account later)",value:"mock"},{label:"Link your Shopify account",value:"link"}],defaultValue:"mock",abortSignal:t.signal}),r=o==="link"?await Fn(t):void 0,n=await Jt({...e,storefrontInfo:r,controller:t});if(!n)return;o==="mock"&&(n.storefrontTitle="Mock.shop");let i=Zt(t,n),s=r&&!r.id&&Sn(r.session,r.title).then(async({storefront:R,jobId:_})=>(_&&await xn(r.session,_),R)).catch(i),a=await ln(),l=dc(a,n.directory,{force:!0,recursive:!0,filter:R=>!/^(app(\/|$)|dist(\/|$)|node_modules(\/|$)|server\.ts$|\.shopify(\/|$))/i.test(ne(a,R))}).then(()=>Wt({rootDirectory:n.directory,appDirectory:E(n.directory,"app"),typescript:!0})).catch(i),p={create:"Creating storefront",setup:`Setting up ${e.quickstart?"Quickstart ":""}project`,install:"Installing dependencies. This could take a few minutes"},d=[{title:p.create,task:async()=>{await s}},{title:p.setup,task:async()=>{await l}}],u=await q(),m=`# The variables added in this file are only available locally in MiniOxygen.
230
+ # Run \`${u} link\` to also inject environment variables from your storefront,
231
+ # or \`${u} env pull\` to populate this file.`;l=l.then(()=>{let R=[Oe(E(n.directory,"package.json"),!1,W=>(W=mc(W),W.replace(/"name": "[^"]+"/,`"name": "${Lr(r?.title??n.name)}"`)))],_;return r?(R.push(bn(n.directory,r),Q(E(n.directory,".env"),m)),r.id?_={id:r.id,title:r.title}:s&&R.push(s.then(W=>{_=W}))):o==="mock"&&R.push(Q(E(n.directory,".env"),m+`
232
+ `+[["SESSION_SECRET","foobar"]].map(([W,H])=>`${W}="${H}"`).join(`
233
+ `)+`
234
+ `)),Promise.all(R).then(()=>{if(_)return kn(n.directory,_)}).catch(i)});let{language:f,transpileProject:y}=await Qt(n.directory,t,e.language);l=l.then(()=>y().catch(i)).then(()=>e.git?Xt(n.directory):void 0);let{setupCss:v,cssStrategy:g}=await jn(n.directory,t,e.styling);g&&(l=l.then(()=>v().catch(i)).then(()=>e.git?Ue(n.directory,"Setup "+ft[g]):void 0));let{packageManager:k,shouldInstallDeps:b,installDeps:I}=await Kt(n.directory,t,e.packageManager,e.installDeps),T={language:f,packageManager:k,cssStrategy:g,depsInstalled:!1,cliCommand:await q("",k)};if(b){let R=l.then(async()=>{try{if(await I(),T.depsInstalled=!0,f==="ts")try{await pt("npx react-router typegen",{cwd:n.directory})}catch{V("Failed to generate React Router types. You may need to run `npx react-router typegen` manually.")}}catch(_){T.depsError=_}});d.push({title:p.install,task:async()=>{await R}})}let{createShortcut:P,showShortcutBanner:C}=await zt(t,T.cliCommand,e.shortcut);P&&(l=l.then(async()=>{await P()&&(T.cliCommand=Me)}),C()),e.quickstart?console.log(`
235
+ `):F({headline:[{userInput:r?.title??n.name},"is ready to build."]});let{i18nStrategy:S,setupI18n:A}=await An(t,T.cliCommand,e.i18n),{setupRoutes:j}=qt(t);return T.i18n=S,l=l.then(async()=>{await A({rootDirectory:n.directory,contextCreate:f==="ts"?"app/lib/context.ts":"app/lib/context.js"}).then(()=>e.git?Ue(n.directory,`Setup markets support using ${S}`):void 0).catch(R=>{T.i18nError=R}),await j(n.directory,f,{i18nStrategy:S,overwriteFileDeps:!1}).then(async R=>{if(T.routes=R,f==="ts"&&T.depsInstalled)try{await pt("npx react-router typegen",{cwd:n.directory})}catch{V("Failed to generate React Router types after route generation. You may need to run `npx react-router typegen` manually.")}if(e.git&&R)return Ue(n.directory,"Generate routes for core functionality")}).catch(R=>{T.routesError=R})}),await X(d),e.git&&await Ue(n.directory,"Lockfile"),await Ze(n,T),{...n,...T}}function mc(e){let t=e.match(/^\s+"@shopify\/hydrogen":\s+"[^"]+",\n/m)?.[0];if(t&&/"0\.0\.0-\w+-/.test(t)){let o=t.replace("hydrogen","cli-hydrogen");e=e.replace(t,o+t)}return e}c();c();async function ms(e,t){let o=sn(e);if(o.isErr())throw new w(o.error.message);let r=await qe("external-templates");await J(r)||await Ot(r);let n=o.value,i=E(r,n.full.replace(/^https?:\/\//,"").replace(/[^\w]+/,"_"));return await J(i)&&await Zo(i,{force:!0}),await en({repoUrl:n.full,destination:i,shallow:!0}),await Zo(E(i,".git"),{force:!0}),{templateDir:i}}var ps="shopify/hydrogen-demo-store";async function us(e,t){let o=e.template==="demo-store"?ps:e.template,r=await Jt({...e,controller:t});if(!r)return;let n=Zt(t,r),i=o.includes("/")?pc(o,t.signal).catch(n):uc(o).catch(n),s=await i;if(t.signal.aborted)return;let a=Promise.resolve().then(async()=>{if(t.signal.aborted)return;let{sourcePath:g}=s;await It(g,r.directory)}).catch(n),l=await J(E(s.sourcePath,"tsconfig.json")),{language:p,transpileProject:d}=l?await Qt(r.directory,t,e.language):{language:"js",transpileProject:()=>Promise.resolve()};a=a.then(()=>d().catch(n)).then(()=>e.git?Xt(r.directory):void 0);let{packageManager:u,shouldInstallDeps:m,installDeps:f}=await Kt(r.directory,t,e.packageManager,e.installDeps),y={language:p,packageManager:u,depsInstalled:!1,cliCommand:await q("",u)},v=[{title:"Downloading template",task:async()=>{await i}},{title:"Setting up project",task:async()=>{await a}}];if(m&&v.push({title:"Installing dependencies. This could take a few minutes",task:async()=>{try{await f(),y.depsInstalled=!0}catch(g){y.depsError=g}}}),!t.signal.aborted)return await X(v),e.git&&await Ue(r.directory,"Lockfile"),await Ze(r,y),U({headline:`Your project will display inventory from ${e.template.endsWith(ps)?"the Hydrogen Demo Store":"Mock.shop"}.`,body:`To connect this project to your Shopify store\u2019s inventory, update \`${r.name}/.env\` with your store ID and Storefront API key.`}),{...r,...y}}async function pc(e,t){let{templateDir:o}=await ms(e,t);return{sourcePath:o}}async function uc(e){throw new w(`Unknown value in \`--template\` flag "${e}".
236
+ Skip the flag or provide the name of a template or a URL to a git repository.`,{list:{title:"Available templates:",items:["skeleton","demo-store"]}})}async function fs(e){let t=new Rt;try{let o=e.template;return o&&o!=="skeleton"?await us({...e,template:o},t):await ds(e,t)}catch(o){throw t.abort(),o}}var fc={f:"force"},jo=class e extends D{static descriptionWithMarkdown="Creates a new Hydrogen storefront.";static description="Creates a new Hydrogen storefront.";static flags={...h.force,path:je.Flags.string({description:"The path to the directory of the new Hydrogen storefront.",env:"SHOPIFY_HYDROGEN_FLAG_PATH"}),language:je.Flags.string({description:"Sets the template language to use. One of `js` or `ts`.",choices:Object.keys(Rn),env:"SHOPIFY_HYDROGEN_FLAG_LANGUAGE"}),template:je.Flags.string({description:"Scaffolds project based on a template: `skeleton` (the default), `demo-store` or a URL to a git repository.",env:"SHOPIFY_HYDROGEN_FLAG_TEMPLATE"}),...h.installDeps,"mock-shop":je.Flags.boolean({description:"Use mock.shop as the data source for the storefront.",env:"SHOPIFY_HYDROGEN_FLAG_MOCK_DATA"}),...h.styling,...h.markets,...h.shortcut,git:je.Flags.boolean({description:"Init Git and create initial commits.",env:"SHOPIFY_HYDROGEN_FLAG_GIT",default:!0,allowNo:!0}),quickstart:je.Flags.boolean({description:"Scaffolds a new Hydrogen project with a set of sensible defaults. Equivalent to `shopify hydrogen init --path hydrogen-quickstart --mock-shop --language js --shortcut --markets none`",env:"SHOPIFY_HYDROGEN_FLAG_QUICKSTART",default:!1}),"package-manager":je.Flags.string({env:"SHOPIFY_HYDROGEN_FLAG_PACKAGE_MANAGER",hidden:!0,options:["npm","yarn","pnpm","unknown"]})};async run(){let{flags:t}=await this.parse(e);await hc(M(t))}};async function hc({markets:e,...t}=hn(process.argv,fc)){if(an(),!t.i18n&&e&&(t.i18n=e),t.i18n&&!ar.includes(t.i18n))throw new w(`Invalid URL structure strategy: ${t.i18n}. Must be one of ${ar.join(", ")}`);if(t.styling&&!nr.includes(t.styling))throw new w(`Invalid styling strategy: ${t.styling}. Must be one of ${nr.join(", ")}`);t.git??=!0,t.quickstart&&(t.i18n??="none",t.installDeps??=!0,t.language??="js",t.mockShop??=!0,t.path??="./hydrogen-quickstart",t.shortcut??=!0,t.styling??="none");let o=await ls();return o&&o(t.packageManager),fs(t)}c();c();var gc=`#graphql
237
+ query ListStorefronts {
238
+ hydrogenStorefronts {
239
+ id
240
+ title
241
+ productionUrl
242
+ currentProductionDeployment {
243
+ id
244
+ createdAt
245
+ commitMessage
246
+ }
247
+ }
248
+ }
249
+ `;async function hs(e){let{hydrogenStorefronts:t}=await Qe(gc,e);return t.map(o=>({...o,parsedId:Ke(o.id)}))}var _o=class e extends D{static descriptionWithMarkdown="Lists all remote Hydrogen storefronts available to link to your local development environment.";static description="Returns a list of Hydrogen storefronts available on a given shop.";static flags={...h.path};async run(){let{flags:t}=await this.parse(e);await yc(t)}};async function yc({path:e=process.cwd()}){let{session:t}=await pe(e),o=await hs(t);o.length>0?(Z(),$(bc({storefronts:o,shop:t.storeFqdn}).toString()),o.forEach(({currentProductionDeployment:r,id:n,productionUrl:i,title:s})=>{Z(),$(Y`${L.whiteBright(s)} ${L.dim(`(id: ${Ke(n)})`)}`.value),i&&$(Y` ${L.whiteBright(i)}`.value),r&&$(Y` ${L.dim(vc(r))}`.value)})):U({headline:"Hydrogen storefronts",body:"There are no Hydrogen storefronts on your Shop.",nextSteps:[`Ensure you are logged in to the correct shop (currently: ${t.storeFqdn})`,`Create a new Hydrogen storefront: Run \`${await q(e)} link\` or visit ${Mi(t)}`]})}var wc=new Intl.DateTimeFormat("default",{year:"numeric",month:"numeric",day:"numeric"});function vc(e){let t="";if(!e)return t;if(t+=wc.format(new Date(e.createdAt)),e.commitMessage){let o=e.commitMessage.split(/\n/)[0];t+=`, ${o}`}return t}var bc=({storefronts:e,shop:t})=>Tt(e,o=>`Showing ${o.length} Hydrogen storefronts for the store ${t}`,o=>`Showing 1 Hydrogen storefront for the store ${t}`);c();var Lo=class e extends D{static descriptionWithMarkdown="Logs in to the specified shop and saves the shop domain to the project.";static description="Login to your Shopify account.";static flags={...h.path,...h.shop};async run(){let{flags:t}=await this.parse(e);await kc(t)}};async function kc({path:e=process.cwd(),shop:t}){Z(),Cn(!0);let{config:o}=await pe(e,t??!0);In(o)}c();var No=class e extends D{static descriptionWithMarkdown="Log out from the current shop.";static description="Logout of your local session.";static flags={...h.path};async run(){let{flags:t}=await this.parse(e);await Ec(t)}};async function Ec({path:e=process.cwd()}){Z(),await Tn(e),F({body:"You are logged out from Shopify."})}c();var Cr=K(ae(),1);c();async function gs(e){let{startWorkerdServer:t}=await import("./workerd-2RFRLQVH.js");return t(e)}var Ho=class e extends D{static descriptionWithMarkdown="Runs a server in your local development environment that serves your Hydrogen app's production build. Requires running the [build](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-build) command first.";static description="Runs a Hydrogen storefront in an Oxygen worker for production.";static flags={...h.path,...h.port,...h.env,...h.envBranch,...h.envFile,...h.inspectorPort,...h.debug,...h.verbose,build:Cr.Flags.boolean({description:"Builds the app before starting the preview server."}),watch:Cr.Flags.boolean({description:"Watches for changes and rebuilds the project.",dependsOn:["build"]}),...he(h.entry,{entry:{dependsOn:["build"]}}),...he(h.codegen,{codegen:{dependsOn:["build"]}})};async run(){let{flags:t}=await this.parse(e),o=t.path?x(t.path):process.cwd(),{close:r}=await Sc({...M(t),directory:o});Ae(async()=>{await r()})}};async function Sc({port:e,directory:t,env:o,envBranch:r,inspectorPort:n,debug:i,verbose:s,build:a=!1,watch:l=!1,codegen:p=!1,codegenConfigPath:d,entry:u,envFile:m}){process.env.NODE_ENV||(process.env.NODE_ENV=l?"development":"production"),s&&Gt(),Yt()||Xe();let{root:f,buildPath:y,buildPathWorkerFile:v,buildPathClient:g}=ve(t),k=await Je(f);if(k)throw new w(be);let b,I=wt(),P=a?await Be({...{directory:f,entry:u,disableRouteWarning:!1,lockfileCheck:!1,sourcemap:!0,bundleStats:!1,useCodegen:p,codegenConfigPath:d},watch:l,async onServerBuildFinish(){I.state==="pending"?I.resolve():$("\u{1F3D7}\uFE0F Project rebuilt. Reloading server..."),await b?.reload()}}):I.resolve();k||(v=(await me(f).catch(()=>null))?.serverOutFile??E(y,"server","index.js"));let{shop:C,storefront:S}=await Bt(f),A=!!C&&!!S?.id,{allVariables:j,logInjectedVariables:R}=await ro({root:f,fetchRemote:A,envBranch:r,envHandle:o,envFile:m});e||(e=await at(ze));let _=await at(e+100);return await I.promise,R(),b=await gs({root:f,appPort:e,assetsPort:_,env:j,buildPathClient:g,buildPathWorkerFile:v,inspectorPort:n,debug:i,watch:l}),b.showBanner({mode:"preview",headlinePrefix:l?"Watching for changes. ":""}),{async close(){await Promise.allSettled([b.close(),P?.close()])}}}c();var Mo=class e extends D{static description="Scaffold routes and core functionality.";static flags={...h.path,...h.force,...h.markets,...h.shortcut,...he(h.installDeps,{"install-deps":{default:!0}})};async run(){let{flags:t}=await this.parse(e),o=t.path?x(t.path):process.cwd();await xc({...M(t),directory:o})}};async function xc(e){let t=new Rt,{rootDirectory:o,appDirectory:r}=await $e(e.directory),n=Ye(o),i=q(),s=Promise.resolve(),a=[{title:"Setting up project",task:async()=>{await s}}],l=e.markets?e.markets:await Mt({abortSignal:t.signal,extraChoices:{none:"Set up later"}}),p=l==="none"?void 0:l,{setupRoutes:d}=qt(t),u,m=await cn(".."),[f,y]=await Promise.all([J(E(o,"tsconfig.json")),mt("*.d.ts",{cwd:m})]);s=s.then(()=>Promise.all([...y.map(b=>It(E(m,b),x(o,b))),Wt({rootDirectory:o,appDirectory:r,typescript:f})])).then(async()=>{u=await d(o,f?"ts":"js",{i18nStrategy:p,overwriteFileDeps:!0})}),p&&(s=s.then(()=>Ht(p,{rootDirectory:o})));let v=await Promise.resolve(i),{createShortcut:g,showShortcutBanner:k}=await zt(t,v,e.shortcut);!p&&!g||(g&&(s=s.then(async()=>{await g()&&(v=Me)}),k()),await X(a),await Ze({location:n,name:n,directory:o},{cliCommand:v,depsInstalled:!0,packageManager:"npm",i18n:p,routes:u}))}c();var ys=K(ae(),1);var Uo=class e extends D{static descriptionWithMarkdown="Adds support for certain CSS strategies to your project.";static description="Setup CSS strategies for your project.";static flags={...h.path,...h.force,...he(h.installDeps,{"install-deps":{default:!0}})};static args={strategy:ys.Args.string({name:"strategy",description:`The CSS strategy to setup. One of ${rr.join()}`,options:rr})};async run(){let{flags:t,args:o}=await this.parse(e),r=t.path?x(t.path):process.cwd();await Pc({...M(t),strategy:o.strategy,directory:r})}};async function Pc({strategy:e,directory:t,force:o=!1,installDeps:r=!0}){let n=await me(t).catch(()=>null);if(!n)throw new w("No Vite config found. This command is only supported in Vite projects.");let{remixConfig:i}=n,s=e||await pn();if(s==="css-modules"||s==="postcss"){F({headline:`Vite works out of the box with ${ft[s]}.`,body:`See the Vite documentation for more information:
250
+ ${ir[s]}`});return}let a=await mn(s,i,o);if(!a)return;let{workPromise:l,generatedAssets:p,needsInstallDeps:d}=a,u=[{title:"Updating files",task:async()=>{await l}}],m=!1;if(r&&d){let f=ye(i.rootDirectory);u.push({title:"Installing new dependencies",task:async()=>{let y=await f;m=y==="npm"||y==="unknown",await At({directory:i.rootDirectory,packageManager:y,args:[]})}})}await X(u),F({headline:`${ft[s]} setup complete.`,body:(p.length>0?`You can now modify CSS configuration in the following files:
251
+ `+p.map(f=>` - ${f}`).join(`
252
+ `)+`
253
+ `:"")+`
254
+ For more information, visit ${ir[s]}`}),d&&m&&s==="tailwind"&&G({body:[`Due to a bug in NPM, you might need to reinstall dependencies again.
255
+ Run`,{command:"npm install"}]})}c();var ws=K(ae(),1);var Vo=class e extends D{static descriptionWithMarkdown="Adds support for multiple [markets](https://shopify.dev/docs/custom-storefronts/hydrogen/markets) to your project by using the URL structure.";static description="Setup support for multiple markets in your project.";static flags={...h.path};static args={strategy:ws.Args.string({name:"strategy",description:`The URL structure strategy to setup multiple markets. One of ${sr.join()}`,options:sr})};async run(){let{flags:t,args:o}=await this.parse(e),r=t.path?x(t.path):process.cwd();await Cc({...M(t),strategy:o.strategy,directory:r})}};async function Cc({strategy:e,directory:t}){let o=$e(t),r=e||await Mt(),n=await o;await X([{title:"Updating files",task:async()=>{await Ht(r,n)}}]),F({headline:`Markets support setup complete with strategy ${un[r].toLowerCase()}.`,body:`You can now modify the supported locales in ${n.serverEntryPoint??"your server entry file."}
256
+ `})}c();var Bo=class e extends D{static description="EXPERIMENTAL: Upgrades the project to use Vite.";static flags={...h.path};async run(){let{flags:t}=await this.parse(e),o=t.path?x(t.path):process.cwd();await Tc({...M(t),directory:o})}},Dc=`export default {
257
+ plugins: {
258
+ tailwindcss: {},
259
+ autoprefixer: {},
260
+ },
261
+ };
262
+ `;async function Tc({directory:e}){if(Z(),await yn(e))throw new w("This project already has a Vite config file.");let[t,o,r]=await Promise.all([gn(e),Wr(E(e,"package.json")),We(e)]),n=t.server||"server.js",i=n.endsWith(".ts"),s=i?"tsx":"jsx",a=await qe("vite"),l=!!t.tailwind,p=x(e,"postcss.config.js"),d=()=>{},u=Promise.all([ge(x(e,"remix.config.js")).catch(d),tr(x(e,"remix.env.d.ts"),x(e,"env.d.ts")).then(()=>Oe(x(e,"env.d.ts"),!1,m=>m.replace('types="@remix-run/dev"','types="vite/client"'))).catch(d),tr(x(e,".eslintrc.js"),x(e,".eslintrc.cjs")).catch(d),se(x(e,"postcss.config.js")).then(async m=>{let f=m.includes("tailwindcss"),v=m.includes("module.exports")||m.includes("exports.")||m.includes("require(")?p.replace(".js",".cjs"):p;return!f&&l&&(m=await ut(m.replace(/(plugins:\s+{)/,`$1
263
+ tailwindcss: {},`),r,v)),Q(v,m)}).catch(async()=>{if(l&&!await J(p)&&!await J(p.replace(".js",".cjs")))return Q(p,Dc)}).catch(d),dn(a,e,{onResult(m){return m.dependencies&&delete m.dependencies["@remix-run/css-bundle"],m.devDependencies&&m.devDependencies["@vanilla-extract/css"]&&(m.devDependencies["@vanilla-extract/vite-plugin"]="^4.0.0",m.devDependencies=Object.keys(m.devDependencies).sort().reduce((f,y)=>(f[y]=m.devDependencies?.[y],f),{})),m}}),se(x(a,"vite.config.js")).then(async m=>{o.devDependencies?.["@vanilla-extract/css"]&&(m=m.replace(/\n\n/g,`
264
+ import {vanillaExtractPlugin} from '@vanilla-extract/vite-plugin';
265
+
266
+ `).replace(/^(\s+)\],/m,`$1 vanillaExtractPlugin(),
267
+ $1],`));let{future:y,appDirectory:v,ignoredRouteFiles:g,routes:k}=t;for(let I of["v3_fetcherPersist","v3_throwAbortReason","v3_relativeSplatPath"])y?.[I]||(m=m.replace(`${I}: true`,`${I}: false`));v&&v!=="app"&&(m=m.replace(/^(\s+)(future:)/m,`$1appDirectory: '${v}',
268
+ $1$2`)),g&&(m=m.replace(/^(\s+)(future:)/m,`$1ignoredRouteFiles: ${JSON.stringify(g)},
269
+ $1$2`)),k&&(m=m.replace(/^(\s+)(future:)/m,`$1routes: ${k.toString()},
270
+ $1$2`));let b=x(e,"vite.config."+s.slice(0,2));return m=await ut(m,r,b),Q(b,m)}),Oe(x(e,n),!1,m=>(i?`// @ts-ignore
271
+ `:"")+m.replace("@remix-run/dev/server-build","virtual:remix/server-build")),Nt(s).then(async m=>{let f=x(e,t.appDirectory??"app"),y=E(f,"root."+s);await new Promise(async(v,g)=>{await m.findInFiles({paths:[y,E(f,"routes")],matcher:{rule:{kind:"string_fragment",regex:"\\.css$",inside:{kind:"import_statement",stopBy:"end"}}}},async(b,I)=>{b&&g(b);let T={};I.forEach(P=>{if(P.text().endsWith(".module.css"))return;let C=P.getRoot().filename(),S=P.getRoot().root().text(),A=P.range().end.index,j=T[C]||{content:S,positions:[]};j.positions.push(A),T[C]=j}),await Promise.all(Object.entries(T).flatMap(([P,{content:C,positions:S}])=>{S.reverse();for(let A of S)C=C.slice(0,A)+"?url"+C.slice(A);return Q(P,C)})),v(null)})===0&&v(null)}),await Oe(y,r,v=>{let g=m.parse(v).root(),k="LiveReload",b={kind:"identifier",regex:k},I=g.find({rule:{kind:"import_specifier",regex:k,inside:{kind:"import_statement",stopBy:"end"}}}),T=g.findAll({rule:{any:[{kind:"jsx_self_closing_element",has:b},{kind:"jsx_element",has:{kind:"jsx_opening_element",has:b}}]}});for(let P of[...T.reverse(),I]){if(!P)continue;let{start:C,end:S}=P.range();v=v.slice(0,C.index)+v.slice(S.index)}return v.replace(/,\s*,/g,",").replace(/import\s+{\s+cssBundleHref\s+}\s+from\s+['"]@remix-run\/css-bundle['"];?\n/,"").replace(/\.\.\.\(\s*cssBundleHref[^)]+\),?/,"")})})]);await X([{title:"Updating files",task:async()=>{await u}},{title:"Installing new dependencies",task:async()=>{await At({directory:e,packageManager:await ye(e),args:[]})}}]),F({headline:"Your Vite project is ready!",body:`We've modified your project to use Vite.
272
+ Please use Git to review the changes.`,nextSteps:[t.mdx?"Setup MDX support in Vite: https://remix.run/docs/en/main/future/vite#add-mdx-plugin":"","See more information about Vite in Remix at https://remix.run/docs/en/main/future/vite"].filter(Boolean)})}c();var Go=class extends D{static descriptionWithMarkdown="Creates a global h2 shortcut for Shopify CLI using shell aliases.\n\n The following shells are supported:\n\n - Bash (using `~/.bashrc`)\n - ZSH (using `~/.zshrc`)\n - Fish (using `~/.config/fish/functions`)\n - PowerShell (added to `$PROFILE`)\n\n After the alias is created, you can call Shopify CLI from anywhere in your project using `h2 <command>`.";static description=`Creates a global \`${Me}\` shortcut for the Hydrogen CLI`;async run(){await Ic()}};async function Ic(){let e=await Pn();e.length>0?F({headline:`Shortcut ready for the following shells: ${e.join(", ")}.
273
+ Restart your terminal session and run \`${Me}\` from your local project.`}):Ce({name:"error",type:0,message:"No supported shell found.",skipOclifErrorHandling:!0,tryMessage:"Please create a shortcut manually."})}c();var Yo=class e extends D{static descriptionWithMarkdown="Unlinks your local development environment from a remote Hydrogen storefront.";static description="Unlink a local project from a Hydrogen storefront.";static flags={...h.path};async run(){let{flags:t}=await this.parse(e);await Oc(t)}};async function Oc({path:e}){let t=e??process.cwd(),{storefront:o}=await Bt(t);if(!o){V("This project isn't linked to a Hydrogen storefront.");return}let r=o.title;await En(t),F({body:["You are no longer linked to",{bold:r}]})}c();import{spawnSync as Rc}from"node:child_process";c();import{createRequire as vs}from"node:module";function bs({id:e,projectPath:t}){return!e||!Dr(t)||!$c(t,e)?!1:(Z(),Jr({headline:`\`shopify ${e.replace(/:/g," ")}\` is not supported by this version of Hydrogen`,body:"The installed version of @shopify/hydrogen disables this command.",nextSteps:["Use your framework or package tooling instead."]}),!0)}function $c(e,t){try{let n=vs(E(e,"package.json"))("@shopify/hydrogen/package.json")?.shopify?.cli?.disabledCommands;return Array.isArray(n)&&n.includes(t)}catch{return!1}}function Dr(e){try{let o=vs(import.meta.url)(E(e,"package.json"));return[o?.dependencies,o?.devDependencies,o?.peerDependencies].some(r=>!!r?.["@shopify/hydrogen"])}catch{return!1}}var Ac=async function(e){if(!e.id?.startsWith("hydrogen:")||e.id==="hydrogen:init")return;let t=_r(),o=/^--path($|=)/,r=e.argv.findIndex(n=>o.test(n));if(r!==-1){let n=e.argv[r]?.split("=")[1]??e.argv[r+1];n&&!n.startsWith("--")&&(t=x(t,n))}if(Dr(t)||(Z(),G({headline:"Looks like you're trying to run a Hydrogen command outside of a Hydrogen project.",body:["Run",{command:"shopify hydrogen init"},"to create a new Hydrogen project or use the",{command:"--path"},`flag to specify an existing Hydrogen project.
274
+
275
+ `,{subdued:t}],reference:["Getting started: https://shopify.dev/docs/storefronts/headless/hydrogen","CLI commands: https://shopify.dev/docs/api/shopify-cli/hydrogen"]}),process.exit(1)),bs({id:e.id,projectPath:t})&&process.exit(1),Fc(e.id,e.argv)&&!process.execArgv.includes(qo)&&!(process.env.NODE_OPTIONS??"").includes(qo)){Kr(`Restarting CLI process with ${qo} flag.`);let[n,...i]=process.argv;i.unshift(qo);let s=Rc(n,i,{stdio:"inherit"});process.exit(s.status??1)}},qo="--experimental-vm-modules";function Fc(e="",t=[]){return e==="hydrogen:debug:cpu"}var ks=Ac;var Wv={"hydrogen:dev":Io,"hydrogen:build":fo,"hydrogen:check":ho,"hydrogen:codegen":yo,"hydrogen:deploy":So,"hydrogen:g":Ao,"hydrogen:init":jo,"hydrogen:link":_n,"hydrogen:list":_o,"hydrogen:login":Lo,"hydrogen:logout":No,"hydrogen:preview":Ho,"hydrogen:setup":Mo,"hydrogen:shortcut":Go,"hydrogen:unlink":Yo,"hydrogen:upgrade":xo,"hydrogen:customer-account-push":Nn,"hydrogen:debug:cpu":wo,"hydrogen:env:list":Oo,"hydrogen:env:pull":$o,"hydrogen:env:push":Ro,"hydrogen:generate:route":xe,"hydrogen:generate:routes":Fo,"hydrogen:setup:css":Uo,"hydrogen:setup:markets":Vo,"hydrogen:setup:vite":Bo},zv={init:ks};export{Wv as a,zv as b};
@@ -1 +1 @@
1
- import{Bb as h,Jb as g,Qb as f,ib as E}from"./chunk-COFGQT76.js";import{b as O}from"./chunk-JA2QZ635.js";import{e as m}from"./chunk-3VYOLEQE.js";import{e as P,g as o}from"./chunk-VKWPEFWQ.js";o();o();o();var R=new Set(["THROTTLED","429"]),b=new Set(["ACCESS_DENIED","access_denied"]);function I(e){return Array.isArray(e)?e.flatMap(t=>{let s=[],n=t,r=n?.extensions?.code;typeof r=="string"&&s.push(r);let u=n?.extensions?.app_errors?.errors;if(Array.isArray(u))for(let p of u){let l=p?.category;typeof l=="string"&&s.push(l)}return s}):[]}function T(e){return e!==void 0&&R.has(e)}function _(e){return e!==void 0&&b.has(e)}function S(e){return I(e).some(T)}o();var C=new Set([502,503,504]);function x(e){return e!==void 0&&C.has(e)}var M=P(O(),1),i;(function(e){e[e.Abort=0]="Abort",e[e.AbortSilent=1]="AbortSilent",e[e.Bug=2]="Bug"})(i||(i={}));var y=class extends Error{},a=class extends Error{tryMessage;type;nextSteps;formattedMessage;customSections;code;details;skipOclifErrorHandling;constructor(t,s,n=null,r,u){let p=typeof t=="string"||"value"in t;super(p?f(t):E(t)),n?n instanceof h?this.tryMessage=f(n):this.tryMessage=n:this.tryMessage=null,this.type=s,this.nextSteps=r,this.customSections=u,this.skipOclifErrorHandling=!0,p||(this.formattedMessage=t)}},d=class extends a{constructor(t,s=null,n,r){super(t,i.Abort,s,n,r)}},w=class extends a{command;args;constructor(t,s,n,r=null){super(t,i.Abort,r),this.command=s,this.args=n}},A=class extends a{constructor(){super("",i.AbortSilent)}},c=class extends a{constructor(t,s=null){super(t,i.Bug,s)}};async function z(e){let t;if(k(e))t=e;else if(typeof e=="string")t=new c(e);else if(e instanceof Error)t=new c(e.message),t.stack=e.stack;else{let r=e;t=new c(r?.message??"Unknown error"),r?.stack&&(t.stack=r?.stack)}let{jsonOutputEnabled:s}=await import("./environment-ZUTBXY7U.js");if(s()){let{renderFatalErrorAsJson:r}=await import("./json-error-UR2OILQ6.js");return r(t),await g(),e}let{renderFatalError:n}=await import("./ui-SYB4LLWY.js");return n(t),Promise.resolve(e)}function J(e){if(e instanceof M.Errors.CLIError){let t=new d(e.message);return t.stack=e.stack,Promise.resolve(t)}else return Promise.resolve(e)}function k(e){try{return Object.prototype.hasOwnProperty.call(e,"type")}catch{return!1}}function Q(e){if(!k(e)){if(e instanceof Error){if(v(e))return!1;let t=e.message;return!L(t)}return!0}return e.type===i.Bug}function v(e){let t=e;if(typeof t.response!="object"||t.response===null||t.request===void 0)return!1;let s=t.response.status;return s===401||s===429||x(s)?!0:S(t.response.errors)}function W(e){return m(e).replace("file:/","/").replace(/^\/?[A-Z]:/,"")}function L(e){return["EPERM: operation not permitted, scandir","EPERM: operation not permitted, rename","EACCES: permission denied","EPERM: operation not permitted, symlink","This version of npm supports the following node versions","EBUSY: resource busy or locked","ENOTEMPTY: directory not empty","getaddrinfo ENOTFOUND","Client network socket disconnected before secure TLS connection was established","spawn EPERM","socket hang up","The user aborted a request.","write EPIPE","Unsupported platform"].some(n=>e.includes(n))}export{I as a,T as b,_ as c,S as d,x as e,i as f,y as g,a as h,d as i,w as j,A as k,c as l,z as m,J as n,Q as o,W as p};
1
+ import{Bb as h,Jb as g,Qb as f,ib as E}from"./chunk-UYWRJHAJ.js";import{b as O}from"./chunk-I3J63RFV.js";import{e as m}from"./chunk-3VYOLEQE.js";import{e as P,g as o}from"./chunk-VKWPEFWQ.js";o();o();o();var R=new Set(["THROTTLED","429"]),b=new Set(["ACCESS_DENIED","access_denied"]);function I(e){return Array.isArray(e)?e.flatMap(t=>{let s=[],n=t,r=n?.extensions?.code;typeof r=="string"&&s.push(r);let u=n?.extensions?.app_errors?.errors;if(Array.isArray(u))for(let p of u){let l=p?.category;typeof l=="string"&&s.push(l)}return s}):[]}function T(e){return e!==void 0&&R.has(e)}function _(e){return e!==void 0&&b.has(e)}function S(e){return I(e).some(T)}o();var C=new Set([502,503,504]);function x(e){return e!==void 0&&C.has(e)}var M=P(O(),1),i;(function(e){e[e.Abort=0]="Abort",e[e.AbortSilent=1]="AbortSilent",e[e.Bug=2]="Bug"})(i||(i={}));var y=class extends Error{},a=class extends Error{tryMessage;type;nextSteps;formattedMessage;customSections;code;details;skipOclifErrorHandling;constructor(t,s,n=null,r,u){let p=typeof t=="string"||"value"in t;super(p?f(t):E(t)),n?n instanceof h?this.tryMessage=f(n):this.tryMessage=n:this.tryMessage=null,this.type=s,this.nextSteps=r,this.customSections=u,this.skipOclifErrorHandling=!0,p||(this.formattedMessage=t)}},d=class extends a{constructor(t,s=null,n,r){super(t,i.Abort,s,n,r)}},w=class extends a{command;args;constructor(t,s,n,r=null){super(t,i.Abort,r),this.command=s,this.args=n}},A=class extends a{constructor(){super("",i.AbortSilent)}},c=class extends a{constructor(t,s=null){super(t,i.Bug,s)}};async function z(e){let t;if(k(e))t=e;else if(typeof e=="string")t=new c(e);else if(e instanceof Error)t=new c(e.message),t.stack=e.stack;else{let r=e;t=new c(r?.message??"Unknown error"),r?.stack&&(t.stack=r?.stack)}let{jsonOutputEnabled:s}=await import("./environment-ZUTBXY7U.js");if(s()){let{renderFatalErrorAsJson:r}=await import("./json-error-BVX244JK.js");return r(t),await g(),e}let{renderFatalError:n}=await import("./ui-QOSX5V7Z.js");return n(t),Promise.resolve(e)}function J(e){if(e instanceof M.Errors.CLIError){let t=new d(e.message);return t.stack=e.stack,Promise.resolve(t)}else return Promise.resolve(e)}function k(e){try{return Object.prototype.hasOwnProperty.call(e,"type")}catch{return!1}}function Q(e){if(!k(e)){if(e instanceof Error){if(v(e))return!1;let t=e.message;return!L(t)}return!0}return e.type===i.Bug}function v(e){let t=e;if(typeof t.response!="object"||t.response===null||t.request===void 0)return!1;let s=t.response.status;return s===401||s===429||x(s)?!0:S(t.response.errors)}function W(e){return m(e).replace("file:/","/").replace(/^\/?[A-Z]:/,"")}function L(e){return["EPERM: operation not permitted, scandir","EPERM: operation not permitted, rename","EACCES: permission denied","EPERM: operation not permitted, symlink","This version of npm supports the following node versions","EBUSY: resource busy or locked","ENOTEMPTY: directory not empty","getaddrinfo ENOTFOUND","Client network socket disconnected before secure TLS connection was established","spawn EPERM","socket hang up","The user aborted a request.","write EPIPE","Unsupported platform"].some(n=>e.includes(n))}export{I as a,T as b,_ as c,S as d,x as e,i as f,y as g,a as h,d as i,w as j,A as k,c as l,z as m,J as n,Q as o,W as p};
@@ -1,4 +1,4 @@
1
- import{b as A}from"./chunk-2KBTFKSM.js";import{b as w}from"./chunk-CUZQRXTV.js";import{j as g}from"./chunk-VWYZCCRE.js";import{i as a}from"./chunk-XUJURYN5.js";import{Aa as m,Ib as y,Kb as v,ya as u}from"./chunk-COFGQT76.js";import{b as L}from"./chunk-JA2QZ635.js";import{f as h,i as f}from"./chunk-3VYOLEQE.js";import{e as x,g as s}from"./chunk-VKWPEFWQ.js";s();s();var U="text/markdown",b="X-Shopify-Surface",R="cli",F=["shopify.dev"];async function S(t,e,p){let c;try{c=new URL(t)}catch{throw new a(`Invalid URL: ${t}`)}let{hostname:d}=c;if(!F.some(o=>d===o||d.endsWith(`.${o}`)))throw new a(`Only documents from the following hosts can be fetched: ${F.join(", ")}.`);let i=await g(t,{headers:{Accept:U,[b]:R,...p?{"Accept-Language":p}:{}}});if(!i.ok)throw new a(`Failed to fetch ${t}: ${i.status} ${i.statusText}`);let l=await i.text();if(e){let o=h(e);await m(f(o)),await u(o,l),v(`Saved ${t} to ${o}`);return}y(l)}var n=x(L(),1),r=class t extends w{static description="Download a complete document from shopify.dev. Every page on shopify.dev has a Markdown version, and that is what this tool returns. Use this to pull an entire document verbatim \u2014 for example, a set of instructions an agent follows like a centrally-served skill. Pass `--language` for the language of the app you are building so code examples match your stack. For finding the relevant pieces of content across shopify.dev instead, use `doc search`.";static examples=[`# fetch the Markdown version of a Shopify.dev page
1
+ import{b as A}from"./chunk-EA5LKCRF.js";import{b as w}from"./chunk-4Q5TSWQL.js";import{j as g}from"./chunk-OSGXBBUJ.js";import{i as a}from"./chunk-VDE7IIYQ.js";import{Aa as m,Ib as y,Kb as v,ya as u}from"./chunk-UYWRJHAJ.js";import{b as L}from"./chunk-I3J63RFV.js";import{f as h,i as f}from"./chunk-3VYOLEQE.js";import{e as x,g as s}from"./chunk-VKWPEFWQ.js";s();s();var U="text/markdown",b="X-Shopify-Surface",R="cli",F=["shopify.dev"];async function S(t,e,p){let c;try{c=new URL(t)}catch{throw new a(`Invalid URL: ${t}`)}let{hostname:d}=c;if(!F.some(o=>d===o||d.endsWith(`.${o}`)))throw new a(`Only documents from the following hosts can be fetched: ${F.join(", ")}.`);let i=await g(t,{headers:{Accept:U,[b]:R,...p?{"Accept-Language":p}:{}}});if(!i.ok)throw new a(`Failed to fetch ${t}: ${i.status} ${i.statusText}`);let l=await i.text();if(e){let o=h(e);await m(f(o)),await u(o,l),v(`Saved ${t} to ${o}`);return}y(l)}var n=x(L(),1),r=class t extends w{static description="Download a complete document from shopify.dev. Every page on shopify.dev has a Markdown version, and that is what this tool returns. Use this to pull an entire document verbatim \u2014 for example, a set of instructions an agent follows like a centrally-served skill. Pass `--language` for the language of the app you are building so code examples match your stack. For finding the relevant pieces of content across shopify.dev instead, use `doc search`.";static examples=[`# fetch the Markdown version of a Shopify.dev page
2
2
  shopify doc fetch --url https://shopify.dev/docs/api/shopify-cli`,`# filter code examples to the language of the app you are building
3
3
  shopify doc fetch --url https://shopify.dev/docs/api/shopify-cli --language ruby`,`# save the document to a file instead of printing it
4
4
  shopify doc fetch --url https://shopify.dev/docs/api/shopify-cli --output docs/shopify-cli.md`];static flags={...A,url:n.Flags.string({description:"The shopify.dev URL to fetch.",env:"SHOPIFY_FLAG_URL",required:!0}),language:n.Flags.string({description:"Filter code examples in the returned Markdown to this language. Supply the language of the app you are building so examples match your stack. Optional \u2014 if omitted, or if shopify.dev does not recognize the language for a given page, the document includes examples in every language.",env:"SHOPIFY_FLAG_LANGUAGE",options:["javascript","typescript","python","ruby","php","rust","curl","liquid","graphql","html"]}),output:n.Flags.string({description:"Write the document to this file path instead of printing it to stdout.",env:"SHOPIFY_FLAG_OUTPUT"})};async run(){let{flags:e}=await this.parse(t);await S(e.url,e.output,e.language)}};export{r as a};