shopify 5.0.2 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (529) hide show
  1. package/dist/analytics-23GM6KJU.js +1 -0
  2. package/dist/analytics-743FYOAE.js +1 -0
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/{chunk-RPCIFYCY.js → chunk-2EQRXSF6.js} +2 -2
  5. package/dist/{chunk-NXAEBGMO.js → chunk-2IXP3IPE.js} +1 -1
  6. package/dist/{chunk-T4XJKM6B.js → chunk-2KACAQJS.js} +1 -1
  7. package/dist/chunk-2KFYIYLI.js +1 -0
  8. package/dist/chunk-2OCSYLKZ.js +1 -0
  9. package/dist/{chunk-AQKWPRZE.js → chunk-2PILNMHJ.js} +2 -2
  10. package/dist/chunk-36S6MFJQ.js +47 -0
  11. package/dist/{chunk-TFPW2VGN.js → chunk-3DB4EC62.js} +1 -1
  12. package/dist/chunk-3GL3IT4K.js +16 -0
  13. package/dist/{chunk-C3RFAKWR.js → chunk-3JRB7Q3T.js} +1 -1
  14. package/dist/chunk-3KGN6N7E.js +1 -0
  15. package/dist/chunk-3OYMK5X6.js +11 -0
  16. package/dist/chunk-3PYDIBTX.js +1 -0
  17. package/dist/chunk-422BGHXN.js +1 -0
  18. package/dist/chunk-43C32FUQ.js +1 -0
  19. package/dist/chunk-4AN7ECPE.js +9 -0
  20. package/dist/chunk-4AWVU2OV.js +1 -0
  21. package/dist/chunk-4IP37MBX.js +1 -0
  22. package/dist/chunk-4KBOLN7Q.js +8 -0
  23. package/dist/chunk-4LJERO23.js +89 -0
  24. package/dist/chunk-4M5WHOZW.js +1 -0
  25. package/dist/chunk-4RO35FFQ.js +1 -0
  26. package/dist/chunk-4ZS5354G.js +3 -0
  27. package/dist/chunk-55AWBPKU.js +7 -0
  28. package/dist/chunk-5BUYR23E.js +1 -0
  29. package/dist/chunk-5EDA7PVE.js +11 -0
  30. package/dist/{chunk-UKWIWCOH.js → chunk-5P6OELKZ.js} +1 -1
  31. package/dist/chunk-5PVXLQNX.js +1 -0
  32. package/dist/{chunk-J5ERDFIC.js → chunk-5S2P4MHJ.js} +1 -1
  33. package/dist/{chunk-26PWHH3B.js → chunk-5TJJVSCI.js} +1 -1
  34. package/dist/chunk-5TOK5OJS.js +1 -0
  35. package/dist/chunk-5ZG2SWU2.js +1 -0
  36. package/dist/{chunk-SLY27GDC.js → chunk-62F4ZMSC.js} +2 -2
  37. package/dist/chunk-652NT7OW.js +1 -0
  38. package/dist/chunk-6B5KM3A4.js +97 -0
  39. package/dist/chunk-6LCESSY3.js +1 -0
  40. package/dist/chunk-6QHDMCAA.js +1 -0
  41. package/dist/{chunk-D2KIGKBI.js → chunk-7A4ZE5IS.js} +60 -60
  42. package/dist/{chunk-CGVROSPS.js → chunk-7AQZKPJU.js} +1 -1
  43. package/dist/chunk-7FBOMPO5.js +203 -0
  44. package/dist/chunk-7HECBXSP.js +1 -0
  45. package/dist/chunk-7UK565VJ.js +1 -0
  46. package/dist/{chunk-LHXFTFFM.js → chunk-A5BSUUNQ.js} +1 -1
  47. package/dist/chunk-ADGE7MKB.js +1 -0
  48. package/dist/chunk-AEWRZ7AE.js +1 -0
  49. package/dist/chunk-ALDJTWCO.js +1 -0
  50. package/dist/chunk-ARL5WBDK.js +1 -0
  51. package/dist/chunk-AXFEIJC7.js +1 -0
  52. package/dist/{chunk-KZRLZWOU.js → chunk-AYGL6F3P.js} +1 -1
  53. package/dist/{chunk-URXM5A2K.js → chunk-AYTTE7X5.js} +1 -1
  54. package/dist/{chunk-3ODQKAEA.js → chunk-BDIZUTKC.js} +1 -1
  55. package/dist/chunk-BQKF4SRH.js +6 -0
  56. package/dist/chunk-C2AOCLEZ.js +1 -0
  57. package/dist/{chunk-WRZWHT6M.js → chunk-C2SGJ5IG.js} +1 -1
  58. package/dist/chunk-C3S3UMV3.js +1 -0
  59. package/dist/{chunk-WBJ6ZHYH.js → chunk-C5DKLOW4.js} +37 -37
  60. package/dist/chunk-C72QNK6O.js +4 -0
  61. package/dist/{chunk-6ES4KRFW.js → chunk-CA3GVT4D.js} +1 -1
  62. package/dist/chunk-CCLU5ZRK.js +9 -0
  63. package/dist/chunk-CE6XQDAG.js +10 -0
  64. package/dist/chunk-CEJ5WS4I.js +5 -0
  65. package/dist/{chunk-VEUKT5EI.js → chunk-CIBBQO2L.js} +2 -2
  66. package/dist/{chunk-IILLQOUC.js → chunk-CKJXJ6HD.js} +1 -1
  67. package/dist/{chunk-MEYVUHQH.js → chunk-COGKVNQB.js} +1 -1
  68. package/dist/chunk-CQAD5WML.js +1 -0
  69. package/dist/chunk-CQPZOXWO.js +6 -0
  70. package/dist/{chunk-62EOM3Y2.js → chunk-CZYQIWNL.js} +1 -1
  71. package/dist/chunk-DA5RQFXA.js +10 -0
  72. package/dist/{chunk-7GHSE7SG.js → chunk-DDRP6QTC.js} +1 -1
  73. package/dist/{chunk-Q5IC3IYY.js → chunk-DESZFFOK.js} +1 -1
  74. package/dist/{chunk-PLSS456F.js → chunk-DKR7562G.js} +1 -1
  75. package/dist/{chunk-LGXI7EGM.js → chunk-DNNTAMC5.js} +2 -2
  76. package/dist/chunk-DUPQUQ2Z.js +1 -0
  77. package/dist/{chunk-Q4JYAUVL.js → chunk-DUTIWCJ2.js} +1 -1
  78. package/dist/chunk-E6JEBSHZ.js +20 -0
  79. package/dist/chunk-E6KNAPIY.js +4 -0
  80. package/dist/chunk-E7XCCLQH.js +1 -0
  81. package/dist/chunk-EE72PCKT.js +1 -0
  82. package/dist/chunk-EEYXBKR7.js +4 -0
  83. package/dist/{chunk-ZRI3SSLG.js → chunk-EGLA3WLZ.js} +2 -2
  84. package/dist/chunk-EVQPYZ7F.js +5 -0
  85. package/dist/chunk-FDFE3SSG.js +35 -0
  86. package/dist/{chunk-Q7BOSHWX.js → chunk-FDSNRKGQ.js} +1 -1
  87. package/dist/chunk-FI5TQHUA.js +1 -0
  88. package/dist/chunk-FIKZQ4RA.js +1 -0
  89. package/dist/chunk-FJOVMEPN.js +3 -0
  90. package/dist/{chunk-ER6C5WS3.js → chunk-FLARCZ5F.js} +1 -1
  91. package/dist/chunk-FOMMPAWZ.js +1 -0
  92. package/dist/{chunk-6PUU6ZNQ.js → chunk-FRWQJAW2.js} +1 -1
  93. package/dist/{chunk-HXZAY5OA.js → chunk-G3DXNSA2.js} +1 -1
  94. package/dist/{chunk-XWSWXQCC.js → chunk-G7JO3W2R.js} +1 -1
  95. package/dist/{chunk-WESTVWWD.js → chunk-GABIWYY3.js} +1 -1
  96. package/dist/chunk-GFSEU7PF.js +6 -0
  97. package/dist/chunk-GFVUWVEM.js +1 -0
  98. package/dist/{chunk-ISKQQXLZ.js → chunk-GHNSXX7R.js} +1 -1
  99. package/dist/{chunk-2L6AN3QA.js → chunk-GQ3LY7BY.js} +1 -1
  100. package/dist/{chunk-2A2JSAAA.js → chunk-H45S4MGC.js} +1 -1
  101. package/dist/chunk-HEB4YYM6.js +9 -0
  102. package/dist/{chunk-CXI3RHPW.js → chunk-HI5FTI3M.js} +1 -1
  103. package/dist/chunk-HJ24NEP5.js +1 -0
  104. package/dist/chunk-HQFXVVTB.js +1 -0
  105. package/dist/{chunk-TODZ3TJR.js → chunk-HR6R7JXN.js} +1 -1
  106. package/dist/chunk-HRHJA5ZP.js +3 -0
  107. package/dist/{chunk-QEKGGTMN.js → chunk-HT5JQJMB.js} +1 -1
  108. package/dist/chunk-HT7273V7.js +1 -0
  109. package/dist/{chunk-UXVXVI6O.js → chunk-HUB4HDWN.js} +78 -76
  110. package/dist/chunk-IATNIWOC.js +13 -0
  111. package/dist/chunk-IHVWDKDV.js +2 -0
  112. package/dist/{chunk-3KM5ZOW2.js → chunk-IKXUYCK7.js} +1 -1
  113. package/dist/chunk-IVQN2RUP.js +1 -0
  114. package/dist/chunk-IWNFPBH2.js +33 -0
  115. package/dist/{chunk-ESFCYB46.js → chunk-J324ZPO6.js} +1 -1
  116. package/dist/{chunk-KNWT7JLL.js → chunk-JJQ3DJG5.js} +2 -2
  117. package/dist/{chunk-7CCTPBCT.js → chunk-JLAN6JXJ.js} +1 -1
  118. package/dist/chunk-K2GCCCCV.js +1 -0
  119. package/dist/{chunk-NVKJ7ZLP.js → chunk-K4KKSBUW.js} +1 -1
  120. package/dist/{chunk-BAHIL37I.js → chunk-K4QJEQI4.js} +1 -1
  121. package/dist/{chunk-QDCLL5OI.js → chunk-K5UVCBIP.js} +1 -1
  122. package/dist/{chunk-64G5TGFF.js → chunk-KN2JIDNO.js} +1 -1
  123. package/dist/chunk-KORVOCNN.js +1 -0
  124. package/dist/chunk-KRQCQ57O.js +1 -0
  125. package/dist/{chunk-3MYDSQHF.js → chunk-KT2AMFVW.js} +1 -1
  126. package/dist/chunk-L23Q53FM.js +70 -0
  127. package/dist/{chunk-UBP3LQFY.js → chunk-L3DTONOI.js} +2 -2
  128. package/dist/{chunk-BN7ZXAZJ.js → chunk-LG3KEHGD.js} +2 -2
  129. package/dist/chunk-LRETOC6P.js +1 -0
  130. package/dist/chunk-LXFWK3O2.js +1 -0
  131. package/dist/chunk-LZ2TN7EZ.js +1 -0
  132. package/dist/chunk-MBAPM5HA.js +15 -0
  133. package/dist/{chunk-UUAKOX7E.js → chunk-MGZK5EQW.js} +2 -2
  134. package/dist/chunk-MKUXSM33.js +1 -0
  135. package/dist/chunk-MQ55QUOJ.js +276 -0
  136. package/dist/chunk-NAQJMRPT.js +2296 -0
  137. package/dist/{chunk-DZKFP6H2.js → chunk-NMXRDF4T.js} +1 -1
  138. package/dist/chunk-NOWM3CCG.js +1 -0
  139. package/dist/chunk-NVDFXEQ5.js +5 -0
  140. package/dist/{chunk-CX5CC6P5.js → chunk-O472FAYX.js} +1 -1
  141. package/dist/{chunk-B2O3ANRZ.js → chunk-OCILF2DD.js} +1 -1
  142. package/dist/{chunk-67L7FIB6.js → chunk-OGBMFGYC.js} +1 -1
  143. package/dist/chunk-OIQ5NQ5I.js +18 -0
  144. package/dist/chunk-OKRKVVTK.js +103 -0
  145. package/dist/chunk-ONNUEQGR.js +3 -0
  146. package/dist/chunk-OSASE35V.js +6 -0
  147. package/dist/chunk-OTMTS5L4.js +3 -0
  148. package/dist/chunk-OWPAHXDF.js +3 -0
  149. package/dist/chunk-P7HZGJRU.js +6 -0
  150. package/dist/chunk-PIU3GVJ4.js +1 -0
  151. package/dist/{chunk-2WJOTJOD.js → chunk-PSNCWS3Q.js} +2 -2
  152. package/dist/chunk-PSREELSQ.js +22 -0
  153. package/dist/{chunk-AQ6EVL73.js → chunk-Q2CKRCPM.js} +1 -1
  154. package/dist/chunk-QA2D7DT2.js +1 -0
  155. package/dist/chunk-QBRRFFMZ.js +1 -0
  156. package/dist/chunk-QDMTJKQ3.js +1 -0
  157. package/dist/{chunk-3Z3MADXZ.js → chunk-QIJ7D2JS.js} +1 -1
  158. package/dist/chunk-QLN6IOOY.js +1 -0
  159. package/dist/chunk-QU3USVKT.js +1 -0
  160. package/dist/chunk-R2E6TMBE.js +22 -0
  161. package/dist/chunk-R4E2E4NN.js +1 -0
  162. package/dist/chunk-R5COVIJM.js +1 -0
  163. package/dist/chunk-RFJ2LI64.js +81 -0
  164. package/dist/chunk-RNF6T6IO.js +5 -0
  165. package/dist/chunk-RSNFNZ6F.js +2 -0
  166. package/dist/{chunk-I4CEH7AK.js → chunk-RZ3UGOV4.js} +2 -2
  167. package/dist/{chunk-35XFNKNB.js → chunk-S23ZG2RG.js} +1 -1
  168. package/dist/{chunk-PF53E2DC.js → chunk-SAK42CAY.js} +1 -1
  169. package/dist/chunk-SBX7CMHM.js +1 -0
  170. package/dist/{chunk-S5P7KWY4.js → chunk-SGQTRKYZ.js} +1 -1
  171. package/dist/chunk-SNPJVVVE.js +5 -0
  172. package/dist/chunk-SNRGS3YU.js +1 -0
  173. package/dist/chunk-SUTSCIXU.js +7 -0
  174. package/dist/chunk-SWFCT5B7.js +2 -0
  175. package/dist/{chunk-4KECSZTL.js → chunk-SZ64GAVG.js} +2 -2
  176. package/dist/{chunk-WBVS5NBV.js → chunk-TDHIOONG.js} +2 -2
  177. package/dist/{chunk-W37IFK3P.js → chunk-TLN4BKXJ.js} +102 -102
  178. package/dist/{chunk-QW52RPAU.js → chunk-TXMZPF2U.js} +1 -1
  179. package/dist/chunk-TZHVCMZN.js +6 -0
  180. package/dist/{chunk-IHXGZW42.js → chunk-TZOB52QK.js} +1 -1
  181. package/dist/{chunk-N57Y7THE.js → chunk-U5BKU3OL.js} +1 -1
  182. package/dist/{chunk-Y55T4IIQ.js → chunk-UK3BDOHR.js} +1 -1
  183. package/dist/chunk-UORSJB4A.js +857 -0
  184. package/dist/chunk-UU6UQ2QY.js +1 -0
  185. package/dist/{chunk-PWAT52M4.js → chunk-UY44O4IZ.js} +1 -1
  186. package/dist/{chunk-QF5WKTPD.js → chunk-V3H6SYK3.js} +1 -1
  187. package/dist/{chunk-YTUUU33R.js → chunk-VBPMVVLV.js} +1 -1
  188. package/dist/{chunk-SNH4XZ6E.js → chunk-VGBCG3I5.js} +1 -1
  189. package/dist/{chunk-QEVTBD33.js → chunk-VHRUPKWH.js} +1 -1
  190. package/dist/chunk-VVHJ2AUF.js +3 -0
  191. package/dist/chunk-WB5GRBHW.js +1 -0
  192. package/dist/{chunk-YSWVYPWR.js → chunk-WBKQSSWW.js} +1 -1
  193. package/dist/{chunk-SIL6HPMK.js → chunk-WDXDT7XY.js} +2 -2
  194. package/dist/{chunk-SACNUF4I.js → chunk-WHOD5I7N.js} +1 -1
  195. package/dist/{chunk-Z2WAW6MM.js → chunk-WL3M63DG.js} +1 -1
  196. package/dist/{chunk-LEHBZKK3.js → chunk-WLJDMI7E.js} +1 -1
  197. package/dist/{chunk-PTSCGSQV.js → chunk-WZ3QWPK5.js} +2 -2
  198. package/dist/{chunk-H6GNKWYM.js → chunk-X5V7AGVU.js} +1 -1
  199. package/dist/{chunk-RPVZ2JON.js → chunk-X76AYO36.js} +1 -1
  200. package/dist/chunk-XB7H2RYV.js +31 -0
  201. package/dist/chunk-XHHAVKKV.js +1 -0
  202. package/dist/chunk-XKNDU62O.js +1 -0
  203. package/dist/chunk-XVJRGOJA.js +4 -0
  204. package/dist/chunk-Y3ZAQZPH.js +16 -0
  205. package/dist/chunk-YF4AXKM4.js +1 -0
  206. package/dist/chunk-YGN65N6W.js +16 -0
  207. package/dist/{chunk-HF4NDEX3.js → chunk-YR4J46US.js} +1 -1
  208. package/dist/chunk-YTC367JI.js +3 -0
  209. package/dist/{chunk-ZBL7XMJ6.js → chunk-Z2FGYMJ6.js} +2 -2
  210. package/dist/chunk-Z3QZNLT5.js +1 -0
  211. package/dist/chunk-ZC3EDADH.js +26 -0
  212. package/dist/chunk-ZLITAXPT.js +1 -0
  213. package/dist/{chunk-ACA2BGAD.js → chunk-ZNEPRGFY.js} +1 -1
  214. package/dist/chunk-ZNEQZV5K.js +3 -0
  215. package/dist/chunk-ZOU6SOXW.js +20 -0
  216. package/dist/{chunk-YV2TP44L.js → chunk-ZQNGYJKJ.js} +1 -1
  217. package/dist/chunk-ZRM7ESSS.js +4 -0
  218. package/dist/chunk-ZX33FUW3.js +5 -0
  219. package/dist/cli/commands/app/build.js +1 -1
  220. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  221. package/dist/cli/commands/app/bulk/execute.js +1 -1
  222. package/dist/cli/commands/app/bulk/status.js +1 -1
  223. package/dist/cli/commands/app/config/link.js +1 -1
  224. package/dist/cli/commands/app/config/pull.js +1 -1
  225. package/dist/cli/commands/app/config/use.js +1 -1
  226. package/dist/cli/commands/app/config/validate.js +1 -1
  227. package/dist/cli/commands/app/demo/watcher.js +1 -1
  228. package/dist/cli/commands/app/deploy.js +1 -1
  229. package/dist/cli/commands/app/dev/clean.js +1 -1
  230. package/dist/cli/commands/app/dev.js +1 -1
  231. package/dist/cli/commands/app/env/pull.js +1 -1
  232. package/dist/cli/commands/app/env/show.js +1 -1
  233. package/dist/cli/commands/app/execute.js +1 -1
  234. package/dist/cli/commands/app/function/build.js +1 -1
  235. package/dist/cli/commands/app/function/info.js +1 -1
  236. package/dist/cli/commands/app/function/replay.js +1 -1
  237. package/dist/cli/commands/app/function/run.js +1 -1
  238. package/dist/cli/commands/app/function/schema.js +1 -1
  239. package/dist/cli/commands/app/function/typegen.js +1 -1
  240. package/dist/cli/commands/app/generate/extension.js +1 -1
  241. package/dist/cli/commands/app/graphiql.js +1 -1
  242. package/dist/cli/commands/app/import/channel-config.js +1 -1
  243. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  244. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  245. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  246. package/dist/cli/commands/app/import-extensions.js +1 -1
  247. package/dist/cli/commands/app/info.js +1 -1
  248. package/dist/cli/commands/app/init.js +1 -1
  249. package/dist/cli/commands/app/logs.js +1 -1
  250. package/dist/cli/commands/app/release.js +1 -1
  251. package/dist/cli/commands/app/security/check.js +1 -1
  252. package/dist/cli/commands/app/security/clean.js +1 -1
  253. package/dist/cli/commands/app/security/instructions.js +1 -1
  254. package/dist/cli/commands/app/security/record.js +1 -1
  255. package/dist/cli/commands/app/security/review.js +1 -1
  256. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  257. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  258. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  259. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  260. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  261. package/dist/cli/commands/app/versions/list.js +1 -1
  262. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  263. package/dist/cli/commands/auth/login.d.ts +10 -10
  264. package/dist/cli/commands/auth/login.js +1 -1
  265. package/dist/cli/commands/auth/logout.d.ts +7 -7
  266. package/dist/cli/commands/auth/logout.js +1 -1
  267. package/dist/cli/commands/cache/clear.js +1 -1
  268. package/dist/cli/commands/config/autoupgrade/off.d.ts +7 -7
  269. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  270. package/dist/cli/commands/config/autoupgrade/on.d.ts +7 -7
  271. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  272. package/dist/cli/commands/config/autoupgrade/status.d.ts +7 -7
  273. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  274. package/dist/cli/commands/debug/command-flags.js +1 -1
  275. package/dist/cli/commands/doc/fetch.d.ts +21 -21
  276. package/dist/cli/commands/doc/fetch.js +1 -1
  277. package/dist/cli/commands/doc/search.d.ts +23 -23
  278. package/dist/cli/commands/doc/search.js +1 -1
  279. package/dist/cli/commands/docs/generate.js +1 -1
  280. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  281. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  282. package/dist/cli/commands/help.d.ts +90 -90
  283. package/dist/cli/commands/help.js +1 -1
  284. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  285. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  286. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  287. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  288. package/dist/cli/commands/notifications/generate.js +1 -1
  289. package/dist/cli/commands/notifications/list.js +1 -1
  290. package/dist/cli/commands/organization/list.js +1 -1
  291. package/dist/cli/commands/search.d.ts +7 -7
  292. package/dist/cli/commands/search.js +1 -1
  293. package/dist/cli/commands/send-analytics.js +1 -1
  294. package/dist/cli/commands/theme/check.js +1 -1
  295. package/dist/cli/commands/theme/console.js +1 -1
  296. package/dist/cli/commands/theme/delete.js +1 -1
  297. package/dist/cli/commands/theme/dev.js +1 -1
  298. package/dist/cli/commands/theme/duplicate.js +1 -1
  299. package/dist/cli/commands/theme/info.js +1 -1
  300. package/dist/cli/commands/theme/init.js +1 -1
  301. package/dist/cli/commands/theme/language-server.js +1 -1
  302. package/dist/cli/commands/theme/list.js +1 -1
  303. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  304. package/dist/cli/commands/theme/open.js +1 -1
  305. package/dist/cli/commands/theme/package.js +1 -1
  306. package/dist/cli/commands/theme/preview.js +1 -1
  307. package/dist/cli/commands/theme/profile.js +1 -1
  308. package/dist/cli/commands/theme/publish.js +1 -1
  309. package/dist/cli/commands/theme/pull.js +1 -1
  310. package/dist/cli/commands/theme/push.js +1 -1
  311. package/dist/cli/commands/theme/rename.js +1 -1
  312. package/dist/cli/commands/theme/share.js +1 -1
  313. package/dist/cli/commands/upgrade.d.ts +24 -24
  314. package/dist/cli/commands/upgrade.js +1 -1
  315. package/dist/cli/commands/version.d.ts +7 -7
  316. package/dist/cli/commands/version.js +1 -1
  317. package/dist/cli/help.js +1 -1
  318. package/dist/cli-version-check-BW2CUMX4.js +1 -0
  319. package/dist/{command-event-context-LFUZ7UCA.js → command-event-context-ILIANB5Q.js} +1 -1
  320. package/dist/command-json-schema-LGR44Q2G.js +1 -0
  321. package/dist/command-registry.js +1 -1
  322. package/dist/conf-store-TODPQ2LC.js +1 -0
  323. package/dist/configs/all.yml +9 -0
  324. package/dist/configs/recommended.yml +9 -0
  325. package/dist/custom-oclif-loader-BPE2TH4B.js +1 -0
  326. package/dist/data/filters.json +41 -2
  327. package/dist/data/local_block_entry.json +1 -1
  328. package/dist/data/manifest_theme.json +1 -0
  329. package/dist/data/objects.json +279 -44
  330. package/dist/data/section.json +15 -1
  331. package/dist/data/setting.json +9 -5
  332. package/dist/data/shopify_system_translations.json +312 -32
  333. package/dist/data/strict_settings.json +24 -0
  334. package/dist/data/tags.json +57 -24
  335. package/dist/data/theme_block.json +1 -1
  336. package/dist/deprecations-5CSI24TV.js +1 -0
  337. package/dist/dist-LPKYTX3M.js +1 -0
  338. package/dist/dist-WT6MPTKJ.js +1 -0
  339. package/dist/environment-5P7JJ3GI.js +1 -0
  340. package/dist/environments-3HTT5CVC.js +1 -0
  341. package/dist/error-PFOKPWFX.js +1 -0
  342. package/dist/error-handler-23FASAEU.js +1 -0
  343. package/dist/fs-RA25PWSJ.js +1 -0
  344. package/dist/hooks/did-you-mean.js +1 -1
  345. package/dist/hooks/hydrogen-init.js +1 -1
  346. package/dist/hooks/plugin-plugins.js +1 -1
  347. package/dist/hooks/postrun.js +1 -1
  348. package/dist/hooks/prerun.js +2 -2
  349. package/dist/hooks/public-metadata.js +1 -1
  350. package/dist/hooks/sensitive-metadata.js +1 -1
  351. package/dist/hooks/tunnel-provider.js +1 -1
  352. package/dist/hooks/tunnel-start.js +1 -1
  353. package/dist/http-EVDTYINS.js +1 -0
  354. package/dist/http-proxy-node16-NZZ674YW.js +38 -0
  355. package/dist/index.js +12 -12
  356. package/dist/is-global-3DNAMKUU.js +1 -0
  357. package/dist/json-error-HGCRNJRF.js +1 -0
  358. package/dist/latest-version-75YEFEMK.js +9 -0
  359. package/dist/lib-4ZA53LTZ.js +1 -0
  360. package/dist/lib-F3MES3XF.js +1 -0
  361. package/dist/lib-XPJABU24.js +1 -0
  362. package/dist/{local-OKPVB4NH.js → local-LNGPIGLG.js} +1 -1
  363. package/dist/metadata-VHLSUKCW.js +1 -0
  364. package/dist/{morph-CRY35DIK.js → morph-H7XQP55V.js} +3 -3
  365. package/dist/node-package-manager-SSFNUVWB.js +1 -0
  366. package/dist/notifications-system-3NQRYYKW.js +1 -0
  367. package/dist/{npa-A4YSCQ5Q.js → npa-LVYMN7GE.js} +1 -1
  368. package/dist/os-KIKVJONE.js +1 -0
  369. package/dist/output-DUJTSURG.js +1 -0
  370. package/dist/{prettier-EGVCP5CY.js → prettier-NOE3TJJ5.js} +1 -1
  371. package/dist/registry-auth-token-EDH77OOW.js +1 -0
  372. package/dist/registry-url-JMNV3LLX.js +1 -0
  373. package/dist/semver-HHZRKD6Y.js +1 -0
  374. package/dist/system-CGOZSROX.js +1 -0
  375. package/dist/tsconfig.tsbuildinfo +1 -1
  376. package/dist/ui-YMBFS3NG.js +1 -0
  377. package/dist/upgrade-73RRPDSC.js +1 -0
  378. package/dist/version-AMUEEBIG.js +1 -0
  379. package/dist/version-S4MGCKDO.js +1 -0
  380. package/dist/workerd-DRWNY3S4.js +18 -0
  381. package/oclif.manifest.json +25618 -1167
  382. package/package.json +7 -7
  383. package/dist/analytics-NMMVOF4B.js +0 -1
  384. package/dist/analytics-UK77WNLG.js +0 -1
  385. package/dist/chunk-224UPIYS.js +0 -4
  386. package/dist/chunk-27NXPOAS.js +0 -1
  387. package/dist/chunk-2MT3LSMZ.js +0 -1
  388. package/dist/chunk-2T4HDR6R.js +0 -70
  389. package/dist/chunk-2ZBXHCQZ.js +0 -1
  390. package/dist/chunk-335BUVBP.js +0 -1
  391. package/dist/chunk-33ZE3DRQ.js +0 -16
  392. package/dist/chunk-34MOWGRL.js +0 -1
  393. package/dist/chunk-3JSKNXL7.js +0 -1
  394. package/dist/chunk-3MG4MTWQ.js +0 -1
  395. package/dist/chunk-3XRI3D44.js +0 -1
  396. package/dist/chunk-43R5VGKT.js +0 -1
  397. package/dist/chunk-4WYKPIN3.js +0 -1
  398. package/dist/chunk-5AEZJZNQ.js +0 -1
  399. package/dist/chunk-5ED7SOQZ.js +0 -20
  400. package/dist/chunk-5IDJALJH.js +0 -1
  401. package/dist/chunk-66TMIQMB.js +0 -1
  402. package/dist/chunk-74NRFUGQ.js +0 -1
  403. package/dist/chunk-7GUMJ5E4.js +0 -1
  404. package/dist/chunk-7NFTSBHQ.js +0 -10
  405. package/dist/chunk-ACZNWIRY.js +0 -1
  406. package/dist/chunk-AUE7LM32.js +0 -1
  407. package/dist/chunk-AXL2VIWA.js +0 -16
  408. package/dist/chunk-B3ZJGYZY.js +0 -3
  409. package/dist/chunk-BOAGJ6P5.js +0 -1
  410. package/dist/chunk-BWN2QG6D.js +0 -5
  411. package/dist/chunk-CCUQM4FX.js +0 -6
  412. package/dist/chunk-CLUUA3HX.js +0 -3
  413. package/dist/chunk-CYEEGTVZ.js +0 -11
  414. package/dist/chunk-DBDTE3EE.js +0 -5
  415. package/dist/chunk-DLVB3237.js +0 -31
  416. package/dist/chunk-DN6X7SHW.js +0 -2
  417. package/dist/chunk-E5COIKGY.js +0 -5
  418. package/dist/chunk-E6RONHMT.js +0 -1
  419. package/dist/chunk-EAZIQI2D.js +0 -1
  420. package/dist/chunk-EEY4FKAW.js +0 -1
  421. package/dist/chunk-EKFPTBXC.js +0 -1
  422. package/dist/chunk-F3CK3EJJ.js +0 -1
  423. package/dist/chunk-FEBOZ2XX.js +0 -31
  424. package/dist/chunk-FFSDGRAN.js +0 -1
  425. package/dist/chunk-FZCGRIOM.js +0 -1
  426. package/dist/chunk-GNCVDN7U.js +0 -1
  427. package/dist/chunk-GQLNG537.js +0 -836
  428. package/dist/chunk-GVI3DWSB.js +0 -4
  429. package/dist/chunk-GW7YIJPJ.js +0 -5
  430. package/dist/chunk-H6GYBLVQ.js +0 -2
  431. package/dist/chunk-HB3MJYBK.js +0 -1
  432. package/dist/chunk-HSKDFEXW.js +0 -1
  433. package/dist/chunk-HTRJU4R4.js +0 -1
  434. package/dist/chunk-I7PEEJVH.js +0 -1
  435. package/dist/chunk-IHMATNOR.js +0 -1
  436. package/dist/chunk-IJY3RJPJ.js +0 -47
  437. package/dist/chunk-J3JPJCWP.js +0 -1
  438. package/dist/chunk-J55GQLP4.js +0 -1
  439. package/dist/chunk-JLQRDFR5.js +0 -18
  440. package/dist/chunk-JPWRZ5SL.js +0 -16
  441. package/dist/chunk-K7ZSPQKL.js +0 -4
  442. package/dist/chunk-L5TSPCSY.js +0 -26
  443. package/dist/chunk-LUGMXSRI.js +0 -9
  444. package/dist/chunk-M2CWCOFU.js +0 -11
  445. package/dist/chunk-M5VIFG2V.js +0 -1
  446. package/dist/chunk-MADINS4Z.js +0 -1
  447. package/dist/chunk-MGHPF7HU.js +0 -6
  448. package/dist/chunk-MHR5OHT5.js +0 -10
  449. package/dist/chunk-MXEXP3HT.js +0 -15
  450. package/dist/chunk-OJULL7HT.js +0 -1
  451. package/dist/chunk-OMPQ7REW.js +0 -3
  452. package/dist/chunk-OR4IJ4BQ.js +0 -1
  453. package/dist/chunk-P2RMFHQP.js +0 -1
  454. package/dist/chunk-P4VZYOKO.js +0 -15
  455. package/dist/chunk-PDZBKVWL.js +0 -97
  456. package/dist/chunk-Q2KWXZQB.js +0 -12
  457. package/dist/chunk-QFSENE5T.js +0 -3
  458. package/dist/chunk-QFWWCZOI.js +0 -1
  459. package/dist/chunk-QFYLJVJW.js +0 -77
  460. package/dist/chunk-QQJNQNKP.js +0 -6
  461. package/dist/chunk-R4UVIYZP.js +0 -4
  462. package/dist/chunk-RLNIOJH3.js +0 -272
  463. package/dist/chunk-RW6G4ZPU.js +0 -1
  464. package/dist/chunk-S4LOWCGS.js +0 -1
  465. package/dist/chunk-SB27UOXX.js +0 -1
  466. package/dist/chunk-SHD4VV5V.js +0 -3
  467. package/dist/chunk-SK7EPN6C.js +0 -1
  468. package/dist/chunk-TAWCKJKP.js +0 -1
  469. package/dist/chunk-U2T5HPRD.js +0 -319
  470. package/dist/chunk-U6YOP562.js +0 -1
  471. package/dist/chunk-UPPO3BMT.js +0 -7
  472. package/dist/chunk-USXIXANP.js +0 -103
  473. package/dist/chunk-UV5GAGAD.js +0 -1
  474. package/dist/chunk-UY6W2EVZ.js +0 -1
  475. package/dist/chunk-UYELAINQ.js +0 -16
  476. package/dist/chunk-V75WUEFU.js +0 -1
  477. package/dist/chunk-VAVXDIUX.js +0 -6
  478. package/dist/chunk-VGSH52JM.js +0 -1
  479. package/dist/chunk-VHZ6RL67.js +0 -1
  480. package/dist/chunk-VQA3X7O3.js +0 -1
  481. package/dist/chunk-VZCMJRYV.js +0 -1
  482. package/dist/chunk-W56ZGEQQ.js +0 -2265
  483. package/dist/chunk-WCC52MR2.js +0 -1
  484. package/dist/chunk-WSDKCQH6.js +0 -6
  485. package/dist/chunk-X2PFXSU4.js +0 -1
  486. package/dist/chunk-X5NIAZA4.js +0 -1
  487. package/dist/chunk-XBMD3FEZ.js +0 -3
  488. package/dist/chunk-XDVPIGXE.js +0 -2
  489. package/dist/chunk-XLIJYJ6Q.js +0 -1
  490. package/dist/chunk-XUHGWIWW.js +0 -4
  491. package/dist/chunk-Y5CVX5LJ.js +0 -1
  492. package/dist/chunk-Y6J46XYF.js +0 -3
  493. package/dist/chunk-YKMINHYY.js +0 -3
  494. package/dist/chunk-ZDQO6CNY.js +0 -1
  495. package/dist/chunk-ZGASBRSQ.js +0 -5
  496. package/dist/chunk-ZGBTO46A.js +0 -1
  497. package/dist/chunk-ZJOX5HW4.js +0 -22
  498. package/dist/chunk-ZOOT3GBY.js +0 -5
  499. package/dist/command-json-schema-F5XF7XHL.js +0 -1
  500. package/dist/conf-store-5CBLWTOC.js +0 -1
  501. package/dist/custom-oclif-loader-UDVUFKMD.js +0 -1
  502. package/dist/deprecations-EOHPSTCS.js +0 -1
  503. package/dist/dist-RNV3GFZ7.js +0 -1
  504. package/dist/dist-ZFKWJVNB.js +0 -1
  505. package/dist/environment-O7ECODHU.js +0 -1
  506. package/dist/environments-4FLRZW4P.js +0 -1
  507. package/dist/error-JY2ADS6S.js +0 -1
  508. package/dist/error-handler-4GCXKC6I.js +0 -1
  509. package/dist/fs-XS5YF34R.js +0 -1
  510. package/dist/http-proxy-node16-D3JUYA5D.js +0 -38
  511. package/dist/is-global-27MUENOK.js +0 -1
  512. package/dist/json-error-S5XFS3UX.js +0 -1
  513. package/dist/latest-version-LDWU5F7A.js +0 -49
  514. package/dist/lib-PJHT4MKY.js +0 -1
  515. package/dist/lib-VKSQ65BQ.js +0 -1
  516. package/dist/lib-YEZOHXF3.js +0 -1
  517. package/dist/metadata-2YJBAKR7.js +0 -1
  518. package/dist/node-package-manager-B3OW3PFQ.js +0 -1
  519. package/dist/notifications-system-BWTDYBG2.js +0 -1
  520. package/dist/os-F6QKJCFW.js +0 -1
  521. package/dist/output-BRIPK7UC.js +0 -1
  522. package/dist/system-466QKFDI.js +0 -1
  523. package/dist/ui-VJTNGCS6.js +0 -1
  524. package/dist/upgrade-VHVJLXKX.js +0 -1
  525. package/dist/version-FETZRLZO.js +0 -1
  526. package/dist/version-T4XXTJMB.js +0 -1
  527. package/dist/workerd-32DMKLMN.js +0 -18
  528. /package/dist/{chunk-YLQ3LNNY.js → chunk-HVECVOIO.js} +0 -0
  529. /package/dist/{chunk-YRHFPXC3.js → chunk-Z2AV4BWZ.js} +0 -0
@@ -1,26 +0,0 @@
1
- import{a as Xt}from"./chunk-UOHNRH6E.js";import{b as Qr}from"./chunk-PF53E2DC.js";import{a as Xr}from"./chunk-DLVB3237.js";import{a as Zr}from"./chunk-AQKWPRZE.js";import{a as eo}from"./chunk-UBP3LQFY.js";import{a as Wr}from"./chunk-UXVXVI6O.js";import{a as qr,b as Hr,c as jr,d as Gr}from"./chunk-OJULL7HT.js";import{a as Yr}from"./chunk-OMPQ7REW.js";import{a as Br}from"./chunk-KNWT7JLL.js";import{a as Kr}from"./chunk-QDCLL5OI.js";import{a as Jr}from"./chunk-2ZBXHCQZ.js";import{a as Vr}from"./chunk-RPCIFYCY.js";import{a as zr}from"./chunk-AQ6EVL73.js";import{a as Ar}from"./chunk-5ED7SOQZ.js";import{a as Cr}from"./chunk-MXEXP3HT.js";import{a as Lr}from"./chunk-2WJOTJOD.js";import{a as Fr}from"./chunk-FEBOZ2XX.js";import{g as kr}from"./chunk-USXIXANP.js";import{a as dt}from"./chunk-TFPW2VGN.js";import{c as ut,o as ft}from"./chunk-IJY3RJPJ.js";import{a as Dr}from"./chunk-XBMD3FEZ.js";import{a as Mr}from"./chunk-2A2JSAAA.js";import{a as _r}from"./chunk-IHXGZW42.js";import{b as Tr,g as Oe,j as pt,u as Ir}from"./chunk-H6GYBLVQ.js";import{a as Nr}from"./chunk-WBVS5NBV.js";import{a as Fo,b as Do,c as Mo,d as Oo}from"./chunk-KZRLZWOU.js";import{d as Or}from"./chunk-SACNUF4I.js";import{a as Ur,b as Rr,c as Lo,d as ko,e as gt,f as $o,g as No}from"./chunk-W37IFK3P.js";import{a as M,b as lt}from"./chunk-H6GNKWYM.js";import{a as vr,b as Pr,d as De,f as Er,m as Me,n as K,s as G,u as xr,v as Sr,w as br}from"./chunk-Q7BOSHWX.js";import{a as yr}from"./chunk-P4VZYOKO.js";import{a as Wo,b as qo,c as Ho,d as wt,e as jo,f as Go,g as Bo,h as Ko,i as Vo,j as zo,k as Yo,l as Jo,m as Qo,n as Xo,o as Zo,p as yt}from"./chunk-ZOOT3GBY.js";import{a as Uo,b as ht,c as ne,d as Ro}from"./chunk-MGHPF7HU.js";import{a as Ao,b as To,c as Io,d as _o,e as Co}from"./chunk-HXZAY5OA.js";import{a as ro}from"./chunk-7CCTPBCT.js";import{a as bo}from"./chunk-J55GQLP4.js";import{a as So}from"./chunk-VHZ6RL67.js";import{a as to}from"./chunk-NVKJ7ZLP.js";import{Aa as qe,L as mo,Ma as xo,N as ho,P as oe,Z as go,_ as Po,i as oo,ia as Eo,j as B,k as no,n as ao,p as fs,t as mt,u as io,v as co,w as lo,x as po,y as uo,z as fo,za as We}from"./chunk-U2T5HPRD.js";import{E as so,ea as wo,fa as Ne,ga as yo,s as re,ta as vo,x as fe}from"./chunk-33ZE3DRQ.js";import{a as $r}from"./chunk-YV2TP44L.js";import{d as hr}from"./chunk-TODZ3TJR.js";import{a as z}from"./chunk-N57Y7THE.js";import{M as zt,_ as ee,aa as Yt,c as jt,h as Gt,j as Bt,m as Kt,o as Vt,p as Re,ta as Jt,u as Ae}from"./chunk-GQLNG537.js";import{b as gr,c as wr,e as Fe}from"./chunk-3KM5ZOW2.js";import{B as ue,I as Le,M as cr,O as ke,T as $e,U as de,V as ct,W as pr,Y as ur,a as Ht,d as D,e as Te,f as st,g as F,h as W,j as Ie,k as _e,l as Zt,m as er,n as tr,o as rr,p as or,q as nr,r as at,s as it,t as sr,u as ar,w as ir,z as Ce}from"./chunk-D2KIGKBI.js";import{b as pe,d as be,j as Ue,m as qt}from"./chunk-335BUVBP.js";import{a as we}from"./chunk-BN7ZXAZJ.js";import{a as ds}from"./chunk-7UNQOKZW.js";import{d as Qt}from"./chunk-CXI3RHPW.js";import{h as I,j as lr,k as te}from"./chunk-M5VIFG2V.js";import{a as He}from"./chunk-5IDJALJH.js";import{Aa as Dt,Ba as Mt,Bb as y,Cb as L,Da as Ot,Hb as mr,Ma as Se,P as rt,Sa as N,Va as le,_a as Nt,bb as Wt,la as k,qb as R,sb as T,ta as xe,va as Z,xa as ot,ya as Ft,yb as V}from"./chunk-JLQRDFR5.js";import{b as A,c as ie,d as ce,j as nt}from"./chunk-FZCGRIOM.js";import{e as dr,g as fr}from"./chunk-LHXFTFFM.js";import{b as us}from"./chunk-YTUUU33R.js";import{a as ye}from"./chunk-JD5P5RAJ.js";import{c as U,e as tt,f as Lt,h as ve,i as Pe,j as Ee,n as kt,o as $t}from"./chunk-IWTNUJGY.js";import{e as X,g as u}from"./chunk-VKWPEFWQ.js";u();u();u();u();u();u();var ms=300*1e3,hs='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 en(t,e,r=Date.now()){for(;await gs(t,e,r););}async function gs(t,e,r){let o=await Oe(t,e);if(!o||ws(o,r))throw new I(hs);return await de(3),o.processing}function ws(t,e){return t.processing&&Date.now()-e>=ms}var ys="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",vs="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",vt=3,je=class extends _r{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=qr(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??=this.devPreview?await this.createHostTheme():await this.create(),e}setTheme(e){Hr(this.adminSession.storeFqdn,e)}removeTheme(){jr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:Tr,name:this.generateThemeName(this.context),src:ys};for(let o=0;o<vt;o++){y(`Attempt ${o}/${vt}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await pt(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),y(`Waiting for theme with id "${n.id}" to be processed`),await en(n.id,this.adminSession),n;throw new Error}catch(n){if(n instanceof lr||Ir(n))throw n;y(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}y(`Theme creation failed after ${vt} retries. Creating theme using fallback theme zip`);let r=await pt({...e,src:vs},this.adminSession);if(!r)throw y("Theme creation failed. Exiting process."),new te(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};u();var Ps={"theme:init":Nr,"theme:check":Ar,"theme:console":Cr,"theme:delete":Lr,"theme:dev":Fr,"theme:duplicate":Dr,"theme:info":Mr,"theme:language-server":Wr,"theme:list":Gr,"theme:metafields:pull":Yr,"theme:open":Br,"theme:package":Kr,"theme:profile":Vr,"theme:publish":zr,"theme:preview":Jr,"theme:pull":Qr,"theme:push":Xr,"theme:rename":Zr,"theme:share":eo},Li=Ps;async function tn(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(E=>E.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[c,f]=await Promise.all([zt(t.storeFqdn),Ss(e)]),l=c.storeFqdn,[p,h]=await Promise.all([ft(c),ut(c)]),g=h?await dt(t.storePassword,l,p):void 0,d=await xs(c,t.theme),m=d.id.toString();return Ce({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:f}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${l}/admin/themes/${m}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:Es,options:{theme:d,adminSession:c,storefrontPassword:g,crawlerSignatureHeaders:p,themeExtensionDirectory:a,themeExtensionPort:i}}}var Es=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await kr(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function xs(t,e){let r;if(e)y(`Fetching theme with provided id ${e}`),r=await Oe(parseInt(e,10),t);else{let o=new je(t,{devPreview:!0});await Le([{title:"Configuring host theme for theme app extension",task:async()=>{y("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new I("Could not find or create a host theme for theme app extensions");return r}async function Ss(t){return t.developerPlatformClient?.clientName===vo.AppManagement?`https://${await Re()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Vt()}/${t.organizationId}/apps/${t.id}/test`}u();u();u();u();u();u();async function bs(t){let e=U(t.directory,"locales");return le([U(e,"*.json")])}async function rn(t,e){let r=await bs(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),Us(a,s,o,t,e)})),o.lastUpdated=Date.now(),y(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function Us(t,e,r,o,n){let s;try{s=await k(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw L(i,n.stderr),new Error(i)}}u();function Ge(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}var Pt=".js.map";async function se(t,e,r,o){return D({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await rn(t,r),c=await no(t),f=t.outputRelativePath?ve(n):n,l=await Rs(t,s,f,o),p=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(p=on(t.configuration.metafields)),{assets:{main:me(l)&&l[0]?.assets?.main?l[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await Se(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:Ge(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:p,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 Rs(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"}]),me(s)){let a=await As(r);return Promise.all(s.map(async i=>{let{target:c,resource:f}=i,l="metafields"in i?on(i.metafields??[]):void 0,p={...i,...l?{metafields:l}:{},surface:qe(c),root:{url:`${e}/${c}`},resource:f||{url:""}},h=a?.[c];if(!h)return p;let d=await ks(h,{target:c,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...p,...d}}))}return s}async function As(t){try{let e=U(t,"manifest.json"),r=await k(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 Ts({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,c=e[s];if(typeof c=="string"){let g=await Be(s,i,typeof a=="string"?a:c,r,o,n,typeof a=="string"?c:void 0);return{assets:{[g.name]:g}}}let l=e.build_manifest?.assets?.[s];if(l?.filepath){let p=await Be(s,i,l.filepath,r,o,n,l.module);return{assets:{[p.name]:p}}}return{}}async function Is({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 Se(U(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function _s({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 f=i.schema,l=s[c]?.schema,p=typeof l=="string"?l:f,h=typeof l=="string"?f:void 0;return{...i,schema:await Be("schema",`${t}/intents/${c}/schema`,p,r,o,n,h)}}))}:{}}async function Cs({target:t,url:e,extension:r,resolver:o},n,s){let a=await Be(n,`${t}/${n}`,s,e,r,o);return await Ls(t,s,r,o),{assets:{[a.name]:a}}}async function Ls(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(Pt)&&await N(U(r.directory,n))&&o.set(`${t}/${Pe(n)}`,n)}async function ks(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return $s(o,n)?_s(e,n):Fs(o,n)?Cs(e,o,n):Ds(o,n)?Is(e,o,n):Ts(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function on(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function me(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Be(t,e,r,o,n,s,a){let i=`${e}${Ee(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await Se(U(n.directory,a??r))??0}}function $s(t,e){return t==="intents"&&Array.isArray(e)}function Fs(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function Ds(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as Ms}from"events";var he;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(he||(he={}));async function nn(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:Lo(t.storeFqdn,t.apiKey),mobileUrl:$o(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>se(n,e,t,r&&Et(r,n.devUUID))))}}function Et(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var Ke=class extends Ms{options;rawPayload;assetResolvers;constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=ee(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(me(n.extensionPoints)&&me(o.extensionPoints)){let s=n.extensionPoints.reduce((c,f)=>({...c,[f.target]:f}),{});o.extensionPoints=ee(o.extensionPoints,n.extensionPoints,c=>c.map(f=>{let l=s[f.target];return l?ee(f,l,(p,h)=>h):f}));let{extensionPoints:a,...i}=n;return ee(o,i)}return ee(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){y(T`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await se(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},Et(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await se(e,r,this.options,Et(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(he.Update,e)}};u();u();var Y;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(Y||(Y={}));function sn(t,e){return(r,o,n)=>{r.url==="/extensions"&&(y("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,Os(t,e)))}}function Os(t,e){return r=>{y("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};y(T`Sending connected payload: ${R.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",js(t,e))}}function Ns(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?R.json(o).output():String(o)).join(" ");return T`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var Ws={debug:t=>R.gray(t),warn:t=>R.yellow(t),error:t=>R.errorText(t)};function qs({type:t,message:e}){let r=Ns(e);switch(t){case"debug":case"warn":case"error":return T`${Ws[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function Hs(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(qs(t))})}function js(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(y(T`Received websocket message with event type ${n} and data:
2
- ${R.json(s)}
3
- `,e.stdout),n===Y.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===Y.Dispatch){let a=Gs(o,e);cn(t,a,e)}else n===Y.Log&&Hs(s,e)}}function an(t,e){return r=>{let o={event:Y.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};y(T`Sending websocket update event to the websocket clients:
4
- ${R.json(o)}
5
- `,e.stdout),cn(t,o,e)}}function cn(t,e,r){y(T`Sending websocket with event type ${e.event} and data:
6
- ${R.json(e.data)}
7
- `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function Gs(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var Bs=10;function ln(t){let e=new Xt.default({noServer:!0,clientTracking:!0}),r=Ks(e);return t.httpServer.on("upgrade",sn(e,t)),t.payloadStore.on(he.Update,an(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function Ks(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},Bs*1e3)}u();u();u();function pn(t,e){let{url:r}=Ge(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",Ve(t,e)),o.toString()}}function un(t,e,r){let o=qe(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",Ve(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=Vs(e,r,t);break;default:return}return n.toString()}function Vs(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 Ve(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function q(t,e){Pr(t,vr(e))}u();var xt=class extends te{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function dn(t){let e=await zs(t),r=await k(e);return yr(r,t.data)}async function zs(t){let e=await Ys(),r=[];t.extensionSurface&&r.push(U(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(U(e,`${t.template}.html.liquid`));let o=await le(r);if(o.length===0)throw new xt(t);return o[0]}async function Ys(){return await Nt("templates/ui-extensions/html",{type:"directory",cwd:$t(import.meta.url)})}var fn=G(t=>{K(t,"Access-Control-Allow-Origin","*"),K(t,"Access-Control-Allow-Methods","GET, OPTIONS"),K(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),mn=G(t=>{K(t,"Cache-Control","no-cache")}),St=G(async t=>Me(t,"/extensions",307));async function Js(t,e){let{filePath:r}=e;if(!await N(r))return q(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Ot(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await N(r)))return q(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await k(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".map":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},s=Ee(r),a=n[s]||"text/plain";return K(t,"Content-Type",a),o}function hn({getExtensions:t,payloadStore:e}){return G(async r=>{let{extensionId:o,assetPath:n=""}=De(r),s=t().find(h=>h.devUUID===o);if(!s)return q(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n),c=i??n,f=c.endsWith(Pt);if(f&&i===void 0)return q(r,{statusCode:404,statusMessage:"Not Found"});let l=tt(f?s.directory:ao(s.outputPath)),p=tt(U(l,c));return kt(l,p)?Js(r,{filePath:p}):q(r,{statusCode:404,statusMessage:"Not Found"})})}function bt({payloadStore:t}){return G(e=>(K(e,"content-type","application/json"),t.getRawPayload()))}function gn({devOptions:t}){return G(e=>{y(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function Ut({devOptions:t,getExtensions:e}){return G(async r=>{let{extensionId:o}=De(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 dn({data:{url:Ve(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=pn(n,t);return Me(r,i,307)}}let a=t.appWatcher.buildOutputPath;return K(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:ae(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await se(n,a,t)}})}function wn({devOptions:t,getExtensions:e}){return G(async r=>{let{extensionId:o,extensionPointTarget:n=""}=De(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=un(n,s,t);return a?Me(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 Qs}from"http";function yn(t){let e=xr(),r=Sr();e.use(gn(t)),e.use(fn),e.use(mn),r.use("/extensions/dev-console",St),r.use("/extensions/:extensionId",Ut(t)),r.use("/extensions/:extensionId/",Ut(t)),r.use("/extensions/:extensionId/:extensionPointTarget",wn(t)),r.use("/extensions/:extensionId/assets/**:assetPath",hn(t)),r.use("/extensions",bt(t)),r.use("/extensions/",bt(t)),r.use("/",St),e.use(r);let o=Qs(br(e));return o.listen(t.devOptions.port,"localhost"),o}async function vn(t){let e={...t,websocketURL:ae(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await nn(e,r,o),s=new Ke(n,e,o),a=e.extensions.filter(p=>p.isPreviewable),i=()=>a;y("Setting up the UI extensions HTTP server...",e.stdout);let c=yn({devOptions:e,payloadStore:s,getExtensions:i});y("Setting up the UI extensions Websocket server...",e.stdout);let f=ln({...e,httpServer:c,payloadStore:s});y("Setting up the UI extensions bundler and file watching...",e.stdout);let l=async({appWasReloaded:p,app:h,extensionEvents:g})=>{p&&(a=h.allExtensions.filter(d=>d.isPreviewable));for(let d of g){if(!d.extension.isPreviewable)continue;let m=d.buildResult?.status==="ok"?"success":"error",E=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case ne.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl){let S=await We(e.extensions,e.storeFqdn);e.checkoutCartUrl=S}await s.addExtension(d.extension,r);break;case ne.Updated:await s.updateExtension(d.extension,e,r,{status:m,error:E});break;case ne.Deleted:e.extensions=e.extensions.filter(S=>S.devUUID!==d.extension.devUUID),await s.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(l).onStart(l),e.signal.addEventListener("abort",()=>{y("Closing the UI extensions dev server..."),f.close(),c.close()})}function ae(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var Xs="3",Zs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:c,proxyUrl:f,appName:l,appDotEnvFile:p,appId:h,grantedScopes:g,allExtensions:d,appDirectory:m,appWatcher:E})=>{await vn({appName:l,appDotEnvFile:p,appDirectory:m,id:h,extensions:d,stdout:e,stderr:t,signal:r,url:f,port:i,storeFqdn:Ae(n),storeId:s,apiKey:o,grantedScopes:g,checkoutCartUrl:c,subscriptionProductUrl:a,manifestVersion:Xs,appWatcher:E})};async function Pn({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await We(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:Zs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}u();u();function J(t){let e=t.find(o=>oe(o,B.Frontend)),r=t.find(o=>oe(o,B.Backend));return{frontendConfig:e,backendConfig:r}}u();async function En(t){let r={topic:"app/uninstalled",api_version:(await Fo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:Oo.LOCALHOST,shared_secret:t.sharedSecret},o=await Do(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await de(3);let n=await ea(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function ea(t,e){let r=0;for(;r<3;){try{return await Mo(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof Gt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await de(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var ta=async({stdout:t},e)=>{await En({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function xn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=J(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:ta,options:{deliveryPort:a?r:o,webhooksPath:c,organizationId:n,...s}}}u();async function Sn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:ra}}var ra=async({stdout:t,abortSignal:e},r)=>{let o=No({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=Rr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",()=>{n.close()})};u();async function Un({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=J(t),c=i?.configuration.hmr_server?await M():void 0,f=void 0,l=t.map(async p=>{let h=await oa({web:p,frontendPort:r,backendPort:o}),g=c&&p.configuration.roles.includes(B.Frontend)?{port:c,httpPaths:p.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:p.configuration.name??["web",...p.configuration.roles].join("-"),function:na,options:{port:h,portFromConfig:p.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:p.directory,devCommand:p.configuration.commands.dev,preDevCommand:p.configuration.commands.predev,scopes:a,shopCustomDomain:f,hmrServerOptions:g,roles:p.configuration.roles}}});return Promise.all(l)}async function oa({web:t,frontendPort:e,backendPort:r}){return oe(t,B.Frontend)?e:oe(t,B.Backend)?r:M()}async function na({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:c,directory:f,devCommand:l,preDevCommand:p,scopes:h,shopCustomDomain:g,hmrServerOptions:d}){let m=d?.port,E={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:h,NODE_ENV:"development",...g&&{SHOP_CUSTOM_DOMAIN:g},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${c}`,...m&&{HMR_SERVER_PORT:`${m}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},S={signal:r,directory:f,port:o,env:E,stdout:t,stderr:e};p&&(t.write(`Running pre-dev command: "${p}"`),await bn({...S,command:p,showOutput:dr()})),await bn({...S,command:l,showOutput:!0})}async function bn({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let c=t.split("&&").map(f=>f.trim())??[];for(let f of c){let[l,...p]=f.split(" ");l?.length!==0&&await $e(l,p,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}u();u();u();var ze=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(T`${R.yellow(e)}`.value)}async success(e){await this.log(T`${R.green(e)}`.value)}async debug(e){y(e,this.stdout)}async error(e,r){let o=R.errorText("\u274C Error"),n=R.errorText(`\u2514 ${e}`);await this.log(T`${o}`.value,r),await this.log(T`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e,r){if(!e||r.status==="remote-error"||r.status==="unknown-error")return;let o={status:r.status},n=e.extensionEvents??[],a=(await Promise.all(n.map(async c=>c.type===ne.Deleted?[]:(await c.extension.getDevSessionUpdateMessages(o))?.map(l=>({message:l,prefix:c.extension.handle}))??[]))).flat(),i=a.map((c,f)=>{let l=T`${R.gray(f===a.length-1?"\u2514 ":"\u2502 ")}${c.message}`.value;return this.log(l,c.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=R.errorText("\u274C Error");await this.log(T`${r}`.value,"app-preview");let o=e.map(n=>{let s=R.errorText(`\u2514 ${n.error}`);return this.log(T`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(`${e}
8
- `)})}};u();var Ye=class{processBatch;queue=[];processingPromise=void 0;constructor(e){this.processBatch=e}enqueue(e){this.queue.push(e),this.processingPromise??=this.startProcessing()}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var Je=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}statusManager;logger;options;appWatcher;bundlePath;appEventsProcessor;failedEvents=[];currentSessionState=null;constructor(e,r){this.statusManager=e.devSessionStatusManager,this.logger=new ze(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ye(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=Uo(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${ht(n)}ms - Total: ${ht(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let a of e)for(let i of a.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new I(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:o.buildResult?.status==="error"&&o.buildResult.error||"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){if(e.status==="updated")await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage();else if(e.status==="created")this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r,e),this.statusManager.setMessage("READY");else if(e.status==="remote-error"||e.status==="unknown-error"){let o=e.error instanceof Error?[e.error.message]:e.error.map(n=>n.message);await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR",o):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR",o))}!this.statusManager.status.isReady&&!fr()&&setImmediate(()=>{throw new I("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:this.options.appPreviewURL,appEmbedded:e.app.configuration.embedded,hasExtensions:r})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=ae(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new I("Auth session expired. Please run `shopify app dev` again.");if(r instanceof jt)throw r.response.status===401||r.response.status===403?new I("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new I("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 Ao(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await Wt(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=U(ve(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...To];r&&n.push("manifest.json"),await Io(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await _o(s,o),s}async getSignedURLWithRetry(){return Co(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.warnings??[],s=r.devSessionUpdate?.devSession;if(s&&this.currentSessionState){let a=ae(this.options.url),i=this.currentSessionState?.userId;if(s.websocketUrl!==a||s.user?.id!==i){let c=s.user?.email;await this.logger.error(`Another developer ${c?`(${c}) `:""}has taken ownership of this dev preview.`);let f=`Another user${c?` (${c})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,l=["You can restart by running",{command:"shopify app dev"},"again."];throw new I(f,l)}this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}}return n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"created"}}async logWarnings(e){await Promise.all(e.map(r=>{let o=r.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${r.message}`:r.message;return this.logger.warning(o)}))}};async function Rn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:sa,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var sa=async({stdout:t},e)=>{await Je.start(e,t)};u();u();u();var An=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=be().substring(0,6),i=`${aa(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,c=Zo({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),f=U(n,i);try{return await Z(n),await xe(f,c),{fullOutputPath:f,identifier:s}}catch(l){throw r.write(`Error while writing log to file: ${l}
9
- `),l}};function aa(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 Qe=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:f=0})=>{if(!i?.aborted)try{let l=e,p=Ho,h=f,g=await o.appLogs({jwtToken:e,cursor:r},a),{errors:d,status:m}=g;if(m===200){h=0;let{app_logs:S}=g;for(let v of S){let w=JSON.parse(v.payload);await D({outputPrefix:v.source,stripAnsi:!1},async()=>{v.log_type===Bo?(ia(v,w,t),w=new Wo(qo(w))):v.log_type.startsWith(Ko)?ca(v,w,t):t.write(JSON.stringify(w));let x=await An({appLog:v,appLogPayload:w,stdout:t,storeName:s,logsDir:c});t.write(T`${R.gray("\u2514 ")}${R.link("Open log file",`file://${x.fullOutputPath}`,`Log: ${x.fullOutputPath}`)} ${R.gray(`(${x.identifier})`)}\n`.value)})}}else{let S={errors:d.map(w=>({message:w,status:m}))},v=await Xo({response:S,onThrottle:w=>{L("Request throttled while polling app logs.",t),L(`Retrying in ${w/1e3} seconds.`,t)},onUnknownError:w=>{L("Error while polling app logs.",t),L(`Retrying in ${w/1e3} seconds.`,t)},onResubscribe:()=>n()});if(v.resubscribeResult==="failed"){if(h+=1,h>=jo){L("App log streaming session has expired. Please restart your dev session.",t);return}}else v.resubscribeResult==="succeeded"&&(h=0);v.nextJwtToken&&(l=v.nextJwtToken),p=v.retryIntervalMs}let{cursor:E}=g;setTimeout(()=>{Qe({stdout:t,appLogsFetchInput:{jwtToken:l,cursor:E??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:h}).catch(S=>{y(`Unexpected error during polling: ${S}}
10
- `)})},p)}catch(l){L("Error while polling app logs.",t),L(`Retrying in ${wt/1e3} seconds.`,t),y(`${l}}
11
- `),setTimeout(()=>{Qe({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c}).catch(p=>{y(`Unexpected error during polling: ${p}}
12
- `)})},wt)}};function ia(t,e,r){let o=(e.fuel_consumed/Go).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
13
- `).filter(Boolean).map(s=>T`${R.gray("\u2502 ")}${s}`.value).join(`
14
- `))}function ca(t,e,r){t.log_type===Vo?r.write("Function network access response retrieved from cache."):t.log_type===zo?e.reason===Jo?r.write("Function network access request executing in background because there is no cached response."):e.reason===Qo&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===Yo&&(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 la(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function Tn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:pa,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var pa=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:c})=>{async function f(l){let p=await yt(o,n,a,t),h=c.getLogsDir();await Z(h),await Qe({stdout:t,appLogsFetchInput:{jwtToken:p},resubscribeCallback:()=>yt(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:l,logsDir:h})}try{let l=!1,p,h=async g=>{let d=la(g.app);if(d&&!l){y("Function extensions detected, starting logs polling"),l=!0,p=new AbortController;try{await f(p.signal)}catch(m){y(`Failed to start function logs: ${m}`,e)}}else!d&&l&&(y("No function extensions detected, stopping logs polling"),l=!1,p?.abort(),p=void 0)};i.onStart(h).onEvent(h)}catch{}};u();async function In(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:ua}}var ua=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};u();import{EventEmitter as da}from"events";var fa={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"}},Xe=class extends da{currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0};constructor(e){super(),e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};Yt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e,r){let o=fa[e],n=o.type==="success"?[]:r;this.updateStatus({statusMessage:o,...n?{errors:n}:{}})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};u();import*as _n from"http";import*as Cn from"https";function Ln(t){return"errors"in t&&Array.isArray(t.errors)}async function kn(t,e,r,o){let s=(await import("./http-proxy-node16-D3JUYA5D.js")).default.createProxyServer(),a=ha(t,s,o),i=r?Cn.createServer(r,a):_n.createServer(a);return i.on("upgrade",ma(t,s,o)),e.addEventListener("abort",()=>{y("Closing reverse HTTP proxy"),i.close()}),{server:i}}function ma(t,e,r){return function(o,n,s){let a=$n(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let f=(Ln(i)?i.errors[i.errors.length-1]:void 0)??i;L(`Error forwarding websocket request: ${f.message}`,r),L(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function ha(t,e,r){return function(o,n){let s=$n(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=(Ln(a)?a.errors[a.errors.length-1]:void 0)??a;L(`Error forwarding web request: ${c.message}`,r),L(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});y(T`
15
- Reverse HTTP proxy error - Invalid path: ${o.url??""}
16
- These are the allowed paths:
17
- ${R.json(JSON.stringify(t))}
18
- `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function $n(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 Fn({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:c,graphiqlKey:f,apiSecret:l}){let p=o.apiKey,h=Ue(),g=!ye(h[re.disableGraphiQLExplorer]),d=await ho(t),m=l??(d.webs.length>0?await Ne(o):void 0),E=g&&m!==void 0,S=new Ro(d,i.proxyUrl),v=await Re(),w=ko(n,p,v),x=w,C=m===void 0?void 0:Ur(f,m,n),O=E&&C?`http://localhost:${c}/graphiql?key=${encodeURIComponent(C)}`:void 0,H=d.configuration.embedded,b=d.nonConfigExtensions.length>0,j=new Xe({isReady:!1,previewURL:x,graphiqlURL:O,appEmbedded:H,hasExtensions:b}),et=[...m===void 0?[]:await Un({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:p,apiSecret:m,scopes:oo(d.configuration)}),E&&m!==void 0?await Sn({appName:o.title,appUrl:w,port:c,apiKey:p,apiSecret:m,key:C,storeFqdn:n}):void 0,await Pn({allExtensions:d.realExtensions,storeFqdn:n,storeId:s,apiKey:p,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:S}),await Rn({app:d,apiKey:p,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:S,appPreviewURL:w,devSessionStatusManager:j,unsafeValidation:a.unsafeValidation}),await tn({remoteApp:o,localApp:d,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),m===void 0?void 0:xn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:m,remoteAppUpdated:e}),await Tn({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:p},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:S}),await In({appWatcher:S})].filter(ga);return{processes:await wa(et,i.proxyPort,i.reverseProxyCert),previewUrl:x,graphiqlUrl:O,devSessionStatusManager:j}}var ga=t=>t!==void 0&&t!==!1;async function wa(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(B.Frontend)){let c=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${c}`;let f=a.options.hmrServerOptions;f&&(i.websocket=`http://localhost:${f.port}`,f.httpPaths.forEach(l=>i[l]=`http://localhost:${f.port}`)),a.options.port=c}else if(a.type==="previewable-extension"){let c=await M();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:ya,options:{port:e,rules:s,localhostCert:r}}),n}var ya=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await kn(o,t,n,e);V(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};u();async function Dn({remoteApp:t,hasWebs:e,graphiqlEnabled:r}){if(e)return Ne(t);if(!r)return;let o=await wo(t);return o||L(`GraphiQL isn't available because the App Management API didn't return the app's client secret for your credentials. ${yo()}`),o}u();u();u();var _=X(st(),1);var Mn=.9,On=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Zt(),{isRawModeSupported:o}=Ie(),[n,s]=(0,_.useState)(e),[a,i]=(0,_.useState)(Math.floor(r.columns*Mn)),[c,f]=(0,_.useState)(!0),l=(0,_.useRef)(null);if(!n)throw new Error("No tabs provided");_e((d,m)=>{(async()=>{if(m?.leftArrow||m?.rightArrow||m?.tab){let w=Object.entries(t).filter(([b,j])=>j.content),x=w.findIndex(([b])=>b===n);if(x===-1)return;let C=m?.leftArrow?-1:1,O=(x+C+w.length)%w.length,H=w[O];H&&s(H[0])}let S=t[d];if(S){S.action?await S.action():s(d);return}let v=t[n];if(v?.shortcuts){let w=v.shortcuts.find(x=>x.key===d);w&&(!w.condition||w.condition())&&await w.action()}})()},{isActive:!!o}),(0,_.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*Mn)),!l.current)return;let m=er(l.current);f(m.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let p=Object.entries(t).map(([d,m])=>({...m,inputKey:d,header:` (${d}) ${m.label} `})),h=p.filter(d=>!d.action),g=p.filter(d=>d.action);return _.default.createElement(_.default.Fragment,null,_.default.createElement(F,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},_.default.createElement(F,{ref:l,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},_.default.createElement(W,{wrap:"truncate-end"},"\u2502",h.map(d=>_.default.createElement(_.default.Fragment,{key:d.inputKey},_.default.createElement(W,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),c&&_.default.createElement(F,{flexGrow:1,justifyContent:"flex-end"},g.map((d,m)=>_.default.createElement(W,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,m<g.length-1&&" \u2502 ")))),_.default.createElement(F,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var P=X(st(),1);var va=({message:t,type:e})=>e==="loading"?P.default.createElement(ir,{title:t}):P.default.createElement(W,null,e==="success"?"\u2705":"\u274C"," ",t),Nn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:c,onAbort:f})=>{let{isRawModeSupported:l}=Ie(),[p,h]=(0,P.useState)(void 0),[g,d]=(0,P.useState)(void 0),[m,E]=(0,P.useState)(r.status),[S,v]=(0,P.useState)(!1),{isAborted:w}=ar(t.signal,async b=>{b&&d(typeof b=="string"?b:b.message),r.status.isReady?v(!0):(h("Shutting down dev ..."),await f()),He()}),x=(0,P.useMemo)(()=>e.map(b=>({...b,action:async(j,et,Ct)=>{try{return await b.action(j,et,Ct)}catch(ps){t.abort(ps)}}})),[e,t]);(0,P.useEffect)(()=>(r.on("dev-session-update",E),()=>{r.off("dev-session-update",E)}),[]),_e((b,j)=>{rr(b,j,()=>t.abort())},{isActive:!!l});let C=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:m.previewURL,condition:()=>!!(m.isReady&&m.previewURL),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),m.previewURL&&await ke(m.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:gt(o),condition:()=>!!(m.isReady&&m.appEmbedded===!1&&m.hasExtensions),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await ke(gt(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:m.graphiqlURL,condition:()=>!!(m.isReady&&m.graphiqlURL),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),m.graphiqlURL&&await ke(m.graphiqlURL)}}],O=C.filter(b=>b.condition?.()??!0),H={d:{label:"Dev status",shortcuts:C,content:P.default.createElement(P.default.Fragment,null,m.statusMessage&&P.default.createElement(va,{message:m.statusMessage.message,type:m.statusMessage.type}),l&&O.length>0&&P.default.createElement(F,{marginTop:1,flexDirection:"column"},O.map(b=>P.default.createElement(W,{key:b.key},or.pointerSmall," ",P.default.createElement(W,{bold:!0},"(",b.key,")")," ",ct()&&b.url?P.default.createElement(at,{url:b.url,label:b.shortcutLabel}):b.shortcutLabel))),P.default.createElement(F,{marginTop:l?1:0,flexDirection:"column"},p?P.default.createElement(W,null,p):P.default.createElement(P.default.Fragment,null,m.isReady&&!(l&&ct())&&P.default.createElement(P.default.Fragment,null,O.filter(b=>b.url).map(b=>P.default.createElement(W,{key:b.key},b.linkLabel," URL: ",P.default.createElement(at,{url:b.url})))))))},a:{label:"App info",content:P.default.createElement(F,{flexDirection:"column"},P.default.createElement(it,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":c??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,b])=>b)}))},s:{label:"Store info",content:P.default.createElement(F,{flexDirection:"column"},P.default.createElement(it,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,b])=>b)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return P.default.createElement(P.default.Fragment,null,P.default.createElement(nr,{processes:x,prefixColumnSize:so,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),S&&P.default.createElement(F,{marginTop:1,flexDirection:"column"},P.default.createElement(sr,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),w?null:P.default.createElement(F,{paddingTop:1,flexDirection:"column",flexGrow:1},l?P.default.createElement(On,{tabs:H,initialActiveTab:"d"}):P.default.createElement(F,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},H.d?.content)),g?P.default.createElement(F,{marginTop:1,flexDirection:"column"},P.default.createElement(W,{color:"red"},g)):null)};var qn=X(st(),1);import{Writable as Hn}from"stream";async function jn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:c,organizationName:f,configPath:l,localURL:p}){let h=()=>o.abort();process.on("shopify:signal",h);try{if(nt()!=="json"&&pr())return await tr(qn.default.createElement(Nn,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:c,organizationName:f,configPath:l,localURL:p,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await Pa({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o}),He()}finally{process.removeListener("shopify:signal",h)}}async function Pa({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){let n=nt()==="json";n||(process.stdout.write(`
19
- Preview URL: ${e}
20
- `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
21
- `));let{signal:s}=o,a=()=>o.abort();process.once("SIGINT",a),process.once("SIGTERM",a);let i=()=>{},c=new Promise(l=>{i=l,s.addEventListener("abort",i,{once:!0}),s.aborted&&l()}),f=t.map(async l=>{let p=new Hn({write:(h,g,d)=>d()});return l.action(n?p:Wn(process.stdout),n?p:Wn(process.stderr),s)});try{await Promise.all([...f,c])}catch(l){if(!s.aborted)throw l}finally{o.abort(),await Promise.allSettled(f),s.removeEventListener("abort",i),process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a)}}function Wn(t){return new Hn({decodeStrings:!1,write(e,r,o){let n=typeof e=="string"?Buffer.from(e,r):e,s=typeof e=="string"&&n.length>0&&n[n.length-1]!==10;t.write(s?Buffer.concat([n,Buffer.from(`
22
- `)]):n,o)}})}u();function Gn(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];ue({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=rt(e.map(n=>n.for)).join(" "),o=rt(e.map(n=>({command:n.flagToRemedy})));ue({headline:[`Random ports will be used for ${r} because the requested ports are not available.`],body:["If you want to use specific ports, you can choose different ports using the",...o,"flags."]})}u();async function Bn(t,e){return e?e.includes("localhost")?"localhost":(await Kt(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}u();var Kn=X(ds(),1);var Q="v1.4.4",Vn="FiloSottile/mkcert",Rt=R.genericShellCommand("mkcert");async function Ea(t,e,r,o){let n=e[re.mkcertBinaryPath];if(n)return n;let a=U(t,r==="win32"?"mkcert.exe":"mkcert");if(await N(a))return a;let i=await(0,Kn.default)("mkcert",{nothrow:!0});return i?(y(T`Found ${Rt} at ${R.path(i)}`),i):(await xa(a,r,o),a)}async function xa(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${Q}-darwin-arm64`:`mkcert-${Q}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${Q}-linux-arm64`:`mkcert-${Q}-linux-amd64`;break;case"win32":o=`mkcert-${Q}-windows-amd64.exe`;break;default:throw new te(`Unsupported platform: ${e}`)}await Or(Vn,Q,o,t),y(T`${Rt} saved to ${R.path(t)}`)}async function Sa(t){let e=U(t,"mkcert-LICENSE");if(await N(e))return;let r=`https://raw.githubusercontent.com/${Vn}/refs/tags/${Q}/LICENSE`,o={headline:"Failed to download mkcert license.",body:["We tried to download the license for mkcert, but the request failed. You can ",{link:{url:r,label:"view the license here"}}]},n;try{if(n=await Bt(r),!n.ok)return o}catch{return o}let s=await n.text();await xe(e,s)}async function zn({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=U(".shopify","localhost-key.pem"),a=U(".shopify","localhost.pem"),i=U(t,s),c=U(t,a);if(await N(i)&&await N(c))return{keyContent:await k(i),certContent:await k(c),certPath:a};if(!(e??await go()))throw new I(`Localhost certificate and key are required at ${a} and ${s}`);let l="",p;return await Le([{title:"Finding or downloading mkcert binary",task:async()=>{let g=U(t,".shopify");l=await Ea(g,r,o,n),p=await Sa(g),y(T`${Rt} found at: ${R.path(l)}`)}}]),p&&Ce(p),V(T`Generating self-signed certificate for localhost. You may be prompted for your password.`),await $e(l,["-install","-key-file",i,"-cert-file",c,"localhost"]),V(T`${R.successIcon()} Certificate generated at ${a}\n`),await ur()&&(ue({headline:"It looks like you're using WSL.",body:["Additional steps are required to configure certificate trust in Windows."],link:{label:"See Shopify CLI documentation",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development-with-windows-subsystem-for-linux-wsl"}}),V("\u{1F449} Press any key to continue"),await cr(),V("")),{keyContent:await k(i),certContent:await k(c),certPath:Lt(t,c)}}u();function Yn(){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 I(t,void 0,[e],[r])}u();u();import{createWriteStream as ba}from"fs";import{Writable as Ua}from"stream";import{finished as Ra}from"stream/promises";import{StringDecoder as Aa}from"string_decoder";import{once as Ta}from"events";var ge=we({name:"DevInstanceLogEntry",schema:A.object({timestamp:ie,source:A.string().describe("What produced the line, for example a process prefix like web or extensions."),level:A.enum(["debug","info","warning","error"]).optional(),message:A.string()}).strict()});function Qn({logFile:t,logOutput:e,isActive:r,onError:o}){let n=ba(t,{flags:"w",mode:384});n.on("error",o),e?.on("error",o);let s=Ta(n,"open"),a=new Set,i=async c=>{if(!r())return;let f=ge.validate({...c,timestamp:c.timestamp??ce(new Date)}),l=`${JSON.stringify(f)}
23
- `;try{await Ze(n,l),e&&await Ze(e,l)}catch(p){throw o(p),p}};return{opened:s,log:i,tee:(c,{source:f,stringWritesAreMessages:l=!1})=>{let p=new Aa("utf8"),h="",g=f,d=async v=>{let w=v.split(/\r?\n/);h=w.pop()??"",await Promise.all(w.map(async x=>{let C=mr(x).trimEnd();C.length>0&&await i({source:g,message:C})}))},m=()=>d(`${h}${p.end()}
24
- `),E=new At({decodeStrings:!l,write(v,w,x){let C=Te()?.outputPrefix??f,O=l&&typeof v=="string",H=C!==g||O?m():Promise.resolve();g=C,Promise.all([H,Ze(c,v,w),d(h+p.write(typeof v=="string"?Buffer.from(v,w):v)+(O?`
25
- `:""))]).then(()=>x()).catch(x)},final(v){m().then(()=>v()).catch(v)}}),S=v=>E.destroy(v);return c.on("error",S),E.on("error",v=>o(v)),E.once("close",()=>{c.off("error",S)}),a.add(E),E},flush:()=>Promise.allSettled([...a].map(c=>Jn(c))),close:async()=>{try{await Jn(n),e&&!e.destroyed&&await Ze(e,"")}finally{e?.off("error",o)}}}}var At=class extends Ua{contexts=[];constructor(e){super({...e,write:(r,o,n)=>{D(this.contexts.shift()??{},()=>e.write.call(this,r,o,n))}})}write(e,r,o){return this.contexts.push(Te()),typeof r=="string"?super.write(e,r,o):super.write(e,r??o)}end(e,r,o){return e!=null&&typeof e!="function"&&this.contexts.push(Te()),typeof e=="function"?super.end(e):typeof r=="string"?super.end(e,r,o):super.end(e,r??o)}};async function Ze(t,e,r="utf8"){await new Promise((o,n)=>{t.write(e,r,s=>s?n(s):o())})}async function Jn(t){let e=Ra(t,{cleanup:!0});t.end(),await e}var Zn=X(fs());import Tt,{readFileSync as Ia}from"fs";import{mkdir as _a,rmdir as Ca,writeFile as La}from"fs/promises";var It="dev_instance_already_running",ka="dev",$a=15e3;function Fa(t){let e=U(t.directory,".shopify",ka),r=Na(t);return{folder:e,infoFile:U(e,`${r}.json`),lockFile:U(e,`${r}.lock`),logFile:U(e,`${r}.jsonl`)}}async function Da(t){let e=Fa(t);await $r(t.directory),await Z(e.folder);let r=`${e.lockFile}.acquire`;try{await _a(r,{mode:448})}catch(o){if(o.code!=="EEXIST")throw o;let n=new I(`Another \`shopify ${t.command}\` is starting, or a previous startup was interrupted.`,"Wait for other starts to finish. If none is running, remove the startup lock below and try again.",[["Startup lock",{filePath:r}]]);throw n.code=It,n}try{return await Ma(t,e)}catch(o){if(!Oa(o))throw o;let n=await rs(e.infoFile);throw os(t,n&&ts(n.pid)?n:void 0)}finally{await Ca(r)}}async function es(t,e){let r=await Da(t);try{return await e(r)}finally{await r.release()}}async function Ma(t,e){let r=await rs(e.infoFile);if(r&&ts(r.pid))throw os(t,r);let o=be(),n=new AbortController,s=!1,a=()=>{if(s)return!1;try{return JSON.parse(Ia(e.infoFile,"utf8")).sessionId===o}catch{return!1}},i=!1,c=w=>{if(!(i&&!a()))try{Tt.rmdirSync(w)}catch(x){if(x.code!=="ENOENT")throw x}},f={realpath:!1,lockfilePath:e.lockFile,stale:$a,retries:0,onCompromised:w=>{s=!0,y(`The ${t.command} instance lock was compromised: ${w.message}`),n.abort(new I(`The ${t.command} instance lost its lock.`,"Start the command again."))},fs:{...Tt,rmdir:(w,x)=>{if(i&&!a())return x(null);Tt.rmdir(w,x)},rmdirSync:c}};r&&await Mt(e.lockFile,{force:!0});let l=await Zn.default.lock(e.infoFile,f),p=ce(new Date),h={schemaVersion:1,sessionId:o,command:t.command,...t.key?{key:t.key}:{},pid:process.pid,status:"starting",startedAt:p,updatedAt:p,directory:t.directory,logFile:e.logFile,details:{...t.details??{}}},g=Promise.resolve(),d=!1,m=Qn({logFile:e.logFile,logOutput:t.logOutput,isActive:()=>!d&&!s,onError:w=>n.abort(w)}),E,S=()=>{!d&&a()&&(c(e.lockFile),Dt(e.infoFile))};process.once("exit",S);let v={info:h,paths:e,abortSignal:n.signal,update:async w=>{if(E||s)return;w.status&&(h.status=w.status),w.details&&(h.details={...h.details,...w.details}),h.updatedAt=ce(new Date);let x={...h,details:{...h.details}},C=g.then(async()=>{s||await Xn(e.infoFile,x)});g=C.catch(()=>{}),await C},log:m.log,tee:m.tee,release:()=>(E??=(async()=>{try{let x=(await m.flush()).find(C=>C.status==="rejected");if(await g,x?.status==="rejected")throw x.reason}finally{d=!0,process.removeListener("exit",S);try{await m.close()}finally{let w=a();await l().catch(x=>y(`Failed to release the dev instance lock: ${x.message}`)),w&&await ot(e.infoFile).catch(()=>{})}}})(),E)};try{return await m.opened,await Xn(e.infoFile,h),i=!0,v}catch(w){throw await v.release().catch(x=>y(x.message)),await ot(`${e.infoFile}.${o}.tmp`),w}}function ts(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}async function rs(t){try{let e=JSON.parse(await k(t));return typeof e?.pid=="number"?e:void 0}catch{return}}async function Xn(t,e){let r=`${t}.${e.sessionId}.tmp`;await La(r,`${JSON.stringify(e,null,2)}
26
- `,{mode:384}),await Ft(r,t)}function Oa(t){return t?.code==="ELOCKED"}function Na({command:t,key:e}){let r=[t,e].filter(Boolean).join("-").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),o=pe(JSON.stringify([t,e??""])).slice(0,4);return`${r}-${o}`}function os(t,e){let r=`shopify ${t.command}`;if(!e){let a=new I(`Another \`${r}\` is starting for this project.`,"Wait a few seconds and try again, or stop the other process first.");return a.code=It,a}let o=process.platform==="win32"?`taskkill /PID ${e.pid} /F`:`kill ${e.pid}`,n=Object.entries(e.details).filter(([,a])=>typeof a=="string"||typeof a=="number"||typeof a=="boolean").map(([a,i])=>[a,String(i)]),s=new I(`Another \`${r}\` is already running for this project.`,"Use the running instance, or stop it before starting a new one.",[["Read its output in",{filePath:e.logFile}],["Stop it with",{command:o}]],[{body:{tabularData:[["PID",String(e.pid)],["Started",e.startedAt],...n],firstColumnSubdued:!0}}]);return s.code=It,s.details={instance:e},s}function ss({app:t,remoteApp:e,json:r=!1},o){return es({command:"app dev",directory:t.directory,key:Pe(t.configPath),details:{configPath:t.configPath,appName:e.title,clientId:e.apiKey},logOutput:r?process.stdout:void 0},o)}async function as(t){let e=new Ht,r;try{if(t.tunnel.mode==="auto"){let c=await M();r=await fo(t.commandConfig,c,"cloudflare"),e.signal.addEventListener("abort",()=>r?.stopTunnel(),{once:!0})}let o=await Wa(t,r);await qa(o);let{processes:n,graphiqlUrl:s,previewUrl:a,devSessionStatusManager:i}=await Fn(o);await ja(o),await Ka({processes:n,previewUrl:a,graphiqlUrl:s,config:o,devSessionStatusManager:i,abortController:e})}finally{e.abort()}}async function Wa(t,e){let{app:r,remoteApp:o,developerPlatformClient:n,store:s,specifications:a,tunnel:i}=t,c=await Po(o,n,a,o.flags);o.configuration=c;let f=await Dn({remoteApp:o,hasWebs:r.webs.length>0,graphiqlEnabled:!ye(Ue()[re.disableGraphiQLExplorer])});Eo({app:r,remoteApp:o,selectedStore:s,cachedInfo:mt(t.directory),organization:t.organization,tunnelMode:i.mode}),r.configuration.build?.dev_store_url&&(r.configuration.build={...r.configuration.build,dev_store_url:s.shopDomain},await(await hr.read(r.configPath)).patch({build:{dev_store_url:s.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await ro(t.project);let l=t.graphiqlPort??await M(fe.graphiql),p=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??fe.graphiql,actual:l}];i.mode==="use-localhost"&&p.push({for:"localhost",flagToRemedy:"--localhost-port",requested:i.requestedPort,actual:i.actualPort}),Gn(p);let{webs:h,...g}=await Ba(r.directory,r.webs,l,i,e,o.configuration,t.installMkcert);r.webs=h;let d=r.configuration.build?.automatically_update_urls_on_dev,m=mt(t.directory)?.previousAppId,E=o.apiKey,S=await Ga(h,t.update,g,r,d,o,E);return{storeFqdn:s.shopDomain,storeId:s.shopId,remoteApp:o,remoteAppUpdated:o.apiKey!==m,localApp:r,developerPlatformClient:n,commandOptions:t,network:g,partnerUrlsUpdated:S,graphiqlPort:l,graphiqlKey:t.graphiqlKey,apiSecret:f}}async function qa(t){await Ha(t)}async function Ha(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||Yn()}async function ja(t){io({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await Va({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Jt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Ga(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=J(t),f=!1;if((c??i)&&e){let l=lo(r.proxyUrl,t.map(({configuration:p})=>p.auth_callback_path).find(p=>p),o.configuration.app_proxy);f=await uo({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:l}),f&&o.setDevApplicationURLs(l)}return f}async function Ba(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=J(e);await za(e,r);let f=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:l,frontendPort:p,usingLocalhost:h},g,d]=await Promise.all([co(f),qt()??i?.configuration.port??M(),po(s)]),m=h?`${l}:${p}`:l,E=c?.configuration.port;c&&(E??=c===i?g:await M(),c.configuration.port=E),E=E??await M();let S;if(o.mode==="use-localhost"){let{keyContent:v,certContent:w,certPath:x}=await zn({appDirectory:t,forceInstall:a});S={key:v,cert:w,certPath:x,port:o.actualPort}}return{proxyUrl:m,proxyPort:p,frontendPort:E,backendPort:g,currentUrls:d,webs:e,reverseProxyCert:S}}async function Ka({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n,abortController:s}){let a=o.commandOptions.devInstance,i=t.map(g=>({prefix:g.prefix,action:async(m,E,S)=>{let v=g.function,w=a?a.tee(m,{source:g.prefix,stringWritesAreMessages:!0}):m,x=a?a.tee(E,{source:g.prefix,stringWritesAreMessages:!0}):E;return v({stdout:w,stderr:x,abortSignal:S},g.options)}}));if(a){let g={storeFqdn:o.storeFqdn,previewUrl:e,graphiqlUrl:r,appUrl:o.localApp.devApplicationURLs?.applicationUrl,localUrl:o.network.proxyUrl};await a.update({status:"running",details:{...g,preview:ns(n.status)}}),await a.log({source:"app dev",level:"info",message:`Preview URL: ${e}`}),r&&await a.log({source:"app dev",level:"info",message:`GraphiQL URL (Admin API): ${r}`})}let c=o.developerPlatformClient,f={id:o.remoteApp.id,developerPlatformClient:c},l,p=g=>{let d=[a?.update({details:{preview:ns(g)}})],m=g.statusMessage;m&&(m.message!==l?.message||m.type!==l?.type)&&d.push(a?.log({source:"app dev",level:m.type==="error"?"error":"info",message:m.message})),l=m,Promise.all(d).catch(E=>{y(`Failed to save dev status: ${E.message}`)})};a&&(n.on("dev-session-update",p),p(n.status));let h=()=>s.abort(a?.abortSignal.reason);try{a?.abortSignal.throwIfAborted(),a?.abortSignal.addEventListener("abort",h,{once:!0}),await jn({processes:i,previewUrl:e,graphiqlUrl:r,app:f,abortController:s,shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl}),a?.abortSignal.throwIfAborted()}finally{a?.abortSignal.removeEventListener("abort",h),a&&n.off("dev-session-update",p)}}function ns({isReady:t,statusMessage:e,errors:r}){let o=t?"ready":"starting";return t&&e?.type==="loading"&&(o="updating"),e?.type==="error"&&(o="error"),{state:o,message:e?.message??null,errors:r??[]}}async function Va(t){let e=await Bn(t.devOptions.commandConfig,t.tunnelUrl);await z.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?pe(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:pe(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await z.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function za(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 I(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await lt(n))throw new I(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await lt(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new I(s,a)}})()])}u();var is=A.object({state:A.enum(["starting","updating","ready","error"]),message:A.string().nullable(),errors:A.array(A.string())}).strict().describe("The CLI-reported preview state in the instance file; this is not a health check."),Ya=A.object({schemaVersion:A.literal(1),sessionId:A.string(),command:A.literal("app dev"),key:A.string().optional(),pid:A.number().int().positive(),status:A.enum(["starting","running"]),startedAt:ie,updatedAt:ie,directory:A.string(),logFile:A.string(),details:A.object({configPath:A.string(),appName:A.string(),clientId:A.string(),storeFqdn:A.string().optional(),previewUrl:A.string().optional(),graphiqlUrl:A.string().optional(),appUrl:A.string().optional(),localUrl:A.string().optional(),preview:is.optional()}).strict()}).strict().describe("The instance JSON file under .shopify/dev/. This object is not emitted to stdout."),cs=we({name:ge.name,schema:ge.schema,definitions:{DevInstance:Ya,DevPreview:is}});u();async function ls({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??fe.localhost,n=await M(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new I(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var $=X(us(),1);var _t=class t extends So{static get requiresSyncAnalytics(){return!0}static summary="Run the app.";static descriptionWithMarkdown="Builds and previews your app on a dev store, and watches for changes. [Read more about testing apps locally](https://shopify.dev/docs/apps/build/cli-for-apps/test-apps-locally).";static get jsonOutputSchema(){return cs}static description=this.descriptionForHelp();static flags={...gr,...to,...wr,"client-id":$.Flags.string({hidden:!1,description:"The Client ID of your app. Use with --config to run dev with that configuration for a different app than the one it is linked to.",env:"SHOPIFY_FLAG_CLIENT_ID"}),store:$.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>Ae(e)}),"skip-dependencies-installation":$.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":$.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"unsafe-validation":$.Flags.boolean({description:"Allow app dev to continue with warnings for eligible app version validation failures.",env:"SHOPIFY_FLAG_UNSAFE_VALIDATION",default:!1}),"subscription-product-url":$.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":$.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":$.Flags.string({description:'Use a custom tunnel, it must be running before executing dev. Format: "https://my-tunnel-url:port".',env:"SHOPIFY_FLAG_TUNNEL_URL",exclusive:["tunnel"]}),"use-localhost":$.Flags.boolean({description:"Service entry point will listen to localhost. A tunnel won't be used. Will work for testing many app features, but not those that directly invoke your app (E.g: Webhooks)",env:"SHOPIFY_FLAG_USE_LOCALHOST",exclusive:["tunnel-url"]}),"install-mkcert":$.Flags.boolean({description:"Install and use mkcert to generate localhost certificates when --use-localhost is enabled without prompting.",env:"SHOPIFY_FLAG_INSTALL_MKCERT",dependsOn:["use-localhost"]}),"localhost-port":Fe({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:$.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Fe({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":$.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:$.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":Fe({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":$.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(t),r=await ls({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Qt(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await mo(e.path);let o=await xo({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config});return ss({...o,json:e.json},async n=>{let s=await bo({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option"}),a={...o,store:s,directory:e.path,update:!e["no-update"],unsafeValidation:e["unsafe-validation"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],storePassword:e["store-password"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],installMkcert:e["install-mkcert"],tunnel:r,devInstance:n};return await as(a),{app:o.app}})}};export{Li as a,_t as b};
@@ -1,9 +0,0 @@
1
- import{b as h}from"./chunk-ZJOX5HW4.js";import{b as u,c as m}from"./chunk-3KM5ZOW2.js";import{O as i}from"./chunk-D2KIGKBI.js";import{a as n}from"./chunk-BN7ZXAZJ.js";import{wb as p}from"./chunk-JLQRDFR5.js";import{b as s}from"./chunk-FZCGRIOM.js";import{b as g}from"./chunk-YTUUU33R.js";import{e as S,g as e}from"./chunk-VKWPEFWQ.js";e();e();async function f(t){let r=new URLSearchParams;return r.append("search",t??""),{url:`https://shopify.dev/docs?${r.toString()}`}}e();e();var o=n({name:"SearchResult",schema:s.object({url:s.string().url()})});async function l(t,r){r==="json"?p(o.encode(t)):await i(t.url)}var d=S(g(),1),a=class t extends h{static descriptionWithMarkdown="Search shopify.dev for the most relevant content matching a query. Best for discovery \u2014 surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`.";static description=this.descriptionForHelp();static usage="search [query]";static examples=[`# open the search modal on Shopify.dev
2
- shopify search
3
-
4
- # search for a term on Shopify.dev
5
- shopify search <query>
6
-
7
- # search for a phrase on Shopify.dev
8
- shopify search "<a search query separated by spaces>"
9
- `];static args={query:d.Args.string()};static flags={...u,...m};static get jsonOutputSchema(){return o}async run(){let{args:r,flags:c}=await this.parse(t),y=await f(r.query);await l(y,c.json?"json":"text")}};export{a};
@@ -1,11 +0,0 @@
1
- import{a as V}from"./chunk-67L7FIB6.js";import{a as K}from"./chunk-VHZ6RL67.js";import{a as D}from"./chunk-NVKJ7ZLP.js";import{Ma as Y,i as m,ka as M}from"./chunk-U2T5HPRD.js";import{ea as W,ha as $,t as b}from"./chunk-33ZE3DRQ.js";import{G as F,H as O}from"./chunk-GQLNG537.js";import{a as f}from"./chunk-HSKDFEXW.js";import{b as R,c as L}from"./chunk-3KM5ZOW2.js";import{z as N}from"./chunk-D2KIGKBI.js";import{c as g}from"./chunk-GW7YIJPJ.js";import{a as _}from"./chunk-BN7ZXAZJ.js";import{Ib as k,L as w,N as x,rb as T,wb as U}from"./chunk-JLQRDFR5.js";import{b as e}from"./chunk-FZCGRIOM.js";import{b as ae}from"./chunk-YTUUU33R.js";import{f as u,i as P}from"./chunk-IWTNUJGY.js";import{e as se,g as c}from"./chunk-VKWPEFWQ.js";c();c();c();var l=e.record(e.unknown()),S=e.object({id:e.string(),name:e.string(),continueOnError:e.boolean().optional()}),J=e.array(e.object({lifecycle:e.literal("deploy"),steps:e.array(e.discriminatedUnion("type",[S.extend({type:e.literal("include_assets"),config:e.object({generatesAssetsManifest:e.boolean().optional(),inclusions:e.array(e.discriminatedUnion("type",[e.object({type:e.literal("pattern"),baseDir:e.string().optional(),include:e.array(e.string()).optional(),ignore:e.array(e.string()).optional(),destination:e.string().optional()}),e.object({type:e.literal("static"),source:e.string(),destination:e.string().optional()}),e.object({type:e.literal("configKey"),key:e.string(),destination:e.string().optional(),anchor:e.string().optional(),groupBy:e.string().optional(),preserveFilePaths:e.boolean().optional()})]))})}),S.extend({type:e.literal("bundle_ui"),config:e.object({generatesAssetsManifest:e.boolean().optional(),bundleFolder:e.string().optional()}).optional()}),S.extend({type:e.enum(["build_theme","bundle_theme","build_function","create_tax_stub"]),config:e.record(e.never()).optional()})]))})),A=e.object({identifier:e.string(),externalIdentifier:e.string(),externalName:e.string(),group:e.string().optional(),additionalIdentifiers:e.array(e.string()),partnersWebIdentifier:e.string(),surface:e.string(),registrationLimit:e.number(),experience:e.enum(["extension","configuration"]),uidStrategy:e.enum(["single","dynamic","uuid"]),dependency:e.string().optional(),graphQLType:e.string().optional(),clientSteps:J.optional(),loadedRemoteSpecs:e.boolean().optional()}),v=e.object({name:e.string(),type:e.string(),externalType:e.string(),humanName:e.string(),surface:e.string(),features:e.array(e.string()),dependency:e.string().optional(),entrySourceFilePath:e.string(),devUUID:e.string(),localIdentifier:e.string(),idEnvironmentVariableName:e.string(),directory:e.string(),configuration:l,configurationPath:e.string(),outputPath:e.string(),handle:e.string(),specification:A,uid:e.string()}).passthrough(),q=e.object({directory:e.string(),configuration:l.optional()}).passthrough(),Q=e.object({file:e.string(),message:e.string()}).passthrough(),h=e.object({id:e.string(),title:e.string(),apiKey:e.string(),organizationId:e.string(),appType:e.string().optional(),newApp:e.boolean().optional(),grantedScopes:e.array(e.string()),developmentStorePreviewEnabled:e.boolean().optional(),applicationUrl:e.string().optional(),redirectUrlWhitelist:e.array(e.string()).optional(),requestedAccessScopes:e.array(e.string()).optional(),webhookApiVersion:e.string().optional(),embedded:e.boolean().optional(),posEmbedded:e.boolean().optional(),preferencesUrl:e.string().optional(),gdprWebhooks:e.object({customerDeletionUrl:e.string().optional(),customerDataRequestUrl:e.string().optional(),shopDeletionUrl:e.string().optional()}).optional(),appProxy:e.object({subPath:e.string(),subPathPrefix:e.string(),url:e.string()}).optional(),configuration:l.optional(),flags:e.array(e.string())}),B=e.object({path:e.string(),message:e.string()}),I=e.object({path:e.string(),content:l,errors:e.array(B)}),G=e.object({directory:e.string(),appConfigFiles:e.array(I),extensionConfigFiles:e.array(I),webConfigFiles:e.array(I),dotenvFiles:e.array(e.object({path:e.string()})),errors:e.array(B)}),X=e.object({cliVersion:e.string(),nodeVersion:e.string(),platform:e.string(),arch:e.string(),shell:e.string().optional()}),H=e.object({remoteApp:h,account:e.discriminatedUnion("type",[e.object({type:e.literal("UserAccount"),email:e.string()}),e.object({type:e.literal("ServiceAccount"),orgName:e.string()}),e.object({type:e.literal("UnknownAccount")})]),project:G,system:X,devStoreUrl:e.string().optional(),name:e.string(),idEnvironmentVariableName:e.literal("SHOPIFY_API_KEY"),directory:e.string(),configPath:e.string(),configuration:l,webs:e.array(q),dotenv:e.object({path:e.string(),variables:e.record(e.string())}).passthrough().optional(),errors:e.object({errors:e.array(Q)}).passthrough(),specifications:e.array(A),remoteFlags:e.array(e.string()),realExtensions:e.array(v),devApplicationURLs:l.optional(),_hiddenConfig:l,packageManager:e.string(),nodeDependencies:e.record(e.string()),usesWorkspaces:e.boolean(),organization:e.object({id:e.string(),businessName:e.string(),source:e.string()}),allExtensions:e.array(v)}).passthrough(),z=e.object({SHOPIFY_API_KEY:e.string(),SHOPIFY_API_SECRET:e.string().optional(),SCOPES:e.string()}),d=_({name:"AppInfoResult",schema:e.union([z,H]),definitions:{AppInfo:H,AppInfoRemoteApp:h,AppInfoProject:G,AppInfoSystem:X,AppInfoWebEnvironment:z,AppInfoExtension:v,AppInfoSpecification:A,AppInfoClientSteps:J,AppInfoWeb:q,AppInfoConfigurationError:Q}});async function ee(r,t,o,n,i){if(i.webEnv){await M(t,o.source);let a=await W(t);return a||$(),{SHOPIFY_API_KEY:t.apiKey,...a?{SHOPIFY_API_SECRET:a}:{},SCOPES:m(r.configuration)}}let s={...r,packageManager:n.packageManager,nodeDependencies:n.nodeDependencies,usesWorkspaces:n.usesWorkspaces,organization:{id:o.id,businessName:o.businessName,source:o.source},remoteApp:h.parse(t),account:await t.developerPlatformClient.accountInfo(),project:{directory:n.directory,appConfigFiles:n.appConfigFiles.map(E),extensionConfigFiles:n.extensionConfigFiles.map(E),webConfigFiles:n.webConfigFiles.map(E),dotenvFiles:[...n.dotenvFiles.values()].map(({path:a})=>({path:a})),errors:(n.errors??[]).map(({path:a,message:ie})=>({path:a,message:ie}))},system:{cliVersion:f,nodeVersion:process.version,...g(),shell:process.env.SHELL},devStoreUrl:r.configuration.build?.dev_store_url??r.hiddenConfig.dev_store_url,allExtensions:Z(r.allExtensions.filter(a=>a.isReturnedAsInfo())),realExtensions:Z(r.realExtensions),specifications:r.specifications.map(te)},p=JSON.parse(JSON.stringify(Object.fromEntries(Object.entries(s).filter(([a])=>a!=="configSchema"))));return d.validate(p)}function te(r){return{identifier:r.identifier,externalIdentifier:r.externalIdentifier,externalName:r.externalName,group:r.group,additionalIdentifiers:r.additionalIdentifiers,partnersWebIdentifier:r.partnersWebIdentifier,surface:r.surface,registrationLimit:r.registrationLimit,experience:r.experience,uidStrategy:r.uidStrategy,dependency:r.dependency,graphQLType:r.graphQLType,clientSteps:r.clientSteps,..."loadedRemoteSpecs"in r?{loadedRemoteSpecs:r.loadedRemoteSpecs}:{}}}function E({path:r,content:t,errors:o}){return{path:r,content:t,errors:o.map(({path:n,message:i})=>({path:n,message:i}))}}function Z(r){return r.map(t=>({...t,name:t.name,type:t.type,externalType:t.externalType,humanName:t.humanName,surface:t.surface,features:t.features,dependency:t.dependency,specification:te(t.specification)}))}c();async function pe(r){let{app:t,remoteApp:o,organization:n,project:i}=r,s=await o.developerPlatformClient.accountInfo();return new C(t,o,n,i,s).output()}async function ne(r){N({customSections:await pe(r)})}function ce(r,t){if(t==="json")return d.encode(r);if(!("name"in r))return V({variables:Object.entries(r).map(([o,n])=>({name:o,value:n}))});throw new Error("App information text output requires the loaded app context.")}function oe(r,t){U(ce(r,t))}var le="unknown",y={subdued:"Not yet configured"},ue="NOT LOADED",C=class{app;remoteApp;organization;project;account;constructor(t,o,n,i,s){this.app=t,this.remoteApp=o,this.organization=n,this.project=i,this.account=s}async output(){return[...await this.devConfigsSection(),this.projectSettingsSection(),...await this.appComponentsSection(),await this.systemInfoSection()]}async devConfigsSection(){let t=y;this.app.configuration.build?.automatically_update_urls_on_dev!==void 0&&(t=this.app.configuration.build.automatically_update_urls_on_dev?"Yes":"No");let o=["User","unknown"],n=this.account;return O(n)?o=["Service account",n.orgName]:F(n)&&(o[1]=n.email),[this.tableSection("Current app configuration",[["Configuration file",{filePath:P(this.app.configPath)||b.app}],["App name",this.remoteApp.title?{userInput:this.remoteApp.title}:y],["Client ID",this.remoteApp.apiKey||y],["Organization",`${this.organization.businessName} (${this.organization.id})`],["Access scopes",m(this.app.configuration)],["Dev store",this.app.configuration.build?.dev_store_url??this.app.hiddenConfig.dev_store_url??y],["Update URLs",t],o],{isFirstItem:!0}),{body:["\u{1F4A1} To change these, run",{command:T(this.project.packageManager,"shopify app config link")}]}]}projectSettingsSection(){return this.tableSection("Your Project",[["Root location",{filePath:this.app.directory}]])}async appComponentsSection(){let t=this.webComponentsSection();return[{title:`
2
- Directory components`.toUpperCase(),body:""},...t?[t]:[],...this.extensionsSections()]}webComponentsSection(){let t=[],o=[];if(this.app.webs[0])return this.app.webs.forEach(n=>{if(n.configuration)if(n.configuration.name){let{name:i,roles:s}=n.configuration,p=u(this.app.directory,n.directory);o.push([` \u{1F4C2} ${i}`,{filePath:p||"/"}]),s.length>0&&o.push([" roles",s.join(", ")])}else n.configuration.roles.forEach(i=>{o.push([` \u{1F4C2} ${i}`,{filePath:u(this.app.directory,n.directory)}])});else o.push([{subdued:` \u{1F4C2} ${le}`},{filePath:u(this.app.directory,n.directory)}]);if(!this.app.errors.isEmpty()){let i=this.app.errors.getErrors(`${n.directory}/${b.web}`);t.push(...i.map(s=>s.message))}}),this.subtableSection("web",[["\u{1F4C2} web",""],...o,...t.map(n=>[{error:"error"},{error:this.formattedError(n)}])])}extensionsSections(){let t=this.app.allExtensions.filter(i=>i.isReturnedAsInfo()),n=x(t.map(i=>i.type)).map(i=>{let s=t.filter(p=>p.type===i);if(s[0])return this.subtableSection(s[0].externalType,s.flatMap(p=>this.extensionSubSection(p)))});return w(n)}extensionSubSection(t){let o=t.configuration,n=[[`\u{1F4C2} ${t.handle||ue}`,{filePath:u(this.app.directory,t.directory)}],[" config file",{filePath:u(t.directory,t.configurationPath)}]];o&&"metafields"in o&&Array.isArray(o.metafields)&&o.metafields.length>0&&n.push([" metafields",`${o.metafields.length}`]);let i=this.app.errors.getErrors(t.configurationPath);for(let s of i)n.push([{error:" error"},{error:this.formattedError(s.message)}]);return n}formattedError(t){let o=t.trim();if(k())return o;let[n,...i]=o.split(`
3
- `);return[`! ${n}`,...i.map(s=>` ${s}`)].join(`
4
- `)}async systemInfoSection(){let{platform:t,arch:o}=g();return this.tableSection("Tooling and System",[["Shopify CLI",f],["Package manager",this.project.packageManager],["OS",`${t}-${o}`],["Shell",process.env.SHELL??"unknown"],["Node version",process.version]])}tableSection(t,o,{isFirstItem:n=!1}={}){return{title:`${n?"":`
5
- `}${t.toUpperCase()}
6
- `,body:{tabularData:o,firstColumnSubdued:!0}}}subtableSection(t,o){return{title:t,body:{tabularData:o,firstColumnSubdued:!0}}}};var re=se(ae(),1);var j=class r extends K{static summary="Print basic information about your app and extensions.";static descriptionWithMarkdown=`The information returned includes the following:
7
-
8
- - The app and dev store that's used when you run the [dev](https://shopify.dev/docs/api/shopify-cli/app/app-dev) command. You can reset these configurations using [\`dev --reset\`](https://shopify.dev/docs/api/shopify-cli/app/app-dev#flags-propertydetail-reset).
9
- - The [structure](https://shopify.dev/docs/apps/tools/cli/structure) of your app project.
10
- - The [access scopes](https://shopify.dev/docs/api/usage) your app has requested.
11
- - System information, including the package manager and version of Shopify CLI used in the project.`;static get jsonOutputSchema(){return d}static description=this.descriptionForHelp();static flags={...R,...D,...L,"web-env":re.Flags.boolean({hidden:!1,description:"Outputs environment variables necessary for running and deploying web/.",env:"SHOPIFY_FLAG_OUTPUT_WEB_ENV",default:!1})};async run(){let{flags:t}=await this.parse(r),{app:o,project:n,remoteApp:i,organization:s}=await Y({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config,unsafeTolerateErrors:!0});if(t.json||t["web-env"]){let p=await ee(o,i,s,n,{webEnv:t["web-env"]});oe(p,t.json?"json":"text")}else await ne({app:o,remoteApp:i,organization:s,project:n});return o.errors.isEmpty()||process.exit(2),{app:o}}};export{j as a};
@@ -1 +0,0 @@
1
- import{Eb as f,db as E,pb as h,xb as g}from"./chunk-JLQRDFR5.js";import{b as P}from"./chunk-YTUUU33R.js";import{d as m}from"./chunk-IWTNUJGY.js";import{e as O,g as i}from"./chunk-VKWPEFWQ.js";i();i();i();var R=new Set(["THROTTLED","429"]),b=new Set(["ACCESS_DENIED","access_denied"]);function I(e){return Array.isArray(e)?e.flatMap(t=>{let s=[],n=t,r=n?.extensions?.code;typeof r=="string"&&s.push(r);let o=n?.extensions?.app_errors?.errors;if(Array.isArray(o))for(let p of o){let l=p?.category;typeof l=="string"&&s.push(l)}return s}):[]}function T(e){return e!==void 0&&R.has(e)}function _(e){return e!==void 0&&b.has(e)}function S(e){return I(e).some(T)}i();var C=new Set([502,503,504]);function x(e){return e!==void 0&&C.has(e)}var A=O(P(),1),a;(function(e){e[e.Abort=0]="Abort",e[e.AbortSilent=1]="AbortSilent",e[e.Bug=2]="Bug"})(a||(a={}));var y=class extends Error{},c=class extends Error{tryMessage;type;nextSteps;formattedMessage;customSections;code;details;skipOclifErrorHandling;constructor(t,s,n=null,r,o){let p=typeof t=="string"||"value"in t;super(p?f(t):E(t)),n?n instanceof h?this.tryMessage=f(n):this.tryMessage=n:this.tryMessage=null,this.type=s,this.nextSteps=r,this.customSections=o,this.skipOclifErrorHandling=!0,p||(this.formattedMessage=t)}},d=class extends c{constructor(t,s=null,n,r){super(t,a.Abort,s,n,r)}},w=class extends c{command;args;constructor(t,s,n,r=null){super(t,a.Abort,r),this.command=s,this.args=n}},M=class extends c{constructor(){super("",a.AbortSilent)}},u=class extends c{constructor(t,s=null){super(t,a.Bug,s)}};async function z(e){let t;if(k(e))t=e;else if(typeof e=="string")t=new u(e);else if(e instanceof Error)t=new u(e.message),t.stack=e.stack;else{let o=e;t=new u(o?.message??"Unknown error"),o?.stack&&(t.stack=o?.stack)}let{jsonOutputEnabled:s}=await import("./environment-O7ECODHU.js"),{commandEventOutputMode:n}=await import("./command-event-context-LFUZ7UCA.js");if(s()||n()==="json"){let{renderFatalErrorAsJson:o}=await import("./json-error-S5XFS3UX.js");return o(t),await g(),e}let{renderFatalError:r}=await import("./ui-VJTNGCS6.js");return r(t),Promise.resolve(e)}function J(e){if(e instanceof A.Errors.CLIError){let t=new d(e.message);return t.stack=e.stack,Promise.resolve(t)}else return Promise.resolve(e)}function k(e){try{return Object.prototype.hasOwnProperty.call(e,"type")}catch{return!1}}function Q(e){if(!k(e)){if(e instanceof Error){if(v(e))return!1;let t=e.message;return!L(t)}return!0}return e.type===a.Bug}function v(e){let t=e;if(typeof t.response!="object"||t.response===null||t.request===void 0)return!1;let s=t.response.status;return s===401||s===429||x(s)?!0:S(t.response.errors)}function W(e){return m(e).replace("file:/","/").replace(/^\/?[A-Z]:/,"")}function L(e){return["EPERM: operation not permitted, scandir","EPERM: operation not permitted, rename","EACCES: permission denied","EPERM: operation not permitted, symlink","This version of npm supports the following node versions","EBUSY: resource busy or locked","ENOTEMPTY: directory not empty","getaddrinfo ENOTFOUND","Client network socket disconnected before secure TLS connection was established","spawn EPERM","socket hang up","The user aborted a request.","write EPIPE","Unsupported platform"].some(n=>e.includes(n))}export{I as a,T as b,_ as c,x as d,a as e,y as f,c as g,d as h,w as i,M as j,u as k,z as l,J as m,Q as n,W as o};
@@ -1 +0,0 @@
1
- import{o as R}from"./chunk-USXIXANP.js";import{a as k}from"./chunk-PWAT52M4.js";import{c as D}from"./chunk-QW52RPAU.js";import{e as S}from"./chunk-QFWWCZOI.js";import{s as A}from"./chunk-H6GYBLVQ.js";import{r as v}from"./chunk-YKMINHYY.js";import{a as E}from"./chunk-YV2TP44L.js";import{N as g}from"./chunk-GQLNG537.js";import{A as b,B as P,C}from"./chunk-D2KIGKBI.js";import{Bb as M,ua as O,wb as j}from"./chunk-JLQRDFR5.js";import{b as e,i as T}from"./chunk-FZCGRIOM.js";import{c as u,e as h,g as y,p as w}from"./chunk-IWTNUJGY.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();import{resolve as x}from"node:path";var I=e.object({name:e.string(),category:e.string()}),L=e.object({key:e.string(),namespace:e.string(),name:e.string(),description:e.string().nullish(),type:I}),a={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"},$=e.object(Object.fromEntries(Object.keys(a).map(t=>[t,e.array(L)]))),N=e.object({ownerType:e.string().describe("The upstream owner type, such as PRODUCT or COMPANY_LOCATION."),key:e.string(),namespace:e.string(),name:e.string(),description:e.string().nullable(),type:e.object({name:e.string().describe("The upstream metafield type, such as single_line_text_field."),category:e.string().describe("The upstream metafield category.")}).strict()}).strict(),F=S({name:"ThemeMetafieldsPullResult",schema:e.union([e.object({status:e.enum(["success","partial"]),changed:e.literal(!0),path:e.string().refine(y).describe("The absolute path of the native language-server metafields JSON artifact."),definitions:e.array(N).describe("All fetched definitions, flattened across owner types."),failedOwnerTypes:e.array(e.string()).describe("Upstream owner types whose fetch failed.")}).strict(),e.object({status:e.literal("skipped"),reason:e.literal("not-a-theme")}).strict()]),definitions:{MetafieldDefinition:N},project:t=>{let i=t;if(i.status==="failed")throw new Error("Failed downloads must use the fatal error envelope.");return i.status==="skipped"?i.reason==="cancelled"?{status:"cancelled"}:{status:"skipped",reason:i.reason}:{status:i.failedOwnerTypes.length?"partial":"success",changed:!0,path:x(i.path),definitions:Object.entries(i.definitions).flatMap(([r,o])=>o.map(n=>({ownerType:a[r],key:n.key,namespace:n.namespace,name:n.name,description:n.description??null,type:{name:n.type.name,category:n.type.category}}))),failedOwnerTypes:i.failedOwnerTypes}}});s();function _(t,i,r=!1){t.status==="downloaded"&&t.failedOwnerTypes.length>0&&M(`Failed to fetch metafield definitions for the following owner types: ${t.failedOwnerTypes.join(", ")}`),!r&&(i==="json"?(t.status==="failed"&&T({type:"diagnostic",level:"error",message:"Failed to fetch metafield definitions."}),j(F.encode(t))):t.status==="downloaded"?t.failedOwnerTypes.length>0?P({body:`Metafield definitions were partially downloaded. Failed owner types: ${t.failedOwnerTypes.join(", ")}.`}):b({body:"Metafield definitions have been successfully downloaded."}):t.status==="failed"&&C({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"}}]}))}s();async function me(t){let i=await J(t);_(i,"text",t.silent)}async function J(t){k({verbose:t.verbose,noColor:t.noColor});let i=v({store:t.store}),r=await g(i,t.password);return U(r,{path:h(t.path??w()),force:t.force??!1})}async function U(t,i){let{force:r,path:o}=i;if(!await R(o)){if(process.env.SHOPIFY_LANGUAGE_SERVER==="1")return{status:"skipped",reason:"not-a-theme"};if(!await D(r))return{status:"skipped",reason:"cancelled"}}let n=[],f=[];for(let[l,c]of Object.entries(a))n.push(A(c,t).catch(m=>(f.push(c),[])).then(m=>({[l]:m})));let p=(await Promise.all(n)).reduce((l,c)=>({...l,...c})),d=Object.values(a).filter(l=>f.includes(l));return d.length===Object.values(a).length?{status:"failed",failedOwnerTypes:d}:{status:"downloaded",path:await G(o,p),definitions:p,failedOwnerTypes:d}}async function G(t,i){let r=await E(t),o=u(r,"metafields.json"),n=JSON.stringify(i,null,2);return O(o,n),o}export{F as a,_ as b,me as c,J as d};
@@ -1,6 +0,0 @@
1
- import{a as L}from"./chunk-26PWHH3B.js";import{N as H}from"./chunk-U2T5HPRD.js";import{t as W}from"./chunk-33ZE3DRQ.js";import{a as X}from"./chunk-VJEKDBGZ.js";import{a as D,d as T,x as k}from"./chunk-D2KIGKBI.js";import{h as S}from"./chunk-M5VIFG2V.js";import{Ba as I,Bb as p,Sa as A,Ta as y,ab as w,ma as O,va as g}from"./chunk-JLQRDFR5.js";import{g as N}from"./chunk-LHXFTFFM.js";import{c as x,d as m,f as v,h as P}from"./chunk-IWTNUJGY.js";import{e as J,g as u}from"./chunk-VKWPEFWQ.js";u();function _(){return process.hrtime()}function U(r){let t=process.hrtime(r);return(t[0]*1e3+t[1]/1e6).toFixed(2)}u();u();var $=J(X(),1),q=200,K=6e4,M=200,Y=500,Q=["**/node_modules/**","**/.git/**","**/.shopify/**","**/.DS_Store","**/*.swp","**/*.swo","**/*~"],b=class{currentEvents=[];extensionPaths=[];app;options;onChangeCallback;watcher;debouncedEmit;ignored={};extensionWatchedFiles=new Map;constructor(t,e,s=q){this.app=t,this.options=e,this.debouncedEmit=k(this.emitEvents.bind(this),s,{leading:!0,trailing:!0}),this.updateApp(t)}onChange(t){this.onChangeCallback=t}async start(){let e=[...this.app.configuration.extension_directories??["extensions"]].map(a=>x(this.app.directory,a));await Promise.all(e.map(async a=>{try{await g(a.replace(/\/\*+$/,""))}catch{}}));let s=[this.app.configPath,...e],i=this.getAllWatchedFiles();s.push(...i),this.close();let{default:n}=await import("./chokidar-5RWEYTNQ.js"),o=new Map;this.watcher=n.watch(s,{ignored:[...Q,a=>{let d=m(a);return this.app.realExtensions.some(c=>{if(!c.isFunctionExtension)return!1;let h=m(x(c.directory,P(c.outputRelativePath)));return d===h||d.startsWith(`${h}/`)})||Z(d,o)}],persistent:!0,ignoreInitial:!0}),this.watcher.on("all",this.handleFileEvent),this.addAbortListener(),p(`File watcher started with ${s.length} paths`,this.options.stdout)}updateApp(t){this.app=t,this.extensionPaths=this.app.nonConfigExtensions.map(e=>m(e.directory)).filter(e=>e!==this.app.directory),this.extensionPaths.forEach(e=>{this.ignored[e]??=this.createIgnoreInstance(e)})}addAbortListener(){this.options.signal.removeEventListener("abort",this.close),this.options.signal.addEventListener("abort",this.close)}getAllWatchedFiles(){this.extensionWatchedFiles.clear();let t=this.app.realExtensions.map(s=>({extension:s,watchedFiles:s.watchedFiles()})),e=new Set;for(let{extension:s,watchedFiles:i}of t)for(let n of i){let o=m(n);e.add(o);let a=this.extensionWatchedFiles.get(o)??new Set;a.add(s.handle),this.extensionWatchedFiles.set(o,a)}return Array.from(e)}emitEvents=()=>{let t=this.currentEvents;this.currentEvents=[];let e=`\u{1F509} ${t.length} EVENTS EMITTED in files: ${t.map(s=>s.path).join(`
2
- `)}`;p(e,this.options.stdout),this.onChangeCallback?.(t)};pushEvent(t){this.shouldIgnoreEvent(t)||(t.type==="extension_folder_created"&&(this.ignored[t.path]=this.createIgnoreInstance(t.path)),!this.currentEvents.some(e=>e.path===t.path&&e.type===t.type&&e.extensionHandle===t.extensionHandle)&&this.currentEvents.push(t))}shouldIgnoreEvent(t){if(t.type==="extension_folder_deleted"||t.type==="extension_folder_created"||t.extensionHandle&&this.extensionWatchedFiles.get(m(t.path))?.has(t.extensionHandle))return!1;let s=(t.extensionHandle?this.app.realExtensions.find(n=>n.handle===t.extensionHandle):void 0)?.watchedFiles(),i=this.ignored[t.extensionPath];if(s)return!s.some(o=>w(t.path,o));if(i){let n=v(t.extensionPath,t.path);return i.ignores(n)}return!1}handleFileEvent=(t,e)=>{let s=_(),i=m(e),n=e===this.app.configPath,o=e.endsWith(".extension.toml");if(p(`\u{1F300}: ${t} ${e.replace(this.app.directory,"")}
3
- `),n)this.handleEventForExtension(t,e,this.app.directory,s,!1);else{let a=this.extensionWatchedFiles.get(i),d=a===void 0||a.size===0;if(d&&t==="add"&&!o){let l=this.discoverFileOwners(i);l.size>0&&(this.extensionWatchedFiles.set(i,l),a=l,d=!1)}if(d&&!o&&!n){p(`\u{1F300}: File ${e} is not watched by any extension`,this.options.stdout);return}for(let l of a??[]){let c=this.app.realExtensions.find(E=>E.handle===l),h=c?m(c.directory):this.app.directory;this.handleEventForExtension(t,e,h,s,!1,l)}d&&this.handleEventForExtension(t,e,this.app.directory,s,!0)}this.debouncedEmit()};discoverFileOwners(t){let e=new Set;for(let s of this.app.realExtensions){let i=m(s.directory);i!==this.app.directory&&t.startsWith(`${i}/`)&&this.pathMatchesWatchPatterns(t,s)&&e.add(s.handle)}return e}pathMatchesWatchPatterns(t,e){let{paths:s,ignore:i}=e.watchPatterns(),n=v(m(e.directory),t);return i.some(o=>w(n,o))?!1:s.some(o=>w(n,o))}handleEventForExtension(t,e,s,i,n,o){let a=e.endsWith(".extension.toml"),d=e===this.app.configPath;switch(t){case"change":if(n)break;a||d?this.pushEvent({type:"extensions_config_updated",path:e,extensionPath:s,extensionHandle:o,startTime:i}):this.pushEvent({type:"file_updated",path:e,extensionPath:s,extensionHandle:o,startTime:i});break;case"add":if(!a){this.pushEvent({type:"file_created",path:e,extensionPath:s,extensionHandle:o,startTime:i});break}let l=0,c=P(e),h=setInterval(()=>{y(x(c,W.lockFile))?(p(`Waiting for extension to complete creation: ${e}
4
- `),l+=M):(clearInterval(h),this.extensionPaths.push(c),this.pushEvent({type:"extension_folder_created",path:c,extensionPath:s,startTime:i}),this.debouncedEmit()),l>=K&&(clearInterval(h),this.options.stderr.write(`Error loading new extension at path: ${e}.
5
- Please restart the process.`))},M);break;case"unlink":if(e.endsWith(W.lockFile))break;d?this.pushEvent({type:"app_config_deleted",path:e,extensionPath:s,startTime:i}):a?(this.extensionPaths=this.extensionPaths.filter(E=>E!==s),this.pushEvent({type:"extension_folder_deleted",path:s,extensionPath:s,startTime:i})):setTimeout(()=>{this.extensionPaths.includes(s)&&(this.pushEvent({type:"file_deleted",path:e,extensionPath:s,extensionHandle:o,startTime:i}),this.extensionWatchedFiles.delete(m(e)),this.debouncedEmit())},Y);break;case"addDir":case"unlinkDir":break}}close=()=>{this.watcher&&(p("Closing file watcher",this.options.stdout),this.watcher.close().then(()=>p("File watching closed",this.options.stdout)).catch(t=>p(`File watching failed to close: ${t.message}`,this.options.stderr)))};createIgnoreInstance(t){let e=x(t,".gitignore");if(!y(e))return;let s=O(e).toString().split(`
6
- `).map(i=>i.trim()).filter(i=>i!==""&&!i.startsWith("#"));return $.default.default().add(s)}};function Z(r,t){let e=r.split("/");for(let s=e.length-1;s>0;s--){if(e[s]!=="target")continue;let i=e.slice(0,s).join("/"),n=t.get(i);if(n===void 0&&(n=y(x(i,"Cargo.toml")),t.set(i,n)),n)return!0}return!1}u();u();function j(r,t,e=!0){let s=r.realExtensions,i=s.map(c=>c.uid),n=t.realExtensions,o=n.map(c=>c.uid),a=n.filter(c=>!i.includes(c.uid)),d=s.filter(c=>!o.includes(c.uid)),l;return e&&(l=n.filter(c=>{let h=s.find(F=>F.uid===c.uid);if(!h)return!1;let E=JSON.stringify(h.configuration)!==JSON.stringify(c.configuration),R=h.configurationPath!==c.configurationPath;return E||R})),{created:a,updated:l??[],deleted:d}}async function V(r,t,e){if(r[0]===void 0)return;let s=r.some(o=>B.includes(o.type)),i=r.filter(o=>!B.includes(o.type));if(s)return it({event:r[0],app:t,options:e,extensions:[]});let n={app:t,extensionEvents:[],path:r[0].path,startTime:r[0].startTime};for(let o of i){let a=o.extensionHandle?t.realExtensions.filter(l=>l.handle===o.extensionHandle):t.realExtensions.filter(l=>l.directory===o.extensionPath),d=tt[o.type]({event:o,app:n.app,extensions:a,options:e});n.extensionEvents.push(...d.extensionEvents)}return n}var B=["extensions_config_updated","extension_folder_created"],tt={extension_folder_deleted:et,file_created:C,file_deleted:C,file_updated:C,app_config_deleted:st,extension_folder_created:z,extensions_config_updated:z};function et({event:r,app:t,extensions:e}){let s=e.map(i=>(t.removeExtension(i.uid),{type:f.Deleted,extension:i}));return{app:t,extensionEvents:s,startTime:r.startTime,path:r.path}}function C({event:r,app:t,extensions:e}){let s=e.map(i=>({type:f.Updated,extension:i}));return{app:t,extensionEvents:s,startTime:r.startTime,path:r.path}}function z(r){return{app:r.app,extensionEvents:[],startTime:r.event.startTime,path:r.event.path}}function st(r){throw new S("The active app.toml was deleted, exiting")}async function it({event:r,app:t}){let e=await nt(t),s=j(t,e,!0),i=s.created.map(d=>({type:f.Created,extension:d})),n=s.deleted.map(d=>({type:f.Deleted,extension:d})),o=s.updated.map(d=>({type:f.Updated,extension:d})),a=[...i,...n,...o];return{app:e,extensionEvents:a,startTime:r.startTime,path:r.path,appWasReloaded:!0}}async function nt(r){let t=_();try{let e=await H(r);return p(`App reloaded [${U(t)}ms]`),e}catch(e){let s=new Error(`Error reloading app: ${e.message}`);throw s.cause="validation-error",s}}u();import{formatMessagesSync as ot}from"esbuild";import rt from"events";var f;(function(r){r.Updated="changed",r.Deleted="deleted",r.Created="created"})(f||(f={}));var G=class extends rt{buildOutputPath;app;options;appURL;started=!1;ready=!1;initialEvents=[];fileWatcher;constructor(t,e,s,i){super(),this.app=t,this.appURL=e,this.buildOutputPath=s??x(t.directory,".shopify","dev-bundle"),this.options={stdout:process.stdout,stderr:process.stderr,signal:new D().signal},this.fileWatcher=i}async start(t,e=!0){this.started||(this.started=!0,this.options=t??this.options,await A(this.buildOutputPath)&&await I(this.buildOutputPath,{force:!0}),await g(this.buildOutputPath),e&&(this.initialEvents=this.app.realExtensions.map(s=>({type:f.Updated,extension:s})),await this.buildExtensions(this.initialEvents)),this.fileWatcher=this.fileWatcher??new b(this.app,this.options),this.fileWatcher.onChange(s=>{V(s,this.app,this.options).then(async i=>{if(i?.extensionEvents.length===0&&p("Change detected, but no extensions were affected"),!i)return;this.app=i.app,i.appWasReloaded&&this.fileWatcher?.updateApp(this.app),await this.rescanImports(i);let n=i.extensionEvents.filter(o=>o.type!==f.Deleted);await this.buildExtensions(n),i.appWasReloaded||await this.app.generateExtensionTypes(),await this.deleteExtensionsBuildOutput(i),this.emit("all",i)}).catch(i=>{this.emit("error",i)})}),await this.fileWatcher.start(),this.ready=!0,this.emit("ready",{app:this.app,extensionEvents:this.initialEvents}))}onEvent(t){return this.addListener("all",t),this}onStart(t){if(this.ready){let e={app:this.app,extensionEvents:this.initialEvents,startTime:[0,0],path:""};t(e)?.catch(()=>{})}else this.once("ready",t);return this}onError(t){return this.addListener("error",t),this}async deleteExtensionsBuildOutput(t){let s=t.extensionEvents.filter(i=>i.type===f.Deleted).map(i=>i.extension).map(async i=>{let n=x(this.buildOutputPath,i.getOutputFolderId());return I(n,{force:!0})});await Promise.all(s)}async buildExtensions(t){let e=L(t,n=>n.extension.uid),s=[];for(let n of Object.values(e))n.length>0&&n[0]&&s.push({extension:n[0].extension,events:n});let i=s.map(async({extension:n,events:o})=>T({outputPrefix:n.handle,stripAnsi:!1},async()=>{try{await this.buildExtension(n);let a={status:"ok",uid:n.uid};o.forEach(d=>{d.buildResult=a})}catch(a){let d=a.errors??[],l=a.message,c;if(d.length){let E=d[0];l=E?.text,c=E?.location?.file,ot(d,{kind:"error",color:!N()}).forEach(F=>{this.options.stderr.write(F)})}else this.options.stderr.write(a.message);let h={status:"error",error:l,file:c,uid:n.uid};o.forEach(E=>{E.buildResult=h})}}));return Promise.all(i)}async buildExtension(t){let e={app:this.app,stdout:this.options.stdout,stderr:this.options.stderr,useTasks:!1,environment:"development",appURL:this.appURL};await t.buildForBundle(e,this.buildOutputPath)}async rescanImports(t){if(t.path.endsWith(".toml"))return;let s=t.extensionEvents.filter(i=>i.type!==f.Deleted).map(i=>i.extension);s.length>0&&(await Promise.all(s.map(async o=>o.rescanImports()))).some(o=>o)&&await this.fileWatcher?.start()}};export{_ as a,U as b,f as c,G as d};