@shopify/cli 4.9.4 → 5.0.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-Q6QDIDYT.js +1 -0
- package/dist/analytics-VKKJNJ62.js +1 -0
- package/dist/assets/hydrogen/starter/CHANGELOG.md +7 -0
- package/dist/assets/hydrogen/starter/package.json +2 -2
- package/dist/assets/hydrogen/vite/package.json +3 -4
- package/dist/assets/hydrogen/vite/vite.config.js +3 -3
- package/dist/bootstrap.js +1 -1
- package/dist/{chunk-LKXFHYLI.js → chunk-24NUJTIH.js} +1 -1
- package/dist/chunk-2CMEKSI7.js +1 -0
- package/dist/chunk-2DID73ML.js +1 -0
- package/dist/chunk-2ORRV7GH.js +1 -0
- package/dist/chunk-2VSNFOKD.js +1 -0
- package/dist/chunk-335BUVBP.js +1 -0
- package/dist/{chunk-UEBUGSBT.js → chunk-3A3DZVEJ.js} +1 -1
- package/dist/chunk-3C6VLJ5D.js +319 -0
- package/dist/{chunk-PB5ZZET5.js → chunk-3G4HJO72.js} +30 -30
- package/dist/chunk-3LVCG4JB.js +1 -0
- package/dist/chunk-43KLFFP7.js +1 -0
- package/dist/chunk-43R5VGKT.js +1 -0
- package/dist/chunk-46MSIQ6Z.js +1 -0
- package/dist/chunk-4ARCB6DT.js +1 -0
- package/dist/chunk-4C2DAX5T.js +1 -0
- package/dist/chunk-4CRBTSVP.js +2 -0
- package/dist/chunk-4GCI2YCZ.js +8 -0
- package/dist/chunk-4GOJQKY5.js +1 -0
- package/dist/chunk-4RDFMBRG.js +9 -0
- package/dist/chunk-4SS6DXC7.js +5 -0
- package/dist/{chunk-J4J2YXH3.js → chunk-4TI7U2PN.js} +1 -1
- package/dist/{chunk-67EBF76X.js → chunk-52FDK2LC.js} +1 -1
- package/dist/chunk-53BG3NLH.js +3 -0
- package/dist/{chunk-LD6ZCTZ3.js → chunk-5B76DT7X.js} +1 -1
- package/dist/{chunk-A2VCTDKH.js → chunk-5NEGOQT6.js} +1 -1
- package/dist/{chunk-MW3JKGJH.js → chunk-5OMJFPQW.js} +1 -1
- package/dist/chunk-5TB52UUV.js +2 -0
- package/dist/chunk-5UWMXOHM.js +7 -0
- package/dist/chunk-6BNKBCCU.js +1 -0
- package/dist/chunk-6DXP7PQ7.js +1 -0
- package/dist/chunk-6PUU6ZNQ.js +1 -0
- package/dist/chunk-7GHSE7SG.js +1 -0
- package/dist/{chunk-7556AIVG.js → chunk-7IFE4UQY.js} +1 -1
- package/dist/chunk-7LAKWAKX.js +25 -0
- package/dist/chunk-7MVWDCI3.js +1 -0
- package/dist/chunk-7NSK77WG.js +3 -0
- package/dist/chunk-7QUZWCJZ.js +3 -0
- package/dist/chunk-7RPFJZLP.js +1 -0
- package/dist/{chunk-LJIJEGND.js → chunk-7UOA4DI7.js} +2 -2
- package/dist/chunk-7WPUV7GY.js +6 -0
- package/dist/chunk-7Y7AZRL3.js +10 -0
- package/dist/{chunk-NGSEF3UX.js → chunk-ACA2BGAD.js} +1 -1
- package/dist/chunk-AJMDF3QC.js +1 -0
- package/dist/{chunk-R7YJNDXW.js → chunk-AXC2MHHO.js} +1 -1
- package/dist/{chunk-DEF2G7S4.js → chunk-AYL6KBPE.js} +1 -1
- package/dist/chunk-BAHIL37I.js +1 -0
- package/dist/{chunk-RSC5NQAT.js → chunk-BCYTZ7LM.js} +1 -1
- package/dist/{chunk-AVMNIZAJ.js → chunk-BJPDJIS4.js} +1 -1
- package/dist/{chunk-7VAKNVFD.js → chunk-BN7ZXAZJ.js} +1 -1
- package/dist/chunk-BVSKBX7T.js +16 -0
- package/dist/chunk-BWRNXCVN.js +4 -0
- package/dist/{chunk-XNPUZRWP.js → chunk-C3KEDG33.js} +1 -1
- package/dist/{chunk-WEXOA4C4.js → chunk-C7V755IT.js} +1 -1
- package/dist/chunk-CCMDZX35.js +7 -0
- package/dist/chunk-CCQNP5YR.js +1 -0
- package/dist/chunk-CEIJKJOF.js +11 -0
- package/dist/chunk-CIK5BF7V.js +1 -0
- package/dist/{chunk-6YDLNP4G.js → chunk-CVVQQLCF.js} +1 -1
- package/dist/chunk-CW2T7EOQ.js +1 -0
- package/dist/chunk-CZ22VZDA.js +376 -0
- package/dist/{chunk-3G2ZQ2EF.js → chunk-D7NB7YR6.js} +1 -1
- package/dist/{chunk-DYPZX7MW.js → chunk-DFQ4WTET.js} +2 -2
- package/dist/chunk-DJAZBPYA.js +3 -0
- package/dist/chunk-DNMXVMJM.js +47 -0
- package/dist/{chunk-CLD3NZYD.js → chunk-EGCWR5AS.js} +1 -1
- package/dist/{chunk-BOE2ST6J.js → chunk-EITIW5OX.js} +1 -1
- package/dist/chunk-EMSF57ZB.js +1 -0
- package/dist/{chunk-ZEBMW5KS.js → chunk-EXFBZPZS.js} +1 -1
- package/dist/chunk-FDXHQZTO.js +26 -0
- package/dist/{chunk-Q2XLIWG4.js → chunk-FFHH5LOR.js} +1 -1
- package/dist/{chunk-MMQZO2W2.js → chunk-FNLECT7B.js} +1 -1
- package/dist/{chunk-PO5T44H3.js → chunk-FWB3GLMW.js} +1 -1
- package/dist/chunk-FZCGRIOM.js +1 -0
- package/dist/{chunk-G7JW4UIM.js → chunk-G6ZMSWEU.js} +1 -1
- package/dist/chunk-GAMC2BNY.js +7 -0
- package/dist/chunk-GB6E3ATN.js +4 -0
- package/dist/chunk-GCNA3HXH.js +8 -0
- package/dist/{chunk-IGDVKRB4.js → chunk-GFVKTWFT.js} +1 -1
- package/dist/chunk-GQNOVEKP.js +2 -0
- package/dist/{chunk-5BTLE67Z.js → chunk-GRGFA26K.js} +1 -1
- package/dist/chunk-GXORLBVN.js +2 -0
- package/dist/{chunk-3V4VL3SD.js → chunk-H4V55Y3Z.js} +118 -118
- package/dist/chunk-HCZG7YJ6.js +16 -0
- package/dist/chunk-HF4NDEX3.js +1 -0
- package/dist/chunk-HIRTL45Q.js +1 -0
- package/dist/chunk-I4OVLRQR.js +1 -0
- package/dist/{chunk-ENQXB532.js → chunk-I6FRVYGE.js} +1 -1
- package/dist/chunk-IEQ4UOH3.js +4 -0
- package/dist/{chunk-PIZDYS7T.js → chunk-IILLQOUC.js} +60 -60
- package/dist/{chunk-45SZ5PSE.js → chunk-IQVRP7CT.js} +1 -1
- package/dist/chunk-IUP7POIE.js +6 -0
- package/dist/chunk-IUTZIN2T.js +10 -0
- package/dist/chunk-IWEKM5Y3.js +1 -0
- package/dist/chunk-IWTNUJGY.js +2 -0
- package/dist/chunk-J6TW43TG.js +1 -0
- package/dist/chunk-JDR6UVZA.js +8 -0
- package/dist/{chunk-CVFPY2SH.js → chunk-JEA3C7ON.js} +1 -1
- package/dist/chunk-JOJV5E2K.js +1 -0
- package/dist/chunk-JYMDWR25.js +1 -0
- package/dist/{chunk-TPHHQAUD.js → chunk-KDPQXURV.js} +1 -1
- package/dist/{chunk-MW3IMZJ5.js → chunk-KGRIYAMA.js} +1 -1
- package/dist/chunk-KJQDS5HI.js +1 -0
- package/dist/chunk-KKPOOIE4.js +2 -0
- package/dist/{chunk-VS7QVU3Z.js → chunk-KSDU4YOB.js} +1 -1
- package/dist/chunk-L7MSPGDS.js +5 -0
- package/dist/{chunk-43URS56H.js → chunk-LDU5T3DN.js} +1 -1
- package/dist/chunk-LHKVXJPX.js +1 -0
- package/dist/{chunk-EO4YJFMY.js → chunk-LMQGNECW.js} +86 -200
- package/dist/{chunk-TQ7URMGS.js → chunk-LQ7ENG4V.js} +1 -1
- package/dist/chunk-LVLAOBJM.js +103 -0
- package/dist/chunk-LWCTKI4Z.js +18 -0
- package/dist/chunk-M3ACZWMR.js +1 -0
- package/dist/chunk-M4BVLMPH.js +31 -0
- package/dist/{chunk-NCRWOW6F.js → chunk-M5TGCSUK.js} +1 -1
- package/dist/chunk-M7LPHCP2.js +274 -0
- package/dist/{chunk-IDKRJ2F4.js → chunk-MDRVCBDO.js} +1 -1
- package/dist/chunk-MR2AUT7Q.js +1 -0
- package/dist/chunk-MXJAH2GW.js +5 -0
- package/dist/{chunk-UU6BRRYS.js → chunk-MYAIWSOO.js} +1 -1
- package/dist/{chunk-NT4A37HG.js → chunk-N2RFDHRY.js} +1 -1
- package/dist/{chunk-GSE6FXZU.js → chunk-NB4BRW3H.js} +1 -1
- package/dist/chunk-NDKSG4CC.js +97 -0
- package/dist/chunk-NK2MGR6A.js +1 -0
- package/dist/chunk-NOH63WC6.js +12 -0
- package/dist/{chunk-BVB3DTNE.js → chunk-OGWPS55W.js} +1 -1
- package/dist/chunk-OQ5CLM2H.js +4 -0
- package/dist/{chunk-PVAZCZSY.js → chunk-OQU3HLAE.js} +1 -1
- package/dist/chunk-OVWUGAEU.js +11 -0
- package/dist/chunk-OX7UVDSU.js +6 -0
- package/dist/chunk-P33TONYG.js +1 -0
- package/dist/chunk-PEVIRAMR.js +6 -0
- package/dist/{chunk-YPCXVZ2N.js → chunk-PGLWZMJU.js} +4 -4
- package/dist/chunk-PIAD3F6M.js +16 -0
- package/dist/chunk-PMHP57MH.js +20 -0
- package/dist/{chunk-F3PZGSOY.js → chunk-POKY4RWR.js} +1 -1
- package/dist/chunk-PSSYLJG4.js +2 -0
- package/dist/chunk-PYIICTLX.js +1 -0
- package/dist/chunk-PZUGDE7N.js +2 -0
- package/dist/{chunk-NU5WLZ6Y.js → chunk-Q2SZCZE7.js} +1 -1
- package/dist/{chunk-MUM34KUM.js → chunk-Q2XRITUG.js} +1 -1
- package/dist/chunk-Q5MEFIMV.js +4 -0
- package/dist/chunk-Q66CI37F.js +7 -0
- package/dist/chunk-QFWWCZOI.js +1 -0
- package/dist/{chunk-TR4OWSEX.js → chunk-QFYLJVJW.js} +1 -1
- package/dist/chunk-QKVVJXWS.js +3 -0
- package/dist/chunk-QN3774QI.js +1 -0
- package/dist/chunk-R2BDABJD.js +213 -0
- package/dist/{chunk-7HWMURCW.js → chunk-R7EMV77H.js} +1 -1
- package/dist/chunk-RFGEM5JC.js +3 -0
- package/dist/{chunk-7A3RW2VM.js → chunk-RVQV6G5M.js} +1 -1
- package/dist/chunk-S67I4E7M.js +5 -0
- package/dist/chunk-SFPXYHHL.js +1 -0
- package/dist/{chunk-4OCVXE5Y.js → chunk-SFQEHDJY.js} +1 -1
- package/dist/chunk-SL3VBI62.js +3 -0
- package/dist/{chunk-LOWSU4BB.js → chunk-SNNZ4U2W.js} +1 -1
- package/dist/chunk-T2IUXXCT.js +1 -0
- package/dist/chunk-TPSA4JN5.js +1 -0
- package/dist/chunk-TTEF7GTX.js +1 -0
- package/dist/{chunk-FQL2WEKX.js → chunk-U25W35TX.js} +1 -1
- package/dist/chunk-UIQL5ZF3.js +1 -0
- package/dist/chunk-UK6576EO.js +1 -0
- package/dist/chunk-ULD7CIOY.js +4 -0
- package/dist/{chunk-D3KFKT4D.js → chunk-UOS2XLGG.js} +1 -1
- package/dist/{chunk-EMH7OHCW.js → chunk-UVRKTMF7.js} +1 -1
- package/dist/{chunk-ZTICX3AO.js → chunk-UWMZ5CSB.js} +1 -1
- package/dist/chunk-UZROQRLX.js +2 -0
- package/dist/{chunk-5BGUKF7L.js → chunk-V75WUEFU.js} +1 -1
- package/dist/chunk-VB7YQMAM.js +5 -0
- package/dist/chunk-VHUD3CBC.js +3 -0
- package/dist/chunk-VMMUJN4T.js +17 -0
- package/dist/{chunk-S36VGP37.js → chunk-VW6QS7DO.js} +1 -1
- package/dist/chunk-VWH3VPYI.js +1 -0
- package/dist/{chunk-4TF7ER72.js → chunk-WBJ6ZHYH.js} +1 -1
- package/dist/chunk-WDFCOZAY.js +16 -0
- package/dist/chunk-WFWISGLS.js +1 -0
- package/dist/chunk-WGUOLSMG.js +1 -0
- package/dist/{chunk-PFXNBHQQ.js → chunk-WJSUIUBW.js} +2 -2
- package/dist/{chunk-TFXUDHCP.js → chunk-WMAFG2JD.js} +1 -1
- package/dist/chunk-X2H6I2WW.js +5 -0
- package/dist/{chunk-DSS4ECIH.js → chunk-X7HVAVSZ.js} +1 -1
- package/dist/{chunk-NYYXH2SX.js → chunk-XBQDMGUN.js} +1 -1
- package/dist/chunk-XITZIDCL.js +18 -0
- package/dist/chunk-XKRJKUA7.js +1 -0
- package/dist/{chunk-FEQHCE2E.js → chunk-XM7YUXTF.js} +2 -2
- package/dist/chunk-XMODGI45.js +1 -0
- package/dist/{chunk-B3M3KIOU.js → chunk-XNNKLUTN.js} +1 -1
- package/dist/chunk-XTREQ4A2.js +1 -0
- package/dist/chunk-YGYEM6QO.js +1 -0
- package/dist/{chunk-LWU5TKNA.js → chunk-YKS7MH3F.js} +9 -6
- package/dist/chunk-YTUDXZLN.js +1 -0
- package/dist/{chunk-I3J63RFV.js → chunk-YTUUU33R.js} +1 -1
- package/dist/chunk-YVVU4J5O.js +3 -0
- package/dist/{chunk-4TZCRMBJ.js → chunk-YVY32DNA.js} +1 -1
- package/dist/chunk-Z5SILNH2.js +7 -0
- package/dist/chunk-ZAA2DXK5.js +5 -0
- package/dist/chunk-ZDQO6CNY.js +1 -0
- package/dist/chunk-ZGV3HNEV.js +1 -0
- package/dist/chunk-ZQDDRIBA.js +22 -0
- package/dist/{chunk-QTLGMJDW.js → chunk-ZT5WFUKJ.js} +4 -4
- package/dist/chunk-ZYQ2XWC5.js +5 -0
- package/dist/cli/commands/app/build.js +1 -1
- package/dist/cli/commands/app/bulk/cancel.js +1 -1
- package/dist/cli/commands/app/bulk/execute.js +1 -1
- package/dist/cli/commands/app/bulk/status.js +1 -1
- package/dist/cli/commands/app/config/link.js +1 -1
- package/dist/cli/commands/app/config/pull.js +1 -1
- package/dist/cli/commands/app/config/use.js +1 -1
- package/dist/cli/commands/app/config/validate.js +1 -1
- package/dist/cli/commands/app/demo/watcher.js +1 -1
- package/dist/cli/commands/app/deploy.js +1 -1
- package/dist/cli/commands/app/dev/clean.js +1 -1
- package/dist/cli/commands/app/dev.js +1 -1
- package/dist/cli/commands/app/env/pull.js +1 -1
- package/dist/cli/commands/app/env/show.js +1 -1
- package/dist/cli/commands/app/execute.js +1 -1
- package/dist/cli/commands/app/function/build.js +1 -1
- package/dist/cli/commands/app/function/info.js +1 -1
- package/dist/cli/commands/app/function/replay.js +1 -1
- package/dist/cli/commands/app/function/run.js +1 -1
- package/dist/cli/commands/app/function/schema.js +1 -1
- package/dist/cli/commands/app/function/typegen.js +1 -1
- package/dist/cli/commands/app/generate/extension.js +1 -1
- package/dist/cli/commands/app/graphiql.js +1 -1
- package/dist/cli/commands/app/import/channel-config.js +1 -1
- package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
- package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
- package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
- package/dist/cli/commands/app/import-extensions.js +1 -1
- package/dist/cli/commands/app/info.js +1 -1
- package/dist/cli/commands/app/init.js +1 -1
- package/dist/cli/commands/app/logs.js +1 -1
- package/dist/cli/commands/app/release.js +1 -1
- package/dist/cli/commands/app/security/check.js +1 -1
- package/dist/cli/commands/app/security/clean.js +1 -1
- package/dist/cli/commands/app/security/instructions.js +1 -1
- package/dist/cli/commands/app/security/record.js +1 -1
- package/dist/cli/commands/app/security/review.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
- package/dist/cli/commands/app/versions/list.js +1 -1
- package/dist/cli/commands/app/webhook/trigger.js +1 -1
- package/dist/cli/commands/auth/login.js +1 -1
- package/dist/cli/commands/auth/logout.js +1 -1
- package/dist/cli/commands/cache/clear.js +1 -1
- package/dist/cli/commands/config/autoupgrade/off.js +1 -1
- package/dist/cli/commands/config/autoupgrade/on.js +1 -1
- package/dist/cli/commands/config/autoupgrade/status.js +1 -1
- package/dist/cli/commands/debug/command-flags.js +1 -1
- package/dist/cli/commands/doc/fetch.d.ts +34 -1
- package/dist/cli/commands/doc/fetch.js +1 -1
- package/dist/cli/commands/doc/search.d.ts +53 -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.d.ts +6 -6
- package/dist/cli/commands/help.js +1 -1
- package/dist/cli/commands/kitchen-sink/async.js +1 -1
- package/dist/cli/commands/kitchen-sink/index.js +1 -1
- package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
- package/dist/cli/commands/kitchen-sink/static.js +1 -1
- package/dist/cli/commands/notifications/generate.js +1 -1
- package/dist/cli/commands/notifications/list.js +1 -1
- package/dist/cli/commands/organization/list.js +1 -1
- package/dist/cli/commands/search.js +1 -1
- package/dist/cli/commands/send-analytics.js +1 -1
- package/dist/cli/commands/theme/check.js +1 -1
- package/dist/cli/commands/theme/console.js +1 -1
- package/dist/cli/commands/theme/delete.js +1 -1
- package/dist/cli/commands/theme/dev.js +1 -1
- package/dist/cli/commands/theme/duplicate.js +1 -1
- package/dist/cli/commands/theme/info.js +1 -1
- package/dist/cli/commands/theme/init.js +1 -1
- package/dist/cli/commands/theme/language-server.js +1 -1
- package/dist/cli/commands/theme/list.js +1 -1
- package/dist/cli/commands/theme/metafields/pull.js +1 -1
- package/dist/cli/commands/theme/open.js +1 -1
- package/dist/cli/commands/theme/package.js +1 -1
- package/dist/cli/commands/theme/preview.js +1 -1
- package/dist/cli/commands/theme/profile.js +1 -1
- package/dist/cli/commands/theme/publish.js +1 -1
- package/dist/cli/commands/theme/pull.js +1 -1
- package/dist/cli/commands/theme/push.js +1 -1
- package/dist/cli/commands/theme/rename.js +1 -1
- package/dist/cli/commands/theme/share.js +1 -1
- package/dist/cli/commands/upgrade.d.ts +64 -0
- package/dist/cli/commands/upgrade.js +1 -1
- package/dist/cli/commands/version.js +1 -1
- package/dist/cli/help.js +1 -1
- package/dist/cli/services/commands/doc/fetch-result.d.ts +2 -0
- package/dist/cli/services/commands/doc/fetch-result.js +22 -0
- package/dist/cli/services/commands/doc/fetch.d.ts +2 -1
- package/dist/cli/services/commands/doc/fetch.js +2 -15
- package/dist/cli/services/commands/doc/search-result.d.ts +2 -0
- package/dist/cli/services/commands/doc/search-result.js +14 -0
- package/dist/cli/services/commands/doc/search.d.ts +9 -1
- package/dist/cli/services/commands/doc/search.js +27 -2
- package/dist/cli/services/commands/doc/types.d.ts +107 -0
- package/dist/cli/services/commands/doc/types.js +47 -0
- package/dist/cli/services/commands/help/types.d.ts +6 -6
- package/dist/command-event-context-LFUZ7UCA.js +1 -0
- package/dist/command-json-schema-2UMKY7MY.js +1 -0
- package/dist/command-registry.js +1 -1
- package/dist/conf-store-RI3TL6I4.js +1 -0
- package/dist/custom-oclif-loader-IZCKN67O.js +1 -0
- package/dist/deprecations-IFVUXXDB.js +1 -0
- package/dist/dist-4H2B7BMN.js +1 -0
- package/dist/dist-QNWOGQN3.js +1 -0
- package/dist/{environment-RSUK27TA.js → environment-O7ECODHU.js} +1 -1
- package/dist/environments-CYMEN7NV.js +1 -0
- package/dist/error-IL6WQMSW.js +1 -0
- package/dist/error-handler-74HKA23T.js +1 -0
- package/dist/fs-AINFLJ2E.js +1 -0
- 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 +13 -13
- package/dist/is-global-2VLKV46Q.js +1 -0
- package/dist/json-error-HZB5YIHV.js +1 -0
- package/dist/{lib-TYM5B75S.js → lib-PJHT4MKY.js} +1 -1
- package/dist/{lib-55QUD4AJ.js → lib-VKSQ65BQ.js} +1 -1
- package/dist/{lib-PH52G55H.js → lib-YEZOHXF3.js} +1 -1
- package/dist/{local-R3UAQN7T.js → local-KOZETREJ.js} +1 -1
- package/dist/{metadata-JWJG4JV4.js → metadata-IBPHZB7N.js} +1 -1
- package/dist/{morph-BABFBRSW.js → morph-CRY35DIK.js} +1 -1
- package/dist/node-package-manager-DXSRNEDC.js +1 -0
- package/dist/notifications-system-XA3EBOGJ.js +1 -0
- package/dist/os-X73O7BAB.js +1 -0
- package/dist/out-B2GISN65.js +1 -0
- package/dist/output-3OYXK3Z5.js +1 -0
- package/dist/{path-CPAYTWQW.js → path-3L2QRACZ.js} +1 -1
- package/dist/system-JWYYT4PM.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui-PCG5D6RZ.js +1 -0
- package/dist/upgrade-7U2TUNC4.js +1 -0
- package/dist/version-7DGU2KYH.js +1 -0
- package/dist/version-SXQTRBXB.js +1 -0
- package/dist/workerd-MQZ3NKJI.js +18 -0
- package/oclif.manifest.json +1664 -427
- package/package.json +8 -8
- package/dist/analytics-APDNTBDE.js +0 -1
- package/dist/analytics-LX52KYSE.js +0 -1
- package/dist/chunk-2PDVBGQH.js +0 -7
- package/dist/chunk-2YVSZFXJ.js +0 -4
- package/dist/chunk-35WQTGN3.js +0 -5
- package/dist/chunk-37BGAWAW.js +0 -2
- package/dist/chunk-3C4WVKSO.js +0 -6
- package/dist/chunk-3LHE4GIX.js +0 -1
- package/dist/chunk-47IQIIFX.js +0 -383
- package/dist/chunk-4ES7BJEK.js +0 -1
- package/dist/chunk-4IFY7V7W.js +0 -1
- package/dist/chunk-4JGWKUJN.js +0 -2
- package/dist/chunk-4O5GQ3DS.js +0 -7
- package/dist/chunk-4O7LK5RG.js +0 -26
- package/dist/chunk-4TFJ5RW7.js +0 -8
- package/dist/chunk-4ZNBEMRT.js +0 -20
- package/dist/chunk-5JIJDUXX.js +0 -20
- package/dist/chunk-66YRAUWX.js +0 -3
- package/dist/chunk-6A4H3HPY.js +0 -7
- package/dist/chunk-6HPUOCFF.js +0 -1
- package/dist/chunk-6IDEDOXW.js +0 -2
- package/dist/chunk-6IMHGT7F.js +0 -8
- package/dist/chunk-6MC2BEW4.js +0 -1
- package/dist/chunk-73D5O7A3.js +0 -1
- package/dist/chunk-7E4MJCVE.js +0 -10
- package/dist/chunk-7HNRK2CR.js +0 -1
- package/dist/chunk-7SJHVJ3W.js +0 -5
- package/dist/chunk-ALK66U3O.js +0 -3
- package/dist/chunk-AMLCWRHU.js +0 -4
- package/dist/chunk-AYIU6Z4C.js +0 -1
- package/dist/chunk-BIWG3FQQ.js +0 -5
- package/dist/chunk-BQ3U3CQV.js +0 -1
- package/dist/chunk-C6IBY7NW.js +0 -16
- package/dist/chunk-CQF5NDTJ.js +0 -4
- package/dist/chunk-DMDLJRLW.js +0 -1
- package/dist/chunk-DMNWSUKV.js +0 -5
- package/dist/chunk-FK7GA4QQ.js +0 -1
- package/dist/chunk-FO2R6KHG.js +0 -1
- package/dist/chunk-FOAV642V.js +0 -1
- package/dist/chunk-GE4MLO3C.js +0 -5
- package/dist/chunk-GM4EFJJF.js +0 -7
- package/dist/chunk-GN66BRYF.js +0 -1
- package/dist/chunk-GPRZYFDE.js +0 -1
- package/dist/chunk-GZ7VGCVW.js +0 -3
- package/dist/chunk-HASIOUH2.js +0 -3
- package/dist/chunk-HILYTMVA.js +0 -1
- package/dist/chunk-HJHS23Q3.js +0 -1
- package/dist/chunk-HLPAVELJ.js +0 -1
- package/dist/chunk-HPM3HF7A.js +0 -1
- package/dist/chunk-HQJ62PII.js +0 -3
- package/dist/chunk-HQY6JM6G.js +0 -6
- package/dist/chunk-HSYMUYEZ.js +0 -359
- package/dist/chunk-I5PQZRYM.js +0 -32
- package/dist/chunk-IPZ6LUJV.js +0 -4
- package/dist/chunk-J4NBPC57.js +0 -1
- package/dist/chunk-J6LQR2F6.js +0 -7
- package/dist/chunk-JYGZD4HM.js +0 -1
- package/dist/chunk-K3HUQLIC.js +0 -6
- package/dist/chunk-K7D53KSJ.js +0 -1
- package/dist/chunk-KQFA5YTT.js +0 -97
- package/dist/chunk-KTD7VLHL.js +0 -2
- package/dist/chunk-L4DFMMOI.js +0 -1
- package/dist/chunk-LJZTSQRD.js +0 -11
- package/dist/chunk-LLPB6JN5.js +0 -9
- package/dist/chunk-LYIXRMQJ.js +0 -46
- package/dist/chunk-MCNK5SJ6.js +0 -2
- package/dist/chunk-MJZSSCGD.js +0 -5
- package/dist/chunk-N55MSO3X.js +0 -12
- package/dist/chunk-N5AZZYQA.js +0 -4
- package/dist/chunk-NCVGCVQ5.js +0 -6
- package/dist/chunk-O5FFMTJE.js +0 -25
- package/dist/chunk-OE3HSNSE.js +0 -16
- package/dist/chunk-ONF7XXEL.js +0 -1
- package/dist/chunk-PG4S5HJJ.js +0 -5
- package/dist/chunk-PHG4DASY.js +0 -18
- package/dist/chunk-PP4VCR4Y.js +0 -1
- package/dist/chunk-PWS4VFSD.js +0 -1
- package/dist/chunk-Q37WAD6F.js +0 -1
- package/dist/chunk-Q43LBSPT.js +0 -1
- package/dist/chunk-QAJZUJR5.js +0 -1
- package/dist/chunk-QO5RNGWA.js +0 -1
- package/dist/chunk-QPQS2YU3.js +0 -1
- package/dist/chunk-QUXQM3S3.js +0 -1
- package/dist/chunk-R3KSOCMB.js +0 -6
- package/dist/chunk-R74WHKHH.js +0 -15
- package/dist/chunk-RJSQMKKS.js +0 -1
- package/dist/chunk-RK2V6OIJ.js +0 -2
- package/dist/chunk-RUHQNF2W.js +0 -1
- package/dist/chunk-RXTLNUPF.js +0 -1
- package/dist/chunk-SNE4RHM4.js +0 -1
- package/dist/chunk-SQAS5RVZ.js +0 -10
- package/dist/chunk-SZI6G247.js +0 -103
- package/dist/chunk-TVCWDEVS.js +0 -1
- package/dist/chunk-TYMYIUIQ.js +0 -1
- package/dist/chunk-UIC7K2HX.js +0 -7
- package/dist/chunk-UNHT4ZFP.js +0 -317
- package/dist/chunk-UQ6ALA3Y.js +0 -3
- package/dist/chunk-UWI76E2L.js +0 -18
- package/dist/chunk-VE35YELD.js +0 -1
- package/dist/chunk-VGBUN3CZ.js +0 -17
- package/dist/chunk-VMNOSVPT.js +0 -8
- package/dist/chunk-VNFUCH6T.js +0 -1
- package/dist/chunk-W4KE7AO6.js +0 -1
- package/dist/chunk-WEPO4J2F.js +0 -19
- package/dist/chunk-WLWHCUPZ.js +0 -1
- package/dist/chunk-XGKCPD6W.js +0 -1
- package/dist/chunk-XNVOKAF2.js +0 -1
- package/dist/chunk-XSMCQLJW.js +0 -1
- package/dist/chunk-XUUIBSLW.js +0 -1
- package/dist/chunk-XWQM2NZ2.js +0 -2
- package/dist/chunk-Y3PY5LP7.js +0 -3
- package/dist/chunk-Y62EMOQA.js +0 -1
- package/dist/chunk-Y743UVBS.js +0 -16
- package/dist/chunk-YBSX53QP.js +0 -1
- package/dist/chunk-YHCP326A.js +0 -16
- package/dist/chunk-YHESTFMZ.js +0 -4
- package/dist/chunk-YT27FIQN.js +0 -275
- package/dist/chunk-YTR5JHNJ.js +0 -2
- package/dist/chunk-YYA5VGDW.js +0 -1
- package/dist/chunk-Z6X2GT6Q.js +0 -1
- package/dist/chunk-ZEE32UH6.js +0 -1
- package/dist/cli/commands/app/app-logs/sources.js +0 -1
- package/dist/command-json-schema-SS4GDJTQ.js +0 -1
- package/dist/conf-store-54YJCIDK.js +0 -1
- package/dist/custom-oclif-loader-3UBH7Q7R.js +0 -1
- package/dist/deprecations-ZX7ZKF6L.js +0 -1
- package/dist/dist-JMNE7MP6.js +0 -1
- package/dist/dist-M2AXGBOL.js +0 -1
- package/dist/environments-KD2IDYPG.js +0 -1
- package/dist/error-AA6LW3PN.js +0 -1
- package/dist/error-handler-4VW3AV2G.js +0 -1
- package/dist/fs-4QZCAEP7.js +0 -1
- package/dist/is-global-FKG327CG.js +0 -1
- package/dist/json-error-32ETFU3V.js +0 -1
- package/dist/node-package-manager-M4XHUTQR.js +0 -1
- package/dist/notifications-system-QVM2JWKB.js +0 -1
- package/dist/os-FEHBQQKP.js +0 -1
- package/dist/out-53ABAVL7.js +0 -1
- package/dist/output-2LS5AOAH.js +0 -1
- package/dist/system-TMD2LYZM.js +0 -1
- package/dist/ui-FNPICAAH.js +0 -1
- package/dist/upgrade-YYPP5VZY.js +0 -1
- package/dist/version-OX3MORI6.js +0 -1
- package/dist/version-P7D5ME4Z.js +0 -1
- package/dist/workerd-TKVRZK2F.js +0 -18
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import{b as Ti}from"./chunk-LQ7ENG4V.js";import{$ as ci,$a as Fi,A as kt,Aa as Ei,B as Cr,Ba as so,C as ei,Ca as ao,D as ti,Da as co,E as Or,Ea as Pi,F as oi,Fa as lo,G as Dr,Ga as mo,H as Zt,Ha as xi,I as eo,Ia as uo,J as ot,Ja as po,K as ri,Ka as We,L as w,La as fo,M as G,Ma as ho,N as ni,Na as Ci,O as ke,Oa as Oi,P as to,Pa as Di,Q as Et,Qa as yo,R as rt,Ra as Je,S as Oe,Sa as at,T as ii,Ta as Pt,U as _e,Ua as wo,V as De,Va as ct,W as si,Wa as vo,X as oo,Xa as Ii,Y as we,Ya as $i,Z as Rr,Za as ji,_ as ai,_a as bo,a as Bn,aa as Tr,ab as Ai,b as de,ba as Ir,bb as _i,c as j,ca as nt,d as B,da as it,e as Gn,ea as li,f as Er,fa as ro,g as Yn,ga as di,h as qn,ha as mi,i as Wn,ia as ui,ib as Ni,j as Jn,ja as pi,k as zn,ka as fi,l as R,la as qe,m as Ze,ma as hi,n as Qn,na as X,o as Ye,oa as st,p as Ce,pa as gi,q as et,qa as yi,r as Kn,ra as no,s as Xn,sa as io,t as Pr,ta as wi,u as tt,ua as ve,v as St,va as vi,w as Ae,wa as bi,x as Zn,xa as $r,y as Xt,ya as Si,z as xr,za as ki}from"./chunk-R2BDABJD.js";import{a as An}from"./chunk-JLGA3B7P.js";import{b as Vn}from"./chunk-UWMZ5CSB.js";import{b as _n,c as Nn,d as Kt,h as Hn,j as Ln,k as Mn,l as Un}from"./chunk-XM7YUXTF.js";import{a as Pa}from"./chunk-UWHAOGO4.js";import{a as So}from"./chunk-FKIVKNOV.js";import{a as go,b as Ri}from"./chunk-7UOA4DI7.js";import{Ca as Ea,ha as ge,i as Cn,j as Se}from"./chunk-H4V55Y3Z.js";import{B as $n,l as Dn,m as Pe,p as Yt,s as Rn,u as Tn,x as In}from"./chunk-IUP7POIE.js";import{c as $}from"./chunk-Q2SZCZE7.js";import{A as H,B as te,D as Wt,E as $e,F as Te,I as ne,N as Jt,T as kr,a as Gt,z as W}from"./chunk-CZ22VZDA.js";import{a as xn}from"./chunk-J6TW43TG.js";import{c as En}from"./chunk-335BUVBP.js";import{a as Y}from"./chunk-BN7ZXAZJ.js";import{h as g,k as zt}from"./chunk-2VSNFOKD.js";import{Ab as Fe,Ba as vr,Bb as Fn,Cb as V,Da as Bt,Db as ye,Fa as Sn,Ga as kn,Hb as Ge,Ja as br,Na as Sr,Sa as K,U as Mt,Va as vt,_ as vn,la as ue,lb as On,ma as bn,nb as qt,oa as Ut,pa as wr,qb as xe,sb as ee,ta as oe,ub as je,va as Vt,xa as Ee,xb as Qt,yb as A,zb as jn}from"./chunk-LWCTKI4Z.js";import{i as M}from"./chunk-B4OMIONW.js";import{b as u,i as Be,j as Pn}from"./chunk-FZCGRIOM.js";import{s as bt}from"./chunk-3A3DZVEJ.js";import{b as me}from"./chunk-YTUUU33R.js";import{a as yn}from"./chunk-JD5P5RAJ.js";import{c as O,e as P,f as le,h as yr,i as Xe,j as wn}from"./chunk-IWTNUJGY.js";import{a as ka}from"./chunk-CX5CC6P5.js";import{e as re,g as c}from"./chunk-VKWPEFWQ.js";c();c();c();var jr=Y({name:"HydrogenBuildResult",definitions:{AbsolutePath:B},schema:u.object({directory:B,clientDirectory:B,serverDirectory:B,serverPath:B}).strict()});var Do=re(me(),1);c();c();var ko=[{name:"npm",lockfile:"package-lock.json",alternativeLockfiles:["npm-shrinkwrap.json"],installCommand:"npm ci"},{name:"yarn",lockfile:"yarn.lock",installCommand:"yarn install --frozen-lockfile"},{name:"pnpm",lockfile:"pnpm-lock.yaml",installCommand:"pnpm install --frozen-lockfile"},{name:"bun",lockfile:"bun.lockb",alternativeLockfiles:["bun.lock"],installCommand:"bun install --frozen-lockfile"}];function xa(e){let t="No lockfile found",o="If you don\u2019t commit a lockfile, then your app might install the wrong package versions when deploying. To avoid versioning issues, generate a new lockfile and commit it to your repository.",r=[["Generate a lockfile. Run",{command:"npm|yarn|pnpm install"}],"Commit the new file to your repository"];if(e)throw new g(t,o,r);te({headline:t,body:o,nextSteps:r})}function Ca(e,t){let o=e.map(({packageManager:s,foundLockfile:a})=>`${a} (created by ${s.name})`),r="Multiple lockfiles found",n=[`Your project contains more than one lockfile. This can cause version conflicts when installing and deploying your app. The following lockfiles were detected:
|
|
2
|
+
`,{list:{items:o}}],i=["Delete any unneeded lockfiles","Commit the change to your repository"];if(t)throw new g(r,n,i);te({headline:r,body:n,nextSteps:i})}function Oa(e){let t="Lockfile ignored by Git",o="Your project\u2019s lockfile isn\u2019t being tracked by Git. If you don\u2019t commit a lockfile, then your app might install the wrong package versions when deploying.",r=[`In your project\u2019s .gitignore file, delete any references to ${e}`,"Commit the change to your repository"];te({headline:t,body:o,nextSteps:r})}async function Hi(e,t=!1){if(Ye&&!process.env.SHOPIFY_UNIT_TEST)return;let o=[];for(let i of ko){let s=[i.lockfile,...i.alternativeLockfiles||[]];for(let a of s)if(await K(P(e,a))){o.push({packageManager:i,foundLockfile:a});break}}if(o.length===0)return xa(t);if(o.length>1)return Ca(o,t);let r=o[0].foundLockfile;(await _n(e,[r]).catch(()=>[])).length>0&&Oa(r)}c();var Da=["^cdn/","^_t/"];function Eo(e){let t=new Set;return Object.values(e.routes).filter(o=>Da.some(r=>new RegExp(r).test(o.path??""))).forEach(o=>{o.path&&t.add(o.path)}),[...t]}var Ra=["","cart","products/:productHandle","collections","collections/:collectionHandle","sitemap.xml","robots.txt","pages/:pageHandle","policies/:policyHandle","search","account","account/login","account/orders/:orderId","account/authorize"];function Po(e,t=Ra){let o=Object.values(e.routes),r=new Set(t);for(let n of t)for(let i of o)if(!n&&!i.path)r.delete(n);else if(n&&i.path){let s={path:i.path,parentId:i.parentId};for(;s.parentId&&s.parentId!=="root";){let m=o.find(l=>l.id===s.parentId);if(!m)break;s.path=m.path==null?s.path:`${m.path}/${s.path}`,s.parentId=m.parentId}let a=":?[^\\/\\?]+\\?",d=`^(${a}\\/)?`+n.replaceAll(".","\\.").replace(/\//g,`\\/(${a}\\/)?`).replace(/:[^/)?]+/g,"(:[^\\/]+|\\*)")+`(\\/${a})?$`;new RegExp(d).test(s.path)&&r.delete(n)}return[...r]}var Ne=100;function Li(e){e.length?te({headline:"Standard Shopify routes missing",body:`Your Hydrogen project is missing ${e.length} standard Shopify route${e.length>1?"s":""}.
|
|
3
|
+
Including these routes improves compatibility with Shopify\u2019s platform:
|
|
4
|
+
|
|
5
|
+
`+e.slice(0,Ne-(e.length<=Ne?0:1)).map(t=>`\u2022 /${t}`).join(`
|
|
6
|
+
`)+(e.length>Ne?`
|
|
7
|
+
\u2022 ...and ${e.length-Ne+1} more`:"")}):H({headline:"All standard Shopify routes present"})}function xo(e){e.length&&te({headline:"Reserved routes present",body:`Your Hydrogen project is using ${e.length} reserved route${e.length>1?"s":""}.
|
|
8
|
+
These routes are reserved by Shopify and may cause issues with your storefront:
|
|
9
|
+
|
|
10
|
+
`+e.slice(0,Ne-(e.length<=Ne?0:1)).map(t=>`\u2022 /${t}`).join(`
|
|
11
|
+
`)+(e.length>Ne?`
|
|
12
|
+
\u2022 ...and ${e.length-Ne+1} more`:"")})}c();c();var Fr="metafile.server.json",Co="server-bundle-analyzer.html";async function Mi(){return ue(await et("bundle","analyzer.html"))}function Ui(e,t){return e.replace("globalThis.METAFILE = '';",`globalThis.METAFILE = '${Buffer.from(t,"utf-8").toString("base64")}';`)}async function Vi(e){try{return` \u2502
|
|
13
|
+
`+(await(await import("esbuild")).analyzeMetafile(await ue(O(e,Fr)),{color:!0})).split(`
|
|
14
|
+
`).filter(r=>!r.match(/(.*)(node_modules\/|server-assets-manifest:|server-entry-module:)(react-dom|@remix-run|@shopify\/hydrogen|react-router|react-router-dom)\/(.*)/g)).slice(2,12).join(`
|
|
15
|
+
`).replace(/dist\/worker\/_assets\/.*$/ms,`
|
|
16
|
+
`).replace(/\n/g,`
|
|
17
|
+
`).replace(/(\.\.\/)+node_modules\//g,r=>M.dim(r))}catch(t){console.warn("Could not generate bundle analysis summary:",t.message)}}function Gi(e){let t;return{name:"hydrogen:bundle-analyzer",configResolved(o){t=o},async generateBundle(o,r){if(!t.build.ssr)return;let{root:n}=t,i=Object.values(r).find(h=>h.type==="chunk");if(!i||i.type!=="chunk"||!i.facadeModuleId||!o.dir)return;let s=await Mi().catch(()=>null);if(!s){console.warn("Bundle analyzer template not found");return}let a=new Set(Object.keys(i.modules)),d=[];for(let h of a){if(Ar(h)||_r(h))continue;let b=this.getModuleInfo(h);if(b?.id){d.push(b);for(let v of[...b.importedIds,...b.dynamicallyImportedIds])!Ar(v)&&!_r(v)&&a.add(v)}}let m=new Map,l=new Map,f=await Promise.all(d.map(async h=>{let b=le(n,h.id),v=i.modules[h.id],S=typeof v?.originalLength=="number"?v.originalLength:h.code?.length??0,k=v?.renderedLength??0;if(e?.minify&&v?.code){let D=await e.minify(v.code,h.id).catch(()=>null);D&&(k=D.length)}l.set(b,k);let x=D=>this.resolve(D,h.id),C=!h.code||/(^\s*export\s+[\w\{]|^\s*import\s+[\w\{'"]|\bimport\()|\bcreateRequire\(/ms.test(h.code)||!/((^|\b)exports\b|\brequire\()/.test(h.code),T=Bi(h.importedIds,"import-statement",n,x,h.code),_=Bi(h.dynamicallyImportedIds,"dynamic-import",n,x,h.code),E=(await Promise.all([...T,..._])).reduce((D,{importedId:q,...I})=>(Ar(q)?C=!1:_r(q)||D.push(I),D),[]);m.set(b,{bytes:S,format:C?"esm":"cjs",imports:E})})).then(()=>null).catch(h=>h);if(f){console.warn("Bundle analyzer failed to analyze the bundle:",f);return}let p=Object.fromEntries(m.entries()),y={inputs:p,outputs:{[le(n,O(o.dir,i.fileName))]:{imports:i.imports,exports:i.exports,entryPoint:le(n,i.facadeModuleId),bytes:i.code.length??0,inputs:Object.entries(p).reduce((h,[b,v])=>(h[b]={bytesInOutput:l.get(b)??v.bytes??0},h),{})}}};this.emitFile({type:"asset",fileName:Fr,source:JSON.stringify(y,null,2)}),this.emitFile({type:"asset",fileName:Co,source:Ui(s,JSON.stringify(y))})}}}function Ar(e){return/(commonjsHelpers\.js$|\?commonjs\-)/.test(e)}function _r(e){return e.endsWith("?transform-only")}async function Ta(e,t,o){let r=t.matchAll(/import\s[^'"]*?['"]([^'"]+)['"]/g)??[];for(let[,n]of r)if(n&&(await o(n))?.id===e)return n;return e}function Bi(e,t,o,r,n){return e.map(async i=>({importedId:i,path:le(o,i),kind:t,original:n?await Ta(i,n,r):i}))}c();import{spawn as Ia}from"node:child_process";import{fileURLToPath as qi}from"node:url";var $a=process.argv[1],ja=qi(import.meta.url),Fa=$a===ja;Fa&&xt({rootDirectory:process.argv[2],appDirectory:process.argv[3],configFilePath:process.argv[4],watch:!0});function Wi(e,t){if(e.includes("AbortError: ")){let s=e.split("AbortError: ")[1]??"",a=s.split(`
|
|
18
|
+
`)[0],d=s.match(/tryMessage: '(.*)',$/m)?.[1];if(a)return{message:a,details:d}}let[o="",...r]=e.replaceAll("[FAILED]","").replace(/\s{2,}/g,`
|
|
19
|
+
`).replace(/\n,\n/,`
|
|
20
|
+
`).trim().split(`
|
|
21
|
+
`),n="[Codegen] "+o,i=r.join(`
|
|
22
|
+
`);if(t){let s=t.replaceAll("\\","/")+"/";i=i.replaceAll(s,"")}return{message:n,details:i}}function Oo({rootDirectory:e,appDirectory:t,configFilePath:o}){let r,n,i=process.argv.findIndex(a=>a==="hydrogen");i>=1?(r=process.argv[0],n=[...process.argv.slice(1,i+1),"codegen","--watch","--path",e],o&&n.push("--codegen-config-path",o)):(r="node",n=[qi(import.meta.url),e,t??P("app"),o??""]);let s=Ia(r,n,{stdio:["inherit","ignore","pipe"]});return s.stderr.on("data",a=>{let d=typeof a=="string"?a:a?.toString?.("utf8")??"";if(!d)return;let{message:m,details:l}=Wi(d,e);/`punycode`/.test(m)||/\.body\[\d\]/.test(m)||/console\.time(End)?\(\)/.test(m)||/─ (warning|info|success) ───/.test(m)||(W({body:""}),te({headline:m,body:l}))}),s.on("close",a=>{a&&a>0&&te({headline:"Codegen process exited with code "+a,body:"There should be more logs above."})}),s}async function xt(e){return await Aa(e),_a(e).catch(t=>{if(t instanceof g)throw t;let{message:o,details:r}=Wi(t.message,e.rootDirectory);throw new g(o,r)})}async function Aa(e){let{execSync:t,exec:o}=await import("child_process");try{t("npx react-router --version",{cwd:e.rootDirectory,stdio:"ignore"})}catch{W({body:"React Router not found, skipping typegen"});return}e.watch?o("npx react-router typegen --watch",{cwd:e.rootDirectory}):t("npx react-router typegen",{cwd:e.rootDirectory,stdio:de()?"pipe":"inherit"})}async function _a({watch:e,configFilePath:t,forceSfapiVersion:o,...r}){let{generate:n,loadCodegenConfig:i,CodegenContext:s}=await Et("@graphql-codegen/cli",r.rootDirectory).catch(()=>{throw new g("Could not load GraphQL Codegen CLI.","Please make sure you have `@graphql-codegen/cli` installed as a dev dependency.")}),{config:a}=await i({configFilePath:t??r.rootDirectory})||await Na(r,o);await Ha(a,r);let d=new s({config:{...a,watch:e,silent:!e,cwd:r.rootDirectory},filepath:"not-used-but-must-be-set"});d.cwd=r.rootDirectory;let m=await n(d,!0);if(e)return{};let l=Object.entries(a.generates);return Object.fromEntries(m.map(({filename:f})=>{let p=P(r.rootDirectory,f),h=(l.find(([S])=>P(r.rootDirectory,S)===p)??l.filter(([S,k])=>!Array.isArray(k)&&k.preset&&p.startsWith(P(r.rootDirectory,S)+"/")).sort(([S],[k])=>k.length-S.length)[0])?.[1],v=[a.documents,h&&!Array.isArray(h)?h.documents:void 0].flat().flatMap(S=>typeof S=="string"?[S]:S?Object.keys(S):[]);return[f,[...new Set(v)]]}))}async function Na({rootDirectory:e,appDirectory:t=P(e,"app")},o){let{getSchema:r,preset:n,pluckConfig:i}=await Et("@shopify/hydrogen-codegen",e).catch(()=>{throw new g("Could not load Hydrogen Codegen.","Please make sure you have `@shopify/hydrogen-codegen` installed as a dev dependency.")}),{loadConfig:s}=await Et("graphql-config",e).catch(()=>{throw new g("Could not load GraphQL Config.","Please make sure you have `graphql-config` installed as a dev dependency.")}),a=await s({rootDir:e,throwOnEmpty:!1,throwOnMissing:!1,legacy:!1}).catch(()=>{}),d=r("storefront"),m=Yi(d,a),l=r("customer-account",{throwIfMissing:!1}),f=l?Yi(l,a):void 0,p="*!(*.d).{ts,tsx,js,jsx}",y=le(e,t),h=v=>{let S=Xe(d),k=l&&Xe(l);return!!(v.endsWith(S)||k&&v.endsWith(k))},b=Object.values(a?.projects??{}).filter(v=>v.hasExtension("codegen")&&(typeof v.schema!="string"||!h(v.schema)));return{filepath:"virtual:codegen",config:{overwrite:!0,pluckConfig:i,generates:{...Nr(m)??{"storefrontapi.generated.d.ts":{preset:n,schema:d,documents:m?.documents??[p,O(y,"**",p)],...!!o&&{presetConfig:{importTypes:!1},schema:{[`https://hydrogen-preview.myshopify.com/api/${o.split(":")[0]}/graphql.json`]:{headers:{"content-type":"application/json","X-Shopify-Storefront-Access-Token":o.split(":")[1]??"3b580e70970c4528da70c98e097c2fa0"}}},config:{defaultScalarType:"string",scalars:{JSON:"unknown"}}}}},...Nr(f)??(f?.documents?{"customer-accountapi.generated.d.ts":{preset:n,schema:l,documents:f.documents}}:{}),...b.reduce((v,S)=>({...v,...Nr(S)}),{})}}}}function Nr(e){if(e?.extensions?.codegen?.generates)return Object.entries(e.extensions.codegen.generates).reduce((t,[o,r])=>(t[o]={...e,...Array.isArray(r)?r[0]:r},t),{})}function Yi(e,t){if(!t)return;let o=Xe(e);return Object.values(t.projects||{}).find(r=>typeof r.schema=="string"&&r.schema.endsWith(o))}async function Ha(e,{rootDirectory:t}){let o=Symbol.for("name"),r=Object.values(e.generates).filter(n=>{let i=(Array.isArray(n)?n[0]:n)?.preset;if(typeof i=="object"&&o in i)return i[o]==="hydrogen"||i[o]==="@shopify/graphql-codegen"});for(let n of r){let i=Array.isArray(n)?n[0]:n;if(i){let s=await tt(t);i.hooks={beforeOneFileWrite:(a,d)=>St(d,s,a),...i.hooks}}}}c();function Ct(){let{env:e}=process;return e.CI==="false"?!1:!!(e.CI||e.CI_NAME||e.BUILD_NUMBER||e.TF_BUILD)}c();function Ot(){let e={state:"pending"};return e.promise=new Promise((t,o)=>{e.resolve=r=>(e.state==="pending"&&(e.state="resolved"),t(r)),e.reject=r=>(e.state==="pending"&&(e.state="rejected"),o(r))}),e}c();function He(e){let t,o=process.exit;process.exit=async r=>{t??=e();let n=setTimeout(()=>o(r),5e3);return await t,clearTimeout(n),o(r)}}import{realpath as La}from"node:fs/promises";var Ro=class e extends R{static get jsonOutputSchema(){return jr}static descriptionWithMarkdown="Builds a Hydrogen storefront for production. The client and app worker files are compiled to a `/dist` folder in your Hydrogen project directory.";static description=this.descriptionForHelp();static flags={...$,...w.path,...w.entry,...w.sourcemap,...w.lockfileCheck,...w.disableRouteWarning,...w.codegen,watch:Do.Flags.boolean({description:"Watches for changes and rebuilds the project writing output to disk.",env:"SHOPIFY_HYDROGEN_FLAG_WATCH"}),"bundle-stats":Do.Flags.boolean({description:"Show a bundle size summary after building. Defaults to true, use `--no-bundle-stats` to disable.",allowNo:!0}),"force-client-sourcemap":Do.Flags.boolean({description:"Client sourcemapping is avoided by default because it makes backend code visible in the browser. Use this flag to force enabling it.",env:"SHOPIFY_HYDROGEN_FLAG_FORCE_CLIENT_SOURCEMAP"})};async run(){let{flags:t}=await this.parse(e);if(t.json&&t.watch)throw new g("--json cannot be combined with --watch. Run without --watch for a finite result.");let o=t.path?P(t.path):process.cwd(),r={...G(t),useCodegen:t.codegen,directory:o};if(!await oo(o))throw new g(De);let i=await ze(r);r.watch?i?.close&&He(async()=>{await i?.close()}):(j(jr,i.result,t.json),await Qt(),process.exit(0))}},Ma=5;async function ze({json:e=de(),entry:t,directory:o,useCodegen:r=!1,codegenConfigPath:n,sourcemap:i=!0,forceClientSourcemap:s,disableRouteWarning:a=!1,lockfileCheck:d=!0,assetPath:m,bundleStats:l=!Ct(),watch:f=!1,onServerBuildStart:p,onServerBuildFinish:y}){process.env.NODE_ENV||(process.env.NODE_ENV="production"),m=m??process.env.HYDROGEN_ASSET_BASE_URL??"/";let h=await La(o??process.cwd());d&&await Hi(h,Ct());let[b,{userViteConfig:v,remixConfig:S,clientOutDir:k,serverOutDir:x,serverOutFile:C}]=await Promise.all([to(h),we(h,t)]),T=b.createLogger(f?"warn":void 0);process.env.SHOPIFY_UNIT_TEST&&(T.info=L=>je("info",L),T.warn=L=>je("warn",L),T.error=L=>je("error",L)),e&&(T.info=L=>Be({type:"diagnostic",level:"info",message:Ge(L)}),T.warn=L=>Be({type:"diagnostic",level:"warning",message:Ge(L)}),T.warnOnce=T.warn,T.error=L=>Be({type:"diagnostic",level:"error",message:Ge(L)}));let _=v.build?.minify??!0,E={root:h,mode:process.env.NODE_ENV,base:m,customLogger:T,...e?{logLevel:"warn"}:{}},D,q=await b.build({...E,build:{emptyOutDir:!0,copyPublicDir:!0,sourcemap:s??(process.env.NODE_ENV!=="production"&&i),watch:f?{}:null},server:{watch:f?{}:null},plugins:[{name:"hydrogen:cli:client",buildStart(){D?.resolve(),D=Ot()},buildEnd(L){L&&D.reject(L)},writeBundle(){D.resolve()},closeWatcher(){this.error(new Error("Process exited before client build finished."))}}]});e||console.log("");let I,N=await b.build({...E,build:{sourcemap:i,ssr:t??!0,emptyOutDir:!1,copyPublicDir:!1,minify:_,watch:f?{buildDelay:100}:null},server:{watch:f?{}:null},plugins:[{name:"hydrogen:cli:server",async buildStart(){await D.promise,I?.resolve(),I=Ot(),await p?.()},async writeBundle(){I?.state!=="rejected"&&await y?.(),I.resolve()},closeWatcher(){this.error(new Error("Process exited before server build finished."))}},...l?[Gi({minify:_?(L,Q)=>b.transformWithEsbuild(L,Q,{minify:!0,minifyWhitespace:!0,minifySyntax:!0,minifyIdentifiers:!0,sourcemap:!1,treeShaking:!1,legalComments:"none",target:"esnext"}).then(fe=>fe.code):void 0})]:[]]});f||await Promise.all([Ee(O(k,".vite")),Ee(O(x,".vite")),Ee(O(x,"assets"))]);let J={rootDirectory:h,appDirectory:S.appDirectory,configFilePath:n},ae=r?f?Oo(J):await xt(J).then(()=>{}):void 0;if(!f&&process.env.NODE_ENV!=="development"){if(l){let Q="file://"+O(x,Co);A(ee`${await Vi(x)||`
|
|
23
|
+
`}\n │\n └─── ${xe.link("Complete analysis: "+Q,Q)}\n\n`)}await Sn(C)/(1024*1024)>=Ma&&V(`\u{1F6A8} Smaller worker bundles are faster to deploy and run.${_?"":"\n Minify your bundle by adding `build.minify: true` to vite.config.js."}
|
|
24
|
+
Learn more about optimizing your worker bundle file: https://h2o.fyi/debugging/bundle-size
|
|
25
|
+
`)}if(!f&&!a){let L=Po(S);if(L.length){let Q=await Pe(h),fe=Q==="npm"?"npx":Q;V(`Heads up: Shopify stores have a number of standard routes that aren\u2019t set up yet.
|
|
26
|
+
Some functionality and backlinks might not work as expected until these are created or redirects are set up.
|
|
27
|
+
This build is missing ${L.length} route${L.length>1?"s":""}. For more details, run \`${fe} shopify hydrogen check routes\`.
|
|
28
|
+
`)}}return!f&&!a&&xo(Eo(S)),{result:{directory:P(h),clientDirectory:P(k),serverDirectory:P(x),serverPath:P(C)},async close(){ae?.removeAllListeners("close"),ae?.kill("SIGINT");let L=[];"close"in q&&L.push(q.close()),"close"in N&&L.push(N.close()),await Promise.allSettled(L),(D?.state==="pending"||I?.state==="pending")&&(D?.promise.catch(()=>{}),D?.reject(),I?.promise.catch(()=>{}),I?.reject(),await new Promise(Q=>setTimeout(Q,500)))}}}c();c();var Hr=Y({name:"HydrogenCheckResult",schema:u.object({valid:u.boolean(),missingRoutes:u.array(u.string()),reservedRoutes:u.array(u.string())}).strict()});var Ji=re(me(),1),To=class e extends R{static get jsonOutputSchema(){return Hr}static descriptionWithMarkdown="Checks whether your Hydrogen app includes a set of standard Shopify routes.";static description=this.descriptionForHelp();static flags={...$,...w.path};static args={resource:Ji.Args.string({name:"resource",description:"The resource to check. Currently only 'routes' is supported.",required:!0,options:["routes"]})};async run(){let{flags:t,args:o}=await this.parse(e),r=t.path?P(t.path):process.cwd();if(o.resource==="routes")await Ua({directory:r},t.json);else throw new Error("Invalid command argument.")}};async function Ua(e,t){let o=await Va(e);return j(Hr,o,t)||(Li(o.missingRoutes),xo(o.reservedRoutes)),o}async function Va({directory:e}){let t=await _e(e),o=Po(t),r=Eo(t);return{valid:o.length===0&&r.length===0,missingRoutes:o,reservedRoutes:r}}c();c();var Lr=Y({name:"HydrogenCodegenResult",schema:u.object({files:u.array(u.object({path:B,sources:u.array(u.string()).describe("Source patterns from the GraphQL codegen configuration.")}).strict())}).strict()});var Io=re(me(),1);var $o=class e extends R{static get jsonOutputSchema(){return Lr}static descriptionWithMarkdown="Automatically generates GraphQL types for your project\u2019s Storefront API queries.";static description=this.descriptionForHelp();static flags={...$,...w.path,"codegen-config-path":Io.Flags.string({description:"Specify a path to a codegen configuration file. Defaults to `<root>/codegen.ts` if it exists.",required:!1}),"force-sfapi-version":Io.Flags.string({description:"Force generating Storefront API types for a specific version instead of using the one provided in Hydrogen. A token can also be provided with this format: `<version>:<token>`.",hidden:!0}),watch:Io.Flags.boolean({description:"Watch the project for changes to update types on file save.",required:!1,default:!1})};async run(){let{flags:t}=await this.parse(e),o=t.path?P(t.path):process.cwd();if(t.json&&t.watch)throw new g("--json cannot be combined with --watch. Run without --watch for a finite result.");await Ba({...G(t),directory:o})}};async function Ba({directory:e,codegenConfigPath:t,forceSfapiVersion:o,watch:r,json:n=de()}){let{root:i}=Oe(e),s=await _e(i);n||console.log("");let a=await xt({...s,configFilePath:t,forceSfapiVersion:o,watch:r}),d={files:Object.entries(a).map(([m,l])=>({path:P(i,m),sources:l}))};return!r&&!j(Lr,d,n)&&H({headline:"Generated types for GraphQL:",body:{list:{items:Object.entries(a).map(([m,l])=>m+`
|
|
29
|
+
`+l.map(f=>M.dim(`- ${f}`)).join(`
|
|
30
|
+
`))}}}),d}c();var Ki=re(me(),1);c();import{Session as Ga}from"node:inspector";import jo from"node:vm";import{isBuiltin as Ya}from"node:module";var qa=new Set(["assert","assert/strict","buffer","events","path","path/posix","path/win32","querystring","string_decoder","url","util","util/types"]);async function zi(){return{async run(e,t){let o=await ue(e),r=Wa(),n=a=>Ja(a,r),i=await za(),s;try{let a=new jo.SourceTextModule(o,{identifier:"<script>",context:r,importModuleDynamically:async d=>{let m=await n(d);return await m.link(n),await m.evaluate(),m}});await a.link(n),await a.evaluate()}finally{s=await i()}return Qa(s,e+".map",t)}}}function Wa(){let e=()=>{throw new g("Asynchronous I/O and timers are unavailable during Worker startup.")},t=jo.createContext({console,performance,crypto,URL,URLSearchParams,Request,Response,Headers,FormData,Blob,File,TextEncoder,TextDecoder,TextEncoderStream,TextDecoderStream,ReadableStream,WritableStream,TransformStream,CompressionStream,DecompressionStream,AbortController,AbortSignal,DOMException,Event,EventTarget,atob,btoa,structuredClone,queueMicrotask,fetch:e,setTimeout:e,setInterval:e,clearTimeout:()=>{},clearInterval:()=>{},caches:{default:{match:e,put:e,delete:e},open:e}});return jo.runInContext("globalThis.self = globalThis",t),t}async function Ja(e,t){if(!Ya(e))throw new g(`Cannot profile an unbundled import: ${e}`,"Bundle this dependency into the server build before profiling startup.");let o=e.replace(/^node:/,"");if(!qa.has(o))throw new g(`Cannot profile unsupported Node built-in: ${e}`,"CPU startup profiling supports only built-ins without host I/O.");let r=await import(`node:${o}`),n=Object.keys(r);return new jo.SyntheticModule(n,function(){for(let i of n)this.setExport(i,r[i])},{context:t})}function za(){let e=new Ga;return e.connect(),new Promise(t=>{e.post("Profiler.enable",()=>{e.post("Profiler.start",()=>{t(()=>new Promise((o,r)=>{e.post("Profiler.stop",(n,{profile:i})=>{if(e.disconnect(),n)return r(n);o(i)})}))})})})}async function Qa(e,t,o){let{SourceMapConsumer:r}=await import("./source-map-E7FCCJL7.js"),n=JSON.parse(await ue(t)),i=await new r(n,"file://"+t),s=new Set,a=0,d=e.endTime-e.startTime,m=e.samples?.length?d/e.samples.length:0;for(let l of e.nodes)(l.callFrame.url==="<script>"||s.has(l.id))&&(s.add(l.id),l.children?.forEach(f=>s.add(f))),s.has(l.id)?(l.callFrame.url==="<script>"&&l.callFrame.lineNumber>=0&&l.callFrame.columnNumber>=0&&Ka(l,i),l.callFrame.url==="<script>"&&!l.callFrame.functionName&&!l.callFrame.lineNumber&&!l.callFrame.columnNumber&&(l.callFrame.url=o??"",l.callFrame.functionName="(top-level app code)"),a+=Math.round((l.hitCount??0)*m*1e3)/1e3):Xa(l);return i.destroy(),{profile:e,totalTimeMs:d/1e3,totalScriptTimeMs:a/1e3}}function Ka(e,t){let o=t.originalPositionFor({line:e.callFrame.lineNumber+1,column:e.callFrame.columnNumber+1});e.callFrame.url=o.source||e.callFrame.url,e.callFrame.functionName=o.name||e.callFrame.functionName,e.callFrame.lineNumber=o.line?o.line-1:e.callFrame.lineNumber,e.callFrame.columnNumber=o.column??e.callFrame.columnNumber}function Xa(e){Object.assign(e,{children:[],callFrame:{functionName:"(profiler)",scriptId:"0",url:"",lineNumber:-1,columnNumber:-1}})}var Qi="startup.cpuprofile",Fo=class e extends R{static descriptionWithMarkdown="Builds the app and runs the resulting code to profile the server startup time, watching for changes. This command can be used to [debug slow app startup times](https://shopify.dev/docs/custom-storefronts/hydrogen/debugging/cpu-startup) that cause failed deployments in Oxygen.\n\n The profiling results are written to a `.cpuprofile` file that can be viewed with certain tools such as [Flame Chart Visualizer for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-js-profile-flame).";static description="Builds and profiles the server startup time the app.";static flags={...w.path,...w.entry,output:Ki.Flags.string({description:`Specify a path to generate the profile file. Defaults to "${Qi}".`,default:Qi,required:!1})};async run(){let{flags:t}=await this.parse(e),o=t.path?P(t.path):process.cwd(),{close:r}=await Za({...G(t),directory:o,output:P(o,t.output)});He(async()=>{await r()})}};async function Za({directory:e,entry:t,output:o}){process.env.NODE_ENV||(process.env.NODE_ENV="production"),st({workerReload:!1});let{buildPath:r,buildPathWorkerFile:n}=Oe(e);A(`\u23F3\uFE0F Starting profiler for CPU startup... Profile will be written to:
|
|
31
|
+
`+M.dim(o));let i=0,s,a=await zi(),d={onServerBuildStart(){i>0&&process.stdout.write(qt.eraseLines(4)),A(`
|
|
32
|
+
#${++i} Building and profiling...`)},async onServerBuildFinish(){let{profile:p,totalScriptTimeMs:y}=await a.run(n,s);process.stdout.write(qt.eraseLines(2)),A(`#${i} Total time: ${y.toLocaleString()} ms
|
|
33
|
+
${M.dim(o)}`),await oe(o,JSON.stringify(p,null,2)),A(`
|
|
34
|
+
Waiting for changes...`)}};if(await rt(e))throw new g(De);let l=await we(e).catch(()=>null);n=l?.serverOutFile??O(r,"server","index.js"),s=l?.remixConfig.serverEntryPoint??"";let f=await ze({entry:t,directory:e,watch:!0,sourcemap:!0,disableRouteWarning:!0,lockfileCheck:!1,bundleStats:!1,...d,onServerBuildStart(){return i===0&&process.stdout.write(qt.eraseLines(1)),d.onServerBuildStart()}});return{async close(){await f.close()}}}c();c();var Xi=u.object({url:u.string().url(),authBypassToken:u.string().nullable()}).strict(),Ao=Y({name:"HydrogenDeployResult",schema:u.object({status:u.enum(["success","cancelled"]),deployment:Xi.nullable()}).strict().describe("The command result. The existing h2_deploy_log.json file retains Oxygen CompletedDeployment format, independently of this result."),definitions:{Deployment:Xi}});var ie=re(me(),1);c();c();import Zi from"fs";import es,{dirname as ec}from"path";import{fileURLToPath as tc}from"url";var _o={assetsDirDefault:"dist/client/",buildCommandDefault:"npm build",verificationDurationDefault:180,maxUploadAttempts:3,maxResumabeUploadAttempts:9,workerDirDefault:"dist/worker/"};function Re(e){if(oc(e)){if(e.statusCode===401)throw new g("You are not authorized to perform this action. Please check your deployment token.");if(e.statusCode===429)throw new g("You've made too many requests. Please try again later")}if(e instanceof g&&e.message.includes("503"))throw new g("The server is currently unavailable. Please try again later.")}var pe=(e=>(e.OxygenNamespaceHandle="X-Oxygen-Namespace-Handle",e))(pe||{});function oc(e){return typeof e=="object"&&e!==null&&"statusCode"in e}function Dt(e){let t;if(e)t=es.join(e,"package.json");else{let r=tc(import.meta.url),n=ec(r);t=es.join(n,"../../package.json")}if(!Zi.existsSync(t))return{};let o=Zi.readFileSync(t,"utf8");return JSON.parse(o)}function Mr(e){process.stderr.write(`${e}
|
|
35
|
+
`)}var lt=375;function Ur(e){try{let t=Buffer.from(e,"base64").toString("utf-8"),o=JSON.parse(t);return rs(o)}catch{throw new Error("Error processing deployment token. Please check your token and try again.")}}function ts(e){if(!e)return;let t=Number(e);if(isNaN(t))throw new g("Invalid duration format. Please specify the duration in hours (e.g., '10').");if(t>12||t<1)throw new g("Invalid duration length. Please specify the duration (in hours) between 1 to 12 hours.");return t}async function os({config:e,performedBuild:t=!1}){let{rootPath:o,workerDir:r,assetsDir:n,skipBuild:i,workerOnly:s}=e,a={root:o};(i||t)&&(a.worker=O(o,r),s||(a.assets=O(o,n)));for(let m of Object.keys(a))await rc(a[m],m);if(!/^https:\/\/(?:[\w-]+\.)*[\w-]+|^https:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/.test(e.deploymentUrl))throw new Error(`Invalid deployment service URL: ${e.deploymentUrl}`)}async function rc(e,t){if(!await K(e))throw t==="assets"&&V('Use the "workerOnly" flag to perform a worker-only deployment.',Mr),new Error(`Path not found: ${e}`)}function rs(e){return typeof e=="object"?Object.keys(e).reduce((t,o)=>{let r=o.replace(/([-_][a-z])/gi,n=>n.toUpperCase().replace("-","").replace("_",""));if(e[o]===void 0)throw new Error(`Invalid token: ${o} is undefined`);return t[r]=rs(e[o]),t},{}):e}c();var No=re(Ea(),1);var ns;function nc(e){if(e)return;if(No.default._client)return No.default;let o={apiKey:"21fd37fe87ead4b9c5a8eed90752b455",autoDetectErrors:!0,appVersion:Dt().version,endpoints:{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com"},logger:null};return No.default.start(o)}function is(e){ns=nc(e)}function dt(){return ns}function ss(e,t){if(!t)return e;let o=r=>r.replace(new RegExp(t,"g"),"***");if(e instanceof Error){let r=Object.create(Object.getPrototypeOf(e));return Object.assign(r,e,{message:o(e.message),stack:e.stack?o(e.stack):void 0}),r}return o(e)}c();var ce=(e=>(e.BuildTime="build_time",e.NumFilesRequested="num_files_requested",e.NumFilesUploaded="num_files_uploaded",e.TotalSizeUploaded="total_size_uploaded",e.TotalSizeRequested="total_size_requested",e.TotalTime="total_time",e.UploadTime="upload_time",e.DeploymentCompletedTime="deployment_completed_time",e.DeploymentRoutableTime="deployment_routable_time",e))(ce||{}),Ho=class{metrics={};metricPrefix="oxygen.cli";defaultTags;exportUrl;constructor(t){let{version:o}=Dt(),{version:r}=Dt(`${t.rootPath}/node_modules/@shopify/hydrogen`);this.defaultTags={ci_provider:t.ciProvider,cli_version:`oxygen-cli@${o||"unknown"}`,hydrogen_version:r||"unknown"},this.exportUrl="https://metrics.myshopify.dev"}add(t,o,r={}){let n={value:o,tags:r};this.metrics[t]?this.metrics[t].push(n):this.metrics[t]=[n]}formatTags(t){return Object.entries(t).map(([o,r])=>`${o}:${r}`)}async export(){let t=Object.entries(this.metrics).map(([o,r])=>{let n=`${this.metricPrefix}.${o}`;return r.map(({value:i,tags:s})=>({name:n,type:"gauge",value:i,tags:this.formatTags({...s,...this.defaultTags})}))}).flat();try{await Se(this.exportUrl,{method:"POST",body:JSON.stringify({events:t})})}catch(o){let r=dt();r&&(o instanceof Error||typeof o=="string")&&r.notify(o)}}};c();c();var as=`
|
|
36
|
+
mutation BuildInitiate($environment: EnvironmentSelectorInput, $labels: [String!]) {
|
|
37
|
+
buildInitiate(environment: $environment, labels: $labels) {
|
|
38
|
+
build {
|
|
39
|
+
id
|
|
40
|
+
assetPath
|
|
41
|
+
}
|
|
42
|
+
userErrors {
|
|
43
|
+
message
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`;async function cs(e){let{config:t,logger:o,environment:r,labels:n=[]}=e,i={environment:r,labels:n};try{let s=await ge({query:as,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:i,addedHeaders:{[pe.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(s.buildInitiate.userErrors.length>=1)throw new g(`Failed to create build. ${s.buildInitiate.userErrors[0]?.message}`);return Fe(`Build initiated successfully with id ${s.buildInitiate.build.id}.`,o),s.buildInitiate}catch(s){throw Re(s),s}}c();c();var ls=`
|
|
48
|
+
mutation BuildCancel($buildId: ID!, $reason: String!) {
|
|
49
|
+
buildCancel(id: $buildId, reason: $reason) {
|
|
50
|
+
build {
|
|
51
|
+
id
|
|
52
|
+
}
|
|
53
|
+
userErrors {
|
|
54
|
+
message
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;async function ds(e){let{config:t,buildId:o,reason:r,logger:n}=e,i={buildId:o,reason:r};try{let s=await ge({query:ls,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,addedHeaders:{[pe.OxygenNamespaceHandle]:t.deploymentToken.namespace},variables:i});if(s.buildCancel.userErrors.length>=1)throw new g(`Failed to cancel build: ${s.buildCancel.userErrors[0]?.message}`);return A(`Build with id ${o} cancelled.`,n),s.buildCancel}catch(s){throw Re(s),s}}c();c();var Lo=(e=>(e.Worker="WORKER",e.Asset="ASSET",e))(Lo||{}),mt=class extends Error{},Qe=class extends Error{};async function us(e,t){let o=O(e.rootPath,e.workerDir),r=await vt(`${o}/**`),n=ms({files:r,basePath:o,type:Lo.Worker,filter:sc});if(!e.workerOnly){let s=O(e.rootPath,e.assetsDir),a=await vt(`${s}/**`);n=[...n,...ms({files:a,basePath:s,type:Lo.Asset,filter:ac})]}t?.add(ce.NumFilesRequested,n.length);let i=n.reduce((s,a)=>s+a.fileSize,0)/1024;return t?.add(ce.TotalSizeRequested,i),n}function ic(e){let t=bn(e);return En(t)}function ms(e){let{files:t,basePath:o,type:r,filter:n}=e,i=[];return t.forEach(s=>{let a=le(o,s);n&&!n(a)||i.push({filePath:a,fileSize:kn(s),mimeType:An(s),fileType:r,fileHash:ic(s)})}),i}function sc(e){let t=["oxygen.json"],o=[".js.map",".mjs.map",".map",".js",".mjs"],n=`^(${["index"].join("|")})(${o.join("|")})$`;return new RegExp(n).test(e.toLowerCase())||t.includes(e)}function ac(e){let o=`(${[".map"].join("|")})$`;return!new RegExp(o).test(e.toLowerCase())}c();c();var ps=`
|
|
59
|
+
mutation DeploymentInitiate($buildId: ID, $environment: EnvironmentSelectorInput, $labels: [String!], $files: [FileInput!]!) {
|
|
60
|
+
deploymentInitiate(buildId: $buildId, environment: $environment, labels: $labels, files: $files) {
|
|
61
|
+
deployment {
|
|
62
|
+
id
|
|
63
|
+
}
|
|
64
|
+
deploymentTargets {
|
|
65
|
+
filePath
|
|
66
|
+
fileSize
|
|
67
|
+
uploadUrl
|
|
68
|
+
fileType
|
|
69
|
+
parameters {
|
|
70
|
+
name
|
|
71
|
+
value
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
deploymentConfiguration {
|
|
75
|
+
timeoutInSeconds
|
|
76
|
+
}
|
|
77
|
+
userErrors {
|
|
78
|
+
message
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`;async function fs(e){let{config:t,input:o,logger:r}=e,n={buildId:o.buildId,environment:o.environment,files:o.manifest,labels:o.labels};try{let i=await ge({query:ps,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:n,addedHeaders:{[pe.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(i.deploymentInitiate.userErrors.length>=1)throw new g(`Failed to create deployment. ${i.deploymentInitiate.userErrors[0]?.message}`);return Fe(`Deployment initiated, ${i.deploymentInitiate.deploymentTargets.length} files to upload.`,r),i.deploymentInitiate}catch(i){throw Re(i),i}}c();c();var hs=`
|
|
83
|
+
mutation DeploymentComplete($deploymentId: ID!, $generateAuthBypassToken: Boolean, $authBypassTokenDuration: Int, $environmentVariables: [EnvironmentVariableInput!]) {
|
|
84
|
+
deploymentComplete(id: $deploymentId, generateAuthBypassToken: $generateAuthBypassToken, authBypassTokenDuration: $authBypassTokenDuration, environmentVariables: $environmentVariables) {
|
|
85
|
+
deployment {
|
|
86
|
+
id
|
|
87
|
+
url
|
|
88
|
+
}
|
|
89
|
+
authBypassToken
|
|
90
|
+
userErrors {
|
|
91
|
+
message
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`;async function gs(e,t){let o={deploymentId:t,generateAuthBypassToken:e.generateAuthBypassToken};if(e.generateAuthBypassToken)o.authBypassTokenDuration=ts(e.authBypassTokenDuration);else if(e.authBypassTokenDuration)throw new g("authBypassTokenDuration is set but generateAuthBypassToken is not enabled");e.overriddenEnvironmentVariables&&(o.environmentVariables=e.overriddenEnvironmentVariables);try{let r=await ge({query:hs,api:"Oxygen",url:`${e.deploymentUrl}/api/v2/admin/graphql`,token:e.deploymentToken.accessToken,variables:o,addedHeaders:{[pe.OxygenNamespaceHandle]:e.deploymentToken.namespace}});if(r.deploymentComplete.userErrors.length>=1)throw new g(`Failed to complete deployment: ${r.deploymentComplete.userErrors[0]?.message}`);return r.deploymentComplete}catch(r){throw Re(r),r}}c();async function ys(e){let{config:t,url:o,logger:r,hooks:n}=e;n?.onVerificationStart?.(),A("Verifying worker deployment is routable...",r);let i=0,s=0,a=!1,d=Date.now(),m=async()=>{if(i<10?s=500:i%5===0&&(s+=5e3),(Date.now()-d)/1e3+s/1e3>t.verificationMaxDuration){let p=new mt("Unable to verify that the worker is accessible.");throw a||(a=!0,n?.onVerificationError?.(p)),p}i++,await new Promise(p=>setTimeout(p,s)),await l()},l=async()=>{try{if((await Se(`${o}/.oxygen/deployment`,{method:"HEAD"})).status===200)return A("Deployment verification check passed",r),n?.onVerificationComplete?.(),Promise.resolve();await m()}catch{await m()}};await l()}c();c();var ws=`
|
|
96
|
+
mutation DeploymentCancel($deploymentId: ID!, $reason: String!) {
|
|
97
|
+
deploymentCancel(id: $deploymentId, reason: $reason) {
|
|
98
|
+
deployment {
|
|
99
|
+
id
|
|
100
|
+
}
|
|
101
|
+
userErrors {
|
|
102
|
+
message
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
`;async function vs(e){let{config:t,deploymentId:o,reason:r,logger:n}=e,i={deploymentId:o,reason:r};try{let s=await ge({query:ws,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:i,addedHeaders:{[pe.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(s.deploymentCancel.userErrors.length>=1)throw new g(s.deploymentCancel.userErrors[0]?.message||"");return A(`Deployment with id ${o} cancelled.`,n),s.deploymentCancel}catch(s){throw Re(s),s}}c();import{Agent as cc}from"https";var bs=re(Pa(),1);async function Ss(e){let{config:t,logger:o,targets:r,hooks:n}=e;A(`Uploading ${r.length} files...`,o);let i=r.reduce((d,m)=>d+m.fileSize,0)/1024;e.metricsExporter?.add(ce.TotalSizeUploaded,i),e.metricsExporter?.add(ce.NumFilesUploaded,r.length);let s=new cc({keepAlive:!0});n?.onUploadFilesStart?.();let a=performance.now();return(0,bs.mapLimit)(r,6,async d=>{await lc(t,d,s)}).then(()=>{let d=performance.now();n?.onUploadFilesComplete?.(),e.metricsExporter?.add(ce.UploadTime,d-a),Fe("Files uploaded successfully",o)}).catch(d=>{throw n?.onUploadFilesError?.(d),d}).finally(()=>{s.destroy()})}async function lc(e,t,o){let r=t.fileType==="WORKER"?O(e.rootPath,e.workerDir):O(e.rootPath,e.assetsDir);if(t.parameters!==null&&t.parameters.length>0){let n=Cn();t.parameters.forEach(i=>{n.append(i.name,i.value)}),n.append("file",br(O(r,t.filePath))),await ks(n,t,o)}else{let n=await dc(t,o);await Es(O(r,t.filePath),n,o)}}async function ks(e,t,o,r=0){try{let i=new AbortController,s=setTimeout(()=>{i.abort()},12e4),a=await Se(t.uploadUrl,{method:"POST",body:e,signal:i.signal,headers:{Connection:"keep-alive"},agent:o});if(clearTimeout(s),!a.ok)throw new Error(`${a.status}`)}catch(n){if(Ps(n,"ENOENT"))throw new Error(`File not found: ${t.filePath}`);if(r<Number(_o.maxUploadAttempts))await ks(e,t,o,r+1);else throw n instanceof Error&&n.name==="AbortError"?new Error(`Request timeout whilst uploading ${t.filePath}`):new Error(`Failed to upload file ${t.filePath}`)}}async function dc(e,t){return Se(e.uploadUrl,{method:"POST",headers:{"x-goog-resumable":"start","X-Goog-Content-Length-Range":`0,${e.fileSize}`,"User-Agent":"oxygen-cli"},agent:t}).then(o=>({sessionUri:o.headers.get("x-guploader-uploadid"),location:o.headers.get("location"),target:e})).catch(o=>{throw new Error(`Failed to initiate resumable upload for file ${e.filePath} (status code ${o.statusCode})`)})}async function Es(e,t,o,r=0,n=0){await mc(t.location,e,r,o).catch(async i=>{if(Ps(i,"ENOENT"))throw new Error(`File not found: ${t.target.filePath}`);if(i&&n>=Number(_o.maxResumabeUploadAttempts))throw new Error(`Failed to upload file ${t.target.filePath} after ${_o.maxResumabeUploadAttempts} attempts`);let s=await uc(t.location,t.target.fileSize,o);if(!s.complete){let a=s.lastReceivedByte,d=n+1;await Es(e,t,o,a,d)}})}async function mc(e,t,o,r){let n=br(t,{start:o});return Se(e,{method:"PUT",body:n,agent:r}).then(i=>i.status)}async function uc(e,t,o){let r=n=>{if(!n||n.split("-").length!==2)return 0;let i=n.split("-");return parseInt(i[1],10)};return Se(e,{method:"PUT",headers:{"Content-Length":"0","Content-Range":`bytes */${t}`},agent:o}).then(n=>({complete:n.status===200,lastReceivedByte:r(n.headers.get("range"))})).catch(n=>(console.error(n),{complete:!1,lastReceivedByte:0}))}function Ps(e,t){return e instanceof Error&&"code"in e&&e.code===t}c();c();var xs=`
|
|
107
|
+
query DeploymentVerificationDetails($deploymentId: ID!) {
|
|
108
|
+
deploymentVerificationDetails(id: $deploymentId) {
|
|
109
|
+
url
|
|
110
|
+
status
|
|
111
|
+
error
|
|
112
|
+
startupTime
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`,Rt=(e=>(e.Pending="PENDING",e.Deployed="DEPLOYED",e.Failed="FAILED",e.Cancelled="CANCELLED",e))(Rt||{});async function Cs(e,t){let{config:o,logger:r,timeoutInSeconds:n,hooks:i}=e,s={deploymentId:t};i?.onDeploymentCompletedVerificationStart?.(),A("Verifying deployment completed...",r);let a=Date.now(),d=async()=>{if((Date.now()-a)/1e3+3e3/1e3>n)throw i?.onDeploymentCompletedVerificationError?.(),new Error(`Deployment not completed after ${n} seconds.`);return await new Promise(p=>setTimeout(p,3e3)),m()},m=async()=>{let f=(await ge({query:xs,api:"Oxygen",url:`${o.deploymentUrl}/api/v2/admin/graphql`,token:o.deploymentToken.accessToken,variables:s,addedHeaders:{[pe.OxygenNamespaceHandle]:o.deploymentToken.namespace}})).deploymentVerificationDetails;if(f==null)throw i?.onDeploymentCompletedVerificationError?.(),new Qe("Deployment not found");if(f.status===Rt.Deployed)return Fe("Deployment to Oxygen completed successfully",r),i?.onDeploymentCompleted?.(),f;if(f.status===Rt.Failed||f.status===Rt.Cancelled)throw i?.onDeploymentFailed?.(f),new Qe(f.error?`Deployment ${f.status.toLocaleLowerCase()}, error: ${f.error}${f.startupTime&&f.error.includes("exceeded CPU time limit")?` (Startup time: ${f.startupTime}ms exceeded CPU time limit)`:""}`:`Deployment ${f.status.toLocaleLowerCase()}`);return d()};return m()}c();import{spawn as pc}from"child_process";import{PassThrough as fc}from"stream";async function Os(e){let{config:t,assetPath:o,hooks:r}=e,n=dt();if(r?.buildFunction){let s=performance.now();return r.buildFunction(o).then(()=>{e.metricsExporter?.add(ce.BuildTime,performance.now()-s)}).catch(a=>{throw new Error(`Build function failed with error: ${a}`)})}let i=o?{HYDROGEN_ASSET_BASE_URL:o}:{};try{await new Promise((s,a)=>{let d="",m=new fc;m.on("data",p=>{d+=p,process.stderr.write(p)});let l=performance.now(),f=pc(t.buildCommand,[],{stdio:["inherit","pipe","pipe"],env:{...process.env,...i},cwd:t.rootPath,shell:!0});f.stderr?.pipe(m),f.stdout?.pipe(m),f.on("close",p=>{if(p===0&&e.metricsExporter?.add(ce.BuildTime,performance.now()-l),n?.addMetadata("buildCommand",{command:t.buildCommand,stderr:d,code:p}),p!==0){a(p);return}s(p)})})}catch(s){throw new Error(`Build failed with error code: ${s}`)}}c();async function Ds(e,t){let o=bt(),r=o.metadata??{};try{let n=await hc(e.rootPath);r.actor||(r.actor=n.author_name),r.commitDate||(r.commitDate=n.date),r.commitMessage||(r.commitMessage=n.message),n.branch&&(r.branch=n.branch),n.hash&&(r.commitSha=n.hash)}catch{V("Could not retrieve Git history, commit message will be unavailable.",t)}return{name:o.isCI?o.name:"none",...r,actor:e.metadata.user??r.actor,commitMessage:gc(e.metadata.description??r.commitMessage),commitSha:e.metadata.version??r.commitSha,hydrogenVersion:e.metadata.hydrogenVersion,url:e.metadata.url??r.url}}async function hc(e){let t=await Kt(e),o=(/HEAD -> ([^,]*)/.exec(t.refs)||[])[1],r=process.env.GITHUB_HEAD_REF;if(!r)return{...t,branch:o};let n=/Merge ([\w\d]+) into [\w\d]+/.exec(t.message);return{...t,branch:r,hash:n?n[1]:t.hash}}function gc(e){if(!e)return;let t=e.split(/\r?\n/)[0]?.trim()||"",o=JSON.stringify(t),r=!1;for(;o.length>lt;){let n=t.lastIndexOf(" ",lt-3);t=`${t.substring(0,n>-1?n:lt-3)}`.trimEnd(),r=!0,o=JSON.stringify(t)}return r?`${t}...`:t}function Rs(e,t){if(e.defaultEnvironment)return;let o=e.environmentTag||t.branch;return o?{tag:o}:void 0}function Ts(e){let t=[],o=(n,i)=>{let s=JSON.stringify(i);if(s.length>lt)throw new Error(`Provided ${n} metadata exceeds maximum length (max ${lt} characters).`);let a=`${n}=${s}`;t.push(a)};if(e.name!=="none"&&t.push(`ci-platform=${JSON.stringify(e.name)}`),e.name!=="unknown"){let n={attempt:"attempt",run:"runId"};for(let[i,s]of Object.entries(n)){let a=i;e[a]&&t.push(`${e.name}-${s}=${JSON.stringify(e[a])}`)}}let r={actor:"user",branch:"branch",commitDate:"commit-date",commitMessage:"description",commitSha:"version",hydrogenVersion:"hydrogen-version",url:"url"};for(let[n,i]of Object.entries(r)){let s=n;e[s]&&o(i,e[s])}return t}async function Is(e){let t=performance.now();is(!e.config.bugsnag);let o=dt();o?.addMetadata("config",{...e.config,deploymentToken:{...e.config.deploymentToken,accessToken:"***"},rootPath:"***"});let{config:r,hooks:n}=e,i=e.logger??Mr,s={},a,d,m;try{let l=await Ds(r,i),f=Ts(l),p=Rs(r,l);if(o?.addMetadata("metadata",{environment:p,labels:f,metadata:l}),m=new Ho({ciProvider:l.name||"unknown",rootPath:r.rootPath}),!r.workerOnly&&!r.skipBuild){let x=await cs({config:r,environment:p,labels:f,logger:i});s.id=x.build.id,s.assetPath=x.build.assetPath}r.skipBuild||(await Os({config:r,assetPath:s.assetPath,hooks:n,metricsExporter:m}),await os({config:r,performedBuild:!0})),a=!0;let y=await us(r,m);o?.addMetadata("manifest",y);let h=s.id?{buildId:s.id,manifest:y}:{environment:p,manifest:y,labels:f};d=await fs({config:r,input:h,logger:i}),await Ss({config:r,targets:d.deploymentTargets,hooks:n,logger:i,metricsExporter:m});let b=performance.now(),v=await gs(r,d.deployment.id);m.add(ce.TotalTime,performance.now()-t),await Cs({config:r,hooks:n,logger:i,timeoutInSeconds:d.deploymentConfiguration.timeoutInSeconds},d.deployment.id),m.add(ce.DeploymentCompletedTime,performance.now()-b),r.skipVerification||(await ys({config:r,url:v.deployment.url,logger:i,hooks:n}),m.add(ce.DeploymentRoutableTime,performance.now()-b));let S={url:v.deployment.url},k=`
|
|
116
|
+
The deployment can be reached at the ${S.url} preview URL`;return v.authBypassToken&&(S.authBypassToken=v.authBypassToken,k+=`. The auth bypass token for the deployment is ${S.authBypassToken}`),jn(k,i),S}catch(l){return r.bugsnag&&o&&(l instanceof Error||typeof l=="string")&&o.notify(ss(l,r.rootPath)),l instanceof Error?(l instanceof mt||l instanceof Qe?V(l.message,i):s.id&&!a?(V(`Build failed with: ${l.message}, cancelling build.`,i),await ds({config:r,buildId:s.id,reason:l.message,logger:i}).catch(f=>{f instanceof Error&&V(`Failed to cancel build: ${f.message}`,i)})):d?.deployment.id&&(V(`Deployment failed with: ${l.message}, cancelling deployment.`,i),await vs({config:r,deploymentId:d.deployment.id,reason:l.message,logger:i}).catch(f=>{f instanceof Error&&V(`Failed to cancel deployment: ${f.message}`,i)})),Promise.reject(l)):(console.error("Unknown error",l),Promise.reject(new Error("Unknown error")))}finally{m?.export()}}import{createRequire as wc}from"node:module";c();c();c();function $s(e){let{storeFqdn:t}=e;return`https://${t}/admin/custom_storefronts/new`}function js(e){let{storeFqdn:t}=e;return`https://${t}/admin/custom_storefronts`}function Ke({session:e,storefront:t,cliCommand:o}){throw new g("Couldn\u2019t find Hydrogen storefront.",ee`Couldn’t find ${t.title} (ID: ${it(t.id)}) on ${e.storeFqdn}. Check that the storefront exists and run ${xe.genericShellCommand(`${o} link`)} to link this project to it.\n\n${xe.link("Hydrogen Storefronts Admin",js(e))}`.value)}function Fs({noStorefronts:e=!1}){W({headline:e?"You don't have a Hydrogen storefront to link to":"You haven't linked your project to a storefront yet",body:["Link your local environment to a Hydrogen storefront. Enable automatic environment variable injection and access to",{command:"env list"},",",{command:"env pull"},",",{command:"env push"},", and",{command:"deploy"},"commands. Use",{command:"unlink"},"to disconnect from the storefront."]})}c();var yc=`#graphql
|
|
117
|
+
query GetDeploymentToken($id: ID!) {
|
|
118
|
+
hydrogenStorefront(id: $id) {
|
|
119
|
+
oxygenDeploymentToken
|
|
120
|
+
environments {
|
|
121
|
+
name
|
|
122
|
+
handle
|
|
123
|
+
branch
|
|
124
|
+
type
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
`;async function As(e,t){let{hydrogenStorefront:o}=await nt(yc,e,{id:t});return{storefront:o}}c();async function Le({root:e,session:t,config:o,cliCommand:r}){let n=await li(t),i=o.storefront?.id?n.find(({id:s})=>s===o.storefront.id):void 0;return i||(Fs({noStorefronts:!n.length}),await Oi(e,t,o,{force:!0,cliCommand:r,storefronts:n}))}async function _s({root:e}){let[{session:t,config:o},r]=await Promise.all([ve(e),X()]),n=await Le({root:e,session:t,config:o,cliCommand:r});if(!n)return;o.storefront=n;let{storefront:i}=await As(t,o.storefront.id);if(i||Ke({session:t,storefront:o.storefront,cliCommand:r}),!i.oxygenDeploymentToken)throw new g("Could not retrieve a deployment token.");return i}var Vr="h2_deploy_log.json",vc="node --run build",bc=(e,t="info")=>{(t==="error"||t==="warn")&&V(e)},Mo=class e extends R{static get jsonOutputSchema(){return Ao}static descriptionWithMarkdown="Builds and deploys your Hydrogen storefront to Oxygen. Requires an Oxygen deployment token to be set with the `--token` flag or an environment variable (`SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN`). If the storefront is [linked](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-link) then the Oxygen deployment token for the linked storefront will be used automatically.";static description=this.descriptionForHelp();static flags={...$,...w.entry,...w.env,...w.envBranch,...ke(w.envFile,{"env-file":{description:"Path to an environment file to override existing environment variables for the deployment.",default:void 0}}),preview:ie.Flags.boolean({description:"Deploys to the Preview environment.",required:!1,default:!1}),force:ie.Flags.boolean({char:"f",description:"Forces a deployment to proceed if there are uncommitted changes in its Git repository, and skips confirmation prompts for non-preview environments.",default:!1,env:"SHOPIFY_HYDROGEN_FLAG_FORCE",required:!1}),"no-verify":ie.Flags.boolean({description:"Skip the routability verification step after deployment.",default:!1,required:!1}),"auth-bypass-token":ie.Flags.boolean({description:"Generate an authentication bypass token, which can be used to perform end-to-end tests against the deployment.",required:!1,default:!1,env:"AUTH_BYPASS_TOKEN"}),"auth-bypass-token-duration":ie.Flags.string({description:"Specify the duration (in hours) up to 12 hours for the authentication bypass token. Defaults to `2`",required:!1,env:"AUTH_BYPASS_TOKEN_DURATION",dependsOn:["auth-bypass-token"]}),"build-command":ie.Flags.string({description:"Specify a build command to run before deploying. If not specified, the Hydrogen build pipeline will be used. When custom output directories are configured, defaults to `node --run build`.",required:!1}),"assets-dir":ie.Flags.string({description:"Directory containing the client assets to deploy, relative to the project root. Defaults to the detected Vite client output directory, then falls back to `dist/client`.",env:"SHOPIFY_HYDROGEN_FLAG_ASSETS_DIR",required:!1}),"worker-dir":ie.Flags.string({description:"Directory containing the Oxygen worker entry point (`index.js` or `index.mjs`), relative to the project root. Defaults to the detected Vite server output directory, then falls back to `dist/server`.",env:"SHOPIFY_HYDROGEN_FLAG_WORKER_DIR",required:!1}),...w.lockfileCheck,...w.path,...w.shop,"json-output":ie.Flags.boolean({allowNo:!0,description:"Create a JSON file containing the deployment details in CI environments. Defaults to true, use `--no-json-output` to disable.",required:!1,default:!0}),token:ie.Flags.string({char:"t",description:"Oxygen deployment token. Defaults to the linked storefront's token if available.",env:"SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN",required:!1}),"metadata-description":ie.Flags.string({description:"Description of the changes in the deployment. Defaults to the commit message of the latest commit if there are no uncommitted changes.",required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_DESCRIPTION"}),"metadata-url":ie.Flags.string({required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_URL",hidden:!0}),"metadata-user":ie.Flags.string({description:"User that initiated the deployment. Will be saved and displayed in the Shopify admin",required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_USER"}),"metadata-version":ie.Flags.string({required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_VERSION",hidden:!0}),"force-client-sourcemap":ie.Flags.boolean({description:"Client sourcemapping is avoided by default because it makes backend code visible in the browser. Use this flag to force enabling it.",env:"SHOPIFY_HYDROGEN_FLAG_FORCE_CLIENT_SOURCEMAP"})};async run(){let{flags:t}=await this.parse(e),o=this.flagsToOxygenDeploymentOptions(t);await Sc(o),await Qt(),process.exit(0)}flagsToOxygenDeploymentOptions(t){return{...G(t),defaultEnvironment:t.preview,environmentFile:t["env-file"],path:t.path?P(t.path):process.cwd()}}};function Ns(e){return new g(e||"The deployment failed due to an unexpected error.","Retrying the deployment may succeed.",[["If the issue persists, please check the",{link:{label:"Shopify status page",url:"https://status.shopify.com/"}},"for any known issues."]])}async function Sc(e){let t=await kc(e),o=bt().isCI,{jsonOutput:r}=e;if(!t){j(Ao,{status:"cancelled",deployment:null},e.json);return}let n=!1;if(o&&r)try{await oe(Vr,JSON.stringify(t)),n=!0}catch{V(`Deployment succeeded, but could not write ${Vr}.`)}if(!j(Ao,{status:"success",deployment:{url:t.url,authBypassToken:t.authBypassToken??null}},e.json)){let i=[];o?n&&i.push(["View the deployment information in",{subdued:Vr}]):(i.push(["Open",{link:{url:t.url}},"in your browser to view your deployment."]),t?.authBypassToken&&i.push(["Use the",{subdued:t.authBypassToken},"token to perform end-to-end tests against the deployment."])),H({body:["Successfully deployed to Oxygen"],nextSteps:i})}return t}async function kc(e){let{authBypassTokenDuration:t,authBypassToken:o,buildCommand:r,defaultEnvironment:n,env:i,envBranch:s,environmentFile:a,force:d,forceClientSourcemap:m=!1,noVerify:l,lockfileCheck:f,jsonOutput:p,path:y,shop:h,assetsDir:b,metadataUrl:v,metadataUser:S,metadataVersion:k,entry:x,workerDir:C}=e,{metadataDescription:T}=e,_=!0;try{await Mn(y)}catch(F){if(F instanceof Ln&&(_=!1),!d&&!_){let z="Uncommitted changes detected",be,wt=[["Commit your changes before deploying or use the",{command:"--force"},"flag to deploy with uncommitted changes."]];try{be=(await Ze("git status -s",{cwd:y})).stdout}catch{}throw be&&(z+=`:
|
|
129
|
+
|
|
130
|
+
${be.trimEnd()}`,ko.forEach(({name:hr,lockfile:gr,alternativeLockfiles:va,installCommand:ba})=>{let gn=[gr,...va||[]].find(Sa=>be.includes(Sa));gn&&wt.push([`If you are using ${hr}, try running`,{command:ba},`to avoid changes to ${gn}.`])})),new g(z,null,wt)}}let E=bt().isCI,D=e.token,q,I,N,J,ae;try{ae=await Kt(y),q=(/HEAD -> ([^,]*)/.exec(ae.refs)||[])[1],I=ae.hash}catch{V("Could not retrieve Git history."),q=void 0}!T&&!_&&(te({headline:"No deployment description provided",body:["Deploying uncommitted changes, but no description has been provided. Use the ",{command:"--metadata-description"},"flag to provide a description. If no description is provided, the description defaults to ",{userInput:"<sha> with additional changes"}," using the SHA of the last commit."]}),T=`${I} with additional changes`);let L;if(a){let{variables:F}=await go(a);L=Object.entries(F).map(([z,be])=>({isSecret:!0,key:z,value:be}))}let Q=null,fe=!1;if(E&&i)throw new g("Can't specify an environment handle in CI","Environments are automatically picked up by the current Git branch.");if(E&&s&&(Q=s),!E){if(N=await _s({root:y,flagShop:h}),!N)return;D=D||N.oxygenDeploymentToken,i?(Q=at(N.environments||[],i).branch,Q===null&&(fe=!0)):s&&(Q=Pt(N.environments||[],s).branch)}if(!D){let F=E?["No deployment token provided. Use the ",{command:"--token"}," flag to provide a token."]:"Could not obtain an Oxygen deployment token, please try again or contact Shopify support.";throw new g(F)}if(!E&&!n&&!i&&!s&&N?.environments)if(N.environments.length>1){let z=yo(N.environments).map(({name:be,branch:wt,handle:hr,type:gr})=>({label:Je(be,hr,wt),value:gr==="PREVIEW"?"shopify-preview-environment.":wt}));J=await $e({message:"Select an environment to deploy to",choices:z,defaultValue:q})}else A(`Using current checked out branch ${q} as environment tag`);let _t="https://oxygen.shopifyapps.com";process.env.UNSAFE_SHOPIFY_HYDROGEN_DEPLOYMENT_URL&&(_t=process.env.UNSAFE_SHOPIFY_HYDROGEN_DEPLOYMENT_URL,V("Using a custom deployment service. Don't do this in production!"));let Nt=q;J==="shopify-preview-environment."&&(Nt=void 0,J=void 0,fe=!0);let Ve="dist/client",Z="dist/worker",he=await rt(y),Ht=xc({appPath:y}),ur=!r&&!he&&(b||C||Pc(Ht));if(he)Ve=b??Ve,Z=C??Z;else{let F=await we(y,x).catch(()=>null),z=Ec({root:y,viteOutputDirs:F,assetsDirFlag:b,workerDirFlag:C});Ve=z.assetsDir,Z=z.workerDir}let Ie={assetsDir:Ve,bugsnag:!0,deploymentUrl:_t,defaultEnvironment:n||fe,deploymentToken:Ur(D),environmentTag:Q||J||Nt,generateAuthBypassToken:o,authBypassTokenDuration:t,verificationMaxDuration:180,metadata:{...T?{description:T}:{},...v?{url:v}:{},...S?{user:S}:{},...k?{version:k}:{},...Ht?{hydrogenVersion:Ht}:{}},skipVerification:l,rootPath:y,skipBuild:!1,workerOnly:!1,workerDir:Z,overriddenEnvironmentVariables:L};if(!E&&!Ie.defaultEnvironment&&(Q||J)&&!d){let F=Pt(N.environments,Ie.environmentTag),z=`Creating a deployment against ${Je(F.name,F.handle,F.branch)}`;if(!await Te({confirmationMessage:"Yes, confirm deploy",cancellationMessage:"No, cancel deploy",message:ee`${z}
|
|
131
|
+
|
|
132
|
+
Continue?`.value}))return}let un,fa=new Promise(F=>{un=F}),pn,ha=new Promise(F=>{pn=F}),fn,ga=new Promise(F=>{fn=F}),yt=null,Lt=null,hn,pr,ya=new Promise((F,z)=>{hn=F,pr=z}),fr={onDeploymentCompleted:()=>fn(),onVerificationComplete:()=>pn(),onDeploymentCompletedVerificationError(){yt=new g("Unable to verify the deployment was completed successfully","Please verify the deployment status in the Shopify Admin and retry deploying if necessary.")},onDeploymentFailed:F=>{yt=Ns(F.error||F.status)},onUploadFilesStart:()=>wa(),onUploadFilesComplete:()=>un(),onVerificationError:F=>{yt=new g(F.message,"Please verify the deployment status in the Shopify Admin and retry deploying if necessary.")},onUploadFilesError:F=>{yt=new g(F.message,"Check your connection and try again. If the problem persists, try again later or contact support.")}};r||ur?(m&&(de()||console.log(""),W({headline:"The `--force-client-sourcemap` flag is not supported with a custom build command",body:"Client sourcemaps will not be generated."})),Ie.buildCommand=r??vc,de()&&(fr.buildFunction=async F=>{let z={};try{z=await Ze(Ie.buildCommand,{cwd:y,env:{...process.env,...F?{HYDROGEN_ASSET_BASE_URL:F}:{}},maxBuffer:64*1024*1024})}catch(be){throw Lt=new g("Build command failed.","Check the build output above for details."),z=be,Lt}finally{z.stdout?.trim()&&Be({type:"diagnostic",level:"info",message:Ge(z.stdout.trim())}),z.stderr?.trim()&&Be({type:"diagnostic",level:"warning",message:Ge(z.stderr.trim())})}})):fr.buildFunction=async F=>{try{if(A(ee`${M.whiteBright("Building project...")}`.value),he)throw new g(De);await ze({directory:y,assetPath:F,lockfileCheck:f,sourcemap:!0,forceClientSourcemap:m,useCodegen:!1,entry:x})}catch(z){throw Lt=z,z}};let wa=async()=>{A(ee`${M.whiteBright(`Deploying to Oxygen..
|
|
133
|
+
`)}`.value),await ne([{title:"Uploading files",task:async()=>await fa},{title:"Verifying deployment has been completed",task:async()=>await ga},{title:"Verifying deployment is routable",task:async()=>await ha,skip:()=>l}])};return await Is({config:Ie,hooks:fr,logger:bc}).then(async F=>{if(!F){pr(Ns());return}hn(F)}).catch(F=>{pr(yt||Lt||F)}),ya}function Ec({root:e,viteOutputDirs:t,assetsDirFlag:o,workerDirFlag:r}){let n=t&&le(e,t.clientOutDir),i=t&&le(e,t.serverOutDir);return{assetsDir:o??n??"dist/client",workerDir:r??i??"dist/server"}}function Pc(e){return e?.startsWith("0.0.0-preview-")??!1}function xc({appPath:e}){let{root:t}=Oe(e);try{let o=wc(import.meta.url),r=o(o.resolve("@shopify/hydrogen/package.json",{paths:[t]}));return typeof r.version=="string"?r.version:void 0}catch{return}}c();var $t=re(me(),1);c();c();var Br=Y({name:"HydrogenShortcutResult",schema:u.object({status:u.literal("success"),changed:u.boolean(),alias:u.string(),shells:u.array(u.enum(["bash","zsh","fish","powershell","powershell-7","cmd"])).min(1)}).strict()}),Hs=()=>u.object({status:u.literal("success"),directory:B,previousVersion:u.string(),version:u.string()}),Gr=Y({name:"HydrogenUpgradeResult",definitions:{AbsolutePath:B},schema:u.discriminatedUnion("changed",[Hs().extend({changed:u.literal(!0),packages:u.array(u.string()),removedPackages:u.array(u.string()),instructionsPath:B.nullable()}).strict(),Hs().extend({changed:u.literal(!1),packages:u.array(u.string()).length(0),removedPackages:u.array(u.string()).length(0),instructionsPath:u.null()}).strict()]).refine(e=>e.changed||e.version===e.previousVersion,{message:"An unchanged upgrade must keep the previous version.",path:["version"]})});var se=re(ka(),1);import{createRequire as Cc}from"node:module";var qr=re(me(),1);function Us(e){return[...e.removeDependencies,...e.removeDevDependencies]}var Ls=".hydrogen",Uo=class e extends R{static get jsonOutputSchema(){return Gr}static descriptionWithMarkdown="Upgrade Hydrogen project dependencies, preview features, fixes and breaking changes. The command also generates an instruction file for each upgrade.";static description=this.descriptionForHelp();static flags={...$,...w.path,version:qr.Flags.string({description:"A target hydrogen version to update to",required:!1,char:"v"}),force:qr.Flags.boolean({description:"Ignore warnings and force the upgrade to the target version",env:"SHOPIFY_HYDROGEN_FLAG_FORCE",char:"f"})};async run(){let{flags:t}=await this.parse(e);await Oc({...G(t),appPath:t.path?P(t.path):process.cwd()},t.json)}},Tt=null;async function Oc(e,t){let o=await Rc(e);await Dc(o,t)}async function Dc(e,t){let{result:o}=e;j(Gr,o,t)||("selectedRelease"in e?await Gc({appPath:o.directory,currentVersion:o.previousVersion,selectedRelease:e.selectedRelease,instrunctionsFilePath:o.instructionsPath??void 0}):H({headline:`You are on the latest Hydrogen version: ${o.version}`}))}async function Rc({appPath:e,version:t,force:o=!1}){if(t==="next"){let h=process.env.SHOPIFY_UNIT_TEST==="1",b=Ct();if(!await Tc()&&!h&&!b)throw new g("--version=next is only available when running from the Hydrogen monorepo","This feature is designed for internal development and testing of unreleased versions")}o||(await $c(e),await jc(e));let{currentVersion:r,currentDependencies:n}=await Vs({appPath:e});if(t==="next"){let h=n["@shopify/hydrogen"]==="next",b=n["@shopify/mini-oxygen"]==="next";if(h||b)throw new g("Project already uses next versions",'Cannot upgrade to --version=next when @shopify/hydrogen or @shopify/mini-oxygen are already using "next" versions')}if(se.default.prerelease(r))throw new g("The upgrade command cannot be run over a prerelease Hydrogen version");let s=await Bs(),{availableUpgrades:a}=Ys({releases:s.releases,currentVersion:r,currentDependencies:n});if(!a?.length){let h=U(r);return{result:{status:"success",changed:!1,directory:P(e),previousVersion:h,instructionsPath:null,version:h,packages:[],removedPackages:[]}}}let d=!1,m,l;do m=await Ac({currentVersion:r,targetVersion:t,availableUpgrades:a,currentDependencies:n}),l=_c({availableUpgrades:a,currentVersion:r,currentDependencies:n,selectedRelease:m}),d=o||await Nc({cumulativeRelease:l,selectedRelease:m,targetVersion:t});while(!d);let f=qc({appPath:e,cumulativeRelease:l,currentVersion:r,selectedRelease:m,force:o}),p=await Lc({appPath:e,selectedRelease:m,currentDependencies:n,targetVersion:t,cumulativeRemoveDependencies:l.removeDependencies,cumulativeRemoveDevDependencies:l.removeDevDependencies,cumulativeDependencies:l.dependencies,cumulativeDevDependencies:l.devDependencies});await Yc({appPath:e,selectedRelease:m,targetVersion:t});let y=await f;return{selectedRelease:m,result:{status:"success",changed:!0,directory:P(e),previousVersion:U(r),version:Jr("@shopify/hydrogen",m.version,t),instructionsPath:y?P(e,y):null,...p}}}async function Tc(){try{let e=process.cwd(),t=[e,O(e,"../"),O(e,"../../")];for(let o of t)try{let r=O(o,"templates/skeleton"),n=O(o,"packages/cli"),i=await Bt(r),s=await Bt(n);if(i&&s)return!0}catch{continue}return!1}catch{return!1}}function Ic(e){let t={...e.dependencies},o={...e.devDependencies??{}};return t["@shopify/hydrogen"]&&(t["@shopify/hydrogen"]="next"),o["@shopify/mini-oxygen"]&&(o["@shopify/mini-oxygen"]="next"),{...e,title:`${e.title} (next versions)`,dependencies:t,devDependencies:o}}function $c(e){return Hn(e).catch(()=>{throw new g("The upgrade command can only be run on a git repository","Please run the command inside a git repository or run 'git init' to create one")})}async function jc(e){if(!await Un(e))throw new g("The upgrade command can only be run on a clean git branch","Please commit your changes or re-run the command on a clean branch")}async function Vs({appPath:e}){let{root:t}=Oe(e),o=O(t,"package.json"),r;try{r=JSON.parse(await ue(o))}catch{throw new g("Could not find a valid package.json","Please make sure you are running the command in a npm project")}let n={...r?.dependencies,...r?.devDependencies},i=n["@shopify/hydrogen"];if(!i)throw new g("Could not find a valid Hydrogen version in package.json","Please make sure you are running the command in a Hydrogen project");return{currentVersion:i,currentDependencies:n}}async function Bs(){if(Tt)return Tt;if(process.env.FORCE_CHANGELOG_SOURCE==="local"||Ye&&Ce&&process.env.FORCE_CHANGELOG_SOURCE!=="remote"){let e=Cc(import.meta.url),t=Ye&&Ce?O(yr(Ce),"docs","changelog.json"):O(process.cwd(),"docs","changelog.json");try{let o=e(t);return Tt=o,o}catch(o){if(V(`Failed to load local changelog from ${t}: ${o.message}`),process.env.FORCE_CHANGELOG_SOURCE==="local")throw new g("Failed to load local changelog",`Could not read changelog from ${t}`)}}try{let e=await Se("https://hydrogen.shopify.dev/changelog.json");if(!e.ok)throw new Error("Failed to fetch changelog.json");let t=await e.json();if("releases"in t&&"url"in t)return Tt=t,Tt}catch{}throw new g("Failed to fetch Hydrogen changelog","Ensure you have internet connection and try again")}function Gs({release:e,currentDependencies:t}){return Object.entries({...e.dependencies,...e.devDependencies??{}}).some(([o,r])=>{if(o==="@shopify/cli")return!1;let n=t?.[o];return n?se.default.gt(U(r),U(n)):!1})}function Fc({currentDependencies:e,currentPinnedVersion:t,release:o}){return se.default.gt(o.version,t)?!0:U(o.version)===t?Gs({release:o,currentDependencies:e}):!1}function Ys({releases:e,currentVersion:t,currentDependencies:o}){let r=U(t),n="",i=e.filter(a=>Fc({release:a,currentPinnedVersion:r,currentDependencies:o})&&n!==a.version?(n=a.version,!0):!1),s=i.reduce((a,d)=>(a[d.version]||(a[d.version]=d),a),{});return{availableUpgrades:i,uniqueAvailableUpgrades:s}}async function Ac({targetVersion:e,availableUpgrades:t,currentVersion:o,currentDependencies:r}){return(e?e==="next"?Ic(t[0]):t.find(i=>U(i.version)===U(e)):void 0)??Bc(o,t)}function _c({availableUpgrades:e,selectedRelease:t,currentVersion:o,currentDependencies:r}){let n=U(o),i={features:[],fixes:[],removeDependencies:[],removeDevDependencies:[],dependencies:{},devDependencies:{}};if(!e?.length)return i;if(t.dependencies?.["@shopify/hydrogen"]==="next")return{...i,features:t.features||[],fixes:t.fixes||[],removeDependencies:t.removeDependencies??[],removeDevDependencies:t.removeDevDependencies??[],dependencies:t.dependencies??{},devDependencies:t.devDependencies??{}};let s=e.filter(k=>se.default.gt(k.version,n)&&se.default.lte(k.version,t.version)?!0:!(U(k.version)===n)||!r?!1:Gs({release:k,currentDependencies:r})),a=s.flatMap(k=>k.features),d=s.flatMap(k=>k.fixes),m=[...s].sort((k,x)=>se.default.compare(k.version,x.version)),l=new Map,f=new Map;m.forEach((k,x)=>{k.removeDependencies?.forEach(C=>{l.set(C,x)}),k.removeDevDependencies?.forEach(C=>{f.set(C,x)})});let p=new Set,y=new Set;for(let k=0;k<m.length;k++){let x=m[k];if(!x)continue;let C=x.dependencies??{},T=x.devDependencies??{};Object.keys(C).forEach(_=>{let E=l.get(_);E!==void 0&&k>=E&&p.add(_)}),Object.keys(T).forEach(_=>{let E=f.get(_);E!==void 0&&k>=E&&y.add(_)})}let h=[...new Set(m.flatMap(k=>k.removeDependencies??[]).filter(k=>!p.has(k)))],b=[...new Set(m.flatMap(k=>k.removeDevDependencies??[]).filter(k=>!y.has(k)))],v={},S={};for(let k of m)Object.assign(v,k.dependencies??{}),Object.assign(S,k.devDependencies??{});return{features:a,fixes:d,removeDependencies:h,removeDevDependencies:b,dependencies:v,devDependencies:S}}function Nc({cumulativeRelease:e,selectedRelease:t,targetVersion:o}){let{features:r,fixes:n}=e,i=Us(e);return(r.length||n.length||i.length)&&W({headline:"Included in this upgrade:",customSections:[r.length&&{title:"Features",body:[{list:{items:r.map(s=>s.title)}}]},n.length&&{title:"Fixes",body:[{list:{items:n.map(s=>s.title)}}]},i.length&&{title:"Removed packages",body:[{list:{items:i}}]}].filter(Boolean)}),o==="next"?!0:Te({message:`Are you sure you want to upgrade to ${t.version}?`,cancellationMessage:"No, choose another version",defaultValue:!0})}function Vo([e]){return!!e.includes("@remix-run")}function Wr([e]){return!!e.includes("react-router")}function Jr(e,t,o){return o==="next"&&(e==="@shopify/hydrogen"||e==="@shopify/mini-oxygen")?"next":U(t)}function Ms({currentDependencies:e,dependency:[t,o],selectedRelease:r,targetVersion:n}){let i=e[t];return Vo([t,o])||Wr([t,o])||i==="next"&&!(n==="next")?!1:r.dependenciesMeta?.[t]?!r.dependenciesMeta?.[t]?.required?!1:!!(!i||n==="next"&&(t==="@shopify/hydrogen"||t==="@shopify/mini-oxygen")||se.default.lt(U(i),U(o))):!0}function Hc({selectedRelease:e,currentDependencies:t,targetVersion:o,cumulativeDependencies:r,cumulativeDevDependencies:n}){let i=[],s={...r??{},...e.dependencies},a={...n??{},...e.devDependencies??{}};for(let p of Object.entries(s))Ms({currentDependencies:t,dependency:p,selectedRelease:e,targetVersion:o})&&i.push(`${p[0]}@${Jr(p[0],p[1],o)}`);for(let p of Object.entries(a))Ms({currentDependencies:t,dependency:p,selectedRelease:e,targetVersion:o})&&i.push(`${p[0]}@${Jr(p[0],p[1],o)}`);let d=Object.entries(t).find(Vo),m=Object.entries(s).find(Vo);d&&m&&se.default.lt(U(d[1]),U(m[1]))&&i.push(...Uc({currentDependencies:t,selectedRemix:m}));let l=Object.entries(t).find(Wr),f=Object.entries(s).find(Wr);return f&&(!l||se.default.lt(U(l[1]),U(f[1])))&&i.push(...Vc({currentDependencies:t,selectedReactRouter:f})),i}async function Lc({appPath:e,selectedRelease:t,currentDependencies:o,targetVersion:r,cumulativeRemoveDependencies:n,cumulativeRemoveDevDependencies:i,cumulativeDependencies:s,cumulativeDevDependencies:a}){let d=[],m=[...n,...i].filter(f=>f in o);m.length>0&&d.push({title:"Removing deprecated dependencies",task:async()=>{await Mc({directory:e,packageManager:zr(await Pe(e)),args:m})}});let l=Hc({selectedRelease:t,currentDependencies:o,targetVersion:r,cumulativeDependencies:s,cumulativeDevDependencies:a});return l.length>0&&d.push({title:"Upgrading dependencies",task:async()=>{let f=await Pe(e),p=f==="npm"?"install":f==="yarn"||f==="pnpm"?"add":"install",y=f==="npm"||f==="unknown"?["--legacy-peer-deps"]:[];await kr(zr(f),[p,...y,...l],{cwd:e})}}),d.length>0&&await ne(d,{}),{packages:l,removedPackages:m}}function zr(e){return e==="unknown"||e==="homebrew"?"npm":e}async function Mc({directory:e,packageManager:t,args:o}){if(o.length===0)return;let r=t==="npm"?"uninstall":t==="yarn"||t==="pnpm"||t==="bun"?"remove":"uninstall",n=t==="npm"||t==="unknown"?["--legacy-peer-deps"]:[];await kr(zr(t),[r,...n,...o],{cwd:e})}function Uc({currentDependencies:e,selectedRemix:t}){let o=[];for(let[r,n]of Object.entries(e))Vo([r,n])&&o.push(`${r}@${U(t[1])}`);return o}function Vc({currentDependencies:e,selectedReactRouter:t}){let o=[],r=U(t[1]),n=["react-router","react-router-dom","@react-router/dev","@react-router/fs-routes"];for(let i of n)o.push(`${i}@${r}`);return o}function U(e){if(e==="next")return"next";if(e.match(/^[\^~]?0\.0\.0-next-([a-f0-9]+)-(\d+)$/))return e.replace(/^[\^~]?/,"");let o=se.default.minVersion(e);if(!o)throw new g(`Invalid version: ${e}`);return o.version}async function Bc(e,t){if(!t?.length)throw new g("No upgrade options available");let o=t.map((r,n)=>{let{version:i,title:s}=r,a=n===0?"(latest)":se.default.patch(i)===0?"(major)":U(e)===U(i)?"(outdated)":"";return`${se.default.major(i)}${se.default.minor(i)}`,{label:`${i} ${a} - ${Ti(s,54)}`,value:r}});return $e({message:`Available Hydrogen versions (current: ${e})`,choices:o,defaultValue:o[0]?.value})}async function Gc({appPath:e,currentVersion:t,selectedRelease:o,instrunctionsFilePath:r}){let n=[...Object.entries(o.dependencies||{}).map(([y,h])=>`${y}@${h}`),...Object.entries(o.devDependencies||{}).map(([y,h])=>`${y}@${h}`)],i=[];if(typeof r=="string"){let y=`Upgrade instructions created at:
|
|
134
|
+
file://${r}`;i.push(y)}let s=`https://hydrogen.shopify.dev/releases/${o.version}`;i.push(`Release notes:
|
|
135
|
+
${s}`);let a=U(t),d=U(o.version),m=a===d,l=`${a} \u2192 ${d}`,f=m?`You've upgraded Hydrogen ${d} dependencies`:`You've upgraded from ${l}`,p=await Pe(e);return H({headline:f,customSections:[{title:"Updated dependencies",body:[{list:{items:n}}]},{title:"What\u2019s next?",body:[{list:{items:i}}]},{title:"Undo these upgrades?",body:[{list:{items:[`Run \`git restore . && git clean -df && ${p} i\``]}}]}].filter(Boolean)})}async function Yc({appPath:e,selectedRelease:t,targetVersion:o}){let n=(await Rn(O(e,"package.json")))["@shopify/hydrogen"];if(!n)throw new g("Hydrogen version not found in package.json");let i=U(n);i.match(/^0\.0\.0-next-[a-f0-9]+-\d+$/);let s=t.dependencies?.["@shopify/hydrogen"]==="next";if(!(o==="next"&&s)&&i!==t.version)throw new g(`Failed to upgrade to Hydrogen version ${t.version}`,`You are still on version ${i}`)}function Yr(e){let{steps:t}=e,o=`### ${e.title} [#${e.id}](${e.pr})
|
|
136
|
+
`,r=t?.map((n,i)=>{let s=e.pr?`[#${e.id}](${e.pr})
|
|
137
|
+
`:"",d=t.length>1?`#### Step: ${i+1}. ${n.title} ${s}
|
|
138
|
+
`:`#### ${n.title.trim()}
|
|
139
|
+
`,m=n.info?`> ${n.info}
|
|
140
|
+
`:"",l=n.code?`${Buffer.from(n.code,"base64")}
|
|
141
|
+
`:"",f=e.docs?`[docs](${e.docs})
|
|
142
|
+
`:"";return`${d}${m}${f}${s}${l}`}).join(`
|
|
143
|
+
`);return`${o}
|
|
144
|
+
${r}`}async function qc({appPath:e,cumulativeRelease:t,currentVersion:o,selectedRelease:r,force:n=!1}){let i="",{featuresMd:s,breakingChangesMd:a}=t.features.filter(v=>v.steps).reduce((v,S)=>(S.breaking?v.breakingChangesMd.push(Yr(S)):v.featuresMd.push(Yr(S)),v),{featuresMd:[],breakingChangesMd:[]}),d=t.fixes.filter(v=>v.steps).map(Yr),m=Us(t);if(!s.length&&!d.length&&!a.length&&!m.length){W({headline:"No upgrade instructions generated",body:"There are no additional upgrade instructions for this version."});return}let l=U(o),f=U(r.version);i=`upgrade-${l}-to-${f}.md`;let p=O(e,Ls),h=`${`# Hydrogen upgrade guide: ${l} to ${f}`}
|
|
145
|
+
|
|
146
|
+
----
|
|
147
|
+
`;a.length&&(h+=`
|
|
148
|
+
## Breaking changes
|
|
149
|
+
|
|
150
|
+
${a.join(`
|
|
151
|
+
`)}
|
|
152
|
+
----
|
|
153
|
+
`),s.length&&(h+=`
|
|
154
|
+
## Features
|
|
155
|
+
|
|
156
|
+
${s.join(`
|
|
157
|
+
`)}
|
|
158
|
+
----
|
|
159
|
+
`),d.length&&(h+=`
|
|
160
|
+
${s.length?`----
|
|
161
|
+
|
|
162
|
+
`:""}## Fixes
|
|
163
|
+
|
|
164
|
+
${d.join(`
|
|
165
|
+
`)}`),m.length&&(h+=d.length?`
|
|
166
|
+
|
|
167
|
+
----
|
|
168
|
+
|
|
169
|
+
`:`
|
|
170
|
+
`,h+=`## Removed packages
|
|
171
|
+
|
|
172
|
+
The following packages have been removed as part of this upgrade:
|
|
173
|
+
|
|
174
|
+
`,h+=m.map(v=>`- \`${v}\``).join(`
|
|
175
|
+
`),h+=`
|
|
176
|
+
`);let b=O(p,i);try{await Bt(p)}catch{await Vt(p)}if(!await K(b))await wr(b);else{if(n||await Te({message:`A previous upgrade instructions file already exists for this version.
|
|
177
|
+
Do you want to overwrite it?`,defaultValue:!1}))await Ee(`${b}.old`);else return;await wr(b)}return await oe(b,h),`${Ls}/${i}`}async function qs({targetPath:e}){try{let t=e?P(e):process.cwd(),{currentVersion:o,currentDependencies:r}=await Vs({appPath:t});if(o.startsWith("workspace:")){W({headline:"Using monorepo @shopify/hydrogen dependency",body:"This project uses the workspace protocol for @shopify/hydrogen, so upgrade notices are skipped during local monorepo development."});return}if(se.default.prerelease(o)||/^[a-z]+$/i.test(o))return;let i=await Bs(),{availableUpgrades:s,uniqueAvailableUpgrades:a}=Ys({releases:i.releases,currentVersion:o,currentDependencies:r});if(s.length===0||!s[0]?.version)return;let d=U(s[0].version),m=U(o),l=m===d,f=l?i.releases.findIndex(v=>U(v.version)!==m):i.releases.findIndex(v=>U(v.version)===m),p;if(f===-1){let v=i.releases.findIndex(S=>se.default.lte(U(S.version),m));p=v===-1?i.releases:i.releases.slice(0,v)}else p=i.releases.slice(0,f);let y=Object.values([...p].reverse().reduce((v,S)=>(v[S.version]??=`${S.version} - ${S.title}`,v),{})).reverse().slice(0,5),h=Object.keys(a).length>1?`There are ${Object.keys(a).length} new @shopify/hydrogen versions available.`:"There's a new @shopify/hydrogen version available.",b=await X();W({headline:h,body:[`Current: ${o} | Latest: ${d}`+(l?" with updated dependencies":"")],customSections:[...y.length>0?[{title:`The next ${y.length} version(s) include`,body:[{list:{items:[...y,s.length>5?"...more":""].flat().filter(Boolean)}}].filter(Boolean)}]:[],{title:"Next steps",body:[{list:{items:[`Run \`${b} upgrade\` or \`${b} upgrade --version ${p[0]?.version??"<version>"}\``,"Read release notes at https://hydrogen.shopify.dev/releases"]}}]}]})}catch(t){let o=t;te({headline:o.message,body:o.tryMessage??void 0})}}c();c();import Wc from"node:net";import Jc from"node:os";var Yo=class extends Error{constructor(t){super(`${t} is locked`)}},ut={old:new Set,young:new Set},zc=1e3*15,Bo=1024,Go=65535,It,Qc=()=>{let e=Jc.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let o of Object.values(e))for(let r of o)t.add(r.address);return t},Ws=e=>new Promise((t,o)=>{let r=Wc.createServer();r.unref(),r.on("error",o),r.listen(e,()=>{let{port:n}=r.address();r.close(()=>{t(n)})})}),Js=async(e,t)=>{if(e.host||e.port===0)return Ws(e);for(let o of t)try{await Ws({port:e.port,host:o})}catch(r){if(!["EADDRNOTAVAIL","EINVAL"].includes(r.code))throw r}return e.port},Kc=function*(e){e&&(yield*e),yield 0};async function Qr(e){let t,o=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let n=e.exclude;if(typeof n[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let i of n){if(typeof i!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(i))throw new TypeError(`Number ${i} in the exclude option is not a safe integer and can't be used`)}o=new Set(n)}It===void 0&&(It=setTimeout(()=>{It=void 0,ut.old=ut.young,ut.young=new Set},zc),It.unref&&It.unref());let r=Qc();for(let n of Kc(t))try{if(o.has(n))continue;let i=await Js({...e,port:n},r);for(;ut.old.has(i)||ut.young.has(i);){if(n!==0)throw new Yo(n);i=await Js({...e,port:n},r)}return ut.young.add(i),i}catch(i){if(!["EADDRINUSE","EACCES"].includes(i.code)&&!(i instanceof Yo))throw i}throw new Error("No available ports found")}function zs(e,t){if(!Number.isInteger(e)||!Number.isInteger(t))throw new TypeError("`from` and `to` must be integer numbers");if(e<Bo||e>Go)throw new RangeError(`'from' must be between ${Bo} and ${Go}`);if(t<Bo||t>Go)throw new RangeError(`'to' must be between ${Bo} and ${Go}`);if(e>t)throw new RangeError("`to` must be greater than or equal to `from`");return function*(r,n){for(let i=r;i<=n;i++)yield i}(e,t)}function pt(e,t=100){return Qr({port:zs(e,e+t)})}c();var Kr=new Set,Xr;function Qs({disableDepsOptimizer:e,showSuccessBanner:t,configFile:o,formatOptionsPromise:r}){return async function({optimizableDependency:i,stack:s}){let a=s.split(`
|
|
178
|
+
`)[0]??s,d=s.split(`
|
|
179
|
+
`).filter(l=>!l.includes("virtual:remix")).join(`
|
|
180
|
+
`),m="MiniOxygen encountered an error while running your app's entry point";if(i)if(e||!o){let l=new zt(`${m}:
|
|
181
|
+
|
|
182
|
+
${M.dim(a)}`,`Try adding '${M.yellow(i)}' to your Vite config in ssr.optimizeDeps.include`);l.stack=d,Wt(l)}else Kr.has(i)||(Kr.add(i),setTimeout(()=>Kr.delete(i),2e3),Zc(i,o,await r,d).then(()=>{setTimeout(()=>{A(`
|
|
183
|
+
Added '${M.yellow(i)}' to your Vite config in ssr.optimizeDeps.include
|
|
184
|
+
`)},200),clearTimeout(Xr),Xr=setTimeout(t,2e3)}).catch(l=>{clearTimeout(Xr),Wt(l)}));else{let l=new zt(m+`:
|
|
185
|
+
|
|
186
|
+
`+M.dim(a));l.stack=d,Wt(l)}}}var Xc={rule:{pattern:"[$$$]",inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"include",stopBy:"end"},inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"optimizeDeps",stopBy:"end"},inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"ssr",stopBy:"end"}}}}}};async function Zc(e,t,o,r){let n=wn(t).replace(/^\.m?/,""),i=await Xt(n);await Ae(t,o,s=>{let d=i.parse(s).root().find(Xc);if(!d)throw new g(`The dependency '${M.yellow(e)}' needs to be optimized by Vite, but couldn't be added to the Vite config.`,`Add the following code manually to your Vite config:
|
|
187
|
+
|
|
188
|
+
`+M.yellow(`ssr: {optimizeDeps: {include: ['${e}']}}`));if(!!d.find({rule:{kind:"string_fragment",regex:`^${e}$`}})){let f=new zt(`A dependency related to '${M.yellow(e)}' might need to be optimized by Vite but couldn't be configured automatically:
|
|
189
|
+
|
|
190
|
+
${M.dim(r.split(`
|
|
191
|
+
`)[0])}`,"If your app doesn't load, check the following stack trace and try fixing the problem by adding the imported dependency to the `ssr.optimizeDeps.include` array in your Vite config file.");throw f.stack=r,f}let{start:l}=d.range();return s.slice(0,l.index+1)+`'${e}',`+s.slice(l.index+1)})}var qo=class e extends R{static descriptionWithMarkdown=`Runs a Hydrogen storefront in a local runtime that emulates an Oxygen worker for development.
|
|
192
|
+
|
|
193
|
+
If your project is [linked](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-link) to a Hydrogen storefront, then its environment variables will be loaded with the runtime.`;static description="Runs Hydrogen storefront in an Oxygen worker for development.";static flags={...w.path,...w.entry,...ke(w.port,{port:{default:void 0,required:!1}}),...w.codegen,"disable-virtual-routes":$t.Flags.boolean({description:"Disable rendering fallback routes when a route file doesn't exist.",env:"SHOPIFY_HYDROGEN_FLAG_DISABLE_VIRTUAL_ROUTES",default:!1}),...w.debug,...w.inspectorPort,...w.env,...w.envBranch,...w.envFile,"disable-version-check":$t.Flags.boolean({description:"Skip the version check when running `hydrogen dev`",default:!1,required:!1}),...w.customerAccountPush,...w.verbose,host:$t.Flags.boolean({description:"Expose the server to the local network",default:!1,required:!1}),"disable-deps-optimizer":$t.Flags.boolean({description:"Disable adding dependencies to Vite's `ssr.optimizeDeps.include` automatically",env:"SHOPIFY_HYDROGEN_FLAG_DISABLE_DEPS_OPTIMIZER",default:!1})};async run(){let{flags:t}=await this.parse(e),o=t.path?P(t.path):process.cwd(),r={...G(t),customerAccountPush:t["customer-account-push"],path:o,cliConfig:this.config};if(!await oo(o))throw new g(De);let{close:i}=await el(r);He(async()=>{await i()})}};async function el({entry:e,port:t,path:o,host:r,codegen:n=!1,codegenConfigPath:i,disableVirtualRoutes:s,disableDepsOptimizer:a=!1,envBranch:d,env:m,debug:l=!1,disableVersionCheck:f=!1,inspectorPort:p,customerAccountPush:y=!1,envFile:h,cliConfig:b,verbose:v}){process.env.NODE_ENV||(process.env.NODE_ENV="development"),v&&no(),io()||st(),t===0&&(t=await pt(ot));let S=o??process.cwd(),k=X(S),x=ji(S,y,h),C=x.then(({fetchRemote:Z,localVariables:he})=>vo({root:S,envBranch:d,envHandle:m,fetchRemote:Z,localVariables:he,envFile:h}));l&&!p&&(p=await pt(ri));let T=await to(S);Ce&&await Ee(O(S,"node_modules/.vite"));let _=Promise.resolve().then(()=>tt(S)),E=await T.createServer({root:S,clearScreen:!1,cacheDir:process.env.SHOPIFY_UNIT_TEST?O(S,".vite"):void 0,customLogger:process.env.SHOPIFY_UNIT_TEST?Object.assign(T.createLogger(),{info:Z=>je("info",Z),warn:Z=>je("warn",Z),error:Z=>je("error",Z)}):void 0,server:{port:t??ot,host:r?!0:void 0,fs:Ce?{allow:[S,Ce]}:void 0},plugins:[{name:"hydrogen:cli",configResolved(Z){Rr(Z)?.api?.registerPluginOptions({disableVirtualRoutes:s}),ai(Z)?.api?.registerPluginOptions({debug:l,entry:e,envPromise:C.then(({allVariables:he})=>he),inspectorPort:p,logRequestLine:Ni,entryPointErrorHandler:Qs({disableDepsOptimizer:a,configFile:Z.configFile,formatOptionsPromise:_,showSuccessBanner:()=>Ks({disableVirtualRoutes:s,debug:l,inspectorPort:p,finalHost:fe,localHost:ae?.host?Q.origin:void 0,storefrontTitle:Ve})})})},configureServer:Z=>{y&&Z.middlewares.use((he,Ht,ur)=>{let Ie=he.headers.host;Ie?.includes(bo.ORIGINAL)&&(he.headers.host=Ie.replace(bo.ORIGINAL,bo.REBRANDED)),ur()})}}]});if(!Rr(E.config))throw await E.close(),new g("Hydrogen plugin not found.","Add `hydrogen()` plugin to your Vite config.");let q=(await we(S)).remixConfig,I,N=n?()=>{I?.kill(0),I=Oo({rootDirectory:S,configFilePath:i,appDirectory:q?.appDirectory})}:void 0;N?.(),Ce&&tl(E,Ce,N);let J=t??E.config.server.port??ot,[ae,L]=await Promise.all([x.then(({customerAccountPush:Z,storefrontId:he})=>Z?Fi(S,b,J,he):void 0),k,E.listen(J)]),Q=new URL(E.resolvedUrls.local[0]??E.resolvedUrls.network[0]),fe=ae?.host||Q.toString()||Q.origin;yi({rootDirectory:S,host:fe,cliCommand:L});let{logInjectedVariables:_t,allVariables:Nt}=await C;_t(),console.log(""),E.printUrls(),E.bindCLIShortcuts({print:!0}),console.log(`
|
|
194
|
+
`);let Ve=(await x).storefrontTitle;return Ks({disableVirtualRoutes:s,debug:l,inspectorPort:p,finalHost:fe,localHost:ae?.host?Q.origin:void 0,storefrontTitle:Ve}),f||qs({targetPath:S}),y&&Ii(Nt)&&$i(L),{getUrl:()=>fe,async close(){I?.removeAllListeners("close"),I?.kill("SIGINT"),await Promise.allSettled([E.close(),ae?.cleanup?.()]),E.watcher.close()}}}function Ks({disableVirtualRoutes:e,debug:t,inspectorPort:o,finalHost:r,localHost:n,storefrontTitle:i}){let s=[];e||s.push({body:_i(r,n)}),t&&o&&s.push({body:{warn:Ai(o)}}),H({body:[`View ${i?M.cyan(i):"Hydrogen"} app:`,{link:{url:r}}],customSections:s})}function tl(e,t,o){e.httpServer?.once("listening",()=>{e.watcher.add(t+"hydrogen/dist/vite/plugin.js"),e.watcher.add(t+"mini-oxygen/dist/vite/plugin.js"),e.watcher.add(t+"mini-oxygen/dist/vite/worker-entry.js"),e.watcher.add(t+"hydrogen-codegen/dist/esm/index.js");let r;e.watcher.on("change",async n=>{n.includes(t)&&(n.includes("/packages/hydrogen-codegen/")?o&&(o(),W({headline:"The Hydrogen Codegen source has been modified.",body:"The codegen process has been restarted."})):(await e.restart(!0),clearTimeout(r),r=setTimeout(()=>{console.log(""),W({headline:"The H2O Vite plugins have been modified.",body:"The Vite server has been restarted to reflect the changes."})},100)))})})}c();c();var ft=u.object({gid:Yn,name:u.string(),handle:u.string(),branch:u.string().nullable(),createdAt:Gn,type:u.string().describe("Upstream environment type; known values are PREVIEW, PRODUCTION, CUSTOM."),url:u.string().url().nullable()}).strict();function ht(e){return{gid:e.id,name:e.name,handle:e.handle,branch:e.branch??null,createdAt:Jn(e.createdAt),type:e.type,url:e.url||null}}var jt=u.object({name:u.string(),id:u.string().regex(/^\d+$/).describe("The decimal HydrogenStorefrontEnvironmentVariable ID, not a GID.").optional(),isSecret:u.boolean().optional(),readOnly:u.boolean().optional()}).strict().describe("Metadata only: variable spelling is preserved and values are never included. Unknown metadata is omitted."),Xs=u.object({gid:Er,name:u.string(),productionUrl:u.string().url().nullable()}).strict(),Zr=Y({name:"HydrogenEnvListResult",schema:u.object({status:u.enum(["success","cancelled"]),storefront:Xs.nullable(),environments:u.array(ft)}).strict().describe("The complete environment list for the linked storefront."),definitions:{Environment:ft,Storefront:Xs}}),en=Y({name:"HydrogenEnvPullResult",schema:u.object({status:u.enum(["success","cancelled"]),changed:u.boolean(),path:B,storefrontGid:Er.nullable(),storefrontName:u.string().nullable(),environment:ft.nullable(),variables:u.array(jt)}).strict().describe("The dotenv file keeps its native format. The result reports variable metadata without values."),definitions:{Environment:ft,Variable:jt}}),tn=Y({name:"HydrogenEnvPushResult",schema:u.object({status:u.enum(["success","cancelled"]),changed:u.boolean(),wouldChange:u.boolean().describe("Whether the compared local and remote variables differ, excluding protected variables."),dryRun:u.boolean(),path:B,environment:ft.nullable(),variables:u.array(jt),skipped:u.array(jt)}).strict(),definitions:{Environment:ft,Variable:jt}});var Wo=class e extends R{static get jsonOutputSchema(){return Zr}static descriptionWithMarkdown="Lists all environments available on the linked Hydrogen storefront.";static description=this.descriptionForHelp();static flags={...$,...w.path};async run(){let{flags:t}=await this.parse(e);await ol(t,t.json)}};async function ol(e,t){let o=await rl(e);return!j(Zr,o,t)&&o.storefront&&nl(o),o}async function rl({path:e=process.cwd()}){let[{session:t,config:o},r]=await Promise.all([ve(e),X()]),n=await Le({root:e,session:t,config:o,cliCommand:r});if(!n)return{status:"cancelled",storefront:null,environments:[]};o.storefront=n;let i=await ct(t,o.storefront.id);i||Ke({session:t,storefront:o.storefront,cliCommand:r});let s=[...i.environments.filter(a=>a.type!=="PREVIEW"),...i.environments.filter(a=>a.type==="PREVIEW")];return{status:"success",storefront:{gid:i.id,name:o.storefront.title,productionUrl:i.productionUrl||null},environments:s.map(ht)}}function nl(e){A(il({environments:e.environments,storefrontTitle:e.storefront.name}).toString()),e.environments.forEach(({name:t,handle:o,branch:r,type:n,url:i})=>{ye();let s=n==="PRODUCTION"?e.storefront.productionUrl:i;A(ee`${Je(t,o,r)}`.value),s&&A(ee` ${s}`.value)}),ye()}var il=({environments:e,storefrontTitle:t})=>Mt(e,o=>`Showing ${o.length} environments for the Hydrogen storefront ${t}`,o=>`Showing 1 environment for the Hydrogen storefront ${t}`,()=>`There are no environments for the Hydrogen storefront ${t}`);c();import{randomUUID as Zs}from"node:crypto";function sl(e){return/[{}@#\s"'\\$`|;&<>()!?*\[\]]/.test(e)||/[\x00-\x1F\x7F]/.test(e)}function al(e,t){if(!sl(t))return t;if(!/['\r\n]/.test(t))return`'${t}'`;if(!/["\\$`]/.test(t))return`"${t.replaceAll("\r","\\r").replaceAll(`
|
|
195
|
+
`,"\\n")}"`;if(!/['\r]/.test(t))return`'${t}'`;throw new g(`Environment variable ${e} cannot be represented safely in dotenv format without changing its value.`,"The value cannot be quoted without changing it or allowing shell expansion. Update its format before pulling it.")}function ea(e,t){let o=new Map,r=e?.replace(/(^[^\n=:#]+[=:][\t ]*)(["'`])([\t ]*\r?\n)/gm,(s,a,d,m)=>{let l=`__HYDROGEN_ENV_${Zs()}__`;return o.set(l,""),`${a}${d}${l}${m}`})??null,n=Object.fromEntries(Object.entries(t).map(([s,a])=>{if(!a.includes(`
|
|
196
|
+
`))return[s,a];let d=`__HYDROGEN_ENV_${Zs()}__`;return o.set(d,a),[s,d]})),i=Ri(r,n);for(let[s,a]of o)i=i.replaceAll(s,()=>a);return i}var Jo=class e extends R{static get jsonOutputSchema(){return en}static descriptionWithMarkdown="Pulls environment variables from the linked Hydrogen storefront and writes them to an `.env` file.";static description=this.descriptionForHelp();static flags={...$,...w.env,...w.envBranch,...w.envFile,...w.path,...w.force};async run(){let{flags:t}=await this.parse(e);await ll({...G(t)},t.json)}};async function cl({env:e,envBranch:t,path:o=process.cwd(),envFile:r,force:n}){let i={path:P(o,r),variables:[],changed:!1,storefrontGid:null,storefrontName:null,environment:null},[{session:s,config:a},d]=await Promise.all([ve(o),X()]),m=await Le({root:o,session:s,config:a,cliCommand:d});if(!m)return{...i,status:"cancelled"};a.storefront=m;let l=await ct(s,a.storefront.id);l||Ke({session:s,storefront:a.storefront,cliCommand:d});let{environments:f}=l,p=e?at(f,e):t?Pt(f,t):f.find(({type:x})=>x==="PREVIEW");if(!p)throw new g("Could not find the Preview environment.");let y=await wo(s,a.storefront.id,p.handle);y||Ke({session:s,storefront:a.storefront,cliCommand:d});let h=y.environmentVariables,b={...i,storefrontGid:a.storefront.id,storefrontName:a.storefront.title,environment:ht(p),variables:h.map(({id:x,key:C,isSecret:T,readOnly:_})=>({id:x.startsWith("gid://shopify/HydrogenStorefrontEnvironmentVariable/")?x.split("/").at(-1):x,name:C,isSecret:T,readOnly:_}))};if(!h.length)return{...b,status:"success"};let v=M.whiteBright(r),S=P(o,r),k={};if(h.forEach(({isSecret:x,key:C,value:T})=>{k[C]=x?'""':al(C,T)}),await K(S)&&!n){let x=await ue(S),C=ea(x,k);if(x===C)return{...b,status:"success"};if(!Jt())throw new g("Pulling environment variables requires confirmation.","Use --force to overwrite the environment file, or run in an interactive terminal.");let T=So(x,C);if(!await Te({confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later",message:ee`We'll make the following changes to your ${v} file:
|
|
197
|
+
|
|
198
|
+
${xe.linesDiff(T)}
|
|
199
|
+
Continue?`.value}))return{...b,status:"cancelled"};await oe(S,C)}else{let x=ea(null,k);await oe(S,x)}return{...b,status:"success",changed:!0}}async function ll(e,t){let o=await cl(e);if(j(en,o,t))return o;let r=M.whiteBright(e.envFile);return o.status==="success"&&o.variables.length===0?A("No environment variables found."):o.status==="success"&&!o.changed?W({body:`No changes to your ${r} file`}):o.status==="success"&&o.changed&&(o.variables.some(({isSecret:n})=>n)&&te({body:`${o.storefrontName} contains environment variables marked as secret, so their values weren\u2019t pulled.`}),H({body:["Changes have been made to your",{filePath:r},"file"]})),o}c();var on=re(me(),1);c();var dl=`#graphql
|
|
200
|
+
mutation PushVariables(
|
|
201
|
+
$storefrontId: ID!,
|
|
202
|
+
$environmentId: ID!,
|
|
203
|
+
$environmentVariablesInput: [HydrogenStorefrontEnvironmentVariableInput!]!,
|
|
204
|
+
) {
|
|
205
|
+
hydrogenStorefrontEnvironmentVariableBulkReplace(
|
|
206
|
+
storefrontId: $storefrontId,
|
|
207
|
+
environmentId: $environmentId,
|
|
208
|
+
environmentVariablesInput: $environmentVariablesInput,
|
|
209
|
+
) {
|
|
210
|
+
userErrors {
|
|
211
|
+
code
|
|
212
|
+
message
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
`;async function ta(e,t,o,r){let{hydrogenStorefrontEnvironmentVariableBulkReplace:n}=await nt(dl,e,{storefrontId:t,environmentId:o,environmentVariablesInput:r}),{userErrors:i}=n;return{userErrors:i}}var zo=class e extends R{static get jsonOutputSchema(){return tn}static descriptionWithMarkdown="Push environment variables from the local .env file to your linked Hydrogen storefront.";static description=this.descriptionForHelp();static flags={...$,...w.env,...w.envFile,...w.path,force:on.Flags.boolean({char:"f",description:"Push environment variable changes without confirmation.",env:"SHOPIFY_HYDROGEN_FLAG_FORCE"}),"dry-run":on.Flags.boolean({description:"Preview environment variable changes without pushing them.",env:"SHOPIFY_HYDROGEN_FLAG_DRY_RUN",exclusive:["force"]})};async run(){let{flags:t}=await this.parse(e);await ul({...G(t)},t.json)}};async function ml({dryRun:e=!1,env:t,envFile:o,force:r=!1,path:n=process.cwd()}){let i,s=P(n,o),{variables:a}=await go(s),[{session:d,config:m},l]=await Promise.all([ve(n),X()]),f=await Le({root:n,session:d,config:m,cliCommand:l});if(!f)return{status:"cancelled",changed:!1,wouldChange:!1,dryRun:e,path:s,environment:null,variables:[],skipped:[]};m.storefront=f;let{environments:p}=await ct(d,m.storefront.id)??{};if(!p)throw new g("Failed to fetch environments");let y=yo(p);if(y.length===0)throw new g("No environments found");if(t)i=at(y,t);else{let E=[...y.map(({id:q,name:I,branch:N,handle:J})=>({label:Je(I,J,N),value:q}))],D=await $e({message:"Select an environment to overwrite its environment variables:",choices:E});i=y.find(({id:q})=>q===D)}let{environmentVariables:h=[]}=await wo(d,m.storefront.id,i.handle)??{},b=new Set(h.filter(({isSecret:E,readOnly:D})=>E||D).map(({key:E})=>E)),S=h.filter(({key:E})=>!b.has(E)).sort((E,D)=>E.key.localeCompare(D.key)).map(({key:E,value:D})=>`${E}=${JSON.stringify(D)}`).join(`
|
|
217
|
+
`)+`
|
|
218
|
+
`,k=Object.keys(a).sort((E,D)=>E.localeCompare(D)).reduce((E,D)=>b.has(D)?E:[...E,`${D}=${JSON.stringify(a[D])}`],[]).join(`
|
|
219
|
+
`)+`
|
|
220
|
+
`;if(!i.name)throw new g("Missing environment name");let x=h.reduce((E,{isSecret:D,readOnly:q,key:I})=>{if(!D&&!q)return E;let N=a[I],J=h.find(ae=>ae.key===I);return N===J?.value?E:[...E,I]},[]);x.length&&V(`Variables that are read only or contain secret values cannot be pushed from the CLI: ${x.join(", ")}.
|
|
221
|
+
`);let C={path:s,changed:!1,wouldChange:k!==S,dryRun:e,environment:ht(i),variables:Object.keys(a).filter(E=>!b.has(E)).map(E=>({name:E})),skipped:Object.keys(a).filter(E=>b.has(E)).map(E=>({name:E}))};if(!C.wouldChange)return{...C,status:"success"};let T=So(S,k);if(e)return{...C,status:"success",diff:T};if(!r){if(!Jt())throw new g("Pushing environment variables requires confirmation.","Use --force to push the changes, --dry-run to preview them, or run in an interactive terminal.");if(!await Te({confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later",message:ee`We'll make the following changes to your environment variables for ${i.name}:
|
|
222
|
+
|
|
223
|
+
${xe.linesDiff(T)}
|
|
224
|
+
Continue?`.value}))return{...C,status:"cancelled"}}if(!i.id)throw new g("Missing environment ID");let{userErrors:_}=await ta(d,m.storefront.id,i.id,Object.entries(a).filter(([E])=>!b.has(E)).map(([E,D])=>({key:E,value:D})));if(_.length)throw new g("Failed to upload and save environment variables.",_[0]?.message);return{...C,status:"success",changed:!0}}async function ul(e,t){let o=await ml(e);return j(tn,(({diff:r,...n})=>n)(o),t)||(o.status==="success"&&!o.changed&&!o.diff&&W({body:"No changes to your environment variables."}),o.status==="success"&&o.dryRun&&o.diff&&W({body:ee`The following changes would be made to your environment variables for ${o.environment.name}:
|
|
225
|
+
|
|
226
|
+
${xe.linesDiff(o.diff)}
|
|
227
|
+
No changes were pushed because --dry-run was used.`.value}),o.status==="success"&&o.changed&&H({body:`Environment variables push to ${o.environment?.name??"Preview"} was successful.`})),o}c();c();c();var Qo=u.object({sourceRoute:u.string(),destinationRoute:u.string(),operation:u.enum(["created","skipped","replaced"]),skipReason:u.enum(["declined","exists"]).optional()}).strict(),Ft=Y({name:"HydrogenGenerateRoutesResult",schema:u.object({status:u.enum(["success","skipped"]),changed:u.boolean(),routes:u.array(Qo),routeGroups:u.record(u.array(u.string())),isTypescript:u.boolean()}).strict(),definitions:{Route:Qo}});var gt=re(me(),1);var Me=class e extends R{static get jsonOutputSchema(){return Ft}static descriptionWithMarkdown="Generates a set of default routes from the starter template.";static description=this.descriptionForHelp();static flags={...$,adapter:gt.Flags.string({description:"React Router adapter used in the route. The default is `react-router`.",env:"SHOPIFY_HYDROGEN_FLAG_ADAPTER"}),typescript:gt.Flags.boolean({description:"Generate TypeScript files",env:"SHOPIFY_HYDROGEN_FLAG_TYPESCRIPT"}),"locale-param":gt.Flags.string({description:"The param name in Remix routes for the i18n locale, if any. Example: `locale` becomes ($locale).",env:"SHOPIFY_HYDROGEN_FLAG_ADAPTER"}),...w.force,...w.path};static hidden;static args={routeName:gt.Args.string({name:"routeName",description:`The route to generate. One of ${$r.join()}.`,required:!0,options:$r,env:"SHOPIFY_HYDROGEN_ARG_ROUTE"})};async run(){let{flags:t,args:{routeName:o}}=await this.parse(e),r=t.path?P(t.path):process.cwd();await rn({...t,directory:r,routeName:o,localePrefix:t["locale-param"]},t.json)}};async function rn(e,t){let{routes:o,routeGroups:r,isTypescript:n}=await Si({...e,v1RouteConvention:bi()}),i=o.some(({operation:a})=>a!=="skipped"),s={status:!i&&o.length?"skipped":"success",changed:i,routes:o.map(({sourceRoute:a,destinationRoute:d,operation:m,skipReason:l})=>({sourceRoute:a,destinationRoute:d,operation:m,...l?{skipReason:l}:{}})),routeGroups:r,isTypescript:n};return j(Ft,s,t)||pl(s),s}function pl({routes:e}){let t=3+e.reduce((r,n)=>Math.max(r,n.destinationRoute.length),0),o=e.filter(({operation:r})=>r!=="skipped").length;H({headline:`${o} of ${e.length} route${e.length>1?"s":""} generated`,body:{list:{items:e.map(({operation:r,destinationRoute:n})=>n.padEnd(t)+M.dim(`[${r}]`))}}})}var Ko=class extends R{static description="Shortcut for `hydrogen generate`. See `hydrogen generate --help` for more information.";static strict=!1;static hidden=!0;async run(){let[t,...o]=this.argv;if(t==="r"||t==="route")return new Me(o,this.config).run();throw new Error(`Invalid command argument "${t}".`)}};c();var Xo=class e extends R{static get jsonOutputSchema(){return Ft}static descriptionWithMarkdown="Generates all supported standard shopify routes.";static description=this.descriptionForHelp();static hidden;static flags={...Me.flags,...$};async run(){let{flags:t}=await this.parse(e);await rn({...t,directory:t.path?P(t.path):process.cwd(),routeName:"all",localePrefix:t["locale-param"]},t.json)}};c();c();var oa=u.object({name:u.string(),directory:B,storefrontName:u.string().nullable(),language:u.enum(["js","ts"]).nullable(),packageManager:u.enum(["npm","pnpm","yarn","bun","unknown"]),dependenciesInstalled:u.boolean(),cssStrategy:u.enum(["none","tailwind","vanilla-extract","css-modules","postcss"]).nullable(),i18n:u.enum(["none","subfolders","domains","subdomains"]).nullable(),routes:u.record(u.union([u.string(),u.array(u.string())])).nullable()}).strict().describe("All projected fields are present; unavailable settings are null. Route values are relative route names."),Zo=Y({name:"HydrogenInitResult",schema:u.object({status:qn,project:oa.nullable(),failures:u.array(u.enum(["dependencies","markets","routes"]))}).strict(),definitions:{Project:oa}});var Ue=re(me(),1);c();import{fileURLToPath as fl}from"node:url";var At={cli:"@shopify/cli",cliHydrogen:"@shopify/cli-hydrogen",createApp:"@shopify/create-hydrogen"};async function ra(){if(Ye&&!process.env.SHOPIFY_UNIT_TEST)return;let{content:e}=await $n(fl(import.meta.url)).catch(()=>({content:void 0})),t=e?.name,o=e?.version;if(!t||!o||!Object.values(At).some(i=>i===t)||o.includes("next")||o.includes("experimental")||o.includes("snapshot"))return;let r=await Tn(t,o);if(!r)return;let n=[{link:{label:"Hydrogen releases",url:"https://github.com/Shopify/hydrogen/releases"}}];return t===At.cli&&n.push({link:{label:"Global CLI reference",url:"https://shopify.dev/docs/api/shopify-cli/"}}),i=>{i??=Dn(),(i==="unknown"||!i)&&(i=On()),i==="unknown"&&(i="npm");let s=t===At.cli?`Please install the latest Shopify CLI version with \`${i==="yarn"?`yarn global add ${At.cli}`:`${i} install -g ${At.cli}`}\` and try again.`:`Please use the latest version with \`${i} create @shopify/hydrogen@latest\``;return W({headline:"Upgrade available",body:`Version ${r} of ${t} is now available.
|
|
228
|
+
You are currently running v${o}.
|
|
229
|
+
|
|
230
|
+
`+s,reference:n}),{currentVersion:o,newVersion:r}}}c();c();function hl(e){if(!e)return{status:"cancelled",project:null,failures:[]};let{name:t,directory:o,storefrontTitle:r,language:n,packageManager:i,depsInstalled:s,cssStrategy:a,i18n:d,routes:m}=e,l=[];return e.depsError&&l.push("dependencies"),e.i18nError&&l.push("markets"),e.routesError&&l.push("routes"),{status:l.length?"partial":"success",project:{name:t,directory:o,storefrontName:r||null,language:n??null,packageManager:i,dependenciesInstalled:s,cssStrategy:a??null,i18n:e.i18nError?null:d??null,routes:m??null},failures:l}}async function na(e,t){if(de())for(let r of[e?.depsError,e?.i18nError,e?.routesError])r&&V(r.message);let o=hl(e);o.status==="partial"&&(process.exitCode=1),!(j(Zo,o)||!e)&&(await fo(e,e),t&&W({headline:`Your project will display inventory from ${t==="demo-store"||t.endsWith("shopify/hydrogen-demo-store")?"the Hydrogen Demo Store":"Mock.shop"}.`,body:"To connect this project to your Shopify store\u2019s inventory, update `"+e.name+"/.env` with your store ID and Storefront API key."}))}c();import{cp as gl}from"node:fs/promises";async function ia(e,t){let o=e.mockShop?"mock":await $e({message:"Connect to Shopify",choices:[{label:"Use sample data from mock.shop (You can connect a Shopify account later)",value:"mock"},{label:"Link your Shopify account",value:"link"}],defaultValue:"mock",abortSignal:t.signal}),r=o==="link"?await Pi(t):void 0,n=await lo({...e,storefrontInfo:r,controller:t});if(!n)return;o==="mock"&&(n.storefrontTitle="Mock.shop");let i=ho(t,n),s=r&&!r.id&&pi(r.session,r.title).then(async({storefront:I,jobId:N})=>(N&&await fi(r.session,N),I)).catch(i),a=await Xn(),d=gl(a,n.directory,{force:!0,recursive:!0,filter:I=>!/^(app(\/|$)|dist(\/|$)|node_modules(\/|$)|server\.ts$|\.shopify(\/|$))/i.test(le(a,I))}).then(()=>ao({rootDirectory:n.directory,appDirectory:O(n.directory,"app"),typescript:!0})).catch(i),m={create:"Creating storefront",setup:`Setting up ${e.quickstart?"Quickstart ":""}project`,install:"Installing dependencies. This could take a few minutes"},l=[{title:m.create,task:async()=>{await s}},{title:m.setup,task:async()=>{await d}}],f=await X(),p=`# The variables added in this file are only available locally in MiniOxygen.
|
|
231
|
+
# Run \`${f} link\` to also inject environment variables from your storefront,
|
|
232
|
+
# or \`${f} env pull\` to populate this file.`;d=d.then(()=>{let I=[Ae(O(n.directory,"package.json"),!1,J=>(J=yl(J),J.replace(/"name": "[^"]+"/,`"name": "${vn(r?.title??n.name)}"`)))],N;return r?(I.push(di(n.directory,r),oe(O(n.directory,".env"),p)),r.id?N={id:r.id,title:r.title}:s&&I.push(s.then(J=>{N=J}))):o==="mock"&&I.push(oe(O(n.directory,".env"),p+`
|
|
233
|
+
`+[["SESSION_SECRET","foobar"]].map(([J,ae])=>`${J}="${ae}"`).join(`
|
|
234
|
+
`)+`
|
|
235
|
+
`)),Promise.all(I).then(()=>{if(N)return mi(n.directory,N)}).catch(i)});let{language:y,transpileProject:h}=await mo(n.directory,t,e.language);d=d.then(()=>h().catch(i)).then(()=>e.git?po(n.directory):void 0);let{setupCss:b,cssStrategy:v}=await xi(n.directory,t,e.styling);v&&(d=d.then(()=>b().catch(i)).then(()=>e.git?We(n.directory,"Setup "+kt[v]):void 0));let{packageManager:S,shouldInstallDeps:k,installDeps:x}=await uo(n.directory,t,e.packageManager,e.installDeps),C={language:y,packageManager:S,cssStrategy:v??"none",depsInstalled:!1,cliCommand:await X("",S)};if(k){let I=d.then(async()=>{try{if(await x(),C.depsInstalled=!0,y==="ts")try{await Ze("npx react-router typegen",{cwd:n.directory})}catch{V("Failed to generate React Router types. You may need to run `npx react-router typegen` manually.")}}catch(N){C.depsError=N}});l.push({title:m.install,task:async()=>{await I}})}let{createShortcut:T,showShortcutBanner:_}=await co(t,C.cliCommand,e.shortcut);T&&(d=d.then(async()=>{await T()&&(C.cliCommand=qe)}),_()),e.quickstart?de()||console.log(`
|
|
236
|
+
`):de()||H({headline:[{userInput:r?.title??n.name},"is ready to build."]});let{i18nStrategy:E,setupI18n:D}=await Ei(t,C.cliCommand,e.i18n),{setupRoutes:q}=so(t);return C.i18n=E??"none",d=d.then(async()=>{await D({rootDirectory:n.directory,contextCreate:y==="ts"?"app/lib/context.ts":"app/lib/context.js"}).then(()=>e.git?We(n.directory,`Setup markets support using ${E}`):void 0).catch(I=>{C.i18nError=I}),await q(n.directory,y,{i18nStrategy:E,overwriteFileDeps:!1}).then(async({routeGroups:I})=>{if(C.routes=I,y==="ts"&&C.depsInstalled)try{await Ze("npx react-router typegen",{cwd:n.directory})}catch{V("Failed to generate React Router types after route generation. You may need to run `npx react-router typegen` manually.")}if(e.git&&I)return We(n.directory,"Generate routes for core functionality")}).catch(I=>{C.routesError=I})}),await ne(l),e.git&&await We(n.directory,"Lockfile"),{...n,...C}}function yl(e){let t=e.match(/^\s+"@shopify\/hydrogen":\s+"[^"]+",\n/m)?.[0];if(t&&/"0\.0\.0-\w+-/.test(t)){let o=t.replace("hydrogen","cli-hydrogen");e=e.replace(t,o+t)}return e}c();c();async function sa(e,t){let o=Vn(e);if(o.isErr())throw new g(o.error.message);let r=await et("external-templates");await K(r)||await Vt(r);let n=o.value,i=O(r,n.full.replace(/^https?:\/\//,"").replace(/[^\w]+/,"_"));return await K(i)&&await vr(i,{force:!0}),await Nn({repoUrl:n.full,destination:i,shallow:!0}),await vr(O(i,".git"),{force:!0}),{templateDir:i}}var wl="shopify/hydrogen-demo-store";async function aa(e,t){let o=e.template==="demo-store"?wl:e.template,r=await lo({...e,controller:t});if(!r)return;let n=ho(t,r),i=o.includes("/")?vl(o,t.signal).catch(n):bl(o).catch(n),s=await i;if(t.signal.aborted)return;let a=Promise.resolve().then(async()=>{if(t.signal.aborted)return;let{sourcePath:v}=s;await Ut(v,r.directory)}).catch(n),d=await K(O(s.sourcePath,"tsconfig.json")),{language:m,transpileProject:l}=d?await mo(r.directory,t,e.language):{language:"js",transpileProject:()=>Promise.resolve()};if(a=a.then(()=>l().catch(n)).then(()=>e.git?po(r.directory):void 0),await a,t.signal.aborted)return;let{packageManager:f,shouldInstallDeps:p,installDeps:y}=await uo(r.directory,t,e.packageManager,e.installDeps),h={language:m,packageManager:f,depsInstalled:!1,cliCommand:await X("",f)},b=[{title:"Downloading template",task:async()=>{await i}},{title:"Setting up project",task:async()=>{await a}}];if(p&&b.push({title:"Installing dependencies. This could take a few minutes",task:async()=>{try{await y(),h.depsInstalled=!0}catch(v){h.depsError=v}}}),!t.signal.aborted)return await ne(b),e.git&&await We(r.directory,"Lockfile"),{...r,...h}}async function vl(e,t){let{templateDir:o}=await sa(e,t);return{sourcePath:o}}async function bl(e){throw new g(`Unknown value in \`--template\` flag "${e}".
|
|
237
|
+
Skip the flag or provide the name of a template or a URL to a git repository.`,{list:{title:"Available templates:",items:["skeleton","demo-store"]}})}async function ca(e){let t=new Gt;try{let o=e.template==="skeleton"?void 0:e.template,r=o?await aa({...e,template:o},t):await ia(e,t);return await na(r,o),r}catch(o){throw t.abort(),o}}var Sl={f:"force"},er=class e extends R{static get jsonOutputSchema(){return Zo}static descriptionWithMarkdown="Creates a new Hydrogen storefront.";static description=this.descriptionForHelp();static flags={...$,...w.force,path:Ue.Flags.string({description:"The path to the directory of the new Hydrogen storefront.",env:"SHOPIFY_HYDROGEN_FLAG_PATH"}),language:Ue.Flags.string({description:"Sets the template language to use. One of `js` or `ts`.",choices:Object.keys(ki),env:"SHOPIFY_HYDROGEN_FLAG_LANGUAGE"}),template:Ue.Flags.string({description:"Scaffolds project based on a template: `skeleton` (the default), `demo-store` or a URL to a git repository.",env:"SHOPIFY_HYDROGEN_FLAG_TEMPLATE"}),...w.installDeps,"mock-shop":Ue.Flags.boolean({description:"Use mock.shop as the data source for the storefront.",env:"SHOPIFY_HYDROGEN_FLAG_MOCK_DATA"}),...w.styling,...w.markets,...w.shortcut,git:Ue.Flags.boolean({description:"Init Git and create initial commits.",env:"SHOPIFY_HYDROGEN_FLAG_GIT",default:!0,allowNo:!0}),quickstart:Ue.Flags.boolean({description:"Scaffolds a new Hydrogen project with a set of sensible defaults. Equivalent to `shopify hydrogen init --path hydrogen-quickstart --mock-shop --language js --shortcut --markets none`",env:"SHOPIFY_HYDROGEN_FLAG_QUICKSTART",default:!1}),"package-manager":Ue.Flags.string({env:"SHOPIFY_HYDROGEN_FLAG_PACKAGE_MANAGER",hidden:!0,options:["npm","yarn","pnpm","unknown"]})};async run(){let{flags:t}=await this.parse(e);await kl(G(t))}};async function kl(e){let t=()=>Bn(()=>El(e));return Pn()?t():xn(process.argv.slice(2),t)}async function El({markets:e,...t}=ni(process.argv,Sl)){if(Qn(),!t.i18n&&e&&(t.i18n=e),t.i18n&&!Dr.includes(t.i18n))throw new g(`Invalid URL structure strategy: ${t.i18n}. Must be one of ${Dr.join(", ")}`);if(t.styling&&!xr.includes(t.styling))throw new g(`Invalid styling strategy: ${t.styling}. Must be one of ${xr.join(", ")}`);t.git??=!0,t.quickstart&&(t.i18n??="none",t.installDeps??=!0,t.language??="js",t.mockShop??=!0,t.path??="./hydrogen-quickstart",t.shortcut??=!0,t.styling??="none");let o=await ra();return o&&o(t.packageManager),ca(t)}c();c();var Pl=`#graphql
|
|
238
|
+
query ListStorefronts {
|
|
239
|
+
hydrogenStorefronts {
|
|
240
|
+
id
|
|
241
|
+
title
|
|
242
|
+
productionUrl
|
|
243
|
+
currentProductionDeployment {
|
|
244
|
+
id
|
|
245
|
+
createdAt
|
|
246
|
+
commitMessage
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
`;async function la(e){let{hydrogenStorefronts:t}=await nt(Pl,e);return t.map(o=>({...o,parsedId:it(o.id)}))}var tr=class e extends R{static get jsonOutputSchema(){return Tr}static descriptionWithMarkdown="Lists all remote Hydrogen storefronts available to link to your local development environment.";static description=this.descriptionForHelp();static flags={...$,...w.path};async run(){let{flags:t}=await this.parse(e);await Cl(t,t.json)}};async function xl({path:e=process.cwd()}){let{session:t}=await ve(e),o=await la(t);return{shop:t.storeFqdn,storefronts:o}}async function Cl(e,t){let o=await xl(e);return j(Tr,ci(o),t)||await Ol(o,e.path),o}async function Ol({shop:e,storefronts:t},o){t.length>0?(ye(),A(Tl({storefronts:t,shop:e}).toString()),t.forEach(({currentProductionDeployment:r,id:n,productionUrl:i,title:s})=>{ye(),A(ee`${M.whiteBright(s)} ${M.dim(`(id: ${it(n)})`)}`.value),i&&A(ee` ${M.whiteBright(i)}`.value),r&&A(ee` ${M.dim(Rl(r))}`.value)})):W({headline:"Hydrogen storefronts",body:"There are no Hydrogen storefronts on your Shop.",nextSteps:[`Ensure you are logged in to the correct shop (currently: ${e})`,`Create a new Hydrogen storefront: Run \`${await X(o)} link\` or visit ${$s({storeFqdn:e})}`]})}var Dl=new Intl.DateTimeFormat("default",{year:"numeric",month:"numeric",day:"numeric"});function Rl(e){let t="";if(!e)return t;if(t+=Dl.format(new Date(e.createdAt)),e.commitMessage){let o=e.commitMessage.split(/\n/)[0];t+=`, ${o}`}return t}var Tl=({storefronts:e,shop:t})=>Mt(e,o=>`Showing ${o.length} Hydrogen storefronts for the store ${t}`,o=>`Showing 1 Hydrogen storefront for the store ${t}`);c();c();var nn=Y({name:"HydrogenLoginResult",schema:u.object({storeDomain:Wn,name:u.string().nullable(),email:u.string().email().nullable()}).strict()}),sn=Y({name:"HydrogenLogoutResult",schema:u.object({status:u.literal("success"),loggedOut:u.literal(!0)}).strict()});var or=class e extends R{static get jsonOutputSchema(){return nn}static descriptionWithMarkdown="Logs in to the specified shop and saves the shop domain to the project.";static description=this.descriptionForHelp();static flags={...$,...w.path,...w.shop};async run(){let{flags:t}=await this.parse(e);await Il(t,t.json)}};async function Il({path:e=process.cwd(),shop:t},o){ye(),gi(!0);let{config:r}=await ve(e,t??!0),{shop:n,shopName:i,email:s}=r,a={storeDomain:zn(n),name:i||null,email:s||null};return j(nn,a,o)||vi(r),a}c();var rr=class e extends R{static get jsonOutputSchema(){return sn}static descriptionWithMarkdown="Log out from the current shop.";static description=this.descriptionForHelp();static flags={...$,...w.path};async run(){let{flags:t}=await this.parse(e);await $l(t,t.json)}};async function $l({path:e=process.cwd()},t){ye(),await wi(e);let o={status:"success",loggedOut:!0};return j(sn,o,t)||H({body:"You are logged out from Shopify."}),o}c();var an=re(me(),1);c();async function da(e){let{startWorkerdServer:t}=await import("./workerd-MQZ3NKJI.js");return t(e)}var nr=class e extends R{static descriptionWithMarkdown="Runs a server in your local development environment that serves your Hydrogen app's production build. Requires running the [build](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-build) command first.";static description="Runs a Hydrogen storefront in an Oxygen worker for production.";static flags={...w.path,...w.port,...w.env,...w.envBranch,...w.envFile,...w.inspectorPort,...w.debug,...w.verbose,build:an.Flags.boolean({description:"Builds the app before starting the preview server."}),watch:an.Flags.boolean({description:"Watches for changes and rebuilds the project.",dependsOn:["build"]}),...ke(w.entry,{entry:{dependsOn:["build"]}}),...ke(w.codegen,{codegen:{dependsOn:["build"]}})};async run(){let{flags:t}=await this.parse(e),o=t.path?P(t.path):process.cwd(),{close:r}=await jl({...G(t),directory:o});He(async()=>{await r()})}};async function jl({port:e,directory:t,env:o,envBranch:r,inspectorPort:n,debug:i,verbose:s,build:a=!1,watch:d=!1,codegen:m=!1,codegenConfigPath:l,entry:f,envFile:p}){process.env.NODE_ENV||(process.env.NODE_ENV=d?"development":"production"),s&&no(),io()||st();let{root:y,buildPath:h,buildPathWorkerFile:b,buildPathClient:v}=Oe(t),S=await rt(y);if(S)throw new g(De);let k,x=Ot(),T=a?await ze({...{directory:y,entry:f,disableRouteWarning:!1,lockfileCheck:!1,sourcemap:!0,bundleStats:!1,useCodegen:m,codegenConfigPath:l},watch:d,async onServerBuildFinish(){x.state==="pending"?x.resolve():A("\u{1F3D7}\uFE0F Project rebuilt. Reloading server..."),await k?.reload()}}):x.resolve();S||(b=(await we(y).catch(()=>null))?.serverOutFile??O(h,"server","index.js"));let{shop:_,storefront:E}=await ro(y),D=!!_&&!!E?.id,{allVariables:q,logInjectedVariables:I}=await vo({root:y,fetchRemote:D,envBranch:r,envHandle:o,envFile:p});e||(e=await pt(ot));let N=await pt(e+100);return await x.promise,I(),k=await da({root:y,appPort:e,assetsPort:N,env:q,buildPathClient:v,buildPathWorkerFile:b,inspectorPort:n,debug:i,watch:d}),k.showBanner({mode:"preview",headlinePrefix:d?"Watching for changes. ":""}),{async close(){await Promise.allSettled([k.close(),T?.close()])}}}c();c();var cn=Y({name:"HydrogenSetupResult",schema:u.object({status:u.literal("success"),changed:u.boolean(),directory:B,name:u.string(),i18n:u.enum(["subfolders","domains","subdomains"]).nullable(),routes:u.array(Qo),routeGroups:u.record(u.array(u.string())),shortcut:u.boolean()}).strict()}),ln=Y({name:"HydrogenSetupCssResult",definitions:{AbsolutePath:B},schema:u.object({status:u.enum(["success","cancelled"]),changed:u.boolean(),directory:B,strategy:u.enum(["tailwind","vanilla-extract","css-modules","postcss"]),filePaths:u.array(B),dependenciesInstalled:u.boolean(),needsNpmReinstall:u.boolean()}).strict()}),dn=Y({name:"HydrogenSetupMarketsResult",definitions:{AbsolutePath:B},schema:u.object({status:u.literal("success"),changed:u.literal(!0),directory:B,strategy:u.enum(["subfolders","domains","subdomains"]),serverPath:B.nullable()}).strict()}),mn=Y({name:"HydrogenSetupViteResult",definitions:{AbsolutePath:B},schema:u.object({status:u.literal("success"),changed:u.literal(!0),directory:B,viteConfigPath:B,serverPath:B,dependenciesInstalled:u.literal(!0),needsMdxSetup:u.boolean()}).strict()});var ir=class e extends R{static get jsonOutputSchema(){return cn}static descriptionWithMarkdown="Scaffold routes and core functionality.";static description=this.descriptionForHelp();static flags={...$,...w.path,...w.force,...w.markets,...w.shortcut,...ke(w.installDeps,{"install-deps":{default:!0}})};async run(){let{flags:t}=await this.parse(e),o=t.path?P(t.path):process.cwd();await Al({...G(t),directory:o},t.json)}};async function Fl(e){let t=new Gt,{rootDirectory:o,appDirectory:r}=await _e(e.directory),n=Xe(o),i=X(),s=Promise.resolve(),a=[{title:"Setting up project",task:async()=>{await s}}],d=e.markets?e.markets:await eo({abortSignal:t.signal,extraChoices:{none:"Set up later"}}),m=d==="none"?void 0:d,{setupRoutes:l}=so(t),f={},p=[],y=await Kn(".."),[h,b]=await Promise.all([K(O(o,"tsconfig.json")),vt("*.d.ts",{cwd:y})]);s=s.then(()=>Promise.all([...b.map(C=>Ut(O(y,C),P(o,C))),ao({rootDirectory:o,appDirectory:r,typescript:h})])).then(async()=>{let C=await l(o,h?"ts":"js",{i18nStrategy:m,overwriteFileDeps:!0});f=C.routeGroups,p=C.routes}),m&&(s=s.then(()=>Zt(m,{rootDirectory:o})));let v=await Promise.resolve(i),{createShortcut:S,showShortcutBanner:k}=await co(t,v,e.shortcut);if(!m&&!S)return await s,{directory:o,name:n,location:n,i18n:m,routes:f,generatedRoutes:p,shortcut:!1,cliCommand:v,showSummary:!1};let x=!1;return S&&(s=s.then(async()=>{await S()&&(x=!0,v=qe)}),k()),await ne(a),{directory:o,name:n,location:n,i18n:m,routes:f,generatedRoutes:p,shortcut:x,cliCommand:v,showSummary:!0}}async function Al(e,t){let o=await Fl(e);return!j(cn,{status:"success",changed:!0,directory:P(o.directory),name:o.name,i18n:o.i18n??null,routes:o.generatedRoutes.map(({sourceRoute:r,destinationRoute:n,operation:i,skipReason:s})=>({sourceRoute:r,destinationRoute:n,operation:i,...s?{skipReason:s}:{}})),routeGroups:o.routes,shortcut:o.shortcut},t)&&o.showSummary&&await fo(o,{cliCommand:o.cliCommand,depsInstalled:!0,packageManager:"npm",i18n:o.i18n,routes:o.routes}),o}c();var ma=re(me(),1);var sr=class e extends R{static get jsonOutputSchema(){return ln}static descriptionWithMarkdown="Adds support for certain CSS strategies to your project.";static description=this.descriptionForHelp();static flags={...$,...w.path,...w.force,...ke(w.installDeps,{"install-deps":{default:!0}})};static args={strategy:ma.Args.string({name:"strategy",description:`The CSS strategy to setup. One of ${Pr.join()}`,options:Pr})};async run(){let{flags:t,args:o}=await this.parse(e),r=t.path?P(t.path):process.cwd();await Nl({...G(t),strategy:o.strategy,directory:r},t.json)}};async function _l({strategy:e,directory:t,force:o=!1,installDeps:r=!0}){let n=await we(t).catch(()=>null);if(!n)throw new g("No Vite config found. This command is only supported in Vite projects.");let{remixConfig:i}=n,s=e||await ti(),a={directory:i.rootDirectory,strategy:s,files:[],dependenciesInstalled:!1,needsNpmReinstall:!1};if(s==="css-modules"||s==="postcss")return{...a,status:"built-in"};let d=await ei(s,i,o);if(!d)return{...a,status:"cancelled"};let{workPromise:m,generatedAssets:l,needsInstallDeps:f}=d,p=[{title:"Updating files",task:async()=>{await m}}],y=!1;if(r&&f){let h=Pe(i.rootDirectory);p.push({title:"Installing new dependencies",task:async()=>{let b=await h;y=b==="npm"||b==="unknown",await Yt({directory:i.rootDirectory,packageManager:b,args:[]})}})}return await ne(p),{...a,status:"configured",files:l,dependenciesInstalled:!!(r&&f),needsNpmReinstall:!!(f&&y&&s==="tailwind")}}async function Nl(e,t){let o=await _l(e);return j(ln,{status:o.status==="cancelled"?"cancelled":"success",changed:o.status==="configured",directory:P(o.directory),strategy:o.strategy,filePaths:o.files.map(r=>P(o.directory,r)),dependenciesInstalled:o.dependenciesInstalled,needsNpmReinstall:o.needsNpmReinstall},t)||Hl(o),o}function Hl(e){let{strategy:t,files:o}=e;if(e.status!=="cancelled"){if(e.status==="built-in"){H({headline:`Vite works out of the box with ${kt[t]}.`,body:`See the Vite documentation for more information:
|
|
251
|
+
${Cr[t]}`});return}H({headline:`${kt[t]} setup complete.`,body:(o.length>0?`You can now modify CSS configuration in the following files:
|
|
252
|
+
`+o.map(r=>` - ${r}`).join(`
|
|
253
|
+
`)+`
|
|
254
|
+
`:"")+`
|
|
255
|
+
For more information, visit ${Cr[t]}`}),e.needsNpmReinstall&&te({body:[`Due to a bug in NPM, you might need to reinstall dependencies again.
|
|
256
|
+
Run`,{command:"npm install"}]})}}c();var ua=re(me(),1);var ar=class e extends R{static get jsonOutputSchema(){return dn}static descriptionWithMarkdown="Adds support for multiple [markets](https://shopify.dev/docs/custom-storefronts/hydrogen/markets) to your project by using the URL structure.";static description=this.descriptionForHelp();static flags={...$,...w.path};static args={strategy:ua.Args.string({name:"strategy",description:`The URL structure strategy to setup multiple markets. One of ${Or.join()}`,options:Or})};async run(){let{flags:t,args:o}=await this.parse(e),r=t.path?P(t.path):process.cwd();await Ml({...G(t),strategy:o.strategy,directory:r},t.json)}};async function Ll({strategy:e,directory:t}){let o=_e(t),r=e||await eo(),n=await o;return await ne([{title:"Updating files",task:async()=>{await Zt(r,n)}}]),{directory:n.rootDirectory,strategy:r,serverEntryPoint:n.serverEntryPoint&&await K(P(n.rootDirectory,n.serverEntryPoint))?n.serverEntryPoint:void 0}}async function Ml(e,t){let o=await Ll(e);return j(dn,{status:"success",changed:!0,directory:P(o.directory),strategy:o.strategy,serverPath:o.serverEntryPoint?P(o.directory,o.serverEntryPoint):null},t)||Ul(o),o}function Ul({strategy:e,serverEntryPoint:t}){H({headline:`Markets support setup complete with strategy ${oi[e].toLowerCase()}.`,body:`You can now modify the supported locales in ${t??"your server entry file."}
|
|
257
|
+
`})}c();import{createRequire as Vl}from"node:module";var cr=class e extends R{static get jsonOutputSchema(){return mn}static descriptionWithMarkdown="EXPERIMENTAL: Upgrades the project to use Vite.";static description=this.descriptionForHelp();static flags={...$,...w.path};async run(){let{flags:t}=await this.parse(e),o=t.path?P(t.path):process.cwd();await Yl({...G(t),directory:o},t.json)}},Bl=`export default {
|
|
258
|
+
plugins: {
|
|
259
|
+
tailwindcss: {},
|
|
260
|
+
autoprefixer: {},
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
`;async function Gl({directory:e}){if(ye(),await si(e))throw new g("This project already has a Vite config file.");try{Vl(O(e,"package.json")).resolve("@shopify/hydrogen/vite")}catch{throw new g("The installed Hydrogen version does not include Vite support.","Upgrade Hydrogen and install your dependencies before running `shopify hydrogen setup vite`.")}let[t,o,r]=await Promise.all([ii(e),In(O(e,"package.json")),tt(e)]),n=t.server||"server.js",i=n.endsWith(".ts"),s=i?"tsx":"jsx",a=await et("vite"),d=!!t.tailwind,m=P(e,"postcss.config.js"),l=p=>{if(p?.code!=="ENOENT")throw p},f=Promise.allSettled([Ee(P(e,"remix.config.js")).catch(l),Sr(P(e,"remix.env.d.ts"),P(e,"env.d.ts")).then(()=>Ae(P(e,"env.d.ts"),!1,p=>p.replace('types="@remix-run/dev"','types="vite/client"'))).catch(l),Sr(P(e,".eslintrc.js"),P(e,".eslintrc.cjs")).catch(l),ue(P(e,"postcss.config.js")).then(async p=>{let y=p.includes("tailwindcss"),b=p.includes("module.exports")||p.includes("exports.")||p.includes("require(")?m.replace(".js",".cjs"):m;return!y&&d&&(p=await St(p.replace(/(plugins:\s+{)/,`$1
|
|
264
|
+
tailwindcss: {},`),r,b)),oe(b,p)}).catch(async p=>{if(l(p),d&&!await K(m)&&!await K(m.replace(".js",".cjs")))return oe(m,Bl)}),Zn(a,e,{onResult(p){return p.dependencies&&delete p.dependencies["@remix-run/css-bundle"],p.devDependencies&&p.devDependencies["@vanilla-extract/css"]&&(p.devDependencies["@vanilla-extract/vite-plugin"]="^4.0.0",p.devDependencies=Object.keys(p.devDependencies).sort().reduce((y,h)=>(y[h]=p.devDependencies?.[h],y),{})),p}}),ue(P(a,"vite.config.js")).then(async p=>{o.devDependencies?.["@vanilla-extract/css"]&&(p=p.replace(/\n\n/g,`
|
|
265
|
+
import {vanillaExtractPlugin} from '@vanilla-extract/vite-plugin';
|
|
266
|
+
|
|
267
|
+
`).replace(/^(\s+)\],/m,`$1 vanillaExtractPlugin(),
|
|
268
|
+
$1],`));let{future:h,appDirectory:b,ignoredRouteFiles:v,routes:S}=t;for(let x of["v3_fetcherPersist","v3_throwAbortReason","v3_relativeSplatPath"])h?.[x]||(p=p.replace(`${x}: true`,`${x}: false`));b&&b!=="app"&&(p=p.replace(/^(\s+)(future:)/m,`$1appDirectory: '${b}',
|
|
269
|
+
$1$2`)),v&&(p=p.replace(/^(\s+)(future:)/m,`$1ignoredRouteFiles: ${JSON.stringify(v)},
|
|
270
|
+
$1$2`)),S&&(p=p.replace(/^(\s+)(future:)/m,`$1routes: ${S.toString()},
|
|
271
|
+
$1$2`));let k=P(e,"vite.config."+s.slice(0,2));return p=await St(p,r,k),oe(k,p)}),Ae(P(e,n),!1,p=>(i?`// @ts-ignore
|
|
272
|
+
`:"")+p.replace("@remix-run/dev/server-build","virtual:remix/server-build")),Xt(s).then(async p=>{let y=P(e,t.appDirectory??"app"),h=O(y,"root."+s);await new Promise(async(b,v)=>{await p.findInFiles({paths:[h,O(y,"routes")],matcher:{rule:{kind:"string_fragment",regex:"\\.css$",inside:{kind:"import_statement",stopBy:"end"}}}},async(k,x)=>{k&&v(k);let C={};x.forEach(T=>{if(T.text().endsWith(".module.css"))return;let _=T.getRoot().filename(),E=T.getRoot().root().text(),D=T.range().end.index,q=C[_]||{content:E,positions:[]};q.positions.push(D),C[_]=q}),await Promise.all(Object.entries(C).flatMap(([T,{content:_,positions:E}])=>{E.reverse();for(let D of E)_=_.slice(0,D)+"?url"+_.slice(D);return oe(T,_)})),b(null)})===0&&b(null)}),await Ae(h,r,b=>{let v=p.parse(b).root(),S="LiveReload",k={kind:"identifier",regex:S},x=v.find({rule:{kind:"import_specifier",regex:S,inside:{kind:"import_statement",stopBy:"end"}}}),C=v.findAll({rule:{any:[{kind:"jsx_self_closing_element",has:k},{kind:"jsx_element",has:{kind:"jsx_opening_element",has:k}}]}});for(let T of[...C.reverse(),x]){if(!T)continue;let{start:_,end:E}=T.range();b=b.slice(0,_.index)+b.slice(E.index)}return b.replace(/,\s*,/g,",").replace(/import\s+{\s+cssBundleHref\s+}\s+from\s+['"]@remix-run\/css-bundle['"];?\n/,"").replace(/\.\.\.\(\s*cssBundleHref[^)]+\),?/,"")})})]);return await ne([{title:"Updating files",task:async()=>{let y=(await f).find(h=>h.status==="rejected");if(y?.status==="rejected")throw y.reason}},{title:"Installing new dependencies",task:async()=>{await Yt({directory:e,packageManager:await Pe(e),args:[]})}}]),{directory:e,viteConfig:P(e,"vite.config."+s.slice(0,2)),serverEntryPoint:P(e,n),dependenciesInstalled:!0,needsMdxSetup:!!t.mdx}}async function Yl(e,t){let o=await Gl(e);return Wl(o,t),o}function ql({needsMdxSetup:e}){H({headline:"Your Vite project is ready!",body:`We've modified your project to use Vite.
|
|
273
|
+
Please use Git to review the changes.`,nextSteps:[e?"Setup MDX support in Vite: https://remix.run/docs/en/main/future/vite#add-mdx-plugin":"","See more information about Vite in Remix at https://remix.run/docs/en/main/future/vite"].filter(Boolean)})}function Wl(e,t){j(mn,{status:"success",changed:!0,directory:P(e.directory),viteConfigPath:P(e.viteConfig),serverPath:P(e.serverEntryPoint),dependenciesInstalled:e.dependenciesInstalled,needsMdxSetup:e.needsMdxSetup},t)||ql(e)}c();var lr=class e extends R{static get jsonOutputSchema(){return Br}static descriptionWithMarkdown="Creates a global h2 shortcut for Shopify CLI using shell aliases.\n\n The following shells are supported:\n\n - Bash (using `~/.bashrc`)\n - ZSH (using `~/.zshrc`)\n - Fish (using `~/.config/fish/functions`)\n - PowerShell (added to `$PROFILE`)\n\n After the alias is created, you can call Shopify CLI from anywhere in your project using `h2 <command>`.";static description=this.descriptionForHelp();static flags={...$};async run(){let{flags:t}=await this.parse(e);await Jl(t.json)}};async function Jl(e){let{shells:t,changed:o}=await hi();if(t.length>0){if(j(Br,{status:"success",changed:o,alias:qe,shells:t.map(r=>r==="CMD"?"cmd":r==="PowerShell"?"powershell":r==="PowerShell 7+"?"powershell-7":r)},e))return;H({headline:`Shortcut ready for the following shells: ${t.join(", ")}.
|
|
274
|
+
Restart your terminal session and run \`${qe}\` from your local project.`})}else throw new g("No supported shell found.","Please create a shortcut manually.")}c();var dr=class e extends R{static get jsonOutputSchema(){return Ir}static descriptionWithMarkdown="Unlinks your local development environment from a remote Hydrogen storefront.";static description=this.descriptionForHelp();static flags={...$,...w.path};async run(){let{flags:t}=await this.parse(e);await zl(t,t.json)}};async function zl(e,t){let o=await Ql(e);return j(Ir,o,t)||(o.storefront?H({body:["You are no longer linked to",{bold:o.storefront.name}]}):V("This project isn't linked to a Hydrogen storefront.")),o}async function Ql({path:e}){let t=e??process.cwd(),{storefront:o}=await ro(t);return o?(await ui(t),{status:"success",changed:!0,storefront:{gid:o.id,name:o.title}}):{status:"success",changed:!1,storefront:null}}c();import{spawnSync as Kl}from"node:child_process";var Xl=async function(e){if(!e.id?.startsWith("hydrogen:")||e.id==="hydrogen:init")return;let t=e.argv.indexOf("--");if(!((t<0?e.argv:e.argv.slice(0,t)).some(r=>["--help","-h","--json-schema"].includes(r))||yn(process.env.SHOPIFY_FLAG_JSON_SCHEMA))&&Zl(e.id)&&!process.execArgv.includes(mr)&&!(process.env.NODE_OPTIONS??"").includes(mr)){Fn(`Restarting CLI process with ${mr} flag.`);let[r,...n]=process.argv;n.unshift(mr);let i=Kl(r,n,{stdio:"inherit"});process.exit(i.status??1)}},mr="--experimental-vm-modules";function Zl(e=""){return e==="hydrogen:debug:cpu"}var pa=Xl;var RE={"hydrogen:dev":qo,"hydrogen:build":Ro,"hydrogen:check":To,"hydrogen:codegen":$o,"hydrogen:deploy":Mo,"hydrogen:g":Ko,"hydrogen:init":er,"hydrogen:link":Ci,"hydrogen:list":tr,"hydrogen:login":or,"hydrogen:logout":rr,"hydrogen:preview":nr,"hydrogen:setup":ir,"hydrogen:shortcut":lr,"hydrogen:unlink":dr,"hydrogen:upgrade":Uo,"hydrogen:customer-account-push":Di,"hydrogen:debug:cpu":Fo,"hydrogen:env:list":Wo,"hydrogen:env:pull":Jo,"hydrogen:env:push":zo,"hydrogen:generate:route":Me,"hydrogen:generate:routes":Xo,"hydrogen:setup:css":sr,"hydrogen:setup:markets":ar,"hydrogen:setup:vite":cr},TE={init:pa};export{RE as a,TE as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{s as r}from"./chunk-WDFCOZAY.js";import{b as a}from"./chunk-ZQDDRIBA.js";import{d as t}from"./chunk-Q2SZCZE7.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();var e=class extends a{static baseFlags={...a.baseFlags,...t};environmentsFilename(){return r.appEnvironments}};export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as i,h as r,o as s}from"./chunk-IWTNUJGY.js";import{g as c}from"./chunk-VKWPEFWQ.js";c();import{existsSync as l,readFileSync as u}from"fs";import{fileURLToPath as g,pathToFileURL as p}from"url";var a;function h(){if(!a){let n=i(s(import.meta.url),"..","oclif.manifest.json");a=JSON.parse(u(n,"utf8")).commands}return a}var m=new Map;function y(n){let t=m.get(n);if(!t){for(t=r(g(import.meta.resolve(n)));t!==r(t);){try{if(JSON.parse(u(i(t,"package.json"),"utf8")).name===n)break}catch(o){if(o instanceof SyntaxError){t=r(t);continue}if(o.code==="ENOENT"){t=r(t);continue}throw o}t=r(t)}m.set(n,t)}return t}var P={"demo:watcher":"dist/cli/commands/app/demo/watcher.js","kitchen-sink":"dist/cli/commands/kitchen-sink/index.js","doctor-release":"dist/cli/commands/doctor-release/doctor-release.js","doctor-release:theme":"dist/cli/commands/doctor-release/theme/index.js"};function f(n){return P[n]??`dist/cli/commands/${n.replace(/:/g,"/")}.js`}var C=new Set(["@shopify/cli","@shopify/app","@shopify/theme"]);async function D(n){let o=h()[n];if(!o)return;let e=o.customPluginName??o.pluginName;if(e)return C.has(e)?j(n,e):k(n,e)}var d=i(s(import.meta.url),"..");function w(n,t){let o=f(n),e=i(d,o);return l(e)?d:y(t)}async function j(n,t){let o=f(n),e=w(n,t);return(await import(p(i(e,o)).href)).default}async function k(n,t){if(t==="@shopify/cli-hydrogen"){let{COMMANDS:o}=await import("./dist-QNWOGQN3.js");return o?.[n]}if(t==="@oclif/plugin-commands"){let{commands:o}=await import("./lib-YEZOHXF3.js");return o[n]}if(t==="@oclif/plugin-plugins"){let{commands:o}=await import("./lib-PJHT4MKY.js");return o[n]}if(t==="@shopify/plugin-did-you-mean"){let{DidYouMeanCommands:o}=await import("./dist-4H2B7BMN.js");return o[n]}}export{D as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{d}from"./chunk-CZ22VZDA.js";import{h as _}from"./chunk-2VSNFOKD.js";import{Bb as u,Cb as E,Y as y,ca as O}from"./chunk-LWCTKI4Z.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();a();var f=class{export;input;inputBytes;output;outputBytes;logs;functionId;fuelConsumed;target;errorMessage;errorType;inputQueryVariablesMetafieldValue;inputQueryVariablesMetafieldNamespace;inputQueryVariablesMetafieldKey;constructor({export:t,input:r,inputBytes:s,output:n,outputBytes:o,logs:i,functionId:l,fuelConsumed:c,target:m,errorMessage:T,errorType:h,inputQueryVariablesMetafieldValue:S,inputQueryVariablesMetafieldNamespace:A,inputQueryVariablesMetafieldKey:g}){this.export=t,this.input=r,this.inputBytes=s,this.output=n,this.outputBytes=o,this.logs=i,this.functionId=l,this.fuelConsumed=c,this.target=m,this.errorMessage=T,this.errorType=h,this.inputQueryVariablesMetafieldValue=S,this.inputQueryVariablesMetafieldNamespace=A,this.inputQueryVariablesMetafieldKey=g}};a();function b(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function I(e,t){return t?.deep&&b(e)||t?.deep&&Array.isArray(e)?p(e,t):e}function p(e,t){if(Array.isArray(e))return e.map(r=>t?.deep?p(r,t):r);if(b(e)){let r={};for(let[s,n]of Object.entries(e))r[y(s)]=I(n,t);return r}return e}var R=450,x=5*1e3,N=60*1e3,K=5,F=1e6,D="function_run",$="function_network_access",j="function_network_access.response_from_cache",Y="function_network_access.request_execution_in_background",X="function_network_access.request_execution",H="no_cached_response",W="cached_response_about_to_expire",q=async e=>{let{errors:t}=e.response,r=R,s=null,n="not_attempted";if(t.length>0)if(u(`Errors: ${t.map(o=>o.message).join(", ")}`),t.some(o=>o.status===401))try{s=await e.onResubscribe(),n="succeeded"}catch(o){u(`Failed to resubscribe to app logs: ${o}`),r=N,n="failed",e.onThrottle(r)}else t.some(o=>o.status===429)?(r=N,e.onThrottle(r)):(r=x,e.onUnknownError(r));return{retryIntervalMs:r,nextJwtToken:s,resubscribeResult:n}},z=({appLog:e,appLogPayload:t,storeName:r,prettyPrint:s=!0})=>{let{cursor:n,...o}=e,i=p({...o,payload:t,localTime:O(e.log_timestamp),storeName:r});return t instanceof f&&(i.payload.logs=t.logs.split(`
|
|
2
|
+
`).filter(Boolean),i.payload.inputQueryVariablesMetafieldValue&&(i.payload.inputQueryVariablesMetafieldValue=C(i.payload.inputQueryVariablesMetafieldValue))),s?JSON.stringify(i,null,2):JSON.stringify(i)},Z=async(e,t,r,s)=>{let n=await e.subscribeToAppLogs(t,r);if(!n.appLogsSubscribe)throw new _("Failed to subscribe to app logs: No response received");let{jwtToken:o,success:i,errors:l}=n.appLogsSubscribe;if(u(`Token: ${o}
|
|
3
|
+
`),u(`API Key: ${t.apiKey}
|
|
4
|
+
`),l&&l.length>0){let c=l.join(", ");throw await d({stripAnsi:!1},()=>{E(`Errors subscribing to app logs: ${c}`,s),E("App log streaming is not available in this session.",s)}),new _(c)}else{if(!o)throw new _("Failed to subscribe to app logs: No response received");let c=Array.isArray(t.shopIds)?t.shopIds:[t.shopIds];u(`Subscribed to App Events for shop ID(s) ${c.join(", ")}`),i!==void 0&&u(`Success: ${i}
|
|
5
|
+
`)}return o};function v(e){try{if(typeof e=="string"){let t=JSON.parse(e);return JSON.stringify(t,null,2)}else return typeof e=="object"&&e!==null?JSON.stringify(e,null,2):void 0}catch(t){throw new Error(`Error parsing JSON: ${t}`)}}var C=e=>{try{return JSON.parse(e)}catch{return e}};a();a();export{f as a,p as b,R as c,x as d,K as e,F as f,D as g,$ as h,j as i,Y as j,X as k,H as l,W as m,q as n,z as o,Z as p,v as q};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-IQVRP7CT.js";import{g as t}from"./chunk-VKWPEFWQ.js";t();var e=async()=>a.getAllSensitiveMetadata(),i=e;export{i as a};
|