@shopify/cli 4.8.4 → 4.9.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 (490) hide show
  1. package/dist/analytics-QK4RFCB6.js +1 -0
  2. package/dist/analytics-R6I5APDB.js +1 -0
  3. package/dist/assets/hydrogen/starter/package.json +1 -1
  4. package/dist/bootstrap.js +1 -3
  5. package/dist/chunk-22LJALHJ.js +7 -0
  6. package/dist/{chunk-APUYMORT.js → chunk-23K3B23N.js} +1 -1
  7. package/dist/chunk-2KLXRVGQ.js +317 -0
  8. package/dist/{chunk-QXR5DJC2.js → chunk-2LZQM5JG.js} +1 -1
  9. package/dist/chunk-2OHSGC4Q.js +1 -0
  10. package/dist/chunk-2Q3WIH7S.js +6 -0
  11. package/dist/{chunk-FRRA5MI2.js → chunk-2W6M7YDY.js} +1 -1
  12. package/dist/{chunk-NHOF2IN6.js → chunk-2YFB3PTV.js} +9 -9
  13. package/dist/chunk-2YRVHJEY.js +4 -0
  14. package/dist/{chunk-3CZ7DKE5.js → chunk-3AASYIOA.js} +3 -3
  15. package/dist/chunk-3DMDSAWK.js +20 -0
  16. package/dist/{chunk-KWQGJ3VC.js → chunk-3SG5EJFC.js} +1 -1
  17. package/dist/chunk-3T2WMZHC.js +1 -0
  18. package/dist/{chunk-773TIA5M.js → chunk-3VYOLEQE.js} +2 -2
  19. package/dist/chunk-3WVEL423.js +1 -0
  20. package/dist/{chunk-SVYHWGMI.js → chunk-3ZK5JZLY.js} +1 -1
  21. package/dist/chunk-44QTWXOJ.js +8 -0
  22. package/dist/{chunk-4QBJ5JBX.js → chunk-4A7FPJVT.js} +16 -15
  23. package/dist/chunk-4TQFTZVD.js +18 -0
  24. package/dist/chunk-4WACZNFF.js +1 -0
  25. package/dist/{chunk-RIM7FNP3.js → chunk-4XSYMLQG.js} +1 -1
  26. package/dist/{chunk-EJJPEWSB.js → chunk-4Y22EM45.js} +1 -1
  27. package/dist/chunk-53U6XS3J.js +1 -0
  28. package/dist/chunk-55NKAIIT.js +1 -0
  29. package/dist/chunk-55PABKRC.js +5 -0
  30. package/dist/chunk-5BLXN5WU.js +1 -0
  31. package/dist/{chunk-LAMTFOVF.js → chunk-5BYVVXGD.js} +1 -1
  32. package/dist/{chunk-Z5KYKXMH.js → chunk-5HEBS5DG.js} +3 -3
  33. package/dist/{chunk-LEW5IJK6.js → chunk-5HONV6NQ.js} +1 -1
  34. package/dist/chunk-5RL6DKWR.js +5 -0
  35. package/dist/chunk-5XO6PAMV.js +1 -0
  36. package/dist/chunk-6DHY67FO.js +6 -0
  37. package/dist/{chunk-6QADNGH4.js → chunk-6GA56I3E.js} +1 -1
  38. package/dist/chunk-6IL3B5Z5.js +4 -0
  39. package/dist/{chunk-RHBLXZGU.js → chunk-6ILP6QCH.js} +1 -1
  40. package/dist/{chunk-H7TDIRIU.js → chunk-6RBCFXJT.js} +1 -1
  41. package/dist/{chunk-WAJRWCZY.js → chunk-72HS7MHV.js} +1 -1
  42. package/dist/{chunk-SPNM3GES.js → chunk-74HXMIDM.js} +1 -1
  43. package/dist/{chunk-ZAH6QID2.js → chunk-77B77IGP.js} +1 -1
  44. package/dist/chunk-7DRKDQRT.js +1 -0
  45. package/dist/chunk-7HDJBEBP.js +3 -0
  46. package/dist/chunk-7IGMIDKK.js +15 -0
  47. package/dist/chunk-7QQPAT4L.js +1 -0
  48. package/dist/chunk-7Y4X5I6N.js +1 -0
  49. package/dist/{chunk-WGFGWDWP.js → chunk-7ZSN2QT5.js} +1 -1
  50. package/dist/chunk-A54V5UCD.js +5 -0
  51. package/dist/{chunk-VETLNJ56.js → chunk-AD4S2VEI.js} +1 -1
  52. package/dist/chunk-ADW7ECNU.js +7 -0
  53. package/dist/chunk-AS2O62JX.js +1 -0
  54. package/dist/chunk-ASUARYJD.js +1 -0
  55. package/dist/chunk-B4RPJYDH.js +1 -0
  56. package/dist/{chunk-ZCNNJCTQ.js → chunk-BJOJNAKH.js} +1 -1
  57. package/dist/chunk-BL5JWD3Y.js +16 -0
  58. package/dist/chunk-BOFCBTX7.js +1 -0
  59. package/dist/chunk-BPIQ4YTW.js +1 -0
  60. package/dist/chunk-C6FZII5S.js +1 -0
  61. package/dist/{chunk-NBXXTQWA.js → chunk-CACPRKUF.js} +1 -1
  62. package/dist/{chunk-QVO5CAJN.js → chunk-CHLSNYF7.js} +1 -1
  63. package/dist/chunk-CMICT4XI.js +1 -0
  64. package/dist/chunk-CPFAATMO.js +6 -0
  65. package/dist/{chunk-CSOCXWP6.js → chunk-CSRNHTHO.js} +2 -2
  66. package/dist/chunk-D3K42KBL.js +9 -0
  67. package/dist/chunk-DGMRL5DQ.js +1 -0
  68. package/dist/chunk-DKJPE42V.js +2 -0
  69. package/dist/{chunk-AIILEPSK.js → chunk-DYA5UUXL.js} +1 -1
  70. package/dist/chunk-E5ND6RBL.js +1 -0
  71. package/dist/{chunk-XKHKXUQY.js → chunk-E75DJTAF.js} +1 -1
  72. package/dist/chunk-ECEOBSGD.js +1 -0
  73. package/dist/{chunk-NDT3F2PR.js → chunk-EYSZRIUL.js} +1 -1
  74. package/dist/chunk-FCULF3JA.js +1 -0
  75. package/dist/chunk-FL34EOXG.js +1 -0
  76. package/dist/chunk-FW5HGFSZ.js +20 -0
  77. package/dist/{chunk-XRJCD3AO.js → chunk-G54BKNIX.js} +1 -1
  78. package/dist/{chunk-74CYT3VX.js → chunk-G7OIACY5.js} +1 -1
  79. package/dist/{chunk-IHH5XTPV.js → chunk-GALDYSEX.js} +1 -1
  80. package/dist/{chunk-A5U4KKNV.js → chunk-GDQLA5NB.js} +1 -1
  81. package/dist/{chunk-6A3TDSON.js → chunk-GJJBOCKD.js} +3 -3
  82. package/dist/{chunk-TAY7HU7X.js → chunk-GQZPGTG7.js} +20 -20
  83. package/dist/{chunk-XHXKPRF5.js → chunk-GVRFO4CV.js} +1 -1
  84. package/dist/chunk-HB3MJYBK.js +1 -0
  85. package/dist/{chunk-AEUCDGTB.js → chunk-HDQXFGYG.js} +1 -1
  86. package/dist/chunk-HSTNTHWM.js +1 -0
  87. package/dist/{chunk-A3U7JDUC.js → chunk-HSZC2LBB.js} +1 -1
  88. package/dist/chunk-I4FGM6UH.js +8 -0
  89. package/dist/chunk-I7GYNNCU.js +6 -0
  90. package/dist/{chunk-ZVA5F4QC.js → chunk-IBTQO3JD.js} +1 -1
  91. package/dist/{chunk-XWXAFJFC.js → chunk-IISE7SBT.js} +1 -1
  92. package/dist/chunk-IUZZWXJG.js +3 -0
  93. package/dist/chunk-IWML2HLC.js +5 -0
  94. package/dist/{chunk-CTNBSUVU.js → chunk-JA2QZ635.js} +2 -2
  95. package/dist/chunk-JOJRABPY.js +3 -0
  96. package/dist/chunk-JQKB3D37.js +1 -0
  97. package/dist/chunk-JROJL6RV.js +1 -0
  98. package/dist/{chunk-GINXNPAR.js → chunk-JTPVSO6Y.js} +1 -1
  99. package/dist/chunk-JWDUSMCA.js +1 -0
  100. package/dist/{chunk-CBMX6XI7.js → chunk-KLYJDAP6.js} +1 -1
  101. package/dist/{chunk-4HOJJCZ6.js → chunk-KVROYIUQ.js} +1 -1
  102. package/dist/chunk-L5XWYTHY.js +836 -0
  103. package/dist/chunk-LOTGSNS5.js +2 -0
  104. package/dist/{chunk-FGRW7GT4.js → chunk-LQLFMDVD.js} +1 -1
  105. package/dist/{chunk-7LZ34C4S.js → chunk-LSWFHTJT.js} +1 -1
  106. package/dist/{chunk-HYPY5WH6.js → chunk-LV2IWYGL.js} +1 -1
  107. package/dist/{chunk-W4SGAPPR.js → chunk-LYPNQFWX.js} +1 -1
  108. package/dist/{chunk-U6URYCC6.js → chunk-MRVQ6XRW.js} +1 -1
  109. package/dist/chunk-MVVHISCR.js +2 -0
  110. package/dist/{chunk-UJBMY5WR.js → chunk-N4DE5H65.js} +1 -1
  111. package/dist/{chunk-W6ST525S.js → chunk-N56BJ3F7.js} +1 -1
  112. package/dist/{chunk-W4SQE6NR.js → chunk-NF7MOA4K.js} +1 -1
  113. package/dist/{chunk-7KLPRSQR.js → chunk-NGN7U2UF.js} +1 -1
  114. package/dist/{chunk-TCFGEOE4.js → chunk-NTVEJYKI.js} +1 -1
  115. package/dist/chunk-NYABB6XW.js +1 -0
  116. package/dist/{chunk-DH3DMUE2.js → chunk-O6E7YL7N.js} +2 -2
  117. package/dist/chunk-OASB6XPV.js +16 -0
  118. package/dist/{chunk-WY7QF7VU.js → chunk-OBYY45BX.js} +1 -1
  119. package/dist/chunk-OETFY7FE.js +28 -0
  120. package/dist/{chunk-QZEDYQVT.js → chunk-OEZATTOS.js} +1 -1
  121. package/dist/{chunk-D6LQ56XT.js → chunk-OG7SF4FU.js} +1 -1
  122. package/dist/chunk-OM243CQ6.js +6 -0
  123. package/dist/chunk-P3Z5RLVV.js +3 -0
  124. package/dist/{chunk-HINK4QAR.js → chunk-PBBZNGS4.js} +1 -1
  125. package/dist/chunk-PGTKKP2B.js +11 -0
  126. package/dist/chunk-PK4ID32C.js +1 -0
  127. package/dist/{chunk-7FVCUY54.js → chunk-PVOWU77O.js} +1 -1
  128. package/dist/{chunk-66HW6J57.js → chunk-PXD2WJOI.js} +3 -3
  129. package/dist/chunk-PXXTSW6I.js +4 -0
  130. package/dist/{chunk-AU7GNCOK.js → chunk-PZHE37Z4.js} +1 -1
  131. package/dist/{chunk-TA2M37OB.js → chunk-Q34PKJRR.js} +1 -1
  132. package/dist/{chunk-S5H5U3PR.js → chunk-Q3O3AFZT.js} +1 -1
  133. package/dist/chunk-Q45XAEG2.js +16 -0
  134. package/dist/{chunk-QKTBYAUD.js → chunk-QAXFCAOV.js} +5 -5
  135. package/dist/{chunk-FY47X4NG.js → chunk-QBGSSUJP.js} +1 -1
  136. package/dist/chunk-QILWHHAQ.js +1 -0
  137. package/dist/chunk-QJST4LZX.js +1 -0
  138. package/dist/chunk-QQN4PJZD.js +1 -0
  139. package/dist/{chunk-6P5FGN6P.js → chunk-QSKOR3ED.js} +1 -1
  140. package/dist/{chunk-FRVRTOTF.js → chunk-QTEWTPAQ.js} +2 -2
  141. package/dist/chunk-QWDJRSJJ.js +1 -0
  142. package/dist/{chunk-GTAYTMCP.js → chunk-R757TSQ6.js} +1 -1
  143. package/dist/chunk-RCIU7NHA.js +1 -0
  144. package/dist/chunk-RGIUP4FW.js +1 -0
  145. package/dist/{chunk-RDS2WYQH.js → chunk-RHNFWHFY.js} +1 -1
  146. package/dist/{chunk-VG3YVCZW.js → chunk-S7536EWZ.js} +4 -4
  147. package/dist/{chunk-VBICZDA4.js → chunk-SDFO7P2M.js} +1 -1
  148. package/dist/{chunk-JQPPLSFT.js → chunk-SDJNAUU6.js} +1 -1
  149. package/dist/chunk-SGBLCVUX.js +1 -0
  150. package/dist/chunk-SJARQZVN.js +3 -0
  151. package/dist/chunk-SKRUMRB4.js +383 -0
  152. package/dist/{chunk-5Z6EW3FA.js → chunk-SW5EWGBJ.js} +1 -1
  153. package/dist/chunk-SXPWOYLT.js +7 -0
  154. package/dist/chunk-T234RERA.js +7 -0
  155. package/dist/chunk-TJJVX7CU.js +4 -0
  156. package/dist/{chunk-L4LDNEFK.js → chunk-TMV37ENR.js} +1 -1
  157. package/dist/{chunk-BYX7SQPM.js → chunk-TNXZWQZU.js} +1 -1
  158. package/dist/{chunk-67QK26HI.js → chunk-TO7TXDLU.js} +1 -1
  159. package/dist/chunk-TSLZNTFM.js +3 -0
  160. package/dist/{chunk-BG7QQU23.js → chunk-UFU2LGFK.js} +1 -1
  161. package/dist/chunk-VDDNDA5K.js +15 -0
  162. package/dist/{chunk-T4V7KOGJ.js → chunk-VFO5OYQ4.js} +1 -1
  163. package/dist/{chunk-HXVUDGLH.js → chunk-VFP3PUGZ.js} +24 -24
  164. package/dist/{chunk-6QDOCBD4.js → chunk-VZUHMW5E.js} +4 -3
  165. package/dist/chunk-W7CBJNXD.js +12 -0
  166. package/dist/chunk-WCAGYCT7.js +4 -0
  167. package/dist/{chunk-DPNZWBT5.js → chunk-WNO2V53C.js} +1 -1
  168. package/dist/{chunk-Y4BBTWM5.js → chunk-WPUQTUDX.js} +1 -1
  169. package/dist/chunk-WU7MSL3I.js +8 -0
  170. package/dist/chunk-WXV35TPE.js +1 -0
  171. package/dist/{chunk-2WATX3XV.js → chunk-XBSWZ6BT.js} +6 -6
  172. package/dist/chunk-XCNJL7ES.js +1 -0
  173. package/dist/{chunk-C4Y7PQDQ.js → chunk-XFZDFDZV.js} +1 -1
  174. package/dist/chunk-XTYSJIZY.js +1 -0
  175. package/dist/chunk-Y5ZN62VF.js +1 -0
  176. package/dist/{chunk-PNNW7YQG.js → chunk-YAH5WFYR.js} +3 -3
  177. package/dist/{chunk-DUNE3INK.js → chunk-YBQKJHZW.js} +1 -1
  178. package/dist/chunk-YD66PU3Y.js +1 -0
  179. package/dist/chunk-YGFEUXKQ.js +1 -0
  180. package/dist/chunk-YJWNM4XO.js +18 -0
  181. package/dist/{chunk-L3JBKCAS.js → chunk-YQQHBFMA.js} +1 -1
  182. package/dist/chunk-YRHFPXC3.js +1 -0
  183. package/dist/chunk-YTJ3EPD3.js +1 -0
  184. package/dist/chunk-YX5GRXRS.js +2368 -0
  185. package/dist/chunk-Z35PUKKP.js +7 -0
  186. package/dist/{chunk-7VQBIGJB.js → chunk-Z3XIZMEM.js} +1 -1
  187. package/dist/chunk-ZGASBRSQ.js +5 -0
  188. package/dist/{chunk-OY6L7J53.js → chunk-ZHJ6KA43.js} +1 -1
  189. package/dist/{chunk-YHTONNIZ.js → chunk-ZO4IBP4B.js} +1 -1
  190. package/dist/chunk-ZOYSMJ27.js +1 -0
  191. package/dist/chunk-ZPCCSPAE.js +3 -0
  192. package/dist/chunk-ZSJXZCAW.js +4 -0
  193. package/dist/{chunk-CP56F5UR.js → chunk-ZSVR5NEO.js} +1 -1
  194. package/dist/{chunk-JJJIRCQP.js → chunk-ZUVAHONX.js} +1 -1
  195. package/dist/chunk-ZVDFCUJT.js +2 -0
  196. package/dist/cli/commands/app/app-logs/sources.js +1 -1
  197. package/dist/cli/commands/app/build.js +1 -1
  198. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  199. package/dist/cli/commands/app/bulk/execute.js +1 -1
  200. package/dist/cli/commands/app/bulk/status.js +1 -1
  201. package/dist/cli/commands/app/config/link.js +1 -1
  202. package/dist/cli/commands/app/config/pull.js +1 -1
  203. package/dist/cli/commands/app/config/use.js +1 -1
  204. package/dist/cli/commands/app/config/validate.js +1 -1
  205. package/dist/cli/commands/app/demo/watcher.js +1 -1
  206. package/dist/cli/commands/app/deploy.js +1 -1
  207. package/dist/cli/commands/app/dev/clean.js +1 -1
  208. package/dist/cli/commands/app/dev.js +1 -1
  209. package/dist/cli/commands/app/env/pull.js +1 -1
  210. package/dist/cli/commands/app/env/show.js +1 -1
  211. package/dist/cli/commands/app/execute.js +1 -1
  212. package/dist/cli/commands/app/function/build.js +1 -1
  213. package/dist/cli/commands/app/function/info.js +1 -1
  214. package/dist/cli/commands/app/function/replay.js +1 -1
  215. package/dist/cli/commands/app/function/run.js +1 -1
  216. package/dist/cli/commands/app/function/schema.js +1 -1
  217. package/dist/cli/commands/app/function/typegen.js +1 -1
  218. package/dist/cli/commands/app/generate/extension.js +1 -1
  219. package/dist/cli/commands/app/graphiql.js +1 -1
  220. package/dist/cli/commands/app/import/channel-config.js +1 -0
  221. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -0
  222. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -0
  223. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  224. package/dist/cli/commands/app/import-extensions.js +1 -1
  225. package/dist/cli/commands/app/info.js +1 -1
  226. package/dist/cli/commands/app/init.js +1 -1
  227. package/dist/cli/commands/app/logs.js +1 -1
  228. package/dist/cli/commands/app/release.js +1 -1
  229. package/dist/cli/commands/app/security/check.js +1 -0
  230. package/dist/cli/commands/app/security/clean.js +1 -0
  231. package/dist/cli/commands/app/security/instructions.js +1 -0
  232. package/dist/cli/commands/app/security/record.js +1 -0
  233. package/dist/cli/commands/app/security/review.js +1 -0
  234. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  235. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  236. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  237. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  238. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  239. package/dist/cli/commands/app/versions/list.js +1 -1
  240. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  241. package/dist/cli/commands/auth/login.d.ts +16 -1
  242. package/dist/cli/commands/auth/login.js +1 -1
  243. package/dist/cli/commands/auth/logout.d.ts +16 -1
  244. package/dist/cli/commands/auth/logout.js +1 -1
  245. package/dist/cli/commands/cache/clear.js +1 -1
  246. package/dist/cli/commands/config/autoupgrade/off.d.ts +13 -0
  247. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  248. package/dist/cli/commands/config/autoupgrade/on.d.ts +13 -0
  249. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  250. package/dist/cli/commands/config/autoupgrade/status.d.ts +13 -0
  251. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  252. package/dist/cli/commands/debug/command-flags.js +1 -1
  253. package/dist/cli/commands/doc/fetch.d.ts +2 -0
  254. package/dist/cli/commands/doc/fetch.js +1 -1
  255. package/dist/cli/commands/doc/search.d.ts +1 -0
  256. package/dist/cli/commands/doc/search.js +1 -1
  257. package/dist/cli/commands/docs/generate.js +1 -1
  258. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  259. package/dist/cli/commands/doctor-release/theme/index.d.ts +1 -0
  260. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  261. package/dist/cli/commands/help.d.ts +431 -1
  262. package/dist/cli/commands/help.js +1 -1
  263. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  264. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  265. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  266. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  267. package/dist/cli/commands/notifications/generate.js +1 -1
  268. package/dist/cli/commands/notifications/list.js +1 -1
  269. package/dist/cli/commands/organization/list.js +1 -1
  270. package/dist/cli/commands/search.d.ts +11 -1
  271. package/dist/cli/commands/search.js +1 -1
  272. package/dist/cli/commands/send-analytics.js +1 -1
  273. package/dist/cli/commands/theme/check.js +1 -1
  274. package/dist/cli/commands/theme/console.js +1 -1
  275. package/dist/cli/commands/theme/delete.js +1 -1
  276. package/dist/cli/commands/theme/dev.js +1 -1
  277. package/dist/cli/commands/theme/duplicate.js +1 -1
  278. package/dist/cli/commands/theme/info.js +1 -1
  279. package/dist/cli/commands/theme/init.js +1 -1
  280. package/dist/cli/commands/theme/language-server.js +1 -1
  281. package/dist/cli/commands/theme/list.js +1 -1
  282. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  283. package/dist/cli/commands/theme/open.js +1 -1
  284. package/dist/cli/commands/theme/package.js +1 -1
  285. package/dist/cli/commands/theme/preview.js +1 -1
  286. package/dist/cli/commands/theme/profile.js +1 -1
  287. package/dist/cli/commands/theme/publish.js +1 -1
  288. package/dist/cli/commands/theme/pull.js +1 -1
  289. package/dist/cli/commands/theme/push.js +1 -1
  290. package/dist/cli/commands/theme/rename.js +1 -1
  291. package/dist/cli/commands/theme/share.js +1 -1
  292. package/dist/cli/commands/upgrade.js +1 -1
  293. package/dist/cli/commands/version.d.ts +15 -1
  294. package/dist/cli/commands/version.js +1 -1
  295. package/dist/cli/help.d.ts +5 -2
  296. package/dist/cli/help.js +6 -2
  297. package/dist/cli/services/commands/auth/login/types.d.ts +11 -0
  298. package/dist/cli/services/commands/auth/login/types.js +7 -0
  299. package/dist/cli/services/commands/config/autoupgrade/index.d.ts +3 -0
  300. package/dist/cli/services/commands/config/autoupgrade/index.js +9 -0
  301. package/dist/cli/services/commands/config/autoupgrade/result.d.ts +2 -0
  302. package/dist/cli/services/commands/config/autoupgrade/result.js +15 -0
  303. package/dist/cli/services/commands/config/autoupgrade/types.d.ts +10 -0
  304. package/dist/cli/services/commands/config/autoupgrade/types.js +7 -0
  305. package/dist/cli/services/commands/doc/fetch.d.ts +1 -1
  306. package/dist/cli/services/commands/doc/fetch.js +11 -2
  307. package/dist/cli/services/commands/help/index.d.ts +3 -0
  308. package/dist/cli/services/commands/help/index.js +51 -0
  309. package/dist/cli/services/commands/help/result.d.ts +2 -0
  310. package/dist/cli/services/commands/help/result.js +6 -0
  311. package/dist/cli/services/commands/help/types.d.ts +431 -0
  312. package/dist/cli/services/commands/help/types.js +71 -0
  313. package/dist/cli/services/commands/search/index.d.ts +2 -0
  314. package/dist/cli/services/commands/search/index.js +8 -0
  315. package/dist/cli/services/commands/search/result.d.ts +2 -0
  316. package/dist/cli/services/commands/search/result.js +12 -0
  317. package/dist/cli/services/commands/search/types.d.ts +10 -0
  318. package/dist/cli/services/commands/search/types.js +7 -0
  319. package/dist/cli/services/commands/version/index.d.ts +2 -0
  320. package/dist/cli/services/commands/version/index.js +5 -0
  321. package/dist/cli/services/commands/version/result.d.ts +2 -0
  322. package/dist/cli/services/commands/version/result.js +6 -0
  323. package/dist/cli/services/commands/version/types.d.ts +10 -0
  324. package/dist/cli/services/commands/version/types.js +7 -0
  325. package/dist/command-json-schema-Y3N2NUZN.js +1 -0
  326. package/dist/command-registry.js +1 -1
  327. package/dist/{conf-store-H3UAVGN5.js → conf-store-5ZA3ILWV.js} +1 -1
  328. package/dist/custom-oclif-loader-VQKMCXNH.js +1 -0
  329. package/dist/deprecations-PFQXWNF6.js +1 -0
  330. package/dist/dist-4X53WJBQ.js +1 -0
  331. package/dist/dist-5M2V3YCM.js +1 -0
  332. package/dist/environment-ZUTBXY7U.js +1 -0
  333. package/dist/environments-3RUZ7F4Q.js +1 -0
  334. package/dist/error-FBSXLW22.js +1 -0
  335. package/dist/error-handler-D5BURRJ7.js +1 -0
  336. package/dist/fs-ZLV5W4TV.js +1 -0
  337. package/dist/hooks/did-you-mean.js +1 -1
  338. package/dist/hooks/hydrogen-init.js +1 -1
  339. package/dist/hooks/plugin-plugins.js +1 -1
  340. package/dist/hooks/postrun.js +1 -1
  341. package/dist/hooks/prerun.js +1 -1
  342. package/dist/hooks/public-metadata.js +1 -1
  343. package/dist/hooks/sensitive-metadata.js +1 -1
  344. package/dist/hooks/tunnel-provider.js +1 -1
  345. package/dist/hooks/tunnel-start.js +1 -1
  346. package/dist/http-proxy-node16-D3JUYA5D.js +38 -0
  347. package/dist/index.js +13 -14
  348. package/dist/is-global-GZ5CIXQA.js +1 -0
  349. package/dist/json-error-2BL3UZ7H.js +1 -0
  350. package/dist/lib-AD2G3QH3.js +1 -0
  351. package/dist/lib-VEVNMHDE.js +1 -0
  352. package/dist/lib-ZQW4E7QU.js +1 -0
  353. package/dist/local-KAZJAYLX.js +1 -0
  354. package/dist/metadata-M3ZE24WB.js +1 -0
  355. package/dist/{morph-BMYYMQNX.js → morph-42EXMN3K.js} +3 -3
  356. package/dist/node-package-manager-RVPONQBY.js +1 -0
  357. package/dist/notifications-system-MYEMV7JF.js +1 -0
  358. package/dist/os-DRUILZZR.js +1 -0
  359. package/dist/output-SDE274Y5.js +1 -0
  360. package/dist/{path-MBXP7ZIC.js → path-6YMSTSWG.js} +1 -1
  361. package/dist/system-5FQ3L5PA.js +1 -0
  362. package/dist/tsconfig.tsbuildinfo +1 -1
  363. package/dist/ui-TEZZM7SE.js +1 -0
  364. package/dist/uncaught-error-handler.d.ts +6 -0
  365. package/dist/uncaught-error-handler.js +33 -0
  366. package/dist/upgrade-3PIVJYBL.js +1 -0
  367. package/dist/version-FMWTVLMF.js +1 -0
  368. package/dist/version-IAMVSP7U.js +1 -0
  369. package/dist/workerd-WRW4ZUYM.js +18 -0
  370. package/oclif.manifest.json +2646 -226
  371. package/package.json +17 -8
  372. package/dist/analytics-M4OC7RPG.js +0 -1
  373. package/dist/analytics-RGIJMP4U.js +0 -1
  374. package/dist/chunk-2HW6VRJT.js +0 -2
  375. package/dist/chunk-2HYR6EUD.js +0 -1
  376. package/dist/chunk-2IRRFPEY.js +0 -1
  377. package/dist/chunk-2KD4LHRT.js +0 -5
  378. package/dist/chunk-2SL443J6.js +0 -1
  379. package/dist/chunk-2VJ6NBPV.js +0 -15
  380. package/dist/chunk-2ZROBXJX.js +0 -11
  381. package/dist/chunk-3DIRCEXA.js +0 -1
  382. package/dist/chunk-3DT4NS4S.js +0 -4
  383. package/dist/chunk-3IQ6WXDD.js +0 -3
  384. package/dist/chunk-43FRAUV6.js +0 -19
  385. package/dist/chunk-44QD4QNO.js +0 -1
  386. package/dist/chunk-4DLRS7MT.js +0 -12
  387. package/dist/chunk-4F3XYIEY.js +0 -1
  388. package/dist/chunk-4OMKKYFC.js +0 -9
  389. package/dist/chunk-4ZTRKEA2.js +0 -1
  390. package/dist/chunk-5DMFEDKY.js +0 -28
  391. package/dist/chunk-66G2HJ2A.js +0 -3
  392. package/dist/chunk-6B727IUY.js +0 -5
  393. package/dist/chunk-6C5AVMKR.js +0 -375
  394. package/dist/chunk-6CR2EEZ3.js +0 -6
  395. package/dist/chunk-6V6UNUMM.js +0 -3
  396. package/dist/chunk-6XLFFOPK.js +0 -1
  397. package/dist/chunk-A3V2A2I4.js +0 -2
  398. package/dist/chunk-AQPOPSQ7.js +0 -1
  399. package/dist/chunk-BAWBC66R.js +0 -5
  400. package/dist/chunk-BHJ3TGS7.js +0 -1
  401. package/dist/chunk-BHTHUKHU.js +0 -1
  402. package/dist/chunk-BV62ZERJ.js +0 -6
  403. package/dist/chunk-CFQ5G2QS.js +0 -1
  404. package/dist/chunk-CNK3ZO2B.js +0 -836
  405. package/dist/chunk-CRALWNNO.js +0 -1
  406. package/dist/chunk-CVW2HMQO.js +0 -317
  407. package/dist/chunk-D6QTOQEJ.js +0 -6
  408. package/dist/chunk-DDZEYA2I.js +0 -8
  409. package/dist/chunk-DO4SRE4M.js +0 -3
  410. package/dist/chunk-DZZORIWL.js +0 -4
  411. package/dist/chunk-EQ2PD2ZA.js +0 -2
  412. package/dist/chunk-ERBXXVOZ.js +0 -2
  413. package/dist/chunk-FW3RORD7.js +0 -1
  414. package/dist/chunk-G2YTINLI.js +0 -6
  415. package/dist/chunk-GCN4O7HM.js +0 -1
  416. package/dist/chunk-GGPMDCCB.js +0 -8
  417. package/dist/chunk-GJHBAOGJ.js +0 -1
  418. package/dist/chunk-H2HR2AQE.js +0 -7
  419. package/dist/chunk-HYM3HBDG.js +0 -20
  420. package/dist/chunk-IHEBV2KO.js +0 -1
  421. package/dist/chunk-JWHQPDOK.js +0 -3
  422. package/dist/chunk-JXG2T76F.js +0 -6
  423. package/dist/chunk-K2DP5Z76.js +0 -1
  424. package/dist/chunk-KUZ5Z6HM.js +0 -1
  425. package/dist/chunk-KZU727AL.js +0 -1
  426. package/dist/chunk-L2DCUVZV.js +0 -1
  427. package/dist/chunk-L3M7PTHU.js +0 -15
  428. package/dist/chunk-LBA6FGKC.js +0 -3
  429. package/dist/chunk-LX5UXWZ7.js +0 -1
  430. package/dist/chunk-M7VQLMSW.js +0 -1
  431. package/dist/chunk-MBRFIXCU.js +0 -1705
  432. package/dist/chunk-MYLMGH7Y.js +0 -1
  433. package/dist/chunk-NKC3K3XP.js +0 -1
  434. package/dist/chunk-O72SHE3Q.js +0 -7
  435. package/dist/chunk-OAG72Q2O.js +0 -1
  436. package/dist/chunk-OPOPO7DG.js +0 -7
  437. package/dist/chunk-OUA6EOLX.js +0 -11
  438. package/dist/chunk-OYCAYEQE.js +0 -7
  439. package/dist/chunk-PGWQHSDV.js +0 -1
  440. package/dist/chunk-PM3HRKPR.js +0 -1
  441. package/dist/chunk-POMWFTBD.js +0 -16
  442. package/dist/chunk-R3GLEZSE.js +0 -4
  443. package/dist/chunk-RHNZA4IL.js +0 -5
  444. package/dist/chunk-SCLGMVNB.js +0 -1
  445. package/dist/chunk-TU47HMTL.js +0 -1
  446. package/dist/chunk-UPGRXCFS.js +0 -4
  447. package/dist/chunk-V2GLAK2W.js +0 -1
  448. package/dist/chunk-V4774HTF.js +0 -1
  449. package/dist/chunk-VDGTHMIQ.js +0 -3
  450. package/dist/chunk-VJ5YOXKL.js +0 -1
  451. package/dist/chunk-WGUCRVII.js +0 -3
  452. package/dist/chunk-X4V2CD2H.js +0 -8
  453. package/dist/chunk-XOYICV6P.js +0 -1
  454. package/dist/chunk-XYUTD6IU.js +0 -1
  455. package/dist/chunk-YNFXYVYN.js +0 -2
  456. package/dist/chunk-Z2HN5L6G.js +0 -6
  457. package/dist/chunk-ZVJD6CUY.js +0 -18
  458. package/dist/cli/commands/app/doctor/instructions.js +0 -1
  459. package/dist/cli/commands/app/doctor.js +0 -1
  460. package/dist/cli/commands/config/autoupgrade/constants.d.ts +0 -4
  461. package/dist/cli/commands/config/autoupgrade/constants.js +0 -1
  462. package/dist/cli/services/commands/search.d.ts +0 -1
  463. package/dist/cli/services/commands/search.js +0 -7
  464. package/dist/cli/services/commands/version.d.ts +0 -1
  465. package/dist/cli/services/commands/version.js +0 -6
  466. package/dist/custom-oclif-loader-BWAMUFQ4.js +0 -1
  467. package/dist/deprecations-TEUM7CML.js +0 -1
  468. package/dist/dist-62I5X3FS.js +0 -1
  469. package/dist/dist-YHZ5BTYD.js +0 -1
  470. package/dist/environments-LAFWOQWO.js +0 -1
  471. package/dist/error-6ZCGAC5E.js +0 -1
  472. package/dist/error-handler-JNCW56EC.js +0 -1
  473. package/dist/fs-QEWOWUPQ.js +0 -1
  474. package/dist/http-proxy-node16-A6AKKRQH.js +0 -38
  475. package/dist/is-global-UYMEAGDR.js +0 -1
  476. package/dist/lib-2BR2WN7L.js +0 -1
  477. package/dist/lib-M72BVWQ3.js +0 -1
  478. package/dist/lib-P3APEIHY.js +0 -1
  479. package/dist/local-Z4ZEMWE4.js +0 -1
  480. package/dist/metadata-ZCQMB5AB.js +0 -1
  481. package/dist/node-package-manager-HMOTOBDS.js +0 -1
  482. package/dist/notifications-system-RT3CY6LZ.js +0 -1
  483. package/dist/os-G6KDPJMC.js +0 -1
  484. package/dist/output-BJCZYDNG.js +0 -1
  485. package/dist/system-T4H2ISV6.js +0 -1
  486. package/dist/ui-4MQSY5IN.js +0 -1
  487. package/dist/upgrade-4234MIYJ.js +0 -1
  488. package/dist/version-FRSRSCRX.js +0 -1
  489. package/dist/version-RF7QQXRX.js +0 -1
  490. package/dist/workerd-7E4H2DM3.js +0 -18
@@ -1 +1 @@
1
- import{a as d,b as f,c as g,d as x,g as C}from"./chunk-EQ2PD2ZA.js";import{a as c}from"./chunk-VJ5YOXKL.js";import{a as l}from"./chunk-GINXNPAR.js";import{wa as m}from"./chunk-CVW2HMQO.js";import{b as p}from"./chunk-K2DP5Z76.js";import{z as s}from"./chunk-6C5AVMKR.js";import{a as I}from"./chunk-CTNBSUVU.js";import{e as y,g as r}from"./chunk-VKWPEFWQ.js";r();var h=y(I(),1);var o=class u extends c{static description="Import dashboard-managed extensions into your app.";static flags={...p,...l,"client-id":h.Flags.string({hidden:!1,description:"The Client ID of your app.",env:"SHOPIFY_FLAG_CLIENT_ID",exclusive:["config"]})};async run(){let{flags:i}=await this.parse(u),e=await m({directory:i.path,clientId:i["client-id"],forceRelink:i.reset,userProvidedConfigName:i.config}),t=await C({developerPlatformClient:e.developerPlatformClient,apiKey:e.remoteApp.apiKey,organizationId:e.remoteApp.organizationId,extensionTypes:g}),n=d(t);if(n.length===0)s({headline:["No extensions to migrate."]});else{let a=await f(n);await x({...e,extensions:t,extensionTypes:a.extensionTypes,buildExtensionConfig:a.buildExtensionConfig})}return{app:e.app}}};export{o as a};
1
+ import{a as d,b as f,c as g,d as x,g as C}from"./chunk-MVVHISCR.js";import{a as c}from"./chunk-YGFEUXKQ.js";import{a as l}from"./chunk-JTPVSO6Y.js";import{Ha as m}from"./chunk-2KLXRVGQ.js";import{b as p}from"./chunk-DGMRL5DQ.js";import{z as s}from"./chunk-SKRUMRB4.js";import{b as I}from"./chunk-JA2QZ635.js";import{e as y,g as a}from"./chunk-VKWPEFWQ.js";a();var h=y(I(),1);var o=class u extends c{static description="Import dashboard-managed extensions into your app.";static flags={...p,...l,"client-id":h.Flags.string({hidden:!1,description:"The Client ID of your app.",env:"SHOPIFY_FLAG_CLIENT_ID",exclusive:["config"]})};async run(){let{flags:i}=await this.parse(u),e=await m({directory:i.path,clientId:i["client-id"],forceRelink:i.reset,userProvidedConfigName:i.config}),t=await C({developerPlatformClient:e.developerPlatformClient,apiKey:e.remoteApp.apiKey,organizationId:e.remoteApp.organizationId,extensionTypes:g}),n=d(t);if(n.length===0)s({headline:["No extensions to migrate."]});else{let r=await f(n);await x({...e,extensions:t,extensionTypes:r.extensionTypes,buildExtensionConfig:r.buildExtensionConfig})}return{app:e.app}}};export{o as a};
@@ -0,0 +1 @@
1
+ import{a as p}from"./chunk-ZUVAHONX.js";import{a as r,b as c}from"./chunk-SDFO7P2M.js";import{d as s}from"./chunk-4Y22EM45.js";import{a}from"./chunk-YGFEUXKQ.js";import{Ha as n}from"./chunk-2KLXRVGQ.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var t=class d extends a{static summary="Schedules manual-billing subscriptions to migrate to Shopify-managed app pricing.";static descriptionWithMarkdown="Schedules manual-billing subscriptions to migrate to Shopify-managed app pricing.\n\nWhen `--input` is omitted, the command reads CSV data from stdin. Use `--input <path>` to read from a file. `--input -` is also supported as an explicit stdin path.\n\n- Required CSV columns: `shop_id`, `target_plan_handle`, and `price_behavior`.\n- Optional CSV column: `notification`.\n- Example header: `shop_id,target_plan_handle,price_behavior,notification`.\n- Example row: `123456789,pro,HONOR_BILLING_PRICE,WHEN_REQUIRED`.\n\n`price_behavior` must be `HONOR_BILLING_PRICE` or `PLAN_PRICE`. `notification` can be `OPT_OUT` or `WHEN_REQUIRED` and defaults to `WHEN_REQUIRED` when omitted or blank.\n\nValidation is atomic: the command submits no operations unless the entire CSV is valid. Valid rows are submitted in batches of 250 shops. Preserve every operation GID printed by the command so you can check or cancel the submitted operations.\n\nRun the command from an app project. By default, it uses the Client ID from the active app configuration. Use `--path` to select an app directory or `--config` to select a configuration. Pass `--client-id` to select a different app within the project. Use `--reset` to relink the app.\n\nUse `--force` to skip confirmation and immediately submit every valid row. With `--watch`, human-readable output shows accepted identifiers before polling begins, then displays operation progress and the final outcome. With `--json --watch`, the command outputs one structured JSON document after every operation reaches a terminal status.";static description=this.descriptionWithoutMarkdown();static examples=["<%= config.bin %> <%= command.id %> --input migrations.csv --force","cat migrations.csv | <%= config.bin %> <%= command.id %> --force","<%= config.bin %> <%= command.id %> --input migrations.csv --path ../my-app --config staging --force --json","<%= config.bin %> <%= command.id %> --input migrations.csv --client-id <client-id> --force","<%= config.bin %> <%= command.id %> --input - --force --watch"];static flags={...s};async run(){let{flags:i}=await this.parse(d),{app:m,remoteApp:l}=await n({directory:i.path,clientId:i["client-id"],forceRelink:i.reset,userProvidedConfigName:i.config}),u=await p({action:"schedule",input:i.input??"-",clientId:l.apiKey,skipConfirmation:i.force,watch:i.watch,...i.watch&&!i.json?{onSubmissionAccepted:r}:{}}),e=c(u,{json:i.json,watch:i.watch});return e!==0&&(process.exitCode=e),{app:m}}};export{t as a};
@@ -0,0 +1,6 @@
1
+ import{b as s,c as i,d as p}from"./chunk-QILWHHAQ.js";import{b as e,c as r}from"./chunk-DGMRL5DQ.js";import{b as o}from"./chunk-FW5HGFSZ.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();var t=class n extends o{static summary="Enable automatic upgrades for Shopify CLI.";static descriptionWithMarkdown=`Enable automatic upgrades for Shopify CLI.
2
+
3
+ When auto-upgrade is enabled, Shopify CLI automatically updates to the latest version once per day. Major version upgrades are skipped and must be done manually.
4
+
5
+ To disable auto-upgrade, run \`shopify config autoupgrade off\`.
6
+ `;static description=this.descriptionForHelp();static flags={...e,...r};static get jsonOutputSchema(){return i}async run(){let{flags:u}=await this.parse(n),d=s(!0);p(d,u.json?"json":"text")}};export{t as a};
@@ -1 +1 @@
1
- import{D as h,E as e,F as r,J as o,K as s,n}from"./chunk-6C5AVMKR.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();async function y(){await h({message:"Associate your project with the org Castile Ventures?",choices:[{label:"first",value:"first",disabled:!0},{label:"second",value:"second"},{label:"third (limit reached)",value:"third",disabled:!0},{label:"fourth (limit reached)",value:"fourth",disabled:!0},{label:"fifth",value:"fifth",group:"Automations",disabled:!0},{label:"sixth",value:"sixth",group:"Automations"},{label:"seventh",value:"seventh"},{label:"eighth (limit reached)",value:"eighth",group:"Merchant Admin",disabled:!0},{label:"ninth",value:"ninth",group:"Merchant Admin"},{label:"tenth",value:"tenth"}],infoTable:[{header:"add",items:["new-ext"],bullet:"+"},{header:"remove",items:["integrated-demand-ext","order-discount"],bullet:"-"}]}),await o({message:"App project name (can be changed later)",defaultValue:"expansive commerce app",validate:t=>{if(t.includes("shopify"))return`Can't include "shopify" in the name`}});let l=[{label:"first",value:"first"},{label:"second",value:"second"},{label:"third",value:"third"},{label:"fourth",value:"fourth"},{label:"fifth",value:"fifth"},{label:"sixth",value:"sixth"},{label:"seventh",value:"seventh"},{label:"eighth",value:"eighth"},{label:"ninth",value:"ninth"},{label:"tenth",value:"tenth"},{label:"eleventh",value:"eleventh"},{label:"twelfth",value:"twelfth"},{label:"thirteenth",value:"thirteenth"},{label:"fourteenth",value:"fourteenth"},{label:"fifteenth",value:"fifteenth"},{label:"sixteenth",value:"sixteenth"},{label:"seventeenth",value:"seventeenth"},{label:"eighteenth",value:"eighteenth"},{label:"nineteenth",value:"nineteenth"},{label:"twentieth",value:"twentieth"},{label:"twenty-first",value:"twenty-first"},{label:"twenty-second",value:"twenty-second"},{label:"twenty-third",value:"twenty-third"},{label:"twenty-fourth",value:"twenty-fourth"},{label:"twenty-fifth",value:"twenty-fifth"},{label:"twenty-sixth",value:"twenty-sixth"},{label:"twenty-seventh",value:"twenty-seventh"},{label:"twenty-eighth",value:"twenty-eighth"},{label:"twenty-ninth",value:"twenty-ninth"},{label:"thirtieth",value:"thirtieth"},{label:"thirty-first",value:"thirty-first"},{label:"thirty-second",value:"thirty-second"},{label:"thirty-third",value:"thirty-third"},{label:"thirty-fourth",value:"thirty-fourth"},{label:"thirty-fifth",value:"thirty-fifth"},{label:"thirty-sixth",value:"thirty-sixth"},{label:"thirty-seventh",value:"thirty-seventh"},{label:"thirty-eighth",value:"thirty-eighth"},{label:"thirty-ninth",value:"thirty-ninth"},{label:"fortieth",value:"fortieth"},{label:"forty-first",value:"forty-first"},{label:"forty-second",value:"forty-second"},{label:"forty-third",value:"forty-third"},{label:"forty-fourth",value:"forty-fourth"},{label:"forty-fifth",value:"forty-fifth"},{label:"forty-sixth",value:"forty-sixth"},{label:"forty-seventh",value:"forty-seventh"},{label:"forty-eighth",value:"forty-eighth"},{label:"forty-ninth",value:"forty-ninth"},{label:"fiftieth",value:"fiftieth"}];await r({message:"Template",choices:l,search(t){return Promise.resolve({data:l.filter(f=>f.label.includes(t))})}});let a=[["first theme",{subdued:"(#1)"}],["second theme",{subdued:"(#2)"}]];await e({message:"Add the following themes to the store?",infoTable:{"":a},confirmationMessage:"Yes, add them",cancellationMessage:"Cancel"});let u={title:{color:"red",text:`${n.warning} This can't be undone.`},body:"The action you are executing should be confirmed to proceed."};await e({message:"Delete the following themes from the store?",infoTable:{"":a},infoMessage:u,confirmationMessage:"Yes, delete them",cancellationMessage:"Cancel",defaultValue:!1}),await e({message:["Make the following changes to your",{filePath:".env"},"file?"],defaultValue:!0,confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later"}),await s({message:"Release this version of Mega App?",infoTable:[{header:"Includes",items:["My subscription extension","Order discount function","Subscription cancelled trigger","Add subscription action"],bullet:"+"},{header:"Removes",items:["product-discount-function","product-subscription-extension"],bullet:"-"}],confirmation:"Mega App"})}export{y as a};
1
+ import{D as h,E as e,F as r,J as o,K as s,n}from"./chunk-SKRUMRB4.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();async function y(){await h({message:"Associate your project with the org Castile Ventures?",choices:[{label:"first",value:"first",disabled:!0},{label:"second",value:"second"},{label:"third (limit reached)",value:"third",disabled:!0},{label:"fourth (limit reached)",value:"fourth",disabled:!0},{label:"fifth",value:"fifth",group:"Automations",disabled:!0},{label:"sixth",value:"sixth",group:"Automations"},{label:"seventh",value:"seventh"},{label:"eighth (limit reached)",value:"eighth",group:"Merchant Admin",disabled:!0},{label:"ninth",value:"ninth",group:"Merchant Admin"},{label:"tenth",value:"tenth"}],infoTable:[{header:"add",items:["new-ext"],bullet:"+"},{header:"remove",items:["integrated-demand-ext","order-discount"],bullet:"-"}]}),await o({message:"App project name (can be changed later)",defaultValue:"expansive commerce app",validate:t=>{if(t.includes("shopify"))return`Can't include "shopify" in the name`}});let l=[{label:"first",value:"first"},{label:"second",value:"second"},{label:"third",value:"third"},{label:"fourth",value:"fourth"},{label:"fifth",value:"fifth"},{label:"sixth",value:"sixth"},{label:"seventh",value:"seventh"},{label:"eighth",value:"eighth"},{label:"ninth",value:"ninth"},{label:"tenth",value:"tenth"},{label:"eleventh",value:"eleventh"},{label:"twelfth",value:"twelfth"},{label:"thirteenth",value:"thirteenth"},{label:"fourteenth",value:"fourteenth"},{label:"fifteenth",value:"fifteenth"},{label:"sixteenth",value:"sixteenth"},{label:"seventeenth",value:"seventeenth"},{label:"eighteenth",value:"eighteenth"},{label:"nineteenth",value:"nineteenth"},{label:"twentieth",value:"twentieth"},{label:"twenty-first",value:"twenty-first"},{label:"twenty-second",value:"twenty-second"},{label:"twenty-third",value:"twenty-third"},{label:"twenty-fourth",value:"twenty-fourth"},{label:"twenty-fifth",value:"twenty-fifth"},{label:"twenty-sixth",value:"twenty-sixth"},{label:"twenty-seventh",value:"twenty-seventh"},{label:"twenty-eighth",value:"twenty-eighth"},{label:"twenty-ninth",value:"twenty-ninth"},{label:"thirtieth",value:"thirtieth"},{label:"thirty-first",value:"thirty-first"},{label:"thirty-second",value:"thirty-second"},{label:"thirty-third",value:"thirty-third"},{label:"thirty-fourth",value:"thirty-fourth"},{label:"thirty-fifth",value:"thirty-fifth"},{label:"thirty-sixth",value:"thirty-sixth"},{label:"thirty-seventh",value:"thirty-seventh"},{label:"thirty-eighth",value:"thirty-eighth"},{label:"thirty-ninth",value:"thirty-ninth"},{label:"fortieth",value:"fortieth"},{label:"forty-first",value:"forty-first"},{label:"forty-second",value:"forty-second"},{label:"forty-third",value:"forty-third"},{label:"forty-fourth",value:"forty-fourth"},{label:"forty-fifth",value:"forty-fifth"},{label:"forty-sixth",value:"forty-sixth"},{label:"forty-seventh",value:"forty-seventh"},{label:"forty-eighth",value:"forty-eighth"},{label:"forty-ninth",value:"forty-ninth"},{label:"fiftieth",value:"fiftieth"}];await r({message:"Template",choices:l,search(t){return Promise.resolve({data:l.filter(f=>f.label.includes(t))})}});let a=[["first theme",{subdued:"(#1)"}],["second theme",{subdued:"(#2)"}]];await e({message:"Add the following themes to the store?",infoTable:{"":a},confirmationMessage:"Yes, add them",cancellationMessage:"Cancel"});let u={title:{color:"red",text:`${n.warning} This can't be undone.`},body:"The action you are executing should be confirmed to proceed."};await e({message:"Delete the following themes from the store?",infoTable:{"":a},infoMessage:u,confirmationMessage:"Yes, delete them",cancellationMessage:"Cancel",defaultValue:!1}),await e({message:["Make the following changes to your",{filePath:".env"},"file?"],defaultValue:!0,confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later"}),await s({message:"Release this version of Mega App?",infoTable:[{header:"Includes",items:["My subscription extension","Order discount function","Subscription cancelled trigger","Add subscription action"],bullet:"+"},{header:"Removes",items:["product-discount-function","product-subscription-extension"],bullet:"-"}],confirmation:"Mega App"})}export{y as a};
@@ -1,19 +1,19 @@
1
- import{p as C,v as Y}from"./chunk-DO4SRE4M.js";import{$ as re,aa as H}from"./chunk-ZVA5F4QC.js";import{b as U}from"./chunk-K2DP5Z76.js";import{r as L}from"./chunk-6QADNGH4.js";import{y as w,z as E}from"./chunk-6C5AVMKR.js";import{h as P}from"./chunk-OAG72Q2O.js";import{a as oe}from"./chunk-CTNBSUVU.js";import{$a as A,Ab as j,N as I,Ta as N,ua as T,wb as p,xb as $,yb as G}from"./chunk-43FRAUV6.js";import{d as O,f as _,p as b}from"./chunk-773TIA5M.js";import{e as k,g as v}from"./chunk-VKWPEFWQ.js";v();v();var r=k(H(),1),l=k(re(),1);function se(e,t){return e instanceof Error&&"code"in e&&e.code==="ENOENT"&&"path"in e&&typeof e.path=="string"&&_(e.path)===_(t)}async function F(e,t){try{return await t()}catch(n){throw e!==void 0&&se(n,e)?new P(`Theme Check config file not found: ${e}`):n}}function ce(e){switch(e){case"error":return r.Severity.ERROR;case"suggestion":case"warning":return r.Severity.WARNING;case"style":case"info":return r.Severity.INFO;case"crash":return}}function W(e){switch(e){case r.Severity.ERROR:return"error";case r.Severity.WARNING:return"warning";case r.Severity.INFO:return"info"}}function ae(e){return new Map(e.map(t=>[t.uri,t.source]))}function ue(e,t,n){let o=e.split(`
2
- `).slice(t,n+1),s=o.length===1;return o.map((c,a)=>{let u=t+a+1,m=s?c.trim():c;return`${u} ${m}`}).join(`
1
+ import{p as C,v as Y}from"./chunk-P3Z5RLVV.js";import{$ as re,aa as q}from"./chunk-IBTQO3JD.js";import{b as H}from"./chunk-DGMRL5DQ.js";import{r as L}from"./chunk-6GA56I3E.js";import{y as w,z as E}from"./chunk-SKRUMRB4.js";import{i as $}from"./chunk-FCULF3JA.js";import{Ib as p,Kb as P,Lb as G,Nb as j,R as I,Xa as N,db as A,ya as T}from"./chunk-YJWNM4XO.js";import{b as oe}from"./chunk-JA2QZ635.js";import{d as O,f as S,p as b}from"./chunk-3VYOLEQE.js";import{e as k,g as v}from"./chunk-VKWPEFWQ.js";v();v();var r=k(q(),1),l=k(re(),1);function se(e,t){return e instanceof Error&&"code"in e&&e.code==="ENOENT"&&"path"in e&&typeof e.path=="string"&&S(e.path)===S(t)}async function F(e,t){try{return await t()}catch(n){throw e!==void 0&&se(n,e)?new $(`Theme Check config file not found: ${e}`):n}}function ce(e){switch(e){case"error":return r.Severity.ERROR;case"suggestion":case"warning":return r.Severity.WARNING;case"style":case"info":return r.Severity.INFO;case"crash":return}}function U(e){switch(e){case r.Severity.ERROR:return"error";case r.Severity.WARNING:return"warning";case r.Severity.INFO:return"info"}}function ae(e){return new Map(e.map(t=>[t.uri,t.source]))}function ue(e,t,n){let o=e.split(`
2
+ `).slice(t,n+1),s=o.length===1;return o.map((c,a)=>{let u=t+a+1,d=s?c.trim():c;return`${u} ${d}`}).join(`
3
3
  `)}function fe(e){switch(e){case r.Severity.ERROR:return{error:`
4
4
  [error]:`};case r.Severity.WARNING:return{warn:`
5
5
  [warning]:`};case r.Severity.INFO:return{info:`
6
- [info]:`}}}function he(e,t){return e.map((i,o)=>{let{message:s,uri:c,start:a,end:u,check:m,severity:d}=i,f=t.get(c),x=f===void 0?[]:[`
6
+ [info]:`}}}function he(e,t){return e.map((i,o)=>{let{message:s,uri:c,start:a,end:u,check:d,severity:m}=i,f=t.get(c),x=f===void 0?[]:[`
7
7
 
8
- ${ue(f,a.line,u.line)}`],S=o===e.length-1?"":`
8
+ ${ue(f,a.line,u.line)}`],_=o===e.length-1?"":`
9
9
 
10
- `;return[fe(d),{bold:m},{subdued:`
11
- ${s}`},...x,S]}).flat()}var de=(e,t)=>e.severity-t.severity;function q(e){let t=e.reduce((n,i)=>{let{uri:o}=i,s=r.path.fsPath(o);return n[s]??=[],n[s].push(i),n},{});return Object.keys(t).reduce((n,i)=>(n[i]=t[i].sort(de),n),{})}function B(e){return e.reduce((t,n)=>(!Object.prototype.hasOwnProperty.call(t,n.severity)&&(t[n.severity]=0),t[n.severity]++,t),{})}function M(e,t,n){let i=[`${n.length} files inspected`];if(e.length===0)i.push("with no offenses found.");else{i.push(`with ${e.length} total offenses found across ${Object.keys(t).length} files.`);let o=B(e);o[r.Severity.ERROR]&&i.push(`
10
+ `;return[fe(m),{bold:d},{subdued:`
11
+ ${s}`},...x,_]}).flat()}var me=(e,t)=>e.severity-t.severity;function W(e){let t=e.reduce((n,i)=>{let{uri:o}=i,s=r.path.fsPath(o);return n[s]??=[],n[s].push(i),n},{});return Object.keys(t).reduce((n,i)=>(n[i]=t[i].sort(me),n),{})}function B(e){return e.reduce((t,n)=>(t[n.severity]=(t[n.severity]??0)+1,t),{})}function M(e,t,n){let i=[`${n.length} files inspected`];if(e.length===0)i.push("with no offenses found.");else{i.push(`with ${e.length} total offenses found across ${Object.keys(t).length} files.`);let o=B(e);o[r.Severity.ERROR]&&i.push(`
12
12
  ${o[r.Severity.ERROR]} errors.`),o[r.Severity.WARNING]&&i.push(`
13
13
  ${o[r.Severity.WARNING]} warnings.`),o[r.Severity.INFO]&&i.push(`
14
- ${o[r.Severity.INFO]} info issues.`)}return i}function D(e,t,n,i){let o=ae(n);Object.keys(e).sort().forEach(c=>{let a=c.replace(t,"").slice(1);w({headline:i?`[${i}] ${a}`:a,body:he(e[c],o)})})}function J(e,t){return Object.entries(e).map(([n,i])=>{let o=i.map(c=>({check:c.check,severity:W(c.severity),start_row:c.start.line,start_column:c.start.character,end_row:c.end.line,end_column:c.end.character,message:c.message})),s=B(i);return{environment:t,path:n,offenses:o,errorCount:s[r.Severity.ERROR]??0,warningCount:s[r.Severity.WARNING]??0,infoCount:s[r.Severity.INFO]??0}})}function V(e,t){t||process.exit(0);let n=ce(t),i=n!==void 0&&e.some(o=>o.severity<=n);process.exit(i?1:0)}function me(e){return e.split(`
14
+ ${o[r.Severity.INFO]} info issues.`)}return i}function D(e,t,n,i){let o=ae(n);Object.keys(e).sort().forEach(c=>{let a=c.replace(t,"").slice(1);w({headline:i?`[${i}] ${a}`:a,body:he(e[c],o)})})}function J(e,t){return Object.entries(e).map(([n,i])=>{let o=i.map(c=>({check:c.check,severity:U(c.severity),start_row:c.start.line,start_column:c.start.character,end_row:c.end.line,end_column:c.end.character,message:c.message})),s=B(i);return{environment:t,path:n,offenses:o,errorCount:s[r.Severity.ERROR]??0,warningCount:s[r.Severity.WARNING]??0,infoCount:s[r.Severity.INFO]??0}})}function V(e,t){t||process.exit(0);let n=ce(t),i=n!==void 0&&e.some(o=>o.severity<=n);process.exit(i?1:0)}function de(e){return e.split(`
15
15
  `).map(t=>`# ${t}`).join(`
16
- `)}async function z(e){let t=".theme-check.yml",n=O(e,t);if(await N(n)){$(`${t} already exists at ${e}`);return}let{settings:i}=await(0,r.loadConfig)(void 0,e),o=me(l.default.stringify(i)),s=l.default.stringify({extends:"theme-check:recommended",ignore:["node_modules/**"]});await T(n,`${s}${o}`),G(`Created ${t} at ${e}`)}var pe=async(e,t)=>{let n=(0,r.applyFixToString)(e.source,t),i=r.path.fsPath(e.uri);await T(i,n)};async function K(e,t){await(0,r.autofix)(e,t,pe)}async function Q(e,t,n){let{ignore:i,settings:o,rootUri:s}=await F(t,()=>(0,r.loadConfig)(t,e)),c={extends:[],ignore:I(i??[]),rootUri:s,...o},a=n?{[n]:c}:c;p(l.default.stringify(a))}async function X(e,t,n){let{settings:i,ignore:o,checks:s}=await F(t,()=>(0,r.loadConfig)(t,e)),c=I(o??[]),u=Object.keys(i).reduce((d,f)=>{let{severity:x,enabled:S,...ee}=i[f];if(!S)return d;let te=W(x??r.Severity.INFO),g=s.find(ie=>ie.meta.code===f),ne=g&&g.meta?{description:g.meta.docs.description,doc:g.meta.docs.url}:{};return d[f]={severity:te,...ne,ignored_patterns:`[${c.join(", ")}]`,...ee},d},{}),m=n?{[n]:u}:u;p(l.default.stringify(m))}function Z(e){return"_handle"in e&&typeof e._handle=="object"&&e._handle!==null&&typeof e._handle.setBlocking=="function"}var h=k(oe(),1);var y=k(H(),1);var R=class extends Y{static summary="Validate the theme.";static descriptionWithMarkdown="Calls and runs [Theme Check](https://shopify.dev/docs/themes/tools/theme-check) to analyze your theme code for errors and to ensure that it follows theme and Liquid best practices. [Learn more about the checks that Theme Check runs.](https://shopify.dev/docs/themes/tools/theme-check/checks)";static description=this.descriptionWithoutMarkdown();static flags={...U,path:C.path,"auto-correct":h.Flags.boolean({char:"a",required:!1,description:"Automatically fix offenses",env:"SHOPIFY_FLAG_AUTO_CORRECT"}),config:h.Flags.string({char:"C",required:!1,description:`Use the config provided, overriding .theme-check.yml if present
16
+ `)}async function z(e){let t=".theme-check.yml",n=O(e,t);if(await N(n)){P(`${t} already exists at ${e}`);return}let{settings:i}=await(0,r.loadConfig)(void 0,e),o=de(l.default.stringify(i)),s=l.default.stringify({extends:"theme-check:recommended",ignore:["node_modules/**"]});await T(n,`${s}${o}`),G(`Created ${t} at ${e}`)}var pe=async(e,t)=>{let n=(0,r.applyFixToString)(e.source,t),i=r.path.fsPath(e.uri);await T(i,n)};async function K(e,t){await(0,r.autofix)(e,t,pe)}async function Q(e,t,n){let{ignore:i,settings:o,rootUri:s}=await F(t,()=>(0,r.loadConfig)(t,e)),c={extends:[],ignore:I(i??[]),rootUri:s,...o},a=n?{[n]:c}:c;p(l.default.stringify(a))}async function X(e,t,n){let{settings:i,ignore:o,checks:s}=await F(t,()=>(0,r.loadConfig)(t,e)),c=I(o??[]),u=Object.keys(i).reduce((m,f)=>{let{severity:x,enabled:_,...ee}=i[f];if(!_)return m;let te=U(x??r.Severity.INFO),y=s.find(ie=>ie.meta.code===f),ne=y&&y.meta?{description:y.meta.docs.description,doc:y.meta.docs.url}:{};return m[f]={severity:te,...ne,ignored_patterns:`[${c.join(", ")}]`,...ee},m},{}),d=n?{[n]:u}:u;p(l.default.stringify(d))}function Z(e){return"_handle"in e&&typeof e._handle=="object"&&e._handle!==null&&typeof e._handle.setBlocking=="function"}var h=k(oe(),1);var g=k(q(),1);var R=class extends Y{static summary="Validate the theme.";static descriptionWithMarkdown="Calls and runs [Theme Check](https://shopify.dev/docs/themes/tools/theme-check) to analyze your theme code for errors and to ensure that it follows theme and Liquid best practices. [Learn more about the checks that Theme Check runs.](https://shopify.dev/docs/themes/tools/theme-check/checks)";static description=this.descriptionForHelp();static flags={...H,path:C.path,"auto-correct":h.Flags.boolean({char:"a",required:!1,description:"Automatically fix offenses",env:"SHOPIFY_FLAG_AUTO_CORRECT"}),config:h.Flags.string({char:"C",required:!1,description:`Use the config provided, overriding .theme-check.yml if present
17
17
  Supports all theme-check: config values, e.g., theme-check:theme-app-extension,
18
18
  theme-check:recommended, theme-check:all
19
- For backwards compatibility, :theme_app_extension is also supported `,env:"SHOPIFY_FLAG_CONFIG"}),"fail-level":h.Flags.string({required:!1,description:"Minimum severity for exit with error code",env:"SHOPIFY_FLAG_FAIL_LEVEL",options:["crash","error","suggestion","style","warning","info"],default:"error"}),init:h.Flags.boolean({required:!1,description:"Generate a .theme-check.yml file",env:"SHOPIFY_FLAG_INIT"}),list:h.Flags.boolean({required:!1,description:"List enabled checks",env:"SHOPIFY_FLAG_LIST"}),output:h.Flags.string({char:"o",required:!1,description:"The output format to use",env:"SHOPIFY_FLAG_OUTPUT",options:["text","json"],default:"text"}),print:h.Flags.boolean({required:!1,description:"Output active config to STDOUT",env:"SHOPIFY_FLAG_PRINT"}),version:h.Flags.boolean({char:"v",required:!1,description:"Print Theme Check version",env:"SHOPIFY_FLAG_VERSION"}),environment:C.environment};static multiEnvironmentsFlags=["path"];async command(t,n,i){let o=t.path,s=t.environment?.[0],a=t.config?.startsWith(":")&&y.LegacyIdentifiers.has(t.config.slice(1))?y.LegacyIdentifiers.get(t.config.slice(1)):t.config;if(t.init){await z(o);return}if(t.version){let d=await A(O("node_modules","@shopify","theme-check-node","package.json"),{type:"file",cwd:b(import.meta.url)}),f="unknown";d&&(f=await L(d)??"unknown"),p(f);return}if(t.print){await Q(o,a,s);return}if(t.list){await X(o,a,s);return}let{offenses:u,theme:m}=await le(o,t.output,a,s);if(t["auto-correct"]&&await K(m,u),!i)return V(u,t["fail-level"])}};async function le(e,t,n,i){let{offenses:o,theme:s}=await F(n,()=>(0,y.themeCheckRun)(e,n,a=>{process.env.SHOPIFY_TMP_FLAG_DEBUG&&j(a)})),c=q(o);if(t==="text"&&(D(c,e,s,i),(o.length?w:E)({headline:i?`[${i}] Theme Check Summary.`:"Theme Check Summary.",body:M(o,c,s)})),t==="json"){let a=process.stdout;Z(a)&&a._handle.setBlocking(!0),p(JSON.stringify(J(c,i)))}return{offenses:o,theme:s}}export{R as a,le as b};
19
+ For backwards compatibility, :theme_app_extension is also supported `,env:"SHOPIFY_FLAG_CONFIG"}),"fail-level":h.Flags.string({required:!1,description:"Minimum severity for exit with error code",env:"SHOPIFY_FLAG_FAIL_LEVEL",options:["crash","error","suggestion","style","warning","info"],default:"error"}),init:h.Flags.boolean({required:!1,description:"Generate a .theme-check.yml file",env:"SHOPIFY_FLAG_INIT"}),list:h.Flags.boolean({required:!1,description:"List enabled checks",env:"SHOPIFY_FLAG_LIST"}),output:h.Flags.string({char:"o",required:!1,description:"The output format to use",env:"SHOPIFY_FLAG_OUTPUT",options:["text","json"],default:"text"}),print:h.Flags.boolean({required:!1,description:"Output active config to STDOUT",env:"SHOPIFY_FLAG_PRINT"}),version:h.Flags.boolean({char:"v",required:!1,description:"Print Theme Check version",env:"SHOPIFY_FLAG_VERSION"}),environment:C.environment};static multiEnvironmentsFlags=["path"];async command(t,n,i){let o=t.path,s=t.environment?.[0],a=t.config?.startsWith(":")&&g.LegacyIdentifiers.has(t.config.slice(1))?g.LegacyIdentifiers.get(t.config.slice(1)):t.config;if(t.init){await z(o);return}if(t.version){let m=await A(O("node_modules","@shopify","theme-check-node","package.json"),{type:"file",cwd:b(import.meta.url)}),f="unknown";m&&(f=await L(m)??"unknown"),p(f);return}if(t.print){await Q(o,a,s);return}if(t.list){await X(o,a,s);return}let{offenses:u,theme:d}=await le(o,t.output,a,s);if(t["auto-correct"]&&await K(d,u),!i)return V(u,t["fail-level"])}};async function le(e,t,n,i){let{offenses:o,theme:s}=await F(n,()=>(0,g.themeCheckRun)(e,n,a=>{process.env.SHOPIFY_TMP_FLAG_DEBUG&&j(a)})),c=W(o);if(t==="text"&&(D(c,e,s,i),(o.length?w:E)({headline:i?`[${i}] Theme Check Summary.`:"Theme Check Summary.",body:M(o,c,s)})),t==="json"){let a=process.stdout;Z(a)&&a._handle.setBlocking(!0),p(JSON.stringify(J(c,i)))}return{offenses:o,theme:s}}export{R as a,le as b};
@@ -0,0 +1,4 @@
1
+ import{a as L}from"./chunk-HSTNTHWM.js";import{a as J}from"./chunk-OASB6XPV.js";import{a as X}from"./chunk-RCIU7NHA.js";import{B,C as m,D as y,F as H,G as K,H as V,I as q,J as Q,K as z,L as h,a as O,c as U,d as b,g as j,i as M,p as W,u as Y}from"./chunk-YX5GRXRS.js";import{b as N}from"./chunk-DGMRL5DQ.js";import{b as T}from"./chunk-FW5HGFSZ.js";import{A as g,B as _,D as G,V as E,y as D,z as F}from"./chunk-SKRUMRB4.js";import{Ib as R,sa as $}from"./chunk-YJWNM4XO.js";import{b as de}from"./chunk-JA2QZ635.js";import{g as d,q as A}from"./chunk-3VYOLEQE.js";import{e as ue,g as a}from"./chunk-VKWPEFWQ.js";a();a();a();function Z(e,t){return t==="none"?0:e.scan.issues.some(s=>b[s.severity]>=b[t])?1:0}async function ee({includeDirs:e,excludePatterns:t,noGitIgnore:i,...s}){let n=Date.now();return{...await M(s,{includeDirs:e,excludePatterns:t,noGitIgnore:i}),elapsedMilliseconds:Date.now()-n}}function te({includeDirs:e,excludePatterns:t,noGitIgnore:i,...s}){return j(s,{includeDirs:e,excludePatterns:t,noGitIgnore:i})}a();var pe={high:"High",medium:"Medium",low:"Low"},v=3,w=8;function he(e){let t=fe(e),i=W(e.scan.issues);return{type:t,options:{headline:ge(e,i),body:me(e),reference:[{subdued:`Engine: ${e.engine.name} ${e.engine.version}`},{subdued:`Ruleset: ${e.engine.ruleset}`},...i.some(s=>s.issues.length>1)&&!e.verbose?[{subdued:"Use --verbose for every occurrence and fix. deterministic-findings.json retains all file and line details."}]:[]],customSections:ve(e,i)}}}function ie(e){let{type:t,options:i}=he(e);if(t==="success"){F(i);return}if(t==="warning"){g(i);return}_(i)}function ne(e){return e.scan.scan.coverage_gaps.length>0}function fe(e){return e.scan.issues.some(t=>t.severity==="high")?"error":e.scan.issues.length>0||ne(e)?"warning":"success"}function ge(e,t){let i=e.scan.issues.length;return t.length<i?`${t.length} security issue ${t.length===1?"group":"groups"} found (${i} occurrences).`:i>0?`${i} security ${i===1?"issue":"issues"} found.`:ne(e)?"Scan completed with coverage gaps.":"No security issues found."}function me(e){let t=e.scan,i=[{userInput:t.app.name},{char:"."},`${t.scan.files_scanned} files scanned in ${Ie(e.elapsedMilliseconds)}.`],s=t.scan.checks_executed.filter(n=>n.status==="not_applicable").length;return s>0&&i.push({info:`
2
+ ${s} check${s===1?"":"s"} not applicable.`}),i.push({info:`
3
+ ${e.agentCheckCount} check${e.agentCheckCount===1?"":"s"} ready for your coding agent.`}),i}function ye(e){return[["Have your coding agent run the agent checks"],["Record the agent results with",{command:h(e.commands.record)}],["Review the results with",{command:h(e.commands.review)}]]}function ke(e){let t=m(e)??"not linked";return e.kind==="config"&&e.clientIdOverride?`${t} (from --client-id)`:t}function be(e){let{selection:t}=e;return{title:"Selection",body:{tabularData:[["App directory",t.appDirectory],["Config file",B(t)??"none"],["Client ID",ke(t)],["Scan directories",e.scanDirectories.map(({directory:i})=>d(t.appDirectory,i)||".").join(", ")]],firstColumnSubdued:!0}}}function ve(e,t){let i=[be(e)];for(let n of["high","medium","low"]){let o=t.filter(r=>r.severity===n);o.length!==0&&i.push({title:pe[n],body:{list:{items:o.flatMap(r=>[Se(r),...e.verbose?r.issues.map(we):[]])}}})}if(e.scan.scan.coverage_gaps.length>0){let n=e.scan.scan.coverage_gaps,o=n.slice(0,w).map(r=>r.message);n.length>w&&o.push({info:`${n.length-w} more coverage gaps`}),i.push({title:"Coverage gaps",body:{list:{items:o}}})}let{appDirectory:s}=e.selection;return i.push({title:"Artifacts",body:{list:{items:[["Deterministic findings:",{filePath:d(s,e.deterministicFindingsPath)}],["Agent security check instructions:",{filePath:d(s,e.agentChecksPath)}]]}}}),i.push({title:"Next steps",body:{list:{items:ye(e),ordered:!0}}}),e.verbose&&i.push({title:"Scan details",body:{tabularData:[["Framework",e.scan.detection.framework],["Surface",e.scan.detection.surface],["Languages",e.scan.detection.languages.map(n=>`${n.name} (${n.support})`).join(", ")||"none"],["Capabilities",Ce(e.scan.capabilities)],["Rules run",String(e.scan.scan.rules_run)],["Not run",String(e.scan.scan.rules_skipped)]],firstColumnSubdued:!0}}),i}function we(e){let t=e.location.line?`${e.location.file}:${e.location.line}`:e.location.file,i=[{bold:e.title},se(e.id),{filePath:t}];return i.push({subdued:e.message},{subdued:`Fix: ${e.fix.description}`}),e.fix.guide&&(e.fix.guide.startsWith("https://")||e.fix.guide.startsWith("http://")?i.push({link:{label:"Guide",url:e.fix.guide}}):i.push({subdued:`Guide: ${e.fix.guide}`})),e.snippet&&i.push({subdued:`Code: ${e.snippet}`}),i}function Se(e){let t=e.issues[0],i=e.issues.length,s=e.files.length,n=e.files.slice(0,v).map(o=>{let r=e.issues.find(f=>f.location.file===o);return{filePath:r.location.line?`${o}:${r.location.line}`:o}});return[{bold:t.title},se(t.id),`${i} ${i===1?"occurrence":"occurrences"} across ${s} ${s===1?"file":"files"}`,...n,...s>v?[{subdued:`+${s-v} more files`}]:[]]}function se(e){let t=U(e);return t?{link:{label:e,url:t}}:{subdued:e}}function Ce(e){let t=Object.entries(e).filter(([,i])=>i).map(([i])=>i);return t.length>0?t.join(", "):"none detected"}function Ie(e){return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function xe(e){return{message:`${e} recommended agent ${e===1?"check":"checks"} available to complete your scan. How do you want to pass that prompt to your agent?`,choices:[{label:"Copy instructions to the clipboard",value:"copy"},{label:"Print instructions to the terminal",value:"print"},{label:"Nothing",value:"nothing"}],defaultValue:"copy"}}var Pe={resolveSelection:H,execute:ee,listFiles:te,writeArtifacts:Y,canPrompt:E,selectInstructionsDestination:e=>G(xe(e)),deliverInstructions:J,output:R,renderInfo:D,renderWarning:g,renderReport:ie,setExitCode:e=>{process.exitCode=e},recordMetadata:X};async function Ae(e,t,i,s){return e.skipInstructions?"nothing":e.yes?"print":i?t.selectInstructionsDestination(s):"nothing"}function $e(e,t,i,s,n,o){return{scan:e.scan,selection:n,scanDirectories:o,engine:e.engine,verbose:i,elapsedMilliseconds:e.elapsedMilliseconds,commands:s,deterministicFindingsPath:t.deterministicFindingsPath,agentChecksPath:t.agentChecksPath,agentCheckCount:e.agentChecks.checks.length}}function De(e){return e.replace(/[?*()[\]{}!#\\]/g,"\\$&")}async function oe(e,t){if(e.ignoredScanDirectories.length===0&&e.otherAppDirectories.length===0)return;let i=await $(A()),s=n=>d(i,n)||".";for(let n of e.ignoredScanDirectories)t.renderWarning({headline:`${s(n)} is ignored by Git, so only the files Git tracks in it are scanned.`,body:["Use",{command:"--no-git-ignore"},"to scan everything in it."]});for(let n of e.otherAppDirectories){let o=s(n);t.renderWarning({headline:`${o} holds another app's configuration, so its files are scanned as part of this app.`,body:["Use",{command:`--exclude ${z(De(o),Q())}`},"to leave it out."]})}}async function S(e,t=Pe){let i=await K(e.includeDirs),s=!e.listFiles&&t.canPrompt(),n=await t.resolveSelection({path:e.directory,config:e.configName,clientId:e.clientId,withoutAppConfig:e.withoutAppConfig,allowPrompts:s,validateClientIdFlag:!0}),{appDirectory:o}=n,r={include_dirs:[...e.includeDirs],excludes:[...e.excludePatterns],no_git_ignore:e.noGitIgnore},p=q(n,e.directory,r),f={selection:n,resultsKey:y(n),commands:p};(n.kind==="no-config"?!e.withoutAppConfig:n.appConfigFilePicked===!0)&&t.renderInfo({headline:"To skip these prompts next time, run:",body:[{command:h(p.scan)}]});let re=n.kind==="config"?n.appConfigDirectories??[]:[],{scanDirectories:k,requestedScanDirectories:ce}=V(o,i,re),I={appDirectory:o,scanDirectories:k.map(({directory:c})=>c),requestedScanDirectories:ce,appConfigDirectories:k.filter(({origin:c})=>c==="app_config_directory").map(({directory:c})=>c),appConfigFilePath:n.kind==="config"?n.appConfigFilePath:void 0,clientId:m(n),includeDirs:e.includeDirs,excludePatterns:e.excludePatterns,noGitIgnore:e.noGitIgnore};if(e.listFiles){let{paths:c,...le}=await t.listFiles(I);return await oe(le,t),c.length>0&&t.output(c.join(`
4
+ `)),f}let l=await t.execute(I);await oe(l,t),await t.recordMetadata({num_security_findings:l.scan.issues.length});let ae=await t.writeArtifacts(o,y(n),{deterministicFindings:l.deterministicFindings,agentChecks:l.agentChecks});t.renderReport($e(l,ae,e.verbose,p,n,k));let x=await Ae(e,t,s,l.agentChecks.checks.length);x!=="nothing"&&await t.deliverInstructions({appDirectory:o,resultsKey:y(n),copy:x==="copy",scanScope:r,commands:p});let P=Z(l,e.blocking);return P!==0&&t.setExitCode(P),f}var u=ue(de(),1);var C=class e extends T{static summary="Check an app for Shopify-specific security issues and write deterministic-findings.json and agent-checks.json.";static descriptionWithMarkdown="Runs an app security check locally and writes `deterministic-findings.json` and `agent-checks.json` to the results directory, `.shopify/app-security/<results key>/`. The results key is `--client-id` when you pass it, and otherwise the name of the app configuration file without `.toml`; the other `app security` commands take the same selection flags and find the same directory. Every run replaces both files, so it's always safe to run the check again.\n\n`deterministic-findings.json` holds the deterministic scan results. `agent-checks.json` holds the checks for your coding agent to investigate; the agent's results are recorded with `shopify app security record`. Use `--config` to select a specific app configuration when the project has multiple `shopify.app*.toml` files; the check inspects only that configuration. Use `--client-id` to replace the configuration's client ID for this run. `--client-id` is checked against your Shopify account before anything is scanned, so it needs you to be logged in. When no app configuration exists, use `--without-app-config --client-id <client-id>` to scan `--path` anyway with config checks skipped; in an interactive terminal the command offers to do this.\n\nThe check scans the app directory and each `--include-dir`. Git ignore rules apply by default: a file or directory that Git ignores is skipped, using the rules of the repository that contains it, while files that Git tracks are always scanned. Use `--no-git-ignore` to turn Git ignore rules off for every scanned directory.\n\nUse `--exclude` to skip more paths. Each value is a glob that is matched against the path relative to the working directory, so a path above it starts with `../`, and a name at any depth needs `**/`, for example `--exclude '**/generated'`. Repeat the flag to add globs. An exclusion can't remove the selected app configuration file. Quote each value so your shell doesn't expand `*`. The coding-agent instructions this check offers repeat the globs. Other `app security` commands don't take `--exclude` or `--no-git-ignore`, so pass the same flags each time you run the check.\n\nUse `--list-files` to check the scope before scanning: it prints the files the check would gather, one path per line and relative to the app directory, and then stops. It writes no results and never prompts. `--client-id` is still checked, but doesn't change the list.\n\nIn interactive terminals, the command offers to copy the coding-agent instructions, print them, or choose nothing; copying is the default. In CI and other non-interactive environments, instructions aren't offered unless you pass `--yes`, which prints them. You can also run `shopify app security instructions` to print, copy, or write them later.";static description=this.descriptionWithoutMarkdown();static flags={...N,...O,"include-dir":u.Flags.string({description:"Also scan this directory, relative to the working directory. Repeat the flag to add directories. Use it for code that lives outside the app directory, such as a backend or a shared library.",multiple:!0}),exclude:u.Flags.string({description:"Skip paths that match this glob, relative to the working directory. Repeat the flag to add globs. The selected app configuration file can't be excluded.",multiple:!0}),"no-git-ignore":u.Flags.boolean({description:"Turn off Git ignore rules for every scanned directory, so files that Git ignores are scanned too. Files that Git tracks are always scanned.",env:"SHOPIFY_FLAG_NO_GIT_IGNORE"}),"list-files":u.Flags.boolean({description:"Print the files the check would gather, one path per line, and stop. Nothing is scanned, no results are written, and nothing is prompted for.",env:"SHOPIFY_FLAG_LIST_FILES",exclusive:["yes","skip-instructions","blocking"]}),...L,yes:u.Flags.boolean({description:"Print coding-agent instructions without prompting.",default:!1,exclusive:["skip-instructions"],env:"SHOPIFY_FLAG_YES"}),"skip-instructions":u.Flags.boolean({description:"Don't offer to show coding-agent instructions.",default:!1,exclusive:["yes"],env:"SHOPIFY_FLAG_APP_SECURITY_SKIP_INSTRUCTIONS"})};async run(){let{flags:t}=await this.parse(e);await S({directory:t.path,configName:t.config,clientId:t["client-id"],withoutAppConfig:!!t["without-app-config"],verbose:!!t.verbose,blocking:t.blocking,yes:t.yes,skipInstructions:t["skip-instructions"],includeDirs:t["include-dir"]??[],excludePatterns:t.exclude??[],noGitIgnore:!!t["no-git-ignore"],listFiles:!!t["list-files"]})}};export{C as a};
@@ -1,4 +1,4 @@
1
- import{a as x}from"./chunk-V2GLAK2W.js";import{wa as D}from"./chunk-CVW2HMQO.js";import{b as u,d as B}from"./chunk-CFQ5G2QS.js";import{k as W,r as y}from"./chunk-CNK3ZO2B.js";import{B as A,I as N,T as F}from"./chunk-6C5AVMKR.js";import{h as s,k as C}from"./chunk-OAG72Q2O.js";import{Ta as _,ma as T,qb as m,sb as o}from"./chunk-43FRAUV6.js";import{e as z,g as t}from"./chunk-VKWPEFWQ.js";t();var b=z(W(),1);function H(e){return e.startsWith("gid://")?e:/^\d+$/.test(e)?`gid://shopify/BulkOperation/${e}`:e}function J(e){return e.match(/^gid:\/\/shopify\/BulkOperation\/(\d+)$/)?.[1]??e}function g(e){let n;try{n=(0,b.parse)(e)}catch(i){throw i instanceof Error?new s(`Invalid GraphQL syntax: ${i.message}`):i}if(n.definitions.filter(i=>i.kind==="OperationDefinition").length!==1)throw new s("GraphQL document must contain exactly one operation definition. Multiple operations are not supported.")}function X(e){let n;try{n=(0,b.parse)(e)}catch(i){throw i instanceof Error?new s(`Invalid GraphQL syntax: ${i.message}`):i}return n.definitions.find(i=>i.kind==="OperationDefinition")?.operation==="mutation"}async function Y(e){let{adminSession:n,userSpecifiedVersion:a,minimumDefaultVersion:i}=e;if(a==="unstable")return a;let r=await B(n);if(!a){let c=r.filter(v=>v.supported).map(v=>v.handle);i&&c.push(i);let f=c.sort().reverse()[0];if(!f)throw new s("No supported API versions available for this store.");return f}let l=r.map(c=>c.handle);if(l.includes(a))return a;let d=o`Invalid API version: ${a}`.value,k=o`Allowed versions: ${l.join(", ")}`.value;throw new s(d,k)}t();t();var p="2026-01";t();async function E(e){let n;if(e.query!==void 0){if(!e.query.trim())throw new s("The --query flag value is empty. Please provide a valid GraphQL query or mutation.");n=e.query}else if(e.queryFile){if(!await _(e.queryFile))throw new s(o`Query file not found at ${m.path(e.queryFile)}. Please check the path and try again.`);let a=await T(e.queryFile,{encoding:"utf8"});if(!a.trim())throw new s(o`Query file at ${m.path(e.queryFile)} is empty. Please provide a valid GraphQL query or mutation.`);n=a}else throw new C("Query should have been provided via --query or --query-file flags due to exactlyOne constraint. This indicates the oclif flag validation failed.");return g(n),n}t();t();var R={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"BulkOperationRunQuery"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperationRunQuery"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperation"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"type"}},{kind:"Field",name:{kind:"Name",value:"completedAt"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"errorCode"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"objectCount"}},{kind:"Field",name:{kind:"Name",value:"partialDataUrl"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function Z(e){let{adminSession:n,query:a,version:i}=e;return(await u({query:R,session:n,variables:{query:a},...i&&{version:i}})).bulkOperationRunQuery}t();t();t();var L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StagedUploadsCreate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StagedUploadInput"}}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"stagedUploadsCreate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"stagedTargets"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"resourceUrl"}},{kind:"Field",name:{kind:"Name",value:"parameters"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"value"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function h(e){let{adminSession:n,variablesJsonl:a}=e,i=Buffer.from(a??"","utf-8"),r="bulk-variables.jsonl",l=i.length,d=await ee(n,r,l),k=ne(d);return await ie(i,k.url,k.parameters,r),k.stagedUploadKey}async function ee(e,n,a){return u({query:L,session:e,variables:{input:[{filename:n,fileSize:a.toString(),httpMethod:"POST",mimeType:"text/jsonl",resource:"BULK_MUTATION_VARIABLES"}]}})}function ne(e){if(!e.stagedUploadsCreate)throw new s("No response received from stagedUploadsCreate mutation");if(e.stagedUploadsCreate.userErrors.length>0){let i=e.stagedUploadsCreate.userErrors.map(r=>r.message).join(", ");throw new s(`Failed to create staged upload: ${i}`)}let n=e.stagedUploadsCreate.stagedTargets?.[0];if(!n)throw new s("No staged upload target returned from Shopify");if(!n.url||!n.resourceUrl)throw new s("Invalid staged upload target: missing required URLs");let a=n.parameters.find(i=>i.name==="key")?.value;if(!a)throw new s("No key parameter found in staged upload target");return{url:n.url,resourceUrl:n.resourceUrl,parameters:n.parameters,stagedUploadKey:a}}async function ie(e,n,a,i){let r=new FormData;for(let d of a)r.append(d.name,d.value);r.append("file",new Blob([new Uint8Array(e)],{type:"text/jsonl"}),i);let l=await N({title:o`Uploading bulk operation variables`,task:async()=>y(n,{method:"POST",body:r},"slow-request"),renderOptions:{stdout:process.stderr}});if(!l.ok){let d=await l.text();throw new s(`Failed to upload file to staged URL: ${l.statusText}
1
+ import{a as x}from"./chunk-JROJL6RV.js";import{Ha as D}from"./chunk-2KLXRVGQ.js";import{b as u,d as B}from"./chunk-NYABB6XW.js";import{b as W,j as y}from"./chunk-L5XWYTHY.js";import{B as _,I as N,T as F}from"./chunk-SKRUMRB4.js";import{i as s,l as C}from"./chunk-FCULF3JA.js";import{Cb as m,Eb as o,Xa as A,qa as T}from"./chunk-YJWNM4XO.js";import{e as z,g as t}from"./chunk-VKWPEFWQ.js";t();var b=z(W(),1);function H(e){return e.startsWith("gid://")?e:/^\d+$/.test(e)?`gid://shopify/BulkOperation/${e}`:e}function J(e){return e.match(/^gid:\/\/shopify\/BulkOperation\/(\d+)$/)?.[1]??e}function g(e){let n;try{n=(0,b.parse)(e)}catch(i){throw i instanceof Error?new s(`Invalid GraphQL syntax: ${i.message}`):i}if(n.definitions.filter(i=>i.kind==="OperationDefinition").length!==1)throw new s("GraphQL document must contain exactly one operation definition. Multiple operations are not supported.")}function X(e){let n;try{n=(0,b.parse)(e)}catch(i){throw i instanceof Error?new s(`Invalid GraphQL syntax: ${i.message}`):i}return n.definitions.find(i=>i.kind==="OperationDefinition")?.operation==="mutation"}async function Y(e){let{adminSession:n,userSpecifiedVersion:a,minimumDefaultVersion:i}=e;if(a==="unstable")return a;let r=await B(n);if(!a){let c=r.filter(v=>v.supported).map(v=>v.handle);i&&c.push(i);let f=c.sort().reverse()[0];if(!f)throw new s("No supported API versions available for this store.");return f}let l=r.map(c=>c.handle);if(l.includes(a))return a;let d=o`Invalid API version: ${a}`.value,k=o`Allowed versions: ${l.join(", ")}`.value;throw new s(d,k)}t();t();var p="2026-01";t();async function E(e){let n;if(e.query!==void 0){if(!e.query.trim())throw new s("The --query flag value is empty. Please provide a valid GraphQL query or mutation.");n=e.query}else if(e.queryFile){if(!await A(e.queryFile))throw new s(o`Query file not found at ${m.path(e.queryFile)}. Please check the path and try again.`);let a=await T(e.queryFile,{encoding:"utf8"});if(!a.trim())throw new s(o`Query file at ${m.path(e.queryFile)} is empty. Please provide a valid GraphQL query or mutation.`);n=a}else throw new C("Query should have been provided via --query or --query-file flags due to exactlyOne constraint. This indicates the oclif flag validation failed.");return g(n),n}t();t();var R={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"BulkOperationRunQuery"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperationRunQuery"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperation"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"type"}},{kind:"Field",name:{kind:"Name",value:"completedAt"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"errorCode"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"objectCount"}},{kind:"Field",name:{kind:"Name",value:"partialDataUrl"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function Z(e){let{adminSession:n,query:a,version:i}=e;return(await u({query:R,session:n,variables:{query:a},...i&&{version:i}})).bulkOperationRunQuery}t();t();t();var L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"StagedUploadsCreate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"StagedUploadInput"}}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"stagedUploadsCreate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"stagedTargets"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"resourceUrl"}},{kind:"Field",name:{kind:"Name",value:"parameters"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"value"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function h(e){let{adminSession:n,variablesJsonl:a}=e,i=Buffer.from(a??"","utf-8"),r="bulk-variables.jsonl",l=i.length,d=await ee(n,r,l),k=ne(d);return await ie(i,k.url,k.parameters,r),k.stagedUploadKey}async function ee(e,n,a){return u({query:L,session:e,variables:{input:[{filename:n,fileSize:a.toString(),httpMethod:"POST",mimeType:"text/jsonl",resource:"BULK_MUTATION_VARIABLES"}]}})}function ne(e){if(!e.stagedUploadsCreate)throw new s("No response received from stagedUploadsCreate mutation");if(e.stagedUploadsCreate.userErrors.length>0){let i=e.stagedUploadsCreate.userErrors.map(r=>r.message).join(", ");throw new s(`Failed to create staged upload: ${i}`)}let n=e.stagedUploadsCreate.stagedTargets?.[0];if(!n)throw new s("No staged upload target returned from Shopify");if(!n.url||!n.resourceUrl)throw new s("Invalid staged upload target: missing required URLs");let a=n.parameters.find(i=>i.name==="key")?.value;if(!a)throw new s("No key parameter found in staged upload target");return{url:n.url,resourceUrl:n.resourceUrl,parameters:n.parameters,stagedUploadKey:a}}async function ie(e,n,a,i){let r=new FormData;for(let d of a)r.append(d.name,d.value);r.append("file",new Blob([new Uint8Array(e)],{type:"text/jsonl"}),i);let l=await N({title:o`Uploading bulk operation variables`,task:async()=>y(n,{method:"POST",body:r},"slow-request"),renderOptions:{stdout:process.stderr}});if(!l.ok){let d=await l.text();throw new s(`Failed to upload file to staged URL: ${l.statusText}
2
2
  ${d}`)}}t();var U={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"BulkOperationRunMutation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"mutation"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"stagedUploadPath"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"clientIdentifier"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperationRunMutation"},arguments:[{kind:"Argument",name:{kind:"Name",value:"mutation"},value:{kind:"Variable",name:{kind:"Name",value:"mutation"}}},{kind:"Argument",name:{kind:"Name",value:"stagedUploadPath"},value:{kind:"Variable",name:{kind:"Name",value:"stagedUploadPath"}}},{kind:"Argument",name:{kind:"Name",value:"clientIdentifier"},value:{kind:"Variable",name:{kind:"Name",value:"clientIdentifier"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperation"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"type"}},{kind:"Field",name:{kind:"Name",value:"completedAt"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"errorCode"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"objectCount"}},{kind:"Field",name:{kind:"Name",value:"partialDataUrl"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function ae(e){let{adminSession:n,query:a,variablesJsonl:i,version:r}=e,l=await h({adminSession:n,variablesJsonl:i});return(await u({query:U,session:n,variables:{mutation:a,stagedUploadPath:l},...r&&{version:r}})).bulkOperationRunMutation}t();t();var S={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetBulkOperationById"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperation"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"type"}},{kind:"Field",name:{kind:"Name",value:"completedAt"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"errorCode"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"objectCount"}},{kind:"Field",name:{kind:"Name",value:"partialDataUrl"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};t();var q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListBulkOperations"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"sortKey"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"BulkOperationsSortKeys"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperations"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}},{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"sortKey"},value:{kind:"Variable",name:{kind:"Name",value:"sortKey"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"errorCode"}},{kind:"Field",name:{kind:"Name",value:"objectCount"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"completedAt"}},{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"partialDataUrl"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function te(e){let{adminSession:n,operationId:a,version:i}=e;return(await u({query:S,session:n,variables:{id:a},version:i??p})).bulkOperation}async function re(e){let{adminSession:n,version:a,sinceDays:i=7,first:r=100}=e,l=new Date(Date.now()-i*24*60*60*1e3).toISOString().split("T")[0];return(await u({query:q,session:n,variables:{query:`created_at:>=${l}`,first:r,sortKey:"CREATED_AT"},version:a??p})).bulkOperations.nodes}t();t();var P={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"BulkOperationCancel"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperationCancel"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"bulkOperation"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"completedAt"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"errorCode"}},{kind:"Field",name:{kind:"Name",value:"fileSize"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"objectCount"}},{kind:"Field",name:{kind:"Name",value:"partialDataUrl"}},{kind:"Field",name:{kind:"Name",value:"query"}},{kind:"Field",name:{kind:"Name",value:"rootObjectCount"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"type"}},{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function oe(e){let{adminSession:n,operationId:a,version:i}=e;return(await u({query:P,session:n,variables:{id:a},version:i??p})).bulkOperationCancel}t();t();function O(e){switch(e.status){case"RUNNING":return o`Bulk operation in progress${e.objectCount>0?m.gray(` (${String(e.objectCount)} objects ${e.type==="MUTATION"?"written":"read"})`):""}`;case"CREATED":return o`Starting`;case"COMPLETED":return o`Bulk operation succeeded: ${m.gray(`${String(e.objectCount)} objects`)}`;case"FAILED":return o`Bulk operation failed. ${m.errorText(`Error: ${e.errorCode??"unknown"}`)}`;case"CANCELING":return o`Bulk operation canceling...`;case"CANCELED":return o`Bulk operation canceled.`;case"EXPIRED":return o`Bulk operation expired.`;default:return o`Bulk operation status: ${e.status}`}}function le(e,n){let a=e.map(i=>o`${i.field?.join(".")??"unknown"}: ${i.message}`.value).join(`
3
- `);A({headline:n,body:a})}function de(e){let n=O(e).value;switch(e.status){case"CANCELING":return{headline:"Bulk operation is being cancelled.",renderType:"success"};case"CANCELED":case"COMPLETED":case"FAILED":{let a=[o`ID: ${m.cyan(e.id)}`.value,o`Status: ${m.yellow(e.status)}`.value,o`Created at: ${m.gray(String(e.createdAt))}`.value,...e.completedAt?[o`Completed at: ${m.gray(String(e.completedAt))}`.value]:[]];return{headline:o`Bulk operation is already ${e.status.toLowerCase()}.`.value,body:o`This operation has already finished and can't be canceled.`.value,customSections:[{body:[{list:{items:a}}]}],renderType:"warning"}}case"CREATED":case"EXPIRED":case"RUNNING":return{headline:n,renderType:"info"}}}var se=["COMPLETED","FAILED","CANCELED","EXPIRED"],V=1,ue=5,M=10,$=3e3,Q=300;async function me(e,n){return N({title:o`Starting bulk operation`,task:async()=>{let a=Date.now(),i=j({adminSession:e,operationId:n,pollIntervalSeconds:Q/1e3,useAdaptivePolling:!1}),r;do{let{value:l,done:d}=await i.next();if(r=l,d)return r}while(Date.now()-a<$);return r},renderOptions:{stdout:process.stderr}})}async function ke(e,n,a,i){return N({title:o`Polling bulk operation`,task:async r=>{let l=j({adminSession:e,operationId:n,pollIntervalSeconds:ue,initialPollIntervalSeconds:V,initialPollCount:M,useAdaptivePolling:!0,abortSignal:a});for(;;){let{value:d,done:k}=await l.next();if(k)return d;r(O(d))}},onAbort:i,renderOptions:{stdout:process.stderr}})}async function*j({adminSession:e,operationId:n,pollIntervalSeconds:a,useAdaptivePolling:i=!1,initialPollIntervalSeconds:r=V,initialPollCount:l=M,abortSignal:d}){let k=0;for(;;){let c=await pe(e,n);if(!c.bulkOperation)throw new Error("bulk operation not found");let f=c.bulkOperation;if(se.includes(f.status)||d?.aborted)return f;yield f,k++;let v=a;if(i&&k<=l&&(v=r),d){let w,K=new Promise(G=>{let I=()=>G();d.addEventListener("abort",I,{once:!0}),w=()=>d.removeEventListener("abort",I)});await Promise.race([F(v),K]),w?.()}else await F(v)}}async function pe(e,n){return u({query:S,session:e,variables:{id:n},version:p})}t();async function ce(e){let n=await y(e);if(!n.ok)throw new s(`Failed to download bulk operation results: ${n.statusText}`);return n.text()}function ve(e){return e.trim().split(`
4
- `).filter(a=>a.trim().length>0).some(a=>{let i;try{i=JSON.parse(a)}catch(l){if(l instanceof SyntaxError)return!1;throw l}if(!i.data)return!1;let r=Object.values(i.data)[0];return r?.userErrors!==void 0&&r.userErrors.length>0})}t();async function fe(e){let n=await D({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),a=await x({appContextResult:n,storeFqdn:e.store,forceReselectStore:e.reset,storeTypes:["APP_DEVELOPMENT","DEVELOPMENT","DEVELOPMENT_SUPERSET","PRODUCTION"]});return{appContextResult:n,store:a}}async function Jn(e){let n=await E({query:e.query,queryFile:e["query-file"]}),{appContextResult:a,store:i}=await fe(e);return{query:n,appContextResult:a,store:i}}export{p as a,H as b,J as c,g as d,X as e,Y as f,E as g,Z as h,ae as i,te as j,re as k,oe as l,O as m,le as n,de as o,me as p,ke as q,ce as r,ve as s,fe as t,Jn as u};
3
+ `);_({headline:n,body:a})}function de(e){let n=O(e).value;switch(e.status){case"CANCELING":return{headline:"Bulk operation is being cancelled.",renderType:"success"};case"CANCELED":case"COMPLETED":case"FAILED":{let a=[o`ID: ${m.cyan(e.id)}`.value,o`Status: ${m.yellow(e.status)}`.value,o`Created at: ${m.gray(String(e.createdAt))}`.value,...e.completedAt?[o`Completed at: ${m.gray(String(e.completedAt))}`.value]:[]];return{headline:o`Bulk operation is already ${e.status.toLowerCase()}.`.value,body:o`This operation has already finished and can't be canceled.`.value,customSections:[{body:[{list:{items:a}}]}],renderType:"warning"}}case"CREATED":case"EXPIRED":case"RUNNING":return{headline:n,renderType:"info"}}}var se=["COMPLETED","FAILED","CANCELED","EXPIRED"],V=1,ue=5,M=10,$=3e3,Q=300;async function me(e,n){return N({title:o`Starting bulk operation`,task:async()=>{let a=Date.now(),i=j({adminSession:e,operationId:n,pollIntervalSeconds:Q/1e3,useAdaptivePolling:!1}),r;do{let{value:l,done:d}=await i.next();if(r=l,d)return r}while(Date.now()-a<$);return r},renderOptions:{stdout:process.stderr}})}async function ke(e,n,a,i){return N({title:o`Polling bulk operation`,task:async r=>{let l=j({adminSession:e,operationId:n,pollIntervalSeconds:ue,initialPollIntervalSeconds:V,initialPollCount:M,useAdaptivePolling:!0,abortSignal:a});for(;;){let{value:d,done:k}=await l.next();if(k)return d;r(O(d))}},onAbort:i,renderOptions:{stdout:process.stderr}})}async function*j({adminSession:e,operationId:n,pollIntervalSeconds:a,useAdaptivePolling:i=!1,initialPollIntervalSeconds:r=V,initialPollCount:l=M,abortSignal:d}){let k=0;for(;;){let c=await pe(e,n);if(!c.bulkOperation)throw new Error("bulk operation not found");let f=c.bulkOperation;if(se.includes(f.status)||d?.aborted)return f;yield f,k++;let v=a;if(i&&k<=l&&(v=r),d){let w,K=new Promise(G=>{let I=()=>G();d.addEventListener("abort",I,{once:!0}),w=()=>d.removeEventListener("abort",I)});await Promise.race([F(v),K]),w?.()}else await F(v)}}async function pe(e,n){return u({query:S,session:e,variables:{id:n},version:p})}t();async function ce(e){let n=await y(e);if(!n.ok)throw new s(`Failed to download bulk operation results: ${n.statusText}`);return n.text()}function ve(e){return e.trim().split(`
4
+ `).filter(a=>a.trim().length>0).some(a=>{let i;try{i=JSON.parse(a)}catch(l){if(l instanceof SyntaxError)return!1;throw l}if(Array.isArray(i.errors)&&i.errors.length>0)return!0;if(!i.data)return!1;let r=Object.values(i.data)[0];return r?.userErrors!==void 0&&r.userErrors.length>0})}t();async function fe(e){let n=await D({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),a=await x({appContextResult:n,storeFqdn:e.store,forceReselectStore:e.reset,storeTypes:["APP_DEVELOPMENT","DEVELOPMENT","DEVELOPMENT_SUPERSET","PRODUCTION"]});return{appContextResult:n,store:a}}async function Jn(e){let n=await E({query:e.query,queryFile:e["query-file"]}),{appContextResult:a,store:i}=await fe(e);return{query:n,appContextResult:a,store:i}}export{p as a,H as b,J as c,g as d,X as e,Y as f,E as g,Z as h,ae as i,te as j,re as k,oe as l,O as m,le as n,de as o,me as p,ke as q,ce as r,ve as s,fe as t,Jn as u};
@@ -0,0 +1,20 @@
1
+ import{a as Mt}from"./chunk-UOHNRH6E.js";import{a as Ur}from"./chunk-SXPWOYLT.js";import{b as Tr}from"./chunk-JOJRABPY.js";import{a as _r}from"./chunk-OETFY7FE.js";import{a as Cr}from"./chunk-OM243CQ6.js";import{a as Ir}from"./chunk-ZPCCSPAE.js";import{a as gr}from"./chunk-WU7MSL3I.js";import{a as wr}from"./chunk-CSRNHTHO.js";import{a as yr,b as vr,c as Pr,d as xr}from"./chunk-6ILP6QCH.js";import{a as Rr}from"./chunk-TSLZNTFM.js";import{a as Er}from"./chunk-44QTWXOJ.js";import{a as br}from"./chunk-ADW7ECNU.js";import{a as Ar}from"./chunk-LQLFMDVD.js";import{a as Sr}from"./chunk-O6E7YL7N.js";import{a as ar}from"./chunk-2YFB3PTV.js";import{a as lr}from"./chunk-7IGMIDKK.js";import{a as pr}from"./chunk-22LJALHJ.js";import{a as dr}from"./chunk-GJJBOCKD.js";import{g as ur}from"./chunk-NTVEJYKI.js";import{a as Xe}from"./chunk-QBGSSUJP.js";import{c as Je,m as Ze}from"./chunk-ZHJ6KA43.js";import{a as mr}from"./chunk-5HEBS5DG.js";import{a as fr}from"./chunk-WPUQTUDX.js";import{a as cr}from"./chunk-72HS7MHV.js";import{b as ir,g as _e,j as Qe}from"./chunk-R757TSQ6.js";import{a as lo,b as po,c as uo,d as mo}from"./chunk-PVOWU77O.js";import{d as hr}from"./chunk-QJST4LZX.js";import{a as nr,b as sr,c as ao,d as io,e as rt,f as co,g as fo}from"./chunk-PBBZNGS4.js";import{a as M,b as Ye}from"./chunk-Z3XIZMEM.js";import{a as Xt,b as Zt,d as Ae,f as er,m as Te,n as H,s as q,u as tr,v as rr,w as or}from"./chunk-Q7BOSHWX.js";import{a as Jt}from"./chunk-CHLSNYF7.js";import{a as Zr,b as tt,c as ee,d as eo}from"./chunk-KVROYIUQ.js";import{a as ho,f as go,g as wo,h as ot,i as yo,j as vo,k as Po,l as xo,m as Eo,n as bo,o as So,p as Uo,q as Ro,v as Ao,x as To,z as nt}from"./chunk-55PABKRC.js";import{a as to,b as ro,c as oo,d as no,e as so}from"./chunk-7Y4X5I6N.js";import{a as Lr}from"./chunk-Q3O3AFZT.js";import{a as Xr}from"./chunk-JROJL6RV.js";import{a as Jr}from"./chunk-YGFEUXKQ.js";import{a as kr}from"./chunk-JTPVSO6Y.js";import{Ha as Qr,I as Br,K as Kr,M as Z,W as jr,X as zr,ha as Yr,i as $r,j as W,k as Mr,o as Dr,t as et,u as Or,v as Nr,w as qr,x as Wr,y as Hr,ya as Ie,z as Gr,za as ke}from"./chunk-2KLXRVGQ.js";import{B as Fr,la as Vr,p as Ce,u as ie}from"./chunk-Q45XAEG2.js";import{d as Yt}from"./chunk-4A7FPJVT.js";import{a as K}from"./chunk-6RBCFXJT.js";import{b as Qt,e as Re}from"./chunk-DGMRL5DQ.js";import{J as It,V as J,X as kt,c as Rt,h as At,j as Tt,m as _t,na as Lt,o as Ct,p as we,u as ye}from"./chunk-L5XWYTHY.js";import{A as se,H as be,L as Bt,N as Se,S as Ue,T as ae,U as ze,V as Kt,X as jt,a as Ut,d as ve,e as k,f as $,h as Pe,i as xe,j as Ft,k as Dt,l as Ot,m as Nt,n as qt,o as F,p as Wt,q as je,r as Ve,s as Ht,t as Gt,y as Ee}from"./chunk-SKRUMRB4.js";import{b as Ke,d as Et,f as bt,i as St}from"./chunk-YTJ3EPD3.js";import{a as In}from"./chunk-7UNQOKZW.js";import{d as $t}from"./chunk-G54BKNIX.js";import{i as A,l as X}from"./chunk-FCULF3JA.js";import{a as _o}from"./chunk-TO7TXDLU.js";import{Aa as fe,Cb as P,Eb as b,Ia as vt,Kb as B,Nb as g,Ob as C,Ra as he,T as Be,Xa as D,_a as ge,db as Pt,gb as xt,qa as L,ya as me}from"./chunk-YJWNM4XO.js";import{e as Vt,g as zt}from"./chunk-SGBLCVUX.js";import{b as Cn}from"./chunk-JA2QZ635.js";import{a as ft}from"./chunk-JD5P5RAJ.js";import{d as S,f as Ge,g as ht,i as ue,j as gt,k as de,o as wt,p as yt}from"./chunk-3VYOLEQE.js";import{e as Q,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var kn=300*1e3,Ln='The host theme could not be created to host your theme app extension. Please try again or use the "--theme" flag to use an existing theme as the host theme.';async function Co(t,e,r=Date.now()){for(;await $n(t,e,r););}async function $n(t,e,r){let o=await _e(t,e);if(!o||Mn(o,r))throw new A(Ln);return await ae(3),o.processing}function Mn(t,e){return t.processing&&Date.now()-e>=kn}var Fn="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",Dn="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",st=3,Le=class extends cr{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=yr(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){vr(this.adminSession.storeFqdn,e)}removeTheme(){Pr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:ir,name:this.generateThemeName(this.context),src:Fn};for(let o=0;o<st;o++){g(`Attempt ${o}/${st}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await Qe(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),g(`Waiting for theme with id "${n.id}" to be processed`),await Co(n.id,this.adminSession),n;throw new Error}catch{g(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}g(`Theme creation failed after ${st} retries. Creating theme using fallback theme zip`);let r=await Qe({...e,src:Dn},this.adminSession);if(!r)throw g("Theme creation failed. Exiting process."),new X(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var On={"theme:init":gr,"theme:check":ar,"theme:console":lr,"theme:delete":pr,"theme:dev":dr,"theme:duplicate":mr,"theme:info":fr,"theme:language-server":wr,"theme:list":xr,"theme:metafields:pull":Rr,"theme:open":Er,"theme:package":br,"theme:profile":Sr,"theme:publish":Ur,"theme:preview":Ar,"theme:pull":Tr,"theme:push":_r,"theme:rename":Cr,"theme:share":Ir},ka=On;async function Io(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(U=>U.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[c,d]=await Promise.all([It(t.storeFqdn),Wn(e)]),l=c.storeFqdn,[u,h]=await Promise.all([Ze(c),Je(c)]),y=h?await Xe(t.storePassword,l,u):void 0,m=await qn(c,t.theme),f=m.id.toString();return Ee({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:d}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${l}/admin/themes/${f}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:Nn,options:{theme:m,adminSession:c,storefrontPassword:y,crawlerSignatureHeaders:u,themeExtensionDirectory:a,themeExtensionPort:i}}}var Nn=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await ur(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function qn(t,e){let r;if(e)g(`Fetching theme with provided id ${e}`),r=await _e(parseInt(e,10),t);else{let o=new Le(t,{devPreview:!0});await be([{title:"Configuring host theme for theme app extension",task:async()=>{g("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new A("Could not find or create a host theme for theme app extensions");return r}async function Wn(t){return t.developerPlatformClient?.clientName===Vr.AppManagement?`https://${await we()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Ct()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function Hn(t){let e=S(t.directory,"locales");return ge([S(e,"*.json")])}async function ko(t,e){let r=await Hn(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),Gn(a,s,o,t,e)})),o.lastUpdated=Date.now(),g(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function Gn(t,e,r,o,n){let s;try{s=await L(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw C(i,n.stderr),new Error(i)}}p();function $e(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}var at=".js.map";async function te(t,e,r,o){return F({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await ko(t,r),c=await Mr(t),d=t.outputRelativePath?ue(n):n,l=await Bn(t,s,d,o),u=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(u=Lo(t.configuration.metafields)),{assets:{main:ce(l)&&l[0]?.assets?.main?l[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await he(n)??0}},supportedFeatures:{runsOffline:t.configuration.supported_features?.runs_offline??!1},capabilities:{blockProgress:t.configuration.capabilities?.block_progress??!1,networkAccess:t.configuration.capabilities?.network_access??!1,apiAccess:t.configuration.capabilities?.api_access??!1,collectBuyerConsent:{smsMarketing:t.configuration.capabilities?.collect_buyer_consent?.sms_marketing??!1,customerPrivacy:t.configuration.capabilities?.collect_buyer_consent?.customer_privacy??!1},iframe:{sources:t.configuration.capabilities?.iframe?.sources??[]}},development:{...r.currentDevelopmentPayload,resource:$e(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:l,localization:a??null,metafields:u,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:c?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function Bn(t,e,r,o){let n=t.configuration,s=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(s=[{target:"purchase.post.render"}]),ce(s)){let a=await Kn(r);return Promise.all(s.map(async i=>{let{target:c,resource:d}=i,l="metafields"in i?Lo(i.metafields??[]):void 0,u={...i,...l?{metafields:l}:{},surface:ke(c),root:{url:`${e}/${c}`},resource:d||{url:""}},h=a?.[c];if(!h)return u;let m=await Jn(h,{target:c,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...u,...m}}))}return s}async function Kn(t){try{let e=S(t,"manifest.json"),r=await L(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 jn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,c=e[s];if(typeof c=="string"){let y=await Me(s,i,typeof a=="string"?a:c,r,o,n,typeof a=="string"?c:void 0);return{assets:{[y.name]:y}}}let l=e.build_manifest?.assets?.[s];if(l?.filepath){let u=await Me(s,i,l.filepath,r,o,n,l.module);return{assets:{[u.name]:u}}}return{}}async function Vn({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await he(S(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function zn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,c)=>{let d=i.schema,l=s[c]?.schema,u=typeof l=="string"?l:d,h=typeof l=="string"?d:void 0;return{...i,schema:await Me("schema",`${t}/intents/${c}/schema`,u,r,o,n,h)}}))}:{}}async function Yn({target:t,url:e,extension:r,resolver:o},n,s){let a=await Me(n,`${t}/${n}`,s,e,r,o);return await Qn(t,s,r,o),{assets:{[a.name]:a}}}async function Qn(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(at)&&await D(S(r.directory,n))&&o.set(`${t}/${gt(n)}`,n)}async function Jn(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return Xn(o,n)?zn(e,n):Zn(o,n)?Yn(e,o,n):es(o,n)?Vn(e,o,n):jn(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function Lo(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function ce(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Me(t,e,r,o,n,s,a){let i=`${e}${de(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await he(S(n.directory,a??r))??0}}function Xn(t,e){return t==="intents"&&Array.isArray(e)}function Zn(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function es(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as ts}from"events";var le;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(le||(le={}));async function $o(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:ao(t.storeFqdn,t.apiKey),mobileUrl:co(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>te(n,e,t,r&&it(r,n.devUUID))))}}function it(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var Fe=class extends ts{options;rawPayload;assetResolvers;constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=J(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(ce(n.extensionPoints)&&ce(o.extensionPoints)){let s=n.extensionPoints.reduce((c,d)=>({...c,[d.target]:d}),{});o.extensionPoints=J(o.extensionPoints,n.extensionPoints,c=>c.map(d=>{let l=s[d.target];return l?J(d,l,(u,h)=>h):d}));let{extensionPoints:a,...i}=n;return J(o,i)}return J(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){g(b`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await te(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},it(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await te(e,r,this.options,it(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(le.Update,e)}};p();p();var j;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(j||(j={}));function Mo(t,e){return(r,o,n)=>{r.url==="/extensions"&&(g("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,rs(t,e)))}}function rs(t,e){return r=>{g("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};g(b`Sending connected payload: ${P.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",is(t,e))}}function os(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?P.json(o).output():String(o)).join(" ");return b`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var ns={debug:t=>P.gray(t),warn:t=>P.yellow(t),error:t=>P.errorText(t)};function ss({type:t,message:e}){let r=os(e);switch(t){case"debug":case"warn":case"error":return b`${ns[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function as(t,e){F({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(ss(t))})}function is(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(g(b`Received websocket message with event type ${n} and data:
2
+ ${P.json(s)}
3
+ `,e.stdout),n===j.Update){let a=e.payloadStore.getRawPayload().app.apiKey,i=s.app?.apiKey;if(s.app){if(a!==i)return;e.payloadStore.updateApp(s.app)}s.extensions&&e.payloadStore.updateExtensions(s.extensions)}else if(n===j.Dispatch){let a=cs(o,e);Do(t,a,e)}else n===j.Log&&as(s,e)}}function Fo(t,e){return r=>{let o={event:j.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};g(b`Sending websocket update event to the websocket clients:
4
+ ${P.json(o)}
5
+ `,e.stdout),Do(t,o,e)}}function Do(t,e,r){g(b`Sending websocket with event type ${e.event} and data:
6
+ ${P.json(e.data)}
7
+ `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function cs(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var ls=10;function Oo(t){let e=new Mt.default({noServer:!0,clientTracking:!0}),r=ps(e);return t.httpServer.on("upgrade",Mo(e,t)),t.payloadStore.on(le.Update,Fo(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function ps(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},ls*1e3)}p();p();p();function No(t,e){let{url:r}=$e(t.type,e);if(t.surface==="checkout"&&r){let o=new URL(`https://${e.storeFqdn}/`);return o.pathname=r,o.searchParams.append("dev",`${e.url}/extensions`),o.toString()}else{let o=new URL(`https://${e.storeFqdn}/`);return o.pathname="admin/extensions-dev",o.searchParams.append("url",De(t,e)),o.toString()}}function qo(t,e,r){let o=ke(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",De(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=us(e,r,t);break;default:return}return n.toString()}function us(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 De(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function O(t,e){Zt(t,Xt(e))}p();var ct=class extends X{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function Wo(t){let e=await ds(t),r=await L(e);return Jt(r,t.data)}async function ds(t){let e=await ms(),r=[];t.extensionSurface&&r.push(S(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(S(e,`${t.template}.html.liquid`));let o=await ge(r);if(o.length===0)throw new ct(t);return o[0]}async function ms(){return await Pt("templates/ui-extensions/html",{type:"directory",cwd:yt(import.meta.url)})}var Ho=q(t=>{H(t,"Access-Control-Allow-Origin","*"),H(t,"Access-Control-Allow-Methods","GET, OPTIONS"),H(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),Go=q(t=>{H(t,"Cache-Control","no-cache")}),lt=q(async t=>Te(t,"/extensions",307));async function fs(t,e){let{filePath:r}=e;if(!await D(r))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await vt(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await D(r)))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await L(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".map":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},s=de(r),a=n[s]||"text/plain";return H(t,"Content-Type",a),o}function Bo({getExtensions:t,payloadStore:e}){return q(async r=>{let{extensionId:o,assetPath:n=""}=Ae(r),s=t().find(h=>h.devUUID===o);if(!s)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n),c=i??n,d=c.endsWith(at);if(d&&i===void 0)return O(r,{statusCode:404,statusMessage:"Not Found"});let l=Ge(d?s.directory:Dr(s.outputPath)),u=Ge(S(l,c));return wt(l,u)?fs(r,{filePath:u}):O(r,{statusCode:404,statusMessage:"Not Found"})})}function pt({payloadStore:t}){return q(e=>(H(e,"content-type","application/json"),t.getRawPayload()))}function Ko({devOptions:t}){return q(e=>{g(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function ut({devOptions:t,getExtensions:e}){return q(async r=>{let{extensionId:o}=Ae(r),n=e().find(i=>i.devUUID===o);if(!n)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(er(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return Wo({data:{url:De(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=No(n,t);return Te(r,i,307)}}let a=t.appWatcher.buildOutputPath;return H(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:re(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await te(n,a,t)}})}function jo({devOptions:t,getExtensions:e}){return q(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Ae(r),s=e().find(i=>i.devUUID===o);if(!s)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return O(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=qo(n,s,t);return a?Te(r,a,307):O(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as hs}from"http";function Vo(t){let e=tr(),r=rr();e.use(Ko(t)),e.use(Ho),e.use(Go),r.use("/extensions/dev-console",lt),r.use("/extensions/:extensionId",ut(t)),r.use("/extensions/:extensionId/",ut(t)),r.use("/extensions/:extensionId/:extensionPointTarget",jo(t)),r.use("/extensions/:extensionId/assets/**:assetPath",Bo(t)),r.use("/extensions",pt(t)),r.use("/extensions/",pt(t)),r.use("/",lt),e.use(r);let o=hs(or(e));return o.listen(t.devOptions.port,"localhost"),o}async function zo(t){let e={...t,websocketURL:re(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await $o(e,r,o),s=new Fe(n,e,o),a=e.extensions.filter(u=>u.isPreviewable),i=()=>a;g("Setting up the UI extensions HTTP server...",e.stdout);let c=Vo({devOptions:e,payloadStore:s,getExtensions:i});g("Setting up the UI extensions Websocket server...",e.stdout);let d=Oo({...e,httpServer:c,payloadStore:s});g("Setting up the UI extensions bundler and file watching...",e.stdout);let l=async({appWasReloaded:u,app:h,extensionEvents:y})=>{u&&(a=h.allExtensions.filter(m=>m.isPreviewable));for(let m of y){if(!m.extension.isPreviewable)continue;let f=m.buildResult?.status==="ok"?"success":"error",U=m.buildResult?.status==="error"?{message:m.buildResult.error,file:m.buildResult.file}:void 0;switch(m.type){case ee.Created:if(e.extensions.push(m.extension),!e.checkoutCartUrl){let E=await Ie(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(m.extension,r);break;case ee.Updated:await s.updateExtension(m.extension,e,r,{status:f,error:U});break;case ee.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==m.extension.devUUID),await s.deleteExtension(m.extension);break}}};e.appWatcher.onEvent(l).onStart(l),e.signal.addEventListener("abort",()=>{g("Closing the UI extensions dev server..."),d.close(),c.close()})}function re(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var gs="3",ws=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:c,proxyUrl:d,appName:l,appDotEnvFile:u,appId:h,grantedScopes:y,allExtensions:m,appDirectory:f,appWatcher:U})=>{await zo({appName:l,appDotEnvFile:u,appDirectory:f,id:h,extensions:m,stdout:e,stderr:t,signal:r,url:d,port:i,storeFqdn:ye(n),storeId:s,apiKey:o,grantedScopes:y,checkoutCartUrl:c,subscriptionProductUrl:a,manifestVersion:gs,appWatcher:U})};async function Yo({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await Ie(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:ws,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();function V(t){let e=t.find(o=>Z(o,W.Frontend)),r=t.find(o=>Z(o,W.Backend));return{frontendConfig:e,backendConfig:r}}p();async function Qo(t){let r={topic:"app/uninstalled",api_version:(await lo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:mo.LOCALHOST,shared_secret:t.sharedSecret},o=await po(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await ae(3);let n=await ys(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function ys(t,e){let r=0;for(;r<3;){try{return await uo(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof At&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await ae(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var vs=async({stdout:t},e)=>{await Qo({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function Jo({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=V(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:vs,options:{deliveryPort:a?r:o,webhooksPath:c,organizationId:n,...s}}}p();async function Xo(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Ps}}var Ps=async({stdout:t,abortSignal:e},r)=>{let o=fo({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=sr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",()=>{n.close()})};p();async function en({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=V(t),c=i?.configuration.hmr_server?await M():void 0,d=void 0,l=t.map(async u=>{let h=await xs({web:u,frontendPort:r,backendPort:o}),y=c&&u.configuration.roles.includes(W.Frontend)?{port:c,httpPaths:u.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:u.configuration.name??["web",...u.configuration.roles].join("-"),function:Es,options:{port:h,portFromConfig:u.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:u.directory,devCommand:u.configuration.commands.dev,preDevCommand:u.configuration.commands.predev,scopes:a,shopCustomDomain:d,hmrServerOptions:y,roles:u.configuration.roles}}});return Promise.all(l)}async function xs({web:t,frontendPort:e,backendPort:r}){return Z(t,W.Frontend)?e:Z(t,W.Backend)?r:M()}async function Es({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:c,directory:d,devCommand:l,preDevCommand:u,scopes:h,shopCustomDomain:y,hmrServerOptions:m}){let f=m?.port,U={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:h,NODE_ENV:"development",...y&&{SHOP_CUSTOM_DOMAIN:y},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${c}`,...f&&{HMR_SERVER_PORT:`${f}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:d,port:o,env:U,stdout:t,stderr:e};u&&(t.write(`Running pre-dev command: "${u}"`),await Zo({...E,command:u,showOutput:Vt()})),await Zo({...E,command:l,showOutput:!0})}async function Zo({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let c=t.split("&&").map(d=>d.trim())??[];for(let d of c){let[l,...u]=d.split(" ");l?.length!==0&&await Ue(l,u,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var Oe=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(b`${P.yellow(e)}`.value)}async success(e){await this.log(b`${P.green(e)}`.value)}async debug(e){g(e,this.stdout)}async error(e,r){let o=P.errorText("\u274C Error"),n=P.errorText(`\u2514 ${e}`);await this.log(b`${o}`.value,r),await this.log(b`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e,r){if(!e||r.status==="remote-error"||r.status==="unknown-error")return;let o={status:r.status},n=e.extensionEvents??[],a=(await Promise.all(n.map(async c=>c.type===ee.Deleted?[]:(await c.extension.getDevSessionUpdateMessages(o))?.map(l=>({message:l,prefix:c.extension.handle}))??[]))).flat(),i=a.map((c,d)=>{let l=b`${P.gray(d===a.length-1?"\u2514 ":"\u2502 ")}${c.message}`.value;return this.log(l,c.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=P.errorText("\u274C Error");await this.log(b`${r}`.value,"app-preview");let o=e.map(n=>{let s=P.errorText(`\u2514 ${n.error}`);return this.log(b`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await F({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(e)})}};p();var Ne=class{processBatch;queue=[];processingPromise=void 0;constructor(e){this.processBatch=e}enqueue(e){this.queue.push(e),this.processingPromise??=this.startProcessing()}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var qe=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}statusManager;logger;options;appWatcher;bundlePath;appEventsProcessor;failedEvents=[];currentSessionState=null;constructor(e,r){this.statusManager=e.devSessionStatusManager,this.logger=new Oe(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ne(o=>this.processEvents(o))}async start(){await this.logger.info(`Preparing dev preview on ${this.options.storeFqdn}`),this.statusManager.setMessage("LOADING"),this.appWatcher.onEvent(async e=>this.onEvent(e)).onStart(async e=>this.onStart(e)).onError(async e=>this.handleDevSessionResult({status:"unknown-error",error:e}))}async onEvent(e){await this.validateAppEvent(e)&&this.appEventsProcessor.enqueue(e)}async processEvents(e){let r=[...this.failedEvents,...e],o=this.consolidateAppEvents(r);if(this.failedEvents=[],!o)return;this.statusManager.setMessage("CHANGE_DETECTED"),this.updatePreviewURL(o),await this.logger.logExtensionEvents(o);let n=Zr(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${tt(n)}ms - Total: ${tt(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let a of e)for(let i of a.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new A(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR"),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){e.status==="updated"?(await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage()):e.status==="created"?(this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r,e),this.statusManager.setMessage("READY")):(e.status==="remote-error"||e.status==="unknown-error")&&(await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR"):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR"))),!this.statusManager.status.isReady&&!zt()&&setImmediate(()=>{throw new A("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:this.options.appPreviewURL,appEmbedded:e.app.configuration.embedded,hasExtensions:r})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=re(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o,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 Error("Unauthorized");if(r instanceof Rt)throw r.response.status===401||r.response.status===403?new A("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new A("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await to(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await xt(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=S(ue(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...ro];r&&n.push("manifest.json"),await oo(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await no(s,o),s}async getSignedURLWithRetry(){return so(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.warnings??[],s=r.devSessionUpdate?.devSession;if(s&&this.currentSessionState){let a=re(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 d=`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 A(d,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 tn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:bs,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var bs=async({stdout:t},e)=>{await qe.start(e,t)};p();p();p();var rn=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=Et().substring(0,6),i=`${Ss(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,c=To({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),d=S(n,i);try{return await fe(n),await me(d,c),{fullOutputPath:d,identifier:s}}catch(l){throw r.write(`Error while writing log to file: ${l}
8
+ `),l}};function Ss(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),s=e.getUTCHours().toString().padStart(2,"0"),a=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),c=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${c}Z`}var We=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:d=0})=>{if(!i?.aborted)try{let l=e,u=wo,h=d,y=await o.appLogs({jwtToken:e,cursor:r},a),{errors:m,status:f}=y;if(f===200){h=0;let{app_logs:E}=y;for(let R of E){let x=JSON.parse(R.payload);await F({outputPrefix:R.source,stripAnsi:!1},async()=>{R.log_type===Po?(Us(R,x,t),x=new ho(go(x))):R.log_type.startsWith(xo)?Rs(R,x,t):t.write(JSON.stringify(x));let _=await rn({appLog:R,appLogPayload:x,stdout:t,storeName:s,logsDir:c});t.write(b`${P.gray("\u2514 ")}${P.link("Open log file",`file://${_.fullOutputPath}`,`Log: ${_.fullOutputPath}`)} ${P.gray(`(${_.identifier})`)}\n`.value)})}}else{let E={errors:m.map(x=>({message:x,status:f}))},R=await Ao({response:E,onThrottle:x=>{C("Request throttled while polling app logs.",t),C(`Retrying in ${x/1e3} seconds.`,t)},onUnknownError:x=>{C("Error while polling app logs.",t),C(`Retrying in ${x/1e3} seconds.`,t)},onResubscribe:()=>n()});if(R.resubscribeResult==="failed"){if(h+=1,h>=yo){C("App log streaming session has expired. Please restart your dev session.",t);return}}else R.resubscribeResult==="succeeded"&&(h=0);R.nextJwtToken&&(l=R.nextJwtToken),u=R.retryIntervalMs}let{cursor:U}=y;setTimeout(()=>{We({stdout:t,appLogsFetchInput:{jwtToken:l,cursor:U??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:h}).catch(E=>{g(`Unexpected error during polling: ${E}}
9
+ `)})},u)}catch(l){C("Error while polling app logs.",t),C(`Retrying in ${ot/1e3} seconds.`,t),g(`${l}}
10
+ `),setTimeout(()=>{We({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c}).catch(u=>{g(`Unexpected error during polling: ${u}}
11
+ `)})},ot)}};function Us(t,e,r){let o=(e.fuel_consumed/vo).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
12
+ `).filter(Boolean).map(s=>b`${P.gray("\u2502 ")}${s}`.value).join(`
13
+ `))}function Rs(t,e,r){t.log_type===Eo?r.write("Function network access response retrieved from cache."):t.log_type===bo?e.reason===Uo?r.write("Function network access request executing in background because there is no cached response."):e.reason===Ro&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===So&&(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 As(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function on({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:Ts,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var Ts=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:c})=>{async function d(l){let u=await nt(o,n,a,t),h=c.getLogsDir();await fe(h),await We({stdout:t,appLogsFetchInput:{jwtToken:u},resubscribeCallback:()=>nt(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:l,logsDir:h})}try{let l=!1,u,h=async y=>{let m=As(y.app);if(m&&!l){g("Function extensions detected, starting logs polling"),l=!0,u=new AbortController;try{await d(u.signal)}catch(f){g(`Failed to start function logs: ${f}`,e)}}else!m&&l&&(g("No function extensions detected, stopping logs polling"),l=!1,u?.abort(),u=void 0)};i.onStart(h).onEvent(h)}catch{}};p();async function nn(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:_s}}var _s=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};p();import{EventEmitter as Cs}from"events";var Is={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"}},He=class extends Cs{currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0};constructor(e){super(),e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};kt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e){this.updateStatus({statusMessage:Is[e]})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};p();import*as sn from"http";import*as an from"https";function cn(t){return"errors"in t&&Array.isArray(t.errors)}async function ln(t,e,r,o){let s=(await import("./http-proxy-node16-D3JUYA5D.js")).default.createProxyServer(),a=Ls(t,s,o),i=r?an.createServer(r,a):sn.createServer(a);return i.on("upgrade",ks(t,s,o)),e.addEventListener("abort",()=>{g("Closing reverse HTTP proxy"),i.close()}),{server:i}}function ks(t,e,r){return function(o,n,s){let a=pn(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let d=(cn(i)?i.errors[i.errors.length-1]:void 0)??i;C(`Error forwarding websocket request: ${d.message}`,r),C(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function Ls(t,e,r){return function(o,n){let s=pn(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=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let c=(cn(a)?a.errors[a.errors.length-1]:void 0)??a;C(`Error forwarding web request: ${c.message}`,r),C(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});g(b`
14
+ Reverse HTTP proxy error - Invalid path: ${o.url??""}
15
+ These are the allowed paths:
16
+ ${P.json(JSON.stringify(t))}
17
+ `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function pn(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 un({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:c,graphiqlKey:d}){let l=o.apiKey,u=o.apiSecretKeys[0]?.secret??"",h=bt(),y=!ft(h[Ce.disableGraphiQLExplorer]),m=await Kr(t),f=new eo(m,i.proxyUrl),U=await we(),E=io(n,l,U),R=E,x=nr(d,u,n),_=y?`http://localhost:${c}/graphiql?key=${encodeURIComponent(x)}`:void 0,ne=m.configuration.embedded,Y=m.nonConfigExtensions.length>0,N=new He({isReady:!1,previewURL:R,graphiqlURL:_,appEmbedded:ne,hasExtensions:Y}),G=[...await en({webs:m.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:l,apiSecret:u,scopes:$r(m.configuration)}),y?await Xo({appName:o.title,appUrl:E,port:c,apiKey:l,apiSecret:u,key:x,storeFqdn:n}):void 0,await Yo({allExtensions:m.realExtensions,storeFqdn:n,storeId:s,apiKey:l,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:m.name,appDotEnvFile:m.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:m.directory,appWatcher:f}),await tn({app:m,apiKey:l,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:f,appPreviewURL:E,devSessionStatusManager:N,unsafeValidation:a.unsafeValidation}),await Io({remoteApp:o,localApp:m,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),Jo({webs:m.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:u,remoteAppUpdated:e}),await on({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:l},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:f}),await nn({appWatcher:f})].filter($s);return{processes:await Ms(G,i.proxyPort,i.reverseProxyCert),previewUrl:R,graphiqlUrl:_,devSessionStatusManager:N}}var $s=t=>t!==void 0&&t!==!1;async function Ms(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(W.Frontend)){let c=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${c}`;let d=a.options.hmrServerOptions;d&&(i.websocket=`http://localhost:${d.port}`,d.httpPaths.forEach(l=>i[l]=`http://localhost:${d.port}`)),a.options.port=c}else if(a.type==="previewable-extension"){let c=await 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:Fs,options:{port:e,rules:s,localhostCert:r}}),n}var Fs=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await ln(o,t,n,e);B(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();p();p();var oe=Q(ve(),1);var dn=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function mn(){let[t,e]=(0,oe.useState)(0);return(0,oe.useEffect)(()=>{let r=setInterval(()=>{e(o=>(o+1)%dn.length)},70);return()=>clearInterval(r)},[]),oe.default.createElement($,null,dn[t])}p();var T=Q(ve(),1);var fn=.9,hn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Ft(),{isRawModeSupported:o}=Pe(),[n,s]=(0,T.useState)(e),[a,i]=(0,T.useState)(Math.floor(r.columns*fn)),[c,d]=(0,T.useState)(!0),l=(0,T.useRef)(null);if(!n)throw new Error("No tabs provided");xe((m,f)=>{(async()=>{if(f?.leftArrow||f?.rightArrow||f?.tab){let x=Object.entries(t).filter(([G,v])=>v.content),_=x.findIndex(([G])=>G===n);if(_===-1)return;let ne=f?.leftArrow?-1:1,Y=(_+ne+x.length)%x.length,N=x[Y];N&&s(N[0])}let E=t[m];if(E){E.action?await E.action():s(m);return}let R=t[n];if(R?.shortcuts){let x=R.shortcuts.find(_=>_.key===m);x&&(!x.condition||x.condition())&&await x.action()}})()},{isActive:!!o}),(0,T.useLayoutEffect)(()=>{let m=()=>{if(i(Math.floor(r.columns*fn)),!l.current)return;let f=Dt(l.current);d(f.width<r.columns)};return r.on("resize",m),()=>{r.off("resize",m)}},[r]);let u=Object.entries(t).map(([m,f])=>({...f,inputKey:m,header:` (${m}) ${f.label} `})),h=u.filter(m=>!m.action),y=u.filter(m=>m.action);return T.default.createElement(T.default.Fragment,null,T.default.createElement(k,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},T.default.createElement(k,{ref:l,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},T.default.createElement($,{wrap:"truncate-end"},"\u2502",h.map(m=>T.default.createElement(T.default.Fragment,{key:m.inputKey},T.default.createElement($,{bold:n===m.inputKey,inverse:n===m.inputKey,wrap:"truncate"},m.header),"\u2502")))),c&&T.default.createElement(k,{flexGrow:1,justifyContent:"flex-end"},y.map((m,f)=>T.default.createElement($,{wrap:"truncate",key:m.inputKey},"(",m.inputKey,") ",m.label,f<y.length-1&&" \u2502 ")))),T.default.createElement(k,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var w=Q(ve(),1);var gn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:c,onAbort:d})=>{let{isRawModeSupported:l}=Pe(),[u,h]=(0,w.useState)(void 0),[y,m]=(0,w.useState)(void 0),[f,U]=(0,w.useState)(r.status),[E,R]=(0,w.useState)(!1),{isAborted:x}=Gt(t.signal,async v=>{v&&m(typeof v=="string"?v:v.message),r.status.isReady?R(!0):(h("Shutting down dev ..."),await d()),_o()}),_=(0,w.useMemo)(()=>e.map(v=>({...v,action:async(pe,An,Tn)=>{try{return await v.action(pe,An,Tn)}catch(_n){t.abort(_n)}}})),[e,t]);(0,w.useEffect)(()=>(r.on("dev-session-update",U),()=>{r.off("dev-session-update",U)}),[]),xe((v,pe)=>{Nt(v,pe,()=>t.abort())},{isActive:!!l});let ne=v=>{switch(v){case"loading":return w.default.createElement(mn,null);case"success":return"\u2705";case"error":return"\u274C"}},Y=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:f.previewURL,condition:()=>!!(f.isReady&&f.previewURL),action:async()=>{await K.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),f.previewURL&&await Se(f.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:rt(o),condition:()=>!!(f.isReady&&f.appEmbedded===!1&&f.hasExtensions),action:async()=>{await K.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Se(rt(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:f.graphiqlURL,condition:()=>!!(f.isReady&&f.graphiqlURL),action:async()=>{await K.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),f.graphiqlURL&&await Se(f.graphiqlURL)}}],N=Y.filter(v=>v.condition?.()??!0),G={d:{label:"Dev status",shortcuts:Y,content:w.default.createElement(w.default.Fragment,null,f.statusMessage&&w.default.createElement($,null,ne(f.statusMessage.type)," ",f.statusMessage.message),l&&N.length>0&&w.default.createElement(k,{marginTop:1,flexDirection:"column"},N.map(v=>w.default.createElement($,{key:v.key},qt.pointerSmall," ",w.default.createElement($,{bold:!0},"(",v.key,")")," ",ze()&&v.url?w.default.createElement(je,{url:v.url,label:v.shortcutLabel}):v.shortcutLabel))),w.default.createElement(k,{marginTop:l?1:0,flexDirection:"column"},u?w.default.createElement($,null,u):w.default.createElement(w.default.Fragment,null,f.isReady&&!(l&&ze())&&w.default.createElement(w.default.Fragment,null,N.filter(v=>v.url).map(v=>w.default.createElement($,{key:v.key},v.linkLabel," URL: ",w.default.createElement(je,{url:v.url})))))))},a:{label:"App info",content:w.default.createElement(k,{flexDirection:"column"},w.default.createElement(Ve,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":c??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,v])=>v)}))},s:{label:"Store info",content:w.default.createElement(k,{flexDirection:"column"},w.default.createElement(Ve,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,v])=>v)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return w.default.createElement(w.default.Fragment,null,w.default.createElement(Wt,{processes:_,prefixColumnSize:Fr,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&w.default.createElement(k,{marginTop:1,flexDirection:"column"},w.default.createElement(Ht,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),x?null:w.default.createElement(k,{paddingTop:1,flexDirection:"column",flexGrow:1},l?w.default.createElement(hn,{tabs:G,initialActiveTab:"d"}):w.default.createElement(k,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},G.d?.content)),y?w.default.createElement(k,{marginTop:1,flexDirection:"column"},w.default.createElement($,{color:"red"},y)):null)};var wn=Q(ve(),1);async function yn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:c,organizationName:d,configPath:l,localURL:u}){if(Kt())return Ot(wn.default.createElement(gn,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:c,organizationName:d,configPath:l,localURL:u,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await Ds({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o})}async function Ds({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){return process.stdout.write(`
18
+ Preview URL: ${e}
19
+ `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
20
+ `),Promise.all(t.map(async n=>{await n.action(process.stdout,process.stderr,o.signal)}))}p();function vn(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];se({headline:[`A random port will be used for ${n.for} because ${n?.requested} is not available.`],body:["If you want to use a specific port, you can choose a different one by setting the ",{command:n?.flagToRemedy}," flag."]});return}let r=Be(e.map(n=>n.for)).join(" "),o=Be(e.map(n=>({command:n.flagToRemedy})));se({headline:[`Random ports will be used for ${r} because the requested ports are not available.`],body:["If you want to use specific ports, you can choose different ports using the",...o,"flags."]})}p();async function Pn(t,e){return e?e.includes("localhost")?"localhost":(await _t(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var xn=Q(In(),1);var z="v1.4.4",En="FiloSottile/mkcert",dt=P.genericShellCommand("mkcert");async function Os(t,e,r,o){let n=e[Ce.mkcertBinaryPath];if(n)return n;let a=S(t,r==="win32"?"mkcert.exe":"mkcert");if(await D(a))return a;let i=await(0,xn.default)("mkcert",{nothrow:!0});return i?(g(b`Found ${dt} at ${P.path(i)}`),i):(await Ns(a,r,o),a)}async function Ns(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${z}-darwin-arm64`:`mkcert-${z}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${z}-linux-arm64`:`mkcert-${z}-linux-amd64`;break;case"win32":o=`mkcert-${z}-windows-amd64.exe`;break;default:throw new X(`Unsupported platform: ${e}`)}await hr(En,z,o,t),g(b`${dt} saved to ${P.path(t)}`)}async function qs(t){let e=S(t,"mkcert-LICENSE");if(await D(e))return;let r=`https://raw.githubusercontent.com/${En}/refs/tags/${z}/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 Tt(r),!n.ok)return o}catch{return o}let s=await n.text();await me(e,s)}async function bn({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=S(".shopify","localhost-key.pem"),a=S(".shopify","localhost.pem"),i=S(t,s),c=S(t,a);if(await D(i)&&await D(c))return{keyContent:await L(i),certContent:await L(c),certPath:a};if(!(e??await jr()))throw new A(`Localhost certificate and key are required at ${a} and ${s}`);let l="",u;return await be([{title:"Finding or downloading mkcert binary",task:async()=>{let y=S(t,".shopify");l=await Os(y,r,o,n),u=await qs(y),g(b`${dt} found at: ${P.path(l)}`)}}]),u&&Ee(u),B(b`Generating self-signed certificate for localhost. You may be prompted for your password.`),await Ue(l,["-install","-key-file",i,"-cert-file",c,"localhost"]),B(b`${P.successIcon()} Certificate generated at ${a}\n`),await jt()&&(se({headline:"It looks like you're using WSL.",body:["Additional steps are required to configure certificate trust in Windows."],link:{label:"See Shopify CLI documentation",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development-with-windows-subsystem-for-linux-wsl"}}),B("\u{1F449} Press any key to continue"),await Bt(),B("")),{keyContent:await L(i),certContent:await L(c),certPath:ht(t,c)}}p();function Sn(){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 A(t,void 0,[e],[r])}async function Un(t){let e=await Ws(t);await Hs(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:s}=await un(e);await Bs(e),await Vs({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:s})}async function Ws(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:s,tunnel:a}=t,i;if(a.mode==="auto"){let E=await M();i=await Gr(t.commandConfig,E,"cloudflare")}let c=await zr(r,o,s,r.flags);r.configuration=c,Yr({app:e,remoteApp:r,selectedStore:n,cachedInfo:et(t.directory),organization:t.organization,tunnelMode:a.mode}),e.configuration.build?.dev_store_url&&(e.configuration.build={...e.configuration.build,dev_store_url:n.shopDomain},await(await Yt.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Lr(t.project);let d=t.graphiqlPort??await M(ie.graphiql),l=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??ie.graphiql,actual:d}];a.mode==="use-localhost"&&l.push({for:"localhost",flagToRemedy:"--localhost-port",requested:a.requestedPort,actual:a.actualPort}),vn(l);let{webs:u,...h}=await js(e.directory,e.webs,d,a,i,r.configuration,t.installMkcert);e.webs=u;let y=e.configuration.build?.automatically_update_urls_on_dev,m=et(t.directory)?.previousAppId,f=r.apiKey,U=await Ks(u,t.update,h,e,y,r,f);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==m,localApp:e,developerPlatformClient:o,commandOptions:t,network:h,partnerUrlsUpdated:U,graphiqlPort:d,graphiqlKey:t.graphiqlKey}}async function Hs(t){await Gs(t)}async function Gs(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||Sn()}async function Bs(t){Or({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await zs({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Lt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Ks(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=V(t),d=!1;if((c??i)&&e){let l=qr(r.proxyUrl,t.map(({configuration:u})=>u.auth_callback_path).find(u=>u),o.configuration.app_proxy);d=await Hr({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:l}),d&&o.setDevApplicationURLs(l)}return d}async function js(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=V(e);await Ys(e,r);let d=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:l,frontendPort:u,usingLocalhost:h},y,m]=await Promise.all([Nr(d),St()??i?.configuration.port??M(),Wr(s)]),f=h?`${l}:${u}`:l,U=c?.configuration.port;c&&(U??=c===i?y:await M(),c.configuration.port=U),U=U??await M();let E;if(o.mode==="use-localhost"){let{keyContent:R,certContent:x,certPath:_}=await bn({appDirectory:t,forceInstall:a});E={key:R,cert:x,certPath:_,port:o.actualPort}}return{proxyUrl:f,proxyPort:u,frontendPort:U,backendPort:y,currentUrls:m,webs:e,reverseProxyCert:E}}async function Vs({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let s=new Ut,a=t.map(d=>({prefix:d.prefix,action:async(u,h,y)=>{let m=d.function;return m({stdout:u,stderr:h,abortSignal:y},d.options)}})),i=o.developerPlatformClient,c={id:o.remoteApp.id,developerPlatformClient:i};return yn({processes:a,previewUrl:e,graphiqlUrl:r,app:c,abortController:s,shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl})}async function zs(t){let e=await Pn(t.devOptions.commandConfig,t.tunnelUrl);await K.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?Ke(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:Ke(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await K.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function Ys(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);if(o)throw new A(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await Ye(n))throw new A(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await Ye(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new A(s,a)}})()])}p();async function Rn({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??ie.localhost,n=await 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 A(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var I=Q(Cn(),1);var mt=class t extends Jr{static get requiresSyncAnalytics(){return!0}static summary="Run the app.";static descriptionWithMarkdown="Builds and previews your app on a dev store, and watches for changes. [Read more about testing apps locally](https://shopify.dev/docs/apps/build/cli-for-apps/test-apps-locally).";static description=this.descriptionForHelp();static flags={...Qt,...kr,"client-id":I.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:I.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>ye(e)}),"skip-dependencies-installation":I.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":I.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":I.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":I.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":I.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":I.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":I.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":I.Flags.boolean({description:"Install and use mkcert to generate localhost certificates when --use-localhost is enabled without prompting.",env:"SHOPIFY_FLAG_INSTALL_MKCERT",dependsOn:["use-localhost"]}),"localhost-port":Re({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:I.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Re({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":I.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:I.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":Re({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":I.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 Rn({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await $t(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await Br(e.path);let o=await Qr({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),n=await Xr({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option"}),s={...o,store:n,directory:e.path,update:!e["no-update"],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};return await Un(s),{app:o.app}}};export{ka as a,mt as b};
@@ -1 +1 @@
1
- import{a as o}from"./chunk-OPOPO7DG.js";import{b as e}from"./chunk-4DLRS7MT.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();var t=class extends e{static description="View the UI kit components that display static output";static hidden=!0;async run(){await o()}};export{t as a};
1
+ import{a as o}from"./chunk-Z35PUKKP.js";import{b as e}from"./chunk-FW5HGFSZ.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();var t=class extends e{static description="View the UI kit components that display static output";static hidden=!0;async run(){await o()}};export{t as a};
@@ -0,0 +1 @@
1
+ import{q as r}from"./chunk-Q45XAEG2.js";import{d as t}from"./chunk-DGMRL5DQ.js";import{b as a}from"./chunk-FW5HGFSZ.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();var e=class extends a{static baseFlags={...a.baseFlags,...t};environmentsFilename(){return r.appEnvironments}};export{e as a};
@@ -1,2 +1,2 @@
1
- import{g as c}from"./chunk-VKWPEFWQ.js";c();c();c();var j=/^[A-Za-z]:\//;function f(e=""){return e&&e.replace(/\\/g,"/").replace(j,n=>n.toUpperCase())}var z=/^[/\\]{2}/,A=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,E=/^[A-Za-z]:$/,v=/^\/([A-Za-z]:)?$/,$="/",R=":",m=function(e){if(e.length===0)return".";e=f(e);let n=e.match(z),t=l(e),s=e[e.length-1]==="/";return e=P(e,!t),e.length===0?t?"/":s?"./":".":(s&&(e+="/"),E.test(e)&&(e+="/"),n?t?`//${e}`:`//./${e}`:t&&!l(e)?`/${e}`:e)},x=function(...e){if(e.length===0)return".";let n;for(let t of e)t&&t.length>0&&(n===void 0?n=t:n+=`/${t}`);return n===void 0?".":m(n.replace(/\/\/+/g,"/"))};function S(){return typeof process<"u"&&typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}var u=function(...e){e=e.map(s=>f(s));let n="",t=!1;for(let s=e.length-1;s>=-1&&!t;s--){let r=s>=0?e[s]:S();!r||r.length===0||(n=`${r}/${n}`,t=l(r))}return n=P(n,!t),t&&!l(n)?`/${n}`:n.length>0?n:"."};function P(e,n){let t="",s=0,r=-1,o=0,a=null;for(let i=0;i<=e.length;++i){if(i<e.length)a=e[i];else{if(a==="/")break;a="/"}if(a==="/"){if(!(r===i-1||o===1))if(o===2){if(t.length<2||s!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let b=t.lastIndexOf("/");b===-1?(t="",s=0):(t=t.slice(0,b),s=t.length-1-t.lastIndexOf("/")),r=i,o=0;continue}else if(t.length>0){t="",s=0,r=i,o=0;continue}}n&&(t+=t.length>0?"/..":"..",s=2)}else t.length>0?t+=`/${e.slice(r+1,i)}`:t=e.slice(r+1,i),s=i-r-1;r=i,o=0}else a==="."&&o!==-1?++o:o=-1}return t}var l=function(e){return A.test(e)};var T=/.(\.[^./]+)$/,h=function(e){let n=T.exec(f(e));return n&&n[1]||""},p=function(e,n){let t=u(e).replace(v,"$1").split("/"),s=u(n).replace(v,"$1").split("/");if(s[0][1]===":"&&t[0][1]===":"&&t[0]!==s[0])return s.join("/");let r=[...t];for(let o of r){if(s[0]!==o)break;t.shift(),s.shift()}return[...t.map(()=>".."),...s].join("/")},d=function(e){let n=f(e).replace(/\/$/,"").split("/").slice(0,-1);return n.length===1&&E.test(n[0])&&(n[0]+="/"),n.join("/")||(l(e)?"/":".")};var g=function(e,n){let t=f(e).split("/").pop();return n&&t.endsWith(n)?t.slice(0,-n.length):t},_=function(e){let n=f(e).split("/").shift()||"/",t=g(e),s=h(t);return{root:n,dir:d(e),base:t,ext:s,name:t.slice(0,t.length-s.length)}};import{fileURLToPath as I}from"url";function X(...e){return x(...e)}function G(e){return m(e)}function J(...e){return u(...e)}function M(e,n){return p(e,n)}function w(e){return l(e)}function D(e){return d(e)}function q(e,n){return g(e,n)}function H(e){return h(e)}function K(e){return _(e)}function N(e,n){let t=e.split(/\/+|\\+/),s=n.split(/\/+|\\+/),r=0;for(;r<t.length&&r<s.length&&t[r]===s[r];)r++;return r>1?t.slice(0,r).join("/"):"/"}function Q(e,n=O()){let t=N(e,n),s=p(n,e),r=s.split("/").filter(o=>o==="..").length;return t==="/"||s===""||r>2?e:s}function Y(e,n){let t=p(e,n);return!t.startsWith("..")&&!w(t)}function ee(e){return D(I(e))}function O(){return m(process.env.INIT_CWD||process.cwd())}function te(e=process.argv){let n=e.indexOf("--path");if(n===-1)return e.find(r=>r.startsWith("--path="))?.split("=")[1];let t=e[n+1];if(!(!t||t.startsWith("-")))return t}function ne(e=process.argv){return e.includes("--json")||e.includes("-j")}function se(e,n){let t=e.replace(/\\/g,"/").split("/"),s=[],r=!1;for(let a of t)a===".."?(r=!0,s.pop()):a!=="."&&s.push(a);let o=s.join("/");return r&&n(`Warning: path '${e}' contains '..' traversal \u2014 sanitized to '${o||"."}'
2
- `),o}export{$ as a,R as b,x as c,X as d,G as e,J as f,M as g,w as h,D as i,q as j,H as k,K as l,N as m,Q as n,Y as o,ee as p,O as q,te as r,ne as s,se as t};
1
+ import{g as c}from"./chunk-VKWPEFWQ.js";c();c();c();var E=/^[A-Za-z]:\//;function f(e=""){return e&&e.replace(/\\/g,"/").replace(E,n=>n.toUpperCase())}var j=/^[/\\]{2}/,z=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,A=/^[A-Za-z]:$/,v=/^\/([A-Za-z]:)?$/,$="/",R=":",m=function(e){if(e.length===0)return".";e=f(e);let n=e.match(j),t=l(e),s=e[e.length-1]==="/";return e=P(e,!t),e.length===0?t?"/":s?"./":".":(s&&(e+="/"),A.test(e)&&(e+="/"),n?t?`//${e}`:`//./${e}`:t&&!l(e)?`/${e}`:e)},x=function(...e){if(e.length===0)return".";let n;for(let t of e)t&&t.length>0&&(n===void 0?n=t:n+=`/${t}`);return n===void 0?".":m(n.replace(/\/\/+/g,"/"))};function S(){return typeof process<"u"&&typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}var u=function(...e){e=e.map(s=>f(s));let n="",t=!1;for(let s=e.length-1;s>=-1&&!t;s--){let r=s>=0?e[s]:S();!r||r.length===0||(n=`${r}/${n}`,t=l(r))}return n=P(n,!t),t&&!l(n)?`/${n}`:n.length>0?n:"."};function P(e,n){let t="",s=0,r=-1,o=0,a=null;for(let i=0;i<=e.length;++i){if(i<e.length)a=e[i];else{if(a==="/")break;a="/"}if(a==="/"){if(!(r===i-1||o===1))if(o===2){if(t.length<2||s!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let b=t.lastIndexOf("/");b===-1?(t="",s=0):(t=t.slice(0,b),s=t.length-1-t.lastIndexOf("/")),r=i,o=0;continue}else if(t.length>0){t="",s=0,r=i,o=0;continue}}n&&(t+=t.length>0?"/..":"..",s=2)}else t.length>0?t+=`/${e.slice(r+1,i)}`:t=e.slice(r+1,i),s=i-r-1;r=i,o=0}else a==="."&&o!==-1?++o:o=-1}return t}var l=function(e){return z.test(e)};var T=/.(\.[^./]+)$/,h=function(e){let n=T.exec(f(e));return n&&n[1]||""},p=function(e,n){let t=u(e).replace(v,"$1").split("/"),s=u(n).replace(v,"$1").split("/");if(s[0][1]===":"&&t[0][1]===":"&&t[0]!==s[0])return s.join("/");let r=[...t];for(let o of r){if(s[0]!==o)break;t.shift(),s.shift()}return[...t.map(()=>".."),...s].join("/")},d=function(e){let n=f(e).replace(/\/$/,"").split("/").slice(0,-1);return n.length===1&&A.test(n[0])&&(n[0]+="/"),n.join("/")||(l(e)?"/":".")};var g=function(e,n){let t=f(e).split("/").pop();return n&&t.endsWith(n)?t.slice(0,-n.length):t},_=function(e){let n=f(e).split("/").shift()||"/",t=g(e),s=h(t);return{root:n,dir:d(e),base:t,ext:s,name:t.slice(0,t.length-s.length)}};import{fileURLToPath as I}from"url";function X(...e){return x(...e)}function G(e){return m(e)}function J(...e){return u(...e)}function M(e,n){return p(e,n)}function O(e){return l(e)}function w(e){return d(e)}function q(e,n){return g(e,n)}function H(e){return h(e)}function K(e){return _(e)}function D(e,n){let t=e.split(/\/+|\\+/),s=n.split(/\/+|\\+/),r=0;for(;r<t.length&&r<s.length&&t[r]===s[r];)r++;return r>1?t.slice(0,r).join("/"):"/"}function Q(e,n=N()){let t=D(e,n),s=p(n,e),r=s.split("/").filter(o=>o==="..").length;return t==="/"||s===""||r>2?e:s}function Y(e,n){let t=p(e,n);return!t.startsWith("..")&&!O(t)}function ee(e){return w(I(e))}function N(){return m(process.env.INIT_CWD||process.cwd())}function te(e=process.argv){let n=e.indexOf("--path");if(n===-1)return e.find(r=>r.startsWith("--path="))?.split("=")[1];let t=e[n+1];if(!(!t||t.startsWith("-")))return t}function ne(e=process.argv){let n=e.indexOf("--"),t=n===-1?e:e.slice(0,n);return t.includes("--json")||t.includes("-j")}function se(e,n){let t=e.replace(/\\/g,"/").split("/"),s=[],r=!1;for(let a of t)a===".."?(r=!0,s.pop()):a!=="."&&s.push(a);let o=s.join("/");return r&&n(`Warning: path '${e}' contains '..' traversal \u2014 sanitized to '${o||"."}'
2
+ `),o}export{$ as a,R as b,x as c,X as d,G as e,J as f,M as g,O as h,w as i,q as j,H as k,K as l,D as m,Q as n,Y as o,ee as p,N as q,te as r,ne as s,se as t};
@@ -0,0 +1 @@
1
+ import{a as m}from"./chunk-OASB6XPV.js";import{D as c,F as l,I as d,a as p}from"./chunk-YX5GRXRS.js";import{b as n}from"./chunk-DGMRL5DQ.js";import{b as a}from"./chunk-FW5HGFSZ.js";import{b as f}from"./chunk-JA2QZ635.js";import{f as s}from"./chunk-3VYOLEQE.js";import{e as h,g as r}from"./chunk-VKWPEFWQ.js";r();var i=h(f(),1);var o=class u extends a{static summary="Provide app security check instructions to a coding agent.";static descriptionWithMarkdown="Prints the complete workflow that a coding agent should follow to review app security check results.\n\nBy default, the instructions are printed to stdout. Use `--copy` to copy them to the clipboard or `--write` to write them to a file. Standalone instructions always start by running `shopify app security check`; only that invocation's generated review pack is trusted as workflow input.";static description=this.descriptionWithoutMarkdown();static flags={...n,...p,copy:i.Flags.boolean({description:"Copy the instructions to the clipboard instead of printing them.",default:!1,exclusive:["write"],env:"SHOPIFY_FLAG_APP_SECURITY_INSTRUCTIONS_COPY"}),write:i.Flags.string({description:"Write the instructions to a file instead of printing them.",exclusive:["copy"],parse:async t=>s(t),env:"SHOPIFY_FLAG_APP_SECURITY_INSTRUCTIONS_WRITE"})};async run(){let{flags:t}=await this.parse(u),e=await l({path:t.path,config:t.config,clientId:t["client-id"],withoutAppConfig:t["without-app-config"],allowPrompts:!1});await m({appDirectory:e.appDirectory,resultsKey:c(e),commands:d(e,t.path),copy:t.copy,writePath:t.write})}};export{o as a};
@@ -1,2 +1,2 @@
1
- import{a as N,b as $,c as w}from"./chunk-BYX7SQPM.js";import{r as T}from"./chunk-CNK3ZO2B.js";import{S as P,T as k,a as F}from"./chunk-6C5AVMKR.js";import{a as D,b}from"./chunk-SPNM3GES.js";import{k as A}from"./chunk-OAG72Q2O.js";import{Ab as u,Ia as U,La as I,N as x,Pa as O,Ua as p,xa as y,za as _}from"./chunk-43FRAUV6.js";import{f as h}from"./chunk-XYUTD6IU.js";import{d as m,i as l,j as S}from"./chunk-773TIA5M.js";import{g as f}from"./chunk-VKWPEFWQ.js";f();f();import{fileURLToPath as q}from"url";import Y from"util";import{pipeline as j}from"stream";import{execSync as z,execFileSync as B}from"child_process";var H="2024.8.2",W=`https://github.com/cloudflare/cloudflared/releases/download/${H}/`,G={arm64:"cloudflared-linux-arm64",arm:"cloudflared-linux-arm",x64:"cloudflared-linux-amd64",ia32:"cloudflared-linux-386"},V={arm64:"cloudflared-darwin-arm64.tgz",x64:"cloudflared-darwin-amd64.tgz"},X={x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe",arm64:"cloudflared-windows-amd64.exe"},v={linux:G,darwin:V,win32:X};function Z(r=process.platform,t=process.arch){if(!Object.keys(v).includes(r))throw new Error(`Unsupported system platform: ${r}`);let n=v[r][t];if(n===void 0)throw new Error(`Unsupported system arch: ${t}`);return W+n}function J(r=process.env,t=process.platform){return r.SHOPIFY_CLI_CLOUDFLARED_PATH?r.SHOPIFY_CLI_CLOUDFLARED_PATH:m(l(q(import.meta.url)),"..","bin",t==="win32"?"cloudflared.exe":"cloudflared")}async function g(r=process.env,t=process.platform,e=process.arch){if(r.SHOPIFY_CLI_IGNORE_CLOUDFLARED){u("Skipping cloudflared installation because SHOPIFY_CLI_IGNORE_CLOUDFLARED is set");return}let n=Z(t,e),o=J(r,t);if(p(o))try{let i=B(o,["--version"],{encoding:"utf8"}).split(" "),a=i.length>2?i[2]:"0.0.0";if(!K(H,a)){u("cloudflared already installed, skipping");return}}catch{u("version check failed, reinstalling")}if(t==="linux")await Q(n,o);else if(t==="darwin")await rt(n,o);else if(t==="win32")await tt(n,o);else throw new Error(`Unsupported platform: ${t}`)}function K(r,t){let[e,n,o]=r.split(".").map(Number),[i,a,c]=t.split(".").map(Number);return e!==i?(e??0)>(i??0):n!==a?(n??0)>(a??0):(o??0)>(c??0)}async function Q(r,t){await C(r,t),await O(t,"755")}async function tt(r,t){await C(r,t)}async function rt(r,t){await C(r,`${t}.tgz`);let e=S(`${t}.tgz`);z(`tar -xzf ${e}`,{cwd:l(t)}),U(`${t}.tgz`),await _(`${l(t)}/cloudflared`,t)}async function C(r,t){p(l(t))||y(l(t));let e=Y.promisify(j),n=await T(r,{redirect:"follow"},"slow-request");if(!n.ok||!n.body)throw new Error(`Couldn't download file ${r} (${n.status} ${n.statusText})`);let o=I(t);return await e(n.body,o),t}import{Writable as et}from"stream";import{fileURLToPath as nt}from"url";var $t=$({provider:w,action:it}),ot=h()?.2:40,st=5;async function it(r){try{let t=new R(r);return await t.startTunnel(),D(t)}catch(t){let e=new N("unknown",t.message);return b(e)}}var R=class{port;provider=w;currentStatus={status:"not-started"};abortController=void 0;constructor(t){this.port=t}async startTunnel(){try{await g(),this.tunnel()}catch(t){this.currentStatus={status:"error",message:t.message,tryMessage:d()}}}getTunnelStatus(){return this.currentStatus}stopTunnel(){this.abortController?.abort()}tunnel(t=0){this.abortController=new F;let e=!1;if(t>=st){e=!0,this.currentStatus={status:"error",message:"Could not start Cloudflare tunnel: max retries reached.",tryMessage:d()};return}let n=["tunnel","--url",`http://localhost:${this.port}`,"--no-autoupdate"],o=[],i=!1,a;this.currentStatus={status:"starting"},setTimeout(()=>{if(!e){e=!0;let s=x(o).slice(-5).join(`
1
+ import{a as N,b as $,c as w}from"./chunk-TNXZWQZU.js";import{j as T}from"./chunk-L5XWYTHY.js";import{a as D,b}from"./chunk-74HXMIDM.js";import{S as P,T as k,a as F}from"./chunk-SKRUMRB4.js";import{l as A}from"./chunk-FCULF3JA.js";import{Ba as y,Da as _,Ma as U,Nb as u,Pa as I,R as x,Ta as O,Ya as p}from"./chunk-YJWNM4XO.js";import{g as h}from"./chunk-SGBLCVUX.js";import{d as m,i as l,j as S}from"./chunk-3VYOLEQE.js";import{g as f}from"./chunk-VKWPEFWQ.js";f();f();import{fileURLToPath as q}from"url";import Y from"util";import{pipeline as j}from"stream";import{execSync as z,execFileSync as B}from"child_process";var H="2024.8.2",W=`https://github.com/cloudflare/cloudflared/releases/download/${H}/`,G={arm64:"cloudflared-linux-arm64",arm:"cloudflared-linux-arm",x64:"cloudflared-linux-amd64",ia32:"cloudflared-linux-386"},V={arm64:"cloudflared-darwin-arm64.tgz",x64:"cloudflared-darwin-amd64.tgz"},X={x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe",arm64:"cloudflared-windows-amd64.exe"},v={linux:G,darwin:V,win32:X};function Z(r=process.platform,t=process.arch){if(!Object.keys(v).includes(r))throw new Error(`Unsupported system platform: ${r}`);let n=v[r][t];if(n===void 0)throw new Error(`Unsupported system arch: ${t}`);return W+n}function J(r=process.env,t=process.platform){return r.SHOPIFY_CLI_CLOUDFLARED_PATH?r.SHOPIFY_CLI_CLOUDFLARED_PATH:m(l(q(import.meta.url)),"..","bin",t==="win32"?"cloudflared.exe":"cloudflared")}async function g(r=process.env,t=process.platform,e=process.arch){if(r.SHOPIFY_CLI_IGNORE_CLOUDFLARED){u("Skipping cloudflared installation because SHOPIFY_CLI_IGNORE_CLOUDFLARED is set");return}let n=Z(t,e),o=J(r,t);if(p(o))try{let i=B(o,["--version"],{encoding:"utf8"}).split(" "),a=i.length>2?i[2]:"0.0.0";if(!K(H,a)){u("cloudflared already installed, skipping");return}}catch{u("version check failed, reinstalling")}if(t==="linux")await Q(n,o);else if(t==="darwin")await rt(n,o);else if(t==="win32")await tt(n,o);else throw new Error(`Unsupported platform: ${t}`)}function K(r,t){let[e,n,o]=r.split(".").map(Number),[i,a,c]=t.split(".").map(Number);return e!==i?(e??0)>(i??0):n!==a?(n??0)>(a??0):(o??0)>(c??0)}async function Q(r,t){await C(r,t),await O(t,"755")}async function tt(r,t){await C(r,t)}async function rt(r,t){await C(r,`${t}.tgz`);let e=S(`${t}.tgz`);z(`tar -xzf ${e}`,{cwd:l(t)}),U(`${t}.tgz`),await _(`${l(t)}/cloudflared`,t)}async function C(r,t){p(l(t))||y(l(t));let e=Y.promisify(j),n=await T(r,{redirect:"follow"},"slow-request");if(!n.ok||!n.body)throw new Error(`Couldn't download file ${r} (${n.status} ${n.statusText})`);let o=I(t);return await e(n.body,o),t}import{Writable as et}from"stream";import{fileURLToPath as nt}from"url";var $t=$({provider:w,action:it}),ot=h()?.2:40,st=5;async function it(r){try{let t=new R(r);return await t.startTunnel(),D(t)}catch(t){let e=new N("unknown",t.message);return b(e)}}var R=class{port;provider=w;currentStatus={status:"not-started"};abortController=void 0;constructor(t){this.port=t}async startTunnel(){try{await g(),this.tunnel()}catch(t){this.currentStatus={status:"error",message:t.message,tryMessage:d()}}}getTunnelStatus(){return this.currentStatus}stopTunnel(){this.abortController?.abort()}tunnel(t=0){this.abortController=new F;let e=!1;if(t>=st){e=!0,this.currentStatus={status:"error",message:"Could not start Cloudflare tunnel: max retries reached.",tryMessage:d()};return}let n=["tunnel","--url",`http://localhost:${this.port}`,"--no-autoupdate"],o=[],i=!1,a;this.currentStatus={status:"starting"},setTimeout(()=>{if(!e){e=!0;let s=x(o).slice(-5).join(`
2
2
  `);s===""?this.currentStatus={status:"error",message:"Could not start Cloudflare tunnel: unknown error.",tryMessage:d()}:this.currentStatus={status:"error",message:s,tryMessage:d()},this.abortController?.abort()}},ot*1e3);let c=this,E=new et({write(s,mt,M){if(u(s.toString()),e)return;a??=at(s),ct(s)&&(i=!0),i&&(a?(e=!0,c.currentStatus={status:"connected",url:a}):c.currentStatus={status:"error",message:"Could not start Cloudflare tunnel: URL not found."});let L=lt(s);L&&o.push(L),M()}});P(dt(),n,{stdout:E,stderr:E,signal:this.abortController.signal,externalErrorHandler:async s=>{if(e)throw new A(`Could not start Cloudflare tunnel: process crashed after stablishing a connection: ${s.message}`,d());u(`Cloudflare tunnel crashed: ${s.message}, restarting...`),h()||await k(1),this.tunnel(t+1)}})}};function d(){return["You can run the command again, or try networking with Shopify via",{command:"--use-localhost"},"or",{command:"--tunnel-url <custom tunnel>"},".",{link:{label:"See documentation for details.",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options"}}]}function at(r){let t=new RegExp(`(https:\\/\\/[^\\s]+\\.${ft()})`),e=r.toString().match(t)??void 0;return e&&e[1]}function lt(r){if([/failed to request quick Tunnel/,/failed to unmarshal quick Tunnel/,/failed to parse quick Tunnel ID/,/failed to provision routing/,/ERR Couldn't start tunnel/,/ERR Failed to serve quic connection/,/ERR Failed to create new quic connection error/].some(n=>n.test(r.toString())))return`Could not start Cloudflare tunnel: ${ut(r.toString())}`}function ut(r){let t=/^[0-9TZ:-]+ (ERR )?/g,e=/connIndex.*/g;return r.replace(t,"").replace(e,"")}function ct(r){let t=r.toString().match(/(INF Registered tunnel connection|INF Connection)/)??void 0;return t&&t[0]}function dt(){return process.env.SHOPIFY_CLI_CLOUDFLARED_PATH?process.env.SHOPIFY_CLI_CLOUDFLARED_PATH:m(l(nt(import.meta.url)),"..","bin",process.platform==="win32"?"cloudflared.exe":"cloudflared")}function ft(){return process.env.SHOPIFY_CLI_CLOUDFLARED_DOMAIN??"trycloudflare.com"}export{$t as a};
@@ -0,0 +1,8 @@
1
+ import{a as w}from"./chunk-ECEOBSGD.js";import{a as u}from"./chunk-GVRFO4CV.js";import{a as v,b as f}from"./chunk-YY6TFARF.js";import{a as y}from"./chunk-LYPNQFWX.js";import{p as d,v as c}from"./chunk-P3Z5RLVV.js";import{b as p}from"./chunk-DGMRL5DQ.js";import{N as m,y as s}from"./chunk-SKRUMRB4.js";import{b as E}from"./chunk-JA2QZ635.js";import{e as T,g as i}from"./chunk-VKWPEFWQ.js";i();i();async function F(t,e){let r=new u(t),g=(await(e.development?r.find():r.fetch()))?.id,n=await y(t,{header:"Select a theme to open",filter:{live:e.live,theme:e.development?`${g}`:e.theme}}),l=v(n,t),a=f(n,t);s({body:["Preview information for theme",...w(n),`
2
+
3
+ `,{list:{items:[{link:{label:"Preview your theme",url:l}},{link:{label:"Customize your theme at the theme editor",url:a}}]}}]}),e.editor?await m(a):await m(l)}var o=T(E(),1);var h=class extends c{static summary="Opens the preview of your remote theme.";static descriptionWithMarkdown=`Returns links that let you preview the specified theme. The following links are returned:
4
+
5
+ - A link to the [editor](https://shopify.dev/docs/themes/tools/online-editor) for the theme in the Shopify admin.
6
+ - A [preview link](https://help.shopify.com/manual/online-store/themes/adding-themes#share-a-theme-preview-with-others) that you can share with other developers.
7
+
8
+ If you don't specify a theme, then you're prompted to select the theme to open from the list of the themes in your store.`;static description=this.descriptionForHelp();static flags={...p,...d,development:o.Flags.boolean({char:"d",description:"Open your development theme. Use --development, --live, or --theme in non-interactive environments.",env:"SHOPIFY_FLAG_DEVELOPMENT"}),editor:o.Flags.boolean({char:"E",description:"Open the theme editor for the specified theme in the browser.",env:"SHOPIFY_FLAG_EDITOR"}),live:o.Flags.boolean({char:"l",description:"Open your live (published) theme. Use --development, --live, or --theme in non-interactive environments.",env:"SHOPIFY_FLAG_LIVE"}),theme:o.Flags.string({char:"t",description:"Theme ID or name of the remote theme. Use --development, --live, or --theme in non-interactive environments.",env:"SHOPIFY_FLAG_THEME_ID"})};static multiEnvironmentsFlags=null;static nonTTYFlagRequirements(){return[{flags:["theme","development","live"]}]}async command(e,r){await F(r,e)}};export{h as a};