shopify 4.9.4 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (501) hide show
  1. package/dist/analytics-Q6QDIDYT.js +1 -0
  2. package/dist/analytics-VKKJNJ62.js +1 -0
  3. package/dist/assets/hydrogen/starter/CHANGELOG.md +7 -0
  4. package/dist/assets/hydrogen/starter/package.json +2 -2
  5. package/dist/assets/hydrogen/vite/package.json +3 -4
  6. package/dist/assets/hydrogen/vite/vite.config.js +3 -3
  7. package/dist/bootstrap.js +1 -1
  8. package/dist/{chunk-LKXFHYLI.js → chunk-24NUJTIH.js} +1 -1
  9. package/dist/chunk-2CMEKSI7.js +1 -0
  10. package/dist/chunk-2DID73ML.js +1 -0
  11. package/dist/chunk-2ORRV7GH.js +1 -0
  12. package/dist/chunk-2VSNFOKD.js +1 -0
  13. package/dist/chunk-335BUVBP.js +1 -0
  14. package/dist/{chunk-UEBUGSBT.js → chunk-3A3DZVEJ.js} +1 -1
  15. package/dist/chunk-3C6VLJ5D.js +319 -0
  16. package/dist/{chunk-PB5ZZET5.js → chunk-3G4HJO72.js} +30 -30
  17. package/dist/chunk-3LVCG4JB.js +1 -0
  18. package/dist/chunk-43KLFFP7.js +1 -0
  19. package/dist/chunk-43R5VGKT.js +1 -0
  20. package/dist/chunk-46MSIQ6Z.js +1 -0
  21. package/dist/chunk-4ARCB6DT.js +1 -0
  22. package/dist/chunk-4C2DAX5T.js +1 -0
  23. package/dist/chunk-4CRBTSVP.js +2 -0
  24. package/dist/chunk-4GCI2YCZ.js +8 -0
  25. package/dist/chunk-4GOJQKY5.js +1 -0
  26. package/dist/chunk-4RDFMBRG.js +9 -0
  27. package/dist/chunk-4SS6DXC7.js +5 -0
  28. package/dist/{chunk-J4J2YXH3.js → chunk-4TI7U2PN.js} +1 -1
  29. package/dist/{chunk-67EBF76X.js → chunk-52FDK2LC.js} +1 -1
  30. package/dist/chunk-53BG3NLH.js +3 -0
  31. package/dist/{chunk-LD6ZCTZ3.js → chunk-5B76DT7X.js} +1 -1
  32. package/dist/{chunk-A2VCTDKH.js → chunk-5NEGOQT6.js} +1 -1
  33. package/dist/{chunk-MW3JKGJH.js → chunk-5OMJFPQW.js} +1 -1
  34. package/dist/chunk-5TB52UUV.js +2 -0
  35. package/dist/chunk-5UWMXOHM.js +7 -0
  36. package/dist/chunk-6BNKBCCU.js +1 -0
  37. package/dist/chunk-6DXP7PQ7.js +1 -0
  38. package/dist/chunk-6PUU6ZNQ.js +1 -0
  39. package/dist/chunk-7GHSE7SG.js +1 -0
  40. package/dist/{chunk-7556AIVG.js → chunk-7IFE4UQY.js} +1 -1
  41. package/dist/chunk-7LAKWAKX.js +25 -0
  42. package/dist/chunk-7MVWDCI3.js +1 -0
  43. package/dist/chunk-7NSK77WG.js +3 -0
  44. package/dist/chunk-7QUZWCJZ.js +3 -0
  45. package/dist/chunk-7RPFJZLP.js +1 -0
  46. package/dist/{chunk-LJIJEGND.js → chunk-7UOA4DI7.js} +2 -2
  47. package/dist/chunk-7WPUV7GY.js +6 -0
  48. package/dist/chunk-7Y7AZRL3.js +10 -0
  49. package/dist/{chunk-NGSEF3UX.js → chunk-ACA2BGAD.js} +1 -1
  50. package/dist/chunk-AJMDF3QC.js +1 -0
  51. package/dist/{chunk-R7YJNDXW.js → chunk-AXC2MHHO.js} +1 -1
  52. package/dist/{chunk-DEF2G7S4.js → chunk-AYL6KBPE.js} +1 -1
  53. package/dist/chunk-BAHIL37I.js +1 -0
  54. package/dist/{chunk-RSC5NQAT.js → chunk-BCYTZ7LM.js} +1 -1
  55. package/dist/{chunk-AVMNIZAJ.js → chunk-BJPDJIS4.js} +1 -1
  56. package/dist/{chunk-7VAKNVFD.js → chunk-BN7ZXAZJ.js} +1 -1
  57. package/dist/chunk-BVSKBX7T.js +16 -0
  58. package/dist/chunk-BWRNXCVN.js +4 -0
  59. package/dist/{chunk-XNPUZRWP.js → chunk-C3KEDG33.js} +1 -1
  60. package/dist/{chunk-WEXOA4C4.js → chunk-C7V755IT.js} +1 -1
  61. package/dist/chunk-CCMDZX35.js +7 -0
  62. package/dist/chunk-CCQNP5YR.js +1 -0
  63. package/dist/chunk-CEIJKJOF.js +11 -0
  64. package/dist/chunk-CIK5BF7V.js +1 -0
  65. package/dist/{chunk-6YDLNP4G.js → chunk-CVVQQLCF.js} +1 -1
  66. package/dist/chunk-CW2T7EOQ.js +1 -0
  67. package/dist/chunk-CZ22VZDA.js +376 -0
  68. package/dist/{chunk-3G2ZQ2EF.js → chunk-D7NB7YR6.js} +1 -1
  69. package/dist/{chunk-DYPZX7MW.js → chunk-DFQ4WTET.js} +2 -2
  70. package/dist/chunk-DJAZBPYA.js +3 -0
  71. package/dist/chunk-DNMXVMJM.js +47 -0
  72. package/dist/{chunk-CLD3NZYD.js → chunk-EGCWR5AS.js} +1 -1
  73. package/dist/{chunk-BOE2ST6J.js → chunk-EITIW5OX.js} +1 -1
  74. package/dist/chunk-EMSF57ZB.js +1 -0
  75. package/dist/{chunk-ZEBMW5KS.js → chunk-EXFBZPZS.js} +1 -1
  76. package/dist/chunk-FDXHQZTO.js +26 -0
  77. package/dist/{chunk-Q2XLIWG4.js → chunk-FFHH5LOR.js} +1 -1
  78. package/dist/{chunk-MMQZO2W2.js → chunk-FNLECT7B.js} +1 -1
  79. package/dist/{chunk-PO5T44H3.js → chunk-FWB3GLMW.js} +1 -1
  80. package/dist/chunk-FZCGRIOM.js +1 -0
  81. package/dist/{chunk-G7JW4UIM.js → chunk-G6ZMSWEU.js} +1 -1
  82. package/dist/chunk-GAMC2BNY.js +7 -0
  83. package/dist/chunk-GB6E3ATN.js +4 -0
  84. package/dist/chunk-GCNA3HXH.js +8 -0
  85. package/dist/{chunk-IGDVKRB4.js → chunk-GFVKTWFT.js} +1 -1
  86. package/dist/chunk-GQNOVEKP.js +2 -0
  87. package/dist/{chunk-5BTLE67Z.js → chunk-GRGFA26K.js} +1 -1
  88. package/dist/chunk-GXORLBVN.js +2 -0
  89. package/dist/{chunk-3V4VL3SD.js → chunk-H4V55Y3Z.js} +118 -118
  90. package/dist/chunk-HCZG7YJ6.js +16 -0
  91. package/dist/chunk-HF4NDEX3.js +1 -0
  92. package/dist/chunk-HIRTL45Q.js +1 -0
  93. package/dist/chunk-I4OVLRQR.js +1 -0
  94. package/dist/{chunk-ENQXB532.js → chunk-I6FRVYGE.js} +1 -1
  95. package/dist/chunk-IEQ4UOH3.js +4 -0
  96. package/dist/{chunk-PIZDYS7T.js → chunk-IILLQOUC.js} +60 -60
  97. package/dist/{chunk-45SZ5PSE.js → chunk-IQVRP7CT.js} +1 -1
  98. package/dist/chunk-IUP7POIE.js +6 -0
  99. package/dist/chunk-IUTZIN2T.js +10 -0
  100. package/dist/chunk-IWEKM5Y3.js +1 -0
  101. package/dist/chunk-IWTNUJGY.js +2 -0
  102. package/dist/chunk-J6TW43TG.js +1 -0
  103. package/dist/chunk-JDR6UVZA.js +8 -0
  104. package/dist/{chunk-CVFPY2SH.js → chunk-JEA3C7ON.js} +1 -1
  105. package/dist/chunk-JOJV5E2K.js +1 -0
  106. package/dist/chunk-JYMDWR25.js +1 -0
  107. package/dist/{chunk-TPHHQAUD.js → chunk-KDPQXURV.js} +1 -1
  108. package/dist/{chunk-MW3IMZJ5.js → chunk-KGRIYAMA.js} +1 -1
  109. package/dist/chunk-KJQDS5HI.js +1 -0
  110. package/dist/chunk-KKPOOIE4.js +2 -0
  111. package/dist/{chunk-VS7QVU3Z.js → chunk-KSDU4YOB.js} +1 -1
  112. package/dist/chunk-L7MSPGDS.js +5 -0
  113. package/dist/{chunk-43URS56H.js → chunk-LDU5T3DN.js} +1 -1
  114. package/dist/chunk-LHKVXJPX.js +1 -0
  115. package/dist/{chunk-EO4YJFMY.js → chunk-LMQGNECW.js} +86 -200
  116. package/dist/{chunk-TQ7URMGS.js → chunk-LQ7ENG4V.js} +1 -1
  117. package/dist/chunk-LVLAOBJM.js +103 -0
  118. package/dist/chunk-LWCTKI4Z.js +18 -0
  119. package/dist/chunk-M3ACZWMR.js +1 -0
  120. package/dist/chunk-M4BVLMPH.js +31 -0
  121. package/dist/{chunk-NCRWOW6F.js → chunk-M5TGCSUK.js} +1 -1
  122. package/dist/chunk-M7LPHCP2.js +274 -0
  123. package/dist/{chunk-IDKRJ2F4.js → chunk-MDRVCBDO.js} +1 -1
  124. package/dist/chunk-MR2AUT7Q.js +1 -0
  125. package/dist/chunk-MXJAH2GW.js +5 -0
  126. package/dist/{chunk-UU6BRRYS.js → chunk-MYAIWSOO.js} +1 -1
  127. package/dist/{chunk-NT4A37HG.js → chunk-N2RFDHRY.js} +1 -1
  128. package/dist/{chunk-GSE6FXZU.js → chunk-NB4BRW3H.js} +1 -1
  129. package/dist/chunk-NDKSG4CC.js +97 -0
  130. package/dist/chunk-NK2MGR6A.js +1 -0
  131. package/dist/chunk-NOH63WC6.js +12 -0
  132. package/dist/{chunk-BVB3DTNE.js → chunk-OGWPS55W.js} +1 -1
  133. package/dist/chunk-OQ5CLM2H.js +4 -0
  134. package/dist/{chunk-PVAZCZSY.js → chunk-OQU3HLAE.js} +1 -1
  135. package/dist/chunk-OVWUGAEU.js +11 -0
  136. package/dist/chunk-OX7UVDSU.js +6 -0
  137. package/dist/chunk-P33TONYG.js +1 -0
  138. package/dist/chunk-PEVIRAMR.js +6 -0
  139. package/dist/{chunk-YPCXVZ2N.js → chunk-PGLWZMJU.js} +4 -4
  140. package/dist/chunk-PIAD3F6M.js +16 -0
  141. package/dist/chunk-PMHP57MH.js +20 -0
  142. package/dist/{chunk-F3PZGSOY.js → chunk-POKY4RWR.js} +1 -1
  143. package/dist/chunk-PSSYLJG4.js +2 -0
  144. package/dist/chunk-PYIICTLX.js +1 -0
  145. package/dist/chunk-PZUGDE7N.js +2 -0
  146. package/dist/{chunk-NU5WLZ6Y.js → chunk-Q2SZCZE7.js} +1 -1
  147. package/dist/{chunk-MUM34KUM.js → chunk-Q2XRITUG.js} +1 -1
  148. package/dist/chunk-Q5MEFIMV.js +4 -0
  149. package/dist/chunk-Q66CI37F.js +7 -0
  150. package/dist/chunk-QFWWCZOI.js +1 -0
  151. package/dist/{chunk-TR4OWSEX.js → chunk-QFYLJVJW.js} +1 -1
  152. package/dist/chunk-QKVVJXWS.js +3 -0
  153. package/dist/chunk-QN3774QI.js +1 -0
  154. package/dist/chunk-R2BDABJD.js +213 -0
  155. package/dist/{chunk-7HWMURCW.js → chunk-R7EMV77H.js} +1 -1
  156. package/dist/chunk-RFGEM5JC.js +3 -0
  157. package/dist/{chunk-7A3RW2VM.js → chunk-RVQV6G5M.js} +1 -1
  158. package/dist/chunk-S67I4E7M.js +5 -0
  159. package/dist/chunk-SFPXYHHL.js +1 -0
  160. package/dist/{chunk-4OCVXE5Y.js → chunk-SFQEHDJY.js} +1 -1
  161. package/dist/chunk-SL3VBI62.js +3 -0
  162. package/dist/{chunk-LOWSU4BB.js → chunk-SNNZ4U2W.js} +1 -1
  163. package/dist/chunk-T2IUXXCT.js +1 -0
  164. package/dist/chunk-TPSA4JN5.js +1 -0
  165. package/dist/chunk-TTEF7GTX.js +1 -0
  166. package/dist/{chunk-FQL2WEKX.js → chunk-U25W35TX.js} +1 -1
  167. package/dist/chunk-UIQL5ZF3.js +1 -0
  168. package/dist/chunk-UK6576EO.js +1 -0
  169. package/dist/chunk-ULD7CIOY.js +4 -0
  170. package/dist/{chunk-D3KFKT4D.js → chunk-UOS2XLGG.js} +1 -1
  171. package/dist/{chunk-EMH7OHCW.js → chunk-UVRKTMF7.js} +1 -1
  172. package/dist/{chunk-ZTICX3AO.js → chunk-UWMZ5CSB.js} +1 -1
  173. package/dist/chunk-UZROQRLX.js +2 -0
  174. package/dist/{chunk-5BGUKF7L.js → chunk-V75WUEFU.js} +1 -1
  175. package/dist/chunk-VB7YQMAM.js +5 -0
  176. package/dist/chunk-VHUD3CBC.js +3 -0
  177. package/dist/chunk-VMMUJN4T.js +17 -0
  178. package/dist/{chunk-S36VGP37.js → chunk-VW6QS7DO.js} +1 -1
  179. package/dist/chunk-VWH3VPYI.js +1 -0
  180. package/dist/{chunk-4TF7ER72.js → chunk-WBJ6ZHYH.js} +1 -1
  181. package/dist/chunk-WDFCOZAY.js +16 -0
  182. package/dist/chunk-WFWISGLS.js +1 -0
  183. package/dist/chunk-WGUOLSMG.js +1 -0
  184. package/dist/{chunk-PFXNBHQQ.js → chunk-WJSUIUBW.js} +2 -2
  185. package/dist/{chunk-TFXUDHCP.js → chunk-WMAFG2JD.js} +1 -1
  186. package/dist/chunk-X2H6I2WW.js +5 -0
  187. package/dist/{chunk-DSS4ECIH.js → chunk-X7HVAVSZ.js} +1 -1
  188. package/dist/{chunk-NYYXH2SX.js → chunk-XBQDMGUN.js} +1 -1
  189. package/dist/chunk-XITZIDCL.js +18 -0
  190. package/dist/chunk-XKRJKUA7.js +1 -0
  191. package/dist/{chunk-FEQHCE2E.js → chunk-XM7YUXTF.js} +2 -2
  192. package/dist/chunk-XMODGI45.js +1 -0
  193. package/dist/{chunk-B3M3KIOU.js → chunk-XNNKLUTN.js} +1 -1
  194. package/dist/chunk-XTREQ4A2.js +1 -0
  195. package/dist/chunk-YGYEM6QO.js +1 -0
  196. package/dist/{chunk-LWU5TKNA.js → chunk-YKS7MH3F.js} +9 -6
  197. package/dist/chunk-YTUDXZLN.js +1 -0
  198. package/dist/{chunk-I3J63RFV.js → chunk-YTUUU33R.js} +1 -1
  199. package/dist/chunk-YVVU4J5O.js +3 -0
  200. package/dist/{chunk-4TZCRMBJ.js → chunk-YVY32DNA.js} +1 -1
  201. package/dist/chunk-Z5SILNH2.js +7 -0
  202. package/dist/chunk-ZAA2DXK5.js +5 -0
  203. package/dist/chunk-ZDQO6CNY.js +1 -0
  204. package/dist/chunk-ZGV3HNEV.js +1 -0
  205. package/dist/chunk-ZQDDRIBA.js +22 -0
  206. package/dist/{chunk-QTLGMJDW.js → chunk-ZT5WFUKJ.js} +4 -4
  207. package/dist/chunk-ZYQ2XWC5.js +5 -0
  208. package/dist/cli/commands/app/build.js +1 -1
  209. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  210. package/dist/cli/commands/app/bulk/execute.js +1 -1
  211. package/dist/cli/commands/app/bulk/status.js +1 -1
  212. package/dist/cli/commands/app/config/link.js +1 -1
  213. package/dist/cli/commands/app/config/pull.js +1 -1
  214. package/dist/cli/commands/app/config/use.js +1 -1
  215. package/dist/cli/commands/app/config/validate.js +1 -1
  216. package/dist/cli/commands/app/demo/watcher.js +1 -1
  217. package/dist/cli/commands/app/deploy.js +1 -1
  218. package/dist/cli/commands/app/dev/clean.js +1 -1
  219. package/dist/cli/commands/app/dev.js +1 -1
  220. package/dist/cli/commands/app/env/pull.js +1 -1
  221. package/dist/cli/commands/app/env/show.js +1 -1
  222. package/dist/cli/commands/app/execute.js +1 -1
  223. package/dist/cli/commands/app/function/build.js +1 -1
  224. package/dist/cli/commands/app/function/info.js +1 -1
  225. package/dist/cli/commands/app/function/replay.js +1 -1
  226. package/dist/cli/commands/app/function/run.js +1 -1
  227. package/dist/cli/commands/app/function/schema.js +1 -1
  228. package/dist/cli/commands/app/function/typegen.js +1 -1
  229. package/dist/cli/commands/app/generate/extension.js +1 -1
  230. package/dist/cli/commands/app/graphiql.js +1 -1
  231. package/dist/cli/commands/app/import/channel-config.js +1 -1
  232. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  233. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  234. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  235. package/dist/cli/commands/app/import-extensions.js +1 -1
  236. package/dist/cli/commands/app/info.js +1 -1
  237. package/dist/cli/commands/app/init.js +1 -1
  238. package/dist/cli/commands/app/logs.js +1 -1
  239. package/dist/cli/commands/app/release.js +1 -1
  240. package/dist/cli/commands/app/security/check.js +1 -1
  241. package/dist/cli/commands/app/security/clean.js +1 -1
  242. package/dist/cli/commands/app/security/instructions.js +1 -1
  243. package/dist/cli/commands/app/security/record.js +1 -1
  244. package/dist/cli/commands/app/security/review.js +1 -1
  245. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  246. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  247. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  248. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  249. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  250. package/dist/cli/commands/app/versions/list.js +1 -1
  251. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  252. package/dist/cli/commands/auth/login.js +1 -1
  253. package/dist/cli/commands/auth/logout.js +1 -1
  254. package/dist/cli/commands/cache/clear.js +1 -1
  255. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  256. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  257. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  258. package/dist/cli/commands/debug/command-flags.js +1 -1
  259. package/dist/cli/commands/doc/fetch.d.ts +34 -1
  260. package/dist/cli/commands/doc/fetch.js +1 -1
  261. package/dist/cli/commands/doc/search.d.ts +53 -1
  262. package/dist/cli/commands/doc/search.js +1 -1
  263. package/dist/cli/commands/docs/generate.js +1 -1
  264. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  265. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  266. package/dist/cli/commands/help.d.ts +6 -6
  267. package/dist/cli/commands/help.js +1 -1
  268. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  269. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  270. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  271. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  272. package/dist/cli/commands/notifications/generate.js +1 -1
  273. package/dist/cli/commands/notifications/list.js +1 -1
  274. package/dist/cli/commands/organization/list.js +1 -1
  275. package/dist/cli/commands/search.js +1 -1
  276. package/dist/cli/commands/send-analytics.js +1 -1
  277. package/dist/cli/commands/theme/check.js +1 -1
  278. package/dist/cli/commands/theme/console.js +1 -1
  279. package/dist/cli/commands/theme/delete.js +1 -1
  280. package/dist/cli/commands/theme/dev.js +1 -1
  281. package/dist/cli/commands/theme/duplicate.js +1 -1
  282. package/dist/cli/commands/theme/info.js +1 -1
  283. package/dist/cli/commands/theme/init.js +1 -1
  284. package/dist/cli/commands/theme/language-server.js +1 -1
  285. package/dist/cli/commands/theme/list.js +1 -1
  286. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  287. package/dist/cli/commands/theme/open.js +1 -1
  288. package/dist/cli/commands/theme/package.js +1 -1
  289. package/dist/cli/commands/theme/preview.js +1 -1
  290. package/dist/cli/commands/theme/profile.js +1 -1
  291. package/dist/cli/commands/theme/publish.js +1 -1
  292. package/dist/cli/commands/theme/pull.js +1 -1
  293. package/dist/cli/commands/theme/push.js +1 -1
  294. package/dist/cli/commands/theme/rename.js +1 -1
  295. package/dist/cli/commands/theme/share.js +1 -1
  296. package/dist/cli/commands/upgrade.d.ts +64 -0
  297. package/dist/cli/commands/upgrade.js +1 -1
  298. package/dist/cli/commands/version.js +1 -1
  299. package/dist/cli/help.js +1 -1
  300. package/dist/cli/services/commands/doc/fetch-result.d.ts +2 -0
  301. package/dist/cli/services/commands/doc/fetch-result.js +22 -0
  302. package/dist/cli/services/commands/doc/fetch.d.ts +2 -1
  303. package/dist/cli/services/commands/doc/fetch.js +2 -15
  304. package/dist/cli/services/commands/doc/search-result.d.ts +2 -0
  305. package/dist/cli/services/commands/doc/search-result.js +14 -0
  306. package/dist/cli/services/commands/doc/search.d.ts +9 -1
  307. package/dist/cli/services/commands/doc/search.js +27 -2
  308. package/dist/cli/services/commands/doc/types.d.ts +107 -0
  309. package/dist/cli/services/commands/doc/types.js +47 -0
  310. package/dist/cli/services/commands/help/types.d.ts +6 -6
  311. package/dist/command-event-context-LFUZ7UCA.js +1 -0
  312. package/dist/command-json-schema-2UMKY7MY.js +1 -0
  313. package/dist/command-registry.js +1 -1
  314. package/dist/conf-store-RI3TL6I4.js +1 -0
  315. package/dist/custom-oclif-loader-IZCKN67O.js +1 -0
  316. package/dist/deprecations-IFVUXXDB.js +1 -0
  317. package/dist/dist-4H2B7BMN.js +1 -0
  318. package/dist/dist-QNWOGQN3.js +1 -0
  319. package/dist/{environment-RSUK27TA.js → environment-O7ECODHU.js} +1 -1
  320. package/dist/environments-CYMEN7NV.js +1 -0
  321. package/dist/error-IL6WQMSW.js +1 -0
  322. package/dist/error-handler-74HKA23T.js +1 -0
  323. package/dist/fs-AINFLJ2E.js +1 -0
  324. package/dist/hooks/did-you-mean.js +1 -1
  325. package/dist/hooks/hydrogen-init.js +1 -1
  326. package/dist/hooks/plugin-plugins.js +1 -1
  327. package/dist/hooks/postrun.js +1 -1
  328. package/dist/hooks/prerun.js +1 -1
  329. package/dist/hooks/public-metadata.js +1 -1
  330. package/dist/hooks/sensitive-metadata.js +1 -1
  331. package/dist/hooks/tunnel-provider.js +1 -1
  332. package/dist/hooks/tunnel-start.js +1 -1
  333. package/dist/index.js +13 -13
  334. package/dist/is-global-2VLKV46Q.js +1 -0
  335. package/dist/json-error-HZB5YIHV.js +1 -0
  336. package/dist/{lib-TYM5B75S.js → lib-PJHT4MKY.js} +1 -1
  337. package/dist/{lib-55QUD4AJ.js → lib-VKSQ65BQ.js} +1 -1
  338. package/dist/{lib-PH52G55H.js → lib-YEZOHXF3.js} +1 -1
  339. package/dist/{local-R3UAQN7T.js → local-KOZETREJ.js} +1 -1
  340. package/dist/{metadata-JWJG4JV4.js → metadata-IBPHZB7N.js} +1 -1
  341. package/dist/{morph-BABFBRSW.js → morph-CRY35DIK.js} +1 -1
  342. package/dist/node-package-manager-DXSRNEDC.js +1 -0
  343. package/dist/notifications-system-XA3EBOGJ.js +1 -0
  344. package/dist/os-X73O7BAB.js +1 -0
  345. package/dist/out-B2GISN65.js +1 -0
  346. package/dist/output-3OYXK3Z5.js +1 -0
  347. package/dist/{path-CPAYTWQW.js → path-3L2QRACZ.js} +1 -1
  348. package/dist/system-JWYYT4PM.js +1 -0
  349. package/dist/tsconfig.tsbuildinfo +1 -1
  350. package/dist/ui-PCG5D6RZ.js +1 -0
  351. package/dist/upgrade-7U2TUNC4.js +1 -0
  352. package/dist/version-7DGU2KYH.js +1 -0
  353. package/dist/version-SXQTRBXB.js +1 -0
  354. package/dist/workerd-MQZ3NKJI.js +18 -0
  355. package/oclif.manifest.json +1664 -427
  356. package/package.json +8 -8
  357. package/dist/analytics-APDNTBDE.js +0 -1
  358. package/dist/analytics-LX52KYSE.js +0 -1
  359. package/dist/chunk-2PDVBGQH.js +0 -7
  360. package/dist/chunk-2YVSZFXJ.js +0 -4
  361. package/dist/chunk-35WQTGN3.js +0 -5
  362. package/dist/chunk-37BGAWAW.js +0 -2
  363. package/dist/chunk-3C4WVKSO.js +0 -6
  364. package/dist/chunk-3LHE4GIX.js +0 -1
  365. package/dist/chunk-47IQIIFX.js +0 -383
  366. package/dist/chunk-4ES7BJEK.js +0 -1
  367. package/dist/chunk-4IFY7V7W.js +0 -1
  368. package/dist/chunk-4JGWKUJN.js +0 -2
  369. package/dist/chunk-4O5GQ3DS.js +0 -7
  370. package/dist/chunk-4O7LK5RG.js +0 -26
  371. package/dist/chunk-4TFJ5RW7.js +0 -8
  372. package/dist/chunk-4ZNBEMRT.js +0 -20
  373. package/dist/chunk-5JIJDUXX.js +0 -20
  374. package/dist/chunk-66YRAUWX.js +0 -3
  375. package/dist/chunk-6A4H3HPY.js +0 -7
  376. package/dist/chunk-6HPUOCFF.js +0 -1
  377. package/dist/chunk-6IDEDOXW.js +0 -2
  378. package/dist/chunk-6IMHGT7F.js +0 -8
  379. package/dist/chunk-6MC2BEW4.js +0 -1
  380. package/dist/chunk-73D5O7A3.js +0 -1
  381. package/dist/chunk-7E4MJCVE.js +0 -10
  382. package/dist/chunk-7HNRK2CR.js +0 -1
  383. package/dist/chunk-7SJHVJ3W.js +0 -5
  384. package/dist/chunk-ALK66U3O.js +0 -3
  385. package/dist/chunk-AMLCWRHU.js +0 -4
  386. package/dist/chunk-AYIU6Z4C.js +0 -1
  387. package/dist/chunk-BIWG3FQQ.js +0 -5
  388. package/dist/chunk-BQ3U3CQV.js +0 -1
  389. package/dist/chunk-C6IBY7NW.js +0 -16
  390. package/dist/chunk-CQF5NDTJ.js +0 -4
  391. package/dist/chunk-DMDLJRLW.js +0 -1
  392. package/dist/chunk-DMNWSUKV.js +0 -5
  393. package/dist/chunk-FK7GA4QQ.js +0 -1
  394. package/dist/chunk-FO2R6KHG.js +0 -1
  395. package/dist/chunk-FOAV642V.js +0 -1
  396. package/dist/chunk-GE4MLO3C.js +0 -5
  397. package/dist/chunk-GM4EFJJF.js +0 -7
  398. package/dist/chunk-GN66BRYF.js +0 -1
  399. package/dist/chunk-GPRZYFDE.js +0 -1
  400. package/dist/chunk-GZ7VGCVW.js +0 -3
  401. package/dist/chunk-HASIOUH2.js +0 -3
  402. package/dist/chunk-HILYTMVA.js +0 -1
  403. package/dist/chunk-HJHS23Q3.js +0 -1
  404. package/dist/chunk-HLPAVELJ.js +0 -1
  405. package/dist/chunk-HPM3HF7A.js +0 -1
  406. package/dist/chunk-HQJ62PII.js +0 -3
  407. package/dist/chunk-HQY6JM6G.js +0 -6
  408. package/dist/chunk-HSYMUYEZ.js +0 -359
  409. package/dist/chunk-I5PQZRYM.js +0 -32
  410. package/dist/chunk-IPZ6LUJV.js +0 -4
  411. package/dist/chunk-J4NBPC57.js +0 -1
  412. package/dist/chunk-J6LQR2F6.js +0 -7
  413. package/dist/chunk-JYGZD4HM.js +0 -1
  414. package/dist/chunk-K3HUQLIC.js +0 -6
  415. package/dist/chunk-K7D53KSJ.js +0 -1
  416. package/dist/chunk-KQFA5YTT.js +0 -97
  417. package/dist/chunk-KTD7VLHL.js +0 -2
  418. package/dist/chunk-L4DFMMOI.js +0 -1
  419. package/dist/chunk-LJZTSQRD.js +0 -11
  420. package/dist/chunk-LLPB6JN5.js +0 -9
  421. package/dist/chunk-LYIXRMQJ.js +0 -46
  422. package/dist/chunk-MCNK5SJ6.js +0 -2
  423. package/dist/chunk-MJZSSCGD.js +0 -5
  424. package/dist/chunk-N55MSO3X.js +0 -12
  425. package/dist/chunk-N5AZZYQA.js +0 -4
  426. package/dist/chunk-NCVGCVQ5.js +0 -6
  427. package/dist/chunk-O5FFMTJE.js +0 -25
  428. package/dist/chunk-OE3HSNSE.js +0 -16
  429. package/dist/chunk-ONF7XXEL.js +0 -1
  430. package/dist/chunk-PG4S5HJJ.js +0 -5
  431. package/dist/chunk-PHG4DASY.js +0 -18
  432. package/dist/chunk-PP4VCR4Y.js +0 -1
  433. package/dist/chunk-PWS4VFSD.js +0 -1
  434. package/dist/chunk-Q37WAD6F.js +0 -1
  435. package/dist/chunk-Q43LBSPT.js +0 -1
  436. package/dist/chunk-QAJZUJR5.js +0 -1
  437. package/dist/chunk-QO5RNGWA.js +0 -1
  438. package/dist/chunk-QPQS2YU3.js +0 -1
  439. package/dist/chunk-QUXQM3S3.js +0 -1
  440. package/dist/chunk-R3KSOCMB.js +0 -6
  441. package/dist/chunk-R74WHKHH.js +0 -15
  442. package/dist/chunk-RJSQMKKS.js +0 -1
  443. package/dist/chunk-RK2V6OIJ.js +0 -2
  444. package/dist/chunk-RUHQNF2W.js +0 -1
  445. package/dist/chunk-RXTLNUPF.js +0 -1
  446. package/dist/chunk-SNE4RHM4.js +0 -1
  447. package/dist/chunk-SQAS5RVZ.js +0 -10
  448. package/dist/chunk-SZI6G247.js +0 -103
  449. package/dist/chunk-TVCWDEVS.js +0 -1
  450. package/dist/chunk-TYMYIUIQ.js +0 -1
  451. package/dist/chunk-UIC7K2HX.js +0 -7
  452. package/dist/chunk-UNHT4ZFP.js +0 -317
  453. package/dist/chunk-UQ6ALA3Y.js +0 -3
  454. package/dist/chunk-UWI76E2L.js +0 -18
  455. package/dist/chunk-VE35YELD.js +0 -1
  456. package/dist/chunk-VGBUN3CZ.js +0 -17
  457. package/dist/chunk-VMNOSVPT.js +0 -8
  458. package/dist/chunk-VNFUCH6T.js +0 -1
  459. package/dist/chunk-W4KE7AO6.js +0 -1
  460. package/dist/chunk-WEPO4J2F.js +0 -19
  461. package/dist/chunk-WLWHCUPZ.js +0 -1
  462. package/dist/chunk-XGKCPD6W.js +0 -1
  463. package/dist/chunk-XNVOKAF2.js +0 -1
  464. package/dist/chunk-XSMCQLJW.js +0 -1
  465. package/dist/chunk-XUUIBSLW.js +0 -1
  466. package/dist/chunk-XWQM2NZ2.js +0 -2
  467. package/dist/chunk-Y3PY5LP7.js +0 -3
  468. package/dist/chunk-Y62EMOQA.js +0 -1
  469. package/dist/chunk-Y743UVBS.js +0 -16
  470. package/dist/chunk-YBSX53QP.js +0 -1
  471. package/dist/chunk-YHCP326A.js +0 -16
  472. package/dist/chunk-YHESTFMZ.js +0 -4
  473. package/dist/chunk-YT27FIQN.js +0 -275
  474. package/dist/chunk-YTR5JHNJ.js +0 -2
  475. package/dist/chunk-YYA5VGDW.js +0 -1
  476. package/dist/chunk-Z6X2GT6Q.js +0 -1
  477. package/dist/chunk-ZEE32UH6.js +0 -1
  478. package/dist/cli/commands/app/app-logs/sources.js +0 -1
  479. package/dist/command-json-schema-SS4GDJTQ.js +0 -1
  480. package/dist/conf-store-54YJCIDK.js +0 -1
  481. package/dist/custom-oclif-loader-3UBH7Q7R.js +0 -1
  482. package/dist/deprecations-ZX7ZKF6L.js +0 -1
  483. package/dist/dist-JMNE7MP6.js +0 -1
  484. package/dist/dist-M2AXGBOL.js +0 -1
  485. package/dist/environments-KD2IDYPG.js +0 -1
  486. package/dist/error-AA6LW3PN.js +0 -1
  487. package/dist/error-handler-4VW3AV2G.js +0 -1
  488. package/dist/fs-4QZCAEP7.js +0 -1
  489. package/dist/is-global-FKG327CG.js +0 -1
  490. package/dist/json-error-32ETFU3V.js +0 -1
  491. package/dist/node-package-manager-M4XHUTQR.js +0 -1
  492. package/dist/notifications-system-QVM2JWKB.js +0 -1
  493. package/dist/os-FEHBQQKP.js +0 -1
  494. package/dist/out-53ABAVL7.js +0 -1
  495. package/dist/output-2LS5AOAH.js +0 -1
  496. package/dist/system-TMD2LYZM.js +0 -1
  497. package/dist/ui-FNPICAAH.js +0 -1
  498. package/dist/upgrade-YYPP5VZY.js +0 -1
  499. package/dist/version-OX3MORI6.js +0 -1
  500. package/dist/version-P7D5ME4Z.js +0 -1
  501. package/dist/workerd-TKVRZK2F.js +0 -18
@@ -1,2 +1,2 @@
1
- import{Aa as f,Cb as e,Eb as r,Nb as n,Xa as o,ya as d}from"./chunk-UWI76E2L.js";import{c as i}from"./chunk-6IDEDOXW.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();var g=".shopify";async function c(h){let t=i(h,g),a=i(t,".gitignore");return await o(t)||(n(r`Creating hidden .shopify folder at ${e.path(t)}...`),await f(t)),await o(a)||(n(r`Creating .gitignore in ${e.path(t)}...`),await d(a,`# Ignore the entire ${g} directory
1
+ import{Bb as n,Sa as o,qb as e,sb as r,ta as d,va as f}from"./chunk-LWCTKI4Z.js";import{c as i}from"./chunk-IWTNUJGY.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();var g=".shopify";async function c(h){let t=i(h,g),a=i(t,".gitignore");return await o(t)||(n(r`Creating hidden .shopify folder at ${e.path(t)}...`),await f(t)),await o(a)||(n(r`Creating .gitignore in ${e.path(t)}...`),await d(a,`# Ignore the entire ${g} directory
2
2
  *`)),t}export{c as a};
@@ -1,5 +1,5 @@
1
- import{a as Ot}from"./chunk-5HBIIYSK.js";import{a as Gt}from"./chunk-GB3YC4TI.js";import{a as ce}from"./chunk-RJ5VF3QY.js";import{a as ae}from"./chunk-636CTEW7.js";import{Eb as ue,Nb as de}from"./chunk-UWI76E2L.js";import{a as y,c as h,e as A,g as s}from"./chunk-VKWPEFWQ.js";var he=h((rr,pe)=>{s();pe.exports=fe;fe.sync=kt;var le=y("fs");function Nt(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}function me(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Nt(t,r)}function fe(e,t,r){le.stat(e,function(n,o){r(n,n?!1:me(o,e,t))})}function kt(e,t){return me(le.statSync(e),e,t)}});var xe=h((ir,Ee)=>{s();Ee.exports=Se;Se.sync=Ut;var ge=y("fs");function Se(e,t,r){ge.stat(e,function(n,o){r(n,n?!1:ye(o,t))})}function Ut(e,t){return ye(ge.statSync(e),t)}function ye(e,t){return e.isFile()&&Lt(e,t)}function Lt(e,t){var r=e.mode,n=e.uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),c=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),d=parseInt("001",8),l=a|u,f=r&d||r&u&&o===c||r&a&&n===i||r&l&&i===0;return f}});var we=h((ar,be)=>{s();var cr=y("fs"),$;process.platform==="win32"||global.TESTING_WINDOWS?$=he():$=xe();be.exports=U;U.sync=Mt;function U(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){U(e,t||{},function(i,c){i?o(i):n(c)})})}$(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function Mt(e,t){try{return $.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var $e=h((dr,Ae)=>{s();var x=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Te=y("path"),Ft=x?";":":",Ie=we(),ve=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ce=(e,t)=>{let r=t.colon||Ft,n=e.match(/\//)||x&&e.match(/\\/)?[""]:[...x?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=x?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=x?o.split(r):[""];return x&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},Pe=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Ce(e,t),c=[],a=d=>new Promise((l,f)=>{if(d===n.length)return t.all&&c.length?l(c):f(ve(e));let m=n[d],g=/^".*"$/.test(m)?m.slice(1,-1):m,p=Te.join(g,e),S=!g&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;l(u(S,d,0))}),u=(d,l,f)=>new Promise((m,g)=>{if(f===o.length)return m(a(l+1));let p=o[f];Ie(d+p,{pathExt:i},(S,E)=>{if(!S&&E)if(t.all)c.push(d+p);else return m(d+p);return m(u(d,l,f+1))})});return r?a(0).then(d=>r(null,d),r):a(0)},jt=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Ce(e,t),i=[];for(let c=0;c<r.length;c++){let a=r[c],u=/^".*"$/.test(a)?a.slice(1,-1):a,d=Te.join(u,e),l=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let f=0;f<n.length;f++){let m=l+n[f];try{if(Ie.sync(m,{pathExt:o}))if(t.all)i.push(m);else return m}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw ve(e)};Ae.exports=Pe;Pe.sync=jt});var Ge=h((mr,L)=>{"use strict";s();var Re=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};L.exports=Re;L.exports.default=Re});var Ue=h((pr,ke)=>{"use strict";s();var Oe=y("path"),Bt=$e(),Dt=Ge();function Ne(e,t){let r=e.options.env||process.env,n=process.cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}let c;try{c=Bt.sync(e.command,{path:r[Dt({env:r})],pathExt:t?Oe.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return c&&(c=Oe.resolve(o?e.options.cwd:"",c)),c}function qt(e){return Ne(e)||Ne(e,!0)}ke.exports=qt});var Le=h((gr,F)=>{"use strict";s();var M=/([()\][%!^"`<>&|;, *?])/g;function Wt(e){return e=e.replace(M,"^$1"),e}function _t(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(M,"^$1"),t&&(e=e.replace(M,"^$1")),e}F.exports.command=Wt;F.exports.argument=_t});var Fe=h((yr,Me)=>{"use strict";s();Me.exports=/^#!(.*)/});var Be=h((xr,je)=>{"use strict";s();var Ht=Fe();je.exports=(e="")=>{let t=e.match(Ht);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var qe=h((wr,De)=>{"use strict";s();var j=y("fs"),zt=Be();function Xt(e){let r=Buffer.alloc(150),n;try{n=j.openSync(e,"r"),j.readSync(n,r,0,150,0),j.closeSync(n)}catch{}return zt(r.toString())}De.exports=Xt});var ze=h((Ir,He)=>{"use strict";s();var Kt=y("path"),We=Ue(),_e=Le(),Vt=qe(),Yt=process.platform==="win32",Qt=/\.(?:com|exe)$/i,Zt=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Jt(e){e.file=We(e);let t=e.file&&Vt(e.file);return t?(e.args.unshift(e.file),e.command=t,We(e)):e.file}function en(e){if(!Yt)return e;let t=Jt(e),r=!Qt.test(t);if(e.options.forceShell||r){let n=Zt.test(t);e.command=Kt.normalize(e.command),e.command=_e.command(e.command),e.args=e.args.map(i=>_e.argument(i,n));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function tn(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:en(n)}He.exports=tn});var Ve=h((Cr,Ke)=>{"use strict";s();var B=process.platform==="win32";function D(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function nn(e,t){if(!B)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=Xe(o,t);if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}function Xe(e,t){return B&&e===1&&!t.file?D(t.original,"spawn"):null}function rn(e,t){return B&&e===1&&!t.file?D(t.original,"spawnSync"):null}Ke.exports={hookChildProcess:nn,verifyENOENT:Xe,verifyENOENTSync:rn,notFoundError:D}});var Ze=h((Ar,b)=>{"use strict";s();var Ye=y("child_process"),q=ze(),W=Ve();function Qe(e,t,r){let n=q(e,t,r),o=Ye.spawn(n.command,n.args,n.options);return W.hookChildProcess(o,n),o}function on(e,t,r){let n=q(e,t,r),o=Ye.spawnSync(n.command,n.args,n.options);return o.error=o.error||W.verifyENOENTSync(o.status,n),o}b.exports=Qe;b.exports.spawn=Qe;b.exports.sync=on;b.exports._parse=q;b.exports._enoent=W});var ht=h((mo,pt)=>{"use strict";s();var{PassThrough:An}=y("stream");pt.exports=function(){var e=[],t=new An({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=n,t.on("unpipe",o),Array.prototype.slice.call(arguments).forEach(r),t;function r(i){return Array.isArray(i)?(i.forEach(r),this):(e.push(i),i.once("end",o.bind(null,i)),i.once("error",t.emit.bind(t,"error")),i.pipe(t,{end:!1}),this)}function n(){return e.length==0}function o(i){e=e.filter(function(c){return c!==i}),!e.length&&t.readable&&t.end()}}});s();s();var At=A(Ze(),1);import{Buffer as Hn}from"node:buffer";import zn from"node:path";import ne from"node:child_process";import k from"node:process";s();function _(e){let t=typeof e=="string"?`
1
+ import{a as Ot}from"./chunk-5HBIIYSK.js";import{a as Gt}from"./chunk-GB3YC4TI.js";import{a as ce}from"./chunk-RJ5VF3QY.js";import{a as ae}from"./chunk-636CTEW7.js";import{Bb as de,sb as ue}from"./chunk-LWCTKI4Z.js";import{a as y,c as h,e as A,g as s}from"./chunk-VKWPEFWQ.js";var he=h((rr,pe)=>{s();pe.exports=fe;fe.sync=kt;var le=y("fs");function Nt(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}function me(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Nt(t,r)}function fe(e,t,r){le.stat(e,function(n,o){r(n,n?!1:me(o,e,t))})}function kt(e,t){return me(le.statSync(e),e,t)}});var xe=h((ir,Ee)=>{s();Ee.exports=Se;Se.sync=Ut;var ge=y("fs");function Se(e,t,r){ge.stat(e,function(n,o){r(n,n?!1:ye(o,t))})}function Ut(e,t){return ye(ge.statSync(e),t)}function ye(e,t){return e.isFile()&&Lt(e,t)}function Lt(e,t){var r=e.mode,n=e.uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),c=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),d=parseInt("001",8),l=a|u,f=r&d||r&u&&o===c||r&a&&n===i||r&l&&i===0;return f}});var we=h((ar,be)=>{s();var cr=y("fs"),$;process.platform==="win32"||global.TESTING_WINDOWS?$=he():$=xe();be.exports=U;U.sync=Mt;function U(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){U(e,t||{},function(i,c){i?o(i):n(c)})})}$(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function Mt(e,t){try{return $.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var $e=h((dr,Ae)=>{s();var x=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Te=y("path"),Ft=x?";":":",Ie=we(),ve=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ce=(e,t)=>{let r=t.colon||Ft,n=e.match(/\//)||x&&e.match(/\\/)?[""]:[...x?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=x?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=x?o.split(r):[""];return x&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},Pe=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Ce(e,t),c=[],a=d=>new Promise((l,f)=>{if(d===n.length)return t.all&&c.length?l(c):f(ve(e));let m=n[d],g=/^".*"$/.test(m)?m.slice(1,-1):m,p=Te.join(g,e),S=!g&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;l(u(S,d,0))}),u=(d,l,f)=>new Promise((m,g)=>{if(f===o.length)return m(a(l+1));let p=o[f];Ie(d+p,{pathExt:i},(S,E)=>{if(!S&&E)if(t.all)c.push(d+p);else return m(d+p);return m(u(d,l,f+1))})});return r?a(0).then(d=>r(null,d),r):a(0)},jt=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Ce(e,t),i=[];for(let c=0;c<r.length;c++){let a=r[c],u=/^".*"$/.test(a)?a.slice(1,-1):a,d=Te.join(u,e),l=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let f=0;f<n.length;f++){let m=l+n[f];try{if(Ie.sync(m,{pathExt:o}))if(t.all)i.push(m);else return m}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw ve(e)};Ae.exports=Pe;Pe.sync=jt});var Ge=h((mr,L)=>{"use strict";s();var Re=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};L.exports=Re;L.exports.default=Re});var Ue=h((pr,ke)=>{"use strict";s();var Oe=y("path"),Bt=$e(),Dt=Ge();function Ne(e,t){let r=e.options.env||process.env,n=process.cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}let c;try{c=Bt.sync(e.command,{path:r[Dt({env:r})],pathExt:t?Oe.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return c&&(c=Oe.resolve(o?e.options.cwd:"",c)),c}function qt(e){return Ne(e)||Ne(e,!0)}ke.exports=qt});var Le=h((gr,F)=>{"use strict";s();var M=/([()\][%!^"`<>&|;, *?])/g;function Wt(e){return e=e.replace(M,"^$1"),e}function _t(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(M,"^$1"),t&&(e=e.replace(M,"^$1")),e}F.exports.command=Wt;F.exports.argument=_t});var Fe=h((yr,Me)=>{"use strict";s();Me.exports=/^#!(.*)/});var Be=h((xr,je)=>{"use strict";s();var Ht=Fe();je.exports=(e="")=>{let t=e.match(Ht);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var qe=h((wr,De)=>{"use strict";s();var j=y("fs"),zt=Be();function Xt(e){let r=Buffer.alloc(150),n;try{n=j.openSync(e,"r"),j.readSync(n,r,0,150,0),j.closeSync(n)}catch{}return zt(r.toString())}De.exports=Xt});var ze=h((Ir,He)=>{"use strict";s();var Kt=y("path"),We=Ue(),_e=Le(),Vt=qe(),Yt=process.platform==="win32",Qt=/\.(?:com|exe)$/i,Zt=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Jt(e){e.file=We(e);let t=e.file&&Vt(e.file);return t?(e.args.unshift(e.file),e.command=t,We(e)):e.file}function en(e){if(!Yt)return e;let t=Jt(e),r=!Qt.test(t);if(e.options.forceShell||r){let n=Zt.test(t);e.command=Kt.normalize(e.command),e.command=_e.command(e.command),e.args=e.args.map(i=>_e.argument(i,n));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function tn(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:en(n)}He.exports=tn});var Ve=h((Cr,Ke)=>{"use strict";s();var B=process.platform==="win32";function D(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function nn(e,t){if(!B)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=Xe(o,t);if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}function Xe(e,t){return B&&e===1&&!t.file?D(t.original,"spawn"):null}function rn(e,t){return B&&e===1&&!t.file?D(t.original,"spawnSync"):null}Ke.exports={hookChildProcess:nn,verifyENOENT:Xe,verifyENOENTSync:rn,notFoundError:D}});var Ze=h((Ar,b)=>{"use strict";s();var Ye=y("child_process"),q=ze(),W=Ve();function Qe(e,t,r){let n=q(e,t,r),o=Ye.spawn(n.command,n.args,n.options);return W.hookChildProcess(o,n),o}function on(e,t,r){let n=q(e,t,r),o=Ye.spawnSync(n.command,n.args,n.options);return o.error=o.error||W.verifyENOENTSync(o.status,n),o}b.exports=Qe;b.exports.spawn=Qe;b.exports.sync=on;b.exports._parse=q;b.exports._enoent=W});var ht=h((mo,pt)=>{"use strict";s();var{PassThrough:An}=y("stream");pt.exports=function(){var e=[],t=new An({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=n,t.on("unpipe",o),Array.prototype.slice.call(arguments).forEach(r),t;function r(i){return Array.isArray(i)?(i.forEach(r),this):(e.push(i),i.once("end",o.bind(null,i)),i.once("error",t.emit.bind(t,"error")),i.pipe(t,{end:!1}),this)}function n(){return e.length==0}function o(i){e=e.filter(function(c){return c!==i}),!e.length&&t.readable&&t.end()}}});s();s();var At=A(Ze(),1);import{Buffer as Hn}from"node:buffer";import zn from"node:path";import ne from"node:child_process";import k from"node:process";s();function _(e){let t=typeof e=="string"?`
2
2
  `:10,r=typeof e=="string"?"\r":13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e}s();var R=new WeakMap,Je=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0,o=e.displayName||e.name||"<anonymous>",i=function(...c){if(R.set(i,++n),n===1)r=e.apply(this,c),e=null;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return r};return ce(i,e),R.set(i,n),i};Je.callCount=e=>{if(!R.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return R.get(e)};var et=Je;s();import hn from"node:process";s();import{constants as un}from"node:os";s();var tt=()=>{let e=rt-nt+1;return Array.from({length:e},sn)},sn=(e,t)=>({name:`SIGRT${t+1}`,number:nt+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),nt=34,rt=64;s();import{constants as cn}from"node:os";s();var ot=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var H=()=>{let e=tt();return[...ot,...e].map(an)},an=({name:e,number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:c}}=cn,a=c!==void 0;return{name:e,number:a?c:t,description:r,supported:a,action:n,forced:o,standard:i}};var dn=()=>{let e=H();return Object.fromEntries(e.map(ln))},ln=({name:e,number:t,description:r,supported:n,action:o,forced:i,standard:c})=>[e,{name:e,number:t,description:r,supported:n,action:o,forced:i,standard:c}],it=dn(),mn=()=>{let e=H(),t=65,r=Array.from({length:t},(n,o)=>fn(o,e));return Object.assign({},...r)},fn=(e,t)=>{let r=pn(e,t);if(r===void 0)return{};let{name:n,description:o,supported:i,action:c,forced:a,standard:u}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:c,forced:a,standard:u}}},pn=(e,t)=>{let r=t.find(({name:n})=>un.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},zr=mn();var gn=({timedOut:e,timeout:t,errorCode:r,signal:n,signalDescription:o,exitCode:i,isCanceled:c})=>e?`timed out after ${t} milliseconds`:c?"was canceled":r!==void 0?`failed with ${r}`:n!==void 0?`was killed with ${n} (${o})`:i!==void 0?`failed with exit code ${i}`:"failed",w=({stdout:e,stderr:t,all:r,error:n,signal:o,exitCode:i,command:c,escapedCommand:a,timedOut:u,isCanceled:d,killed:l,parsed:{options:{timeout:f,cwd:m=hn.cwd()}}})=>{i=i===null?void 0:i,o=o===null?void 0:o;let g=o===void 0?void 0:it[o].description,p=n&&n.code,E=`Command ${gn({timedOut:u,timeout:f,errorCode:p,signal:o,signalDescription:g,exitCode:i,isCanceled:d})}: ${c}`,v=Object.prototype.toString.call(n)==="[object Error]",C=v?`${E}
3
3
  ${n.message}`:E,P=[C,t,e].filter(Boolean).join(`
4
4
  `);return v?(n.originalMessage=n.message,n.message=P):n=new Error(P),n.shortMessage=C,n.command=c,n.escapedCommand=a,n.exitCode=i,n.signal=o,n.signalDescription=g,n.stdout=e,n.stderr=t,n.cwd=m,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!u,n.isCanceled=d,n.killed=l&&!u,n};s();var G=["stdin","stdout","stderr"],Sn=e=>G.some(t=>e[t]!==void 0),st=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return G.map(n=>e[n]);if(Sn(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${G.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,G.length);return Array.from({length:r},(n,o)=>t[o])};s();var ct=A(Ot(),1);import yn from"node:os";var En=1e3*5,at=(e,t="SIGTERM",r={})=>{let n=e(t);return xn(e,t,r,n),n},xn=(e,t,r,n)=>{if(!bn(t,r,n))return;let o=Tn(r),i=setTimeout(()=>{e("SIGKILL")},o);i.unref&&i.unref()},bn=(e,{forceKillAfterTimeout:t},r)=>wn(e)&&t!==!1&&r,wn=e=>e===yn.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Tn=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return En;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},ut=(e,t)=>{e.kill()&&(t.isCanceled=!0)},In=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},dt=(e,{timeout:t,killSignal:r="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let o,i=new Promise((a,u)=>{o=setTimeout(()=>{In(e,r,u)},t)}),c=n.finally(()=>{clearTimeout(o)});return Promise.race([i,c])},lt=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},mt=async(e,{cleanup:t,detached:r},n)=>{if(!t||r)return n;let o=(0,ct.default)(()=>{e.kill()});return n.finally(()=>{o()})};s();import{createWriteStream as vn}from"node:fs";import{ChildProcess as Cn}from"node:child_process";s();function O(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function z(e){return O(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}var Pn=e=>e instanceof Cn&&typeof e.then=="function",X=(e,t,r)=>{if(typeof r=="string")return e[t].pipe(vn(r)),e;if(z(r))return e[t].pipe(r),e;if(!Pn(r))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!z(r.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(r.stdin),r},ft=e=>{e.stdout!==null&&(e.pipeStdout=X.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=X.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=X.bind(void 0,e,"all"))};s();import{createReadStream as $n,readFileSync as Rn}from"node:fs";var Y=A(Gt(),1),gt=A(ht(),1),St=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},Gn=({input:e,inputFile:t})=>typeof t!="string"?e:(St(e),Rn(t)),yt=e=>{let t=Gn(e);if(O(t))throw new TypeError("The `input` option cannot be a stream in sync mode");return t},On=({input:e,inputFile:t})=>typeof t!="string"?e:(St(e),$n(t)),Et=(e,t)=>{let r=On(t);r!==void 0&&(O(r)?r.pipe(e.stdin):e.stdin.end(r))},xt=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let r=(0,gt.default)();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},K=async(e,t)=>{if(!(!e||t===void 0)){e.destroy();try{return await t}catch(r){return r.bufferedData}}},V=(e,{encoding:t,buffer:r,maxBuffer:n})=>{if(!(!e||!r))return t?(0,Y.default)(e,{encoding:t,maxBuffer:n}):Y.default.buffer(e,{maxBuffer:n})},bt=async({stdout:e,stderr:t,all:r},{encoding:n,buffer:o,maxBuffer:i},c)=>{let a=V(e,{encoding:n,buffer:o,maxBuffer:i}),u=V(t,{encoding:n,buffer:o,maxBuffer:i}),d=V(r,{encoding:n,buffer:o,maxBuffer:i*2});try{return await Promise.all([c,a,u,d])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},K(e,a),K(t,u),K(r,d)])}};s();var Nn=(async()=>{})().constructor.prototype,kn=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(Nn,e)]),Q=(e,t)=>{for(let[r,n]of kn){let o=typeof t=="function"?(...i)=>Reflect.apply(n.value,t(),i):n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},wt=e=>new Promise((t,r)=>{e.on("exit",(n,o)=>{t({exitCode:n,signal:o})}),e.on("error",n=>{r(n)}),e.stdin&&e.stdin.on("error",n=>{r(n)})});s();import{Buffer as Un}from"node:buffer";import{ChildProcess as Ln}from"node:child_process";var vt=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],Mn=/^[\w.-]+$/,Fn=/"/g,jn=e=>typeof e!="string"||Mn.test(e)?e:`"${e.replace(Fn,'\\"')}"`,Z=(e,t)=>vt(e,t).join(" "),J=(e,t)=>vt(e,t).map(r=>jn(r)).join(" "),Bn=/ +/g;var Tt=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(t==="object"&&e!==null&&!(e instanceof Ln)&&"stdout"in e){let r=typeof e.stdout;if(r==="string")return e.stdout;if(Un.isBuffer(e.stdout))return e.stdout.toString();throw new TypeError(`Unexpected "${r}" stdout in template expression`)}throw new TypeError(`Unexpected "${t}" in template expression`)},It=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e[e.length-1]}${t[0]}`,...t.slice(1)],Dn=({templates:e,expressions:t,tokens:r,index:n,template:o})=>{let i=o??e.raw[n],c=i.split(Bn).filter(Boolean),a=It(r,c,i.startsWith(" "));if(n===t.length)return a;let u=t[n],d=Array.isArray(u)?u.map(l=>Tt(l)):[Tt(u)];return It(a,d,i.endsWith(" "))},ee=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=Dn({templates:e,expressions:t,tokens:r,index:n,template:o});return r};s();import{debuglog as qn}from"node:util";import Wn from"node:process";var Ct=qn("execa").enabled,N=(e,t)=>String(e).padStart(t,"0"),_n=()=>{let e=new Date;return`${N(e.getHours(),2)}:${N(e.getMinutes(),2)}:${N(e.getSeconds(),2)}.${N(e.getMilliseconds(),3)}`},te=(e,{verbose:t})=>{t&&Wn.stderr.write(`[${_n()}] ${e}
5
- `)};var Xn=1e3*1e3*100,Kn=({env:e,extendEnv:t,preferLocal:r,localDir:n,execPath:o})=>{let i=t?{...k.env,...e}:e;return r?ae({env:i,cwd:n,execPath:o}):i},$t=(e,t,r={})=>{let n=At.default._parse(e,t,r);return e=n.command,t=n.args,r=n.options,r={maxBuffer:Xn,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||k.cwd(),execPath:k.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Ct,...r},r.env=Kn(r),r.stdio=st(r),k.platform==="win32"&&zn.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},T=(e,t,r)=>typeof t!="string"&&!Hn.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?_(t):t;function I(e,t,r){let n=$t(e,t,r),o=Z(e,t),i=J(e,t);te(i,n.options),lt(n.options);let c;try{c=ne.spawn(n.file,n.args,n.options)}catch(g){let p=new ne.ChildProcess,S=Promise.reject(w({error:g,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return Q(p,S),p}let a=wt(c),u=dt(c,n.options,a),d=mt(c,n.options,u),l={isCanceled:!1};c.kill=at.bind(null,c.kill.bind(c)),c.cancel=ut.bind(null,c,l);let m=et(async()=>{let[{error:g,exitCode:p,signal:S,timedOut:E},v,C,P]=await bt(c,n.options,d),re=T(n.options,v),oe=T(n.options,C),ie=T(n.options,P);if(g||p!==0||S!==null){let se=w({error:g,exitCode:p,signal:S,stdout:re,stderr:oe,all:ie,command:o,escapedCommand:i,parsed:n,timedOut:E,isCanceled:l.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:c.killed});if(!n.options.reject)return se;throw se}return{command:o,escapedCommand:i,exitCode:0,stdout:re,stderr:oe,all:ie,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Et(c,n.options),c.all=xt(c,n.options),ft(c),Q(c,m),c}function Vn(e,t,r){let n=$t(e,t,r),o=Z(e,t),i=J(e,t);te(i,n.options);let c=yt(n.options),a;try{a=ne.spawnSync(n.file,n.args,{...n.options,input:c})}catch(l){throw w({error:l,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}let u=T(n.options,a.stdout,a.error),d=T(n.options,a.stderr,a.error);if(a.error||a.status!==0||a.signal!==null){let l=w({stdout:u,stderr:d,error:a.error,signal:a.signal,exitCode:a.status,command:o,escapedCommand:i,parsed:n,timedOut:a.error&&a.error.code==="ETIMEDOUT",isCanceled:!1,killed:a.signal!==null});if(!n.options.reject)return l;throw l}return{command:o,escapedCommand:i,exitCode:0,stdout:u,stderr:d,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}var Yn=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Pt=(e={})=>({preferLocal:!0,...Yn(e),...e});function Rt(e){function t(r,...n){if(!Array.isArray(r))return Rt({...e,...r});let[o,...i]=ee(r,n);return I(o,i,Pt(e))}return t.sync=(r,...n)=>{if(!Array.isArray(r))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[o,...i]=ee(r,n);return Vn(o,i,Pt(e))},t}var Ho=Rt();import{userInfo as Qn}from"os";async function Qo(e=process.platform){de(ue`Obtaining user name...`);let t=Jn();if(t)return t;let r=er();if(r)return r;try{if(e==="win32"){let{stdout:o}=await I("whoami");return tr(o)}let{stdout:n}=await I("id",["-u"]);try{let{stdout:o}=await I("id",["-un",n]);return o}catch{}return nr(n)}catch{return null}}var Zn={x64:"amd64",ia32:"386"};function Zo(e=process.platform,t=process.arch){let r=Zn[t]??t;return{platform:e.match(/^win.+/)?"windows":e,arch:r}}function Jn(){let{env:e}=process;return e.SUDO_USER||e.C9_USER||e.LOGNAME||e.USER||e.LNAME||e.USERNAME}function er(){try{return Qn().username}catch{return null}}function tr(e){return e.replace(/^.*\\/,"")}function nr(e){return`no-username-${e}`}export{Ze as a,I as b,Qo as c,Zo as d};
5
+ `)};var Xn=1e3*1e3*100,Kn=({env:e,extendEnv:t,preferLocal:r,localDir:n,execPath:o})=>{let i=t?{...k.env,...e}:e;return r?ae({env:i,cwd:n,execPath:o}):i},$t=(e,t,r={})=>{let n=At.default._parse(e,t,r);return e=n.command,t=n.args,r=n.options,r={maxBuffer:Xn,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||k.cwd(),execPath:k.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Ct,...r},r.env=Kn(r),r.stdio=st(r),k.platform==="win32"&&zn.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},T=(e,t,r)=>typeof t!="string"&&!Hn.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?_(t):t;function I(e,t,r){let n=$t(e,t,r),o=Z(e,t),i=J(e,t);te(i,n.options),lt(n.options);let c;try{c=ne.spawn(n.file,n.args,n.options)}catch(g){let p=new ne.ChildProcess,S=Promise.reject(w({error:g,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return Q(p,S),p}let a=wt(c),u=dt(c,n.options,a),d=mt(c,n.options,u),l={isCanceled:!1};c.kill=at.bind(null,c.kill.bind(c)),c.cancel=ut.bind(null,c,l);let m=et(async()=>{let[{error:g,exitCode:p,signal:S,timedOut:E},v,C,P]=await bt(c,n.options,d),re=T(n.options,v),oe=T(n.options,C),ie=T(n.options,P);if(g||p!==0||S!==null){let se=w({error:g,exitCode:p,signal:S,stdout:re,stderr:oe,all:ie,command:o,escapedCommand:i,parsed:n,timedOut:E,isCanceled:l.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:c.killed});if(!n.options.reject)return se;throw se}return{command:o,escapedCommand:i,exitCode:0,stdout:re,stderr:oe,all:ie,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Et(c,n.options),c.all=xt(c,n.options),ft(c),Q(c,m),c}function Vn(e,t,r){let n=$t(e,t,r),o=Z(e,t),i=J(e,t);te(i,n.options);let c=yt(n.options),a;try{a=ne.spawnSync(n.file,n.args,{...n.options,input:c})}catch(l){throw w({error:l,stdout:"",stderr:"",all:"",command:o,escapedCommand:i,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}let u=T(n.options,a.stdout,a.error),d=T(n.options,a.stderr,a.error);if(a.error||a.status!==0||a.signal!==null){let l=w({stdout:u,stderr:d,error:a.error,signal:a.signal,exitCode:a.status,command:o,escapedCommand:i,parsed:n,timedOut:a.error&&a.error.code==="ETIMEDOUT",isCanceled:!1,killed:a.signal!==null});if(!n.options.reject)return l;throw l}return{command:o,escapedCommand:i,exitCode:0,stdout:u,stderr:d,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}var Yn=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Pt=(e={})=>({preferLocal:!0,...Yn(e),...e});function Rt(e){function t(r,...n){if(!Array.isArray(r))return Rt({...e,...r});let[o,...i]=ee(r,n);return I(o,i,Pt(e))}return t.sync=(r,...n)=>{if(!Array.isArray(r))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[o,...i]=ee(r,n);return Vn(o,i,Pt(e))},t}var Ho=Rt();import{userInfo as Qn}from"os";async function Qo(e=process.platform){de(ue`Obtaining user name...`);let t=Jn();if(t)return t;let r=er();if(r)return r;try{if(e==="win32"){let{stdout:o}=await I("whoami");return tr(o)}let{stdout:n}=await I("id",["-u"]);try{let{stdout:o}=await I("id",["-un",n]);return o}catch{}return nr(n)}catch{return null}}var Zn={x64:"amd64",ia32:"386"};function Zo(e=process.platform,t=process.arch){let r=Zn[t]??t;return{platform:e.match(/^win.+/)?"windows":e,arch:r}}function Jn(){let{env:e}=process;return e.SUDO_USER||e.C9_USER||e.LOGNAME||e.USER||e.LNAME||e.USERNAME}function er(){try{return Qn().username}catch{return null}}function tr(e){return e.replace(/^.*\\/,"")}function nr(e){return`no-username-${e}`}export{I as a,Qo as b,Zo as c};
@@ -0,0 +1,3 @@
1
+ import{a as Se}from"./chunk-7IFE4UQY.js";import{a as se}from"./chunk-6BNKBCCU.js";import{a as ye,b as H}from"./chunk-ZQDDRIBA.js";import{E as U,N as O,u as w,va as ce,xa as M,ya as me}from"./chunk-H4V55Y3Z.js";import{e as _}from"./chunk-ZT5WFUKJ.js";import{d as ve}from"./chunk-Q2SZCZE7.js";import{B as D,C as B,F as le,W as fe,a as ae,y as pe}from"./chunk-CZ22VZDA.js";import{c as ie}from"./chunk-J6TW43TG.js";import{b as ne,o as re}from"./chunk-335BUVBP.js";import{d as ue,e as de}from"./chunk-X7HVAVSZ.js";import{h as x,k as he}from"./chunk-2VSNFOKD.js";import{Bb as g,Ea as te,Ta as C,qb as G,sb as y,wb as ge}from"./chunk-LWCTKI4Z.js";import{h as oe,i as L,j as R}from"./chunk-FZCGRIOM.js";import{b as Le}from"./chunk-YTUUU33R.js";import{c as Z,e as $,h as ee,p as k}from"./chunk-IWTNUJGY.js";import{e as qe,g as S}from"./chunk-VKWPEFWQ.js";S();var b=qe(Le(),1);var Y={path:b.Flags.string({description:"The path where you want to run the command. Defaults to the current working directory.",env:"SHOPIFY_FLAG_PATH",parse:async n=>{let e=$(n);if(!C(e))throw new x("A path was explicitly provided but doesn't exist.",`Please check the path and try again: ${e}`);if(!te(e))throw new x("The path must be a directory, not a file.",`The provided path is not a directory: ${e}. Did you mean: ${ee(e)}`);return e},default:async()=>k(),noCacheDefault:!0}),password:b.Flags.string({description:"Password generated from the Theme Access app or an Admin API token.",env:"SHOPIFY_CLI_THEME_TOKEN"}),store:b.Flags.string({char:"s",description:"Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).",env:"SHOPIFY_FLAG_STORE",parse:async n=>w(n)}),environment:b.Flags.string({char:"e",description:"The environment to apply to the current command.",env:"SHOPIFY_FLAG_ENVIRONMENT",multiple:!0})},we="Wrap the value in double quotes if you're using wildcards.",Ve=n=>({only:b.Flags.string({char:"o",multiple:!0,description:`${n.charAt(0).toUpperCase()+n.slice(1)} only the specified files (Multiple flags allowed). ${we}`,env:"SHOPIFY_FLAG_ONLY"}),ignore:b.Flags.string({char:"x",multiple:!0,description:`Skip ${n}ing the specified files (Multiple flags allowed). ${we}`,env:"SHOPIFY_FLAG_IGNORE"})});S();S();S();import{AsyncLocalStorage as Ue}from"node:async_hooks";var Fe=new Ue,Ae,Ee,xe,Te;function v(){return Ae??=new _({projectName:"shopify-cli-theme-conf"}),Ae}function z(){return Ee??=new _({projectName:"shopify-cli-development-theme-config"}),Ee}function J(){return xe??=new _({projectName:"shopify-cli-repl-theme-config"}),xe}function W(){return Te??=new _({projectName:"shopify-cli-theme-store-password"}),Te}function K(n=v()){return Fe.getStore()?.store??n.get("themeStore")}function Ie(n,e=v()){e.set("themeStore",n)}function rt(n=v()){return g(y`Getting development theme...`),z().get(F(n))}function ot(n,e=v()){g(y`Setting development theme...`),z().set(F(e),n)}function st(n=v()){g(y`Removing development theme...`),z().delete(F(n))}function it(n=v()){return g(y`Getting REPL theme...`),J().get(F(n))}function at(n,e=v()){g(y`Setting REPL theme to ${n}...`),J().set(F(e),n)}function ct(n=v()){g(y`Removing REPL theme...`),J().delete(F(n))}function mt(n=v()){let e=F(n);return g(y`Getting storefront password for shop ${e}...`),W().get(e)}function ut(n,e=v()){let t=F(e);g(y`Setting storefront password for shop ${t}...`),W().set(t,n)}function dt(n=v()){let e=F(n);g(y`Removing storefront password for ${e}...`),W().delete(e)}function F(n=v()){let e=K(n);if(!e)throw new he("Theme store is not set. This indicates an unexpected issue with the CLI. Please report this to the Shopify CLI team.",["It may be possible to recover by running",{command:"shopify theme list --store <store>"},"(setting the store flag to the store you wish to use) and then running the command again."]);return e}async function _e(n,e){return Fe.run({store:n},e)}function be(n){let e=n.store??K();if(!e)throw ce(new x("A store is required",`Specify the store passing ${y`${G.genericShellCommand(`--${Y.store.name}=example.myshopify.com`)}`.value} or set the ${y`${G.genericShellCommand(Y.store.env)}`.value} environment variable.`));return Ie(e),e}S();var Ce="shopify.theme.toml",At=new Intl.DateTimeFormat(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),Et=["**/.git","**/.vscode","**/.hg","**/.bzr","**/.svn","**/_darcs","**/CVS","**/*.sublime-(project|workspace)","**/.DS_Store","**/.sass-cache","**/Thumbs.db","**/desktop.ini","**/config.yml","**/node_modules/",".prettierrc.json","**/{blocks,layout,snippets}/**/*.liquid.tmp.*","**/{config,locales}/**/*.json.tmp.*","**/{sections,templates}/**/*.{liquid,json}.tmp.*"],xt=50;S();S();var V="7e9cb568cfd431c538f36d1ad3f2b4f6";var Oe="shopify-cli-store",Me=240*1e3,Pe;function j(){return Pe??=new _({projectName:Oe}),Pe}function P(n){return`${V}::${De(n)}`}function De(n){return n.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function p(n){return typeof n=="string"}function Be(n){if(!n||typeof n!="object")return;let e=n;if(typeof e.id=="number")return{id:e.id,...p(e.email)?{email:e.email}:{},...p(e.firstName)?{firstName:e.firstName}:{},...p(e.lastName)?{lastName:e.lastName}:{},...typeof e.accountOwner=="boolean"?{accountOwner:e.accountOwner}:{}}}function Ge(n){if(!n||typeof n!="object")return;let e=n;if(!(!p(e.shopId)||!p(e.name)||!p(e.createdAt)))return{shopId:e.shopId,name:e.name,createdAt:e.createdAt,...p(e.placeholderAccountUuid)?{placeholderAccountUuid:e.placeholderAccountUuid}:{},...p(e.country)?{country:e.country}:{},...p(e.accessUrl)?{accessUrl:e.accessUrl}:{}}}function He(n){if(!n||typeof n!="object")return;let e=n;if(!p(e.store)||!p(e.clientId)||!p(e.userId)||!p(e.accessToken)||!Array.isArray(e.scopes)||!e.scopes.every(p)||!p(e.acquiredAt))return;let t=Be(e.associatedUser),r=e.kind==="preview"?"preview":"standard",o=r==="preview"?Ge(e.preview):void 0;if(!(r==="preview"&&!o))return{store:e.store,clientId:e.clientId,userId:e.userId,accessToken:e.accessToken,scopes:e.scopes,acquiredAt:e.acquiredAt,...p(e.refreshToken)?{refreshToken:e.refreshToken}:{},...p(e.expiresAt)?{expiresAt:e.expiresAt}:{},...p(e.refreshTokenExpiresAt)?{refreshTokenExpiresAt:e.refreshTokenExpiresAt}:{},...t?{associatedUser:t}:{},...r==="preview"?{kind:r}:{},...o?{preview:o}:{}}}function $e(n,e,t){if(!e||typeof e!="object")return;let{sessionsByUserId:r,currentUserId:o}=e;if(!(r!==void 0||o!==void 0))return;let s=P(n);if(!r||typeof r!="object"||Array.isArray(r)||typeof o!="string"){t.delete(s);return}let i=Object.fromEntries(Object.entries(r).flatMap(([c,m])=>{let u=He(m);return u?[[c,u]]:[]}));if(Object.keys(i).length!==Object.keys(r).length)if(i[o])t.set(s,{currentUserId:o,sessionsByUserId:i});else{t.delete(s);return}return{currentUserId:o,sessionsByUserId:i}}function Q(n,e){return $e(n,e.get(P(n)),e)}function Ye(n){return n.config?.store??{}}function ke(n=j()){let e=[],t=`${V}::`;for(let[r,o]of Object.entries(Ye(n))){if(!r.startsWith(t))continue;let a=$e(r.slice(t.length),o,n),s=a?.sessionsByUserId[a.currentUserId];s&&e.push(s)}return e}function Re(n,e=j()){let t=w(n),r=Q(t,e);if(!r)return;let o=r.sessionsByUserId[r.currentUserId];if(!o){e.delete(P(t));return}return o}function kt(n,e=j()){let t=P(n.store),r=Q(n.store,e),o={currentUserId:n.userId,sessionsByUserId:{...r?.sessionsByUserId??{},[n.userId]:n}};e.set(t,o)}function Rt(n,e,t){let r=w(n),o=typeof e=="string"?e:void 0,a=(typeof e=="string"?t:e)??j(),s=P(r);if(!o){a.delete(s);return}let i=Q(r,a);if(!i)return;let{[o]:c,...m}=i.sessionsByUserId,u=Object.keys(m);if(u.length===0){a.delete(s);return}a.set(s,{currentUserId:i.currentUserId===o?u[0]:i.currentUserId,sessionsByUserId:m})}function je(n){if(!n.expiresAt)return!1;let e=new Date(n.expiresAt).getTime();return Number.isNaN(e)?!0:e-Me<Date.now()}var X=class extends H{static baseFlags={...H.baseFlags,...ve};environmentsFilename(){return this.hasExplicitEnvironment()&&this.collectsEnvironmentResults({json:re(process.env,this.argv)})?void 0:Ce}async command(e,t,r=!1,o,a){}async run(e){let t=this.constructor,r=t.multiEnvironmentsFlags,o=this.hasExplicitEnvironment(),{args:a,flags:s}=await this.parse(t);return this.runWithParsedOutput(s,async()=>{let i="password"in t.flags,c=(Array.isArray(s.environment)?s.environment:[s.environment]).filter(Boolean),m=o&&this.collectsEnvironmentResults(s),u=this.requiredFlagsForSingleEnvironment(r??[]),l=u.some(d=>Array.isArray(d)?d.includes("store"):d==="store");if(c.length<=1&&!(c.length>0&&m)){if(c[0]&&!s.store&&l)throw new x("Please provide a valid environment.");this.validateCommandFlags(s);let d=i?await this.createSession(s):void 0,N=this.constructor.name.toLowerCase();if(M(`theme-command:${N}:single-env:authenticated`),s.path&&!C(s.path))throw new x(`Path does not exist: ${s.path}`);try{await this.command(s,d,!1,a)}finally{await this.logAnalyticsData(d)}return}if(r===null&&c.length>1){if(s.json)throw new x("This command does not support multiple environments.");D({body:"This command does not support multiple environments."});return}let{flags:h}=await this.parse(ye(t),this.argv);if(c.length>1&&"path"in h){this.errorOnGlobalPath(!!s.json);return}let f=await this.loadEnvironments(c,s,h);m||=Array.from(f.values()).some(({flags:d})=>this.collectsEnvironmentResults(d));let T=async()=>{let d=await this.validateEnvironments(f,c.length===1?u:r??[],i,m);if((m?d.valid.some(({flags:I})=>this.requiresEnvironmentConfirmation(I)):this.requiresEnvironmentConfirmation(s))&&!await this.showConfirmation(this.constructor.name,r??[],d)){m&&this.renderEnvironmentResults(c.map(E=>({environment:E,result:{status:"cancelled"}})));return}let A=await this.runConcurrent(d.valid,m);if(m){let I=c.map(E=>{let q=d.invalid.find(Ne=>Ne.environment===E);return A.get(E)??{environment:E,error:{type:"abort",message:q?.reason??"The environment did not return a result."}}});this.renderEnvironmentResults(I),I.some(E=>"error"in E)&&(process.exitCode=1)}};return m&&R()!=="json"?oe({outputMode:"json",sink:ie},T):T()})}validateCommandFlags(e){}requiredFlagsForSingleEnvironment(e){return e.filter(t=>t!=="password")}collectsEnvironmentResults(e){let t=this.constructor;return!!(e.json&&t.jsonOutputSchema)}requiresEnvironmentConfirmation(e){return"force"in this.constructor.flags&&!e.force&&(!this.collectsEnvironmentResults(e)||fe())}renderEnvironmentResults(e){let t=this.constructor;ge(t.jsonOutputSchema.encode({environments:e}))}validateNonTTYFlags(e){let t=this.constructor;"multiEnvironmentsFlags"in t&&t.multiEnvironmentsFlags!==void 0&&Array.isArray(e.environment)&&(e.environment.length>1||e.environment.length===1&&this.hasExplicitEnvironment()&&this.collectsEnvironmentResults(e))||super.validateNonTTYFlags(e)}storeAuthScopes(){}hasExplicitEnvironment(){return this.argv.some(e=>e==="--environment"||e.startsWith("--environment=")||e.startsWith("-e"))||!!process.env.SHOPIFY_FLAG_ENVIRONMENT}async loadEnvironments(e,t,r){let o=new Map;for(let s of e){let i;try{i=await Se(s,"shopify.theme.toml",{from:t.path,silent:!0})}catch(c){if(!this.collectsEnvironmentResults(t))throw c;o.set(s,{flags:t,validationFlags:{},parserFlags:{},error:c instanceof Error?c.message:String(c)});continue}i?.store&&typeof i.store=="string"&&(i.store=w(i.store)),typeof i?.theme=="number"?i.theme=String(i.theme):Array.isArray(i?.theme)&&(i.theme=i.theme.map(String)),i?.path&&typeof i.path=="string"&&(i.path=$(i.path)),o.set(s,{parserFlags:{...i,...r},flags:{...t,...i,...r,environment:[s]},validationFlags:{...e.length===1?t:{},...i,...r}})}if(this.collectsEnvironmentResults(t)||Array.from(o.values()).some(s=>this.collectsEnvironmentResults(s.flags))){for(let[s,i]of o)if(!i.error){i.flags={...i.flags,json:!0};try{let c=await this.parseEnvironmentFlags({json:!0,...i.parserFlags},this.constructor,r);i.flags={...i.flags,...c,environment:[s]}}catch(c){i.error=c instanceof Error?c.message:String(c)}}}return o}async validateEnvironments(e,t,r,o=!1){let a=[],s=[],i=r?this.storeAuthSessionsForTheme(Array.from(e.values()).map(({validationFlags:m})=>m)):new Map,c=Array.from(e.entries()).map(([m,{flags:u,validationFlags:l,error:h}])=>({environmentName:m,error:h,flags:u,validationFlags:l,storeAuthSession:this.storeAuthSessionFromCache(l,i)}));for(let{environmentName:m,flags:u,validationFlags:l,storeAuthSession:h,error:f}of c){if(f){s.push({environment:m,reason:f});continue}let T=this.validConfig(l,t,m,h,o);if(T!==!0){let d=T.join(", ");s.push({environment:m,reason:`Missing flags: ${d}`});continue}try{this.validateCommandFlags(u),super.validateNonTTYFlags(u)}catch(d){if(!o)throw d;s.push({environment:m,reason:d instanceof Error?d.message:String(d)});continue}a.push({environment:m,flags:u,requiresAuth:r,storeAuthSession:h})}return{valid:a,invalid:s}}async showConfirmation(e,t,r){let s={message:[`Run ${e.toLowerCase()} in the following environments?`],confirmationMessage:"Yes, proceed",cancellationMessage:"Cancel"},i=[...r.valid.map(({environment:c,flags:m})=>{let u=t.map(l=>{let h=Array.isArray(l)?l.find(f=>m[f]):l;if(h==="password")return"password";if(h==="path"&&typeof m.path=="string"){let f=m.path.split(/[/\\]/);if(f.length===1)return`path: ${m.path}`;let T=f[0]===""?`/${f[1]}`:f[0],d=f.at(-1);return`path: ${T}/.../${d}`}return h&&`${h}: ${m[h]}`}).join(", ");return[c,{subdued:u||"No flags required"}]}),...r.invalid.map(({environment:c,reason:m})=>[c,{error:`Skipping | ${m}`}])];return s.infoTable={Environment:i},r.invalid.length>0&&(s.confirmationMessage="Proceed anyway (will skip invalid environments)"),le(s)}async runConcurrent(e,t=!1){let r=new Map,o=new ae,a=e.map(c=>c.flags.store),s=new Set(a),i=a.length===s.size?[e]:this.createSequentialGroups(e);for(let c of i){let m=c.map(({environment:u,flags:l,requiresAuth:h,storeAuthSession:f})=>({prefix:u,action:async(T,d,N)=>{try{let A=l.store,I=await _e(A,async()=>{let E=h?await this.createSession(l,f):void 0,q=this.constructor.name.toLowerCase();M(`theme-command:${q}:multi-env:authenticated`);try{return await this.command(t?{...l,json:!0}:l,E,!0,{},{stdout:T,stderr:d})}finally{await this.logAnalyticsData(E)}});r.set(u,{environment:u,result:I??{status:"cancelled"}})}catch(A){process.exitCode=1,t&&r.set(u,{environment:u,error:se(A)}),A instanceof Error&&(A.message=`Environment ${u} failed:
2
+
3
+ ${A.message}`,t||R()==="json"?L({type:"diagnostic",level:"error",code:"theme-environment-failed",message:A.message}):B({body:[A.message]}))}}}));t?await Promise.all(m.map(({action:u})=>u(process.stdout,process.stderr,o.signal))):await pe({processes:m,abortSignal:o.signal,showTimestamps:!0,renderOptions:{stdout:process.stderr}})}return r}createSequentialGroups(e){let t=[];return e.forEach(r=>{let o=t.find(a=>!a.some(s=>s.flags.store===r.flags.store));o?o.push(r):t.push([r])}),t}async createSession(e,t){let r=be({store:e.store}),o=e.password;return o?await O(r,o):t??await this.storeAuthSessionForTheme({store:r})??await O(r,o)}async storeAuthSessionForTheme(e){let t=this.storeAuthScopes();if(!t)return;let r=typeof e.store=="string"?e.store:void 0,o=e.password;if(!r||o)return;let a=w(r),s=Re(a);if(s)return this.adminSessionFromStoreAuthSession(s,a,t)}storeAuthSessionsForTheme(e){let t=this.storeAuthScopes();if(!t)return new Map;let r=new Set(e.filter(({store:o,password:a})=>typeof o=="string"&&!a).map(({store:o})=>w(o)));return r.size===0?new Map:new Map(ke().map(o=>{let a=w(o.store);if(!r.has(a))return;let s=this.adminSessionFromStoreAuthSession(o,a,t);return s?[a,s]:void 0}).filter(o=>o!==void 0))}storeAuthSessionFromCache(e,t){let r=typeof e.store=="string"?e.store:void 0,o=e.password;if(!(!r||o))return t.get(w(r))}adminSessionFromStoreAuthSession(e,t,r){if(je(e)){g(`Ignoring stored store auth session for ${t}: it expired at ${e.expiresAt??"unknown"}.`);return}if(!this.hasRequiredStoreAuthScopes(e.scopes,r)){g(`Ignoring stored store auth session for ${t}: it is missing required scopes (has: ${e.scopes.join(", ")}; needs: ${r.join(", ")}).`);return}return g(`Using stored store auth session for ${t} (scopes: ${e.scopes.join(", ")}).`),U(e.userId),{token:e.accessToken,storeFqdn:t}}expandImpliedStoreAuthScopes(e){let t=new Set(e);for(let r of e){let o=r.match(/^(unauthenticated_)?write_(.*)$/);o&&t.add(`${o[1]??""}read_${o[2]}`)}return t}hasRequiredStoreAuthScopes(e,t){let r=this.expandImpliedStoreAuthScopes(e);return t.every(o=>r.has(o))}validConfig(e,t,r,o,a=!1){let s=t.filter(i=>Array.isArray(i)?!i.some(c=>this.hasRequiredFlag(e,c,o)):!this.hasRequiredFlag(e,i,o)).map(i=>Array.isArray(i)?i.join(" or "):i);return s.length>0?(a||R()==="json"?L({type:"diagnostic",level:"warning",code:"theme-environment-invalid",message:`Missing required flags in environment configuration for ${r}: ${s.join(", ")}`}):D({body:[`Missing required flags in environment configuration${r?` for ${r}`:""}:`,{list:{items:s}}]}),s):!0}hasRequiredFlag(e,t,r){return t==="password"&&r?!0:!!e[t]}errorOnGlobalPath(e){let t=Z(k(),"shopify.theme.toml"),r=C(t),o="Can't use `--path` flag with multiple environments.",a=r?["Configure each environment's theme path in your shopify.theme.toml file instead."]:["Run this command from the directory containing shopify.theme.toml.","No shopify.theme.toml found in current directory."];if(e)throw new x(o,a.join(" "));B({body:[o,...a]})}async logAnalyticsData(e){if(e)try{let t=me();await ue(()=>({store_fqdn_hash:ne(e.storeFqdn),store_domain:e.storeFqdn,cmd_theme_timings:JSON.stringify(t.timings),cmd_theme_errors:JSON.stringify(t.errors),cmd_theme_retries:JSON.stringify(t.retries),cmd_theme_events:JSON.stringify(t.events)})),await de(()=>({store_fqdn:e.storeFqdn}))}catch(t){g(`Unable to record theme analytics: ${t instanceof Error?t.message:String(t)}`)}}};export{V as a,ke as b,Re as c,kt as d,Rt as e,K as f,rt as g,ot as h,st as i,it as j,at as k,ct as l,mt as m,ut as n,dt as o,Y as p,Ve as q,be as r,At as s,Et as t,xt as u,X as v};
@@ -0,0 +1,47 @@
1
+ import{k as j,t as M}from"./chunk-5TB52UUV.js";import{a as F}from"./chunk-Q7BOSHWX.js";import{a as _}from"./chunk-AJMDF3QC.js";import{L as I,N as q,k as w,va as f,xa as h}from"./chunk-H4V55Y3Z.js";import{a as x}from"./chunk-4C2DAX5T.js";import{C as L,D as O,U as P}from"./chunk-CZ22VZDA.js";import{h as l,j as U}from"./chunk-2VSNFOKD.js";import{Bb as c,qb as R,sb as D}from"./chunk-LWCTKI4Z.js";import{i as H,j as v}from"./chunk-FZCGRIOM.js";import{u as N}from"./chunk-3A3DZVEJ.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();p();function G(e){let t=new URLSearchParams;for(let[r,o]of Object.entries(e.replaceTemplates??[]))t.append(`replace_templates[${r}]`,o);for(let[r,o]of Object.entries(e.replaceExtensionTemplates??[])){let s=r.split("/")[0];t.append(`replace_extension_templates[${s}][${r}]`,o)}return t.append("_method",e.method),t}function S(){return{"User-Agent":`Shopify CLI; v=${x}`}}function T(e){return delete e.cookie,delete e.authorization,e}p();function y(e){let t={};return e.split(";").forEach(r=>{let o=r.match(/(.*?)=(.*)$/)??[],s=o[1]?.trim(),n=o[2]?.trim()??"";s&&(t[s]=n)}),t}function E(e){return Object.entries(e).map(([t,r])=>`${t}=${r}`).join("; ")}var $=class extends l{};async function Ie(e){return M(e)}async function qe(e,t,r){let o=X(t),s=new URLSearchParams;s.append("form_type","storefront_password"),s.append("utf8","\u2713"),s.append("password",e??""),h("theme-service:storefront-session:check-storefront-password");let n={"cache-control":"no-cache","content-type":"application/x-www-form-urlencoded",...r},a=await w(`${o}/password`,{headers:n,body:s.toString(),method:"POST",redirect:"manual"});if(a.status===429)throw f(new l(`Too many incorrect password attempts. Please try again after ${a.headers.get("retry-after")} seconds.`));return V(a,o)}async function B(e,t,r,o,s={}){let n={},a=await W(e,r,s),i=X(t);if(n._shopify_essential=a,h(`theme-service:storefront-session:is-password-protected:${!!o}`),!o)return n;let u=await se(a,e,i,o,s);return{...n,...u}}var ne=1;async function W(e,t,r,o=1){let s=new URLSearchParams({preview_theme_id:t,_fd:"0",pb:"0"}),n=`${e}?${s}`;h("theme-service:storefront-session:get-session-essential-cookie");let a={...r,...S()},i=await w(n,{method:"HEAD",redirect:"manual",headers:a}),u=i.headers.raw()["set-cookie"]??[],d=C(u,"_shopify_essential");if(!d){if(c(`Failed to obtain _shopify_essential cookie.
2
+
3
+ -Request ID: ${i.headers.get("x-request-id")??"unknown"}
4
+
5
+ -Body: ${await i.text()}
6
+
7
+ -Status: ${i.status}
8
+ `),o>3)throw f(new $('Your development session could not be created because the "_shopify_essential" could not be defined. Please, check your internet connection.'));return c("Retrying to obtain the _shopify_essential cookie..."),await P(o),W(e,t,r,o+1)}return z(i,n,d,a)}async function z(e,t,r,o,s=0){let n=e.headers.get("location");if(!n||s>=ne)return r;let a=new URL(n,t);if(a.origin!==new URL(t).origin||!a.searchParams.has("preview_theme_id"))return r;let i=await w(a.toString(),{method:"HEAD",redirect:"manual",headers:{...o,Cookie:E({_shopify_essential:r})}}),u=i.headers.raw()["set-cookie"]??[],d=C(u,"_shopify_essential");return d||c(`Preview redirect to ${a.pathname} did not set a new _shopify_essential cookie; keeping the previous one.`),z(i,a.toString(),d??r,o,s+1)}async function se(e,t,r,o,s){let n=new URLSearchParams({password:o}),a={...s,...S(),Cookie:E({_shopify_essential:e})},i=await w(`${t}/password`,{method:"POST",redirect:"manual",body:n,headers:a});if(!V(i,r))throw f(new l("Your development session could not be created because the store password is invalid. Please, retry with a different password."));let u=i.headers.raw()["set-cookie"]??[],d=C(u,"storefront_digest"),m=C(u,"_shopify_essential"),g={};return d&&(g.storefront_digest=d),m&&(g._shopify_essential=m),g}function V(e,t){let r=e.headers.get("location")??"",o;try{o=new URL(r,t)}catch(n){if(n instanceof TypeError)return!1;throw n}let s=new URL(t).origin;return e.status===302&&o.origin===s}function C(e,t){let r=e.find(s=>y(s)[t]);return r?y(r)[t]:void 0}function X(e){return`https://${e}`}p();p();function ae(e,t){if(!(t instanceof U)){if(f(t),v()==="json"){H({type:"diagnostic",level:"error",message:`${e}
9
+ ${t.message}`});return}t instanceof l?(t.message=`${e}
10
+ ${t.message}`,O(t)):(L({headline:e,body:t.message}),c(`${e}
11
+ ${t.stack??t.message}`))}}function Me(e,t){let r={delete:`Failed to delete file "${e}" from remote theme.`,upload:`Failed to upload file "${e}" to remote theme.`,default:e}[t??"default"]??e;return o=>{ae(r,o)}}function k(e,t){return F({status:e.status??502,statusText:e.statusText??"Bad Gateway",cause:e,data:{url:(t??e.url)?.toString(),requestId:e.headers?.get("x-request-id")??void 0}})}function Ge(e,t="Unexpected error during fetch"){let r=e,o=r.statusCode??502,s=r.statusMessage??"Bad Gateway",n=`${t.replace(/\.$/,"")} with status ${o} (${s}).`;r.data?.requestId&&(n+=`
12
+ Request ID: ${r.data.requestId}`),r.data?.url&&(n+=`
13
+ URL: ${r.data.url}`);let a=r.cause??e;return{headline:n,body:a.stack??r.stack??r.message??s,status:o,statusText:s,cause:a,requestId:r.data?.requestId,url:r.data?.url}}var ie={_fd:"0",pb:"0"};async function Je(e,t){let r=fe(e,t),s={...await ce(e,t),...S()},n,a=Object.keys({...t.replaceTemplates,...t.replaceExtensionTemplates});if(a.length>0){c(`\u2192 Rendering ${r} (with ${a})...`);let m=G(t);n=await fetch(r,{method:"POST",body:m,redirect:"manual",headers:s}).catch(g=>{throw k(f(g),r)})}else c(`\u2192 Rendering ${r}...`),n=await fetch(r,{method:t.method,redirect:"manual",headers:s}).catch(m=>{throw k(f(m),r)});let i=n.headers.get("x-request-id");c(`\u2190 ${n.status} (request_id: ${i})`);let d=n.headers.get("Content-Type")?.includes("application/json");return n=new Response(n.body,n),d||n.headers.delete("Content-Type"),n}async function ce(e,t){return K(e)?de(e,t):ue(e,t)}async function ue(e,t){let r=await Y(e,t),o=e.storefrontToken;return T({...t.headers,...e.crawlerSignatureHeaders,Authorization:`Bearer ${o}`,Cookie:r})}async function de(e,t){let r=await Y(e,t),o=e.storefrontToken,s={},n=["ACCEPT","CONTENT-TYPE","CONTENT-LENGTH"];for(let[a,i]of Object.entries(t.headers))n.includes(a.toUpperCase())&&(s[a]=i);return T({...s,...pe(e),...e.crawlerSignatureHeaders,Authorization:`Bearer ${o}`,Cookie:r})}function Y(e,t){let r=y(t.headers.cookie??t.headers.Cookie??""),o=e.sessionCookies??{};return E({...r,...o})}function fe(e,{path:t,sectionId:r,appBlockId:o,query:s}){let a=`${b(e)}${t}`,i=new URLSearchParams(ie);for(let[u,d]of s)i.append(u,d);return r?i.append("section_id",r):o&&i.append("app_block_id",o),`${a}?${i}`}function b(e){return K(e)?`https://${N()}/cli/sfr`:`https://${e.storeFqdn}`}function K(e){return e.token.startsWith("shptka_")}function pe(e){return{"X-Shopify-Shop":e.storeFqdn,"X-Shopify-Access-Token":e.token}}p();var A="Shopify CLI",le=720*60*60,Q=["Signature","Signature-Input","Signature-Agent"],J="unstable",me=`
14
+ query StorefrontCrawlerSignatures($first: Int!, $expired: Boolean, $cli: Boolean, $domain: String) {
15
+ storefrontCrawlerSignatures(first: $first, expired: $expired, cli: $cli, domain: $domain) {
16
+ edges {
17
+ node {
18
+ id
19
+ name
20
+ domainHost
21
+ signature
22
+ signatureInput
23
+ signatureAgent
24
+ expiresAt
25
+ }
26
+ }
27
+ }
28
+ }
29
+ `,he=`
30
+ mutation StorefrontCrawlerSignatureGenerate($timeToLive: Int!, $name: String!, $domainHost: String!, $cli: Boolean) {
31
+ storefrontCrawlerSignatureGenerate(timeToLive: $timeToLive, name: $name, domainHost: $domainHost, cli: $cli) {
32
+ id
33
+ signature
34
+ signatureInput
35
+ signatureAgent
36
+ name
37
+ expiresAt
38
+ domainHost
39
+ userErrors {
40
+ field
41
+ message
42
+ code
43
+ }
44
+ }
45
+ }
46
+ `;async function te(e,t=e.storeFqdn){try{let o=(await _(me,e,{first:1,expired:!1,cli:!0,domain:t},J)).storefrontCrawlerSignatures;if(!o)throw f(new l("Could not fetch Shopify CLI crawler signatures."));let s=o.edges[0]?.node;if(s){h("theme-service:crawler-signature:reused");let u=ee(s);return c(`Reusing crawler signature "${A}" for ${s.domainHost} (${Z(u)}).`),u}let a=(await _(he,e,{timeToLive:le,name:A,domainHost:t,cli:!0},J)).storefrontCrawlerSignatureGenerate;if(!a)throw f(new l("Could not create a Shopify CLI crawler signature."));if(a.userErrors.length>0){let u=a.userErrors.map(d=>{let m=d.field?.join(".");return m?`${m}: ${d.message}`:d.message}).join(`
47
+ `);throw f(new l("Could not create a Shopify CLI crawler signature.",u))}h("theme-service:crawler-signature:created");let i=ee(a);return c(`Created crawler signature "${A}" for ${a.domainHost} expiring at ${a.expiresAt} (${Z(i)}).`),i}catch(r){let o=r instanceof Error?r.message:String(r);c(`Could not obtain crawler signature headers; continuing without them. ${o}`);return}}function Z(e){let t=Object.keys(e),r=Q.filter(s=>t.some(n=>n.toLowerCase()===s.toLowerCase())),o=Q.filter(s=>!r.includes(s));return`present: ${r.join(", ")||"none"}; missing: ${o.join(", ")||"none"}`}function ee(e){if(!e.signature||!e.signatureInput||!e.signatureAgent)throw f(new l("The Shopify CLI crawler signature response did not include all required headers."));return{Signature:e.signature,"Signature-Input":e.signatureInput,"Signature-Agent":e.signatureAgent}}p();var ge=1800*1e3,re=["layout/theme.liquid","config/settings_schema.json"];async function ht(e,t,r,o,s){let n=await oe(e,t,r,o,s);return n.refresh=async()=>{c("Refreshing theme session...");let a=await oe(e,t,r,o,n.crawlerSignatureHeaders);return h("theme-service:session:refreshed"),Object.assign(n,a),a},setInterval(()=>{n.refresh&&n.refresh().then(()=>c("Refreshed theme session via auto-refresher...")).catch(()=>c("Session could not be refreshed."))},ge),n}async function oe(e,t,r,o,s){let n=b(t),a=s??await te(t),i=await q(t.storeFqdn,r,[],{forceRefresh:!1,noPrompt:!0}),u=await I([],r,{forceRefresh:!1,noPrompt:!0}),d=await we(n,e,t,u,o,a);return{...i,sessionCookies:d,storefrontToken:u,crawlerSignatureHeaders:a}}async function we(e,t,r,o,s,n){try{return await B(e,r.storeFqdn,t,s,{"X-Shopify-Shop":r.storeFqdn,"X-Shopify-Access-Token":r.token,Authorization:`Bearer ${o}`,...n})}catch(a){throw a instanceof $&&await Se(t,r),a}}async function Se(e,t){if(c(`Verifying if theme with id ${e} has required files...`),(await j(Number(e),re,t)).length!==re.length)throw f(new l(D`Theme ${R.cyan(e)} is missing required files. Run ${R.cyan(`shopify theme delete -t ${e}`)} to delete it, then try your command again.`.value));c(`Theme with id ${e} has required files.`)}export{S as a,T as b,Ie as c,qe as d,ae as e,Me as f,k as g,Ge as h,ie as i,Je as j,ce as k,Y as l,b as m,te as n,ht as o,oe as p};
@@ -1 +1 @@
1
- import{g as o}from"./chunk-NU5WLZ6Y.js";import{b as s}from"./chunk-4ZNBEMRT.js";import{g as e}from"./chunk-VKWPEFWQ.js";e();var t=class extends s{static description="Clear the CLI cache, used to store some API responses and handle notifications status";static hidden=!0;async run(){await o()}};export{t as a};
1
+ import{b as s}from"./chunk-ZQDDRIBA.js";import{g as o}from"./chunk-Q2SZCZE7.js";import{g as e}from"./chunk-VKWPEFWQ.js";e();var t=class extends s{static description="Clear the CLI cache, used to store some API responses and handle notifications status";static hidden=!0;async run(){await o()}};export{t as a};
@@ -1 +1 @@
1
- import{a as s}from"./chunk-NT4A37HG.js";import{g as r,h as n,i as h}from"./chunk-Y3PY5LP7.js";import{i as m}from"./chunk-Q37WAD6F.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var c=t=>`Development theme #${t} could not be found. Please create a new development theme.`,E="No development theme ID has been set. Please create a development theme first.",p=class extends s{context="Development";constructor(e){super(e),this.themeId=r()}async find(){let e=await this.fetch();if(!e)throw new m(this.themeId?c(this.themeId):E);return e}setTheme(e){n(e)}removeTheme(){h()}};export{p as a};
1
+ import{a as s}from"./chunk-N2RFDHRY.js";import{g as r,h as n,i as h}from"./chunk-DJAZBPYA.js";import{h as m}from"./chunk-2VSNFOKD.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var c=t=>`Development theme #${t} could not be found. Please create a new development theme.`,E="No development theme ID has been set. Please create a development theme first.",p=class extends s{context="Development";constructor(e){super(e),this.themeId=r()}async find(){let e=await this.fetch();if(!e)throw new m(this.themeId?c(this.themeId):E);return e}setTheme(e){n(e)}removeTheme(){h()}};export{p as a};
@@ -0,0 +1 @@
1
+ import{a as h,b as w}from"./chunk-PGLWZMJU.js";import{j as f}from"./chunk-H4V55Y3Z.js";import{U as d}from"./chunk-CZ22VZDA.js";import{h as i}from"./chunk-2VSNFOKD.js";import{Fa as m,ma as p}from"./chunk-LWCTKI4Z.js";import{c as u}from"./chunk-IWTNUJGY.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();import{writeFile as g}from"fs/promises";var S=1024*1024,y=100,U=y*S,E=3,_=new Set([408,429,500,502,503,504]);async function j(o,e){let t=u(e,"manifest.json");await g(t,JSON.stringify(o,null,2))}var A=["!**/*.js.map","!**/*.metafile.json"];async function k(o,e,t){let n=t??["**/*",...A];e.endsWith(".br")?await w({inputDirectory:o,outputPath:e,matchFilePattern:n}):await h({inputDirectory:o,outputZipPath:e,matchFilePattern:n})}async function C(o,e){let t=await m(e);if(t>U){let s=`${(Math.ceil(t/S*100)/100).toFixed(2)} MB`;throw new i(`Your app bundle exceeds the ${y} MB upload limit (it is ${s}).`,"Check the asset paths in your extension configuration \u2014 a misconfigured source can pull in much more than intended. Exclude large files or directories from your bundle, then try again.")}let n=p(e),r;for(let s=1;s<=E;s++){if(r=await f(o,{method:"put",body:n},"slow-request"),r.ok)return;let T=s===E;if(_.has(r.status)&&!T){await r.text().catch(()=>{}),await d(2**s*.1);continue}break}let a=r?.status,c=(await r?.text().catch(()=>""))?.trim();throw new i(`Failed to upload your app bundle to storage${a?` (HTTP ${a})`:""}.`,"This is usually transient. Please try again, and check your network connection if it persists.",c?[`Storage responded with: ${c.slice(0,300)}`]:void 0)}async function D(o,e){let t=await o.generateSignedUploadUrl(e);if(!t.assetUrl||t.userErrors?.length>0){let n=t.userErrors.map(r=>r.message).join(", ");throw new i(n)}return t.assetUrl}export{j as a,A as b,k as c,C as d,D as e};
@@ -1 +1 @@
1
- import{H as m,I as d,x as c}from"./chunk-47IQIIFX.js";import{Bb as w,Cb as n,Eb as a}from"./chunk-UWI76E2L.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};
1
+ import{I as m,J as d,y as c}from"./chunk-CZ22VZDA.js";import{pb as w,qb as n,sb as a}from"./chunk-LWCTKI4Z.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};
@@ -0,0 +1,26 @@
1
+ import{a as Yt}from"./chunk-UOHNRH6E.js";import{b as zr}from"./chunk-QKVVJXWS.js";import{a as Yr}from"./chunk-YKS7MH3F.js";import{a as Jr}from"./chunk-7WPUV7GY.js";import{a as Qr}from"./chunk-53BG3NLH.js";import{a as Mr}from"./chunk-AYL6KBPE.js";import{a as Or,b as Nr,c as Wr,d as qr}from"./chunk-PYIICTLX.js";import{a as Kr}from"./chunk-SL3VBI62.js";import{a as Hr}from"./chunk-4GCI2YCZ.js";import{a as jr}from"./chunk-Z5SILNH2.js";import{a as Vr}from"./chunk-HIRTL45Q.js";import{a as Gr}from"./chunk-ZYQ2XWC5.js";import{a as Br}from"./chunk-CCMDZX35.js";import{a as br}from"./chunk-PMHP57MH.js";import{a as Ir}from"./chunk-5NEGOQT6.js";import{a as Tr}from"./chunk-5UWMXOHM.js";import{a as Cr}from"./chunk-M4BVLMPH.js";import{g as _r}from"./chunk-LVLAOBJM.js";import{a as ct}from"./chunk-BCYTZ7LM.js";import{c as it,n as lt}from"./chunk-DNMXVMJM.js";import{a as kr}from"./chunk-RFGEM5JC.js";import{a as $r}from"./chunk-SFPXYHHL.js";import{a as Ar}from"./chunk-N2RFDHRY.js";import{b as Ur,g as Fe,j as at,u as Rr}from"./chunk-5TB52UUV.js";import{a as Dr}from"./chunk-GCNA3HXH.js";import{a as _o,b as Lo,c as Co,d as ko}from"./chunk-U25W35TX.js";import{d as Fr}from"./chunk-UWMZ5CSB.js";import{a as Er,b as Sr,c as Ao,d as Io,e as dt,f as To,g as $o}from"./chunk-3G4HJO72.js";import{a as M,b as st}from"./chunk-SFQEHDJY.js";import{a as gr,b as wr,d as ke,f as yr,m as $e,n as B,s as j,u as vr,v as Pr,w as xr}from"./chunk-Q7BOSHWX.js";import{a as hr}from"./chunk-R7EMV77H.js";import{a as Fo,b as Do,c as Mo,d as ft,e as Oo,f as No,g as Wo,h as qo,i as Ho,j as jo,k as Go,l as Bo,m as Ko,n as Vo,o as zo,p as mt}from"./chunk-MXJAH2GW.js";import{a as Po,b as ut,c as oe,d as xo}from"./chunk-PEVIRAMR.js";import{a as Eo,b as So,c as bo,d as Uo,e as Ro}from"./chunk-EMSF57ZB.js";import{a as Zr}from"./chunk-YVY32DNA.js";import{a as vo}from"./chunk-UVRKTMF7.js";import{a as yo}from"./chunk-ZGV3HNEV.js";import{a as Xr}from"./chunk-FWB3GLMW.js";import{Aa as Oe,L as po,Ma as wo,N as uo,P as re,Z as fo,_ as ho,i as eo,ia as go,j as G,k as to,n as oo,p as ls,t as pt,u as no,v as so,w as ao,x as io,y as co,z as lo,za as Me}from"./chunk-3C6VLJ5D.js";import{D as ro,oa as mo,r as De,w as de}from"./chunk-WDFCOZAY.js";import{a as Lr}from"./chunk-D7NB7YR6.js";import{d as dr}from"./chunk-UOS2XLGG.js";import{a as z}from"./chunk-IQVRP7CT.js";import{M as Bt,_ as ee,aa as Kt,c as Wt,h as qt,j as Ht,m as jt,o as Gt,p as Se,ta as Vt,u as be}from"./chunk-H4V55Y3Z.js";import{b as fr,c as mr,e as Ce}from"./chunk-Q2SZCZE7.js";import{B as pe,I as Te,M as sr,O as _e,T as Le,U as ue,V as nt,W as ir,Y as cr,a as Nt,d as D,e as Ue,f as tt,g as F,h as N,j as Re,k as Ae,l as Jt,m as Qt,n as Xt,o as Zt,p as er,q as tr,r as rt,s as ot,t as rr,u as or,w as nr,z as Ie}from"./chunk-CZ22VZDA.js";import{b as le,d as Ee,j as Mt,m as Ot}from"./chunk-335BUVBP.js";import{a as ge}from"./chunk-BN7ZXAZJ.js";import{a as cs}from"./chunk-7UNQOKZW.js";import{d as zt}from"./chunk-X7HVAVSZ.js";import{h as T,j as ar,k as te}from"./chunk-2VSNFOKD.js";import{a as Ne}from"./chunk-FFHH5LOR.js";import{Aa as Ct,Ba as kt,Bb as y,Cb as k,Da as $t,Hb as ur,Ma as xe,P as Xe,Sa as O,Va as ce,_a as Ft,bb as Dt,la as C,qb as R,sb as I,ta as Pe,va as Z,xa as Ze,ya as Lt,yb as V}from"./chunk-LWCTKI4Z.js";import{b as A,c as ae,d as ie,j as et}from"./chunk-FZCGRIOM.js";import{e as lr,g as pr}from"./chunk-3A3DZVEJ.js";import{b as is}from"./chunk-YTUUU33R.js";import{a as At}from"./chunk-JD5P5RAJ.js";import{c as U,e as Qe,f as It,h as we,i as ye,j as ve,n as Tt,o as _t}from"./chunk-IWTNUJGY.js";import{e as X,g as u}from"./chunk-VKWPEFWQ.js";u();u();u();u();u();u();var ps=300*1e3,us='The host theme could not be created to host your theme app extension. Please try again or use the "--theme" flag to use an existing theme as the host theme.';async function Yo(t,e,r=Date.now()){for(;await ds(t,e,r););}async function ds(t,e,r){let o=await Fe(t,e);if(!o||fs(o,r))throw new T(us);return await ue(3),o.processing}function fs(t,e){return t.processing&&Date.now()-e>=ps}var ms="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",hs="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",ht=3,We=class extends Ar{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=Or(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??=this.devPreview?await this.createHostTheme():await this.create(),e}setTheme(e){Nr(this.adminSession.storeFqdn,e)}removeTheme(){Wr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:Ur,name:this.generateThemeName(this.context),src:ms};for(let o=0;o<ht;o++){y(`Attempt ${o}/${ht}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await at(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),y(`Waiting for theme with id "${n.id}" to be processed`),await Yo(n.id,this.adminSession),n;throw new Error}catch(n){if(n instanceof ar||Rr(n))throw n;y(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}y(`Theme creation failed after ${ht} retries. Creating theme using fallback theme zip`);let r=await at({...e,src:hs},this.adminSession);if(!r)throw y("Theme creation failed. Exiting process."),new te(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};u();var gs={"theme:init":Dr,"theme:check":br,"theme:console":Ir,"theme:delete":Tr,"theme:dev":Cr,"theme:duplicate":kr,"theme:info":$r,"theme:language-server":Mr,"theme:list":qr,"theme:metafields:pull":Kr,"theme:open":Hr,"theme:package":jr,"theme:profile":Gr,"theme:publish":Br,"theme:preview":Vr,"theme:pull":zr,"theme:push":Yr,"theme:rename":Jr,"theme:share":Qr},Ii=gs;async function Jo(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(x=>x.isThemeExtension);if(n.length===0)return;let s=n[0].directory,i=t.themeExtensionPort??9293,[l,f]=await Promise.all([Bt(t.storeFqdn),vs(e)]),c=l.storeFqdn,[p,h]=await Promise.all([lt(l),it(l)]),g=h?await ct(t.storePassword,c,p):void 0,d=await ys(l,t.theme),m=d.id.toString();return Ie({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:f}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${c}/admin/themes/${m}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:ws,options:{theme:d,adminSession:l,storefrontPassword:g,crawlerSignatureHeaders:p,themeExtensionDirectory:s,themeExtensionPort:i}}}var ws=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:a,themeExtensionPort:s})=>{await(await _r(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:a,themeExtensionPort:s})).start()};async function ys(t,e){let r;if(e)y(`Fetching theme with provided id ${e}`),r=await Fe(parseInt(e,10),t);else{let o=new We(t,{devPreview:!0});await Te([{title:"Configuring host theme for theme app extension",task:async()=>{y("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new T("Could not find or create a host theme for theme app extensions");return r}async function vs(t){return t.developerPlatformClient?.clientName===mo.AppManagement?`https://${await Se()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Gt()}/${t.organizationId}/apps/${t.id}/test`}u();u();u();u();u();u();async function Ps(t){let e=U(t.directory,"locales");return ce([U(e,"*.json")])}async function Qo(t,e){let r=await Ps(t);if(!r.length)return{localization:void 0,status:""};let o=e.currentLocalizationPayload??{defaultLocale:"en",translations:{},lastUpdated:0},n="success";try{await Promise.all(r.map(async a=>{let[s,...i]=a.split("/").pop().split(".");if(s)return i[0]==="default"&&(o.defaultLocale=s),xs(s,a,o,t,e)})),o.lastUpdated=Date.now(),y(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function xs(t,e,r,o,n){let a;try{a=await C(e),r.translations[t]=JSON.parse(a)}catch(s){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${s.message}`;throw k(i,n.stderr),new Error(i)}}u();function qe(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}var gt=".js.map";async function ne(t,e,r,o){return D({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),a=`${r.url}/extensions/${t.devUUID}`,{localization:s,status:i}=await Qo(t,r),l=await to(t),f=t.outputRelativePath?we(n):n,c=await Es(t,a,f,o),p=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(p=Xo(t.configuration.metafields)),{assets:{main:fe(c)&&c[0]?.assets?.main?c[0].assets.main:{name:"main",url:`${a}/assets/${t.outputFileName}`,lastUpdated:await xe(n)??0}},supportedFeatures:{runsOffline:t.configuration.supported_features?.runs_offline??!1},capabilities:{blockProgress:t.configuration.capabilities?.block_progress??!1,networkAccess:t.configuration.capabilities?.network_access??!1,apiAccess:t.configuration.capabilities?.api_access??!1,collectBuyerConsent:{smsMarketing:t.configuration.capabilities?.collect_buyer_consent?.sms_marketing??!1,customerPrivacy:t.configuration.capabilities?.collect_buyer_consent?.customer_privacy??!1},iframe:{sources:t.configuration.capabilities?.iframe?.sources??[]}},development:{...r.currentDevelopmentPayload,resource:qe(t.type,r),root:{url:a},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:c,localization:s??null,metafields:p,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:l?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function Es(t,e,r,o){let n=t.configuration,a=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(a=[{target:"purchase.post.render"}]),fe(a)){let s=await Ss(r);return Promise.all(a.map(async i=>{let{target:l,resource:f}=i,c="metafields"in i?Xo(i.metafields??[]):void 0,p={...i,...c?{metafields:c}:{},surface:Oe(l),root:{url:`${e}/${l}`},resource:f||{url:""}},h=s?.[l];if(!h)return p;let d=await Ts(h,{target:l,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...p,...d}}))}return a}async function Ss(t){try{let e=U(t,"manifest.json"),r=await C(e);return JSON.parse(r)}catch(e){if(e instanceof SyntaxError)throw new Error(`Invalid manifest.json in ${t}: ${e.message}`);return null}}async function bs({target:t,extensionPoint:e,url:r,extension:o,resolver:n},a,s){let i=`${t}/${a}`,l=e[a];if(typeof l=="string"){let g=await He(a,i,typeof s=="string"?s:l,r,o,n,typeof s=="string"?l:void 0);return{assets:{[g.name]:g}}}let c=e.build_manifest?.assets?.[a];if(c?.filepath){let p=await He(a,i,c.filepath,r,o,n,c.module);return{assets:{[p.name]:p}}}return{}}async function Us({target:t,url:e,buildDirectory:r,resolver:o},n,a){if(a.length===0)return{};for(let i of a)o?.set(`${t}/${i}`,i);let s=await Promise.all(a.map(async i=>await xe(U(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...s)}}}}async function Rs({target:t,extensionPoint:e,url:r,extension:o,resolver:n},a){return e.intents?{intents:await Promise.all(e.intents.map(async(i,l)=>{let f=i.schema,c=a[l]?.schema,p=typeof c=="string"?c:f,h=typeof c=="string"?f:void 0;return{...i,schema:await He("schema",`${t}/intents/${l}/schema`,p,r,o,n,h)}}))}:{}}async function As({target:t,url:e,extension:r,resolver:o},n,a){let s=await He(n,`${t}/${n}`,a,e,r,o);return await Is(t,a,r,o),{assets:{[s.name]:s}}}async function Is(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(gt)&&await O(U(r.directory,n))&&o.set(`${t}/${ye(n)}`,n)}async function Ts(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return _s(o,n)?Rs(e,n):Ls(o,n)?As(e,o,n):Cs(o,n)?Us(e,o,n):bs(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function Xo(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function fe(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function He(t,e,r,o,n,a,s){let i=`${e}${ve(r)}`;return a?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await xe(U(n.directory,s??r))??0}}function _s(t,e){return t==="intents"&&Array.isArray(e)}function Ls(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function Cs(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as ks}from"events";var me;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(me||(me={}));async function Zo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:Ao(t.storeFqdn,t.apiKey),mobileUrl:To(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>ne(n,e,t,r&&wt(r,n.devUUID))))}}function wt(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var je=class extends ks{options;rawPayload;assetResolvers;constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=ee(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(a=>a.uuid===o.uuid);if(n){if(fe(n.extensionPoints)&&fe(o.extensionPoints)){let a=n.extensionPoints.reduce((l,f)=>({...l,[f.target]:f}),{});o.extensionPoints=ee(o.extensionPoints,n.extensionPoints,l=>l.map(f=>{let c=a[f.target];return c?ee(f,c,(p,h)=>h):f}));let{extensionPoints:s,...i}=n;return ee(o,i)}return ee(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let a=this.rawPayload.extensions,s=a.findIndex(i=>i.uuid===e.devUUID);if(s===-1){y(I`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}a[s]=await ne(e,o,{...this.options,currentDevelopmentPayload:n??{status:a[s]?.development.status},currentLocalizationPayload:a[s]?.localization},wt(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=a,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await ne(e,r,this.options,wt(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(me.Update,e)}};u();u();var Y;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(Y||(Y={}));function en(t,e){return(r,o,n)=>{r.url==="/extensions"&&(y("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,$s(t,e)))}}function $s(t,e){return r=>{y("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};y(I`Sending connected payload: ${R.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",Ns(t,e))}}function Fs(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?R.json(o).output():String(o)).join(" ");return I`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var Ds={debug:t=>R.gray(t),warn:t=>R.yellow(t),error:t=>R.errorText(t)};function Ms({type:t,message:e}){let r=Fs(e);switch(t){case"debug":case"warn":case"error":return I`${Ds[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function Os(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(Ms(t))})}function Ns(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:a}=o;if(y(I`Received websocket message with event type ${n} and data:
2
+ ${R.json(a)}
3
+ `,e.stdout),n===Y.Update){let s=e.payloadStore.getRawPayload().app.apiKey,i=a.app?.apiKey;if(a.app){if(s!==i)return;e.payloadStore.updateApp(a.app)}a.extensions&&e.payloadStore.updateExtensions(a.extensions)}else if(n===Y.Dispatch){let s=Ws(o,e);rn(t,s,e)}else n===Y.Log&&Os(a,e)}}function tn(t,e){return r=>{let o={event:Y.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};y(I`Sending websocket update event to the websocket clients:
4
+ ${R.json(o)}
5
+ `,e.stdout),rn(t,o,e)}}function rn(t,e,r){y(I`Sending websocket with event type ${e.event} and data:
6
+ ${R.json(e.data)}
7
+ `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function Ws(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var qs=10;function on(t){let e=new Yt.default({noServer:!0,clientTracking:!0}),r=Hs(e);return t.httpServer.on("upgrade",en(e,t)),t.payloadStore.on(me.Update,tn(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function Hs(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},qs*1e3)}u();u();u();function nn(t,e){let{url:r}=qe(t.type,e);if(t.surface==="checkout"&&r){let o=new URL(`https://${e.storeFqdn}/`);return o.pathname=r,o.searchParams.append("dev",`${e.url}/extensions`),o.toString()}else{let o=new URL(`https://${e.storeFqdn}/`);return o.pathname="admin/extensions-dev",o.searchParams.append("url",Ge(t,e)),o.toString()}}function sn(t,e,r){let o=Oe(t),n=new URL(`https://${r.storeFqdn}/`);switch(o){case"checkout":n.pathname=r.checkoutCartUrl,n.searchParams.append("dev",`${r.url}/extensions`);break;case"post_purchase":if(n.pathname=r.checkoutCartUrl,n.searchParams.set("script_url",`${r.url}/extensions/${e.devUUID}/assets/${e.localIdentifier}.js`),n.searchParams.set("post_purchase_dev_api_key",r.apiKey),e.devUUID&&r.websocketURL&&(n.searchParams.set("uuid",e.devUUID),n.searchParams.set("socket_url",r.websocketURL)),"metafields"in e.configuration){let a={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(a))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",Ge(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=js(e,r,t);break;default:return}return n.toString()}function js(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,a="shopify.com",s=new URL(`https://${a}/${n}/account/extensions-development`);return s.searchParams.append("origin",o),s.searchParams.append("extensionId",t.devUUID),s.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),s.searchParams.append("appId",e.id??""),r!==""&&s.searchParams.append("target",r),s}function Ge(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function H(t,e){wr(t,gr(e))}u();var yt=class extends te{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function an(t){let e=await Gs(t),r=await C(e);return hr(r,t.data)}async function Gs(t){let e=await Bs(),r=[];t.extensionSurface&&r.push(U(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(U(e,`${t.template}.html.liquid`));let o=await ce(r);if(o.length===0)throw new yt(t);return o[0]}async function Bs(){return await Ft("templates/ui-extensions/html",{type:"directory",cwd:_t(import.meta.url)})}var cn=j(t=>{B(t,"Access-Control-Allow-Origin","*"),B(t,"Access-Control-Allow-Methods","GET, OPTIONS"),B(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),ln=j(t=>{B(t,"Cache-Control","no-cache")}),vt=j(async t=>$e(t,"/extensions",307));async function Ks(t,e){let{filePath:r}=e;if(!await O(r))return H(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await $t(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await O(r)))return H(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await C(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".map":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},a=ve(r),s=n[a]||"text/plain";return B(t,"Content-Type",s),o}function pn({getExtensions:t,payloadStore:e}){return j(async r=>{let{extensionId:o,assetPath:n=""}=ke(r),a=t().find(h=>h.devUUID===o);if(!a)return H(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(a.devUUID)?.get(n),l=i??n,f=l.endsWith(gt);if(f&&i===void 0)return H(r,{statusCode:404,statusMessage:"Not Found"});let c=Qe(f?a.directory:oo(a.outputPath)),p=Qe(U(c,l));return Tt(c,p)?Ks(r,{filePath:p}):H(r,{statusCode:404,statusMessage:"Not Found"})})}function Pt({payloadStore:t}){return j(e=>(B(e,"content-type","application/json"),t.getRawPayload()))}function un({devOptions:t}){return j(e=>{y(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function xt({devOptions:t,getExtensions:e}){return j(async r=>{let{extensionId:o}=ke(r),n=e().find(i=>i.devUUID===o);if(!n)return H(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(yr(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return an({data:{url:Ge(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=nn(n,t);return $e(r,i,307)}}let s=t.appWatcher.buildOutputPath;return B(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:se(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await ne(n,s,t)}})}function dn({devOptions:t,getExtensions:e}){return j(async r=>{let{extensionId:o,extensionPointTarget:n=""}=ke(r),a=e().find(i=>i.devUUID===o);if(!a)return H(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(a.configuration.type!=="checkout_post_purchase"&&!a.hasExtensionPointTarget(n))return H(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let s=sn(n,a,t);return s?$e(r,s,307):H(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as Vs}from"http";function fn(t){let e=vr(),r=Pr();e.use(un(t)),e.use(cn),e.use(ln),r.use("/extensions/dev-console",vt),r.use("/extensions/:extensionId",xt(t)),r.use("/extensions/:extensionId/",xt(t)),r.use("/extensions/:extensionId/:extensionPointTarget",dn(t)),r.use("/extensions/:extensionId/assets/**:assetPath",pn(t)),r.use("/extensions",Pt(t)),r.use("/extensions/",Pt(t)),r.use("/",vt),e.use(r);let o=Vs(xr(e));return o.listen(t.devOptions.port,"localhost"),o}async function mn(t){let e={...t,websocketURL:se(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Zo(e,r,o),a=new je(n,e,o),s=e.extensions.filter(p=>p.isPreviewable),i=()=>s;y("Setting up the UI extensions HTTP server...",e.stdout);let l=fn({devOptions:e,payloadStore:a,getExtensions:i});y("Setting up the UI extensions Websocket server...",e.stdout);let f=on({...e,httpServer:l,payloadStore:a});y("Setting up the UI extensions bundler and file watching...",e.stdout);let c=async({appWasReloaded:p,app:h,extensionEvents:g})=>{p&&(s=h.allExtensions.filter(d=>d.isPreviewable));for(let d of g){if(!d.extension.isPreviewable)continue;let m=d.buildResult?.status==="ok"?"success":"error",x=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case oe.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl){let S=await Me(e.extensions,e.storeFqdn);e.checkoutCartUrl=S}await a.addExtension(d.extension,r);break;case oe.Updated:await a.updateExtension(d.extension,e,r,{status:m,error:x});break;case oe.Deleted:e.extensions=e.extensions.filter(S=>S.devUUID!==d.extension.devUUID),await a.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(c).onStart(c),e.signal.addEventListener("abort",()=>{y("Closing the UI extensions dev server..."),f.close(),l.close()})}function se(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var zs="3",Ys=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:a,subscriptionProductUrl:s,port:i,cartUrl:l,proxyUrl:f,appName:c,appDotEnvFile:p,appId:h,grantedScopes:g,allExtensions:d,appDirectory:m,appWatcher:x})=>{await mn({appName:c,appDotEnvFile:p,appDirectory:m,id:h,extensions:d,stdout:e,stderr:t,signal:r,url:f,port:i,storeFqdn:be(n),storeId:a,apiKey:o,grantedScopes:g,checkoutCartUrl:l,subscriptionProductUrl:s,manifestVersion:zs,appWatcher:x})};async function hn({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(s=>s.isPreviewable),a=await Me(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:Ys,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:a,...o}}}u();u();function J(t){let e=t.find(o=>re(o,G.Frontend)),r=t.find(o=>re(o,G.Backend));return{frontendConfig:e,backendConfig:r}}u();async function gn(t){let r={topic:"app/uninstalled",api_version:(await _o(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:ko.LOCALHOST,shared_secret:t.sharedSecret},o=await Lo(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await ue(3);let n=await Js(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function Js(t,e){let r=0;for(;r<3;){try{return await Co(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof qt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await ue(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var Qs=async({stdout:t},e)=>{await gn({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function wn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...a}){let{backendConfig:s,frontendConfig:i}=J(t),l=t.map(({configuration:c})=>c.webhooks_path).find(c=>c)??"/api/webhooks";if(l&&e&&(i??s))return{type:"send-webhook",prefix:"webhooks",function:Qs,options:{deliveryPort:s?r:o,webhooksPath:l,organizationId:n,...a}}}u();async function yn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Xs}}var Xs=async({stdout:t,abortSignal:e},r)=>{let o=$o({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=Sr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",()=>{n.close()})};u();async function Pn({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:a,scopes:s}){let{frontendConfig:i}=J(t),l=i?.configuration.hmr_server?await M():void 0,f=void 0,c=t.map(async p=>{let h=await Zs({web:p,frontendPort:r,backendPort:o}),g=l&&p.configuration.roles.includes(G.Frontend)?{port:l,httpPaths:p.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:p.configuration.name??["web",...p.configuration.roles].join("-"),function:ea,options:{port:h,portFromConfig:p.configuration.port,apiKey:n,apiSecret:a,hostname:e,backendPort:o,frontendServerPort:r,directory:p.directory,devCommand:p.configuration.commands.dev,preDevCommand:p.configuration.commands.predev,scopes:s,shopCustomDomain:f,hmrServerOptions:g,roles:p.configuration.roles}}});return Promise.all(c)}async function Zs({web:t,frontendPort:e,backendPort:r}){return re(t,G.Frontend)?e:re(t,G.Backend)?r:M()}async function ea({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:a,hostname:s,backendPort:i,frontendServerPort:l,directory:f,devCommand:c,preDevCommand:p,scopes:h,shopCustomDomain:g,hmrServerOptions:d}){let m=d?.port,x={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:a,HOST:s,SCOPES:h,NODE_ENV:"development",...g&&{SHOP_CUSTOM_DOMAIN:g},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${l}`,...m&&{HMR_SERVER_PORT:`${m}`},APP_URL:s,APP_ENV:"development",REMIX_DEV_ORIGIN:s},S={signal:r,directory:f,port:o,env:x,stdout:t,stderr:e};p&&(t.write(`Running pre-dev command: "${p}"`),await vn({...S,command:p,showOutput:lr()})),await vn({...S,command:c,showOutput:!0})}async function vn({command:t,signal:e,directory:r,port:o,env:n,showOutput:a,stdout:s,stderr:i}){let l=t.split("&&").map(f=>f.trim())??[];for(let f of l){let[c,...p]=f.split(" ");c?.length!==0&&await Le(c,p,{cwd:r,stdout:a?s:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}u();u();u();var Be=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(I`${R.yellow(e)}`.value)}async success(e){await this.log(I`${R.green(e)}`.value)}async debug(e){y(e,this.stdout)}async error(e,r){let o=R.errorText("\u274C Error"),n=R.errorText(`\u2514 ${e}`);await this.log(I`${o}`.value,r),await this.log(I`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let a=n.on?n.on[0]:void 0,s=r.find(i=>i.uid===a?.user_identifier);return{error:n.message,prefix:s?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let a=n.extension.handle,s=`Extension ${n.type}`;await this.log(s,a)})}async logExtensionUpdateMessages(e,r){if(!e||r.status==="remote-error"||r.status==="unknown-error")return;let o={status:r.status},n=e.extensionEvents??[],s=(await Promise.all(n.map(async l=>l.type===oe.Deleted?[]:(await l.extension.getDevSessionUpdateMessages(o))?.map(c=>({message:c,prefix:l.extension.handle}))??[]))).flat(),i=s.map((l,f)=>{let c=I`${R.gray(f===s.length-1?"\u2514 ":"\u2502 ")}${l.message}`.value;return this.log(c,l.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=R.errorText("\u274C Error");await this.log(I`${r}`.value,"app-preview");let o=e.map(n=>{let a=R.errorText(`\u2514 ${n.error}`);return this.log(I`${a}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(`${e}
8
+ `)})}};u();var Ke=class{processBatch;queue=[];processingPromise=void 0;constructor(e){this.processBatch=e}enqueue(e){this.queue.push(e),this.processingPromise??=this.startProcessing()}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var Ve=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}statusManager;logger;options;appWatcher;bundlePath;appEventsProcessor;failedEvents=[];currentSessionState=null;constructor(e,r){this.statusManager=e.devSessionStatusManager,this.logger=new Be(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ke(o=>this.processEvents(o))}async start(){await this.logger.info(`Preparing dev preview on ${this.options.storeFqdn}`),this.statusManager.setMessage("LOADING"),this.appWatcher.onEvent(async e=>this.onEvent(e)).onStart(async e=>this.onStart(e)).onError(async e=>this.handleDevSessionResult({status:"unknown-error",error:e}))}async onEvent(e){await this.validateAppEvent(e)&&this.appEventsProcessor.enqueue(e)}async processEvents(e){let r=[...this.failedEvents,...e],o=this.consolidateAppEvents(r);if(this.failedEvents=[],!o)return;this.statusManager.setMessage("CHANGE_DETECTED"),this.updatePreviewURL(o),await this.logger.logExtensionEvents(o);let n=Po(),a=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(a,o),await this.logger.debug(`\u2705 Event handled [Network: ${ut(n)}ms - Total: ${ut(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let s of e)for(let i of s.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(s=>s.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new T(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:o.buildResult?.status==="error"&&o.buildResult.error||"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){if(e.status==="updated")await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage();else if(e.status==="created")this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r,e),this.statusManager.setMessage("READY");else if(e.status==="remote-error"||e.status==="unknown-error"){let o=e.error instanceof Error?[e.error.message]:e.error.map(n=>n.message);await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR",o):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR",o))}!this.statusManager.status.isReady&&!pr()&&setImmediate(()=>{throw new T("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:this.options.appPreviewURL,appEmbedded:e.app.configuration.embedded,hasExtensions:r})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),a=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),s=se(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:a,manifest:r,inheritedModuleUids:o,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:a,websocketUrl:s,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new T("Auth session expired. Please run `shopify app dev` again.");if(r instanceof Wt)throw r.response.status===401||r.response.status===403?new T("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new T("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await Eo(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let a=await Dt(this.bundlePath),s=n.modules.map(i=>i.assets).filter(i=>a.includes(i));return{manifest:n,inheritedModuleUids:o,assets:s}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=U(we(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(s=>`${s}/**`),...So];r&&n.push("manifest.json"),await bo(this.bundlePath,o,n);let a=await this.getSignedURLWithRetry();return await Uo(a,o),a}async getSignedURLWithRetry(){return Ro(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.warnings??[],a=r.devSessionUpdate?.devSession;if(a&&this.currentSessionState){let s=se(this.options.url),i=this.currentSessionState?.userId;if(a.websocketUrl!==s||a.user?.id!==i){let l=a.user?.email;await this.logger.error(`Another developer ${l?`(${l}) `:""}has taken ownership of this dev preview.`);let f=`Another user${l?` (${l})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,c=["You can restart by running",{command:"shopify app dev"},"again."];throw new T(f,c)}this.currentSessionState={websocketUrl:a.websocketUrl,userId:a.user?.id??null,userEmail:a.user?.email??null}}return n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],a=r.devSessionCreate?.devSession;return a&&(this.currentSessionState={websocketUrl:a.websocketUrl,userId:a.user?.id??null,userEmail:a.user?.email??null}),n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"created"}}async logWarnings(e){await Promise.all(e.map(r=>{let o=r.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${r.message}`:r.message;return this.logger.warning(o)}))}};async function xn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:ta,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var ta=async({stdout:t},e)=>{await Ve.start(e,t)};u();u();u();var En=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let a=Ee().substring(0,6),i=`${ra(t.log_timestamp)}_${t.source_namespace}_${t.source}_${a}.json`,l=zo({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),f=U(n,i);try{return await Z(n),await Pe(f,l),{fullOutputPath:f,identifier:a}}catch(c){throw r.write(`Error while writing log to file: ${c}
9
+ `),c}};function ra(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),a=e.getUTCHours().toString().padStart(2,"0"),s=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),l=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${a}${s}${i}_${l}Z`}var ze=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:a,organizationId:s,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:f=0})=>{if(!i?.aborted)try{let c=e,p=Mo,h=f,g=await o.appLogs({jwtToken:e,cursor:r},s),{errors:d,status:m}=g;if(m===200){h=0;let{app_logs:S}=g;for(let v of S){let w=JSON.parse(v.payload);await D({outputPrefix:v.source,stripAnsi:!1},async()=>{v.log_type===Wo?(oa(v,w,t),w=new Fo(Do(w))):v.log_type.startsWith(qo)?na(v,w,t):t.write(JSON.stringify(w));let E=await En({appLog:v,appLogPayload:w,stdout:t,storeName:a,logsDir:l});t.write(I`${R.gray("\u2514 ")}${R.link("Open log file",`file://${E.fullOutputPath}`,`Log: ${E.fullOutputPath}`)} ${R.gray(`(${E.identifier})`)}\n`.value)})}}else{let S={errors:d.map(w=>({message:w,status:m}))},v=await Vo({response:S,onThrottle:w=>{k("Request throttled while polling app logs.",t),k(`Retrying in ${w/1e3} seconds.`,t)},onUnknownError:w=>{k("Error while polling app logs.",t),k(`Retrying in ${w/1e3} seconds.`,t)},onResubscribe:()=>n()});if(v.resubscribeResult==="failed"){if(h+=1,h>=Oo){k("App log streaming session has expired. Please restart your dev session.",t);return}}else v.resubscribeResult==="succeeded"&&(h=0);v.nextJwtToken&&(c=v.nextJwtToken),p=v.retryIntervalMs}let{cursor:x}=g;setTimeout(()=>{ze({stdout:t,appLogsFetchInput:{jwtToken:c,cursor:x??r},developerPlatformClient:o,resubscribeCallback:n,storeName:a,organizationId:s,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:h}).catch(S=>{y(`Unexpected error during polling: ${S}}
10
+ `)})},p)}catch(c){k("Error while polling app logs.",t),k(`Retrying in ${ft/1e3} seconds.`,t),y(`${c}}
11
+ `),setTimeout(()=>{ze({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:a,organizationId:s,abortSignal:i,logsDir:l}).catch(p=>{y(`Unexpected error during polling: ${p}}
12
+ `)})},ft)}};function oa(t,e,r){let o=(e.fuel_consumed/No).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
13
+ `).filter(Boolean).map(a=>I`${R.gray("\u2502 ")}${a}`.value).join(`
14
+ `))}function na(t,e,r){t.log_type===Ho?r.write("Function network access response retrieved from cache."):t.log_type===jo?e.reason===Bo?r.write("Function network access request executing in background because there is no cached response."):e.reason===Ko&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===Go&&(t.status==="success"?r.write("Function network access request executed successfully."):t.status==="failure"&&r.write(`\u274C Function network access request failed to execute with error: ${e.error}.`))}function sa(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function Sn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:a,localApp:s}){return{type:"app-logs-subscribe",prefix:"app-logs",function:aa,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:a,localApp:s}}}var aa=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:a,organizationId:s,appWatcher:i,localApp:l})=>{async function f(c){let p=await mt(o,n,s,t),h=l.getLogsDir();await Z(h),await ze({stdout:t,appLogsFetchInput:{jwtToken:p},resubscribeCallback:()=>mt(o,n,s),developerPlatformClient:o,storeName:a,organizationId:s,abortSignal:c,logsDir:h})}try{let c=!1,p,h=async g=>{let d=sa(g.app);if(d&&!c){y("Function extensions detected, starting logs polling"),c=!0,p=new AbortController;try{await f(p.signal)}catch(m){y(`Failed to start function logs: ${m}`,e)}}else!d&&c&&(y("No function extensions detected, stopping logs polling"),c=!1,p?.abort(),p=void 0)};i.onStart(h).onEvent(h)}catch{}};u();async function bn(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:ia}}var ia=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};u();import{EventEmitter as ca}from"events";var la={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},Ye=class extends ca{currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0};constructor(e){super(),e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};Kt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e,r){let o=la[e],n=o.type==="success"?[]:r;this.updateStatus({statusMessage:o,...n?{errors:n}:{}})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};u();import*as Un from"http";import*as Rn from"https";function An(t){return"errors"in t&&Array.isArray(t.errors)}async function In(t,e,r,o){let a=(await import("./http-proxy-node16-D3JUYA5D.js")).default.createProxyServer(),s=ua(t,a,o),i=r?Rn.createServer(r,s):Un.createServer(s);return i.on("upgrade",pa(t,a,o)),e.addEventListener("abort",()=>{y("Closing reverse HTTP proxy"),i.close()}),{server:i}}function pa(t,e,r){return function(o,n,a){let s=Tn(t,o,!0);if(s)return e.ws(o,n,a,{target:s},i=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let f=(An(i)?i.errors[i.errors.length-1]:void 0)??i;k(`Error forwarding websocket request: ${f.message}`,r),k(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});n.destroy()}}function ua(t,e,r){return function(o,n){let a=Tn(t,o);if(a)return o.method==="OPTIONS"?(n.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin??"*","Access-Control-Allow-Methods":o.headers["access-control-request-method"]??"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]??"Content-Type, Authorization","Access-Control-Max-Age":"86400"}),n.end()):e.web(o,n,{target:a},s=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let l=(An(s)?s.errors[s.errors.length-1]:void 0)??s;k(`Error forwarding web request: ${l.message}`,r),k(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});y(I`
15
+ Reverse HTTP proxy error - Invalid path: ${o.url??""}
16
+ These are the allowed paths:
17
+ ${R.json(JSON.stringify(t))}
18
+ `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function Tn(t,e,r=!1){let o=e.url??"/";for(let n in t)if(o.startsWith(n))return t[n];return r&&t.websocket?t.websocket:t.default}async function _n({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:a,commandOptions:s,network:i,graphiqlPort:l,graphiqlKey:f}){let c=o.apiKey,p=o.apiSecretKeys[0]?.secret??"",h=Mt(),g=!At(h[De.disableGraphiQLExplorer]),d=await uo(t),m=new xo(d,i.proxyUrl),x=await Se(),S=Io(n,c,x),v=S,w=Er(f,p,n),E=g?`http://localhost:${l}/graphiql?key=${encodeURIComponent(w)}`:void 0,L=d.configuration.embedded,W=d.nonConfigExtensions.length>0,q=new Ye({isReady:!1,previewURL:v,graphiqlURL:E,appEmbedded:L,hasExtensions:W}),b=[...await Pn({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:c,apiSecret:p,scopes:eo(d.configuration)}),g?await yn({appName:o.title,appUrl:S,port:l,apiKey:c,apiSecret:p,key:w,storeFqdn:n}):void 0,await hn({allExtensions:d.realExtensions,storeFqdn:n,storeId:a,apiKey:c,subscriptionProductUrl:s.subscriptionProductUrl,checkoutCartUrl:s.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:m}),await xn({app:d,apiKey:c,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:m,appPreviewURL:S,devSessionStatusManager:q,unsafeValidation:s.unsafeValidation}),await Jo({remoteApp:o,localApp:d,storeFqdn:n,theme:s.theme,themeExtensionPort:s.themeExtensionPort,storePassword:s.storePassword}),wn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:p,remoteAppUpdated:e}),await Sn({developerPlatformClient:r,subscription:{shopIds:[Number(a)],apiKey:c},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:m}),await bn({appWatcher:m})].filter(da);return{processes:await fa(b,i.proxyPort,i.reverseProxyCert),previewUrl:v,graphiqlUrl:E,devSessionStatusManager:q}}var da=t=>t!==void 0&&t!==!1;async function fa(t,e,r){let o=await Promise.all(t.map(async s=>{let i={};if(s.type==="web"&&s.options.roles.includes(G.Frontend)){let l=s.options.portFromConfig??s.options.port;i.default=`http://localhost:${l}`;let f=s.options.hmrServerOptions;f&&(i.websocket=`http://localhost:${f.port}`,f.httpPaths.forEach(c=>i[c]=`http://localhost:${f.port}`)),s.options.port=l}else if(s.type==="previewable-extension"){let l=await M();i[s.options.pathPrefix]=`http://localhost:${l}`,s.options.port=l}return{process:s,rules:i}})),n=o.map(({process:s})=>s),a=o.map(({rules:s})=>s).reduce((s,i)=>({...s,...i}),{});return Object.keys(a).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:ma,options:{port:e,rules:a,localhostCert:r}}),n}var ma=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:a}=await In(o,t,n,e);V(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await a.listen(r,"localhost")};u();u();u();var _=X(tt(),1);var Ln=.9,Cn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Jt(),{isRawModeSupported:o}=Re(),[n,a]=(0,_.useState)(e),[s,i]=(0,_.useState)(Math.floor(r.columns*Ln)),[l,f]=(0,_.useState)(!0),c=(0,_.useRef)(null);if(!n)throw new Error("No tabs provided");Ae((d,m)=>{(async()=>{if(m?.leftArrow||m?.rightArrow||m?.tab){let w=Object.entries(t).filter(([b,K])=>K.content),E=w.findIndex(([b])=>b===n);if(E===-1)return;let L=m?.leftArrow?-1:1,W=(E+L+w.length)%w.length,q=w[W];q&&a(q[0])}let S=t[d];if(S){S.action?await S.action():a(d);return}let v=t[n];if(v?.shortcuts){let w=v.shortcuts.find(E=>E.key===d);w&&(!w.condition||w.condition())&&await w.action()}})()},{isActive:!!o}),(0,_.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*Ln)),!c.current)return;let m=Qt(c.current);f(m.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let p=Object.entries(t).map(([d,m])=>({...m,inputKey:d,header:` (${d}) ${m.label} `})),h=p.filter(d=>!d.action),g=p.filter(d=>d.action);return _.default.createElement(_.default.Fragment,null,_.default.createElement(F,{paddingTop:0,width:s,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},_.default.createElement(F,{ref:c,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},_.default.createElement(N,{wrap:"truncate-end"},"\u2502",h.map(d=>_.default.createElement(_.default.Fragment,{key:d.inputKey},_.default.createElement(N,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),l&&_.default.createElement(F,{flexGrow:1,justifyContent:"flex-end"},g.map((d,m)=>_.default.createElement(N,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,m<g.length-1&&" \u2502 ")))),_.default.createElement(F,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var P=X(tt(),1);var ha=({message:t,type:e})=>e==="loading"?P.default.createElement(nr,{title:t}):P.default.createElement(N,null,e==="success"?"\u2705":"\u274C"," ",t),kn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:a,organizationName:s,configPath:i,localURL:l,onAbort:f})=>{let{isRawModeSupported:c}=Re(),[p,h]=(0,P.useState)(void 0),[g,d]=(0,P.useState)(void 0),[m,x]=(0,P.useState)(r.status),[S,v]=(0,P.useState)(!1),{isAborted:w}=or(t.signal,async b=>{b&&d(typeof b=="string"?b:b.message),r.status.isReady?v(!0):(h("Shutting down dev ..."),await f()),Ne()}),E=(0,P.useMemo)(()=>e.map(b=>({...b,action:async(K,ns,ss)=>{try{return await b.action(K,ns,ss)}catch(as){t.abort(as)}}})),[e,t]);(0,P.useEffect)(()=>(r.on("dev-session-update",x),()=>{r.off("dev-session-update",x)}),[]),Ae((b,K)=>{Zt(b,K,()=>t.abort())},{isActive:!!c});let L=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:m.previewURL,condition:()=>!!(m.isReady&&m.previewURL),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),m.previewURL&&await _e(m.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:dt(o),condition:()=>!!(m.isReady&&m.appEmbedded===!1&&m.hasExtensions),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await _e(dt(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:m.graphiqlURL,condition:()=>!!(m.isReady&&m.graphiqlURL),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),m.graphiqlURL&&await _e(m.graphiqlURL)}}],W=L.filter(b=>b.condition?.()??!0),q={d:{label:"Dev status",shortcuts:L,content:P.default.createElement(P.default.Fragment,null,m.statusMessage&&P.default.createElement(ha,{message:m.statusMessage.message,type:m.statusMessage.type}),c&&W.length>0&&P.default.createElement(F,{marginTop:1,flexDirection:"column"},W.map(b=>P.default.createElement(N,{key:b.key},er.pointerSmall," ",P.default.createElement(N,{bold:!0},"(",b.key,")")," ",nt()&&b.url?P.default.createElement(rt,{url:b.url,label:b.shortcutLabel}):b.shortcutLabel))),P.default.createElement(F,{marginTop:c?1:0,flexDirection:"column"},p?P.default.createElement(N,null,p):P.default.createElement(P.default.Fragment,null,m.isReady&&!(c&&nt())&&P.default.createElement(P.default.Fragment,null,W.filter(b=>b.url).map(b=>P.default.createElement(N,{key:b.key},b.linkLabel," URL: ",P.default.createElement(rt,{url:b.url})))))))},a:{label:"App info",content:P.default.createElement(F,{flexDirection:"column"},P.default.createElement(ot,{tabularData:[["App:",a??""],["App URL:",n??""],["Local URL:",n?"":l??""],["Config:",i?.split("/").pop()??""],["Org:",s??""]].filter(([,b])=>b)}))},s:{label:"Store info",content:P.default.createElement(F,{flexDirection:"column"},P.default.createElement(ot,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",s??""]].filter(([,b])=>b)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return P.default.createElement(P.default.Fragment,null,P.default.createElement(tr,{processes:E,prefixColumnSize:ro,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),S&&P.default.createElement(F,{marginTop:1,flexDirection:"column"},P.default.createElement(rr,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),w?null:P.default.createElement(F,{paddingTop:1,flexDirection:"column",flexGrow:1},c?P.default.createElement(Cn,{tabs:q,initialActiveTab:"d"}):P.default.createElement(F,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},q.d?.content)),g?P.default.createElement(F,{marginTop:1,flexDirection:"column"},P.default.createElement(N,{color:"red"},g)):null)};var Fn=X(tt(),1);import{Writable as Dn}from"stream";async function Mn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:a,devSessionStatusManager:s,appURL:i,appName:l,organizationName:f,configPath:c,localURL:p}){let h=()=>o.abort();process.on("shopify:signal",h);try{if(et()!=="json"&&ir())return await Xt(Fn.default.createElement(kn,{processes:t,abortController:o,devSessionStatusManager:s,shopFqdn:a,appURL:i,appName:l,organizationName:f,configPath:c,localURL:p,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:a})}}),{exitOnCtrlC:!1});await ga({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o}),Ne()}finally{process.removeListener("shopify:signal",h)}}async function ga({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){let n=et()==="json";n||(process.stdout.write(`
19
+ Preview URL: ${e}
20
+ `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
21
+ `));let{signal:a}=o,s=()=>o.abort();process.once("SIGINT",s),process.once("SIGTERM",s);let i=()=>{},l=new Promise(c=>{i=c,a.addEventListener("abort",i,{once:!0}),a.aborted&&c()}),f=t.map(async c=>{let p=new Dn({write:(h,g,d)=>d()});return c.action(n?p:$n(process.stdout),n?p:$n(process.stderr),a)});try{await Promise.all([...f,l])}catch(c){if(!a.aborted)throw c}finally{o.abort(),await Promise.allSettled(f),a.removeEventListener("abort",i),process.removeListener("SIGINT",s),process.removeListener("SIGTERM",s)}}function $n(t){return new Dn({decodeStrings:!1,write(e,r,o){let n=typeof e=="string"?Buffer.from(e,r):e,a=typeof e=="string"&&n.length>0&&n[n.length-1]!==10;t.write(a?Buffer.concat([n,Buffer.from(`
22
+ `)]):n,o)}})}u();function On(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];pe({headline:[`A random port will be used for ${n.for} because ${n?.requested} is not available.`],body:["If you want to use a specific port, you can choose a different one by setting the ",{command:n?.flagToRemedy}," flag."]});return}let r=Xe(e.map(n=>n.for)).join(" "),o=Xe(e.map(n=>({command:n.flagToRemedy})));pe({headline:[`Random ports will be used for ${r} because the requested ports are not available.`],body:["If you want to use specific ports, you can choose different ports using the",...o,"flags."]})}u();async function Nn(t,e){return e?e.includes("localhost")?"localhost":(await jt(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}u();var Wn=X(cs(),1);var Q="v1.4.4",qn="FiloSottile/mkcert",Et=R.genericShellCommand("mkcert");async function wa(t,e,r,o){let n=e[De.mkcertBinaryPath];if(n)return n;let s=U(t,r==="win32"?"mkcert.exe":"mkcert");if(await O(s))return s;let i=await(0,Wn.default)("mkcert",{nothrow:!0});return i?(y(I`Found ${Et} at ${R.path(i)}`),i):(await ya(s,r,o),s)}async function ya(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${Q}-darwin-arm64`:`mkcert-${Q}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${Q}-linux-arm64`:`mkcert-${Q}-linux-amd64`;break;case"win32":o=`mkcert-${Q}-windows-amd64.exe`;break;default:throw new te(`Unsupported platform: ${e}`)}await Fr(qn,Q,o,t),y(I`${Et} saved to ${R.path(t)}`)}async function va(t){let e=U(t,"mkcert-LICENSE");if(await O(e))return;let r=`https://raw.githubusercontent.com/${qn}/refs/tags/${Q}/LICENSE`,o={headline:"Failed to download mkcert license.",body:["We tried to download the license for mkcert, but the request failed. You can ",{link:{url:r,label:"view the license here"}}]},n;try{if(n=await Ht(r),!n.ok)return o}catch{return o}let a=await n.text();await Pe(e,a)}async function Hn({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let a=U(".shopify","localhost-key.pem"),s=U(".shopify","localhost.pem"),i=U(t,a),l=U(t,s);if(await O(i)&&await O(l))return{keyContent:await C(i),certContent:await C(l),certPath:s};if(!(e??await fo()))throw new T(`Localhost certificate and key are required at ${s} and ${a}`);let c="",p;return await Te([{title:"Finding or downloading mkcert binary",task:async()=>{let g=U(t,".shopify");c=await wa(g,r,o,n),p=await va(g),y(I`${Et} found at: ${R.path(c)}`)}}]),p&&Ie(p),V(I`Generating self-signed certificate for localhost. You may be prompted for your password.`),await Le(c,["-install","-key-file",i,"-cert-file",l,"localhost"]),V(I`${R.successIcon()} Certificate generated at ${s}\n`),await cr()&&(pe({headline:"It looks like you're using WSL.",body:["Additional steps are required to configure certificate trust in Windows."],link:{label:"See Shopify CLI documentation",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development-with-windows-subsystem-for-linux-wsl"}}),V("\u{1F449} Press any key to continue"),await sr(),V("")),{keyContent:await C(i),certContent:await C(l),certPath:It(t,l)}}u();function jn(){let t=["Your app has extensions which need to be assigned",{command:"uid"},"identifiers."],e=["You must first map IDs to your existing extensions by running",{command:"shopify app deploy"},"interactively, without",{command:"--allow-updates"},"or",{command:"--allow-deletes"},", to finish the migration."],r={title:"Reference",body:{list:{items:[{link:{label:"Migrating from the Partner Dashboard",url:"https://shopify.dev/docs/apps/build/dev-dashboard/migrate-from-partners"}}]}}};throw new T(t,void 0,[e],[r])}u();u();import{createWriteStream as Pa}from"fs";import{Writable as xa}from"stream";import{finished as Ea}from"stream/promises";import{StringDecoder as Sa}from"string_decoder";import{once as ba}from"events";var he=ge({name:"DevInstanceLogEntry",schema:A.object({timestamp:ae,source:A.string().describe("What produced the line, for example a process prefix like web or extensions."),level:A.enum(["debug","info","warning","error"]).optional(),message:A.string()}).strict()});function Bn({logFile:t,logOutput:e,isActive:r,onError:o}){let n=Pa(t,{flags:"w",mode:384});n.on("error",o),e?.on("error",o);let a=ba(n,"open"),s=new Set,i=async l=>{if(!r())return;let f=he.validate({...l,timestamp:l.timestamp??ie(new Date)}),c=`${JSON.stringify(f)}
23
+ `;try{await Je(n,c),e&&await Je(e,c)}catch(p){throw o(p),p}};return{opened:a,log:i,tee:(l,{source:f,stringWritesAreMessages:c=!1})=>{let p=new Sa("utf8"),h="",g=f,d=async v=>{let w=v.split(/\r?\n/);h=w.pop()??"",await Promise.all(w.map(async E=>{let L=ur(E).trimEnd();L.length>0&&await i({source:g,message:L})}))},m=()=>d(`${h}${p.end()}
24
+ `),x=new St({decodeStrings:!c,write(v,w,E){let L=Ue()?.outputPrefix??f,W=c&&typeof v=="string",q=L!==g||W?m():Promise.resolve();g=L,Promise.all([q,Je(l,v,w),d(h+p.write(typeof v=="string"?Buffer.from(v,w):v)+(W?`
25
+ `:""))]).then(()=>E()).catch(E)},final(v){m().then(()=>v()).catch(v)}}),S=v=>x.destroy(v);return l.on("error",S),x.on("error",v=>o(v)),x.once("close",()=>{l.off("error",S)}),s.add(x),x},flush:()=>Promise.allSettled([...s].map(l=>Gn(l))),close:async()=>{try{await Gn(n),e&&!e.destroyed&&await Je(e,"")}finally{e?.off("error",o)}}}}var St=class extends xa{contexts=[];constructor(e){super({...e,write:(r,o,n)=>{D(this.contexts.shift()??{},()=>e.write.call(this,r,o,n))}})}write(e,r,o){return this.contexts.push(Ue()),typeof r=="string"?super.write(e,r,o):super.write(e,r??o)}end(e,r,o){return e!=null&&typeof e!="function"&&this.contexts.push(Ue()),typeof e=="function"?super.end(e):typeof r=="string"?super.end(e,r,o):super.end(e,r??o)}};async function Je(t,e,r="utf8"){await new Promise((o,n)=>{t.write(e,r,a=>a?n(a):o())})}async function Gn(t){let e=Ea(t,{cleanup:!0});t.end(),await e}var Vn=X(ls());import bt,{readFileSync as Ua}from"fs";import{mkdir as Ra,rmdir as Aa,writeFile as Ia}from"fs/promises";var Ut="dev_instance_already_running",Ta="dev",_a=15e3;function La(t){let e=U(t.directory,".shopify",Ta),r=Fa(t);return{folder:e,infoFile:U(e,`${r}.json`),lockFile:U(e,`${r}.lock`),logFile:U(e,`${r}.jsonl`)}}async function Ca(t){let e=La(t);await Lr(t.directory),await Z(e.folder);let r=`${e.lockFile}.acquire`;try{await Ra(r,{mode:448})}catch(o){if(o.code!=="EEXIST")throw o;let n=new T(`Another \`shopify ${t.command}\` is starting, or a previous startup was interrupted.`,"Wait for other starts to finish. If none is running, remove the startup lock below and try again.",[["Startup lock",{filePath:r}]]);throw n.code=Ut,n}try{return await ka(t,e)}catch(o){if(!$a(o))throw o;let n=await Jn(e.infoFile);throw Qn(t,n&&Yn(n.pid)?n:void 0)}finally{await Aa(r)}}async function zn(t,e){let r=await Ca(t);try{return await e(r)}finally{await r.release()}}async function ka(t,e){let r=await Jn(e.infoFile);if(r&&Yn(r.pid))throw Qn(t,r);let o=Ee(),n=new AbortController,a=!1,s=()=>{if(a)return!1;try{return JSON.parse(Ua(e.infoFile,"utf8")).sessionId===o}catch{return!1}},i=!1,l=w=>{if(!(i&&!s()))try{bt.rmdirSync(w)}catch(E){if(E.code!=="ENOENT")throw E}},f={realpath:!1,lockfilePath:e.lockFile,stale:_a,retries:0,onCompromised:w=>{a=!0,y(`The ${t.command} instance lock was compromised: ${w.message}`),n.abort(new T(`The ${t.command} instance lost its lock.`,"Start the command again."))},fs:{...bt,rmdir:(w,E)=>{if(i&&!s())return E(null);bt.rmdir(w,E)},rmdirSync:l}};r&&await kt(e.lockFile,{force:!0});let c=await Vn.default.lock(e.infoFile,f),p=ie(new Date),h={schemaVersion:1,sessionId:o,command:t.command,...t.key?{key:t.key}:{},pid:process.pid,status:"starting",startedAt:p,updatedAt:p,directory:t.directory,logFile:e.logFile,details:{...t.details??{}}},g=Promise.resolve(),d=!1,m=Bn({logFile:e.logFile,logOutput:t.logOutput,isActive:()=>!d&&!a,onError:w=>n.abort(w)}),x,S=()=>{!d&&s()&&(l(e.lockFile),Ct(e.infoFile))};process.once("exit",S);let v={info:h,paths:e,abortSignal:n.signal,update:async w=>{if(x||a)return;w.status&&(h.status=w.status),w.details&&(h.details={...h.details,...w.details}),h.updatedAt=ie(new Date);let E={...h,details:{...h.details}},L=g.then(async()=>{a||await Kn(e.infoFile,E)});g=L.catch(()=>{}),await L},log:m.log,tee:m.tee,release:()=>(x??=(async()=>{try{let E=(await m.flush()).find(L=>L.status==="rejected");if(await g,E?.status==="rejected")throw E.reason}finally{d=!0,process.removeListener("exit",S);try{await m.close()}finally{let w=s();await c().catch(E=>y(`Failed to release the dev instance lock: ${E.message}`)),w&&await Ze(e.infoFile).catch(()=>{})}}})(),x)};try{return await m.opened,await Kn(e.infoFile,h),i=!0,v}catch(w){throw await v.release().catch(E=>y(E.message)),await Ze(`${e.infoFile}.${o}.tmp`),w}}function Yn(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}async function Jn(t){try{let e=JSON.parse(await C(t));return typeof e?.pid=="number"?e:void 0}catch{return}}async function Kn(t,e){let r=`${t}.${e.sessionId}.tmp`;await Ia(r,`${JSON.stringify(e,null,2)}
26
+ `,{mode:384}),await Lt(r,t)}function $a(t){return t?.code==="ELOCKED"}function Fa({command:t,key:e}){let r=[t,e].filter(Boolean).join("-").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),o=le(JSON.stringify([t,e??""])).slice(0,4);return`${r}-${o}`}function Qn(t,e){let r=`shopify ${t.command}`;if(!e){let s=new T(`Another \`${r}\` is starting for this project.`,"Wait a few seconds and try again, or stop the other process first.");return s.code=Ut,s}let o=process.platform==="win32"?`taskkill /PID ${e.pid} /F`:`kill ${e.pid}`,n=Object.entries(e.details).filter(([,s])=>typeof s=="string"||typeof s=="number"||typeof s=="boolean").map(([s,i])=>[s,String(i)]),a=new T(`Another \`${r}\` is already running for this project.`,"Use the running instance, or stop it before starting a new one.",[["Read its output in",{filePath:e.logFile}],["Stop it with",{command:o}]],[{body:{tabularData:[["PID",String(e.pid)],["Started",e.startedAt],...n],firstColumnSubdued:!0}}]);return a.code=Ut,a.details={instance:e},a}function Zn({app:t,remoteApp:e,json:r=!1},o){return zn({command:"app dev",directory:t.directory,key:ye(t.configPath),details:{configPath:t.configPath,appName:e.title,clientId:e.apiKey},logOutput:r?process.stdout:void 0},o)}async function es(t){let e=await Da(t);await Ma(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:a}=await _n(e);await Na(e),await Ha({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:a})}async function Da(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:a,tunnel:s}=t,i;if(s.mode==="auto"){let S=await M();i=await lo(t.commandConfig,S,"cloudflare")}let l=await ho(r,o,a,r.flags);r.configuration=l,go({app:e,remoteApp:r,selectedStore:n,cachedInfo:pt(t.directory),organization:t.organization,tunnelMode:s.mode}),e.configuration.build?.dev_store_url&&(e.configuration.build={...e.configuration.build,dev_store_url:n.shopDomain},await(await dr.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Zr(t.project);let f=t.graphiqlPort??await M(de.graphiql),c=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??de.graphiql,actual:f}];s.mode==="use-localhost"&&c.push({for:"localhost",flagToRemedy:"--localhost-port",requested:s.requestedPort,actual:s.actualPort}),On(c);let{webs:p,...h}=await qa(e.directory,e.webs,f,s,i,r.configuration,t.installMkcert);e.webs=p;let g=e.configuration.build?.automatically_update_urls_on_dev,d=pt(t.directory)?.previousAppId,m=r.apiKey,x=await Wa(p,t.update,h,e,g,r,m);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==d,localApp:e,developerPlatformClient:o,commandOptions:t,network:h,partnerUrlsUpdated:x,graphiqlPort:f,graphiqlKey:t.graphiqlKey}}async function Ma(t){await Oa(t)}async function Oa(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||jn()}async function Na(t){no({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await ja({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Vt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Wa(t,e,r,o,n,a,s){let{backendConfig:i,frontendConfig:l}=J(t),f=!1;if((l??i)&&e){let c=ao(r.proxyUrl,t.map(({configuration:p})=>p.auth_callback_path).find(p=>p),o.configuration.app_proxy);f=await co({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:a.newApp,localApp:o,apiKey:s,newURLs:c}),f&&o.setDevApplicationURLs(c)}return f}async function qa(t,e,r,o,n,a,s){let{backendConfig:i,frontendConfig:l}=J(e);await Ga(e,r);let f=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:c,frontendPort:p,usingLocalhost:h},g,d]=await Promise.all([so(f),Ot()??i?.configuration.port??M(),io(a)]),m=h?`${c}:${p}`:c,x=l?.configuration.port;l&&(x??=l===i?g:await M(),l.configuration.port=x),x=x??await M();let S;if(o.mode==="use-localhost"){let{keyContent:v,certContent:w,certPath:E}=await Hn({appDirectory:t,forceInstall:s});S={key:v,cert:w,certPath:E,port:o.actualPort}}return{proxyUrl:m,proxyPort:p,frontendPort:x,backendPort:g,currentUrls:d,webs:e,reverseProxyCert:S}}async function Ha({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let a=new Nt,s=o.commandOptions.devInstance,i=t.map(g=>({prefix:g.prefix,action:async(m,x,S)=>{let v=g.function,w=s?s.tee(m,{source:g.prefix,stringWritesAreMessages:!0}):m,E=s?s.tee(x,{source:g.prefix,stringWritesAreMessages:!0}):x;return v({stdout:w,stderr:E,abortSignal:S},g.options)}}));if(s){let g={storeFqdn:o.storeFqdn,previewUrl:e,graphiqlUrl:r,appUrl:o.localApp.devApplicationURLs?.applicationUrl,localUrl:o.network.proxyUrl};await s.update({status:"running",details:{...g,preview:Xn(n.status)}}),await s.log({source:"app dev",level:"info",message:`Preview URL: ${e}`}),r&&await s.log({source:"app dev",level:"info",message:`GraphiQL URL (Admin API): ${r}`})}let l=o.developerPlatformClient,f={id:o.remoteApp.id,developerPlatformClient:l},c,p=g=>{let d=[s?.update({details:{preview:Xn(g)}})],m=g.statusMessage;m&&(m.message!==c?.message||m.type!==c?.type)&&d.push(s?.log({source:"app dev",level:m.type==="error"?"error":"info",message:m.message})),c=m,Promise.all(d).catch(x=>{y(`Failed to save dev status: ${x.message}`)})};s&&(n.on("dev-session-update",p),p(n.status));let h=()=>a.abort(s?.abortSignal.reason);try{s?.abortSignal.throwIfAborted(),s?.abortSignal.addEventListener("abort",h,{once:!0}),await Mn({processes:i,previewUrl:e,graphiqlUrl:r,app:f,abortController:a,shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl}),s?.abortSignal.throwIfAborted()}finally{s?.abortSignal.removeEventListener("abort",h),s&&n.off("dev-session-update",p)}}function Xn({isReady:t,statusMessage:e,errors:r}){let o=t?"ready":"starting";return t&&e?.type==="loading"&&(o="updating"),e?.type==="error"&&(o="error"),{state:o,message:e?.message??null,errors:r??[]}}async function ja(t){let e=await Nn(t.devOptions.commandConfig,t.tunnelUrl);await z.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?le(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:le(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await z.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function Ga(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,a)=>r.indexOf(n)!==a);if(o)throw new T(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await st(n))throw new T(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await st(e)){let a=`Port ${e} is not available for serving GraphiQL.`,s=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new T(a,s)}})()])}u();var ts=A.object({state:A.enum(["starting","updating","ready","error"]),message:A.string().nullable(),errors:A.array(A.string())}).strict().describe("The CLI-reported preview state in the instance file; this is not a health check."),Ba=A.object({schemaVersion:A.literal(1),sessionId:A.string(),command:A.literal("app dev"),key:A.string().optional(),pid:A.number().int().positive(),status:A.enum(["starting","running"]),startedAt:ae,updatedAt:ae,directory:A.string(),logFile:A.string(),details:A.object({configPath:A.string(),appName:A.string(),clientId:A.string(),storeFqdn:A.string().optional(),previewUrl:A.string().optional(),graphiqlUrl:A.string().optional(),appUrl:A.string().optional(),localUrl:A.string().optional(),preview:ts.optional()}).strict()}).strict().describe("The instance JSON file under .shopify/dev/. This object is not emitted to stdout."),rs=ge({name:he.name,schema:he.schema,definitions:{DevInstance:Ba,DevPreview:ts}});u();async function os({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??de.localhost,n=await M(o);if(e&&n!==o){let a=`Port ${e} is not available.`,s=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new T(a,s)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var $=X(is(),1);var Rt=class t extends yo{static get requiresSyncAnalytics(){return!0}static summary="Run the app.";static descriptionWithMarkdown="Builds and previews your app on a dev store, and watches for changes. [Read more about testing apps locally](https://shopify.dev/docs/apps/build/cli-for-apps/test-apps-locally).";static get jsonOutputSchema(){return rs}static description=this.descriptionForHelp();static flags={...fr,...Xr,...mr,"client-id":$.Flags.string({hidden:!1,description:"The Client ID of your app. Use with --config to run dev with that configuration for a different app than the one it is linked to.",env:"SHOPIFY_FLAG_CLIENT_ID"}),store:$.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>be(e)}),"skip-dependencies-installation":$.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":$.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"unsafe-validation":$.Flags.boolean({description:"Allow app dev to continue with warnings for eligible app version validation failures.",env:"SHOPIFY_FLAG_UNSAFE_VALIDATION",default:!1}),"subscription-product-url":$.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":$.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":$.Flags.string({description:'Use a custom tunnel, it must be running before executing dev. Format: "https://my-tunnel-url:port".',env:"SHOPIFY_FLAG_TUNNEL_URL",exclusive:["tunnel"]}),"use-localhost":$.Flags.boolean({description:"Service entry point will listen to localhost. A tunnel won't be used. Will work for testing many app features, but not those that directly invoke your app (E.g: Webhooks)",env:"SHOPIFY_FLAG_USE_LOCALHOST",exclusive:["tunnel-url"]}),"install-mkcert":$.Flags.boolean({description:"Install and use mkcert to generate localhost certificates when --use-localhost is enabled without prompting.",env:"SHOPIFY_FLAG_INSTALL_MKCERT",dependsOn:["use-localhost"]}),"localhost-port":Ce({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:$.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Ce({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":$.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:$.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":Ce({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":$.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(t),r=await os({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await zt(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await po(e.path);let o=await wo({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config});return Zn({...o,json:e.json},async n=>{let a=await vo({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option"}),s={...o,store:a,directory:e.path,update:!e["no-update"],unsafeValidation:e["unsafe-validation"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],storePassword:e["store-password"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],installMkcert:e["install-mkcert"],tunnel:r,devInstance:n};return await es(s),{app:o.app}})}};export{Ii as a,Rt as b};
@@ -1 +1 @@
1
- import{a as u}from"./chunk-4JGWKUJN.js";import{g as d}from"./chunk-VKWPEFWQ.js";d();var m=!1;function v(){return m}function y(){let t=0,e=!1,i=setInterval(()=>{if(!e){if(v()||t>=12e4){e=!0,clearInterval(i),u(process.pid,"SIGINT",!1,()=>{process.exit(0)});return}t+=100}},100)}var k=async({config:a,Command:o})=>{await I(o);let t=await import("./metadata-JWJG4JV4.js"),{commandStartOptions:e}=t.getAllSensitiveMetadata();e&&await t.addSensitiveMetadata(()=>({commandStartOptions:{...e,endTime:new Date().getTime()}}));let{postrun:i}=await import("./deprecations-ZX7ZKF6L.js");i(o);let{outputDebug:n}=await import("./output-2LS5AOAH.js"),r=o.id.replace(/:/g," ");n(`Completed command ${r}`),!r.includes("notifications")&&!r.includes("upgrade")&&!r.includes("send-analytics")&&await M();let{reportAnalyticsEvent:c}=await import("./analytics-APDNTBDE.js");await c({config:a,exitMode:"ok"}),m=!0};async function M(){let{versionToAutoUpgrade:a,warnIfUpgradeAvailable:o}=await import("./upgrade-YYPP5VZY.js"),t=a();if(!t){await o();return}if(process.env.SHOPIFY_CLI_FORCE_AUTO_UPGRADE==="1")await l(t);else{let{runAtMinimumInterval:i}=await import("./conf-store-54YJCIDK.js");await i("auto-upgrade",{days:1},async()=>{await l(t)})}}async function l(a){let[{CLI_KIT_VERSION:o},{isMajorVersionChange:t},{outputWarn:e,outputDebug:i},{getOutputUpdateCLIReminder:n,runCLIUpgrade:r,hasBlockingAutoUpgradeNotification:c},s]=await Promise.all([import("./version-OX3MORI6.js"),import("./version-P7D5ME4Z.js"),import("./output-2LS5AOAH.js"),import("./upgrade-YYPP5VZY.js"),import("./metadata-JWJG4JV4.js")]);if(t(o,a)){e(n(a,!0)),await s.addPublicMetadata(()=>({env_auto_upgrade_skipped_reason:"major_version"}));return}if(await c()){await s.addPublicMetadata(()=>({env_auto_upgrade_skipped_reason:"blocked_by_notification"}));return}try{await r({autoupgrade:!0}),await s.addPublicMetadata(()=>({env_auto_upgrade_success:!0}))}catch(f){let p=`Auto-upgrade failed: ${f}`;i(p),e(n(a)),await s.addPublicMetadata(()=>({env_auto_upgrade_success:!1}));let[{sendErrorToBugsnag:g},{inferPackageManagerForGlobalCLI:w}]=await Promise.all([import("./error-handler-4VW3AV2G.js"),import("./is-global-FKG327CG.js")]),_=Object.assign(new Error(p),{packageManager:w(),platform:process.platform,cliVersion:o});await g(_,"expected_error")}}async function I(a){let o=new Date().getTime();if(a&&"analyticsStopCommand"in a&&typeof a.analyticsStopCommand=="function"){let t=a.analyticsStopCommand();if(t){let e=await import("./metadata-JWJG4JV4.js"),{commandStartOptions:i}=e.getAllSensitiveMetadata();if(!i)return;await e.addSensitiveMetadata(()=>({commandStartOptions:{...i,startTime:o,startCommand:t}}))}}}export{y as a,k as b};
1
+ import{a as u}from"./chunk-GQNOVEKP.js";import{g as d}from"./chunk-VKWPEFWQ.js";d();var m=!1;function v(){return m}function y(){let t=0,e=!1,i=setInterval(()=>{if(!e){if(v()||t>=12e4){e=!0,clearInterval(i),u(process.pid,"SIGINT",!1,()=>{process.exit(0)});return}t+=100}},100)}var k=async({config:a,Command:o})=>{await I(o);let t=await import("./metadata-IBPHZB7N.js"),{commandStartOptions:e}=t.getAllSensitiveMetadata();e&&await t.addSensitiveMetadata(()=>({commandStartOptions:{...e,endTime:new Date().getTime()}}));let{postrun:i}=await import("./deprecations-IFVUXXDB.js");i(o);let{outputDebug:n}=await import("./output-3OYXK3Z5.js"),r=o.id.replace(/:/g," ");n(`Completed command ${r}`),!r.includes("notifications")&&!r.includes("upgrade")&&!r.includes("send-analytics")&&await M();let{reportAnalyticsEvent:c}=await import("./analytics-Q6QDIDYT.js");await c({config:a,exitMode:"ok"}),m=!0};async function M(){let{versionToAutoUpgrade:a,warnIfUpgradeAvailable:o}=await import("./upgrade-7U2TUNC4.js"),t=a();if(!t){await o();return}if(process.env.SHOPIFY_CLI_FORCE_AUTO_UPGRADE==="1")await l(t);else{let{runAtMinimumInterval:i}=await import("./conf-store-RI3TL6I4.js");await i("auto-upgrade",{days:1},async()=>{await l(t)})}}async function l(a){let[{CLI_KIT_VERSION:o},{isMajorVersionChange:t},{outputWarn:e,outputDebug:i},{getOutputUpdateCLIReminder:n,runCLIUpgrade:r,hasBlockingAutoUpgradeNotification:c},s]=await Promise.all([import("./version-SXQTRBXB.js"),import("./version-7DGU2KYH.js"),import("./output-3OYXK3Z5.js"),import("./upgrade-7U2TUNC4.js"),import("./metadata-IBPHZB7N.js")]);if(t(o,a)){e(n(a,!0)),await s.addPublicMetadata(()=>({env_auto_upgrade_skipped_reason:"major_version"}));return}if(await c()){await s.addPublicMetadata(()=>({env_auto_upgrade_skipped_reason:"blocked_by_notification"}));return}try{await r({autoupgrade:!0}),await s.addPublicMetadata(()=>({env_auto_upgrade_success:!0}))}catch(f){let p=`Auto-upgrade failed: ${f}`;i(p),e(n(a)),await s.addPublicMetadata(()=>({env_auto_upgrade_success:!1}));let[{sendErrorToBugsnag:g},{inferPackageManagerForGlobalCLI:w}]=await Promise.all([import("./error-handler-74HKA23T.js"),import("./is-global-2VLKV46Q.js")]),_=Object.assign(new Error(p),{packageManager:w(),platform:process.platform,cliVersion:o});await g(_,"expected_error")}}async function I(a){let o=new Date().getTime();if(a&&"analyticsStopCommand"in a&&typeof a.analyticsStopCommand=="function"){let t=a.analyticsStopCommand();if(t){let e=await import("./metadata-IBPHZB7N.js"),{commandStartOptions:i}=e.getAllSensitiveMetadata();if(!i)return;await e.addSensitiveMetadata(()=>({commandStartOptions:{...i,startTime:o,startCommand:t}}))}}}export{y as a,k as b};
@@ -1 +1 @@
1
- import{Ia as r}from"./chunk-UNHT4ZFP.js";import{a}from"./chunk-45SZ5PSE.js";import{p as i}from"./chunk-6IDEDOXW.js";import{g as e}from"./chunk-VKWPEFWQ.js";e();var c=3e3;async function n(o){let t;try{if(a.getAllPublicMetadata().api_key!==void 0)return;await Promise.race([r({directory:o,skipPrompts:!0}),new Promise(l=>{t=setTimeout(l,c)})])}catch{}finally{t&&clearTimeout(t)}}var m=async()=>(await n(i()),a.getAllPublicMetadata()),f=m;export{f as a};
1
+ import{Na as r}from"./chunk-3C6VLJ5D.js";import{a}from"./chunk-IQVRP7CT.js";import{p as i}from"./chunk-IWTNUJGY.js";import{g as e}from"./chunk-VKWPEFWQ.js";e();var c=3e3;async function n(o){let t;try{if(a.getAllPublicMetadata().api_key!==void 0)return;await Promise.race([r({directory:o,skipPrompts:!0}),new Promise(l=>{t=setTimeout(l,c)})])}catch{}finally{t&&clearTimeout(t)}}var m=async()=>(await n(i()),a.getAllPublicMetadata()),f=m;export{f as a};
@@ -1 +1 @@
1
- import{u as r}from"./chunk-3V4VL3SD.js";import{b as o}from"./chunk-I3J63RFV.js";import{e as t,p as n}from"./chunk-6IDEDOXW.js";import{e as s,g as a}from"./chunk-VKWPEFWQ.js";a();var e=s(o(),1);var c={path:e.Flags.string({description:"The path to your app directory.",parse:async i=>t(i),default:async()=>n(),noCacheDefault:!0,env:"SHOPIFY_FLAG_PATH"}),config:e.Flags.string({hidden:!1,char:"c",description:"The name of the app configuration.",env:"SHOPIFY_FLAG_APP_CONFIG"}),"client-id":e.Flags.string({hidden:!1,description:"The Client ID of your app.",env:"SHOPIFY_FLAG_CLIENT_ID",exclusive:["config"]}),reset:e.Flags.boolean({hidden:!1,description:"Reset all your settings.",env:"SHOPIFY_FLAG_RESET",default:!1,exclusive:["config"]})},p={query:e.Flags.string({char:"q",description:"The GraphQL query or mutation to run as a bulk operation.",env:"SHOPIFY_FLAG_QUERY",required:!1,exactlyOne:["query","query-file"]}),"query-file":e.Flags.string({description:"Path to a file containing the GraphQL query or mutation. Can't be used with --query.",env:"SHOPIFY_FLAG_QUERY_FILE",parse:async i=>t(i),exactlyOne:["query","query-file"]}),variables:e.Flags.string({char:"v",description:"The values for any GraphQL variables in your mutation, in JSON format. Can be specified multiple times.",env:"SHOPIFY_FLAG_VARIABLES",multiple:!0,exclusive:["variable-file"]}),"variable-file":e.Flags.string({description:"Path to a file containing GraphQL variables in JSONL format (one JSON object per line). Can't be used with --variables.",env:"SHOPIFY_FLAG_VARIABLE_FILE",parse:async i=>t(i),exclusive:["variables"]}),store:e.Flags.string({char:"s",description:"The store domain. Must be an existing dev store.",env:"SHOPIFY_FLAG_STORE",parse:async i=>r(i)}),watch:e.Flags.boolean({description:"Wait for bulk operation results before exiting. Defaults to false.",env:"SHOPIFY_FLAG_WATCH"}),"output-file":e.Flags.string({description:"The file path where results should be written if --watch is specified. If not specified, results will be written to STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE",dependsOn:["watch"]}),version:e.Flags.string({description:"The API version to use for the bulk operation. If not specified, uses the latest stable version.",env:"SHOPIFY_FLAG_VERSION"})},h={query:e.Flags.string({char:"q",description:"The GraphQL query or mutation, as a string.",env:"SHOPIFY_FLAG_QUERY",required:!1,exactlyOne:["query","query-file"]}),"query-file":e.Flags.string({description:"Path to a file containing the GraphQL query or mutation. Can't be used with --query.",env:"SHOPIFY_FLAG_QUERY_FILE",parse:async i=>t(i),exactlyOne:["query","query-file"]}),variables:e.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES",exclusive:["variable-file"]}),"variable-file":e.Flags.string({description:"Path to a file containing GraphQL variables in JSON format. Can't be used with --variables.",env:"SHOPIFY_FLAG_VARIABLE_FILE",parse:async i=>t(i),exclusive:["variables"]}),store:e.Flags.string({char:"s",description:"The myshopify.com domain of the store to execute against. The app must be installed on the store. If not specified, you will be prompted to select a store.",env:"SHOPIFY_FLAG_STORE",parse:async i=>r(i)}),version:e.Flags.string({description:"The API version to use for the query or mutation. Defaults to the latest stable version.",env:"SHOPIFY_FLAG_VERSION"}),"output-file":e.Flags.string({description:"The file name where results should be written, instead of STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE"})};export{c as a,p as b,h as c};
1
+ import{u as r}from"./chunk-H4V55Y3Z.js";import{b as o}from"./chunk-YTUUU33R.js";import{e as t,p as n}from"./chunk-IWTNUJGY.js";import{e as s,g as a}from"./chunk-VKWPEFWQ.js";a();var e=s(o(),1);var c={path:e.Flags.string({description:"The path to your app directory.",parse:async i=>t(i),default:async()=>n(),noCacheDefault:!0,env:"SHOPIFY_FLAG_PATH"}),config:e.Flags.string({hidden:!1,char:"c",description:"The name of the app configuration.",env:"SHOPIFY_FLAG_APP_CONFIG"}),"client-id":e.Flags.string({hidden:!1,description:"The Client ID of your app.",env:"SHOPIFY_FLAG_CLIENT_ID",exclusive:["config"]}),reset:e.Flags.boolean({hidden:!1,description:"Reset all your settings.",env:"SHOPIFY_FLAG_RESET",default:!1,exclusive:["config"]})},p={query:e.Flags.string({char:"q",description:"The GraphQL query or mutation to run as a bulk operation.",env:"SHOPIFY_FLAG_QUERY",required:!1,exactlyOne:["query","query-file"]}),"query-file":e.Flags.string({description:"Path to a file containing the GraphQL query or mutation. Can't be used with --query.",env:"SHOPIFY_FLAG_QUERY_FILE",parse:async i=>t(i),exactlyOne:["query","query-file"]}),variables:e.Flags.string({char:"v",description:"The values for any GraphQL variables in your mutation, in JSON format. Can be specified multiple times.",env:"SHOPIFY_FLAG_VARIABLES",multiple:!0,exclusive:["variable-file"]}),"variable-file":e.Flags.string({description:"Path to a file containing GraphQL variables in JSONL format (one JSON object per line). Can't be used with --variables.",env:"SHOPIFY_FLAG_VARIABLE_FILE",parse:async i=>t(i),exclusive:["variables"]}),store:e.Flags.string({char:"s",description:"The store domain. Must be an existing dev store.",env:"SHOPIFY_FLAG_STORE",parse:async i=>r(i)}),watch:e.Flags.boolean({description:"Wait for bulk operation results before exiting. Defaults to false.",env:"SHOPIFY_FLAG_WATCH"}),"output-file":e.Flags.string({description:"The file path where results should be written if --watch is specified. If not specified, results will be written to STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE",dependsOn:["watch"]}),version:e.Flags.string({description:"The API version to use for the bulk operation. If not specified, uses the latest stable version.",env:"SHOPIFY_FLAG_VERSION"})},h={query:e.Flags.string({char:"q",description:"The GraphQL query or mutation, as a string.",env:"SHOPIFY_FLAG_QUERY",required:!1,exactlyOne:["query","query-file"]}),"query-file":e.Flags.string({description:"Path to a file containing the GraphQL query or mutation. Can't be used with --query.",env:"SHOPIFY_FLAG_QUERY_FILE",parse:async i=>t(i),exactlyOne:["query","query-file"]}),variables:e.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES",exclusive:["variable-file"]}),"variable-file":e.Flags.string({description:"Path to a file containing GraphQL variables in JSON format. Can't be used with --variables.",env:"SHOPIFY_FLAG_VARIABLE_FILE",parse:async i=>t(i),exclusive:["variables"]}),store:e.Flags.string({char:"s",description:"The myshopify.com domain of the store to execute against. The app must be installed on the store. If not specified, you will be prompted to select a store.",env:"SHOPIFY_FLAG_STORE",parse:async i=>r(i)}),version:e.Flags.string({description:"The API version to use for the query or mutation. Defaults to the latest stable version.",env:"SHOPIFY_FLAG_VERSION"}),"output-file":e.Flags.string({description:"The file name where results should be written, instead of STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE"})};export{c as a,p as b,h as c};