shopify 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-DWUYMFHO.js +1 -0
- package/dist/analytics-SOXP4UBD.js +1 -0
- package/dist/assets/hydrogen/routes/locale-check.ts +3 -3
- package/dist/assets/hydrogen/starter/CHANGELOG.md +106 -0
- package/dist/assets/hydrogen/starter/app/components/Aside.tsx +4 -2
- package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +8 -5
- package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +117 -23
- package/dist/assets/hydrogen/starter/app/components/Header.tsx +3 -3
- package/dist/assets/hydrogen/starter/app/components/PaginatedResourceSection.tsx +24 -4
- package/dist/assets/hydrogen/starter/app/components/ProductPrice.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/lib/context.ts +5 -0
- package/dist/assets/hydrogen/starter/app/routes/[robots.txt].tsx +14 -53
- package/dist/assets/hydrogen/starter/app/routes/_index.tsx +11 -4
- package/dist/assets/hydrogen/starter/app/routes/account.$.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +2 -2
- package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +1 -1
- package/dist/assets/hydrogen/starter/package.json +9 -10
- package/dist/assets/hydrogen/starter/storefrontapi.generated.d.ts +0 -11
- package/dist/assets/hydrogen/starter/vite.config.ts +10 -4
- package/dist/assets/hydrogen/vite/package.json +1 -2
- package/dist/assets/hydrogen/vite/vite.config.js +4 -3
- package/dist/bootstrap.js +1 -1
- package/dist/chunk-2EROVVCL.js +1 -0
- package/dist/{chunk-MEIEEENL.js → chunk-2MMGFZDP.js} +1 -1
- package/dist/{chunk-3YDYZ232.js → chunk-2NWWMNU5.js} +8 -8
- package/dist/{chunk-WHNWE7P2.js → chunk-3CYHS4W2.js} +1 -1
- package/dist/{chunk-DNXYKGV2.js → chunk-3FBSBMSQ.js} +1 -1
- package/dist/chunk-3OZ6ZZ4T.js +5 -0
- package/dist/{chunk-UTO4Z6P6.js → chunk-442S5SDM.js} +1 -1
- package/dist/{chunk-2RBIR3NM.js → chunk-45MEVWH5.js} +1 -1
- package/dist/{chunk-N5LVGFDS.js → chunk-47MGPVED.js} +1 -1
- package/dist/{chunk-UYSF234H.js → chunk-4N6YTHFD.js} +1 -1
- package/dist/chunk-4TST2MNC.js +1 -0
- package/dist/{chunk-NILXAUUT.js → chunk-5GVXMNC4.js} +1 -1
- package/dist/{chunk-PMS4MNHB.js → chunk-5JNEWYD5.js} +1 -1
- package/dist/{chunk-ATSMK66C.js → chunk-5QQN3SKH.js} +1 -1
- package/dist/{chunk-DCLUZFT7.js → chunk-5QWYIBE6.js} +1 -1
- package/dist/chunk-5W443CKL.js +836 -0
- package/dist/{chunk-JUYJZUYU.js → chunk-67KMRBSZ.js} +1 -1
- package/dist/{chunk-UC7KMA6W.js → chunk-6DIHOMCB.js} +1 -1
- package/dist/{chunk-NTRAWIEJ.js → chunk-6EZ7JWBK.js} +6 -6
- package/dist/{chunk-25HJX3L2.js → chunk-6RL7FUPD.js} +1 -1
- package/dist/chunk-6YPEONHB.js +46 -0
- package/dist/{chunk-JEZ3PGVC.js → chunk-733R5OKQ.js} +1 -1
- package/dist/chunk-73W5BGAZ.js +1 -0
- package/dist/{chunk-Q7C44DX5.js → chunk-75LJTY7F.js} +1 -1
- package/dist/{chunk-JCIN73BE.js → chunk-7EJ4UVYI.js} +1 -1
- package/dist/{chunk-BL46CZ2M.js → chunk-7LATYPLU.js} +1 -1
- package/dist/{chunk-TP7E54WN.js → chunk-7SVMAJTR.js} +1 -1
- package/dist/{chunk-7572RLUP.js → chunk-7UOPCYMV.js} +1 -1
- package/dist/chunk-APN3VWN4.js +3 -0
- package/dist/{chunk-FOFJBRSL.js → chunk-AT2GDXN7.js} +1 -1
- package/dist/{chunk-4QTEPWEJ.js → chunk-ATXODH6C.js} +4 -4
- package/dist/chunk-AY4GIVME.js +4 -0
- package/dist/{chunk-TY6BZTG3.js → chunk-B7BUEEBR.js} +1 -1
- package/dist/{chunk-G2LVUM7N.js → chunk-B7S23DLF.js} +1 -1
- package/dist/chunk-BCD4KTLJ.js +1 -0
- package/dist/{chunk-CEHXOWA6.js → chunk-BIMOHK2P.js} +1 -1
- package/dist/{chunk-UB26DGTR.js → chunk-C3CVLSLS.js} +1 -1
- package/dist/{chunk-G3RWLAOG.js → chunk-CD5O2BIT.js} +1 -1
- package/dist/chunk-CPE7XCC6.js +593 -0
- package/dist/{chunk-TRYWVIVJ.js → chunk-CZXGQ53M.js} +1 -1
- package/dist/chunk-D6YDSGR4.js +3 -0
- package/dist/{chunk-33OHQUHZ.js → chunk-DHBYYHBT.js} +1 -1
- package/dist/{chunk-OU4SKQTC.js → chunk-DLNBTHKL.js} +2 -2
- package/dist/chunk-DO2SHYFU.js +1 -0
- package/dist/{chunk-7FQFEB33.js → chunk-DONEJHDG.js} +33 -33
- package/dist/{chunk-JAWKLBOB.js → chunk-DQ4HA72R.js} +1 -1
- package/dist/{chunk-CV5EQGES.js → chunk-DZLA2RJP.js} +1 -1
- package/dist/{chunk-GJXINXSU.js → chunk-EKHWL542.js} +46 -46
- package/dist/{chunk-USLYL5AC.js → chunk-F5QG42MA.js} +1 -1
- package/dist/{chunk-2XZBQZ5R.js → chunk-FA4K3JRN.js} +1 -1
- package/dist/{chunk-3SPDFV5D.js → chunk-FPLUMESQ.js} +1 -1
- package/dist/chunk-FU232KQ7.js +1 -0
- package/dist/{chunk-S22NCNAJ.js → chunk-FZKKKGUJ.js} +1 -1
- package/dist/chunk-G24L7MB3.js +1 -0
- package/dist/{chunk-RKDZGK5K.js → chunk-G2I2ZUBV.js} +1 -1
- package/dist/{chunk-4FFPTEKD.js → chunk-G2S346IS.js} +1 -1
- package/dist/{chunk-HCTZN7L4.js → chunk-GBZL4TTY.js} +1 -1
- package/dist/{chunk-AO3RFGNV.js → chunk-GFCLUGAG.js} +1 -1
- package/dist/{chunk-MRS6LAY7.js → chunk-GKRCTMWY.js} +1 -1
- package/dist/{chunk-JJ6RM54S.js → chunk-GTUKM3ZW.js} +1 -1
- package/dist/{chunk-YL3TYQGT.js → chunk-GUO7S4NW.js} +1 -1
- package/dist/{chunk-ANBOLDON.js → chunk-GW3VY3FZ.js} +1 -1
- package/dist/{chunk-OXJBYKMX.js → chunk-H5C3QTOO.js} +1 -1
- package/dist/{chunk-T3ERXB7F.js → chunk-H6WN7GP4.js} +1 -1
- package/dist/{chunk-NWXDOCL5.js → chunk-HA6NISOZ.js} +1 -1
- package/dist/{chunk-L2PC4MUV.js → chunk-HCN6HXA5.js} +1 -1
- package/dist/chunk-HM5H7WBE.js +1 -0
- package/dist/chunk-HZMP62GK.js +21 -0
- package/dist/{chunk-57PPQKJT.js → chunk-HZSAUZBX.js} +1 -1
- package/dist/{chunk-ZGJ3DFTQ.js → chunk-HZYRCG4R.js} +1 -1
- package/dist/{chunk-6JKGUQRD.js → chunk-I73E3BD5.js} +1 -1
- package/dist/{chunk-Q73GEVSJ.js → chunk-IG6LPVS4.js} +1 -1
- package/dist/{chunk-T4NS63K4.js → chunk-IIOIDMG3.js} +1 -1
- package/dist/{chunk-FQ5ZZX2G.js → chunk-IPQH2RHD.js} +1 -1
- package/dist/chunk-IX4KP6E3.js +2 -0
- package/dist/{chunk-A5HKAMAC.js → chunk-J2WCMQZZ.js} +1 -1
- package/dist/chunk-J3HXFQ2L.js +1 -0
- package/dist/{chunk-QDVJJKLB.js → chunk-J5TNYNR5.js} +1 -1
- package/dist/{chunk-SSCYLDSX.js → chunk-J7UQBC45.js} +1 -1
- package/dist/{chunk-Q77MM2N2.js → chunk-JAW32T6G.js} +1 -1
- package/dist/{chunk-OZBY45KT.js → chunk-JOZXRV5K.js} +1 -1
- package/dist/{chunk-S5IFJ737.js → chunk-KKUDXLK2.js} +1 -1
- package/dist/{chunk-HDC5V7RY.js → chunk-KN3FTJDU.js} +1 -1
- package/dist/{chunk-AERKD4TO.js → chunk-KSZ5K6LJ.js} +1 -1
- package/dist/{chunk-G3JJLXPH.js → chunk-LCPD2BYX.js} +1 -1
- package/dist/chunk-LKZ7ARYS.js +18 -0
- package/dist/{chunk-ZUKLGZOU.js → chunk-LOHUNOQ7.js} +1 -1
- package/dist/{chunk-ZM75DSIW.js → chunk-LOQIRLTD.js} +1 -1
- package/dist/{chunk-FIYAECXH.js → chunk-MFLQRQQT.js} +1 -1
- package/dist/chunk-MQICT2LR.js +1 -0
- package/dist/{chunk-RSRYC5ZF.js → chunk-MZMYBFZQ.js} +1 -1
- package/dist/{chunk-2EHBJWC6.js → chunk-NADNFSKS.js} +1 -1
- package/dist/{chunk-N3YTDGFY.js → chunk-NWDP5IZ2.js} +1 -1
- package/dist/{chunk-WVRGCNBZ.js → chunk-NY5OGHM5.js} +1 -1
- package/dist/chunk-O6KTFMCD.js +1 -0
- package/dist/{chunk-YSIBRY6C.js → chunk-OAI7VSLW.js} +1 -1
- package/dist/{chunk-GWHV62YT.js → chunk-OORCODNK.js} +1 -1
- package/dist/{chunk-W7DDV2EY.js → chunk-OQORDQLH.js} +1 -1
- package/dist/{chunk-JAWOP4HJ.js → chunk-PETINPMX.js} +1 -1
- package/dist/{chunk-5XDQ76DQ.js → chunk-PJYNAUQB.js} +1 -1
- package/dist/{chunk-5H3VTG77.js → chunk-PMXCJIBP.js} +1 -1
- package/dist/{chunk-OU3M32A2.js → chunk-POAICASX.js} +1 -1
- package/dist/{chunk-6KETAPWL.js → chunk-PUAMSBXS.js} +1 -1
- package/dist/{chunk-M2YINBHF.js → chunk-PZYP3MCL.js} +1 -1
- package/dist/chunk-Q7BOSHWX.js +7 -0
- package/dist/{chunk-HIQHYPLU.js → chunk-QJ7TI6CK.js} +1 -1
- package/dist/{chunk-VJ6KDRZI.js → chunk-QMXKGSFH.js} +1 -1
- package/dist/{chunk-3AOQKI4B.js → chunk-QPN2M26G.js} +1 -1
- package/dist/{chunk-5FVB7JHP.js → chunk-QS3FMN67.js} +1 -1
- package/dist/{chunk-VRJTLVG3.js → chunk-RF6NUGCU.js} +1 -1
- package/dist/{chunk-PXHY753L.js → chunk-RYGZCBO4.js} +1 -1
- package/dist/{chunk-MMIHHCMW.js → chunk-SKLUHLS2.js} +1 -1
- package/dist/{chunk-2GU7OY3H.js → chunk-SP2WUATO.js} +1 -1
- package/dist/chunk-SWI3LCPE.js +7 -0
- package/dist/{chunk-J3HX6ZGD.js → chunk-SXTDVUT3.js} +1 -1
- package/dist/{chunk-4J32OHLY.js → chunk-T5GSCWN5.js} +1 -1
- package/dist/{chunk-J5BRKYGE.js → chunk-TC3JOEMA.js} +1 -1
- package/dist/{chunk-5FFHQTRC.js → chunk-TJGUNVRI.js} +1 -1
- package/dist/{chunk-EVZA2TCI.js → chunk-TKG42KLM.js} +1 -1
- package/dist/{chunk-DYNH5SKT.js → chunk-TQUSREKP.js} +1 -1
- package/dist/{chunk-PCCK4YTE.js → chunk-U73TPLFE.js} +1 -1
- package/dist/{chunk-HOSFU6UP.js → chunk-UKK5P74A.js} +3 -3
- package/dist/chunk-UMT7DWR4.js +1 -0
- package/dist/chunk-UUC5YKAS.js +2 -0
- package/dist/chunk-UYK6CXAU.js +1 -0
- package/dist/{chunk-JSOGPMWB.js → chunk-V3RZ3DTW.js} +1 -1
- package/dist/{chunk-5O43334U.js → chunk-V6ZSIUO3.js} +1 -1
- package/dist/{chunk-YPBCSDFQ.js → chunk-VFWWZMOQ.js} +1 -1
- package/dist/{chunk-MIDYZPO4.js → chunk-VOJWKGCW.js} +1 -1
- package/dist/{chunk-AU5EZQW7.js → chunk-VQW35HIQ.js} +1 -1
- package/dist/{chunk-PFGYC53K.js → chunk-WAGAC3YI.js} +1 -1
- package/dist/{chunk-TPCG6DCA.js → chunk-WKBVT5WG.js} +1 -1
- package/dist/{chunk-KRQGLK2Q.js → chunk-WLO5H255.js} +1 -1
- package/dist/{chunk-M7YFD4EV.js → chunk-WNWQSHEC.js} +5 -5
- package/dist/{chunk-VI34CKV6.js → chunk-WRRUFK4Y.js} +1 -1
- package/dist/{chunk-LCZDC6EE.js → chunk-WVHB2HCQ.js} +1 -1
- package/dist/{chunk-YIRFEW5M.js → chunk-WZVQHMGI.js} +1 -1
- package/dist/{chunk-G2OHWAY2.js → chunk-X4DIJTIK.js} +1 -1
- package/dist/{chunk-S6B2ADVR.js → chunk-XH6ZP7M5.js} +1 -1
- package/dist/{chunk-7D45IAMQ.js → chunk-XV3I45NA.js} +1 -1
- package/dist/{chunk-2K7FGAT6.js → chunk-Y3WIZSRU.js} +1 -1
- package/dist/{chunk-2GAFKG64.js → chunk-Y66GQ6V2.js} +1 -1
- package/dist/{chunk-N3CNWCC2.js → chunk-YGKQCEVG.js} +1 -1
- package/dist/{chunk-2TMQG2UT.js → chunk-YLGSM42I.js} +1 -1
- package/dist/{chunk-JK3NIHTX.js → chunk-YQH2JHFA.js} +1 -1
- package/dist/{chunk-E7DHELFH.js → chunk-YYL356OX.js} +1 -1
- package/dist/chunk-Z4LC3WE5.js +7 -0
- package/dist/{chunk-PNP5OKNZ.js → chunk-Z74QYLNC.js} +1 -1
- package/dist/{chunk-5BKCIDMS.js → chunk-ZAMDXIVC.js} +1 -1
- package/dist/{chunk-WA3YC5W4.js → chunk-ZEENHLSC.js} +2 -2
- package/dist/{chunk-6LWOWDF4.js → chunk-ZIREP3EZ.js} +1 -1
- package/dist/chunk-ZIXWWU2N.js +275 -0
- package/dist/{chunk-N3NE4MVN.js → chunk-ZQ5JVD5X.js} +1 -1
- package/dist/{chunk-YVQXEPHY.js → chunk-ZULTG2D2.js} +1 -1
- package/dist/{chunk-UU5P2IYU.js → chunk-ZZFZBFVM.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 -0
- 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/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/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.d.ts +38 -0
- package/dist/cli/help.js +2 -0
- package/dist/command-registry.js +1 -1
- package/dist/{conf-store-UY3MDGGA.js → conf-store-C2LOYIOU.js} +1 -1
- package/dist/{deprecations-KNUMDRIU.js → deprecations-QOHE6JG6.js} +1 -1
- package/dist/dist-FF6C4ZHS.js +1 -0
- package/dist/dist-Q676YGVI.js +1 -0
- package/dist/environments-EGD263DV.js +1 -0
- package/dist/error-66U2HJ37.js +1 -0
- package/dist/error-handler-SW2ALZ5Z.js +1 -0
- package/dist/{fs-LJWVNO4H.js → fs-JPQRUGZI.js} +1 -1
- package/dist/hooks/app-init.js +1 -1
- package/dist/hooks/did-you-mean.js +1 -1
- package/dist/hooks/hydrogen-init.js +1 -1
- package/dist/hooks/plugin-plugins.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 +23 -10
- package/dist/{is-global-W6ALVC5L.js → is-global-QWTDUPNR.js} +1 -1
- package/dist/lib-NOROGV6N.js +1 -0
- package/dist/lib-UCG2DNMS.js +1 -0
- package/dist/{local-GKEWZAIV.js → local-FRYN3NWL.js} +1 -1
- package/dist/local-storage-DFH3LT5G.js +1 -0
- package/dist/{metadata-UEUN64TK.js → metadata-KZVLHQII.js} +1 -1
- package/dist/{morph-CGOZEPPZ.js → morph-CG6HEMCQ.js} +4 -4
- package/dist/{node-package-manager-4ASQQIIF.js → node-package-manager-LVFBY4LY.js} +1 -1
- package/dist/notifications-system-DP443VTE.js +1 -0
- package/dist/{output-S6E37GJQ.js → output-NH4I5Y3C.js} +1 -1
- package/dist/{prettier-EGVCP5CY.js → prettier-6ZMB2MMO.js} +1 -1
- package/dist/system-GNOF6HMI.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui-QOGKADWB.js +1 -0
- package/dist/upgrade-K4S6JW64.js +1 -0
- package/dist/version-FJFTTOZU.js +1 -0
- package/dist/version-ZI4GZX72.js +1 -0
- package/dist/{workerd-QOTT6UCO.js → workerd-U6WWWY73.js} +1 -1
- package/oclif.manifest.json +714 -122
- package/package.json +15 -8
- package/dist/analytics-JH64XI2J.js +0 -1
- package/dist/analytics-MEGKKFGF.js +0 -1
- package/dist/assets/hydrogen/starter/app/routes/api.$version.[graphql.json].tsx +0 -14
- package/dist/chunk-762JWOWJ.js +0 -5
- package/dist/chunk-7LV55VWE.js +0 -1
- package/dist/chunk-A27NZMWB.js +0 -1
- package/dist/chunk-AVD3INWF.js +0 -1
- package/dist/chunk-AWEB5AQM.js +0 -1
- package/dist/chunk-AXNAGI32.js +0 -1
- package/dist/chunk-BQWK3C47.js +0 -278
- package/dist/chunk-CFOXXOO2.js +0 -1
- package/dist/chunk-DTIWUT2T.js +0 -18
- package/dist/chunk-DZQYG32N.js +0 -2
- package/dist/chunk-EH7ZTFS4.js +0 -613
- package/dist/chunk-EKVTNWHM.js +0 -1
- package/dist/chunk-G4OQABDT.js +0 -836
- package/dist/chunk-I22ZTRKK.js +0 -3
- package/dist/chunk-I4R7TML2.js +0 -7
- package/dist/chunk-J3H4LPN6.js +0 -18
- package/dist/chunk-JLE4NBMT.js +0 -1
- package/dist/chunk-LXVORHCQ.js +0 -1
- package/dist/chunk-MINZGZ4N.js +0 -1
- package/dist/chunk-S7F5KFQP.js +0 -1
- package/dist/chunk-T4IV643Z.js +0 -9
- package/dist/chunk-TUNUEOHO.js +0 -3
- package/dist/chunk-VPPWSKOY.js +0 -1
- package/dist/chunk-XVUHUA36.js +0 -1
- package/dist/chunk-YMAWEIUR.js +0 -1
- package/dist/dist-C5IV2YDQ.js +0 -1
- package/dist/dist-VL4KZWV2.js +0 -1
- package/dist/environments-YPRVO2CF.js +0 -1
- package/dist/error-XRBQTNFM.js +0 -1
- package/dist/error-handler-NI7D6GSY.js +0 -1
- package/dist/lib-AIKYSHWL.js +0 -1
- package/dist/lib-Q4PWEMFD.js +0 -1
- package/dist/local-storage-ZOZMA22B.js +0 -1
- package/dist/notifications-system-HLXJCAMG.js +0 -1
- package/dist/system-YQZNGSWB.js +0 -1
- package/dist/ui-D2FFWRK7.js +0 -1
- package/dist/upgrade-TVTCFMXM.js +0 -1
- package/dist/version-J6MDN7BZ.js +0 -1
- package/dist/version-RIRW5EXQ.js +0 -1
- /package/dist/{chunk-YLQ3LNNY.js → chunk-VDN6MEYI.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as f,c as o,d as h}from"./chunk-
|
|
1
|
+
import{b as f,c as o,d as h}from"./chunk-5JNEWYD5.js";import{a as l}from"./chunk-HM5H7WBE.js";import{a as c}from"./chunk-ZAMDXIVC.js";import{Fa as m}from"./chunk-ATXODH6C.js";import{b as d}from"./chunk-H5C3QTOO.js";import{Mb as e}from"./chunk-DONEJHDG.js";import{u as r}from"./chunk-A4SBXDZB.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();var t=class g extends l{async run(){let{flags:a}=await this.parse(g),{app:s}=await m({directory:a.path,clientId:a["client-id"],forceRelink:a.reset,userProvidedConfigName:a.config}),i=new h(s);return await i.start(),e(`Watching for changes in ${s.name}...`),i.onEvent(async({app:y,extensionEvents:u,startTime:w,path:x})=>{e(`\u{1F195} Event [${f(w)}ms]`),e(` \u{1F4C2} ${x}`),u.forEach(n=>{switch(n.type){case o.Created:e(` \u2705 Extension created - ${r.green(n.extension.handle)}`);break;case o.Deleted:e(` \u274C Extension deleted: ${r.red(n.extension.handle)}`);break;case o.Updated:e(` \u{1F504} Updated: ${r.yellow(n.extension.handle)}`);break}})}),setInterval(()=>{},1<<30),{app:s}}};t.summary="Watch and prints out changes to an app.";t.hidden=!0;t.flags={...d,...c};var F=t;export{F as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as D}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-BCD4KTLJ.js";import{a as _,c as b}from"./chunk-VOJWKGCW.js";import{a as c,b as F}from"./chunk-QMXKGSFH.js";import{e as y,q as T}from"./chunk-PJYNAUQB.js";import{i as v,p as g,v as w}from"./chunk-D6YDSGR4.js";import{b as u}from"./chunk-H5C3QTOO.js";import{A as p,v as d}from"./chunk-6EZ7JWBK.js";import{V as f}from"./chunk-DONEJHDG.js";import{r as C}from"./chunk-T6CC5WUU.js";import{e as Y,g as h}from"./chunk-VKWPEFWQ.js";h();h();async function I(t,e,i){let r=e.themes;e.development&&(r=[(await new D(t).find()).id.toString()]);let n=t.storeFqdn,s=await L(t,{...e,themes:r,development:!1});if(!e.force&&!i&&!await M(s,n))return;await Promise.all(s.map(o=>(y(o)&&v(),T(o.id,t))));let l=e.environment?[{subdued:`Environment: ${e.environment}
|
|
2
2
|
|
|
3
3
|
`}]:[];d({body:f(s,o=>[...l,`The following themes were deleted from ${n}:`,F(o)],o=>[...l,"The theme",...c(o),`was deleted from ${n}.`])})}async function L(t,e){if(e.selectTheme||e.themes.length>0)return b(t,e);let i=t.storeFqdn;return[await _(t,{header:`Select a theme to delete from ${i}`,filter:{development:e.development}})]}async function M(t,e){let r={message:f(t,n=>[`Delete the following themes from ${e}?`],n=>["Delete",...c(n),`from ${e}?`]),confirmationMessage:"Yes, confirm changes",cancellationMessage:"Cancel"};return t.length>1&&(r.infoTable={"":t.map(c)}),p(r)}var a=Y(C(),1);var O,m=class extends w{async command(e,i,r){let{environment:n,development:s,force:l,theme:o}=e,E=o??[];await I(i,{selectTheme:e["show-all"],environment:n,development:s,themes:E,force:l},r)}};O=m;m.summary="Delete remote themes from the connected store. This command can't be undone.";m.descriptionWithMarkdown=`Deletes a theme from your store.
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Pb as m}from"./chunk-
|
|
1
|
+
import{Pb as m}from"./chunk-DONEJHDG.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();import{spawn as h}from"child_process";function g(e=process.pid,i="SIGTERM",r=!0,s){k(e,i,r,s??(n=>{n&&m(`Failed to kill process ${e}: ${n}`)}))}function k(e,i,r,s){let t=typeof e=="number"?e.toString():e;if(!/^\d+$/.test(t))if(s){s(new Error("pid must be a number"));return}else throw new Error("pid must be a number");let n={};n[t]=[];let o=new Set;switch(o.add(t),process.platform){case"win32":{h("taskkill",["/pid",t,"/T","/F"]).on("close",u=>{s&&(u===0?s():s(new Error(`taskkill exited with code ${u}`)))});break}case"darwin":l(t,n,o,function(f){return h("pgrep",["-lfP",f])},function(){w(n,i,t,r,s)});break;default:l(t,n,o,function(f){return h("ps",["-o","pid command","--no-headers","--ppid",f])},function(){w(n,i,t,r,s)});break}}function w(e,i,r,s,t){let n=new Set;try{Object.keys(e).forEach(function(o){e[o].forEach(function(f){n.has(f)||(E(f,i),n.add(f))}),o===r&&s&&!n.has(o)&&(E(o,i),n.add(o))})}catch(o){if(t){t(o);return}else throw o}t&&t()}function E(e,i){try{process.kill(parseInt(e,10),i)}catch(r){if(r.code!=="ESRCH")throw r}}function l(e,i,r,s,t){let n=s(e),o="";n.stdout?.on("data",function(u){let a=u.toString("ascii");o+=a});let f=u=>{if(r.delete(e),u!==0){if(r.size===0){t();return}return}o.trim().split(`
|
|
2
2
|
`).forEach(function(a){let d=a.match(/^(\d+)\s(.*)$/);if(d){let c=d[1],$=d[2];i[e].push(c),i[c]=[],m(`Killing process ${c}: ${$}`),r.add(c),l(c,i,r,s,t)}})};n.on("close",f)}export{g as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as I}from"./chunk-VKWPEFWQ.js";I();var o="4.4.0";export{o as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as f,c as g,d as x,g as C}from"./chunk-
|
|
1
|
+
import{a as c,b as f,c as g,d as x,g as C}from"./chunk-V6ZSIUO3.js";import{a as d}from"./chunk-HM5H7WBE.js";import{a as l}from"./chunk-ZAMDXIVC.js";import{Fa as m}from"./chunk-ATXODH6C.js";import{b as p}from"./chunk-H5C3QTOO.js";import{v as s}from"./chunk-6EZ7JWBK.js";import{r as I}from"./chunk-T6CC5WUU.js";import{e as y,g as a}from"./chunk-VKWPEFWQ.js";a();var h=y(I(),1);var i=class u extends d{async run(){let{flags:o}=await this.parse(u),e=await m({directory:o.path,clientId:o["client-id"],forceRelink:o.reset,userProvidedConfigName:o.config}),t=await C({developerPlatformClient:e.developerPlatformClient,apiKey:e.remoteApp.apiKey,organizationId:e.remoteApp.organizationId,extensionTypes:g}),n=c(t);if(n.length===0)s({headline:["No extensions to migrate."]});else{let r=await f(n);await x({...e,extensions:t,extensionTypes:r.extensionTypes,buildExtensionConfig:r.buildExtensionConfig})}return{app:e.app}}};i.description="Import dashboard-managed extensions into your app.";i.flags={...p,...l,"client-id":h.Flags.string({hidden:!1,description:"The Client ID of your app.",env:"SHOPIFY_FLAG_CLIENT_ID",exclusive:["config"]})};var k=i;export{k as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as f,fa as v,ga as A,h as d,k as w,s as m}from"./chunk-5W443CKL.js";import{b as l}from"./chunk-KN3FTJDU.js";import{d as p,g as F}from"./chunk-WKBVT5WG.js";import{Fb as V,Hb as h}from"./chunk-DONEJHDG.js";import{j as q}from"./chunk-NNOSZ447.js";import{g as c}from"./chunk-VKWPEFWQ.js";c();c();var g={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"publicApiVersions"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"publicApiVersions"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"handle"}},{kind:"Field",name:{kind:"Name",value:"supported"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var S=new Map;async function W(t,r,e,o){let a="Admin",u=o??await b(r),n=r.storeFqdn,s=$(r);l()==="local"&&(s["x-forwarded-host"]=n,n=new m().host("app"));let i=x(n,u,r);return v({query:t,api:a,addedHeaders:s,url:i,token:r.token,variables:e})}async function E(t){let{query:r,session:e,variables:o,version:a,responseOptions:u,preferredBehaviour:n}=t,s=a??S.get(e.storeFqdn);s??(s=await b(e,n));let i=e.storeFqdn,k=$(e);l()==="local"&&(k["x-forwarded-host"]=i,i=new m().host("app"));let D={url:x(i,s,e),api:"Admin",token:e.token,addedHeaders:k},y;return"refresh"in e&&(y={type:"token_refresh",handler:e.refresh}),A({...D,query:r,variables:o,responseOptions:u,unauthorizedHandler:y,preferredBehaviour:n})}function $(t){return f(t)?{"X-Shopify-Shop":t.storeFqdn,"X-Shopify-Access-Token":t.token}:{}}async function b(t,r){let o=(await N(t,r)).reverse()[0];return S.set(t.storeFqdn,o),o}async function N(t,r){return(await R(t,r)).filter(o=>o.supported).map(o=>o.handle).sort()}async function R(t,r){try{return(await E({query:g,session:t,variables:{},version:"unstable",responseOptions:{handleErrors:!1},preferredBehaviour:r})).publicApiVersions}catch(e){if(e instanceof d&&e.response.status===403){let o=t.storeFqdn.replace(".myshopify.com","");throw new p(h`Looks like you don't have access to this dev store: (${V.link(o,`https://${t.storeFqdn}`)})`,h`If you're not the owner, create a dev store staff account for yourself`)}throw e instanceof d&&(e.response.status===401||e.response.status===404)?new p(`Error connecting to your store ${t.storeFqdn}: ${e.message} ${e.response.status} ${e.response.data}`):w(e)?new p(`Network error connecting to your store ${t.storeFqdn}: ${e instanceof Error?e.message:String(e)}`,"Check your internet connection and try again."):new F(`Unknown error connecting to your store ${t.storeFqdn}: ${e instanceof Error?e.message:String(e)}`)}}function x(t,r,e){let o=r??"unstable";return e&&f(e)?`https://${q}/cli/admin/api/${o}/graphql.json`:`https://${t}/admin/api/${o}/graphql.json`}export{W as a,E as b,N as c,R as d,x as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as R}from"./chunk-
|
|
1
|
+
import{n as R}from"./chunk-5W443CKL.js";import{a as T,b as k}from"./chunk-SXTDVUT3.js";import{f as G}from"./chunk-WRRUFK4Y.js";import{d as l}from"./chunk-WKBVT5WG.js";import{Fb as u,Hb as h,Oa as y,Pa as x,Pb as f,ka as $,ua as b,wa as g}from"./chunk-DONEJHDG.js";import{d,i as w}from"./chunk-773TIA5M.js";import{g as m}from"./chunk-VKWPEFWQ.js";m();function U(a){let t=/^(?:(?:https:\/\/)?([^:/]+\.[^:/]+)\/|git@([^:/]+)[:/]|([^/]+):)?([^/\s]+)\/([^/\s#]+)(?:((?:\/[^/\s#]+)+))?(?:\/)?(?:#(.+))?/.exec(a);if(!t){let v=["github:user/repo","user/repo/subdirectory","git@github.com:user/repo","user/repo#dev","https://github.com/user/repo"];return k(new Error(`Parsing the url ${a} failed. Supported formats are ${v.join(", ")}.`))}let e=t[1]??t[2]??t[3]??"github.com",r=e==="github"?"github.com":e,s=t[4],i=t[5].replace(/\.git$/,""),n=t[6]?.slice(1),o=t[7],p=o?`#${o}`:"",c=`git@${r}:${s}/${i}`,H=`https://${r}/${s}/${i}`,P=["https:/",r,s,i,n].join("/").concat(p);return T({full:P,site:r,user:s,name:i,ref:o,subDirectory:n,ssh:c,http:H})}function A(a){let t=new URL(a),e=t.hash?t.hash.slice(1):void 0,[r,s,i,...n]=t.pathname.split("/"),o=n.length>0?n.join("/"):void 0;return{baseURL:`${t.origin}/${s}/${i}`,branch:e,filePath:o}}async function B(a,t,e,r){let s=`https://github.com/${a}/releases/download/${t}/${e}`;return G("cmd_all_timing_network_ms")(async()=>{f(h`Downloading ${u.link(e,s)}`),await $(async i=>{let n=d(i,e),o;try{if(o=await R(s,void 0,"slow-request"),!o.ok)throw new l(`Failed to download ${e}: ${o.statusText}`)}catch(c){throw new l(`Failed to download ${e}: ${c instanceof Error?c.message:"unknown error"}`)}let p=await o.arrayBuffer();await b(n,Buffer.from(p)),await x(n,493),await g(w(r)),await y(n,r)}),f(h`${u.successIcon()} Successfully downloaded ${u.path(r)}`)})}export{U as a,A as b,B as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-MQICT2LR.js";import{a as n}from"./chunk-ZAMDXIVC.js";import{C as p,F as s,Ga as c}from"./chunk-ATXODH6C.js";import{b as e}from"./chunk-H5C3QTOO.js";import{r as d}from"./chunk-T6CC5WUU.js";import{e as l,g as r}from"./chunk-VKWPEFWQ.js";r();var m=l(d(),1);var t,{config:b,...u}=n,o=class extends f{async run(){let{flags:a,args:i}=await this.parse(t),{app:g}=await c({directory:a.path,userProvidedConfigName:i.config});return await s(a.path),await p({directory:a.path,configName:i.config,reset:a.reset}),{app:g}}};t=o;o.summary="Activate an app configuration.";o.descriptionWithMarkdown="Sets default configuration when you run app-related CLI commands. If you omit the `config-name` parameter, then you'll be prompted to choose from the configuration files in your project.";o.description=t.descriptionWithoutMarkdown();o.usage="app config use [config] [flags]";o.flags={...e,...u};o.args={config:m.Args.string({description:"The name of the app configuration. Can be 'shopify.app.staging.toml' or simply 'staging'."})};var v=o;export{v as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{w as h}from"./chunk-
|
|
1
|
+
import{w as h}from"./chunk-6RL7FUPD.js";import{a as d}from"./chunk-HM5H7WBE.js";import{a as f}from"./chunk-ZAMDXIVC.js";import{Fa as l}from"./chunk-ATXODH6C.js";import{b as m}from"./chunk-H5C3QTOO.js";import{Lb as c,Xb as u}from"./chunk-DONEJHDG.js";import{g as n}from"./chunk-VKWPEFWQ.js";n();n();function g(p){let e=h(p),o=new Map;e.forEach(s=>{let r=s.split(".");if(r.length>=2){let i=r[0];o.has(i)||o.set(i,[]),o.set(i,[...o.get(i),s])}});for(let[s,r]of o)c(u(s,r.join(`
|
|
2
2
|
`)))}var a,t=class extends d{async run(){let{flags:e}=await this.parse(a),{app:o}=await l({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config});return o.errors.isEmpty()?g(o):process.exit(2),{app:o}}};a=t;t.summary="Print out a list of sources that may be used with the logs command.";t.descriptionWithMarkdown="The output source names can be used with the `--source` argument of `shopify app logs` to filter log output. Currently only function extensions are supported as sources.";t.description=a.descriptionWithoutMarkdown();t.flags={...m,...f};var N=t;export{N as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u}from"./chunk-
|
|
1
|
+
import{c as u}from"./chunk-J2WCMQZZ.js";import{w as c}from"./chunk-6EZ7JWBK.js";import{e as s}from"./chunk-WRRUFK4Y.js";import{$a as d}from"./chunk-DONEJHDG.js";import{q as m}from"./chunk-773TIA5M.js";import{g as f}from"./chunk-VKWPEFWQ.js";f();function o(e,n){n||c(e)}async function P(e,n,t){let r=await l(n,t);if(!r){o({body:"Environment file not found."},t?.silent);return}let a=(await u.read(r)).content.environments;if(!a){o({body:["No environments found in",{command:r},{char:"."}]},t?.silent);return}let i=a[e];if(!i){o({body:["Environment",{command:e},"not found."]},t?.silent);return}return await s(()=>({environmentFlags:JSON.stringify(i)})),i}async function l(e,n){let t=n?.from&&n.from!=="."?n.from:m();return d(e,{cwd:t,type:"file"})}export{P as a,l as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-MQICT2LR.js";import{a as g}from"./chunk-2MMGFZDP.js";import{a as y}from"./chunk-ZAMDXIVC.js";import{Ga as w,g as b}from"./chunk-ATXODH6C.js";import{b as h}from"./chunk-H5C3QTOO.js";import{O as u,t as m,v as f}from"./chunk-6EZ7JWBK.js";import{d}from"./chunk-WRRUFK4Y.js";import{r as S}from"./chunk-T6CC5WUU.js";import{e as A,g as o}from"./chunk-VKWPEFWQ.js";o();o();o();async function r(e,{web:i,stdout:t,stderr:a,signal:s,env:p={}}){let l=i.configuration.commands[e];if(!l)return;let[_,...v]=l.split(" ");await u(_,v,{cwd:i.directory,stdout:t,stderr:a,signal:s,env:p}),t.write("Web successfully built.")}async function P(e){!e.skipDependenciesInstallation&&!e.project.usesWorkspaces&&await g(e.project);let i={};e.apiKey&&(i.SHOPIFY_API_KEY=e.apiKey),await b(e.app),await m({processes:[...e.app.webs.map(t=>({prefix:["web",...t.configuration.roles].join("-"),action:async(a,s,p)=>{await r("build",{web:t,stdout:a,stderr:s,signal:p,env:i})}})),...e.app.allExtensions.map(t=>({prefix:t.localIdentifier,action:async(a,s,p)=>{await t.build({stdout:a,stderr:s,signal:p,app:e.app,environment:"production"})}}))],showTimestamps:!1}),f({headline:[{userInput:e.app.name},"built!"]})}var x=P;var I=A(S(),1);var c,n=class extends k{async run(){let{flags:i}=await this.parse(c),t=i["client-id"];await d(()=>({cmd_app_dependency_installation_skipped:i["skip-dependencies-installation"]}));let{app:a,project:s}=await w({directory:i.path,userProvidedConfigName:i.config});return await x({app:a,project:s,skipDependenciesInstallation:i["skip-dependencies-installation"],apiKey:t}),{app:a}}};c=n;n.summary="Build the app, including extensions.";n.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.";n.description=c.descriptionWithoutMarkdown();n.flags={...h,...y,"skip-dependencies-installation":I.Flags.boolean({hidden:!1,description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1})};var J=n;export{J as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
1
|
+
import{b as a}from"./chunk-45MEVWH5.js";import{Fa as i}from"./chunk-5W443CKL.js";import{b as s}from"./chunk-UKK5P74A.js";import{r as m}from"./chunk-T6CC5WUU.js";import{e as d,g as e}from"./chunk-VKWPEFWQ.js";e();var n=d(m(),1);var t=class c extends s{static{this.description="List current notifications configured for the CLI."}static{this.hidden=!0}static{this.flags={"ignore-errors":n.Flags.boolean({hidden:!1,description:"Don't fail if an error occurs.",env:"SHOPIFY_FLAG_IGNORE_ERRORS"})}}async run(){let{flags:f}=await this.parse(c);try{await a()}catch(r){let o="Error fetching notifications";if(r instanceof Error&&(o=o.concat(`: ${r.message}`)),await i(o,"expected_error"),!f["ignore-errors"])throw r}}};export{t as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fb as e,Hb as r,Pb as n,Ta as o,ua as g,wa as d}from"./chunk-
|
|
1
|
+
import{Fb as e,Hb as r,Pb as n,Ta as o,ua as g,wa as d}from"./chunk-DONEJHDG.js";import{d as i}from"./chunk-773TIA5M.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();var f=".shopify";async function E(p){let t=i(p,f),a=i(t,".gitignore"),[h,u]=await Promise.all([o(t),o(a)]);return h||(n(r`Creating hidden .shopify folder at ${e.path(t)}...`),await d(t)),u||(n(r`Creating .gitignore in ${e.path(t)}...`),await g(a,`# Ignore the entire ${f} directory
|
|
2
2
|
*`)),t}export{E as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as W,l as B}from"./chunk-
|
|
1
|
+
import{j as W,l as B}from"./chunk-KN3FTJDU.js";import{O as v,a as O}from"./chunk-6EZ7JWBK.js";import{f as h}from"./chunk-WRRUFK4Y.js";import{d as u,g as T}from"./chunk-WKBVT5WG.js";import{$a as S,Bb as L,Fb as o,Hb as s,Pb as d,Ta as w,Ua as i,Wa as D,ma as x,ua as b}from"./chunk-DONEJHDG.js";import{d as c,i as k}from"./chunk-773TIA5M.js";import{a as I}from"./chunk-CX5CC6P5.js";import{e as R,g}from"./chunk-VKWPEFWQ.js";g();g();function M(e,n){try{return JSON.parse(e)}catch(a){let r=a instanceof Error?a.message:String(a),t=n?` from ${n}`:"";throw new u(`Failed to parse JSON${t}.
|
|
2
2
|
${r}`)}}var l=R(I()),N="yarn.lock",j="package-lock.json",J="pnpm-lock.yaml",$="bun.lockb",C="bun.lock",V="pnpm-workspace.yaml",ke=[N,J,j,$,C],we={yarn:[N],npm:[j],pnpm:[J],bun:[$,C],homebrew:[],unknown:[]},E=["yarn","npm","pnpm","bun","homebrew","unknown"],_=class extends u{constructor(){super("Unknown package manager")}},y=class extends u{constructor(n){super(s`The directory ${o.path(n)} doesn't have a package.json.`)}},P=class extends T{constructor(n){super(s`Couldn't find a a package.json traversing directories from ${o.path(n)}`)}};function A(e=process.env){return e.npm_config_user_agent?.includes("yarn")?"yarn":e.npm_config_user_agent?.includes("pnpm")?"pnpm":e.npm_config_user_agent?.includes("bun")?"bun":e.npm_config_user_agent?.includes("npm")?"npm":"unknown"}function U(e){return i(c(e,$))||i(c(e,C))}function G(e){switch(e){case"yarn":case"npm":case"pnpm":case"bun":return e;case"homebrew":case"unknown":return"npm"}}function K(e,n,...a){switch(e){case"npm":return{command:"npm",args:["exec","--",n,...a]};case"pnpm":return{command:"pnpm",args:["exec",n,...a]};case"yarn":return{command:"yarn",args:["run",n,...a]};case"bun":return{command:"bun",args:["x",n,...a]}}}async function F(e){let n=e;for(d(s`Looking for a lockfile in ${o.path(n)}...`);;){if(i(c(n,N)))return"yarn";if(i(c(n,J))||i(c(n,V)))return"pnpm";if(U(n))return"bun";if(i(c(n,j)))return"npm";let r=k(n);if(r===n)break;n=r}let a=A();return a!=="unknown"?a:"npm"}async function he(e,n,...a){let r=G(await F(e));return K(r,n,...a)}async function ye(e){let n=await D(c(e.directory,"**/package.json"),{ignore:[c(e.directory,"node_modules/**/package.json")],cwd:e.directory,onlyFiles:!0,deep:e.deep}),a=new O;try{await Promise.all(n.map(async r=>{let t=k(r);await z({directory:t,packageManager:e.packageManager,stdout:void 0,stderr:void 0,signal:a.signal,args:[]})}))}catch(r){throw a.abort(),r}}async function z(e){let n={cwd:e.directory,stdin:void 0,stdout:e.stdout,stderr:e.stderr,signal:e.signal},a=["install"];e.args&&(a=a.concat(e.args)),await h("cmd_all_timing_network_ms")(async()=>{await v(e.packageManager,a,n)})}async function xe(e){return(await f(e)).name}async function be(e){return(await f(e)).version}async function H(e){let n=await f(e),a=n.dependencies??{},r=n.devDependencies??{};return{...a,...r}}async function ve(e){let n=c(e,"package.json"),a=await f(n),r=c(e,V);return!!a.workspaces||w(r)}async function Me(e,n,{cacheExpiryInHours:a=0}={}){let r=async()=>(d(s`Checking if there's a version of ${e} newer than ${n}`),ne(e)),t=`npm-package-${e}`,p;try{p=await W(t,r,a*3600*1e3)}catch{return}if(p&&new l.SemVer(n).compare(p)<0)return p}function _e(e,n){let a=`npm-package-${e}`,r=B(a)?.value;if(r&&new l.SemVer(n).compare(r)<0)return r}function Pe(e,n){return(0,l.satisfies)(e,n)}async function f(e){if(!await w(e))throw new y(k(e));return M(await x(e),e)}async function Y(e,n){d(s`Adding the following dependencies if needed:
|
|
3
3
|
${o.json(e)}
|
|
4
4
|
With options:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as c,c as u}from"./chunk-NNOSZ447.js";import{r as C}from"./chunk-T6CC5WUU.js";import{e as h,g as i}from"./chunk-VKWPEFWQ.js";i();i();import{fileURLToPath as L}from"node:url";async function f(e){let{isDevelopment:o}=await import("./local-FRYN3NWL.js"),{ShopifyConfig:n}=await import("./custom-oclif-loader-3AICQCNU.js"),t=await import("./lib-QJDPPAWN.js"),{run:a,flush:p,Errors:d,settings:m}=t.default??t;o()&&(m.debug=!0);try{let r=new n({root:L(e.moduleURL)});await r.load(),e.lazyCommandLoader&&r.setLazyCommandLoader(e.lazyCommandLoader),await a(e.argv,r),await p()}catch(r){let{errorHandler:l}=await import("./error-handler-SW2ALZ5Z.js");return await l(r),d.handle(r)}}var s=h(C());async function y(e=process.versions){let o=e.node,n=Number(o.split(".")[0]);if(n<18){let{renderError:a}=await import("./ui-QOGKADWB.js");a({headline:"Upgrade to a supported Node version now.",body:[`Node ${n} has reached end-of-life and poses security risks. When you upgrade to a`,{link:{url:"https://nodejs.dev/en/about/previous-releases",label:"supported version"}},{char:","},"you'll be able to use Shopify CLI without interruption."]}),process.exit(1)}}function I(e,o=process.argv,n=process.env){o.includes("--verbose")&&(n.DEBUG=n.DEBUG??"*"),e.development&&(n.SHOPIFY_CLI_ENV=n.SHOPIFY_CLI_ENV??"development")}function b(e=process.argv,o=process.env){(e.includes("--no-color")||e.includes("--json")||e.includes("-j")||c(o.NO_COLOR)||c(o.SHOPIFY_FLAG_NO_COLOR)||c(o[u.json])||o.TERM==="dumb")&&(o.FORCE_COLOR="0")}async function _(e,o=f,n=process.argv,t=process.env,a=process.versions){return I(e,n,t),e.runInCreateMode&&await O(e,n),b(n,t),await y(a),o({moduleURL:e.moduleURL,lazyCommandLoader:e.lazyCommandLoader})}async function O(e,o=process.argv){let{findUpAndReadPackageJson:n}=await import("./node-package-manager-LVFBY4LY.js"),{moduleDirectory:t}=await import("./path-MBXP7ZIC.js"),d=(await n(t(e.moduleURL))).content.name.replace("@shopify/create-","");if(o.findIndex(r=>r.includes("init"))===-1){let r=o.findIndex(l=>l.match(new RegExp(`bin(\\/|\\\\)+(create-${d}|dev|run)`)))+1;o.splice(r,0,"init")}}var F={"no-color":s.Flags.boolean({hidden:!1,description:"Disable color output.",env:"SHOPIFY_FLAG_NO_COLOR"}),verbose:s.Flags.boolean({hidden:!1,description:"Increase the verbosity of the output.",env:"SHOPIFY_FLAG_VERBOSE"})},E={json:s.Flags.boolean({char:"j",description:"Output the result as JSON. Automatically disables color output.",hidden:!1,default:!1,env:u.json})},S=(e={})=>{let o=[e.description,"Must be between 1 and 65535."].filter(Boolean).join(" ");return s.Flags.integer({min:1,max:65535,...e,description:o})};async function j(){let{cacheClear:e}=await import("./conf-store-C2LOYIOU.js");e()}export{_ as a,F as b,E as c,S as d,j as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as u}from"./chunk-BCD4KTLJ.js";import{a as y}from"./chunk-VOJWKGCW.js";import{a as w}from"./chunk-QMXKGSFH.js";import{a as c,b as v}from"./chunk-STJ3LWFL.js";import{p as d,v as f}from"./chunk-D6YDSGR4.js";import{b as s}from"./chunk-H5C3QTOO.js";import{J as h,u as p}from"./chunk-6EZ7JWBK.js";import{r as O}from"./chunk-T6CC5WUU.js";import{e as I,g as m}from"./chunk-VKWPEFWQ.js";m();m();async function F(o,t){let i=new u(o),E=(await(t.development?i.find():i.fetch()))?.id,n=await y(o,{header:"Select a theme to open",filter:{live:t.live,theme:t.development?`${E}`:t.theme}}),l=c(n,o),a=v(n,o);p({body:["Preview information for theme",...w(n),`
|
|
2
2
|
|
|
3
3
|
`,{list:{items:[{link:{label:"Preview your theme",url:l}},{link:{label:"Customize your theme at the theme editor",url:a}}]}}]}),t.editor?await h(a):await h(l)}var r=I(O(),1);var g,e=class extends f{async command(t,i){await F(i,t)}};g=e;e.summary="Opens the preview of your remote theme.";e.descriptionWithMarkdown=`Returns links that let you preview the specified theme. The following links are returned:
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u,c as h,f}from"./chunk-
|
|
1
|
+
import{b as u,c as h,f}from"./chunk-ATXODH6C.js";import{O as c}from"./chunk-6EZ7JWBK.js";import{d as e}from"./chunk-773TIA5M.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();async function s(n){if(n.features.includes("function")&&n.isJavaScript){let r=await f(n);return u(r.functionRunner)}return u()}function d(n){return n.configuration.build?.path?e(n.directory,n.configuration.build.path):n.outputPath}async function g(n){let r=n.functionExtension,i=await s(r);await h(i);let t=[];n.inputPath&&t.push("--input",n.inputPath),n.export&&t.push("--export",n.export),n.json&&t.push("--json"),n.schemaPath&&n.queryPath&&(t.push("--schema-path",n.schemaPath),t.push("--query-path",n.queryPath));let o=d(r);return c(i.path,["-f",o,...t],{cwd:n.functionExtension.directory,stdin:n.stdin,stdout:n.stdout??"inherit",stderr:n.stderr??"inherit",input:n.input})}export{g as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as C}from"./chunk-
|
|
1
|
+
import{b as C}from"./chunk-47MGPVED.js";import{b as f}from"./chunk-UKK5P74A.js";import{A as S,u as i,y as x}from"./chunk-6EZ7JWBK.js";import{d as v}from"./chunk-WKBVT5WG.js";import{Pb as I}from"./chunk-DONEJHDG.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();a();a();var m={on:"Autocorrect on. The system will automatically run commands even when you mistype them.",off:"Autocorrect off. You'll need to confirm corrections for mistyped commands."};a();function p(o=W()){return!!o.get("autocorrectEnabled")}function y(o,n=W()){n.set("autocorrectEnabled",o)}function W(){return b??(b=new C({projectName:"did-you-mean"})),b}var b;var A,s=class extends f{async run(){y(!0),i({body:m.on})}};A=s;s.summary="Enable autocorrect. Off by default.";s.descriptionWithMarkdown=`Enable autocorrect. Off by default.
|
|
2
2
|
|
|
3
3
|
When autocorrection is enabled, Shopify CLI automatically runs a corrected version of your command if a correction is available.
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-UMT7DWR4.js";import{g as e}from"./chunk-VKWPEFWQ.js";e();var t=class extends o{};export{t as a};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{a as qr}from"./chunk-KSZ5K6LJ.js";import{a as Mt}from"./chunk-UOHNRH6E.js";import{a as Ir}from"./chunk-H6WN7GP4.js";import{a as Lr}from"./chunk-Z4LC3WE5.js";import{a as Mr}from"./chunk-4TST2MNC.js";import{a as kr}from"./chunk-J7UQBC45.js";import{a as Dr}from"./chunk-X4DIJTIK.js";import{b as Fr}from"./chunk-TKG42KLM.js";import{a as Or}from"./chunk-MFLQRQQT.js";import{a as Nr}from"./chunk-B7S23DLF.js";import{a as Pr}from"./chunk-FA4K3JRN.js";import{a as Er}from"./chunk-NADNFSKS.js";import{a as br}from"./chunk-PZYP3MCL.js";import{a as Sr}from"./chunk-DO2SHYFU.js";import{a as Ur}from"./chunk-6DIHOMCB.js";import{a as Rr}from"./chunk-LOHUNOQ7.js";import{a as Tr,b as Ar,c as _r,d as Cr}from"./chunk-OORCODNK.js";import{a as $r}from"./chunk-DQ4HA72R.js";import{g as xr}from"./chunk-2NWWMNU5.js";import{a as Lo,b as ko}from"./chunk-733R5OKQ.js";import{a as gr}from"./chunk-YGKQCEVG.js";import{a as vr}from"./chunk-HZSAUZBX.js";import{a as gt}from"./chunk-J3HXFQ2L.js";import{a as yr}from"./chunk-CZXGQ53M.js";import{c as ht,m as wt}from"./chunk-6YPEONHB.js";import{b as wr,g as je,j as ft}from"./chunk-PJYNAUQB.js";import{c as Yo}from"./chunk-NWDP5IZ2.js";import{a as fr,b as hr,c as Ye,d as Co,e as Pt,f as Io,g as Do}from"./chunk-CPE7XCC6.js";import{a as O,b as mt}from"./chunk-O6KTFMCD.js";import{a as cr,b as lr,d as Ee,f as pr,m as Ge,n as ee,s as W,u as ur,v as dr,w as mr}from"./chunk-Q7BOSHWX.js";import{c as Wr}from"./chunk-G2I2ZUBV.js";import{a as ir}from"./chunk-ZEENHLSC.js";import{a as bo,b as vt,c as te,d as So}from"./chunk-5JNEWYD5.js";import{a as $o,f as Mo,g as Fo,h as xt,i as Oo,j as No,k as qo,l as Wo,m as Ho,n as Bo,o as Go,p as jo,q as Ko,v as zo,x as Vo,z as Et}from"./chunk-6RL7FUPD.js";import{a as Uo,b as Ro,c as To,d as Ao,e as _o}from"./chunk-73W5BGAZ.js";import{a as Br}from"./chunk-2MMGFZDP.js";import{a as Eo}from"./chunk-JOZXRV5K.js";import{a as xo}from"./chunk-HM5H7WBE.js";import{a as Hr}from"./chunk-ZAMDXIVC.js";import{a as Qe}from"./chunk-U73TPLFE.js";import{Aa as Ve,F as no,Fa as Po,H as so,J as fe,R as ao,U as uo,V as mo,Z as fo,aa as ho,fa as go,g as Gr,i as Kr,ia as wo,j as zr,ja as yo,k as J,ka as vo,l as Vr,n as Yr,o as Qr,r as yt,s as Jr,u as Xr,v as Zr,w as eo,x as to,y as ro,z as oo,za as ze}from"./chunk-ATXODH6C.js";import{O as io,P as co,Z as lo,ca as po,e as Ke,j as be,p as jr}from"./chunk-442S5SDM.js";import{c as sr}from"./chunk-J2WCMQZZ.js";import{a as H}from"./chunk-J5TNYNR5.js";import{$ as Yt,N as Vt,Z as de,a as Wt,c as Ht,h as Bt,l as Gt,n as jt,q as Kt,t as zt,ta as Qt,u as ke,z as De}from"./chunk-5W443CKL.js";import{b as ar,d as Be}from"./chunk-H5C3QTOO.js";import{a as lt,c as qt}from"./chunk-5C7HDTHJ.js";import{D as Ne,H as Zt,J as Z,O as qe,P as xe,Q as dt,R as tr,T as rr,a as Nt,i as pt,j as $e,k as M,l as F,m as Me,n as ut,o as Xt,p as Fe,u as Oe,w as ne}from"./chunk-6EZ7JWBK.js";import{a as Zn}from"./chunk-7UNQOKZW.js";import{d as Jt}from"./chunk-WRRUFK4Y.js";import{d as _,g as me,l as er}from"./chunk-WKBVT5WG.js";import{$a as ve,Ea as Dt,Fb as U,Gb as nr,Hb as R,Mb as Q,Na as Ie,Pb as y,Q as ct,Qb as k,Ta as X,Wa as Le,cb as $t,eb as Pe,fb as L,gb as S,jb as le,kb as pe,ma as I,mb as Ft,nb as Ot,tb as ue,ua as _e,wa as Ce}from"./chunk-DONEJHDG.js";import{d as or,f as We,j as He}from"./chunk-KKUDXLK2.js";import{a as Re}from"./chunk-NNOSZ447.js";import{d as T,f as it,g as Te,i as ce,j as Lt,k as Ae,o as kt,p as ye}from"./chunk-773TIA5M.js";import{r as Xn}from"./chunk-T6CC5WUU.js";import{e as oe,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var es=300*1e3,ts='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 Qo(t,e,r=Date.now()){for(;await rs(t,e,r););}async function rs(t,e,r){let o=await je(t,e);if(!o||os(o,r))throw new _(ts);return await xe(3),o.processing}function os(t,e){return t.processing&&Date.now()-e>=es}var ns="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",ss="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",bt=3,Je=class extends yr{constructor(e,r={devPreview:!1}){super(e),this.context="App Ext. Host",this.themeId=Tr(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??(e=this.devPreview?await this.createHostTheme():await this.create()),e}setTheme(e){Ar(this.adminSession.storeFqdn,e)}removeTheme(){_r(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:wr,name:this.generateThemeName(this.context),src:ns};for(let o=0;o<bt;o++){y(`Attempt ${o}/${bt}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await ft(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),y(`Waiting for theme with id "${n.id}" to be processed`),await Qo(n.id,this.adminSession),n;throw new Error}catch{y(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}y(`Theme creation failed after ${bt} retries. Creating theme using fallback theme zip`);let r=await ft({...e,src:ss},this.adminSession);if(!r)throw y("Theme creation failed. Exiting process."),new me(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var as={"theme:init":Ur,"theme:check":gr,"theme:console":vr,"theme:delete":Pr,"theme:dev":Er,"theme:duplicate":br,"theme:info":Sr,"theme:language-server":Rr,"theme:list":Cr,"theme:metafields:pull":$r,"theme:open":Ir,"theme:package":Lr,"theme:profile":kr,"theme:publish":Dr,"theme:preview":Mr,"theme:pull":Fr,"theme:push":Or,"theme:rename":Nr,"theme:share":qr},oi=as;async function Jo(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(v=>v.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[l,u]=await Promise.all([Vt(t.storeFqdn),ls(e)]),c=l.storeFqdn,[m,h]=await Promise.all([wt(l),ht(l)]),g=h?await gt(void 0,c,m):void 0,d=await cs(l,t.theme),f=d.id.toString();return Oe({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:u}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${c}/admin/themes/${f}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:is,options:{theme:d,adminSession:l,storefrontPassword:g,crawlerSignatureHeaders:m,themeExtensionDirectory:a,themeExtensionPort:i}}}var is=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await xr(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function cs(t,e){let r;if(e)y(`Fetching theme with provided id ${e}`),r=await je(parseInt(e,10),t);else{let o=new Je(t,{devPreview:!0});await Ne([{title:"Configuring host theme for theme app extension",task:async()=>{y("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new _("Could not find or create a host theme for theme app extensions");return r}async function ls(t){return t.developerPlatformClient?.clientName===lo.AppManagement?`https://${await ke()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await zt()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function ps(t){let e=T(t.directory,"locales");return Le([T(e,"*.json")])}async function Xo(t,e){let r=await ps(t);if(!r.length)return{localization:void 0,status:""};let o=e.currentLocalizationPayload??{defaultLocale:"en",translations:{},lastUpdated:0},n="success";try{await Promise.all(r.map(async s=>{let[a,...i]=s.split("/").pop().split(".");if(a)return i[0]==="default"&&(o.defaultLocale=a),us(a,s,o,t,e)})),o.lastUpdated=Date.now(),y(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function us(t,e,r,o,n){let s;try{s=await I(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw k(i,n.stderr),new er.ExtendableError(i)}}p();function Xe(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}async function he(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 Xo(t,r),l=await Vr(t),u=t.outputRelativePath?ce(n):n,c=await ds(t,s,u,o),m=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(m=t.configuration.metafields),{assets:{main:Se(c)&&c[0]?.assets?.main?c[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await Ie(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:Xe(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:c,localization:a??null,metafields:m,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:l?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function ds(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"}]),Se(s)){let a=await ms(r);return Promise.all(s.map(async i=>{let{target:l,resource:u}=i,c={...i,surface:Ve(l),root:{url:`${e}/${l}`},resource:u||{url:""}},m=a?.[l];if(!m)return c;let g=await ys(m,{target:l,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...c,...g}}))}return s}async function ms(t){try{let e=T(t,"manifest.json"),r=await I(e);return JSON.parse(r)}catch(e){if(e instanceof SyntaxError)throw new Error(`Invalid manifest.json in ${t}: ${e.message}`);return null}}async function fs({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,l=e[s];if(typeof l=="string"){let g=await Ze(s,i,typeof a=="string"?a:l,r,o,n,typeof a=="string"?l:void 0);return{assets:{[g.name]:g}}}let c=e.build_manifest?.assets?.[s];if(c?.filepath){let m=await Ze(s,i,c.filepath,r,o,n,c.module);return{assets:{[m.name]:m}}}return{}}async function hs({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 Ie(T(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function gs({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,l)=>{let u=i.schema,c=s[l]?.schema,m=typeof c=="string"?c:u,h=typeof c=="string"?u:void 0;return{...i,schema:await Ze("schema",`${t}/intents/${l}/schema`,m,r,o,n,h)}}))}:{}}async function ws({target:t,url:e,extension:r,resolver:o},n,s){let a=await Ze(n,`${t}/${n}`,s,e,r,o);return{assets:{[a.name]:a}}}async function ys(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return vs(o,n)?gs(e,n):Ps(o,n)?ws(e,o,n):xs(o,n)?hs(e,o,n):fs(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function Se(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Ze(t,e,r,o,n,s,a){let i=`${e}${Ae(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await Ie(T(n.directory,a??r))??0}}function vs(t,e){return t==="intents"&&Array.isArray(e)}function Ps(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function xs(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as Es}from"events";var Ue;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(Ue||(Ue={}));async function Zo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:Ye(t.storeFqdn,t.apiKey),mobileUrl:Io(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=>he(n,e,t,r&&St(r,n.devUUID))))}}function St(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var et=class extends Es{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=de(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(Se(n.extensionPoints)&&Se(o.extensionPoints)){let s=n.extensionPoints.reduce((l,u)=>({...l,[u.target]:u}),{});o.extensionPoints=de(o.extensionPoints,n.extensionPoints,l=>l.map(u=>{let c=s[u.target];return c?de(u,c,(m,h)=>h):u}));let{extensionPoints:a,...i}=n;return de(o,i)}return de(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){y(R`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await he(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},St(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 he(e,r,this.options,St(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(Ue.Update,e)}};p();p();var se;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(se||(se={}));function en(t,e){return(r,o,n)=>{r.url==="/extensions"&&(y("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,bs(t,e)))}}function bs(t,e){return r=>{y("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};y(R`Sending connected payload: ${U.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",As(t,e))}}function Ss(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?U.json(o).output():String(o)).join(" ");return R`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var Us={debug:t=>U.gray(t),warn:t=>U.yellow(t),error:t=>U.errorText(t)};function Rs({type:t,message:e}){let r=Ss(e);switch(t){case"debug":case"warn":case"error":return R`${Us[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function Ts(t,e){F({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(Rs(t))})}function As(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(y(R`Received websocket message with event type ${n} and data:
|
|
2
|
+
${U.json(s)}
|
|
3
|
+
`,e.stdout),n===se.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===se.Dispatch){let a=_s(o,e);rn(t,a,e)}else n===se.Log&&Ts(s,e)}}function tn(t,e){return r=>{let o={event:se.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};y(R`Sending websocket update event to the websocket clients:
|
|
4
|
+
${U.json(o)}
|
|
5
|
+
`,e.stdout),rn(t,o,e)}}function rn(t,e,r){y(R`Sending websocket with event type ${e.event} and data:
|
|
6
|
+
${U.json(e.data)}
|
|
7
|
+
`,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function _s(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var Cs=10;function on(t){let e=new Mt.default({noServer:!0,clientTracking:!0}),r=Is(e);return t.httpServer.on("upgrade",en(e,t)),t.payloadStore.on(Ue.Update,tn(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function Is(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},Cs*1e3)}p();p();p();function nn(t,e){let{url:r}=Xe(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",tt(t,e)),o.toString()}}function sn(t,e,r){let o=Ve(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",tt(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=Ls(e,r,t);break;default:return}return n.toString()}function Ls(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,s="shopify.com",a=new URL(`https://${s}/${n}/account/extensions-development`);return a.searchParams.append("origin",o),a.searchParams.append("extensionId",t.devUUID),a.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),a.searchParams.append("appId",e.id??""),r!==""&&a.searchParams.append("target",r),a}function tt(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function B(t,e){lr(t,cr(e))}p();var Ut=class extends me{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function an(t){let e=await ks(t),r=await I(e);return ir(r,t.data)}async function ks(t){let e=await Ds(),r=[];t.extensionSurface&&r.push(T(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(T(e,`${t.template}.html.liquid`));let o=await Le(r);if(o.length===0)throw new Ut(t);return o[0]}async function Ds(){return await ve("templates/ui-extensions/html",{type:"directory",cwd:ye(import.meta.url)})}var cn=W(t=>{ee(t,"Access-Control-Allow-Origin","*"),ee(t,"Access-Control-Allow-Methods","GET, OPTIONS"),ee(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),ln=W(t=>{ee(t,"Cache-Control","no-cache")}),pn=W(async t=>Ge(t,"/extensions/dev-console",307));async function Rt(t,e){let{filePath:r}=e;if(!await X(r))return B(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Dt(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await X(r)))return B(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await I(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},s=Ae(r),a=n[s]||"text/plain";return ee(t,"Content-Type",a),o}function un({getExtensions:t,payloadStore:e}){return W(async r=>{let{extensionId:o,assetPath:n=""}=Ee(r),s=t().find(c=>c.devUUID===o);if(!s)return B(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n)??n,l=it(Yr(s.outputPath)),u=it(T(l,i));return kt(l,u)?Rt(r,{filePath:u}):B(r,{statusCode:404,statusMessage:"Not Found"})})}function Tt({payloadStore:t}){return W(e=>(ee(e,"content-type","application/json"),t.getRawPayload()))}var dn=W(async t=>{let e=await ve(T("assets","dev-console"),{type:"directory",cwd:ye(import.meta.url)});return e?Rt(t,{filePath:e}):B(t,{statusCode:404,statusMessage:"Could not find root directory for dev console"})}),mn=W(async t=>{let{assetPath:e=""}=Ee(t),r=await ve(T("assets","dev-console","extensions","dev-console","assets"),{type:"directory",cwd:ye(import.meta.url)});return r?Rt(t,{filePath:T(r,e)}):B(t,{statusCode:404,statusMessage:"Could not find root directory for dev console asset"})});function fn({devOptions:t}){return W(e=>{y(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function At({devOptions:t,getExtensions:e}){return W(async r=>{let{extensionId:o}=Ee(r),n=e().find(i=>i.devUUID===o);if(!n)return B(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(pr(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return an({data:{url:tt(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=nn(n,t);return Ge(r,i,307)}}let a=t.appWatcher.buildOutputPath;return ee(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:ge(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await he(n,a,t)}})}function hn({devOptions:t,getExtensions:e}){return W(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Ee(r),s=e().find(i=>i.devUUID===o);if(!s)return B(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return B(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=sn(n,s,t);return a?Ge(r,a,307):B(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as $s}from"http";function gn(t){let e=ur(),r=dr();e.use(fn(t)),e.use(cn),e.use(ln),r.use("/extensions/dev-console",dn),r.use("/extensions/dev-console/assets/**:assetPath",mn),r.use("/extensions/:extensionId",At(t)),r.use("/extensions/:extensionId/",At(t)),r.use("/extensions/:extensionId/:extensionPointTarget",hn(t)),r.use("/extensions/:extensionId/assets/**:assetPath",un(t)),r.use("/extensions",Tt(t)),r.use("/extensions/",Tt(t)),r.use("/",pn),e.use(r);let o=$s(mr(e));return o.listen(t.devOptions.port,"localhost"),o}async function wn(t){let e={...t,websocketURL:ge(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Zo(e,r,o),s=new et(n,e,o),a=e.extensions.filter(m=>m.isPreviewable),i=()=>a;y("Setting up the UI extensions HTTP server...",e.stdout);let l=gn({devOptions:e,payloadStore:s,getExtensions:i});y("Setting up the UI extensions Websocket server...",e.stdout);let u=on({...e,httpServer:l,payloadStore:s});y("Setting up the UI extensions bundler and file watching...",e.stdout);let c=async({appWasReloaded:m,app:h,extensionEvents:g})=>{m&&(a=h.allExtensions.filter(d=>d.isPreviewable));for(let d of g){if(!d.extension.isPreviewable)continue;let f=d.buildResult?.status==="ok"?"success":"error",v=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case te.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl){let E=await ze(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(d.extension,r);break;case te.Updated:await s.updateExtension(d.extension,e,r,{status:f,error:v});break;case te.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==d.extension.devUUID),await s.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(c).onStart(c),e.signal.addEventListener("abort",()=>{y("Closing the UI extensions dev server..."),u.close(),l.close()})}function ge(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var Ms="3",Fs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:l,proxyUrl:u,appName:c,appDotEnvFile:m,appId:h,grantedScopes:g,allExtensions:d,appDirectory:f,appWatcher:v})=>{await wn({appName:c,appDotEnvFile:m,appDirectory:f,id:h,extensions:d,stdout:e,stderr:t,signal:r,url:u,port:i,storeFqdn:De(n),storeId:s,apiKey:o,grantedScopes:g,checkoutCartUrl:l,subscriptionProductUrl:a,manifestVersion:Ms,appWatcher:v})};async function yn({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await ze(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:Fs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();p();async function vn(t){let e={},r=await Qr(t);return await Promise.all(r.map(async o=>{let n=Te(t.directory,o),a=ce(n)==="assets"?"binary":"utf8",i=await I(o,{encoding:a});e[n]=Buffer.from(i,a).toString("base64")})),{theme_extension:{files:e}}}async function Pn({extension:t,developerPlatformClient:e,apiKey:r,registrationId:o,stdout:n,stderr:s,appConfiguration:a,bundlePath:i}){let l,u=t.getOutputPathForDirectory(i);if(t.features.includes("esbuild")){let v=await I(u);if(!v)return;l=Buffer.from(v).toString("base64")}let c;t.isThemeExtension?c=await vn(t):c=await t.deployConfig({apiKey:r,appConfiguration:a})??{};let m={...c,serialized_script:l};if(t.isFunctionExtension){let v=await I(t.outputPath,{encoding:"base64"});m.uploaded_files={"dist/index.wasm":v}}let h={apiKey:r,config:JSON.stringify(m),handle:t.handle,context:t.contextValue,registrationId:o},g,d=[];try{g=await e.updateExtension(h)}catch(v){if(d=[{message:"Unknown error"}],v&&typeof v=="object"){let E=v;E.errors?.length?d=E.errors:E.message&&(d=[{message:E.message}])}else typeof v=="string"&&(d=[{message:v}])}let f=g?.extensionUpdateDraft?.userErrors;if(f?.length&&d.push(...f),d.length>0){let v=d.map(E=>E.message).join(", ");s.write(`${t.draftMessages.errorMessage}: ${v}`)}else{let v=t.draftMessages.successMessage;v&&Q(v,n)}}var Os=async({stderr:t,stdout:e},{developerPlatformClient:r,apiKey:o,remoteExtensionIds:n,localApp:s,appWatcher:a})=>{await Gr(s);let i=s.draftableExtensions.map(u=>u.handle),l=async u=>{let m=u.extensionEvents.filter(h=>h.type===te.Updated).filter(h=>h.buildResult?.status==="ok").filter(h=>i.includes(h.extension.handle)).map(async h=>{let g=h.extension,d=n[g.localIdentifier];if(!d)throw new _(`Extension ${g.localIdentifier} not found on remote app.`);await F({outputPrefix:g.outputPrefix},async()=>{await Pn({extension:g,developerPlatformClient:r,apiKey:o,registrationId:d,stdout:e,stderr:t,appConfiguration:s.configuration,bundlePath:a.buildOutputPath})})});await Promise.all(m)};a.onEvent(l).onStart(l)};async function xn({localApp:t,apiKey:e,developerPlatformClient:r,remoteApp:o,...n}){let s=t.draftableExtensions;if(s.length===0)return;let a=ho({app:t}),{extensionIds:i,extensions:l}=await fo({app:t,remoteApp:o,appId:e,appName:o.title,force:!0,release:!0,developerPlatformClient:r,envIdentifiers:a,includeDraftExtensions:!0});return t.updateExtensionUUIDS(l),{type:"draftable-extension",prefix:"extensions",function:Os,options:{localApp:t,apiKey:e,developerPlatformClient:r,...n,extensions:s,remoteExtensionIds:i}}}p();p();function ae(t){let e=t.find(o=>fe(o,J.Frontend)),r=t.find(o=>fe(o,J.Backend));return{frontendConfig:e,backendConfig:r}}p();async function En(t){let r={topic:"app/uninstalled",api_version:(await co(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:ko.LOCALHOST,shared_secret:t.sharedSecret},o=await io(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await xe(3);let n=await Ns(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function Ns(t,e){let r=0;for(;r<3;){try{return await Lo(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof Gt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await xe(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var qs=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 bn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=ae(t),l=t.map(({configuration:c})=>c.webhooks_path).find(c=>c)??"/api/webhooks";if(l&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:qs,options:{deliveryPort:a?r:o,webhooksPath:l,organizationId:n,...s}}}p();async function Sn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Ws}}var Ws=async({stdout:t,abortSignal:e},r)=>{let o=Do({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=hr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",async()=>{n.close()})};p();async function Rn({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=ae(t),l=i?.configuration.hmr_server?await O():void 0,u=void 0,c=t.map(async m=>{let h=await Hs({web:m,frontendPort:r,backendPort:o}),g=l&&m.configuration.roles.includes(J.Frontend)?{port:l,httpPaths:m.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:m.configuration.name??["web",...m.configuration.roles].join("-"),function:Bs,options:{port:h,portFromConfig:m.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:m.directory,devCommand:m.configuration.commands.dev,preDevCommand:m.configuration.commands.predev,scopes:a,shopCustomDomain:u,hmrServerOptions:g,roles:m.configuration.roles}}});return Promise.all(c)}async function Hs({web:t,frontendPort:e,backendPort:r}){return fe(t,J.Frontend)?e:fe(t,J.Backend)?r:O()}async function Bs({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:l,directory:u,devCommand:c,preDevCommand:m,scopes:h,shopCustomDomain:g,hmrServerOptions:d}){let f=d?.port,v={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:h,NODE_ENV:"development",...g&&{SHOP_CUSTOM_DOMAIN:g},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${l}`,...f&&{HMR_SERVER_PORT:`${f}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:u,port:o,env:v,stdout:t,stderr:e};m&&(t.write(`Running pre-dev command: "${m}"`),await Un({...E,command:m,showOutput:or()})),await Un({...E,command:c,showOutput:!0})}async function Un({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let l=t.split("&&").map(u=>u.trim())??[];for(let u of l){let[c,...m]=u.split(" ");c?.length!==0&&await qe(c,m,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var rt=class{constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(R`${U.yellow(e)}`.value)}async success(e){await this.log(R`${U.green(e)}`.value)}async debug(e){y(e,this.stdout)}async error(e,r){let o=U.errorText("\u274C Error"),n=U.errorText(`\u2514 ${e}`);await this.log(R`${o}`.value,r),await this.log(R`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e){if(!e)return;let r=e.extensionEvents??[],n=(await Promise.all(r.map(async a=>a.type===te.Deleted?[]:(await a.extension.getDevSessionUpdateMessages())?.map(l=>({message:l,prefix:a.extension.handle}))??[]))).flat(),s=n.map((a,i)=>{let l=R`${U.gray(i===n.length-1?"\u2514 ":"\u2502 ")}${a.message}`.value;return this.log(l,a.prefix)});await Promise.all(s)}async logMultipleErrors(e){let r=U.errorText("\u274C Error");await this.log(R`${r}`.value,"app-preview");let o=e.map(n=>{let s=U.errorText(`\u2514 ${n.error}`);return this.log(R`${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 ot=class{constructor(e){this.processBatch=e,this.queue=[],this.processingPromise=void 0}enqueue(e){this.queue.push(e),this.processingPromise??(this.processingPromise=this.startProcessing())}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var nt=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}constructor(e,r){this.failedEvents=[],this.currentSessionState=null,this.statusManager=e.devSessionStatusManager,this.logger=new rt(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new ot(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=bo(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${vt(n)}ms - Total: ${vt(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 _(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR"),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){e.status==="updated"?(await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r),await this.setUpdatedStatusMessage()):e.status==="created"?(this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r),this.statusManager.setMessage("READY")):e.status==="aborted"?await this.logger.debug("\u274C Dev preview update aborted (new change detected or error during update)"):(e.status==="remote-error"||e.status==="unknown-error")&&(await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR"):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR"))),!this.statusManager.status.isReady&&!We()&&setImmediate(()=>{throw new _("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.allExtensions.filter(a=>a.isPreviewable).length>0,n=He()&&r?this.options.appLocalProxyURL:this.options.appPreviewURL,s=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:n,appEmbedded:e.app.configuration.embedded,hasExtensions:s})}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=ge(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new Error("Unauthorized");if(r instanceof Bt)throw r.response.status===401||r.response.status===403?new _("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new _("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await Uo(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await $t(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=T(ce(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...Ro];r&&n.push("manifest.json"),await To(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await Ao(s,o),s}async getSignedURLWithRetry(){return _o(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.devSession;if(n&&this.currentSessionState){let s=ge(this.options.url),a=this.currentSessionState?.userId;if(n.websocketUrl!==s||n.user?.id!==a){let i=n.user?.email;await this.logger.error(`Another developer ${i?`(${i}) `:""}has taken ownership of this dev preview.`);let l=`Another user${i?` (${i})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,u=["You can restart by running",{command:"shopify app dev"},"again."];throw new _(l,u)}this.currentSessionState={websocketUrl:n.websocketUrl,userId:n.user?.id??null,userEmail:n.user?.email??null}}return o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await Promise.all(n.map(a=>{let i=a.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${a.message}`:a.message;return this.logger.warning(i)})),o.length?{status:"remote-error",error:o}:{status:"created"}}};async function Tn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:Gs,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var Gs=async({stdout:t},e)=>{await nt.start(e,t)};p();p();p();var An=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=qt().substring(0,6),i=`${js(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,l=Vo({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),u=T(n,i);try{return await Ce(n),await _e(u,l),{fullOutputPath:u,identifier:s}}catch(c){throw r.write(`Error while writing log to file: ${c}
|
|
8
|
+
`),c}};function js(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),s=e.getUTCHours().toString().padStart(2,"0"),a=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),l=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${l}Z`}var st=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:u=0})=>{if(!i?.aborted)try{let c=e,m=Fo,h=u,g=await o.appLogs({jwtToken:e,cursor:r},a),{errors:d,status:f}=g;if(f===200){h=0;let{app_logs:E}=g;for(let A of E){let P=JSON.parse(A.payload);await F({outputPrefix:A.source,stripAnsi:!1},async()=>{A.log_type===qo?(Ks(A,P,t),P=new $o(Mo(P))):A.log_type.startsWith(Wo)?zs(A,P,t):t.write(JSON.stringify(P));let D=await An({appLog:A,appLogPayload:P,stdout:t,storeName:s,logsDir:l});t.write(R`${U.gray("\u2514 ")}${U.link("Open log file",`file://${D.fullOutputPath}`,`Log: ${D.fullOutputPath}`)} ${U.gray(`(${D.identifier})`)}\n`.value)})}}else{let E={errors:d.map(P=>({message:P,status:f}))},A=await zo({response:E,onThrottle:P=>{k("Request throttled while polling app logs.",t),k(`Retrying in ${P/1e3} seconds.`,t)},onUnknownError:P=>{k("Error while polling app logs.",t),k(`Retrying in ${P/1e3} seconds.`,t)},onResubscribe:()=>n()});if(A.resubscribeResult==="failed"){if(h+=1,h>=Oo){k("App log streaming session has expired. Please restart your dev session.",t);return}}else A.resubscribeResult==="succeeded"&&(h=0);A.nextJwtToken&&(c=A.nextJwtToken),m=A.retryIntervalMs}let{cursor:v}=g;setTimeout(()=>{st({stdout:t,appLogsFetchInput:{jwtToken:c,cursor:v??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:h}).catch(E=>{y(`Unexpected error during polling: ${E}}
|
|
9
|
+
`)})},m)}catch(c){k("Error while polling app logs.",t),k(`Retrying in ${xt/1e3} seconds.`,t),y(`${c}}
|
|
10
|
+
`),setTimeout(()=>{st({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l}).catch(m=>{y(`Unexpected error during polling: ${m}}
|
|
11
|
+
`)})},xt)}};function Ks(t,e,r){let o=(e.fuel_consumed/No).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=>R`${U.gray("\u2502 ")}${s}`.value).join(`
|
|
13
|
+
`))}function zs(t,e,r){t.log_type===Ho?r.write("Function network access response retrieved from cache."):t.log_type===Bo?e.reason===jo?r.write("Function network access request executing in background because there is no cached response."):e.reason===Ko&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===Go&&(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 Vs(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function _n({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:Ys,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var Ys=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:l})=>{async function u(c){let m=await Et(o,n,a,t),h=l.getLogsDir();await Ce(h),await st({stdout:t,appLogsFetchInput:{jwtToken:m},resubscribeCallback:()=>Et(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:c,logsDir:h})}try{let c=!1,m,h=async g=>{let d=Vs(g.app);if(d&&!c){y("Function extensions detected, starting logs polling"),c=!0,m=new AbortController;try{await u(m.signal)}catch(f){y(`Failed to start function logs: ${f}`,e)}}else!d&&c&&(y("No function extensions detected, stopping logs polling"),c=!1,m?.abort(),m=void 0)};i.onStart(h).onEvent(h)}catch{}};p();async function Cn(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:Qs}}var Qs=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};p();import{EventEmitter as Js}from"events";var Xs={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},at=class extends Js{constructor(e){super(),this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0},e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};Yt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e){this.updateStatus({statusMessage:Xs[e]})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};p();import*as In from"http";import*as Ln from"https";function kn(t){return"errors"in t&&Array.isArray(t.errors)}async function Dn(t,e,r,o){let s=(await import("./http-proxy-node16-X2WAMUT5.js")).default.createProxyServer(),a=ea(t,s,o),i=r?Ln.createServer(r,a):In.createServer(a);return i.on("upgrade",Zs(t,s,o)),e.addEventListener("abort",()=>{y("Closing reverse HTTP proxy"),i.close()}),{server:i}}function Zs(t,e,r){return function(o,n,s){let a=$n(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let u=(kn(i)?i.errors[i.errors.length-1]:void 0)??i;k(`Error forwarding websocket request: ${u.message}`,r),k(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function ea(t,e,r){return function(o,n){let s=$n(t,o);if(s)return o.method==="OPTIONS"?(n.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin??"*","Access-Control-Allow-Methods":o.headers["access-control-request-method"]??"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]??"Content-Type, Authorization","Access-Control-Max-Age":"86400"}),n.end()):e.web(o,n,{target:s},a=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let l=(kn(a)?a.errors[a.errors.length-1]:void 0)??a;k(`Error forwarding web request: ${l.message}`,r),k(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});y(R`
|
|
14
|
+
Reverse HTTP proxy error - Invalid path: ${o.url??""}
|
|
15
|
+
These are the allowed paths:
|
|
16
|
+
${U.json(JSON.stringify(t))}
|
|
17
|
+
`),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function $n(t,e,r=!1){let o=e.url??"/";for(let n in t)if(o.startsWith(n))return t[n];return r&&t.websocket?t.websocket:t.default}async function Mn({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:l,graphiqlKey:u}){let c=o.apiKey,m=o.apiSecretKeys[0]?.secret??"",h=Wt(),g=!Re(h[Ke.disableGraphiQLExplorer]),d=await so(t),f=new So(d,i.proxyUrl),v=d.allExtensions.some(Y=>Y.isPreviewable),E=`${i.proxyUrl}/extensions/dev-console`,A=He(),P;if(A)P=Ye(n,c);else{let Y=await ke();P=Co(n,c,Y)}let z=A&&v?E:P,j=fr(u,m,n),q=g?`http://localhost:${l}/graphiql?key=${encodeURIComponent(j)}`:void 0,V=d.configuration.embedded,w=d.nonConfigExtensions.length>0,$=new at({isReady:!1,previewURL:z,graphiqlURL:q,appEmbedded:V,hasExtensions:w}),N=[...await Rn({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:c,apiSecret:m,scopes:Kr(d.configuration)}),g?await Sn({appName:o.title,appUrl:P,port:l,apiKey:c,apiSecret:m,key:j,storeFqdn:n}):void 0,await yn({allExtensions:d.realExtensions,storeFqdn:n,storeId:s,apiKey:c,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:f}),r.supportsDevSessions?await Tn({app:d,apiKey:c,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:f,appPreviewURL:P,appLocalProxyURL:E,devSessionStatusManager:$}):await xn({localApp:d,remoteApp:o,apiKey:c,developerPlatformClient:r,proxyUrl:i.proxyUrl,appWatcher:f}),await Jo({remoteApp:o,localApp:d,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort}),bn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:m,remoteAppUpdated:e}),await _n({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:c},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:f}),await Cn({appWatcher:f})].filter(ta);return{processes:await ra(N,i.proxyPort,i.reverseProxyCert),previewUrl:z,graphiqlUrl:q,devSessionStatusManager:$}}var ta=t=>t!==void 0&&t!==!1;async function ra(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(J.Frontend)){let l=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${l}`;let u=a.options.hmrServerOptions;u&&(i.websocket=`http://localhost:${u.port}`,u.httpPaths.forEach(c=>i[c]=`http://localhost:${u.port}`)),a.options.port=l}else if(a.type==="previewable-extension"){let l=await O();i[a.options.pathPrefix]=`http://localhost:${l}`,a.options.port=l}return{process:a,rules:i}})),n=o.map(({process:a})=>a),s=o.map(({rules:a})=>a).reduce((a,i)=>({...a,...i}),{});return Object.keys(s).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:oa,options:{port:e,rules:s,localhostCert:r}}),n}var oa=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await Dn(o,t,n,e);Q(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();p();var b=oe(Pe(),1);var na=(t,e)=>Math.max(...t.map(r=>r.prefix.length),...e.map(r=>r.handle.length)),Fn=({abortController:t,processes:e,previewUrl:r,graphiqlUrl:o="",graphiqlPort:n,app:s,pollingTime:a=5e3,developerPreview:i,isEditionWeek:l})=>{let{canEnablePreviewMode:u,developmentStorePreviewEnabled:c}=s,{isRawModeSupported:m}=le(),h=(0,b.useRef)(),g=`http://localhost:${n}/graphiql`,[d,f]=(0,b.useState)(void 0),[v,E]=(0,b.useState)(!0),[A,P]=(0,b.useState)(void 0),{isAborted:D}=Fe(t.signal,async w=>{w?f("Shutting down dev because of an error ..."):(f("Shutting down dev ..."),Qe()),clearInterval(h.current),await i.disable()}),z=(0,b.useMemo)(()=>e.map(w=>({...w,action:async($,N,K)=>{try{return await w.action($,N,K)}catch(Y){t.abort(Y)}}})),[e,t]);(0,b.useEffect)(()=>{let w=async()=>{try{let N=await i.fetchMode();E(N??!1),P("")}catch{P("Failed to fetch the latest status of the development store preview, trying again in 5 seconds.")}},$=async()=>{try{await i.enable(),P("")}catch{P("Failed to turn on development store preview automatically.\nTry turning it on manually by pressing `d`."),E(!!c)}};if(u){$();let N=()=>setInterval(()=>w(),a);h.current=N()}return()=>{clearInterval(h.current)}},[u]),pe((w,$)=>{$e(w,$,()=>t.abort()),(async()=>{try{if(P(""),w==="p"&&r)await H.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Z(r);else if(w==="g"&&o)await H.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),await Z(g);else if(w==="q")t.abort();else if(w==="e"&&l)await Z("https://shopify.link/yQmk");else if(w==="d"&&u){await H.addPublicMetadata(()=>({cmd_dev_dev_preview_toggle_used:!0}));let K=!v;E(K);try{if(!await i.update(K))throw new Error(`Failed to turn ${K?"on":"off"} development store preview.`)}catch{E(v),P(`Failed to turn ${K?"on":"off"} development store preview.`)}}}catch{P("Failed to handle your input.")}})()},{isActive:!!m});let j=new Date,q=j.getMonth()>3?"Summer":"Winter",V=j.getFullYear();return b.default.createElement(b.default.Fragment,null,b.default.createElement(Me,{processes:z,prefixColumnSize:na(z,s.extensions),abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!1}),D?null:b.default.createElement(L,{marginY:1,paddingTop:1,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},m?b.default.createElement(L,{flexDirection:"column"},l?b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"e")," ",M.lineVertical," check out ",q," Edition",` ${V}`,", live NOW with 100+ product announcements!"):null,u?b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"d")," ",M.lineVertical," toggle development store preview: ",v?b.default.createElement(S,{color:"green"},"\u2714 on"):b.default.createElement(S,{color:"red"},"\u2716 off")):null,o?b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"g")," ",M.lineVertical," open GraphiQL (Admin API) in your browser"):null,b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"p")," ",M.lineVertical," preview in your browser"),b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"q")," ",M.lineVertical," quit")):null,b.default.createElement(L,{marginTop:m?1:0,flexDirection:"column"},d?b.default.createElement(S,null,d):b.default.createElement(b.default.Fragment,null,b.default.createElement(S,null,"Preview URL: ",b.default.createElement(ue,{url:r})),o?b.default.createElement(S,null,"GraphiQL URL: ",b.default.createElement(ue,{url:g})):null)),A?b.default.createElement(S,{color:"red"},A):null))};p();p();var we=oe(Pe(),1);var On=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Nn(){let[t,e]=(0,we.useState)(0);return(0,we.useEffect)(()=>{let r=setInterval(()=>{e(o=>(o+1)%On.length)},70);return()=>clearInterval(r)},[]),we.default.createElement(S,null,On[t])}p();var C=oe(Pe(),1);var qn=.9,Wn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Ft(),{isRawModeSupported:o}=le(),[n,s]=(0,C.useState)(e),[a,i]=(0,C.useState)(Math.floor(r.columns*qn)),[l,u]=(0,C.useState)(!0),c=(0,C.useRef)(null);if(!n)throw new Error("No tabs provided");pe((d,f)=>{(async()=>{if(f?.leftArrow||f?.rightArrow||f?.tab){let P=Object.entries(t).filter(([V,w])=>w.content),D=P.findIndex(([V])=>V===n);if(D===-1)return;let z=f?.leftArrow?-1:1,j=(D+z+P.length)%P.length,q=P[j];q&&s(q[0])}let E=t[d];if(E){E.action?await E.action():s(d);return}let A=t[n];if(A?.shortcuts){let P=A.shortcuts.find(D=>D.key===d);P&&(!P.condition||P.condition())&&await P.action()}})()},{isActive:!!o}),(0,C.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*qn)),!c.current)return;let f=Ot(c.current);u(f.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let m=Object.entries(t).map(([d,f])=>({...f,inputKey:d,header:` (${d}) ${f.label} `})),h=m.filter(d=>!d.action),g=m.filter(d=>d.action);return C.default.createElement(C.default.Fragment,null,C.default.createElement(L,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},C.default.createElement(L,{ref:c,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},C.default.createElement(S,{wrap:"truncate-end"},"\u2502",h.map(d=>C.default.createElement(C.default.Fragment,{key:d.inputKey},C.default.createElement(S,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),l&&C.default.createElement(L,{flexGrow:1,justifyContent:"flex-end"},g.map((d,f)=>C.default.createElement(S,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,f<g.length-1&&" \u2502 ")))),C.default.createElement(L,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var x=oe(Pe(),1);var Hn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:l,onAbort:u})=>{let{isRawModeSupported:c}=le(),[m,h]=(0,x.useState)(void 0),[g,d]=(0,x.useState)(void 0),[f,v]=(0,x.useState)(r.status),[E,A]=(0,x.useState)(!1),{isAborted:P}=Fe(t.signal,async w=>{w&&d(typeof w=="string"?w:w.message),r.status.isReady?A(!0):(h("Shutting down dev ..."),await u()),Qe()}),D=(0,x.useMemo)(()=>e.map(w=>({...w,action:async($,N,K)=>{try{return await w.action($,N,K)}catch(Y){t.abort(Y)}}})),[e,t]);(0,x.useEffect)(()=>(r.on("dev-session-update",v),()=>{r.off("dev-session-update",v)}),[]),pe((w,$)=>{$e(w,$,()=>t.abort())},{isActive:!!c});let z=w=>{switch(w){case"loading":return x.default.createElement(Nn,null);case"success":return"\u2705";case"error":return"\u274C"}},j=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:f.previewURL,condition:()=>!!(f.isReady&&f.previewURL),action:async()=>{await H.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),f.previewURL&&await Z(f.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:Pt(o),condition:()=>!!(f.isReady&&f.appEmbedded===!1&&f.hasExtensions),action:async()=>{await H.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Z(Pt(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:f.graphiqlURL,condition:()=>!!(f.isReady&&f.graphiqlURL),action:async()=>{await H.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),f.graphiqlURL&&await Z(f.graphiqlURL)}}],q=j.filter(w=>w.condition?.()??!0),V={d:{label:"Dev status",shortcuts:j,content:x.default.createElement(x.default.Fragment,null,f.statusMessage&&x.default.createElement(S,null,z(f.statusMessage.type)," ",f.statusMessage.message),c&&q.length>0&&x.default.createElement(L,{marginTop:1,flexDirection:"column"},q.map(w=>x.default.createElement(S,{key:w.key},M.pointerSmall," ",x.default.createElement(S,{bold:!0},"(",w.key,")")," ",dt()&&w.url?x.default.createElement(ue,{url:w.url,label:w.shortcutLabel}):w.shortcutLabel))),x.default.createElement(L,{marginTop:c?1:0,flexDirection:"column"},m?x.default.createElement(S,null,m):x.default.createElement(x.default.Fragment,null,f.isReady&&!(c&&dt())&&x.default.createElement(x.default.Fragment,null,q.filter(w=>w.url).map(w=>x.default.createElement(S,{key:w.key},w.linkLabel," URL: ",x.default.createElement(ue,{url:w.url})))))))},a:{label:"App info",content:x.default.createElement(L,{flexDirection:"column"},x.default.createElement(ut,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":l??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,w])=>w)}))},s:{label:"Store info",content:x.default.createElement(L,{flexDirection:"column"},x.default.createElement(ut,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,w])=>w)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return x.default.createElement(x.default.Fragment,null,x.default.createElement(Me,{processes:D,prefixColumnSize:jr,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&x.default.createElement(L,{marginTop:1,flexDirection:"column"},x.default.createElement(Xt,{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:x.default.createElement(L,{paddingTop:1,flexDirection:"column",flexGrow:1},c?x.default.createElement(Wn,{tabs:V,initialActiveTab:"d"}):x.default.createElement(L,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},V.d?.content)),g?x.default.createElement(L,{marginTop:1,flexDirection:"column"},x.default.createElement(S,{color:"red"},g)):null)};var _t=oe(Pe(),1);async function Bn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,graphiqlPort:s,developerPreview:a,shopFqdn:i,devSessionStatusManager:l,appURL:u,appName:c,organizationName:m,configPath:h,localURL:g}){if(!tr())await sa({processes:t,previewUrl:e,graphiqlUrl:n,app:r,abortController:o,developerPreview:a,shopFqdn:i});else return r.developerPlatformClient.supportsDevSessions?pt(_t.default.createElement(Hn,{processes:t,abortController:o,devSessionStatusManager:l,shopFqdn:i,appURL:u,appName:c,organizationName:m,configPath:h,localURL:g,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:i})}}),{exitOnCtrlC:!1}):pt(_t.default.createElement(Fn,{processes:t,abortController:o,previewUrl:e,app:r,graphiqlUrl:n,graphiqlPort:s,developerPreview:a,isEditionWeek:aa(),shopFqdn:i}),{exitOnCtrlC:!1})}async function sa({processes:t,previewUrl:e,graphiqlUrl:r,app:{canEnablePreviewMode:o},abortController:n,developerPreview:s}){return o&&(await s.enable(),n?.signal.addEventListener("abort",async()=>{await s.disable()})),process.stdout.write(`
|
|
18
|
+
Preview URL: ${e}
|
|
19
|
+
`),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
|
|
20
|
+
`),Promise.all(t.map(async a=>{await a.action(process.stdout,process.stderr,n.signal)}))}function aa(){if(Re(process.env.IS_EDITION_WEEK))return!0;if(We())return!1;let t=new Date("2024-01-31T17:00:00.000Z"),e=new Date("2024-02-07T17:00:00.000Z"),r=new Date;return r>=t&&r<=e}p();function Gn(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];ne({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=ct(e.map(n=>n.for)).join(" "),o=ct(e.map(n=>({command:n.flagToRemedy})));ne({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 jn(t,e){return e?e.includes("localhost")?"localhost":(await Kt(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var Kn=oe(Zn(),1);var ie="v1.4.4",zn="FiloSottile/mkcert",Ct=U.genericShellCommand("mkcert");async function ia(t,e,r,o){let n=e[Ke.mkcertBinaryPath];if(n)return n;let a=T(t,r==="win32"?"mkcert.exe":"mkcert");if(await X(a))return a;let i=await(0,Kn.default)("mkcert",{nothrow:!0});return i?(y(R`Found ${Ct} at ${U.path(i)}`),i):(await ca(a,r,o),a)}async function ca(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${ie}-darwin-arm64`:`mkcert-${ie}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${ie}-linux-arm64`:`mkcert-${ie}-linux-amd64`;break;case"win32":o=`mkcert-${ie}-windows-amd64.exe`;break;default:throw new me(`Unsupported platform: ${e}`)}await Wr(zn,ie,o,t),y(R`${Ct} saved to ${U.path(t)}`)}async function la(t){let e=T(t,"mkcert-LICENSE");if(await X(e))return;let r=`https://raw.githubusercontent.com/${zn}/refs/tags/${ie}/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 jt(r),!n.ok)return o}catch{return o}let s=await n.text();await _e(e,s)}async function Vn({appDirectory:t,env:e=process.env,platform:r=process.platform,arch:o=process.arch}){let n=T(".shopify","localhost-key.pem"),s=T(".shopify","localhost.pem"),a=T(t,n),i=T(t,s);if(await X(a)&&await X(i))return{keyContent:await I(a),certContent:await I(i),certPath:s};if(!await ao())throw new _(`Localhost certificate and key are required at ${s} and ${n}`);let u="",c;return await Ne([{title:"Finding or downloading mkcert binary",task:async()=>{let h=T(t,".shopify");u=await ia(h,e,r,o),c=await la(h),y(R`${Ct} found at: ${U.path(u)}`)}}]),c&&Oe(c),Q(R`Generating self-signed certificate for localhost. You may be prompted for your password.`),await qe(u,["-install","-key-file",a,"-cert-file",i,"localhost"]),Q(R`${U.successIcon()} Certificate generated at ${s}\n`),await rr()&&(ne({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"}}),Q("\u{1F449} Press any key to continue"),await Zt(),Q("")),{keyContent:await I(a),certContent:await I(i),certPath:Te(t,i)}}async function Qn(t){let e=await pa(t);await ua(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:s}=await Mn(e);await fa(e),await wa({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:s})}async function pa(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:s,tunnel:a}=t,i;if(a.mode==="auto"){let E=await O();i=await oo(t.commandConfig,E,"cloudflare")}let l=await uo(r,o,s,r.flags);r.configuration=l,go({app:e,remoteApp:r,selectedStore:n,cachedInfo:yt(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 sr.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Br(t.project);let u=t.graphiqlPort??await O(be.graphiql),c=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??be.graphiql,actual:u}];a.mode==="use-localhost"&&c.push({for:"localhost",flagToRemedy:"--localhost-port",requested:a.requestedPort,actual:a.actualPort}),Gn(c);let{webs:m,...h}=await ga(e.directory,e.webs,u,a,i,r.configuration);e.webs=m;let g=e.configuration.build?.automatically_update_urls_on_dev,d=yt(t.directory)?.previousAppId,f=r.apiKey,v=await ha(m,t.update,h,e,g,r,f,o);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==d,localApp:e,developerPlatformClient:o,commandOptions:t,network:h,partnerUrlsUpdated:v,graphiqlPort:u,graphiqlKey:t.graphiqlKey}}async function ua(t){await da(t),await ma(t)}async function da({localApp:t,remoteApp:e,developerPlatformClient:r,commandOptions:o}){if(r.supportsDevSessions)return;let n=t.configuration.access_scopes,s=e.configuration?.access_scopes,a=u=>u&&u.split(",").map(c=>c.trim()).sort().join(","),i=a(n?.scopes),l=a(s?.scopes);if(!n?.use_legacy_install_flow&&i!==l){let u=[["Run",{command:nr(o.project.packageManager,"shopify app deploy")},"to push your scopes to the Partner Dashboard"]];ne({headline:["The scopes in your TOML don't match the scopes in your Partner Dashboard"],body:[`Scopes in ${Lt(t.configPath)}:`,Yn(zr(t.configuration)),`
|
|
21
|
+
`,"Scopes in Partner Dashboard:",Yn(s?.scopes?.split(",")??[])],nextSteps:u})}}async function ma(t){let{developerPlatformClient:e,remoteApp:r}=t;if(!e.supportsDevSessions)return;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||mo()}async function fa(t){Jr({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await va({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Qt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function ha(t,e,r,o,n,s,a,i){let{backendConfig:l,frontendConfig:u}=ae(t),c=!1;if((u??l)&&e){let m=Zr(r.proxyUrl,t.map(({configuration:h})=>h.auth_callback_path).find(h=>h),o.configuration.app_proxy);c=await ro({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:m,developerPlatformClient:i}),c&&(i.supportsDevSessions?o.setDevApplicationURLs(m):await eo(m,a,i,o))}return c}async function ga(t,e,r,o,n,s){let{backendConfig:a,frontendConfig:i}=ae(e);await Pa(e,r);let l=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:u,frontendPort:c,usingLocalhost:m},h,g]=await Promise.all([Xr(l),Ht()??a?.configuration.port??O(),to(s)]),d=m?`${u}:${c}`:u,f=i?.configuration.port;i&&(f??(f=i===a?h:await O()),i.configuration.port=f),f=f??await O();let v;if(o.mode==="use-localhost"){let{keyContent:E,certContent:A,certPath:P}=await Vn({appDirectory:t});v={key:E,cert:A,certPath:P,port:o.actualPort}}return{proxyUrl:d,proxyPort:c,frontendPort:f,backendPort:h,currentUrls:g,webs:e,reverseProxyCert:v}}async function wa({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let s=new Nt,a=t.map(c=>({prefix:c.prefix,action:async(h,g,d)=>{let f=c.function;return f({stdout:h,stderr:g,abortSignal:d},c.options)}})),i=o.remoteApp.apiKey,l=o.developerPlatformClient,u={canEnablePreviewMode:l.supportsDevSessions?!1:await Yo({localApp:o.localApp,developerPlatformClient:l,apiKey:i,organizationId:o.remoteApp.organizationId}),developmentStorePreviewEnabled:o.remoteApp.developmentStorePreviewEnabled,apiKey:i,id:o.remoteApp.id,developerPlatformClient:l,extensions:o.localApp.allExtensions};return Bn({processes:a,previewUrl:e,graphiqlUrl:r,graphiqlPort:o.graphiqlPort,app:u,abortController:s,developerPreview:ya(i,l),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})}function ya(t,e){return e.supportsDevSessions?{fetchMode:()=>Promise.resolve(!1),enable:()=>Promise.resolve(!1),disable:()=>Promise.resolve(),update:()=>Promise.resolve(!1)}:{fetchMode:async()=>!!await po(t,e),enable:async()=>wo({apiKey:t,developerPlatformClient:e}),disable:async()=>yo({apiKey:t,developerPlatformClient:e}),update:async r=>vo({apiKey:t,developerPlatformClient:e,enabled:r})}}async function va(t){let e=await jn(t.devOptions.commandConfig,t.tunnelUrl);await H.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?lt(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:lt(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await H.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}function Yn(t){return{list:{items:t.length===0?["No scopes"]:t}}}async function Pa(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);if(o)throw new _(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await mt(n))throw new _(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await mt(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new _(s,a)}})()])}p();async function Jn({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??be.localhost,n=await O(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new _(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var G=oe(Xn(),1);var It,re=class extends xo{static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(It),r=await Jn({useLocalhost:e["use-localhost"],tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Jt(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await no(e.path);let o=await Po({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),n=await Eo({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset}),s={...o,store:n,directory:e.path,update:!e["no-update"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],tunnel:r};return await Qn(s),{app:o.app}}};It=re;re.summary="Run the app.";re.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).";re.description=It.descriptionWithoutMarkdown();re.flags={...ar,...Hr,store:G.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async t=>De(t)}),"skip-dependencies-installation":G.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":G.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"subscription-product-url":G.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":G.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":G.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":G.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",default:!1,exclusive:["tunnel-url"]}),"localhost-port":Be({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:G.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Be({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),notify:G.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":Be({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":G.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};var tm=re;export{oi as a,tm as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as O}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-J3HXFQ2L.js";import{a as I}from"./chunk-CZXGQ53M.js";import{c as _,i as P,n as k}from"./chunk-6YPEONHB.js";import{b as S,m as b}from"./chunk-PJYNAUQB.js";import{j as g,k as T,l as L,p as R,v as q}from"./chunk-D6YDSGR4.js";import{xa as x}from"./chunk-5W443CKL.js";import{a as v}from"./chunk-FU232KQ7.js";import{b as E}from"./chunk-H5C3QTOO.js";import{d as u}from"./chunk-WKBVT5WG.js";import{Fb as d,Hb as m,Mb as o,Pb as c}from"./chunk-DONEJHDG.js";import{r as G}from"./chunk-T6CC5WUU.js";import{e as V,g as r}from"./chunk-VKWPEFWQ.js";r();r();r();var f=class extends I{constructor(t){super(t),this.context="REPL",this.themeId=g()}async create(t,n){let s=await super.create(t,n);return await this.uploadThemeAssets(s),s}async findOrCreate(){let t=await this.fetch();if(!t){let n=`Liquid Console (${v})`;t=await this.create(S,n)}return t}setTheme(t){T(t)}removeTheme(){L()}async uploadThemeAssets(t){let n=[{key:"config/settings_data.json",value:"{}"},{key:"config/settings_schema.json",value:"[]"},{key:"snippets/eval.liquid",value:""},{key:"layout/password.liquid",value:"{{ content_for_header }}{{ content_for_layout }}"},{key:"layout/theme.liquid",value:"{{ content_for_header }}{{ content_for_layout }}"},{key:"sections/announcement-bar.liquid",value:""},{key:"templates/index.json",value:JSON.stringify({sections:{announcement:{type:"announcement-bar",settings:{}}},order:["announcement"]})}];await b(t.id,n,this.adminSession)}};r();r();async function A(e){return await H(e)??await $(e)??await Y(e)??await z(e)??void 0}async function H(e){c(`Evaluating snippet - ${e.snippet}`);let t=`{ "type": "display", "value": {{ ${e.snippet} | json }} }`,n=await h({...e,snippet:t}),s=await n.text();return C(n.status,s)?Q(s):void 0}async function $(e){c(`Evaluating context - ${e.snippet}`);let t=`{ "type": "context", "value": "{% ${e.snippet.replace(/"/g,'\\"')} %}" }`,n=await h({...e,snippet:t}),s=await n.text();C(n.status,s)&&e.replSession.push(JSON.parse(t))}async function Y(e){if(c(`Evaluating assignment context - ${e.snippet}`),oe(e.snippet))return e.snippet=`assign ${e.snippet}`,o(m`${d.gray(`> ${e.snippet}`)}`),$(e)}async function z(e){c(`Evaluating syntax error - ${e.snippet}`);let t="";if(X(e.snippet)||(t=await(await h({...e,snippet:`{{ ${e.snippet} }}`})).text()),y(t)||(t=await(await h({...e,snippet:`{% ${e.snippet} %}`})).text()),y(t)){let n=t.replace(/ \(snippets\/eval line \d+\)/,"");B(e.snippet,n)}}function B(e,t){if(t.includes("Unknown tag")){o(m`${d.errorText(`Unknown object, property, tag, or filter: '${e}'`)}`);return}let n=j(t);n&&o(m`${d.errorText(n)}`)}async function h(e){let t=K(e);e.url.startsWith("/")||(e.url=`/${e.url}`);let n=await P(e.themeSession,{method:"GET",path:e.url,query:[],themeId:e.themeId,sectionId:"announcement-bar",headers:{},replaceTemplates:{"sections/announcement-bar.liquid":"{% render 'eval' %}","snippets/eval.liquid":`
|
|
2
2
|
${t}
|
|
3
3
|
`}});return Z(n)&&ne(),ee(n)&&se(),te(n)&&re(),n}function K(e){return`[${[...e.replSession.map(n=>JSON.stringify(n)),e.snippet].join(",").replace(/\\"/g,'"')}]`}function Q(e){let t=j(e);if(t)return JSON.parse(t)?.find(s=>s.type==="display")?.value}function j(e){let t=e.split(`
|
|
4
4
|
`).slice(1,-1);if(t.length!==0)return t.join("")}function y(e){return e.includes("Liquid syntax error")}function X(e){return/^\s*assign\s*((?:\(?[\w\-.[\]]\)?)+)\s*=\s*(.*)\s*/m.test(e)}function Z(e){return e.status===401||e.status===403}function ee(e){return e.status===430||e.status===429}function te(e){return e.headers.get("server-timing")?.includes('pageType;desc="404"')??!1}function ne(){throw new u("Session expired. Please initiate a new one.")}function se(){throw new u("Evaluations limit reached. Try again later.")}function re(){throw new u("Page not found. Please provide a valid --url value!")}function oe(e){return/^\s*((?:\(?[\w\-.[\]]\)?)+)\s*=\s*(.*)\s*/m.test(e)}function C(e,t){return e===200&&!y(t)}r();function F(e){if(N(e)){o("Object can't be printed, but you can access its fields. Read more at https://shopify.dev/docs/api/liquid.");return}if(e==null){M("null");return}let t=JSON.stringify(e,null,2);M(t)}function N(e){if(Array.isArray(e))return e.length>0?N(e[0]):!1;if(e&&typeof e=="object"){let n=e.error;return typeof n=="string"&&n.includes("json not allowed for this object")}return!1}function M(e){return o(m`${d.cyan(e)}`)}import{createInterface as ie}from"readline";var ae=`Liquid Console doesn't support Liquid delimiters such as '{{ ... }}' or '{% ... %}'.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as i}from"./chunk-
|
|
1
|
+
import{b as i}from"./chunk-H5C3QTOO.js";import{b as o}from"./chunk-UKK5P74A.js";import{J as t}from"./chunk-6EZ7JWBK.js";import{r as p}from"./chunk-T6CC5WUU.js";import{e as h,g as a}from"./chunk-VKWPEFWQ.js";a();a();async function c(r){let e=new URLSearchParams;e.append("search",r??""),await t(`https://shopify.dev?${e.toString()}`)}var n=h(p(),1),s=class r extends o{static{this.description="Search shopify.dev for the most relevant content matching a query. Best for discovery \u2014 surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`."}static{this.usage="search [query]"}static{this.examples=[`# open the search modal on Shopify.dev
|
|
2
2
|
shopify search
|
|
3
3
|
|
|
4
4
|
# search for a term on Shopify.dev
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-J5TNYNR5.js";import{g as t}from"./chunk-VKWPEFWQ.js";t();var e=async()=>a.getAllSensitiveMetadata(),i=e;export{i as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as E}from"./chunk-FKIVKNOV.js";import{a as S}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-FKIVKNOV.js";import{a as S}from"./chunk-HM5H7WBE.js";import{a as C}from"./chunk-ZAMDXIVC.js";import{Fa as P,I as x,ha as y,i as F}from"./chunk-ATXODH6C.js";import{b as f}from"./chunk-XH6ZP7M5.js";import{b as w}from"./chunk-H5C3QTOO.js";import{Fb as n,Hb as d,Lb as v,Ta as h,ma as g,ua as l}from"./chunk-DONEJHDG.js";import{f as u}from"./chunk-773TIA5M.js";import{r as $}from"./chunk-T6CC5WUU.js";import{e as k,g as p}from"./chunk-VKWPEFWQ.js";p();p();async function _({app:c,remoteApp:t,organization:o,envFile:e}){await y(t,o.source);let r={SHOPIFY_API_KEY:t.apiKey,SHOPIFY_API_SECRET:t.apiSecretKeys[0]?.secret,SCOPES:F(c.configuration)};if(await h(e)){let a=await g(e),s=f(a,r);if(s===a)return d`No changes to ${n.path(e)}`;{await l(e,s);let I=E(a??"",s);return d`Updated ${n.path(e)} to be:
|
|
2
2
|
|
|
3
3
|
${s}
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as S,c as A,d as R}from"./chunk-
|
|
1
|
+
import{b as S,c as A,d as R}from"./chunk-7UOPCYMV.js";import{a as N}from"./chunk-MQICT2LR.js";import{a as P}from"./chunk-ZAMDXIVC.js";import{Ga as T,b as y,c as x}from"./chunk-ATXODH6C.js";import{b,c as g}from"./chunk-H5C3QTOO.js";import{u as h}from"./chunk-6EZ7JWBK.js";import{Fb as l,Hb as m,Lb as d}from"./chunk-DONEJHDG.js";import{d as f}from"./chunk-773TIA5M.js";import{g as p}from"./chunk-VKWPEFWQ.js";p();p();function C(n,t){let o={};return n.targeting?.forEach(e=>{e.target&&(o[e.target]={...e.input_query&&{inputQueryPath:`${t}/${e.input_query}`},...e.export&&{export:e.export}})}),o}function I(n,t,o,e,i,r){return JSON.stringify({handle:t.handle,name:n.name,apiVersion:t.api_version,targeting:o,schemaPath:r,wasmPath:i,functionRunnerPath:e},null,2)}function j(n,t){return{title:`CONFIGURATION
|
|
2
2
|
`,body:{tabularData:[["Handle",n.handle??"N/A"],["Name",t??"N/A"],["API Version",n.api_version??"N/A"]],firstColumnSubdued:!0}}}function O(n){if(Object.keys(n).length===0)return null;let t=[];return Object.entries(n).forEach(([o,e])=>{t.push([m`${l.cyan(o)}`.value,""]),e.inputQueryPath&&t.push([{subdued:" Input Query Path"},{filePath:e.inputQueryPath}]),e.export&&t.push([{subdued:" Export"},e.export])}),{title:`
|
|
3
3
|
TARGETING
|
|
4
4
|
`,body:{tabularData:t}}}function v(n,t){return{title:`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k,b as i,c as F,d as L,e as _,f as M,g as H}from"./chunk-
|
|
1
|
+
import{a as k,b as i,c as F,d as L,e as _,f as M,g as H}from"./chunk-733R5OKQ.js";import{a as E}from"./chunk-HM5H7WBE.js";import{a as P}from"./chunk-ZAMDXIVC.js";import{Fa as I,ga as S}from"./chunk-ATXODH6C.js";import{O as b,P as T,Q as A}from"./chunk-442S5SDM.js";import{B as g,F as v,z as p}from"./chunk-6EZ7JWBK.js";import{Nb as h,Qb as m,Sb as w}from"./chunk-DONEJHDG.js";import{j as y}from"./chunk-773TIA5M.js";import{r as q}from"./chunk-T6CC5WUU.js";import{e as G,g as a}from"./chunk-VKWPEFWQ.js";a();a();a();a();async function V(e){let t=e.map(o=>({label:o,value:o}));return await g({message:"Webhook Topic",choices:t})}async function C(e){return p({message:"Webhook ApiVersion",choices:e.map(t=>({label:t,value:t}))})}async function R(){return p({message:"Delivery method",choices:[{label:"HTTP",value:i.HTTP},{label:"Google Pub/Sub",value:i.PUBSUB},{label:"Amazon EventBridge",value:i.EVENTBRIDGE}]})}async function D(e){return(await v({message:"Address for delivery",validate:r=>{let o=r.trim();if(o.length===0)return"Address can't be empty";if(!F(o,e))return`Invalid address.
|
|
2
2
|
${c(e)}`}})).trim()}function U(e){return e===i.HTTP?["For remote HTTP testing, use a URL that starts with https://","For local HTTP testing, use http://localhost:{port}/{url-path}"]:e===i.PUBSUB?["For Google Pub/Sub, use pubsub://{project-id}:{topic-id}"]:e===i.EVENTBRIDGE?["For Amazon EventBridge, use an Amazon Resource Name (ARN) starting with arn:aws:events:"]:[]}function c(e){return U(e).map(t=>` \xB7 ${w(t)}`).join(`
|
|
3
3
|
`)}async function O(e,t){let{clientSecret:r,clientId:o,remoteApp:s,app:l}=e;return r&&(o||t!==i.EVENTBRIDGE)?{clientSecret:r,apiKey:o}:(S({appName:s.title,configFile:y(l.configPath)}),{clientSecret:s.apiSecretKeys.find(f=>f.secret).secret,apiKey:s.apiKey})}async function x(e,t,r){let o=await T(e,r);return t?_(t,o):C(o)}async function B(e,t,r,o){let s=await A(e,t,o);return r?M(r,t,s):V(s)}async function Y(e,t){let r=e??H(t)??await R(),o=t??await D(r);return L(o,r)}async function N(e){let t=await W(e);await z(t)}async function W(e){let t=await x(e.developerPlatformClient,e.apiVersion,e.organizationId),r=await B(e.developerPlatformClient,t,e.topic,e.organizationId),[o,s]=await Y(e.deliveryMethod,e.address),l=await O(e,s);return{topic:r,apiVersion:t,deliveryMethod:s,address:o,apiKey:l.apiKey,clientSecret:l.clientSecret,developerPlatformClient:e.developerPlatformClient,organizationId:e.organizationId}}async function z(e){let t={topic:e.topic,api_version:e.apiVersion,address:e.address,delivery_method:e.deliveryMethod,shared_secret:e.clientSecret,api_key:e.apiKey},r=await b(e.developerPlatformClient,t,e.organizationId);if(!r.success){m(`Request errors:
|
|
4
4
|
${K(r.userErrors)}`);return}if(e.deliveryMethod===i.LOCALHOST){if(await k(e.address,r.samplePayload,r.headers)){h("Localhost delivery sucessful");return}m("Localhost delivery failed");return}r.samplePayload===JSON.stringify({})&&h("Webhook has been enqueued for delivery")}function K(e){try{return e.map(t=>JSON.parse(t.message).map(r=>` \xB7 ${r}`).join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as b}from"./chunk-J3JPJCWP.js";import{a as fe}from"./chunk-YQH2JHFA.js";import{b as re,c as oe,d as se,e as ne,f as ie,h as ae,i as le,k as ce,l as me,n as de}from"./chunk-2NWWMNU5.js";import{c as ee,e as te}from"./chunk-QMXKGSFH.js";import{a as X}from"./chunk-J3HXFQ2L.js";import{c as Q,e as v,m as Z,n as x}from"./chunk-6YPEONHB.js";import{k as P,l as V,n as y}from"./chunk-PJYNAUQB.js";import{s as C,u as k}from"./chunk-D6YDSGR4.js";import{a as B,b as N}from"./chunk-O6KTFMCD.js";import{o as K,s as J,t as z,u as Y,w as j}from"./chunk-Q7BOSHWX.js";import{ta as $,xa as L}from"./chunk-5W443CKL.js";import{a as O}from"./chunk-5C7HDTHJ.js";import{J as U,s as W,u as I,v as M,w as R,y as q,z as G}from"./chunk-6EZ7JWBK.js";import{d as _,e as H}from"./chunk-WRRUFK4Y.js";import{d as g}from"./chunk-WKBVT5WG.js";import{Fb as w,Hb as E,Mb as T,Pb as u}from"./chunk-DONEJHDG.js";import{u as p}from"./chunk-A4SBXDZB.js";import{g as d}from"./chunk-VKWPEFWQ.js";d();d();d();d();var he={workPromise:Promise.resolve()};async function ue(e,t,o,r,s){if(o.length===0)return he;u("Initiating theme asset reconciliation process");let{filesOnlyPresentLocally:a,filesOnlyPresentOnRemote:i,filesWithConflictingChecksums:l}=Ce(o,r),n=a.length===0&&i.length===0&&l.length===0;if(L(`theme-service:theme-reconciliation:manual:${n}`),n)return u("Local and remote checksums match - no need to reconcile theme assets"),he;let c=await Se({filesOnlyPresentLocally:a,filesOnlyPresentOnRemote:i,filesWithConflictingChecksums:l},s);return{workPromise:Ae(e,t,r,c)}}function Ce(e,t){let o=new Set,r=[],s=[];for(let i of e){o.add(i.key);let l=t.files.get(i.key);l?i.checksum!==l.checksum&&s.push(i):r.push(i)}let a=Array.from(t.files.values()).filter(i=>!o.has(i.key));return{filesOnlyPresentOnRemote:A(r,t),filesOnlyPresentLocally:A(a,t),filesWithConflictingChecksums:A(s,t)}}function A(e,t){return t.applyIgnoreFilters(e).filter(r=>r.key.endsWith(".json"))}async function S(e,t,o){if(e.length===0)return;I({body:{list:{title:t,items:e.map(s=>s.key)}}}),await G({message:"Reconciliation Strategy",choices:[{label:o.remote.label,value:D},{label:o.local.label,value:pe}]})===D?o.remote.callback(e):o.local.callback(e)}async function Ae(e,t,o,r){let{localFilesToDelete:s,filesToDownload:a,remoteFilesToDelete:i}=r,l=s.map(m=>o.delete(m.key)),n=b(a,k,async m=>{let f=await P(e.id,m.map(h=>h.key),t);return Promise.all(f.map(h=>{if(h)return o.write(h)}))}),c=V(e.id,i.map(m=>m.key),t);await Promise.all([...l,...n,c])}async function Se(e,t){let{filesOnlyPresentLocally:o,filesOnlyPresentOnRemote:r,filesWithConflictingChecksums:s}=e,a=[],i=[],l=[];return t.noDelete||await S(o,"The files listed below are only present locally. What would you like to do?",{remote:{label:"Delete files from the local directory",callback:n=>{a.push(...n)}},local:{label:"Upload local files to the remote theme",callback:()=>{}}}),await S(r,"The files listed below are only present on the remote theme. What would you like to do?",{remote:{label:"Download remote files to the local directory",callback:n=>{i.push(...n)}},local:{label:"Delete files from the remote theme",callback:n=>{l.push(...n)}}}),await S(s,"The files listed below differ between the local and remote versions. What would you like to do?",{remote:{label:"Keep the remote version",callback:n=>{i.push(...n)}},local:{label:"Keep the local version",callback:()=>{}}}),{localFilesToDelete:a,filesToDownload:i,remoteFilesToDelete:l}}d();var De=3e3,F=class extends Error{};function we(e,t,o,r,s,a){u("Listening for changes in the theme editor");let i=5,l=0,n="",c=o,m=async()=>{await new Promise(f=>setTimeout(f,De)),c=await Fe(e,t,c,r,s).then(f=>(l=0,n="",f)).catch(f=>{if(l++,f.message!==n&&(n=f.message,v("Error while polling for changes.",f)),l>=i){let h=new g("Too many polling errors...","Please check the errors above and ensure you have a stable internet connection.");q(h),a(h)}return c})};setTimeout(async()=>{for(;;)await m()})}async function Fe(e,t,o,r,s){let a=new Set(r.unsyncedFileKeys),i=ye(o,r,a),l=await y(e.id,t).then(m=>ye(m,r,a)),n=$e(i,l),c=Oe(l,i);return await He(r,n),await Le(e,t,r,n),await _e(r,c,s),l}function Oe(e,t){let o=new Map(e.map(s=>[s.key,s]));return t.filter(s=>o.get(s.key)===void 0)}function $e(e,t){let o=new Map(e.map(s=>[s.key,s]));return t.filter(s=>{let a=o.get(s.key);if(!a||a.checksum!==s.checksum)return!0})}async function Le(e,t,o,r){let s=r.filter(i=>o.files.get(i.key)?.checksum!==i.checksum),a=b(s,k,async i=>P(e.id,i.map(l=>l.key),t).then(l=>Promise.all(l.map(async n=>{n&&(await o.write(n),T(E`• ${C.format(new Date)} Synced ${w.raw("\xBB")} ${w.gray(`download ${n.key} from remote theme`)}`))}))));await Promise.all(a)}async function _e(e,t,o){if(!o.noDelete)return Promise.all(t.map(r=>{if(e.files.get(r.key))return e.delete(r.key).then(()=>{T(E`• ${C.format(new Date)} Synced ${w.raw("\xBB")} ${w.gray(`remove ${r.key} from local theme`)}`)})}))}async function He(e,t){let o=new Map(e.files);await Promise.all(t.map(r=>e.read(r.key)));for(let r of t){let s=o.get(r.key)?.checksum,a=e.files.get(r.key)?.checksum;if(s!==a)throw new F(`Detected changes to the file '${r.key}' on both local and remote sources. Aborting...`)}}function ye(e,t,o){return t.applyIgnoreFilters(e).filter(s=>s.key.endsWith(".json")).filter(s=>!o.has(s.key))}var pe="local",D="remote";async function ge(e,t,o,r,s,a){u("Initiating theme asset reconciliation process"),await r.ready();let{workPromise:i}=await ue(e,t,o,r,s);return{updatedRemoteChecksumsPromise:i.then(async()=>{let n=await y(e.id,t);return we(e,t,n,r,s,a),n}),workPromise:i}}d();function ke(){if(Promise.withResolvers)return Promise.withResolvers();let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}import{createServer as We}from"node:http";function Pe(e,t){let{promise:o,resolve:r,reject:s}=ke(),a=ae(e,t),i=Ie(e,t,s),l=Promise.all([a,i.workPromise]).then(()=>t.localThemeFileSystem.startWatcher(e.id.toString(),t.session)),n=qe(e,t,l);return{workPromise:l,serverStart:n.start,dispatchEvent:n.dispatch,renderDevSetupProgress:i.renderProgress,backgroundJobPromise:o,resolveBackgroundJob:r}}function Ie(e,t,o){let r=n=>(v("Failed to perform the initial theme synchronization.",n),o(n),new Promise(()=>{})),a=y(e.id,t.session).then(n=>Me(e,t,n,o)),i=a.then(async({updatedRemoteChecksumsPromise:n})=>{let c=await n;return fe(e,t.session,c,t.localThemeFileSystem,{nodelete:t.options.noDelete,deferPartialWork:!0,backgroundWorkCatch:r})});return{workPromise:i.then(n=>n.workPromise).catch(r),renderProgress:async()=>{if(t.options.themeEditorSync){let{workPromise:c}=await a;await te([{title:"Performing file synchronization. This may take a while...",task:async()=>{await c}}])}let{renderThemeSyncProgress:n}=await i;await n()}}}function Me(e,t,o,r){return t.options.themeEditorSync?ge(e,t.session,o,t.localThemeFileSystem,{noDelete:t.options.noDelete,ignore:t.options.ignore,only:t.options.only},r):Promise.resolve({updatedRemoteChecksumsPromise:Promise.resolve(o),workPromise:Promise.resolve()})}function qe(e,t,o){let r=Y(),s=[`http://${t.options.host}:${t.options.port}`,`https://${t.session.storeFqdn}`,"https://online-store-web.shopifyapps.com"];r.use(ne(t.options.host,t.options.port)),r.use(z(async()=>(await o,J(i=>{i.node.req.headers.origin&&K(i,{origin:n=>s.includes(n),credentials:!0,methods:["GET","POST","HEAD","OPTIONS"],preflight:{statusCode:204}})})))),t.options.liveReload!=="off"&&r.use(le(e,t)),r.use(se(e,t)),r.use(re(e,t)),r.use(oe(e,t));let a=We(j(r));return{dispatch:r.handler.bind(r),start:async()=>new Promise(i=>a.listen({port:t.options.port,host:t.options.host},()=>i({close:async()=>{await Promise.all([new Promise(l=>{a.closeAllConnections(),a.close(l)})])}})))}}import Ge from"readline";var Ue="127.0.0.1",Ke=9292,ve=!1;async function xt(e){if(!await de(e.directory)&&!await ee(e.force))return;e.password?.startsWith("shpat_")&&R({headline:"Admin API token missing features:",body:["Directly using an Admin API token will result in some missing features.","We recommend generating a password from the Theme Access app.","Alternatively, you can authenticate normally by not passing the --password flag.",`
|
|
2
|
+
`,{list:{title:"Known limitations:",items:["Hot module reloading","Password protected storefronts"]}}],link:{label:"Theme Access app",url:"https://shopify.dev/docs/storefronts/themes/tools/theme-access"}}),e.listing&&await ce(e.directory,e.listing);let[t,o]=await Promise.all([Z(e.adminSession),Q(e.adminSession)]),r=o?await X(e.storePassword,e.adminSession.storeFqdn,t):void 0,s=ie(),a=me(e.directory,{filters:e,listing:e.listing,noDelete:e.noDelete,notify:e.notify}),i=e.host??Ue,l;if(e.port){if(!await N(e.port))throw new g(`Port ${e.port} is not available. Try a different port or remove the --port flag to use an available port.`);l=e.port}else l=await B(Ke);let n={local:`http://${i}:${l}`,giftCard:`http://${i}:${l}/gift_cards/[store_id]/preview`,themeEditor:`https://${e.store}/admin/themes/${e.theme.id}/editor?hr=${l}`,preview:`https://${e.store}/?preview_theme_id=${e.theme.id}`},m={session:await x(e.theme.id.toString(),e.adminSession,e.password,r,t),localThemeFileSystem:a,localThemeExtensionFileSystem:s,directory:e.directory,type:"theme",lastRequestedPath:"",options:{themeEditorSync:e["theme-editor-sync"],host:i,port:l,open:e.open,liveReload:e["live-reload"],standardEventsDevBundle:!0,standardEventsInspector:e["standard-events-inspector"],noDelete:e.noDelete,ignore:e.ignore,only:e.only,errorOverlay:e["error-overlay"]}},{serverStart:f,renderDevSetupProgress:h,backgroundJobPromise:Re,resolveBackgroundJob:Ee}=Pe(e.theme,m);Ge.emitKeypressEvents(process.stdin);let Te=ze(n,m,Ee);process.stdin.on("keypress",Te),await Promise.all([Re,h().then(f).then(()=>{process.stdin.isTTY&&process.stdin.setRawMode(!0),je(n),e.open&&be(n.local,"development server")})]),await Je(e.commandConfig,e.adminSession),process.exit(0)}async function Je(e,t){if(!ve){ve=!0;try{await _(()=>({store_fqdn_hash:O(t.storeFqdn)})),await H(()=>({store_fqdn:t.storeFqdn})),await $({config:e,exitMode:"ok"})}catch{}}}function ze(e,t,o){let r=W(be,100,{leading:!0,trailing:!1});return(s,a)=>{if(a.ctrl&&a.name==="c"){o();return}switch(a.name){case void 0:break;case"t":r(e.local,"localhost");break;case"p":r(e.preview,"theme preview");break;case"e":r(t.lastRequestedPath==="/"?e.themeEditor:`${e.themeEditor}&previewPath=${encodeURIComponent(t.lastRequestedPath)}`,"theme editor");break;case"g":r(e.giftCard,"gift card preview");break;default:break}}}function be(e,t){U(e).catch(Ye(t))}function Ye(e){return t=>{R({headline:`Failed to open ${e}.`,body:t.stack??t.message})}}function je(e){M({body:[{list:{title:p.bold("Preview your theme ")+p.cyan("(t)"),items:[{link:{url:e.local}}]}}],nextSteps:[[{link:{label:`Share your theme preview ${p.cyan("(p)")}`,url:e.preview}},{subdued:e.preview}],[{link:{label:`Customize your theme at the theme editor ${p.cyan("(e)")}`,url:e.themeEditor}}],[{link:{label:`Preview your gift cards ${p.cyan("(g)")}`,url:e.giftCard}}]]})}export{xt as a,be as b};
|