@shopify/cli 4.7.1 → 4.8.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 (324) hide show
  1. package/dist/analytics-3IIUBZ3B.js +1 -0
  2. package/dist/analytics-OOT5AB52.js +1 -0
  3. package/dist/assets/hydrogen/starter/AGENTS.md +5 -0
  4. package/dist/assets/hydrogen/starter/CHANGELOG.md +9 -0
  5. package/dist/assets/hydrogen/starter/CLAUDE.md +1 -0
  6. package/dist/assets/hydrogen/starter/package.json +3 -3
  7. package/dist/bootstrap.js +1 -1
  8. package/dist/{chunk-U3F6GPCE.js → chunk-2AK44UYM.js} +1 -1
  9. package/dist/{chunk-N7425436.js → chunk-2CIZE537.js} +1 -1
  10. package/dist/{chunk-7JIYJMRN.js → chunk-2EAFYCCS.js} +1 -1
  11. package/dist/{chunk-LBREJXT6.js → chunk-2KGPH7YG.js} +1 -1
  12. package/dist/{chunk-VPY47DBW.js → chunk-2O224ZPO.js} +1 -1
  13. package/dist/{chunk-3WV7DQMM.js → chunk-2XDUJQQN.js} +3 -3
  14. package/dist/{chunk-K3VLFPPI.js → chunk-36ROOKQB.js} +1 -1
  15. package/dist/{chunk-SGIMJQEM.js → chunk-3DCN3N23.js} +1 -1
  16. package/dist/{chunk-PK73ZSND.js → chunk-3JXPOOFV.js} +39 -39
  17. package/dist/{chunk-IENBHP2S.js → chunk-4QBJ5JBX.js} +15 -16
  18. package/dist/chunk-4ZNV5YSL.js +1 -0
  19. package/dist/chunk-5L63PRJL.js +2 -0
  20. package/dist/{chunk-HRHNJFAA.js → chunk-5N6HNQQ5.js} +1 -1
  21. package/dist/{chunk-K63FW7Q7.js → chunk-5SEEDOQ5.js} +1 -1
  22. package/dist/chunk-67Z34HN5.js +5 -0
  23. package/dist/chunk-6BDAJ6UD.js +5 -0
  24. package/dist/chunk-6CXG3XLP.js +1 -0
  25. package/dist/{chunk-OJSJWGP2.js → chunk-6MWWJZFN.js} +1 -1
  26. package/dist/{chunk-N4KDWHT2.js → chunk-6RQOEPEC.js} +1 -1
  27. package/dist/{chunk-CRP4PQU2.js → chunk-72ZY3KTF.js} +1 -1
  28. package/dist/{chunk-VXYABRFY.js → chunk-742XXXGL.js} +1 -1
  29. package/dist/{chunk-VXX4EZ7G.js → chunk-7HFHL5SO.js} +1 -1
  30. package/dist/{chunk-PV6T52KB.js → chunk-7ISJRIPT.js} +1 -1
  31. package/dist/{chunk-KBBITJSF.js → chunk-7LWUHQIF.js} +1 -1
  32. package/dist/{chunk-7EUIO4ZO.js → chunk-7T6M7FAC.js} +1 -1
  33. package/dist/{chunk-3HCWJRL6.js → chunk-A6BMJISP.js} +1 -1
  34. package/dist/{chunk-HOVIGRE4.js → chunk-AWUX36VG.js} +1 -1
  35. package/dist/chunk-BWJIZYAG.js +1 -0
  36. package/dist/{chunk-6R62DGJG.js → chunk-BZ73NV3L.js} +1 -1
  37. package/dist/chunk-C3RUVXG2.js +6 -0
  38. package/dist/{chunk-IA3XNJ56.js → chunk-C4YLE3NS.js} +1 -1
  39. package/dist/chunk-CEYIZC3M.js +2 -0
  40. package/dist/{chunk-J2VRPZFC.js → chunk-CIWKN4HF.js} +1 -1
  41. package/dist/{chunk-JJSV7HNM.js → chunk-CULTZLC4.js} +1 -1
  42. package/dist/{chunk-HCQABTQL.js → chunk-CX75OKZK.js} +1 -1
  43. package/dist/{chunk-22NROZ5X.js → chunk-DASVZTAX.js} +46 -46
  44. package/dist/{chunk-EULSSTWY.js → chunk-DX3JLOUA.js} +1 -1
  45. package/dist/{chunk-IQT6LOA2.js → chunk-E55KS3GZ.js} +1 -1
  46. package/dist/{chunk-CNMJ6QXM.js → chunk-E5FXOLQO.js} +1 -1
  47. package/dist/{chunk-46BKAF3F.js → chunk-E6N4PZZR.js} +1 -1
  48. package/dist/{chunk-27UEK3FU.js → chunk-EB574SY6.js} +1 -1
  49. package/dist/chunk-EX5GVHGE.js +1 -0
  50. package/dist/chunk-F3NYCSXT.js +273 -0
  51. package/dist/{chunk-KNVHXIEB.js → chunk-F6X6OXXB.js} +1 -1
  52. package/dist/{chunk-Y6UZW73M.js → chunk-FDBHQLFK.js} +1 -1
  53. package/dist/{chunk-Z66ZSXKB.js → chunk-FDYW3UQC.js} +1 -1
  54. package/dist/{chunk-GJ4A4QKE.js → chunk-FEDVVYK2.js} +1 -1
  55. package/dist/{chunk-SCXL5UQ4.js → chunk-FJ6F4XRV.js} +1 -1
  56. package/dist/{chunk-JNIPCLAF.js → chunk-FOREMLFZ.js} +1 -1
  57. package/dist/{chunk-R5EGWWZH.js → chunk-FUYDGK33.js} +1 -1
  58. package/dist/{chunk-UAJBQEGE.js → chunk-FX3L344E.js} +1 -1
  59. package/dist/{chunk-YCU7ZCIG.js → chunk-G5XIGN5D.js} +1 -1
  60. package/dist/{chunk-LKZQSER3.js → chunk-GAYKYEIM.js} +1 -1
  61. package/dist/{chunk-KT5MDCII.js → chunk-GCY7LPEF.js} +1 -1
  62. package/dist/{chunk-3KM2GKXH.js → chunk-GNBRCK7L.js} +1 -1
  63. package/dist/{chunk-WEWLPJK2.js → chunk-GRPKF5ZB.js} +1 -1
  64. package/dist/{chunk-UK4WXL4G.js → chunk-GRSF7456.js} +1 -1
  65. package/dist/chunk-H2TQ4ODI.js +1 -0
  66. package/dist/{chunk-O53YIDJL.js → chunk-H6XEESUN.js} +1 -1
  67. package/dist/{chunk-I6XH7XDX.js → chunk-HB347DXT.js} +1 -1
  68. package/dist/chunk-HFSCXTJQ.js +97 -0
  69. package/dist/chunk-HHN6KZXX.js +1 -0
  70. package/dist/{chunk-6QJIGFQJ.js → chunk-HP64ZTEJ.js} +1 -1
  71. package/dist/{chunk-YXDIHVPY.js → chunk-IARCMH7G.js} +1 -1
  72. package/dist/{chunk-X5JQU6T7.js → chunk-IBI5UCJO.js} +1 -1
  73. package/dist/{chunk-RXUOQZ32.js → chunk-IKUSLRGD.js} +1 -1
  74. package/dist/{chunk-DLSUDLXD.js → chunk-IT4HYLTY.js} +1 -1
  75. package/dist/{chunk-RY4MPX5A.js → chunk-J4T73EAS.js} +1 -1
  76. package/dist/chunk-JG4HH54Q.js +1 -0
  77. package/dist/{chunk-S2WUVD7V.js → chunk-JIYSCWCG.js} +1 -1
  78. package/dist/chunk-JWRK5KLD.js +560 -0
  79. package/dist/{chunk-OF6CV5R4.js → chunk-JX7FYWPO.js} +1 -1
  80. package/dist/{chunk-6ELAWKMY.js → chunk-K42WBNJQ.js} +1 -1
  81. package/dist/{chunk-NSZHEXZK.js → chunk-KDU7VW3L.js} +1 -1
  82. package/dist/{chunk-6G5TDB45.js → chunk-KWVOJWO7.js} +1 -1
  83. package/dist/{chunk-O4G6TE26.js → chunk-LANUJ7LX.js} +1 -1
  84. package/dist/{chunk-DMFEYI4G.js → chunk-LUKQ5HLC.js} +1 -1
  85. package/dist/{chunk-PS2UVFHP.js → chunk-M2XHIN57.js} +1 -1
  86. package/dist/{chunk-YFKEESYB.js → chunk-MNOQAXJW.js} +1 -1
  87. package/dist/chunk-MYQUYU4U.js +2 -0
  88. package/dist/{chunk-PU3NATV4.js → chunk-N65F7ET2.js} +1 -1
  89. package/dist/{chunk-DEMZRLX5.js → chunk-N6RBRPGW.js} +1 -1
  90. package/dist/chunk-N75VOJHO.js +15 -0
  91. package/dist/{chunk-ELSDVDT7.js → chunk-NBFMP5XQ.js} +1 -1
  92. package/dist/{chunk-SYF6LGQB.js → chunk-NE3ZFSMS.js} +1 -1
  93. package/dist/{chunk-IF6EYTHG.js → chunk-NGLMZYS7.js} +2 -2
  94. package/dist/{chunk-6K3AJTNO.js → chunk-NHAUJWEG.js} +1 -1
  95. package/dist/chunk-NILETICC.js +11 -0
  96. package/dist/{chunk-5MD7GNEY.js → chunk-NNZXKFOS.js} +1 -1
  97. package/dist/{chunk-EWS2RNM6.js → chunk-NQK2VCDA.js} +1 -1
  98. package/dist/{chunk-HU4GFVEN.js → chunk-NROVZETL.js} +1 -1
  99. package/dist/{chunk-2S3GOPRL.js → chunk-NW6NUGN7.js} +1 -1
  100. package/dist/{chunk-I2LNQKIJ.js → chunk-O7DZXO3O.js} +2 -2
  101. package/dist/{chunk-77AC3OJQ.js → chunk-OBYQSIYU.js} +1 -1
  102. package/dist/{chunk-RY4YUBG3.js → chunk-OEG3N5PG.js} +1 -1
  103. package/dist/{chunk-7S73765P.js → chunk-OGBZTY2G.js} +1 -1
  104. package/dist/chunk-OMHR423H.js +1 -0
  105. package/dist/{chunk-22NWEE5U.js → chunk-OV6SRRXR.js} +1 -1
  106. package/dist/{chunk-FELV7GWY.js → chunk-OVV5YGKN.js} +1 -1
  107. package/dist/{chunk-U46RPVQA.js → chunk-OZL5FTT7.js} +1 -1
  108. package/dist/{chunk-MTTBBZSR.js → chunk-OZMQ2EJB.js} +1 -1
  109. package/dist/{chunk-USBP7H7J.js → chunk-P57P7UAN.js} +1 -1
  110. package/dist/{chunk-WOIAYH5U.js → chunk-PATTG7YZ.js} +1 -1
  111. package/dist/{chunk-XMJFT4WP.js → chunk-PG5YNPJB.js} +1 -1
  112. package/dist/chunk-PP4L2JJ6.js +3 -0
  113. package/dist/{chunk-PEHLR7XP.js → chunk-Q5JX23QU.js} +1 -1
  114. package/dist/{chunk-4FI2YBRF.js → chunk-Q5KVMLBK.js} +1 -1
  115. package/dist/{chunk-LKQ3EJ6Z.js → chunk-Q5LIJGT7.js} +1 -1
  116. package/dist/{chunk-QASOHYDS.js → chunk-Q6ADIMJM.js} +1 -1
  117. package/dist/{chunk-4FCS6PJY.js → chunk-QERQARMC.js} +1 -1
  118. package/dist/{chunk-RM3B7AFT.js → chunk-QOV43E26.js} +1 -1
  119. package/dist/{chunk-SJGPJDGH.js → chunk-QTFUYKMF.js} +1 -1
  120. package/dist/{chunk-4WGJUVXS.js → chunk-QTJCCOAG.js} +3 -3
  121. package/dist/{chunk-4VJ6YK7U.js → chunk-R6ICQT2D.js} +1 -1
  122. package/dist/{chunk-KDBKEVCF.js → chunk-R7T3LYJL.js} +1 -1
  123. package/dist/{chunk-AIA7JVSJ.js → chunk-RXQJCJDV.js} +1 -1
  124. package/dist/{chunk-WXSDPMIZ.js → chunk-S2TLBBSS.js} +1 -1
  125. package/dist/{chunk-PQG7XSQP.js → chunk-S5FOQY35.js} +1 -1
  126. package/dist/{chunk-WR6LRE4I.js → chunk-SYLHT42O.js} +1 -1
  127. package/dist/{chunk-ULR25PTO.js → chunk-T4AA6TSF.js} +1 -1
  128. package/dist/{chunk-5WGT45CO.js → chunk-T4QWK5GG.js} +1 -1
  129. package/dist/{chunk-XMQFQUUK.js → chunk-T7PJDT5O.js} +1 -1
  130. package/dist/{chunk-UZVON6GP.js → chunk-TEY4LRY7.js} +1 -1
  131. package/dist/{chunk-ZBSC2KZ7.js → chunk-TFBRVLDN.js} +1 -1
  132. package/dist/{chunk-QHLY2IID.js → chunk-TUVDJ3PG.js} +1 -1
  133. package/dist/{chunk-JNVCCE6M.js → chunk-U2DWBZK2.js} +1 -1
  134. package/dist/chunk-U53OLUOE.js +3 -0
  135. package/dist/{chunk-AWHS336T.js → chunk-UAETNFN4.js} +1 -1
  136. package/dist/{chunk-XTXYS7LB.js → chunk-UAFEFKAQ.js} +1 -1
  137. package/dist/{chunk-3MN3WLA2.js → chunk-ULRJDKWQ.js} +1 -1
  138. package/dist/chunk-UZARYOLN.js +1 -0
  139. package/dist/chunk-VASGXHYA.js +1 -0
  140. package/dist/chunk-VD4XJ6BX.js +1 -0
  141. package/dist/{chunk-HQUWYKSJ.js → chunk-VFM2KQRM.js} +4 -4
  142. package/dist/{chunk-KRLEEYLL.js → chunk-VSDRNYA5.js} +1 -1
  143. package/dist/{chunk-PE4TV5IJ.js → chunk-VVZSYHDG.js} +1 -1
  144. package/dist/chunk-VXEYO3ZP.js +1 -0
  145. package/dist/{chunk-2F2DXTRI.js → chunk-VYDSOAV4.js} +1 -1
  146. package/dist/{chunk-ZULQKYJ6.js → chunk-WBYAGS6B.js} +1 -1
  147. package/dist/chunk-WGAFCKGD.js +1 -0
  148. package/dist/{chunk-CUUCRIGC.js → chunk-WYBTC356.js} +1 -1
  149. package/dist/{chunk-WMZS3Y4Z.js → chunk-XF2KTEID.js} +1 -1
  150. package/dist/{chunk-O4RHWBBM.js → chunk-XH5YGJQR.js} +1 -1
  151. package/dist/chunk-XHKWITLA.js +1705 -0
  152. package/dist/chunk-XOCB4KNX.js +2 -0
  153. package/dist/{chunk-R2RULBBV.js → chunk-XUUAKGEX.js} +1 -1
  154. package/dist/{chunk-JQUEW7CB.js → chunk-XUYVJEZG.js} +1 -1
  155. package/dist/chunk-Y47C3LSX.js +3 -0
  156. package/dist/{chunk-GW4JHUIA.js → chunk-Y5PRPHLQ.js} +1 -1
  157. package/dist/{chunk-WTES5ZXR.js → chunk-YD2VQEN5.js} +1 -1
  158. package/dist/{chunk-RA3WWB2S.js → chunk-YESGYUEL.js} +1 -1
  159. package/dist/{chunk-IX4IGE5H.js → chunk-YEVGLC5X.js} +1 -1
  160. package/dist/{chunk-WSCSFFLH.js → chunk-YFINLODF.js} +2 -2
  161. package/dist/{chunk-5JW4JQWZ.js → chunk-YKL3BLWC.js} +1 -1
  162. package/dist/{chunk-ZDDLEFVO.js → chunk-YLXPYXQP.js} +1 -1
  163. package/dist/{chunk-EMETQFFJ.js → chunk-YNDIZCD2.js} +1 -1
  164. package/dist/{chunk-53IU36CL.js → chunk-YPWHD3NL.js} +1 -1
  165. package/dist/{chunk-UZV5H2JI.js → chunk-YSAFHVV6.js} +1 -1
  166. package/dist/{chunk-AFT6ABDE.js → chunk-YZMY2CTU.js} +1 -1
  167. package/dist/{chunk-VRH3HWYA.js → chunk-Z4AFEO36.js} +1 -1
  168. package/dist/{chunk-P5OQUFH6.js → chunk-Z5WPP6ME.js} +1 -1
  169. package/dist/chunk-Z65E4UAP.js +1 -0
  170. package/dist/{chunk-MK7MOLLI.js → chunk-ZDRIQC7O.js} +1 -1
  171. package/dist/{chunk-26DH5P7S.js → chunk-ZH44BDUR.js} +1 -1
  172. package/dist/{chunk-QT367CYF.js → chunk-ZL5LU4U2.js} +1 -1
  173. package/dist/{chunk-P5WLH64A.js → chunk-ZYX7UHCQ.js} +1 -1
  174. package/dist/{chunk-GFWXVO72.js → chunk-ZZRFG6ME.js} +114 -114
  175. package/dist/cli/commands/app/app-logs/sources.js +1 -1
  176. package/dist/cli/commands/app/build.js +1 -1
  177. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  178. package/dist/cli/commands/app/bulk/execute.js +1 -1
  179. package/dist/cli/commands/app/bulk/status.js +1 -1
  180. package/dist/cli/commands/app/config/link.js +1 -1
  181. package/dist/cli/commands/app/config/pull.js +1 -1
  182. package/dist/cli/commands/app/config/use.js +1 -1
  183. package/dist/cli/commands/app/config/validate.js +1 -1
  184. package/dist/cli/commands/app/demo/watcher.js +1 -1
  185. package/dist/cli/commands/app/deploy.js +1 -1
  186. package/dist/cli/commands/app/dev/clean.js +1 -1
  187. package/dist/cli/commands/app/dev.js +1 -1
  188. package/dist/cli/commands/app/doctor/instructions.js +1 -0
  189. package/dist/cli/commands/app/doctor.js +1 -0
  190. package/dist/cli/commands/app/env/pull.js +1 -1
  191. package/dist/cli/commands/app/env/show.js +1 -1
  192. package/dist/cli/commands/app/execute.js +1 -1
  193. package/dist/cli/commands/app/function/build.js +1 -1
  194. package/dist/cli/commands/app/function/info.js +1 -1
  195. package/dist/cli/commands/app/function/replay.js +1 -1
  196. package/dist/cli/commands/app/function/run.js +1 -1
  197. package/dist/cli/commands/app/function/schema.js +1 -1
  198. package/dist/cli/commands/app/function/typegen.js +1 -1
  199. package/dist/cli/commands/app/generate/extension.js +1 -1
  200. package/dist/cli/commands/app/graphiql.js +1 -1
  201. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  202. package/dist/cli/commands/app/import-extensions.js +1 -1
  203. package/dist/cli/commands/app/info.js +1 -1
  204. package/dist/cli/commands/app/init.js +1 -1
  205. package/dist/cli/commands/app/logs.js +1 -1
  206. package/dist/cli/commands/app/release.js +1 -1
  207. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -0
  208. package/dist/cli/commands/app/subscription-migrations/list.js +1 -0
  209. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -0
  210. package/dist/cli/commands/app/subscription-migrations/status.js +1 -0
  211. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -0
  212. package/dist/cli/commands/app/versions/list.js +1 -1
  213. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  214. package/dist/cli/commands/auth/login.js +1 -1
  215. package/dist/cli/commands/auth/logout.js +1 -1
  216. package/dist/cli/commands/cache/clear.js +1 -1
  217. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  218. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  219. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  220. package/dist/cli/commands/debug/command-flags.js +1 -1
  221. package/dist/cli/commands/doc/fetch.js +1 -1
  222. package/dist/cli/commands/doc/search.js +1 -1
  223. package/dist/cli/commands/docs/generate.js +1 -1
  224. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  225. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  226. package/dist/cli/commands/help.js +1 -1
  227. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  228. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  229. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  230. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  231. package/dist/cli/commands/notifications/generate.js +1 -1
  232. package/dist/cli/commands/notifications/list.js +1 -1
  233. package/dist/cli/commands/organization/list.js +1 -1
  234. package/dist/cli/commands/search.js +1 -1
  235. package/dist/cli/commands/send-analytics.js +1 -1
  236. package/dist/cli/commands/theme/check.js +1 -1
  237. package/dist/cli/commands/theme/console.js +1 -1
  238. package/dist/cli/commands/theme/delete.js +1 -1
  239. package/dist/cli/commands/theme/dev.js +1 -1
  240. package/dist/cli/commands/theme/duplicate.js +1 -1
  241. package/dist/cli/commands/theme/info.js +1 -1
  242. package/dist/cli/commands/theme/init.js +1 -1
  243. package/dist/cli/commands/theme/language-server.js +1 -1
  244. package/dist/cli/commands/theme/list.js +1 -1
  245. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  246. package/dist/cli/commands/theme/open.js +1 -1
  247. package/dist/cli/commands/theme/package.js +1 -1
  248. package/dist/cli/commands/theme/preview.js +1 -1
  249. package/dist/cli/commands/theme/profile.js +1 -1
  250. package/dist/cli/commands/theme/publish.js +1 -1
  251. package/dist/cli/commands/theme/pull.js +1 -1
  252. package/dist/cli/commands/theme/push.js +1 -1
  253. package/dist/cli/commands/theme/rename.js +1 -1
  254. package/dist/cli/commands/theme/share.js +1 -1
  255. package/dist/cli/commands/upgrade.js +1 -1
  256. package/dist/cli/commands/version.js +1 -1
  257. package/dist/command-registry.js +1 -1
  258. package/dist/{conf-store-QQ4DOFI3.js → conf-store-ASDCTDQ4.js} +1 -1
  259. package/dist/configs/all.yml +60 -0
  260. package/dist/configs/recommended.yml +60 -0
  261. package/dist/data/filters.json +31 -2
  262. package/dist/data/setting.json +129 -4
  263. package/dist/data/shopify_system_translations.json +154 -13
  264. package/dist/{deprecations-43ZQ5RCE.js → deprecations-VBQV7Q4O.js} +1 -1
  265. package/dist/dist-FZLOAKU7.js +1 -0
  266. package/dist/dist-HTY6UHG5.js +1 -0
  267. package/dist/environments-HSTNEQRG.js +1 -0
  268. package/dist/{error-26WTDNKZ.js → error-2LZYKRMA.js} +1 -1
  269. package/dist/error-handler-PIGEJ7BT.js +1 -0
  270. package/dist/{fs-Y7I3Y5IR.js → fs-BJHNJDDK.js} +1 -1
  271. package/dist/hooks/did-you-mean.js +1 -1
  272. package/dist/hooks/hydrogen-init.js +1 -1
  273. package/dist/hooks/postrun.js +1 -1
  274. package/dist/hooks/prerun.js +1 -1
  275. package/dist/hooks/public-metadata.js +1 -1
  276. package/dist/hooks/sensitive-metadata.js +1 -1
  277. package/dist/hooks/tunnel-provider.js +1 -1
  278. package/dist/hooks/tunnel-start.js +1 -1
  279. package/dist/index.js +14 -16
  280. package/dist/{is-global-WBIBPIVZ.js → is-global-6SCOAJVG.js} +1 -1
  281. package/dist/{local-HF4T3FFE.js → local-PZWPRFU7.js} +1 -1
  282. package/dist/{metadata-CSQPNQP2.js → metadata-VVBHB3HL.js} +1 -1
  283. package/dist/{node-package-manager-CVEU22N7.js → node-package-manager-ETYQN7OM.js} +1 -1
  284. package/dist/notifications-system-652OG5KL.js +1 -0
  285. package/dist/os-7D6NT4O3.js +1 -0
  286. package/dist/{output-E6OGPGXL.js → output-74VDGYJD.js} +1 -1
  287. package/dist/{prettier-RVUAAWC7.js → prettier-EGVCP5CY.js} +1 -1
  288. package/dist/{system-ZETSJRKS.js → system-P5QIJALL.js} +1 -1
  289. package/dist/tsconfig.tsbuildinfo +1 -1
  290. package/dist/{ui-7TVGGEWJ.js → ui-H5I5YVKV.js} +1 -1
  291. package/dist/upgrade-34HSYBXI.js +1 -0
  292. package/dist/version-EKXEAF6Q.js +1 -0
  293. package/dist/{version-DL4Y6DRX.js → version-J2PYO6M5.js} +1 -1
  294. package/dist/{workerd-EHI5ZCEV.js → workerd-X4TGHEG3.js} +1 -1
  295. package/oclif.manifest.json +903 -133
  296. package/package.json +9 -8
  297. package/dist/analytics-5SII3GTA.js +0 -1
  298. package/dist/analytics-F56E2NGH.js +0 -1
  299. package/dist/chunk-4I7TUB3K.js +0 -1
  300. package/dist/chunk-4NXLDIW5.js +0 -1
  301. package/dist/chunk-5QZHJCZM.js +0 -1
  302. package/dist/chunk-6AV6GX5W.js +0 -2
  303. package/dist/chunk-6SM4RY3I.js +0 -5
  304. package/dist/chunk-76NEIDP5.js +0 -1
  305. package/dist/chunk-BI7LE6CZ.js +0 -1
  306. package/dist/chunk-ESPT6CGE.js +0 -1
  307. package/dist/chunk-FAXNGDWI.js +0 -11
  308. package/dist/chunk-FQQXU5IN.js +0 -2
  309. package/dist/chunk-GXOFJIKQ.js +0 -559
  310. package/dist/chunk-M5Q74UZM.js +0 -3
  311. package/dist/chunk-OQWMCJLY.js +0 -3
  312. package/dist/chunk-SPE2D366.js +0 -16
  313. package/dist/chunk-TP4Z5OZT.js +0 -1382
  314. package/dist/chunk-VI5FF6SW.js +0 -1
  315. package/dist/dist-E7EGYE4D.js +0 -1
  316. package/dist/dist-WRUROUNV.js +0 -1
  317. package/dist/environments-RG64VB5R.js +0 -1
  318. package/dist/error-handler-XFH47Y75.js +0 -1
  319. package/dist/notifications-system-L3FMN6EX.js +0 -1
  320. package/dist/os-VLZLRAHR.js +0 -1
  321. package/dist/upgrade-F77O4ZDT.js +0 -1
  322. package/dist/version-3L3ANUTL.js +0 -1
  323. /package/dist/{chunk-NJPL5BTN.js → chunk-YLQ3LNNY.js} +0 -0
  324. /package/dist/{morph-77RHJICZ.js → morph-BMYYMQNX.js} +0 -0
@@ -1,10 +1,10 @@
1
- import{a as Mt}from"./chunk-UOHNRH6E.js";import{a as Cr}from"./chunk-USBP7H7J.js";import{a as xr}from"./chunk-HRHNJFAA.js";import{a as Er}from"./chunk-DEMZRLX5.js";import{a as Rr}from"./chunk-HCQABTQL.js";import{a as br}from"./chunk-YFKEESYB.js";import{a as Sr}from"./chunk-EMETQFFJ.js";import{b as Tr}from"./chunk-JQUEW7CB.js";import{a as Ar}from"./chunk-SCXL5UQ4.js";import{a as _r}from"./chunk-6QJIGFQJ.js";import{a as pr}from"./chunk-46BKAF3F.js";import{a as dr}from"./chunk-XMJFT4WP.js";import{a as mr}from"./chunk-QT367CYF.js";import{a as fr}from"./chunk-WTES5ZXR.js";import{a as hr}from"./chunk-RY4MPX5A.js";import{a as gr}from"./chunk-GXOFJIKQ.js";import{a as wr,b as yr,c as Pr,d as vr}from"./chunk-DMFEYI4G.js";import{a as Ur}from"./chunk-KDBKEVCF.js";import{g as ur}from"./chunk-7EUIO4ZO.js";import{a as lo,b as po,c as uo,d as mo}from"./chunk-PQG7XSQP.js";import{a as ar}from"./chunk-OJSJWGP2.js";import{a as lr}from"./chunk-RY4YUBG3.js";import{a as Xe}from"./chunk-EWS2RNM6.js";import{a as cr}from"./chunk-ELSDVDT7.js";import{c as Je,m as Ze}from"./chunk-5JW4JQWZ.js";import{b as ir,g as _e,j as Qe}from"./chunk-K63FW7Q7.js";import{a as nr,b as sr,c as ao,d as io,e as rt,f as co,g as fo}from"./chunk-YCU7ZCIG.js";import{a as $,b as Ve}from"./chunk-MTTBBZSR.js";import{a as Xt,b as Zt,d as Te,f as er,m as Ae,n as H,s as q,u as tr,v as rr,w as or}from"./chunk-Q7BOSHWX.js";import{c as kr}from"./chunk-CUUCRIGC.js";import{a as Jt}from"./chunk-I2LNQKIJ.js";import{a as Zr,b as tt,c as ee,d as eo}from"./chunk-XMQFQUUK.js";import{a as ho,f as go,g as wo,h as ot,i as yo,j as Po,k as vo,l as xo,m as Eo,n as bo,o as So,p as Uo,q as Ro,v as To,x as Ao,z as nt}from"./chunk-YXDIHVPY.js";import{a as to,b as ro,c as oo,d as no,e as so}from"./chunk-HOVIGRE4.js";import{a as Lr}from"./chunk-ZBSC2KZ7.js";import{a as Xr}from"./chunk-4I7TUB3K.js";import{a as Jr}from"./chunk-ESPT6CGE.js";import{a as Ir}from"./chunk-RA3WWB2S.js";import{B as Br,D as Kr,F as Z,M as jr,N as Yr,X as Vr,i as $r,j as W,k as Mr,m as Fr,ma as ke,na as Ie,p as et,q as Or,r as Nr,s as qr,sa as Qr,t as Wr,u as Hr,v as Gr}from"./chunk-GFWXVO72.js";import{X as zr,e as Ce,j as ie,p as Dr}from"./chunk-SPE2D366.js";import{c as Vt}from"./chunk-IENBHP2S.js";import{a as K}from"./chunk-HU4GFVEN.js";import{b as Qt,e as Re}from"./chunk-IX4IGE5H.js";import{C as ye,R as kt,a as Ke,ba as J,c as bt,da as It,e as St,g as Ut,k as Rt,o as Tt,q as At,t as _t,va as Lt,w as Ct,x as we}from"./chunk-PK73ZSND.js";import{A as se,H as be,L as Bt,N as Se,S as Ue,T as ae,U as Ye,V as Kt,X as jt,a as Et,d as Pe,e as k,f as L,h as ve,i as xe,j as Dt,k as Ft,l as Ot,m as Nt,n as qt,o as D,p as Wt,q as je,r as ze,s as Ht,t as Gt,y as Ee}from"./chunk-WSCSFFLH.js";import{a as Cn}from"./chunk-7UNQOKZW.js";import{d as $t}from"./chunk-6K3AJTNO.js";import{h as T,k as X}from"./chunk-BI7LE6CZ.js";import{a as _n}from"./chunk-CTNBSUVU.js";import{a as _o}from"./chunk-JNIPCLAF.js";import{$a as vt,Ab as g,Bb as C,Ea as Pt,Na as he,P as Be,Ta as F,Wa as ge,cb as xt,ma as I,qb as v,sb as b,ua as me,wa as fe,xb as B}from"./chunk-HQUWYKSJ.js";import{d as zt,f as Yt}from"./chunk-4VJ6YK7U.js";import{a as ft}from"./chunk-JD5P5RAJ.js";import{d as S,f as Ge,g as ht,i as ue,j as gt,k as de,o as wt,p as yt}from"./chunk-773TIA5M.js";import{e as Q,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var kn=300*1e3,In='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 Co(t,e,r=Date.now()){for(;await Ln(t,e,r););}async function Ln(t,e,r){let o=await _e(t,e);if(!o||$n(o,r))throw new T(In);return await ae(3),o.processing}function $n(t,e){return t.processing&&Date.now()-e>=kn}var Mn="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",Dn="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",st=3,Le=class extends cr{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=wr(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){yr(this.adminSession.storeFqdn,e)}removeTheme(){Pr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:ir,name:this.generateThemeName(this.context),src:Mn};for(let o=0;o<st;o++){g(`Attempt ${o}/${st}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await Qe(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),g(`Waiting for theme with id "${n.id}" to be processed`),await Co(n.id,this.adminSession),n;throw new Error}catch{g(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}g(`Theme creation failed after ${st} retries. Creating theme using fallback theme zip`);let r=await Qe({...e,src:Dn},this.adminSession);if(!r)throw g("Theme creation failed. Exiting process."),new X(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var Fn={"theme:init":hr,"theme:check":ar,"theme:console":lr,"theme:delete":pr,"theme:dev":dr,"theme:duplicate":mr,"theme:info":fr,"theme:language-server":gr,"theme:list":vr,"theme:metafields:pull":Ur,"theme:open":xr,"theme:package":Er,"theme:profile":br,"theme:publish":Sr,"theme:preview":Rr,"theme:pull":Tr,"theme:push":Ar,"theme:rename":_r,"theme:share":Cr},ka=Fn;async function ko(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(U=>U.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[c,d]=await Promise.all([kt(t.storeFqdn),qn(e)]),l=c.storeFqdn,[u,h]=await Promise.all([Ze(c),Je(c)]),w=h?await Xe(t.storePassword,l,u):void 0,m=await Nn(c,t.theme),f=m.id.toString();return Ee({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:d}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${l}/admin/themes/${f}/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:On,options:{theme:m,adminSession:c,storefrontPassword:w,crawlerSignatureHeaders:u,themeExtensionDirectory:a,themeExtensionPort:i}}}var On=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await ur(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function Nn(t,e){let r;if(e)g(`Fetching theme with provided id ${e}`),r=await _e(parseInt(e,10),t);else{let o=new Le(t,{devPreview:!0});await be([{title:"Configuring host theme for theme app extension",task:async()=>{g("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 qn(t){return t.developerPlatformClient?.clientName===zr.AppManagement?`https://${await we()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Ct()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function Wn(t){let e=S(t.directory,"locales");return ge([S(e,"*.json")])}async function Io(t,e){let r=await Wn(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 s=>{let[a,...i]=s.split("/").pop().split(".");if(a)return i[0]==="default"&&(o.defaultLocale=a),Hn(a,s,o,t,e)})),o.lastUpdated=Date.now(),g(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function Hn(t,e,r,o,n){let s;try{s=await I(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw C(i,n.stderr),new Error(i)}}p();function $e(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 at=".js.map";async function te(t,e,r,o){return D({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await Io(t,r),c=await Mr(t),d=t.outputRelativePath?ue(n):n,l=await Gn(t,s,d,o),u=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(u=t.configuration.metafields),{assets:{main:ce(l)&&l[0]?.assets?.main?l[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await he(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:$e(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:l,localization:a??null,metafields:u,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:c?.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 Gn(t,e,r,o){let n=t.configuration,s=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(s=[{target:"purchase.post.render"}]),ce(s)){let a=await Bn(r);return Promise.all(s.map(async i=>{let{target:c,resource:d}=i,l={...i,surface:Ie(c),root:{url:`${e}/${c}`},resource:d||{url:""}},u=a?.[c];if(!u)return l;let w=await Qn(u,{target:c,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...l,...w}}))}return s}async function Bn(t){try{let e=S(t,"manifest.json"),r=await I(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 Kn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,c=e[s];if(typeof c=="string"){let w=await Me(s,i,typeof a=="string"?a:c,r,o,n,typeof a=="string"?c:void 0);return{assets:{[w.name]:w}}}let l=e.build_manifest?.assets?.[s];if(l?.filepath){let u=await Me(s,i,l.filepath,r,o,n,l.module);return{assets:{[u.name]:u}}}return{}}async function jn({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await he(S(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function zn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,c)=>{let d=i.schema,l=s[c]?.schema,u=typeof l=="string"?l:d,h=typeof l=="string"?d:void 0;return{...i,schema:await Me("schema",`${t}/intents/${c}/schema`,u,r,o,n,h)}}))}:{}}async function Yn({target:t,url:e,extension:r,resolver:o},n,s){let a=await Me(n,`${t}/${n}`,s,e,r,o);return await Vn(t,s,r,o),{assets:{[a.name]:a}}}async function Vn(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(at)&&await F(S(r.directory,n))&&o.set(`${t}/${gt(n)}`,n)}async function Qn(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return Jn(o,n)?zn(e,n):Xn(o,n)?Yn(e,o,n):Zn(o,n)?jn(e,o,n):Kn(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function ce(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Me(t,e,r,o,n,s,a){let i=`${e}${de(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await he(S(n.directory,a??r))??0}}function Jn(t,e){return t==="intents"&&Array.isArray(e)}function Xn(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function Zn(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as es}from"events";var le;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(le||(le={}));async function Lo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:ao(t.storeFqdn,t.apiKey),mobileUrl:co(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=>te(n,e,t,r&&it(r,n.devUUID))))}}function it(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var De=class extends es{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=J(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(ce(n.extensionPoints)&&ce(o.extensionPoints)){let s=n.extensionPoints.reduce((c,d)=>({...c,[d.target]:d}),{});o.extensionPoints=J(o.extensionPoints,n.extensionPoints,c=>c.map(d=>{let l=s[d.target];return l?J(d,l,(u,h)=>h):d}));let{extensionPoints:a,...i}=n;return J(o,i)}return J(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){g(b`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await te(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},it(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,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 te(e,r,this.options,it(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(le.Update,e)}};p();p();var j;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(j||(j={}));function $o(t,e){return(r,o,n)=>{r.url==="/extensions"&&(g("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,ts(t,e)))}}function ts(t,e){return r=>{g("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};g(b`Sending connected payload: ${v.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",as(t,e))}}function rs(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?v.json(o).output():String(o)).join(" ");return b`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var os={debug:t=>v.gray(t),warn:t=>v.yellow(t),error:t=>v.errorText(t)};function ns({type:t,message:e}){let r=rs(e);switch(t){case"debug":case"warn":case"error":return b`${os[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function ss(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(ns(t))})}function as(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(g(b`Received websocket message with event type ${n} and data:
1
+ import{a as Mt}from"./chunk-UOHNRH6E.js";import{a as Er}from"./chunk-N6RBRPGW.js";import{a as Rr}from"./chunk-CX75OKZK.js";import{a as br}from"./chunk-MNOQAXJW.js";import{a as Sr}from"./chunk-YNDIZCD2.js";import{b as Tr}from"./chunk-XUYVJEZG.js";import{a as Ar}from"./chunk-FJ6F4XRV.js";import{a as _r}from"./chunk-HP64ZTEJ.js";import{a as Cr}from"./chunk-P57P7UAN.js";import{a as dr}from"./chunk-PG5YNPJB.js";import{a as mr}from"./chunk-ZL5LU4U2.js";import{a as fr}from"./chunk-YD2VQEN5.js";import{a as hr}from"./chunk-J4T73EAS.js";import{a as gr}from"./chunk-JWRK5KLD.js";import{a as wr,b as yr,c as Pr,d as vr}from"./chunk-LUKQ5HLC.js";import{a as Ur}from"./chunk-R7T3LYJL.js";import{g as ur}from"./chunk-7T6M7FAC.js";import{a as xr}from"./chunk-5N6HNQQ5.js";import{a as lo,b as po,c as uo,d as mo}from"./chunk-S5FOQY35.js";import{a as ar}from"./chunk-6MWWJZFN.js";import{a as lr}from"./chunk-OEG3N5PG.js";import{a as Xe}from"./chunk-NQK2VCDA.js";import{c as Je,m as Ze}from"./chunk-YKL3BLWC.js";import{a as pr}from"./chunk-E6N4PZZR.js";import{a as cr}from"./chunk-NBFMP5XQ.js";import{b as ir,g as _e,j as Qe}from"./chunk-5SEEDOQ5.js";import{c as kr}from"./chunk-WYBTC356.js";import{a as nr,b as sr,c as ao,d as io,e as rt,f as co,g as fo}from"./chunk-G5XIGN5D.js";import{a as $,b as Ve}from"./chunk-OZMQ2EJB.js";import{a as Xt,b as Zt,d as Te,f as er,m as Ae,n as H,s as q,u as tr,v as rr,w as or}from"./chunk-Q7BOSHWX.js";import{a as Jt}from"./chunk-O7DZXO3O.js";import{a as Zr,b as tt,c as ee,d as eo}from"./chunk-T7PJDT5O.js";import{a as ho,f as go,g as wo,h as ot,i as yo,j as Po,k as vo,l as xo,m as Eo,n as bo,o as So,p as Uo,q as Ro,v as To,x as Ao,z as nt}from"./chunk-IARCMH7G.js";import{a as to,b as ro,c as oo,d as no,e as so}from"./chunk-AWUX36VG.js";import{a as Lr}from"./chunk-TFBRVLDN.js";import{a as Xr}from"./chunk-EX5GVHGE.js";import{a as Jr}from"./chunk-UZARYOLN.js";import{a as Ir}from"./chunk-YESGYUEL.js";import{$ as Vr,B as Br,D as Kr,F as Z,P as jr,Q as Yr,i as $r,j as W,k as Mr,m as Fr,p as et,q as Or,qa as ke,r as Nr,ra as Ie,s as qr,t as Wr,u as Hr,v as Gr,wa as Qr}from"./chunk-ZZRFG6ME.js";import{y as zr}from"./chunk-N75VOJHO.js";import{c as Vt}from"./chunk-CEYIZC3M.js";import{a as Ce,f as ie,m as Dr}from"./chunk-XOCB4KNX.js";import{a as K}from"./chunk-NROVZETL.js";import{b as Qt,e as Re}from"./chunk-YEVGLC5X.js";import{D as ye,S as kt,b as Ke,ca as J,d as bt,ea as It,f as St,h as Ut,l as Rt,p as Tt,r as At,u as _t,wa as Lt,x as Ct,y as we}from"./chunk-3JXPOOFV.js";import{A as se,H as be,L as Bt,N as Se,S as Ue,T as ae,U as Ye,V as Kt,X as jt,a as Et,d as Pe,e as k,f as L,h as ve,i as xe,j as Dt,k as Ft,l as Ot,m as Nt,n as qt,o as D,p as Wt,q as je,r as ze,s as Ht,t as Gt,y as Ee}from"./chunk-YFINLODF.js";import{a as Cn}from"./chunk-7UNQOKZW.js";import{d as $t}from"./chunk-NHAUJWEG.js";import{h as T,k as X}from"./chunk-BWJIZYAG.js";import{a as _n}from"./chunk-CTNBSUVU.js";import{a as _o}from"./chunk-FOREMLFZ.js";import{$a as vt,Ab as g,Bb as C,Ea as Pt,Na as he,P as Be,Ta as F,Wa as ge,cb as xt,ma as I,qb as v,sb as b,ua as me,wa as fe,xb as B}from"./chunk-VFM2KQRM.js";import{d as zt,f as Yt}from"./chunk-R6ICQT2D.js";import{a as ft}from"./chunk-JD5P5RAJ.js";import{d as S,f as Ge,g as ht,i as ue,j as gt,k as de,o as wt,p as yt}from"./chunk-773TIA5M.js";import{e as Q,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var kn=300*1e3,In='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 Co(t,e,r=Date.now()){for(;await Ln(t,e,r););}async function Ln(t,e,r){let o=await _e(t,e);if(!o||$n(o,r))throw new T(In);return await ae(3),o.processing}function $n(t,e){return t.processing&&Date.now()-e>=kn}var Mn="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",Dn="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",st=3,Le=class extends cr{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=wr(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){yr(this.adminSession.storeFqdn,e)}removeTheme(){Pr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:ir,name:this.generateThemeName(this.context),src:Mn};for(let o=0;o<st;o++){g(`Attempt ${o}/${st}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await Qe(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),g(`Waiting for theme with id "${n.id}" to be processed`),await Co(n.id,this.adminSession),n;throw new Error}catch{g(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}g(`Theme creation failed after ${st} retries. Creating theme using fallback theme zip`);let r=await Qe({...e,src:Dn},this.adminSession);if(!r)throw g("Theme creation failed. Exiting process."),new X(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var Fn={"theme:init":hr,"theme:check":ar,"theme:console":lr,"theme:delete":pr,"theme:dev":dr,"theme:duplicate":mr,"theme:info":fr,"theme:language-server":gr,"theme:list":vr,"theme:metafields:pull":Ur,"theme:open":xr,"theme:package":Er,"theme:profile":br,"theme:publish":Sr,"theme:preview":Rr,"theme:pull":Tr,"theme:push":Ar,"theme:rename":_r,"theme:share":Cr},ka=Fn;async function ko(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(U=>U.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[c,d]=await Promise.all([kt(t.storeFqdn),qn(e)]),l=c.storeFqdn,[u,h]=await Promise.all([Ze(c),Je(c)]),w=h?await Xe(t.storePassword,l,u):void 0,m=await Nn(c,t.theme),f=m.id.toString();return Ee({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:d}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${l}/admin/themes/${f}/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:On,options:{theme:m,adminSession:c,storefrontPassword:w,crawlerSignatureHeaders:u,themeExtensionDirectory:a,themeExtensionPort:i}}}var On=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await ur(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function Nn(t,e){let r;if(e)g(`Fetching theme with provided id ${e}`),r=await _e(parseInt(e,10),t);else{let o=new Le(t,{devPreview:!0});await be([{title:"Configuring host theme for theme app extension",task:async()=>{g("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 qn(t){return t.developerPlatformClient?.clientName===zr.AppManagement?`https://${await we()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Ct()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function Wn(t){let e=S(t.directory,"locales");return ge([S(e,"*.json")])}async function Io(t,e){let r=await Wn(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 s=>{let[a,...i]=s.split("/").pop().split(".");if(a)return i[0]==="default"&&(o.defaultLocale=a),Hn(a,s,o,t,e)})),o.lastUpdated=Date.now(),g(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function Hn(t,e,r,o,n){let s;try{s=await I(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw C(i,n.stderr),new Error(i)}}p();function $e(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 at=".js.map";async function te(t,e,r,o){return D({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await Io(t,r),c=await Mr(t),d=t.outputRelativePath?ue(n):n,l=await Gn(t,s,d,o),u=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(u=t.configuration.metafields),{assets:{main:ce(l)&&l[0]?.assets?.main?l[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await he(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:$e(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:l,localization:a??null,metafields:u,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:c?.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 Gn(t,e,r,o){let n=t.configuration,s=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(s=[{target:"purchase.post.render"}]),ce(s)){let a=await Bn(r);return Promise.all(s.map(async i=>{let{target:c,resource:d}=i,l={...i,surface:Ie(c),root:{url:`${e}/${c}`},resource:d||{url:""}},u=a?.[c];if(!u)return l;let w=await Qn(u,{target:c,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...l,...w}}))}return s}async function Bn(t){try{let e=S(t,"manifest.json"),r=await I(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 Kn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,c=e[s];if(typeof c=="string"){let w=await Me(s,i,typeof a=="string"?a:c,r,o,n,typeof a=="string"?c:void 0);return{assets:{[w.name]:w}}}let l=e.build_manifest?.assets?.[s];if(l?.filepath){let u=await Me(s,i,l.filepath,r,o,n,l.module);return{assets:{[u.name]:u}}}return{}}async function jn({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await he(S(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function zn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,c)=>{let d=i.schema,l=s[c]?.schema,u=typeof l=="string"?l:d,h=typeof l=="string"?d:void 0;return{...i,schema:await Me("schema",`${t}/intents/${c}/schema`,u,r,o,n,h)}}))}:{}}async function Yn({target:t,url:e,extension:r,resolver:o},n,s){let a=await Me(n,`${t}/${n}`,s,e,r,o);return await Vn(t,s,r,o),{assets:{[a.name]:a}}}async function Vn(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(at)&&await F(S(r.directory,n))&&o.set(`${t}/${gt(n)}`,n)}async function Qn(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return Jn(o,n)?zn(e,n):Xn(o,n)?Yn(e,o,n):Zn(o,n)?jn(e,o,n):Kn(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function ce(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Me(t,e,r,o,n,s,a){let i=`${e}${de(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await he(S(n.directory,a??r))??0}}function Jn(t,e){return t==="intents"&&Array.isArray(e)}function Xn(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function Zn(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as es}from"events";var le;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(le||(le={}));async function Lo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:ao(t.storeFqdn,t.apiKey),mobileUrl:co(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=>te(n,e,t,r&&it(r,n.devUUID))))}}function it(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var De=class extends es{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=J(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(ce(n.extensionPoints)&&ce(o.extensionPoints)){let s=n.extensionPoints.reduce((c,d)=>({...c,[d.target]:d}),{});o.extensionPoints=J(o.extensionPoints,n.extensionPoints,c=>c.map(d=>{let l=s[d.target];return l?J(d,l,(u,h)=>h):d}));let{extensionPoints:a,...i}=n;return J(o,i)}return J(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){g(b`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await te(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},it(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,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 te(e,r,this.options,it(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(le.Update,e)}};p();p();var j;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(j||(j={}));function $o(t,e){return(r,o,n)=>{r.url==="/extensions"&&(g("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,ts(t,e)))}}function ts(t,e){return r=>{g("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};g(b`Sending connected payload: ${v.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",as(t,e))}}function rs(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?v.json(o).output():String(o)).join(" ");return b`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var os={debug:t=>v.gray(t),warn:t=>v.yellow(t),error:t=>v.errorText(t)};function ns({type:t,message:e}){let r=rs(e);switch(t){case"debug":case"warn":case"error":return b`${os[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function ss(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(ns(t))})}function as(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(g(b`Received websocket message with event type ${n} and data:
2
2
  ${v.json(s)}
3
3
  `,e.stdout),n===j.Update){let a=e.payloadStore.getRawPayload().app.apiKey,i=s.app?.apiKey;if(s.app){if(a!==i)return;e.payloadStore.updateApp(s.app)}s.extensions&&e.payloadStore.updateExtensions(s.extensions)}else if(n===j.Dispatch){let a=is(o,e);Do(t,a,e)}else n===j.Log&&ss(s,e)}}function Mo(t,e){return r=>{let o={event:j.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};g(b`Sending websocket update event to the websocket clients:
4
4
  ${v.json(o)}
5
5
  `,e.stdout),Do(t,o,e)}}function Do(t,e,r){g(b`Sending websocket with event type ${e.event} and data:
6
6
  ${v.json(e.data)}
7
- `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function is(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var cs=10;function Fo(t){let e=new Mt.default({noServer:!0,clientTracking:!0}),r=ls(e);return t.httpServer.on("upgrade",$o(e,t)),t.payloadStore.on(le.Update,Mo(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function ls(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},cs*1e3)}p();p();p();function Oo(t,e){let{url:r}=$e(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",Fe(t,e)),o.toString()}}function No(t,e,r){let o=Ie(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 s={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(s))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",Fe(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=ps(e,r,t);break;default:return}return n.toString()}function ps(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,s="shopify.com",a=new URL(`https://${s}/${n}/account/extensions-development`);return a.searchParams.append("origin",o),a.searchParams.append("extensionId",t.devUUID),a.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),a.searchParams.append("appId",e.id??""),r!==""&&a.searchParams.append("target",r),a}function Fe(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function O(t,e){Zt(t,Xt(e))}p();var ct=class extends X{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function qo(t){let e=await us(t),r=await I(e);return Jt(r,t.data)}async function us(t){let e=await ds(),r=[];t.extensionSurface&&r.push(S(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(S(e,`${t.template}.html.liquid`));let o=await ge(r);if(o.length===0)throw new ct(t);return o[0]}async function ds(){return await vt("templates/ui-extensions/html",{type:"directory",cwd:yt(import.meta.url)})}var Wo=q(t=>{H(t,"Access-Control-Allow-Origin","*"),H(t,"Access-Control-Allow-Methods","GET, OPTIONS"),H(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),Ho=q(t=>{H(t,"Cache-Control","no-cache")}),lt=q(async t=>Ae(t,"/extensions",307));async function ms(t,e){let{filePath:r}=e;if(!await F(r))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Pt(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await F(r)))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await I(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"},s=de(r),a=n[s]||"text/plain";return H(t,"Content-Type",a),o}function Go({getExtensions:t,payloadStore:e}){return q(async r=>{let{extensionId:o,assetPath:n=""}=Te(r),s=t().find(h=>h.devUUID===o);if(!s)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n),c=i??n,d=c.endsWith(at);if(d&&i===void 0)return O(r,{statusCode:404,statusMessage:"Not Found"});let l=Ge(d?s.directory:Fr(s.outputPath)),u=Ge(S(l,c));return wt(l,u)?ms(r,{filePath:u}):O(r,{statusCode:404,statusMessage:"Not Found"})})}function pt({payloadStore:t}){return q(e=>(H(e,"content-type","application/json"),t.getRawPayload()))}function Bo({devOptions:t}){return q(e=>{g(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function ut({devOptions:t,getExtensions:e}){return q(async r=>{let{extensionId:o}=Te(r),n=e().find(i=>i.devUUID===o);if(!n)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(er(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return qo({data:{url:Fe(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=Oo(n,t);return Ae(r,i,307)}}let a=t.appWatcher.buildOutputPath;return H(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:re(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await te(n,a,t)}})}function Ko({devOptions:t,getExtensions:e}){return q(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Te(r),s=e().find(i=>i.devUUID===o);if(!s)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return O(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=No(n,s,t);return a?Ae(r,a,307):O(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as fs}from"http";function jo(t){let e=tr(),r=rr();e.use(Bo(t)),e.use(Wo),e.use(Ho),r.use("/extensions/dev-console",lt),r.use("/extensions/:extensionId",ut(t)),r.use("/extensions/:extensionId/",ut(t)),r.use("/extensions/:extensionId/:extensionPointTarget",Ko(t)),r.use("/extensions/:extensionId/assets/**:assetPath",Go(t)),r.use("/extensions",pt(t)),r.use("/extensions/",pt(t)),r.use("/",lt),e.use(r);let o=fs(or(e));return o.listen(t.devOptions.port,"localhost"),o}async function zo(t){let e={...t,websocketURL:re(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Lo(e,r,o),s=new De(n,e,o),a=e.extensions.filter(u=>u.isPreviewable),i=()=>a;g("Setting up the UI extensions HTTP server...",e.stdout);let c=jo({devOptions:e,payloadStore:s,getExtensions:i});g("Setting up the UI extensions Websocket server...",e.stdout);let d=Fo({...e,httpServer:c,payloadStore:s});g("Setting up the UI extensions bundler and file watching...",e.stdout);let l=async({appWasReloaded:u,app:h,extensionEvents:w})=>{u&&(a=h.allExtensions.filter(m=>m.isPreviewable));for(let m of w){if(!m.extension.isPreviewable)continue;let f=m.buildResult?.status==="ok"?"success":"error",U=m.buildResult?.status==="error"?{message:m.buildResult.error,file:m.buildResult.file}:void 0;switch(m.type){case ee.Created:if(e.extensions.push(m.extension),!e.checkoutCartUrl){let E=await ke(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(m.extension,r);break;case ee.Updated:await s.updateExtension(m.extension,e,r,{status:f,error:U});break;case ee.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==m.extension.devUUID),await s.deleteExtension(m.extension);break}}};e.appWatcher.onEvent(l).onStart(l),e.signal.addEventListener("abort",()=>{g("Closing the UI extensions dev server..."),d.close(),c.close()})}function re(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var hs="3",gs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:c,proxyUrl:d,appName:l,appDotEnvFile:u,appId:h,grantedScopes:w,allExtensions:m,appDirectory:f,appWatcher:U})=>{await zo({appName:l,appDotEnvFile:u,appDirectory:f,id:h,extensions:m,stdout:e,stderr:t,signal:r,url:d,port:i,storeFqdn:ye(n),storeId:s,apiKey:o,grantedScopes:w,checkoutCartUrl:c,subscriptionProductUrl:a,manifestVersion:hs,appWatcher:U})};async function Yo({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await ke(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:gs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();function z(t){let e=t.find(o=>Z(o,W.Frontend)),r=t.find(o=>Z(o,W.Backend));return{frontendConfig:e,backendConfig:r}}p();async function Vo(t){let r={topic:"app/uninstalled",api_version:(await lo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:mo.LOCALHOST,shared_secret:t.sharedSecret},o=await po(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await ae(3);let n=await ws(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function ws(t,e){let r=0;for(;r<3;){try{return await uo(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof Tt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await ae(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var ys=async({stdout:t},e)=>{await Vo({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function Qo({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=z(t),c=t.map(({configuration:l})=>l.webhooks_path).find(l=>l)??"/api/webhooks";if(c&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:ys,options:{deliveryPort:a?r:o,webhooksPath:c,organizationId:n,...s}}}p();async function Jo(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Ps}}var Ps=async({stdout:t,abortSignal:e},r)=>{let o=fo({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()})};p();async function Zo({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=z(t),c=i?.configuration.hmr_server?await $():void 0,d=void 0,l=t.map(async u=>{let h=await vs({web:u,frontendPort:r,backendPort:o}),w=c&&u.configuration.roles.includes(W.Frontend)?{port:c,httpPaths:u.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:u.configuration.name??["web",...u.configuration.roles].join("-"),function:xs,options:{port:h,portFromConfig:u.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:u.directory,devCommand:u.configuration.commands.dev,preDevCommand:u.configuration.commands.predev,scopes:a,shopCustomDomain:d,hmrServerOptions:w,roles:u.configuration.roles}}});return Promise.all(l)}async function vs({web:t,frontendPort:e,backendPort:r}){return Z(t,W.Frontend)?e:Z(t,W.Backend)?r:$()}async function xs({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:c,directory:d,devCommand:l,preDevCommand:u,scopes:h,shopCustomDomain:w,hmrServerOptions:m}){let f=m?.port,U={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:h,NODE_ENV:"development",...w&&{SHOP_CUSTOM_DOMAIN:w},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${c}`,...f&&{HMR_SERVER_PORT:`${f}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:d,port:o,env:U,stdout:t,stderr:e};u&&(t.write(`Running pre-dev command: "${u}"`),await Xo({...E,command:u,showOutput:zt()})),await Xo({...E,command:l,showOutput:!0})}async function Xo({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let c=t.split("&&").map(d=>d.trim())??[];for(let d of c){let[l,...u]=d.split(" ");l?.length!==0&&await Ue(l,u,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var Oe=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(b`${v.yellow(e)}`.value)}async success(e){await this.log(b`${v.green(e)}`.value)}async debug(e){g(e,this.stdout)}async error(e,r){let o=v.errorText("\u274C Error"),n=v.errorText(`\u2514 ${e}`);await this.log(b`${o}`.value,r),await this.log(b`${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 s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.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 s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e){if(!e)return;let r=e.extensionEvents??[],n=(await Promise.all(r.map(async a=>a.type===ee.Deleted?[]:(await a.extension.getDevSessionUpdateMessages())?.map(c=>({message:c,prefix:a.extension.handle}))??[]))).flat(),s=n.map((a,i)=>{let c=b`${v.gray(i===n.length-1?"\u2514 ":"\u2502 ")}${a.message}`.value;return this.log(c,a.prefix)});await Promise.all(s)}async logMultipleErrors(e){let r=v.errorText("\u274C Error");await this.log(b`${r}`.value,"app-preview");let o=e.map(n=>{let s=v.errorText(`\u2514 ${n.error}`);return this.log(b`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(e)})}};p();var Ne=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 qe=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 Oe(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ne(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=Zr(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${tt(n)}ms - Total: ${tt(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 a of e)for(let i of a.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(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)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"),!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:"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){e.status==="updated"?(await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r),await this.setUpdatedStatusMessage()):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),this.statusManager.setMessage("READY")):e.status==="aborted"?await this.logger.debug("\u274C Dev preview update aborted (new change detected or error during update)"):(e.status==="remote-error"||e.status==="unknown-error")&&(await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR"):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR"))),!this.statusManager.status.isReady&&!Yt()&&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),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=re(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new Error("Unauthorized");if(r instanceof Rt)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 to(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await xt(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=S(ue(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...ro];r&&n.push("manifest.json"),await oo(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await no(s,o),s}async getSignedURLWithRetry(){return so(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?.devSession;if(n&&this.currentSessionState){let s=re(this.options.url),a=this.currentSessionState?.userId;if(n.websocketUrl!==s||n.user?.id!==a){let i=n.user?.email;await this.logger.error(`Another developer ${i?`(${i}) `:""}has taken ownership of this dev preview.`);let c=`Another user${i?` (${i})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,d=["You can restart by running",{command:"shopify app dev"},"again."];throw new T(c,d)}this.currentSessionState={websocketUrl:n.websocketUrl,userId:n.user?.id??null,userEmail:n.user?.email??null}}return 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??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await Promise.all(n.map(a=>{let i=a.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${a.message}`:a.message;return this.logger.warning(i)})),o.length?{status:"remote-error",error:o}:{status:"created"}}};async function en({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:Es,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var Es=async({stdout:t},e)=>{await qe.start(e,t)};p();p();p();var tn=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=bt().substring(0,6),i=`${bs(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,c=Ao({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),d=S(n,i);try{return await fe(n),await me(d,c),{fullOutputPath:d,identifier:s}}catch(l){throw r.write(`Error while writing log to file: ${l}
7
+ `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function is(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var cs=10;function Fo(t){let e=new Mt.default({noServer:!0,clientTracking:!0}),r=ls(e);return t.httpServer.on("upgrade",$o(e,t)),t.payloadStore.on(le.Update,Mo(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function ls(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},cs*1e3)}p();p();p();function Oo(t,e){let{url:r}=$e(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",Fe(t,e)),o.toString()}}function No(t,e,r){let o=Ie(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 s={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(s))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",Fe(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=ps(e,r,t);break;default:return}return n.toString()}function ps(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,s="shopify.com",a=new URL(`https://${s}/${n}/account/extensions-development`);return a.searchParams.append("origin",o),a.searchParams.append("extensionId",t.devUUID),a.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),a.searchParams.append("appId",e.id??""),r!==""&&a.searchParams.append("target",r),a}function Fe(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function O(t,e){Zt(t,Xt(e))}p();var ct=class extends X{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function qo(t){let e=await us(t),r=await I(e);return Jt(r,t.data)}async function us(t){let e=await ds(),r=[];t.extensionSurface&&r.push(S(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(S(e,`${t.template}.html.liquid`));let o=await ge(r);if(o.length===0)throw new ct(t);return o[0]}async function ds(){return await vt("templates/ui-extensions/html",{type:"directory",cwd:yt(import.meta.url)})}var Wo=q(t=>{H(t,"Access-Control-Allow-Origin","*"),H(t,"Access-Control-Allow-Methods","GET, OPTIONS"),H(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),Ho=q(t=>{H(t,"Cache-Control","no-cache")}),lt=q(async t=>Ae(t,"/extensions",307));async function ms(t,e){let{filePath:r}=e;if(!await F(r))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Pt(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await F(r)))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await I(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"},s=de(r),a=n[s]||"text/plain";return H(t,"Content-Type",a),o}function Go({getExtensions:t,payloadStore:e}){return q(async r=>{let{extensionId:o,assetPath:n=""}=Te(r),s=t().find(h=>h.devUUID===o);if(!s)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n),c=i??n,d=c.endsWith(at);if(d&&i===void 0)return O(r,{statusCode:404,statusMessage:"Not Found"});let l=Ge(d?s.directory:Fr(s.outputPath)),u=Ge(S(l,c));return wt(l,u)?ms(r,{filePath:u}):O(r,{statusCode:404,statusMessage:"Not Found"})})}function pt({payloadStore:t}){return q(e=>(H(e,"content-type","application/json"),t.getRawPayload()))}function Bo({devOptions:t}){return q(e=>{g(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function ut({devOptions:t,getExtensions:e}){return q(async r=>{let{extensionId:o}=Te(r),n=e().find(i=>i.devUUID===o);if(!n)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(er(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return qo({data:{url:Fe(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=Oo(n,t);return Ae(r,i,307)}}let a=t.appWatcher.buildOutputPath;return H(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:re(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await te(n,a,t)}})}function Ko({devOptions:t,getExtensions:e}){return q(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Te(r),s=e().find(i=>i.devUUID===o);if(!s)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return O(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=No(n,s,t);return a?Ae(r,a,307):O(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as fs}from"http";function jo(t){let e=tr(),r=rr();e.use(Bo(t)),e.use(Wo),e.use(Ho),r.use("/extensions/dev-console",lt),r.use("/extensions/:extensionId",ut(t)),r.use("/extensions/:extensionId/",ut(t)),r.use("/extensions/:extensionId/:extensionPointTarget",Ko(t)),r.use("/extensions/:extensionId/assets/**:assetPath",Go(t)),r.use("/extensions",pt(t)),r.use("/extensions/",pt(t)),r.use("/",lt),e.use(r);let o=fs(or(e));return o.listen(t.devOptions.port,"localhost"),o}async function zo(t){let e={...t,websocketURL:re(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Lo(e,r,o),s=new De(n,e,o),a=e.extensions.filter(u=>u.isPreviewable),i=()=>a;g("Setting up the UI extensions HTTP server...",e.stdout);let c=jo({devOptions:e,payloadStore:s,getExtensions:i});g("Setting up the UI extensions Websocket server...",e.stdout);let d=Fo({...e,httpServer:c,payloadStore:s});g("Setting up the UI extensions bundler and file watching...",e.stdout);let l=async({appWasReloaded:u,app:h,extensionEvents:w})=>{u&&(a=h.allExtensions.filter(m=>m.isPreviewable));for(let m of w){if(!m.extension.isPreviewable)continue;let f=m.buildResult?.status==="ok"?"success":"error",U=m.buildResult?.status==="error"?{message:m.buildResult.error,file:m.buildResult.file}:void 0;switch(m.type){case ee.Created:if(e.extensions.push(m.extension),!e.checkoutCartUrl){let E=await ke(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(m.extension,r);break;case ee.Updated:await s.updateExtension(m.extension,e,r,{status:f,error:U});break;case ee.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==m.extension.devUUID),await s.deleteExtension(m.extension);break}}};e.appWatcher.onEvent(l).onStart(l),e.signal.addEventListener("abort",()=>{g("Closing the UI extensions dev server..."),d.close(),c.close()})}function re(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var hs="3",gs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:c,proxyUrl:d,appName:l,appDotEnvFile:u,appId:h,grantedScopes:w,allExtensions:m,appDirectory:f,appWatcher:U})=>{await zo({appName:l,appDotEnvFile:u,appDirectory:f,id:h,extensions:m,stdout:e,stderr:t,signal:r,url:d,port:i,storeFqdn:ye(n),storeId:s,apiKey:o,grantedScopes:w,checkoutCartUrl:c,subscriptionProductUrl:a,manifestVersion:hs,appWatcher:U})};async function Yo({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await ke(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:gs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();function z(t){let e=t.find(o=>Z(o,W.Frontend)),r=t.find(o=>Z(o,W.Backend));return{frontendConfig:e,backendConfig:r}}p();async function Vo(t){let r={topic:"app/uninstalled",api_version:(await lo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:mo.LOCALHOST,shared_secret:t.sharedSecret},o=await po(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await ae(3);let n=await ws(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function ws(t,e){let r=0;for(;r<3;){try{return await uo(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof Tt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await ae(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var ys=async({stdout:t},e)=>{await Vo({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function Qo({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=z(t),c=t.map(({configuration:l})=>l.webhooks_path).find(l=>l)??"/api/webhooks";if(c&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:ys,options:{deliveryPort:a?r:o,webhooksPath:c,organizationId:n,...s}}}p();async function Jo(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Ps}}var Ps=async({stdout:t,abortSignal:e},r)=>{let o=fo({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()})};p();async function Zo({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=z(t),c=i?.configuration.hmr_server?await $():void 0,d=void 0,l=t.map(async u=>{let h=await vs({web:u,frontendPort:r,backendPort:o}),w=c&&u.configuration.roles.includes(W.Frontend)?{port:c,httpPaths:u.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:u.configuration.name??["web",...u.configuration.roles].join("-"),function:xs,options:{port:h,portFromConfig:u.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:u.directory,devCommand:u.configuration.commands.dev,preDevCommand:u.configuration.commands.predev,scopes:a,shopCustomDomain:d,hmrServerOptions:w,roles:u.configuration.roles}}});return Promise.all(l)}async function vs({web:t,frontendPort:e,backendPort:r}){return Z(t,W.Frontend)?e:Z(t,W.Backend)?r:$()}async function xs({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:c,directory:d,devCommand:l,preDevCommand:u,scopes:h,shopCustomDomain:w,hmrServerOptions:m}){let f=m?.port,U={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:h,NODE_ENV:"development",...w&&{SHOP_CUSTOM_DOMAIN:w},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${c}`,...f&&{HMR_SERVER_PORT:`${f}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:d,port:o,env:U,stdout:t,stderr:e};u&&(t.write(`Running pre-dev command: "${u}"`),await Xo({...E,command:u,showOutput:zt()})),await Xo({...E,command:l,showOutput:!0})}async function Xo({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let c=t.split("&&").map(d=>d.trim())??[];for(let d of c){let[l,...u]=d.split(" ");l?.length!==0&&await Ue(l,u,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var Oe=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(b`${v.yellow(e)}`.value)}async success(e){await this.log(b`${v.green(e)}`.value)}async debug(e){g(e,this.stdout)}async error(e,r){let o=v.errorText("\u274C Error"),n=v.errorText(`\u2514 ${e}`);await this.log(b`${o}`.value,r),await this.log(b`${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 s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.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 s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e,r){if(!e||r.status==="remote-error"||r.status==="unknown-error")return;let o={status:r.status},n=e.extensionEvents??[],a=(await Promise.all(n.map(async c=>c.type===ee.Deleted?[]:(await c.extension.getDevSessionUpdateMessages(o))?.map(l=>({message:l,prefix:c.extension.handle}))??[]))).flat(),i=a.map((c,d)=>{let l=b`${v.gray(d===a.length-1?"\u2514 ":"\u2502 ")}${c.message}`.value;return this.log(l,c.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=v.errorText("\u274C Error");await this.log(b`${r}`.value,"app-preview");let o=e.map(n=>{let s=v.errorText(`\u2514 ${n.error}`);return this.log(b`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(e)})}};p();var Ne=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 qe=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 Oe(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ne(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=Zr(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${tt(n)}ms - Total: ${tt(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 a of e)for(let i of a.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(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)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"),!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:"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){e.status==="updated"?(await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage()):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")):(e.status==="remote-error"||e.status==="unknown-error")&&(await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR"):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR"))),!this.statusManager.status.isReady&&!Yt()&&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),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=re(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new Error("Unauthorized");if(r instanceof Rt)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 to(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await xt(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=S(ue(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...ro];r&&n.push("manifest.json"),await oo(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await no(s,o),s}async getSignedURLWithRetry(){return so(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?.devSession;if(n&&this.currentSessionState){let s=re(this.options.url),a=this.currentSessionState?.userId;if(n.websocketUrl!==s||n.user?.id!==a){let i=n.user?.email;await this.logger.error(`Another developer ${i?`(${i}) `:""}has taken ownership of this dev preview.`);let c=`Another user${i?` (${i})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,d=["You can restart by running",{command:"shopify app dev"},"again."];throw new T(c,d)}this.currentSessionState={websocketUrl:n.websocketUrl,userId:n.user?.id??null,userEmail:n.user?.email??null}}return 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??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await Promise.all(n.map(a=>{let i=a.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${a.message}`:a.message;return this.logger.warning(i)})),o.length?{status:"remote-error",error:o}:{status:"created"}}};async function en({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:Es,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var Es=async({stdout:t},e)=>{await qe.start(e,t)};p();p();p();var tn=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=bt().substring(0,6),i=`${bs(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,c=Ao({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),d=S(n,i);try{return await fe(n),await me(d,c),{fullOutputPath:d,identifier:s}}catch(l){throw r.write(`Error while writing log to file: ${l}
8
8
  `),l}};function bs(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),s=e.getUTCHours().toString().padStart(2,"0"),a=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),c=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${c}Z`}var We=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:d=0})=>{if(!i?.aborted)try{let l=e,u=wo,h=d,w=await o.appLogs({jwtToken:e,cursor:r},a),{errors:m,status:f}=w;if(f===200){h=0;let{app_logs:E}=w;for(let R of E){let x=JSON.parse(R.payload);await D({outputPrefix:R.source,stripAnsi:!1},async()=>{R.log_type===vo?(Ss(R,x,t),x=new ho(go(x))):R.log_type.startsWith(xo)?Us(R,x,t):t.write(JSON.stringify(x));let _=await tn({appLog:R,appLogPayload:x,stdout:t,storeName:s,logsDir:c});t.write(b`${v.gray("\u2514 ")}${v.link("Open log file",`file://${_.fullOutputPath}`,`Log: ${_.fullOutputPath}`)} ${v.gray(`(${_.identifier})`)}\n`.value)})}}else{let E={errors:m.map(x=>({message:x,status:f}))},R=await To({response:E,onThrottle:x=>{C("Request throttled while polling app logs.",t),C(`Retrying in ${x/1e3} seconds.`,t)},onUnknownError:x=>{C("Error while polling app logs.",t),C(`Retrying in ${x/1e3} seconds.`,t)},onResubscribe:()=>n()});if(R.resubscribeResult==="failed"){if(h+=1,h>=yo){C("App log streaming session has expired. Please restart your dev session.",t);return}}else R.resubscribeResult==="succeeded"&&(h=0);R.nextJwtToken&&(l=R.nextJwtToken),u=R.retryIntervalMs}let{cursor:U}=w;setTimeout(()=>{We({stdout:t,appLogsFetchInput:{jwtToken:l,cursor:U??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:h}).catch(E=>{g(`Unexpected error during polling: ${E}}
9
9
  `)})},u)}catch(l){C("Error while polling app logs.",t),C(`Retrying in ${ot/1e3} seconds.`,t),g(`${l}}
10
10
  `),setTimeout(()=>{We({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c}).catch(u=>{g(`Unexpected error during polling: ${u}}
@@ -17,4 +17,4 @@ ${v.json(JSON.stringify(t))}
17
17
  `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function ln(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 pn({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:c,graphiqlKey:d}){let l=o.apiKey,u=o.apiSecretKeys[0]?.secret??"",h=St(),w=!ft(h[Ce.disableGraphiQLExplorer]),m=await Kr(t),f=new eo(m,i.proxyUrl),U=await we(),E=io(n,l,U),R=E,x=nr(d,u,n),_=w?`http://localhost:${c}/graphiql?key=${encodeURIComponent(x)}`:void 0,ne=m.configuration.embedded,V=m.nonConfigExtensions.length>0,N=new He({isReady:!1,previewURL:R,graphiqlURL:_,appEmbedded:ne,hasExtensions:V}),G=[...await Zo({webs:m.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:l,apiSecret:u,scopes:$r(m.configuration)}),w?await Jo({appName:o.title,appUrl:E,port:c,apiKey:l,apiSecret:u,key:x,storeFqdn:n}):void 0,await Yo({allExtensions:m.realExtensions,storeFqdn:n,storeId:s,apiKey:l,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:m.name,appDotEnvFile:m.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:m.directory,appWatcher:f}),await en({app:m,apiKey:l,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:f,appPreviewURL:E,devSessionStatusManager:N}),await ko({remoteApp:o,localApp:m,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),Qo({webs:m.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:u,remoteAppUpdated:e}),await rn({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:l},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:f}),await on({appWatcher:f})].filter(Ls);return{processes:await $s(G,i.proxyPort,i.reverseProxyCert),previewUrl:R,graphiqlUrl:_,devSessionStatusManager:N}}var Ls=t=>t!==void 0&&t!==!1;async function $s(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(W.Frontend)){let c=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${c}`;let d=a.options.hmrServerOptions;d&&(i.websocket=`http://localhost:${d.port}`,d.httpPaths.forEach(l=>i[l]=`http://localhost:${d.port}`)),a.options.port=c}else if(a.type==="previewable-extension"){let c=await $();i[a.options.pathPrefix]=`http://localhost:${c}`,a.options.port=c}return{process:a,rules:i}})),n=o.map(({process:a})=>a),s=o.map(({rules:a})=>a).reduce((a,i)=>({...a,...i}),{});return Object.keys(s).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:Ms,options:{port:e,rules:s,localhostCert:r}}),n}var Ms=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await cn(o,t,n,e);B(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();p();p();var oe=Q(Pe(),1);var un=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function dn(){let[t,e]=(0,oe.useState)(0);return(0,oe.useEffect)(()=>{let r=setInterval(()=>{e(o=>(o+1)%un.length)},70);return()=>clearInterval(r)},[]),oe.default.createElement(L,null,un[t])}p();var A=Q(Pe(),1);var mn=.9,fn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Dt(),{isRawModeSupported:o}=ve(),[n,s]=(0,A.useState)(e),[a,i]=(0,A.useState)(Math.floor(r.columns*mn)),[c,d]=(0,A.useState)(!0),l=(0,A.useRef)(null);if(!n)throw new Error("No tabs provided");xe((m,f)=>{(async()=>{if(f?.leftArrow||f?.rightArrow||f?.tab){let x=Object.entries(t).filter(([G,P])=>P.content),_=x.findIndex(([G])=>G===n);if(_===-1)return;let ne=f?.leftArrow?-1:1,V=(_+ne+x.length)%x.length,N=x[V];N&&s(N[0])}let E=t[m];if(E){E.action?await E.action():s(m);return}let R=t[n];if(R?.shortcuts){let x=R.shortcuts.find(_=>_.key===m);x&&(!x.condition||x.condition())&&await x.action()}})()},{isActive:!!o}),(0,A.useLayoutEffect)(()=>{let m=()=>{if(i(Math.floor(r.columns*mn)),!l.current)return;let f=Ft(l.current);d(f.width<r.columns)};return r.on("resize",m),()=>{r.off("resize",m)}},[r]);let u=Object.entries(t).map(([m,f])=>({...f,inputKey:m,header:` (${m}) ${f.label} `})),h=u.filter(m=>!m.action),w=u.filter(m=>m.action);return A.default.createElement(A.default.Fragment,null,A.default.createElement(k,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},A.default.createElement(k,{ref:l,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},A.default.createElement(L,{wrap:"truncate-end"},"\u2502",h.map(m=>A.default.createElement(A.default.Fragment,{key:m.inputKey},A.default.createElement(L,{bold:n===m.inputKey,inverse:n===m.inputKey,wrap:"truncate"},m.header),"\u2502")))),c&&A.default.createElement(k,{flexGrow:1,justifyContent:"flex-end"},w.map((m,f)=>A.default.createElement(L,{wrap:"truncate",key:m.inputKey},"(",m.inputKey,") ",m.label,f<w.length-1&&" \u2502 ")))),A.default.createElement(k,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var y=Q(Pe(),1);var hn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:c,onAbort:d})=>{let{isRawModeSupported:l}=ve(),[u,h]=(0,y.useState)(void 0),[w,m]=(0,y.useState)(void 0),[f,U]=(0,y.useState)(r.status),[E,R]=(0,y.useState)(!1),{isAborted:x}=Gt(t.signal,async P=>{P&&m(typeof P=="string"?P:P.message),r.status.isReady?R(!0):(h("Shutting down dev ..."),await d()),_o()}),_=(0,y.useMemo)(()=>e.map(P=>({...P,action:async(pe,Rn,Tn)=>{try{return await P.action(pe,Rn,Tn)}catch(An){t.abort(An)}}})),[e,t]);(0,y.useEffect)(()=>(r.on("dev-session-update",U),()=>{r.off("dev-session-update",U)}),[]),xe((P,pe)=>{Nt(P,pe,()=>t.abort())},{isActive:!!l});let ne=P=>{switch(P){case"loading":return y.default.createElement(dn,null);case"success":return"\u2705";case"error":return"\u274C"}},V=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:f.previewURL,condition:()=>!!(f.isReady&&f.previewURL),action:async()=>{await K.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),f.previewURL&&await Se(f.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:rt(o),condition:()=>!!(f.isReady&&f.appEmbedded===!1&&f.hasExtensions),action:async()=>{await K.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Se(rt(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:f.graphiqlURL,condition:()=>!!(f.isReady&&f.graphiqlURL),action:async()=>{await K.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),f.graphiqlURL&&await Se(f.graphiqlURL)}}],N=V.filter(P=>P.condition?.()??!0),G={d:{label:"Dev status",shortcuts:V,content:y.default.createElement(y.default.Fragment,null,f.statusMessage&&y.default.createElement(L,null,ne(f.statusMessage.type)," ",f.statusMessage.message),l&&N.length>0&&y.default.createElement(k,{marginTop:1,flexDirection:"column"},N.map(P=>y.default.createElement(L,{key:P.key},qt.pointerSmall," ",y.default.createElement(L,{bold:!0},"(",P.key,")")," ",Ye()&&P.url?y.default.createElement(je,{url:P.url,label:P.shortcutLabel}):P.shortcutLabel))),y.default.createElement(k,{marginTop:l?1:0,flexDirection:"column"},u?y.default.createElement(L,null,u):y.default.createElement(y.default.Fragment,null,f.isReady&&!(l&&Ye())&&y.default.createElement(y.default.Fragment,null,N.filter(P=>P.url).map(P=>y.default.createElement(L,{key:P.key},P.linkLabel," URL: ",y.default.createElement(je,{url:P.url})))))))},a:{label:"App info",content:y.default.createElement(k,{flexDirection:"column"},y.default.createElement(ze,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":c??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,P])=>P)}))},s:{label:"Store info",content:y.default.createElement(k,{flexDirection:"column"},y.default.createElement(ze,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,P])=>P)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return y.default.createElement(y.default.Fragment,null,y.default.createElement(Wt,{processes:_,prefixColumnSize:Dr,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&y.default.createElement(k,{marginTop:1,flexDirection:"column"},y.default.createElement(Ht,{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"}})),x?null:y.default.createElement(k,{paddingTop:1,flexDirection:"column",flexGrow:1},l?y.default.createElement(fn,{tabs:G,initialActiveTab:"d"}):y.default.createElement(k,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},G.d?.content)),w?y.default.createElement(k,{marginTop:1,flexDirection:"column"},y.default.createElement(L,{color:"red"},w)):null)};var gn=Q(Pe(),1);async function wn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:c,organizationName:d,configPath:l,localURL:u}){if(Kt())return Ot(gn.default.createElement(hn,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:c,organizationName:d,configPath:l,localURL:u,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await Ds({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o})}async function Ds({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){return process.stdout.write(`
18
18
  Preview URL: ${e}
19
19
  `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
20
- `),Promise.all(t.map(async n=>{await n.action(process.stdout,process.stderr,o.signal)}))}p();function yn(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];se({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=Be(e.map(n=>n.for)).join(" "),o=Be(e.map(n=>({command:n.flagToRemedy})));se({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."]})}p();async function Pn(t,e){return e?e.includes("localhost")?"localhost":(await _t(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var vn=Q(Cn(),1);var Y="v1.4.4",xn="FiloSottile/mkcert",dt=v.genericShellCommand("mkcert");async function Fs(t,e,r,o){let n=e[Ce.mkcertBinaryPath];if(n)return n;let a=S(t,r==="win32"?"mkcert.exe":"mkcert");if(await F(a))return a;let i=await(0,vn.default)("mkcert",{nothrow:!0});return i?(g(b`Found ${dt} at ${v.path(i)}`),i):(await Os(a,r,o),a)}async function Os(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${Y}-darwin-arm64`:`mkcert-${Y}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${Y}-linux-arm64`:`mkcert-${Y}-linux-amd64`;break;case"win32":o=`mkcert-${Y}-windows-amd64.exe`;break;default:throw new X(`Unsupported platform: ${e}`)}await kr(xn,Y,o,t),g(b`${dt} saved to ${v.path(t)}`)}async function Ns(t){let e=S(t,"mkcert-LICENSE");if(await F(e))return;let r=`https://raw.githubusercontent.com/${xn}/refs/tags/${Y}/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 At(r),!n.ok)return o}catch{return o}let s=await n.text();await me(e,s)}async function En({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=S(".shopify","localhost-key.pem"),a=S(".shopify","localhost.pem"),i=S(t,s),c=S(t,a);if(await F(i)&&await F(c))return{keyContent:await I(i),certContent:await I(c),certPath:a};if(!(e??await jr()))throw new T(`Localhost certificate and key are required at ${a} and ${s}`);let l="",u;return await be([{title:"Finding or downloading mkcert binary",task:async()=>{let w=S(t,".shopify");l=await Fs(w,r,o,n),u=await Ns(w),g(b`${dt} found at: ${v.path(l)}`)}}]),u&&Ee(u),B(b`Generating self-signed certificate for localhost. You may be prompted for your password.`),await Ue(l,["-install","-key-file",i,"-cert-file",c,"localhost"]),B(b`${v.successIcon()} Certificate generated at ${a}\n`),await jt()&&(se({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"}}),B("\u{1F449} Press any key to continue"),await Bt(),B("")),{keyContent:await I(i),certContent:await I(c),certPath:ht(t,c)}}p();function bn(){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])}async function Sn(t){let e=await qs(t);await Ws(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:s}=await pn(e);await Gs(e),await js({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:s})}async function qs(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:s,tunnel:a}=t,i;if(a.mode==="auto"){let E=await $();i=await Gr(t.commandConfig,E,"cloudflare")}let c=await Yr(r,o,s,r.flags);r.configuration=c,Vr({app:e,remoteApp:r,selectedStore:n,cachedInfo:et(t.directory),organization:t.organization,tunnelMode:a.mode}),e.configuration.build?.dev_store_url&&(e.configuration.build={...e.configuration.build,dev_store_url:n.shopDomain},await(await Vt.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Lr(t.project);let d=t.graphiqlPort??await $(ie.graphiql),l=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??ie.graphiql,actual:d}];a.mode==="use-localhost"&&l.push({for:"localhost",flagToRemedy:"--localhost-port",requested:a.requestedPort,actual:a.actualPort}),yn(l);let{webs:u,...h}=await Ks(e.directory,e.webs,d,a,i,r.configuration,t.installMkcert);e.webs=u;let w=e.configuration.build?.automatically_update_urls_on_dev,m=et(t.directory)?.previousAppId,f=r.apiKey,U=await Bs(u,t.update,h,e,w,r,f);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==m,localApp:e,developerPlatformClient:o,commandOptions:t,network:h,partnerUrlsUpdated:U,graphiqlPort:d,graphiqlKey:t.graphiqlKey}}async function Ws(t){await Hs(t)}async function Hs(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||bn()}async function Gs(t){Or({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await zs({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Lt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Bs(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=z(t),d=!1;if((c??i)&&e){let l=qr(r.proxyUrl,t.map(({configuration:u})=>u.auth_callback_path).find(u=>u),o.configuration.app_proxy);d=await Hr({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:l}),d&&o.setDevApplicationURLs(l)}return d}async function Ks(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=z(e);await Ys(e,r);let d=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:l,frontendPort:u,usingLocalhost:h},w,m]=await Promise.all([Nr(d),Ut()??i?.configuration.port??$(),Wr(s)]),f=h?`${l}:${u}`:l,U=c?.configuration.port;c&&(U??=c===i?w:await $(),c.configuration.port=U),U=U??await $();let E;if(o.mode==="use-localhost"){let{keyContent:R,certContent:x,certPath:_}=await En({appDirectory:t,forceInstall:a});E={key:R,cert:x,certPath:_,port:o.actualPort}}return{proxyUrl:f,proxyPort:u,frontendPort:U,backendPort:w,currentUrls:m,webs:e,reverseProxyCert:E}}async function js({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let s=new Et,a=t.map(d=>({prefix:d.prefix,action:async(u,h,w)=>{let m=d.function;return m({stdout:u,stderr:h,abortSignal:w},d.options)}})),i=o.developerPlatformClient,c={id:o.remoteApp.id,developerPlatformClient:i};return wn({processes:a,previewUrl:e,graphiqlUrl:r,app:c,abortController:s,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})}async function zs(t){let e=await Pn(t.devOptions.commandConfig,t.tunnelUrl);await K.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?Ke(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:Ke(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await K.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function Ys(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);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 Ve(n))throw new T(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await Ve(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new T(s,a)}})()])}p();async function Un({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??ie.localhost,n=await $(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new T(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var M=Q(_n(),1);var mt=class t extends Jr{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 description=this.descriptionWithoutMarkdown();static flags={...Qt,...Ir,store:M.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>ye(e)}),"skip-dependencies-installation":M.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":M.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"subscription-product-url":M.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":M.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":M.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":M.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":M.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":Re({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:M.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Re({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":M.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:M.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":Re({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":M.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 Un({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await $t(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await Br(e.path);let o=await Qr({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),n=await Xr({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset}),s={...o,store:n,directory:e.path,update:!e["no-update"],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"]??!1,tunnel:r};return await Sn(s),{app:o.app}}};export{ka as a,mt as b};
20
+ `),Promise.all(t.map(async n=>{await n.action(process.stdout,process.stderr,o.signal)}))}p();function yn(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];se({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=Be(e.map(n=>n.for)).join(" "),o=Be(e.map(n=>({command:n.flagToRemedy})));se({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."]})}p();async function Pn(t,e){return e?e.includes("localhost")?"localhost":(await _t(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var vn=Q(Cn(),1);var Y="v1.4.4",xn="FiloSottile/mkcert",dt=v.genericShellCommand("mkcert");async function Fs(t,e,r,o){let n=e[Ce.mkcertBinaryPath];if(n)return n;let a=S(t,r==="win32"?"mkcert.exe":"mkcert");if(await F(a))return a;let i=await(0,vn.default)("mkcert",{nothrow:!0});return i?(g(b`Found ${dt} at ${v.path(i)}`),i):(await Os(a,r,o),a)}async function Os(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${Y}-darwin-arm64`:`mkcert-${Y}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${Y}-linux-arm64`:`mkcert-${Y}-linux-amd64`;break;case"win32":o=`mkcert-${Y}-windows-amd64.exe`;break;default:throw new X(`Unsupported platform: ${e}`)}await kr(xn,Y,o,t),g(b`${dt} saved to ${v.path(t)}`)}async function Ns(t){let e=S(t,"mkcert-LICENSE");if(await F(e))return;let r=`https://raw.githubusercontent.com/${xn}/refs/tags/${Y}/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 At(r),!n.ok)return o}catch{return o}let s=await n.text();await me(e,s)}async function En({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=S(".shopify","localhost-key.pem"),a=S(".shopify","localhost.pem"),i=S(t,s),c=S(t,a);if(await F(i)&&await F(c))return{keyContent:await I(i),certContent:await I(c),certPath:a};if(!(e??await jr()))throw new T(`Localhost certificate and key are required at ${a} and ${s}`);let l="",u;return await be([{title:"Finding or downloading mkcert binary",task:async()=>{let w=S(t,".shopify");l=await Fs(w,r,o,n),u=await Ns(w),g(b`${dt} found at: ${v.path(l)}`)}}]),u&&Ee(u),B(b`Generating self-signed certificate for localhost. You may be prompted for your password.`),await Ue(l,["-install","-key-file",i,"-cert-file",c,"localhost"]),B(b`${v.successIcon()} Certificate generated at ${a}\n`),await jt()&&(se({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"}}),B("\u{1F449} Press any key to continue"),await Bt(),B("")),{keyContent:await I(i),certContent:await I(c),certPath:ht(t,c)}}p();function bn(){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])}async function Sn(t){let e=await qs(t);await Ws(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:s}=await pn(e);await Gs(e),await js({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:s})}async function qs(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:s,tunnel:a}=t,i;if(a.mode==="auto"){let E=await $();i=await Gr(t.commandConfig,E,"cloudflare")}let c=await Yr(r,o,s,r.flags);r.configuration=c,Vr({app:e,remoteApp:r,selectedStore:n,cachedInfo:et(t.directory),organization:t.organization,tunnelMode:a.mode}),e.configuration.build?.dev_store_url&&(e.configuration.build={...e.configuration.build,dev_store_url:n.shopDomain},await(await Vt.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Lr(t.project);let d=t.graphiqlPort??await $(ie.graphiql),l=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??ie.graphiql,actual:d}];a.mode==="use-localhost"&&l.push({for:"localhost",flagToRemedy:"--localhost-port",requested:a.requestedPort,actual:a.actualPort}),yn(l);let{webs:u,...h}=await Ks(e.directory,e.webs,d,a,i,r.configuration,t.installMkcert);e.webs=u;let w=e.configuration.build?.automatically_update_urls_on_dev,m=et(t.directory)?.previousAppId,f=r.apiKey,U=await Bs(u,t.update,h,e,w,r,f);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==m,localApp:e,developerPlatformClient:o,commandOptions:t,network:h,partnerUrlsUpdated:U,graphiqlPort:d,graphiqlKey:t.graphiqlKey}}async function Ws(t){await Hs(t)}async function Hs(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||bn()}async function Gs(t){Or({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await zs({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Lt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Bs(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=z(t),d=!1;if((c??i)&&e){let l=qr(r.proxyUrl,t.map(({configuration:u})=>u.auth_callback_path).find(u=>u),o.configuration.app_proxy);d=await Hr({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:l}),d&&o.setDevApplicationURLs(l)}return d}async function Ks(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=z(e);await Ys(e,r);let d=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:l,frontendPort:u,usingLocalhost:h},w,m]=await Promise.all([Nr(d),Ut()??i?.configuration.port??$(),Wr(s)]),f=h?`${l}:${u}`:l,U=c?.configuration.port;c&&(U??=c===i?w:await $(),c.configuration.port=U),U=U??await $();let E;if(o.mode==="use-localhost"){let{keyContent:R,certContent:x,certPath:_}=await En({appDirectory:t,forceInstall:a});E={key:R,cert:x,certPath:_,port:o.actualPort}}return{proxyUrl:f,proxyPort:u,frontendPort:U,backendPort:w,currentUrls:m,webs:e,reverseProxyCert:E}}async function js({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let s=new Et,a=t.map(d=>({prefix:d.prefix,action:async(u,h,w)=>{let m=d.function;return m({stdout:u,stderr:h,abortSignal:w},d.options)}})),i=o.developerPlatformClient,c={id:o.remoteApp.id,developerPlatformClient:i};return wn({processes:a,previewUrl:e,graphiqlUrl:r,app:c,abortController:s,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})}async function zs(t){let e=await Pn(t.devOptions.commandConfig,t.tunnelUrl);await K.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?Ke(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:Ke(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await K.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function Ys(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);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 Ve(n))throw new T(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await Ve(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new T(s,a)}})()])}p();async function Un({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??ie.localhost,n=await $(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new T(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var M=Q(_n(),1);var mt=class t extends Jr{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 description=this.descriptionWithoutMarkdown();static flags={...Qt,...Ir,store:M.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>ye(e)}),"skip-dependencies-installation":M.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":M.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"subscription-product-url":M.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":M.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":M.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":M.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":M.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":Re({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:M.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Re({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":M.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:M.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":Re({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":M.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 Un({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await $t(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await Br(e.path);let o=await Qr({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),n=await Xr({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option"}),s={...o,store:n,directory:e.path,update:!e["no-update"],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};return await Sn(s),{app:o.app}}};export{ka as a,mt as b};
@@ -1 +1 @@
1
- import{b as r,c as u,e as I}from"./chunk-DPNZWBT5.js";import{a as o}from"./chunk-JD5P5RAJ.js";import{g as c}from"./chunk-VKWPEFWQ.js";c();c();function i(t){return!(t===void 0||t.trim()==="")}function s(t,e){switch(t){case"bitbucket":return{branch:e.BITBUCKET_BRANCH,build:e.BITBUCKET_BUILD_NUMBER,commitSha:e.BITBUCKET_COMMIT,run:e.BITBUCKET_BUILD_NUMBER,url:`https://bitbucket.org/${e.BITBUCKET_WORKSPACE}/${e.BITBUCKET_REPO_SLUG}/pipelines/results/${e.BITBUCKET_BUILD_NUMBER}`};case"circleci":return{actor:e.CIRCLE_USERNAME,branch:e.CIRCLE_BRANCH,build:e.CIRCLE_BUILD_NUM,commitSha:e.CIRCLE_SHA1,run:e.CIRCLE_WORKFLOW_ID,url:e.CIRCLE_BUILD_URL};case"github":return{actor:e.GITHUB_ACTOR,attempt:e.GITHUB_RUN_ATTEMPT,branch:e.GITHUB_REF_NAME,build:e.GITHUB_RUN_ID,commitSha:e.GITHUB_SHA,run:e.GITHUB_RUN_ID,runNumber:e.GITHUB_RUN_NUMBER,url:`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`};case"gitlab":return{actor:e.GITLAB_USER_LOGIN,branch:e.CI_COMMIT_REF_NAME,build:e.CI_PIPELINE_ID,commitSha:e.CI_COMMIT_SHA,commitMessage:e.CI_COMMIT_MESSAGE,run:e.CI_RUNNER_ID,url:e.CI_PIPELINE_URL};case"buildkite":return{branch:e.BUILDKITE_BRANCH,build:e.BUILDKITE_BUILD_NUMBER,commitSha:e.BUILDKITE_COMMIT,commitMessage:e.BUILDKITE_MESSAGE,run:e.BUILDKITE_BUILD_NUMBER,url:e.BUILDKITE_BUILD_URL};default:return{}}}import{randomUUID as p}from"crypto";import{homedir as l,networkInterfaces as m}from"os";async function f(t){let{fileExists:e}=await import("./fs-Y7I3Y5IR.js");return e(t)}async function U(t,e){let{exec:a}=await import("./system-ZETSJRKS.js");await a(t,e)}function M(){return!!(process.stdout.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}function x(){return l()}var _,T;function B(t=process.env){return t[r.env]==="development"}function N(t=process.env){return t===process.env?_??=o(t[r.verbose])||process.argv.includes("--verbose"):o(t[r.verbose])||process.argv.includes("--verbose")}async function A(t=process.env){return Object.prototype.hasOwnProperty.call(t,r.runAsUser)?!o(t[r.runAsUser]):await f(I.executables.dev)}function y(t=process.env){return t===process.env?T??=o(t[r.unitTest]):o(t[r.unitTest])}function g(t=process.env){return o(t[r.noAnalytics])||o(t[r.optOutInstrumentation])||B(t)}function S(t=process.env){return o(t[r.alwaysLogAnalytics])}function K(t=process.env){return o(t[r.alwaysLogMetrics])}function G(t=process.env){return o(t[r.doctor])}function O(t=process.env){return t[r.gitpod]}function H(t=process.env){return t[r.codespaceName]}function w(t=process.env){return t[r.codespacePortForwardingDomain]}function P(t=process.env){return d(t).platform!=="localhost"}function k(t=process.env){return t[r.themeToken]}function d(t=process.env){return i(t[r.codespaces])?{platform:"codespaces",editor:!0}:i(t[r.gitpod])?{platform:"gitpod",editor:!0}:i(t[r.cloudShell])?{platform:"cloudShell",editor:!0}:{platform:"localhost",editor:!1}}async function F(){try{return await U("git",["--version"]),!0}catch{return!1}}function z(t=process.env){if(o(t.CI)){let e="unknown";return i(t.BITBUCKET_BUILD_NUMBER)?e="bitbucket":o(t.CIRCLECI)?e="circleci":i(t.GITHUB_ACTION)?e="github":o(t.GITLAB_CI)?e="gitlab":i(t.BUILDKITE)&&(e="buildkite"),{isCI:!0,name:e,metadata:s(e,t)}}else if(o(t.TF_BUILD))return{isCI:!0,name:"azure",metadata:s("azure",t)};return{isCI:!1}}async function $(){let t="00:00:00:00:00:00",e=Object.values(m()).flat().filter(n=>!!(n&&n.mac!==t));return(e.find(n=>!n.internal)??e[0])?.mac??p()}function V(t=process.env){let e=t[r.themeKitAccessDomain];return i(e)?e:u}function W(t=process.env){let e=t[r.otelURL];return i(e)?e:"https://otlp-http-production-cli.shopifysvc.com"}export{M as a,x as b,B as c,N as d,A as e,y as f,g,S as h,K as i,G as j,O as k,H as l,w as m,P as n,k as o,d as p,F as q,z as r,$ as s,V as t,W as u};
1
+ import{b as r,c as u,e as I}from"./chunk-DPNZWBT5.js";import{a as o}from"./chunk-JD5P5RAJ.js";import{g as c}from"./chunk-VKWPEFWQ.js";c();c();function i(t){return!(t===void 0||t.trim()==="")}function s(t,e){switch(t){case"bitbucket":return{branch:e.BITBUCKET_BRANCH,build:e.BITBUCKET_BUILD_NUMBER,commitSha:e.BITBUCKET_COMMIT,run:e.BITBUCKET_BUILD_NUMBER,url:`https://bitbucket.org/${e.BITBUCKET_WORKSPACE}/${e.BITBUCKET_REPO_SLUG}/pipelines/results/${e.BITBUCKET_BUILD_NUMBER}`};case"circleci":return{actor:e.CIRCLE_USERNAME,branch:e.CIRCLE_BRANCH,build:e.CIRCLE_BUILD_NUM,commitSha:e.CIRCLE_SHA1,run:e.CIRCLE_WORKFLOW_ID,url:e.CIRCLE_BUILD_URL};case"github":return{actor:e.GITHUB_ACTOR,attempt:e.GITHUB_RUN_ATTEMPT,branch:e.GITHUB_REF_NAME,build:e.GITHUB_RUN_ID,commitSha:e.GITHUB_SHA,run:e.GITHUB_RUN_ID,runNumber:e.GITHUB_RUN_NUMBER,url:`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`};case"gitlab":return{actor:e.GITLAB_USER_LOGIN,branch:e.CI_COMMIT_REF_NAME,build:e.CI_PIPELINE_ID,commitSha:e.CI_COMMIT_SHA,commitMessage:e.CI_COMMIT_MESSAGE,run:e.CI_RUNNER_ID,url:e.CI_PIPELINE_URL};case"buildkite":return{branch:e.BUILDKITE_BRANCH,build:e.BUILDKITE_BUILD_NUMBER,commitSha:e.BUILDKITE_COMMIT,commitMessage:e.BUILDKITE_MESSAGE,run:e.BUILDKITE_BUILD_NUMBER,url:e.BUILDKITE_BUILD_URL};default:return{}}}import{randomUUID as p}from"crypto";import{homedir as l,networkInterfaces as m}from"os";async function f(t){let{fileExists:e}=await import("./fs-BJHNJDDK.js");return e(t)}async function U(t,e){let{exec:a}=await import("./system-P5QIJALL.js");await a(t,e)}function M(){return!!(process.stdout.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}function x(){return l()}var _,T;function B(t=process.env){return t[r.env]==="development"}function N(t=process.env){return t===process.env?_??=o(t[r.verbose])||process.argv.includes("--verbose"):o(t[r.verbose])||process.argv.includes("--verbose")}async function A(t=process.env){return Object.prototype.hasOwnProperty.call(t,r.runAsUser)?!o(t[r.runAsUser]):await f(I.executables.dev)}function y(t=process.env){return t===process.env?T??=o(t[r.unitTest]):o(t[r.unitTest])}function g(t=process.env){return o(t[r.noAnalytics])||o(t[r.optOutInstrumentation])||B(t)}function S(t=process.env){return o(t[r.alwaysLogAnalytics])}function K(t=process.env){return o(t[r.alwaysLogMetrics])}function G(t=process.env){return o(t[r.doctor])}function O(t=process.env){return t[r.gitpod]}function H(t=process.env){return t[r.codespaceName]}function w(t=process.env){return t[r.codespacePortForwardingDomain]}function P(t=process.env){return d(t).platform!=="localhost"}function k(t=process.env){return t[r.themeToken]}function d(t=process.env){return i(t[r.codespaces])?{platform:"codespaces",editor:!0}:i(t[r.gitpod])?{platform:"gitpod",editor:!0}:i(t[r.cloudShell])?{platform:"cloudShell",editor:!0}:{platform:"localhost",editor:!1}}async function F(){try{return await U("git",["--version"]),!0}catch{return!1}}function z(t=process.env){if(o(t.CI)){let e="unknown";return i(t.BITBUCKET_BUILD_NUMBER)?e="bitbucket":o(t.CIRCLECI)?e="circleci":i(t.GITHUB_ACTION)?e="github":o(t.GITLAB_CI)?e="gitlab":i(t.BUILDKITE)&&(e="buildkite"),{isCI:!0,name:e,metadata:s(e,t)}}else if(o(t.TF_BUILD))return{isCI:!0,name:"azure",metadata:s("azure",t)};return{isCI:!1}}async function $(){let t="00:00:00:00:00:00",e=Object.values(m()).flat().filter(n=>!!(n&&n.mac!==t));return(e.find(n=>!n.internal)??e[0])?.mac??p()}function V(t=process.env){let e=t[r.themeKitAccessDomain];return i(e)?e:u}function W(t=process.env){let e=t[r.otelURL];return i(e)?e:"https://otlp-http-production-cli.shopifysvc.com"}export{M as a,x as b,B as c,N as d,A as e,y as f,g,S as h,K as i,G as j,O as k,H as l,w as m,P as n,k as o,d as p,F as q,z as r,$ as s,V as t,W as u};
@@ -1,3 +1,3 @@
1
- import{a}from"./chunk-UK4WXL4G.js";import{p as i,v as s}from"./chunk-3KM2GKXH.js";import{b as r}from"./chunk-IX4IGE5H.js";import{a as c}from"./chunk-CTNBSUVU.js";import{e as d,g as e}from"./chunk-VKWPEFWQ.js";e();var m=d(c(),1),t=class extends s{static summary="Download metafields definitions from your shop into a local file.";static descriptionWithMarkdown=`Retrieves metafields from Shopify Admin.
1
+ import{a}from"./chunk-GRSF7456.js";import{p as i,v as s}from"./chunk-GNBRCK7L.js";import{b as r}from"./chunk-YEVGLC5X.js";import{a as c}from"./chunk-CTNBSUVU.js";import{e as d,g as e}from"./chunk-VKWPEFWQ.js";e();var m=d(c(),1),t=class extends s{static summary="Download metafields definitions from your shop into a local file.";static descriptionWithMarkdown=`Retrieves metafields from Shopify Admin.
2
2
 
3
3
  If the metafields file already exists, it will be overwritten.`;static description=this.descriptionWithoutMarkdown();static flags={...r,...i,force:m.Flags.boolean({hidden:!0,char:"f",description:"Proceed without confirmation, if current directory does not seem to be theme directory.",env:"SHOPIFY_FLAG_FORCE"})};static multiEnvironmentsFlags=null;async command(o){let n={path:o.path,password:o.password,store:o.store,force:o.force,verbose:o.verbose,noColor:o["no-color"]};await a(n)}};export{t as a};
@@ -1 +1 @@
1
- import{a as q,c as C}from"./chunk-U3F6GPCE.js";import{d as x,f as k,u as N}from"./chunk-SGIMJQEM.js";import{a as J}from"./chunk-ESPT6CGE.js";import{a as A,c as E}from"./chunk-RA3WWB2S.js";import{b}from"./chunk-6G5TDB45.js";import{b as O}from"./chunk-IX4IGE5H.js";import{j as I,k as y}from"./chunk-PK73ZSND.js";import{B as v,I as f,z as d}from"./chunk-WSCSFFLH.js";import{h as l}from"./chunk-BI7LE6CZ.js";import{Ta as g,ma as h,qb as c,sb as s,ua as w,wb as S}from"./chunk-HQUWYKSJ.js";import{e as Q,g as p}from"./chunk-VKWPEFWQ.js";p();p();var F=Q(I(),1);async function z(a,e){if(a)try{return JSON.parse(a)}catch(t){let r=t instanceof Error?t.message:"Unknown error";throw new l(s`Invalid JSON in ${c.yellow("--variables")} flag: ${r}`,"Please provide valid JSON format.")}else if(e){if(!await g(e))throw new l(s`Variable file not found at ${c.path(e)}. Please check the path and try again.`);let t=await h(e,{encoding:"utf8"});try{return JSON.parse(t)}catch(r){let n=r instanceof Error?r.message:"Unknown error";throw new l(s`Invalid JSON in variable file ${c.path(e)}: ${n}`,"Please provide valid JSON format.")}}}async function M(a){let{remoteApp:e,store:t,query:r,variables:n,variableFile:$,version:L,outputFile:u}=a,{adminSession:R,version:V}=await f({title:s`Authenticating`,task:async()=>{let o=await q(e,t.shopDomain),i=await k({adminSession:o,userSpecifiedVersion:L});return{adminSession:o,version:i}},renderOptions:{stdout:process.stderr}}),G=await z(n,$);x(r),C(r,t);try{let o=await f({title:s`Executing GraphQL operation`,task:async()=>b({query:(0,F.parse)(r),session:R,variables:G,version:V,responseOptions:{handleErrors:!1}}),renderOptions:{stdout:process.stderr}}),i=JSON.stringify(o,null,2);u?(await w(u,i),d({headline:"Operation succeeded.",body:`Results written to ${u}`})):(d({headline:"Operation succeeded."}),S(i))}catch(o){if(o instanceof y){let i={errors:o.response.errors},P=JSON.stringify(i,null,2);v({headline:"GraphQL operation failed.",body:P});return}throw o}}var m=class a extends J{static summary="Execute GraphQL queries and mutations.";static descriptionWithMarkdown="Executes an Admin API GraphQL query or mutation on the specified store. Mutations are only allowed on dev stores.\n\n For operations that process large amounts of data, use [`bulk execute`](https://shopify.dev/docs/api/shopify-cli/app/app-bulk-execute) instead.";static description=this.descriptionWithoutMarkdown();static flags={...O,...A,...E};async run(){let{flags:e}=await this.parse(a),{query:t,appContextResult:r,store:n}=await N(e);return await M({organization:r.organization,remoteApp:r.remoteApp,store:n,query:t,variables:e.variables,variableFile:e["variable-file"],outputFile:e["output-file"],...e.version&&{version:e.version}}),{app:r.app}}};export{m as a};
1
+ import{a as q,c as C}from"./chunk-2AK44UYM.js";import{d as x,f as k,u as N}from"./chunk-3DCN3N23.js";import{a as J}from"./chunk-UZARYOLN.js";import{a as A,c as E}from"./chunk-YESGYUEL.js";import{b}from"./chunk-KWVOJWO7.js";import{b as O}from"./chunk-YEVGLC5X.js";import{k as I,l as y}from"./chunk-3JXPOOFV.js";import{B as v,I as f,z as d}from"./chunk-YFINLODF.js";import{h as l}from"./chunk-BWJIZYAG.js";import{Ta as g,ma as h,qb as c,sb as s,ua as w,wb as S}from"./chunk-VFM2KQRM.js";import{e as Q,g as p}from"./chunk-VKWPEFWQ.js";p();p();var F=Q(I(),1);async function z(a,e){if(a)try{return JSON.parse(a)}catch(t){let r=t instanceof Error?t.message:"Unknown error";throw new l(s`Invalid JSON in ${c.yellow("--variables")} flag: ${r}`,"Please provide valid JSON format.")}else if(e){if(!await g(e))throw new l(s`Variable file not found at ${c.path(e)}. Please check the path and try again.`);let t=await h(e,{encoding:"utf8"});try{return JSON.parse(t)}catch(r){let n=r instanceof Error?r.message:"Unknown error";throw new l(s`Invalid JSON in variable file ${c.path(e)}: ${n}`,"Please provide valid JSON format.")}}}async function M(a){let{remoteApp:e,store:t,query:r,variables:n,variableFile:$,version:L,outputFile:u}=a,{adminSession:R,version:V}=await f({title:s`Authenticating`,task:async()=>{let o=await q(e,t.shopDomain),i=await k({adminSession:o,userSpecifiedVersion:L});return{adminSession:o,version:i}},renderOptions:{stdout:process.stderr}}),G=await z(n,$);x(r),C(r,t);try{let o=await f({title:s`Executing GraphQL operation`,task:async()=>b({query:(0,F.parse)(r),session:R,variables:G,version:V,responseOptions:{handleErrors:!1}}),renderOptions:{stdout:process.stderr}}),i=JSON.stringify(o,null,2);u?(await w(u,i),d({headline:"Operation succeeded.",body:`Results written to ${u}`})):(d({headline:"Operation succeeded."}),S(i))}catch(o){if(o instanceof y){let i={errors:o.response.errors},P=JSON.stringify(i,null,2);v({headline:"GraphQL operation failed.",body:P});return}throw o}}var m=class a extends J{static summary="Execute GraphQL queries and mutations.";static descriptionWithMarkdown="Executes an Admin API GraphQL query or mutation on the specified store. Mutations are only allowed on dev stores.\n\n For operations that process large amounts of data, use [`bulk execute`](https://shopify.dev/docs/api/shopify-cli/app/app-bulk-execute) instead.";static description=this.descriptionWithoutMarkdown();static flags={...O,...A,...E};async run(){let{flags:e}=await this.parse(a),{query:t,appContextResult:r,store:n}=await N(e);return await M({organization:r.organization,remoteApp:r.remoteApp,store:n,query:t,variables:e.variables,variableFile:e["variable-file"],outputFile:e["output-file"],...e.version&&{version:e.version}}),{app:r.app}}};export{m as a};
@@ -1,4 +1,4 @@
1
- import{a as C}from"./chunk-K3VLFPPI.js";import{b as ne,c as re}from"./chunk-OF6CV5R4.js";import{c as ee,d as te}from"./chunk-XMQFQUUK.js";import{A as M}from"./chunk-YXDIHVPY.js";import{a as Z}from"./chunk-ESPT6CGE.js";import{a as Q}from"./chunk-RA3WWB2S.js";import{sa as X}from"./chunk-GFWXVO72.js";import{b as z,c as Y,f as V}from"./chunk-IX4IGE5H.js";import{F as K,a as b,d as v,e as l,f as s,g as j,h as G,i as H,l as J,m as q,n as x,t as R}from"./chunk-WSCSFFLH.js";import{h as O}from"./chunk-BI7LE6CZ.js";import{a as ye}from"./chunk-CTNBSUVU.js";import{a as B}from"./chunk-LBREJXT6.js";import{ma as N}from"./chunk-HQUWYKSJ.js";import{f as U}from"./chunk-4VJ6YK7U.js";import{d as I}from"./chunk-773TIA5M.js";import{e as S,g as c}from"./chunk-VKWPEFWQ.js";c();c();c();c();c();var h=S(v(),1);import{Writable as oe}from"stream";function ie({selectedRun:e,abortController:t,app:o,extension:r,appWatcher:i}){let a={type:"functionRun",input:e.payload.input,output:e.payload.output,logs:e.payload.logs,name:e.source,size:0,memory_usage:0,instructions:e.payload.fuelConsumed},[u,f]=(0,h.useState)([]),[p,m]=(0,h.useState)([a,a]),[y,d]=(0,h.useState)(void 0),{input:w,export:_}=e.payload,[fe,k]=(0,h.useState)(`Watching for changes to ${e.source}...`);return(0,h.useEffect)(()=>{let A=new b;t.signal.addEventListener("abort",()=>{A.abort()});let $=async()=>{let E=await we(r,JSON.stringify(w),_);m(g=>[E,g[0]]),k(`Watching for changes to ${e.source}...`),f(g=>[...g,E])},de=async()=>{k("Replaying log with local function..."),await $()},ge=async()=>{i.onEvent(async g=>{let F=g.extensionEvents.find(L=>L.extension.handle===r.handle);if(!(!F||F.type!==ee.Updated)){if(F.buildResult?.status==="error"){d(`Error while reloading and building extension: ${F.buildResult?.error}`);return}d(void 0),k("Re-running with latest changes..."),await $()}});let E=new oe({write(g,F,L){f(he=>[...he,{type:"systemMessage",message:g.toString()}]),L()}});await i.start({stdout:E,stderr:E,signal:A.signal},!1)};return de().then(()=>{ge()}),()=>{A.abort()}},[w,_,o,r]),R(t.signal,async()=>{setTimeout(()=>{U()||B(process.pid,"SIGINT",!1,()=>{process.exit(0)})},2e3)}),{logs:u,statusMessage:fe,recentFunctionRuns:p,error:y}}async function we(e,t,o){let r="",i=new oe({write(u,f,p){r+=u,p()}});return await C({functionExtension:e,input:t,export:o,stdout:i,json:!0}),{...JSON.parse(r),type:"functionRun"}}var n=S(v(),1);var ae=({selectedRun:e,abortController:t,app:o,extension:r})=>{let{isAborted:i}=R(t.signal),{isRawModeSupported:a}=G(),u=new te(o),{logs:f,statusMessage:p,recentFunctionRuns:m,error:y}=ie({selectedRun:e,abortController:t,app:o,extension:r,appWatcher:u});return H((d,w)=>{q(d,w,()=>t.abort()),d==="q"&&t.abort()},{isActive:!!a}),n.default.createElement(n.default.Fragment,null,n.default.createElement(j,{items:f},(d,w)=>n.default.createElement(l,{key:`replayOutputScrollerLog${w}`,flexDirection:"column"},n.default.createElement(Re,{log:d}))),i?null:n.default.createElement(l,{marginY:1,paddingTop:1,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},a?n.default.createElement(l,{flexDirection:"column"},n.default.createElement(l,{flexDirection:"row"},n.default.createElement(s,null,x.pointerSmall," ",p)),n.default.createElement(be,{recentFunctionRuns:m}),n.default.createElement(s,null,x.pointerSmall," Press ",n.default.createElement(s,{bold:!0},"q")," ",x.lineVertical," quit")):null,y?n.default.createElement(s,{color:"red"},y):null))};function D({title:e,backgroundColor:t}){let o=Math.max(Math.round((28-e.length)/2),0),r=" ".repeat(o);return n.default.createElement(s,{backgroundColor:t,color:"black"},`
1
+ import{a as C}from"./chunk-36ROOKQB.js";import{b as ne,c as re}from"./chunk-JX7FYWPO.js";import{c as ee,d as te}from"./chunk-T7PJDT5O.js";import{A as M}from"./chunk-IARCMH7G.js";import{a as Z}from"./chunk-UZARYOLN.js";import{a as Q}from"./chunk-YESGYUEL.js";import{wa as X}from"./chunk-ZZRFG6ME.js";import{b as z,c as Y,f as V}from"./chunk-YEVGLC5X.js";import{F as K,a as b,d as v,e as l,f as s,g as j,h as G,i as H,l as J,m as q,n as x,t as R}from"./chunk-YFINLODF.js";import{h as O}from"./chunk-BWJIZYAG.js";import{a as ye}from"./chunk-CTNBSUVU.js";import{a as B}from"./chunk-2KGPH7YG.js";import{ma as N}from"./chunk-VFM2KQRM.js";import{f as U}from"./chunk-R6ICQT2D.js";import{d as I}from"./chunk-773TIA5M.js";import{e as S,g as c}from"./chunk-VKWPEFWQ.js";c();c();c();c();c();var h=S(v(),1);import{Writable as oe}from"stream";function ie({selectedRun:e,abortController:t,app:o,extension:r,appWatcher:i}){let a={type:"functionRun",input:e.payload.input,output:e.payload.output,logs:e.payload.logs,name:e.source,size:0,memory_usage:0,instructions:e.payload.fuelConsumed},[u,f]=(0,h.useState)([]),[p,m]=(0,h.useState)([a,a]),[y,d]=(0,h.useState)(void 0),{input:w,export:_}=e.payload,[fe,k]=(0,h.useState)(`Watching for changes to ${e.source}...`);return(0,h.useEffect)(()=>{let A=new b;t.signal.addEventListener("abort",()=>{A.abort()});let $=async()=>{let E=await we(r,JSON.stringify(w),_);m(g=>[E,g[0]]),k(`Watching for changes to ${e.source}...`),f(g=>[...g,E])},de=async()=>{k("Replaying log with local function..."),await $()},ge=async()=>{i.onEvent(async g=>{let F=g.extensionEvents.find(L=>L.extension.handle===r.handle);if(!(!F||F.type!==ee.Updated)){if(F.buildResult?.status==="error"){d(`Error while reloading and building extension: ${F.buildResult?.error}`);return}d(void 0),k("Re-running with latest changes..."),await $()}});let E=new oe({write(g,F,L){f(he=>[...he,{type:"systemMessage",message:g.toString()}]),L()}});await i.start({stdout:E,stderr:E,signal:A.signal},!1)};return de().then(()=>{ge()}),()=>{A.abort()}},[w,_,o,r]),R(t.signal,async()=>{setTimeout(()=>{U()||B(process.pid,"SIGINT",!1,()=>{process.exit(0)})},2e3)}),{logs:u,statusMessage:fe,recentFunctionRuns:p,error:y}}async function we(e,t,o){let r="",i=new oe({write(u,f,p){r+=u,p()}});return await C({functionExtension:e,input:t,export:o,stdout:i,json:!0}),{...JSON.parse(r),type:"functionRun"}}var n=S(v(),1);var ae=({selectedRun:e,abortController:t,app:o,extension:r})=>{let{isAborted:i}=R(t.signal),{isRawModeSupported:a}=G(),u=new te(o),{logs:f,statusMessage:p,recentFunctionRuns:m,error:y}=ie({selectedRun:e,abortController:t,app:o,extension:r,appWatcher:u});return H((d,w)=>{q(d,w,()=>t.abort()),d==="q"&&t.abort()},{isActive:!!a}),n.default.createElement(n.default.Fragment,null,n.default.createElement(j,{items:f},(d,w)=>n.default.createElement(l,{key:`replayOutputScrollerLog${w}`,flexDirection:"column"},n.default.createElement(Re,{log:d}))),i?null:n.default.createElement(l,{marginY:1,paddingTop:1,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},a?n.default.createElement(l,{flexDirection:"column"},n.default.createElement(l,{flexDirection:"row"},n.default.createElement(s,null,x.pointerSmall," ",p)),n.default.createElement(be,{recentFunctionRuns:m}),n.default.createElement(s,null,x.pointerSmall," Press ",n.default.createElement(s,{bold:!0},"q")," ",x.lineVertical," quit")):null,y?n.default.createElement(s,{color:"red"},y):null))};function D({title:e,backgroundColor:t}){let o=Math.max(Math.round((28-e.length)/2),0),r=" ".repeat(o);return n.default.createElement(s,{backgroundColor:t,color:"black"},`
2
2
 
3
3
  `,r,e,r,`
4
4
  `)}function Ee({input:e}){return n.default.createElement(l,{flexDirection:"column"},n.default.createElement(D,{title:"Input",backgroundColor:"yellow"}),n.default.createElement(s,null,M(e)))}function Fe({logs:e}){return n.default.createElement(l,{flexDirection:"column"},n.default.createElement(D,{title:"Logs",backgroundColor:"blueBright"}),n.default.createElement(s,null,e))}function xe({output:e}){return n.default.createElement(l,{flexDirection:"column"},n.default.createElement(D,{title:"Output",backgroundColor:"greenBright"}),n.default.createElement(s,null,M(e)))}function Se({functionRun:e}){return n.default.createElement(l,{flexDirection:"column"},n.default.createElement(D,{title:"Benchmark Results",backgroundColor:"green"}),n.default.createElement(s,null,"Name: ",e.name),n.default.createElement(s,null,"Linear Memory Usage: ",e.memory_usage,"KB"),n.default.createElement(s,null,"Instructions: ",e.instructions/1e3,"K"),n.default.createElement(s,null,"Size: ",e.size,"KB"))}function be({recentFunctionRuns:e}){let t=e[0].instructions-e[1].instructions;return n.default.createElement(l,{flexDirection:"column"},n.default.createElement(s,null,x.pointerSmall," Instruction count change: ",t>0?"+":"",t))}function Re({log:e}){switch(e.type){case"functionRun":return n.default.createElement(l,{flexDirection:"column"},n.default.createElement(Ee,{input:e.input}),n.default.createElement(Fe,{logs:e.logs}),n.default.createElement(xe,{output:e.output}),n.default.createElement(Se,{functionRun:e}),n.default.createElement(s,null,"\xA0"));case"systemMessage":return n.default.createElement(s,null,e.message);default:return null}}var se=S(v(),1);async function ce({selectedRun:e,abortController:t,app:o,extension:r}){return J(se.default.createElement(ae,{selectedRun:e,abortController:t,app:o,extension:r}),{exitOnCtrlC:!1})}c();async function le(e){if(e.length===0)return;let t=i=>({label:`${i.logTimestamp} (${i.status}) - ${i.identifier}`,value:i}),o=e.map(t);return await K({message:"Which function run would you like to replay locally?",choices:o})}import{existsSync as Ce,readdirSync as De}from"fs";var T=100;async function ue(e){let{watch:t,extension:o,app:r}=e,i=new b;try{let a=r.getLogsDir(),u=e.log?await ke(a,o.handle,e.log):await Le(a,o.handle),{input:f,export:p}=u.payload;t?await ce({selectedRun:u,abortController:i,app:r,extension:o}):await C({functionExtension:o,json:e.json,input:JSON.stringify(f),export:p})}catch(a){throw i.abort(),a}}async function ke(e,t,o){let r=await Ae(e,t,o);if(r===void 0)throw new O(`No log found for '${o}'.
@@ -1 +1 @@
1
- import{q as a}from"./chunk-PK73ZSND.js";import{h as s}from"./chunk-BI7LE6CZ.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();var n={LOCALHOST:"localhost",HTTP:"http",PUBSUB:"google-pub-sub",EVENTBRIDGE:"event-bridge"},p={LOCALHOST:new RegExp("^http:","i"),HTTP:new RegExp("^https:","i"),PUBSUB:new RegExp("^pubsub:"),EVENTBRIDGE:new RegExp("^arn:aws:events:")};function c(t,e){let r=T(t);return r===n.LOCALHOST&&e===n.HTTP?!0:r===e}function l(t){return p.LOCALHOST.test(t)?new URL(t.toLowerCase()).hostname==="localhost":!1}function d(t,e){if(!c(t,e))throw new s(`Can't deliver your webhook payload to this address using '${e}'`,"Use a valid URL for address",f(e));let r=e;return l(t)&&(r=n.LOCALHOST),[t.trim(),r]}function f(t){return t===n.HTTP?["For remote HTTP testing, use a URL that starts with https://","For local HTTP testing, use http://localhost:{port}/{url-path}"]:t===n.PUBSUB?["For Google Pub/Sub, use pubsub://{project-id}:{topic-id}"]:t===n.EVENTBRIDGE?["For Amazon EventBridge, use an Amazon Resource Name (ARN) starting with arn:aws:events:"]:[]}function g(t,e){if(e.includes(t))return t;throw new s(`Api Version '${t}' does not exist`,`Allowed values: ${e.join(", ")}`,["Try again with a valid api-version value"])}function A(t,e,r){if(r.length===0)throw new s(`No topics found for '${e}'`);let o=h(t.trim(),r);if(o===void 0)throw new s(`Topic '${t}' does not exist for ApiVersion '${e}'`,`Allowed values: ${r.join(", ")}`,["Try again with a valid api-version - topic pair"]);return o}function h(t,e){return e.includes(t)?t:e.find(r=>r.toUpperCase().replace("/","_")===t)}function T(t){if(t){if(t.startsWith("pubsub:"))return n.PUBSUB;if(t.startsWith("arn:aws:events:"))return n.EVENTBRIDGE;if(l(t))return n.LOCALHOST;if(p.HTTP.test(t))return n.HTTP}}i();async function O(t,e,r){let{sendSampleWebhook:o}=await t.sendSampleWebhook(e,r);return o}i();async function H(t,e,r){let o={method:"POST",body:e,headers:{"Content-Type":"application/json",...JSON.parse(r)}},u=await a(t,o);return u.status>=200&&u.status<300}i();async function m(t,e){let{publicApiVersions:r}=await t.apiVersions(e),o=r.indexOf("unstable");return o===-1?r.sort().reverse():(r.splice(o,1),r.sort().reverse(),r.push("unstable")),r}export{m as a,O as b,H as c,n as d,c as e,d as f,g,A as h,T as i};
1
+ import{r as a}from"./chunk-3JXPOOFV.js";import{h as s}from"./chunk-BWJIZYAG.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();var n={LOCALHOST:"localhost",HTTP:"http",PUBSUB:"google-pub-sub",EVENTBRIDGE:"event-bridge"},p={LOCALHOST:new RegExp("^http:","i"),HTTP:new RegExp("^https:","i"),PUBSUB:new RegExp("^pubsub:"),EVENTBRIDGE:new RegExp("^arn:aws:events:")};function c(t,e){let r=T(t);return r===n.LOCALHOST&&e===n.HTTP?!0:r===e}function l(t){return p.LOCALHOST.test(t)?new URL(t.toLowerCase()).hostname==="localhost":!1}function d(t,e){if(!c(t,e))throw new s(`Can't deliver your webhook payload to this address using '${e}'`,"Use a valid URL for address",f(e));let r=e;return l(t)&&(r=n.LOCALHOST),[t.trim(),r]}function f(t){return t===n.HTTP?["For remote HTTP testing, use a URL that starts with https://","For local HTTP testing, use http://localhost:{port}/{url-path}"]:t===n.PUBSUB?["For Google Pub/Sub, use pubsub://{project-id}:{topic-id}"]:t===n.EVENTBRIDGE?["For Amazon EventBridge, use an Amazon Resource Name (ARN) starting with arn:aws:events:"]:[]}function g(t,e){if(e.includes(t))return t;throw new s(`Api Version '${t}' does not exist`,`Allowed values: ${e.join(", ")}`,["Try again with a valid api-version value"])}function A(t,e,r){if(r.length===0)throw new s(`No topics found for '${e}'`);let o=h(t.trim(),r);if(o===void 0)throw new s(`Topic '${t}' does not exist for ApiVersion '${e}'`,`Allowed values: ${r.join(", ")}`,["Try again with a valid api-version - topic pair"]);return o}function h(t,e){return e.includes(t)?t:e.find(r=>r.toUpperCase().replace("/","_")===t)}function T(t){if(t){if(t.startsWith("pubsub:"))return n.PUBSUB;if(t.startsWith("arn:aws:events:"))return n.EVENTBRIDGE;if(l(t))return n.LOCALHOST;if(p.HTTP.test(t))return n.HTTP}}i();async function O(t,e,r){let{sendSampleWebhook:o}=await t.sendSampleWebhook(e,r);return o}i();async function H(t,e,r){let o={method:"POST",body:e,headers:{"Content-Type":"application/json",...JSON.parse(r)}},u=await a(t,o);return u.status>=200&&u.status<300}i();async function m(t,e){let{publicApiVersions:r}=await t.apiVersions(e),o=r.indexOf("unstable");return o===-1?r.sort().reverse():(r.splice(o,1),r.sort().reverse(),r.push("unstable")),r}export{m as a,O as b,H as c,n as d,c as e,d as f,g,A as h,T as i};
@@ -1 +1 @@
1
- import{f as y}from"./chunk-IX4IGE5H.js";import{b as g}from"./chunk-3WV7DQMM.js";import{B as u,E as l,F as f,G as m,H as d,N as p}from"./chunk-PK73ZSND.js";import{j as n}from"./chunk-AFT6ABDE.js";import{D as S,J as h}from"./chunk-WSCSFFLH.js";import{a as v}from"./chunk-CTNBSUVU.js";import{zb as w}from"./chunk-HQUWYKSJ.js";import{e as N,g as i}from"./chunk-VKWPEFWQ.js";i();i();var r="NEW_LOGIN";function C(s,t){let e=[],o=s[t];if(o)for(let[c,L]of Object.entries(o))e.push({label:L.identity.alias??c,value:c});return e}async function b(){let s=await p({},{forceNewSession:!0}),t=await f(s.userId);if(!t){let e=await h({message:"Enter an alias for this account (e.g. your email or a nickname)"});return await m(s.userId,e),e}return t}async function x(){let s=await l(),t=await u(),e=[];return s&&e.push(...C(s,t)),e.length>0&&e.push({label:"Log in with a different account",value:r}),e}async function A(s){if(s){let o=await d(s);if(o)return n(o),s}let t=await x(),e=r;return t.length>0&&(e=await S({message:"Which account would you like to use?",choices:t})),e===r?b():(n(e),t.find(o=>o.value===e)?.label??e)}var I=N(v(),1);var a=class s extends g{static description="Logs you in to your Shopify account.";static flags={alias:y(I.Flags.string({description:"Alias of an existing session you want to use.",env:"SHOPIFY_FLAG_AUTH_ALIAS"}))};async run(){let{flags:t}=await this.parse(s),e=await A(t.alias);w(`Current account: ${e}.`)}};export{a};
1
+ import{f as y}from"./chunk-YEVGLC5X.js";import{b as g}from"./chunk-2XDUJQQN.js";import{C as u,F as l,G as f,H as m,I as d,O as p}from"./chunk-3JXPOOFV.js";import{D as S,J as h}from"./chunk-YFINLODF.js";import{j as n}from"./chunk-YZMY2CTU.js";import{a as v}from"./chunk-CTNBSUVU.js";import{zb as w}from"./chunk-VFM2KQRM.js";import{e as N,g as i}from"./chunk-VKWPEFWQ.js";i();i();var r="NEW_LOGIN";function C(s,t){let e=[],o=s[t];if(o)for(let[c,L]of Object.entries(o))e.push({label:L.identity.alias??c,value:c});return e}async function b(){let s=await p({},{forceNewSession:!0}),t=await f(s.userId);if(!t){let e=await h({message:"Enter an alias for this account (e.g. your email or a nickname)"});return await m(s.userId,e),e}return t}async function x(){let s=await l(),t=await u(),e=[];return s&&e.push(...C(s,t)),e.length>0&&e.push({label:"Log in with a different account",value:r}),e}async function A(s){if(s){let o=await d(s);if(o)return n(o),s}let t=await x(),e=r;return t.length>0&&(e=await S({message:"Which account would you like to use?",choices:t})),e===r?b():(n(e),t.find(o=>o.value===e)?.label??e)}var I=N(v(),1);var a=class s extends g{static description="Logs you in to your Shopify account.";static flags={alias:y(I.Flags.string({description:"Alias of an existing session you want to use.",env:"SHOPIFY_FLAG_AUTH_ALIAS"}))};async run(){let{flags:t}=await this.parse(s),e=await A(t.alias);w(`Current account: ${e}.`)}};export{a};
@@ -1,4 +1,4 @@
1
- import{b as h}from"./chunk-3WV7DQMM.js";import{Ca as g,ua as u,wa as c}from"./chunk-HQUWYKSJ.js";import{d as f,q as p}from"./chunk-773TIA5M.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();var d=f(p(),"/docs-shopify.dev/commands"),m=class extends h{static description="Generate CLI commands documentation";static hidden=!0;async run(){let a=this.config.commands;await g(d),await c(d);let o=a.sort((e,i)=>e.id.length-i.id.length).filter(e=>!b(e)).map(e=>{let i=k(e);return N(e,i)});await Promise.all(o)}},C=["commands","help","plugins"];function b(t){return t.hidden?(C.push(t.id),!0):t.pluginType==="user"?!0:C.some(a=>t.id.startsWith(`${a}:`))}function k(t){let a=t.id.replace(/[:]/g," "),s=t.id.replace(/[:]/g,"-"),o=t.id.replace(/[:-]/g,"");return{commandName:a,fileName:s,interfaceName:o}}async function N(t,{commandName:a,fileName:s,interfaceName:o}){let e=Object.keys(t.flags).map(r=>{let n=t.flags[r];if(!n||n.hidden)return;let $=n.description??"",w=n.char?`-${n.char}, `:"",y=n.type==="option"?"string":"''",v=n.type==="option"?" <value>":"",x=n.required?"":"?",D=n.env!==void 0?` @environment ${n.env}`:"";return` /**
1
+ import{b as h}from"./chunk-2XDUJQQN.js";import{Ca as g,ua as u,wa as c}from"./chunk-VFM2KQRM.js";import{d as f,q as p}from"./chunk-773TIA5M.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();var d=f(p(),"/docs-shopify.dev/commands"),m=class extends h{static description="Generate CLI commands documentation";static hidden=!0;async run(){let a=this.config.commands;await g(d),await c(d);let o=a.sort((e,i)=>e.id.length-i.id.length).filter(e=>!b(e)).map(e=>{let i=k(e);return N(e,i)});await Promise.all(o)}},C=["commands","help","plugins"];function b(t){return t.hidden?(C.push(t.id),!0):t.pluginType==="user"?!0:C.some(a=>t.id.startsWith(`${a}:`))}function k(t){let a=t.id.replace(/[:]/g," "),s=t.id.replace(/[:]/g,"-"),o=t.id.replace(/[:-]/g,"");return{commandName:a,fileName:s,interfaceName:o}}async function N(t,{commandName:a,fileName:s,interfaceName:o}){let e=Object.keys(t.flags).map(r=>{let n=t.flags[r];if(!n||n.hidden)return;let $=n.description??"",w=n.char?`-${n.char}, `:"",y=n.type==="option"?"string":"''",v=n.type==="option"?" <value>":"",x=n.required?"":"?",D=n.env!==void 0?` @environment ${n.env}`:"";return` /**
2
2
  * ${$}
3
3
  *${D}
4
4
  */
@@ -1,4 +1,4 @@
1
- import{b as ge}from"./chunk-CUUCRIGC.js";import{a as he,c as ye}from"./chunk-M5Q74UZM.js";import{b as ue}from"./chunk-I2LNQKIJ.js";import{a as Te}from"./chunk-ESPT6CGE.js";import{C as ve,H as Pe,J as Ae,L as ke,U as xe,W as Ce,h as we,pa as Fe,sa as Le}from"./chunk-GFWXVO72.js";import{Y as Ie,aa as Re,o as be}from"./chunk-SPE2D366.js";import{b as fe,f as de}from"./chunk-IX4IGE5H.js";import{B as ie,D as re,E as oe,f as C,g as ee,i as te,p as ae}from"./chunk-GW4JHUIA.js";import{e as Q}from"./chunk-AFT6ABDE.js";import{D as $,H as ce,y as le,z as pe}from"./chunk-WSCSFFLH.js";import{c as ne}from"./chunk-XTXYS7LB.js";import{a as z}from"./chunk-76NEIDP5.js";import{d as se}from"./chunk-6K3AJTNO.js";import{h as m}from"./chunk-BI7LE6CZ.js";import{a as He}from"./chunk-CTNBSUVU.js";import{$a as Z,Ca as I,Ja as V,Oa as K,Ta as R,Ua as x,Va as B,Wa as W,_ as H,hb as X,ib as J,ka as q,ma as O,qb as h,rb as F,sa as T,sb as b,ua as _,wa as Y}from"./chunk-HQUWYKSJ.js";import{e as me}from"./chunk-4VJ6YK7U.js";import{d as l,e as k,f as M,p as U,q as D}from"./chunk-773TIA5M.js";import{e as De,g as c}from"./chunk-VKWPEFWQ.js";c();c();var y={reactRouter:{url:"https://github.com/Shopify/shopify-app-template-react-router",label:"Build a React Router app (recommended)",visible:!0,branches:{prompt:"For your React Router template, which language do you want?",options:{javascript:{branch:"javascript-cli",label:"JavaScript"},typescript:{branch:"main-cli",label:"TypeScript"}}}},remix:{url:"https://github.com/Shopify/shopify-app-template-remix",label:"Build a Remix app",visible:!1,branches:{prompt:"For your Remix template, which language do you want?",options:{javascript:{branch:"javascript",label:"JavaScript"},typescript:{branch:"main",label:"TypeScript"}}}},none:{url:"https://github.com/Shopify/shopify-app-template-extension-only",label:"Build an extension-only app",visible:!0},node:{url:"https://github.com/Shopify/shopify-app-template-node",visible:!1},ruby:{url:"https://github.com/Shopify/shopify-app-template-ruby",visible:!1}},S=Object.keys(y),L=S.filter(e=>y[e].visible),qe=["reactRouter","none"],Oe=async e=>{let t=e.template,a=e.flavor,r={template:y.reactRouter.url};t??=await $({choices:qe.map(o=>({label:y[o].label||o,value:o})),message:"Get started building your app:",defaultValue:S.find(o=>y[o].url===r.template)});let i={...e,template:t,templateType:P(t)?t:"custom",globalCLIResult:{install:!1,alreadyInstalled:!1}},n,s;if(i.templateType!=="custom"){let o=y[i.templateType];n=o.url,o.branches&&(a?s=o.branches.options[a]?.branch:s=await $({message:o.branches.prompt||"Choose a flavor:",choices:Object.entries(o.branches.options).map(([f,u])=>({value:u.branch,label:u.label}))}))}return s&&(n=`${n}#${s}`),i.template=n||i.template||r.template,i.globalCLIResult=await J(),i},_e=Oe;function P(e){return S.includes(e)}function $e(e){return e!==void 0&&P(e)&&y[e].branches!==void 0}c();c();import{platform as Ye}from"os";async function Se({packageJSON:e,local:t,useGlobalCLI:a}){if(e.dependencies=e.dependencies??{},a?delete e.dependencies["@shopify/cli"]:e.dependencies["@shopify/cli"]=z,delete e.dependencies["@shopify/app"],t){let r=await Ve("cli");e.dependencies["@shopify/cli"]=r;let i={"@shopify/cli":r};e.overrides=e.overrides?{...e.overrides,...i}:i,e.resolutions=e.resolutions?{...e.resolutions,...i}:i}return e}async function Ve(e){return`file:${await Z(`packages/${e}`,{type:"directory",cwd:U(import.meta.url)})}`}async function Ge({from:e,packageManager:t}){let a=Ye()==="win32"&&t==="yarn"?["--network-concurrency","1"]:[];return ae({directory:k(e),packageManager:t,args:a})}c();async function G(e,t){let r=(await W([l(e,"**",".git"),l(e,"**",".github"),l(e,"**",".gitmodules"),l(e,"**",".cli-liquid-bypass"),l(e,"LICENSE*"),l(e,"**","frontend/LICENSE*"),l(e,"package.json.cli2")],{dot:!0,onlyFiles:!1,onlyDirectories:!1,ignore:["**/node_modules/**"]})).map(s=>I(s,{force:!0})),i=new Set(ee[t]),n=C.filter(s=>!i.has(s)).map(s=>{let o=l(e,s);if(x(o))return V(o)});return Promise.all([...r,...n])}async function Ke(e){let t=e.packageManager,a=H(e.name),r=l(e.directory,a),i=ge(e.template);await Ee(r,a),await Be(r),le({body:["Initializing project with",{command:t},`
1
+ import{b as ge}from"./chunk-WYBTC356.js";import{a as he,c as ye}from"./chunk-Y47C3LSX.js";import{b as ue}from"./chunk-O7DZXO3O.js";import{a as Te}from"./chunk-UZARYOLN.js";import{C as ve,K as Pe,M as Ae,O as ke,Y as xe,_ as Ce,h as we,ta as Fe,wa as Le}from"./chunk-ZZRFG6ME.js";import{E as Re,z as Ie}from"./chunk-N75VOJHO.js";import{l as be}from"./chunk-XOCB4KNX.js";import{b as fe,f as de}from"./chunk-YEVGLC5X.js";import{B as ie,D as re,E as oe,f as C,g as ee,i as te,p as ae}from"./chunk-Y5PRPHLQ.js";import{D as $,H as ce,y as le,z as pe}from"./chunk-YFINLODF.js";import{c as ne}from"./chunk-UAFEFKAQ.js";import{a as z}from"./chunk-VASGXHYA.js";import{e as Q}from"./chunk-YZMY2CTU.js";import{d as se}from"./chunk-NHAUJWEG.js";import{h as m}from"./chunk-BWJIZYAG.js";import{a as He}from"./chunk-CTNBSUVU.js";import{$a as Z,Ca as I,Ja as V,Oa as K,Ta as R,Ua as x,Va as B,Wa as W,_ as H,hb as X,ib as J,ka as q,ma as O,qb as h,rb as F,sa as T,sb as b,ua as _,wa as Y}from"./chunk-VFM2KQRM.js";import{e as me}from"./chunk-R6ICQT2D.js";import{d as l,e as k,f as M,p as U,q as D}from"./chunk-773TIA5M.js";import{e as De,g as c}from"./chunk-VKWPEFWQ.js";c();c();var y={reactRouter:{url:"https://github.com/Shopify/shopify-app-template-react-router",label:"Build a React Router app (recommended)",visible:!0,branches:{prompt:"For your React Router template, which language do you want?",options:{javascript:{branch:"javascript-cli",label:"JavaScript"},typescript:{branch:"main-cli",label:"TypeScript"}}}},remix:{url:"https://github.com/Shopify/shopify-app-template-remix",label:"Build a Remix app",visible:!1,branches:{prompt:"For your Remix template, which language do you want?",options:{javascript:{branch:"javascript",label:"JavaScript"},typescript:{branch:"main",label:"TypeScript"}}}},none:{url:"https://github.com/Shopify/shopify-app-template-extension-only",label:"Build an extension-only app",visible:!0},node:{url:"https://github.com/Shopify/shopify-app-template-node",visible:!1},ruby:{url:"https://github.com/Shopify/shopify-app-template-ruby",visible:!1}},S=Object.keys(y),L=S.filter(e=>y[e].visible),qe=["reactRouter","none"],Oe=async e=>{let t=e.template,a=e.flavor,r={template:y.reactRouter.url};t??=await $({choices:qe.map(o=>({label:y[o].label||o,value:o})),message:"Get started building your app:",defaultValue:S.find(o=>y[o].url===r.template)});let i={...e,template:t,templateType:P(t)?t:"custom",globalCLIResult:{install:!1,alreadyInstalled:!1}},n,s;if(i.templateType!=="custom"){let o=y[i.templateType];n=o.url,o.branches&&(a?s=o.branches.options[a]?.branch:s=await $({message:o.branches.prompt||"Choose a flavor:",choices:Object.entries(o.branches.options).map(([f,u])=>({value:u.branch,label:u.label}))}))}return s&&(n=`${n}#${s}`),i.template=n||i.template||r.template,i.globalCLIResult=await J(),i},_e=Oe;function P(e){return S.includes(e)}function $e(e){return e!==void 0&&P(e)&&y[e].branches!==void 0}c();c();import{platform as Ye}from"os";async function Se({packageJSON:e,local:t,useGlobalCLI:a}){if(e.dependencies=e.dependencies??{},a?delete e.dependencies["@shopify/cli"]:e.dependencies["@shopify/cli"]=z,delete e.dependencies["@shopify/app"],t){let r=await Ve("cli");e.dependencies["@shopify/cli"]=r;let i={"@shopify/cli":r};e.overrides=e.overrides?{...e.overrides,...i}:i,e.resolutions=e.resolutions?{...e.resolutions,...i}:i}return e}async function Ve(e){return`file:${await Z(`packages/${e}`,{type:"directory",cwd:U(import.meta.url)})}`}async function Ge({from:e,packageManager:t}){let a=Ye()==="win32"&&t==="yarn"?["--network-concurrency","1"]:[];return ae({directory:k(e),packageManager:t,args:a})}c();async function G(e,t){let r=(await W([l(e,"**",".git"),l(e,"**",".github"),l(e,"**",".gitmodules"),l(e,"**",".cli-liquid-bypass"),l(e,"LICENSE*"),l(e,"**","frontend/LICENSE*"),l(e,"package.json.cli2")],{dot:!0,onlyFiles:!1,onlyDirectories:!1,ignore:["**/node_modules/**"]})).map(s=>I(s,{force:!0})),i=new Set(ee[t]),n=C.filter(s=>!i.has(s)).map(s=>{let o=l(e,s);if(x(o))return V(o)});return Promise.all([...r,...n])}async function Ke(e){let t=e.packageManager,a=H(e.name),r=l(e.directory,a),i=ge(e.template);await Ee(r,a),await Be(r),le({body:["Initializing project with",{command:t},`
2
2
  Use the`,{command:"--package-manager"},"flag to select a different package manager."]}),await q(async o=>{let f=l(o,"download"),u=i.filePath?l(f,i.filePath):f,d=l(o,"app"),A=i.branch?`${i.baseURL}#${i.branch}`:i.baseURL;await Y(f);let w=[{title:`Downloading template from ${A}`,task:async()=>{await ye({repoUrl:A,destination:f,shallow:!0})}}];w.push({title:"Parsing liquid",task:async()=>{await ue(u,d,{dependency_manager:t,app_name:e.name})}},{title:"Updating package.json",task:async()=>{let p=(await ie(d)).content;p.name=a,p.author=await ne()??"",p.private=!0;let v=["extensions/*"].concat(We(d));switch(t){case"npm":case"yarn":case"bun":p.workspaces=v;break;case"pnpm":{await Ze(d,v),await T(l(d,".npmrc"),`auto-install-peers=true
3
3
  `);break}case"homebrew":case"unknown":throw new te}await Se({packageJSON:p,local:e.local,directory:d,useGlobalCLI:e.useGlobalCLI}),await re(d,p)}}),e.postCloneActions.removeLockfilesFromGitignore&&w.push({title:"Removing lockfiles from .gitignore",task:async()=>{let p=l(d,".gitignore");if(await R(p)){let v=await O(p);C.forEach(Me=>{let Ue=new RegExp(`^${Me.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`,"gm");v=v.replace(Ue,"")}),await _(p,v.trim())}}}),await me()&&w.push({title:"[Shopifolks-only] Configuring the project's NPM registry",task:async()=>{let p=l(d,".npmrc");await T(p,`@shopify:registry=https://registry.npmjs.org
4
4
  `)}});let N=!1;w.push({title:"Preparing project directory",task:async()=>{await Ee(r,a),N=!0,await K(d,r)}}),w.push({title:`Installing dependencies with ${t}`,task:async()=>{await Ge({from:r,packageManager:t})}},{title:"Cleaning up",task:async()=>{await G(r,t)}},{title:"Initializing a Git repository...",task:async()=>{await he(r)}});try{await ce(w)}catch(p){throw N&&await I(r).catch(()=>{}),p}});let n;if(e.selectedAppOrNameResult.result==="new"){let o=await ve(r,e.name),f=e.selectedAppOrNameResult.org;n=await e.developerPlatformClient.createApp(f,o)}else n=e.selectedAppOrNameResult.app;await Fe({directory:r,apiKey:n.apiKey,appId:n.id,organizationId:n.organizationId,configName:"shopify.app.toml",developerPlatformClient:e.developerPlatformClient,isNewApp:!0},!1);let s=await Le({directory:r,clientId:void 0,forceRelink:!1,userProvidedConfigName:void 0});return pe({headline:[{userInput:a},"is ready for you to build!"],nextSteps:[["Run",{command:`cd ${a}`}],["For extensions, run",{command:F(t,"shopify app generate extension")}],["To see your app, run",{command:F(t,"shopify app dev")}]],reference:[{link:{label:"Shopify docs",url:"https://shopify.dev"}},[{link:{label:"Shopify Dev MCP,",url:"https://shopify.dev/docs/apps/build/devmcp"}},"connect your AI assistant to development resources"],["For an overview of commands, run",{command:F(t,"shopify app","--help")}]]}),{app:s.app}}async function Ee(e,t){if(await R(e))throw new m(`
@@ -1,4 +1,4 @@
1
- import{a as U}from"./chunk-KBBITJSF.js";import{D as H}from"./chunk-GFWXVO72.js";import{a as q}from"./chunk-VJEKDBGZ.js";import{f as I}from"./chunk-SPE2D366.js";import{a as O,o as D,w as k}from"./chunk-WSCSFFLH.js";import{h as N}from"./chunk-BI7LE6CZ.js";import{Ab as h,Ca as F,Ta as A,Ua as P,bb as y,na as R,wa as g}from"./chunk-HQUWYKSJ.js";import{f as S}from"./chunk-4VJ6YK7U.js";import{d as x,e as E,g as v,i as C}from"./chunk-773TIA5M.js";import{e as X,g as m}from"./chunk-VKWPEFWQ.js";m();function w(){return process.hrtime()}function M(r){let t=process.hrtime(r);return(t[0]*1e3+t[1]/1e6).toFixed(2)}m();m();var $=X(q(),1),G=200,K=6e4,L=200,Q=500,_=class{currentEvents=[];extensionPaths=[];app;options;onChangeCallback;watcher;debouncedEmit;ignored={};extensionWatchedFiles=new Map;constructor(t,e,s=G){this.app=t,this.options=e,this.debouncedEmit=k(this.emitEvents.bind(this),s,{leading:!0,trailing:!0}),this.updateApp(t)}onChange(t){this.onChangeCallback=t}async start(){let e=[...this.app.configuration.extension_directories??["extensions"]].map(n=>x(this.app.directory,n));await Promise.all(e.map(async n=>{try{await g(n.replace(/\/\*+$/,""))}catch{}}));let s=[this.app.configPath,...e],i=this.getAllWatchedFiles();s.push(...i),this.close();let{default:o}=await import("./chokidar-5RWEYTNQ.js");this.watcher=o.watch(s,{ignored:["**/node_modules/**","**/.git/**"],persistent:!0,ignoreInitial:!0}),this.watcher.on("all",this.handleFileEvent),this.addAbortListener(),h(`File watcher started with ${s.length} paths`,this.options.stdout)}updateApp(t){this.app=t,this.extensionPaths=this.app.nonConfigExtensions.map(e=>E(e.directory)).filter(e=>e!==this.app.directory),this.extensionPaths.forEach(e=>{this.ignored[e]??=this.createIgnoreInstance(e)})}addAbortListener(){this.options.signal.removeEventListener("abort",this.close),this.options.signal.addEventListener("abort",this.close)}getAllWatchedFiles(){this.extensionWatchedFiles.clear();let t=this.app.realExtensions.map(s=>({extension:s,watchedFiles:s.watchedFiles()})),e=new Set;for(let{extension:s,watchedFiles:i}of t)for(let o of i){let n=E(o);e.add(n);let a=this.extensionWatchedFiles.get(n)??new Set;a.add(s.handle),this.extensionWatchedFiles.set(n,a)}return Array.from(e)}emitEvents=()=>{let t=this.currentEvents;this.currentEvents=[];let e=`\u{1F509} ${t.length} EVENTS EMITTED in files: ${t.map(s=>s.path).join(`
1
+ import{a as U}from"./chunk-7LWUHQIF.js";import{D as H}from"./chunk-ZZRFG6ME.js";import{a as q}from"./chunk-VJEKDBGZ.js";import{b as I}from"./chunk-XOCB4KNX.js";import{a as O,o as D,w as k}from"./chunk-YFINLODF.js";import{h as N}from"./chunk-BWJIZYAG.js";import{Ab as h,Ca as F,Ta as A,Ua as P,bb as y,na as R,wa as g}from"./chunk-VFM2KQRM.js";import{f as S}from"./chunk-R6ICQT2D.js";import{d as x,e as E,g as v,i as C}from"./chunk-773TIA5M.js";import{e as X,g as m}from"./chunk-VKWPEFWQ.js";m();function w(){return process.hrtime()}function M(r){let t=process.hrtime(r);return(t[0]*1e3+t[1]/1e6).toFixed(2)}m();m();var $=X(q(),1),G=200,K=6e4,L=200,Q=500,_=class{currentEvents=[];extensionPaths=[];app;options;onChangeCallback;watcher;debouncedEmit;ignored={};extensionWatchedFiles=new Map;constructor(t,e,s=G){this.app=t,this.options=e,this.debouncedEmit=k(this.emitEvents.bind(this),s,{leading:!0,trailing:!0}),this.updateApp(t)}onChange(t){this.onChangeCallback=t}async start(){let e=[...this.app.configuration.extension_directories??["extensions"]].map(n=>x(this.app.directory,n));await Promise.all(e.map(async n=>{try{await g(n.replace(/\/\*+$/,""))}catch{}}));let s=[this.app.configPath,...e],i=this.getAllWatchedFiles();s.push(...i),this.close();let{default:o}=await import("./chokidar-5RWEYTNQ.js");this.watcher=o.watch(s,{ignored:["**/node_modules/**","**/.git/**"],persistent:!0,ignoreInitial:!0}),this.watcher.on("all",this.handleFileEvent),this.addAbortListener(),h(`File watcher started with ${s.length} paths`,this.options.stdout)}updateApp(t){this.app=t,this.extensionPaths=this.app.nonConfigExtensions.map(e=>E(e.directory)).filter(e=>e!==this.app.directory),this.extensionPaths.forEach(e=>{this.ignored[e]??=this.createIgnoreInstance(e)})}addAbortListener(){this.options.signal.removeEventListener("abort",this.close),this.options.signal.addEventListener("abort",this.close)}getAllWatchedFiles(){this.extensionWatchedFiles.clear();let t=this.app.realExtensions.map(s=>({extension:s,watchedFiles:s.watchedFiles()})),e=new Set;for(let{extension:s,watchedFiles:i}of t)for(let o of i){let n=E(o);e.add(n);let a=this.extensionWatchedFiles.get(n)??new Set;a.add(s.handle),this.extensionWatchedFiles.set(n,a)}return Array.from(e)}emitEvents=()=>{let t=this.currentEvents;this.currentEvents=[];let e=`\u{1F509} ${t.length} EVENTS EMITTED in files: ${t.map(s=>s.path).join(`
2
2
  `)}`;h(e,this.options.stdout),this.onChangeCallback?.(t)};pushEvent(t){this.shouldIgnoreEvent(t)||(t.type==="extension_folder_created"&&(this.ignored[t.path]=this.createIgnoreInstance(t.path)),!this.currentEvents.some(e=>e.path===t.path&&e.type===t.type&&e.extensionHandle===t.extensionHandle)&&this.currentEvents.push(t))}shouldIgnoreEvent(t){if(t.type==="extension_folder_deleted"||t.type==="extension_folder_created"||t.extensionHandle&&this.extensionWatchedFiles.get(E(t.path))?.has(t.extensionHandle))return!1;let s=(t.extensionHandle?this.app.realExtensions.find(o=>o.handle===t.extensionHandle):void 0)?.watchedFiles(),i=this.ignored[t.extensionPath];if(s)return!s.some(n=>y(t.path,n));if(i){let o=v(t.extensionPath,t.path);return i.ignores(o)}return!1}handleFileEvent=(t,e)=>{let s=w(),i=E(e),o=e===this.app.configPath,n=e.endsWith(".extension.toml");if(h(`\u{1F300}: ${t} ${e.replace(this.app.directory,"")}
3
3
  `),o)this.handleEventForExtension(t,e,this.app.directory,s,!1);else{let a=this.extensionWatchedFiles.get(i),d=a===void 0||a.size===0;if(d&&t==="add"&&!n){let c=this.discoverFileOwners(i);c.size>0&&(this.extensionWatchedFiles.set(i,c),a=c,d=!1)}if(d&&!n&&!o){h(`\u{1F300}: File ${e} is not watched by any extension`,this.options.stdout);return}for(let c of a??[]){let l=this.app.realExtensions.find(f=>f.handle===c),u=l?E(l.directory):this.app.directory;this.handleEventForExtension(t,e,u,s,!1,c)}d&&this.handleEventForExtension(t,e,this.app.directory,s,!0)}this.debouncedEmit()};discoverFileOwners(t){let e=new Set;for(let s of this.app.realExtensions){let i=E(s.directory);i!==this.app.directory&&t.startsWith(`${i}/`)&&this.pathMatchesWatchPatterns(t,s)&&e.add(s.handle)}return e}pathMatchesWatchPatterns(t,e){let{paths:s,ignore:i}=e.watchPatterns(),o=v(E(e.directory),t);return i.some(n=>y(o,n))?!1:s.some(n=>y(o,n))}handleEventForExtension(t,e,s,i,o,n){let a=e.endsWith(".extension.toml"),d=e===this.app.configPath;switch(t){case"change":if(o)break;a||d?this.pushEvent({type:"extensions_config_updated",path:e,extensionPath:s,extensionHandle:n,startTime:i}):this.pushEvent({type:"file_updated",path:e,extensionPath:s,extensionHandle:n,startTime:i});break;case"add":if(!a){this.pushEvent({type:"file_created",path:e,extensionPath:s,extensionHandle:n,startTime:i});break}let c=0,l=C(e),u=setInterval(()=>{P(x(l,I.lockFile))?(h(`Waiting for extension to complete creation: ${e}
4
4
  `),c+=L):(clearInterval(u),this.extensionPaths.push(l),this.pushEvent({type:"extension_folder_created",path:l,extensionPath:s,startTime:i}),this.debouncedEmit()),c>=K&&(clearInterval(u),this.options.stderr.write(`Error loading new extension at path: ${e}.
@@ -1 +1 @@
1
- import{D as h,E as e,F as r,J as o,K as s,n}from"./chunk-WSCSFFLH.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();async function y(){await h({message:"Associate your project with the org Castile Ventures?",choices:[{label:"first",value:"first",disabled:!0},{label:"second",value:"second"},{label:"third (limit reached)",value:"third",disabled:!0},{label:"fourth (limit reached)",value:"fourth",disabled:!0},{label:"fifth",value:"fifth",group:"Automations",disabled:!0},{label:"sixth",value:"sixth",group:"Automations"},{label:"seventh",value:"seventh"},{label:"eighth (limit reached)",value:"eighth",group:"Merchant Admin",disabled:!0},{label:"ninth",value:"ninth",group:"Merchant Admin"},{label:"tenth",value:"tenth"}],infoTable:[{header:"add",items:["new-ext"],bullet:"+"},{header:"remove",items:["integrated-demand-ext","order-discount"],bullet:"-"}]}),await o({message:"App project name (can be changed later)",defaultValue:"expansive commerce app",validate:t=>{if(t.includes("shopify"))return`Can't include "shopify" in the name`}});let l=[{label:"first",value:"first"},{label:"second",value:"second"},{label:"third",value:"third"},{label:"fourth",value:"fourth"},{label:"fifth",value:"fifth"},{label:"sixth",value:"sixth"},{label:"seventh",value:"seventh"},{label:"eighth",value:"eighth"},{label:"ninth",value:"ninth"},{label:"tenth",value:"tenth"},{label:"eleventh",value:"eleventh"},{label:"twelfth",value:"twelfth"},{label:"thirteenth",value:"thirteenth"},{label:"fourteenth",value:"fourteenth"},{label:"fifteenth",value:"fifteenth"},{label:"sixteenth",value:"sixteenth"},{label:"seventeenth",value:"seventeenth"},{label:"eighteenth",value:"eighteenth"},{label:"nineteenth",value:"nineteenth"},{label:"twentieth",value:"twentieth"},{label:"twenty-first",value:"twenty-first"},{label:"twenty-second",value:"twenty-second"},{label:"twenty-third",value:"twenty-third"},{label:"twenty-fourth",value:"twenty-fourth"},{label:"twenty-fifth",value:"twenty-fifth"},{label:"twenty-sixth",value:"twenty-sixth"},{label:"twenty-seventh",value:"twenty-seventh"},{label:"twenty-eighth",value:"twenty-eighth"},{label:"twenty-ninth",value:"twenty-ninth"},{label:"thirtieth",value:"thirtieth"},{label:"thirty-first",value:"thirty-first"},{label:"thirty-second",value:"thirty-second"},{label:"thirty-third",value:"thirty-third"},{label:"thirty-fourth",value:"thirty-fourth"},{label:"thirty-fifth",value:"thirty-fifth"},{label:"thirty-sixth",value:"thirty-sixth"},{label:"thirty-seventh",value:"thirty-seventh"},{label:"thirty-eighth",value:"thirty-eighth"},{label:"thirty-ninth",value:"thirty-ninth"},{label:"fortieth",value:"fortieth"},{label:"forty-first",value:"forty-first"},{label:"forty-second",value:"forty-second"},{label:"forty-third",value:"forty-third"},{label:"forty-fourth",value:"forty-fourth"},{label:"forty-fifth",value:"forty-fifth"},{label:"forty-sixth",value:"forty-sixth"},{label:"forty-seventh",value:"forty-seventh"},{label:"forty-eighth",value:"forty-eighth"},{label:"forty-ninth",value:"forty-ninth"},{label:"fiftieth",value:"fiftieth"}];await r({message:"Template",choices:l,search(t){return Promise.resolve({data:l.filter(f=>f.label.includes(t))})}});let a=[["first theme",{subdued:"(#1)"}],["second theme",{subdued:"(#2)"}]];await e({message:"Add the following themes to the store?",infoTable:{"":a},confirmationMessage:"Yes, add them",cancellationMessage:"Cancel"});let u={title:{color:"red",text:`${n.warning} This can't be undone.`},body:"The action you are executing should be confirmed to proceed."};await e({message:"Delete the following themes from the store?",infoTable:{"":a},infoMessage:u,confirmationMessage:"Yes, delete them",cancellationMessage:"Cancel",defaultValue:!1}),await e({message:["Make the following changes to your",{filePath:".env"},"file?"],defaultValue:!0,confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later"}),await s({message:"Release this version of Mega App?",infoTable:[{header:"Includes",items:["My subscription extension","Order discount function","Subscription cancelled trigger","Add subscription action"],bullet:"+"},{header:"Removes",items:["product-discount-function","product-subscription-extension"],bullet:"-"}],confirmation:"Mega App"})}export{y as a};
1
+ import{D as h,E as e,F as r,J as o,K as s,n}from"./chunk-YFINLODF.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();async function y(){await h({message:"Associate your project with the org Castile Ventures?",choices:[{label:"first",value:"first",disabled:!0},{label:"second",value:"second"},{label:"third (limit reached)",value:"third",disabled:!0},{label:"fourth (limit reached)",value:"fourth",disabled:!0},{label:"fifth",value:"fifth",group:"Automations",disabled:!0},{label:"sixth",value:"sixth",group:"Automations"},{label:"seventh",value:"seventh"},{label:"eighth (limit reached)",value:"eighth",group:"Merchant Admin",disabled:!0},{label:"ninth",value:"ninth",group:"Merchant Admin"},{label:"tenth",value:"tenth"}],infoTable:[{header:"add",items:["new-ext"],bullet:"+"},{header:"remove",items:["integrated-demand-ext","order-discount"],bullet:"-"}]}),await o({message:"App project name (can be changed later)",defaultValue:"expansive commerce app",validate:t=>{if(t.includes("shopify"))return`Can't include "shopify" in the name`}});let l=[{label:"first",value:"first"},{label:"second",value:"second"},{label:"third",value:"third"},{label:"fourth",value:"fourth"},{label:"fifth",value:"fifth"},{label:"sixth",value:"sixth"},{label:"seventh",value:"seventh"},{label:"eighth",value:"eighth"},{label:"ninth",value:"ninth"},{label:"tenth",value:"tenth"},{label:"eleventh",value:"eleventh"},{label:"twelfth",value:"twelfth"},{label:"thirteenth",value:"thirteenth"},{label:"fourteenth",value:"fourteenth"},{label:"fifteenth",value:"fifteenth"},{label:"sixteenth",value:"sixteenth"},{label:"seventeenth",value:"seventeenth"},{label:"eighteenth",value:"eighteenth"},{label:"nineteenth",value:"nineteenth"},{label:"twentieth",value:"twentieth"},{label:"twenty-first",value:"twenty-first"},{label:"twenty-second",value:"twenty-second"},{label:"twenty-third",value:"twenty-third"},{label:"twenty-fourth",value:"twenty-fourth"},{label:"twenty-fifth",value:"twenty-fifth"},{label:"twenty-sixth",value:"twenty-sixth"},{label:"twenty-seventh",value:"twenty-seventh"},{label:"twenty-eighth",value:"twenty-eighth"},{label:"twenty-ninth",value:"twenty-ninth"},{label:"thirtieth",value:"thirtieth"},{label:"thirty-first",value:"thirty-first"},{label:"thirty-second",value:"thirty-second"},{label:"thirty-third",value:"thirty-third"},{label:"thirty-fourth",value:"thirty-fourth"},{label:"thirty-fifth",value:"thirty-fifth"},{label:"thirty-sixth",value:"thirty-sixth"},{label:"thirty-seventh",value:"thirty-seventh"},{label:"thirty-eighth",value:"thirty-eighth"},{label:"thirty-ninth",value:"thirty-ninth"},{label:"fortieth",value:"fortieth"},{label:"forty-first",value:"forty-first"},{label:"forty-second",value:"forty-second"},{label:"forty-third",value:"forty-third"},{label:"forty-fourth",value:"forty-fourth"},{label:"forty-fifth",value:"forty-fifth"},{label:"forty-sixth",value:"forty-sixth"},{label:"forty-seventh",value:"forty-seventh"},{label:"forty-eighth",value:"forty-eighth"},{label:"forty-ninth",value:"forty-ninth"},{label:"fiftieth",value:"fiftieth"}];await r({message:"Template",choices:l,search(t){return Promise.resolve({data:l.filter(f=>f.label.includes(t))})}});let a=[["first theme",{subdued:"(#1)"}],["second theme",{subdued:"(#2)"}]];await e({message:"Add the following themes to the store?",infoTable:{"":a},confirmationMessage:"Yes, add them",cancellationMessage:"Cancel"});let u={title:{color:"red",text:`${n.warning} This can't be undone.`},body:"The action you are executing should be confirmed to proceed."};await e({message:"Delete the following themes from the store?",infoTable:{"":a},infoMessage:u,confirmationMessage:"Yes, delete them",cancellationMessage:"Cancel",defaultValue:!1}),await e({message:["Make the following changes to your",{filePath:".env"},"file?"],defaultValue:!0,confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later"}),await s({message:"Release this version of Mega App?",infoTable:[{header:"Includes",items:["My subscription extension","Order discount function","Subscription cancelled trigger","Add subscription action"],bullet:"+"},{header:"Removes",items:["product-discount-function","product-subscription-extension"],bullet:"-"}],confirmation:"Mega App"})}export{y as a};
@@ -1 +1 @@
1
- import{o as n}from"./chunk-GW4JHUIA.js";import{H as s}from"./chunk-WSCSFFLH.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();async function c(e){await s([{title:"Installing dependencies",task:async()=>{await n({packageManager:e.packageManager,directory:e.directory,deep:3})}}])}export{c as a};
1
+ import{o as n}from"./chunk-Y5PRPHLQ.js";import{H as s}from"./chunk-YFINLODF.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();async function c(e){await s([{title:"Installing dependencies",task:async()=>{await n({packageManager:e.packageManager,directory:e.directory,deep:3})}}])}export{c as a};
@@ -1,2 +1,2 @@
1
- import{Ab as n,Ta as o,qb as e,sb as r,ua as d,wa as f}from"./chunk-HQUWYKSJ.js";import{d as i}from"./chunk-773TIA5M.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{Ab as n,Ta as o,qb as e,sb as r,ua as d,wa as f}from"./chunk-VFM2KQRM.js";import{d as i}from"./chunk-773TIA5M.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 +1 @@
1
- import{H as m,I as d,x as c}from"./chunk-WSCSFFLH.js";import{pb as w,qb as n,sb as a}from"./chunk-HQUWYKSJ.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{H as m,I as d,x as c}from"./chunk-YFINLODF.js";import{pb as w,qb as n,sb as a}from"./chunk-VFM2KQRM.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,3 @@
1
+ import{a as I}from"./chunk-LFOBYEWG.js";import{i as d,r as w,v as n}from"./chunk-3JXPOOFV.js";import{w as l}from"./chunk-Y5PRPHLQ.js";import{A as y,B as N,S,y as g}from"./chunk-YFINLODF.js";import{a as h}from"./chunk-VASGXHYA.js";import{m as u,n as m}from"./chunk-YZMY2CTU.js";import{j as _}from"./chunk-BWJIZYAG.js";import{Ab as a}from"./chunk-VFM2KQRM.js";import{a as f}from"./chunk-JD5P5RAJ.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();var C="https://cdn.shopify.com/static/cli/notifications.json",T="Cache is empty",O=["notifications:list","notifications:generate","init","app:init","theme:init","hydrogen:init","cache:clear","send-analytics"],$=["127.0.0.1","localhost","::1","[::1]"];function c(){let e=process.env.SHOPIFY_CLI_NOTIFICATIONS_URL;if(e)try{let t=new globalThis.URL(e);if(v(t))return e;a(`The notifications URL provided via SHOPIFY_CLI_NOTIFICATIONS_URL (${e}) must use https, or http with a loopback host. Falling back to default.`)}catch{a(`The notifications URL provided via SHOPIFY_CLI_NOTIFICATIONS_URL (${e}) is not a valid URL. Falling back to default.`)}return C}function v(e){return e.protocol==="https:"?!0:e.protocol==="http:"&&$.includes(e.hostname)}var E=n.object({id:n.string(),message:n.string(),type:n.enum(["info","warning","error"]),frequency:n.enum(["always","once","once_a_day","once_a_week"]),ownerChannel:n.string(),cta:n.object({label:n.string(),url:n.string().url()}).optional(),title:n.string().optional(),minVersion:n.string().optional(),maxVersion:n.string().optional(),minDate:n.string().optional(),maxDate:n.string().optional(),commands:n.array(n.string()).optional(),surface:n.string().optional()}),x=n.object({notifications:n.array(E)});async function Z(e,t=process.env){try{let r=I();if(D(r,t)||d(t))return;let o=await k(),i=A(o.notifications,r,e);a(`Notifications to show: ${i.length}`),await L(i)}catch(r){if(r.message===T){a("Notifications to show: 0 (Cache is empty)");return}if(r.message==="abort")throw new _;let o=`Error showing notifications: ${r.message}`;a(o);let{sendErrorToBugsnag:i}=await import("./error-handler-PIGEJ7BT.js");await i(o,"unexpected_error")}}function D(e,t=process.env){return f(t.CI)||f(t.SHOPIFY_UNIT_TEST)||O.includes(e)}async function L(e){e.slice(0,2).forEach(t=>{let r={headline:t.title,body:t.message.replace(/\\n/g,`
2
+ `),link:t.cta};switch(t.type){case"info":{g(r);break}case"warning":{y(r);break}case"error":throw N(r),new Error("abort")}u(`notification-${t.id}`,new Date().getTime().toString())})}async function k(){let e=`notifications-${c()}`,t=m(e)?.value;if(!t)throw new Error(T);let r=JSON.parse(t);return x.parse(r)}async function ee(){a("Fetching notifications...");let e=await w(c(),void 0,{useNetworkLevelRetry:!1,useAbortSignal:!0,timeoutMs:3*1e3});if(e.status!==200)throw new Error(`Failed to fetch notifications: ${e.statusText}`);let t=await e.text(),r=JSON.parse(t),o=x.parse(r);return await F(t),o}async function F(e){u(`notifications-${c()}`,e),a(`Notifications from ${c()} stored in the cache`)}function te(e,t=process.argv,r=process.env){if(D(e,r)||!t[1])return;let o=process.execPath,s=[t[1],"notifications","list","--ignore-errors"];S(o,s,{background:!0,env:{...process.env,SHOPIFY_CLI_NO_ANALYTICS:"1"},externalErrorHandler:async b=>{a(`Failed to fetch notifications in background: ${b.message}`)}})}function A(e,t,r,o=new Date(new Date().setUTCHours(0,0,0,0)),i=h){return e.filter(s=>V(s,i)).filter(s=>B(s,o)).filter(s=>R(s,t)).filter(s=>U(s,t,r)).filter(s=>H(s))}function V(e,t){let r=!e.minVersion||l(t,`>=${e.minVersion}`),o=!e.maxVersion||l(t,`<=${e.maxVersion}`);return r&&o}function B(e,t){let r=!e.minDate||new Date(e.minDate)<=t,o=!e.maxDate||new Date(e.maxDate)>=t;return r&&o}function R(e,t){return t===""?!0:!e.commands||e.commands.includes(t)}function U(e,t,r){let o=t.split(":")[0]??"all",i=e.surface??"all";return r?r.includes(i):i===o||i==="all"}function H(e){if(!e.frequency)return!0;let t=`notification-${e.id}`,r=m(t)?.value;if(!r)return!0;switch(e.frequency){case"always":return!0;case"once":return!1;case"once_a_day":return new Date().getTime()-Number(r)>24*3600*1e3;case"once_a_week":return new Date().getTime()-Number(r)>168*3600*1e3}}function re(e){let t=[];return e.minDate&&t.push(`from ${e.minDate}`),e.maxDate&&t.push(`to ${e.maxDate}`),e.minVersion&&t.push(`from v${e.minVersion}`),e.maxVersion&&t.push(`to v${e.maxVersion}`),e.frequency==="once"&&t.push("show only once"),e.frequency==="once_a_day"&&t.push("show once a day"),e.frequency==="once_a_week"&&t.push("show once a week"),e.surface&&t.push(`surface = ${e.surface}`),e.commands&&t.push(`commands = ${e.commands.join(", ")}`),t.join(`
3
+ `)}export{Z as a,k as b,ee as c,te as d,A as e,re as f};
@@ -1 +1 @@
1
- import{b as a}from"./chunk-6R62DGJG.js";import{b as s}from"./chunk-3WV7DQMM.js";import{Ha as i}from"./chunk-PK73ZSND.js";import{a as m}from"./chunk-CTNBSUVU.js";import{e as d,g as e}from"./chunk-VKWPEFWQ.js";e();var n=d(m(),1);var t=class c extends s{static description="List current notifications configured for the CLI.";static hidden=!0;static flags={"ignore-errors":n.Flags.boolean({hidden:!1,description:"Don't fail if an error occurs.",env:"SHOPIFY_FLAG_IGNORE_ERRORS"})};async run(){let{flags:f}=await this.parse(c);try{await a()}catch(r){let o="Error fetching notifications";if(r instanceof Error&&(o=o.concat(`: ${r.message}`)),await i(o,"expected_error"),!f["ignore-errors"])throw r}}};export{t as a};
1
+ import{b as a}from"./chunk-BZ73NV3L.js";import{b as s}from"./chunk-2XDUJQQN.js";import{Ia as i}from"./chunk-3JXPOOFV.js";import{a as m}from"./chunk-CTNBSUVU.js";import{e as d,g as e}from"./chunk-VKWPEFWQ.js";e();var n=d(m(),1);var t=class c extends s{static description="List current notifications configured for the CLI.";static hidden=!0;static flags={"ignore-errors":n.Flags.boolean({hidden:!1,description:"Don't fail if an error occurs.",env:"SHOPIFY_FLAG_IGNORE_ERRORS"})};async run(){let{flags:f}=await this.parse(c);try{await a()}catch(r){let o="Error fetching notifications";if(r instanceof Error&&(o=o.concat(`: ${r.message}`)),await i(o,"expected_error"),!f["ignore-errors"])throw r}}};export{t as a};