shopify 5.0.2 → 5.2.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 (529) hide show
  1. package/dist/analytics-23GM6KJU.js +1 -0
  2. package/dist/analytics-743FYOAE.js +1 -0
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/{chunk-RPCIFYCY.js → chunk-2EQRXSF6.js} +2 -2
  5. package/dist/{chunk-NXAEBGMO.js → chunk-2IXP3IPE.js} +1 -1
  6. package/dist/{chunk-T4XJKM6B.js → chunk-2KACAQJS.js} +1 -1
  7. package/dist/chunk-2KFYIYLI.js +1 -0
  8. package/dist/chunk-2OCSYLKZ.js +1 -0
  9. package/dist/{chunk-AQKWPRZE.js → chunk-2PILNMHJ.js} +2 -2
  10. package/dist/chunk-36S6MFJQ.js +47 -0
  11. package/dist/{chunk-TFPW2VGN.js → chunk-3DB4EC62.js} +1 -1
  12. package/dist/chunk-3GL3IT4K.js +16 -0
  13. package/dist/{chunk-C3RFAKWR.js → chunk-3JRB7Q3T.js} +1 -1
  14. package/dist/chunk-3KGN6N7E.js +1 -0
  15. package/dist/chunk-3OYMK5X6.js +11 -0
  16. package/dist/chunk-3PYDIBTX.js +1 -0
  17. package/dist/chunk-422BGHXN.js +1 -0
  18. package/dist/chunk-43C32FUQ.js +1 -0
  19. package/dist/chunk-4AN7ECPE.js +9 -0
  20. package/dist/chunk-4AWVU2OV.js +1 -0
  21. package/dist/chunk-4IP37MBX.js +1 -0
  22. package/dist/chunk-4KBOLN7Q.js +8 -0
  23. package/dist/chunk-4LJERO23.js +89 -0
  24. package/dist/chunk-4M5WHOZW.js +1 -0
  25. package/dist/chunk-4RO35FFQ.js +1 -0
  26. package/dist/chunk-4ZS5354G.js +3 -0
  27. package/dist/chunk-55AWBPKU.js +7 -0
  28. package/dist/chunk-5BUYR23E.js +1 -0
  29. package/dist/chunk-5EDA7PVE.js +11 -0
  30. package/dist/{chunk-UKWIWCOH.js → chunk-5P6OELKZ.js} +1 -1
  31. package/dist/chunk-5PVXLQNX.js +1 -0
  32. package/dist/{chunk-J5ERDFIC.js → chunk-5S2P4MHJ.js} +1 -1
  33. package/dist/{chunk-26PWHH3B.js → chunk-5TJJVSCI.js} +1 -1
  34. package/dist/chunk-5TOK5OJS.js +1 -0
  35. package/dist/chunk-5ZG2SWU2.js +1 -0
  36. package/dist/{chunk-SLY27GDC.js → chunk-62F4ZMSC.js} +2 -2
  37. package/dist/chunk-652NT7OW.js +1 -0
  38. package/dist/chunk-6B5KM3A4.js +97 -0
  39. package/dist/chunk-6LCESSY3.js +1 -0
  40. package/dist/chunk-6QHDMCAA.js +1 -0
  41. package/dist/{chunk-D2KIGKBI.js → chunk-7A4ZE5IS.js} +60 -60
  42. package/dist/{chunk-CGVROSPS.js → chunk-7AQZKPJU.js} +1 -1
  43. package/dist/chunk-7FBOMPO5.js +203 -0
  44. package/dist/chunk-7HECBXSP.js +1 -0
  45. package/dist/chunk-7UK565VJ.js +1 -0
  46. package/dist/{chunk-LHXFTFFM.js → chunk-A5BSUUNQ.js} +1 -1
  47. package/dist/chunk-ADGE7MKB.js +1 -0
  48. package/dist/chunk-AEWRZ7AE.js +1 -0
  49. package/dist/chunk-ALDJTWCO.js +1 -0
  50. package/dist/chunk-ARL5WBDK.js +1 -0
  51. package/dist/chunk-AXFEIJC7.js +1 -0
  52. package/dist/{chunk-KZRLZWOU.js → chunk-AYGL6F3P.js} +1 -1
  53. package/dist/{chunk-URXM5A2K.js → chunk-AYTTE7X5.js} +1 -1
  54. package/dist/{chunk-3ODQKAEA.js → chunk-BDIZUTKC.js} +1 -1
  55. package/dist/chunk-BQKF4SRH.js +6 -0
  56. package/dist/chunk-C2AOCLEZ.js +1 -0
  57. package/dist/{chunk-WRZWHT6M.js → chunk-C2SGJ5IG.js} +1 -1
  58. package/dist/chunk-C3S3UMV3.js +1 -0
  59. package/dist/{chunk-WBJ6ZHYH.js → chunk-C5DKLOW4.js} +37 -37
  60. package/dist/chunk-C72QNK6O.js +4 -0
  61. package/dist/{chunk-6ES4KRFW.js → chunk-CA3GVT4D.js} +1 -1
  62. package/dist/chunk-CCLU5ZRK.js +9 -0
  63. package/dist/chunk-CE6XQDAG.js +10 -0
  64. package/dist/chunk-CEJ5WS4I.js +5 -0
  65. package/dist/{chunk-VEUKT5EI.js → chunk-CIBBQO2L.js} +2 -2
  66. package/dist/{chunk-IILLQOUC.js → chunk-CKJXJ6HD.js} +1 -1
  67. package/dist/{chunk-MEYVUHQH.js → chunk-COGKVNQB.js} +1 -1
  68. package/dist/chunk-CQAD5WML.js +1 -0
  69. package/dist/chunk-CQPZOXWO.js +6 -0
  70. package/dist/{chunk-62EOM3Y2.js → chunk-CZYQIWNL.js} +1 -1
  71. package/dist/chunk-DA5RQFXA.js +10 -0
  72. package/dist/{chunk-7GHSE7SG.js → chunk-DDRP6QTC.js} +1 -1
  73. package/dist/{chunk-Q5IC3IYY.js → chunk-DESZFFOK.js} +1 -1
  74. package/dist/{chunk-PLSS456F.js → chunk-DKR7562G.js} +1 -1
  75. package/dist/{chunk-LGXI7EGM.js → chunk-DNNTAMC5.js} +2 -2
  76. package/dist/chunk-DUPQUQ2Z.js +1 -0
  77. package/dist/{chunk-Q4JYAUVL.js → chunk-DUTIWCJ2.js} +1 -1
  78. package/dist/chunk-E6JEBSHZ.js +20 -0
  79. package/dist/chunk-E6KNAPIY.js +4 -0
  80. package/dist/chunk-E7XCCLQH.js +1 -0
  81. package/dist/chunk-EE72PCKT.js +1 -0
  82. package/dist/chunk-EEYXBKR7.js +4 -0
  83. package/dist/{chunk-ZRI3SSLG.js → chunk-EGLA3WLZ.js} +2 -2
  84. package/dist/chunk-EVQPYZ7F.js +5 -0
  85. package/dist/chunk-FDFE3SSG.js +35 -0
  86. package/dist/{chunk-Q7BOSHWX.js → chunk-FDSNRKGQ.js} +1 -1
  87. package/dist/chunk-FI5TQHUA.js +1 -0
  88. package/dist/chunk-FIKZQ4RA.js +1 -0
  89. package/dist/chunk-FJOVMEPN.js +3 -0
  90. package/dist/{chunk-ER6C5WS3.js → chunk-FLARCZ5F.js} +1 -1
  91. package/dist/chunk-FOMMPAWZ.js +1 -0
  92. package/dist/{chunk-6PUU6ZNQ.js → chunk-FRWQJAW2.js} +1 -1
  93. package/dist/{chunk-HXZAY5OA.js → chunk-G3DXNSA2.js} +1 -1
  94. package/dist/{chunk-XWSWXQCC.js → chunk-G7JO3W2R.js} +1 -1
  95. package/dist/{chunk-WESTVWWD.js → chunk-GABIWYY3.js} +1 -1
  96. package/dist/chunk-GFSEU7PF.js +6 -0
  97. package/dist/chunk-GFVUWVEM.js +1 -0
  98. package/dist/{chunk-ISKQQXLZ.js → chunk-GHNSXX7R.js} +1 -1
  99. package/dist/{chunk-2L6AN3QA.js → chunk-GQ3LY7BY.js} +1 -1
  100. package/dist/{chunk-2A2JSAAA.js → chunk-H45S4MGC.js} +1 -1
  101. package/dist/chunk-HEB4YYM6.js +9 -0
  102. package/dist/{chunk-CXI3RHPW.js → chunk-HI5FTI3M.js} +1 -1
  103. package/dist/chunk-HJ24NEP5.js +1 -0
  104. package/dist/chunk-HQFXVVTB.js +1 -0
  105. package/dist/{chunk-TODZ3TJR.js → chunk-HR6R7JXN.js} +1 -1
  106. package/dist/chunk-HRHJA5ZP.js +3 -0
  107. package/dist/{chunk-QEKGGTMN.js → chunk-HT5JQJMB.js} +1 -1
  108. package/dist/chunk-HT7273V7.js +1 -0
  109. package/dist/{chunk-UXVXVI6O.js → chunk-HUB4HDWN.js} +78 -76
  110. package/dist/chunk-IATNIWOC.js +13 -0
  111. package/dist/chunk-IHVWDKDV.js +2 -0
  112. package/dist/{chunk-3KM5ZOW2.js → chunk-IKXUYCK7.js} +1 -1
  113. package/dist/chunk-IVQN2RUP.js +1 -0
  114. package/dist/chunk-IWNFPBH2.js +33 -0
  115. package/dist/{chunk-ESFCYB46.js → chunk-J324ZPO6.js} +1 -1
  116. package/dist/{chunk-KNWT7JLL.js → chunk-JJQ3DJG5.js} +2 -2
  117. package/dist/{chunk-7CCTPBCT.js → chunk-JLAN6JXJ.js} +1 -1
  118. package/dist/chunk-K2GCCCCV.js +1 -0
  119. package/dist/{chunk-NVKJ7ZLP.js → chunk-K4KKSBUW.js} +1 -1
  120. package/dist/{chunk-BAHIL37I.js → chunk-K4QJEQI4.js} +1 -1
  121. package/dist/{chunk-QDCLL5OI.js → chunk-K5UVCBIP.js} +1 -1
  122. package/dist/{chunk-64G5TGFF.js → chunk-KN2JIDNO.js} +1 -1
  123. package/dist/chunk-KORVOCNN.js +1 -0
  124. package/dist/chunk-KRQCQ57O.js +1 -0
  125. package/dist/{chunk-3MYDSQHF.js → chunk-KT2AMFVW.js} +1 -1
  126. package/dist/chunk-L23Q53FM.js +70 -0
  127. package/dist/{chunk-UBP3LQFY.js → chunk-L3DTONOI.js} +2 -2
  128. package/dist/{chunk-BN7ZXAZJ.js → chunk-LG3KEHGD.js} +2 -2
  129. package/dist/chunk-LRETOC6P.js +1 -0
  130. package/dist/chunk-LXFWK3O2.js +1 -0
  131. package/dist/chunk-LZ2TN7EZ.js +1 -0
  132. package/dist/chunk-MBAPM5HA.js +15 -0
  133. package/dist/{chunk-UUAKOX7E.js → chunk-MGZK5EQW.js} +2 -2
  134. package/dist/chunk-MKUXSM33.js +1 -0
  135. package/dist/chunk-MQ55QUOJ.js +276 -0
  136. package/dist/chunk-NAQJMRPT.js +2296 -0
  137. package/dist/{chunk-DZKFP6H2.js → chunk-NMXRDF4T.js} +1 -1
  138. package/dist/chunk-NOWM3CCG.js +1 -0
  139. package/dist/chunk-NVDFXEQ5.js +5 -0
  140. package/dist/{chunk-CX5CC6P5.js → chunk-O472FAYX.js} +1 -1
  141. package/dist/{chunk-B2O3ANRZ.js → chunk-OCILF2DD.js} +1 -1
  142. package/dist/{chunk-67L7FIB6.js → chunk-OGBMFGYC.js} +1 -1
  143. package/dist/chunk-OIQ5NQ5I.js +18 -0
  144. package/dist/chunk-OKRKVVTK.js +103 -0
  145. package/dist/chunk-ONNUEQGR.js +3 -0
  146. package/dist/chunk-OSASE35V.js +6 -0
  147. package/dist/chunk-OTMTS5L4.js +3 -0
  148. package/dist/chunk-OWPAHXDF.js +3 -0
  149. package/dist/chunk-P7HZGJRU.js +6 -0
  150. package/dist/chunk-PIU3GVJ4.js +1 -0
  151. package/dist/{chunk-2WJOTJOD.js → chunk-PSNCWS3Q.js} +2 -2
  152. package/dist/chunk-PSREELSQ.js +22 -0
  153. package/dist/{chunk-AQ6EVL73.js → chunk-Q2CKRCPM.js} +1 -1
  154. package/dist/chunk-QA2D7DT2.js +1 -0
  155. package/dist/chunk-QBRRFFMZ.js +1 -0
  156. package/dist/chunk-QDMTJKQ3.js +1 -0
  157. package/dist/{chunk-3Z3MADXZ.js → chunk-QIJ7D2JS.js} +1 -1
  158. package/dist/chunk-QLN6IOOY.js +1 -0
  159. package/dist/chunk-QU3USVKT.js +1 -0
  160. package/dist/chunk-R2E6TMBE.js +22 -0
  161. package/dist/chunk-R4E2E4NN.js +1 -0
  162. package/dist/chunk-R5COVIJM.js +1 -0
  163. package/dist/chunk-RFJ2LI64.js +81 -0
  164. package/dist/chunk-RNF6T6IO.js +5 -0
  165. package/dist/chunk-RSNFNZ6F.js +2 -0
  166. package/dist/{chunk-I4CEH7AK.js → chunk-RZ3UGOV4.js} +2 -2
  167. package/dist/{chunk-35XFNKNB.js → chunk-S23ZG2RG.js} +1 -1
  168. package/dist/{chunk-PF53E2DC.js → chunk-SAK42CAY.js} +1 -1
  169. package/dist/chunk-SBX7CMHM.js +1 -0
  170. package/dist/{chunk-S5P7KWY4.js → chunk-SGQTRKYZ.js} +1 -1
  171. package/dist/chunk-SNPJVVVE.js +5 -0
  172. package/dist/chunk-SNRGS3YU.js +1 -0
  173. package/dist/chunk-SUTSCIXU.js +7 -0
  174. package/dist/chunk-SWFCT5B7.js +2 -0
  175. package/dist/{chunk-4KECSZTL.js → chunk-SZ64GAVG.js} +2 -2
  176. package/dist/{chunk-WBVS5NBV.js → chunk-TDHIOONG.js} +2 -2
  177. package/dist/{chunk-W37IFK3P.js → chunk-TLN4BKXJ.js} +102 -102
  178. package/dist/{chunk-QW52RPAU.js → chunk-TXMZPF2U.js} +1 -1
  179. package/dist/chunk-TZHVCMZN.js +6 -0
  180. package/dist/{chunk-IHXGZW42.js → chunk-TZOB52QK.js} +1 -1
  181. package/dist/{chunk-N57Y7THE.js → chunk-U5BKU3OL.js} +1 -1
  182. package/dist/{chunk-Y55T4IIQ.js → chunk-UK3BDOHR.js} +1 -1
  183. package/dist/chunk-UORSJB4A.js +857 -0
  184. package/dist/chunk-UU6UQ2QY.js +1 -0
  185. package/dist/{chunk-PWAT52M4.js → chunk-UY44O4IZ.js} +1 -1
  186. package/dist/{chunk-QF5WKTPD.js → chunk-V3H6SYK3.js} +1 -1
  187. package/dist/{chunk-YTUUU33R.js → chunk-VBPMVVLV.js} +1 -1
  188. package/dist/{chunk-SNH4XZ6E.js → chunk-VGBCG3I5.js} +1 -1
  189. package/dist/{chunk-QEVTBD33.js → chunk-VHRUPKWH.js} +1 -1
  190. package/dist/chunk-VVHJ2AUF.js +3 -0
  191. package/dist/chunk-WB5GRBHW.js +1 -0
  192. package/dist/{chunk-YSWVYPWR.js → chunk-WBKQSSWW.js} +1 -1
  193. package/dist/{chunk-SIL6HPMK.js → chunk-WDXDT7XY.js} +2 -2
  194. package/dist/{chunk-SACNUF4I.js → chunk-WHOD5I7N.js} +1 -1
  195. package/dist/{chunk-Z2WAW6MM.js → chunk-WL3M63DG.js} +1 -1
  196. package/dist/{chunk-LEHBZKK3.js → chunk-WLJDMI7E.js} +1 -1
  197. package/dist/{chunk-PTSCGSQV.js → chunk-WZ3QWPK5.js} +2 -2
  198. package/dist/{chunk-H6GNKWYM.js → chunk-X5V7AGVU.js} +1 -1
  199. package/dist/{chunk-RPVZ2JON.js → chunk-X76AYO36.js} +1 -1
  200. package/dist/chunk-XB7H2RYV.js +31 -0
  201. package/dist/chunk-XHHAVKKV.js +1 -0
  202. package/dist/chunk-XKNDU62O.js +1 -0
  203. package/dist/chunk-XVJRGOJA.js +4 -0
  204. package/dist/chunk-Y3ZAQZPH.js +16 -0
  205. package/dist/chunk-YF4AXKM4.js +1 -0
  206. package/dist/chunk-YGN65N6W.js +16 -0
  207. package/dist/{chunk-HF4NDEX3.js → chunk-YR4J46US.js} +1 -1
  208. package/dist/chunk-YTC367JI.js +3 -0
  209. package/dist/{chunk-ZBL7XMJ6.js → chunk-Z2FGYMJ6.js} +2 -2
  210. package/dist/chunk-Z3QZNLT5.js +1 -0
  211. package/dist/chunk-ZC3EDADH.js +26 -0
  212. package/dist/chunk-ZLITAXPT.js +1 -0
  213. package/dist/{chunk-ACA2BGAD.js → chunk-ZNEPRGFY.js} +1 -1
  214. package/dist/chunk-ZNEQZV5K.js +3 -0
  215. package/dist/chunk-ZOU6SOXW.js +20 -0
  216. package/dist/{chunk-YV2TP44L.js → chunk-ZQNGYJKJ.js} +1 -1
  217. package/dist/chunk-ZRM7ESSS.js +4 -0
  218. package/dist/chunk-ZX33FUW3.js +5 -0
  219. package/dist/cli/commands/app/build.js +1 -1
  220. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  221. package/dist/cli/commands/app/bulk/execute.js +1 -1
  222. package/dist/cli/commands/app/bulk/status.js +1 -1
  223. package/dist/cli/commands/app/config/link.js +1 -1
  224. package/dist/cli/commands/app/config/pull.js +1 -1
  225. package/dist/cli/commands/app/config/use.js +1 -1
  226. package/dist/cli/commands/app/config/validate.js +1 -1
  227. package/dist/cli/commands/app/demo/watcher.js +1 -1
  228. package/dist/cli/commands/app/deploy.js +1 -1
  229. package/dist/cli/commands/app/dev/clean.js +1 -1
  230. package/dist/cli/commands/app/dev.js +1 -1
  231. package/dist/cli/commands/app/env/pull.js +1 -1
  232. package/dist/cli/commands/app/env/show.js +1 -1
  233. package/dist/cli/commands/app/execute.js +1 -1
  234. package/dist/cli/commands/app/function/build.js +1 -1
  235. package/dist/cli/commands/app/function/info.js +1 -1
  236. package/dist/cli/commands/app/function/replay.js +1 -1
  237. package/dist/cli/commands/app/function/run.js +1 -1
  238. package/dist/cli/commands/app/function/schema.js +1 -1
  239. package/dist/cli/commands/app/function/typegen.js +1 -1
  240. package/dist/cli/commands/app/generate/extension.js +1 -1
  241. package/dist/cli/commands/app/graphiql.js +1 -1
  242. package/dist/cli/commands/app/import/channel-config.js +1 -1
  243. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  244. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  245. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  246. package/dist/cli/commands/app/import-extensions.js +1 -1
  247. package/dist/cli/commands/app/info.js +1 -1
  248. package/dist/cli/commands/app/init.js +1 -1
  249. package/dist/cli/commands/app/logs.js +1 -1
  250. package/dist/cli/commands/app/release.js +1 -1
  251. package/dist/cli/commands/app/security/check.js +1 -1
  252. package/dist/cli/commands/app/security/clean.js +1 -1
  253. package/dist/cli/commands/app/security/instructions.js +1 -1
  254. package/dist/cli/commands/app/security/record.js +1 -1
  255. package/dist/cli/commands/app/security/review.js +1 -1
  256. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  257. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  258. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  259. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  260. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  261. package/dist/cli/commands/app/versions/list.js +1 -1
  262. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  263. package/dist/cli/commands/auth/login.d.ts +10 -10
  264. package/dist/cli/commands/auth/login.js +1 -1
  265. package/dist/cli/commands/auth/logout.d.ts +7 -7
  266. package/dist/cli/commands/auth/logout.js +1 -1
  267. package/dist/cli/commands/cache/clear.js +1 -1
  268. package/dist/cli/commands/config/autoupgrade/off.d.ts +7 -7
  269. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  270. package/dist/cli/commands/config/autoupgrade/on.d.ts +7 -7
  271. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  272. package/dist/cli/commands/config/autoupgrade/status.d.ts +7 -7
  273. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  274. package/dist/cli/commands/debug/command-flags.js +1 -1
  275. package/dist/cli/commands/doc/fetch.d.ts +21 -21
  276. package/dist/cli/commands/doc/fetch.js +1 -1
  277. package/dist/cli/commands/doc/search.d.ts +23 -23
  278. package/dist/cli/commands/doc/search.js +1 -1
  279. package/dist/cli/commands/docs/generate.js +1 -1
  280. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  281. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  282. package/dist/cli/commands/help.d.ts +90 -90
  283. package/dist/cli/commands/help.js +1 -1
  284. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  285. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  286. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  287. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  288. package/dist/cli/commands/notifications/generate.js +1 -1
  289. package/dist/cli/commands/notifications/list.js +1 -1
  290. package/dist/cli/commands/organization/list.js +1 -1
  291. package/dist/cli/commands/search.d.ts +7 -7
  292. package/dist/cli/commands/search.js +1 -1
  293. package/dist/cli/commands/send-analytics.js +1 -1
  294. package/dist/cli/commands/theme/check.js +1 -1
  295. package/dist/cli/commands/theme/console.js +1 -1
  296. package/dist/cli/commands/theme/delete.js +1 -1
  297. package/dist/cli/commands/theme/dev.js +1 -1
  298. package/dist/cli/commands/theme/duplicate.js +1 -1
  299. package/dist/cli/commands/theme/info.js +1 -1
  300. package/dist/cli/commands/theme/init.js +1 -1
  301. package/dist/cli/commands/theme/language-server.js +1 -1
  302. package/dist/cli/commands/theme/list.js +1 -1
  303. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  304. package/dist/cli/commands/theme/open.js +1 -1
  305. package/dist/cli/commands/theme/package.js +1 -1
  306. package/dist/cli/commands/theme/preview.js +1 -1
  307. package/dist/cli/commands/theme/profile.js +1 -1
  308. package/dist/cli/commands/theme/publish.js +1 -1
  309. package/dist/cli/commands/theme/pull.js +1 -1
  310. package/dist/cli/commands/theme/push.js +1 -1
  311. package/dist/cli/commands/theme/rename.js +1 -1
  312. package/dist/cli/commands/theme/share.js +1 -1
  313. package/dist/cli/commands/upgrade.d.ts +24 -24
  314. package/dist/cli/commands/upgrade.js +1 -1
  315. package/dist/cli/commands/version.d.ts +7 -7
  316. package/dist/cli/commands/version.js +1 -1
  317. package/dist/cli/help.js +1 -1
  318. package/dist/cli-version-check-BW2CUMX4.js +1 -0
  319. package/dist/{command-event-context-LFUZ7UCA.js → command-event-context-ILIANB5Q.js} +1 -1
  320. package/dist/command-json-schema-LGR44Q2G.js +1 -0
  321. package/dist/command-registry.js +1 -1
  322. package/dist/conf-store-TODPQ2LC.js +1 -0
  323. package/dist/configs/all.yml +9 -0
  324. package/dist/configs/recommended.yml +9 -0
  325. package/dist/custom-oclif-loader-BPE2TH4B.js +1 -0
  326. package/dist/data/filters.json +41 -2
  327. package/dist/data/local_block_entry.json +1 -1
  328. package/dist/data/manifest_theme.json +1 -0
  329. package/dist/data/objects.json +279 -44
  330. package/dist/data/section.json +15 -1
  331. package/dist/data/setting.json +9 -5
  332. package/dist/data/shopify_system_translations.json +312 -32
  333. package/dist/data/strict_settings.json +24 -0
  334. package/dist/data/tags.json +57 -24
  335. package/dist/data/theme_block.json +1 -1
  336. package/dist/deprecations-5CSI24TV.js +1 -0
  337. package/dist/dist-LPKYTX3M.js +1 -0
  338. package/dist/dist-WT6MPTKJ.js +1 -0
  339. package/dist/environment-5P7JJ3GI.js +1 -0
  340. package/dist/environments-3HTT5CVC.js +1 -0
  341. package/dist/error-PFOKPWFX.js +1 -0
  342. package/dist/error-handler-23FASAEU.js +1 -0
  343. package/dist/fs-RA25PWSJ.js +1 -0
  344. package/dist/hooks/did-you-mean.js +1 -1
  345. package/dist/hooks/hydrogen-init.js +1 -1
  346. package/dist/hooks/plugin-plugins.js +1 -1
  347. package/dist/hooks/postrun.js +1 -1
  348. package/dist/hooks/prerun.js +2 -2
  349. package/dist/hooks/public-metadata.js +1 -1
  350. package/dist/hooks/sensitive-metadata.js +1 -1
  351. package/dist/hooks/tunnel-provider.js +1 -1
  352. package/dist/hooks/tunnel-start.js +1 -1
  353. package/dist/http-EVDTYINS.js +1 -0
  354. package/dist/http-proxy-node16-NZZ674YW.js +38 -0
  355. package/dist/index.js +12 -12
  356. package/dist/is-global-3DNAMKUU.js +1 -0
  357. package/dist/json-error-HGCRNJRF.js +1 -0
  358. package/dist/latest-version-75YEFEMK.js +9 -0
  359. package/dist/lib-4ZA53LTZ.js +1 -0
  360. package/dist/lib-F3MES3XF.js +1 -0
  361. package/dist/lib-XPJABU24.js +1 -0
  362. package/dist/{local-OKPVB4NH.js → local-LNGPIGLG.js} +1 -1
  363. package/dist/metadata-VHLSUKCW.js +1 -0
  364. package/dist/{morph-CRY35DIK.js → morph-H7XQP55V.js} +3 -3
  365. package/dist/node-package-manager-SSFNUVWB.js +1 -0
  366. package/dist/notifications-system-3NQRYYKW.js +1 -0
  367. package/dist/{npa-A4YSCQ5Q.js → npa-LVYMN7GE.js} +1 -1
  368. package/dist/os-KIKVJONE.js +1 -0
  369. package/dist/output-DUJTSURG.js +1 -0
  370. package/dist/{prettier-EGVCP5CY.js → prettier-NOE3TJJ5.js} +1 -1
  371. package/dist/registry-auth-token-EDH77OOW.js +1 -0
  372. package/dist/registry-url-JMNV3LLX.js +1 -0
  373. package/dist/semver-HHZRKD6Y.js +1 -0
  374. package/dist/system-CGOZSROX.js +1 -0
  375. package/dist/tsconfig.tsbuildinfo +1 -1
  376. package/dist/ui-YMBFS3NG.js +1 -0
  377. package/dist/upgrade-73RRPDSC.js +1 -0
  378. package/dist/version-AMUEEBIG.js +1 -0
  379. package/dist/version-S4MGCKDO.js +1 -0
  380. package/dist/workerd-DRWNY3S4.js +18 -0
  381. package/oclif.manifest.json +25618 -1167
  382. package/package.json +7 -7
  383. package/dist/analytics-NMMVOF4B.js +0 -1
  384. package/dist/analytics-UK77WNLG.js +0 -1
  385. package/dist/chunk-224UPIYS.js +0 -4
  386. package/dist/chunk-27NXPOAS.js +0 -1
  387. package/dist/chunk-2MT3LSMZ.js +0 -1
  388. package/dist/chunk-2T4HDR6R.js +0 -70
  389. package/dist/chunk-2ZBXHCQZ.js +0 -1
  390. package/dist/chunk-335BUVBP.js +0 -1
  391. package/dist/chunk-33ZE3DRQ.js +0 -16
  392. package/dist/chunk-34MOWGRL.js +0 -1
  393. package/dist/chunk-3JSKNXL7.js +0 -1
  394. package/dist/chunk-3MG4MTWQ.js +0 -1
  395. package/dist/chunk-3XRI3D44.js +0 -1
  396. package/dist/chunk-43R5VGKT.js +0 -1
  397. package/dist/chunk-4WYKPIN3.js +0 -1
  398. package/dist/chunk-5AEZJZNQ.js +0 -1
  399. package/dist/chunk-5ED7SOQZ.js +0 -20
  400. package/dist/chunk-5IDJALJH.js +0 -1
  401. package/dist/chunk-66TMIQMB.js +0 -1
  402. package/dist/chunk-74NRFUGQ.js +0 -1
  403. package/dist/chunk-7GUMJ5E4.js +0 -1
  404. package/dist/chunk-7NFTSBHQ.js +0 -10
  405. package/dist/chunk-ACZNWIRY.js +0 -1
  406. package/dist/chunk-AUE7LM32.js +0 -1
  407. package/dist/chunk-AXL2VIWA.js +0 -16
  408. package/dist/chunk-B3ZJGYZY.js +0 -3
  409. package/dist/chunk-BOAGJ6P5.js +0 -1
  410. package/dist/chunk-BWN2QG6D.js +0 -5
  411. package/dist/chunk-CCUQM4FX.js +0 -6
  412. package/dist/chunk-CLUUA3HX.js +0 -3
  413. package/dist/chunk-CYEEGTVZ.js +0 -11
  414. package/dist/chunk-DBDTE3EE.js +0 -5
  415. package/dist/chunk-DLVB3237.js +0 -31
  416. package/dist/chunk-DN6X7SHW.js +0 -2
  417. package/dist/chunk-E5COIKGY.js +0 -5
  418. package/dist/chunk-E6RONHMT.js +0 -1
  419. package/dist/chunk-EAZIQI2D.js +0 -1
  420. package/dist/chunk-EEY4FKAW.js +0 -1
  421. package/dist/chunk-EKFPTBXC.js +0 -1
  422. package/dist/chunk-F3CK3EJJ.js +0 -1
  423. package/dist/chunk-FEBOZ2XX.js +0 -31
  424. package/dist/chunk-FFSDGRAN.js +0 -1
  425. package/dist/chunk-FZCGRIOM.js +0 -1
  426. package/dist/chunk-GNCVDN7U.js +0 -1
  427. package/dist/chunk-GQLNG537.js +0 -836
  428. package/dist/chunk-GVI3DWSB.js +0 -4
  429. package/dist/chunk-GW7YIJPJ.js +0 -5
  430. package/dist/chunk-H6GYBLVQ.js +0 -2
  431. package/dist/chunk-HB3MJYBK.js +0 -1
  432. package/dist/chunk-HSKDFEXW.js +0 -1
  433. package/dist/chunk-HTRJU4R4.js +0 -1
  434. package/dist/chunk-I7PEEJVH.js +0 -1
  435. package/dist/chunk-IHMATNOR.js +0 -1
  436. package/dist/chunk-IJY3RJPJ.js +0 -47
  437. package/dist/chunk-J3JPJCWP.js +0 -1
  438. package/dist/chunk-J55GQLP4.js +0 -1
  439. package/dist/chunk-JLQRDFR5.js +0 -18
  440. package/dist/chunk-JPWRZ5SL.js +0 -16
  441. package/dist/chunk-K7ZSPQKL.js +0 -4
  442. package/dist/chunk-L5TSPCSY.js +0 -26
  443. package/dist/chunk-LUGMXSRI.js +0 -9
  444. package/dist/chunk-M2CWCOFU.js +0 -11
  445. package/dist/chunk-M5VIFG2V.js +0 -1
  446. package/dist/chunk-MADINS4Z.js +0 -1
  447. package/dist/chunk-MGHPF7HU.js +0 -6
  448. package/dist/chunk-MHR5OHT5.js +0 -10
  449. package/dist/chunk-MXEXP3HT.js +0 -15
  450. package/dist/chunk-OJULL7HT.js +0 -1
  451. package/dist/chunk-OMPQ7REW.js +0 -3
  452. package/dist/chunk-OR4IJ4BQ.js +0 -1
  453. package/dist/chunk-P2RMFHQP.js +0 -1
  454. package/dist/chunk-P4VZYOKO.js +0 -15
  455. package/dist/chunk-PDZBKVWL.js +0 -97
  456. package/dist/chunk-Q2KWXZQB.js +0 -12
  457. package/dist/chunk-QFSENE5T.js +0 -3
  458. package/dist/chunk-QFWWCZOI.js +0 -1
  459. package/dist/chunk-QFYLJVJW.js +0 -77
  460. package/dist/chunk-QQJNQNKP.js +0 -6
  461. package/dist/chunk-R4UVIYZP.js +0 -4
  462. package/dist/chunk-RLNIOJH3.js +0 -272
  463. package/dist/chunk-RW6G4ZPU.js +0 -1
  464. package/dist/chunk-S4LOWCGS.js +0 -1
  465. package/dist/chunk-SB27UOXX.js +0 -1
  466. package/dist/chunk-SHD4VV5V.js +0 -3
  467. package/dist/chunk-SK7EPN6C.js +0 -1
  468. package/dist/chunk-TAWCKJKP.js +0 -1
  469. package/dist/chunk-U2T5HPRD.js +0 -319
  470. package/dist/chunk-U6YOP562.js +0 -1
  471. package/dist/chunk-UPPO3BMT.js +0 -7
  472. package/dist/chunk-USXIXANP.js +0 -103
  473. package/dist/chunk-UV5GAGAD.js +0 -1
  474. package/dist/chunk-UY6W2EVZ.js +0 -1
  475. package/dist/chunk-UYELAINQ.js +0 -16
  476. package/dist/chunk-V75WUEFU.js +0 -1
  477. package/dist/chunk-VAVXDIUX.js +0 -6
  478. package/dist/chunk-VGSH52JM.js +0 -1
  479. package/dist/chunk-VHZ6RL67.js +0 -1
  480. package/dist/chunk-VQA3X7O3.js +0 -1
  481. package/dist/chunk-VZCMJRYV.js +0 -1
  482. package/dist/chunk-W56ZGEQQ.js +0 -2265
  483. package/dist/chunk-WCC52MR2.js +0 -1
  484. package/dist/chunk-WSDKCQH6.js +0 -6
  485. package/dist/chunk-X2PFXSU4.js +0 -1
  486. package/dist/chunk-X5NIAZA4.js +0 -1
  487. package/dist/chunk-XBMD3FEZ.js +0 -3
  488. package/dist/chunk-XDVPIGXE.js +0 -2
  489. package/dist/chunk-XLIJYJ6Q.js +0 -1
  490. package/dist/chunk-XUHGWIWW.js +0 -4
  491. package/dist/chunk-Y5CVX5LJ.js +0 -1
  492. package/dist/chunk-Y6J46XYF.js +0 -3
  493. package/dist/chunk-YKMINHYY.js +0 -3
  494. package/dist/chunk-ZDQO6CNY.js +0 -1
  495. package/dist/chunk-ZGASBRSQ.js +0 -5
  496. package/dist/chunk-ZGBTO46A.js +0 -1
  497. package/dist/chunk-ZJOX5HW4.js +0 -22
  498. package/dist/chunk-ZOOT3GBY.js +0 -5
  499. package/dist/command-json-schema-F5XF7XHL.js +0 -1
  500. package/dist/conf-store-5CBLWTOC.js +0 -1
  501. package/dist/custom-oclif-loader-UDVUFKMD.js +0 -1
  502. package/dist/deprecations-EOHPSTCS.js +0 -1
  503. package/dist/dist-RNV3GFZ7.js +0 -1
  504. package/dist/dist-ZFKWJVNB.js +0 -1
  505. package/dist/environment-O7ECODHU.js +0 -1
  506. package/dist/environments-4FLRZW4P.js +0 -1
  507. package/dist/error-JY2ADS6S.js +0 -1
  508. package/dist/error-handler-4GCXKC6I.js +0 -1
  509. package/dist/fs-XS5YF34R.js +0 -1
  510. package/dist/http-proxy-node16-D3JUYA5D.js +0 -38
  511. package/dist/is-global-27MUENOK.js +0 -1
  512. package/dist/json-error-S5XFS3UX.js +0 -1
  513. package/dist/latest-version-LDWU5F7A.js +0 -49
  514. package/dist/lib-PJHT4MKY.js +0 -1
  515. package/dist/lib-VKSQ65BQ.js +0 -1
  516. package/dist/lib-YEZOHXF3.js +0 -1
  517. package/dist/metadata-2YJBAKR7.js +0 -1
  518. package/dist/node-package-manager-B3OW3PFQ.js +0 -1
  519. package/dist/notifications-system-BWTDYBG2.js +0 -1
  520. package/dist/os-F6QKJCFW.js +0 -1
  521. package/dist/output-BRIPK7UC.js +0 -1
  522. package/dist/system-466QKFDI.js +0 -1
  523. package/dist/ui-VJTNGCS6.js +0 -1
  524. package/dist/upgrade-VHVJLXKX.js +0 -1
  525. package/dist/version-FETZRLZO.js +0 -1
  526. package/dist/version-T4XXTJMB.js +0 -1
  527. package/dist/workerd-32DMKLMN.js +0 -18
  528. /package/dist/{chunk-YLQ3LNNY.js → chunk-HVECVOIO.js} +0 -0
  529. /package/dist/{chunk-YRHFPXC3.js → chunk-Z2AV4BWZ.js} +0 -0
@@ -0,0 +1,3 @@
1
+ import{b as D}from"./chunk-ZOU6SOXW.js";import{a as ee}from"./chunk-COGKVNQB.js";import{k as K,l as Q,m as X,o as Z}from"./chunk-OKRKVVTK.js";import{a as re}from"./chunk-UY44O4IZ.js";import{a as q,c as z}from"./chunk-TXMZPF2U.js";import{a as W}from"./chunk-7AQZKPJU.js";import{a as V,b as Y}from"./chunk-YY6TFARF.js";import{a as G}from"./chunk-GQ3LY7BY.js";import{b as F,c as N,d as A,f as U,j as I,n as H,p as B}from"./chunk-RSNFNZ6F.js";import{d as R,e as $,g as M,h as J}from"./chunk-7HECBXSP.js";import{r as g}from"./chunk-VVHJ2AUF.js";import{da as me}from"./chunk-MQ55QUOJ.js";import{Ea as P,Fa as _,U as E}from"./chunk-UORSJB4A.js";import{D as L,y as k,z as O}from"./chunk-7A4ZE5IS.js";import{j as v}from"./chunk-FJOVMEPN.js";import{zb as y}from"./chunk-OIQ5NQ5I.js";import{b as t,j}from"./chunk-3PYDIBTX.js";import{e as x,g as C,p as f}from"./chunk-IWTNUJGY.js";import{e as ie,g as d}from"./chunk-VKWPEFWQ.js";d();import{resolve as ae}from"node:path";var he=t.object({id:t.number(),name:t.string(),role:t.string(),shop:t.string(),editor_url:t.string(),preview_url:t.string()}),T=t.object({environment:t.string().optional(),directory:t.string().optional(),sourcePaths:t.record(t.string()).optional(),changed:t.boolean().optional(),theme:he,published:t.boolean(),hasErrors:t.boolean(),errors:t.record(t.array(t.string()))}),te=t.object({status:t.enum(["success","partial"]),changed:t.boolean(),theme:R,issues:t.array(t.object({filePath:t.string().refine(C,"Expected an absolute filesystem path."),message:t.string()}).strict())}).strict(),oe=t.object({status:t.literal("skipped"),reason:t.literal("unsafe-directory")}).strict();function w(e){let{theme:o,hasErrors:r,errors:s}=e;return{status:r?"partial":"success",changed:e.changed??!0,theme:{...J(o),storeDomain:M(o.shop),editorUrl:o.editor_url||null,previewUrl:o.preview_url||null},issues:Object.entries(s).flatMap(([n,i])=>i.map(a=>({filePath:ae(e.directory??f(),e.sourcePaths?.[n]??n),message:a})))}}var S=$({name:"ThemePushJsonResult",schema:t.union([te,oe]),definitions:{ThemePushTheme:R},project:e=>oe.safeParse(e).success||te.safeParse(e).success?e:w(T.parse(e))});d();var b=ie(me(),1);function se(e,o){if(o==="json"){y(S.encode(w(e)));return}let{environment:r,theme:s,hasErrors:n,published:i}=e,a=r?[{subdued:`Environment: ${r}
2
+
3
+ `}]:[],m=n?O:k;if(i){m({body:[...a,n?`Your theme was published with errors and is now live at https://${s.shop}`:`Your theme is now live at https://${s.shop}`]});return}m({body:[...a,"The theme",...q(s),n?"was pushed with errors":"was pushed successfully."],nextSteps:[[{link:{label:"View your theme",url:s.preview_url}}],[{link:{label:"Customize your theme at the theme editor",url:s.editor_url}}]]})}async function ne(e,o=!1,r={}){if(!e.strict)return;let s=e.environment?.[0],n=o?"json":"silent",i=e.json?n:"text",{offenses:a}=await D(e.path??f(),i,void 0,s,r);if(e.json&&!o)for(let m of a)j({type:"diagnostic",level:{[b.Severity.ERROR]:"error",[b.Severity.WARNING]:"warning",[b.Severity.INFO]:"info"}[m.severity],code:m.check,message:`${s?`[${s}] `:""}${m.uri}: ${m.message}`});if(a.some(m=>m.severity===b.Severity.ERROR))throw _(new v(`${s?`[${s}] `:""}Theme check failed. Please fix the errors before pushing.`))}function _e(e){let o=e.map(r=>{if("error"in r)return r;let s=r.result??{status:"skipped",reason:"unsafe-directory"};return T.safeParse(s).data?.hasErrors&&(process.exitCode=1),{...r,result:s}});y(S.encode({environments:o}))}d();async function ue(e,o,r,s){let n=e.environment?.[0],i=o??await E(g({store:e.store}),e.password);P("theme-service:push:setup"),re({verbose:e.verbose,noColor:e.noColor});let a=e.force??!1,m=e.path?x(e.path):f();if(!await Z(m)&&!await z(a,void 0,n,r))return;e.listing&&await Q(m,e.listing);let l=await le(i,e,r);if(l)return P("theme-service:push:setup"),ce(l,i,{allowLive:e.allowLive??!1,environment:n,force:a,ignore:e.ignore??[],multiEnvironment:r,nodelete:e.nodelete??!1,only:e.only??[],path:m,publish:e.publish??!1,listing:e.listing},s)}async function ce(e,o,r,s){P("theme-service:push:file-system");let n=await H(e.id,o),i=X(r.path,{filters:r,listing:r.listing});P("theme-service:push:file-system");let a;if(r.listing){let c=r.listing;await i.ready(),a=Object.fromEntries(await Promise.all([...i.files.keys()].map(async p=>[p,await K(r.path,c,p)??p])))}let m=ee(e,o,n,i,r,s);await m.renderThemeSyncProgress();let{uploadResults:l}=m;r.publish&&await B(e.id,o);let h={};for(let[c,p]of l)p.success||(h[c]=p.errors?.asset?.length?p.errors.asset:["File upload failed"]);let u=T.parse({environment:r.environment,directory:r.path,...a&&{sourcePaths:a},changed:e.createdAtRuntime===!0||r.publish===!0||m.hasChanges,theme:{id:e.id,name:e.name,role:e.role,shop:o.storeFqdn,editor_url:Y(e,o),preview_url:V(e,o)},published:r.publish??!1,hasErrors:[...l.values()].some(c=>!c.success),errors:h});if(u.hasErrors&&!u.changed){let c=new v(`The theme '${e.name}' could not be pushed.`);throw c.details={themeId:String(e.id),issues:w(u).issues},c}return u}async function le(e,o,r){let{live:s,development:n,unpublished:i,theme:a,environment:m,developmentContext:l}=o;if(n)return new W(e).findOrCreate(l,F);if(i){let h=a??await U("Name of the new theme"),u=await I({name:h,role:A},e);return u?{...u,createdAtRuntime:!0}:void 0}else{let h=await G(e,{create:!0,header:"Select a theme to push to:",filter:{live:s,theme:a}});return await pe(h.role,o.allowLive,e.storeFqdn,m,r)?h:void 0}}async function pe(e,o,r,s,n){if(e===N){if(o)return!0;if(n)throw new v(`Can't push theme files to the live theme on ${r}. Use the --allow-live flag.`);let i={message:`Push theme files to the ${e} theme on ${r}?`,confirmationMessage:"Yes, confirm changes",cancellationMessage:"Cancel"};return L(i)}return!0}async function Qe(e,o,r,s){let n=o??await E(g({store:e.store}),e.password);await ne(e,!0);let i=await ue(e,n,r,s);i&&se(i,e.json?"json":"text")}export{T as a,w as b,S as c,se as d,ne as e,_e as f,ue as g,Qe as h};
@@ -0,0 +1,6 @@
1
+ import{b as r,c as i,d as p}from"./chunk-G7JO3W2R.js";import{b as o}from"./chunk-PSREELSQ.js";import{b as e,c as s}from"./chunk-IKXUYCK7.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var t=class n extends o{static summary="Enable automatic upgrades for Shopify CLI.";static descriptionWithMarkdown=`Enable automatic upgrades for Shopify CLI.
2
+
3
+ When auto-upgrade is enabled, Shopify CLI automatically updates to the latest version once per day. Major version upgrades are skipped and must be done manually.
4
+
5
+ To disable auto-upgrade, run \`shopify config autoupgrade off\`.
6
+ `;static jsonOutputSchema=i;static description=this.descriptionForHelp();static flags={...e,...s};async run(){let{flags:u}=await this.parse(n),d=r(!0);p(d,u.json?"json":"text")}};export{t as a};
@@ -0,0 +1 @@
1
+ import{P as j}from"./chunk-7FBOMPO5.js";import{s as P}from"./chunk-4LJERO23.js";import{E as A}from"./chunk-7A4ZE5IS.js";import{a as y}from"./chunk-LG3KEHGD.js";import{j as h}from"./chunk-FJOVMEPN.js";import{Bb as x,Sa as u,ta as b,vb as f,zb as p}from"./chunk-OIQ5NQ5I.js";import{b as r}from"./chunk-3PYDIBTX.js";import{a as I}from"./chunk-A5BSUUNQ.js";import{b as q}from"./chunk-VBPMVVLV.js";import{c as l,e as v,p as F}from"./chunk-IWTNUJGY.js";import{e as O,g as c}from"./chunk-VKWPEFWQ.js";c();async function C(t){let{extension:e,developerPlatformClient:n,app:a,orgId:i}=t,o=a.configuration.client_id,{api_version:s,type:m,targeting:d}=e.configuration,G=await(!!d?.length?z({localIdentifier:e.localIdentifier,developerPlatformClient:n,apiKey:o,target:d[0].target,version:s,orgId:i}):R({localIdentifier:e.localIdentifier,developerPlatformClient:n,apiKey:o,type:m,version:s,orgId:i}));return{definition:P(G,s),path:l(e.directory,"schema.graphql"),localIdentifier:e.localIdentifier}}async function z({localIdentifier:t,developerPlatformClient:e,apiKey:n,target:a,version:i,orgId:o}){let s={handle:a,version:i},m=await e.targetSchemaDefinition(s,n,o);if(!m)throw new h(f`A schema could not be generated for ${t}`,f`Check that the Function targets and version are valid.`);return m}async function R({localIdentifier:t,developerPlatformClient:e,apiKey:n,version:a,type:i,orgId:o}){let s={version:a,type:i},m=await e.apiSchemaDefinition(s,n,o);if(!m)throw new h(f`A schema could not be generated for ${t}`,f`Check that the Function API type and version are valid.`);return m}c();c();var g=r.string().regex(/^(?:\/|[a-zA-Z]:[\\/]|\\\\)/).describe("An absolute native filesystem path."),V=r.object({handle:r.string().nullable().describe("Null when the extension does not configure a handle."),name:r.string(),directory:g}).strict();var T=r.object({path:g,format:r.literal("graphql").describe("The file contains native GraphQL SDL with the API-version header.")}).strict(),D=r.object({schema:r.string().describe("Native GraphQL SDL with the API-version header, returned with --stdout --json.")}).strict(),S=y({name:"FunctionSchemaResult",schema:r.union([T,D]),definitions:{FunctionSchemaFile:T,FunctionSchemaContent:D}});c();import{resolve as _}from"node:path";async function L(t,e){let n=e.stdout?{schema:t.definition}:{path:_(t.path),format:"graphql"};if(e.stdout){p(e.json?S.encode(n):t.definition);return}await b(t.path,t.definition),e.json?p(S.encode(n)):x(`GraphQL Schema for ${t.localIdentifier} written to ${t.path}`)}c();var E=O(q(),1);var pt={path:E.Flags.string({hidden:!1,description:"The path to your function directory.",parse:async t=>v(t),default:async()=>F(),noCacheDefault:!0,env:"SHOPIFY_FLAG_PATH"})};async function gt(t,e){let n=t.allExtensions.filter(i=>i.isFunctionExtension),a=n.find(i=>i.directory===e);if(a)return a;if(n.length===1&&n[0])return n[0];if(I())return await A({message:"Which function?",choices:n.map(o=>({label:o.handle,value:o}))});throw new h("Run this command from a function directory or use `--path` to specify a function directory.")}async function St(t,e,n,a,i){let o=l(t.directory,"schema.graphql");if(await u(o))return o;let{app:s,developerPlatformClient:m,organization:d}=await j({directory:e,clientId:n,forceRelink:a,userProvidedConfigName:i}),w=await C({app:s,developerPlatformClient:m,extension:t,orgId:d.id});return await L(w,{stdout:!1,json:!1}),await u(o)?o:void 0}export{C as a,g as b,V as c,S as d,L as e,pt as f,gt as g,St as h};
@@ -1,6 +1,6 @@
1
- import{a as L,b as w,c as P}from"./chunk-HF4NDEX3.js";import{a as g,b as x}from"./chunk-QW52RPAU.js";import{a as A}from"./chunk-CGVROSPS.js";import{a as q,c as J}from"./chunk-2L6AN3QA.js";import{e as R}from"./chunk-QFWWCZOI.js";import{e as Y,q as H}from"./chunk-H6GYBLVQ.js";import{i as _,p as $,v as C}from"./chunk-YKMINHYY.js";import{b as O,c as E,f as M}from"./chunk-3KM5ZOW2.js";import{A as b,B as D,F}from"./chunk-D2KIGKBI.js";import{g as I,h as S}from"./chunk-M5VIFG2V.js";import{Cb as j,U as T,wb as u}from"./chunk-JLQRDFR5.js";import{b as o}from"./chunk-FZCGRIOM.js";import{b as U}from"./chunk-YTUUU33R.js";import{e as z,g as c}from"./chunk-VKWPEFWQ.js";c();c();var N=o.object({status:o.enum(["success","partial"]),themes:o.array(L),errors:o.array(o.object({themeId:o.number(),message:o.string()})).optional()}),p=R({name:"ThemeDeleteResult",schema:o.object({status:o.enum(["success","partial"]),changed:o.boolean(),themes:o.array(w),errors:o.array(o.object({themeId:o.string().regex(/^\d+$/),error:o.object({type:o.literal("abort"),message:o.string()}).strict()}).strict()).optional()}).strict(),definitions:{Theme:w},project(t){let e=N.parse(t);return{status:e.status,changed:e.themes.length>0,themes:e.themes.map(P),...e.errors?{errors:e.errors.map(n=>({themeId:String(n.themeId),error:{type:"abort",message:n.message}}))}:{}}}});c();function k(t,e,n){if(e==="json"){u(p.encode(t));return}let s=n.environment?[{subdued:`Environment: ${n.environment}
1
+ import{a as L,b as w,c as P}from"./chunk-YR4J46US.js";import{a as g,b as x}from"./chunk-TXMZPF2U.js";import{a as A}from"./chunk-7AQZKPJU.js";import{a as q,c as J}from"./chunk-GQ3LY7BY.js";import{e as Y,q as H}from"./chunk-RSNFNZ6F.js";import{e as R}from"./chunk-7HECBXSP.js";import{i as _,p as $,v as C}from"./chunk-VVHJ2AUF.js";import{b as O,c as E,f as M}from"./chunk-IKXUYCK7.js";import{D as F,y as b,z as D}from"./chunk-7A4ZE5IS.js";import{i as I,j as S}from"./chunk-FJOVMEPN.js";import{Fb as j,U as T,zb as u}from"./chunk-OIQ5NQ5I.js";import{b as o}from"./chunk-3PYDIBTX.js";import{b as U}from"./chunk-VBPMVVLV.js";import{e as z,g as c}from"./chunk-VKWPEFWQ.js";c();c();var N=o.object({status:o.enum(["success","partial"]),themes:o.array(L),errors:o.array(o.object({themeId:o.number(),message:o.string()})).optional()}),p=R({name:"ThemeDeleteResult",schema:o.object({status:o.enum(["success","partial"]),changed:o.boolean(),themes:o.array(w),errors:o.array(o.object({themeId:o.string().regex(/^\d+$/),error:o.object({type:o.literal("abort"),message:o.string()}).strict()}).strict()).optional()}).strict(),definitions:{Theme:w},project(t){let e=N.parse(t);return{status:e.status,changed:e.themes.length>0,themes:e.themes.map(P),...e.errors?{errors:e.errors.map(n=>({themeId:String(n.themeId),error:{type:"abort",message:n.message}}))}:{}}}});c();function k(t,e,n){if(e==="json"){u(p.encode(t));return}let s=n.environment?[{subdued:`Environment: ${n.environment}
2
2
 
3
- `}]:[];(t.status==="partial"?D:b)({body:T(t.themes,m=>[...s,`The following themes were deleted from ${n.store}:`,x(m)],m=>[...s,"The theme",...g(m),`was deleted from ${n.store}.`]),...t.errors?{nextSteps:t.errors.map(m=>[`Theme #${m.themeId}: ${m.message}`])}:{}})}c();async function G(t,e,n){let s=e.themes;e.development&&(s=[(await new A(t).find()).id.toString()]);let i=t.storeFqdn,m=await B(t,{...e,themes:s,development:!1});if(!e.force&&!n&&!await V(m,i))return;let f=await Promise.allSettled(m.map(async r=>(await H(r.id,t),{...r,shop:i}))),d=f.flatMap(r=>r.status==="fulfilled"?[r.value]:[]);for(let r of d)if(Y(r))try{_()}catch(l){let a=l instanceof Error?l.message:String(l);j(`Theme #${r.id} was deleted, but its local development theme reference could not be removed: ${a}`)}let h=f.flatMap((r,l)=>{if(r.status==="fulfilled")return[];let a=r.reason;return[{themeId:m[l].id,message:a instanceof Error?a.message:String(a)}]});if(h.length>0&&d.length===0){let r=f.find(a=>a.status==="rejected")?.reason;if(r instanceof I)throw r;let l=new S(h[0].message);throw l.details={errors:h.map(({themeId:a,message:W})=>({themeId:String(a),message:W}))},l}return{status:h.length>0?"partial":"success",themes:d,...h.length>0?{errors:h}:{}}}async function B(t,e){if(e.selectTheme||e.themes.length>0)return J(t,e);let n=t.storeFqdn;return[await q(t,{header:`Select a theme to delete from ${n}`,filter:{development:e.development}})]}async function V(t,e){let s={message:T(t,i=>[`Delete the following themes from ${e}?`],i=>["Delete",...g(i),`from ${e}?`]),confirmationMessage:"Yes, confirm changes",cancellationMessage:"Cancel"};return t.length>1&&(s.infoTable={"":t.map(g)}),F(s)}var v=z(U(),1);var y=class extends C{static get jsonOutputSchema(){return p}static summary="Delete remote themes from the connected store. This command can't be undone.";static descriptionWithMarkdown=`Deletes a theme from your store.
3
+ `}]:[];(t.status==="partial"?D:b)({body:T(t.themes,m=>[...s,`The following themes were deleted from ${n.store}:`,x(m)],m=>[...s,"The theme",...g(m),`was deleted from ${n.store}.`]),...t.errors?{nextSteps:t.errors.map(m=>[`Theme #${m.themeId}: ${m.message}`])}:{}})}c();async function G(t,e,n){let s=e.themes;e.development&&(s=[(await new A(t).find()).id.toString()]);let i=t.storeFqdn,m=await B(t,{...e,themes:s,development:!1});if(!e.force&&!n&&!await V(m,i))return;let f=await Promise.allSettled(m.map(async r=>(await H(r.id,t),{...r,shop:i}))),d=f.flatMap(r=>r.status==="fulfilled"?[r.value]:[]);for(let r of d)if(Y(r))try{_()}catch(l){let a=l instanceof Error?l.message:String(l);j(`Theme #${r.id} was deleted, but its local development theme reference could not be removed: ${a}`)}let h=f.flatMap((r,l)=>{if(r.status==="fulfilled")return[];let a=r.reason;return[{themeId:m[l].id,message:a instanceof Error?a.message:String(a)}]});if(h.length>0&&d.length===0){let r=f.find(a=>a.status==="rejected")?.reason;if(r instanceof I)throw r;let l=new S(h[0].message);throw l.details={errors:h.map(({themeId:a,message:W})=>({themeId:String(a),message:W}))},l}return{status:h.length>0?"partial":"success",themes:d,...h.length>0?{errors:h}:{}}}async function B(t,e){if(e.selectTheme||e.themes.length>0)return J(t,e);let n=t.storeFqdn;return[await q(t,{header:`Select a theme to delete from ${n}`,filter:{development:e.development}})]}async function V(t,e){let s={message:T(t,i=>[`Delete the following themes from ${e}?`],i=>["Delete",...g(i),`from ${e}?`]),confirmationMessage:"Yes, confirm changes",cancellationMessage:"Cancel"};return t.length>1&&(s.infoTable={"":t.map(g)}),F(s)}var v=z(U(),1);var y=class extends C{static jsonOutputSchema=p;static summary="Delete remote themes from the connected store. This command can't be undone.";static descriptionWithMarkdown=`Deletes a theme from your store.
4
4
 
5
5
  You can specify multiple themes by ID. If no theme is specified, then you're prompted to select the theme that you want to delete from the list of themes in your store.
6
6
 
@@ -0,0 +1,22 @@
1
+ import{b as Y}from"./chunk-LFOBYEWG.js";import{M as W}from"./chunk-UORSJB4A.js";import{q as M}from"./chunk-CE6XQDAG.js";import{U as k}from"./chunk-7A4ZE5IS.js";import{a as C,d as j}from"./chunk-WLJDMI7E.js";import{c as A}from"./chunk-2KFYIYLI.js";import{b as S}from"./chunk-QBRRFFMZ.js";import{d as I}from"./chunk-HI5FTI3M.js";import{j as d}from"./chunk-FJOVMEPN.js";import{$ as P,tb as h,vb as g,zb as R}from"./chunk-OIQ5NQ5I.js";import{i as b,j as N,k as f}from"./chunk-3PYDIBTX.js";import{d as q}from"./chunk-A5BSUUNQ.js";import{b as $}from"./chunk-R4E2E4NN.js";import{b as J}from"./chunk-VBPMVVLV.js";import{a as _}from"./chunk-JD5P5RAJ.js";import{e as H,g as O}from"./chunk-VKWPEFWQ.js";O();var u=H(J()),E=class extends u.Command{static baseFlags={"json-schema":u.Flags.boolean({description:"Print the command's JSON schemas.",env:"SHOPIFY_FLAG_JSON_SCHEMA"})};static descriptionWithMarkdown;static jsonOutputSchema;static get requiresSyncAnalytics(){return!1}static nonTTYFlagRequirements(n){return[]}static descriptionForHelp(){let n=(this.descriptionWithMarkdown??"").replace(/(\[)(.*?)(])(\()(.*?)(\))/gm,'"$2" ($5)');return z(n,this.jsonOutputSchema)}static descriptionWithoutMarkdown(){return this.descriptionForHelp()}static analyticsNameOverride(){}static analyticsStopCommand(){}jsonOutputFromFlags=!1;async catch(n){let e=async()=>{n.skipOclifErrorHandling=!0;let{errorHandler:r}=await import("./error-handler-23FASAEU.js");return await r(n,this.config),u.Errors.handle(n)};return this.jsonOutputFromFlags&&f()!=="json"?b({outputMode:"json",sink:j},e):e()}async _run(){return C(this.argv,()=>super._run())}async init(){if(this.exitWithTimestampWhenEnvVariablePresent(),Y(this.id??""),!q()){let{registerCleanBugsnagErrorsFromWithinPlugins:e}=await import("./error-handler-23FASAEU.js");await e(this.config)}await G(this.config),this.showNpmFlagWarning(),await this.showDeprecatedAutomationTokenVariableWarning();let{showNotificationsIfNeeded:n}=await import("./notifications-system-3NQRYYKW.js");return await n(),super.init()}showNpmFlagWarning(){let n=this.constructor;Object.keys(n.flags||{}).map(t=>`npm_config_${P(t).replace(/^no_/,"")}`).some(t=>process.env[t]!==void 0)&&import("./ui-YMBFS3NG.js").then(({renderWarning:t})=>{t({body:["NPM scripts require an extra",{command:"--"},"separator to pass the flags. Example:",{command:"npm run dev -- --reset"}]})})}async showDeprecatedAutomationTokenVariableWarning(){let n=A();n&&await M("warn-on-deprecated-automation-token-variable",{days:1},async()=>{let{renderWarning:e}=await import("./ui-YMBFS3NG.js");e({headline:`${n} is deprecated.`,body:`Move the token to ${$.serviceAccountToken}. ${n} still works for now, but a future release will stop reading it.`})})}exitWithTimestampWhenEnvVariablePresent(){_(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)&&(R(`
2
+ SHOPIFY_CLI_TIMESTAMP_START
3
+ { "timestamp": ${Date.now()} }
4
+ SHOPIFY_CLI_TIMESTAMP_END
5
+ `),process.exit(0))}async parse(n,e){let r=await super.parse(n,e),t=await this.resultWithEnvironment(r,n,e);return this.runWithParsedOutput(t.flags,async()=>(await W(t.flags["auth-alias"]),await U(t.flags),this.validateNonTTYFlags(t.flags),{...t,argv:t.argv}))}runWithParsedOutput(n,e){let r=this.constructor,t=c(r.flags,"json")&&(n.json===!0||T(r.flags)&&n.output==="json");return this.jsonOutputFromFlags||=t,t&&f()!=="json"?b({outputMode:"json",sink:j},e):e()}environmentsFilename(){}filterEnvironmentFlags(n){return n}async parseEnvironmentFlags(n,e,r){let t=this.argv;try{return(await super.parse(e,[...t,...D(this.filterEnvironmentFlags(n),e,r)])).flags}finally{this.argv=t}}validateNonTTYFlags(n){this.failMissingNonTTYFlagRequirements(n,this.applicableNonTTYFlagRequirements(n))}failMissingNonTTYFlags(n,e){this.failMissingNonTTYFlagRequirements(n,e.map(r=>({flags:[r]})))}failMissingNonTTYFlagRequirements(n,e){if(k())return;let r=e.filter(i=>i.flags.every(l=>n[l]===void 0||n[l]===!1));if(r.length===0)return;let t=r.length===1?"Flag not specified":"Flags not specified",s=r.map(i=>i.flags.map(l=>`--${l}`).join(" or ")).join(`
6
+ `),o=r.length===1?"This flag is required":"These flags are required";throw new d(g`${t}:
7
+
8
+ ${h.cyan(s)}
9
+
10
+ ${o} in non-interactive terminal environments, such as a CI environment, or when piping input from another process.`,"To resolve this, specify the options in the command, or run the command in an interactive environment such as your local terminal.")}applicableNonTTYFlagRequirements(n){let e=this.constructor,r={...e.baseFlags,...e.flags},t=Object.entries(r).filter(([,o])=>!!o.requiredIfNonInteractive).map(([o])=>({flags:[o]})),s=(e.nonTTYFlagRequirements?.(n)??[]).filter(o=>o.when?.(n)??!0);return[...t,...s]}async resultWithEnvironment(n,e,r){let t=n.flags,s=this.environmentsFilename();if(!s)return n;let{environmentFilePath:o}=await import("./environments-3HTT5CVC.js"),i=await o(s,{from:t.path}),l=[];t.environment&&(l=Array.isArray(t.environment)?t.environment:[t.environment]);let p=l.length>0;if(!i&&!p||p&&l.length>1)return n;let{environment:m,isDefaultEnvironment:v}=await this.loadEnvironmentForCommand(t.path,s,l[0]);if(!m||v&&!c(e?.flags,"environment"))return n;let y=await super.parse(B(e),r),F={...m,...y.flags};this.jsonOutputFromFlags=c(e?.flags,"json")&&F.json===!0||T(e?.flags)&&F.output==="json";let x=c(e?.flags,"json")&&T(e?.flags)&&F.output==="json"?{json:!0,...m}:m,w=await super.parse(e,[...r??this.argv,...D(x,e,y.flags),...v?["--environment","default"]:[]]),V=()=>L(y.flags,w.flags,v?"default":l[0],m);return this.runWithParsedOutput(w.flags,V),w}async loadEnvironmentForCommand(n,e,r){let{loadEnvironment:t}=await import("./environments-3HTT5CVC.js");if(r){let o=await t(r,e,{from:n});return{environment:o&&this.filterEnvironmentFlags(o),isDefaultEnvironment:!1}}let s=await t("default",e,{from:n,silent:!0});return{environment:s&&this.filterEnvironmentFlags(s),isDefaultEnvironment:!0}}};async function U(a){await I(()=>({cmd_all_verbose:a.verbose,cmd_all_path_override:a.path!==void 0,cmd_all_path_override_hash:a.path===void 0?void 0:S(a.path)}))}function L(a,n,e,r){let t={};for(let[o,i]of Object.entries(n)){let l=Object.prototype.hasOwnProperty.call(a,o),p=Object.prototype.hasOwnProperty.call(r,o);if(!l&&p){let m=o==="password"||o==="store-password"?`********${i.substr(-4)}`:i;t[o]=m}}if(Object.keys(t).length===0)return;let s=Object.entries(t).map(([o,i])=>`${o}: ${i}`);if(f()==="json"){N({type:"diagnostic",level:"info",message:`Using applicable flags from ${e} environment:
11
+ ${s.join(`
12
+ `)}`});return}import("./ui-YMBFS3NG.js").then(({renderInfo:o})=>{o({headline:["Using applicable flags from",{userInput:e},"environment:"],body:[{list:{items:s}}]})})}function B(a){return a?.flags?{...a,flags:Object.fromEntries(Object.entries(a.flags).map(([n,e])=>{let r={...e};return delete r.default,[n,r]}))}:a}function D(a,n,e){let r=[];for(let[t,s]of Object.entries(a)){let o=c(n?.flags,t),i=Object.prototype.hasOwnProperty.call(e,t);if(o&&!i){if(n?.flags?.[t]?.type==="boolean"&&typeof s!="boolean")throw new d(g`Environment flag ${h.yellow(t)} must be a boolean.`);if(typeof s=="boolean")if(s)r.push(`--${t}`);else throw new d(g`Environments can only specify true for boolean flags. Attempted to set ${h.yellow(t)} to false.`);else Array.isArray(s)?s.forEach(l=>r.push(`--${t}`,`${l}`)):r.push(`--${t}`,`${s}`)}}return r}function c(a,n){return!!a&&Object.prototype.hasOwnProperty.call(a,n)}function T(a){let n=a?.output;return n?.type==="option"&&n.options?.includes("json")===!0}function z(a,n){if(!n)return a;let e=`Use \`--json-schema\` to print the result, error, and event schemas.
13
+
14
+ Output from \`--json\` conforms to the \`${n.name}\` schema.
15
+
16
+ \`\`\`json
17
+ ${JSON.stringify(n.jsonSchema,null,2)}
18
+ \`\`\``;return[a,e].filter(Boolean).join(`
19
+
20
+ `)}async function G(a){let n=Array.from(a.plugins.values()),e=["@shopify/app","@shopify/plugin-cloudflare"],r=n.filter(s=>e.includes(s.name));if(r.length>0){let s=r.map(i=>` - shopify plugins remove ${i.name}`).join(`
21
+ `),{renderWarning:o}=await import("./ui-YMBFS3NG.js");o({headline:`Unsupported plugins detected: ${r.map(i=>i.name).join(", ")}`,body:["They are already included in the CLI and installing them as custom plugins can cause conflicts.",`You can fix it by running:
22
+ ${s}`]})}let t=n.filter(s=>!e.includes(s.name));a.plugins=new Map(t.map(s=>[s.name,s]))}var cn=E;export{B as a,cn as b};
@@ -1,4 +1,4 @@
1
- import{a as F,b as c,c as P}from"./chunk-HF4NDEX3.js";import{a as I}from"./chunk-6PUU6ZNQ.js";import{a as S}from"./chunk-QW52RPAU.js";import{a as w}from"./chunk-YY6TFARF.js";import{a as j}from"./chunk-2L6AN3QA.js";import{e as g}from"./chunk-QFWWCZOI.js";import{p as v}from"./chunk-H6GYBLVQ.js";import{p as T,v as y}from"./chunk-YKMINHYY.js";import{b as d,c as b,f as n}from"./chunk-3KM5ZOW2.js";import{A as p,F as f}from"./chunk-D2KIGKBI.js";import{wb as a}from"./chunk-JLQRDFR5.js";import{b as h}from"./chunk-FZCGRIOM.js";import{b as k}from"./chunk-YTUUU33R.js";import{e as R,g as r}from"./chunk-VKWPEFWQ.js";r();r();var x=I.extend({changed:h.boolean(),theme:F}),s=g({name:"ThemePublishResult",schema:h.object({status:h.literal("success"),changed:h.boolean(),theme:c}).strict(),definitions:{Theme:c},project(t){let e=x.parse(t);return{status:e.status,changed:e.changed,theme:P(e.theme)}}});r();function O(t,e,m){if(e==="json"){a(s.encode(t.data));return}p({headline:m?`Environment: ${m}`:void 0,body:["The theme",...S(t.originalTheme),t.data.changed?"is now live at":"is already live at",{link:{label:t.previewUrl,url:t.previewUrl}},{char:"."}]})}r();async function M(t,e,m){let o=await j(t,{header:"Select a theme to publish",filter:{development:!1,live:!1,theme:e.theme}}),i=w({...o,role:"live"},t);return o.role==="live"?{data:{status:"success",changed:!1,theme:{...o,shop:t.storeFqdn}},originalTheme:o,previewUrl:i}:!e.force&&!m&&!await f({message:`Do you want to make '${o.name}' the new live theme on ${t.storeFqdn}?`,confirmationMessage:`Yes, make '${o.name}' the new live theme`,cancellationMessage:"No, cancel publish"})?void 0:{data:{status:"success",changed:!0,theme:{...await v(o.id,t),shop:t.storeFqdn}},originalTheme:o,previewUrl:i}}var u=R(k(),1);var l=class extends y{static get jsonOutputSchema(){return s}static summary="Set a remote theme as the live theme.";static descriptionWithMarkdown=`Publishes an unpublished theme from your theme library.
1
+ import{a as F,b as c,c as P}from"./chunk-YR4J46US.js";import{a as I}from"./chunk-FRWQJAW2.js";import{a as S}from"./chunk-TXMZPF2U.js";import{a as w}from"./chunk-YY6TFARF.js";import{a as j}from"./chunk-GQ3LY7BY.js";import{p as v}from"./chunk-RSNFNZ6F.js";import{e as g}from"./chunk-7HECBXSP.js";import{p as T,v as y}from"./chunk-VVHJ2AUF.js";import{b as d,c as b,f as n}from"./chunk-IKXUYCK7.js";import{D as f,y as p}from"./chunk-7A4ZE5IS.js";import{zb as a}from"./chunk-OIQ5NQ5I.js";import{b as h}from"./chunk-3PYDIBTX.js";import{b as k}from"./chunk-VBPMVVLV.js";import{e as R,g as r}from"./chunk-VKWPEFWQ.js";r();r();var x=I.extend({changed:h.boolean(),theme:F}),s=g({name:"ThemePublishResult",schema:h.object({status:h.literal("success"),changed:h.boolean(),theme:c}).strict(),definitions:{Theme:c},project(t){let e=x.parse(t);return{status:e.status,changed:e.changed,theme:P(e.theme)}}});r();function O(t,e,m){if(e==="json"){a(s.encode(t.data));return}p({headline:m?`Environment: ${m}`:void 0,body:["The theme",...S(t.originalTheme),t.data.changed?"is now live at":"is already live at",{link:{label:t.previewUrl,url:t.previewUrl}},{char:"."}]})}r();async function M(t,e,m){let o=await j(t,{header:"Select a theme to publish",filter:{development:!1,live:!1,theme:e.theme}}),i=w({...o,role:"live"},t);return o.role==="live"?{data:{status:"success",changed:!1,theme:{...o,shop:t.storeFqdn}},originalTheme:o,previewUrl:i}:!e.force&&!m&&!await f({message:`Do you want to make '${o.name}' the new live theme on ${t.storeFqdn}?`,confirmationMessage:`Yes, make '${o.name}' the new live theme`,cancellationMessage:"No, cancel publish"})?void 0:{data:{status:"success",changed:!0,theme:{...await v(o.id,t),shop:t.storeFqdn}},originalTheme:o,previewUrl:i}}var u=R(k(),1);var l=class extends y{static jsonOutputSchema=s;static summary="Set a remote theme as the live theme.";static descriptionWithMarkdown=`Publishes an unpublished theme from your theme library.
2
2
 
3
3
  If no theme ID is specified, then you're prompted to select the theme that you want to publish from the list of themes in your store.
4
4
 
@@ -0,0 +1 @@
1
+ import{Q as r}from"./chunk-7FBOMPO5.js";import{a}from"./chunk-U5BKU3OL.js";import{p as i}from"./chunk-IWTNUJGY.js";import{g as e}from"./chunk-VKWPEFWQ.js";e();var c=3e3;async function n(o){let t;try{if(a.getAllPublicMetadata().api_key!==void 0)return;await Promise.race([r({directory:o,skipPrompts:!0}),new Promise(l=>{t=setTimeout(l,c)})])}catch{}finally{t&&clearTimeout(t)}}var m=async()=>(await n(i()),a.getAllPublicMetadata()),f=m;export{f as a};
@@ -0,0 +1 @@
1
+ import{g as r}from"./chunk-VKWPEFWQ.js";r();import t from"crypto";function o(e){return t.createHash("sha256").update(e).digest()}function c(e){return t.createHash("sha1").update(e).digest("hex")}function d(e){return t.createHash("md5").update(e).digest("hex")}function p(){return t.randomUUID()}function s(e){return t.createHash("sha1").update(Buffer.from("6ba7b810-9dad-11d1-80b4-00c04fd430c8".replace(/-/g,""),"hex")).update(e).digest().toString("hex").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5")}export{o as a,c as b,d as c,p as d,s as e};
@@ -0,0 +1 @@
1
+ import{b as p,c as T,f as J}from"./chunk-4LJERO23.js";import{O as C,R as S,z as m}from"./chunk-7A4ZE5IS.js";import{a as g}from"./chunk-LG3KEHGD.js";import{l as F}from"./chunk-FJOVMEPN.js";import{Fb as P,Sa as v,ma as x,zb as W}from"./chunk-OIQ5NQ5I.js";import{b as o}from"./chunk-3PYDIBTX.js";import{c as w}from"./chunk-IWTNUJGY.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();var j=()=>o.unknown().refine(e=>e!==void 0,"The native value must be present."),E=g({name:"FunctionRunResult",schema:o.object({name:o.string(),size:o.number().int().nonnegative().describe("Module size in kilobytes, as reported by Function runner."),memory_usage:o.number().int().nonnegative().describe("Linear memory usage in kilobytes, as reported by Function runner."),instructions:o.number().int().nonnegative(),logs:o.string(),input:j().describe("Native Function input; query keys and values are preserved."),output:j().describe("Native Function output, including the runner-specific invalid-output representation."),success:o.boolean().describe("False for a completed Function execution that failed.")}).passthrough().describe("The native JSON object produced by Function runner 7.x and 9.x. Extra upstream fields are preserved.")});s();import{Writable as _}from"stream";async function $(e){if(e.features.includes("function")&&e.isJavaScript){let t=await J(e);return p(t.functionRunner)}return p()}function q(e){return e.configuration.build?.path?w(e.directory,e.configuration.build.path):e.outputPath}var l="The profile won't contain names for your function.",R="JavaScript functions built with Javy don't include a WebAssembly function name section, regardless of the wasm_opt setting. Function names will appear as <unknown> in the profile.",B="The built WebAssembly module doesn't contain a function name section. The default wasm-opt step removes this section, and the function compiler can also omit it. To preserve function names, set wasm_opt = false under [extensions.build] in shopify.extension.toml, configure the compiler to emit function names, and rebuild the function.";async function z(e,t){try{if(!await v(t))return;let r=x(t);if(!WebAssembly.validate(r))return;let i=new WebAssembly.Module(r);return WebAssembly.Module.customSections(i,"name").length>0?void 0:e.isJavaScript?"javascript":"wasm"}catch{return}}function O(e){e==="javascript"?m({headline:l,body:R}):m({headline:l,body:["The built WebAssembly module doesn't contain a function name section. The default wasm-opt step removes this section, and the function compiler can also omit it. To preserve function names, set ",{userInput:"wasm_opt = false"}," under ",{userInput:"[extensions.build]"}," in shopify.extension.toml, configure the compiler to emit function names, and rebuild the function."]})}async function te(e){let{command:t,args:r,processOptions:i,warningType:a}=await k(e);return a&&O(a),S(t,r,{...i,stdout:e.stdout??"inherit",stderr:e.stderr??"inherit"})}async function k(e){let t=await $(e.functionExtension);await T(t);let r=q(e.functionExtension);return{command:t.path,args:["-f",r,...M(e)],processOptions:{cwd:e.functionExtension.directory,stdin:e.stdin,input:e.input},warningType:e.profile?await z(e.functionExtension,r):void 0}}function M(e){let t=[];return e.inputPath&&t.push("--input",e.inputPath),e.export&&t.push("--export",e.export),e.json&&t.push("--json"),e.profile&&t.push("--profile"),e.schemaPath&&e.queryPath&&(t.push("--schema-path",e.schemaPath),t.push("--query-path",e.queryPath)),t}async function ne(e){let t=e.json??!0,{command:r,args:i,processOptions:a,warningType:u}=await k({...e,json:t});!t&&u&&O(u);let h=u?[`${l} ${u==="javascript"?R:B}`]:[],f=[],y=d=>new _({write(A,I,N){f.push({stream:d,data:A}),N()}}),n=await C(r,i,{...a,stripFinalNewline:t,...t?{}:{stdout:y("stdout"),stderr:y("stderr")}});if(!t)return n.exitCode!==0?{state:"failed",message:`Function runner failed with exit code ${n.exitCode}.`,command:r,args:i,exitCode:n.exitCode,stderr:n.stderr,outputChunks:f}:{state:"completed-text",outputChunks:f};let b;try{b=JSON.parse(n.stdout)}catch(d){if(!(d instanceof SyntaxError))throw d;return{state:"failed",message:n.exitCode===0?"Function runner returned invalid JSON.":`Function runner failed with exit code ${n.exitCode}.`,command:r,args:i,exitCode:n.exitCode,stderr:n.stderr}}let c=E.schema.safeParse(b);return!c.success||n.exitCode!==0&&c.data.success?{state:"failed",message:c.success?`Function runner failed with exit code ${n.exitCode}.`:"Function runner returned an invalid result.",command:r,args:i,exitCode:n.exitCode,stderr:n.stderr}:{state:"completed",resultJson:n.stdout.trim(),exitCode:n.exitCode||+!c.data.success,diagnostics:n.stderr.trim()?[...h,n.stderr.trim()]:h}}s();function ae(e){if(e.state==="completed-text"||e.state==="failed"){for(let{stream:r,data:i}of e.outputChunks??[])process[r].write(i);if(e.state==="completed-text")return;let t=new F(e.message,e.command,e.args);throw t.details={exitCode:e.exitCode,stderr:e.stderr},t}for(let t of e.diagnostics)P(t);W(e.resultJson),e.exitCode!==0&&(process.exitCode=e.exitCode)}export{E as a,te as b,ne as c,ae as d};
@@ -1 +1 @@
1
- import{a as s}from"./chunk-64G5TGFF.js";import{a as e}from"./chunk-TAWCKJKP.js";import{a as o}from"./chunk-Y55T4IIQ.js";import{b as i}from"./chunk-ZJOX5HW4.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var t=class extends i{static description="View all the available UI kit components";static hiddenAliases=["kitchen-sink all"];static hidden=!0;async run(){await o(),await e(),await s()}};export{t as a};
1
+ import{a as s}from"./chunk-KN2JIDNO.js";import{a as e}from"./chunk-MKUXSM33.js";import{a as o}from"./chunk-UK3BDOHR.js";import{b as i}from"./chunk-PSREELSQ.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var t=class extends i{static description="View all the available UI kit components";static hiddenAliases=["kitchen-sink all"];static hidden=!0;async run(){await o(),await e(),await s()}};export{t as a};
@@ -0,0 +1 @@
1
+ import{a as Y}from"./chunk-5HBIIYSK.js";import{ha as P}from"./chunk-OIQ5NQ5I.js";import{a as X,c as p,g as a}from"./chunk-VKWPEFWQ.js";var R=p((pt,L)=>{a();function c(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}L.exports=c;c.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};c.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};c.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var i=this,u=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},r);return this._options.unref&&u.unref(),!0};c.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};c.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};c.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};c.prototype.start=c.prototype.try;c.prototype.errors=function(){return this._errors};c.prototype.attempts=function(){return this._attempts};c.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,r=0,i=0;i<this._errors.length;i++){var u=this._errors[i],n=u.message,o=(e[n]||0)+1;e[n]=o,o>=r&&(t=u,r=o)}return t}});var N=p(y=>{a();var B=R();y.operation=function(e){var t=y.timeouts(e);return new B(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};y.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],u=0;u<t.retries;u++)i.push(this.createTimeout(u,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(u,t)),i.sort(function(n,o){return n-o}),i};y.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,i=Math.round(r*t.minTimeout*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout),i};y.wrap=function(e,t,r){if(t instanceof Array&&(r=t,t=null),!r){r=[];for(var i in e)typeof e[i]=="function"&&r.push(i)}for(var u=0;u<r.length;u++){var n=r[u],o=e[n];e[n]=function(m){var l=y.operation(t),d=Array.prototype.slice.call(arguments,1),W=d.pop();d.push(function(C){l.retry(C)||(C&&(arguments[0]=l.mainError()),W.apply(this,arguments))}),l.attempt(function(){m.apply(e,d)})}.bind(e,o),e[n].options=t}}});var U=p((Et,q)=>{a();q.exports=N()});var A=p((gt,O)=>{"use strict";a();var I=Symbol();function G(e,t,r){let i=t[I];if(i)return t.stat(e,(n,o)=>{if(n)return r(n);r(null,o.mtime,i)});let u=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,u,u,n=>{if(n)return r(n);t.stat(e,(o,s)=>{if(o)return r(o);let m=s.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(t,I,{value:m}),r(null,s.mtime,m)})})}function H(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}O.exports.probe=G;O.exports.getMtime=H});var J=p((Ot,E)=>{"use strict";a();var V=X("path"),D=P(),Z=U(),tt=Y(),b=A(),f={};function _(e,t){return t.lockfilePath||`${e}.lock`}function k(e,t,r){if(!t.realpath)return r(null,V.resolve(e));t.fs.realpath(e,r)}function S(e,t,r){let i=_(e,t);t.fs.mkdir(i,u=>{if(!u)return b.probe(i,t.fs,(n,o,s)=>{if(n)return t.fs.rmdir(i,()=>{}),r(n);r(null,o,s)});if(u.code!=="EEXIST")return r(u);if(t.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));t.fs.stat(i,(n,o)=>{if(n)return n.code==="ENOENT"?S(e,{...t,stale:0},r):r(n);if(!j(o,t))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));F(e,t,s=>{if(s)return r(s);S(e,{...t,stale:0},r)})})})}function j(e,t){return e.mtime.getTime()<Date.now()-t.stale}function F(e,t,r){t.fs.rmdir(_(e,t),i=>{if(i&&i.code!=="ENOENT")return r(i);r()})}function v(e,t){let r=f[e];r.updateTimeout||(r.updateDelay=r.updateDelay||t.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,t.fs.stat(r.lockfilePath,(i,u)=>{let n=r.lastUpdate+t.stale<Date.now();if(i)return i.code==="ENOENT"||n?x(e,r,Object.assign(i,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,v(e,t));if(!(r.mtime.getTime()===u.mtime.getTime()))return x(e,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=b.getMtime(r.mtimePrecision);t.fs.utimes(r.lockfilePath,s,s,m=>{let l=r.lastUpdate+t.stale<Date.now();if(!r.released){if(m)return m.code==="ENOENT"||l?x(e,r,Object.assign(m,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,v(e,t));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,v(e,t)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function x(e,t,r){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),f[e]===t&&delete f[e],t.options.onCompromised(r)}function et(e,t,r){t={stale:1e4,update:null,realpath:!0,retries:0,fs:D,onCompromised:i=>{throw i},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),k(e,t,(i,u)=>{if(i)return r(i);let n=Z.operation(t.retries);n.attempt(()=>{S(u,t,(o,s,m)=>{if(n.retry(o))return;if(o)return r(n.mainError());let l=f[u]={lockfilePath:_(u,t),mtime:s,mtimePrecision:m,options:t,lastUpdate:Date.now()};v(u,t),r(null,d=>{if(l.released)return d&&d(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));z(u,{...t,realpath:!1},d)})})})})}function z(e,t,r){t={fs:D,realpath:!0,...t},k(e,t,(i,u)=>{if(i)return r(i);let n=f[u];if(!n)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));n.updateTimeout&&clearTimeout(n.updateTimeout),n.released=!0,delete f[u],F(u,t,r)})}function rt(e,t,r){t={stale:1e4,realpath:!0,fs:D,...t},t.stale=Math.max(t.stale||0,2e3),k(e,t,(i,u)=>{if(i)return r(i);t.fs.stat(_(u,t),(n,o)=>n?n.code==="ENOENT"?r(null,!1):r(n):r(null,!j(o,t)))})}function it(){return f}tt(()=>{for(let e in f){let t=f[e].options;try{t.fs.rmdirSync(_(e,t))}catch{}}});E.exports.lock=et;E.exports.unlock=z;E.exports.check=rt;E.exports.getLocks=it});var $=p((St,K)=>{"use strict";a();var nt=P();function ut(e){let t=["mkdir","realpath","stat","rmdir","utimes"],r={...e};return t.forEach(i=>{r[i]=(...u)=>{let n=u.pop(),o;try{o=e[`${i}Sync`](...u)}catch(s){return n(s)}n(null,o)}}),r}function ot(e){return(...t)=>new Promise((r,i)=>{t.push((u,n)=>{u?i(u):r(n)}),e(...t)})}function st(e){return(...t)=>{let r,i;if(t.push((u,n)=>{r=u,i=n}),e(...t),r)throw r;return i}}function at(e){if(e={...e},e.fs=ut(e.fs||nt),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}K.exports={toPromise:ot,toSync:st,toSyncOptions:at}});var dt=p((kt,h)=>{"use strict";a();var T=J(),{toPromise:g,toSync:w,toSyncOptions:M}=$();async function Q(e,t){let r=await g(T.lock)(e,t);return g(r)}function ct(e,t){let r=w(T.lock)(e,M(t));return w(r)}function mt(e,t){return g(T.unlock)(e,t)}function ft(e,t){return w(T.unlock)(e,M(t))}function ht(e,t){return g(T.check)(e,t)}function lt(e,t){return w(T.check)(e,M(t))}h.exports=Q;h.exports.lock=Q;h.exports.unlock=mt;h.exports.lockSync=ct;h.exports.unlockSync=ft;h.exports.check=ht;h.exports.checkSync=lt});export{dt as a};
@@ -0,0 +1 @@
1
+ import{b as f,d as r,e as h}from"./chunk-BQKF4SRH.js";import{a as l}from"./chunk-R5COVIJM.js";import{a as c}from"./chunk-K4KKSBUW.js";import{P as m}from"./chunk-7FBOMPO5.js";import{b as d}from"./chunk-IKXUYCK7.js";import{Bb as e}from"./chunk-OIQ5NQ5I.js";import{i as n}from"./chunk-B4OMIONW.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();var s=class g extends l{static summary="Watch and prints out changes to an app.";static hidden=!0;static flags={...d,...c};async run(){let{flags:t}=await this.parse(g),{app:o}=await m({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),i=new h(o);return await i.start(),e(`Watching for changes in ${o.name}...`),i.onEvent(async({app:y,extensionEvents:u,startTime:w,path:x})=>{e(`\u{1F195} Event [${f(w)}ms]`),e(` \u{1F4C2} ${x}`),u.forEach(a=>{switch(a.type){case r.Created:e(` \u2705 Extension created - ${n.green(a.extension.handle)}`);break;case r.Deleted:e(` \u274C Extension deleted: ${n.red(a.extension.handle)}`);break;case r.Updated:e(` \u{1F504} Updated: ${n.yellow(a.extension.handle)}`);break}})}),setInterval(()=>{},1<<30),{app:o}}};export{s as a};
@@ -0,0 +1,22 @@
1
+ import{a as Gt}from"./chunk-UOHNRH6E.js";import{b as Hr}from"./chunk-SAK42CAY.js";import{a as Gr}from"./chunk-XB7H2RYV.js";import{a as jr}from"./chunk-2PILNMHJ.js";import{a as Br}from"./chunk-L3DTONOI.js";import{a as Cr}from"./chunk-HUB4HDWN.js";import{a as kr,b as Lr,c as $r,d as Mr}from"./chunk-4RO35FFQ.js";import{a as Wr}from"./chunk-4ZS5354G.js";import{a as Dr}from"./chunk-JJQ3DJG5.js";import{a as Fr}from"./chunk-K5UVCBIP.js";import{a as qr}from"./chunk-5TOK5OJS.js";import{a as Or}from"./chunk-2EQRXSF6.js";import{a as Nr}from"./chunk-Q2CKRCPM.js";import{a as yr}from"./chunk-ZOU6SOXW.js";import{a as Er}from"./chunk-IATNIWOC.js";import{a as br}from"./chunk-PSNCWS3Q.js";import{a as ct,b as Ur,c as Rr}from"./chunk-FDFE3SSG.js";import{g as Sr}from"./chunk-OKRKVVTK.js";import{a as at}from"./chunk-3DB4EC62.js";import{d as st,p as it}from"./chunk-36S6MFJQ.js";import{a as Ar}from"./chunk-HRHJA5ZP.js";import{a as Tr}from"./chunk-H45S4MGC.js";import{a as xr}from"./chunk-TZOB52QK.js";import{b as vr,g as Le,j as nt,u as Pr}from"./chunk-RSNFNZ6F.js";import{a as Ir}from"./chunk-TDHIOONG.js";import{a as Ao,b as To,c as _o,d as Io}from"./chunk-AYGL6F3P.js";import{d as _r}from"./chunk-WHOD5I7N.js";import{a as gr,b as wr,c as So,d as Uo,e as ut,f as Ro,g as Co}from"./chunk-TLN4BKXJ.js";import{a as M,b as ot}from"./chunk-X5V7AGVU.js";import{a as pr,b as ur,e as Ce,g as dr,n as ke,o as V,t as H,v as mr,w as fr,x as hr}from"./chunk-FDSNRKGQ.js";import{a as lr}from"./chunk-MBAPM5HA.js";import{a as ko,b as Lo,c as $o,d as dt,e as Mo,f as Do,g as Fo,h as Oo,i as No,j as Wo,k as qo,l as Ho,m as Go,n as jo,o as Bo,p as mt}from"./chunk-NVDFXEQ5.js";import{a as wo,b as pt,d as ne,e as yo}from"./chunk-BQKF4SRH.js";import{a as vo,b as Po,c as xo,d as Eo,e as bo}from"./chunk-G3DXNSA2.js";import{a as Vr}from"./chunk-JLAN6JXJ.js";import{a as go}from"./chunk-Z3QZNLT5.js";import{a as ho}from"./chunk-R5COVIJM.js";import{a as Kr}from"./chunk-K4KKSBUW.js";import{C as Me,D as oe,P as fo,b as uo,l as mo}from"./chunk-7FBOMPO5.js";import{d as io,e as $e,f as co,g as lo,t as po}from"./chunk-4KBOLN7Q.js";import{A as eo,B as to,C as ro,D as oo,Q as no,V as so,Y as re,ga as ao,j as zr,k as G,l as Qr,q as Jr,x as lt,y as Xr,z as Zr}from"./chunk-4LJERO23.js";import{I as Yr,t as te,y as pe}from"./chunk-HEB4YYM6.js";import{d as ar}from"./chunk-HR6R7JXN.js";import{a as Q}from"./chunk-U5BKU3OL.js";import{B as be,Da as qt,T as Nt,W as K,d as $t,fa as Z,ha as Wt,j as Mt,p as Dt,t as Ft,v as Ot,w as Ee}from"./chunk-UORSJB4A.js";import{b as ir,c as cr,e as Ie}from"./chunk-IKXUYCK7.js";import{G as Ae,K as Zt,M as Te,R as _e,S as le,T as rt,U as rr,W as or,a as Lt,d as Ze,e as L,f as F,h as Se,i as Ue,j as jt,k as Bt,l as Kt,m as Vt,n as Yt,o as zt,p as et,q as tt,r as Qt,s as Jt,u as Xt,x as Re,z as ce}from"./chunk-7A4ZE5IS.js";import{a as Qn}from"./chunk-7UNQOKZW.js";import{e as xe,h as kt}from"./chunk-2KFYIYLI.js";import{b as Je,d as Ct}from"./chunk-QBRRFFMZ.js";import{a as St}from"./chunk-LG3KEHGD.js";import{d as Ht}from"./chunk-HI5FTI3M.js";import{j as _,k as er,m as tr,n as ee}from"./chunk-FJOVMEPN.js";import{a as De}from"./chunk-HJ24NEP5.js";import{Bb as z,Da as Tt,Eb as y,Fb as T,Ma as ve,P as Qe,Sa as O,Va as Pe,_a as _t,bb as It,gb as D,la as $,ta as we,tb as b,va as ye,vb as U}from"./chunk-OIQ5NQ5I.js";import{b as h,d as Ye,k as Xe}from"./chunk-3PYDIBTX.js";import{e as nr,g as sr}from"./chunk-A5BSUUNQ.js";import{b as zn}from"./chunk-VBPMVVLV.js";import{a as me}from"./chunk-JD5P5RAJ.js";import{c as A,e as ze,f as Ut,h as fe,i as he,j as ge,n as Rt,o as At}from"./chunk-IWTNUJGY.js";import{e as ie,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var Jn=300*1e3,Xn='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 Ko(t,e,r=Date.now()){for(;await Zn(t,e,r););}async function Zn(t,e,r){let o=await Le(t,e);if(!o||es(o,r))throw new _(Xn);return await le(3),o.processing}function es(t,e){return t.processing&&Date.now()-e>=Jn}var ts="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",rs="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",ft=3,Fe=class extends xr{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=kr(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){Lr(this.adminSession.storeFqdn,e)}removeTheme(){$r(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:vr,name:this.generateThemeName(this.context),src:ts};for(let o=0;o<ft;o++){y(`Attempt ${o}/${ft}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await nt(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),y(`Waiting for theme with id "${n.id}" to be processed`),await Ko(n.id,this.adminSession),n;throw new Error}catch(n){if(n instanceof tr||Pr(n))throw n;y(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}y(`Theme creation failed after ${ft} retries. Creating theme using fallback theme zip`);let r=await nt({...e,src:rs},this.adminSession);if(!r)throw y("Theme creation failed. Exiting process."),new ee(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var os={"theme:init":Ir,"theme:check":yr,"theme:console":Er,"theme:delete":br,"theme:dev":Rr,"theme:duplicate":Ar,"theme:info":Tr,"theme:language-server":Cr,"theme:list":Mr,"theme:metafields:pull":Wr,"theme:open":Dr,"theme:package":Fr,"theme:profile":Or,"theme:publish":Nr,"theme:preview":qr,"theme:pull":Hr,"theme:push":Gr,"theme:rename":jr,"theme:share":Br},ri=os;async function Vo(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(S=>S.isThemeExtension);if(n.length===0)return;if(K()){T("The theme app extension preview isn't available with SHOPIFY_SERVICE_ACCOUNT_TOKEN. Dev runs without it.");return}let a=n[0].directory,i=t.themeExtensionPort??9293,[l,m]=await Promise.all([Nt(t.storeFqdn),as(e)]),c=l.storeFqdn,[u,g]=await Promise.all([it(l),st(l)]),w=g?await at(t.storePassword,c,u):void 0,d=await ss(l,t.theme),f=d.id.toString();return Re({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:m}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${c}/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:ns,options:{theme:d,adminSession:l,storefrontPassword:w,crawlerSignatureHeaders:u,themeExtensionDirectory:a,themeExtensionPort:i}}}var ns=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await Sr(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function ss(t,e){let r;if(e)y(`Fetching theme with provided id ${e}`),r=await Le(parseInt(e,10),t);else{let o=new Fe(t,{devPreview:!0});await Ae([{title:"Configuring host theme for theme app extension",task:async()=>{y("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new _("Could not find or create a host theme for theme app extensions");return r}async function as(t){return t.developerPlatformClient?.clientName===po.AppManagement?`https://${await Ee()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Ot()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function is(t){let e=A(t.directory,"locales");return Pe([A(e,"*.json")])}async function Yo(t,e){let r=await is(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),cs(a,s,o,t,e)})),o.lastUpdated=Date.now(),y(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function cs(t,e,r,o,n){let s;try{s=await $(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw T(i,n.stderr),new Error(i)}}p();function Oe(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 ht=".js.map";async function se(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 Yo(t,r),l=await Qr(t),m=t.outputRelativePath?fe(n):n,c=await ls(t,s,m,o),u=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(u=zo(t.configuration.metafields)),{assets:{main:ue(c)&&c[0]?.assets?.main?c[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await ve(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:Oe(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:c,localization:a??null,metafields:u,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:l?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function ls(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"}]),ue(s)){let a=await ps(r);return Promise.all(s.map(async i=>{let{target:l,resource:m}=i,c="metafields"in i?zo(i.metafields??[]):void 0,u={...i,...c?{metafields:c}:{},surface:oe(l),root:{url:`${e}/${l}`},resource:m||{url:""}},g=a?.[l];if(!g)return u;let d=await gs(g,{target:l,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...u,...d}}))}return s}async function ps(t){try{let e=A(t,"manifest.json"),r=await $(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 us({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,l=e[s];if(typeof l=="string"){let w=await Ne(s,i,typeof a=="string"?a:l,r,o,n,typeof a=="string"?l:void 0);return{assets:{[w.name]:w}}}let c=e.build_manifest?.assets?.[s];if(c?.filepath){let u=await Ne(s,i,c.filepath,r,o,n,c.module);return{assets:{[u.name]:u}}}return{}}async function ds({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 ve(A(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function ms({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,l)=>{let m=i.schema,c=s[l]?.schema,u=typeof c=="string"?c:m,g=typeof c=="string"?m:void 0;return{...i,schema:await Ne("schema",`${t}/intents/${l}/schema`,u,r,o,n,g)}}))}:{}}async function fs({target:t,url:e,extension:r,resolver:o},n,s){let a=await Ne(n,`${t}/${n}`,s,e,r,o);return await hs(t,s,r,o),{assets:{[a.name]:a}}}async function hs(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(ht)&&await O(A(r.directory,n))&&o.set(`${t}/${he(n)}`,n)}async function gs(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return ws(o,n)?ms(e,n):ys(o,n)?fs(e,o,n):vs(o,n)?ds(e,o,n):us(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function zo(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function ue(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Ne(t,e,r,o,n,s,a){let i=`${e}${ge(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await ve(A(n.directory,a??r))??0}}function ws(t,e){return t==="intents"&&Array.isArray(e)}function ys(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function vs(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as Ps}from"events";var de;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(de||(de={}));async function Qo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:So(t.storeFqdn,t.apiKey),mobileUrl:Ro(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=>se(n,e,t,r&&gt(r,n.devUUID))))}}function gt(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var We=class extends Ps{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=Z(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(ue(n.extensionPoints)&&ue(o.extensionPoints)){let s=n.extensionPoints.reduce((l,m)=>({...l,[m.target]:m}),{});o.extensionPoints=Z(o.extensionPoints,n.extensionPoints,l=>l.map(m=>{let c=s[m.target];return c?Z(m,c,(u,g)=>g):m}));let{extensionPoints:a,...i}=n;return Z(o,i)}return Z(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){y(U`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await se(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},gt(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 se(e,r,this.options,gt(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(de.Update,e)}};p();p();var N;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(N||(N={}));var xs=h.discriminatedUnion("event",[h.object({event:h.literal(N.Update),data:h.object({app:h.object({apiKey:h.string()}).passthrough().optional(),extensions:h.array(h.object({uuid:h.string(),extensionPoints:h.union([h.array(h.string()),h.array(h.object({target:h.string()})),h.null()]).optional()})).optional()})}),h.object({event:h.literal(N.Dispatch),data:h.object({type:h.enum(["focus","unfocus"]),payload:h.array(h.object({uuid:h.string()})).optional()})}),h.object({event:h.literal(N.Log),data:h.object({type:h.string(),message:h.string(),extensionName:h.string()})})]);function Jo(t,e){return(r,o,n)=>{r.url==="/extensions"&&(y("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,Es(t,e)))}}function Es(t,e){return r=>{y("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};y(U`Sending connected payload: ${b.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",As(t,e)),r.on("error",n=>{y(`Websocket connection error: ${n.message}`,e.stdout)})}}function bs(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?b.json(o).output():String(o)).join(" ");return U`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var Ss={debug:t=>b.gray(t),warn:t=>b.yellow(t),error:t=>b.errorText(t)};function Us({type:t,message:e}){let r=bs(e);switch(t){case"debug":case"warn":case"error":return U`${Ss[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function Rs(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(Us(t))})}function As(t,e){return r=>{let o;try{o=JSON.parse(r.toString())}catch(a){if(a instanceof SyntaxError){y(`Ignoring websocket message that is not valid JSON: ${a.message}`,e.stdout);return}throw a}if(!xs.safeParse(o).success){y("Ignoring websocket message with an invalid shape",e.stdout);return}let{event:n,data:s}=o;if(y(U`Received websocket message with event type ${n} and data:
2
+ ${b.json(s)}
3
+ `,e.stdout),n===N.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===N.Dispatch){let a=Ts(o,e);Zo(t,a,e)}else n===N.Log&&Rs(s,e)}}function Xo(t,e){return r=>{let o={event:N.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};y(U`Sending websocket update event to the websocket clients:
4
+ ${b.json(o)}
5
+ `,e.stdout),Zo(t,o,e)}}function Zo(t,e,r){y(U`Sending websocket with event type ${e.event} and data:
6
+ ${b.json(e.data)}
7
+ `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function Ts(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var _s=10;function en(t){let e=new Gt.default({noServer:!0,clientTracking:!0}),r=Is(e);return t.httpServer.on("upgrade",Jo(e,t)),t.payloadStore.on(de.Update,Xo(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function Is(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},_s*1e3)}p();p();p();function tn(t,e){let{url:r}=Oe(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",qe(t,e)),o.toString()}}function rn(t,e,r){let o=oe(t),n=new URL(`https://${r.storeFqdn}/`);switch(o){case"checkout":if(!r.checkoutCartUrl)return;n.pathname=r.checkoutCartUrl,n.searchParams.append("dev",`${r.url}/extensions`);break;case"post_purchase":if(!r.checkoutCartUrl)return;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",qe(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":if(!r.storeId)return;n=Cs(e,r,t);break;default:return}return n.toString()}function Cs(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 qe(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function W(t,e){ur(t,pr(e))}p();var wt=class extends ee{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function on(t){let e=await ks(t),r=await $(e);return lr(r,t.data)}async function ks(t){let e=await Ls(),r=[];t.extensionSurface&&r.push(A(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(A(e,`${t.template}.html.liquid`));let o=await Pe(r);if(o.length===0)throw new wt(t);return o[0]}async function Ls(){return await _t("templates/ui-extensions/html",{type:"directory",cwd:At(import.meta.url)})}var nn=H(t=>{V(t,"Access-Control-Allow-Origin","*"),V(t,"Access-Control-Allow-Methods","GET, OPTIONS"),V(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),sn=H(t=>{V(t,"Cache-Control","no-cache")}),yt=H(async t=>ke(t,"/extensions",307));async function $s(t,e){let{filePath:r}=e;if(!await O(r))return W(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Tt(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await O(r)))return W(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await $(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=ge(r),a=n[s]||"text/plain";return V(t,"Content-Type",a),o}function an({getExtensions:t,payloadStore:e}){return H(async r=>{let{extensionId:o,assetPath:n=""}=Ce(r),s=t().find(g=>g.devUUID===o);if(!s)return W(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n),l=i??n,m=l.endsWith(ht);if(m&&i===void 0)return W(r,{statusCode:404,statusMessage:"Not Found"});let c=ze(m?s.directory:Jr(s.outputPath)),u=ze(A(c,l));return Rt(c,u)?$s(r,{filePath:u}):W(r,{statusCode:404,statusMessage:"Not Found"})})}function vt({payloadStore:t}){return H(e=>(V(e,"content-type","application/json"),t.getRawPayload()))}function cn({devOptions:t}){return H(e=>{y(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function Pt({devOptions:t,getExtensions:e}){return H(async r=>{let{extensionId:o}=Ce(r),n=e().find(i=>i.devUUID===o);if(!n)return W(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(dr(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return on({data:{url:qe(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=tn(n,t);return ke(r,i,307)}}let a=t.appWatcher.buildOutputPath;return V(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:ae(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await se(n,a,t)}})}function ln({devOptions:t,getExtensions:e}){return H(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Ce(r),s=e().find(i=>i.devUUID===o);if(!s)return W(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return W(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=rn(n,s,t);return a?ke(r,a,307):W(r,{statusCode:404,statusMessage:Ms(o,n,t)})})}function Ms(t,e,r){let o=`extension with id ${t} and extension target "${e}"`,n=oe(e);if((n==="checkout"||n==="post_purchase")&&!r.checkoutCartUrl)return`Can't preview ${o} without a cart. Restart dev with --checkout-cart-url, in the format "/cart/{productVariantID}:{productQuantity}"`;if(n==="customer-accounts"&&!r.storeId){let s=K()?", which dev can't look up with SHOPIFY_SERVICE_ACCOUNT_TOKEN":", which dev could not find";return`Can't preview ${o}: customer account previews need the store's ID${s}`}return`Redirect url can't be constructed for ${o}`}import{createServer as Ds}from"http";function pn(t){let e=mr(),r=fr();e.use(cn(t)),e.use(nn),e.use(sn),r.use("/extensions/dev-console",yt),r.use("/extensions/:extensionId",Pt(t)),r.use("/extensions/:extensionId/",Pt(t)),r.use("/extensions/:extensionId/:extensionPointTarget",ln(t)),r.use("/extensions/:extensionId/assets/**:assetPath",an(t)),r.use("/extensions",vt(t)),r.use("/extensions/",vt(t)),r.use("/",yt),e.use(r);let o=Ds(hr(e));return o.listen(t.devOptions.port,"localhost"),o}async function un(t){let e={...t,websocketURL:ae(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Qo(e,r,o),s=new We(n,e,o),a=e.extensions.filter(u=>u.isPreviewable),i=()=>a;y("Setting up the UI extensions HTTP server...",e.stdout);let l=pn({devOptions:e,payloadStore:s,getExtensions:i});y("Setting up the UI extensions Websocket server...",e.stdout);let m=en({...e,httpServer:l,payloadStore:s});y("Setting up the UI extensions bundler and file watching...",e.stdout);let c=async({appWasReloaded:u,app:g,extensionEvents:w})=>{u&&(a=g.allExtensions.filter(d=>d.isPreviewable));for(let d of w){if(!d.extension.isPreviewable)continue;let f=d.buildResult?.status==="ok"?"success":"error",S=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case ne.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl&&K())d.extension.shouldFetchCartUrl()&&T(`${d.extension.localIdentifier} can't be previewed without a cart. Restart dev with --checkout-cart-url, in the format "/cart/{productVariantID}:{productQuantity}".`,e.stderr);else if(!e.checkoutCartUrl){let E=await Me(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(d.extension,r);break;case ne.Updated:await s.updateExtension(d.extension,e,r,{status:f,error:S});break;case ne.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==d.extension.devUUID),await s.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(c).onStart(c),e.signal.addEventListener("abort",()=>{y("Closing the UI extensions dev server..."),m.close(),l.close()})}function ae(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var Fs="3",Os=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:l,proxyUrl:m,appName:c,appDotEnvFile:u,appId:g,grantedScopes:w,allExtensions:d,appDirectory:f,appWatcher:S})=>{await un({appName:c,appDotEnvFile:u,appDirectory:f,id:g,extensions:d,stdout:e,stderr:t,signal:r,url:m,port:i,storeFqdn:be(n),storeId:s,apiKey:o,grantedScopes:w,checkoutCartUrl:l,subscriptionProductUrl:a,manifestVersion:Fs,appWatcher:S})};async function dn({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await Me(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:Os,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();function J(t){let e=t.find(o=>re(o,G.Frontend)),r=t.find(o=>re(o,G.Backend));return{frontendConfig:e,backendConfig:r}}p();async function mn(t){let r={topic:"app/uninstalled",api_version:(await Ao(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:Io.LOCALHOST,shared_secret:t.sharedSecret},o=await To(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await le(3);let n=await Ns(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function Ns(t,e){let r=0;for(;r<3;){try{return await _o(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof Mt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await le(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var Ws=async({stdout:t},e)=>{await mn({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function fn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=J(t),l=t.map(({configuration:c})=>c.webhooks_path).find(c=>c)??"/api/webhooks";if(l&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:Ws,options:{deliveryPort:a?r:o,webhooksPath:l,organizationId:n,...s}}}p();async function hn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:qs}}var qs=async({stdout:t,abortSignal:e},r)=>{let o=Co({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=wr({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(),n.closeAllConnections()})};p();async function wn({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=J(t),l=i?.configuration.hmr_server?await M():void 0,m=void 0,c=t.map(async u=>{let g=await Hs({web:u,frontendPort:r,backendPort:o}),w=l&&u.configuration.roles.includes(G.Frontend)?{port:l,httpPaths:u.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:u.configuration.name??["web",...u.configuration.roles].join("-"),function:Gs,options:{port:g,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:m,hmrServerOptions:w,roles:u.configuration.roles}}});return Promise.all(c)}async function Hs({web:t,frontendPort:e,backendPort:r}){return re(t,G.Frontend)?e:re(t,G.Backend)?r:M()}async function Gs({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:l,directory:m,devCommand:c,preDevCommand:u,scopes:g,shopCustomDomain:w,hmrServerOptions:d}){let f=d?.port,S={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:g,NODE_ENV:"development",...w&&{SHOP_CUSTOM_DOMAIN:w},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${l}`,...f&&{HMR_SERVER_PORT:`${f}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:m,port:o,env:S,stdout:t,stderr:e};u&&(t.write(`Running pre-dev command: "${u}"`),await gn({...E,command:u,showOutput:nr()})),await gn({...E,command:c,showOutput:!0})}async function gn({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let l=t.split("&&").map(m=>m.trim())??[];for(let m of l){let[c,...u]=m.split(" ");c?.length!==0&&await _e(c,u,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var He=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(U`${b.yellow(e)}`.value)}async success(e){await this.log(U`${b.green(e)}`.value)}async debug(e){y(e,this.stdout)}async error(e,r){let o=b.errorText("\u274C Error"),n=b.errorText(`\u2514 ${e}`);await this.log(U`${o}`.value,r),await this.log(U`${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 l=>l.type===ne.Deleted?[]:(await l.extension.getDevSessionUpdateMessages(o))?.map(c=>({message:c,prefix:l.extension.handle}))??[]))).flat(),i=a.map((l,m)=>{let c=U`${b.gray(m===a.length-1?"\u2514 ":"\u2502 ")}${l.message}`.value;return this.log(c,l.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=b.errorText("\u274C Error");await this.log(U`${r}`.value,"app-preview");let o=e.map(n=>{let s=b.errorText(`\u2514 ${n.error}`);return this.log(U`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(`${e}
8
+ `)})}};p();var Ge=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 je=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 He(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ge(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=wo(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${pt(n)}ms - Total: ${pt(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)this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new _(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:o.buildResult?.status==="error"&&o.buildResult.error||"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){if(e.status==="updated")await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage();else if(e.status==="created")this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r,e),this.statusManager.setMessage("READY");else if(e.status==="remote-error"||e.status==="unknown-error"){let o=e.error instanceof Error?[e.error.message]:e.error.map(n=>n.message);await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR",o):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR",o))}!this.statusManager.status.isReady&&!sr()&&setImmediate(()=>{throw new _("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=ae(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionCreateWithRetry(i)}}catch(r){if(r instanceof er)throw r;if(r.statusCode===401)throw new _("Auth session expired. Please run `shopify app dev` again.");if(r instanceof $t)throw r.response.status===401||r.response.status===403?new _("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new _("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 vo(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await It(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=A(fe(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...Po];r&&n.push("manifest.json"),await xo(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await Eo(s,o),s}async getSignedURLWithRetry(){return bo(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.warnings??[],s=r.devSessionUpdate?.devSession;if(s&&this.currentSessionState){let a=ae(this.options.url),i=this.currentSessionState?.userId;if(s.websocketUrl!==a||s.user?.id!==i){let l=s.user?.email;await this.logger.error(`Another developer ${l?`(${l}) `:""}has taken ownership of this dev preview.`);let m=`Another user${l?` (${l})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,c=["You can restart by running",{command:"shopify app dev"},"again."];throw new _(m,c)}this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}}return n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],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 this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"created"}}async logWarnings(e){await Promise.all(e.map(r=>{let o=r.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${r.message}`:r.message;return this.logger.warning(o)}))}};async function yn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:js,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var js=async({stdout:t},e)=>{await je.start(e,t)};p();p();p();var vn=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=Ct().substring(0,6),i=`${Bs(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,l=Bo({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),m=A(n,i);try{return await ye(n),await we(m,l),{fullOutputPath:m,identifier:s}}catch(c){throw r.write(`Error while writing log to file: ${c}
9
+ `),c}};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"),l=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${l}Z`}var Be=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:m=0})=>{if(!i?.aborted)try{let c=e,u=$o,g=m,w=await o.appLogs({jwtToken:e,cursor:r},a),{errors:d,status:f}=w;if(f===200){g=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===Fo?(Ks(R,x,t),x=new ko(Lo(x))):R.log_type.startsWith(Oo)?Vs(R,x,t):t.write(JSON.stringify(x));let C=await vn({appLog:R,appLogPayload:x,stdout:t,storeName:s,logsDir:l});t.write(U`${b.gray("\u2514 ")}${b.link("Open log file",`file://${C.fullOutputPath}`,`Log: ${C.fullOutputPath}`)} ${b.gray(`(${C.identifier})`)}\n`.value)})}}else{let E={errors:d.map(x=>({message:x,status:f}))},R=await jo({response:E,onThrottle:x=>{T("Request throttled while polling app logs.",t),T(`Retrying in ${x/1e3} seconds.`,t)},onUnknownError:x=>{T("Error while polling app logs.",t),T(`Retrying in ${x/1e3} seconds.`,t)},onResubscribe:()=>n()});if(R.resubscribeResult==="failed"){if(g+=1,g>=Mo){T("App log streaming session has expired. Please restart your dev session.",t);return}}else R.resubscribeResult==="succeeded"&&(g=0);R.nextJwtToken&&(c=R.nextJwtToken),u=R.retryIntervalMs}let{cursor:S}=w;setTimeout(()=>{Be({stdout:t,appLogsFetchInput:{jwtToken:c,cursor:S??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:g}).catch(E=>{y(`Unexpected error during polling: ${E}}
10
+ `)})},u)}catch(c){T("Error while polling app logs.",t),T(`Retrying in ${dt/1e3} seconds.`,t),y(`${c}}
11
+ `),setTimeout(()=>{Be({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l}).catch(u=>{y(`Unexpected error during polling: ${u}}
12
+ `)})},dt)}};function Ks(t,e,r){let o=(e.fuel_consumed/Do).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
13
+ `).filter(Boolean).map(s=>U`${b.gray("\u2502 ")}${s}`.value).join(`
14
+ `))}function Vs(t,e,r){t.log_type===No?r.write("Function network access response retrieved from cache."):t.log_type===Wo?e.reason===Ho?r.write("Function network access request executing in background because there is no cached response."):e.reason===Go&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===qo&&(t.status==="success"?r.write("Function network access request executed successfully."):t.status==="failure"&&r.write(`\u274C Function network access request failed to execute with error: ${e.error}.`))}function Ys(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function Pn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:zs,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var zs=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:l})=>{async function m(c){let u=await mt(o,n,a,t),g=l.getLogsDir();await ye(g),await Be({stdout:t,appLogsFetchInput:{jwtToken:u},resubscribeCallback:()=>mt(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:c,logsDir:g})}try{let c=!1,u,g=async w=>{let d=Ys(w.app);if(d&&!c){y("Function extensions detected, starting logs polling"),c=!0,u=new AbortController;try{await m(u.signal)}catch(f){y(`Failed to start function logs: ${f}`,e)}}else!d&&c&&(y("No function extensions detected, stopping logs polling"),c=!1,u?.abort(),u=void 0)};i.onStart(g).onEvent(g)}catch{}};p();async function xn(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:Qs}}var Qs=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};p();import{EventEmitter as Js}from"events";var Xs={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},Ke=class extends Js{currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0};constructor(e){super(),e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};Wt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e,r){let o=Xs[e],n=o.type==="success"?[]:r;this.updateStatus({statusMessage:o,...n?{errors:n}:{}})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};p();import*as En from"http";import*as bn from"https";function Sn(t){return"errors"in t&&Array.isArray(t.errors)}async function Un(t,e,r,o){let s=(await import("./http-proxy-node16-NZZ674YW.js")).default.createProxyServer(),a=ea(t,s,o),i=r?bn.createServer(r,a):En.createServer(a);return i.on("upgrade",Zs(t,s,o)),e.addEventListener("abort",()=>{y("Closing reverse HTTP proxy"),i.close()}),{server:i}}function Zs(t,e,r){return function(o,n,s){let a=Rn(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let m=(Sn(i)?i.errors[i.errors.length-1]:void 0)??i;T(`Error forwarding websocket request: ${m.message}`,r),T(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function ea(t,e,r){return function(o,n){let s=Rn(t,o);if(s)return o.method==="OPTIONS"?(n.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin??"*","Access-Control-Allow-Methods":o.headers["access-control-request-method"]??"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]??"Content-Type, Authorization","Access-Control-Max-Age":"86400"}),n.end()):e.web(o,n,{target:s},a=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let l=(Sn(a)?a.errors[a.errors.length-1]:void 0)??a;T(`Error forwarding web request: ${l.message}`,r),T(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});y(U`
15
+ Reverse HTTP proxy error - Invalid path: ${o.url??""}
16
+ These are the allowed paths:
17
+ ${b.json(JSON.stringify(t))}
18
+ `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function Rn(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}function ta(t){t.allExtensions.some(e=>e.isFunctionExtension)&&T("Function logs aren't streamed, because dev doesn't know the store's ID.")}async function An({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:l,graphiqlKey:m,apiSecret:c}){let u=o.apiKey,g=xe(),w=!me(g[te.disableGraphiQLExplorer]),d=await so(t),f=c??(d.webs.length>0?await $e(o):void 0),S=w&&f!==void 0,E=new yo(d,i.proxyUrl),R=await Ee(),x=Uo(n,u,R),C=x,j=f===void 0?void 0:gr(m,f,n),B=S&&j?`http://localhost:${l}/graphiql?key=${encodeURIComponent(j)}`:void 0,Y=d.configuration.embedded,P=d.nonConfigExtensions.length>0,q=new Ke({isReady:!1,previewURL:C,graphiqlURL:B,appEmbedded:Y,hasExtensions:P}),Ve=[...f===void 0?[]:await wn({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:u,apiSecret:f,scopes:zr(d.configuration)}),S&&f!==void 0?await hn({appName:o.title,appUrl:x,port:l,apiKey:u,apiSecret:f,key:j,storeFqdn:n}):void 0,await dn({allExtensions:d.realExtensions,storeFqdn:n,storeId:s,apiKey:u,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:E}),await yn({app:d,apiKey:u,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:E,appPreviewURL:x,devSessionStatusManager:q,unsafeValidation:a.unsafeValidation}),await Vo({remoteApp:o,localApp:d,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),f===void 0?void 0:fn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:f,remoteAppUpdated:e}),s===void 0?ta(d):await Pn({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:u},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:E}),await xn({appWatcher:E})].filter(ra);return{processes:await oa(Ve,i.proxyPort,i.reverseProxyCert),previewUrl:C,graphiqlUrl:B,devSessionStatusManager:q}}var ra=t=>t!==void 0&&t!==!1;async function oa(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(G.Frontend)){let l=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${l}`;let m=a.options.hmrServerOptions;m&&(i.websocket=`http://localhost:${m.port}`,m.httpPaths.forEach(c=>i[c]=`http://localhost:${m.port}`)),a.options.port=l}else if(a.type==="previewable-extension"){let l=await M();i[a.options.pathPrefix]=`http://localhost:${l}`,a.options.port=l}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:na,options:{port:e,rules:s,localhostCert:r}}),n}var na=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await Un(o,t,n,e);z(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();async function Tn({remoteApp:t,hasWebs:e,graphiqlEnabled:r}){if(e)return $e(t);if(!r)return;let o=await io(t);return o||T(`GraphiQL isn't available because the App Management API didn't return the app's client secret for your credentials. ${lo()} ${co()}`),o}p();p();p();var I=ie(Ze(),1);var _n=.9,In=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=jt(),{isRawModeSupported:o}=Se(),[n,s]=(0,I.useState)(e),[a,i]=(0,I.useState)(Math.floor(r.columns*_n)),[l,m]=(0,I.useState)(!0),c=(0,I.useRef)(null);if(!n)throw new Error("No tabs provided");Ue((d,f)=>{(async()=>{if(f?.leftArrow||f?.rightArrow||f?.tab){let x=Object.entries(t).filter(([P,q])=>q.content),C=x.findIndex(([P])=>P===n);if(C===-1)return;let j=f?.leftArrow?-1:1,B=(C+j+x.length)%x.length,Y=x[B];Y&&s(Y[0])}let E=t[d];if(E){E.action?await E.action():s(d);return}let R=t[n];if(R?.shortcuts){let x=R.shortcuts.find(C=>C.key===d);x&&(!x.condition||x.condition())&&await x.action()}})()},{isActive:!!o}),(0,I.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*_n)),!c.current)return;let f=Bt(c.current);m(f.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let u=Object.entries(t).map(([d,f])=>({...f,inputKey:d,header:` (${d}) ${f.label} `})),g=u.filter(d=>!d.action),w=u.filter(d=>d.action);return I.default.createElement(I.default.Fragment,null,I.default.createElement(L,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},I.default.createElement(L,{ref:c,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},I.default.createElement(F,{wrap:"truncate-end"},"\u2502",g.map(d=>I.default.createElement(I.default.Fragment,{key:d.inputKey},I.default.createElement(F,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),l&&I.default.createElement(L,{flexGrow:1,justifyContent:"flex-end"},w.map((d,f)=>I.default.createElement(F,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,f<w.length-1&&" \u2502 ")))),I.default.createElement(L,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var v=ie(Ze(),1);var sa=({message:t,type:e})=>e==="loading"?v.default.createElement(Xt,{title:t}):v.default.createElement(F,null,e==="success"?"\u2705":"\u274C"," ",t),Cn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:l,onAbort:m})=>{let{isRawModeSupported:c}=Se(),[u,g]=(0,v.useState)(void 0),[w,d]=(0,v.useState)(void 0),[f,S]=(0,v.useState)(r.status),[E,R]=(0,v.useState)(!1),{isAborted:x}=Jt(t.signal,async P=>{P&&d(typeof P=="string"?P:P.message),r.status.isReady?R(!0):(g("Shutting down dev ..."),await m()),De()}),C=(0,v.useMemo)(()=>e.map(P=>({...P,action:async(q,Ve,bt)=>{try{return await P.action(q,Ve,bt)}catch(Yn){t.abort(Yn)}}})),[e,t]);(0,v.useEffect)(()=>(r.on("dev-session-update",S),()=>{r.off("dev-session-update",S)}),[]),Ue((P,q)=>{Vt(P,q,()=>t.abort())},{isActive:!!c});let j=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:f.previewURL,condition:()=>!!(f.isReady&&f.previewURL),action:async()=>{await Q.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),f.previewURL&&await Te(f.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:ut(o),condition:()=>!!(f.isReady&&f.appEmbedded===!1&&f.hasExtensions),action:async()=>{await Q.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Te(ut(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:f.graphiqlURL,condition:()=>!!(f.isReady&&f.graphiqlURL),action:async()=>{await Q.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),f.graphiqlURL&&await Te(f.graphiqlURL)}}],B=j.filter(P=>P.condition?.()??!0),Y={d:{label:"Dev status",shortcuts:j,content:v.default.createElement(v.default.Fragment,null,f.statusMessage&&v.default.createElement(sa,{message:f.statusMessage.message,type:f.statusMessage.type}),c&&B.length>0&&v.default.createElement(L,{marginTop:1,flexDirection:"column"},B.map(P=>v.default.createElement(F,{key:P.key},Yt.pointerSmall," ",v.default.createElement(F,{bold:!0},"(",P.key,")")," ",rt()&&P.url?v.default.createElement(et,{url:P.url,label:P.shortcutLabel}):P.shortcutLabel))),v.default.createElement(L,{marginTop:c?1:0,flexDirection:"column"},u?v.default.createElement(F,null,u):v.default.createElement(v.default.Fragment,null,f.isReady&&!(c&&rt())&&v.default.createElement(v.default.Fragment,null,B.filter(P=>P.url).map(P=>v.default.createElement(F,{key:P.key},P.linkLabel," URL: ",v.default.createElement(et,{url:P.url})))))))},a:{label:"App info",content:v.default.createElement(L,{flexDirection:"column"},v.default.createElement(tt,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":l??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,P])=>P)}))},s:{label:"Store info",content:v.default.createElement(L,{flexDirection:"column"},v.default.createElement(tt,{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 v.default.createElement(v.default.Fragment,null,v.default.createElement(zt,{processes:C,prefixColumnSize:Yr,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&v.default.createElement(L,{marginTop:1,flexDirection:"column"},v.default.createElement(Qt,{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:v.default.createElement(L,{paddingTop:1,flexDirection:"column",flexGrow:1},c?v.default.createElement(In,{tabs:Y,initialActiveTab:"d"}):v.default.createElement(L,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},Y.d?.content)),w?v.default.createElement(L,{marginTop:1,flexDirection:"column"},v.default.createElement(F,{color:"red"},w)):null)};var Ln=ie(Ze(),1);import{Writable as $n}from"stream";async function Mn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:l,organizationName:m,configPath:c,localURL:u}){let g=()=>o.abort();process.on("shopify:signal",g);try{if(Xe()!=="json"&&rr())return await Kt(Ln.default.createElement(Cn,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:l,organizationName:m,configPath:c,localURL:u,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await aa({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o}),De()}finally{process.removeListener("shopify:signal",g)}}async function aa({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){let n=Xe()==="json";n||(process.stdout.write(`
19
+ Preview URL: ${e}
20
+ `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
21
+ `));let{signal:s}=o,a=()=>o.abort();process.once("SIGINT",a),process.once("SIGTERM",a);let i=()=>{},l=new Promise(c=>{i=c,s.addEventListener("abort",i,{once:!0}),s.aborted&&c()}),m=t.map(async c=>{let u=new $n({write:(g,w,d)=>d()});return c.action(n?u:kn(process.stdout),n?u:kn(process.stderr),s)});try{await Promise.all([...m,l])}catch(c){if(!s.aborted)throw c}finally{o.abort(),await Promise.allSettled(m),s.removeEventListener("abort",i),process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a)}}function kn(t){return new $n({decodeStrings:!1,write(e,r,o){let n=typeof e=="string"?Buffer.from(e,r):e,s=typeof e=="string"&&n.length>0&&n[n.length-1]!==10;t.write(s?Buffer.concat([n,Buffer.from(`
22
+ `)]):n,o)}})}p();function Dn(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];ce({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=Qe(e.map(n=>n.for)).join(" "),o=Qe(e.map(n=>({command:n.flagToRemedy})));ce({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 Fn(t,e){return e?e.includes("localhost")?"localhost":(await Ft(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var On=ie(Qn(),1);var X="v1.4.4",Nn="FiloSottile/mkcert",xt=b.genericShellCommand("mkcert");async function ia(t,e,r,o){let n=e[te.mkcertBinaryPath];if(n)return n;let a=A(t,r==="win32"?"mkcert.exe":"mkcert");if(await O(a))return a;let i=await(0,On.default)("mkcert",{nothrow:!0});return i?(y(U`Found ${xt} at ${b.path(i)}`),i):(await ca(a,r,o),a)}async function ca(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${X}-darwin-arm64`:`mkcert-${X}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${X}-linux-arm64`:`mkcert-${X}-linux-amd64`;break;case"win32":o=`mkcert-${X}-windows-amd64.exe`;break;default:throw new ee(`Unsupported platform: ${e}`)}await _r(Nn,X,o,t),y(U`${xt} saved to ${b.path(t)}`)}async function la(t){let e=A(t,"mkcert-LICENSE");if(await O(e))return;let r=`https://raw.githubusercontent.com/${Nn}/refs/tags/${X}/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 Dt(r),!n.ok)return o}catch{return o}let s=await n.text();await we(e,s)}async function Wn({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=A(".shopify","localhost-key.pem"),a=A(".shopify","localhost.pem"),i=A(t,s),l=A(t,a);if(await O(i)&&await O(l))return{keyContent:await $(i),certContent:await $(l),certPath:a};if(!(e??await ao()))throw new _(`Localhost certificate and key are required at ${a} and ${s}`);let c="",u;return await Ae([{title:"Finding or downloading mkcert binary",task:async()=>{let w=A(t,".shopify");c=await ia(w,r,o,n),u=await la(w),y(U`${xt} found at: ${b.path(c)}`)}}]),u&&Re(u),z(U`Generating self-signed certificate for localhost. You may be prompted for your password.`),await _e(c,["-install","-key-file",i,"-cert-file",l,"localhost"]),z(U`${b.successIcon()} Certificate generated at ${a}\n`),await or()&&(ce({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"}}),z("\u{1F449} Press any key to continue"),await Zt(),z("")),{keyContent:await $(i),certContent:await $(l),certPath:Ut(t,l)}}p();function qn(){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,void 0,[e],[r])}function Gn({app:t,remoteApp:e,json:r=!1},o){return Ur({command:"app dev",directory:t.directory,key:he(t.configPath),details:{configPath:t.configPath,appName:e.title,clientId:e.apiKey},logOutput:r?process.stdout:void 0},o)}async function jn(t){let e=new Lt,r;try{if(t.tunnel.mode==="auto"){let l=await M();r=await oo(t.commandConfig,l,"cloudflare"),e.signal.addEventListener("abort",()=>r?.stopTunnel(),{once:!0})}let o=await pa(t,r);await ua(o);let{processes:n,graphiqlUrl:s,previewUrl:a,devSessionStatusManager:i}=await An(o);await ma(o),await ga({processes:n,previewUrl:a,graphiqlUrl:s,config:o,devSessionStatusManager:i,abortController:e})}finally{e.abort()}}async function pa(t,e){let{app:r,remoteApp:o,developerPlatformClient:n,store:s,specifications:a,tunnel:i}=t,l=await uo(o,n,a,o.flags);o.configuration=l;let m=await Tn({remoteApp:o,hasWebs:r.webs.length>0,graphiqlEnabled:!me(xe()[te.disableGraphiQLExplorer])});mo({app:r,remoteApp:o,selectedStore:s,cachedInfo:lt(t.directory),organization:t.organization,tunnelMode:i.mode}),r.configuration.build?.dev_store_url&&!K()&&(r.configuration.build={...r.configuration.build,dev_store_url:s.shopDomain},await(await ar.read(r.configPath)).patch({build:{dev_store_url:s.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Vr(t.project);let c=t.graphiqlPort??await M(pe.graphiql),u=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??pe.graphiql,actual:c}];i.mode==="use-localhost"&&u.push({for:"localhost",flagToRemedy:"--localhost-port",requested:i.requestedPort,actual:i.actualPort}),Dn(u);let{webs:g,...w}=await ha(r.directory,r.webs,c,i,e,o.configuration,t.installMkcert);r.webs=g;let d=r.configuration.build?.automatically_update_urls_on_dev,f=lt(t.directory)?.previousAppId,S=o.apiKey,E=await fa(g,t.update,w,r,d,o,S);return{storeFqdn:s.shopDomain,storeId:s.shopId||void 0,remoteApp:o,remoteAppUpdated:o.apiKey!==f,localApp:r,developerPlatformClient:n,commandOptions:t,network:w,partnerUrlsUpdated:E,graphiqlPort:c,graphiqlKey:t.graphiqlKey,apiSecret:m}}async function ua(t){await da(t)}async function da(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||qn()}async function ma(t){Xr({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await wa({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await qt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function fa(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:l}=J(t),m=!1;if((l??i)&&e){let c=eo(r.proxyUrl,t.map(({configuration:u})=>u.auth_callback_path).find(u=>u),o.configuration.app_proxy);m=await ro({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:c}),m&&o.setDevApplicationURLs(c)}return m}async function ha(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:l}=J(e);await ya(e,r);let m=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:c,frontendPort:u,usingLocalhost:g},w,d]=await Promise.all([Zr(m),kt()??i?.configuration.port??M(),to(s)]),f=g?`${c}:${u}`:c,S=l?.configuration.port;l&&(S??=l===i?w:await M(),l.configuration.port=S),S=S??await M();let E;if(o.mode==="use-localhost"){let{keyContent:R,certContent:x,certPath:C}=await Wn({appDirectory:t,forceInstall:a});E={key:R,cert:x,certPath:C,port:o.actualPort}}return{proxyUrl:f,proxyPort:u,frontendPort:S,backendPort:w,currentUrls:d,webs:e,reverseProxyCert:E}}async function ga({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n,abortController:s}){let a=o.commandOptions.devInstance,i=t.map(w=>({prefix:w.prefix,action:async(f,S,E)=>{let R=w.function,x=a?a.tee(f,{source:w.prefix,stringWritesAreMessages:!0}):f,C=a?a.tee(S,{source:w.prefix,stringWritesAreMessages:!0}):S;return R({stdout:x,stderr:C,abortSignal:E},w.options)}}));if(a){let w={storeFqdn:o.storeFqdn,previewUrl:e,graphiqlUrl:r,appUrl:o.localApp.devApplicationURLs?.applicationUrl,localUrl:o.network.proxyUrl};await a.update({status:"running",details:{...w,preview:Hn(n.status)}}),await a.log({source:"app dev",level:"info",message:`Preview URL: ${e}`}),r&&await a.log({source:"app dev",level:"info",message:`GraphiQL URL (Admin API): ${r}`})}let l=o.developerPlatformClient,m={id:o.remoteApp.id,developerPlatformClient:l},c,u=w=>{let d=[a?.update({details:{preview:Hn(w)}})],f=w.statusMessage;f&&(f.message!==c?.message||f.type!==c?.type)&&d.push(a?.log({source:"app dev",level:f.type==="error"?"error":"info",message:f.message})),c=f,Promise.all(d).catch(S=>{y(`Failed to save dev status: ${S.message}`)})};a&&(n.on("dev-session-update",u),u(n.status));let g=()=>s.abort(a?.abortSignal.reason);try{a?.abortSignal.throwIfAborted(),a?.abortSignal.addEventListener("abort",g,{once:!0}),await Mn({processes:i,previewUrl:e,graphiqlUrl:r,app:m,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}),a?.abortSignal.throwIfAborted()}finally{a?.abortSignal.removeEventListener("abort",g),a&&n.off("dev-session-update",u)}}function Hn({isReady:t,statusMessage:e,errors:r}){let o=t?"ready":"starting";return t&&e?.type==="loading"&&(o="updating"),e?.type==="error"&&(o="error"),{state:o,message:e?.message??null,errors:r??[]}}async function wa(t){let e=await Fn(t.devOptions.commandConfig,t.tunnelUrl);await Q.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?Je(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:Je(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await Q.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function ya(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 _(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await ot(n))throw new _(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await ot(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new _(s,a)}})()])}p();var Bn=h.object({state:h.enum(["starting","updating","ready","error"]),message:h.string().nullable(),errors:h.array(h.string())}).strict().describe("The CLI-reported preview state in the instance file; this is not a health check."),va=h.object({schemaVersion:h.literal(1),sessionId:h.string(),command:h.literal("app dev"),key:h.string().optional(),pid:h.number().int().positive(),status:h.enum(["starting","running"]),startedAt:Ye,updatedAt:Ye,directory:h.string(),logFile:h.string(),details:h.object({configPath:h.string(),appName:h.string(),clientId:h.string(),storeFqdn:h.string().optional(),previewUrl:h.string().optional(),graphiqlUrl:h.string().optional(),appUrl:h.string().optional(),localUrl:h.string().optional(),preview:Bn.optional()}).strict()}).strict().describe("The instance JSON file under .shopify/dev/. This object is not emitted to stdout."),Kn=St({name:ct.name,schema:ct.schema,definitions:{DevInstance:va,DevPreview:Bn}});p();async function Vn({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??pe.localhost,n=await M(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 _(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var k=ie(zn(),1);var Et=class t extends ho{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 jsonOutputSchema=Kn;static description=this.descriptionForHelp();static flags={...ir,...Kr,...cr,"client-id":k.Flags.string({hidden:!1,description:"The Client ID of your app. Use with --config to run dev with that configuration for a different app than the one it is linked to.",env:"SHOPIFY_FLAG_CLIENT_ID"}),store:k.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>be(e)}),"skip-dependencies-installation":k.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":k.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"unsafe-validation":k.Flags.boolean({description:"Allow app dev to continue with warnings for eligible app version validation failures.",env:"SHOPIFY_FLAG_UNSAFE_VALIDATION",default:!1}),"subscription-product-url":k.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":k.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":k.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":k.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":k.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":Ie({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:k.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Ie({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":k.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:k.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":Ie({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":k.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 Vn({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Ht(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await no(e.path);let o=await fo({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config});return Gn({...o,json:e.json},async n=>{let s=await go({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option",devSession:!0}),a={...o,store:s,directory:e.path,update:!e["no-update"],unsafeValidation:e["unsafe-validation"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],storePassword:e["store-password"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],installMkcert:e["install-mkcert"],tunnel:r,devInstance:n};return await jn(a),{app:o.app}})}};export{ri as a,Et as b};
@@ -0,0 +1 @@
1
+ import{c as s}from"./chunk-IWTNUJGY.js";import{g as r}from"./chunk-VKWPEFWQ.js";r();r();import e from"node:path";import E from"node:os";import c from"node:process";var n=E.homedir(),a=E.tmpdir(),{env:i}=c,p=o=>{let t=e.join(n,"Library");return{data:e.join(t,"Application Support",o),config:e.join(t,"Preferences",o),cache:e.join(t,"Caches",o),log:e.join(t,"Logs",o),temp:e.join(a,o)}},A=o=>{let t=i.APPDATA||e.join(n,"AppData","Roaming"),_=i.LOCALAPPDATA||e.join(n,"AppData","Local");return{data:e.join(_,o,"Data"),config:e.join(t,o,"Config"),cache:e.join(_,o,"Cache"),log:e.join(_,o,"Log"),temp:e.join(a,o)}},T=o=>{let t=e.basename(n);return{data:e.join(i.XDG_DATA_HOME||e.join(n,".local","share"),o),config:e.join(i.XDG_CONFIG_HOME||e.join(n,".config"),o),cache:e.join(i.XDG_CACHE_HOME||e.join(n,".cache"),o),log:e.join(i.XDG_STATE_HOME||e.join(n,".local","state"),o),temp:e.join(a,t,o)}};function I(o,{suffix:t="nodejs"}={}){if(typeof o!="string")throw new TypeError(`Expected a string, got ${typeof o}`);return t&&(o+=`-${t}`),c.platform==="darwin"?p(o):c.platform==="win32"?A(o):T(o)}var S="shopify-cli",O=()=>process.env.XDG_CACHE_HOME?process.env.XDG_CACHE_HOME:I(S).cache;var C={alwaysLogAnalytics:"SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS",alwaysLogMetrics:"SHOPIFY_CLI_ALWAYS_LOG_METRICS",deviceAuth:"SHOPIFY_CLI_DEVICE_AUTH",doctor:"SHOPIFY_CLI_DOCTOR",enableCliRedirect:"SHOPIFY_CLI_ENABLE_CLI_REDIRECT",env:"SHOPIFY_CLI_ENV",noAnalytics:"SHOPIFY_CLI_NO_ANALYTICS",optOutInstrumentation:"OPT_OUT_INSTRUMENTATION",doNotTrack:"DO_NOT_TRACK",serviceAccountToken:"SHOPIFY_SERVICE_ACCOUNT_TOKEN",appAutomationToken:"SHOPIFY_APP_AUTOMATION_TOKEN",partnersToken:"SHOPIFY_CLI_PARTNERS_TOKEN",runAsUser:"SHOPIFY_RUN_AS_USER",serviceEnv:"SHOPIFY_SERVICE_ENV",skipCliRedirect:"SHOPIFY_CLI_SKIP_CLI_REDIRECT",spinInstance:"SPIN_INSTANCE",themeToken:"SHOPIFY_CLI_THEME_TOKEN",unitTest:"SHOPIFY_UNIT_TEST",verbose:"SHOPIFY_FLAG_VERBOSE",codespaces:"CODESPACES",codespaceName:"CODESPACE_NAME",codespacePortForwardingDomain:"GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN",gitpod:"GITPOD_WORKSPACE_URL",cloudShell:"CLOUD_SHELL",spinAppPort:"SERVER_PORT",spinAppHost:"SPIN_APP_HOST",organization:"SHOPIFY_CLI_ORGANIZATION",identityToken:"SHOPIFY_CLI_IDENTITY_TOKEN",refreshToken:"SHOPIFY_CLI_REFRESH_TOKEN",otelURL:"SHOPIFY_CLI_OTEL_EXPORTER_OTLP_ENDPOINT",themeKitAccessDomain:"SHOPIFY_CLI_THEME_KIT_ACCESS_DOMAIN",json:"SHOPIFY_FLAG_JSON",skipNetworkLevelRetry:"SHOPIFY_CLI_SKIP_NETWORK_LEVEL_RETRY",maxRequestTimeForNetworkCalls:"SHOPIFY_CLI_MAX_REQUEST_TIME_FOR_NETWORK_CALLS",disableImportScanning:"SHOPIFY_CLI_DISABLE_IMPORT_SCANNING"},P="theme-kit-access.shopifyapps.com",F={backendPort:"BACKEND_PORT"},h={executables:{dev:"/opt/dev/bin/dev"},directories:{cache:{path:()=>O(),vendor:{path:()=>s(O(),"vendor"),binaries:()=>s(O(),"vendor","binaries")}}}},m={expirationTimeMarginInMinutes:4},Y="9e1e6889176fd0c795d5c659225e0fae",u={limit:300,timeout:{days:1}},f=process.env[C.themeKitAccessDomain]??P;export{I as a,C as b,P as c,F as d,h as e,m as f,Y as g,u as h,f as i};
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-KT2AMFVW.js";import{g as e}from"./chunk-VKWPEFWQ.js";e();var t=class extends o{};export{t as a};