@shopify/cli 4.5.2 → 4.6.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 (363) hide show
  1. package/dist/analytics-6S5JVSRO.js +1 -0
  2. package/dist/analytics-E252SR3P.js +1 -0
  3. package/dist/assets/hydrogen/starter/package.json +1 -1
  4. package/dist/bootstrap.js +1 -1
  5. package/dist/{chokidar-VDIVGBZH.js → chokidar-5RWEYTNQ.js} +1 -1
  6. package/dist/{chunk-AATUQ2AY.js → chunk-2I62GKIH.js} +80 -80
  7. package/dist/{chunk-MC466GSO.js → chunk-2JFZ6GZC.js} +1 -1
  8. package/dist/{chunk-UQWFDL3F.js → chunk-2KD4LHRT.js} +1 -1
  9. package/dist/chunk-2MCH43SL.js +11 -0
  10. package/dist/{chunk-K4APB7O3.js → chunk-2SNT7U7B.js} +1 -1
  11. package/dist/{chunk-V6QZF5YS.js → chunk-2VIUGNYO.js} +1 -1
  12. package/dist/chunk-2Y6CYLKF.js +1 -0
  13. package/dist/{chunk-XHTICMA7.js → chunk-3EHRA4LA.js} +1 -1
  14. package/dist/{chunk-FSVSM57K.js → chunk-3EPQ6UOK.js} +6 -6
  15. package/dist/{chunk-7KWBVZPI.js → chunk-3NO6PWNL.js} +1 -1
  16. package/dist/chunk-3TFUSDHY.js +370 -0
  17. package/dist/{chunk-TH6CLNGO.js → chunk-46NA23I7.js} +1 -1
  18. package/dist/{chunk-YXNKDX56.js → chunk-47URTBZF.js} +1 -1
  19. package/dist/chunk-4FEBSLSU.js +1 -0
  20. package/dist/{chunk-OMXKQY2L.js → chunk-4HB4VZJQ.js} +1 -1
  21. package/dist/{chunk-ZUWEGJA7.js → chunk-4JARSKED.js} +1 -1
  22. package/dist/{chunk-NSADN5S2.js → chunk-4KZRP2JP.js} +141 -141
  23. package/dist/{chunk-TPGREOWO.js → chunk-4P7PWLUN.js} +1 -1
  24. package/dist/{chunk-UHMRDG6J.js → chunk-4YCMEC5R.js} +1 -1
  25. package/dist/{chunk-KIAMA3L2.js → chunk-53ZA2HD3.js} +1 -1
  26. package/dist/{chunk-2ACN7JIZ.js → chunk-57YF2UNT.js} +1 -1
  27. package/dist/{chunk-AAK3WGD7.js → chunk-5EFQILLF.js} +1 -1
  28. package/dist/chunk-5JPV3HPJ.js +1 -0
  29. package/dist/{chunk-2TJ6LOCC.js → chunk-5LJ5H4TD.js} +1 -1
  30. package/dist/{chunk-Z6VNPAY7.js → chunk-5Y2VD4I3.js} +1 -1
  31. package/dist/{chunk-N6IFIMC6.js → chunk-6BX62FFE.js} +1 -1
  32. package/dist/{chunk-RFOALCVH.js → chunk-6FJBCRVK.js} +1 -1
  33. package/dist/{chunk-KQTVJMV6.js → chunk-6Q5VRSRN.js} +1 -1
  34. package/dist/{chunk-GDHD3TGC.js → chunk-6QDOCBD4.js} +1 -1
  35. package/dist/{chunk-BUVP2UUA.js → chunk-6SXB44CE.js} +1 -1
  36. package/dist/chunk-6UTUJKKC.js +16 -0
  37. package/dist/{chunk-EEEKSYWV.js → chunk-6YCGMS7X.js} +15 -15
  38. package/dist/chunk-72GN655L.js +1 -0
  39. package/dist/chunk-7CPECP5P.js +1 -0
  40. package/dist/{chunk-SG5TRPJ7.js → chunk-7HAFBCL3.js} +1 -1
  41. package/dist/chunk-7XPFLQEM.js +1 -0
  42. package/dist/{chunk-HOAVZLEG.js → chunk-A3JE5LX3.js} +1 -1
  43. package/dist/{chunk-5VRU3BT5.js → chunk-AJ6VOBXU.js} +1 -1
  44. package/dist/{chunk-42RVM4EZ.js → chunk-B2WK53GH.js} +1 -1
  45. package/dist/chunk-B34VYVGV.js +1 -0
  46. package/dist/chunk-B6SY4BIK.js +2 -0
  47. package/dist/{chunk-7AYYQUJG.js → chunk-BBEHNPKK.js} +1 -1
  48. package/dist/{chunk-JADXT2DY.js → chunk-BCTMBKAU.js} +1 -1
  49. package/dist/chunk-BGUHH7AW.js +10 -0
  50. package/dist/chunk-BOAGJ6P5.js +1 -0
  51. package/dist/chunk-C256W7D2.js +26 -0
  52. package/dist/chunk-CTNBSUVU.js +83 -0
  53. package/dist/{chunk-34SINZ7L.js → chunk-CXWLHQKA.js} +1 -1
  54. package/dist/chunk-DHU767C3.js +1 -0
  55. package/dist/{chunk-CEBDKIVH.js → chunk-DKHMLETG.js} +1 -1
  56. package/dist/{chunk-L42FYXFW.js → chunk-DODCPRXT.js} +4 -4
  57. package/dist/{chunk-6VR22Z5R.js → chunk-E3RDAVJT.js} +3 -3
  58. package/dist/chunk-E3RQCWSC.js +6 -0
  59. package/dist/{chunk-HQE5B2CF.js → chunk-EBZ6MDEM.js} +1 -1
  60. package/dist/chunk-ELJ7SKMH.js +1 -0
  61. package/dist/{chunk-YNX4DT2O.js → chunk-EQTULRM7.js} +1 -1
  62. package/dist/{chunk-KFUOVO3X.js → chunk-ERCJPRN3.js} +1 -1
  63. package/dist/{chunk-5CV7GFWZ.js → chunk-ESZS7L6O.js} +1 -1
  64. package/dist/{chunk-R6A754UW.js → chunk-ET2O5DAS.js} +1 -1
  65. package/dist/chunk-EZ7EBYDT.js +684 -0
  66. package/dist/{chunk-WDSBR7KX.js → chunk-EZNJDFFK.js} +1 -1
  67. package/dist/chunk-F34LB7M4.js +20 -0
  68. package/dist/{chunk-VGSH33QU.js → chunk-FE24P4UQ.js} +1 -1
  69. package/dist/chunk-FFSDGRAN.js +1 -0
  70. package/dist/{chunk-35FS2NTM.js → chunk-FMTPUYSH.js} +1 -1
  71. package/dist/{chunk-ZAN7AZTX.js → chunk-FPWLEGKZ.js} +1 -1
  72. package/dist/{chunk-P6LVSNTT.js → chunk-FT4HLDK7.js} +1 -1
  73. package/dist/{chunk-BQARKSGG.js → chunk-G3YYMKWG.js} +1 -1
  74. package/dist/chunk-G7QW5OSQ.js +6 -0
  75. package/dist/{chunk-DIPTSBQM.js → chunk-GCDEDRY7.js} +1 -1
  76. package/dist/{chunk-3EJGRQTH.js → chunk-GEE5MXHT.js} +1 -1
  77. package/dist/{chunk-ANH2V6DJ.js → chunk-H4MYBJ6C.js} +1 -1
  78. package/dist/chunk-HDXBZLHH.js +8 -0
  79. package/dist/chunk-HSKB5OTM.js +1 -0
  80. package/dist/{chunk-I5X3IP6T.js → chunk-HT6MOPLW.js} +1 -1
  81. package/dist/chunk-HZXY7RWJ.js +19 -0
  82. package/dist/{chunk-XS7WK4YK.js → chunk-IDAWPBJM.js} +1 -1
  83. package/dist/{chunk-CX44CQFL.js → chunk-IDLDQ2JB.js} +1 -1
  84. package/dist/{chunk-HSVZU7MP.js → chunk-IKYZ5L3F.js} +1 -1
  85. package/dist/{chunk-LXOBFJZO.js → chunk-ILQXBASM.js} +1 -1
  86. package/dist/{chunk-P2SBE77Z.js → chunk-IYU72M55.js} +1 -1
  87. package/dist/{chunk-SZM6ANMN.js → chunk-J3IHP46B.js} +2 -2
  88. package/dist/{chunk-DELISRUH.js → chunk-J4KJQHNS.js} +1 -1
  89. package/dist/{chunk-PEYYIWP6.js → chunk-JHRZCUBE.js} +2 -2
  90. package/dist/chunk-JIBLEZ57.js +18 -0
  91. package/dist/{chunk-ML6SILEL.js → chunk-JIKIYMCT.js} +1 -1
  92. package/dist/{chunk-5GVE4ILZ.js → chunk-JJTGHARS.js} +1 -1
  93. package/dist/chunk-JJZNUFPD.js +44 -0
  94. package/dist/{chunk-5N7H4PJJ.js → chunk-JQP3ZCAG.js} +1 -1
  95. package/dist/{chunk-523SJVNT.js → chunk-JS3X6BDT.js} +1 -1
  96. package/dist/{chunk-XCGV3IJ5.js → chunk-K7IZMKBR.js} +1 -1
  97. package/dist/{chunk-7PVNAILK.js → chunk-KGZH4RFA.js} +1 -1
  98. package/dist/{chunk-OC5PD4ID.js → chunk-KO4FB4QU.js} +1 -1
  99. package/dist/chunk-KPRKIZ5M.js +3 -0
  100. package/dist/chunk-KUN74JD4.js +4 -0
  101. package/dist/chunk-KURWC4A5.js +16 -0
  102. package/dist/{chunk-XDV4PRFT.js → chunk-L3D2CASO.js} +1 -1
  103. package/dist/{chunk-4UJNCOE6.js → chunk-L7DZTIHJ.js} +1 -1
  104. package/dist/{chunk-UW6YEKST.js → chunk-LBDAYBIF.js} +1 -1
  105. package/dist/{chunk-ZG7BVVT2.js → chunk-LD6ZCTZ3.js} +1 -1
  106. package/dist/{chunk-UMB4BWCK.js → chunk-LH3RIIOB.js} +1 -1
  107. package/dist/{chunk-LSCDB36D.js → chunk-LWRDNTAD.js} +1 -1
  108. package/dist/{chunk-NYG2VQFQ.js → chunk-LWWBU7ET.js} +1 -1
  109. package/dist/chunk-M4BEPPA3.js +1 -0
  110. package/dist/chunk-M4YPMHIM.js +1 -0
  111. package/dist/{chunk-75DBVSVI.js → chunk-M5KKLAM6.js} +1 -1
  112. package/dist/{chunk-T35C6NC7.js → chunk-MBLHXPGK.js} +1 -1
  113. package/dist/{chunk-ODSMT2ZC.js → chunk-MDHJJVXA.js} +1 -1
  114. package/dist/{chunk-ICRQZAXP.js → chunk-MDXSLAIC.js} +1 -1
  115. package/dist/{chunk-SH6Q5CLM.js → chunk-NA2ERJIJ.js} +1 -1
  116. package/dist/chunk-NOKCVDYD.js +317 -0
  117. package/dist/chunk-O6XSWAP2.js +4 -0
  118. package/dist/{chunk-6AWRW3GS.js → chunk-OB62WVZ5.js} +1 -1
  119. package/dist/{chunk-RTINXD5Z.js → chunk-OT52JOML.js} +1 -1
  120. package/dist/chunk-OTT73YUA.js +5 -0
  121. package/dist/{chunk-AUAUAK6P.js → chunk-OUUOML3D.js} +1 -1
  122. package/dist/{chunk-6ZWMXMNM.js → chunk-P7XC5HS2.js} +1 -1
  123. package/dist/{chunk-JOKLZMTP.js → chunk-PALG4SNB.js} +1 -1
  124. package/dist/{chunk-OJZT3NA2.js → chunk-PB37BTPE.js} +1 -1
  125. package/dist/{chunk-KPNNGJAW.js → chunk-PWYRKTJ4.js} +1 -1
  126. package/dist/{chunk-WN5VTUWJ.js → chunk-PXSX63RF.js} +1 -1
  127. package/dist/{chunk-23LZNWB5.js → chunk-QDPDB5EP.js} +1 -1
  128. package/dist/{chunk-VJQJ5PTQ.js → chunk-QG7TELFC.js} +1 -1
  129. package/dist/{chunk-TM44Z7U7.js → chunk-QU5NL2QT.js} +1 -1
  130. package/dist/{chunk-3OCR7P3S.js → chunk-QV53BSQP.js} +1 -1
  131. package/dist/{chunk-P7OSUECN.js → chunk-QXXA2EQY.js} +1 -1
  132. package/dist/{chunk-XUAAQI5N.js → chunk-QZ5FMWZS.js} +1 -1
  133. package/dist/chunk-R26GJEH3.js +1 -0
  134. package/dist/{chunk-VCWESQBC.js → chunk-RTW4RZWH.js} +2 -2
  135. package/dist/{chunk-UVIGXZMV.js → chunk-SEV3S3WH.js} +1 -1
  136. package/dist/{chunk-NIVGP4LB.js → chunk-TAFOSPBW.js} +1 -1
  137. package/dist/{chunk-Q7DSLGTN.js → chunk-TAV2ENJY.js} +1 -1
  138. package/dist/{chunk-LVLDPYH5.js → chunk-TQNALMQH.js} +1 -1
  139. package/dist/chunk-TR4OWSEX.js +77 -0
  140. package/dist/{chunk-DZMXYETH.js → chunk-TUJNCWHZ.js} +1 -1
  141. package/dist/{chunk-TSEPNC3O.js → chunk-U564K7SX.js} +1 -1
  142. package/dist/chunk-UKQ7NE5V.js +1 -0
  143. package/dist/{chunk-TNUY66EE.js → chunk-UM3OHLCX.js} +1 -1
  144. package/dist/{chunk-QEVGRNUE.js → chunk-V65P572N.js} +3 -3
  145. package/dist/chunk-VFIVXK53.js +2 -0
  146. package/dist/chunk-VVFPW4ZQ.js +2 -0
  147. package/dist/{chunk-YKNMNGV7.js → chunk-VYITPC34.js} +1 -1
  148. package/dist/{chunk-7AY6HLQG.js → chunk-VZKR2YFM.js} +1 -1
  149. package/dist/{chunk-YWQPSMRZ.js → chunk-W2GMKXM7.js} +1 -1
  150. package/dist/{chunk-7TQ6HVHN.js → chunk-W4X3635B.js} +1 -1
  151. package/dist/chunk-W6ST525S.js +99 -0
  152. package/dist/{chunk-BVWQZKNK.js → chunk-WEEYQX3M.js} +1 -1
  153. package/dist/{chunk-KMQE7WFZ.js → chunk-WO7LKJCJ.js} +1 -1
  154. package/dist/{chunk-DI5ZPWNA.js → chunk-WPRAJ25Z.js} +1 -1
  155. package/dist/{chunk-ZT4PUH7L.js → chunk-WR2ZQGUR.js} +1 -1
  156. package/dist/{chunk-RLB5QHWG.js → chunk-WWX265PC.js} +1 -1
  157. package/dist/chunk-XERJY4IG.js +103 -0
  158. package/dist/{chunk-EOJNSPIH.js → chunk-XGCJWCC4.js} +1 -1
  159. package/dist/{chunk-LGFOE4XL.js → chunk-XGMPC7KK.js} +1 -1
  160. package/dist/chunk-XGRVAPLR.js +7 -0
  161. package/dist/{chunk-TC3JOEMA.js → chunk-Y2PC2BBJ.js} +60 -60
  162. package/dist/{chunk-XXLGM6OZ.js → chunk-Y4QC2YVE.js} +1 -1
  163. package/dist/chunk-YNJZ2VXV.js +5 -0
  164. package/dist/chunk-Z5DDPQ26.js +3 -0
  165. package/dist/{chunk-U3MSTPZP.js → chunk-ZK7VJZ6V.js} +1 -1
  166. package/dist/{chunk-4VJ5VBSR.js → chunk-ZLT4DPHN.js} +1 -1
  167. package/dist/{chunk-6K4DVV37.js → chunk-ZOBQKNGK.js} +1 -1
  168. package/dist/chunk-ZTE46E4Z.js +153 -0
  169. package/dist/cli/commands/app/app-logs/sources.js +1 -1
  170. package/dist/cli/commands/app/build.js +1 -1
  171. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  172. package/dist/cli/commands/app/bulk/execute.js +1 -1
  173. package/dist/cli/commands/app/bulk/status.js +1 -1
  174. package/dist/cli/commands/app/config/link.js +1 -1
  175. package/dist/cli/commands/app/config/pull.js +1 -1
  176. package/dist/cli/commands/app/config/use.js +1 -1
  177. package/dist/cli/commands/app/config/validate.js +1 -1
  178. package/dist/cli/commands/app/demo/watcher.js +1 -1
  179. package/dist/cli/commands/app/deploy.js +1 -1
  180. package/dist/cli/commands/app/dev/clean.js +1 -1
  181. package/dist/cli/commands/app/dev.js +1 -1
  182. package/dist/cli/commands/app/env/pull.js +1 -1
  183. package/dist/cli/commands/app/env/show.js +1 -1
  184. package/dist/cli/commands/app/execute.js +1 -1
  185. package/dist/cli/commands/app/function/build.js +1 -1
  186. package/dist/cli/commands/app/function/info.js +1 -1
  187. package/dist/cli/commands/app/function/replay.js +1 -1
  188. package/dist/cli/commands/app/function/run.js +1 -1
  189. package/dist/cli/commands/app/function/schema.js +1 -1
  190. package/dist/cli/commands/app/function/typegen.js +1 -1
  191. package/dist/cli/commands/app/generate/extension.js +1 -1
  192. package/dist/cli/commands/app/graphiql.js +1 -1
  193. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  194. package/dist/cli/commands/app/import-extensions.js +1 -1
  195. package/dist/cli/commands/app/info.js +1 -1
  196. package/dist/cli/commands/app/init.js +1 -1
  197. package/dist/cli/commands/app/logs.js +1 -1
  198. package/dist/cli/commands/app/release.js +1 -1
  199. package/dist/cli/commands/app/versions/list.js +1 -1
  200. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  201. package/dist/cli/commands/auth/login.js +1 -1
  202. package/dist/cli/commands/auth/logout.js +1 -1
  203. package/dist/cli/commands/cache/clear.js +1 -1
  204. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  205. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  206. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  207. package/dist/cli/commands/debug/command-flags.js +1 -1
  208. package/dist/cli/commands/doc/fetch.js +1 -1
  209. package/dist/cli/commands/doc/search.js +1 -1
  210. package/dist/cli/commands/docs/generate.js +1 -1
  211. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  212. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  213. package/dist/cli/commands/help.js +1 -1
  214. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  215. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  216. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  217. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  218. package/dist/cli/commands/notifications/generate.js +1 -1
  219. package/dist/cli/commands/notifications/list.js +1 -1
  220. package/dist/cli/commands/organization/list.js +1 -1
  221. package/dist/cli/commands/search.js +1 -1
  222. package/dist/cli/commands/theme/check.js +1 -1
  223. package/dist/cli/commands/theme/console.js +1 -1
  224. package/dist/cli/commands/theme/delete.js +1 -1
  225. package/dist/cli/commands/theme/dev.js +1 -1
  226. package/dist/cli/commands/theme/duplicate.js +1 -1
  227. package/dist/cli/commands/theme/info.js +1 -1
  228. package/dist/cli/commands/theme/init.js +1 -1
  229. package/dist/cli/commands/theme/language-server.js +1 -1
  230. package/dist/cli/commands/theme/list.js +1 -1
  231. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  232. package/dist/cli/commands/theme/open.js +1 -1
  233. package/dist/cli/commands/theme/package.js +1 -1
  234. package/dist/cli/commands/theme/preview.js +1 -1
  235. package/dist/cli/commands/theme/profile.js +1 -1
  236. package/dist/cli/commands/theme/publish.js +1 -1
  237. package/dist/cli/commands/theme/pull.js +1 -1
  238. package/dist/cli/commands/theme/push.js +1 -1
  239. package/dist/cli/commands/theme/rename.js +1 -1
  240. package/dist/cli/commands/theme/share.js +1 -1
  241. package/dist/cli/commands/upgrade.js +1 -1
  242. package/dist/cli/commands/version.js +1 -1
  243. package/dist/cli/help.js +1 -1
  244. package/dist/command-registry.js +1 -1
  245. package/dist/conf-store-N5P2ZEAD.js +1 -0
  246. package/dist/custom-oclif-loader-4ZAXX5MR.js +1 -0
  247. package/dist/deprecations-4TY4DNME.js +1 -0
  248. package/dist/dist-6ZJS4I57.js +1 -0
  249. package/dist/dist-7W2KJOYN.js +1 -0
  250. package/dist/environments-TR5WW2MD.js +1 -0
  251. package/dist/error-VJQM4MFE.js +1 -0
  252. package/dist/error-handler-IYGE3Z72.js +1 -0
  253. package/dist/{fs-B4UJTUCD.js → fs-EOQL26C3.js} +1 -1
  254. package/dist/hooks/app-init.js +1 -1
  255. package/dist/hooks/did-you-mean.js +1 -1
  256. package/dist/hooks/hydrogen-init.js +1 -1
  257. package/dist/hooks/plugin-plugins.js +1 -1
  258. package/dist/hooks/postrun.js +1 -1
  259. package/dist/hooks/prerun.js +1 -1
  260. package/dist/hooks/public-metadata.js +1 -1
  261. package/dist/hooks/sensitive-metadata.js +1 -1
  262. package/dist/hooks/tunnel-provider.js +1 -1
  263. package/dist/hooks/tunnel-start.js +1 -1
  264. package/dist/{http-proxy-node16-X2WAMUT5.js → http-proxy-node16-A6AKKRQH.js} +1 -1
  265. package/dist/index.js +15 -15
  266. package/dist/is-global-RQCPBQA3.js +1 -0
  267. package/dist/{latest-version-32HXMWJ7.js → latest-version-LDWU5F7A.js} +7 -7
  268. package/dist/lib-2BR2WN7L.js +1 -0
  269. package/dist/lib-JKLF33A7.js +1 -0
  270. package/dist/{lib-NOROGV6N.js → lib-P3APEIHY.js} +1 -1
  271. package/dist/local-TW3HCZ2S.js +1 -0
  272. package/dist/local-storage-T6FKS53K.js +1 -0
  273. package/dist/{metadata-FREAI3KR.js → metadata-TYZDEER5.js} +1 -1
  274. package/dist/{morph-QZGREMO2.js → morph-ABSWZEVT.js} +4 -4
  275. package/dist/node-package-manager-6SWUZILX.js +1 -0
  276. package/dist/notifications-system-SMHMV2UW.js +1 -0
  277. package/dist/out-53ABAVL7.js +1 -0
  278. package/dist/{output-VUR2QZPW.js → output-JG5I2TEL.js} +1 -1
  279. package/dist/system-D4Z32GDS.js +1 -0
  280. package/dist/tsconfig.tsbuildinfo +1 -1
  281. package/dist/ui-6M3XZ6MR.js +1 -0
  282. package/dist/upgrade-EKAG4IV7.js +1 -0
  283. package/dist/version-6UBWZCNS.js +1 -0
  284. package/dist/version-XRU7TEAI.js +1 -0
  285. package/dist/{workerd-KPQTFQD4.js → workerd-LXBSJULF.js} +1 -1
  286. package/oclif.manifest.json +612 -2
  287. package/package.json +11 -11
  288. package/dist/analytics-M7ZU437S.js +0 -1
  289. package/dist/analytics-ZRM4FEOE.js +0 -1
  290. package/dist/assets/dev-console/extensions/dev-console/assets/apple-touch-icon-BXMqQaSW.png +0 -0
  291. package/dist/assets/dev-console/extensions/dev-console/assets/favicon-16x16-B6uL8SrV.png +0 -0
  292. package/dist/assets/dev-console/extensions/dev-console/assets/favicon-32x32-CGwlpz_y.png +0 -0
  293. package/dist/assets/dev-console/extensions/dev-console/assets/favicon-ByUl89Ab.ico +0 -0
  294. package/dist/assets/dev-console/extensions/dev-console/assets/index-Bm_GpKQW.js +0 -51
  295. package/dist/assets/dev-console/extensions/dev-console/assets/index-DISeE29z.css +0 -1
  296. package/dist/assets/dev-console/extensions/dev-console/assets/site-B9Ae890R.webmanifest +0 -19
  297. package/dist/assets/dev-console/index.html +0 -21
  298. package/dist/chunk-2O22LZKV.js +0 -44
  299. package/dist/chunk-3IFZECSI.js +0 -22
  300. package/dist/chunk-4MLEL3VK.js +0 -283
  301. package/dist/chunk-4P54DKG4.js +0 -3
  302. package/dist/chunk-4ROX2TCK.js +0 -1
  303. package/dist/chunk-5C7HDTHJ.js +0 -1
  304. package/dist/chunk-5VC4XXYH.js +0 -1
  305. package/dist/chunk-7RJPTSL6.js +0 -7
  306. package/dist/chunk-ADKFAPED.js +0 -21
  307. package/dist/chunk-B5MFFERE.js +0 -1
  308. package/dist/chunk-BLSWUNOK.js +0 -16
  309. package/dist/chunk-DN3BB4IO.js +0 -103
  310. package/dist/chunk-EAOT5CK5.js +0 -2
  311. package/dist/chunk-G6BFXMOV.js +0 -2
  312. package/dist/chunk-GMAZ2BQY.js +0 -26
  313. package/dist/chunk-HYF3VJYS.js +0 -3
  314. package/dist/chunk-IIFRDOYG.js +0 -1
  315. package/dist/chunk-KB6H5LQJ.js +0 -4
  316. package/dist/chunk-LKZ7ARYS.js +0 -18
  317. package/dist/chunk-MYQTAM77.js +0 -2
  318. package/dist/chunk-NGCPVRDM.js +0 -1
  319. package/dist/chunk-NJOO5XJV.js +0 -1
  320. package/dist/chunk-NNOSZ447.js +0 -1
  321. package/dist/chunk-NVA2354A.js +0 -5
  322. package/dist/chunk-NWH3TAHK.js +0 -1
  323. package/dist/chunk-OCBGHOH2.js +0 -19
  324. package/dist/chunk-P7U6BWKN.js +0 -1
  325. package/dist/chunk-QFXJNFMI.js +0 -1
  326. package/dist/chunk-R7QYSC6T.js +0 -567
  327. package/dist/chunk-RE652L3G.js +0 -1
  328. package/dist/chunk-SSDEWKDZ.js +0 -6
  329. package/dist/chunk-T6CC5WUU.js +0 -159
  330. package/dist/chunk-TB7HFPBB.js +0 -370
  331. package/dist/chunk-TIU7MMRT.js +0 -836
  332. package/dist/chunk-TTEY5PLR.js +0 -10
  333. package/dist/chunk-U4HLIXRH.js +0 -4
  334. package/dist/chunk-UAYIFFYJ.js +0 -11
  335. package/dist/chunk-UHIP5CFI.js +0 -1
  336. package/dist/chunk-UMFVRG33.js +0 -5
  337. package/dist/chunk-WTRKTFVE.js +0 -2
  338. package/dist/chunk-X3VG75LO.js +0 -1
  339. package/dist/chunk-XSUZPWYV.js +0 -5
  340. package/dist/chunk-Z33MWGCG.js +0 -1
  341. package/dist/chunk-ZIM2G3EP.js +0 -1
  342. package/dist/chunk-ZSYMRT3S.js +0 -4
  343. package/dist/conf-store-HOA62HKK.js +0 -1
  344. package/dist/custom-oclif-loader-3AICQCNU.js +0 -1
  345. package/dist/deprecations-2FTB7JEW.js +0 -1
  346. package/dist/dist-63JMGNUL.js +0 -1
  347. package/dist/dist-6TY6L7OW.js +0 -1
  348. package/dist/environments-XVYTKHRZ.js +0 -1
  349. package/dist/error-SDU6RPQQ.js +0 -1
  350. package/dist/error-handler-4YEBBCUH.js +0 -1
  351. package/dist/is-global-5LFZDDNH.js +0 -1
  352. package/dist/lib-QJDPPAWN.js +0 -1
  353. package/dist/lib-UCG2DNMS.js +0 -1
  354. package/dist/local-VTYGIJVD.js +0 -1
  355. package/dist/local-storage-A6NBLBB2.js +0 -1
  356. package/dist/node-package-manager-N5SUT2WN.js +0 -1
  357. package/dist/notifications-system-P3SUTD25.js +0 -1
  358. package/dist/out-CDCY25QC.js +0 -1
  359. package/dist/system-OXF2P5CT.js +0 -1
  360. package/dist/ui-N2C5FC3G.js +0 -1
  361. package/dist/upgrade-AJ36IT7H.js +0 -1
  362. package/dist/version-DSFP332V.js +0 -1
  363. package/dist/version-HUOO3XOE.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as l}from"./chunk-UHMRDG6J.js";import{p as r,q as m,v as a}from"./chunk-4P54DKG4.js";import{ua as i}from"./chunk-TIU7MMRT.js";import{b as s,c as h}from"./chunk-NGCPVRDM.js";import{r as v}from"./chunk-T6CC5WUU.js";import{e as f,g as n}from"./chunk-VKWPEFWQ.js";n();var e=f(v(),1);var p,t=class extends a{async command(o,d,c,y,u){i("theme-command:push"),await l({...o,allowLive:o["allow-live"],noColor:o["no-color"],developmentContext:o["development-context"]},d,c,u),i("theme-command:push")}storeAuthScopes(){return["read_themes","write_themes"]}};p=t;t.summary="Uploads your local theme files to the connected store, overwriting the remote version if specified.";t.usage=["theme push","theme push --unpublished --json"];t.descriptionWithMarkdown=`Uploads your local theme files to Shopify, overwriting the remote version if specified.
1
+ import{a as l}from"./chunk-4YCMEC5R.js";import{p as r,q as m,v as a}from"./chunk-Z5DDPQ26.js";import{b as s,c as h}from"./chunk-2Y6CYLKF.js";import{ra as i}from"./chunk-EZ7EBYDT.js";import{a as v}from"./chunk-CTNBSUVU.js";import{e as f,g as n}from"./chunk-VKWPEFWQ.js";n();var e=f(v(),1);var p,t=class extends a{async command(o,d,c,y,u){i("theme-command:push"),await l({...o,allowLive:o["allow-live"],noColor:o["no-color"],developmentContext:o["development-context"]},d,c,u),i("theme-command:push")}storeAuthScopes(){return["read_themes","write_themes"]}};p=t;t.summary="Uploads your local theme files to the connected store, overwriting the remote version if specified.";t.usage=["theme push","theme push --unpublished --json"];t.descriptionWithMarkdown=`Uploads your local theme files to Shopify, overwriting the remote version if specified.
2
2
 
3
3
  If no theme is specified, then you're prompted to select the theme to overwrite from the list of the themes in your store.
4
4
 
@@ -0,0 +1,20 @@
1
+ import{a as Cr}from"./chunk-IYU72M55.js";import{a as xt}from"./chunk-UOHNRH6E.js";import{a as xr}from"./chunk-SEV3S3WH.js";import{a as Er}from"./chunk-5LJ5H4TD.js";import{a as Rr}from"./chunk-L3D2CASO.js";import{a as br}from"./chunk-GCDEDRY7.js";import{a as Ur}from"./chunk-BBEHNPKK.js";import{b as Tr}from"./chunk-G3YYMKWG.js";import{a as Ar}from"./chunk-EZNJDFFK.js";import{a as _r}from"./chunk-PB37BTPE.js";import{a as pr}from"./chunk-A3JE5LX3.js";import{a as dr}from"./chunk-C256W7D2.js";import{a as mr}from"./chunk-4JARSKED.js";import{a as fr}from"./chunk-PWYRKTJ4.js";import{a as hr}from"./chunk-LH3RIIOB.js";import{a as gr}from"./chunk-2JFZ6GZC.js";import{a as wr,b as yr,c as vr,d as Pr}from"./chunk-P7XC5HS2.js";import{a as Sr}from"./chunk-JJTGHARS.js";import{g as ur}from"./chunk-XERJY4IG.js";import{a as lo,b as po,c as uo,d as mo}from"./chunk-7CPECP5P.js";import{a as ar}from"./chunk-HZXY7RWJ.js";import{a as lr}from"./chunk-QXXA2EQY.js";import{a as Ze}from"./chunk-6Q5VRSRN.js";import{a as cr}from"./chunk-TUJNCWHZ.js";import{c as Xe,m as et}from"./chunk-IKYZ5L3F.js";import{b as ir,g as Ce,j as Je}from"./chunk-HT6MOPLW.js";import{a as nr,b as sr,c as ao,d as io,e as ot,f as co,g as fo}from"./chunk-W2GMKXM7.js";import{a as $,b as Qe}from"./chunk-ERCJPRN3.js";import{a as Xt,b as Zt,d as Ae,f as er,m as _e,n as H,s as O,u as tr,v as rr,w as or}from"./chunk-Q7BOSHWX.js";import{c as kr}from"./chunk-WPRAJ25Z.js";import{a as Jt}from"./chunk-JHRZCUBE.js";import{a as Zr,b as rt,c as te,d as eo}from"./chunk-RTW4RZWH.js";import{a as ho,f as go,g as wo,h as nt,i as yo,j as vo,k as Po,l as xo,m as Eo,n as bo,o as Uo,p as So,q as Ro,v as To,x as Ao,z as st}from"./chunk-K7IZMKBR.js";import{a as to,b as ro,c as oo,d as no,e as so}from"./chunk-MDXSLAIC.js";import{a as Lr}from"./chunk-5EFQILLF.js";import{a as Xr}from"./chunk-72GN655L.js";import{a as Jr}from"./chunk-DHU767C3.js";import{a as Ir}from"./chunk-QG7TELFC.js";import{a as _o}from"./chunk-NA2ERJIJ.js";import{C as Br,E as Kr,G as ee,N as jr,O as Yr,Y as Vr,i as $r,j as N,k as Mr,m as Fr,na as Ie,oa as Le,p as tt,q as Or,s as Nr,t as qr,ta as Qr,u as Wr,v as Hr,w as Gr}from"./chunk-NOKCVDYD.js";import{X as zr,e as ke,j as ce,p as Dr}from"./chunk-6UTUJKKC.js";import{c as Vt}from"./chunk-AJ6VOBXU.js";import{a as j}from"./chunk-KGZH4RFA.js";import{b as Qt,e as Te}from"./chunk-2Y6CYLKF.js";import{$ as $t,N as Lt,Z as X,a as ze,c as Rt,e as Tt,g as At,k as _t,m as Ct,p as kt,qa as Mt,s as It,t as xe,y as Ee}from"./chunk-EZ7EBYDT.js";import{D as Ue,H as Gt,J as Se,O as Re,P as ie,Q as Ve,R as Kt,T as jt,a as St,i as Ft,j as Ot,k as Nt,l as D,m as qt,n as Ye,o as Wt,p as Ht,u as be,w as ae}from"./chunk-6YCGMS7X.js";import{a as Cn}from"./chunk-7UNQOKZW.js";import{d as Dt}from"./chunk-VZKR2YFM.js";import{f as Ut,m as T,p as Z,u as Bt}from"./chunk-ZTE46E4Z.js";import{$a as vt,Ea as yt,Fb as P,Hb as b,Mb as K,Na as ge,P as Ke,Pb as h,Qb as C,Ta as W,Wa as we,cb as Pt,eb as ye,fb as k,gb as L,jb as ve,kb as Pe,ma as I,mb as Et,nb as bt,tb as je,ua as fe,wa as he}from"./chunk-3TFUSDHY.js";import{d as zt,f as Yt}from"./chunk-J3IHP46B.js";import{a as ft}from"./chunk-UKQ7NE5V.js";import{d as S,f as Be,g as ht,i as de,k as me,o as gt,p as wt}from"./chunk-773TIA5M.js";import{a as _n}from"./chunk-CTNBSUVU.js";import{e as J,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var kn=300*1e3,In='The host theme could not be created to host your theme app extension. Please try again or use the "--theme" flag to use an existing theme as the host theme.';async function Co(t,e,r=Date.now()){for(;await Ln(t,e,r););}async function Ln(t,e,r){let o=await Ce(t,e);if(!o||$n(o,r))throw new T(In);return await ie(3),o.processing}function $n(t,e){return t.processing&&Date.now()-e>=kn}var Mn="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",Dn="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",at=3,$e=class extends cr{constructor(e,r={devPreview:!1}){super(e),this.context="App Ext. Host",this.themeId=wr(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??(e=this.devPreview?await this.createHostTheme():await this.create()),e}setTheme(e){yr(this.adminSession.storeFqdn,e)}removeTheme(){vr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:ir,name:this.generateThemeName(this.context),src:Mn};for(let o=0;o<at;o++){h(`Attempt ${o}/${at}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await Je(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),h(`Waiting for theme with id "${n.id}" to be processed`),await Co(n.id,this.adminSession),n;throw new Error}catch{h(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}h(`Theme creation failed after ${at} retries. Creating theme using fallback theme zip`);let r=await Je({...e,src:Dn},this.adminSession);if(!r)throw h("Theme creation failed. Exiting process."),new Z(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var Fn={"theme:init":hr,"theme:check":ar,"theme:console":lr,"theme:delete":pr,"theme:dev":dr,"theme:duplicate":mr,"theme:info":fr,"theme:language-server":gr,"theme:list":Pr,"theme:metafields:pull":Sr,"theme:open":xr,"theme:package":Er,"theme:profile":br,"theme:publish":Ur,"theme:preview":Rr,"theme:pull":Tr,"theme:push":Ar,"theme:rename":_r,"theme:share":Cr},Ca=Fn;async function ko(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(U=>U.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[c,d]=await Promise.all([Lt(t.storeFqdn),qn(e)]),l=c.storeFqdn,[u,g]=await Promise.all([et(c),Xe(c)]),w=g?await Ze(t.storePassword,l,u):void 0,m=await Nn(c,t.theme),f=m.id.toString();return be({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:d}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${l}/admin/themes/${f}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:On,options:{theme:m,adminSession:c,storefrontPassword:w,crawlerSignatureHeaders:u,themeExtensionDirectory:a,themeExtensionPort:i}}}var On=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await ur(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function Nn(t,e){let r;if(e)h(`Fetching theme with provided id ${e}`),r=await Ce(parseInt(e,10),t);else{let o=new $e(t,{devPreview:!0});await Ue([{title:"Configuring host theme for theme app extension",task:async()=>{h("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new T("Could not find or create a host theme for theme app extensions");return r}async function qn(t){return t.developerPlatformClient?.clientName===zr.AppManagement?`https://${await xe()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await It()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function Wn(t){let e=S(t.directory,"locales");return we([S(e,"*.json")])}async function Io(t,e){let r=await Wn(t);if(!r.length)return{localization:void 0,status:""};let o=e.currentLocalizationPayload??{defaultLocale:"en",translations:{},lastUpdated:0},n="success";try{await Promise.all(r.map(async s=>{let[a,...i]=s.split("/").pop().split(".");if(a)return i[0]==="default"&&(o.defaultLocale=a),Hn(a,s,o,t,e)})),o.lastUpdated=Date.now(),h(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function Hn(t,e,r,o,n){let s;try{s=await I(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw C(i,n.stderr),new Bt.ExtendableError(i)}}p();function Me(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:""}}}async function re(t,e,r,o){return D({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await Io(t,r),c=await Mr(t),d=t.outputRelativePath?de(n):n,l=await Gn(t,s,d,o),u=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(u=t.configuration.metafields),{assets:{main:le(l)&&l[0]?.assets?.main?l[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await ge(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:Me(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:l,localization:a??null,metafields:u,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:c?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function Gn(t,e,r,o){let n=t.configuration,s=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(s=[{target:"purchase.post.render"}]),le(s)){let a=await Bn(r);return Promise.all(s.map(async i=>{let{target:c,resource:d}=i,l={...i,surface:Le(c),root:{url:`${e}/${c}`},resource:d||{url:""}},u=a?.[c];if(!u)return l;let w=await Vn(u,{target:c,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...l,...w}}))}return s}async function Bn(t){try{let e=S(t,"manifest.json"),r=await I(e);return JSON.parse(r)}catch(e){if(e instanceof SyntaxError)throw new Error(`Invalid manifest.json in ${t}: ${e.message}`);return null}}async function Kn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,c=e[s];if(typeof c=="string"){let w=await De(s,i,typeof a=="string"?a:c,r,o,n,typeof a=="string"?c:void 0);return{assets:{[w.name]:w}}}let l=e.build_manifest?.assets?.[s];if(l?.filepath){let u=await De(s,i,l.filepath,r,o,n,l.module);return{assets:{[u.name]:u}}}return{}}async function jn({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await ge(S(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function zn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,c)=>{let d=i.schema,l=s[c]?.schema,u=typeof l=="string"?l:d,g=typeof l=="string"?d:void 0;return{...i,schema:await De("schema",`${t}/intents/${c}/schema`,u,r,o,n,g)}}))}:{}}async function Yn({target:t,url:e,extension:r,resolver:o},n,s){let a=await De(n,`${t}/${n}`,s,e,r,o);return{assets:{[a.name]:a}}}async function Vn(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return Qn(o,n)?zn(e,n):Jn(o,n)?Yn(e,o,n):Xn(o,n)?jn(e,o,n):Kn(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function le(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function De(t,e,r,o,n,s,a){let i=`${e}${me(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await ge(S(n.directory,a??r))??0}}function Qn(t,e){return t==="intents"&&Array.isArray(e)}function Jn(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function Xn(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as Zn}from"events";var pe;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(pe||(pe={}));async function Lo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:ao(t.storeFqdn,t.apiKey),mobileUrl:co(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>re(n,e,t,r&&it(r,n.devUUID))))}}function it(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var Fe=class extends Zn{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=X(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(le(n.extensionPoints)&&le(o.extensionPoints)){let s=n.extensionPoints.reduce((c,d)=>({...c,[d.target]:d}),{});o.extensionPoints=X(o.extensionPoints,n.extensionPoints,c=>c.map(d=>{let l=s[d.target];return l?X(d,l,(u,g)=>g):d}));let{extensionPoints:a,...i}=n;return X(o,i)}return X(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){h(b`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await re(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},it(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await re(e,r,this.options,it(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(pe.Update,e)}};p();p();var z;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(z||(z={}));function $o(t,e){return(r,o,n)=>{r.url==="/extensions"&&(h("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,es(t,e)))}}function es(t,e){return r=>{h("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};h(b`Sending connected payload: ${P.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",ss(t,e))}}function ts(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?P.json(o).output():String(o)).join(" ");return b`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var rs={debug:t=>P.gray(t),warn:t=>P.yellow(t),error:t=>P.errorText(t)};function os({type:t,message:e}){let r=ts(e);switch(t){case"debug":case"warn":case"error":return b`${rs[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function ns(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(os(t))})}function ss(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(h(b`Received websocket message with event type ${n} and data:
2
+ ${P.json(s)}
3
+ `,e.stdout),n===z.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===z.Dispatch){let a=as(o,e);Do(t,a,e)}else n===z.Log&&ns(s,e)}}function Mo(t,e){return r=>{let o={event:z.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};h(b`Sending websocket update event to the websocket clients:
4
+ ${P.json(o)}
5
+ `,e.stdout),Do(t,o,e)}}function Do(t,e,r){h(b`Sending websocket with event type ${e.event} and data:
6
+ ${P.json(e.data)}
7
+ `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function as(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var is=10;function Fo(t){let e=new xt.default({noServer:!0,clientTracking:!0}),r=cs(e);return t.httpServer.on("upgrade",$o(e,t)),t.payloadStore.on(pe.Update,Mo(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function cs(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},is*1e3)}p();p();p();function Oo(t,e){let{url:r}=Me(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",Oe(t,e)),o.toString()}}function No(t,e,r){let o=Le(t),n=new URL(`https://${r.storeFqdn}/`);switch(o){case"checkout":n.pathname=r.checkoutCartUrl,n.searchParams.append("dev",`${r.url}/extensions`);break;case"post_purchase":if(n.pathname=r.checkoutCartUrl,n.searchParams.set("script_url",`${r.url}/extensions/${e.devUUID}/assets/${e.localIdentifier}.js`),n.searchParams.set("post_purchase_dev_api_key",r.apiKey),e.devUUID&&r.websocketURL&&(n.searchParams.set("uuid",e.devUUID),n.searchParams.set("socket_url",r.websocketURL)),"metafields"in e.configuration){let s={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(s))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",Oe(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=ls(e,r,t);break;default:return}return n.toString()}function ls(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 Oe(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function q(t,e){Zt(t,Xt(e))}p();var ct=class extends Z{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function qo(t){let e=await ps(t),r=await I(e);return Jt(r,t.data)}async function ps(t){let e=await us(),r=[];t.extensionSurface&&r.push(S(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(S(e,`${t.template}.html.liquid`));let o=await we(r);if(o.length===0)throw new ct(t);return o[0]}async function us(){return await vt("templates/ui-extensions/html",{type:"directory",cwd:wt(import.meta.url)})}var Wo=O(t=>{H(t,"Access-Control-Allow-Origin","*"),H(t,"Access-Control-Allow-Methods","GET, OPTIONS"),H(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),Ho=O(t=>{H(t,"Cache-Control","no-cache")}),lt=O(async t=>_e(t,"/extensions",307));async function ds(t,e){let{filePath:r}=e;if(!await W(r))return q(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await yt(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await W(r)))return q(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await I(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".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=me(r),a=n[s]||"text/plain";return H(t,"Content-Type",a),o}function Go({getExtensions:t,payloadStore:e}){return O(async r=>{let{extensionId:o,assetPath:n=""}=Ae(r),s=t().find(l=>l.devUUID===o);if(!s)return q(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n)??n,c=Be(Fr(s.outputPath)),d=Be(S(c,i));return gt(c,d)?ds(r,{filePath:d}):q(r,{statusCode:404,statusMessage:"Not Found"})})}function pt({payloadStore:t}){return O(e=>(H(e,"content-type","application/json"),t.getRawPayload()))}function Bo({devOptions:t}){return O(e=>{h(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function ut({devOptions:t,getExtensions:e}){return O(async r=>{let{extensionId:o}=Ae(r),n=e().find(i=>i.devUUID===o);if(!n)return q(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(er(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return qo({data:{url:Oe(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=Oo(n,t);return _e(r,i,307)}}let a=t.appWatcher.buildOutputPath;return H(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:oe(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await re(n,a,t)}})}function Ko({devOptions:t,getExtensions:e}){return O(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Ae(r),s=e().find(i=>i.devUUID===o);if(!s)return q(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return q(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=No(n,s,t);return a?_e(r,a,307):q(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as ms}from"http";function jo(t){let e=tr(),r=rr();e.use(Bo(t)),e.use(Wo),e.use(Ho),r.use("/extensions/dev-console",lt),r.use("/extensions/:extensionId",ut(t)),r.use("/extensions/:extensionId/",ut(t)),r.use("/extensions/:extensionId/:extensionPointTarget",Ko(t)),r.use("/extensions/:extensionId/assets/**:assetPath",Go(t)),r.use("/extensions",pt(t)),r.use("/extensions/",pt(t)),r.use("/",lt),e.use(r);let o=ms(or(e));return o.listen(t.devOptions.port,"localhost"),o}async function zo(t){let e={...t,websocketURL:oe(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Lo(e,r,o),s=new Fe(n,e,o),a=e.extensions.filter(u=>u.isPreviewable),i=()=>a;h("Setting up the UI extensions HTTP server...",e.stdout);let c=jo({devOptions:e,payloadStore:s,getExtensions:i});h("Setting up the UI extensions Websocket server...",e.stdout);let d=Fo({...e,httpServer:c,payloadStore:s});h("Setting up the UI extensions bundler and file watching...",e.stdout);let l=async({appWasReloaded:u,app:g,extensionEvents:w})=>{u&&(a=g.allExtensions.filter(m=>m.isPreviewable));for(let m of w){if(!m.extension.isPreviewable)continue;let f=m.buildResult?.status==="ok"?"success":"error",U=m.buildResult?.status==="error"?{message:m.buildResult.error,file:m.buildResult.file}:void 0;switch(m.type){case te.Created:if(e.extensions.push(m.extension),!e.checkoutCartUrl){let E=await Ie(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(m.extension,r);break;case te.Updated:await s.updateExtension(m.extension,e,r,{status:f,error:U});break;case te.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==m.extension.devUUID),await s.deleteExtension(m.extension);break}}};e.appWatcher.onEvent(l).onStart(l),e.signal.addEventListener("abort",()=>{h("Closing the UI extensions dev server..."),d.close(),c.close()})}function oe(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var fs="3",hs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:c,proxyUrl:d,appName:l,appDotEnvFile:u,appId:g,grantedScopes:w,allExtensions:m,appDirectory:f,appWatcher:U})=>{await zo({appName:l,appDotEnvFile:u,appDirectory:f,id:g,extensions:m,stdout:e,stderr:t,signal:r,url:d,port:i,storeFqdn:Ee(n),storeId:s,apiKey:o,grantedScopes:w,checkoutCartUrl:c,subscriptionProductUrl:a,manifestVersion:fs,appWatcher:U})};async function Yo({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await Ie(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:hs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();function Y(t){let e=t.find(o=>ee(o,N.Frontend)),r=t.find(o=>ee(o,N.Backend));return{frontendConfig:e,backendConfig:r}}p();async function Vo(t){let r={topic:"app/uninstalled",api_version:(await lo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:mo.LOCALHOST,shared_secret:t.sharedSecret},o=await po(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await ie(3);let n=await gs(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function gs(t,e){let r=0;for(;r<3;){try{return await uo(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof _t&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await ie(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 Vo({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function Qo({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=Y(t),c=t.map(({configuration:l})=>l.webhooks_path).find(l=>l)??"/api/webhooks";if(c&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:ws,options:{deliveryPort:a?r:o,webhooksPath:c,organizationId:n,...s}}}p();async function Jo(t){return{type:"graphiql",prefix:"graphiql",options:t,function:ys}}var ys=async({stdout:t,abortSignal:e},r)=>{let o=fo({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=sr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",async()=>{n.close()})};p();async function Zo({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=Y(t),c=i?.configuration.hmr_server?await $():void 0,d=void 0,l=t.map(async u=>{let g=await vs({web:u,frontendPort:r,backendPort:o}),w=c&&u.configuration.roles.includes(N.Frontend)?{port:c,httpPaths:u.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:u.configuration.name??["web",...u.configuration.roles].join("-"),function:Ps,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:d,hmrServerOptions:w,roles:u.configuration.roles}}});return Promise.all(l)}async function vs({web:t,frontendPort:e,backendPort:r}){return ee(t,N.Frontend)?e:ee(t,N.Backend)?r:$()}async function Ps({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:c,directory:d,devCommand:l,preDevCommand:u,scopes:g,shopCustomDomain:w,hmrServerOptions:m}){let f=m?.port,U={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:`${c}`,...f&&{HMR_SERVER_PORT:`${f}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:d,port:o,env:U,stdout:t,stderr:e};u&&(t.write(`Running pre-dev command: "${u}"`),await Xo({...E,command:u,showOutput:zt()})),await Xo({...E,command:l,showOutput:!0})}async function Xo({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let c=t.split("&&").map(d=>d.trim())??[];for(let d of c){let[l,...u]=d.split(" ");l?.length!==0&&await Re(l,u,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var Ne=class{constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(b`${P.yellow(e)}`.value)}async success(e){await this.log(b`${P.green(e)}`.value)}async debug(e){h(e,this.stdout)}async error(e,r){let o=P.errorText("\u274C Error"),n=P.errorText(`\u2514 ${e}`);await this.log(b`${o}`.value,r),await this.log(b`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e){if(!e)return;let r=e.extensionEvents??[],n=(await Promise.all(r.map(async a=>a.type===te.Deleted?[]:(await a.extension.getDevSessionUpdateMessages())?.map(c=>({message:c,prefix:a.extension.handle}))??[]))).flat(),s=n.map((a,i)=>{let c=b`${P.gray(i===n.length-1?"\u2514 ":"\u2502 ")}${a.message}`.value;return this.log(c,a.prefix)});await Promise.all(s)}async logMultipleErrors(e){let r=P.errorText("\u274C Error");await this.log(b`${r}`.value,"app-preview");let o=e.map(n=>{let s=P.errorText(`\u2514 ${n.error}`);return this.log(b`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(e)})}};p();var qe=class{constructor(e){this.processBatch=e,this.queue=[],this.processingPromise=void 0}enqueue(e){this.queue.push(e),this.processingPromise??(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 We=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}constructor(e,r){this.failedEvents=[],this.currentSessionState=null,this.statusManager=e.devSessionStatusManager,this.logger=new Ne(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new qe(o=>this.processEvents(o))}async start(){await this.logger.info(`Preparing dev preview on ${this.options.storeFqdn}`),this.statusManager.setMessage("LOADING"),this.appWatcher.onEvent(async e=>this.onEvent(e)).onStart(async e=>this.onStart(e)).onError(async e=>this.handleDevSessionResult({status:"unknown-error",error:e}))}async onEvent(e){await this.validateAppEvent(e)&&this.appEventsProcessor.enqueue(e)}async processEvents(e){let r=[...this.failedEvents,...e],o=this.consolidateAppEvents(r);if(this.failedEvents=[],!o)return;this.statusManager.setMessage("CHANGE_DETECTED"),this.updatePreviewURL(o),await this.logger.logExtensionEvents(o);let n=Zr(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${rt(n)}ms - Total: ${rt(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let a of e)for(let i of a.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new T(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR"),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){e.status==="updated"?(await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r),await this.setUpdatedStatusMessage()):e.status==="created"?(this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r),this.statusManager.setMessage("READY")):e.status==="aborted"?await this.logger.debug("\u274C Dev preview update aborted (new change detected or error during update)"):(e.status==="remote-error"||e.status==="unknown-error")&&(await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR"):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR"))),!this.statusManager.status.isReady&&!Yt()&&setImmediate(()=>{throw new T("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:this.options.appPreviewURL,appEmbedded:e.app.configuration.embedded,hasExtensions:r})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=oe(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new Error("Unauthorized");if(r instanceof Ut)throw r.response.status===401||r.response.status===403?new T("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new T("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await to(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await Pt(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=S(de(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...ro];r&&n.push("manifest.json"),await oo(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await no(s,o),s}async getSignedURLWithRetry(){return so(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.devSession;if(n&&this.currentSessionState){let s=oe(this.options.url),a=this.currentSessionState?.userId;if(n.websocketUrl!==s||n.user?.id!==a){let i=n.user?.email;await this.logger.error(`Another developer ${i?`(${i}) `:""}has taken ownership of this dev preview.`);let c=`Another user${i?` (${i})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,d=["You can restart by running",{command:"shopify app dev"},"again."];throw new T(c,d)}this.currentSessionState={websocketUrl:n.websocketUrl,userId:n.user?.id??null,userEmail:n.user?.email??null}}return o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await Promise.all(n.map(a=>{let i=a.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${a.message}`:a.message;return this.logger.warning(i)})),o.length?{status:"remote-error",error:o}:{status:"created"}}};async function en({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:xs,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var xs=async({stdout:t},e)=>{await We.start(e,t)};p();p();p();var tn=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=Rt().substring(0,6),i=`${Es(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,c=Ao({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),d=S(n,i);try{return await he(n),await fe(d,c),{fullOutputPath:d,identifier:s}}catch(l){throw r.write(`Error while writing log to file: ${l}
8
+ `),l}};function Es(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),s=e.getUTCHours().toString().padStart(2,"0"),a=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),c=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${c}Z`}var He=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:d=0})=>{if(!i?.aborted)try{let l=e,u=wo,g=d,w=await o.appLogs({jwtToken:e,cursor:r},a),{errors:m,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===Po?(bs(R,x,t),x=new ho(go(x))):R.log_type.startsWith(xo)?Us(R,x,t):t.write(JSON.stringify(x));let _=await tn({appLog:R,appLogPayload:x,stdout:t,storeName:s,logsDir:c});t.write(b`${P.gray("\u2514 ")}${P.link("Open log file",`file://${_.fullOutputPath}`,`Log: ${_.fullOutputPath}`)} ${P.gray(`(${_.identifier})`)}\n`.value)})}}else{let E={errors:m.map(x=>({message:x,status:f}))},R=await To({response:E,onThrottle:x=>{C("Request throttled while polling app logs.",t),C(`Retrying in ${x/1e3} seconds.`,t)},onUnknownError:x=>{C("Error while polling app logs.",t),C(`Retrying in ${x/1e3} seconds.`,t)},onResubscribe:()=>n()});if(R.resubscribeResult==="failed"){if(g+=1,g>=yo){C("App log streaming session has expired. Please restart your dev session.",t);return}}else R.resubscribeResult==="succeeded"&&(g=0);R.nextJwtToken&&(l=R.nextJwtToken),u=R.retryIntervalMs}let{cursor:U}=w;setTimeout(()=>{He({stdout:t,appLogsFetchInput:{jwtToken:l,cursor:U??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:g}).catch(E=>{h(`Unexpected error during polling: ${E}}
9
+ `)})},u)}catch(l){C("Error while polling app logs.",t),C(`Retrying in ${nt/1e3} seconds.`,t),h(`${l}}
10
+ `),setTimeout(()=>{He({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c}).catch(u=>{h(`Unexpected error during polling: ${u}}
11
+ `)})},nt)}};function bs(t,e,r){let o=(e.fuel_consumed/vo).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(`
12
+ `).filter(Boolean).map(s=>b`${P.gray("\u2502 ")}${s}`.value).join(`
13
+ `))}function Us(t,e,r){t.log_type===Eo?r.write("Function network access response retrieved from cache."):t.log_type===bo?e.reason===So?r.write("Function network access request executing in background because there is no cached response."):e.reason===Ro&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===Uo&&(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 Ss(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function rn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:Rs,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var Rs=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:c})=>{async function d(l){let u=await st(o,n,a,t),g=c.getLogsDir();await he(g),await He({stdout:t,appLogsFetchInput:{jwtToken:u},resubscribeCallback:()=>st(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:l,logsDir:g})}try{let l=!1,u,g=async w=>{let m=Ss(w.app);if(m&&!l){h("Function extensions detected, starting logs polling"),l=!0,u=new AbortController;try{await d(u.signal)}catch(f){h(`Failed to start function logs: ${f}`,e)}}else!m&&l&&(h("No function extensions detected, stopping logs polling"),l=!1,u?.abort(),u=void 0)};i.onStart(g).onEvent(g)}catch{}};p();async function on(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:Ts}}var Ts=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 As}from"events";var _s={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"}},Ge=class extends As{constructor(e){super(),this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0},e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};$t(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e){this.updateStatus({statusMessage:_s[e]})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};p();import*as nn from"http";import*as sn from"https";function an(t){return"errors"in t&&Array.isArray(t.errors)}async function cn(t,e,r,o){let s=(await import("./http-proxy-node16-A6AKKRQH.js")).default.createProxyServer(),a=ks(t,s,o),i=r?sn.createServer(r,a):nn.createServer(a);return i.on("upgrade",Cs(t,s,o)),e.addEventListener("abort",()=>{h("Closing reverse HTTP proxy"),i.close()}),{server:i}}function Cs(t,e,r){return function(o,n,s){let a=ln(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let d=(an(i)?i.errors[i.errors.length-1]:void 0)??i;C(`Error forwarding websocket request: ${d.message}`,r),C(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function ks(t,e,r){return function(o,n){let s=ln(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 c=(an(a)?a.errors[a.errors.length-1]:void 0)??a;C(`Error forwarding web request: ${c.message}`,r),C(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});h(b`
14
+ Reverse HTTP proxy error - Invalid path: ${o.url??""}
15
+ These are the allowed paths:
16
+ ${P.json(JSON.stringify(t))}
17
+ `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function ln(t,e,r=!1){let o=e.url??"/";for(let n in t)if(o.startsWith(n))return t[n];return r&&t.websocket?t.websocket:t.default}async function pn({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:c,graphiqlKey:d}){let l=o.apiKey,u=o.apiSecretKeys[0]?.secret??"",g=Tt(),w=!ft(g[ke.disableGraphiQLExplorer]),m=await Kr(t),f=new eo(m,i.proxyUrl),U=await xe(),E=io(n,l,U),R=E,x=nr(d,u,n),_=w?`http://localhost:${c}/graphiql?key=${encodeURIComponent(x)}`:void 0,se=m.configuration.embedded,Q=m.nonConfigExtensions.length>0,F=new Ge({isReady:!1,previewURL:R,graphiqlURL:_,appEmbedded:se,hasExtensions:Q}),B=[...await Zo({webs:m.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:l,apiSecret:u,scopes:$r(m.configuration)}),w?await Jo({appName:o.title,appUrl:E,port:c,apiKey:l,apiSecret:u,key:x,storeFqdn:n}):void 0,await Yo({allExtensions:m.realExtensions,storeFqdn:n,storeId:s,apiKey:l,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:m.name,appDotEnvFile:m.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:m.directory,appWatcher:f}),await en({app:m,apiKey:l,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:f,appPreviewURL:E,devSessionStatusManager:F}),await ko({remoteApp:o,localApp:m,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),Qo({webs:m.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:u,remoteAppUpdated:e}),await rn({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:l},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:f}),await on({appWatcher:f})].filter(Is);return{processes:await Ls(B,i.proxyPort,i.reverseProxyCert),previewUrl:R,graphiqlUrl:_,devSessionStatusManager:F}}var Is=t=>t!==void 0&&t!==!1;async function Ls(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(N.Frontend)){let c=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${c}`;let d=a.options.hmrServerOptions;d&&(i.websocket=`http://localhost:${d.port}`,d.httpPaths.forEach(l=>i[l]=`http://localhost:${d.port}`)),a.options.port=c}else if(a.type==="previewable-extension"){let c=await $();i[a.options.pathPrefix]=`http://localhost:${c}`,a.options.port=c}return{process:a,rules:i}})),n=o.map(({process:a})=>a),s=o.map(({rules:a})=>a).reduce((a,i)=>({...a,...i}),{});return Object.keys(s).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:$s,options:{port:e,rules:s,localhostCert:r}}),n}var $s=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await cn(o,t,n,e);K(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();p();p();var ne=J(ye(),1);var un=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function dn(){let[t,e]=(0,ne.useState)(0);return(0,ne.useEffect)(()=>{let r=setInterval(()=>{e(o=>(o+1)%un.length)},70);return()=>clearInterval(r)},[]),ne.default.createElement(L,null,un[t])}p();var A=J(ye(),1);var mn=.9,fn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Et(),{isRawModeSupported:o}=ve(),[n,s]=(0,A.useState)(e),[a,i]=(0,A.useState)(Math.floor(r.columns*mn)),[c,d]=(0,A.useState)(!0),l=(0,A.useRef)(null);if(!n)throw new Error("No tabs provided");Pe((m,f)=>{(async()=>{if(f?.leftArrow||f?.rightArrow||f?.tab){let x=Object.entries(t).filter(([B,v])=>v.content),_=x.findIndex(([B])=>B===n);if(_===-1)return;let se=f?.leftArrow?-1:1,Q=(_+se+x.length)%x.length,F=x[Q];F&&s(F[0])}let E=t[m];if(E){E.action?await E.action():s(m);return}let R=t[n];if(R?.shortcuts){let x=R.shortcuts.find(_=>_.key===m);x&&(!x.condition||x.condition())&&await x.action()}})()},{isActive:!!o}),(0,A.useLayoutEffect)(()=>{let m=()=>{if(i(Math.floor(r.columns*mn)),!l.current)return;let f=bt(l.current);d(f.width<r.columns)};return r.on("resize",m),()=>{r.off("resize",m)}},[r]);let u=Object.entries(t).map(([m,f])=>({...f,inputKey:m,header:` (${m}) ${f.label} `})),g=u.filter(m=>!m.action),w=u.filter(m=>m.action);return A.default.createElement(A.default.Fragment,null,A.default.createElement(k,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},A.default.createElement(k,{ref:l,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},A.default.createElement(L,{wrap:"truncate-end"},"\u2502",g.map(m=>A.default.createElement(A.default.Fragment,{key:m.inputKey},A.default.createElement(L,{bold:n===m.inputKey,inverse:n===m.inputKey,wrap:"truncate"},m.header),"\u2502")))),c&&A.default.createElement(k,{flexGrow:1,justifyContent:"flex-end"},w.map((m,f)=>A.default.createElement(L,{wrap:"truncate",key:m.inputKey},"(",m.inputKey,") ",m.label,f<w.length-1&&" \u2502 ")))),A.default.createElement(k,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var y=J(ye(),1);var hn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:c,onAbort:d})=>{let{isRawModeSupported:l}=ve(),[u,g]=(0,y.useState)(void 0),[w,m]=(0,y.useState)(void 0),[f,U]=(0,y.useState)(r.status),[E,R]=(0,y.useState)(!1),{isAborted:x}=Ht(t.signal,async v=>{v&&m(typeof v=="string"?v:v.message),r.status.isReady?R(!0):(g("Shutting down dev ..."),await d()),_o()}),_=(0,y.useMemo)(()=>e.map(v=>({...v,action:async(ue,Rn,Tn)=>{try{return await v.action(ue,Rn,Tn)}catch(An){t.abort(An)}}})),[e,t]);(0,y.useEffect)(()=>(r.on("dev-session-update",U),()=>{r.off("dev-session-update",U)}),[]),Pe((v,ue)=>{Ot(v,ue,()=>t.abort())},{isActive:!!l});let se=v=>{switch(v){case"loading":return y.default.createElement(dn,null);case"success":return"\u2705";case"error":return"\u274C"}},Q=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:f.previewURL,condition:()=>!!(f.isReady&&f.previewURL),action:async()=>{await j.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),f.previewURL&&await Se(f.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:ot(o),condition:()=>!!(f.isReady&&f.appEmbedded===!1&&f.hasExtensions),action:async()=>{await j.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Se(ot(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:f.graphiqlURL,condition:()=>!!(f.isReady&&f.graphiqlURL),action:async()=>{await j.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),f.graphiqlURL&&await Se(f.graphiqlURL)}}],F=Q.filter(v=>v.condition?.()??!0),B={d:{label:"Dev status",shortcuts:Q,content:y.default.createElement(y.default.Fragment,null,f.statusMessage&&y.default.createElement(L,null,se(f.statusMessage.type)," ",f.statusMessage.message),l&&F.length>0&&y.default.createElement(k,{marginTop:1,flexDirection:"column"},F.map(v=>y.default.createElement(L,{key:v.key},Nt.pointerSmall," ",y.default.createElement(L,{bold:!0},"(",v.key,")")," ",Ve()&&v.url?y.default.createElement(je,{url:v.url,label:v.shortcutLabel}):v.shortcutLabel))),y.default.createElement(k,{marginTop:l?1:0,flexDirection:"column"},u?y.default.createElement(L,null,u):y.default.createElement(y.default.Fragment,null,f.isReady&&!(l&&Ve())&&y.default.createElement(y.default.Fragment,null,F.filter(v=>v.url).map(v=>y.default.createElement(L,{key:v.key},v.linkLabel," URL: ",y.default.createElement(je,{url:v.url})))))))},a:{label:"App info",content:y.default.createElement(k,{flexDirection:"column"},y.default.createElement(Ye,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":c??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,v])=>v)}))},s:{label:"Store info",content:y.default.createElement(k,{flexDirection:"column"},y.default.createElement(Ye,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,v])=>v)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return y.default.createElement(y.default.Fragment,null,y.default.createElement(qt,{processes:_,prefixColumnSize:Dr,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&y.default.createElement(k,{marginTop:1,flexDirection:"column"},y.default.createElement(Wt,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),x?null:y.default.createElement(k,{paddingTop:1,flexDirection:"column",flexGrow:1},l?y.default.createElement(fn,{tabs:B,initialActiveTab:"d"}):y.default.createElement(k,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},B.d?.content)),w?y.default.createElement(k,{marginTop:1,flexDirection:"column"},y.default.createElement(L,{color:"red"},w)):null)};var gn=J(ye(),1);async function wn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:c,organizationName:d,configPath:l,localURL:u}){if(Kt())return Ft(gn.default.createElement(hn,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:c,organizationName:d,configPath:l,localURL:u,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await Ms({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o})}async function Ms({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){return process.stdout.write(`
18
+ Preview URL: ${e}
19
+ `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
20
+ `),Promise.all(t.map(async n=>{await n.action(process.stdout,process.stderr,o.signal)}))}p();function yn(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];ae({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=Ke(e.map(n=>n.for)).join(" "),o=Ke(e.map(n=>({command:n.flagToRemedy})));ae({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 vn(t,e){return e?e.includes("localhost")?"localhost":(await kt(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var Pn=J(Cn(),1);var V="v1.4.4",xn="FiloSottile/mkcert",dt=P.genericShellCommand("mkcert");async function Ds(t,e,r,o){let n=e[ke.mkcertBinaryPath];if(n)return n;let a=S(t,r==="win32"?"mkcert.exe":"mkcert");if(await W(a))return a;let i=await(0,Pn.default)("mkcert",{nothrow:!0});return i?(h(b`Found ${dt} at ${P.path(i)}`),i):(await Fs(a,r,o),a)}async function Fs(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${V}-darwin-arm64`:`mkcert-${V}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${V}-linux-arm64`:`mkcert-${V}-linux-amd64`;break;case"win32":o=`mkcert-${V}-windows-amd64.exe`;break;default:throw new Z(`Unsupported platform: ${e}`)}await kr(xn,V,o,t),h(b`${dt} saved to ${P.path(t)}`)}async function Os(t){let e=S(t,"mkcert-LICENSE");if(await W(e))return;let r=`https://raw.githubusercontent.com/${xn}/refs/tags/${V}/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 Ct(r),!n.ok)return o}catch{return o}let s=await n.text();await fe(e,s)}async function En({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=S(".shopify","localhost-key.pem"),a=S(".shopify","localhost.pem"),i=S(t,s),c=S(t,a);if(await W(i)&&await W(c))return{keyContent:await I(i),certContent:await I(c),certPath:a};if(!(e??await jr()))throw new T(`Localhost certificate and key are required at ${a} and ${s}`);let l="",u;return await Ue([{title:"Finding or downloading mkcert binary",task:async()=>{let w=S(t,".shopify");l=await Ds(w,r,o,n),u=await Os(w),h(b`${dt} found at: ${P.path(l)}`)}}]),u&&be(u),K(b`Generating self-signed certificate for localhost. You may be prompted for your password.`),await Re(l,["-install","-key-file",i,"-cert-file",c,"localhost"]),K(b`${P.successIcon()} Certificate generated at ${a}\n`),await jt()&&(ae({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"}}),K("\u{1F449} Press any key to continue"),await Gt(),K("")),{keyContent:await I(i),certContent:await I(c),certPath:ht(t,c)}}p();function bn(){let t=["Your app has extensions which need to be assigned",{command:"uid"},"identifiers."],e=["You must first map IDs to your existing extensions by running",{command:"shopify app deploy"},"interactively, without",{command:"--allow-updates"},"or",{command:"--allow-deletes"},", to finish the migration."],r={title:"Reference",body:{list:{items:[{link:{label:"Migrating from the Partner Dashboard",url:"https://shopify.dev/docs/apps/build/dev-dashboard/migrate-from-partners"}}]}}};throw new T(t,void 0,[e],[r])}async function Un(t){let e=await Ns(t);await qs(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:s}=await pn(e);await Hs(e),await Ks({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:s})}async function Ns(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:s,tunnel:a}=t,i;if(a.mode==="auto"){let E=await $();i=await Gr(t.commandConfig,E,"cloudflare")}let c=await Yr(r,o,s,r.flags);r.configuration=c,Vr({app:e,remoteApp:r,selectedStore:n,cachedInfo:tt(t.directory),organization:t.organization,tunnelMode:a.mode}),e.configuration.build?.dev_store_url&&(e.configuration.build={...e.configuration.build,dev_store_url:n.shopDomain},await(await Vt.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Lr(t.project);let d=t.graphiqlPort??await $(ce.graphiql),l=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??ce.graphiql,actual:d}];a.mode==="use-localhost"&&l.push({for:"localhost",flagToRemedy:"--localhost-port",requested:a.requestedPort,actual:a.actualPort}),yn(l);let{webs:u,...g}=await Bs(e.directory,e.webs,d,a,i,r.configuration,t.installMkcert);e.webs=u;let w=e.configuration.build?.automatically_update_urls_on_dev,m=tt(t.directory)?.previousAppId,f=r.apiKey,U=await Gs(u,t.update,g,e,w,r,f);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==m,localApp:e,developerPlatformClient:o,commandOptions:t,network:g,partnerUrlsUpdated:U,graphiqlPort:d,graphiqlKey:t.graphiqlKey}}async function qs(t){await Ws(t)}async function Ws(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||bn()}async function Hs(t){Or({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await js({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Mt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Gs(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=Y(t),d=!1;if((c??i)&&e){let l=qr(r.proxyUrl,t.map(({configuration:u})=>u.auth_callback_path).find(u=>u),o.configuration.app_proxy);d=await Hr({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:l}),d&&o.setDevApplicationURLs(l)}return d}async function Bs(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=Y(e);await zs(e,r);let d=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:l,frontendPort:u,usingLocalhost:g},w,m]=await Promise.all([Nr(d),At()??i?.configuration.port??$(),Wr(s)]),f=g?`${l}:${u}`:l,U=c?.configuration.port;c&&(U??(U=c===i?w:await $()),c.configuration.port=U),U=U??await $();let E;if(o.mode==="use-localhost"){let{keyContent:R,certContent:x,certPath:_}=await En({appDirectory:t,forceInstall:a});E={key:R,cert:x,certPath:_,port:o.actualPort}}return{proxyUrl:f,proxyPort:u,frontendPort:U,backendPort:w,currentUrls:m,webs:e,reverseProxyCert:E}}async function Ks({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let s=new St,a=t.map(d=>({prefix:d.prefix,action:async(u,g,w)=>{let m=d.function;return m({stdout:u,stderr:g,abortSignal:w},d.options)}})),i=o.developerPlatformClient,c={id:o.remoteApp.id,developerPlatformClient:i};return wn({processes:a,previewUrl:e,graphiqlUrl:r,app:c,abortController:s,shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl})}async function js(t){let e=await vn(t.devOptions.commandConfig,t.tunnelUrl);await j.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?ze(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:ze(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await j.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function zs(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);if(o)throw new T(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await Qe(n))throw new T(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await Qe(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new T(s,a)}})()])}p();async function Sn({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??ce.localhost,n=await $(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new T(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var M=J(_n(),1);var mt,G=class extends Jr{static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(mt),r=await Sn({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Dt(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await Br(e.path);let o=await Qr({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),n=await Xr({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset}),s={...o,store:n,directory:e.path,update:!e["no-update"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],storePassword:e["store-password"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],installMkcert:e["install-mkcert"]??!1,tunnel:r};return await Un(s),{app:o.app}}};mt=G;G.summary="Run the app.";G.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).";G.description=mt.descriptionWithoutMarkdown();G.flags={...Qt,...Ir,store:M.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async t=>Ee(t)}),"skip-dependencies-installation":M.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":M.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"subscription-product-url":M.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":M.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":M.Flags.string({description:'Use a custom tunnel, it must be running before executing dev. Format: "https://my-tunnel-url:port".',env:"SHOPIFY_FLAG_TUNNEL_URL",exclusive:["tunnel"]}),"use-localhost":M.Flags.boolean({description:"Service entry point will listen to localhost. A tunnel won't be used. Will work for testing many app features, but not those that directly invoke your app (E.g: Webhooks)",env:"SHOPIFY_FLAG_USE_LOCALHOST",exclusive:["tunnel-url"]}),"install-mkcert":M.Flags.boolean({description:"Install and use mkcert to generate localhost certificates when --use-localhost is enabled without prompting.",env:"SHOPIFY_FLAG_INSTALL_MKCERT",dependsOn:["use-localhost"]}),"localhost-port":Te({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:M.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Te({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":M.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:M.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":Te({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":M.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};var Ku=G;export{Ca as a,Ku as b};
@@ -1,4 +1,4 @@
1
- import{a as i}from"./chunk-GCN4O7HM.js";import{r as t}from"./chunk-ZT4PUH7L.js";import{b as r}from"./chunk-UAYIFFYJ.js";import{u as e}from"./chunk-EEEKSYWV.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var o=class extends r{static{this.summary="Enable automatic upgrades for Shopify CLI."}static{this.descriptionWithMarkdown=`Enable automatic upgrades for Shopify CLI.
1
+ import{a as i}from"./chunk-GCN4O7HM.js";import{b as r}from"./chunk-2MCH43SL.js";import{r as t}from"./chunk-WR2ZQGUR.js";import{u as e}from"./chunk-6YCGMS7X.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var o=class extends r{static{this.summary="Enable automatic upgrades for Shopify CLI."}static{this.descriptionWithMarkdown=`Enable automatic upgrades for Shopify CLI.
2
2
 
3
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
4
 
@@ -0,0 +1 @@
1
+ import{a as K}from"./chunk-BOAGJ6P5.js";import{c as J,g as E}from"./chunk-VKWPEFWQ.js";var _=J((k,D)=>{E();var B=K();D.exports=U;var L="\0SLASH"+Math.random()+"\0",S="\0OPEN"+Math.random()+"\0",j="\0CLOSE"+Math.random()+"\0",Z="\0COMMA"+Math.random()+"\0",w="\0PERIOD"+Math.random()+"\0";function y(r){return parseInt(r,10)==r?parseInt(r,10):r.charCodeAt(0)}function Q(r){return r.split("\\\\").join(L).split("\\{").join(S).split("\\}").join(j).split("\\,").join(Z).split("\\.").join(w)}function T(r){return r.split(L).join("\\").split(S).join("{").split(j).join("}").split(Z).join(",").split(w).join(".")}function z(r){if(!r)return[""];var t=[],i=B("{","}",r);if(!i)return r.split(",");var p=i.pre,c=i.body,f=i.post,n=p.split(",");n[n.length-1]+="{"+c+"}";var h=z(f);return f.length&&(n[n.length-1]+=h.shift(),n.push.apply(n,h)),t.push.apply(t,n),t}function U(r,t){if(!r)return[];t=t||{};var i=t.max==null?1/0:t.max;return r.substr(0,2)==="{}"&&(r="\\{\\}"+r.substr(2)),v(Q(r),i,!0).map(T)}function V(r){return"{"+r+"}"}function W(r){return/^-?0\d/.test(r)}function X(r,t){return r<=t}function Y(r,t){return r>=t}function v(r,t,i){for(var p=[];;){let a=B("{","}",r);if(!a)return[r];let x=a.pre;if(/\$$/.test(a.pre)){let d=a.post.length?v(a.post,t,!1):[""];for(let g=0;g<d.length&&g<t;g++){let G=x+"{"+a.body+"}"+d[g];p.push(G)}return p}var c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),f=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),n=c||f,h=a.body.indexOf(",")>=0;if(!n&&!h){if(a.post.match(/,(?!,).*\}/)){r=a.pre+"{"+a.body+j+a.post,i=!0;continue}return[r]}let b=a.post.length?v(a.post,t,!1):[""];var e;if(n)e=a.body.split(/\.\./);else if(e=z(a.body),e.length===1&&(e=v(e[0],t,!1).map(V),e.length===1))return b.map(function(d){return a.pre+e[0]+d});var s;if(n){var M=y(e[0]),C=y(e[1]),H=Math.max(e[0].length,e[1].length),O=e.length==3?Math.max(Math.abs(y(e[2])),1):1,P=X,R=C<M;R&&(O*=-1,P=Y);var F=e.some(W);s=[];for(var u=M;P(u,C)&&s.length<t;u+=O){var o;if(f)o=String.fromCharCode(u),o==="\\"&&(o="");else if(o=String(u),F){var A=H-o.length;if(A>0){var I=new Array(A+1).join("0");u<0?o="-"+I+o.slice(1):o=I+o}}s.push(o)}}else{s=[];for(var l=0;l<e.length;l++)s.push.apply(s,v(e[l],t,!1))}for(var l=0;l<s.length;l++)for(var m=0;m<b.length&&p.length<t;m++){var $=x+s[l]+b[m];(!i||n||$)&&p.push($)}return p}}});export{_ as a};
@@ -1 +1 @@
1
- import{e as c}from"./chunk-523SJVNT.js";import{R as s}from"./chunk-TIU7MMRT.js";import{d as p,g as a}from"./chunk-IIFRDOYG.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();async function v(e,t){let o=e.apiSecretKeys[0]?.secret;if(!o)throw new a("No API secret keys found for app");return s(t,e.apiKey,o)}function y(e){let{organization:t,remoteApp:o,storeFqdn:u,version:r}=e,n=[`Organization: ${t.businessName}`,`App: ${o.title}`,`Store: ${u}`];return r&&n.push(`API version: ${r}`),n}function S(e,t){if(c(e)&&t.storeType!=="APP_DEVELOPMENT")throw new p("Mutations can only be executed on dev stores.")}export{v as a,y as b,S as c};
1
+ import{e as c}from"./chunk-JS3X6BDT.js";import{R as s}from"./chunk-EZ7EBYDT.js";import{m as p,p as a}from"./chunk-ZTE46E4Z.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();async function v(e,t){let o=e.apiSecretKeys[0]?.secret;if(!o)throw new a("No API secret keys found for app");return s(t,e.apiKey,o)}function y(e){let{organization:t,remoteApp:o,storeFqdn:u,version:r}=e,n=[`Organization: ${t.businessName}`,`App: ${o.title}`,`Store: ${u}`];return r&&n.push(`API version: ${r}`),n}function S(e,t){if(c(e)&&t.storeType!=="APP_DEVELOPMENT")throw new p("Mutations can only be executed on dev stores.")}export{v as a,y as b,S as c};
@@ -1 +1 @@
1
- import{n as A}from"./chunk-DN3BB4IO.js";import{a as P}from"./chunk-2ACN7JIZ.js";import{c as C}from"./chunk-N6IFIMC6.js";import{s as T}from"./chunk-I5X3IP6T.js";import{r as w}from"./chunk-4P54DKG4.js";import{a as D}from"./chunk-LGFOE4XL.js";import{O as u}from"./chunk-TIU7MMRT.js";import{v as h,x as y}from"./chunk-EEEKSYWV.js";import{Pb as O,va as p}from"./chunk-TB7HFPBB.js";import{d,q as m}from"./chunk-773TIA5M.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();async function q(e){P({verbose:e.verbose,noColor:e.noColor});let t=w({store:e.store}),o=await u(t,e.password);await R(o,{path:e.path??m(),force:e.force??!1,silent:e.silent??!1})}var E={article:"ARTICLE",blog:"BLOG",collection:"COLLECTION",company:"COMPANY",company_location:"COMPANY_LOCATION",location:"LOCATION",market:"MARKET",order:"ORDER",page:"PAGE",product:"PRODUCT",variant:"PRODUCTVARIANT",shop:"SHOP"};async function R(e,t){let{force:o,path:i,silent:n}=t;if(!await A(i)&&(process.env.SHOPIFY_LANGUAGE_SERVER==="1"||!await C(o)))return;let f=[],r=[];for(let[a,s]of Object.entries(E))f.push(T(s,e).catch(c=>(r.push(s),[])).then(c=>({[a]:c})));let b=(await Promise.all(f)).reduce((a,s)=>({...a,...s}));if(r.length===Object.values(E).length){n||y({body:"Failed to fetch metafield definitions.",nextSteps:["Check your network connection and try again.","Ensure you have the permission to fetch metafield definitions."],reference:[{link:{label:"Metafield Definition API",url:"https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition"}}]});return}await S(i,b),r.length>0&&O(`Failed to fetch metafield definitions for the following owner types: ${r.join(", ")}`),n||h({body:"Metafield definitions have been successfully downloaded."})}async function S(e,t){let o=await D(e),i=d(o,"metafields.json"),n=JSON.stringify(t,null,2);p(i,n)}export{q as a};
1
+ import{n as A}from"./chunk-XERJY4IG.js";import{a as P}from"./chunk-57YF2UNT.js";import{c as C}from"./chunk-6BX62FFE.js";import{s as T}from"./chunk-HT6MOPLW.js";import{r as w}from"./chunk-Z5DDPQ26.js";import{a as D}from"./chunk-XGMPC7KK.js";import{O as u}from"./chunk-EZ7EBYDT.js";import{v as h,x as y}from"./chunk-6YCGMS7X.js";import{Pb as O,va as p}from"./chunk-3TFUSDHY.js";import{d,q as m}from"./chunk-773TIA5M.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();async function q(e){P({verbose:e.verbose,noColor:e.noColor});let t=w({store:e.store}),o=await u(t,e.password);await R(o,{path:e.path??m(),force:e.force??!1,silent:e.silent??!1})}var E={article:"ARTICLE",blog:"BLOG",collection:"COLLECTION",company:"COMPANY",company_location:"COMPANY_LOCATION",location:"LOCATION",market:"MARKET",order:"ORDER",page:"PAGE",product:"PRODUCT",variant:"PRODUCTVARIANT",shop:"SHOP"};async function R(e,t){let{force:o,path:i,silent:n}=t;if(!await A(i)&&(process.env.SHOPIFY_LANGUAGE_SERVER==="1"||!await C(o)))return;let f=[],r=[];for(let[a,s]of Object.entries(E))f.push(T(s,e).catch(c=>(r.push(s),[])).then(c=>({[a]:c})));let b=(await Promise.all(f)).reduce((a,s)=>({...a,...s}));if(r.length===Object.values(E).length){n||y({body:"Failed to fetch metafield definitions.",nextSteps:["Check your network connection and try again.","Ensure you have the permission to fetch metafield definitions."],reference:[{link:{label:"Metafield Definition API",url:"https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition"}}]});return}await S(i,b),r.length>0&&O(`Failed to fetch metafield definitions for the following owner types: ${r.join(", ")}`),n||h({body:"Metafield definitions have been successfully downloaded."})}async function S(e,t){let o=await D(e),i=d(o,"metafields.json"),n=JSON.stringify(t,null,2);p(i,n)}export{q as a};
@@ -1 +1 @@
1
- import{b as n}from"./chunk-XXLGM6OZ.js";import{l as i}from"./chunk-IIFRDOYG.js";import{g as t}from"./chunk-VKWPEFWQ.js";t();t();var o=class extends i.ExtendableError{constructor(e,p){super(p),this.type=e}},d=r=>async()=>r,f=r=>async e=>e.provider!==r.provider?n(new o("invalid-provider")):r.action(e.port);var a="cloudflare",l=d({name:a});export{o as a,f as b,a as c,l as d};
1
+ import{b as n}from"./chunk-Y4QC2YVE.js";import{u as i}from"./chunk-ZTE46E4Z.js";import{g as t}from"./chunk-VKWPEFWQ.js";t();t();var o=class extends i.ExtendableError{constructor(e,p){super(p),this.type=e}},d=r=>async()=>r,f=r=>async e=>e.provider!==r.provider?n(new o("invalid-provider")):r.action(e.port);var a="cloudflare",l=d({name:a});export{o as a,f as b,a as c,l as d};
@@ -1,3 +1,3 @@
1
- import{b as $}from"./chunk-J3JPJCWP.js";import{a as O}from"./chunk-5VC4XXYH.js";import{a as M}from"./chunk-TM44Z7U7.js";import{a as x,l as H,n as Y}from"./chunk-DN3BB4IO.js";import{a as R}from"./chunk-2ACN7JIZ.js";import{a as G,c as y}from"./chunk-N6IFIMC6.js";import{a as S,b as L}from"./chunk-STJ3LWFL.js";import{k as A,n as I}from"./chunk-I5X3IP6T.js";import{p as D,q as E,r as _,u as P,v as C}from"./chunk-4P54DKG4.js";import{h as V,k as B}from"./chunk-75DBVSVI.js";import{O as g,ua as a}from"./chunk-TIU7MMRT.js";import{b}from"./chunk-NGCPVRDM.js";import{D as F,v as k}from"./chunk-EEEKSYWV.js";import{Wa as T}from"./chunk-TB7HFPBB.js";import{q as p}from"./chunk-773TIA5M.js";import{r as Q}from"./chunk-T6CC5WUU.js";import{e as z,g as d}from"./chunk-VKWPEFWQ.js";d();d();d();async function K(e,t,o,n,r,l){let i=X(o,n,r),c=J(o,e,n,t),s=[...i,...c,{title:"Theme download complete",task:async()=>{}}];s.length>0&&await F(s,{renderOptions:{stdout:l?.stdout??process.stdout},noProgressBar:r.multiEnvironment})}function X(e,t,o){if(o.nodelete)return[];let n=new Set(e.map(i=>i.key));return t.applyIgnoreFilters([...t.files.values()]).map(({key:i})=>i).filter(i=>!n.has(i)).map(i=>({title:`Cleaning your local directory (removing ${i})`,task:async()=>t.delete(i)}))}function J(e,t,o,n){let r=o.applyIgnoreFilters(e);r=r.filter(s=>{let u=s.checksum;return o.files.get(s.key)?.checksum!==u});let l=r.map(s=>s.key),i=s=>s.total===0?"[100%]":`[${Math.round(s.current/s.total*100)}%]`;return $(l,P,(s,u)=>({title:`Downloading files from remote theme ${i({current:u,total:l.length})}`,task:async()=>Z(t,o,s,n)}))}async function Z(e,t,o,n){let r=await A(e.id,o,n);r&&await Promise.all(r.map(l=>t.write(l)))}async function N(e,t,o,n){a("theme-service:pull:setup"),R({verbose:e.verbose,noColor:e.noColor});let r=t??await g(_({store:e.store}),e.password),l=new O(r),i=await(e.development?l.find():l.fetch()),{path:c,nodelete:s,live:u,development:f,only:W,ignore:j,force:w,environment:v}=e;if(!await oe(c??p(),w??!1,v?.[0],o))return;let q=await M(r,{header:"Select a theme to open",filter:{live:u,theme:f?`${i?.id}`:e.theme}});a("theme-service:pull:setup"),await ee(q,r,{environment:v?.[0],force:w??!1,ignore:j??[],multiEnvironment:o,nodelete:s??!1,only:W??[],path:c??p()},n)}async function ee(e,t,o,n){a("theme-service:pull:file-system");let r=H(o.path,{filters:o}),[l]=await Promise.all([I(e.id,t),r.ready()]),i=x(l);a("theme-service:pull:file-system"),await K(e,t,i,r,o,n);let c=o.environment?`Environment: ${o.environment}`:"";k({headline:c,body:["The theme",...G(e),"has been pulled."],nextSteps:[[{link:{label:"View your theme",url:S(e,t)}}],[{link:{label:"Customize your theme at the theme editor",url:L(e,t)}}]]})}async function te(e){return(await T("*",{cwd:e,deep:1,onlyFiles:!1})).length===0}async function oe(e,t,o,n){return t?!0:!(!await te(e)&&!await Y(e)&&!await y(t,void 0,o,n)||await V(e)&&!await B(e)&&!await y(t,"The current Git directory has uncommitted changes.",o,n))}var h=z(Q(),1);var U,m=class extends C{async command(t,o,n,r,l){a("theme-command:pull"),await N({...t,noColor:t["no-color"]},o,n,l),a("theme-command:pull")}storeAuthScopes(){return["read_themes"]}};U=m;m.summary="Download your remote theme files locally.";m.descriptionWithMarkdown=`Retrieves theme files from Shopify.
1
+ import{b as $}from"./chunk-J3JPJCWP.js";import{a as O}from"./chunk-R26GJEH3.js";import{a as M}from"./chunk-QU5NL2QT.js";import{a as x,l as H,n as Y}from"./chunk-XERJY4IG.js";import{a as R}from"./chunk-57YF2UNT.js";import{a as G,c as y}from"./chunk-6BX62FFE.js";import{a as S,b as L}from"./chunk-STJ3LWFL.js";import{k as A,n as I}from"./chunk-HT6MOPLW.js";import{p as D,q as E,r as _,u as P,v as C}from"./chunk-Z5DDPQ26.js";import{h as V,k as B}from"./chunk-M5KKLAM6.js";import{b}from"./chunk-2Y6CYLKF.js";import{O as g,ra as a}from"./chunk-EZ7EBYDT.js";import{D as F,v as k}from"./chunk-6YCGMS7X.js";import{Wa as T}from"./chunk-3TFUSDHY.js";import{q as p}from"./chunk-773TIA5M.js";import{a as Q}from"./chunk-CTNBSUVU.js";import{e as z,g as d}from"./chunk-VKWPEFWQ.js";d();d();d();async function K(e,t,o,n,r,l){let i=X(o,n,r),c=J(o,e,n,t),s=[...i,...c,{title:"Theme download complete",task:async()=>{}}];s.length>0&&await F(s,{renderOptions:{stdout:l?.stdout??process.stdout},noProgressBar:r.multiEnvironment})}function X(e,t,o){if(o.nodelete)return[];let n=new Set(e.map(i=>i.key));return t.applyIgnoreFilters([...t.files.values()]).map(({key:i})=>i).filter(i=>!n.has(i)).map(i=>({title:`Cleaning your local directory (removing ${i})`,task:async()=>t.delete(i)}))}function J(e,t,o,n){let r=o.applyIgnoreFilters(e);r=r.filter(s=>{let u=s.checksum;return o.files.get(s.key)?.checksum!==u});let l=r.map(s=>s.key),i=s=>s.total===0?"[100%]":`[${Math.round(s.current/s.total*100)}%]`;return $(l,P,(s,u)=>({title:`Downloading files from remote theme ${i({current:u,total:l.length})}`,task:async()=>Z(t,o,s,n)}))}async function Z(e,t,o,n){let r=await A(e.id,o,n);r&&await Promise.all(r.map(l=>t.write(l)))}async function N(e,t,o,n){a("theme-service:pull:setup"),R({verbose:e.verbose,noColor:e.noColor});let r=t??await g(_({store:e.store}),e.password),l=new O(r),i=await(e.development?l.find():l.fetch()),{path:c,nodelete:s,live:u,development:f,only:W,ignore:j,force:w,environment:v}=e;if(!await oe(c??p(),w??!1,v?.[0],o))return;let q=await M(r,{header:"Select a theme to open",filter:{live:u,theme:f?`${i?.id}`:e.theme}});a("theme-service:pull:setup"),await ee(q,r,{environment:v?.[0],force:w??!1,ignore:j??[],multiEnvironment:o,nodelete:s??!1,only:W??[],path:c??p()},n)}async function ee(e,t,o,n){a("theme-service:pull:file-system");let r=H(o.path,{filters:o}),[l]=await Promise.all([I(e.id,t),r.ready()]),i=x(l);a("theme-service:pull:file-system"),await K(e,t,i,r,o,n);let c=o.environment?`Environment: ${o.environment}`:"";k({headline:c,body:["The theme",...G(e),"has been pulled."],nextSteps:[[{link:{label:"View your theme",url:S(e,t)}}],[{link:{label:"Customize your theme at the theme editor",url:L(e,t)}}]]})}async function te(e){return(await T("*",{cwd:e,deep:1,onlyFiles:!1})).length===0}async function oe(e,t,o,n){return t?!0:!(!await te(e)&&!await Y(e)&&!await y(t,void 0,o,n)||await V(e)&&!await B(e)&&!await y(t,"The current Git directory has uncommitted changes.",o,n))}var h=z(Q(),1);var U,m=class extends C{async command(t,o,n,r,l){a("theme-command:pull"),await N({...t,noColor:t["no-color"]},o,n,l),a("theme-command:pull")}storeAuthScopes(){return["read_themes"]}};U=m;m.summary="Download your remote theme files locally.";m.descriptionWithMarkdown=`Retrieves theme files from Shopify.
2
2
 
3
3
  If no theme is specified, then you're prompted to select the theme to pull from the list of the themes in your store.`;m.description=U.descriptionWithoutMarkdown();m.flags={...b,...D,...E("download"),theme:h.Flags.string({char:"t",description:"Theme ID or name of the remote theme.",env:"SHOPIFY_FLAG_THEME_ID"}),development:h.Flags.boolean({char:"d",description:"Pull theme files from your remote development theme.",env:"SHOPIFY_FLAG_DEVELOPMENT"}),live:h.Flags.boolean({char:"l",description:"Pull theme files from your remote live theme.",env:"SHOPIFY_FLAG_LIVE"}),nodelete:h.Flags.boolean({char:"n",description:"Prevent deleting local files that don't exist remotely.",env:"SHOPIFY_FLAG_NODELETE"}),force:h.Flags.boolean({hidden:!0,char:"f",description:"Proceed without confirmation, if current directory does not seem to be theme directory.",env:"SHOPIFY_FLAG_FORCE"})};m.multiEnvironmentsFlags=["store","password","path",["live","development","theme"]];var Le=m;export{N as a,Le as b};
@@ -0,0 +1,6 @@
1
+ import{j as W,l as B}from"./chunk-WR2ZQGUR.js";import{O as v,a as O}from"./chunk-6YCGMS7X.js";import{f as h}from"./chunk-VZKR2YFM.js";import{m as u,p as T}from"./chunk-ZTE46E4Z.js";import{$a as S,Bb as L,Fb as c,Hb as s,Pb as d,Ta as w,Ua as i,Wa as D,ma as x,ua as b}from"./chunk-3TFUSDHY.js";import{d as o,i as k}from"./chunk-773TIA5M.js";import{a as I}from"./chunk-CX5CC6P5.js";import{e as R,g as f}from"./chunk-VKWPEFWQ.js";f();f();function M(e,n){try{return JSON.parse(e)}catch(a){let r=a instanceof Error?a.message:String(a),t=n?` from ${n}`:"";throw new u(`Failed to parse JSON${t}.
2
+ ${r}`)}}var l=R(I(),1),j="yarn.lock",J="package-lock.json",$="pnpm-lock.yaml",C="bun.lockb",_="bun.lock",V="pnpm-workspace.yaml",ke=[j,$,J,C,_],we={yarn:[j],npm:[J],pnpm:[$],bun:[C,_],homebrew:[],unknown:[]},E=["yarn","npm","pnpm","bun","homebrew","unknown"],P=class extends u{constructor(){super("Unknown package manager")}},y=class extends u{constructor(n){super(s`The directory ${c.path(n)} doesn't have a package.json.`)}},N=class extends T{constructor(n){super(s`Couldn't find a a package.json traversing directories from ${c.path(n)}`)}};function A(e=process.env){let n=e.npm_config_user_agent;return["yarn","pnpm","bun","npm"].find(a=>n?.includes(a))??"unknown"}function U(e){return i(o(e,C))||i(o(e,_))}function G(e){switch(e){case"yarn":case"npm":case"pnpm":case"bun":return e;case"homebrew":case"unknown":return"npm"}}function K(e,n,...a){switch(e){case"npm":return{command:"npm",args:["exec","--",n,...a]};case"pnpm":return{command:"pnpm",args:["exec",n,...a]};case"yarn":return{command:"yarn",args:["run",n,...a]};case"bun":return{command:"bun",args:["x",n,...a]}}}async function F(e){let n=e;for(d(s`Looking for a lockfile in ${c.path(n)}...`);;){if(i(o(n,j)))return"yarn";if(i(o(n,$))||i(o(n,V)))return"pnpm";if(U(n))return"bun";if(i(o(n,J)))return"npm";let r=k(n);if(r===n)break;n=r}let a=A();return a!=="unknown"?a:"npm"}async function he(e,n,...a){let r=G(await F(e));return K(r,n,...a)}async function ye(e){let n=await D(o(e.directory,"**/package.json"),{ignore:[o(e.directory,"node_modules/**/package.json")],cwd:e.directory,onlyFiles:!0,deep:e.deep}),a=new O;try{await Promise.all(n.map(async r=>{let t=k(r);await z({directory:t,packageManager:e.packageManager,stdout:void 0,stderr:void 0,signal:a.signal,args:[]})}))}catch(r){throw a.abort(),r}}async function z(e){let n={cwd:e.directory,stdin:void 0,stdout:e.stdout,stderr:e.stderr,signal:e.signal},a=["install"];e.args&&(a=a.concat(e.args)),await h("cmd_all_timing_network_ms")(async()=>{await v(e.packageManager,a,n)})}async function xe(e){return(await g(e)).name}async function be(e){return(await g(e)).version}async function H(e){let n=await g(e),a=n.dependencies??{},r=n.devDependencies??{};return{...a,...r}}async function ve(e){let n=o(e,"package.json"),a=await g(n),r=o(e,V);return!!a.workspaces||w(r)}async function Me(e,n,{cacheExpiryInHours:a=0}={}){let r=async()=>(d(s`Checking if there's a version of ${e} newer than ${n}`),ne(e)),t=`npm-package-${e}`,p;try{p=await W(t,r,a*3600*1e3)}catch{return}if(p&&new l.SemVer(n).compare(p)<0)return p}function Pe(e,n){let a=`npm-package-${e}`,r=B(a)?.value;if(r&&new l.SemVer(n).compare(r)<0)return r}function Ne(e,n){return(0,l.satisfies)(e,n)}async function g(e){if(!await w(e))throw new y(k(e));return M(await x(e),e)}async function Y(e,n){d(s`Adding the following dependencies if needed:
3
+ ${c.json(e)}
4
+ With options:
5
+ ${c.json(n)}
6
+ `);let a=o(n.directory,"package.json");if(!await w(a))throw new y(n.directory);let r=Object.keys(await H(a)),t=e.filter(p=>!r.includes(p.name));t.length!==0&&await q(t,n)}async function q(e,n){let a=e.map(r=>r.version?`${r.name}@${r.version}`:r.name);switch(n.stdout?.write(`Installing ${a.join(" ")} with ${n.packageManager}`),n.packageManager){case"npm":for(let r of a)await m(n,Q(r,n.type));break;case"yarn":await m(n,X(a,n.type,!!n.addToRootDirectory));break;case"pnpm":await m(n,Z(a,n.type,!!n.addToRootDirectory));break;case"bun":await m(n,ee(a,n.type)),await m(n,["install"]);break;case"homebrew":throw new u("Homebrew can't be used to install project dependencies. Use npm, yarn, pnpm, or bun.");case"unknown":throw new P}}async function m(e,n){return h("cmd_all_timing_network_ms")(async()=>v(e.packageManager,n,{cwd:e.directory,stdout:e.stdout,stderr:e.stderr,signal:e.signal}))}async function je(e,n){await Y(e.map(a=>({name:a,version:void 0})),n)}function Q(e,n){let a=["install"];switch(a=a.concat(e),n){case"dev":a.push("--save-dev");break;case"peer":a.push("--save-peer");break;case"prod":a.push("--save-prod");break}return e.match(/@\d/g)&&a.push("--save-exact"),a}function X(e,n,a=!1){let r=["add"];switch(a&&r.push("-W"),r=r.concat(e),n){case"dev":r.push("--dev");break;case"peer":r.push("--peer");break;case"prod":r.push("--prod");break}return r}function Z(e,n,a=!1){let r=["add"];switch(a&&r.push("-w"),r=r.concat(e),n){case"dev":r.push("--save-dev");break;case"peer":r.push("--save-peer");break;case"prod":r.push("--save-prod");break}return r}function ee(e,n){let a=["add"];switch(a=a.concat(e),n){case"dev":a.push("--development");break;case"peer":a.push("--optional");break;case"prod":break}return a}async function Je(e){let n=await S("package.json",{cwd:e,type:"file"});if(n){let a=M(await x(n),n);return{path:n,content:a}}else throw new N(e)}async function $e(e,n){let a=await F(e),r=o(e,"package.json"),t=await g(r);a==="yarn"&&(t.resolutions=t.resolutions?{...t.resolutions,...n}:n),(a==="npm"||a==="pnpm"||a==="bun")&&(t.overrides=t.overrides?{...t.overrides,...n}:n),await b(r,JSON.stringify(t,null,2))}async function ne(e){return d(s`Getting the latest version of NPM package: ${c.raw(e)}`),h("cmd_all_timing_network_ms")(async()=>{let{default:n}=await import("./latest-version-LDWU5F7A.js");return n(e)})}async function Ce(e,n){d(s`JSON-encoding and writing content to package.json at ${c.path(e)}...`);let a=o(e,"package.json");await b(a,JSON.stringify(n,null,2))}function _e(e,n=process.env){if(e&&E.includes(e))return e;let a=A(n);if(a!=="unknown")return a;let r=L();return r!=="unknown"?r:"npm"}export{j as a,J as b,$ as c,C as d,V as e,ke as f,we as g,E as h,P as i,y as j,N as k,A as l,F as m,he as n,ye as o,z as p,xe as q,be as r,H as s,ve as t,Me as u,Pe as v,Ne as w,g as x,Y as y,q as z,je as A,Je as B,$e as C,Ce as D,_e as E};
@@ -1,3 +1,3 @@
1
- import{a as _}from"./chunk-TM44Z7U7.js";import{e as R}from"./chunk-N6IFIMC6.js";import{a as j}from"./chunk-KQTVJMV6.js";import{c as O,i as k,o as x}from"./chunk-HSVZU7MP.js";import{p as v,v as A}from"./chunk-4P54DKG4.js";import{b as F,c as L}from"./chunk-NGCPVRDM.js";import{J as y}from"./chunk-EEEKSYWV.js";import{d as T}from"./chunk-IIFRDOYG.js";import{$a as $,Lb as S,Pb as p,la as P,ua as g}from"./chunk-TB7HFPBB.js";import{d as m,i as w}from"./chunk-773TIA5M.js";import{r as U}from"./chunk-T6CC5WUU.js";import{e as D,g as l}from"./chunk-VKWPEFWQ.js";l();l();l();import{fileURLToPath as I}from"node:url";async function E(...i){let e=await $("package.json",{cwd:I(import.meta.url),type:"file"});if(!e)throw new Error("Failed to find CLI root path");return e.endsWith("/packages/theme/package.json")?m(w(e),"assets",...i):m(w(e),"dist","assets",...i)}async function b(i,e,s,t,n,f){let c=await O(i)?await j(f,i.storeFqdn):void 0;if(n)throw new T("Unable to use Admin API or Theme Access tokens with the profile command","You must authenticate manually by not passing the --password flag.");let d=await x(e,i,n,c),o=await k(d,{method:"GET",path:s,query:[],themeId:e,headers:{Accept:"application/vnd.speedscope+json"}});if(o.status!==200){let u=await o.text();throw new Error(`Bad response: ${o.status}: ${u}`)}let a=await o.text();t?S(a):await J(a)}async function J(i){let e=process.env.WSL_DISTRO_NAME,s=e?`//wsl$/${e}`:"",t=await E("speedscope","index.html");p(`[Theme Profile] Resolved URL to open: ${t}`);let n="liquid-profile",f=Buffer.from(i).toString("base64"),c=`speedscope.loadFileFromBase64(${JSON.stringify(n)}, ${JSON.stringify(f)})`,d=`speedscope-${Number(new Date)}-${process.pid}`,o=m(P(),`${d}.js`);p(`[Theme Profile] writing JS file to: ${o}`),await g(o,c),p(`[Theme Profile] JS file created successfully: ${o}`),t=`${s}${t}`,o=`${s}${o}`,t+=`#localProfilePath=${o}`;let a=m(P(),`${d}.html`);p(`[Theme Profile] writing HTML file to: ${a}`),await g(a,`<script>window.location=${JSON.stringify(t)}</script>`),p(`[Theme Profile] HTML file created successfully: ${a}`),a=`${s}${a}`,t=`file://${a}`,p(`[Theme Profile] Opening URL: ${t}`);let u=await y(t);p(`[Theme Profile] URL opened successfully: ${u}`)}var h=D(U(),1);var q,r=class extends A{async command(e,s){let{password:t}=e,n;e.theme?n={filter:{theme:e.theme}}:n={filter:{live:!0}};let f=await _(s,n),c=[{title:`Generating Liquid profile for ${s.storeFqdn} ${e.url}`,task:async()=>{await b(s,f.id.toString(),e.url,e.json,t,e["store-password"])}}];await R(c)}};q=r;r.summary="Profile the Liquid rendering of a theme page.";r.usage=["theme profile","theme profile --url /products/classic-leather-jacket"];r.descriptionWithMarkdown=`Profile the Shopify Liquid on a given page.
1
+ import{a as _}from"./chunk-QU5NL2QT.js";import{e as R}from"./chunk-6BX62FFE.js";import{a as j}from"./chunk-6Q5VRSRN.js";import{c as O,i as k,o as x}from"./chunk-IKYZ5L3F.js";import{p as v,v as A}from"./chunk-Z5DDPQ26.js";import{b as F,c as L}from"./chunk-2Y6CYLKF.js";import{J as y}from"./chunk-6YCGMS7X.js";import{m as T}from"./chunk-ZTE46E4Z.js";import{$a as $,Lb as S,Pb as p,la as P,ua as g}from"./chunk-3TFUSDHY.js";import{d as m,i as w}from"./chunk-773TIA5M.js";import{a as U}from"./chunk-CTNBSUVU.js";import{e as D,g as l}from"./chunk-VKWPEFWQ.js";l();l();l();import{fileURLToPath as I}from"node:url";async function E(...i){let e=await $("package.json",{cwd:I(import.meta.url),type:"file"});if(!e)throw new Error("Failed to find CLI root path");return e.endsWith("/packages/theme/package.json")?m(w(e),"assets",...i):m(w(e),"dist","assets",...i)}async function b(i,e,s,t,n,f){let c=await O(i)?await j(f,i.storeFqdn):void 0;if(n)throw new T("Unable to use Admin API or Theme Access tokens with the profile command","You must authenticate manually by not passing the --password flag.");let d=await x(e,i,n,c),o=await k(d,{method:"GET",path:s,query:[],themeId:e,headers:{Accept:"application/vnd.speedscope+json"}});if(o.status!==200){let u=await o.text();throw new Error(`Bad response: ${o.status}: ${u}`)}let a=await o.text();t?S(a):await J(a)}async function J(i){let e=process.env.WSL_DISTRO_NAME,s=e?`//wsl$/${e}`:"",t=await E("speedscope","index.html");p(`[Theme Profile] Resolved URL to open: ${t}`);let n="liquid-profile",f=Buffer.from(i).toString("base64"),c=`speedscope.loadFileFromBase64(${JSON.stringify(n)}, ${JSON.stringify(f)})`,d=`speedscope-${Number(new Date)}-${process.pid}`,o=m(P(),`${d}.js`);p(`[Theme Profile] writing JS file to: ${o}`),await g(o,c),p(`[Theme Profile] JS file created successfully: ${o}`),t=`${s}${t}`,o=`${s}${o}`,t+=`#localProfilePath=${o}`;let a=m(P(),`${d}.html`);p(`[Theme Profile] writing HTML file to: ${a}`),await g(a,`<script>window.location=${JSON.stringify(t)}</script>`),p(`[Theme Profile] HTML file created successfully: ${a}`),a=`${s}${a}`,t=`file://${a}`,p(`[Theme Profile] Opening URL: ${t}`);let u=await y(t);p(`[Theme Profile] URL opened successfully: ${u}`)}var h=D(U(),1);var q,r=class extends A{async command(e,s){let{password:t}=e,n;e.theme?n={filter:{theme:e.theme}}:n={filter:{live:!0}};let f=await _(s,n),c=[{title:`Generating Liquid profile for ${s.storeFqdn} ${e.url}`,task:async()=>{await b(s,f.id.toString(),e.url,e.json,t,e["store-password"])}}];await R(c)}};q=r;r.summary="Profile the Liquid rendering of a theme page.";r.usage=["theme profile","theme profile --url /products/classic-leather-jacket"];r.descriptionWithMarkdown=`Profile the Shopify Liquid on a given page.
2
2
 
3
3
  This command will open a web page with the Speedscope profiler detailing the time spent executing Liquid on the given page.`;r.description=q.descriptionWithoutMarkdown();r.flags={...F,...v,theme:h.Flags.string({char:"t",description:"Theme ID or name of the remote theme.",env:"SHOPIFY_FLAG_THEME_ID"}),url:h.Flags.string({description:"The url to be used as context",env:"SHOPIFY_FLAG_URL",default:"/"}),"store-password":h.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),...L};r.multiEnvironmentsFlags=null;var le=r;export{le as a};
@@ -1,4 +1,4 @@
1
- import{b as F}from"./chunk-35FS2NTM.js";import{a as I,b as L,c as x,f as S,j as $,k as N,m as _,t as q}from"./chunk-523SJVNT.js";import{a as P}from"./chunk-UHIP5CFI.js";import{a as z}from"./chunk-VJQJ5PTQ.js";import{R as w,z as E}from"./chunk-TIU7MMRT.js";import{b as B}from"./chunk-NGCPVRDM.js";import{C,u as c,v as T,x as D}from"./chunk-EEEKSYWV.js";import{g as b}from"./chunk-IIFRDOYG.js";import{Fb as d,Hb as u,Rb as A,ca as y,ha as g}from"./chunk-TB7HFPBB.js";import{u as f}from"./chunk-A4SBXDZB.js";import{r as U}from"./chunk-T6CC5WUU.js";import{e as K,g as m}from"./chunk-VKWPEFWQ.js";m();m();async function M(e){let{organization:o,storeFqdn:t,operationId:r,remoteApp:a}=e;c({headline:"Checking bulk operation status.",body:[{list:{items:F({organization:o,remoteApp:a,storeFqdn:t})}}]});let s=a.apiSecretKeys[0]?.secret;if(!s)throw new b("No API secret keys found for app");let l=await w(t,a.apiKey,s),i=await $({adminSession:l,operationId:r,version:await S({adminSession:l,minimumDefaultVersion:I})});i?V(i):D({headline:"Bulk operation not found.",body:u`ID: ${d.yellow(r)}`.value})}async function R(e){let{organization:o,storeFqdn:t,remoteApp:r}=e;c({headline:"Listing bulk operations.",body:[{list:{items:F({organization:o,remoteApp:r,storeFqdn:t})}}]});let a=r.apiSecretKeys[0]?.secret;if(!a)throw new b("No API secret keys found for app");let s=await w(t,r.apiKey,a),i=(await N({adminSession:s,version:await S({adminSession:s,minimumDefaultVersion:I})})).map(n=>({id:x(n.id),status:H(n.status),count:W(n.objectCount),dateCreated:y(new Date(String(n.createdAt))),dateFinished:n.completedAt?y(new Date(String(n.completedAt))):"",results:Y(n.url??n.partialDataUrl)}));A(),i.length===0?c({body:"No bulk operations found in the last 7 days."}):C({rows:i,columns:{id:{header:"ID",color:"yellow"},status:{header:"STATUS"},count:{header:"COUNT"},dateCreated:{header:"DATE CREATED",color:"cyan"},dateFinished:{header:"DATE FINISHED",color:"cyan"},results:{header:"RESULTS"}}}),A()}function V(e){let{id:o,status:t,createdAt:r,completedAt:a,url:s,partialDataUrl:l}=e,i=_(e).value,n=G(r,a),h=u`ID: ${d.yellow(o)}\n${n}`.value;if(t==="COMPLETED"){let k=s?d.link("Download results",s):"";T({headline:i,body:u`${h}\n${k}`.value})}else if(t==="FAILED"){let k=l?d.link("Download partial results",l):"";D({headline:i,body:u`${h}\n${k}`.value})}else c({headline:i,body:h})}function G(e,o){let t=new Date;return o?`Finished ${g(new Date(String(o)),t)}`:`Started ${g(new Date(String(e)),t)}`}function H(e){return e==="COMPLETED"?f.green(e):e==="FAILED"?f.red(e):f.dim(e)}function W(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Y(e){return e?u`${d.link("download",e)}`.value:""}var O=K(U(),1);var v,p=class extends P{async run(){let{flags:o}=await this.parse(v),{appContextResult:t,store:r}=await q(o);return o.id?await M({organization:t.organization,storeFqdn:r.shopDomain,operationId:L(o.id),remoteApp:t.remoteApp}):await R({organization:t.organization,storeFqdn:r.shopDomain,remoteApp:t.remoteApp}),{app:t.app}}};v=p;p.summary="Check the status of bulk operations.";p.descriptionWithMarkdown=`Check the status of a specific bulk operation by ID, or list all bulk operations belonging to this app on this store in the last 7 days.
1
+ import{b as F}from"./chunk-FMTPUYSH.js";import{a as I,b as L,c as x,f as S,j as $,k as N,m as _,t as q}from"./chunk-JS3X6BDT.js";import{a as P}from"./chunk-DHU767C3.js";import{a as z}from"./chunk-QG7TELFC.js";import{b as B}from"./chunk-2Y6CYLKF.js";import{R as w,y as E}from"./chunk-EZ7EBYDT.js";import{C,u as c,v as T,x as D}from"./chunk-6YCGMS7X.js";import{p as b}from"./chunk-ZTE46E4Z.js";import{Fb as d,Hb as u,Rb as A,ba as y,ga as g}from"./chunk-3TFUSDHY.js";import{u as f}from"./chunk-A4SBXDZB.js";import{a as U}from"./chunk-CTNBSUVU.js";import{e as K,g as m}from"./chunk-VKWPEFWQ.js";m();m();async function M(e){let{organization:o,storeFqdn:t,operationId:r,remoteApp:a}=e;c({headline:"Checking bulk operation status.",body:[{list:{items:F({organization:o,remoteApp:a,storeFqdn:t})}}]});let s=a.apiSecretKeys[0]?.secret;if(!s)throw new b("No API secret keys found for app");let l=await w(t,a.apiKey,s),i=await $({adminSession:l,operationId:r,version:await S({adminSession:l,minimumDefaultVersion:I})});i?V(i):D({headline:"Bulk operation not found.",body:u`ID: ${d.yellow(r)}`.value})}async function R(e){let{organization:o,storeFqdn:t,remoteApp:r}=e;c({headline:"Listing bulk operations.",body:[{list:{items:F({organization:o,remoteApp:r,storeFqdn:t})}}]});let a=r.apiSecretKeys[0]?.secret;if(!a)throw new b("No API secret keys found for app");let s=await w(t,r.apiKey,a),i=(await N({adminSession:s,version:await S({adminSession:s,minimumDefaultVersion:I})})).map(n=>({id:x(n.id),status:H(n.status),count:W(n.objectCount),dateCreated:y(new Date(String(n.createdAt))),dateFinished:n.completedAt?y(new Date(String(n.completedAt))):"",results:Y(n.url??n.partialDataUrl)}));A(),i.length===0?c({body:"No bulk operations found in the last 7 days."}):C({rows:i,columns:{id:{header:"ID",color:"yellow"},status:{header:"STATUS"},count:{header:"COUNT"},dateCreated:{header:"DATE CREATED",color:"cyan"},dateFinished:{header:"DATE FINISHED",color:"cyan"},results:{header:"RESULTS"}}}),A()}function V(e){let{id:o,status:t,createdAt:r,completedAt:a,url:s,partialDataUrl:l}=e,i=_(e).value,n=G(r,a),h=u`ID: ${d.yellow(o)}\n${n}`.value;if(t==="COMPLETED"){let k=s?d.link("Download results",s):"";T({headline:i,body:u`${h}\n${k}`.value})}else if(t==="FAILED"){let k=l?d.link("Download partial results",l):"";D({headline:i,body:u`${h}\n${k}`.value})}else c({headline:i,body:h})}function G(e,o){let t=new Date;return o?`Finished ${g(new Date(String(o)),t)}`:`Started ${g(new Date(String(e)),t)}`}function H(e){return e==="COMPLETED"?f.green(e):e==="FAILED"?f.red(e):f.dim(e)}function W(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Y(e){return e?u`${d.link("download",e)}`.value:""}var O=K(U(),1);var v,p=class extends P{async run(){let{flags:o}=await this.parse(v),{appContextResult:t,store:r}=await q(o);return o.id?await M({organization:t.organization,storeFqdn:r.shopDomain,operationId:L(o.id),remoteApp:t.remoteApp}):await R({organization:t.organization,storeFqdn:r.shopDomain,remoteApp:t.remoteApp}),{app:t.app}}};v=p;p.summary="Check the status of bulk operations.";p.descriptionWithMarkdown=`Check the status of a specific bulk operation by ID, or list all bulk operations belonging to this app on this store in the last 7 days.
2
2
 
3
3
  Bulk operations allow you to process large amounts of data asynchronously. Learn more about [bulk query operations](https://shopify.dev/docs/api/usage/bulk-operations/queries) and [bulk mutation operations](https://shopify.dev/docs/api/usage/bulk-operations/imports).
4
4
 
@@ -1 +1 @@
1
- import{a as f}from"./chunk-P7U6BWKN.js";import{a as n}from"./chunk-VJQJ5PTQ.js";import{C as p,F as s,Ga as c}from"./chunk-4MLEL3VK.js";import{b as e}from"./chunk-NGCPVRDM.js";import{r as d}from"./chunk-T6CC5WUU.js";import{e as l,g as r}from"./chunk-VKWPEFWQ.js";r();var m=l(d(),1);var t,{config:b,...u}=n,o=class extends f{async run(){let{flags:a,args:i}=await this.parse(t),{app:g}=await c({directory:a.path,userProvidedConfigName:i.config});return await s(a.path),await p({directory:a.path,configName:i.config,reset:a.reset}),{app:g}}};t=o;o.summary="Activate an app configuration.";o.descriptionWithMarkdown="Sets default configuration when you run app-related CLI commands. If you omit the `config-name` parameter, then you'll be prompted to choose from the configuration files in your project.";o.description=t.descriptionWithoutMarkdown();o.usage="app config use [config] [flags]";o.flags={...e,...u};o.args={config:m.Args.string({description:"The name of the app configuration. Can be 'shopify.app.staging.toml' or simply 'staging'."})};var v=o;export{v as a};
1
+ import{a as f}from"./chunk-M4YPMHIM.js";import{a as n}from"./chunk-QG7TELFC.js";import{C as s,ua as c,z as p}from"./chunk-NOKCVDYD.js";import{b as e}from"./chunk-2Y6CYLKF.js";import{a as d}from"./chunk-CTNBSUVU.js";import{e as l,g as r}from"./chunk-VKWPEFWQ.js";r();var m=l(d(),1);var t,{config:b,...u}=n,o=class extends f{async run(){let{flags:a,args:i}=await this.parse(t),{app:g}=await c({directory:a.path,userProvidedConfigName:i.config});return await s(a.path),await p({directory:a.path,configName:i.config,reset:a.reset}),{app:g}}};t=o;o.summary="Activate an app configuration.";o.descriptionWithMarkdown="Sets default configuration when you run app-related CLI commands. If you omit the `config-name` parameter, then you'll be prompted to choose from the configuration files in your project.";o.description=t.descriptionWithoutMarkdown();o.usage="app config use [config] [flags]";o.flags={...e,...u};o.args={config:m.Args.string({description:"The name of the app configuration. Can be 'shopify.app.staging.toml' or simply 'staging'."})};var v=o;export{v as a};
@@ -0,0 +1,8 @@
1
+ import{c as J}from"./chunk-M5KKLAM6.js";import{b as T}from"./chunk-JHRZCUBE.js";import{a as ae}from"./chunk-HSKB5OTM.js";import{a as ne}from"./chunk-DHU767C3.js";import{a as z}from"./chunk-QG7TELFC.js";import{C as Z,E as ee,d as K,e as Q,ta as te}from"./chunk-NOKCVDYD.js";import{f as k,h as X,i as B}from"./chunk-6UTUJKKC.js";import{a as P}from"./chunk-KGZH4RFA.js";import{b as H}from"./chunk-2Y6CYLKF.js";import{d as F}from"./chunk-EZ7EBYDT.js";import{C as G,p as _,x as R,y as b}from"./chunk-G7QW5OSQ.js";import{B as q,D as O,F as V,v as $,z as U}from"./chunk-6YCGMS7X.js";import{m}from"./chunk-ZTE46E4Z.js";import{Gb as W,Oa as j,Ta as x,Ua as D,Wa as L,X as f,_ as M,ka as g,qa as N,wa as v,ya as E}from"./chunk-3TFUSDHY.js";import{e as Y}from"./chunk-J3IHP46B.js";import{d as p,n as I}from"./chunk-773TIA5M.js";import{a as xe}from"./chunk-CTNBSUVU.js";import{e as he,g as d}from"./chunk-VKWPEFWQ.js";d();d();d();async function re(e,t,r,n={}){let{templates:a,groupOrder:i}=await e.templateSpecifications(t,n);return{templates:a.filter(o=>r.includes(o.identifier)||r.includes(o.type)),groupOrder:i}}d();d();async function ie(e,t){let r=e?.path??"",n=p(t,r);if(!await x(n))throw new m(`
2
+ The extension is not available for ${e?.value}`);return n}async function oe({name:e,app:t}){let r=M(e),n=p(t.directory,B.extensions.directoryName,r);if(await x(n))throw new m(`
3
+ A directory with this name (${r}) already exists.
4
+ Choose a new name for your extension.`);return await v(n),await N(p(n,k.lockFile)),n}function A(e){switch(e){case"vanilla-js":case"preact":case"react":case"typescript":case"typescript-react":return"javascript";case"rust":case"wasm":return e;case void 0:case"liquid":case"config-only":return}}async function se(e){let t=e.extensionChoices.name,r=e.extensionChoices.flavor,n=e.extensionTemplate.supportedFlavors.find(o=>o.value===r),a=await oe({app:e.app,name:t}),i=e.cloneUrl??e.extensionTemplate.url,s={directory:a,url:i,app:e.app,project:e.project,type:e.extensionTemplate.type,name:t,extensionFlavor:n,onGetTemplateRepository:e.onGetTemplateRepository??(async(o,c)=>{await J({repoUrl:o,destination:c,shallow:!0})})};return await we(s),{directory:I(a),extensionTemplate:e.extensionTemplate}}async function we(e){try{switch(e.type){case"theme":await ge(e);break;case"function":await ve(e);break;default:await Ee(e);break}let t=p(e.directory,k.lockFile);await E(t)}catch(t){throw await E(e.directory),t}}async function ge({directory:e,url:t,type:r,name:n,extensionFlavor:a,onGetTemplateRepository:i}){return g(async s=>{let o=await S(t,a,s,i);await T(o,e,{name:n,type:r,uid:F(f(n))})})}async function ve({directory:e,url:t,app:r,project:n,name:a,extensionFlavor:i,onGetTemplateRepository:s}){let o=A(i?.value),c=[];c.push({title:"Generating function extension",task:async()=>{if(await g(async l=>{let u=await S(t,i,l,s);await T(u,e,{name:a,handle:f(a),flavor:i?.value,uid:F(f(a))})}),o==="javascript"){let l=ce(i?.value??"rust");await le(e,l,"!(*.graphql)")}}}),o==="javascript"&&c.push({title:"Installing additional dependencies",task:async()=>{n.usesWorkspaces&&await _({packageManager:n.packageManager,directory:n.directory});let l=Fe(o);await b(l,{packageManager:n.packageManager,type:"prod",directory:n.usesWorkspaces?e:n.directory})}}),o==="javascript"&&c.push({title:"Building GraphQL types",task:async()=>{await Q({directory:e,isJavaScript:!0},{stdout:process.stdout,stderr:process.stderr,app:r})}}),await O(c)}async function Ee({directory:e,url:t,app:r,project:n,name:a,extensionFlavor:i,onGetTemplateRepository:s}){let o=A(i?.value),c=[{title:"Generating extension",task:async()=>{let l=ce(i?.value??"vanilla-js");await g(async u=>{let h=await S(t,i,u,s);await T(h,e,{srcFileExtension:l,name:a,handle:f(a),flavor:i?.value??"",uid:F(f(a))})}),o==="javascript"&&await le(e,l)}},{title:"Installing dependencies",task:async()=>{let l=n.packageManager;if(n.usesWorkspaces)A(i?.value)==="javascript"&&await _({packageManager:l,directory:n.directory});else{await Te(n.directory,i?.value);let u=p(e,"package.json"),h=await ke(u);await b(h,{packageManager:l,type:"prod",directory:n.directory}),await E(u)}}}];c.push({title:"Update shared type definition",task:async()=>{await ee(r)}}),await O(c)}function ce(e){return{"vanilla-js":"js",preact:"jsx",react:"jsx",typescript:"ts","typescript-react":"tsx",rust:"rs",wasm:"wasm",liquid:"liquid","config-only":""}[e]??"js"}function Fe(e){let t=[];return e==="javascript"&&t.push({name:"@shopify/shopify_function",version:`~${K}.0.0`}),t}async function le(e,t,r="*"){let n=await L(p(e,"src",r)),a=[];for(let i of n)a.push(j(i,`${i}.${t}`));await Promise.all(a)}async function Te(e,t){t==="typescript-react"&&await G(e,{"@types/react":X.reactTypes})}async function ke(e){if(!await x(e))return[];let t=await R(e);return Object.entries(t?.dependencies??{}).map(([r,n])=>({name:r,version:n}))}async function S(e,t,r,n){let a=p(r,"download");return await v(a),await n(e,a),ie(t,a)}d();function Pe(e,t=[]){let r=[...e.map(a=>({label:a.name,value:a.identifier,group:a.group||"Other",sortPriority:a.sortPriority??Number.MAX_SAFE_INTEGER})),...t.map(a=>({label:`${a.name} (limit reached)`,value:a.identifier,group:a.group||"Other",disabled:!0,sortPriority:a.sortPriority??Number.MAX_SAFE_INTEGER}))],n=(a,i)=>a.sortPriority===i.sortPriority?a.label.localeCompare(i.label):a.sortPriority-i.sortPriority;return r.sort(n)}var _e=async e=>{let t=e.extensionTemplates,r=e.templateType,n=e.extensionFlavor;if(!r){if(n&&(t=t.filter(c=>c.supportedFlavors.map(l=>l.value).includes(n))),t.length===0)throw new m("You have reached the limit for the number of extensions you can create.");r=await q({message:"Type of extension?",choices:Pe(t,e.unavailableExtensions),groupOrder:e.groupOrder})}let a=t.find(c=>c.identifier===r),i=e.name||await pe(e.directory,a.defaultName),s=e.extensionFlavor??await be(a);return{extensionTemplate:a,extensionContent:{name:i,flavor:s}}};async function pe(e,t,r=1){let n=t.includes(" ")?" ":"-",a=r<=1?t:`${t}${n}${r}`,i=p(e,f(a));return D(i)?pe(e,t,r+1):V({message:"Name your extension:",defaultValue:a})}async function be(e){if(e.supportedFlavors.length!==0)return e.supportedFlavors.length===1&&e.supportedFlavors[0]?e.supportedFlavors[0].value:U({message:"What would you like to work in?",choices:e.supportedFlavors.map(t=>({label:t.name,value:t.value})),defaultValue:"react"})}var de=_e;async function Oe(e){let{app:t,developerPlatformClient:r,remoteApp:n,specifications:a,template:i}=e,s=a.map(ye=>ye.identifier),{templates:o,groupOrder:c}=await re(r,n,s,{requestedTemplate:i}),l=await Ae(o,c,a,t,e),u=await de(l);await Ce(u,i);let h=Ie(u,t,e,r),fe=await se(h);Me(fe,e.project.packageManager)}async function Ae(e,t,r,n,a){let i=await De(a.template,n,e,r);Ne(i,a.flavor);let{validTemplates:s,templatesOverlimit:o}=Se(e,r,n);return{templateType:i?.identifier,name:a.name,extensionFlavor:a.flavor,directory:p(a.directory,"extensions"),app:n,extensionTemplates:s??[],unavailableExtensions:o??[],reset:a.reset,groupOrder:t}}function Se(e,t,r){return ae(e,a=>!ue(r,t,a)?"validTemplates":"templatesOverlimit")}function ue(e,t,r){let n=r.type,a=t.find(s=>s.identifier===n||s.externalIdentifier===n);return e.extensionsForType({identifier:n,externalIdentifier:n}).length>=(a?.registrationLimit??1)}async function Ce(e,t){let{extensionContent:r}=e;return P.addPublicMetadata(()=>({cmd_scaffold_template_flavor:r.flavor,cmd_scaffold_type:e.extensionTemplate.identifier,cmd_scaffold_used_prompts_for_type:!t}))}function Ie(e,t,r,n){return{app:t,project:r.project,cloneUrl:r.cloneUrl,extensionChoices:e.extensionContent,extensionTemplate:e.extensionTemplate,developerPlatformClient:n}}function Me(e,t){let r=je(e.extensionTemplate,e.directory,t);$(r)}function Ne(e,t){if(!t||!e)return;let r=e.supportedFlavors.map(n=>n.value);if(!r.includes(t))throw new m("Invalid template for extension type",`Expected template to be one of the following: ${r.join(", ")}.`)}function je(e,t,r){let n={headline:["Your extension was created in",{filePath:t},{char:"."}],nextSteps:[],reference:[]};return e.type!=="function"&&n.nextSteps.push(["To preview this extension along with the rest of the project, run",{command:W(r,"shopify app dev")}]),e.supportLinks[0]&&n.reference.push(["For more details, see the",{link:{label:"docs",url:e.supportLinks[0]}}]),n}async function De(e,t,r,n){if(!e)return;let a=r.find(i=>i.identifier===e);if(!a){let i=await Y(),s=r.map(c=>c.identifier),o=i?"You might need to enable some flags on your Organization or App":void 0;throw new m(`Unknown extension type: ${e}.
5
+ The following extension types are supported: ${s.join(", ")}`,o)}if(ue(t,n,a))throw new m(`Invalid extension type: ${e}`,`You have reached the limit of extension(s) of type ${a.type} per app`);return a}var me=Oe;var w=he(xe(),1);var C,y=class extends ne{async run(){let{flags:t}=await this.parse(C);await P.addPublicMetadata(()=>({cmd_scaffold_required_auth:!0,cmd_scaffold_template_custom:t["clone-url"]!==void 0,cmd_scaffold_type_owner:"@shopify/app"})),await Z(t.path);let{app:r,project:n,specifications:a,remoteApp:i,developerPlatformClient:s}=await te({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config});return await me({directory:t.path,reset:t.reset,name:t.name,cloneUrl:t["clone-url"],template:t.template,flavor:t.flavor,app:r,project:n,specifications:a,remoteApp:i,developerPlatformClient:s}),{app:r}}};C=y;y.summary="Generate a new app Extension.";y.descriptionWithMarkdown=`Generates a new [app extension](https://shopify.dev/docs/apps/build/app-extensions). For a list of app extensions that you can generate using this command, refer to [Supported extensions](https://shopify.dev/docs/apps/build/app-extensions/list-of-app-extensions).
6
+
7
+ Each new app extension is created in a folder under \`extensions/\`. To learn more about the extensions file structure, refer to [App structure](https://shopify.dev/docs/apps/build/cli-for-apps/app-structure) and the documentation for your extension.
8
+ `;y.description=C.descriptionWithoutMarkdown();y.flags={...H,...z,template:w.Flags.string({char:"t",hidden:!1,description:"Extension template",env:"SHOPIFY_FLAG_EXTENSION_TEMPLATE"}),name:w.Flags.string({char:"n",hidden:!1,description:"name of your Extension",env:"SHOPIFY_FLAG_NAME"}),"clone-url":w.Flags.string({hidden:!0,char:"u",description:"The Git URL to clone the function extensions templates from. Defaults to: https://github.com/Shopify/function-examples",env:"SHOPIFY_FLAG_CLONE_URL"}),flavor:w.Flags.string({hidden:!1,description:"Choose a starting template for your extension, where applicable",options:["vanilla-js","react","typescript","typescript-react","wasm","rust"],env:"SHOPIFY_FLAG_FLAVOR"})};var It=y;export{It as a};
@@ -0,0 +1 @@
1
+ import{T as B}from"./chunk-EZ7EBYDT.js";import{q as O}from"./chunk-6YCGMS7X.js";import{F as w,f as m}from"./chunk-3TFUSDHY.js";import{c as g,e as s,g as o}from"./chunk-VKWPEFWQ.js";var f=g((Q,c)=>{o();function j(r,e,t,n){for(var a=-1,i=r==null?0:r.length;++a<i;){var u=r[a];e(n,u,t(u),r)}return n}c.exports=j});var A=g((S,h)=>{o();var l=O();function E(r,e,t,n){return l(r,function(a,i,u){e(n,a,t(a),u)}),n}h.exports=E});var p=g((U,q)=>{o();var G=f(),I=A(),V=w(),C=m();function D(r,e){return function(t,n){var a=C(t)?G:I,i=e?e():{};return a(t,r,V(n,2),i)}}q.exports=D});var x=g((X,v)=>{o();var F=B(),H=p(),J=Object.prototype,K=J.hasOwnProperty,L=H(function(r,e,t){K.call(r,t)?r[t].push(e):F(r,t,[e])});v.exports=L});var y=g((Z,b)=>{o();var M=p(),N=M(function(r,e,t){r[t?0:1].push(e)},function(){return[[],[]]});b.exports=N});o();var P=s(x()),d=s(y());function $(r,e){return(0,P.default)(r,e)}function k(r,e){return(0,d.default)(r,e)}export{$ as a,k as b};