shopify 4.2.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (440) hide show
  1. package/dist/{acorn-QBS5IYTX.js → acorn-7M27BPGP.js} +1 -1
  2. package/dist/analytics-DWUYMFHO.js +1 -0
  3. package/dist/analytics-SOXP4UBD.js +1 -0
  4. package/dist/{angular-UTTM4Y4S.js → angular-DW5TQVCM.js} +1 -1
  5. package/dist/assets/hydrogen/routes/locale-check.ts +3 -3
  6. package/dist/assets/hydrogen/starter/CHANGELOG.md +106 -0
  7. package/dist/assets/hydrogen/starter/app/components/Aside.tsx +4 -2
  8. package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +8 -5
  9. package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +117 -23
  10. package/dist/assets/hydrogen/starter/app/components/Header.tsx +3 -3
  11. package/dist/assets/hydrogen/starter/app/components/PaginatedResourceSection.tsx +24 -4
  12. package/dist/assets/hydrogen/starter/app/components/ProductPrice.tsx +1 -1
  13. package/dist/assets/hydrogen/starter/app/lib/context.ts +5 -0
  14. package/dist/assets/hydrogen/starter/app/routes/[robots.txt].tsx +14 -53
  15. package/dist/assets/hydrogen/starter/app/routes/_index.tsx +11 -4
  16. package/dist/assets/hydrogen/starter/app/routes/account.$.tsx +1 -1
  17. package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +2 -2
  18. package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +1 -1
  19. package/dist/assets/hydrogen/starter/package.json +9 -10
  20. package/dist/assets/hydrogen/starter/storefrontapi.generated.d.ts +0 -11
  21. package/dist/assets/hydrogen/starter/vite.config.ts +10 -4
  22. package/dist/assets/hydrogen/vite/package.json +1 -2
  23. package/dist/assets/hydrogen/vite/vite.config.js +4 -3
  24. package/dist/{babel-JS32NLHY.js → babel-I2RLWM7N.js} +1 -1
  25. package/dist/bootstrap.js +1 -1
  26. package/dist/{chokidar-G4ONJSK4.js → chokidar-VDIVGBZH.js} +1 -1
  27. package/dist/chunk-2EROVVCL.js +1 -0
  28. package/dist/{chunk-DCBYHVKW.js → chunk-2MMGFZDP.js} +1 -1
  29. package/dist/{chunk-X2TC7S57.js → chunk-2NWWMNU5.js} +8 -8
  30. package/dist/{chunk-PRVQAHWI.js → chunk-2O22LZKV.js} +1 -1
  31. package/dist/{chunk-MFLBTJO7.js → chunk-3CYHS4W2.js} +1 -1
  32. package/dist/{chunk-2EJCY4CE.js → chunk-3FBSBMSQ.js} +1 -1
  33. package/dist/chunk-3OZ6ZZ4T.js +5 -0
  34. package/dist/{chunk-VICNWPLQ.js → chunk-442S5SDM.js} +12 -12
  35. package/dist/{chunk-MKE434RB.js → chunk-45MEVWH5.js} +1 -1
  36. package/dist/{chunk-A5SQCM63.js → chunk-47MGPVED.js} +1 -1
  37. package/dist/chunk-4N6YTHFD.js +1 -0
  38. package/dist/chunk-4TST2MNC.js +1 -0
  39. package/dist/{chunk-JUVAGMIH.js → chunk-5C7HDTHJ.js} +1 -1
  40. package/dist/{chunk-GVITHCQJ.js → chunk-5GVXMNC4.js} +1 -1
  41. package/dist/{chunk-YGMVL6NZ.js → chunk-5JNEWYD5.js} +2 -2
  42. package/dist/{chunk-KU5OPV7U.js → chunk-5QQN3SKH.js} +1 -1
  43. package/dist/{chunk-OKNBZSGN.js → chunk-5QWYIBE6.js} +1 -1
  44. package/dist/chunk-5W443CKL.js +836 -0
  45. package/dist/{chunk-PD5ZHJWI.js → chunk-636CTEW7.js} +1 -1
  46. package/dist/{chunk-L2VSSINY.js → chunk-67KMRBSZ.js} +1 -1
  47. package/dist/{chunk-HJSYHK4S.js → chunk-6DIHOMCB.js} +1 -1
  48. package/dist/{chunk-MGL4YM3S.js → chunk-6EZ7JWBK.js} +5 -5
  49. package/dist/{chunk-NBYS6YQ2.js → chunk-6RL7FUPD.js} +1 -1
  50. package/dist/chunk-6YPEONHB.js +46 -0
  51. package/dist/{chunk-C6ABJCRG.js → chunk-733R5OKQ.js} +1 -1
  52. package/dist/chunk-73W5BGAZ.js +1 -0
  53. package/dist/{chunk-XDAOLCPN.js → chunk-75LJTY7F.js} +1 -1
  54. package/dist/{chunk-IU2ZQ6TE.js → chunk-773TIA5M.js} +1 -1
  55. package/dist/{chunk-TQGTEVSR.js → chunk-7EJ4UVYI.js} +1 -1
  56. package/dist/{chunk-FQDRVPCY.js → chunk-7LATYPLU.js} +1 -1
  57. package/dist/{chunk-XXE7667M.js → chunk-7SVMAJTR.js} +1 -1
  58. package/dist/{chunk-QUTQDXSL.js → chunk-7UNQOKZW.js} +1 -1
  59. package/dist/{chunk-CE6FKJFS.js → chunk-7UOPCYMV.js} +1 -1
  60. package/dist/{chunk-7JESXDF2.js → chunk-A4SBXDZB.js} +1 -1
  61. package/dist/{chunk-Z35BTAM6.js → chunk-AAK376RT.js} +1 -1
  62. package/dist/chunk-APN3VWN4.js +3 -0
  63. package/dist/{chunk-7DVOSOEP.js → chunk-AT2GDXN7.js} +1 -1
  64. package/dist/chunk-ATXODH6C.js +283 -0
  65. package/dist/chunk-AY4GIVME.js +4 -0
  66. package/dist/{chunk-PS25FEBF.js → chunk-B7BUEEBR.js} +1 -1
  67. package/dist/{chunk-6YHJ554P.js → chunk-B7S23DLF.js} +1 -1
  68. package/dist/chunk-BCD4KTLJ.js +1 -0
  69. package/dist/{chunk-C3LZPAAH.js → chunk-BIMOHK2P.js} +1 -1
  70. package/dist/chunk-C3CVLSLS.js +6 -0
  71. package/dist/{chunk-57N2DFIF.js → chunk-CD5O2BIT.js} +1 -1
  72. package/dist/chunk-CPE7XCC6.js +593 -0
  73. package/dist/{chunk-PIBY5DDZ.js → chunk-CRALWNNO.js} +1 -1
  74. package/dist/{chunk-H4W4DFKK.js → chunk-CX5CC6P5.js} +1 -1
  75. package/dist/{chunk-2KH2S7PI.js → chunk-CZXGQ53M.js} +1 -1
  76. package/dist/chunk-D6YDSGR4.js +3 -0
  77. package/dist/{chunk-J6VTZEE2.js → chunk-DHBYYHBT.js} +1 -1
  78. package/dist/chunk-DLNBTHKL.js +5 -0
  79. package/dist/chunk-DO2SHYFU.js +1 -0
  80. package/dist/{chunk-VPL2NDH6.js → chunk-DONEJHDG.js} +35 -35
  81. package/dist/{chunk-5TIJLYZU.js → chunk-DQ4HA72R.js} +1 -1
  82. package/dist/{chunk-NO5KVFTV.js → chunk-DZLA2RJP.js} +3 -3
  83. package/dist/{chunk-YS6VOQ7I.js → chunk-EJDWYASP.js} +1 -1
  84. package/dist/{chunk-N3YWHJMB.js → chunk-EKHWL542.js} +46 -46
  85. package/dist/{chunk-6M3ZYNGO.js → chunk-ET2CGROE.js} +1 -1
  86. package/dist/{chunk-QSTEVZFQ.js → chunk-F3TMLDLC.js} +1 -1
  87. package/dist/{chunk-M4LOKANA.js → chunk-F5QG42MA.js} +1 -1
  88. package/dist/{chunk-FTN7Y6HD.js → chunk-FA4K3JRN.js} +1 -1
  89. package/dist/{chunk-WDC3KIZT.js → chunk-FKIVKNOV.js} +1 -1
  90. package/dist/{chunk-4EXYYBQ6.js → chunk-FPLUMESQ.js} +1 -1
  91. package/dist/chunk-FU232KQ7.js +1 -0
  92. package/dist/{chunk-HLMFVORT.js → chunk-FZKKKGUJ.js} +1 -1
  93. package/dist/chunk-G24L7MB3.js +1 -0
  94. package/dist/{chunk-LQMSF3F7.js → chunk-G2I2ZUBV.js} +1 -1
  95. package/dist/{chunk-FFYYJKF7.js → chunk-G2S346IS.js} +1 -1
  96. package/dist/{chunk-KLMDWDT2.js → chunk-GB3YC4TI.js} +1 -1
  97. package/dist/{chunk-VA5IUGZV.js → chunk-GBZL4TTY.js} +1 -1
  98. package/dist/{chunk-OCOY5MV2.js → chunk-GCN4O7HM.js} +1 -1
  99. package/dist/{chunk-2N4O33VM.js → chunk-GDHD3TGC.js} +1 -1
  100. package/dist/{chunk-TLSAQ6FG.js → chunk-GFCLUGAG.js} +1 -1
  101. package/dist/{chunk-C2FFA4O4.js → chunk-GKRCTMWY.js} +1 -1
  102. package/dist/{chunk-TGACBJIY.js → chunk-GTUKM3ZW.js} +1 -1
  103. package/dist/{chunk-RGNAWKD7.js → chunk-GUO7S4NW.js} +1 -1
  104. package/dist/{chunk-WUK5NQSX.js → chunk-GW3VY3FZ.js} +2 -2
  105. package/dist/{chunk-4KRT35A2.js → chunk-H5C3QTOO.js} +1 -1
  106. package/dist/{chunk-LKS47US7.js → chunk-H6WN7GP4.js} +1 -1
  107. package/dist/{chunk-2WNODIWJ.js → chunk-HA6NISOZ.js} +1 -1
  108. package/dist/{chunk-FBVBO5YQ.js → chunk-HCN6HXA5.js} +1 -1
  109. package/dist/chunk-HM5H7WBE.js +1 -0
  110. package/dist/chunk-HZMP62GK.js +21 -0
  111. package/dist/{chunk-QLQGHMVU.js → chunk-HZSAUZBX.js} +1 -1
  112. package/dist/chunk-HZYRCG4R.js +9 -0
  113. package/dist/{chunk-EENHXSWU.js → chunk-I5A6BPCP.js} +1 -1
  114. package/dist/chunk-I73E3BD5.js +1 -0
  115. package/dist/{chunk-UURFVUAH.js → chunk-IG6LPVS4.js} +1 -1
  116. package/dist/{chunk-BECEP46I.js → chunk-IIOIDMG3.js} +1 -1
  117. package/dist/{chunk-D656BV5Z.js → chunk-IPQH2RHD.js} +1 -1
  118. package/dist/{chunk-TNQXTZAX.js → chunk-IWOTLFOY.js} +1 -1
  119. package/dist/chunk-IX4KP6E3.js +2 -0
  120. package/dist/{chunk-AP3RFOPL.js → chunk-J2WCMQZZ.js} +1 -1
  121. package/dist/chunk-J3HXFQ2L.js +1 -0
  122. package/dist/{chunk-OYP7DKPU.js → chunk-J3JPJCWP.js} +1 -1
  123. package/dist/chunk-J5TNYNR5.js +1 -0
  124. package/dist/{chunk-UBKVCI7A.js → chunk-J7UQBC45.js} +1 -1
  125. package/dist/{chunk-M2TJICTB.js → chunk-JAW32T6G.js} +1 -1
  126. package/dist/{chunk-LCCMXY6N.js → chunk-JOZXRV5K.js} +1 -1
  127. package/dist/{chunk-UARVYVLN.js → chunk-KKUDXLK2.js} +2 -2
  128. package/dist/{chunk-LITB5QQX.js → chunk-KN3FTJDU.js} +1 -1
  129. package/dist/{chunk-3VZEETAV.js → chunk-KRZABRYT.js} +1 -1
  130. package/dist/{chunk-DNLOSMHL.js → chunk-KSZ5K6LJ.js} +1 -1
  131. package/dist/chunk-LCPD2BYX.js +1 -0
  132. package/dist/chunk-LKZ7ARYS.js +18 -0
  133. package/dist/{chunk-3V63X7WZ.js → chunk-LOHUNOQ7.js} +1 -1
  134. package/dist/{chunk-IXUVSFW2.js → chunk-LOQIRLTD.js} +1 -1
  135. package/dist/{chunk-CW7WJZKR.js → chunk-MFLQRQQT.js} +1 -1
  136. package/dist/{chunk-PRKBO42R.js → chunk-MPW2YJWU.js} +1 -1
  137. package/dist/chunk-MQICT2LR.js +1 -0
  138. package/dist/{chunk-VYXVYOIJ.js → chunk-MZMYBFZQ.js} +1 -1
  139. package/dist/{chunk-ZZYFG22L.js → chunk-NADNFSKS.js} +1 -1
  140. package/dist/{chunk-5Y7GIF2W.js → chunk-NJOO5XJV.js} +1 -1
  141. package/dist/{chunk-ULQG3XQS.js → chunk-NNOSZ447.js} +1 -1
  142. package/dist/{chunk-WNGV4JQS.js → chunk-NWDP5IZ2.js} +1 -1
  143. package/dist/{chunk-R6JNXEB3.js → chunk-NY5OGHM5.js} +1 -1
  144. package/dist/chunk-O6KTFMCD.js +1 -0
  145. package/dist/{chunk-3BRUCKZ2.js → chunk-OAI7VSLW.js} +1 -1
  146. package/dist/{chunk-RAH5NW3R.js → chunk-OORCODNK.js} +1 -1
  147. package/dist/chunk-OQORDQLH.js +1 -0
  148. package/dist/{chunk-75VPUOC5.js → chunk-P2OI2P2M.js} +1 -1
  149. package/dist/{chunk-6AJZKIZ3.js → chunk-PETINPMX.js} +1 -1
  150. package/dist/{chunk-MZJRNFAU.js → chunk-PJYNAUQB.js} +1 -1
  151. package/dist/{chunk-HD5TYIDZ.js → chunk-PMXCJIBP.js} +1 -1
  152. package/dist/{chunk-K77WAKOB.js → chunk-POAICASX.js} +1 -1
  153. package/dist/chunk-PUAMSBXS.js +1 -0
  154. package/dist/{chunk-DERA4K6A.js → chunk-PZYP3MCL.js} +1 -1
  155. package/dist/chunk-Q7BOSHWX.js +7 -0
  156. package/dist/{chunk-K7K6GNF6.js → chunk-QJ7TI6CK.js} +1 -1
  157. package/dist/{chunk-M4V2OQAX.js → chunk-QMXKGSFH.js} +1 -1
  158. package/dist/chunk-QPN2M26G.js +1 -0
  159. package/dist/{chunk-UCLSPAVX.js → chunk-QS3FMN67.js} +1 -1
  160. package/dist/chunk-RF6NUGCU.js +1 -0
  161. package/dist/{chunk-5CH3B62S.js → chunk-RJ5VF3QY.js} +1 -1
  162. package/dist/{chunk-XX343DDG.js → chunk-RYGZCBO4.js} +1 -1
  163. package/dist/{chunk-U3ZG675O.js → chunk-SKLUHLS2.js} +1 -1
  164. package/dist/{chunk-F6T3UBBL.js → chunk-SP2WUATO.js} +1 -1
  165. package/dist/{chunk-QFWIDATO.js → chunk-STJ3LWFL.js} +1 -1
  166. package/dist/chunk-SWI3LCPE.js +7 -0
  167. package/dist/{chunk-6HZTMQD6.js → chunk-SXTDVUT3.js} +1 -1
  168. package/dist/{chunk-IWCPQD7X.js → chunk-T5GSCWN5.js} +1 -1
  169. package/dist/{chunk-3YWUSKWF.js → chunk-T6CC5WUU.js} +1 -1
  170. package/dist/{chunk-3TNEIDOD.js → chunk-T7KHS6RF.js} +1 -1
  171. package/dist/{chunk-E2YBU6D3.js → chunk-TC3JOEMA.js} +2 -2
  172. package/dist/{chunk-A6X2IVGT.js → chunk-TJGUNVRI.js} +1 -1
  173. package/dist/{chunk-6ZIOYXEF.js → chunk-TKG42KLM.js} +1 -1
  174. package/dist/{chunk-QYR5VPQA.js → chunk-TOLPNBZK.js} +1 -1
  175. package/dist/{chunk-6TORWTD7.js → chunk-TQUSREKP.js} +1 -1
  176. package/dist/chunk-TU47HMTL.js +1 -0
  177. package/dist/chunk-TYMYIUIQ.js +1 -0
  178. package/dist/{chunk-XP6IRAZN.js → chunk-U73TPLFE.js} +1 -1
  179. package/dist/{chunk-VEDZUOVI.js → chunk-UKK5P74A.js} +3 -3
  180. package/dist/chunk-UMT7DWR4.js +1 -0
  181. package/dist/{chunk-FD5S2O6M.js → chunk-UOHNRH6E.js} +1 -1
  182. package/dist/{chunk-ZR76GGZ6.js → chunk-UQWFDL3F.js} +1 -1
  183. package/dist/chunk-UUC5YKAS.js +2 -0
  184. package/dist/chunk-UYK6CXAU.js +1 -0
  185. package/dist/{chunk-7KJ5TBWG.js → chunk-V3RZ3DTW.js} +1 -1
  186. package/dist/{chunk-6TEXPRI2.js → chunk-V6ZSIUO3.js} +1 -1
  187. package/dist/{chunk-A3VYI4LO.js → chunk-VDN6MEYI.js} +3 -3
  188. package/dist/chunk-VE35YELD.js +1 -0
  189. package/dist/{chunk-6LK6ZP3Q.js → chunk-VFWWZMOQ.js} +1 -1
  190. package/dist/{chunk-VBUZWRUL.js → chunk-VJEKDBGZ.js} +1 -1
  191. package/dist/chunk-VKWPEFWQ.js +1 -0
  192. package/dist/{chunk-7BFDUVOG.js → chunk-VOJWKGCW.js} +1 -1
  193. package/dist/{chunk-LTWXTDDR.js → chunk-VQW35HIQ.js} +1 -1
  194. package/dist/chunk-VUMUCNI7.js +1 -0
  195. package/dist/{chunk-2VLMN5QZ.js → chunk-WAGAC3YI.js} +1 -1
  196. package/dist/chunk-WKBVT5WG.js +1 -0
  197. package/dist/chunk-WLO5H255.js +3 -0
  198. package/dist/chunk-WNWQSHEC.js +10 -0
  199. package/dist/{chunk-6YAXFS6V.js → chunk-WRRUFK4Y.js} +1 -1
  200. package/dist/{chunk-SSM346XI.js → chunk-WVHB2HCQ.js} +1 -1
  201. package/dist/{chunk-MOA33ZFO.js → chunk-WW7TENNA.js} +1 -1
  202. package/dist/chunk-WZVQHMGI.js +1 -0
  203. package/dist/{chunk-NPM3MFB3.js → chunk-X4DIJTIK.js} +1 -1
  204. package/dist/{chunk-42RMKTCJ.js → chunk-XH6ZP7M5.js} +1 -1
  205. package/dist/{chunk-23AMFHXC.js → chunk-XV3I45NA.js} +1 -1
  206. package/dist/{chunk-PSQFZAF3.js → chunk-XWPPBOGF.js} +1 -1
  207. package/dist/{chunk-MIO2CV3Q.js → chunk-Y3WIZSRU.js} +1 -1
  208. package/dist/{chunk-INFBVFMU.js → chunk-Y66GQ6V2.js} +1 -1
  209. package/dist/{chunk-IVGWFPMA.js → chunk-YGKQCEVG.js} +1 -1
  210. package/dist/{chunk-4Z2WYNTE.js → chunk-YLGSM42I.js} +1 -1
  211. package/dist/{chunk-TXUTT6UA.js → chunk-YQH2JHFA.js} +1 -1
  212. package/dist/{chunk-QTGMS62F.js → chunk-YYL356OX.js} +1 -1
  213. package/dist/chunk-Z4LC3WE5.js +7 -0
  214. package/dist/{chunk-OA4P6AKS.js → chunk-Z74QYLNC.js} +1 -1
  215. package/dist/{chunk-DCK2FX6J.js → chunk-ZAMDXIVC.js} +1 -1
  216. package/dist/{chunk-4LNCYIS3.js → chunk-ZDF5N422.js} +1 -1
  217. package/dist/{chunk-RL5BWZ7D.js → chunk-ZEENHLSC.js} +2 -2
  218. package/dist/{chunk-T4M5CWAO.js → chunk-ZG7BVVT2.js} +1 -1
  219. package/dist/{chunk-NKQBEFPS.js → chunk-ZI7LK3LW.js} +1 -1
  220. package/dist/{chunk-UOQQNAHX.js → chunk-ZIREP3EZ.js} +1 -1
  221. package/dist/chunk-ZIXWWU2N.js +275 -0
  222. package/dist/{chunk-NXL6LDJU.js → chunk-ZQ5JVD5X.js} +1 -1
  223. package/dist/{chunk-FGVC22EY.js → chunk-ZULTG2D2.js} +1 -1
  224. package/dist/{chunk-F47MFBKM.js → chunk-ZZFZBFVM.js} +1 -1
  225. package/dist/cli/commands/app/app-logs/sources.js +1 -1
  226. package/dist/cli/commands/app/build.js +1 -1
  227. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  228. package/dist/cli/commands/app/bulk/execute.js +1 -1
  229. package/dist/cli/commands/app/bulk/status.js +1 -1
  230. package/dist/cli/commands/app/config/link.js +1 -1
  231. package/dist/cli/commands/app/config/pull.js +1 -1
  232. package/dist/cli/commands/app/config/use.js +1 -1
  233. package/dist/cli/commands/app/config/validate.js +1 -1
  234. package/dist/cli/commands/app/demo/watcher.js +1 -1
  235. package/dist/cli/commands/app/deploy.js +1 -1
  236. package/dist/cli/commands/app/dev/clean.js +1 -1
  237. package/dist/cli/commands/app/dev.js +1 -1
  238. package/dist/cli/commands/app/env/pull.js +1 -1
  239. package/dist/cli/commands/app/env/show.js +1 -1
  240. package/dist/cli/commands/app/execute.js +1 -1
  241. package/dist/cli/commands/app/function/build.js +1 -1
  242. package/dist/cli/commands/app/function/info.js +1 -1
  243. package/dist/cli/commands/app/function/replay.js +1 -1
  244. package/dist/cli/commands/app/function/run.js +1 -1
  245. package/dist/cli/commands/app/function/schema.js +1 -1
  246. package/dist/cli/commands/app/function/typegen.js +1 -1
  247. package/dist/cli/commands/app/generate/extension.js +1 -1
  248. package/dist/cli/commands/app/graphiql.js +1 -0
  249. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  250. package/dist/cli/commands/app/import-extensions.js +1 -1
  251. package/dist/cli/commands/app/info.js +1 -1
  252. package/dist/cli/commands/app/init.js +1 -1
  253. package/dist/cli/commands/app/logs.js +1 -1
  254. package/dist/cli/commands/app/release.js +1 -1
  255. package/dist/cli/commands/app/versions/list.js +1 -1
  256. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  257. package/dist/cli/commands/auth/login.js +1 -1
  258. package/dist/cli/commands/auth/logout.js +1 -1
  259. package/dist/cli/commands/cache/clear.js +1 -1
  260. package/dist/cli/commands/config/autoupgrade/constants.js +1 -1
  261. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  262. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  263. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  264. package/dist/cli/commands/debug/command-flags.js +1 -1
  265. package/dist/cli/commands/doc/fetch.d.ts +12 -0
  266. package/dist/cli/commands/doc/fetch.js +1 -0
  267. package/dist/cli/commands/doc/search.d.ts +13 -0
  268. package/dist/cli/commands/doc/search.js +1 -0
  269. package/dist/cli/commands/docs/generate.js +1 -1
  270. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  271. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  272. package/dist/cli/commands/help.js +1 -1
  273. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  274. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  275. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  276. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  277. package/dist/cli/commands/notifications/generate.js +1 -1
  278. package/dist/cli/commands/notifications/list.js +1 -1
  279. package/dist/cli/commands/organization/list.js +1 -1
  280. package/dist/cli/commands/search.d.ts +4 -0
  281. package/dist/cli/commands/search.js +1 -1
  282. package/dist/cli/commands/theme/check.js +1 -1
  283. package/dist/cli/commands/theme/console.js +1 -1
  284. package/dist/cli/commands/theme/delete.js +1 -1
  285. package/dist/cli/commands/theme/dev.js +1 -1
  286. package/dist/cli/commands/theme/duplicate.js +1 -1
  287. package/dist/cli/commands/theme/info.js +1 -1
  288. package/dist/cli/commands/theme/init.js +1 -1
  289. package/dist/cli/commands/theme/language-server.js +1 -1
  290. package/dist/cli/commands/theme/list.js +1 -1
  291. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  292. package/dist/cli/commands/theme/open.js +1 -1
  293. package/dist/cli/commands/theme/package.js +1 -1
  294. package/dist/cli/commands/theme/preview.js +1 -1
  295. package/dist/cli/commands/theme/profile.js +1 -1
  296. package/dist/cli/commands/theme/publish.js +1 -1
  297. package/dist/cli/commands/theme/pull.js +1 -1
  298. package/dist/cli/commands/theme/push.js +1 -1
  299. package/dist/cli/commands/theme/rename.js +1 -1
  300. package/dist/cli/commands/theme/share.js +1 -1
  301. package/dist/cli/commands/upgrade.js +1 -1
  302. package/dist/cli/commands/version.js +1 -1
  303. package/dist/cli/help.d.ts +38 -0
  304. package/dist/cli/help.js +2 -0
  305. package/dist/cli/services/commands/doc/fetch.d.ts +1 -0
  306. package/dist/cli/services/commands/doc/fetch.js +45 -0
  307. package/dist/cli/services/commands/doc/search.d.ts +1 -0
  308. package/dist/cli/services/commands/doc/search.js +47 -0
  309. package/dist/command-registry.js +1 -1
  310. package/dist/{conf-store-6QNH5BID.js → conf-store-C2LOYIOU.js} +1 -1
  311. package/dist/{custom-oclif-loader-TSPWW5YF.js → custom-oclif-loader-3AICQCNU.js} +1 -1
  312. package/dist/deprecations-QOHE6JG6.js +1 -0
  313. package/dist/{devtools-HCKYP7DQ.js → devtools-37DE4MUR.js} +1 -1
  314. package/dist/{devtools-VEZNCV6W.js → devtools-WAWU5KQL.js} +1 -1
  315. package/dist/dist-FF6C4ZHS.js +1 -0
  316. package/dist/dist-Q676YGVI.js +1 -0
  317. package/dist/environments-EGD263DV.js +1 -0
  318. package/dist/error-66U2HJ37.js +1 -0
  319. package/dist/error-handler-SW2ALZ5Z.js +1 -0
  320. package/dist/{estree-BYYJYS3A.js → estree-JV5M77BA.js} +1 -1
  321. package/dist/{flow-M3Q2HPQT.js → flow-N4JYPYMQ.js} +1 -1
  322. package/dist/{fs-YMUQ6JLE.js → fs-JPQRUGZI.js} +1 -1
  323. package/dist/{glimmer-3DEJJGOJ.js → glimmer-JEV3BXHR.js} +1 -1
  324. package/dist/{graphql-A4HHE3MB.js → graphql-DTF6MHYF.js} +1 -1
  325. package/dist/hooks/app-init.js +1 -1
  326. package/dist/hooks/did-you-mean.js +1 -1
  327. package/dist/hooks/hydrogen-init.js +1 -1
  328. package/dist/hooks/plugin-plugins.js +1 -1
  329. package/dist/hooks/postrun.js +1 -1
  330. package/dist/hooks/prerun.js +1 -1
  331. package/dist/hooks/public-metadata.js +1 -1
  332. package/dist/hooks/sensitive-metadata.js +1 -1
  333. package/dist/hooks/tunnel-provider.js +1 -1
  334. package/dist/hooks/tunnel-start.js +1 -1
  335. package/dist/{html-HETICZ2F.js → html-LVOJ3RQS.js} +1 -1
  336. package/dist/{http-proxy-node16-Q5DZMBHC.js → http-proxy-node16-X2WAMUT5.js} +1 -1
  337. package/dist/index.js +41 -7
  338. package/dist/is-global-QWTDUPNR.js +1 -0
  339. package/dist/{is-wsl-TN2CXYI7.js → is-wsl-UEMXYJPN.js} +1 -1
  340. package/dist/{latest-version-6OAYLOBL.js → latest-version-32HXMWJ7.js} +1 -1
  341. package/dist/lib-NOROGV6N.js +1 -0
  342. package/dist/lib-O5EZ4NVT.js +1 -0
  343. package/dist/lib-QJDPPAWN.js +1 -0
  344. package/dist/lib-UCG2DNMS.js +1 -0
  345. package/dist/{local-GPDAXHE6.js → local-FRYN3NWL.js} +1 -1
  346. package/dist/local-storage-DFH3LT5G.js +1 -0
  347. package/dist/{markdown-5TVCXM53.js → markdown-J6CE6POI.js} +1 -1
  348. package/dist/{meriyah-23OZNYWC.js → meriyah-PNQQZQYI.js} +1 -1
  349. package/dist/metadata-KZVLHQII.js +1 -0
  350. package/dist/{morph-I35VYPBH.js → morph-CG6HEMCQ.js} +4 -4
  351. package/dist/{multipart-parser-Q4QJZK3V.js → multipart-parser-5NSSTW27.js} +1 -1
  352. package/dist/{node-package-manager-GO4ZRTKQ.js → node-package-manager-LVFBY4LY.js} +1 -1
  353. package/dist/notifications-system-DP443VTE.js +1 -0
  354. package/dist/{npa-VNALV7XY.js → npa-A4YSCQ5Q.js} +1 -1
  355. package/dist/{open-VA7TLUIL.js → open-KLSGXBIW.js} +1 -1
  356. package/dist/out-CDCY25QC.js +1 -0
  357. package/dist/{output-7IYOMPSA.js → output-NH4I5Y3C.js} +1 -1
  358. package/dist/{path-CWUNINMX.js → path-MBXP7ZIC.js} +1 -1
  359. package/dist/{postcss-IIK6CGAW.js → postcss-Q36SHOML.js} +1 -1
  360. package/dist/{prettier-ZSBNNQTK.js → prettier-6ZMB2MMO.js} +1 -1
  361. package/dist/{source-map-3K6Y2OMO.js → source-map-E7FCCJL7.js} +1 -1
  362. package/dist/system-GNOF6HMI.js +1 -0
  363. package/dist/tsconfig.tsbuildinfo +1 -1
  364. package/dist/typescript-5R4Y7PXE.js +1 -0
  365. package/dist/{typescript-YKZ232QT.js → typescript-WYPDGPSV.js} +1 -1
  366. package/dist/ui-QOGKADWB.js +1 -0
  367. package/dist/upgrade-K4S6JW64.js +1 -0
  368. package/dist/version-FJFTTOZU.js +1 -0
  369. package/dist/version-ZI4GZX72.js +1 -0
  370. package/dist/{workerd-ST6XJKUN.js → workerd-U6WWWY73.js} +1 -1
  371. package/dist/{yaml-SJKIH3VD.js → yaml-6KWCJ64X.js} +1 -1
  372. package/oclif.manifest.json +964 -74
  373. package/package.json +19 -9
  374. package/dist/analytics-CX22YIUZ.js +0 -1
  375. package/dist/analytics-UBWQIQYF.js +0 -1
  376. package/dist/assets/hydrogen/starter/app/routes/api.$version.[graphql.json].tsx +0 -14
  377. package/dist/chunk-2YXKZWYW.js +0 -1
  378. package/dist/chunk-4V4DQ6W7.js +0 -836
  379. package/dist/chunk-4ZGSSQC6.js +0 -1
  380. package/dist/chunk-6SXOUZ7V.js +0 -1
  381. package/dist/chunk-ATPFTRCC.js +0 -1
  382. package/dist/chunk-AWQ5AR2K.js +0 -5
  383. package/dist/chunk-BHWEA4V2.js +0 -1
  384. package/dist/chunk-BPVZ7E63.js +0 -1
  385. package/dist/chunk-CCEA5CUX.js +0 -1
  386. package/dist/chunk-D3DDLLNF.js +0 -2
  387. package/dist/chunk-FP2NOZSD.js +0 -1
  388. package/dist/chunk-FSTCEWXX.js +0 -1
  389. package/dist/chunk-HHXHOQQP.js +0 -3
  390. package/dist/chunk-HSYRYSX4.js +0 -3
  391. package/dist/chunk-HZA6IAA4.js +0 -1
  392. package/dist/chunk-I3LX25MB.js +0 -1
  393. package/dist/chunk-IOQQUHST.js +0 -18
  394. package/dist/chunk-IWE4RUI7.js +0 -1
  395. package/dist/chunk-K3PGC6DC.js +0 -1
  396. package/dist/chunk-KFCGMT67.js +0 -1
  397. package/dist/chunk-KLA7AWG6.js +0 -7
  398. package/dist/chunk-KQU6HOJ3.js +0 -1
  399. package/dist/chunk-MA52QGHP.js +0 -1
  400. package/dist/chunk-N5ROZKPZ.js +0 -1
  401. package/dist/chunk-NEZEHBT2.js +0 -1
  402. package/dist/chunk-NP4UFPAX.js +0 -9
  403. package/dist/chunk-OKOYLEA7.js +0 -278
  404. package/dist/chunk-OLOBQ42K.js +0 -1
  405. package/dist/chunk-PBTXPBI6.js +0 -18
  406. package/dist/chunk-PLQFX5ZP.js +0 -9
  407. package/dist/chunk-PUTZFF2Z.js +0 -613
  408. package/dist/chunk-RVMB5LC2.js +0 -1
  409. package/dist/chunk-T5MK7ZSF.js +0 -1
  410. package/dist/chunk-UOQ75BL3.js +0 -1
  411. package/dist/chunk-UWJ73J4B.js +0 -1
  412. package/dist/chunk-VPRTJUIN.js +0 -1
  413. package/dist/chunk-VT77EFRL.js +0 -10
  414. package/dist/chunk-WCWNI3ZV.js +0 -283
  415. package/dist/chunk-X4CV6TRE.js +0 -1
  416. package/dist/chunk-XEFQQPL4.js +0 -1
  417. package/dist/chunk-XFKCDWXB.js +0 -5
  418. package/dist/chunk-YJB7P2HC.js +0 -1
  419. package/dist/chunk-YOZNRLFC.js +0 -1
  420. package/dist/deprecations-F6JWVV2W.js +0 -1
  421. package/dist/dist-4BD6KOLR.js +0 -1
  422. package/dist/dist-AUABCVPI.js +0 -1
  423. package/dist/environments-RGLI75HN.js +0 -1
  424. package/dist/error-OZALZZ3U.js +0 -1
  425. package/dist/error-handler-V7LSEXHM.js +0 -1
  426. package/dist/is-global-BLIZ57HQ.js +0 -1
  427. package/dist/lib-AK5EOIKR.js +0 -1
  428. package/dist/lib-LVUMLZ4H.js +0 -1
  429. package/dist/lib-ME6554NA.js +0 -1
  430. package/dist/lib-WU3FEA6I.js +0 -1
  431. package/dist/local-storage-P66KJG6I.js +0 -1
  432. package/dist/metadata-TRH25EHU.js +0 -1
  433. package/dist/notifications-system-HM6JZ6WJ.js +0 -1
  434. package/dist/out-WLY6KV4B.js +0 -1
  435. package/dist/system-X5C4EQQH.js +0 -1
  436. package/dist/typescript-K5CWIA4V.js +0 -1
  437. package/dist/ui-H62CMRLG.js +0 -1
  438. package/dist/upgrade-EEOPH464.js +0 -1
  439. package/dist/version-76NBQR4K.js +0 -1
  440. package/dist/version-IGSEISUA.js +0 -1
@@ -0,0 +1,275 @@
1
+ import{$ as ei,A as Vn,Aa as ui,B as k,Ba as fi,C as U,Ca as mi,D as Gn,E as we,F as Zt,G as qe,H as rt,I as xe,Ia as To,J as qn,Ja as pi,K as Ne,Ka as mr,L as Pe,La as ze,M as Wn,Ma as at,N as er,Na as Pt,O as he,Oa as pr,P as Do,Pa as lt,Q as Yn,Qa as hr,R as ot,Ra as gi,S as nt,Sa as yi,T as zn,Ta as wi,U as tr,Ua as gr,V as Jn,Va as vi,W as Qn,Wa as bi,X as Kn,Xa as ki,Y as Xn,Z as Zn,_ as We,a as pe,aa as W,b as Et,ba as it,c as Fn,ca as ti,d as Ie,da as ri,e as Se,ea as rr,f as Ge,fa as or,g as jn,ga as oi,h as Nn,ha as ge,i as Ln,ia as ni,j as ko,ja as ii,k as et,ka as Co,l as St,la as si,m as je,ma as ai,n as Mn,na as li,o as Qt,oa as nr,p as Eo,pa as ir,q as xt,qa as sr,r as So,ra as ci,s as Hn,sa as ar,t as Un,ta as lr,u as xo,ua as di,v as Bn,va as cr,w as Po,wa as dr,x as Kt,xa as Ye,y as Xt,ya as st,z as tt,za as ur}from"./chunk-EKHWL542.js";import{b as hi}from"./chunk-XWPPBOGF.js";import{a as yr}from"./chunk-FKIVKNOV.js";import{a as Cn}from"./chunk-KRZABRYT.js";import{a as Ei}from"./chunk-G2I2ZUBV.js";import{b as Tn,c as In,d as Jt,g as On,i as _n,j as Rn,k as $n}from"./chunk-MZMYBFZQ.js";import{a as ll,b as An,d as cl}from"./chunk-ZULTG2D2.js";import{a as fr,b as Io,c as Oo}from"./chunk-XH6ZP7M5.js";import{c as Dn}from"./chunk-F3TMLDLC.js";import{Aa as il,Ba as Sn,Ca as sl,Da as al,fa as me,m as gn,n as se}from"./chunk-5W443CKL.js";import{B as En,l as wn,m as ke,p as Wt,s as vn,u as bn,x as kn}from"./chunk-GW3VY3FZ.js";import{b as T}from"./chunk-UKK5P74A.js";import{b as hn}from"./chunk-5C7HDTHJ.js";import{A as Te,D as ee,O as bo,a as qt,u as V,v as N,w as q,y as Re,z as $e}from"./chunk-6EZ7JWBK.js";import{d as E,g as Yt}from"./chunk-WKBVT5WG.js";import{$ as un,Bb as yn,Ca as yo,Ea as Vt,Fb as Ee,Ga as mn,Ha as pn,Hb as z,Jb as Ae,Ka as wo,Mb as $,Nb as xn,Oa as vo,Ob as Fe,Pb as Pn,Qb as B,Rb as ae,Ta as G,V as Ut,Wa as kt,ma as de,na as fn,pa as Bt,qa as go,qb as Gt,ua as Q,wa as bt,ya as be}from"./chunk-DONEJHDG.js";import{u as M}from"./chunk-A4SBXDZB.js";import{s as zt}from"./chunk-KKUDXLK2.js";import{d as x,f as D,g as ie,i as ho,j as Ze,k as cn,q as dn}from"./chunk-773TIA5M.js";import{a as ol}from"./chunk-CX5CC6P5.js";import{b as nl}from"./chunk-TOLPNBZK.js";import{a as ve,c as ce,e as K,g as l}from"./chunk-VKWPEFWQ.js";var Bs=ce((Yw,Us)=>{l();Us.exports=Vc;function Vc(e){var t=e._readableState;return t?t.objectMode||typeof e._duplexState=="number"?e.read():e.read(Gc(t)):null}function Gc(e){if(e.buffer.length){var t=e.bufferIndex||0;if(e.buffer.head)return e.buffer.head.data.length;if(e.buffer.length-t>0&&e.buffer[t])return e.buffer[t].length}return e.length}});var Go=ce((Jw,Ws)=>{l();var Wr=An(),Vs=Sn(),qc=Dn(),Wc=Bs(),Gs=Buffer.from&&Buffer.from!==Uint8Array.from?Buffer.from([0]):new Buffer([0]),Vo=function(e,t){e._corked?e.once("uncork",t):t()},Yc=function(e,t){e._autoDestroy&&e.destroy(t)},qs=function(e,t){return function(r){r?Yc(e,r.message==="premature close"?null:r):t&&!e._ended&&e.end()}},zc=function(e,t){if(!e||e._writableState&&e._writableState.finished)return t();if(e._writableState)return e.end(t);e.end(),t()},Jc=function(e){return new Wr.Readable({objectMode:!0,highWaterMark:16}).wrap(e)},X=function(e,t,r){if(!(this instanceof X))return new X(e,t,r);Wr.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||r.autoDestroy!==!1,this._forwardDestroy=!r||r.destroy!==!1,this._forwardEnd=!r||r.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};qc(X,Wr.Duplex);X.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new X(e,t,r)};X.prototype.cork=function(){++this._corked===1&&this.emit("cork")};X.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")};X.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed){e&&e.destroy&&e.destroy();return}if(e===null||e===!1){this.end();return}var t=this,r=Vs(e,{writable:!0,readable:!1},qs(this,this._forwardEnd)),o=function(){var i=t._ondrain;t._ondrain=null,i&&i()},n=function(){t._writable.removeListener("drain",o),r()};this._unwrite&&process.nextTick(o),this._writable=e,this._writable.on("drain",o),this._unwrite=n,this.uncork()};X.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed){e&&e.destroy&&e.destroy();return}if(e===null||e===!1){this.push(null),this.resume();return}var t=this,r=Vs(e,{writable:!1,readable:!0},qs(this)),o=function(){t._forward()},n=function(){t.push(null)},i=function(){t._readable2.removeListener("readable",o),t._readable2.removeListener("end",n),r()};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:Jc(e),this._readable2.on("readable",o),this._readable2.on("end",n),this._unread=i,this._forward()};X.prototype._read=function(){this._drained=!0,this._forward()};X.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var e;this._drained&&(e=Wc(this._readable2))!==null;)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}};X.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0;var t=this;process.nextTick(function(){t._destroy(e)})}};X.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")};X.prototype._write=function(e,t,r){if(this.destroyed)return r();if(this._corked)return Vo(this,this._write.bind(this,e,t,r));if(e===Gs)return this._finish(r);if(!this._writable)return r();this._writable.write(e)===!1?this._ondrain=r:r()};X.prototype._finish=function(e){var t=this;this.emit("preend"),Vo(this,function(){zc(t._forwardEnd&&t._writable,function(){t._writableState.prefinished===!1&&(t._writableState.prefinished=!0),t.emit("prefinish"),Vo(t,e)})})};X.prototype.end=function(e,t,r){return typeof e=="function"?this.end(null,null,e):typeof t=="function"?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this.write(Gs),Wr.Writable.prototype.end.call(this,r))};Ws.exports=X});var zs=ce((Kw,Ys)=>{l();Ys.exports=Kc;var Qc=Object.prototype.hasOwnProperty;function Kc(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)Qc.call(r,o)&&(e[o]=r[o])}return e}});var Wo=ce((Zw,Yr)=>{l();var Js=An().Transform,Qs=ve("util").inherits,Ks=zs();function gt(e){Js.call(this,e),this._destroyed=!1}Qs(gt,Js);gt.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;process.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}};function Xc(e,t,r){r(null,e)}function qo(e){return function(t,r,o){return typeof t=="function"&&(o=r,r=t,t={}),typeof r!="function"&&(r=Xc),typeof o!="function"&&(o=null),e(t,r,o)}}Yr.exports=qo(function(e,t,r){var o=new gt(e);return o._transform=t,r&&(o._flush=r),o});Yr.exports.ctor=qo(function(e,t,r){function o(n){if(!(this instanceof o))return new o(n);this.options=Ks(e,n),gt.call(this,this.options)}return Qs(o,gt),o.prototype._transform=t,r&&(o.prototype._flush=r),o});Yr.exports.obj=qo(function(e,t,r){var o=new gt(Ks({objectMode:!0,highWaterMark:16},e));return o._transform=t,r&&(o._flush=r),o})});var ea=ce((tv,Zs)=>{l();var Zc=Go(),ed=Wo(),td=nl(),rd=function(e){return!Buffer.isBuffer(e)&&typeof e!="string"},Xs=function(e,t){if(typeof e=="number"&&(e={maxBuffer:e}),typeof e=="function")return Xs(null,e);e||(e={});var r=typeof e.maxBuffer=="number"?e.maxBuffer:65535,o=e.strict,n=e.newline!==!1,i=[],s=0,a=Zc.obj(),c=ed.obj({highWaterMark:1},function(f,m,h){if(rd(f))return d(f,null,h);if(Buffer.isBuffer(f)||(f=td(f)),n){var w=Array.prototype.indexOf.call(f,10);if(w>0&&f[w-1]===13&&w--,w>-1)return i.push(f.slice(0,w)),d(Buffer.concat(i),f.slice(w),h)}if(i.push(f),s+=f.length,s<r)return h();if(o)return h(new Error("No newline found"));d(Buffer.concat(i),null,h)}),u=function(){if(o)return a.destroy(new Error("No newline found"));a.cork(),d(Buffer.concat(i),null,function(f){if(f)return a.destroy(f);a.uncork()})},d=function(f,m,h){a.removeListener("preend",u),t(f,function(w,y){if(w)return h(w);a.setWritable(y),a.setReadable(y),f&&y.write(f),m&&y.write(m),m=i=c=null,h()})};return a.on("preend",u),a.setWritable(c),a};Zs.exports=Xs});var oa=ce((ov,ra)=>{l();var od=il(),nd=Sn(),Yo=ve("fs"),Ft=function(){},id=/^v?\.0/.test(process.version),zr=function(e){return typeof e=="function"},sd=function(e){return!id||!Yo?!1:(e instanceof(Yo.ReadStream||Ft)||e instanceof(Yo.WriteStream||Ft))&&zr(e.close)},ad=function(e){return e.setHeader&&zr(e.abort)},ld=function(e,t,r,o){o=od(o);var n=!1;e.on("close",function(){n=!0}),nd(e,{readable:t,writable:r},function(s){if(s)return o(s);n=!0,o()});var i=!1;return function(s){if(!n&&!i){if(i=!0,sd(e))return e.close(Ft);if(ad(e))return e.abort();if(zr(e.destroy))return e.destroy();o(s||new Error("stream was destroyed"))}}},ta=function(e){e()},cd=function(e,t){return e.pipe(t)},dd=function(){var e=Array.prototype.slice.call(arguments),t=zr(e[e.length-1]||Ft)&&e.pop()||Ft;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r,o=e.map(function(n,i){var s=i<e.length-1,a=i>0;return ld(n,s,a,function(c){r||(r=c),c&&o.forEach(ta),!s&&(o.forEach(ta),t(r))})});e.reduce(cd)};ra.exports=dd});var sa=ce((iv,Jr)=>{l();var ud=oa(),fd=Dn(),na=Go(),ia=function(e){return e.length?Array.isArray(e[0])?e[0]:Array.prototype.slice.call(e):[]},zo=function(e){var t=function(){var r=ia(arguments);if(!(this instanceof t))return new t(r);na.call(this,null,null,e),r.length&&this.setPipeline(r)};return fd(t,na),t.prototype.setPipeline=function(){var r=ia(arguments),o=this,n=!1,i=r[0],s=r[r.length-1];s=s.readable?s:null,i=i.writable?i:null;var a=function(){r[0].emit("error",new Error("stream was destroyed"))};if(this.on("close",a),this.on("prefinish",function(){n||o.cork()}),ud(r,function(c){if(o.removeListener("close",a),c)return o.destroy(c.message==="premature close"?null:c);n=!0,o._autoDestroy===!1&&(o._autoDestroy=!0),o.uncork()}),this.destroyed)return a();this.setWritable(i),this.setReadable(s)},t};Jr.exports=zo({autoDestroy:!1,destroy:!1});Jr.exports.obj=zo({autoDestroy:!1,destroy:!1,objectMode:!0,highWaterMark:16});Jr.exports.ctor=zo});var la=ce((av,aa)=>{"use strict";l();aa.exports=function(e){return!e||e.length<3?!1:e[0]===31&&e[1]===139&&e[2]===8}});var da=ce((cv,ca)=>{"use strict";l();ca.exports=function(e){return!e||e.length<2?!1:e[0]===120&&(e[1]===1||e[1]===156||e[1]===218)}});var pa=ce((uv,ma)=>{l();var ua=ve("zlib"),md=ea(),pd=Wo(),fa=sa(),hd=la(),gd=da(),yd=function(e){return hd(e)?1:gd(e)?2:0},Jo=function(e){return e===void 0&&(e=3),md({newline:!1,maxBuffer:10},function(t,r){if(e<0)return r(new Error("Maximum recursion reached"));switch(yd(t)){case 1:r(null,fa(ua.createGunzip(),Jo(e-1)));break;case 2:r(null,fa(ua.createInflate(),Jo(e-1)));break;default:r(null,pd())}})};ma.exports=Jo});var ka=ce((mv,ba)=>{"use strict";l();var ye=ve("fs"),Ke=ve("path"),wd=ye.lchown?"lchown":"chown",vd=ye.lchownSync?"lchownSync":"chownSync",ga=ye.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),ha=(e,t,r)=>{try{return ye[vd](e,t,r)}catch(o){if(o.code!=="ENOENT")throw o}},bd=(e,t,r)=>{try{return ye.chownSync(e,t,r)}catch(o){if(o.code!=="ENOENT")throw o}},kd=ga?(e,t,r,o)=>n=>{!n||n.code!=="EISDIR"?o(n):ye.chown(e,t,r,o)}:(e,t,r,o)=>o,Qo=ga?(e,t,r)=>{try{return ha(e,t,r)}catch(o){if(o.code!=="EISDIR")throw o;bd(e,t,r)}}:(e,t,r)=>ha(e,t,r),Ed=process.version,ya=(e,t,r)=>ye.readdir(e,t,r),Sd=(e,t)=>ye.readdirSync(e,t);/^v4\./.test(Ed)&&(ya=(e,t,r)=>ye.readdir(e,r));var Qr=(e,t,r,o)=>{ye[wd](e,t,r,kd(e,t,r,n=>{o(n&&n.code!=="ENOENT"?n:null)}))},wa=(e,t,r,o,n)=>{if(typeof t=="string")return ye.lstat(Ke.resolve(e,t),(i,s)=>{if(i)return n(i.code!=="ENOENT"?i:null);s.name=t,wa(e,s,r,o,n)});if(t.isDirectory())Ko(Ke.resolve(e,t.name),r,o,i=>{if(i)return n(i);let s=Ke.resolve(e,t.name);Qr(s,r,o,n)});else{let i=Ke.resolve(e,t.name);Qr(i,r,o,n)}},Ko=(e,t,r,o)=>{ya(e,{withFileTypes:!0},(n,i)=>{if(n){if(n.code==="ENOENT")return o();if(n.code!=="ENOTDIR"&&n.code!=="ENOTSUP")return o(n)}if(n||!i.length)return Qr(e,t,r,o);let s=i.length,a=null,c=u=>{if(!a){if(u)return o(a=u);if(--s===0)return Qr(e,t,r,o)}};i.forEach(u=>wa(e,u,t,r,c))})},xd=(e,t,r,o)=>{if(typeof t=="string")try{let n=ye.lstatSync(Ke.resolve(e,t));n.name=t,t=n}catch(n){if(n.code==="ENOENT")return;throw n}t.isDirectory()&&va(Ke.resolve(e,t.name),r,o),Qo(Ke.resolve(e,t.name),r,o)},va=(e,t,r)=>{let o;try{o=Sd(e,{withFileTypes:!0})}catch(n){if(n.code==="ENOENT")return;if(n.code==="ENOTDIR"||n.code==="ENOTSUP")return Qo(e,t,r);throw n}return o&&o.length&&o.forEach(n=>xd(e,n,t,r)),Qo(e,t,r)};ba.exports=Ko;Ko.sync=va});var Pa=ce((hv,xa)=>{l();var Kr=ve("path"),Ea=ve("fs"),Sa=parseInt("0777",8);xa.exports=yt.mkdirp=yt.mkdirP=yt;function yt(e,t,r,o){typeof t=="function"?(r=t,t={}):(!t||typeof t!="object")&&(t={mode:t});var n=t.mode,i=t.fs||Ea;n===void 0&&(n=Sa&~process.umask()),o||(o=null);var s=r||function(){};e=Kr.resolve(e),i.mkdir(e,n,function(a){if(!a)return o=o||e,s(null,o);a.code==="ENOENT"?yt(Kr.dirname(e),t,function(c,u){c?s(c,u):yt(e,t,s,u)}):i.stat(e,function(c,u){c||!u.isDirectory()?s(a,o):s(null,o)})})}yt.sync=function e(t,r,o){(!r||typeof r!="object")&&(r={mode:r});var n=r.mode,i=r.fs||Ea;n===void 0&&(n=Sa&~process.umask()),o||(o=null),t=Kr.resolve(t);try{i.mkdirSync(t,n),o=o||t}catch(a){switch(a.code){case"ENOENT":o=e(Kr.dirname(t),r,o),e(t,r,o);break;default:var s;try{s=i.statSync(t)}catch{throw a}if(!s.isDirectory())throw a;break}}return o}});var Aa=ce(en=>{l();var Pd=ka(),Ta=cl(),Ia=sl(),Dd=Pa(),Oa=ve("fs"),Z=ve("path"),Cd=ve("os"),jt=Cd.platform()==="win32",Nt=function(){},Zo=function(e){return e},Xo=jt?function(e){return e.replace(/\\/g,"/").replace(/[:?<>|]/g,"_")}:Zo,Td=function(e,t,r,o,n,i){var s=n||["."];return function(c){if(!s.length)return c();var u=s.shift(),d=Z.join(r,u);t.call(e,d,function(f,m){if(f)return c(f);if(!m.isDirectory())return c(null,u,m);e.readdir(d,function(h,w){if(h)return c(h);i&&w.sort();for(var y=0;y<w.length;y++)o(Z.join(r,u,w[y]))||s.push(Z.join(u,w[y]));c(null,u,m)})})}},_a=function(e,t){return function(r){r.name=r.name.split("/").slice(t).join("/");var o=r.linkname;return o&&(r.type==="link"||Z.isAbsolute(o))&&(r.linkname=o.split("/").slice(t).join("/")),e(r)}};en.pack=function(e,t){e||(e="."),t||(t={});var r=t.fs||Oa,o=t.ignore||t.filter||Nt,n=t.map||Nt,i=t.mapStream||Zo,s=Td(r,t.dereference?r.stat:r.lstat,e,o,t.entries,t.sort),a=t.strict!==!1,c=typeof t.umask=="number"?~t.umask:~Ra(),u=typeof t.dmode=="number"?t.dmode:0,d=typeof t.fmode=="number"?t.fmode:0,f=t.pack||Ta.pack(),m=t.finish||Nt;t.strip&&(n=_a(n,t.strip)),t.readable&&(u|=parseInt(555,8),d|=parseInt(444,8)),t.writable&&(u|=parseInt(333,8),d|=parseInt(222,8));var h=function(b,v){r.readlink(Z.join(e,b),function(p,g){if(p)return f.destroy(p);v.linkname=Xo(g),f.entry(v,y)})},w=function(b,v,p){if(b)return f.destroy(b);if(!v)return t.finalize!==!1&&f.finalize(),m(f);if(p.isSocket())return y();var g={name:Xo(v),mode:(p.mode|(p.isDirectory()?u:d))&c,mtime:p.mtime,size:p.size,type:"file",uid:p.uid,gid:p.gid};if(p.isDirectory())return g.size=0,g.type="directory",g=n(g)||g,f.entry(g,y);if(p.isSymbolicLink())return g.size=0,g.type="symlink",g=n(g)||g,h(v,g);if(g=n(g)||g,!p.isFile())return a?f.destroy(new Error("unsupported type for "+v)):y();var S=f.entry(g,y);if(S){var C=i(r.createReadStream(Z.join(e,v),{start:0,end:g.size>0?g.size-1:g.size}),g);C.on("error",function(O){S.destroy(O)}),Ia(C,S)}},y=function(b){if(b)return f.destroy(b);s(w)};return y(),f};var Id=function(e){return e.length?e[e.length-1]:null},Od=function(){return process.getuid?process.getuid():-1},Ra=function(){return process.umask?process.umask():0};en.extract=function(e,t){e||(e="."),t||(t={});var r=t.fs||Oa,o=t.ignore||t.filter||Nt,n=t.map||Nt,i=t.mapStream||Zo,s=t.chown!==!1&&!jt&&Od()===0,a=t.extract||Ta.extract(),c=[],u=new Date,d=typeof t.umask=="number"?~t.umask:~Ra(),f=typeof t.dmode=="number"?t.dmode:0,m=typeof t.fmode=="number"?t.fmode:0,h=t.strict!==!1;t.strip&&(n=_a(n,t.strip)),t.readable&&(f|=parseInt(555,8),m|=parseInt(444,8)),t.writable&&(f|=parseInt(333,8),m|=parseInt(222,8));var w=function(v,p){for(var g;(g=Id(c))&&v.slice(0,g[0].length)!==g[0];)c.pop();if(!g)return p();r.utimes(g[0],u,g[1],p)},y=function(v,p,g){if(t.utimes===!1)return g();if(p.type==="directory")return r.utimes(v,u,p.mtime,g);if(p.type==="symlink")return w(v,g);r.utimes(v,u,p.mtime,function(S){if(S)return g(S);w(v,g)})},b=function(v,p,g){var S=p.type==="symlink",C=S?r.lchmod:r.chmod,O=S?r.lchown:r.chown;if(!C)return g();var P=(p.mode|(p.type==="directory"?f:m))&d;O&&s?O.call(r,v,p.uid,p.gid,A):A(null);function A(F){if(F)return g(F);if(!C)return g();C.call(r,v,P,g)}};return a.on("entry",function(v,p,g){v=n(v)||v,v.name=Xo(v.name);var S=Z.join(e,Z.join("/",v.name));if(o(S,v))return p.resume(),g();var C=function(I){if(I)return g(I);y(S,v,function(_){if(_)return g(_);if(jt)return g();b(S,v,g)})},O=function(){if(jt)return g();r.unlink(S,function(){var I=Z.resolve(Z.dirname(S),v.linkname);if(!Ca(I,e))return g(new Error(S+" is not a valid symlink"));r.symlink(v.linkname,S,C)})},P=function(){if(jt)return g();r.unlink(S,function(){var I=Z.join(e,Z.join("/",v.linkname));r.realpath(I,function(_,L){if(_||!Ca(L,e))return g(new Error(S+" is not a valid hardlink"));r.link(L,S,function(j){if(j&&j.code==="EPERM"&&t.hardlinkAsFilesFallback)return p=r.createReadStream(I),A();C(j)})})})},A=function(){var I=r.createWriteStream(S),_=i(p,v);I.on("error",function(L){_.destroy(L)}),Ia(_,I,function(L){if(L)return g(L);I.on("close",C)})};if(v.type==="directory")return c.push([S,v.mtime]),Da(S,{fs:r,own:s,uid:v.uid,gid:v.gid},C);var F=Z.dirname(S);$a(r,F,Z.join(e,"."),function(I,_){if(I)return g(I);if(!_)return g(new Error(F+" is not a valid path"));Da(F,{fs:r,own:s,uid:v.uid,gid:v.gid},function(L){if(L)return g(L);switch(v.type){case"file":return A();case"link":return P();case"symlink":return O()}if(h)return g(new Error("unsupported type for "+S+" ("+v.type+")"));p.resume(),g()})})}),t.finish&&a.on("finish",t.finish),a};function $a(e,t,r,o){if(t===r)return o(null,!0);e.lstat(t,function(n,i){if(n&&n.code!=="ENOENT")return o(n);if(n||i.isDirectory())return $a(e,Z.join(t,".."),r,o);o(null,!1)})}function Da(e,t,r){Dd(e,{fs:t.fs},function(o,n){!o&&n&&t.own?Pd(n,t.uid,t.gid,r):r(o)})}function Ca(e,t){return t=Z.resolve(t),t===e||e.startsWith(t+Z.sep)}});l();l();var xr=K(pe(),1);l();l();var wr=[{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 dl(e){let t="No lockfile found",r="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.",o=[["Generate a lockfile. Run",{command:"npm|yarn|pnpm install"}],"Commit the new file to your repository"];if(e)throw new E(t,r,o);q({headline:t,body:r,nextSteps:o})}function ul(e,t){let r=e.map(({packageManager:s,foundLockfile:a})=>`${a} (created by ${s.name})`),o="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:r}}],i=["Delete any unneeded lockfiles","Commit the change to your repository"];if(t)throw new E(o,n,i);q({headline:o,body:n,nextSteps:i})}function fl(e){let t="Lockfile ignored by Git",r="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.",o=[`In your project\u2019s .gitignore file, delete any references to ${e}`,"Commit the change to your repository"];q({headline:t,body:r,nextSteps:o})}async function Si(e,t=!1){if(Ie&&!process.env.SHOPIFY_UNIT_TEST)return;let r=[];for(let i of wr){let s=[i.lockfile,...i.alternativeLockfiles||[]];for(let a of s)if(await G(D(e,a))){r.push({packageManager:i,foundLockfile:a});break}}if(r.length===0)return dl(t);if(r.length>1)return ul(r,t);let o=r[0].foundLockfile;(await Tn(e,[o]).catch(()=>[])).length>0&&fl(o)}l();var ml=["^cdn/","^_t/"];function vr(e){let t=new Set;return Object.values(e.routes).filter(r=>ml.some(o=>new RegExp(o).test(r.path??""))).forEach(r=>{r.path&&t.add(r.path)}),[...t]}var pl=["","cart","products/:productHandle","collections","collections/:collectionHandle","sitemap.xml","robots.txt","pages/:pageHandle","policies/:policyHandle","search","account","account/login","account/orders/:orderId","account/authorize"];function br(e,t=pl){let r=Object.values(e.routes),o=new Set(t);for(let n of t)for(let i of r)if(!n&&!i.path)o.delete(n);else if(n&&i.path){let s={path:i.path,parentId:i.parentId};for(;s.parentId&&s.parentId!=="root";){let u=r.find(d=>d.id===s.parentId);if(!u)break;s.path=u.path==null?s.path:`${u.path}/${s.path}`,s.parentId=u.parentId}let a=":?[^\\/\\?]+\\?",c=`^(${a}\\/)?`+n.replaceAll(".","\\.").replace(/\//g,`\\/(${a}\\/)?`).replace(/:[^/)?]+/g,"(:[^\\/]+|\\*)")+`(\\/${a})?$`;new RegExp(c).test(s.path)&&o.delete(n)}return[...o]}var Le=100;function xi(e){e.length?q({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,Le-(e.length<=Le?0:1)).map(t=>`\u2022 /${t}`).join(`
6
+ `)+(e.length>Le?`
7
+ \u2022 ...and ${e.length-Le+1} more`:"")}):N({headline:"All standard Shopify routes present"})}function kr(e){e.length&&q({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,Le-(e.length<=Le?0:1)).map(t=>`\u2022 /${t}`).join(`
11
+ `)+(e.length>Le?`
12
+ \u2022 ...and ${e.length-Le+1} more`:"")})}l();l();var _o="metafile.server.json",Er="server-bundle-analyzer.html";async function Pi(){return de(await Ge("bundle","analyzer.html"))}function Di(e,t){return e.replace("globalThis.METAFILE = '';",`globalThis.METAFILE = '${Buffer.from(t,"utf-8").toString("base64")}';`)}async function Ci(e){try{return` \u2502
13
+ `+(await(await import("esbuild")).analyzeMetafile(await de(x(e,_o)),{color:!0})).split(`
14
+ `).filter(o=>!o.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,o=>M.dim(o))}catch(t){console.warn("Could not generate bundle analysis summary:",t.message)}}function Ii(e){let t;return{name:"hydrogen:bundle-analyzer",configResolved(r){t=r},async generateBundle(r,o){if(!t.build.ssr)return;let{root:n}=t,i=Object.values(o).find(w=>w.type==="chunk");if(!i||i.type!=="chunk"||!i.facadeModuleId||!r.dir)return;let s=await Pi().catch(()=>null);if(!s){console.warn("Bundle analyzer template not found");return}let a=new Set(Object.keys(i.modules)),c=[];for(let w of a){if(Ro(w)||$o(w))continue;let y=this.getModuleInfo(w);if(y?.id){c.push(y);for(let b of[...y.importedIds,...y.dynamicallyImportedIds])!Ro(b)&&!$o(b)&&a.add(b)}}let u=new Map,d=new Map,f=await Promise.all(c.map(async w=>{let y=ie(n,w.id),b=i.modules[w.id],v=typeof b?.originalLength=="number"?b.originalLength:w.code?.length??0,p=b?.renderedLength??0;if(e?.minify&&b?.code){let A=await e.minify(b.code,w.id).catch(()=>null);A&&(p=A.length)}d.set(y,p);let g=A=>this.resolve(A,w.id),S=!w.code||/(^\s*export\s+[\w\{]|^\s*import\s+[\w\{'"]|\bimport\()|\bcreateRequire\(/ms.test(w.code)||!/((^|\b)exports\b|\brequire\()/.test(w.code),C=Ti(w.importedIds,"import-statement",n,g,w.code),O=Ti(w.dynamicallyImportedIds,"dynamic-import",n,g,w.code),P=(await Promise.all([...C,...O])).reduce((A,{importedId:F,...I})=>(Ro(F)?S=!1:$o(F)||A.push(I),A),[]);u.set(y,{bytes:v,format:S?"esm":"cjs",imports:P})})).then(()=>null).catch(w=>w);if(f){console.warn("Bundle analyzer failed to analyze the bundle:",f);return}let m=Object.fromEntries(u.entries()),h={inputs:m,outputs:{[ie(n,x(r.dir,i.fileName))]:{imports:i.imports,exports:i.exports,entryPoint:ie(n,i.facadeModuleId),bytes:i.code.length??0,inputs:Object.entries(m).reduce((w,[y,b])=>(w[y]={bytesInOutput:d.get(y)??b.bytes??0},w),{})}}};this.emitFile({type:"asset",fileName:_o,source:JSON.stringify(h,null,2)}),this.emitFile({type:"asset",fileName:Er,source:Di(s,JSON.stringify(h))})}}}function Ro(e){return/(commonjsHelpers\.js$|\?commonjs\-)/.test(e)}function $o(e){return e.endsWith("?transform-only")}async function hl(e,t,r){let o=t.matchAll(/import\s[^'"]*?['"]([^'"]+)['"]/g)??[];for(let[,n]of o)if(n&&(await r(n))?.id===e)return n;return e}function Ti(e,t,r,o,n){return e.map(async i=>({importedId:i,path:ie(r,i),kind:t,original:n?await hl(i,n,o):i}))}l();import{spawn as gl}from"node:child_process";import{fileURLToPath as _i}from"node:url";var yl=process.argv[1],wl=_i(import.meta.url),vl=yl===wl;vl&&Dt({rootDirectory:process.argv[2],appDirectory:process.argv[3],configFilePath:process.argv[4],watch:!0});function Ri(e,t){if(e.includes("AbortError: ")){let s=e.split("AbortError: ")[1]??"",a=s.split(`
18
+ `)[0],c=s.match(/tryMessage: '(.*)',$/m)?.[1];if(a)return{message:a,details:c}}let[r="",...o]=e.replaceAll("[FAILED]","").replace(/\s{2,}/g,`
19
+ `).replace(/\n,\n/,`
20
+ `).trim().split(`
21
+ `),n="[Codegen] "+r,i=o.join(`
22
+ `);if(t){let s=t.replaceAll("\\","/")+"/";i=i.replaceAll(s,"")}return{message:n,details:i}}function Sr({rootDirectory:e,appDirectory:t,configFilePath:r}){let o,n,i=process.argv.findIndex(a=>a==="hydrogen");i>=1?(o=process.argv[0],n=[...process.argv.slice(1,i+1),"codegen","--watch","--path",e],r&&n.push("--codegen-config-path",r)):(o="node",n=[_i(import.meta.url),e,t??D("app"),r??""]);let s=gl(o,n,{stdio:["inherit","ignore","pipe"]});return s.stderr.on("data",a=>{let c=typeof a=="string"?a:a?.toString?.("utf8")??"";if(!c)return;let{message:u,details:d}=Ri(c,e);/`punycode`/.test(u)||/\.body\[\d\]/.test(u)||/console\.time(End)?\(\)/.test(u)||/─ (warning|info|success) ───/.test(u)||(V({body:""}),q({headline:u,body:d}))}),s.on("close",a=>{a&&a>0&&q({headline:"Codegen process exited with code "+a,body:"There should be more logs above."})}),s}async function Dt(e){return await bl(e),kl(e).catch(t=>{if(t instanceof E)throw t;let{message:r,details:o}=Ri(t.message,e.rootDirectory);throw new E(r,o)})}async function bl(e){let{execSync:t,exec:r}=await import("child_process");try{t("npx react-router --version",{cwd:e.rootDirectory,stdio:"ignore"})}catch{V({body:"React Router not found, skipping typegen"});return}e.watch?r("npx react-router typegen --watch",{cwd:e.rootDirectory}):t("npx react-router typegen",{cwd:e.rootDirectory,stdio:"inherit"})}async function kl({watch:e,configFilePath:t,forceSfapiVersion:r,...o}){let{generate:n,loadCodegenConfig:i,CodegenContext:s}=await qe("@graphql-codegen/cli",o.rootDirectory).catch(()=>{throw new E("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??o.rootDirectory})||await El(o,r);await Sl(a,o);let c=new s({config:{...a,watch:e,silent:!e,cwd:o.rootDirectory},filepath:"not-used-but-must-be-set"});return c.cwd=o.rootDirectory,await n(c,!0),Object.entries(a.generates).reduce((u,[d,f])=>("documents"in f&&(u[d]=(Array.isArray(f.documents)?f.documents:[f.documents]).filter(m=>typeof m=="string")),u),{})}async function El({rootDirectory:e,appDirectory:t=D(e,"app")},r){let{getSchema:o,preset:n,pluckConfig:i}=await qe("@shopify/hydrogen-codegen",e).catch(()=>{throw new E("Could not load Hydrogen Codegen.","Please make sure you have `@shopify/hydrogen-codegen` installed as a dev dependency.")}),{loadConfig:s}=await qe("graphql-config",e).catch(()=>{throw new E("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(()=>{}),c=o("storefront"),u=Oi(c,a),d=o("customer-account",{throwIfMissing:!1}),f=d?Oi(d,a):void 0,m="*!(*.d).{ts,tsx,js,jsx}",h=ie(e,t),w=b=>{let v=Ze(c),p=d&&Ze(d);return!!(b.endsWith(v)||p&&b.endsWith(p))},y=Object.values(a?.projects??{}).filter(b=>b.hasExtension("codegen")&&(typeof b.schema!="string"||!w(b.schema)));return{filepath:"virtual:codegen",config:{overwrite:!0,pluckConfig:i,generates:{...Ao(u)??{"storefrontapi.generated.d.ts":{preset:n,schema:c,documents:u?.documents??[m,x(h,"**",m)],...!!r&&{presetConfig:{importTypes:!1},schema:{[`https://hydrogen-preview.myshopify.com/api/${r.split(":")[0]}/graphql.json`]:{headers:{"content-type":"application/json","X-Shopify-Storefront-Access-Token":r.split(":")[1]??"3b580e70970c4528da70c98e097c2fa0"}}},config:{defaultScalarType:"string",scalars:{JSON:"unknown"}}}}},...Ao(f)??(f?.documents?{"customer-accountapi.generated.d.ts":{preset:n,schema:d,documents:f.documents}}:{}),...y.reduce((b,v)=>({...b,...Ao(v)}),{})}}}}function Ao(e){if(e?.extensions?.codegen?.generates)return Object.entries(e.extensions.codegen.generates).reduce((t,[r,o])=>(t[r]={...e,...Array.isArray(o)?o[0]:o},t),{})}function Oi(e,t){if(!t)return;let r=Ze(e);return Object.values(t.projects||{}).find(o=>typeof o.schema=="string"&&o.schema.endsWith(r))}async function Sl(e,{rootDirectory:t}){let r=Symbol.for("name"),o=Object.values(e.generates).filter(n=>{let i=(Array.isArray(n)?n[0]:n)?.preset;if(typeof i=="object"&&r in i)return i[r]==="hydrogen"||i[r]==="@shopify/graphql-codegen"});for(let n of o){let i=Array.isArray(n)?n[0]:n;if(i){let s=await et(t);i.hooks={beforeOneFileWrite:(a,c)=>St(c,s,a),...i.hooks}}}}l();function Ct(){let{env:e}=process;return e.CI==="false"?!1:!!(e.CI||e.CI_NAME||e.BUILD_NUMBER||e.TF_BUILD)}l();function Tt(){let e={state:"pending"};return e.promise=new Promise((t,r)=>{e.resolve=o=>(e.state==="pending"&&(e.state="resolved"),t(o)),e.reject=o=>(e.state==="pending"&&(e.state="rejected"),r(o))}),e}l();function Me(e){let t,r=process.exit;process.exit=async o=>{t??=e();let n=setTimeout(()=>r(o),5e3);return await t,clearTimeout(n),r(o)}}var Pr=class e extends T{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={...k.path,...k.entry,...k.sourcemap,...k.lockfileCheck,...k.disableRouteWarning,...k.codegen,watch:xr.Flags.boolean({description:"Watches for changes and rebuilds the project writing output to disk.",env:"SHOPIFY_HYDROGEN_FLAG_WATCH"}),"bundle-stats":xr.Flags.boolean({description:"Show a bundle size summary after building. Defaults to true, use `--no-bundle-stats` to disable.",allowNo:!0}),"force-client-sourcemap":xr.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),r=t.path?D(t.path):process.cwd(),o={...U(t),useCodegen:t.codegen,directory:r};if(!await er(r))throw new E(Pe);let i=await Je(o);o.watch?i?.close&&Me(async()=>{await i?.close()}):process.exit(0)}},xl=5;async function Je({entry:e,directory:t,useCodegen:r=!1,codegenConfigPath:o,sourcemap:n=!0,forceClientSourcemap:i,disableRouteWarning:s=!1,lockfileCheck:a=!0,assetPath:c,bundleStats:u=!Ct(),watch:d=!1,onServerBuildStart:f,onServerBuildFinish:m}){process.env.NODE_ENV||(process.env.NODE_ENV="production"),c=c??process.env.HYDROGEN_ASSET_BASE_URL??"/";let h=t??process.cwd();a&&await Si(h,Ct());let[w,{userViteConfig:y,remixConfig:b,clientOutDir:v,serverOutDir:p,serverOutFile:g}]=await Promise.all([Zt(h),he(h,e)]),S=w.createLogger(d?"warn":void 0);process.env.SHOPIFY_UNIT_TEST&&(S.info=j=>Ae("info",j),S.warn=j=>Ae("warn",j),S.error=j=>Ae("error",j));let C=y.build?.minify??!0,O={root:h,mode:process.env.NODE_ENV,base:c,customLogger:S},P,A=await w.build({...O,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(){P?.resolve(),P=Tt()},buildEnd(j){j&&P.reject(j)},writeBundle(){P.resolve()},closeWatcher(){this.error(new Error("Process exited before client build finished."))}}]});console.log("");let F,I=await w.build({...O,build:{sourcemap:n,ssr:e??!0,emptyOutDir:!1,copyPublicDir:!1,minify:C,watch:d?{buildDelay:100}:null},server:{watch:d?{}:null},plugins:[{name:"hydrogen:cli:server",async buildStart(){await P.promise,F?.resolve(),F=Tt(),await f?.()},async writeBundle(){F?.state!=="rejected"&&await m?.(),F.resolve()},closeWatcher(){this.error(new Error("Process exited before server build finished."))}},...u?[Ii({minify:C?(j,oe)=>w.transformWithEsbuild(j,oe,{minify:!0,minifyWhitespace:!0,minifySyntax:!0,minifyIdentifiers:!0,sourcemap:!1,treeShaking:!1,legalComments:"none",target:"esnext"}).then(le=>le.code):void 0})]:[]]});d||await Promise.all([be(x(v,".vite")),be(x(p,".vite")),be(x(p,"assets"))]);let _={rootDirectory:h,appDirectory:b.appDirectory,configFilePath:o},L=r?d?Sr(_):await Dt(_).then(()=>{}):void 0;if(!d&&process.env.NODE_ENV!=="development"){if(u){let oe="file://"+x(p,Er);$(z`${await Ci(p)||`
23
+ `}\n │\n └─── ${Ee.link("Complete analysis: "+oe,oe)}\n\n`)}await mn(g)/(1024*1024)>=xl&&B(`\u{1F6A8} Smaller worker bundles are faster to deploy and run.${C?"":"\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 j=br(b);if(j.length){let oe=await ke(h),le=oe==="npm"?"npx":oe;B(`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 ${j.length} route${j.length>1?"s":""}. For more details, run \`${le} shopify hydrogen check routes\`.
28
+ `)}}return!d&&!s&&kr(vr(b)),{async close(){L?.removeAllListeners("close"),L?.kill("SIGINT");let j=[];"close"in A&&j.push(A.close()),"close"in I&&j.push(I.close()),await Promise.allSettled(j),(P?.state==="pending"||F?.state==="pending")&&(P?.promise.catch(()=>{}),P?.reject(),F?.promise.catch(()=>{}),F?.reject(),await new Promise(oe=>setTimeout(oe,500)))}}}l();var $i=K(pe(),1),Dr=class e extends T{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={...k.path};static args={resource:$i.Args.string({name:"resource",description:"The resource to check. Currently only 'routes' is supported.",required:!0,options:["routes"]})};async run(){let{flags:t,args:r}=await this.parse(e),o=t.path?D(t.path):process.cwd();if(r.resource==="routes")await Pl({directory:o});else throw new Error("Invalid command argument.")}};async function Pl({directory:e}){let t=await Ne(e);xi(br(t)),kr(vr(t))}l();var Cr=K(pe(),1);var Tr=class e extends T{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={...k.path,"codegen-config-path":Cr.Flags.string({description:"Specify a path to a codegen configuration file. Defaults to `<root>/codegen.ts` if it exists.",required:!1}),"force-sfapi-version":Cr.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:Cr.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),r=t.path?D(t.path):process.cwd();await Dl({...U(t),directory:r})}};async function Dl({directory:e,codegenConfigPath:t,forceSfapiVersion:r,watch:o}){let{root:n}=xe(e),i=await Ne(n);console.log("");let s=await Dt({...i,configFilePath:t,forceSfapiVersion:r,watch:o});o||N({headline:"Generated types for GraphQL:",body:{list:{items:Object.entries(s).map(([a,c])=>a+`
29
+ `+c.map(u=>M.dim(`- ${u}`)).join(`
30
+ `))}}})}l();var ji=K(pe(),1);l();import{Session as Cl}from"node:inspector";async function Ai(e){let{createMiniOxygen:t}=await qe("@shopify/mini-oxygen/node",e).catch(To),r=t({script:"export default {}",modules:!0,log:()=>{}});return{async run(o,n){let[i]=await Promise.all([de(o),r.ready()]),s=await Tl();await r.reload({script:i});let a=await s();return Il(a,o+".map",n)},async close(){await r.dispose()}}}function Tl(){let e=new Cl;return e.connect(),new Promise(t=>{e.post("Profiler.enable",()=>{e.post("Profiler.start",()=>{t(()=>new Promise((r,o)=>{e.post("Profiler.stop",(n,{profile:i})=>{if(e.disconnect(),n)return o(n);r(i)})}))})})})}async function Il(e,t,r){let{SourceMapConsumer:o}=await import("./source-map-E7FCCJL7.js"),n=JSON.parse(await de(t)),i=await new o(n,"file://"+t),s=new Set,a=0,c=e.endTime-e.startTime,u=e.samples?.length?c/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(f=>s.add(f))),s.has(d.id)?(Ol(d,i),d.callFrame.url==="<script>"&&!d.callFrame.functionName&&!d.callFrame.lineNumber&&!d.callFrame.columnNumber&&(d.callFrame.url=r??"",d.callFrame.functionName="(top-level app code)"),a+=Math.round((d.hitCount??0)*u*1e3)/1e3):_l(d);return i.destroy(),{profile:e,totalTimeMs:c/1e3,totalScriptTimeMs:a/1e3}}function Ol(e,t){let r=t.originalPositionFor({line:e.callFrame.lineNumber+1,column:e.callFrame.columnNumber+1});e.callFrame.url=r.source||e.callFrame.url,e.callFrame.functionName=r.name||e.callFrame.functionName,e.callFrame.lineNumber=r.line?r.line-1:e.callFrame.lineNumber,e.callFrame.columnNumber=r.column??e.callFrame.columnNumber}function _l(e){Object.assign(e,{children:[],callFrame:{functionName:"(profiler)",scriptId:"0",url:"",lineNumber:-1,columnNumber:-1}})}var Fi="startup.cpuprofile",Ir=class e extends T{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={...k.path,...k.entry,output:ji.Flags.string({description:`Specify a path to generate the profile file. Defaults to "${Fi}".`,default:Fi,required:!1})};async run(){let{flags:t}=await this.parse(e),r=t.path?D(t.path):process.cwd(),{close:o}=await Rl({...U(t),directory:r,output:D(r,t.output)});Me(async()=>{await o()})}};async function Rl({directory:e,entry:t,output:r}){process.env.NODE_ENV||(process.env.NODE_ENV="production"),it({workerReload:!1});let{buildPath:o,buildPathWorkerFile:n}=xe(e);$(`\u23F3\uFE0F Starting profiler for CPU startup... Profile will be written to:
31
+ `+M.dim(r));let i=0,s,a=await Ai(e),c={onServerBuildStart(){i>0&&process.stdout.write(Gt.eraseLines(4)),$(`
32
+ #${++i} Building and profiling...`)},async onServerBuildFinish(){let{profile:m,totalScriptTimeMs:h}=await a.run(n,s);process.stdout.write(Gt.eraseLines(2)),$(`#${i} Total time: ${h.toLocaleString()} ms
33
+ ${M.dim(r)}`),await Q(r,JSON.stringify(m,null,2)),$(`
34
+ Waiting for changes...`)}};if(await rt(e))throw new E(Pe);let d=await he(e).catch(()=>null);n=d?.serverOutFile??x(o,"server","index.js"),s=d?.remixConfig.serverEntryPoint??"";let f=await Je({entry:t,directory:e,watch:!0,sourcemap:!0,disableRouteWarning:!0,lockfileCheck:!1,bundleStats:!1,...c,onServerBuildStart(){return i===0&&process.stdout.write(Gt.eraseLines(1)),c.onServerBuildStart()}});return{async close(){await Promise.allSettled([f.close(),a.close()])}}}l();var te=K(pe(),1);l();l();import Ni from"fs";import Li,{dirname as $l}from"path";import{fileURLToPath as Al}from"url";var Or={assetsDirDefault:"dist/client/",buildCommandDefault:"npm build",verificationDurationDefault:180,maxUploadAttempts:3,maxResumabeUploadAttempts:9,workerDirDefault:"dist/worker/"};function De(e){if(Fl(e)){if(e.statusCode===401)throw new E("You are not authorized to perform this action. Please check your deployment token.");if(e.statusCode===429)throw new E("You've made too many requests. Please try again later")}if(e instanceof E&&e.message.includes("503"))throw new E("The server is currently unavailable. Please try again later.")}var ue=(e=>(e.OxygenNamespaceHandle="X-Oxygen-Namespace-Handle",e))(ue||{});function Fl(e){return typeof e=="object"&&e!==null&&"statusCode"in e}function It(e){let t;if(e)t=Li.join(e,"package.json");else{let o=Al(import.meta.url),n=$l(o);t=Li.join(n,"../../package.json")}if(!Ni.existsSync(t))return{};let r=Ni.readFileSync(t,"utf8");return JSON.parse(r)}function Fo(e){process.stderr.write(`${e}
35
+ `)}var ct=375;function jo(e){try{let t=Buffer.from(e,"base64").toString("utf-8"),r=JSON.parse(t);return Ui(r)}catch{throw new Error("Error processing deployment token. Please check your token and try again.")}}function Mi(e){if(!e)return;let t=Number(e);if(isNaN(t))throw new E("Invalid duration format. Please specify the duration in hours (e.g., '10').");if(t>12||t<1)throw new E("Invalid duration length. Please specify the duration (in hours) between 1 to 12 hours.");return t}async function Hi({config:e,performedBuild:t=!1}){let{rootPath:r,workerDir:o,assetsDir:n,skipBuild:i,workerOnly:s}=e,a={root:r};(i||t)&&(a.worker=x(r,o),s||(a.assets=x(r,n)));for(let u of Object.keys(a))await jl(a[u],u);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 jl(e,t){if(!await G(e))throw t==="assets"&&B('Use the "workerOnly" flag to perform a worker-only deployment.',Fo),new Error(`Path not found: ${e}`)}function Ui(e){return typeof e=="object"?Object.keys(e).reduce((t,r)=>{let o=r.replace(/([-_][a-z])/gi,n=>n.toUpperCase().replace("-","").replace("_",""));if(e[r]===void 0)throw new Error(`Invalid token: ${r} is undefined`);return t[o]=Ui(e[r]),t},{}):e}l();var _r=K(al(),1);var Bi;function Nl(e){if(e)return;if(_r.default._client)return _r.default;let r={apiKey:"21fd37fe87ead4b9c5a8eed90752b455",autoDetectErrors:!0,appVersion:It().version,endpoints:{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com"},logger:null};return _r.default.start(r)}function Vi(e){Bi=Nl(e)}function dt(){return Bi}function Gi(e,t){if(!t)return e;let r=o=>o.replace(new RegExp(t,"g"),"***");if(e instanceof Error){let o=Object.create(Object.getPrototypeOf(e));return Object.assign(o,e,{message:r(e.message),stack:e.stack?r(e.stack):void 0}),o}return r(e)}l();var ne=(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))(ne||{}),Rr=class{metrics={};metricPrefix="oxygen.cli";defaultTags;exportUrl;constructor(t){let{version:r}=It(),{version:o}=It(`${t.rootPath}/node_modules/@shopify/hydrogen`);this.defaultTags={ci_provider:t.ciProvider,cli_version:`oxygen-cli@${r||"unknown"}`,hydrogen_version:o||"unknown"},this.exportUrl="https://metrics.myshopify.dev"}add(t,r,o={}){let n={value:r,tags:o};this.metrics[t]?this.metrics[t].push(n):this.metrics[t]=[n]}formatTags(t){return Object.entries(t).map(([r,o])=>`${r}:${o}`)}async export(){let t=Object.entries(this.metrics).map(([r,o])=>{let n=`${this.metricPrefix}.${r}`;return o.map(({value:i,tags:s})=>({name:n,type:"gauge",value:i,tags:this.formatTags({...s,...this.defaultTags})}))}).flat();try{await se(this.exportUrl,{method:"POST",body:JSON.stringify({events:t})})}catch(r){let o=dt();o&&(r instanceof Error||typeof r=="string")&&o.notify(r)}}};l();l();var qi=`
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 Wi(e){let{config:t,logger:r,environment:o,labels:n=[]}=e,i={environment:o,labels:n};try{let s=await me({query:qi,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:i,addedHeaders:{[ue.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(s.buildInitiate.userErrors.length>=1)throw new E(`Failed to create build. ${s.buildInitiate.userErrors[0]?.message}`);return Fe(`Build initiated successfully with id ${s.buildInitiate.build.id}.`,r),s.buildInitiate}catch(s){throw De(s),s}}l();l();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 zi(e){let{config:t,buildId:r,reason:o,logger:n}=e,i={buildId:r,reason:o};try{let s=await me({query:Yi,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,addedHeaders:{[ue.OxygenNamespaceHandle]:t.deploymentToken.namespace},variables:i});if(s.buildCancel.userErrors.length>=1)throw new E(`Failed to cancel build: ${s.buildCancel.userErrors[0]?.message}`);return $(`Build with id ${r} cancelled.`,n),s.buildCancel}catch(s){throw De(s),s}}l();l();var $r=(e=>(e.Worker="WORKER",e.Asset="ASSET",e))($r||{}),ut=class extends Error{},Qe=class extends Error{};async function Qi(e,t){let r=x(e.rootPath,e.workerDir),o=await kt(`${r}/**`),n=Ji({files:o,basePath:r,type:$r.Worker,filter:Ml});if(!e.workerOnly){let s=x(e.rootPath,e.assetsDir),a=await kt(`${s}/**`);n=[...n,...Ji({files:a,basePath:s,type:$r.Asset,filter:Hl})]}t?.add(ne.NumFilesRequested,n.length);let i=n.reduce((s,a)=>s+a.fileSize,0)/1024;return t?.add(ne.TotalSizeRequested,i),n}function Ll(e){let t=fn(e);return hn(t)}function Ji(e){let{files:t,basePath:r,type:o,filter:n}=e,i=[];return t.forEach(s=>{let a=ie(r,s);n&&!n(a)||i.push({filePath:a,fileSize:pn(s),mimeType:Cn(s),fileType:o,fileHash:Ll(s)})}),i}function Ml(e){let t=["oxygen.json"],r=[".js.map",".mjs.map",".map",".js",".mjs"],n=`^(${["index"].join("|")})(${r.join("|")})$`;return new RegExp(n).test(e.toLowerCase())||t.includes(e)}function Hl(e){let r=`(${[".map"].join("|")})$`;return!new RegExp(r).test(e.toLowerCase())}l();l();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 Xi(e){let{config:t,input:r,logger:o}=e,n={buildId:r.buildId,environment:r.environment,files:r.manifest,labels:r.labels};try{let i=await me({query:Ki,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:n,addedHeaders:{[ue.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(i.deploymentInitiate.userErrors.length>=1)throw new E(`Failed to create deployment. ${i.deploymentInitiate.userErrors[0]?.message}`);return Fe(`Deployment initiated, ${i.deploymentInitiate.deploymentTargets.length} files to upload.`,o),i.deploymentInitiate}catch(i){throw De(i),i}}l();l();var Zi=`
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 es(e,t){let r={deploymentId:t,generateAuthBypassToken:e.generateAuthBypassToken};if(e.generateAuthBypassToken)r.authBypassTokenDuration=Mi(e.authBypassTokenDuration);else if(e.authBypassTokenDuration)throw new E("authBypassTokenDuration is set but generateAuthBypassToken is not enabled");e.overriddenEnvironmentVariables&&(r.environmentVariables=e.overriddenEnvironmentVariables);try{let o=await me({query:Zi,api:"Oxygen",url:`${e.deploymentUrl}/api/v2/admin/graphql`,token:e.deploymentToken.accessToken,variables:r,addedHeaders:{[ue.OxygenNamespaceHandle]:e.deploymentToken.namespace}});if(o.deploymentComplete.userErrors.length>=1)throw new E(`Failed to complete deployment: ${o.deploymentComplete.userErrors[0]?.message}`);return o.deploymentComplete}catch(o){throw De(o),o}}l();async function ts(e){let{config:t,url:r,logger:o,hooks:n}=e;n?.onVerificationStart?.(),$("Verifying worker deployment is routable...",o);let i=0,s=0,a=!1,c=Date.now(),u=async()=>{if(i<10?s=500:i%5===0&&(s+=5e3),(Date.now()-c)/1e3+s/1e3>t.verificationMaxDuration){let m=new ut("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 se(`${r}/.oxygen/deployment`,{method:"HEAD"})).status===200)return $("Deployment verification check passed",o),n?.onVerificationComplete?.(),Promise.resolve();await u()}catch{await u()}};await d()}l();l();var rs=`
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 os(e){let{config:t,deploymentId:r,reason:o,logger:n}=e,i={deploymentId:r,reason:o};try{let s=await me({query:rs,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:i,addedHeaders:{[ue.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(s.deploymentCancel.userErrors.length>=1)throw new E(s.deploymentCancel.userErrors[0]?.message||"");return $(`Deployment with id ${r} cancelled.`,n),s.deploymentCancel}catch(s){throw De(s),s}}l();import{Agent as Ul}from"https";var ns=K(ll(),1);async function is(e){let{config:t,logger:r,targets:o,hooks:n}=e;$(`Uploading ${o.length} files...`,r);let i=o.reduce((c,u)=>c+u.fileSize,0)/1024;e.metricsExporter?.add(ne.TotalSizeUploaded,i),e.metricsExporter?.add(ne.NumFilesUploaded,o.length);let s=new Ul({keepAlive:!0});n?.onUploadFilesStart?.();let a=performance.now();return(0,ns.mapLimit)(o,6,async c=>{await Bl(t,c,s)}).then(()=>{let c=performance.now();n?.onUploadFilesComplete?.(),e.metricsExporter?.add(ne.UploadTime,c-a),Fe("Files uploaded successfully",r)}).catch(c=>{throw n?.onUploadFilesError?.(c),c}).finally(()=>{s.destroy()})}async function Bl(e,t,r){let o=t.fileType==="WORKER"?x(e.rootPath,e.workerDir):x(e.rootPath,e.assetsDir);if(t.parameters!==null&&t.parameters.length>0){let n=gn();t.parameters.forEach(i=>{n.append(i.name,i.value)}),n.append("file",wo(x(o,t.filePath))),await ss(n,t,r)}else{let n=await Vl(t,r);await as(x(o,t.filePath),n,r)}}async function ss(e,t,r,o=0){try{let i=new AbortController,s=setTimeout(()=>{i.abort()},12e4),a=await se(t.uploadUrl,{method:"POST",body:e,signal:i.signal,headers:{Connection:"keep-alive"},agent:r});if(clearTimeout(s),!a.ok)throw new Error(`${a.status}`)}catch(n){if(ls(n,"ENOENT"))throw new Error(`File not found: ${t.filePath}`);if(o<Number(Or.maxUploadAttempts))await ss(e,t,r,o+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 Vl(e,t){return se(e.uploadUrl,{method:"POST",headers:{"x-goog-resumable":"start","X-Goog-Content-Length-Range":`0,${e.fileSize}`,"User-Agent":"oxygen-cli"},agent:t}).then(r=>({sessionUri:r.headers.get("x-guploader-uploadid"),location:r.headers.get("location"),target:e})).catch(r=>{throw new Error(`Failed to initiate resumable upload for file ${e.filePath} (status code ${r.statusCode})`)})}async function as(e,t,r,o=0,n=0){await Gl(t.location,e,o,r).catch(async i=>{if(ls(i,"ENOENT"))throw new Error(`File not found: ${t.target.filePath}`);if(i&&n>=Number(Or.maxResumabeUploadAttempts))throw new Error(`Failed to upload file ${t.target.filePath} after ${Or.maxResumabeUploadAttempts} attempts`);let s=await ql(t.location,t.target.fileSize,r);if(!s.complete){let a=s.lastReceivedByte,c=n+1;await as(e,t,r,a,c)}})}async function Gl(e,t,r,o){let n=wo(t,{start:r});return se(e,{method:"PUT",body:n,agent:o}).then(i=>i.status)}async function ql(e,t,r){let o=n=>{if(!n||n.split("-").length!==2)return 0;let i=n.split("-");return parseInt(i[1],10)};return se(e,{method:"PUT",headers:{"Content-Length":"0","Content-Range":`bytes */${t}`},agent:r}).then(n=>({complete:n.status===200,lastReceivedByte:o(n.headers.get("range"))})).catch(n=>(console.error(n),{complete:!1,lastReceivedByte:0}))}function ls(e,t){return e instanceof Error&&"code"in e&&e.code===t}l();l();var cs=`
107
+ query DeploymentVerificationDetails($deploymentId: ID!) {
108
+ deploymentVerificationDetails(id: $deploymentId) {
109
+ url
110
+ status
111
+ error
112
+ startupTime
113
+ }
114
+ }
115
+ `,Ot=(e=>(e.Pending="PENDING",e.Deployed="DEPLOYED",e.Failed="FAILED",e.Cancelled="CANCELLED",e))(Ot||{});async function ds(e,t){let{config:r,logger:o,timeoutInSeconds:n,hooks:i}=e,s={deploymentId:t};i?.onDeploymentCompletedVerificationStart?.(),$("Verifying deployment completed...",o);let a=Date.now(),c=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)),u()},u=async()=>{let f=(await me({query:cs,api:"Oxygen",url:`${r.deploymentUrl}/api/v2/admin/graphql`,token:r.deploymentToken.accessToken,variables:s,addedHeaders:{[ue.OxygenNamespaceHandle]:r.deploymentToken.namespace}})).deploymentVerificationDetails;if(f==null)throw i?.onDeploymentCompletedVerificationError?.(),new Qe("Deployment not found");if(f.status===Ot.Deployed)return Fe("Deployment to Oxygen completed successfully",o),i?.onDeploymentCompleted?.(),f;if(f.status===Ot.Failed||f.status===Ot.Cancelled)throw i?.onDeploymentFailed?.(f),new Qe(f.error?`Deployment ${f.status.toLocaleLowerCase()}, error: ${f.error}${f.startupTime&&f.error.includes("exceeded CPU time limit")?` (Startup time: ${f.startupTime}ms exceeded CPU time limit)`:""}`:`Deployment ${f.status.toLocaleLowerCase()}`);return c()};return u()}l();import{spawn as Wl}from"child_process";import{PassThrough as Yl}from"stream";async function us(e){let{config:t,assetPath:r,hooks:o}=e,n=dt();if(o?.buildFunction){let s=performance.now();return o.buildFunction(r).then(()=>{e.metricsExporter?.add(ne.BuildTime,performance.now()-s)}).catch(a=>{throw new Error(`Build function failed with error: ${a}`)})}let i=r?{HYDROGEN_ASSET_BASE_URL:r}:{};try{await new Promise((s,a)=>{let c="",u=new Yl;u.on("data",m=>{c+=m,process.stderr.write(m)});let d=performance.now(),f=Wl(t.buildCommand,[],{stdio:["inherit","pipe","pipe"],env:{...process.env,...i},cwd:t.rootPath,shell:!0});f.stderr?.pipe(u),f.stdout?.pipe(u),f.on("close",m=>{if(m===0&&e.metricsExporter?.add(ne.BuildTime,performance.now()-d),n?.addMetadata("buildCommand",{command:t.buildCommand,stderr:c,code:m}),m!==0){a(m);return}s(m)})})}catch(s){throw new Error(`Build failed with error code: ${s}`)}}l();async function fs(e,t){let r=zt(),o=r.metadata??{};try{let n=await zl(e.rootPath);o.actor||(o.actor=n.author_name),o.commitDate||(o.commitDate=n.date),o.commitMessage||(o.commitMessage=n.message),n.branch&&(o.branch=n.branch),n.hash&&(o.commitSha=n.hash)}catch{B("Could not retrieve Git history, commit message will be unavailable.",t)}return{name:r.isCI?r.name:"none",...o,actor:e.metadata.user??o.actor,commitMessage:Jl(e.metadata.description??o.commitMessage),commitSha:e.metadata.version??o.commitSha,hydrogenVersion:e.metadata.hydrogenVersion,url:e.metadata.url??o.url}}async function zl(e){let t=await Jt(e),r=(/HEAD -> ([^,]*)/.exec(t.refs)||[])[1],o=process.env.GITHUB_HEAD_REF;if(!o)return{...t,branch:r};let n=/Merge ([\w\d]+) into [\w\d]+/.exec(t.message);return{...t,branch:o,hash:n?n[1]:t.hash}}function Jl(e){if(!e)return;let t=e.split(/\r?\n/)[0]?.trim()||"",r=JSON.stringify(t),o=!1;for(;r.length>ct;){let n=t.lastIndexOf(" ",ct-3);t=`${t.substring(0,n>-1?n:ct-3)}`.trimEnd(),o=!0,r=JSON.stringify(t)}return o?`${t}...`:t}function ms(e,t){if(e.defaultEnvironment)return;let r=e.environmentTag||t.branch;return r?{tag:r}:void 0}function ps(e){let t=[],r=(n,i)=>{let s=JSON.stringify(i);if(s.length>ct)throw new Error(`Provided ${n} metadata exceeds maximum length (max ${ct} 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 o={actor:"user",branch:"branch",commitDate:"commit-date",commitMessage:"description",commitSha:"version",hydrogenVersion:"hydrogen-version",url:"url"};for(let[n,i]of Object.entries(o)){let s=n;e[s]&&r(i,e[s])}return t}async function hs(e){let t=performance.now();Vi(!e.config.bugsnag);let r=dt();r?.addMetadata("config",{...e.config,deploymentToken:{...e.config.deploymentToken,accessToken:"***"},rootPath:"***"});let{config:o,hooks:n}=e,i=e.logger??Fo,s={},a,c,u;try{let d=await fs(o,i),f=ps(d),m=ms(o,d);if(r?.addMetadata("metadata",{environment:m,labels:f,metadata:d}),u=new Rr({ciProvider:d.name||"unknown",rootPath:o.rootPath}),!o.workerOnly&&!o.skipBuild){let g=await Wi({config:o,environment:m,labels:f,logger:i});s.id=g.build.id,s.assetPath=g.build.assetPath}o.skipBuild||(await us({config:o,assetPath:s.assetPath,hooks:n,metricsExporter:u}),await Hi({config:o,performedBuild:!0})),a=!0;let h=await Qi(o,u);r?.addMetadata("manifest",h);let w=s.id?{buildId:s.id,manifest:h}:{environment:m,manifest:h,labels:f};c=await Xi({config:o,input:w,logger:i}),await is({config:o,targets:c.deploymentTargets,hooks:n,logger:i,metricsExporter:u});let y=performance.now(),b=await es(o,c.deployment.id);u.add(ne.TotalTime,performance.now()-t),await ds({config:o,hooks:n,logger:i,timeoutInSeconds:c.deploymentConfiguration.timeoutInSeconds},c.deployment.id),u.add(ne.DeploymentCompletedTime,performance.now()-y),o.skipVerification||(await ts({config:o,url:b.deployment.url,logger:i,hooks:n}),u.add(ne.DeploymentRoutableTime,performance.now()-y));let v={url:b.deployment.url},p=`
116
+ The deployment can be reached at the ${v.url} preview URL`;return b.authBypassToken&&(v.authBypassToken=b.authBypassToken,p+=`. The auth bypass token for the deployment is ${v.authBypassToken}`),xn(p,i),v}catch(d){return o.bugsnag&&r&&(d instanceof Error||typeof d=="string")&&r.notify(Gi(d,o.rootPath)),d instanceof Error?(d instanceof ut||d instanceof Qe?B(d.message,i):s.id&&!a?(B(`Build failed with: ${d.message}, cancelling build.`,i),await zi({config:o,buildId:s.id,reason:d.message,logger:i}).catch(f=>{f instanceof Error&&B(`Failed to cancel build: ${f.message}`,i)})):c?.deployment.id&&(B(`Deployment failed with: ${d.message}, cancelling deployment.`,i),await os({config:o,deploymentId:c.deployment.id,reason:d.message,logger:i}).catch(f=>{f instanceof Error&&B(`Failed to cancel deployment: ${f.message}`,i)})),Promise.reject(d)):(console.error("Unknown error",d),Promise.reject(new Error("Unknown error")))}finally{u?.export()}}import{createRequire as Kl}from"node:module";l();l();l();function gs(e){let{storeFqdn:t}=e;return`https://${t}/admin/custom_storefronts/new`}function ys(e){let{storeFqdn:t}=e;return`https://${t}/admin/custom_storefronts`}function ft({session:e,storefront:t,cliCommand:r}){Re({name:"NoStorefrontError",type:0,message:z`${Ee.errorText("Couldn\u2019t find Hydrogen storefront.")}`.value,skipOclifErrorHandling:!0,tryMessage:z`Couldn’t find ${t.title} (ID: ${nt(t.id)}) on ${e.storeFqdn}. Check that the storefront exists and run ${Ee.genericShellCommand(`${r} link`)} to link this project to it.\n\n${Ee.link("Hydrogen Storefronts Admin",ys(e))}`.value})}function ws({noStorefronts:e=!1}){V({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."]})}l();var Ql=`#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 vs(e,t){let{hydrogenStorefront:r}=await ot(Ql,e,{id:t});return{storefront:r}}l();async function He({root:e,session:t,config:r,cliCommand:o}){let n=await zn(t),i=r.storefront?.id?n.find(({id:s})=>s===r.storefront.id):void 0;return i||(ws({noStorefronts:!n.length}),await fi(e,t,r,{force:!0,cliCommand:o,storefronts:n}))}async function bs({root:e}){let[{session:t,config:r},o]=await Promise.all([ge(e),W()]),n=await He({root:e,session:t,config:r,cliCommand:o});if(!n)return;r.storefront=n;let{storefront:i}=await vs(t,r.storefront.id);if(!i){ft({session:t,storefront:r.storefront,cliCommand:o});return}if(!i.oxygenDeploymentToken){B("Could not retrieve a deployment token.");return}return i}var ks="h2_deploy_log.json",Xl="node --run build",Zl=(e,t="info")=>{(t==="error"||t==="warn")&&B(e)},Ar=class e extends T{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={...k.entry,...k.env,...k.envBranch,...we(k.envFile,{"env-file":{description:"Path to an environment file to override existing environment variables for the deployment.",default:void 0}}),preview:te.Flags.boolean({description:"Deploys to the Preview environment.",required:!1,default:!1}),force:te.Flags.boolean({char:"f",description:"Forces a deployment to proceed if there are uncommitted changes in its Git repository.",default:!1,env:"SHOPIFY_HYDROGEN_FLAG_FORCE",required:!1}),"no-verify":te.Flags.boolean({description:"Skip the routability verification step after deployment.",default:!1,required:!1}),"auth-bypass-token":te.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":te.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":te.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":te.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":te.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}),...k.lockfileCheck,...k.path,...k.shop,"json-output":te.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:te.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":te.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":te.Flags.string({required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_URL",hidden:!0}),"metadata-user":te.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":te.Flags.string({required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_VERSION",hidden:!0}),"force-client-sourcemap":te.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),r=this.flagsToOxygenDeploymentOptions(t);await ec(r),process.exit(0)}flagsToOxygenDeploymentOptions(t){return{...U(t),defaultEnvironment:t.preview,environmentFile:t["env-file"],path:t.path?D(t.path):process.cwd()}}};function Es(e){return new E(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 ec(e){let{authBypassTokenDuration:t,authBypassToken:r,buildCommand:o,defaultEnvironment:n,env:i,envBranch:s,environmentFile:a,force:c,forceClientSourcemap:u=!1,noVerify:d,lockfileCheck:f,jsonOutput:m,path:h,shop:w,assetsDir:y,metadataUrl:b,metadataUser:v,metadataVersion:p,entry:g,workerDir:S}=e,{metadataDescription:C}=e,O=!0;try{await Rn(h)}catch(R){if(R instanceof _n&&(O=!1),!c&&!O){let J="Uncommitted changes detected",Ce,vt=[["Commit your changes before deploying or use the",{command:"--force"},"flag to deploy with uncommitted changes."]];try{Ce=(await Et("git status -s",{cwd:h})).stdout}catch{}throw Ce&&(J+=`:
129
+
130
+ ${Ce.trimEnd()}`,wr.forEach(({name:mo,lockfile:po,alternativeLockfiles:el,installCommand:tl})=>{let ln=[po,...el||[]].find(rl=>Ce.includes(rl));ln&&vt.push([`If you are using ${mo}, try running`,{command:tl},`to avoid changes to ${ln}.`])})),new E(J,null,vt)}}let P=zt().isCI,A=e.token,F,I,_,L,j;try{j=await Jt(h),F=(/HEAD -> ([^,]*)/.exec(j.refs)||[])[1],I=j.hash}catch{B("Could not retrieve Git history."),F=void 0}!C&&!O&&(q({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."]}),C=`${I} with additional changes`);let oe;if(a){let{variables:R}=await fr(a);oe=Object.entries(R).map(([J,Ce])=>({isSecret:!0,key:J,value:Ce}))}let le=null,_e=!1;if(P&&i)throw new E("Can't specify an environment handle in CI","Environments are automatically picked up by the current Git branch.");if(P&&s&&(le=s),!P){if(_=await bs({root:h,flagShop:w}),!_)return;A=A||_.oxygenDeploymentToken,i?(le=at(_.environments||[],i).branch,le===null&&(_e=!0)):s&&(le=Pt(_.environments||[],s).branch)}if(!A){let R=P?["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 E(R)}if(!P&&!n&&!i&&!s&&_?.environments)if(_.environments.length>1){let J=mr(_.environments).map(({name:Ce,branch:vt,handle:mo,type:po})=>({label:ze(Ce,mo,vt),value:po==="PREVIEW"?"shopify-preview-environment.":vt}));L=await $e({message:"Select an environment to deploy to",choices:J,defaultValue:F})}else $(`Using current checked out branch ${F} as environment tag`);let Lt="https://oxygen.shopifyapps.com";process.env.UNSAFE_SHOPIFY_HYDROGEN_DEPLOYMENT_URL&&(Lt=process.env.UNSAFE_SHOPIFY_HYDROGEN_DEPLOYMENT_URL,B("Using a custom deployment service. Don't do this in production!"));let Mt=F;L==="shopify-preview-environment."&&(Mt=void 0,L=void 0,_e=!0);let Be="dist/client",Y="dist/worker",fe=await rt(h),Ht=oc({appPath:h}),uo=!o&&!fe&&(y||S||rc(Ht));if(fe)Be=y??Be,Y=S??Y;else{let R=await he(h,g).catch(()=>null),J=await tc({root:h,viteConfig:R,assetsDir:y,workerDir:S});Be=J.assetsDir,Y=J.workerDir}let Ve={assetsDir:Be,bugsnag:!0,deploymentUrl:Lt,defaultEnvironment:n||_e,deploymentToken:jo(A),environmentTag:le||L||Mt,generateAuthBypassToken:r,authBypassTokenDuration:t,verificationMaxDuration:180,metadata:{...C?{description:C}:{},...b?{url:b}:{},...v?{user:v}:{},...p?{version:p}:{},...Ht?{hydrogenVersion:Ht}:{}},skipVerification:d,rootPath:h,skipBuild:!1,workerOnly:!1,workerDir:Y,overriddenEnvironmentVariables:oe};if(!P&&!Ve.defaultEnvironment&&(le||L)){let R=Pt(_.environments,Ve.environmentTag),J=`Creating a deployment against ${ze(R.name,R.handle,R.branch)}`;if(!await Te({confirmationMessage:"Yes, confirm deploy",cancellationMessage:"No, cancel deploy",message:z`${J}
131
+
132
+ Continue?`.value}))return}let rn,Ja=new Promise(R=>{rn=R}),on,Qa=new Promise(R=>{on=R}),nn,Ka=new Promise(R=>{nn=R}),wt=null,sn,fo,Xa=new Promise((R,J)=>{sn=R,fo=J}),an={onDeploymentCompleted:()=>nn(),onVerificationComplete:()=>on(),onDeploymentCompletedVerificationError(){wt=new E("Unable to verify the deployment was completed successfully","Please verify the deployment status in the Shopify Admin and retry deploying if necessary.")},onDeploymentFailed:R=>{wt=Es(R.error||R.status)},onUploadFilesStart:()=>Za(),onUploadFilesComplete:()=>rn(),onVerificationError:R=>{wt=new E(R.message,"Please verify the deployment status in the Shopify Admin and retry deploying if necessary.")},onUploadFilesError:R=>{wt=new E(R.message,"Check your connection and try again. If the problem persists, try again later or contact support.")}};o||uo?(u&&(console.log(""),V({headline:"The `--force-client-sourcemap` flag is not supported with a custom build command",body:"Client sourcemaps will not be generated."})),Ve.buildCommand=o??Xl):an.buildFunction=async R=>{if($(z`${M.whiteBright("Building project...")}`.value),fe)throw new E(Pe);await Je({directory:h,assetPath:R,lockfileCheck:f,sourcemap:!0,forceClientSourcemap:u,useCodegen:!1,entry:g})};let Za=async()=>{$(z`${M.whiteBright(`Deploying to Oxygen..
133
+ `)}`.value),await ee([{title:"Uploading files",task:async()=>await Ja},{title:"Verifying deployment has been completed",task:async()=>await Ka},{title:"Verifying deployment is routable",task:async()=>await Qa,skip:()=>d}])};return await hs({config:Ve,hooks:an,logger:Zl}).then(async R=>{if(!R){fo(Es());return}let J=[];P?m&&J.push(["View the deployment information in",{subdued:ks}]):(J.push(["Open",{link:{url:R.url}},"in your browser to view your deployment."]),R?.authBypassToken&&J.push(["Use the",{subdued:R.authBypassToken},"token to perform end-to-end tests against the deployment."])),N({body:["Successfully deployed to Oxygen"],nextSteps:J}),P&&m&&await Q(ks,JSON.stringify(R)),sn()}).catch(R=>{fo(wt||R)}),Xa}async function tc({root:e,viteConfig:t,assetsDir:r,workerDir:o}){let n={assetsDir:"dist/client",workerDir:"dist/server"},i=t?{assetsDir:ie(e,t.clientOutDir),workerDir:ie(e,t.serverOutDir)}:void 0;return{assetsDir:r??i?.assetsDir??n.assetsDir,workerDir:o??i?.workerDir??n.workerDir}}function rc(e){return e?.startsWith("0.0.0-preview-")??!1}function oc({appPath:e}){let{root:t}=xe(e);try{let r=Kl(import.meta.url),o=r(r.resolve("@shopify/hydrogen/package.json",{paths:[t]}));return typeof o.version=="string"?o.version:void 0}catch{return}}l();var $t=K(pe(),1);l();var re=K(ol(),1);import{createRequire as nc}from"node:module";var Lo=K(pe(),1);function Ds(e){return[...e.removeDependencies,...e.removeDevDependencies]}var Ss=".hydrogen",Fr=class e extends T{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={...k.path,version:Lo.Flags.string({description:"A target hydrogen version to update to",required:!1,char:"v"}),force:Lo.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 ic({...U(t),appPath:t.path?D(t.path):process.cwd()})}},_t=null;async function ic({appPath:e,version:t,force:r}){if(t==="next"){let h=process.env.SHOPIFY_UNIT_TEST==="1",w=Ct();if(!await sc()&&!h&&!w)throw new E("--version=next is only available when running from the Hydrogen monorepo","This feature is designed for internal development and testing of unreleased versions")}r||(await lc(e),await cc(e));let{currentVersion:o,currentDependencies:n}=await Cs({appPath:e});if(t==="next"){let h=n["@shopify/hydrogen"]==="next",w=n["@shopify/mini-oxygen"]==="next";if(h||w)throw new E("Project already uses next versions",'Cannot upgrade to --version=next when @shopify/hydrogen or @shopify/mini-oxygen are already using "next" versions')}if(re.default.prerelease(o))throw new E("The upgrade command cannot be run over a prerelease Hydrogen version");let s=await Ts(),{availableUpgrades:a}=Os({releases:s.releases,currentVersion:o,currentDependencies:n});if(!a?.length){N({headline:`You are on the latest Hydrogen version: ${H(o)}`});return}let c=!1,u,d;do u=await uc({currentVersion:o,targetVersion:t,availableUpgrades:a,currentDependencies:n}),d=fc({availableUpgrades:a,currentVersion:o,currentDependencies:n,selectedRelease:u}),c=await mc({cumulativeRelease:d,selectedRelease:u,targetVersion:t});while(!c);let f=Ec({appPath:e,cumulativeRelease:d,currentVersion:o,selectedRelease:u});await hc({appPath:e,selectedRelease:u,currentDependencies:n,targetVersion:t,cumulativeRemoveDependencies:d.removeDependencies,cumulativeRemoveDevDependencies:d.removeDevDependencies,cumulativeDependencies:d.dependencies,cumulativeDevDependencies:d.devDependencies}),await kc({appPath:e,selectedRelease:u,targetVersion:t});let m=await f;await bc({appPath:e,currentVersion:o,instrunctionsFilePath:m,selectedRelease:u})}async function sc(){try{let e=process.cwd(),t=[e,x(e,"../"),x(e,"../../")];for(let r of t)try{let o=x(r,"templates/skeleton"),n=x(r,"packages/cli"),i=await Vt(o),s=await Vt(n);if(i&&s)return!0}catch{continue}return!1}catch{return!1}}function ac(e){let t={...e.dependencies},r={...e.devDependencies??{}};return t["@shopify/hydrogen"]&&(t["@shopify/hydrogen"]="next"),r["@shopify/mini-oxygen"]&&(r["@shopify/mini-oxygen"]="next"),{...e,title:`${e.title} (next versions)`,dependencies:t,devDependencies:r}}function lc(e){return On(e).catch(()=>{throw new E("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 cc(e){if(!await $n(e))throw new E("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 Cs({appPath:e}){let{root:t}=xe(e),r=x(t,"package.json"),o;try{o=JSON.parse(await de(r))}catch{throw new E("Could not find a valid package.json","Please make sure you are running the command in a npm project")}let n={...o?.dependencies,...o?.devDependencies},i=n["@shopify/hydrogen"];if(!i)throw new E("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 Ts(){if(_t)return _t;if(process.env.FORCE_CHANGELOG_SOURCE==="local"||Ie&&Se&&process.env.FORCE_CHANGELOG_SOURCE!=="remote"){let e=nc(import.meta.url),t=Ie&&Se?x(ho(Se),"docs","changelog.json"):x(process.cwd(),"docs","changelog.json");try{let r=e(t);return _t=r,r}catch(r){if(console.warn(`Failed to load local changelog from ${t}:`,r.message),process.env.FORCE_CHANGELOG_SOURCE==="local")throw new E("Failed to load local changelog",`Could not read changelog from ${t}`)}}try{let e=await se("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 _t=t,_t}catch{}throw new E("Failed to fetch Hydrogen changelog","Ensure you have internet connection and try again")}function Is({release:e,currentDependencies:t}){return Object.entries({...e.dependencies,...e.devDependencies??{}}).some(([r,o])=>{if(r==="@shopify/cli")return!1;let n=t?.[r];return n?re.default.gt(H(o),H(n)):!1})}function dc({currentDependencies:e,currentPinnedVersion:t,release:r}){return re.default.gt(r.version,t)?!0:H(r.version)===t?Is({release:r,currentDependencies:e}):!1}function Os({releases:e,currentVersion:t,currentDependencies:r}){let o=H(t),n="",i=e.filter(a=>dc({release:a,currentPinnedVersion:o,currentDependencies:r})&&n!==a.version?(n=a.version,!0):!1),s=i.reduce((a,c)=>(a[c.version]||(a[c.version]=c),a),{});return{availableUpgrades:i,uniqueAvailableUpgrades:s}}async function uc({targetVersion:e,availableUpgrades:t,currentVersion:r,currentDependencies:o}){return(e?e==="next"?ac(t[0]):t.find(i=>H(i.version)===H(e)):void 0)??vc(r,t)}function fc({availableUpgrades:e,selectedRelease:t,currentVersion:r,currentDependencies:o}){let n=H(r),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(p=>re.default.gt(p.version,n)&&re.default.lte(p.version,t.version)?!0:!(H(p.version)===n)||!o?!1:Is({release:p,currentDependencies:o})),a=s.flatMap(p=>p.features),c=s.flatMap(p=>p.fixes),u=[...s].sort((p,g)=>re.default.compare(p.version,g.version)),d=new Map,f=new Map;u.forEach((p,g)=>{p.removeDependencies?.forEach(S=>{d.set(S,g)}),p.removeDevDependencies?.forEach(S=>{f.set(S,g)})});let m=new Set,h=new Set;for(let p=0;p<u.length;p++){let g=u[p];if(!g)continue;let S=g.dependencies??{},C=g.devDependencies??{};Object.keys(S).forEach(O=>{let P=d.get(O);P!==void 0&&p>=P&&m.add(O)}),Object.keys(C).forEach(O=>{let P=f.get(O);P!==void 0&&p>=P&&h.add(O)})}let w=[...new Set(u.flatMap(p=>p.removeDependencies??[]).filter(p=>!m.has(p)))],y=[...new Set(u.flatMap(p=>p.removeDevDependencies??[]).filter(p=>!h.has(p)))],b={},v={};for(let p of u)Object.assign(b,p.dependencies??{}),Object.assign(v,p.devDependencies??{});return{features:a,fixes:c,removeDependencies:w,removeDevDependencies:y,dependencies:b,devDependencies:v}}function mc({cumulativeRelease:e,selectedRelease:t,targetVersion:r}){let{features:o,fixes:n}=e,i=Ds(e);return(o.length||n.length||i.length)&&V({headline:"Included in this upgrade:",customSections:[o.length&&{title:"Features",body:[{list:{items:o.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)}),r==="next"?!0:Te({message:`Are you sure you want to upgrade to ${t.version}?`,cancellationMessage:"No, choose another version",defaultValue:!0})}function jr([e]){return!!e.includes("@remix-run")}function Mo([e]){return!!e.includes("react-router")}function xs(e,t,r){return r==="next"&&(e==="@shopify/hydrogen"||e==="@shopify/mini-oxygen")?"next":H(t)}function Ps({currentDependencies:e,dependency:[t,r],selectedRelease:o,targetVersion:n}){let i=e[t];return jr([t,r])||Mo([t,r])||i==="next"&&!(n==="next")?!1:o.dependenciesMeta?.[t]?!o.dependenciesMeta?.[t]?.required?!1:!!(!i||n==="next"&&(t==="@shopify/hydrogen"||t==="@shopify/mini-oxygen")||re.default.lt(H(i),H(r))):!0}function pc({selectedRelease:e,currentDependencies:t,targetVersion:r,cumulativeDependencies:o,cumulativeDevDependencies:n}){let i=[],s={...o??{},...e.dependencies},a={...n??{},...e.devDependencies??{}};for(let m of Object.entries(s))Ps({currentDependencies:t,dependency:m,selectedRelease:e,targetVersion:r})&&i.push(`${m[0]}@${xs(m[0],m[1],r)}`);for(let m of Object.entries(a))Ps({currentDependencies:t,dependency:m,selectedRelease:e,targetVersion:r})&&i.push(`${m[0]}@${xs(m[0],m[1],r)}`);let c=Object.entries(t).find(jr),u=Object.entries(s).find(jr);c&&u&&re.default.lt(H(c[1]),H(u[1]))&&i.push(...yc({currentDependencies:t,selectedRemix:u}));let d=Object.entries(t).find(Mo),f=Object.entries(s).find(Mo);return f&&(!d||re.default.lt(H(d[1]),H(f[1])))&&i.push(...wc({currentDependencies:t,selectedReactRouter:f})),i}async function hc({appPath:e,selectedRelease:t,currentDependencies:r,targetVersion:o,cumulativeRemoveDependencies:n,cumulativeRemoveDevDependencies:i,cumulativeDependencies:s,cumulativeDevDependencies:a}){let c=[],u=[...n,...i].filter(f=>f in r);u.length>0&&c.push({title:"Removing deprecated dependencies",task:async()=>{await gc({directory:e,packageManager:await ke(e),args:u})}});let d=pc({selectedRelease:t,currentDependencies:r,targetVersion:o,cumulativeDependencies:s,cumulativeDevDependencies:a});d.length>0&&c.push({title:"Upgrading dependencies",task:async()=>{let f=await ke(e),m=f==="npm"?"install":f==="yarn"||f==="pnpm"?"add":"install",h=f==="npm"||f==="unknown"?["--legacy-peer-deps"]:[];await bo(_s(f),[m,...h,...d],{cwd:e})}}),c.length>0&&await ee(c,{})}function _s(e){return e==="unknown"?"npm":e}async function gc({directory:e,packageManager:t,args:r}){if(r.length===0)return;let o=t==="npm"?"uninstall":t==="yarn"||t==="pnpm"||t==="bun"?"remove":"uninstall",n=t==="npm"||t==="unknown"?["--legacy-peer-deps"]:[];await bo(_s(t),[o,...n,...r],{cwd:e})}function yc({currentDependencies:e,selectedRemix:t}){let r=[];for(let[o,n]of Object.entries(e))jr([o,n])&&r.push(`${o}@${H(t[1])}`);return r}function wc({currentDependencies:e,selectedReactRouter:t}){let r=[],o=H(t[1]),n=["react-router","react-router-dom","@react-router/dev","@react-router/fs-routes"];for(let i of n)r.push(`${i}@${o}`);return r}function H(e){if(e==="next")return"next";if(e.match(/^[\^~]?0\.0\.0-next-([a-f0-9]+)-(\d+)$/))return e.replace(/^[\^~]?/,"");let r=re.default.minVersion(e);if(!r)throw new E(`Invalid version: ${e}`);return r.version}async function vc(e,t){if(!t?.length)throw new E("No upgrade options available");let r=t.map((o,n)=>{let{version:i,title:s}=o,a=n===0?"(latest)":re.default.patch(i)===0?"(major)":H(e)===H(i)?"(outdated)":"";return`${re.default.major(i)}${re.default.minor(i)}`,{label:`${i} ${a} - ${hi(s,54)}`,value:o}});return $e({message:`Available Hydrogen versions (current: ${e})`,choices:r,defaultValue:r[0]?.value})}async function bc({appPath:e,currentVersion:t,selectedRelease:r,instrunctionsFilePath:o}){let n=[...Object.entries(r.dependencies||{}).map(([h,w])=>`${h}@${w}`),...Object.entries(r.devDependencies||{}).map(([h,w])=>`${h}@${w}`)],i=[];if(typeof o=="string"){let h=`Upgrade instructions created at:
134
+ file://${o}`;i.push(h)}let s=`https://hydrogen.shopify.dev/releases/${r.version}`;i.push(`Release notes:
135
+ ${s}`);let a=H(t),c=H(r.version),u=a===c,d=`${a} \u2192 ${c}`,f=u?`You've upgraded Hydrogen ${c} dependencies`:`You've upgraded from ${d}`,m=await ke(e);return N({headline:f,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 kc({appPath:e,selectedRelease:t,targetVersion:r}){let n=(await vn(x(e,"package.json")))["@shopify/hydrogen"];if(!n)throw new E("Hydrogen version not found in package.json");let i=H(n);i.match(/^0\.0\.0-next-[a-f0-9]+-\d+$/);let s=t.dependencies?.["@shopify/hydrogen"]==="next";if(!(r==="next"&&s)&&i!==t.version)throw new E(`Failed to upgrade to Hydrogen version ${t.version}`,`You are still on version ${i}`)}function No(e){let{steps:t}=e,r=`### ${e.title} [#${e.id}](${e.pr})
136
+ `,o=t?.map((n,i)=>{let s=e.pr?`[#${e.id}](${e.pr})
137
+ `:"",c=t.length>1?`#### Step: ${i+1}. ${n.title} ${s}
138
+ `:`#### ${n.title.trim()}
139
+ `,u=n.info?`> ${n.info}
140
+ `:"",d=n.code?`${Buffer.from(n.code,"base64")}
141
+ `:"",f=e.docs?`[docs](${e.docs})
142
+ `:"";return`${c}${u}${f}${s}${d}`}).join(`
143
+ `);return`${r}
144
+ ${o}`}async function Ec({appPath:e,cumulativeRelease:t,currentVersion:r,selectedRelease:o}){let n="",{featuresMd:i,breakingChangesMd:s}=t.features.filter(y=>y.steps).reduce((y,b)=>(b.breaking?y.breakingChangesMd.push(No(b)):y.featuresMd.push(No(b)),y),{featuresMd:[],breakingChangesMd:[]}),a=t.fixes.filter(y=>y.steps).map(No),c=Ds(t);if(!i.length&&!a.length&&!s.length&&!c.length){V({headline:"No upgrade instructions generated",body:"There are no additional upgrade instructions for this version."});return}let u=H(r),d=H(o.version);n=`upgrade-${u}-to-${d}.md`;let f=x(e,Ss),h=`${`# Hydrogen upgrade guide: ${u} to ${d}`}
145
+
146
+ ----
147
+ `;s.length&&(h+=`
148
+ ## Breaking changes
149
+
150
+ ${s.join(`
151
+ `)}
152
+ ----
153
+ `),i.length&&(h+=`
154
+ ## Features
155
+
156
+ ${i.join(`
157
+ `)}
158
+ ----
159
+ `),a.length&&(h+=`
160
+ ${i.length?`----
161
+
162
+ `:""}## Fixes
163
+
164
+ ${a.join(`
165
+ `)}`),c.length&&(h+=a.length?`
166
+
167
+ ----
168
+
169
+ `:`
170
+ `,h+=`## Removed packages
171
+
172
+ The following packages have been removed as part of this upgrade:
173
+
174
+ `,h+=c.map(y=>`- \`${y}\``).join(`
175
+ `),h+=`
176
+ `);let w=x(f,n);try{await Vt(f)}catch{await bt(f)}if(!await G(w))await go(w);else{if(await Te({message:`A previous upgrade instructions file already exists for this version.
177
+ Do you want to overwrite it?`,defaultValue:!1}))await be(`${w}.old`);else return;await go(w)}return await Q(w,h),`${Ss}/${n}`}async function Rs({targetPath:e}){try{let t=e?D(e):process.cwd(),{currentVersion:r,currentDependencies:o}=await Cs({appPath:t});if(r.startsWith("workspace:")){V({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(re.default.prerelease(r)||/^[a-z]+$/i.test(r))return;let i=await Ts(),{availableUpgrades:s,uniqueAvailableUpgrades:a}=Os({releases:i.releases,currentVersion:r,currentDependencies:o});if(s.length===0||!s[0]?.version)return;let c=H(s[0].version),u=H(r),d=u===c,f=d?i.releases.findIndex(b=>H(b.version)!==u):i.releases.findIndex(b=>H(b.version)===u),m;if(f===-1){let b=i.releases.findIndex(v=>re.default.lte(H(v.version),u));m=b===-1?i.releases:i.releases.slice(0,b)}else m=i.releases.slice(0,f);let h=Object.values([...m].reverse().reduce((b,v)=>(b[v.version]??=`${v.version} - ${v.title}`,b),{})).reverse().slice(0,5),w=Object.keys(a).length>1?`There are ${Object.keys(a).length} new @shopify/hydrogen versions available.`:"There's a new @shopify/hydrogen version available.",y=await W();V({headline:w,body:[`Current: ${r} | Latest: ${c}`+(d?" with updated dependencies":"")],customSections:[...h.length>0?[{title:`The next ${h.length} version(s) include`,body:[{list:{items:[...h,s.length>5?"...more":""].flat().filter(Boolean)}}].filter(Boolean)}]:[],{title:"Next steps",body:[{list:{items:[`Run \`${y} upgrade\` or \`${y} upgrade --version ${m[0]?.version??"<version>"}\``,"Read release notes at https://hydrogen.shopify.dev/releases"]}}]}]})}catch(t){let r=t;q({headline:r.message,body:r.tryMessage??void 0})}}l();l();import Sc from"node:net";import xc from"node:os";var Mr=class extends Error{constructor(t){super(`${t} is locked`)}},mt={old:new Set,young:new Set},Pc=1e3*15,Nr=1024,Lr=65535,Rt,Dc=()=>{let e=xc.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let o of r)t.add(o.address);return t},$s=e=>new Promise((t,r)=>{let o=Sc.createServer();o.unref(),o.on("error",r),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{t(n)})})}),As=async(e,t)=>{if(e.host||e.port===0)return $s(e);for(let r of t)try{await $s({port:e.port,host:r})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},Cc=function*(e){e&&(yield*e),yield 0};async function Ho(e){let t,r=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`)}r=new Set(n)}Rt===void 0&&(Rt=setTimeout(()=>{Rt=void 0,mt.old=mt.young,mt.young=new Set},Pc),Rt.unref&&Rt.unref());let o=Dc();for(let n of Cc(t))try{if(r.has(n))continue;let i=await As({...e,port:n},o);for(;mt.old.has(i)||mt.young.has(i);){if(n!==0)throw new Mr(n);i=await As({...e,port:n},o)}return mt.young.add(i),i}catch(i){if(!["EADDRINUSE","EACCES"].includes(i.code)&&!(i instanceof Mr))throw i}throw new Error("No available ports found")}function Fs(e,t){if(!Number.isInteger(e)||!Number.isInteger(t))throw new TypeError("`from` and `to` must be integer numbers");if(e<Nr||e>Lr)throw new RangeError(`'from' must be between ${Nr} and ${Lr}`);if(t<Nr||t>Lr)throw new RangeError(`'to' must be between ${Nr} and ${Lr}`);if(e>t)throw new RangeError("`to` must be greater than or equal to `from`");return function*(o,n){for(let i=o;i<=n;i++)yield i}(e,t)}function pt(e,t=100){return Ho({port:Fs(e,e+t)})}l();var Uo=new Set,Bo;function js({disableDepsOptimizer:e,showSuccessBanner:t,configFile:r,formatOptionsPromise:o}){return async function({optimizableDependency:i,stack:s}){let a=s.split(`
178
+ `)[0]??s,c=s.split(`
179
+ `).filter(d=>!d.includes("virtual:remix")).join(`
180
+ `),u="MiniOxygen encountered an error while running your app's entry point";if(i)if(e||!r){let d=new Yt(`${u}:
181
+
182
+ ${M.dim(a)}`,`Try adding '${M.yellow(i)}' to your Vite config in ssr.optimizeDeps.include`);d.stack=c,Re(d)}else Uo.has(i)||(Uo.add(i),setTimeout(()=>Uo.delete(i),2e3),Ic(i,r,await o,c).then(()=>{setTimeout(()=>{$(`
183
+ Added '${M.yellow(i)}' to your Vite config in ssr.optimizeDeps.include
184
+ `)},200),clearTimeout(Bo),Bo=setTimeout(t,2e3)}).catch(d=>{clearTimeout(Bo),Re(d)}));else{let d=new Yt(u+`:
185
+
186
+ `+M.dim(a));d.stack=c,Re(d)}}}var Tc={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 Ic(e,t,r,o){let n=cn(t).replace(/^\.m?/,""),i=await Qt(n);await je(t,r,s=>{let c=i.parse(s).root().find(Tc);if(!c)throw new E(`The dependency '${M.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
+ `+M.yellow(`ssr: {optimizeDeps: {include: ['${e}']}}`));if(!!c.find({rule:{kind:"string_fragment",regex:`^${e}$`}})){let f=new Yt(`A dependency related to '${M.yellow(e)}' might need to be optimized by Vite but couldn't be configured automatically:
189
+
190
+ ${M.dim(o.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 f.stack=o,f}let{start:d}=c.range();return s.slice(0,d.index+1)+`'${e}',`+s.slice(d.index+1)})}var Hr=class e extends T{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={...k.path,...k.entry,...we(k.port,{port:{default:void 0,required:!1}}),...k.codegen,"disable-virtual-routes":$t.Flags.boolean({description:"Disable rendering fallback routes when a route file doesn't exist.",env:"SHOPIFY_HYDROGEN_FLAG_DISABLE_VIRTUAL_ROUTES",default:!1}),...k.debug,...k.inspectorPort,...k.env,...k.envBranch,...k.envFile,"disable-version-check":$t.Flags.boolean({description:"Skip the version check when running `hydrogen dev`",default:!1,required:!1}),...k.customerAccountPush,...k.verbose,host:$t.Flags.boolean({description:"Expose the server to the local network",default:!1,required:!1}),"disable-deps-optimizer":$t.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),r=t.path?D(t.path):process.cwd(),o={...U(t),customerAccountPush:t["customer-account-push"],path:r,cliConfig:this.config};if(!await er(r))throw new E(Pe);let{close:i}=await Oc(o);Me(async()=>{await i()})}};async function Oc({entry:e,port:t,path:r,host:o,codegen:n=!1,codegenConfigPath:i,disableVirtualRoutes:s,disableDepsOptimizer:a=!1,envBranch:c,env:u,debug:d=!1,disableVersionCheck:f=!1,inspectorPort:m,customerAccountPush:h=!1,envFile:w,cliConfig:y,verbose:b}){process.env.NODE_ENV||(process.env.NODE_ENV="development"),b&&rr(),or()||it(),t===0&&(t=await pt(tt));let v=r??process.cwd(),p=W(v),g=wi(v,h,w),S=g.then(({fetchRemote:Y,localVariables:fe})=>hr({root:v,envBranch:c,envHandle:u,fetchRemote:Y,localVariables:fe,envFile:w}));d&&!m&&(m=await pt(Vn));let C=await Zt(v);Se&&await be(x(v,"node_modules/.vite"));let O=Promise.resolve().then(()=>et(v)),P=await C.createServer({root:v,clearScreen:!1,cacheDir:process.env.SHOPIFY_UNIT_TEST?x(v,".vite"):void 0,customLogger:process.env.SHOPIFY_UNIT_TEST?Object.assign(C.createLogger(),{info:Y=>Ae("info",Y),warn:Y=>Ae("warn",Y),error:Y=>Ae("error",Y)}):void 0,server:{port:t??tt,host:o?!0:void 0,fs:Se?{allow:[v,Se]}:void 0},plugins:[{name:"hydrogen:cli",configResolved(Y){Do(Y)?.api?.registerPluginOptions({disableVirtualRoutes:s}),Yn(Y)?.api?.registerPluginOptions({debug:d,entry:e,envPromise:S.then(({allVariables:fe})=>fe),inspectorPort:m,logRequestLine:pi,entryPointErrorHandler:js({disableDepsOptimizer:a,configFile:Y.configFile,formatOptionsPromise:O,showSuccessBanner:()=>Ns({disableVirtualRoutes:s,debug:d,inspectorPort:m,finalHost:_e,storefrontTitle:Be})})})},configureServer:Y=>{h&&Y.middlewares.use((fe,Ht,uo)=>{let Ve=fe.headers.host;Ve?.includes(gr.ORIGINAL)&&(fe.headers.host=Ve.replace(gr.ORIGINAL,gr.REBRANDED)),uo()})}}]});if(!Do(P.config))throw await P.close(),new E("Hydrogen plugin not found.","Add `hydrogen()` plugin to your Vite config.");let F=(await he(v)).remixConfig,I,_=n?()=>{I?.kill(0),I=Sr({rootDirectory:v,configFilePath:i,appDirectory:F?.appDirectory})}:void 0;_?.(),Se&&_c(P,Se,_);let L=t??P.config.server.port??tt,[j,oe]=await Promise.all([g.then(({customerAccountPush:Y,storefrontId:fe})=>Y?vi(v,y,L,fe):void 0),p,P.listen(L)]),le=new URL(P.resolvedUrls.local[0]??P.resolvedUrls.network[0]),_e=j?.host||le.toString()||le.origin;ri({rootDirectory:v,host:_e,cliCommand:oe});let{logInjectedVariables:Lt,allVariables:Mt}=await S;Lt(),console.log(""),P.printUrls(),P.bindCLIShortcuts({print:!0}),console.log(`
194
+ `);let Be=(await g).storefrontTitle;return Ns({disableVirtualRoutes:s,debug:d,inspectorPort:m,finalHost:_e,storefrontTitle:Be}),f||Rs({targetPath:v}),h&&gi(Mt)&&yi(oe),{getUrl:()=>_e,async close(){I?.removeAllListeners("close"),I?.kill("SIGINT"),await Promise.allSettled([P.close(),j?.cleanup?.()]),P.watcher.close()}}}function Ns({disableVirtualRoutes:e,debug:t,inspectorPort:r,finalHost:o,storefrontTitle:n}){let i=[];e||i.push({body:ki(o)}),t&&r&&i.push({body:{warn:bi(r)}}),N({body:[`View ${n?M.cyan(n):"Hydrogen"} app:`,{link:{url:o}}],customSections:i})}function _c(e,t,r){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 o;e.watcher.on("change",async n=>{n.includes(t)&&(n.includes("/packages/hydrogen-codegen/")?r&&(r(),V({headline:"The Hydrogen Codegen source has been modified.",body:"The codegen process has been restarted."})):(await e.restart(!0),clearTimeout(o),o=setTimeout(()=>{console.log(""),V({headline:"The H2O Vite plugins have been modified.",body:"The Vite server has been restarted to reflect the changes."})},100)))})})}l();var Ur=class e extends T{static descriptionWithMarkdown="Lists all environments available on the linked Hydrogen storefront.";static description="List the environments on your linked Hydrogen storefront.";static flags={...k.path};async run(){let{flags:t}=await this.parse(e);await Rc(t)}};async function Rc({path:e=process.cwd()}){let[{session:t,config:r},o]=await Promise.all([ge(e),W()]),n=await He({root:e,session:t,config:r,cliCommand:o});if(!n)return;r.storefront=n;let i=await lt(t,r.storefront.id);if(!i){ft({session:t,storefront:r.storefront,cliCommand:o});return}let s=i.environments.findIndex(c=>c.type==="PREVIEW"),a=i.environments.splice(s,1);i.environments.push(a[0]),$($c({environments:i.environments,storefrontTitle:r.storefront.title}).toString()),i.environments.forEach(({name:c,handle:u,branch:d,type:f,url:m})=>{ae();let h=f==="PRODUCTION"?i.productionUrl:m;$(z`${ze(c,u,d)}`.value),h&&$(z` ${h}`.value)}),ae()}var $c=({environments:e,storefrontTitle:t})=>Ut(e,r=>`Showing ${r.length} environments for the Hydrogen storefront ${t}`,r=>`Showing 1 environment for the Hydrogen storefront ${t}`,()=>`There are no environments for the Hydrogen storefront ${t}`);l();function Ac(e){return/[{}@#\s"'\\$`|;&<>()!?*\[\]]/.test(e)||/[\x00-\x1F\x7F]/.test(e)}function Fc(e){return Ac(e)?`"${e.replaceAll("\\","\\\\").replaceAll('"','\\"').replaceAll(`
195
+ `,"\\n").replaceAll("\r","\\r").replaceAll(" ","\\t")}"`:e}var Br=class e extends T{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={...k.env,...k.envBranch,...k.envFile,...k.path,...k.force};async run(){let{flags:t}=await this.parse(e);await jc({...U(t)})}};async function jc({env:e,envBranch:t,path:r=process.cwd(),envFile:o,force:n}){let[{session:i,config:s},a]=await Promise.all([ge(r),W()]),c=await He({root:r,session:i,config:s,cliCommand:a});if(!c)return;if(s.storefront=c,e||t){let y=(await lt(i,s.storefront.id))?.environments||[];e?at(y,e):t&&(e=Pt(y,t).handle)}let u=await pr(i,s.storefront.id,e);if(!u){ft({session:i,storefront:s.storefront,cliCommand:a});return}if(!u.environmentVariables.length){$("No environment variables found.");return}let d=u.environmentVariables;if(!d.length)return;let f=M.whiteBright(o),m=D(r,o),h={};if(d.forEach(({isSecret:y,key:b,value:v})=>{h[b]=y?'""':Fc(v)}),await G(m)&&!n){let y=await de(m),b=Io(y,h);if(y===b){V({body:`No changes to your ${f} file`});return}let v=yr(y,b);if(!await Te({confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later",message:z`We'll make the following changes to your ${f} file:
196
+
197
+ ${Ee.linesDiff(v)}
198
+ Continue?`.value}))return;await Q(m,b)}else{let y=Io(null,h);await Q(m,y)}d.some(({isSecret:y})=>y)&&q({body:`${s.storefront.title} contains environment variables marked as secret, so their values weren\u2019t pulled.`}),N({body:["Changes have been made to your",{filePath:f},"file"]})}l();l();var Nc=`#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 Ls(e,t,r,o){let{hydrogenStorefrontEnvironmentVariableBulkReplace:n}=await ot(Nc,e,{storefrontId:t,environmentId:r,environmentVariablesInput:o}),{userErrors:i}=n;return{userErrors:i}}var Vr=class e extends T{static description="Push environment variables from the local .env file to your linked Hydrogen storefront.";static flags={...k.env,...k.envFile,...k.path};async run(){let{flags:t}=await this.parse(e);await Lc({...U(t)})}};async function Lc({env:e,envFile:t,path:r=process.cwd()}){let o,n=D(r,t),{variables:i}=await fr(n),[{session:s,config:a},c]=await Promise.all([ge(r),W()]),u=await He({root:r,session:s,config:a,cliCommand:c});if(!u)return;a.storefront=u;let{environments:d}=await lt(s,a.storefront.id)??{};if(!d)throw new E("Failed to fetch environments");let f=mr(d);if(f.length===0)throw new E("No environments found");if(e)o=at(f,e);else{let p=[...f.map(({id:S,name:C,branch:O,handle:P})=>({label:ze(C,P,O),value:S}))],g=await $e({message:"Select an environment to overwrite its environment variables:",choices:p});o=f.find(({id:S})=>S===g)}let{environmentVariables:m=[]}=await pr(s,a.storefront.id,o.handle)??{},w=m.filter(({isSecret:p,readOnly:g})=>!p&&!g).sort((p,g)=>p.key.localeCompare(g.key)).map(({key:p,value:g})=>Oo(p,g)).join(`
216
+ `)+`
217
+ `,y=Object.keys(i).sort((p,g)=>p.localeCompare(g)).reduce((p,g)=>{let{isSecret:S,readOnly:C}=m.find(O=>O.key===g)??{};return S||C?p:[...p,Oo(g,i[g])]},[]).join(`
218
+ `)+`
219
+ `;if(!o.name)throw new E("Missing environment name");let b=m.reduce((p,{isSecret:g,readOnly:S,key:C})=>{if(!g&&!S)return p;let O=i[C],P=m.find(A=>A.key===C);return O===P?.value?p:[...p,C]},[]);if(b.length&&B(`Variables that are read only or contain secret values cannot be pushed from the CLI: ${b.join(", ")}.
220
+ `),y===w){V({body:"No changes to your environment variables."});return}else{let p=yr(w,y);if(!await Te({confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later",message:z`We'll make the following changes to your environment variables for ${o.name}:
221
+
222
+ ${Ee.linesDiff(p)}
223
+ Continue?`.value}))return}if(!o.id)throw new E("Missing environment ID");let{userErrors:v}=await Ls(s,a.storefront.id,o.id,Object.entries(i).map(([p,g])=>({key:p,value:g})));if(v.length)throw new E("Failed to upload and save environment variables.",v[0]?.message);N({body:`Environment variables push to ${o.name??"Preview"} was successful.`})}l();l();var ht=K(pe(),1);var Oe=class e extends T{static descriptionWithMarkdown="Generates a set of default routes from the starter template.";static description="Generates a standard Shopify route.";static flags={adapter:ht.Flags.string({description:"React Router adapter used in the route. The default is `react-router`.",env:"SHOPIFY_HYDROGEN_FLAG_ADAPTER"}),typescript:ht.Flags.boolean({description:"Generate TypeScript files",env:"SHOPIFY_HYDROGEN_FLAG_TYPESCRIPT"}),"locale-param":ht.Flags.string({description:"The param name in Remix routes for the i18n locale, if any. Example: `locale` becomes ($locale).",env:"SHOPIFY_HYDROGEN_FLAG_ADAPTER"}),...k.force,...k.path};static hidden;static args={routeName:ht.Args.string({name:"routeName",description:`The route to generate. One of ${Co.join()}.`,required:!0,options:Co,env:"SHOPIFY_HYDROGEN_ARG_ROUTE"})};async run(){let{flags:t,args:{routeName:r}}=await this.parse(e),o=t.path?D(t.path):process.cwd();await Mc({...t,directory:o,routeName:r,localePrefix:t["locale-param"]})}};async function Mc(e){let{routes:t}=await si({...e,v1RouteConvention:ii()}),r=3+t.reduce((n,i)=>Math.max(n,i.destinationRoute.length),0),o=t.filter(({operation:n})=>n!=="skipped").length;N({headline:`${o} of ${t.length} route${t.length>1?"s":""} generated`,body:{list:{items:t.map(({operation:n,destinationRoute:i})=>i.padEnd(r)+M.dim(`[${n}]`))}}})}var Gr=class extends T{static description="Shortcut for `hydrogen generate`. See `hydrogen generate --help` for more information.";static strict=!1;static hidden=!0;async run(){let[t,...r]=this.argv;if(t==="r"||t==="route")return new Oe(r,this.config).run();throw new Error(`Invalid command argument "${t}".`)}};l();var qr=class e extends T{static description="Generates all supported standard shopify routes.";static hidden;static flags=Oe.flags;async run(){let{flags:t}=await this.parse(e);await Oe.run(["all",...Object.entries(t).map(([r,o])=>o===!0?`--${r}`:`--${r}=${o}`)])}};l();var Ue=K(pe(),1);l();import{fileURLToPath as Hc}from"node:url";var At={cli:"@shopify/cli",cliHydrogen:"@shopify/cli-hydrogen",createApp:"@shopify/create-hydrogen"};async function Ms(){if(Ie&&!process.env.SHOPIFY_UNIT_TEST)return;let{content:e}=await En(Hc(import.meta.url)).catch(()=>({content:void 0})),t=e?.name,r=e?.version;if(!t||!r||!Object.values(At).some(i=>i===t)||r.includes("next")||r.includes("experimental")||r.includes("snapshot"))return;let o=await bn(t,r);if(!o)return;let n=[{link:{label:"Hydrogen releases",url:"https://github.com/Shopify/hydrogen/releases"}}];return t===At.cli&&n.push({link:{label:"Global CLI reference",url:"https://shopify.dev/docs/api/shopify-cli/"}}),i=>{i??=wn(),(i==="unknown"||!i)&&(i=yn()),i==="unknown"&&(i="npm");let s=t===At.cli?`Please install the latest Shopify CLI version with \`${i==="yarn"?`yarn global add ${At.cli}`:`${i} install -g ${At.cli}`}\` and try again.`:`Please use the latest version with \`${i} create @shopify/hydrogen@latest\``;return V({headline:"Upgrade available",body:`Version ${o} of ${t} is now available.
224
+ You are currently running v${r}.
225
+
226
+ `+s,reference:n}),{currentVersion:r,newVersion:o}}}l();l();import{cp as Uc}from"node:fs/promises";async function Hs(e,t){let r=e.mockShop?"mock":await $e({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}),o=r==="link"?await ci(t):void 0,n=await ar({...e,storefrontInfo:o,controller:t});if(!n)return;r==="mock"&&(n.storefrontTitle="Mock.shop");let i=ur(t,n),s=o&&!o.id&&Xn(o.session,o.title).then(async({storefront:I,jobId:_})=>(_&&await Zn(o.session,_),I)).catch(i),a=await Nn(),c=Uc(a,n.directory,{force:!0,recursive:!0,filter:I=>!/^(app(\/|$)|dist(\/|$)|node_modules(\/|$)|server\.ts$|\.shopify(\/|$))/i.test(ie(a,I))}).then(()=>ir({rootDirectory:n.directory,appDirectory:x(n.directory,"app"),typescript:!0})).catch(i),u={create:"Creating storefront",setup:`Setting up ${e.quickstart?"Quickstart ":""}project`,install:"Installing dependencies. This could take a few minutes"},d=[{title:u.create,task:async()=>{await s}},{title:u.setup,task:async()=>{await c}}],f=await W(),m=`# The variables added in this file are only available locally in MiniOxygen.
227
+ # Run \`${f} link\` to also inject environment variables from your storefront,
228
+ # or \`${f} env pull\` to populate this file.`;c=c.then(()=>{let I=[je(x(n.directory,"package.json"),!1,L=>(L=Bc(L),L.replace(/"name": "[^"]+"/,`"name": "${un(o?.title??n.name)}"`)))],_;return o?(I.push(Jn(n.directory,o),Q(x(n.directory,".env"),m)),o.id?_={id:o.id,title:o.title}:s&&I.push(s.then(L=>{_=L}))):r==="mock"&&I.push(Q(x(n.directory,".env"),m+`
229
+ `+[["SESSION_SECRET","foobar"]].map(([L,j])=>`${L}="${j}"`).join(`
230
+ `)+`
231
+ `)),Promise.all(I).then(()=>{if(_)return Qn(n.directory,_)}).catch(i)});let{language:h,transpileProject:w}=await lr(n.directory,t,e.language);c=c.then(()=>w().catch(i)).then(()=>e.git?dr(n.directory):void 0);let{setupCss:y,cssStrategy:b}=await di(n.directory,t,e.styling);b&&(c=c.then(()=>y().catch(i)).then(()=>e.git?Ye(n.directory,"Setup "+xt[b]):void 0));let{packageManager:v,shouldInstallDeps:p,installDeps:g}=await cr(n.directory,t,e.packageManager,e.installDeps),S={language:h,packageManager:v,cssStrategy:b,depsInstalled:!1,cliCommand:await W("",v)};if(p){let I=c.then(async()=>{try{if(await g(),S.depsInstalled=!0,h==="ts")try{await Et("npx react-router typegen",{cwd:n.directory})}catch{B("Failed to generate React Router types. You may need to run `npx react-router typegen` manually.")}}catch(_){S.depsError=_}});d.push({title:u.install,task:async()=>{await I}})}let{createShortcut:C,showShortcutBanner:O}=await sr(t,S.cliCommand,e.shortcut);C&&(c=c.then(async()=>{await C()&&(S.cliCommand=We)}),O()),e.quickstart?console.log(`
232
+ `):N({headline:[{userInput:o?.title??n.name},"is ready to build."]});let{i18nStrategy:P,setupI18n:A}=await li(t,S.cliCommand,e.i18n),{setupRoutes:F}=nr(t);return S.i18n=P,c=c.then(async()=>{await A({rootDirectory:n.directory,contextCreate:h==="ts"?"app/lib/context.ts":"app/lib/context.js"}).then(()=>e.git?Ye(n.directory,`Setup markets support using ${P}`):void 0).catch(I=>{S.i18nError=I}),await F(n.directory,h,{i18nStrategy:P,overwriteFileDeps:!1}).then(async I=>{if(S.routes=I,h==="ts"&&S.depsInstalled)try{await Et("npx react-router typegen",{cwd:n.directory})}catch{B("Failed to generate React Router types after route generation. You may need to run `npx react-router typegen` manually.")}if(e.git&&I)return Ye(n.directory,"Generate routes for core functionality")}).catch(I=>{S.routesError=I})}),await ee(d),e.git&&await Ye(n.directory,"Lockfile"),await st(n,S),{...n,...S}}function Bc(e){let t=e.match(/^\s+"@shopify\/hydrogen":\s+"[^"]+",\n/m)?.[0];if(t&&/"0\.0\.0-\w+-/.test(t)){let r=t.replace("hydrogen","cli-hydrogen");e=e.replace(t,r+t)}return e}l();import{readdir as Ha}from"node:fs/promises";l();var Fa=K(pa(),1),ja=K(Aa(),1);import Xe from"node:path";import{pipeline as _d}from"stream/promises";var Rd="https://api.github.com/repos/shopify/hydrogen/releases/latest",Na=e=>e===403?"If you are using a VPN, WARP, or similar service, consider disabling it momentarily.":void 0;async function $d(e){let t=await se(Rd,{signal:e});if(!t.ok||t.status>=400)throw new E(`Failed to fetch the latest release information. Status ${t.status} ${t.statusText.replace(/\.$/,"")}.`,Na(t.status));let r=await t.json();return{version:r.name.split("/").pop()??r.name,url:r.tarball_url}}async function Ad(e,t,r){let o=await se(e,{signal:r});if(!o.ok||o.status>=400)throw new E(`Failed to download the latest release files. Status ${o.status} ${o.statusText}}`,Na(o.status));await _d(o.body,(0,Fa.default)(),(0,ja.extract)(t,{strip:1,filter:n=>(n=n.replace(t,""),!n.startsWith(Xe.normalize("/templates/"))&&!n.startsWith(Xe.normalize("/examples/")))}))}async function La({signal:e}={}){if(Ie&&process.env.FORCE_TEMPLATES_SOURCE!=="remote"){let t=Xe.dirname(Ln());return{version:"local",templatesDir:t,examplesDir:Xe.resolve(t,"..","examples")}}try{let{version:t,url:r}=await $d(e),o=await Ge("internal-templates");await G(o)||await bt(o);let n=Xe.join(o,t);return await G(n)||await Ad(r,n,e),{version:t,templatesDir:Xe.join(n,"templates"),examplesDir:Xe.join(n,"examples")}}catch(t){let r=t;throw new E(`Could not download Hydrogen templates from GitHub.
233
+ Please check your internet connection and the following error:
234
+
235
+ `+r.message,r.tryMessage)}}async function Ma(e,t){let r=Ei(e);if(r.isErr())throw new E(r.error.message);let o=await Ge("external-templates");await G(o)||await bt(o);let n=r.value,i=x(o,n.full.replace(/^https?:\/\//,"").replace(/[^\w]+/,"_"));return await G(i)&&await yo(i,{force:!0}),await In({repoUrl:n.full,destination:i,shallow:!0}),await yo(x(i,".git"),{force:!0}),{templateDir:i}}var Ua="shopify/hydrogen-demo-store";async function Ba(e,t){let r=e.template==="demo-store"?Ua:e.template,o=await ar({...e,controller:t});if(!o)return;let n=ur(t,o),i=r.includes("/")?Fd(r,t.signal).catch(n):jd(r,t.signal).catch(n),s=await i;if(t.signal.aborted)return;let a=Promise.resolve().then(async()=>{if(t.signal.aborted)return;let{sourcePath:b}=s;await Bt(b,o.directory)}).catch(n),c=await G(x(s.sourcePath,"tsconfig.json")),{language:u,transpileProject:d}=c?await lr(o.directory,t,e.language):{language:"js",transpileProject:()=>Promise.resolve()};a=a.then(()=>d().catch(n)).then(()=>e.git?dr(o.directory):void 0);let{packageManager:f,shouldInstallDeps:m,installDeps:h}=await cr(o.directory,t,e.packageManager,e.installDeps),w={language:u,packageManager:f,depsInstalled:!1,cliCommand:await W("",f)},y=[{title:"Downloading template",task:async()=>{await i}},{title:"Setting up project",task:async()=>{await a}}];if(m&&y.push({title:"Installing dependencies. This could take a few minutes",task:async()=>{try{await h(),w.depsInstalled=!0}catch(b){w.depsError=b}}}),!t.signal.aborted)return await ee(y),e.git&&await Ye(o.directory,"Lockfile"),await st(o,w),V({headline:`Your project will display inventory from ${e.template.endsWith(Ua)?"the Hydrogen Demo Store":"Mock.shop"}.`,body:`To connect this project to your Shopify store\u2019s inventory, update \`${o.name}/.env\` with your store ID and Storefront API key.`}),{...o,...w}}async function Fd(e,t){let{templateDir:r}=await Ma(e,t);return{sourcePath:r}}async function jd(e,t){let{templatesDir:r,examplesDir:o}=await La({signal:t}),n=x(r,"skeleton"),i=x(r,e),s=x(o,e);if(await G(i))return{skeletonPath:n,sourcePath:i};if(await G(s))return{skeletonPath:n,sourcePath:s};let a=(await Promise.all([Ha(o),Ha(r)]).catch(()=>[])).flat().filter(c=>c!=="skeleton"&&!c.endsWith(".md")).concat("demo-store").sort();throw new E(`Unknown value in \`--template\` flag "${e}".
236
+ Skip the flag or provide the name of a template or example in the Hydrogen repository or a URL to a git repository.`,a.length===0?"":{list:{title:"Available templates:",items:a}})}async function Va(e){let t=new qt;try{let r=e.template;return r?await Ba({...e,template:r},t):await Hs(e,t)}catch(r){throw t.abort(),r}}var Nd={f:"force"},Xr=class e extends T{static descriptionWithMarkdown="Creates a new Hydrogen storefront.";static description="Creates a new Hydrogen storefront.";static flags={...k.force,path:Ue.Flags.string({description:"The path to the directory of the new Hydrogen storefront.",env:"SHOPIFY_HYDROGEN_FLAG_PATH"}),language:Ue.Flags.string({description:"Sets the template language to use. One of `js` or `ts`.",choices:Object.keys(ai),env:"SHOPIFY_HYDROGEN_FLAG_LANGUAGE"}),template:Ue.Flags.string({description:"Scaffolds project based on an existing template or example from the Hydrogen repository.",env:"SHOPIFY_HYDROGEN_FLAG_TEMPLATE"}),...k.installDeps,"mock-shop":Ue.Flags.boolean({description:"Use mock.shop as the data source for the storefront.",env:"SHOPIFY_HYDROGEN_FLAG_MOCK_DATA"}),...k.styling,...k.markets,...k.shortcut,git:Ue.Flags.boolean({description:"Init Git and create initial commits.",env:"SHOPIFY_HYDROGEN_FLAG_GIT",default:!0,allowNo:!0}),quickstart:Ue.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":Ue.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 Ld(U(t))}};async function Ld({markets:e,...t}=Gn(process.argv,Nd)){if(Fn(),!t.i18n&&e&&(t.i18n=e),t.i18n&&!Po.includes(t.i18n))throw new E(`Invalid URL structure strategy: ${t.i18n}. Must be one of ${Po.join(", ")}`);if(t.styling&&!Eo.includes(t.styling))throw new E(`Invalid styling strategy: ${t.styling}. Must be one of ${Eo.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 r=await Ms();return r&&r(t.packageManager),Va(t)}l();l();var Md=`#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 Ga(e){let{hydrogenStorefronts:t}=await ot(Md,e);return t.map(r=>({...r,parsedId:nt(r.id)}))}var Zr=class e extends T{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={...k.path};async run(){let{flags:t}=await this.parse(e);await Hd(t)}};async function Hd({path:e=process.cwd()}){let{session:t}=await ge(e),r=await Ga(t);r.length>0?(ae(),$(Vd({storefronts:r,shop:t.storeFqdn}).toString()),r.forEach(({currentProductionDeployment:o,id:n,productionUrl:i,title:s})=>{ae(),$(z`${M.whiteBright(s)} ${M.dim(`(id: ${nt(n)})`)}`.value),i&&$(z` ${M.whiteBright(i)}`.value),o&&$(z` ${M.dim(Bd(o))}`.value)})):V({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 W(e)} link\` or visit ${gs(t)}`]})}var Ud=new Intl.DateTimeFormat("default",{year:"numeric",month:"numeric",day:"numeric"});function Bd(e){let t="";if(!e)return t;if(t+=Ud.format(new Date(e.createdAt)),e.commitMessage){let r=e.commitMessage.split(/\n/)[0];t+=`, ${r}`}return t}var Vd=({storefronts:e,shop:t})=>Ut(e,r=>`Showing ${r.length} Hydrogen storefronts for the store ${t}`,r=>`Showing 1 Hydrogen storefront for the store ${t}`);l();var eo=class e extends T{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={...k.path,...k.shop};async run(){let{flags:t}=await this.parse(e);await Gd(t)}};async function Gd({path:e=process.cwd(),shop:t}){ae(),ti(!0);let{config:r}=await ge(e,t??!0);ni(r)}l();var to=class e extends T{static descriptionWithMarkdown="Log out from the current shop.";static description="Logout of your local session.";static flags={...k.path};async run(){let{flags:t}=await this.parse(e);await qd(t)}};async function qd({path:e=process.cwd()}){ae(),await oi(e),N({body:"You are logged out from Shopify."})}l();var tn=K(pe(),1);l();async function qa(e){let{startWorkerdServer:t}=await import("./workerd-U6WWWY73.js");return t(e)}var ro=class e extends T{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={...k.path,...k.port,...k.env,...k.envBranch,...k.envFile,...k.inspectorPort,...k.debug,...k.verbose,build:tn.Flags.boolean({description:"Builds the app before starting the preview server."}),watch:tn.Flags.boolean({description:"Watches for changes and rebuilds the project.",dependsOn:["build"]}),...we(k.entry,{entry:{dependsOn:["build"]}}),...we(k.codegen,{codegen:{dependsOn:["build"]}})};async run(){let{flags:t}=await this.parse(e),r=t.path?D(t.path):process.cwd(),{close:o}=await Wd({...U(t),directory:r});Me(async()=>{await o()})}};async function Wd({port:e,directory:t,env:r,envBranch:o,inspectorPort:n,debug:i,verbose:s,build:a=!1,watch:c=!1,codegen:u=!1,codegenConfigPath:d,entry:f,envFile:m}){process.env.NODE_ENV||(process.env.NODE_ENV=c?"development":"production"),s&&rr(),or()||it();let{root:h,buildPath:w,buildPathWorkerFile:y,buildPathClient:b}=xe(t),v=await rt(h);if(v)throw new E(Pe);let p,g=Tt(),C=a?await Je({...{directory:h,entry:f,disableRouteWarning:!1,lockfileCheck:!1,sourcemap:!0,bundleStats:!1,useCodegen:u,codegenConfigPath:d},watch:c,async onServerBuildFinish(){g.state==="pending"?g.resolve():$("\u{1F3D7}\uFE0F Project rebuilt. Reloading server..."),await p?.reload()}}):g.resolve();v||(y=(await he(h).catch(()=>null))?.serverOutFile??x(w,"server","index.js"));let{shop:O,storefront:P}=await tr(h),A=!!O&&!!P?.id,{allVariables:F,logInjectedVariables:I}=await hr({root:h,fetchRemote:A,envBranch:o,envHandle:r,envFile:m});e||(e=await pt(tt));let _=await pt(e+100);return await g.promise,I(),p=await qa({root:h,appPort:e,assetsPort:_,env:F,buildPathClient:b,buildPathWorkerFile:y,inspectorPort:n,debug:i,watch:c}),p.showBanner({mode:"preview",headlinePrefix:c?"Watching for changes. ":""}),{async close(){await Promise.allSettled([p.close(),C?.close()])}}}l();var oo=class e extends T{static description="Scaffold routes and core functionality.";static flags={...k.path,...k.force,...k.markets,...k.shortcut,...we(k.installDeps,{"install-deps":{default:!0}})};async run(){let{flags:t}=await this.parse(e),r=t.path?D(t.path):process.cwd();await Yd({...U(t),directory:r})}};async function Yd(e){let t=new qt,{rootDirectory:r,appDirectory:o}=await Ne(e.directory),n=Ze(r),i=W(),s=Promise.resolve(),a=[{title:"Setting up project",task:async()=>{await s}}],c=e.markets?e.markets:await Xt({abortSignal:t.signal,extraChoices:{none:"Set up later"}}),u=c==="none"?void 0:c,{setupRoutes:d}=nr(t),f,m=await jn(".."),[h,w]=await Promise.all([G(x(r,"tsconfig.json")),kt("*.d.ts",{cwd:m})]);s=s.then(()=>Promise.all([...w.map(p=>Bt(x(m,p),D(r,p))),ir({rootDirectory:r,appDirectory:o,typescript:h})])).then(async()=>{f=await d(r,h?"ts":"js",{i18nStrategy:u,overwriteFileDeps:!0})}),u&&(s=s.then(()=>Kt(u,{rootDirectory:r})));let y=await Promise.resolve(i),{createShortcut:b,showShortcutBanner:v}=await sr(t,y,e.shortcut);!u&&!b||(b&&(s=s.then(async()=>{await b()&&(y=We)}),v()),await ee(a),await st({location:n,name:n,directory:r},{cliCommand:y,depsInstalled:!0,packageManager:"npm",i18n:u,routes:f}))}l();var Wa=K(pe(),1);var no=class e extends T{static descriptionWithMarkdown="Adds support for certain CSS strategies to your project.";static description="Setup CSS strategies for your project.";static flags={...k.path,...k.force,...we(k.installDeps,{"install-deps":{default:!0}})};static args={strategy:Wa.Args.string({name:"strategy",description:`The CSS strategy to setup. One of ${ko.join()}`,options:ko})};async run(){let{flags:t,args:r}=await this.parse(e),o=t.path?D(t.path):process.cwd();await zd({...U(t),strategy:r.strategy,directory:o})}};async function zd({strategy:e,directory:t,force:r=!1,installDeps:o=!0}){let n=await he(t).catch(()=>null);if(!n)throw new E("No Vite config found. This command is only supported in Vite projects.");let{remixConfig:i}=n,s=e||await Un();if(s==="css-modules"||s==="postcss"){N({headline:`Vite works out of the box with ${xt[s]}.`,body:`See the Vite documentation for more information:
250
+ ${So[s]}`});return}let a=await Hn(s,i,r);if(!a)return;let{workPromise:c,generatedAssets:u,needsInstallDeps:d}=a,f=[{title:"Updating files",task:async()=>{await c}}],m=!1;if(o&&d){let h=ke(i.rootDirectory);f.push({title:"Installing new dependencies",task:async()=>{let w=await h;m=w==="npm"||w==="unknown",await Wt({directory:i.rootDirectory,packageManager:w,args:[]})}})}await ee(f),N({headline:`${xt[s]} setup complete.`,body:(u.length>0?`You can now modify CSS configuration in the following files:
251
+ `+u.map(h=>` - ${h}`).join(`
252
+ `)+`
253
+ `:"")+`
254
+ For more information, visit ${So[s]}`}),d&&m&&s==="tailwind"&&q({body:[`Due to a bug in NPM, you might need to reinstall dependencies again.
255
+ Run`,{command:"npm install"}]})}l();var Ya=K(pe(),1);var io=class e extends T{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={...k.path};static args={strategy:Ya.Args.string({name:"strategy",description:`The URL structure strategy to setup multiple markets. One of ${xo.join()}`,options:xo})};async run(){let{flags:t,args:r}=await this.parse(e),o=t.path?D(t.path):process.cwd();await Jd({...U(t),strategy:r.strategy,directory:o})}};async function Jd({strategy:e,directory:t}){let r=Ne(t),o=e||await Xt(),n=await r;await ee([{title:"Updating files",task:async()=>{await Kt(o,n)}}]),N({headline:`Markets support setup complete with strategy ${Bn[o].toLowerCase()}.`,body:`You can now modify the supported locales in ${n.serverEntryPoint??"your server entry file."}
256
+ `})}l();var so=class e extends T{static description="EXPERIMENTAL: Upgrades the project to use Vite.";static flags={...k.path};async run(){let{flags:t}=await this.parse(e),r=t.path?D(t.path):process.cwd();await Kd({...U(t),directory:r})}},Qd=`export default {
257
+ plugins: {
258
+ tailwindcss: {},
259
+ autoprefixer: {},
260
+ },
261
+ };
262
+ `;async function Kd({directory:e}){if(ae(),await Wn(e))throw new E("This project already has a Vite config file.");let[t,r,o]=await Promise.all([qn(e),kn(x(e,"package.json")),et(e)]),n=t.server||"server.js",i=n.endsWith(".ts"),s=i?"tsx":"jsx",a=await Ge("vite"),c=!!t.tailwind,u=D(e,"postcss.config.js"),d=()=>{},f=Promise.all([be(D(e,"remix.config.js")).catch(d),vo(D(e,"remix.env.d.ts"),D(e,"env.d.ts")).then(()=>je(D(e,"env.d.ts"),!1,m=>m.replace('types="@remix-run/dev"','types="vite/client"'))).catch(d),vo(D(e,".eslintrc.js"),D(e,".eslintrc.cjs")).catch(d),de(D(e,"postcss.config.js")).then(async m=>{let h=m.includes("tailwindcss"),y=m.includes("module.exports")||m.includes("exports.")||m.includes("require(")?u.replace(".js",".cjs"):u;return!h&&c&&(m=await St(m.replace(/(plugins:\s+{)/,`$1
263
+ tailwindcss: {},`),o,y)),Q(y,m)}).catch(async()=>{if(c&&!await G(u)&&!await G(u.replace(".js",".cjs")))return Q(u,Qd)}).catch(d),Mn(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((h,w)=>(h[w]=m.devDependencies?.[w],h),{})),m}}),de(D(a,"vite.config.js")).then(async m=>{r.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:w,appDirectory:y,ignoredRouteFiles:b,routes:v}=t;for(let g of["v3_fetcherPersist","v3_throwAbortReason","v3_relativeSplatPath"])w?.[g]||(m=m.replace(`${g}: true`,`${g}: false`));y&&y!=="app"&&(m=m.replace(/^(\s+)(future:)/m,`$1appDirectory: '${y}',
268
+ $1$2`)),b&&(m=m.replace(/^(\s+)(future:)/m,`$1ignoredRouteFiles: ${JSON.stringify(b)},
269
+ $1$2`)),v&&(m=m.replace(/^(\s+)(future:)/m,`$1routes: ${v.toString()},
270
+ $1$2`));let p=D(e,"vite.config."+s.slice(0,2));return m=await St(m,o,p),Q(p,m)}),je(D(e,n),!1,m=>(i?`// @ts-ignore
271
+ `:"")+m.replace("@remix-run/dev/server-build","virtual:remix/server-build")),Qt(s).then(async m=>{let h=D(e,t.appDirectory??"app"),w=x(h,"root."+s);await new Promise(async(y,b)=>{await m.findInFiles({paths:[w,x(h,"routes")],matcher:{rule:{kind:"string_fragment",regex:"\\.css$",inside:{kind:"import_statement",stopBy:"end"}}}},async(p,g)=>{p&&b(p);let S={};g.forEach(C=>{if(C.text().endsWith(".module.css"))return;let O=C.getRoot().filename(),P=C.getRoot().root().text(),A=C.range().end.index,F=S[O]||{content:P,positions:[]};F.positions.push(A),S[O]=F}),await Promise.all(Object.entries(S).flatMap(([C,{content:O,positions:P}])=>{P.reverse();for(let A of P)O=O.slice(0,A)+"?url"+O.slice(A);return Q(C,O)})),y(null)})===0&&y(null)}),await je(w,o,y=>{let b=m.parse(y).root(),v="LiveReload",p={kind:"identifier",regex:v},g=b.find({rule:{kind:"import_specifier",regex:v,inside:{kind:"import_statement",stopBy:"end"}}}),S=b.findAll({rule:{any:[{kind:"jsx_self_closing_element",has:p},{kind:"jsx_element",has:{kind:"jsx_opening_element",has:p}}]}});for(let C of[...S.reverse(),g]){if(!C)continue;let{start:O,end:P}=C.range();y=y.slice(0,O.index)+y.slice(P.index)}return y.replace(/,\s*,/g,",").replace(/import\s+{\s+cssBundleHref\s+}\s+from\s+['"]@remix-run\/css-bundle['"];?\n/,"").replace(/\.\.\.\(\s*cssBundleHref[^)]+\),?/,"")})})]);await ee([{title:"Updating files",task:async()=>{await f}},{title:"Installing new dependencies",task:async()=>{await Wt({directory:e,packageManager:await ke(e),args:[]})}}]),N({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)})}l();var ao=class extends T{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 \`${We}\` shortcut for the Hydrogen CLI`;async run(){await Xd()}};async function Xd(){let e=await ei();e.length>0?N({headline:`Shortcut ready for the following shells: ${e.join(", ")}.
273
+ Restart your terminal session and run \`${We}\` from your local project.`}):Re({name:"error",type:0,message:"No supported shell found.",skipOclifErrorHandling:!0,tryMessage:"Please create a shortcut manually."})}l();var lo=class e extends T{static descriptionWithMarkdown="Unlinks your local development environment from a remote Hydrogen storefront.";static description="Unlink a local project from a Hydrogen storefront.";static flags={...k.path};async run(){let{flags:t}=await this.parse(e);await Zd(t)}};async function Zd({path:e}){let t=e??process.cwd(),{storefront:r}=await tr(t);if(!r){B("This project isn't linked to a Hydrogen storefront.");return}let o=r.title;await Kn(t),N({body:["You are no longer linked to",{bold:o}]})}l();import{createRequire as eu}from"node:module";import{spawnSync as tu}from"node:child_process";var ru=async function(e){if(!e.id?.startsWith("hydrogen:")||e.id==="hydrogen:init")return;let t=dn(),r=/^--path($|=)/,o=e.argv.findIndex(n=>r.test(n));if(o!==-1){let n=e.argv[o]?.split("=")[1]??e.argv[o+1];n&&!n.startsWith("--")&&(t=D(t,n))}if(nu(t)||(ae(),q({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)),ou(e.id,e.argv)&&!process.execArgv.includes(co)&&!(process.env.NODE_OPTIONS??"").includes(co)){Pn(`Restarting CLI process with ${co} flag.`);let[n,...i]=process.argv;i.unshift(co);let s=tu(n,i,{stdio:"inherit"});process.exit(s.status??1)}},co="--experimental-vm-modules";function ou(e="",t=[]){return e==="hydrogen:debug:cpu"}function nu(e){try{let t=eu(import.meta.url),{dependencies:r,scripts:o}=t(x(e,"package.json"));return!!r?.["@shopify/hydrogen"]||!!o?.dev?.includes("--diff")}catch{return!1}}var za=ru;var UE={"hydrogen:dev":Hr,"hydrogen:build":Pr,"hydrogen:check":Dr,"hydrogen:codegen":Tr,"hydrogen:deploy":Ar,"hydrogen:g":Gr,"hydrogen:init":Xr,"hydrogen:link":ui,"hydrogen:list":Zr,"hydrogen:login":eo,"hydrogen:logout":to,"hydrogen:preview":ro,"hydrogen:setup":oo,"hydrogen:shortcut":ao,"hydrogen:unlink":lo,"hydrogen:upgrade":Fr,"hydrogen:customer-account-push":mi,"hydrogen:debug:cpu":Ir,"hydrogen:env:list":Ur,"hydrogen:env:pull":Br,"hydrogen:env:push":Vr,"hydrogen:generate:route":Oe,"hydrogen:generate:routes":qr,"hydrogen:setup:css":no,"hydrogen:setup:markets":io,"hydrogen:setup:vite":so},BE={init:za};export{UE as a,BE as b};
@@ -1 +1 @@
1
- import{D as m,E as d,t as c}from"./chunk-MGL4YM3S.js";import{Eb as w,Fb as n,Hb as a}from"./chunk-VPL2NDH6.js";import{g as o}from"./chunk-VPRTJUIN.js";o();async function P(){let r,l=new Promise(function(e,i){r=e});await c({processes:[{prefix:"backend",action:async(e,i,s)=>{e.write("first backend message"),await new Promise(t=>setTimeout(t,1e3)),e.write("second backend message"),await new Promise(t=>setTimeout(t,1e3)),e.write("third backend message"),await new Promise(t=>setTimeout(t,1e3)),r()}},{prefix:"frontend",action:async(e,i,s)=>{await l,e.write("first frontend message"),await new Promise(t=>setTimeout(t,1e3)),e.write("second frontend message"),await new Promise(t=>setTimeout(t,1e3)),e.write("third frontend message")}}]}),await m([{title:"Installing dependencies",task:async()=>{await new Promise(e=>setTimeout(e,2e3))}},{title:"Downloading assets",task:async()=>{await new Promise(e=>setTimeout(e,2e3))}}]),await d({title:new w("Importing data"),task:async e=>{for(let i=1;i<=10;i++){await new Promise(t=>setTimeout(t,500));let s=a`Importing data ${n.italic(a`(${n.green(i.toString())} complete)`)}`;e(s)}return"completed"}})}export{P as a};
1
+ import{D as m,E as d,t as c}from"./chunk-6EZ7JWBK.js";import{Eb as w,Fb as n,Hb as a}from"./chunk-DONEJHDG.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();async function P(){let r,l=new Promise(function(e,i){r=e});await c({processes:[{prefix:"backend",action:async(e,i,s)=>{e.write("first backend message"),await new Promise(t=>setTimeout(t,1e3)),e.write("second backend message"),await new Promise(t=>setTimeout(t,1e3)),e.write("third backend message"),await new Promise(t=>setTimeout(t,1e3)),r()}},{prefix:"frontend",action:async(e,i,s)=>{await l,e.write("first frontend message"),await new Promise(t=>setTimeout(t,1e3)),e.write("second frontend message"),await new Promise(t=>setTimeout(t,1e3)),e.write("third frontend message")}}]}),await m([{title:"Installing dependencies",task:async()=>{await new Promise(e=>setTimeout(e,2e3))}},{title:"Downloading assets",task:async()=>{await new Promise(e=>setTimeout(e,2e3))}}]),await d({title:new w("Importing data"),task:async e=>{for(let i=1;i<=10;i++){await new Promise(t=>setTimeout(t,500));let s=a`Importing data ${n.italic(a`(${n.green(i.toString())} complete)`)}`;e(s)}return"completed"}})}export{P as a};