shopify 4.9.4 → 4.9.6
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.
- package/dist/analytics-BTM7UNF6.js +1 -0
- package/dist/analytics-KFRP2KGG.js +1 -0
- package/dist/bootstrap.js +1 -1
- package/dist/{chunk-2YVSZFXJ.js → chunk-242NOO4T.js} +1 -1
- package/dist/{chunk-4ES7BJEK.js → chunk-27WWE5QN.js} +1 -1
- package/dist/{chunk-GPRZYFDE.js → chunk-2EFFU2J3.js} +1 -1
- package/dist/{chunk-3V4VL3SD.js → chunk-2TCPTRLF.js} +3 -3
- package/dist/{chunk-R7YJNDXW.js → chunk-36TJJREK.js} +1 -1
- package/dist/{chunk-LYIXRMQJ.js → chunk-3CSRZM3Q.js} +1 -1
- package/dist/{chunk-7HWMURCW.js → chunk-3EY3ULS6.js} +1 -1
- package/dist/{chunk-W4KE7AO6.js → chunk-3LR3IQRE.js} +1 -1
- package/dist/chunk-3OSGEQWG.js +4 -0
- package/dist/{chunk-C6IBY7NW.js → chunk-3QBQSNON.js} +1 -1
- package/dist/chunk-3WNWP3ZV.js +20 -0
- package/dist/{chunk-AVMNIZAJ.js → chunk-3XFVLDKZ.js} +1 -1
- package/dist/{chunk-Y3PY5LP7.js → chunk-43RTNZ6T.js} +1 -1
- package/dist/{chunk-TVCWDEVS.js → chunk-4CH5XVYP.js} +1 -1
- package/dist/{chunk-3LHE4GIX.js → chunk-4GD2RMV4.js} +1 -1
- package/dist/{chunk-AMLCWRHU.js → chunk-4LUOXUQX.js} +1 -1
- package/dist/{chunk-FEQHCE2E.js → chunk-4MLDRZ3X.js} +2 -2
- package/dist/{chunk-J4J2YXH3.js → chunk-4SOWK7OZ.js} +1 -1
- package/dist/{chunk-6YDLNP4G.js → chunk-4UROHXMF.js} +1 -1
- package/dist/{chunk-GSE6FXZU.js → chunk-4XDMN6DI.js} +1 -1
- package/dist/{chunk-43URS56H.js → chunk-4XVDLMXZ.js} +1 -1
- package/dist/{chunk-A2VCTDKH.js → chunk-5EVQSYMN.js} +1 -1
- package/dist/chunk-5IQ42V5M.js +11 -0
- package/dist/{chunk-LKXFHYLI.js → chunk-5K7B3MYY.js} +1 -1
- package/dist/chunk-5LDJ4CAJ.js +3 -0
- package/dist/{chunk-AYIU6Z4C.js → chunk-5W3YFFC2.js} +1 -1
- package/dist/{chunk-UQ6ALA3Y.js → chunk-5WN5FGRS.js} +1 -1
- package/dist/{chunk-73D5O7A3.js → chunk-5YMLUN2H.js} +1 -1
- package/dist/{chunk-EMH7OHCW.js → chunk-6AFURA34.js} +1 -1
- package/dist/{chunk-PFXNBHQQ.js → chunk-6ALQJACW.js} +1 -1
- package/dist/{chunk-4O7LK5RG.js → chunk-6HC6JBXZ.js} +1 -1
- package/dist/{chunk-ZTICX3AO.js → chunk-6I5ATJK6.js} +1 -1
- package/dist/{chunk-RXTLNUPF.js → chunk-6KWTCDUU.js} +1 -1
- package/dist/{chunk-RUHQNF2W.js → chunk-6LHYAB44.js} +1 -1
- package/dist/{chunk-LLPB6JN5.js → chunk-6M36S2RZ.js} +1 -1
- package/dist/{chunk-DSS4ECIH.js → chunk-6MELTJU3.js} +1 -1
- package/dist/{chunk-PHG4DASY.js → chunk-6R4CZJEP.js} +1 -1
- package/dist/{chunk-R3KSOCMB.js → chunk-6XKLKUE3.js} +1 -1
- package/dist/chunk-77G2GTZU.js +1 -0
- package/dist/{chunk-EO4YJFMY.js → chunk-7JAZMNHL.js} +1 -1
- package/dist/{chunk-QAJZUJR5.js → chunk-7VH257QN.js} +1 -1
- package/dist/{chunk-Q43LBSPT.js → chunk-7VHNMRXX.js} +1 -1
- package/dist/{chunk-PVAZCZSY.js → chunk-7XGP35CV.js} +1 -1
- package/dist/{chunk-LWU5TKNA.js → chunk-A5RXJNQ5.js} +1 -1
- package/dist/{chunk-RSC5NQAT.js → chunk-A7KQUQLZ.js} +1 -1
- package/dist/{chunk-N55MSO3X.js → chunk-AQRJ76WH.js} +1 -1
- package/dist/{chunk-7HNRK2CR.js → chunk-AY5OUOJX.js} +1 -1
- package/dist/{chunk-7VAKNVFD.js → chunk-B6BTX7WU.js} +1 -1
- package/dist/{chunk-NGSEF3UX.js → chunk-BAAM465I.js} +1 -1
- package/dist/{chunk-IPZ6LUJV.js → chunk-BAPGKXWM.js} +1 -1
- package/dist/chunk-BSNPN72J.js +5 -0
- package/dist/{chunk-4O5GQ3DS.js → chunk-BUERBYLS.js} +1 -1
- package/dist/{chunk-D3KFKT4D.js → chunk-BYZU7YS7.js} +1 -1
- package/dist/{chunk-UU6BRRYS.js → chunk-CNHSSTET.js} +1 -1
- package/dist/{chunk-67EBF76X.js → chunk-CUKGLLVJ.js} +1 -1
- package/dist/{chunk-K3HUQLIC.js → chunk-CYXIVHAF.js} +1 -1
- package/dist/{chunk-VGBUN3CZ.js → chunk-D2XXDJOB.js} +1 -1
- package/dist/{chunk-HQJ62PII.js → chunk-D65CUTKT.js} +1 -1
- package/dist/{chunk-KQFA5YTT.js → chunk-DP64USHX.js} +1 -1
- package/dist/{chunk-NU5WLZ6Y.js → chunk-DWMRVMKX.js} +1 -1
- package/dist/{chunk-ALK66U3O.js → chunk-DXDKHVOZ.js} +1 -1
- package/dist/{chunk-TPHHQAUD.js → chunk-DXVMT37F.js} +1 -1
- package/dist/{chunk-TFXUDHCP.js → chunk-EBAV3Z54.js} +1 -1
- package/dist/{chunk-YHESTFMZ.js → chunk-ECUMY7EP.js} +1 -1
- package/dist/{chunk-4JGWKUJN.js → chunk-EDUQUCXK.js} +1 -1
- package/dist/chunk-EGWRLGF4.js +1 -0
- package/dist/{chunk-S36VGP37.js → chunk-FASYFQVN.js} +1 -1
- package/dist/{chunk-NYYXH2SX.js → chunk-FJUE4LQ6.js} +1 -1
- package/dist/{chunk-XNVOKAF2.js → chunk-FLKGDGRR.js} +1 -1
- package/dist/{chunk-GM4EFJJF.js → chunk-FMFU75ON.js} +1 -1
- package/dist/{chunk-MW3IMZJ5.js → chunk-FMT52ZOY.js} +1 -1
- package/dist/{chunk-YBSX53QP.js → chunk-FRHB4IFP.js} +1 -1
- package/dist/{chunk-4ZNBEMRT.js → chunk-FSWOB535.js} +3 -3
- package/dist/{chunk-HJHS23Q3.js → chunk-FUJAJKL2.js} +1 -1
- package/dist/{chunk-HPM3HF7A.js → chunk-FX27WXGC.js} +1 -1
- package/dist/{chunk-SNE4RHM4.js → chunk-G73DLMVM.js} +1 -1
- package/dist/{chunk-ZEBMW5KS.js → chunk-G76W6NZP.js} +1 -1
- package/dist/chunk-G7HOEDC3.js +6 -0
- package/dist/{chunk-SQAS5RVZ.js → chunk-GAWWWWUZ.js} +1 -1
- package/dist/{chunk-6IMHGT7F.js → chunk-GB3AA3X5.js} +1 -1
- package/dist/{chunk-ONF7XXEL.js → chunk-GDNCENVE.js} +1 -1
- package/dist/{chunk-IGDVKRB4.js → chunk-HCKLWXCL.js} +1 -1
- package/dist/{chunk-Z6X2GT6Q.js → chunk-HK3GFNMW.js} +1 -1
- package/dist/{chunk-XGKCPD6W.js → chunk-HP4GSH4V.js} +1 -1
- package/dist/{chunk-4IFY7V7W.js → chunk-HUWP2XMA.js} +1 -1
- package/dist/{chunk-J4NBPC57.js → chunk-HYLSV7GC.js} +1 -1
- package/dist/{chunk-MCNK5SJ6.js → chunk-I3QLXR5S.js} +1 -1
- package/dist/{chunk-6MC2BEW4.js → chunk-IAFTSCIL.js} +1 -1
- package/dist/{chunk-OE3HSNSE.js → chunk-ICRQVAFM.js} +1 -1
- package/dist/{chunk-NCVGCVQ5.js → chunk-IRF43DMG.js} +1 -1
- package/dist/{chunk-5BTLE67Z.js → chunk-ITO5UZMZ.js} +1 -1
- package/dist/{chunk-MMQZO2W2.js → chunk-J47LE4T7.js} +1 -1
- package/dist/{chunk-47IQIIFX.js → chunk-J6XOTLT5.js} +1 -1
- package/dist/{chunk-DMDLJRLW.js → chunk-JDAQL76H.js} +1 -1
- package/dist/{chunk-QPQS2YU3.js → chunk-JNHEAOMV.js} +1 -1
- package/dist/{chunk-UEBUGSBT.js → chunk-JTEP5MP2.js} +1 -1
- package/dist/{chunk-XWQM2NZ2.js → chunk-KACAGYNQ.js} +1 -1
- package/dist/{chunk-MW3JKGJH.js → chunk-KCO5GEOP.js} +1 -1
- package/dist/{chunk-3G2ZQ2EF.js → chunk-KK6PJIJT.js} +1 -1
- package/dist/{chunk-QTLGMJDW.js → chunk-KW5SQ6PG.js} +1 -1
- package/dist/{chunk-DEF2G7S4.js → chunk-LXCVWQK4.js} +1 -1
- package/dist/{chunk-PG4S5HJJ.js → chunk-MEWNJLRS.js} +1 -1
- package/dist/{chunk-B3M3KIOU.js → chunk-MJIGXNI3.js} +1 -1
- package/dist/{chunk-WEXOA4C4.js → chunk-MKNCBJVY.js} +1 -1
- package/dist/{chunk-I5PQZRYM.js → chunk-MLZAI55C.js} +1 -1
- package/dist/{chunk-66YRAUWX.js → chunk-MNYLFNXN.js} +1 -1
- package/dist/{chunk-SZI6G247.js → chunk-N5YS4PAM.js} +1 -1
- package/dist/{chunk-VNFUCH6T.js → chunk-NB2KT7G6.js} +1 -1
- package/dist/{chunk-RJSQMKKS.js → chunk-NLXVPUOO.js} +1 -1
- package/dist/{chunk-GE4MLO3C.js → chunk-NQ5PKMPV.js} +1 -1
- package/dist/{chunk-YTR5JHNJ.js → chunk-NQVG4W5U.js} +1 -1
- package/dist/{chunk-PB5ZZET5.js → chunk-NY5ESCDK.js} +1 -1
- package/dist/{chunk-QUXQM3S3.js → chunk-O4Q3UXIN.js} +1 -1
- package/dist/{chunk-GZ7VGCVW.js → chunk-ON4RFEHN.js} +1 -1
- package/dist/{chunk-CLD3NZYD.js → chunk-OPIEU37B.js} +1 -1
- package/dist/{chunk-4TFJ5RW7.js → chunk-OTQUZLAC.js} +1 -1
- package/dist/{chunk-WEPO4J2F.js → chunk-OYMJI3MD.js} +1 -1
- package/dist/{chunk-UIC7K2HX.js → chunk-PCWXGO4K.js} +1 -1
- package/dist/{chunk-K7D53KSJ.js → chunk-PDAOTRLF.js} +1 -1
- package/dist/{chunk-IDKRJ2F4.js → chunk-PI6M7EZF.js} +1 -1
- package/dist/{chunk-G7JW4UIM.js → chunk-PJ273A7N.js} +1 -1
- package/dist/{chunk-YHCP326A.js → chunk-PUMOQZDB.js} +1 -1
- package/dist/{chunk-O5FFMTJE.js → chunk-PZA7BBAC.js} +4 -4
- package/dist/{chunk-Q37WAD6F.js → chunk-QF453PH7.js} +1 -1
- package/dist/{chunk-Q2XLIWG4.js → chunk-QFMATBKM.js} +1 -1
- package/dist/chunk-QG3GJSLN.js +15 -0
- package/dist/chunk-QLHPTMIH.js +1 -0
- package/dist/{chunk-JYGZD4HM.js → chunk-QMFD6EWX.js} +1 -1
- package/dist/{chunk-37BGAWAW.js → chunk-QREFTU4W.js} +1 -1
- package/dist/{chunk-UWI76E2L.js → chunk-QY73XOBU.js} +3 -3
- package/dist/{chunk-FQL2WEKX.js → chunk-QYV5QN44.js} +1 -1
- package/dist/{chunk-BOE2ST6J.js → chunk-ROUPL6WR.js} +1 -1
- package/dist/{chunk-VMNOSVPT.js → chunk-RV54HI5A.js} +1 -1
- package/dist/{chunk-6A4H3HPY.js → chunk-S43YCHAN.js} +1 -1
- package/dist/chunk-SAA32TAK.js +5 -0
- package/dist/{chunk-XNPUZRWP.js → chunk-SBVYAGNC.js} +1 -1
- package/dist/{chunk-YYA5VGDW.js → chunk-SFQGGQDB.js} +1 -1
- package/dist/{chunk-FK7GA4QQ.js → chunk-SM3X5GTB.js} +1 -1
- package/dist/{chunk-F3PZGSOY.js → chunk-SNBJDHF2.js} +1 -1
- package/dist/{chunk-HASIOUH2.js → chunk-SPWX6OQR.js} +1 -1
- package/dist/{chunk-LJIJEGND.js → chunk-ST75AW7Z.js} +1 -1
- package/dist/{chunk-45SZ5PSE.js → chunk-SUIVO7GI.js} +1 -1
- package/dist/{chunk-7556AIVG.js → chunk-T2RE2K3N.js} +1 -1
- package/dist/{chunk-HLPAVELJ.js → chunk-TC63IUVI.js} +1 -1
- package/dist/{chunk-PO5T44H3.js → chunk-TFVIG4I7.js} +1 -1
- package/dist/{chunk-7SJHVJ3W.js → chunk-TJ2QQ2YQ.js} +1 -1
- package/dist/{chunk-MUM34KUM.js → chunk-TM3PHZKF.js} +1 -1
- package/dist/{chunk-N5AZZYQA.js → chunk-TV37VCLT.js} +1 -1
- package/dist/{chunk-YT27FIQN.js → chunk-TYBZNIRM.js} +2 -2
- package/dist/{chunk-QO5RNGWA.js → chunk-U5U5E7K5.js} +1 -1
- package/dist/chunk-UPAV44WQ.js +1 -0
- package/dist/{chunk-WLWHCUPZ.js → chunk-UQPAHTBH.js} +1 -1
- package/dist/{chunk-PP4VCR4Y.js → chunk-UZR3JSH2.js} +1 -1
- package/dist/{chunk-XSMCQLJW.js → chunk-V2XUMMTV.js} +1 -1
- package/dist/{chunk-4OCVXE5Y.js → chunk-VEYIT46B.js} +1 -1
- package/dist/{chunk-J6LQR2F6.js → chunk-VI7XF2HZ.js} +1 -1
- package/dist/{chunk-HQY6JM6G.js → chunk-VMMPBOTN.js} +1 -1
- package/dist/{chunk-ENQXB532.js → chunk-VOVBMABU.js} +1 -1
- package/dist/{chunk-FO2R6KHG.js → chunk-VVHUYIID.js} +1 -1
- package/dist/{chunk-DYPZX7MW.js → chunk-VWKMTYCN.js} +1 -1
- package/dist/chunk-VYEPVORB.js +2 -0
- package/dist/{chunk-Y62EMOQA.js → chunk-W2PLTMI4.js} +1 -1
- package/dist/{chunk-BVB3DTNE.js → chunk-WPVPRCCD.js} +1 -1
- package/dist/{chunk-4TZCRMBJ.js → chunk-WQG4QDC5.js} +1 -1
- package/dist/{chunk-YPCXVZ2N.js → chunk-WYAOSSZV.js} +1 -1
- package/dist/{chunk-UNHT4ZFP.js → chunk-X4767EMJ.js} +1 -1
- package/dist/chunk-X5VPFSL3.js +16 -0
- package/dist/{chunk-HSYMUYEZ.js → chunk-XAATRAER.js} +1 -1
- package/dist/{chunk-MJZSSCGD.js → chunk-XEL7K7VT.js} +1 -1
- package/dist/chunk-XUZXQC5H.js +1 -0
- package/dist/{chunk-NCRWOW6F.js → chunk-XWQIX3T7.js} +1 -1
- package/dist/{chunk-6HPUOCFF.js → chunk-Y4USH7MD.js} +1 -1
- package/dist/{chunk-RK2V6OIJ.js → chunk-Y54LCKE7.js} +1 -1
- package/dist/{chunk-2PDVBGQH.js → chunk-YMB7HPMN.js} +1 -1
- package/dist/{chunk-35WQTGN3.js → chunk-Z5RA2TNT.js} +1 -1
- package/dist/{chunk-ZEE32UH6.js → chunk-Z6TXDTXR.js} +1 -1
- package/dist/{chunk-LOWSU4BB.js → chunk-ZG4M63GT.js} +1 -1
- package/dist/chunk-ZHTG2T5Y.js +1 -0
- package/dist/{chunk-VS7QVU3Z.js → chunk-ZY353ZNN.js} +1 -1
- package/dist/{chunk-NT4A37HG.js → chunk-ZYZU37KT.js} +1 -1
- package/dist/cli/commands/app/app-logs/sources.js +1 -1
- package/dist/cli/commands/app/build.js +1 -1
- package/dist/cli/commands/app/bulk/cancel.js +1 -1
- package/dist/cli/commands/app/bulk/execute.js +1 -1
- package/dist/cli/commands/app/bulk/status.js +1 -1
- package/dist/cli/commands/app/config/link.js +1 -1
- package/dist/cli/commands/app/config/pull.js +1 -1
- package/dist/cli/commands/app/config/use.js +1 -1
- package/dist/cli/commands/app/config/validate.js +1 -1
- package/dist/cli/commands/app/demo/watcher.js +1 -1
- package/dist/cli/commands/app/deploy.js +1 -1
- package/dist/cli/commands/app/dev/clean.js +1 -1
- package/dist/cli/commands/app/dev.js +1 -1
- package/dist/cli/commands/app/env/pull.js +1 -1
- package/dist/cli/commands/app/env/show.js +1 -1
- package/dist/cli/commands/app/execute.js +1 -1
- package/dist/cli/commands/app/function/build.js +1 -1
- package/dist/cli/commands/app/function/info.js +1 -1
- package/dist/cli/commands/app/function/replay.js +1 -1
- package/dist/cli/commands/app/function/run.js +1 -1
- package/dist/cli/commands/app/function/schema.js +1 -1
- package/dist/cli/commands/app/function/typegen.js +1 -1
- package/dist/cli/commands/app/generate/extension.js +1 -1
- package/dist/cli/commands/app/graphiql.js +1 -1
- package/dist/cli/commands/app/import/channel-config.js +1 -1
- package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
- package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
- package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
- package/dist/cli/commands/app/import-extensions.js +1 -1
- package/dist/cli/commands/app/info.js +1 -1
- package/dist/cli/commands/app/init.js +1 -1
- package/dist/cli/commands/app/logs.js +1 -1
- package/dist/cli/commands/app/release.js +1 -1
- package/dist/cli/commands/app/security/check.js +1 -1
- package/dist/cli/commands/app/security/clean.js +1 -1
- package/dist/cli/commands/app/security/instructions.js +1 -1
- package/dist/cli/commands/app/security/record.js +1 -1
- package/dist/cli/commands/app/security/review.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
- package/dist/cli/commands/app/versions/list.js +1 -1
- package/dist/cli/commands/app/webhook/trigger.js +1 -1
- package/dist/cli/commands/auth/login.js +1 -1
- package/dist/cli/commands/auth/logout.js +1 -1
- package/dist/cli/commands/cache/clear.js +1 -1
- package/dist/cli/commands/config/autoupgrade/off.js +1 -1
- package/dist/cli/commands/config/autoupgrade/on.js +1 -1
- package/dist/cli/commands/config/autoupgrade/status.js +1 -1
- package/dist/cli/commands/debug/command-flags.js +1 -1
- package/dist/cli/commands/doc/fetch.js +1 -1
- package/dist/cli/commands/doc/search.js +1 -1
- package/dist/cli/commands/docs/generate.js +1 -1
- package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
- package/dist/cli/commands/doctor-release/theme/index.js +1 -1
- package/dist/cli/commands/help.js +1 -1
- package/dist/cli/commands/kitchen-sink/async.js +1 -1
- package/dist/cli/commands/kitchen-sink/index.js +1 -1
- package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
- package/dist/cli/commands/kitchen-sink/static.js +1 -1
- package/dist/cli/commands/notifications/generate.js +1 -1
- package/dist/cli/commands/notifications/list.js +1 -1
- package/dist/cli/commands/organization/list.js +1 -1
- package/dist/cli/commands/search.js +1 -1
- package/dist/cli/commands/send-analytics.js +1 -1
- package/dist/cli/commands/theme/check.js +1 -1
- package/dist/cli/commands/theme/console.js +1 -1
- package/dist/cli/commands/theme/delete.js +1 -1
- package/dist/cli/commands/theme/dev.js +1 -1
- package/dist/cli/commands/theme/duplicate.js +1 -1
- package/dist/cli/commands/theme/info.js +1 -1
- package/dist/cli/commands/theme/init.js +1 -1
- package/dist/cli/commands/theme/language-server.js +1 -1
- package/dist/cli/commands/theme/list.js +1 -1
- package/dist/cli/commands/theme/metafields/pull.js +1 -1
- package/dist/cli/commands/theme/open.js +1 -1
- package/dist/cli/commands/theme/package.js +1 -1
- package/dist/cli/commands/theme/preview.js +1 -1
- package/dist/cli/commands/theme/profile.js +1 -1
- package/dist/cli/commands/theme/publish.js +1 -1
- package/dist/cli/commands/theme/pull.js +1 -1
- package/dist/cli/commands/theme/push.js +1 -1
- package/dist/cli/commands/theme/rename.js +1 -1
- package/dist/cli/commands/theme/share.js +1 -1
- package/dist/cli/commands/upgrade.js +1 -1
- package/dist/cli/commands/version.js +1 -1
- package/dist/cli/help.js +1 -1
- package/dist/{command-json-schema-SS4GDJTQ.js → command-json-schema-V4OTY4MX.js} +1 -1
- package/dist/command-registry.js +1 -1
- package/dist/{conf-store-54YJCIDK.js → conf-store-LWBJNYPC.js} +1 -1
- package/dist/{custom-oclif-loader-3UBH7Q7R.js → custom-oclif-loader-KS3MBI4W.js} +1 -1
- package/dist/{deprecations-ZX7ZKF6L.js → deprecations-NAJ4JNON.js} +1 -1
- package/dist/dist-HTXIQ6TQ.js +1 -0
- package/dist/dist-XYFXZS4I.js +1 -0
- package/dist/environments-65BJOXLA.js +1 -0
- package/dist/{error-AA6LW3PN.js → error-TTZRUUUI.js} +1 -1
- package/dist/error-handler-TJG7IDLT.js +1 -0
- package/dist/{fs-4QZCAEP7.js → fs-VHUA5OHC.js} +1 -1
- package/dist/hooks/did-you-mean.js +1 -1
- package/dist/hooks/hydrogen-init.js +1 -1
- package/dist/hooks/postrun.js +1 -1
- package/dist/hooks/prerun.js +1 -1
- package/dist/hooks/public-metadata.js +1 -1
- package/dist/hooks/sensitive-metadata.js +1 -1
- package/dist/hooks/tunnel-provider.js +1 -1
- package/dist/hooks/tunnel-start.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{is-global-FKG327CG.js → is-global-7BDGLRND.js} +1 -1
- package/dist/{json-error-32ETFU3V.js → json-error-OSDR2S56.js} +1 -1
- package/dist/{local-R3UAQN7T.js → local-BQ5FJYX6.js} +1 -1
- package/dist/{metadata-JWJG4JV4.js → metadata-GFLDQ2I7.js} +1 -1
- package/dist/{node-package-manager-M4XHUTQR.js → node-package-manager-FQZ7XFU4.js} +1 -1
- package/dist/notifications-system-BESW6Q65.js +1 -0
- package/dist/{os-FEHBQQKP.js → os-GPZXOHDI.js} +1 -1
- package/dist/{output-2LS5AOAH.js → output-TLYSXAUL.js} +1 -1
- package/dist/{system-TMD2LYZM.js → system-KVPOFMPA.js} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{ui-FNPICAAH.js → ui-CM3VQLC2.js} +1 -1
- package/dist/upgrade-CPOWDAOD.js +1 -0
- package/dist/version-ILYYDNX7.js +1 -0
- package/dist/version-SN7J7ZYL.js +1 -0
- package/dist/{workerd-TKVRZK2F.js → workerd-SBI5B2H5.js} +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +7 -7
- package/dist/analytics-APDNTBDE.js +0 -1
- package/dist/analytics-LX52KYSE.js +0 -1
- package/dist/chunk-3C4WVKSO.js +0 -6
- package/dist/chunk-5JIJDUXX.js +0 -20
- package/dist/chunk-7A3RW2VM.js +0 -1
- package/dist/chunk-BIWG3FQQ.js +0 -5
- package/dist/chunk-BQ3U3CQV.js +0 -1
- package/dist/chunk-CQF5NDTJ.js +0 -4
- package/dist/chunk-CVFPY2SH.js +0 -3
- package/dist/chunk-DMNWSUKV.js +0 -5
- package/dist/chunk-GN66BRYF.js +0 -1
- package/dist/chunk-KTD7VLHL.js +0 -2
- package/dist/chunk-L4DFMMOI.js +0 -1
- package/dist/chunk-LJZTSQRD.js +0 -11
- package/dist/chunk-PWS4VFSD.js +0 -1
- package/dist/chunk-R74WHKHH.js +0 -15
- package/dist/chunk-XUUIBSLW.js +0 -1
- package/dist/chunk-Y743UVBS.js +0 -16
- package/dist/dist-JMNE7MP6.js +0 -1
- package/dist/dist-M2AXGBOL.js +0 -1
- package/dist/environments-KD2IDYPG.js +0 -1
- package/dist/error-handler-4VW3AV2G.js +0 -1
- package/dist/notifications-system-QVM2JWKB.js +0 -1
- package/dist/upgrade-YYPP5VZY.js +0 -1
- package/dist/version-OX3MORI6.js +0 -1
- package/dist/version-P7D5ME4Z.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as E}from"./chunk-
|
|
1
|
+
import{b as E}from"./chunk-DWMRVMKX.js";import{b}from"./chunk-FSWOB535.js";import{Q as F,R as N}from"./chunk-J6XOTLT5.js";import{Kb as k,W as C,Xa as w,qa as O}from"./chunk-QY73XOBU.js";import{i as n}from"./chunk-B4OMIONW.js";import{k as R}from"./chunk-JTEP5MP2.js";import{b as U}from"./chunk-I3J63RFV.js";import{c as u,e as P,f as x,g,m as T,p as y}from"./chunk-6IDEDOXW.js";import{e as H,g as d}from"./chunk-VKWPEFWQ.js";d();d();d();d();var m=class{static description="Doctor test suite";context;assertions=[];registeredTests=[];async runSuite(t){this.context=t,this.registeredTests=[];let e=[];this.tests();for(let o of this.registeredTests){this.assertions=[];let s=Date.now();try{await o.fn(),e.push({name:o.name,status:this.hasFailures()?"failed":"passed",duration:Date.now()-s,assertions:[...this.assertions]})}catch(r){e.push({name:o.name,status:"failed",duration:Date.now()-s,assertions:[...this.assertions],error:r instanceof Error?r:new Error(String(r))})}}return e}test(t,e){this.registeredTests.push({name:t,fn:e})}tests(){}async run(t,e){let o=e?.cwd??this.context.workingDirectory,s=await F(t,{cwd:o,env:e?.env});return{command:t,exitCode:s.exitCode,stdout:s.stdout,stderr:s.stderr,output:String(s.stdout)+String(s.stderr),success:s.exitCode===0}}async runInteractive(t,e){let o=e?.cwd??this.context.workingDirectory,s=0;try{await N(t,{cwd:o,env:e?.env,stdin:"inherit"})}catch{s=1}return{command:t,exitCode:s,stdout:"",stderr:"",output:"",success:s===0}}assertSuccess(t,e){this.assertions.push({description:e??`Command succeeded: ${t.command}`,passed:t.success,expected:"exit code 0",actual:`exit code ${t.exitCode}`})}assertError(t,e,o){let s=!t.success;if(e){let h=(typeof e=="string"?new RegExp(e):e).test(t.output),c;s?h?c="matched":c=`output: ${t.output.slice(0,200)}`:c="command succeeded",this.assertions.push({description:o??`Command failed with expected error: ${e}`,passed:s&&h,expected:`failure with error matching ${e}`,actual:c})}else this.assertions.push({description:o??`Command failed: ${t.command}`,passed:s,expected:"non-zero exit code",actual:`exit code ${t.exitCode}`})}async assertFile(t,e,o){let s=g(t)?t:u(this.context.workingDirectory,t),r=x(this.context.workingDirectory,s);if(!await w(s)){this.assertions.push({description:o??`File exists: ${r}`,passed:!1,expected:"file exists",actual:"file not found"});return}if(e){let c=await O(s),D=(typeof e=="string"?new RegExp(e):e).test(c);this.assertions.push({description:o??`File ${r} matches ${e}`,passed:D,expected:`content matching ${e}`,actual:D?"matched":`content: ${c.slice(0,200)}...`})}else this.assertions.push({description:o??`File exists: ${r}`,passed:!0,expected:"file exists",actual:"file exists"})}async assertNoFile(t,e){let o=g(t)?t:u(this.context.workingDirectory,t),s=x(this.context.workingDirectory,o),r=await w(o);this.assertions.push({description:e??`File does not exist: ${s}`,passed:!r,expected:"file does not exist",actual:r?"file exists":"file does not exist"})}async assertDirectory(t,e){let o=g(t)?t:u(this.context.workingDirectory,t),s=x(this.context.workingDirectory,o),r=await w(o);this.assertions.push({description:e??`Directory exists: ${s}`,passed:r,expected:"directory exists",actual:r?"directory exists":"directory not found"})}assertOutput(t,e,o){let r=(typeof e=="string"?new RegExp(e):e).test(t.output);this.assertions.push({description:o??`Output matches ${e}`,passed:r,expected:`output matching ${e}`,actual:r?"matched":`output: ${t.output.slice(0,200)}`})}assertJson(t,e,o){try{let s=JSON.parse(t.stdout);if(e){let r=e(s);this.assertions.push({description:o??"Output is valid JSON matching validator",passed:r,expected:"valid JSON matching validator",actual:r?"matched":"validator returned false"})}else this.assertions.push({description:o??"Output is valid JSON",passed:!0,expected:"valid JSON",actual:"valid JSON"});return s}catch{this.assertions.push({description:o??"Output is valid JSON",passed:!1,expected:"valid JSON",actual:`invalid JSON: ${t.stdout.slice(0,100)}`});return}}assert(t,e){this.assertions.push({description:e,passed:t,expected:"true",actual:String(t)})}assertEqual(t,e,o){this.assertions.push({description:o,passed:t===e,expected:String(e),actual:String(t)})}hasFailures(){return this.assertions.some(t=>!t.passed)}};var p=class extends m{static description="Tests the theme init command creates a valid theme structure";themeName="";themePath="";tests(){this.test("init creates theme directory",async()=>{this.themeName=`doctor-theme-${C("creative")}`,this.themePath=u(this.context.workingDirectory,this.themeName);let t=await this.runInteractive(`shopify theme init ${this.themeName} --path ${this.context.workingDirectory}`);this.assertSuccess(t),this.context.themeName=this.themeName,this.context.themePath=this.themePath}),this.test("essential theme files exist",async()=>{let t=["layout/theme.liquid","config/settings_schema.json","templates/index.json"];await Promise.all(t.map(e=>this.assertFile(u(this.themePath,e))))}),this.test("theme directories exist",async()=>{let t=["sections","snippets","assets","locales"];await Promise.all(t.map(e=>this.assertDirectory(u(this.themePath,e))))}),this.test("layout/theme.liquid has valid content",async()=>{await this.assertFile(u(this.themePath,"layout/theme.liquid"),/<!doctype html>|<html|{{ content_for_header }}/i,"layout/theme.liquid contains expected Liquid markup")})}};d();var l=class extends m{static description="Tests pushing a theme to the store creates an unpublished theme";static requiresStore=!0;tests(){this.test("push creates unpublished theme",async()=>{if(!this.context.themePath){this.assert(!1,"Theme init did not complete successfully; themePath is missing in context");return}let t=this.context.themeName??"doctor-theme",e=`shopify theme push --unpublished --json --path ${this.context.themePath} -t ${t}`;this.context.environment&&(e+=` -e ${this.context.environment}`),this.context.store&&(e+=` -s ${this.context.store}`),this.context.password&&(e+=` --password ${this.context.password}`);let o=await this.run(e);this.assertSuccess(o);let s=this.assertJson(o,r=>typeof r.theme?.id=="number");s?.theme&&(this.assert(typeof s.theme.id=="number","Theme was created with a valid ID"),this.assertEqual(s.theme.role,"unpublished","Theme role is unpublished"),this.assert(s.theme.editor_url.includes("/admin/themes/"),"Editor URL is provided"),this.assert(s.theme.preview_url.includes("preview_theme_id="),"Preview URL is provided"),this.context.themeId=String(s.theme.id),this.context.data.editorUrl=s.theme.editor_url,this.context.data.previewUrl=s.theme.preview_url)})}};d();function _(i){return{workingDirectory:i.path??y(),environment:i.environment,store:i.store,password:i.password,data:{}}}d();var a=i=>k(i),v;function J(i){v=i}function G(i){if(!v)return i;let t=/\/[^\s,)]+/g;return i.replace(t,e=>T(e,v))}function A(i,t){a(""),a(n.bold(n.cyan(`Suite: ${i}`))),a(n.dim(t))}function j(i){a(n.bold(n.blue(`Running: ${i}`)))}function q(i){let t=`(${(i.duration/1e3).toFixed(2)}s)`;if(i.status==="passed"){a(n.bold(n.green(`PASSED: ${i.name} ${n.dim(t)}`)));for(let e of I(i.assertions))a(e)}else if(i.status==="failed"){a(n.red(`FAILED: ${i.name} ${n.dim(t)}`));for(let e of I(i.assertions))a(e);i.error&&a(n.red(` Error: ${G(i.error.message)}`))}else a(n.yellow(`SKIPPED: ${i.name}`))}function S(i){let t=i.filter(h=>h.status==="passed").length,e=i.filter(h=>h.status==="failed").length,o=i.filter(h=>h.status==="skipped").length,s=i.length,r=i.reduce((h,c)=>h+c.duration,0);a(""),a(n.bold("\u2500".repeat(40))),e>0?a(n.red(n.bold(`Doctor Complete: ${e}/${s} tests failed`))):a(n.green(n.bold(`Doctor Complete: ${t}/${s} tests passed`))),a(` Passed: ${n.green(String(t))}`),a(` Failed: ${n.red(String(e))}`),o>0&&a(` Skipped: ${n.yellow(String(o))}`),a(` Total time: ${n.dim(`${(r/1e3).toFixed(2)}s`)}`)}function I(i){return i.map(t=>{if(t.passed)return n.green(` [OK] ${t.description}`);{let e=` (expected: ${t.expected}, actual: ${t.actual})`;return n.red(` [FAIL] ${t.description}${e}`)}})}var Y=[p,l];async function L(i){let t=[],e=_(i);J(e.workingDirectory);for(let o of Y){let s=new o,r=o.description??"Test suite";A(o.name,r);let h=await s.runSuite(e);for(let c of h)if(j(c.name),q(c),t.push(c),c.status==="failed")return S(t),t}return S(t),t}var f=H(U(),1);var $=class i extends b{static description="Run all theme command doctor-release tests";static hidden=!0;static flags={...E,path:f.Flags.string({char:"p",description:"The path to run tests in. Defaults to current directory.",env:"SHOPIFY_FLAG_PATH",parse:async t=>P(t),default:async()=>y()}),environment:f.Flags.string({char:"e",description:"The environment to use from shopify.theme.toml (required for store-connected tests).",env:"SHOPIFY_FLAG_ENVIRONMENT",required:!0}),store:f.Flags.string({char:"s",description:"Store URL (overrides environment).",env:"SHOPIFY_FLAG_STORE"}),password:f.Flags.string({description:"Password from Theme Access app (overrides environment).",env:"SHOPIFY_FLAG_PASSWORD"})};async run(){if(!R())return;let{flags:t}=await this.parse(i);(await L({path:t.path,environment:t.environment,store:t.store,password:t.password})).some(s=>s.status==="failed")&&(process.exitCode=1)}};export{$ as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{k as P,t as F}from"./chunk-
|
|
1
|
+
import{k as P,t as F}from"./chunk-4GD2RMV4.js";import{a as N}from"./chunk-Q7BOSHWX.js";import{a as T}from"./chunk-UQPAHTBH.js";import{I as H,K as q,k as $,pa as d,ra as h}from"./chunk-2TCPTRLF.js";import{a as x}from"./chunk-EGWRLGF4.js";import{B as I,C as L,T as v}from"./chunk-J6XOTLT5.js";import{i as l}from"./chunk-QF453PH7.js";import{Cb as C,Eb as U,Nb as c}from"./chunk-QY73XOBU.js";import{u as O}from"./chunk-JTEP5MP2.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();p();function D(e){let t=new URLSearchParams;for(let[r,o]of Object.entries(e.replaceTemplates??[]))t.append(`replace_templates[${r}]`,o);for(let[r,o]of Object.entries(e.replaceExtensionTemplates??[])){let n=r.split("/")[0];t.append(`replace_extension_templates[${n}][${r}]`,o)}return t.append("_method",e.method),t}function w(){return{"User-Agent":`Shopify CLI; v=${x}`}}function k(e){return delete e.cookie,delete e.authorization,e}p();function S(e){let t={};return e.split(";").forEach(r=>{let o=r.match(/(.*?)=(.*)$/)??[],n=o[1]?.trim(),s=o[2]?.trim()??"";n&&(t[n]=s)}),t}function E(e){return Object.entries(e).map(([t,r])=>`${t}=${r}`).join("; ")}var y=class extends l{};async function Re(e){return F(e)}async function be(e,t,r){let o=M(t),n=new URLSearchParams;n.append("form_type","storefront_password"),n.append("utf8","\u2713"),n.append("password",e??""),h("theme-service:storefront-session:check-storefront-password");let s={"cache-control":"no-cache","content-type":"application/x-www-form-urlencoded",...r},a=await $(`${o}/password`,{headers:s,body:n.toString(),method:"POST",redirect:"manual"});if(a.status===429)throw d(new l(`Too many incorrect password attempts. Please try again after ${a.headers.get("retry-after")} seconds.`));return B(a,o)}async function j(e,t,r,o,n={}){let s={},a=await G(e,r,n),i=M(t);if(s._shopify_essential=a,h(`theme-service:storefront-session:is-password-protected:${!!o}`),!o)return s;let u=await ee(a,e,i,o,n);return{...s,...u}}async function G(e,t,r,o=1){let n=new URLSearchParams({preview_theme_id:t,_fd:"0",pb:"0"}),s=`${e}?${n}`;h("theme-service:storefront-session:get-session-essential-cookie");let a={...r,...w()},i=await $(s,{method:"HEAD",redirect:"manual",headers:a}),u=i.headers.raw()["set-cookie"]??[],f=_(u,"_shopify_essential");if(!f){if(c(`Failed to obtain _shopify_essential cookie.
|
|
2
2
|
|
|
3
3
|
-Request ID: ${i.headers.get("x-request-id")??"unknown"}
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Aa as bt,Cb as kt,Eb as gs,Ia as cs,Nb as ms,Ta as hs,Ua as us,Xa as fs,_a as ds,fb as ps,qa as wt,ta as be,ya as ls}from"./chunk-
|
|
1
|
+
import{Aa as bt,Cb as kt,Eb as gs,Ia as cs,Nb as ms,Ta as hs,Ua as us,Xa as fs,_a as ds,fb as ps,qa as wt,ta as be,ya as ls}from"./chunk-QY73XOBU.js";import{c as we,f as yt,h as as}from"./chunk-6IDEDOXW.js";import{a as X,c as gi,e as mi,g as ye}from"./chunk-VKWPEFWQ.js";var ui=gi(l=>{"use strict";ye();Object.defineProperty(l,"__esModule",{value:!0});var yi=X("stream"),W=X("path"),G=X("fs"),Es=X("crypto"),O=class{constructor(e,s,i,r,n){this.kind=e,this.input=s,this.begin=i,this.end=r,this.file=n}getText(){return this.input.slice(this.begin,this.end)}getPosition(){let[e,s]=[1,1];for(let i=0;i<this.begin;i++)this.input[i]===`
|
|
2
2
|
`?(e++,s=1):s++;return[e,s]}size(){return this.end-this.begin}},D=class{liquidMethodMissing(e,s){}},wi=Object.prototype.toString,ys=String.prototype.toLowerCase,Qt=Object.hasOwnProperty;function d(t){return typeof t=="string"}function x(t){return typeof t=="function"}function bi(t){return t&&x(t.then)}function _e(t){return t&&x(t.next)&&x(t.throw)&&x(t.return)}function Kt(t){return function(...e){return new Promise((s,i)=>{t(...e,(r,n)=>{r?i(r):s(n)})})}}function h(t){return t=m(t),d(t)?t:k(t)?"":S(t)?t.map(e=>h(e)).join(""):String(t)}function ge(t){return t=m(t),S(t)?t:d(t)&&t.length>0?[t]:Ti(t)?Array.from(t):dt(t)?Object.keys(t).map(e=>[e,t[e]]):[]}function L(t){return t=m(t),k(t)?[]:S(t)?t:[t]}function m(t){return t instanceof D&&x(t.valueOf)?t.valueOf():t}function xt(t){return+m(t)||0}function ft(t){return typeof t=="number"}function Vs(t){return t&&x(t.toLiquid)?Vs(t.toLiquid()):t}function k(t){return t==null}function ki(t){return t===void 0}function S(t){return wi.call(t)==="[object Array]"}function Ps(t){return t&&ft(t.length)}function Ti(t){return dt(t)&&Symbol.iterator in t}function ws(t,e){t=t||{};for(let s in t)if(Qt.call(t,s)&&e(t[s],s,t)===!1)break;return t}function xi(t){return t[t.length-1]}function dt(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function Cs(t,e,s=1){let i=[];for(let r=t;r<e;r+=s)i.push(r);return i}function oe(t,e,s=" "){return $s(t,e,s,(i,r)=>r+i)}function Si(t,e,s=" "){return $s(t,e,s,(i,r)=>i+r)}function $s(t,e,s,i){t=String(t);let r=e-t.length;return r<=0?t:i(t,s.repeat(r))}function js(t){return t}function _i(t){return[...t].some(s=>s>="a"&&s<="z")?t.toUpperCase():t.toLowerCase()}function Li(t,e){return t.length>e?t.slice(0,e-3)+"...":t}function Fi(t,e){return k(t)&&k(e)?0:k(t)?1:k(e)||t<e?-1:t>e?1:0}function Oi(t,e){return k(t)&&k(e)?0:k(t)?1:k(e)||(t=ys.call(t),e=ys.call(e),t<e)?-1:t>e?1:0}function pt(t){return function(...e){return t.call(this,...e.map(m))}}function V(t){return function(...e){return t.call(this,...e.map(xt))}}function*ke(t){let e=new Set;for(let s of t){let i=JSON.stringify(s);e.has(i)||(e.add(i),yield s)}}var bs="__liquidClass__",E=class extends Error{constructor(e,s){super(typeof e=="string"?e:e.message),this.context="",typeof e!="string"&&Object.defineProperty(this,"originalError",{value:e,enumerable:!1}),Object.defineProperty(this,"token",{value:s,enumerable:!1}),Object.defineProperty(this,bs,{value:"LiquidError",enumerable:!1})}update(){Object.defineProperty(this,"context",{value:vi(this.token),enumerable:!1}),this.message=zi(this.message,this.token),this.stack=this.message+`
|
|
3
3
|
`+this.context+`
|
|
4
4
|
`+this.stack,this.originalError&&(this.stack+=`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as O,c as b,f as F}from"./chunk-
|
|
1
|
+
import{b as O,c as b,f as F}from"./chunk-DWMRVMKX.js";import{b as L}from"./chunk-FSWOB535.js";import{F as g,t as f,w as p,x as d,y as h,z as S}from"./chunk-2TCPTRLF.js";import{j as r}from"./chunk-KW5SQ6PG.js";import{D as w,J as y}from"./chunk-J6XOTLT5.js";import{a as m}from"./chunk-B6BTX7WU.js";import{Ib as A,Mb as I,b as n}from"./chunk-QY73XOBU.js";import{b as j}from"./chunk-I3J63RFV.js";import{e as C,g as i}from"./chunk-VKWPEFWQ.js";i();i();var a=m({name:"AuthLoginResult",schema:n.object({status:n.literal("success"),alias:n.string()}).strict()});i();var c="NEW_LOGIN";function _(s,e){let t=[],o=s[e];if(o)for(let[l,x]of Object.entries(o))t.push({label:x.identity.alias??l,value:l});return t}async function q(){let s=await g({},{forceNewSession:!0}),e=await d(s.userId);if(!e){let t=await y({message:"Enter an alias for this account (e.g. your email or a nickname)"});return await h(s.userId,t),t}return e}async function E(){let s=await p(),e=await f(),t=[];return s&&t.push(..._(s,e)),t.length>0&&t.push({label:"Log in with a different account",value:c}),t}async function N(s){if(s){let o=await S(s);if(o)return r(o),s}let e=await E(),t=c;return e.length>0&&(t=await w({message:"Which account would you like to use?",choices:e})),t===c?q():(r(t),e.find(o=>o.value===t)?.label??t)}var v=C(j(),1);var u=class s extends L{static descriptionWithMarkdown="Logs you in to your Shopify account.";static description=this.descriptionForHelp();static flags={...O,...b,alias:F(v.Flags.string({description:"Alias of an existing session you want to use.",env:"SHOPIFY_FLAG_AUTH_ALIAS"}))};static get jsonOutputSchema(){return a}async run(){let{flags:e}=await this.parse(s),t=await N(e.alias);e.json?A(a.encode({status:"success",alias:t})):I(`Current account: ${t}.`)}};export{u as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as M}from"./chunk-6AFURA34.js";import{a as E}from"./chunk-XUZXQC5H.js";import{a as O}from"./chunk-TFVIG4I7.js";import{Ha as j,I as C}from"./chunk-X4767EMJ.js";import{ba as I}from"./chunk-X5VPFSL3.js";import{e as R}from"./chunk-UQPAHTBH.js";import{b as z}from"./chunk-BYZU7YS7.js";import{b as D}from"./chunk-DWMRVMKX.js";import{$ as h,N as y,ca as g,u as _}from"./chunk-2TCPTRLF.js";import{H as T,I as k,y as A}from"./chunk-J6XOTLT5.js";import{Cb as p,Eb as m,Kb as f}from"./chunk-QY73XOBU.js";import{b as W}from"./chunk-I3J63RFV.js";import{e as F,g as s}from"./chunk-VKWPEFWQ.js";s();s();s();var L={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"metafieldDefinitions"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ownerType"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"MetafieldOwnerType"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"metafieldDefinitions"},arguments:[{kind:"Argument",name:{kind:"Name",value:"ownerType"},value:{kind:"Variable",name:{kind:"Name",value:"ownerType"}}},{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"30"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"MetafieldForImport"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"MetafieldForImport"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"MetafieldDefinition"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"key"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"type"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"category"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}},{kind:"Field",name:{kind:"Name",value:"access"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin"}},{kind:"Field",name:{kind:"Name",value:"storefront"}},{kind:"Field",name:{kind:"Name",value:"customerAccount"}}]}},{kind:"Field",name:{kind:"Name",value:"capabilities"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"adminFilterable"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"validations"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"value"}}]}}]}}]};s();async function J(e){let i="Admin",n=R(e.storeFqdn,"unstable");return{token:e.token,api:i,url:n}}async function P(e){return g({query:e.query,...await J(e.session),variables:e.variables,autoRateLimitRestore:e.autoRateLimitRestore})}s();var w={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"metaobjectDefinitions"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"metaobjectDefinitions"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"10"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"MetaobjectForImport"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"MetaobjectForImport"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"MetaobjectDefinition"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"type"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"access"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin"}},{kind:"Field",name:{kind:"Name",value:"storefront"}}]}},{kind:"Field",name:{kind:"Name",value:"displayNameKey"}},{kind:"Field",name:{kind:"Name",value:"capabilities"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"publishable"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}}]}},{kind:"Field",name:{kind:"Name",value:"translatable"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}}]}},{kind:"Field",name:{kind:"Name",value:"renderable"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}},{kind:"Field",name:{kind:"Name",value:"data"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"metaTitleKey"}},{kind:"Field",name:{kind:"Name",value:"metaDescriptionKey"}}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"fieldDefinitions"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"key"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"type"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"category"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"required"}},{kind:"Field",name:{kind:"Name",value:"validations"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"value"}}]}}]}}]}}]};var x=F(z(),1);var Q={article:"ARTICLE",blog:"BLOG",collection:"COLLECTION",company:"COMPANY",company_location:"COMPANY_LOCATION",location:"LOCATION",market:"MARKET",order:"ORDER",page:"PAGE",product:"PRODUCT",customer:"CUSTOMER",delivery_customization:"DELIVERY_CUSTOMIZATION",delivery_method:"DELIVERY_METHOD",delivery_option_generator:"DELIVERY_OPTION_GENERATOR",discount:"DISCOUNT",draft_order:"DRAFTORDER",fulfillment_constraint_rule:"FULFILLMENT_CONSTRAINT_RULE",gift_card_transaction:"GIFT_CARD_TRANSACTION",order_routing_location_rule:"ORDER_ROUTING_LOCATION_RULE",payment_customization:"PAYMENT_CUSTOMIZATION",selling_plan:"SELLING_PLAN",shop:"SHOP",validation:"VALIDATION",variant:"PRODUCTVARIANT",cart_transform:"CARTTRANSFORM"};async function $({query:e,session:i,toNodes:n,toVariables:t,performQuery:d=a=>P({query:e,session:i,variables:a,autoRateLimitRestore:!0})}){let a;try{let o=n(await d(t(a))),l=[];for(l.push(...o.nodes);o.pageInfo.hasNextPage;)a=o.pageInfo.endCursor,o=n(await d(t(a))),l.push(...o.nodes);return{status:"ok",items:l}}catch(o){if(o instanceof Error&&o.message.includes("ACCESS_DENIED"))return{status:"scope_error"};throw o}}function V(e,i){let n="";for(let t of e)n=(0,x.updateTomlValues)(n,t);return`# ${i}
|
|
2
|
+
${n}`}function Z(e,i){let n=i.map(oe).map(a=>{switch(a.status){case"ok":{let{typeName:o,patches:l}=a;return V(l,`type: $app:${o}`)}case"not_app_reserved":return null}}).filter(a=>a!==null),t=e.flatMap(({items:a,ownerType:o,graphQLOwner:l})=>a.map(r=>({result:de(r,o),graphQLOwner:l}))).map(({result:a,graphQLOwner:o})=>{switch(a.status){case"ok":{let{namespace:l,key:r,patches:N}=a;return V(N,`namespace: ${l==="app"?"$app":`$app:${l}`} key: ${r} owner_type: ${o}`)}case"not_app_reserved":return null}}).filter(a=>a!==null);return{tomlContent:[...n,...t].join(`
|
|
3
|
+
`),metafieldCount:t.length,metaobjectCount:n.length}}async function q(e){let i=await ae(e),n=i.storeFqdn,t=await ee(i),d=await ne(i);e.includeExistingDeclaredDefinitions||(t=ie(t,e.appConfiguration),d=te(d,e.appConfiguration));let{tomlContent:a,metafieldCount:o,metaobjectCount:l}=Z(t,d);X(o,l,n,a)}function X(e,i,n,t){A({headline:"Conversion to TOML complete.",body:["Converted",{warn:`${e} metafields`},"and",{warn:`${i} metaobjects`},"from",{warn:n},"into TOML, ready for you to copy."],orderedNextSteps:!0,nextSteps:["Review the suggested TOML carefully before applying.",["Missing sections? Make sure your app has the required access scopes to load metafields and metaobjects (e.g.",{command:"read_customers"},"to load customer metafields,",{command:"read_metaobject_definitions"},"to load metaobjects.)"],["Missing definitions? Only metafields and metaobjects that are app-reserved (using",{command:"$app"},") will be converted."],["When you're ready, add the generated TOML to your app's configuration file and test out changes with the",{command:"shopify app dev"},"command."]]}),ce(t)}async function ee(e){let i=[];return await T(Object.entries(Q).map(([n,t])=>({title:m`Loading ${p.green(n)} metafields`,task:async()=>{let d=await $({query:L,session:e,toNodes:a=>a.metafieldDefinitions,toVariables:a=>({ownerType:t,after:a})});i.push({metafields:d,ownerType:n,graphQLOwner:t})}}))),i.map(({metafields:n,ownerType:t,graphQLOwner:d})=>n.status==="ok"?{ownerType:t,items:n.items,graphQLOwner:d}:null).filter(n=>n!==null)}async function ne(e){let i=await k({title:m`Loading ${p.green("metaobjects")}`,task:async()=>$({query:w,session:e,toNodes:n=>n.metaobjectDefinitions,toVariables:n=>({after:n})})});return i.status==="ok"?i.items:[]}function ie(e,i){return e.map(n=>{let t=n.items.filter(d=>!U(i,[n.ownerType,"metafields",u(d.namespace)??"",d.key]));return t.length>0?{...n,items:t}:null}).filter(n=>n!==null)}function te(e,i){return e.filter(n=>!U(i,["metaobjects","app",u(n.type)??""]))}function U(e,i){let n=e;for(let t of i){if(!n[t])return!1;n=n[t]}return!0}async function ae(e){let{remoteApp:i,store:n}=e,t=await I(i);return await y(n.shopDomain,i.apiKey,t)}function u(e){if(!e.match(/^app--\d+/))return null;let i="app";return e.match(/^app--\d+--/)&&(i=e.replace(/^app--\d+--/,"")),i}function de(e,i){let n=u(e.namespace);if(!n)return{status:"not_app_reserved"};let t=e.key,d=le(e),a=re(d,i,n,t);return{status:"ok",key:t,namespace:n,patches:a}}function oe(e){let i=u(e.type);if(!i)return{status:"not_app_reserved"};let n=se(e,i),t=me(n,i);return{status:"ok",typeName:i,patches:t}}function le(e){let i={name:e.name===e.key?void 0:e.name,type:e.type.name,description:e.description??void 0,capabilities:c({admin_filterable:e.capabilities.adminFilterable.enabled||void 0}),access:c({admin:H(e.access.admin),storefront:Y(e.access.storefront),customer_account:ue(e.access.customerAccount)}),validations:G(e.validations)},{type:n,validations:t}=K(i.type,i.validations);return i.type=n,i.validations=t,i}function se(e,i){return{name:e.name===i?void 0:e.name,description:e.description??void 0,display_name_field:e.displayNameKey??void 0,access:c({admin:H(e.access.admin),storefront:Y(e.access.storefront)}),capabilities:c({translatable:e.capabilities.translatable.enabled||void 0,publishable:e.capabilities.publishable.enabled||void 0,renderable:e.capabilities.renderable?.enabled||void 0,renderable_meta_title_field:e.capabilities.renderable?.data?.metaTitleKey??void 0,renderable_meta_description_field:e.capabilities.renderable?.data?.metaDescriptionKey??void 0}),fields:Object.fromEntries(e.fieldDefinitions.map(n=>{let t={type:n.type.name,description:n.description??void 0,name:n.name===n.key?void 0:n.name,required:n.required||void 0,validations:G(n.validations)},{type:d,validations:a}=K(t.type,t.validations);return t.type=d,t.validations=a,[n.key,t]}))}}function K(e,i){if(!i)return{type:e,validations:void 0};if(i.metaobject_definition_type&&typeof i.metaobject_definition_type=="string"){let n=u(i.metaobject_definition_type);return{type:`${e}<$app:${n}>`,validations:c({...i,metaobject_definition_type:void 0})}}if(i.metaobject_definition_types&&Array.isArray(i.metaobject_definition_types)&&i.metaobject_definition_types.every(n=>typeof n=="string")){let n=i.metaobject_definition_types.map(t=>u(t));return{type:`${e}<${n.map(t=>`$app:${t}`).join(",")}>`,validations:c({...i,metaobject_definition_types:void 0})}}return{type:e,validations:i}}function G(e){let i=n=>{try{return JSON.parse(n)}catch{return n}};return c(Object.fromEntries(e.filter(n=>n.value!==void 0&&n.name!=="metaobject_definition_id"&&n.name!=="metaobject_definition_ids").map(n=>[n.name,n.value?i(n.value):void 0])))}function re(e,i,n,t){let d=[[[i,"metafields",n,t,"name"],e.name],[[i,"metafields",n,t,"type"],e.type],[[i,"metafields",n,t,"description"],e.description]],a=[[[i,"metafields",n,t,"access","admin"],e.access?.admin],[[i,"metafields",n,t,"access","storefront"],e.access?.storefront],[[i,"metafields",n,t,"access","customer_account"],e.access?.customer_account],[[i,"metafields",n,t,"capabilities","admin_filterable"],e.capabilities?.admin_filterable||void 0]];return e.validations&&B(e.validations).forEach(({validationKey:l,actualValue:r})=>{d.push([[i,"metafields",n,t,"validations",l],r])}),[v(d),v(a)]}function me(e,i){let n=[[["metaobjects","app",i,"name"],e.name===i?void 0:e.name],[["metaobjects","app",i,"description"],e.description],[["metaobjects","app",i,"display_name_field"],e.display_name_field]],t=[[["metaobjects","app",i,"access","admin"],e.access?.admin],[["metaobjects","app",i,"access","storefront"],e.access?.storefront]];return e.capabilities?.translatable&&t.push([["metaobjects","app",i,"capabilities","translatable"],!0]),e.capabilities?.publishable&&t.push([["metaobjects","app",i,"capabilities","publishable"],!0]),e.capabilities?.renderable&&(t.push([["metaobjects","app",i,"capabilities","renderable"],!0]),e.capabilities?.renderable_meta_title_field&&t.push([["metaobjects","app",i,"capabilities","renderable_meta_title_field"],e.capabilities.renderable_meta_title_field]),e.capabilities?.renderable_meta_description_field&&t.push([["metaobjects","app",i,"capabilities","renderable_meta_description_field"],e.capabilities.renderable_meta_description_field])),Object.entries(e.fields).forEach(([d,a])=>{if(typeof a=="string")n.push([["metaobjects","app",i,"fields",d],a]);else{let o=Object.fromEntries(Object.entries(a).filter(([l,r])=>r!==void 0));Object.keys(o).length===1?n.push([["metaobjects","app",i,"fields",d],a.type]):(n.push([["metaobjects","app",i,"fields",d,"type"],a.type]),n.push([["metaobjects","app",i,"fields",d,"description"],a.description]),n.push([["metaobjects","app",i,"fields",d,"name"],a.name]),n.push([["metaobjects","app",i,"fields",d,"required"],a.required||void 0]),a.validations&&B(a.validations).forEach(({validationKey:r,actualValue:N})=>{n.push([["metaobjects","app",i,"fields",d,"validations",r],N])}))}}),[v(n),v(t)]}function B(e){return Object.entries(e).map(([i,n])=>{let t;return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||Array.isArray(n)&&n.every(d=>typeof d=="string")?t=n:t=JSON.stringify(n),{validationKey:i,actualValue:t}})}function ce(e){let i=e.split(`
|
|
4
|
+
`);for(let n of i)n.match(/^\s*\[/)?f(m`${p.green(n)}`):n.match(/^\s*#/)?f(m`${p.gray(n)}`):f(m`${n}`)}function H(e){switch(e){case"MERCHANT_READ_WRITE":return"merchant_read_write";case"MERCHANT_READ":case"PRIVATE":case"PUBLIC_READ":case"PUBLIC_READ_WRITE":case null:case void 0:return}}function Y(e){switch(e){case"PUBLIC_READ":return"public_read";case"NONE":case null:case void 0:return}}function ue(e){switch(e){case"READ":return"read";case"READ_WRITE":return"read_write";case"NONE":case null:case void 0:return}}function c(e){if(e&&!h(e)&&!(typeof e=="object"&&Object.values(e).every(i=>i===void 0)))return e}function v(e){return e.filter(([i,n])=>n!==void 0)}var b=F(W(),1);var S=class e extends E{static summary="Import metafield and metaobject definitions.";static descriptionWithMarkdown="Import metafield and metaobject definitions from your development store. [Read more about declarative custom data definitions](https://shopify.dev/docs/apps/build/custom-data/declarative-custom-data-definitions).";static description=this.descriptionForHelp();static flags={...D,...O,store:b.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async i=>_(i)}),"include-existing":b.Flags.boolean({description:"Include existing declared definitions in the output.",default:!1,env:"SHOPIFY_FLAG_INCLUDE_EXISTING"})};async run(){let{appContextResult:i,...n}=await k({title:m`Loading application`,task:async()=>{let{flags:t}=await this.parse(e);await C(t.path);let d=await j({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),a=await M({appContextResult:d,storeFqdn:t.store,forceReselectStore:t.reset});return{appContextResult:d,appConfiguration:d.app.configuration,remoteApp:d.remoteApp,store:a,includeExistingDeclaredDefinitions:t["include-existing"]}}});return await q(n),{app:i.app}}};export{S as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{J as g,L as c,M as C,h as m,t as f}from"./chunk-
|
|
1
|
+
import{J as g,L as c,M as C,h as m,t as f}from"./chunk-7JAZMNHL.js";import{z as h}from"./chunk-J6XOTLT5.js";import{Ib as p,ya as l}from"./chunk-QY73XOBU.js";import{p as d}from"./chunk-6IDEDOXW.js";import{g as u}from"./chunk-VKWPEFWQ.js";u();import E from"clipboardy";var I="{{SCAN_CONTEXT}}",y="<the findings document from step 4>",N={posix:"bash",powershell:"powershell",cmd:"bat"};function r(e){return`\`${e.replace(/`/g,"'")}\``}function w(e,n){return`\`\`\`${N[n]}
|
|
2
2
|
${e}
|
|
3
3
|
\`\`\``}function _(e,n){let t=w(c(e,n),n),i=`replacing \`${e.stdinPlaceholder}\` with the file's path`,o=C(e,y,n);if(o===void 0)return`cmd.exe can't pipe multi-line text inline, so write the document to a file and redirect it to \`record\`, ${i}:
|
|
4
4
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{a as Dt}from"./chunk-UOHNRH6E.js";import{a as Ar}from"./chunk-S43YCHAN.js";import{b as Cr}from"./chunk-D65CUTKT.js";import{a as Ir}from"./chunk-A5RXJNQ5.js";import{a as kr}from"./chunk-VMMPBOTN.js";import{a as Lr}from"./chunk-SPWX6OQR.js";import{a as yr}from"./chunk-RV54HI5A.js";import{a as vr}from"./chunk-LXCVWQK4.js";import{a as Pr,b as xr,c as Er,d as br}from"./chunk-FX27WXGC.js";import{a as Tr}from"./chunk-5WN5FGRS.js";import{a as Sr}from"./chunk-OTQUZLAC.js";import{a as Ur}from"./chunk-VI7XF2HZ.js";import{a as _r}from"./chunk-27WWE5QN.js";import{a as Rr}from"./chunk-ON4RFEHN.js";import{a as cr}from"./chunk-OYMJI3MD.js";import{a as ur}from"./chunk-5EVQSYMN.js";import{a as dr}from"./chunk-PCWXGO4K.js";import{a as mr}from"./chunk-6HC6JBXZ.js";import{g as fr}from"./chunk-N5YS4PAM.js";import{a as tt}from"./chunk-A7KQUQLZ.js";import{c as et,m as rt}from"./chunk-3CSRZM3Q.js";import{a as hr}from"./chunk-MLZAI55C.js";import{a as gr}from"./chunk-Y4USH7MD.js";import{a as pr}from"./chunk-ZYZU37KT.js";import{b as lr,g as ke,j as Ze}from"./chunk-4GD2RMV4.js";import{a as mo,b as ho,c as go,d as wo}from"./chunk-QYV5QN44.js";import{d as wr}from"./chunk-6I5ATJK6.js";import{a as ar,b as ir,c as po,d as uo,e as st,f as fo,g as yo}from"./chunk-NY5ESCDK.js";import{a as M,b as Xe}from"./chunk-VEYIT46B.js";import{a as er,b as tr,d as Ce,f as rr,m as Ie,n as H,s as N,u as or,v as nr,w as sr}from"./chunk-Q7BOSHWX.js";import{a as Zt}from"./chunk-3EY3ULS6.js";import{a as oo,b as nt,c as oe,d as no}from"./chunk-IRF43DMG.js";import{a as vo,f as Po,g as xo,h as at,i as Eo,j as bo,k as So,l as Uo,m as Ro,n as Ao,o as To,p as _o,q as Co,v as Io,x as ko,z as it}from"./chunk-NQ5PKMPV.js";import{a as so,b as ao,c as io,d as co,e as lo}from"./chunk-V2XUMMTV.js";import{a as Mr}from"./chunk-WQG4QDC5.js";import{a as ro}from"./chunk-6AFURA34.js";import{a as to}from"./chunk-XUZXQC5H.js";import{a as $r}from"./chunk-TFVIG4I7.js";import{Ha as eo,I as jr,K as Vr,M as re,W as zr,X as Xr,ha as Zr,i as Fr,j as q,k as Dr,o as Nr,t as ot,u as qr,v as Wr,w as Hr,x as Gr,y as Br,ya as $e,z as Kr,za as Me}from"./chunk-X4767EMJ.js";import{B as Or,aa as Yr,ba as Le,ca as Qr,p as te,pa as Jr,u as le}from"./chunk-X5VPFSL3.js";import{d as Jt}from"./chunk-BYZU7YS7.js";import{a as V}from"./chunk-SUIVO7GI.js";import{b as Xt,e as _e}from"./chunk-DWMRVMKX.js";import{J as Lt,V as Z,X as $t,c as Tt,h as _t,j as Ct,m as It,na as Mt,o as kt,p as Pe,u as xe}from"./chunk-2TCPTRLF.js";import{A as ie,H as Re,L as jt,N as Ae,S as Te,T as ce,U as Je,V as Vt,X as zt,a as At,d as Ee,e as k,f as $,h as be,i as Se,j as Ot,k as Nt,l as qt,m as Wt,n as Ht,o as F,p as Gt,q as Ye,r as Qe,s as Bt,t as Kt,y as Ue}from"./chunk-J6XOTLT5.js";import{b as ze,d as Ut,f as ve,i as Rt}from"./chunk-HILYTMVA.js";import{a as Mn}from"./chunk-7UNQOKZW.js";import{d as Ft}from"./chunk-6MELTJU3.js";import{i as A,l as ee}from"./chunk-QF453PH7.js";import{a as Lo}from"./chunk-QFMATBKM.js";import{Aa as ge,Cb as x,Eb as b,Ia as Et,Kb as j,Nb as g,Ob as _,Ra as we,T as Ve,Xa as D,_a as ye,db as bt,gb as St,qa as L,ya as he}from"./chunk-QY73XOBU.js";import{e as Yt,g as Qt}from"./chunk-JTEP5MP2.js";import{b as $n}from"./chunk-I3J63RFV.js";import{a as de}from"./chunk-JD5P5RAJ.js";import{c as U,e as je,f as yt,h as fe,i as vt,j as me,n as Pt,o as xt}from"./chunk-6IDEDOXW.js";import{e as X,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var Fn=300*1e3,Dn='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 $o(t,e,r=Date.now()){for(;await On(t,e,r););}async function On(t,e,r){let o=await ke(t,e);if(!o||Nn(o,r))throw new A(Dn);return await ce(3),o.processing}function Nn(t,e){return t.processing&&Date.now()-e>=Fn}var qn="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",Wn="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",ct=3,Fe=class extends pr{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=Pr(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){xr(this.adminSession.storeFqdn,e)}removeTheme(){Er(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:lr,name:this.generateThemeName(this.context),src:qn};for(let o=0;o<ct;o++){g(`Attempt ${o}/${ct}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await Ze(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),g(`Waiting for theme with id "${n.id}" to be processed`),await $o(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 ${ct} retries. Creating theme using fallback theme zip`);let r=await Ze({...e,src:Wn},this.adminSession);if(!r)throw g("Theme creation failed. Exiting process."),new ee(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var Hn={"theme:init":yr,"theme:check":cr,"theme:console":ur,"theme:delete":dr,"theme:dev":mr,"theme:duplicate":hr,"theme:info":gr,"theme:language-server":vr,"theme:list":br,"theme:metafields:pull":Tr,"theme:open":Sr,"theme:package":Ur,"theme:profile":Rr,"theme:publish":Ar,"theme:preview":_r,"theme:pull":Cr,"theme:push":Ir,"theme:rename":kr,"theme:share":Lr},Fa=Hn;async function Mo(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(R=>R.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[c,f]=await Promise.all([Lt(t.storeFqdn),Kn(e)]),l=c.storeFqdn,[u,h]=await Promise.all([rt(c),et(c)]),y=h?await tt(t.storePassword,l,u):void 0,d=await Bn(c,t.theme),m=d.id.toString();return Ue({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:f}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${l}/admin/themes/${m}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:Gn,options:{theme:d,adminSession:c,storefrontPassword:y,crawlerSignatureHeaders:u,themeExtensionDirectory:a,themeExtensionPort:i}}}var Gn=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await fr(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function Bn(t,e){let r;if(e)g(`Fetching theme with provided id ${e}`),r=await ke(parseInt(e,10),t);else{let o=new Fe(t,{devPreview:!0});await Re([{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 Kn(t){return t.developerPlatformClient?.clientName===Jr.AppManagement?`https://${await Pe()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await kt()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function jn(t){let e=U(t.directory,"locales");return ye([U(e,"*.json")])}async function Fo(t,e){let r=await jn(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),Vn(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 Vn(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 _(i,n.stderr),new Error(i)}}p();function De(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 lt=".js.map";async function ne(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 Fo(t,r),c=await Dr(t),f=t.outputRelativePath?fe(n):n,l=await zn(t,s,f,o),u=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(u=Do(t.configuration.metafields)),{assets:{main:pe(l)&&l[0]?.assets?.main?l[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await we(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:De(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 zn(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"}]),pe(s)){let a=await Yn(r);return Promise.all(s.map(async i=>{let{target:c,resource:f}=i,l="metafields"in i?Do(i.metafields??[]):void 0,u={...i,...l?{metafields:l}:{},surface:Me(c),root:{url:`${e}/${c}`},resource:f||{url:""}},h=a?.[c];if(!h)return u;let d=await ts(h,{target:c,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...u,...d}}))}return s}async function Yn(t){try{let e=U(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 Qn({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 Oe(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 Oe(s,i,l.filepath,r,o,n,l.module);return{assets:{[u.name]:u}}}return{}}async function Jn({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await we(U(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function Xn({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,c)=>{let f=i.schema,l=s[c]?.schema,u=typeof l=="string"?l:f,h=typeof l=="string"?f:void 0;return{...i,schema:await Oe("schema",`${t}/intents/${c}/schema`,u,r,o,n,h)}}))}:{}}async function Zn({target:t,url:e,extension:r,resolver:o},n,s){let a=await Oe(n,`${t}/${n}`,s,e,r,o);return await es(t,s,r,o),{assets:{[a.name]:a}}}async function es(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(lt)&&await D(U(r.directory,n))&&o.set(`${t}/${vt(n)}`,n)}async function ts(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return rs(o,n)?Xn(e,n):os(o,n)?Zn(e,o,n):ns(o,n)?Jn(e,o,n):Qn(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function Do(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function pe(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Oe(t,e,r,o,n,s,a){let i=`${e}${me(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await we(U(n.directory,a??r))??0}}function rs(t,e){return t==="intents"&&Array.isArray(e)}function os(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function ns(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as ss}from"events";var ue;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(ue||(ue={}));async function Oo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:po(t.storeFqdn,t.apiKey),mobileUrl:fo(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=>ne(n,e,t,r&&pt(r,n.devUUID))))}}function pt(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var Ne=class extends ss{options;rawPayload;assetResolvers;constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=Z(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(pe(n.extensionPoints)&&pe(o.extensionPoints)){let s=n.extensionPoints.reduce((c,f)=>({...c,[f.target]:f}),{});o.extensionPoints=Z(o.extensionPoints,n.extensionPoints,c=>c.map(f=>{let l=s[f.target];return l?Z(f,l,(u,h)=>h):f}));let{extensionPoints:a,...i}=n;return Z(o,i)}return Z(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){g(b`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await ne(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},pt(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 ne(e,r,this.options,pt(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(ue.Update,e)}};p();p();var z;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(z||(z={}));function No(t,e){return(r,o,n)=>{r.url==="/extensions"&&(g("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,as(t,e)))}}function as(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: ${x.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",us(t,e))}}function is(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?x.json(o).output():String(o)).join(" ");return b`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var cs={debug:t=>x.gray(t),warn:t=>x.yellow(t),error:t=>x.errorText(t)};function ls({type:t,message:e}){let r=is(e);switch(t){case"debug":case"warn":case"error":return b`${cs[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function ps(t,e){F({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(ls(t))})}function us(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
|
+
${x.json(s)}
|
|
3
|
+
`,e.stdout),n===z.Update){let a=e.payloadStore.getRawPayload().app.apiKey,i=s.app?.apiKey;if(s.app){if(a!==i)return;e.payloadStore.updateApp(s.app)}s.extensions&&e.payloadStore.updateExtensions(s.extensions)}else if(n===z.Dispatch){let a=ds(o,e);Wo(t,a,e)}else n===z.Log&&ps(s,e)}}function qo(t,e){return r=>{let o={event:z.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};g(b`Sending websocket update event to the websocket clients:
|
|
4
|
+
${x.json(o)}
|
|
5
|
+
`,e.stdout),Wo(t,o,e)}}function Wo(t,e,r){g(b`Sending websocket with event type ${e.event} and data:
|
|
6
|
+
${x.json(e.data)}
|
|
7
|
+
`,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function ds(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var fs=10;function Ho(t){let e=new Dt.default({noServer:!0,clientTracking:!0}),r=ms(e);return t.httpServer.on("upgrade",No(e,t)),t.payloadStore.on(ue.Update,qo(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function ms(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},fs*1e3)}p();p();p();function Go(t,e){let{url:r}=De(t.type,e);if(t.surface==="checkout"&&r){let o=new URL(`https://${e.storeFqdn}/`);return o.pathname=r,o.searchParams.append("dev",`${e.url}/extensions`),o.toString()}else{let o=new URL(`https://${e.storeFqdn}/`);return o.pathname="admin/extensions-dev",o.searchParams.append("url",qe(t,e)),o.toString()}}function Bo(t,e,r){let o=Me(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",qe(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=hs(e,r,t);break;default:return}return n.toString()}function hs(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,s="shopify.com",a=new URL(`https://${s}/${n}/account/extensions-development`);return a.searchParams.append("origin",o),a.searchParams.append("extensionId",t.devUUID),a.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),a.searchParams.append("appId",e.id??""),r!==""&&a.searchParams.append("target",r),a}function qe(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function O(t,e){tr(t,er(e))}p();var ut=class extends ee{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function Ko(t){let e=await gs(t),r=await L(e);return Zt(r,t.data)}async function gs(t){let e=await ws(),r=[];t.extensionSurface&&r.push(U(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(U(e,`${t.template}.html.liquid`));let o=await ye(r);if(o.length===0)throw new ut(t);return o[0]}async function ws(){return await bt("templates/ui-extensions/html",{type:"directory",cwd:xt(import.meta.url)})}var jo=N(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")}),Vo=N(t=>{H(t,"Cache-Control","no-cache")}),dt=N(async t=>Ie(t,"/extensions",307));async function ys(t,e){let{filePath:r}=e;if(!await D(r))return O(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Et(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=me(r),a=n[s]||"text/plain";return H(t,"Content-Type",a),o}function zo({getExtensions:t,payloadStore:e}){return N(async r=>{let{extensionId:o,assetPath:n=""}=Ce(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,f=c.endsWith(lt);if(f&&i===void 0)return O(r,{statusCode:404,statusMessage:"Not Found"});let l=je(f?s.directory:Nr(s.outputPath)),u=je(U(l,c));return Pt(l,u)?ys(r,{filePath:u}):O(r,{statusCode:404,statusMessage:"Not Found"})})}function ft({payloadStore:t}){return N(e=>(H(e,"content-type","application/json"),t.getRawPayload()))}function Yo({devOptions:t}){return N(e=>{g(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function mt({devOptions:t,getExtensions:e}){return N(async r=>{let{extensionId:o}=Ce(r),n=e().find(i=>i.devUUID===o);if(!n)return O(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(rr(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return Ko({data:{url:qe(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=Go(n,t);return Ie(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:se(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await ne(n,a,t)}})}function Qo({devOptions:t,getExtensions:e}){return N(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Ce(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=Bo(n,s,t);return a?Ie(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 vs}from"http";function Jo(t){let e=or(),r=nr();e.use(Yo(t)),e.use(jo),e.use(Vo),r.use("/extensions/dev-console",dt),r.use("/extensions/:extensionId",mt(t)),r.use("/extensions/:extensionId/",mt(t)),r.use("/extensions/:extensionId/:extensionPointTarget",Qo(t)),r.use("/extensions/:extensionId/assets/**:assetPath",zo(t)),r.use("/extensions",ft(t)),r.use("/extensions/",ft(t)),r.use("/",dt),e.use(r);let o=vs(sr(e));return o.listen(t.devOptions.port,"localhost"),o}async function Xo(t){let e={...t,websocketURL:se(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Oo(e,r,o),s=new Ne(n,e,o),a=e.extensions.filter(u=>u.isPreviewable),i=()=>a;g("Setting up the UI extensions HTTP server...",e.stdout);let c=Jo({devOptions:e,payloadStore:s,getExtensions:i});g("Setting up the UI extensions Websocket server...",e.stdout);let f=Ho({...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(d=>d.isPreviewable));for(let d of y){if(!d.extension.isPreviewable)continue;let m=d.buildResult?.status==="ok"?"success":"error",R=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case oe.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl){let E=await $e(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(d.extension,r);break;case oe.Updated:await s.updateExtension(d.extension,e,r,{status:m,error:R});break;case oe.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==d.extension.devUUID),await s.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(l).onStart(l),e.signal.addEventListener("abort",()=>{g("Closing the UI extensions dev server..."),f.close(),c.close()})}function se(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var Ps="3",xs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:c,proxyUrl:f,appName:l,appDotEnvFile:u,appId:h,grantedScopes:y,allExtensions:d,appDirectory:m,appWatcher:R})=>{await Xo({appName:l,appDotEnvFile:u,appDirectory:m,id:h,extensions:d,stdout:e,stderr:t,signal:r,url:f,port:i,storeFqdn:xe(n),storeId:s,apiKey:o,grantedScopes:y,checkoutCartUrl:c,subscriptionProductUrl:a,manifestVersion:Ps,appWatcher:R})};async function Zo({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await $e(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:xs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();function Y(t){let e=t.find(o=>re(o,q.Frontend)),r=t.find(o=>re(o,q.Backend));return{frontendConfig:e,backendConfig:r}}p();async function en(t){let r={topic:"app/uninstalled",api_version:(await mo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:wo.LOCALHOST,shared_secret:t.sharedSecret},o=await ho(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await ce(3);let n=await Es(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function Es(t,e){let r=0;for(;r<3;){try{return await go(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof _t&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await ce(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var bs=async({stdout:t},e)=>{await en({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function tn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=Y(t),c=t.map(({configuration:l})=>l.webhooks_path).find(l=>l)??"/api/webhooks";if(c&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:bs,options:{deliveryPort:a?r:o,webhooksPath:c,organizationId:n,...s}}}p();async function rn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Ss}}var Ss=async({stdout:t,abortSignal:e},r)=>{let o=yo({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=ir({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 nn({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=Y(t),c=i?.configuration.hmr_server?await M():void 0,f=void 0,l=t.map(async u=>{let h=await Us({web:u,frontendPort:r,backendPort:o}),y=c&&u.configuration.roles.includes(q.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:Rs,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:f,hmrServerOptions:y,roles:u.configuration.roles}}});return Promise.all(l)}async function Us({web:t,frontendPort:e,backendPort:r}){return re(t,q.Frontend)?e:re(t,q.Backend)?r:M()}async function Rs({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:c,directory:f,devCommand:l,preDevCommand:u,scopes:h,shopCustomDomain:y,hmrServerOptions:d}){let m=d?.port,R={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}`,...m&&{HMR_SERVER_PORT:`${m}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:f,port:o,env:R,stdout:t,stderr:e};u&&(t.write(`Running pre-dev command: "${u}"`),await on({...E,command:u,showOutput:Yt()})),await on({...E,command:l,showOutput:!0})}async function on({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let c=t.split("&&").map(f=>f.trim())??[];for(let f of c){let[l,...u]=f.split(" ");l?.length!==0&&await Te(l,u,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var We=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(b`${x.yellow(e)}`.value)}async success(e){await this.log(b`${x.green(e)}`.value)}async debug(e){g(e,this.stdout)}async error(e,r){let o=x.errorText("\u274C Error"),n=x.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===oe.Deleted?[]:(await c.extension.getDevSessionUpdateMessages(o))?.map(l=>({message:l,prefix:c.extension.handle}))??[]))).flat(),i=a.map((c,f)=>{let l=b`${x.gray(f===a.length-1?"\u2514 ":"\u2502 ")}${c.message}`.value;return this.log(l,c.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=x.errorText("\u274C Error");await this.log(b`${r}`.value,"app-preview");let o=e.map(n=>{let s=x.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 He=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 Ge=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 We(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new He(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=oo(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${nt(n)}ms - Total: ${nt(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&&!Qt()&&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=se(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 Tt)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 so(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await St(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=U(fe(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...ao];r&&n.push("manifest.json"),await io(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await co(s,o),s}async getSignedURLWithRetry(){return lo(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=se(this.options.url),i=this.currentSessionState?.userId;if(s.websocketUrl!==a||s.user?.id!==i){let c=s.user?.email;await this.logger.error(`Another developer ${c?`(${c}) `:""}has taken ownership of this dev preview.`);let f=`Another user${c?` (${c})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,l=["You can restart by running",{command:"shopify app dev"},"again."];throw new A(f,l)}this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}}return n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"created"}}async logWarnings(e){await Promise.all(e.map(r=>{let o=r.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${r.message}`:r.message;return this.logger.warning(o)}))}};async function sn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:As,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var As=async({stdout:t},e)=>{await Ge.start(e,t)};p();p();p();var an=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=Ut().substring(0,6),i=`${Ts(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,c=ko({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),f=U(n,i);try{return await ge(n),await he(f,c),{fullOutputPath:f,identifier:s}}catch(l){throw r.write(`Error while writing log to file: ${l}
|
|
8
|
+
`),l}};function Ts(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 Be=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:f=0})=>{if(!i?.aborted)try{let l=e,u=xo,h=f,y=await o.appLogs({jwtToken:e,cursor:r},a),{errors:d,status:m}=y;if(m===200){h=0;let{app_logs:E}=y;for(let S of E){let P=JSON.parse(S.payload);await F({outputPrefix:S.source,stripAnsi:!1},async()=>{S.log_type===So?(_s(S,P,t),P=new vo(Po(P))):S.log_type.startsWith(Uo)?Cs(S,P,t):t.write(JSON.stringify(P));let C=await an({appLog:S,appLogPayload:P,stdout:t,storeName:s,logsDir:c});t.write(b`${x.gray("\u2514 ")}${x.link("Open log file",`file://${C.fullOutputPath}`,`Log: ${C.fullOutputPath}`)} ${x.gray(`(${C.identifier})`)}\n`.value)})}}else{let E={errors:d.map(P=>({message:P,status:m}))},S=await Io({response:E,onThrottle:P=>{_("Request throttled while polling app logs.",t),_(`Retrying in ${P/1e3} seconds.`,t)},onUnknownError:P=>{_("Error while polling app logs.",t),_(`Retrying in ${P/1e3} seconds.`,t)},onResubscribe:()=>n()});if(S.resubscribeResult==="failed"){if(h+=1,h>=Eo){_("App log streaming session has expired. Please restart your dev session.",t);return}}else S.resubscribeResult==="succeeded"&&(h=0);S.nextJwtToken&&(l=S.nextJwtToken),u=S.retryIntervalMs}let{cursor:R}=y;setTimeout(()=>{Be({stdout:t,appLogsFetchInput:{jwtToken:l,cursor:R??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){_("Error while polling app logs.",t),_(`Retrying in ${at/1e3} seconds.`,t),g(`${l}}
|
|
10
|
+
`),setTimeout(()=>{Be({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
|
+
`)})},at)}};function _s(t,e,r){let o=(e.fuel_consumed/bo).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`${x.gray("\u2502 ")}${s}`.value).join(`
|
|
13
|
+
`))}function Cs(t,e,r){t.log_type===Ro?r.write("Function network access response retrieved from cache."):t.log_type===Ao?e.reason===_o?r.write("Function network access request executing in background because there is no cached response."):e.reason===Co&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===To&&(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 Is(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function cn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:ks,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var ks=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:c})=>{async function f(l){let u=await it(o,n,a,t),h=c.getLogsDir();await ge(h),await Be({stdout:t,appLogsFetchInput:{jwtToken:u},resubscribeCallback:()=>it(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:l,logsDir:h})}try{let l=!1,u,h=async y=>{let d=Is(y.app);if(d&&!l){g("Function extensions detected, starting logs polling"),l=!0,u=new AbortController;try{await f(u.signal)}catch(m){g(`Failed to start function logs: ${m}`,e)}}else!d&&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 ln(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:Ls}}var Ls=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 $s}from"events";var Ms={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},Ke=class extends $s{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};$t(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e){this.updateStatus({statusMessage:Ms[e]})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};p();import*as pn from"http";import*as un from"https";function dn(t){return"errors"in t&&Array.isArray(t.errors)}async function fn(t,e,r,o){let s=(await import("./http-proxy-node16-D3JUYA5D.js")).default.createProxyServer(),a=Ds(t,s,o),i=r?un.createServer(r,a):pn.createServer(a);return i.on("upgrade",Fs(t,s,o)),e.addEventListener("abort",()=>{g("Closing reverse HTTP proxy"),i.close()}),{server:i}}function Fs(t,e,r){return function(o,n,s){let a=mn(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let f=(dn(i)?i.errors[i.errors.length-1]:void 0)??i;_(`Error forwarding websocket request: ${f.message}`,r),_(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function Ds(t,e,r){return function(o,n){let s=mn(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=(dn(a)?a.errors[a.errors.length-1]:void 0)??a;_(`Error forwarding web request: ${c.message}`,r),_(`\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
|
+
${x.json(JSON.stringify(t))}
|
|
17
|
+
`),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function mn(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 hn({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:c,graphiqlKey:f,apiSecret:l}){let u=o.apiKey,h=ve(),y=!de(h[te.disableGraphiQLExplorer]),d=await Vr(t),m=l??(d.webs.length>0?await Le(o):void 0),R=y&&m!==void 0,E=new no(d,i.proxyUrl),S=await Pe(),P=uo(n,u,S),C=P,G=m===void 0?void 0:ar(f,m,n),B=R&&G?`http://localhost:${c}/graphiql?key=${encodeURIComponent(G)}`:void 0,W=d.configuration.embedded,K=d.nonConfigExtensions.length>0,v=new Ke({isReady:!1,previewURL:C,graphiqlURL:B,appEmbedded:W,hasExtensions:K}),J=[...m===void 0?[]:await nn({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:u,apiSecret:m,scopes:Fr(d.configuration)}),R&&m!==void 0?await rn({appName:o.title,appUrl:P,port:c,apiKey:u,apiSecret:m,key:G,storeFqdn:n}):void 0,await Zo({allExtensions:d.realExtensions,storeFqdn:n,storeId:s,apiKey:u,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:E}),await sn({app:d,apiKey:u,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:E,appPreviewURL:P,devSessionStatusManager:v,unsafeValidation:a.unsafeValidation}),await Mo({remoteApp:o,localApp:d,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),m===void 0?void 0:tn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:m,remoteAppUpdated:e}),await cn({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:u},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:E}),await ln({appWatcher:E})].filter(Os);return{processes:await Ns(J,i.proxyPort,i.reverseProxyCert),previewUrl:C,graphiqlUrl:B,devSessionStatusManager:v}}var Os=t=>t!==void 0&&t!==!1;async function Ns(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(q.Frontend)){let c=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${c}`;let f=a.options.hmrServerOptions;f&&(i.websocket=`http://localhost:${f.port}`,f.httpPaths.forEach(l=>i[l]=`http://localhost:${f.port}`)),a.options.port=c}else if(a.type==="previewable-extension"){let c=await M();i[a.options.pathPrefix]=`http://localhost:${c}`,a.options.port=c}return{process:a,rules:i}})),n=o.map(({process:a})=>a),s=o.map(({rules:a})=>a).reduce((a,i)=>({...a,...i}),{});return Object.keys(s).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:qs,options:{port:e,rules:s,localhostCert:r}}),n}var qs=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await fn(o,t,n,e);j(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();async function gn({remoteApp:t,hasWebs:e,graphiqlEnabled:r}){if(e)return Le(t);if(!r)return;let o=await Yr(t);return o||_(`GraphiQL isn't available because the App Management API didn't return the app's client secret for your credentials. ${Qr()}`),o}p();p();p();var ae=X(Ee(),1);var wn=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function yn(){let[t,e]=(0,ae.useState)(0);return(0,ae.useEffect)(()=>{let r=setInterval(()=>{e(o=>(o+1)%wn.length)},70);return()=>clearInterval(r)},[]),ae.default.createElement($,null,wn[t])}p();var T=X(Ee(),1);var vn=.9,Pn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Ot(),{isRawModeSupported:o}=be(),[n,s]=(0,T.useState)(e),[a,i]=(0,T.useState)(Math.floor(r.columns*vn)),[c,f]=(0,T.useState)(!0),l=(0,T.useRef)(null);if(!n)throw new Error("No tabs provided");Se((d,m)=>{(async()=>{if(m?.leftArrow||m?.rightArrow||m?.tab){let P=Object.entries(t).filter(([K,v])=>v.content),C=P.findIndex(([K])=>K===n);if(C===-1)return;let G=m?.leftArrow?-1:1,B=(C+G+P.length)%P.length,W=P[B];W&&s(W[0])}let E=t[d];if(E){E.action?await E.action():s(d);return}let S=t[n];if(S?.shortcuts){let P=S.shortcuts.find(C=>C.key===d);P&&(!P.condition||P.condition())&&await P.action()}})()},{isActive:!!o}),(0,T.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*vn)),!l.current)return;let m=Nt(l.current);f(m.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let u=Object.entries(t).map(([d,m])=>({...m,inputKey:d,header:` (${d}) ${m.label} `})),h=u.filter(d=>!d.action),y=u.filter(d=>d.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(d=>T.default.createElement(T.default.Fragment,{key:d.inputKey},T.default.createElement($,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),c&&T.default.createElement(k,{flexGrow:1,justifyContent:"flex-end"},y.map((d,m)=>T.default.createElement($,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,m<y.length-1&&" \u2502 ")))),T.default.createElement(k,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var w=X(Ee(),1);var xn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:c,onAbort:f})=>{let{isRawModeSupported:l}=be(),[u,h]=(0,w.useState)(void 0),[y,d]=(0,w.useState)(void 0),[m,R]=(0,w.useState)(r.status),[E,S]=(0,w.useState)(!1),{isAborted:P}=Kt(t.signal,async v=>{v&&d(typeof v=="string"?v:v.message),r.status.isReady?S(!0):(h("Shutting down dev ..."),await f()),Lo()}),C=(0,w.useMemo)(()=>e.map(v=>({...v,action:async(J,wt,kn)=>{try{return await v.action(J,wt,kn)}catch(Ln){t.abort(Ln)}}})),[e,t]);(0,w.useEffect)(()=>(r.on("dev-session-update",R),()=>{r.off("dev-session-update",R)}),[]),Se((v,J)=>{Wt(v,J,()=>t.abort())},{isActive:!!l});let G=v=>{switch(v){case"loading":return w.default.createElement(yn,null);case"success":return"\u2705";case"error":return"\u274C"}},B=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:m.previewURL,condition:()=>!!(m.isReady&&m.previewURL),action:async()=>{await V.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),m.previewURL&&await Ae(m.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:st(o),condition:()=>!!(m.isReady&&m.appEmbedded===!1&&m.hasExtensions),action:async()=>{await V.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Ae(st(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:m.graphiqlURL,condition:()=>!!(m.isReady&&m.graphiqlURL),action:async()=>{await V.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),m.graphiqlURL&&await Ae(m.graphiqlURL)}}],W=B.filter(v=>v.condition?.()??!0),K={d:{label:"Dev status",shortcuts:B,content:w.default.createElement(w.default.Fragment,null,m.statusMessage&&w.default.createElement($,null,G(m.statusMessage.type)," ",m.statusMessage.message),l&&W.length>0&&w.default.createElement(k,{marginTop:1,flexDirection:"column"},W.map(v=>w.default.createElement($,{key:v.key},Ht.pointerSmall," ",w.default.createElement($,{bold:!0},"(",v.key,")")," ",Je()&&v.url?w.default.createElement(Ye,{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,m.isReady&&!(l&&Je())&&w.default.createElement(w.default.Fragment,null,W.filter(v=>v.url).map(v=>w.default.createElement($,{key:v.key},v.linkLabel," URL: ",w.default.createElement(Ye,{url:v.url})))))))},a:{label:"App info",content:w.default.createElement(k,{flexDirection:"column"},w.default.createElement(Qe,{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(Qe,{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(Gt,{processes:C,prefixColumnSize:Or,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&w.default.createElement(k,{marginTop:1,flexDirection:"column"},w.default.createElement(Bt,{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"}})),P?null:w.default.createElement(k,{paddingTop:1,flexDirection:"column",flexGrow:1},l?w.default.createElement(Pn,{tabs:K,initialActiveTab:"d"}):w.default.createElement(k,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},K.d?.content)),y?w.default.createElement(k,{marginTop:1,flexDirection:"column"},w.default.createElement($,{color:"red"},y)):null)};var En=X(Ee(),1);async function bn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:c,organizationName:f,configPath:l,localURL:u}){if(Vt())return qt(En.default.createElement(xn,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:c,organizationName:f,configPath:l,localURL:u,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await Ws({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o})}async function Ws({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 Sn(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];ie({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=Ve(e.map(n=>n.for)).join(" "),o=Ve(e.map(n=>({command:n.flagToRemedy})));ie({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 Un(t,e){return e?e.includes("localhost")?"localhost":(await It(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var Rn=X(Mn(),1);var Q="v1.4.4",An="FiloSottile/mkcert",ht=x.genericShellCommand("mkcert");async function Hs(t,e,r,o){let n=e[te.mkcertBinaryPath];if(n)return n;let a=U(t,r==="win32"?"mkcert.exe":"mkcert");if(await D(a))return a;let i=await(0,Rn.default)("mkcert",{nothrow:!0});return i?(g(b`Found ${ht} at ${x.path(i)}`),i):(await Gs(a,r,o),a)}async function Gs(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${Q}-darwin-arm64`:`mkcert-${Q}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${Q}-linux-arm64`:`mkcert-${Q}-linux-amd64`;break;case"win32":o=`mkcert-${Q}-windows-amd64.exe`;break;default:throw new ee(`Unsupported platform: ${e}`)}await wr(An,Q,o,t),g(b`${ht} saved to ${x.path(t)}`)}async function Bs(t){let e=U(t,"mkcert-LICENSE");if(await D(e))return;let r=`https://raw.githubusercontent.com/${An}/refs/tags/${Q}/LICENSE`,o={headline:"Failed to download mkcert license.",body:["We tried to download the license for mkcert, but the request failed. You can ",{link:{url:r,label:"view the license here"}}]},n;try{if(n=await Ct(r),!n.ok)return o}catch{return o}let s=await n.text();await he(e,s)}async function Tn({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=U(".shopify","localhost-key.pem"),a=U(".shopify","localhost.pem"),i=U(t,s),c=U(t,a);if(await D(i)&&await D(c))return{keyContent:await L(i),certContent:await L(c),certPath:a};if(!(e??await zr()))throw new A(`Localhost certificate and key are required at ${a} and ${s}`);let l="",u;return await Re([{title:"Finding or downloading mkcert binary",task:async()=>{let y=U(t,".shopify");l=await Hs(y,r,o,n),u=await Bs(y),g(b`${ht} found at: ${x.path(l)}`)}}]),u&&Ue(u),j(b`Generating self-signed certificate for localhost. You may be prompted for your password.`),await Te(l,["-install","-key-file",i,"-cert-file",c,"localhost"]),j(b`${x.successIcon()} Certificate generated at ${a}\n`),await zt()&&(ie({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"}}),j("\u{1F449} Press any key to continue"),await jt(),j("")),{keyContent:await L(i),certContent:await L(c),certPath:yt(t,c)}}p();function _n(){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 Cn(t){let e=await Ks(t);await js(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:s}=await hn(e);await zs(e),await Js({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:s})}async function Ks(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:s,tunnel:a}=t,i;if(a.mode==="auto"){let S=await M();i=await Kr(t.commandConfig,S,"cloudflare")}let c=await Xr(r,o,s,r.flags);r.configuration=c;let f=await gn({remoteApp:r,hasWebs:e.webs.length>0,graphiqlEnabled:!de(ve()[te.disableGraphiQLExplorer])});Zr({app:e,remoteApp:r,selectedStore:n,cachedInfo:ot(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 Jt.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Mr(t.project);let l=t.graphiqlPort??await M(le.graphiql),u=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??le.graphiql,actual:l}];a.mode==="use-localhost"&&u.push({for:"localhost",flagToRemedy:"--localhost-port",requested:a.requestedPort,actual:a.actualPort}),Sn(u);let{webs:h,...y}=await Qs(e.directory,e.webs,l,a,i,r.configuration,t.installMkcert);e.webs=h;let d=e.configuration.build?.automatically_update_urls_on_dev,m=ot(t.directory)?.previousAppId,R=r.apiKey,E=await Ys(h,t.update,y,e,d,r,R);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==m,localApp:e,developerPlatformClient:o,commandOptions:t,network:y,partnerUrlsUpdated:E,graphiqlPort:l,graphiqlKey:t.graphiqlKey,apiSecret:f}}async function js(t){await Vs(t)}async function Vs(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||_n()}async function zs(t){qr({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await Xs({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Mt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Ys(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=Y(t),f=!1;if((c??i)&&e){let l=Hr(r.proxyUrl,t.map(({configuration:u})=>u.auth_callback_path).find(u=>u),o.configuration.app_proxy);f=await Br({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:l}),f&&o.setDevApplicationURLs(l)}return f}async function Qs(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=Y(e);await Zs(e,r);let f=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:l,frontendPort:u,usingLocalhost:h},y,d]=await Promise.all([Wr(f),Rt()??i?.configuration.port??M(),Gr(s)]),m=h?`${l}:${u}`:l,R=c?.configuration.port;c&&(R??=c===i?y:await M(),c.configuration.port=R),R=R??await M();let E;if(o.mode==="use-localhost"){let{keyContent:S,certContent:P,certPath:C}=await Tn({appDirectory:t,forceInstall:a});E={key:S,cert:P,certPath:C,port:o.actualPort}}return{proxyUrl:m,proxyPort:u,frontendPort:R,backendPort:y,currentUrls:d,webs:e,reverseProxyCert:E}}async function Js({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let s=new At,a=t.map(f=>({prefix:f.prefix,action:async(u,h,y)=>{let d=f.function;return d({stdout:u,stderr:h,abortSignal:y},f.options)}})),i=o.developerPlatformClient,c={id:o.remoteApp.id,developerPlatformClient:i};return bn({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 Xs(t){let e=await Un(t.devOptions.commandConfig,t.tunnelUrl);await V.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?ze(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:ze(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await V.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function Zs(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);if(o)throw new A(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await Xe(n))throw new A(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await Xe(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 In({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??le.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=X($n(),1);var gt=class t extends to{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={...Xt,...$r,"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=>xe(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":_e({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":_e({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":_e({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 In({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Ft(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await jr(e.path);let o=await eo({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),n=await ro({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 Cn(s),{app:o.app}}};export{Fa as a,gt as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n}from"./chunk-
|
|
1
|
+
import{b as n}from"./chunk-FSWOB535.js";import{y as t}from"./chunk-J6XOTLT5.js";import{k as r}from"./chunk-JTEP5MP2.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var e=class extends n{static description="Run CLI doctor-release tests";static hidden=!0;async run(){r()&&t({headline:"Shopify CLI Doctor Release.",body:["Available doctor-release commands:",""," shopify doctor-release theme -e <environment> Run all theme command tests","","The -e/--environment flag is required to specify the store configuration.","Use --help with any command for more options."]})}};export{e as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as ne}from"./chunk-7556AIVG.js";import{d as ie}from"./chunk-NU5WLZ6Y.js";import{a as se,b as q}from"./chunk-4ZNBEMRT.js";import{B as C,K as L,pa as V,ra as U,sa as X,u as w}from"./chunk-3V4VL3SD.js";import{e as x}from"./chunk-QTLGMJDW.js";import{A as N,B as I,E as re,a as Q,x as te}from"./chunk-47IQIIFX.js";import{b as K}from"./chunk-HILYTMVA.js";import{d as Z,e as ee}from"./chunk-DSS4ECIH.js";import{i as F,l as oe}from"./chunk-Q37WAD6F.js";import{Cb as R,Eb as l,Ja as W,Nb as h,Ya as _}from"./chunk-UWI76E2L.js";import{b as Ie}from"./chunk-I3J63RFV.js";import{c as Y,e as k,h as J,p as $}from"./chunk-6IDEDOXW.js";import{e as Te,g as f}from"./chunk-VKWPEFWQ.js";f();var T=Te(Ie(),1);var O={path:T.Flags.string({description:"The path where you want to run the command. Defaults to the current working directory.",env:"SHOPIFY_FLAG_PATH",parse:async t=>{let e=k(t);return _(e)?W(e)?e:(I({headline:"The path must be a directory, not a file.",body:[`The provided path is not a directory: ${e}`,`Did you mean: ${J(e)}`]}),process.exit(1)):(I({headline:"A path was explicitly provided but doesn't exist.",body:[`Please check the path and try again: ${e}`]}),process.exit(1))},default:async()=>$(),noCacheDefault:!0}),password:T.Flags.string({description:"Password generated from the Theme Access app or an Admin API token.",env:"SHOPIFY_CLI_THEME_TOKEN"}),store:T.Flags.string({char:"s",description:"Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).",env:"SHOPIFY_FLAG_STORE",parse:async t=>w(t)}),environment:T.Flags.string({char:"e",description:"The environment to apply to the current command.",env:"SHOPIFY_FLAG_ENVIRONMENT",multiple:!0})},ae="Wrap the value in double quotes if you're using wildcards.",qe=t=>({only:T.Flags.string({char:"o",multiple:!0,description:`${t.charAt(0).toUpperCase()+t.slice(1)} only the specified files (Multiple flags allowed). ${ae}`,env:"SHOPIFY_FLAG_ONLY"}),ignore:T.Flags.string({char:"x",multiple:!0,description:`Skip ${t}ing the specified files (Multiple flags allowed). ${ae}`,env:"SHOPIFY_FLAG_IGNORE"})});f();f();import{AsyncLocalStorage as _e}from"node:async_hooks";var pe=new _e,ce,ue,me,de;function S(){return ce??=new x({projectName:"shopify-cli-theme-conf"}),ce}function j(){return ue??=new x({projectName:"shopify-cli-development-theme-config"}),ue}function D(){return me??=new x({projectName:"shopify-cli-repl-theme-config"}),me}function M(){return de??=new x({projectName:"shopify-cli-theme-store-password"}),de}function B(t=S()){return pe.getStore()?.store??t.get("themeStore")}function fe(t,e=S()){e.set("themeStore",t)}function He(t=S()){return h(l`Getting development theme...`),j().get(v(t))}function ze(t,e=S()){h(l`Setting development theme...`),j().set(v(e),t)}function Ye(t=S()){h(l`Removing development theme...`),j().delete(v(t))}function Je(t=S()){return h(l`Getting REPL theme...`),D().get(v(t))}function We(t,e=S()){h(l`Setting REPL theme to ${t}...`),D().set(v(e),t)}function Ke(t=S()){h(l`Removing REPL theme...`),D().delete(v(t))}function Qe(t=S()){let e=v(t);return h(l`Getting storefront password for shop ${e}...`),M().get(e)}function Ve(t,e=S()){let o=v(e);h(l`Setting storefront password for shop ${o}...`),M().set(o,t)}function Xe(t=S()){let e=v(t);h(l`Removing storefront password for ${e}...`),M().delete(e)}function v(t=S()){let e=B(t);if(!e)throw new oe("Theme store is not set. This indicates an unexpected issue with the CLI. Please report this to the Shopify CLI team.",["It may be possible to recover by running",{command:"shopify theme list --store <store>"},"(setting the store flag to the store you wish to use) and then running the command again."]);return e}async function he(t,e){return pe.run({store:t},e)}function le(t){let e=t.store??B();if(!e)throw V(new F("A store is required",`Specify the store passing ${l`${R.genericShellCommand(`--${O.store.name}=example.myshopify.com`)}`.value} or set the ${l`${R.genericShellCommand(O.store.env)}`.value} environment variable.`));return fe(e),e}f();f();var Se="shopify.theme.toml",ct=new Intl.DateTimeFormat(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),ut=["**/.git","**/.vscode","**/.hg","**/.bzr","**/.svn","**/_darcs","**/CVS","**/*.sublime-(project|workspace)","**/.DS_Store","**/.sass-cache","**/Thumbs.db","**/desktop.ini","**/config.yml","**/node_modules/",".prettierrc.json","**/{blocks,layout,snippets}/**/*.liquid.tmp.*","**/{config,locales}/**/*.json.tmp.*","**/{sections,templates}/**/*.{liquid,json}.tmp.*"],mt=50;f();f();var G="7e9cb568cfd431c538f36d1ad3f2b4f6";var Fe="shopify-cli-store",be=240*1e3,ge;function P(){return ge??=new x({projectName:Fe}),ge}function b(t){return`${G}::${Ee(t)}`}function Ee(t){return t.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function d(t){return typeof t=="string"}function ke(t){if(!t||typeof t!="object")return;let e=t;if(typeof e.id=="number")return{id:e.id,...d(e.email)?{email:e.email}:{},...d(e.firstName)?{firstName:e.firstName}:{},...d(e.lastName)?{lastName:e.lastName}:{},...typeof e.accountOwner=="boolean"?{accountOwner:e.accountOwner}:{}}}function $e(t){if(!t||typeof t!="object")return;let e=t;if(!(!d(e.shopId)||!d(e.name)||!d(e.createdAt)))return{shopId:e.shopId,name:e.name,createdAt:e.createdAt,...d(e.placeholderAccountUuid)?{placeholderAccountUuid:e.placeholderAccountUuid}:{},...d(e.country)?{country:e.country}:{},...d(e.accessUrl)?{accessUrl:e.accessUrl}:{}}}function Pe(t){if(!t||typeof t!="object")return;let e=t;if(!d(e.store)||!d(e.clientId)||!d(e.userId)||!d(e.accessToken)||!Array.isArray(e.scopes)||!e.scopes.every(d)||!d(e.acquiredAt))return;let o=ke(e.associatedUser),r=e.kind==="preview"?"preview":"standard",n=r==="preview"?$e(e.preview):void 0;if(!(r==="preview"&&!n))return{store:e.store,clientId:e.clientId,userId:e.userId,accessToken:e.accessToken,scopes:e.scopes,acquiredAt:e.acquiredAt,...d(e.refreshToken)?{refreshToken:e.refreshToken}:{},...d(e.expiresAt)?{expiresAt:e.expiresAt}:{},...d(e.refreshTokenExpiresAt)?{refreshTokenExpiresAt:e.refreshTokenExpiresAt}:{},...o?{associatedUser:o}:{},...r==="preview"?{kind:r}:{},...n?{preview:n}:{}}}function ye(t,e,o){if(!e||typeof e!="object")return;let{sessionsByUserId:r,currentUserId:n}=e;if(!(r!==void 0||n!==void 0))return;let s=b(t);if(!r||typeof r!="object"||Array.isArray(r)||typeof n!="string"){o.delete(s);return}let a=Object.fromEntries(Object.entries(r).flatMap(([u,c])=>{let p=Pe(c);return p?[[u,p]]:[]}));if(Object.keys(a).length!==Object.keys(r).length)if(a[n])o.set(s,{currentUserId:n,sessionsByUserId:a});else{o.delete(s);return}return{currentUserId:n,sessionsByUserId:a}}function H(t,e){return ye(t,e.get(b(t)),e)}function Ce(t){return t.config?.store??{}}function we(t=P()){let e=[],o=`${G}::`;for(let[r,n]of Object.entries(Ce(t))){if(!r.startsWith(o))continue;let i=ye(r.slice(o.length),n,t),s=i?.sessionsByUserId[i.currentUserId];s&&e.push(s)}return e}function Ae(t,e=P()){let o=w(t),r=H(o,e);if(!r)return;let n=r.sessionsByUserId[r.currentUserId];if(!n){e.delete(b(o));return}return n}function wt(t,e=P()){let o=b(t.store),r=H(t.store,e),n={currentUserId:t.userId,sessionsByUserId:{...r?.sessionsByUserId??{},[t.userId]:t}};e.set(o,n)}function At(t,e,o){let r=w(t),n=typeof e=="string"?e:void 0,i=(typeof e=="string"?o:e)??P(),s=b(r);if(!n){i.delete(s);return}let a=H(r,i);if(!a)return;let{[n]:u,...c}=a.sessionsByUserId,p=Object.keys(c);if(p.length===0){i.delete(s);return}i.set(s,{currentUserId:a.currentUserId===n?p[0]:a.currentUserId,sessionsByUserId:c})}function ve(t){if(!t.expiresAt)return!1;let e=new Date(t.expiresAt).getTime();return Number.isNaN(e)?!0:e-be<Date.now()}var z=class extends q{static baseFlags={...q.baseFlags,...ie};environmentsFilename(){return Se}async command(e,o,r=!1,n,i){}async run(e){let o=this.constructor,r=o.multiEnvironmentsFlags,{args:n,flags:i}=await this.parse(o),s="password"in o.flags,a=(Array.isArray(i.environment)?i.environment:[i.environment]).filter(Boolean),u=r!==null&&r.some(m=>Array.isArray(m)?m.includes("store"):m==="store");if(a.length<=1){if(a[0]&&!i.store&&u)throw new F("Please provide a valid environment.");let m=s?await this.createSession(i):void 0,A=this.constructor.name.toLowerCase();if(U(`theme-command:${A}:single-env:authenticated`),i.path&&!_(i.path))throw new F(`Path does not exist: ${i.path}`);try{await this.command(i,m,!1,n)}finally{await this.logAnalyticsData(m)}return}if(r===null){N({body:"This command does not support multiple environments."});return}let{flags:c}=await this.parse(se(o),this.argv);if("path"in c){this.errorOnGlobalPath();return}let p=await this.loadEnvironments(a,i,c),g=await this.validateEnvironments(p,r,s);"force"in o.flags&&!i.force&&!await this.showConfirmation(this.constructor.name,r,g)||await this.runConcurrent(g.valid)}storeAuthScopes(){}async loadEnvironments(e,o,r){let n=new Map;for(let i of e){let s=await ne(i,"shopify.theme.toml",{from:o.path,silent:!0});s?.store&&typeof s.store=="string"&&(s.store=w(s.store)),s?.path&&typeof s.path=="string"&&(s.path=k(s.path)),n.set(i,{flags:{...o,...s,...r,environment:[i]},validationFlags:{...s,...r}})}return n}async validateEnvironments(e,o,r){let n=[],i=[],s=r?this.storeAuthSessionsForTheme(Array.from(e.values()).map(({validationFlags:u})=>u)):new Map,a=Array.from(e.entries()).map(([u,{flags:c,validationFlags:p}])=>({environmentName:u,flags:c,validationFlags:p,storeAuthSession:this.storeAuthSessionFromCache(p,s)}));for(let{environmentName:u,flags:c,validationFlags:p,storeAuthSession:g}of a){let y=this.validConfig(p,o,u,g);if(y!==!0){let m=y.join(", ");i.push({environment:u,reason:`Missing flags: ${m}`});continue}n.push({environment:u,flags:c,requiresAuth:r,storeAuthSession:g})}return{valid:n,invalid:i}}async showConfirmation(e,o,r){let s={message:[`Run ${e.toLowerCase()} in the following environments?`],confirmationMessage:"Yes, proceed",cancellationMessage:"Cancel"},a=[...r.valid.map(({environment:u,flags:c})=>{let p=o.map(g=>{let y=Array.isArray(g)?g.find(m=>c[m]):g;if(y==="password")return"password";if(y==="path"&&typeof c.path=="string"){let m=c.path.split(/[/\\]/);if(m.length===1)return`path: ${c.path}`;let A=m[0]===""?`/${m[1]}`:m[0],E=m.at(-1);return`path: ${A}/.../${E}`}return y&&`${y}: ${c[y]}`}).join(", ");return[u,{subdued:p||"No flags required"}]}),...r.invalid.map(({environment:u,reason:c})=>[u,{error:`Skipping | ${c}`}])];return s.infoTable={Environment:a},r.invalid.length>0&&(s.confirmationMessage="Proceed anyway (will skip invalid environments)"),re(s)}async runConcurrent(e){let o=new Q,r=e.map(s=>s.flags.store),n=new Set(r),i=r.length===n.size?[e]:this.createSequentialGroups(e);for(let s of i)await te({processes:s.map(({environment:a,flags:u,requiresAuth:c,storeAuthSession:p})=>({prefix:a,action:async(g,y,m)=>{try{let A=u.store;await he(A,async()=>{let E=c?await this.createSession(u,p):void 0,xe=this.constructor.name.toLowerCase();U(`theme-command:${xe}:multi-env:authenticated`);try{await this.command(u,E,!0,{},{stdout:g,stderr:y})}finally{await this.logAnalyticsData(E)}})}catch(A){A instanceof Error&&(A.message=`Environment ${a} failed:
|
|
1
|
+
import{a as ne}from"./chunk-T2RE2K3N.js";import{d as ie}from"./chunk-DWMRVMKX.js";import{a as se,b as q}from"./chunk-FSWOB535.js";import{B as C,K as L,pa as V,ra as U,sa as X,u as w}from"./chunk-2TCPTRLF.js";import{e as x}from"./chunk-KW5SQ6PG.js";import{A as N,B as I,E as re,a as Q,x as te}from"./chunk-J6XOTLT5.js";import{b as K}from"./chunk-HILYTMVA.js";import{d as Z,e as ee}from"./chunk-6MELTJU3.js";import{i as F,l as oe}from"./chunk-QF453PH7.js";import{Cb as R,Eb as l,Ja as W,Nb as h,Ya as _}from"./chunk-QY73XOBU.js";import{b as Ie}from"./chunk-I3J63RFV.js";import{c as Y,e as k,h as J,p as $}from"./chunk-6IDEDOXW.js";import{e as Te,g as f}from"./chunk-VKWPEFWQ.js";f();var T=Te(Ie(),1);var O={path:T.Flags.string({description:"The path where you want to run the command. Defaults to the current working directory.",env:"SHOPIFY_FLAG_PATH",parse:async t=>{let e=k(t);return _(e)?W(e)?e:(I({headline:"The path must be a directory, not a file.",body:[`The provided path is not a directory: ${e}`,`Did you mean: ${J(e)}`]}),process.exit(1)):(I({headline:"A path was explicitly provided but doesn't exist.",body:[`Please check the path and try again: ${e}`]}),process.exit(1))},default:async()=>$(),noCacheDefault:!0}),password:T.Flags.string({description:"Password generated from the Theme Access app or an Admin API token.",env:"SHOPIFY_CLI_THEME_TOKEN"}),store:T.Flags.string({char:"s",description:"Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).",env:"SHOPIFY_FLAG_STORE",parse:async t=>w(t)}),environment:T.Flags.string({char:"e",description:"The environment to apply to the current command.",env:"SHOPIFY_FLAG_ENVIRONMENT",multiple:!0})},ae="Wrap the value in double quotes if you're using wildcards.",qe=t=>({only:T.Flags.string({char:"o",multiple:!0,description:`${t.charAt(0).toUpperCase()+t.slice(1)} only the specified files (Multiple flags allowed). ${ae}`,env:"SHOPIFY_FLAG_ONLY"}),ignore:T.Flags.string({char:"x",multiple:!0,description:`Skip ${t}ing the specified files (Multiple flags allowed). ${ae}`,env:"SHOPIFY_FLAG_IGNORE"})});f();f();import{AsyncLocalStorage as _e}from"node:async_hooks";var pe=new _e,ce,ue,me,de;function S(){return ce??=new x({projectName:"shopify-cli-theme-conf"}),ce}function j(){return ue??=new x({projectName:"shopify-cli-development-theme-config"}),ue}function D(){return me??=new x({projectName:"shopify-cli-repl-theme-config"}),me}function M(){return de??=new x({projectName:"shopify-cli-theme-store-password"}),de}function B(t=S()){return pe.getStore()?.store??t.get("themeStore")}function fe(t,e=S()){e.set("themeStore",t)}function He(t=S()){return h(l`Getting development theme...`),j().get(v(t))}function ze(t,e=S()){h(l`Setting development theme...`),j().set(v(e),t)}function Ye(t=S()){h(l`Removing development theme...`),j().delete(v(t))}function Je(t=S()){return h(l`Getting REPL theme...`),D().get(v(t))}function We(t,e=S()){h(l`Setting REPL theme to ${t}...`),D().set(v(e),t)}function Ke(t=S()){h(l`Removing REPL theme...`),D().delete(v(t))}function Qe(t=S()){let e=v(t);return h(l`Getting storefront password for shop ${e}...`),M().get(e)}function Ve(t,e=S()){let o=v(e);h(l`Setting storefront password for shop ${o}...`),M().set(o,t)}function Xe(t=S()){let e=v(t);h(l`Removing storefront password for ${e}...`),M().delete(e)}function v(t=S()){let e=B(t);if(!e)throw new oe("Theme store is not set. This indicates an unexpected issue with the CLI. Please report this to the Shopify CLI team.",["It may be possible to recover by running",{command:"shopify theme list --store <store>"},"(setting the store flag to the store you wish to use) and then running the command again."]);return e}async function he(t,e){return pe.run({store:t},e)}function le(t){let e=t.store??B();if(!e)throw V(new F("A store is required",`Specify the store passing ${l`${R.genericShellCommand(`--${O.store.name}=example.myshopify.com`)}`.value} or set the ${l`${R.genericShellCommand(O.store.env)}`.value} environment variable.`));return fe(e),e}f();f();var Se="shopify.theme.toml",ct=new Intl.DateTimeFormat(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),ut=["**/.git","**/.vscode","**/.hg","**/.bzr","**/.svn","**/_darcs","**/CVS","**/*.sublime-(project|workspace)","**/.DS_Store","**/.sass-cache","**/Thumbs.db","**/desktop.ini","**/config.yml","**/node_modules/",".prettierrc.json","**/{blocks,layout,snippets}/**/*.liquid.tmp.*","**/{config,locales}/**/*.json.tmp.*","**/{sections,templates}/**/*.{liquid,json}.tmp.*"],mt=50;f();f();var G="7e9cb568cfd431c538f36d1ad3f2b4f6";var Fe="shopify-cli-store",be=240*1e3,ge;function P(){return ge??=new x({projectName:Fe}),ge}function b(t){return`${G}::${Ee(t)}`}function Ee(t){return t.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function d(t){return typeof t=="string"}function ke(t){if(!t||typeof t!="object")return;let e=t;if(typeof e.id=="number")return{id:e.id,...d(e.email)?{email:e.email}:{},...d(e.firstName)?{firstName:e.firstName}:{},...d(e.lastName)?{lastName:e.lastName}:{},...typeof e.accountOwner=="boolean"?{accountOwner:e.accountOwner}:{}}}function $e(t){if(!t||typeof t!="object")return;let e=t;if(!(!d(e.shopId)||!d(e.name)||!d(e.createdAt)))return{shopId:e.shopId,name:e.name,createdAt:e.createdAt,...d(e.placeholderAccountUuid)?{placeholderAccountUuid:e.placeholderAccountUuid}:{},...d(e.country)?{country:e.country}:{},...d(e.accessUrl)?{accessUrl:e.accessUrl}:{}}}function Pe(t){if(!t||typeof t!="object")return;let e=t;if(!d(e.store)||!d(e.clientId)||!d(e.userId)||!d(e.accessToken)||!Array.isArray(e.scopes)||!e.scopes.every(d)||!d(e.acquiredAt))return;let o=ke(e.associatedUser),r=e.kind==="preview"?"preview":"standard",n=r==="preview"?$e(e.preview):void 0;if(!(r==="preview"&&!n))return{store:e.store,clientId:e.clientId,userId:e.userId,accessToken:e.accessToken,scopes:e.scopes,acquiredAt:e.acquiredAt,...d(e.refreshToken)?{refreshToken:e.refreshToken}:{},...d(e.expiresAt)?{expiresAt:e.expiresAt}:{},...d(e.refreshTokenExpiresAt)?{refreshTokenExpiresAt:e.refreshTokenExpiresAt}:{},...o?{associatedUser:o}:{},...r==="preview"?{kind:r}:{},...n?{preview:n}:{}}}function ye(t,e,o){if(!e||typeof e!="object")return;let{sessionsByUserId:r,currentUserId:n}=e;if(!(r!==void 0||n!==void 0))return;let s=b(t);if(!r||typeof r!="object"||Array.isArray(r)||typeof n!="string"){o.delete(s);return}let a=Object.fromEntries(Object.entries(r).flatMap(([u,c])=>{let p=Pe(c);return p?[[u,p]]:[]}));if(Object.keys(a).length!==Object.keys(r).length)if(a[n])o.set(s,{currentUserId:n,sessionsByUserId:a});else{o.delete(s);return}return{currentUserId:n,sessionsByUserId:a}}function H(t,e){return ye(t,e.get(b(t)),e)}function Ce(t){return t.config?.store??{}}function we(t=P()){let e=[],o=`${G}::`;for(let[r,n]of Object.entries(Ce(t))){if(!r.startsWith(o))continue;let i=ye(r.slice(o.length),n,t),s=i?.sessionsByUserId[i.currentUserId];s&&e.push(s)}return e}function Ae(t,e=P()){let o=w(t),r=H(o,e);if(!r)return;let n=r.sessionsByUserId[r.currentUserId];if(!n){e.delete(b(o));return}return n}function wt(t,e=P()){let o=b(t.store),r=H(t.store,e),n={currentUserId:t.userId,sessionsByUserId:{...r?.sessionsByUserId??{},[t.userId]:t}};e.set(o,n)}function At(t,e,o){let r=w(t),n=typeof e=="string"?e:void 0,i=(typeof e=="string"?o:e)??P(),s=b(r);if(!n){i.delete(s);return}let a=H(r,i);if(!a)return;let{[n]:u,...c}=a.sessionsByUserId,p=Object.keys(c);if(p.length===0){i.delete(s);return}i.set(s,{currentUserId:a.currentUserId===n?p[0]:a.currentUserId,sessionsByUserId:c})}function ve(t){if(!t.expiresAt)return!1;let e=new Date(t.expiresAt).getTime();return Number.isNaN(e)?!0:e-be<Date.now()}var z=class extends q{static baseFlags={...q.baseFlags,...ie};environmentsFilename(){return Se}async command(e,o,r=!1,n,i){}async run(e){let o=this.constructor,r=o.multiEnvironmentsFlags,{args:n,flags:i}=await this.parse(o),s="password"in o.flags,a=(Array.isArray(i.environment)?i.environment:[i.environment]).filter(Boolean),u=r!==null&&r.some(m=>Array.isArray(m)?m.includes("store"):m==="store");if(a.length<=1){if(a[0]&&!i.store&&u)throw new F("Please provide a valid environment.");let m=s?await this.createSession(i):void 0,A=this.constructor.name.toLowerCase();if(U(`theme-command:${A}:single-env:authenticated`),i.path&&!_(i.path))throw new F(`Path does not exist: ${i.path}`);try{await this.command(i,m,!1,n)}finally{await this.logAnalyticsData(m)}return}if(r===null){N({body:"This command does not support multiple environments."});return}let{flags:c}=await this.parse(se(o),this.argv);if("path"in c){this.errorOnGlobalPath();return}let p=await this.loadEnvironments(a,i,c),g=await this.validateEnvironments(p,r,s);"force"in o.flags&&!i.force&&!await this.showConfirmation(this.constructor.name,r,g)||await this.runConcurrent(g.valid)}storeAuthScopes(){}async loadEnvironments(e,o,r){let n=new Map;for(let i of e){let s=await ne(i,"shopify.theme.toml",{from:o.path,silent:!0});s?.store&&typeof s.store=="string"&&(s.store=w(s.store)),s?.path&&typeof s.path=="string"&&(s.path=k(s.path)),n.set(i,{flags:{...o,...s,...r,environment:[i]},validationFlags:{...s,...r}})}return n}async validateEnvironments(e,o,r){let n=[],i=[],s=r?this.storeAuthSessionsForTheme(Array.from(e.values()).map(({validationFlags:u})=>u)):new Map,a=Array.from(e.entries()).map(([u,{flags:c,validationFlags:p}])=>({environmentName:u,flags:c,validationFlags:p,storeAuthSession:this.storeAuthSessionFromCache(p,s)}));for(let{environmentName:u,flags:c,validationFlags:p,storeAuthSession:g}of a){let y=this.validConfig(p,o,u,g);if(y!==!0){let m=y.join(", ");i.push({environment:u,reason:`Missing flags: ${m}`});continue}n.push({environment:u,flags:c,requiresAuth:r,storeAuthSession:g})}return{valid:n,invalid:i}}async showConfirmation(e,o,r){let s={message:[`Run ${e.toLowerCase()} in the following environments?`],confirmationMessage:"Yes, proceed",cancellationMessage:"Cancel"},a=[...r.valid.map(({environment:u,flags:c})=>{let p=o.map(g=>{let y=Array.isArray(g)?g.find(m=>c[m]):g;if(y==="password")return"password";if(y==="path"&&typeof c.path=="string"){let m=c.path.split(/[/\\]/);if(m.length===1)return`path: ${c.path}`;let A=m[0]===""?`/${m[1]}`:m[0],E=m.at(-1);return`path: ${A}/.../${E}`}return y&&`${y}: ${c[y]}`}).join(", ");return[u,{subdued:p||"No flags required"}]}),...r.invalid.map(({environment:u,reason:c})=>[u,{error:`Skipping | ${c}`}])];return s.infoTable={Environment:a},r.invalid.length>0&&(s.confirmationMessage="Proceed anyway (will skip invalid environments)"),re(s)}async runConcurrent(e){let o=new Q,r=e.map(s=>s.flags.store),n=new Set(r),i=r.length===n.size?[e]:this.createSequentialGroups(e);for(let s of i)await te({processes:s.map(({environment:a,flags:u,requiresAuth:c,storeAuthSession:p})=>({prefix:a,action:async(g,y,m)=>{try{let A=u.store;await he(A,async()=>{let E=c?await this.createSession(u,p):void 0,xe=this.constructor.name.toLowerCase();U(`theme-command:${xe}:multi-env:authenticated`);try{await this.command(u,E,!0,{},{stdout:g,stderr:y})}finally{await this.logAnalyticsData(E)}})}catch(A){A instanceof Error&&(A.message=`Environment ${a} failed:
|
|
2
2
|
|
|
3
3
|
${A.message}`,I({body:[A.message]}))}}})),abortSignal:o.signal,showTimestamps:!0,renderOptions:{stdout:process.stderr}})}createSequentialGroups(e){let o=[];return e.forEach(r=>{let n=o.find(i=>!i.some(s=>s.flags.store===r.flags.store));n?n.push(r):o.push([r])}),o}async createSession(e,o){let r=le({store:e.store}),n=e.password;return n?await L(r,n):o??await this.storeAuthSessionForTheme({store:r})??await L(r,n)}async storeAuthSessionForTheme(e){let o=this.storeAuthScopes();if(!o)return;let r=typeof e.store=="string"?e.store:void 0,n=e.password;if(!r||n)return;let i=w(r),s=Ae(i);if(s)return this.adminSessionFromStoreAuthSession(s,i,o)}storeAuthSessionsForTheme(e){let o=this.storeAuthScopes();if(!o)return new Map;let r=new Set(e.filter(({store:n,password:i})=>typeof n=="string"&&!i).map(({store:n})=>w(n)));return r.size===0?new Map:new Map(we().map(n=>{let i=w(n.store);if(!r.has(i))return;let s=this.adminSessionFromStoreAuthSession(n,i,o);return s?[i,s]:void 0}).filter(n=>n!==void 0))}storeAuthSessionFromCache(e,o){let r=typeof e.store=="string"?e.store:void 0,n=e.password;if(!(!r||n))return o.get(w(r))}adminSessionFromStoreAuthSession(e,o,r){if(ve(e)){h(`Ignoring stored store auth session for ${o}: it expired at ${e.expiresAt??"unknown"}.`);return}if(!this.hasRequiredStoreAuthScopes(e.scopes,r)){h(`Ignoring stored store auth session for ${o}: it is missing required scopes (has: ${e.scopes.join(", ")}; needs: ${r.join(", ")}).`);return}return h(`Using stored store auth session for ${o} (scopes: ${e.scopes.join(", ")}).`),C(e.userId),{token:e.accessToken,storeFqdn:o}}expandImpliedStoreAuthScopes(e){let o=new Set(e);for(let r of e){let n=r.match(/^(unauthenticated_)?write_(.*)$/);n&&o.add(`${n[1]??""}read_${n[2]}`)}return o}hasRequiredStoreAuthScopes(e,o){let r=this.expandImpliedStoreAuthScopes(e);return o.every(n=>r.has(n))}validConfig(e,o,r,n){let i=o.filter(s=>Array.isArray(s)?!s.some(a=>this.hasRequiredFlag(e,a,n)):!this.hasRequiredFlag(e,s,n)).map(s=>Array.isArray(s)?s.join(" or "):s);return i.length>0?(N({body:[`Missing required flags in environment configuration${r?` for ${r}`:""}:`,{list:{items:i}}]}),i):!0}hasRequiredFlag(e,o,r){return o==="password"&&r?!0:!!e[o]}errorOnGlobalPath(){let e=Y($(),"shopify.theme.toml"),o=_(e);I({body:["Can't use `--path` flag with multiple environments.",...o?["Configure each environment's theme path in your shopify.theme.toml file instead."]:["Run this command from the directory containing shopify.theme.toml.","No shopify.theme.toml found in current directory."]]})}async logAnalyticsData(e){if(!e)return;let o=X();await Z(()=>({store_fqdn_hash:K(e.storeFqdn),store_domain:e.storeFqdn,cmd_theme_timings:JSON.stringify(o.timings),cmd_theme_errors:JSON.stringify(o.errors),cmd_theme_retries:JSON.stringify(o.retries),cmd_theme_events:JSON.stringify(o.events)})),await ee(()=>({store_fqdn:e.storeFqdn}))}};export{G as a,we as b,Ae as c,wt as d,At as e,B as f,He as g,ze as h,Ye as i,Je as j,We as k,Ke as l,Qe as m,Ve as n,Xe as o,O as p,qe as q,le as r,ct as s,ut as t,mt as u,z as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as w}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-77G2GTZU.js";import{a as y}from"./chunk-WQG4QDC5.js";import{a as h}from"./chunk-TFVIG4I7.js";import{Ia as b,g}from"./chunk-X4767EMJ.js";import{b as u}from"./chunk-DWMRVMKX.js";import{S as f,x as d,z as m}from"./chunk-J6XOTLT5.js";import{d as l}from"./chunk-6MELTJU3.js";import{b as A}from"./chunk-I3J63RFV.js";import{e as _,g as s}from"./chunk-VKWPEFWQ.js";s();s();s();async function o(e,{web:i,stdout:t,stderr:a,signal:n,env:p={}}){let c=i.configuration.commands[e];if(!c)return;let[I,...v]=c.split(" ");await f(I,v,{cwd:i.directory,stdout:t,stderr:a,signal:n,env:p}),t.write("Web successfully built.")}async function S(e){!e.skipDependenciesInstallation&&!e.project.usesWorkspaces&&await y(e.project);let i={};e.apiKey&&(i.SHOPIFY_API_KEY=e.apiKey),await g(e.app),await d({processes:[...e.app.webs.map(t=>({prefix:["web",...t.configuration.roles].join("-"),action:async(a,n,p)=>{await o("build",{web:t,stdout:a,stderr:n,signal:p,env:i})}})),...e.app.allExtensions.map(t=>({prefix:t.localIdentifier,action:async(a,n,p)=>{await t.build({stdout:a,stderr:n,signal:p,app:e.app,environment:"production"})}}))],showTimestamps:!1}),m({headline:[{userInput:e.app.name},"built!"]})}var k=S;var x=_(A(),1);var r=class e extends w{static summary="Build the app, including extensions.";static descriptionWithMarkdown="This command executes the build script specified in the element's TOML file. You can specify a custom script in the file. To learn about configuration files in Shopify apps, refer to [App configuration](https://shopify.dev/docs/apps/tools/cli/configuration).\n\n If you're building a [theme app extension](https://shopify.dev/docs/apps/online-store/theme-app-extensions), then running the `build` command runs [Theme Check](https://shopify.dev/docs/themes/tools/theme-check) against your extension to ensure that it's valid.";static description=this.descriptionForHelp();static flags={...u,...h,"skip-dependencies-installation":x.Flags.boolean({hidden:!1,description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1})};async run(){let{flags:i}=await this.parse(e),t=i["client-id"];await l(()=>({cmd_app_dependency_installation_skipped:i["skip-dependencies-installation"]}));let{app:a,project:n}=await b({directory:i.path,userProvidedConfigName:i.config});return await k({app:a,project:n,skipDependenciesInstallation:i["skip-dependencies-installation"],apiKey:t}),{app:a}}};export{r as a};
|