shopify 5.0.0 → 5.0.2
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 → analytics-NMMVOF4B.js} +1 -1
- package/dist/{analytics-VKKJNJ62.js → analytics-UK77WNLG.js} +1 -1
- package/dist/bootstrap.js +1 -1
- package/dist/{chunk-Q5MEFIMV.js → chunk-224UPIYS.js} +1 -1
- package/dist/{chunk-XBQDMGUN.js → chunk-26PWHH3B.js} +1 -1
- package/dist/{chunk-46MSIQ6Z.js → chunk-27NXPOAS.js} +1 -1
- package/dist/{chunk-SFPXYHHL.js → chunk-2A2JSAAA.js} +1 -1
- package/dist/{chunk-P33TONYG.js → chunk-2L6AN3QA.js} +1 -1
- package/dist/{chunk-43KLFFP7.js → chunk-2MT3LSMZ.js} +1 -1
- package/dist/{chunk-PGLWZMJU.js → chunk-2T4HDR6R.js} +1 -1
- package/dist/{chunk-5UWMXOHM.js → chunk-2WJOTJOD.js} +1 -1
- package/dist/{chunk-HIRTL45Q.js → chunk-2ZBXHCQZ.js} +1 -1
- package/dist/chunk-33ZE3DRQ.js +16 -0
- package/dist/{chunk-WFWISGLS.js → chunk-34MOWGRL.js} +1 -1
- package/dist/{chunk-AXC2MHHO.js → chunk-35XFNKNB.js} +1 -1
- package/dist/{chunk-LHKVXJPX.js → chunk-3JSKNXL7.js} +1 -1
- package/dist/{chunk-Q2SZCZE7.js → chunk-3KM5ZOW2.js} +1 -1
- package/dist/{chunk-KJQDS5HI.js → chunk-3MG4MTWQ.js} +1 -1
- package/dist/{chunk-MDRVCBDO.js → chunk-3MYDSQHF.js} +1 -1
- package/dist/{chunk-MYAIWSOO.js → chunk-3ODQKAEA.js} +1 -1
- package/dist/{chunk-6DXP7PQ7.js → chunk-3XRI3D44.js} +1 -1
- package/dist/{chunk-KGRIYAMA.js → chunk-3Z3MADXZ.js} +1 -1
- package/dist/{chunk-GB6E3ATN.js → chunk-4KECSZTL.js} +1 -1
- package/dist/{chunk-G6ZMSWEU.js → chunk-4WYKPIN3.js} +1 -1
- package/dist/{chunk-M3ACZWMR.js → chunk-5AEZJZNQ.js} +1 -1
- package/dist/chunk-5ED7SOQZ.js +20 -0
- package/dist/{chunk-FFHH5LOR.js → chunk-5IDJALJH.js} +1 -1
- package/dist/{chunk-GXORLBVN.js → chunk-62EOM3Y2.js} +1 -1
- package/dist/{chunk-EXFBZPZS.js → chunk-64G5TGFF.js} +1 -1
- package/dist/{chunk-QN3774QI.js → chunk-66TMIQMB.js} +1 -1
- package/dist/{chunk-L7MSPGDS.js → chunk-67L7FIB6.js} +1 -1
- package/dist/{chunk-7UOA4DI7.js → chunk-6ES4KRFW.js} +1 -1
- package/dist/{chunk-XMODGI45.js → chunk-74NRFUGQ.js} +1 -1
- package/dist/{chunk-YVY32DNA.js → chunk-7CCTPBCT.js} +1 -1
- package/dist/{chunk-2DID73ML.js → chunk-7GUMJ5E4.js} +1 -1
- package/dist/{chunk-IUTZIN2T.js → chunk-7NFTSBHQ.js} +1 -1
- package/dist/{chunk-TPSA4JN5.js → chunk-ACZNWIRY.js} +1 -1
- package/dist/{chunk-CCMDZX35.js → chunk-AQ6EVL73.js} +1 -1
- package/dist/{chunk-7WPUV7GY.js → chunk-AQKWPRZE.js} +1 -1
- package/dist/chunk-AUE7LM32.js +1 -0
- package/dist/{chunk-PIAD3F6M.js → chunk-AXL2VIWA.js} +1 -1
- package/dist/{chunk-CVVQQLCF.js → chunk-B2O3ANRZ.js} +1 -1
- package/dist/chunk-B3ZJGYZY.js +3 -0
- package/dist/{chunk-4SS6DXC7.js → chunk-BWN2QG6D.js} +1 -1
- package/dist/{chunk-6BNKBCCU.js → chunk-C3RFAKWR.js} +1 -1
- package/dist/{chunk-SNNZ4U2W.js → chunk-CCUQM4FX.js} +1 -1
- package/dist/{chunk-EITIW5OX.js → chunk-CGVROSPS.js} +1 -1
- package/dist/{chunk-7QUZWCJZ.js → chunk-CLUUA3HX.js} +1 -1
- package/dist/{chunk-X7HVAVSZ.js → chunk-CXI3RHPW.js} +1 -1
- package/dist/chunk-CYEEGTVZ.js +11 -0
- package/dist/{chunk-CZ22VZDA.js → chunk-D2KIGKBI.js} +108 -108
- package/dist/chunk-DBDTE3EE.js +5 -0
- package/dist/{chunk-YKS7MH3F.js → chunk-DLVB3237.js} +1 -1
- package/dist/{chunk-UZROQRLX.js → chunk-DN6X7SHW.js} +1 -1
- package/dist/{chunk-OGWPS55W.js → chunk-DZKFP6H2.js} +1 -1
- package/dist/{chunk-S67I4E7M.js → chunk-E5COIKGY.js} +1 -1
- package/dist/{chunk-CW2T7EOQ.js → chunk-E6RONHMT.js} +1 -1
- package/dist/{chunk-2CMEKSI7.js → chunk-EAZIQI2D.js} +1 -1
- package/dist/{chunk-FNLECT7B.js → chunk-EEY4FKAW.js} +1 -1
- package/dist/{chunk-YGYEM6QO.js → chunk-EKFPTBXC.js} +1 -1
- package/dist/{chunk-VW6QS7DO.js → chunk-ER6C5WS3.js} +1 -1
- package/dist/{chunk-MR2AUT7Q.js → chunk-ESFCYB46.js} +1 -1
- package/dist/{chunk-GRGFA26K.js → chunk-F3CK3EJJ.js} +1 -1
- package/dist/{chunk-M4BVLMPH.js → chunk-FEBOZ2XX.js} +1 -1
- package/dist/{chunk-5OMJFPQW.js → chunk-GNCVDN7U.js} +1 -1
- package/dist/{chunk-H4V55Y3Z.js → chunk-GQLNG537.js} +83 -83
- package/dist/{chunk-IEQ4UOH3.js → chunk-GVI3DWSB.js} +1 -1
- package/dist/{chunk-DFQ4WTET.js → chunk-GW7YIJPJ.js} +1 -1
- package/dist/{chunk-SFQEHDJY.js → chunk-H6GNKWYM.js} +1 -1
- package/dist/{chunk-5TB52UUV.js → chunk-H6GYBLVQ.js} +1 -1
- package/dist/chunk-HSKDFEXW.js +1 -0
- package/dist/{chunk-JYMDWR25.js → chunk-HTRJU4R4.js} +1 -1
- package/dist/{chunk-EMSF57ZB.js → chunk-HXZAY5OA.js} +1 -1
- package/dist/{chunk-WJSUIUBW.js → chunk-I4CEH7AK.js} +1 -1
- package/dist/{chunk-4ARCB6DT.js → chunk-I7PEEJVH.js} +1 -1
- package/dist/{chunk-CCQNP5YR.js → chunk-IHMATNOR.js} +1 -1
- package/dist/{chunk-N2RFDHRY.js → chunk-IHXGZW42.js} +1 -1
- package/dist/chunk-IJY3RJPJ.js +47 -0
- package/dist/{chunk-52FDK2LC.js → chunk-ISKQQXLZ.js} +1 -1
- package/dist/{chunk-UVRKTMF7.js → chunk-J55GQLP4.js} +1 -1
- package/dist/{chunk-3LVCG4JB.js → chunk-J5ERDFIC.js} +1 -1
- package/dist/{chunk-LWCTKI4Z.js → chunk-JLQRDFR5.js} +3 -3
- package/dist/{chunk-HCZG7YJ6.js → chunk-JPWRZ5SL.js} +1 -1
- package/dist/{chunk-BWRNXCVN.js → chunk-K7ZSPQKL.js} +1 -1
- package/dist/{chunk-4GCI2YCZ.js → chunk-KNWT7JLL.js} +1 -1
- package/dist/{chunk-U25W35TX.js → chunk-KZRLZWOU.js} +1 -1
- package/dist/chunk-L5TSPCSY.js +26 -0
- package/dist/{chunk-J6TW43TG.js → chunk-LEHBZKK3.js} +1 -1
- package/dist/chunk-LGXI7EGM.js +8 -0
- package/dist/{chunk-3A3DZVEJ.js → chunk-LHXFTFFM.js} +1 -1
- package/dist/{chunk-4RDFMBRG.js → chunk-LUGMXSRI.js} +1 -1
- package/dist/chunk-M2CWCOFU.js +11 -0
- package/dist/{chunk-2VSNFOKD.js → chunk-M5VIFG2V.js} +1 -1
- package/dist/{chunk-IWEKM5Y3.js → chunk-MADINS4Z.js} +1 -1
- package/dist/{chunk-VMMUJN4T.js → chunk-MEYVUHQH.js} +1 -1
- package/dist/{chunk-PEVIRAMR.js → chunk-MGHPF7HU.js} +1 -1
- package/dist/{chunk-ZT5WFUKJ.js → chunk-MHR5OHT5.js} +1 -1
- package/dist/{chunk-5NEGOQT6.js → chunk-MXEXP3HT.js} +1 -1
- package/dist/{chunk-IQVRP7CT.js → chunk-N57Y7THE.js} +1 -1
- package/dist/{chunk-FWB3GLMW.js → chunk-NVKJ7ZLP.js} +1 -1
- package/dist/{chunk-GQNOVEKP.js → chunk-NXAEBGMO.js} +1 -1
- package/dist/{chunk-PYIICTLX.js → chunk-OJULL7HT.js} +1 -1
- package/dist/{chunk-SL3VBI62.js → chunk-OMPQ7REW.js} +1 -1
- package/dist/{chunk-NK2MGR6A.js → chunk-OR4IJ4BQ.js} +1 -1
- package/dist/{chunk-CIK5BF7V.js → chunk-P2RMFHQP.js} +1 -1
- package/dist/{chunk-R7EMV77H.js → chunk-P4VZYOKO.js} +2 -2
- package/dist/{chunk-NDKSG4CC.js → chunk-PDZBKVWL.js} +1 -1
- package/dist/{chunk-QKVVJXWS.js → chunk-PF53E2DC.js} +1 -1
- package/dist/{chunk-XNNKLUTN.js → chunk-PLSS456F.js} +1 -1
- package/dist/{chunk-XM7YUXTF.js → chunk-PTSCGSQV.js} +2 -2
- package/dist/{chunk-KSDU4YOB.js → chunk-PWAT52M4.js} +1 -1
- package/dist/{chunk-NOH63WC6.js → chunk-Q2KWXZQB.js} +1 -1
- package/dist/{chunk-EGCWR5AS.js → chunk-Q4JYAUVL.js} +1 -1
- package/dist/{chunk-4CRBTSVP.js → chunk-Q5IC3IYY.js} +1 -1
- package/dist/{chunk-Z5SILNH2.js → chunk-QDCLL5OI.js} +1 -1
- package/dist/{chunk-VB7YQMAM.js → chunk-QEKGGTMN.js} +1 -1
- package/dist/{chunk-BJPDJIS4.js → chunk-QEVTBD33.js} +1 -1
- package/dist/{chunk-PZUGDE7N.js → chunk-QF5WKTPD.js} +1 -1
- package/dist/{chunk-7NSK77WG.js → chunk-QFSENE5T.js} +1 -1
- package/dist/{chunk-IUP7POIE.js → chunk-QQJNQNKP.js} +1 -1
- package/dist/{chunk-PSSYLJG4.js → chunk-QW52RPAU.js} +1 -1
- package/dist/{chunk-ULD7CIOY.js → chunk-R4UVIYZP.js} +1 -1
- package/dist/{chunk-M5TGCSUK.js → chunk-RLNIOJH3.js} +1 -1
- package/dist/{chunk-ZYQ2XWC5.js → chunk-RPCIFYCY.js} +1 -1
- package/dist/{chunk-C3KEDG33.js → chunk-RPVZ2JON.js} +1 -1
- package/dist/{chunk-I4OVLRQR.js → chunk-RW6G4ZPU.js} +1 -1
- package/dist/{chunk-4GOJQKY5.js → chunk-S4LOWCGS.js} +1 -1
- package/dist/{chunk-OQU3HLAE.js → chunk-S5P7KWY4.js} +1 -1
- package/dist/{chunk-UWMZ5CSB.js → chunk-SACNUF4I.js} +1 -1
- package/dist/chunk-SB27UOXX.js +1 -0
- package/dist/{chunk-YVVU4J5O.js → chunk-SHD4VV5V.js} +1 -1
- package/dist/{chunk-M7LPHCP2.js → chunk-SIL6HPMK.js} +2 -2
- package/dist/{chunk-AJMDF3QC.js → chunk-SK7EPN6C.js} +1 -1
- package/dist/{chunk-XITZIDCL.js → chunk-SLY27GDC.js} +1 -1
- package/dist/{chunk-C7V755IT.js → chunk-SNH4XZ6E.js} +1 -1
- package/dist/{chunk-POKY4RWR.js → chunk-T4XJKM6B.js} +1 -1
- package/dist/{chunk-7MVWDCI3.js → chunk-TAWCKJKP.js} +1 -1
- package/dist/{chunk-BCYTZ7LM.js → chunk-TFPW2VGN.js} +1 -1
- package/dist/{chunk-UOS2XLGG.js → chunk-TODZ3TJR.js} +1 -1
- package/dist/chunk-U2T5HPRD.js +319 -0
- package/dist/{chunk-XTREQ4A2.js → chunk-U6YOP562.js} +1 -1
- package/dist/{chunk-53BG3NLH.js → chunk-UBP3LQFY.js} +1 -1
- package/dist/{chunk-GFVKTWFT.js → chunk-UKWIWCOH.js} +1 -1
- package/dist/{chunk-GAMC2BNY.js → chunk-UPPO3BMT.js} +1 -1
- package/dist/{chunk-Q2XRITUG.js → chunk-URXM5A2K.js} +1 -1
- package/dist/chunk-USXIXANP.js +103 -0
- package/dist/{chunk-R2BDABJD.js → chunk-UUAKOX7E.js} +1 -1
- package/dist/{chunk-WGUOLSMG.js → chunk-UV5GAGAD.js} +1 -1
- package/dist/{chunk-AYL6KBPE.js → chunk-UXVXVI6O.js} +1 -1
- package/dist/{chunk-VWH3VPYI.js → chunk-UY6W2EVZ.js} +1 -1
- package/dist/{chunk-BVSKBX7T.js → chunk-UYELAINQ.js} +1 -1
- package/dist/{chunk-KDPQXURV.js → chunk-VAVXDIUX.js} +1 -1
- package/dist/{chunk-OX7UVDSU.js → chunk-VEUKT5EI.js} +1 -1
- package/dist/chunk-VGSH52JM.js +1 -0
- package/dist/chunk-VHZ6RL67.js +1 -0
- package/dist/{chunk-UK6576EO.js → chunk-VQA3X7O3.js} +1 -1
- package/dist/{chunk-TTEF7GTX.js → chunk-VZCMJRYV.js} +1 -1
- package/dist/{chunk-3G4HJO72.js → chunk-W37IFK3P.js} +1 -1
- package/dist/{chunk-LMQGNECW.js → chunk-W56ZGEQQ.js} +1 -1
- package/dist/{chunk-GCNA3HXH.js → chunk-WBVS5NBV.js} +1 -1
- package/dist/{chunk-XKRJKUA7.js → chunk-WCC52MR2.js} +1 -1
- package/dist/{chunk-LDU5T3DN.js → chunk-WESTVWWD.js} +1 -1
- package/dist/{chunk-24NUJTIH.js → chunk-WRZWHT6M.js} +1 -1
- package/dist/{chunk-4TI7U2PN.js → chunk-WSDKCQH6.js} +1 -1
- package/dist/{chunk-UIQL5ZF3.js → chunk-X2PFXSU4.js} +1 -1
- package/dist/{chunk-NB4BRW3H.js → chunk-X5NIAZA4.js} +1 -1
- package/dist/{chunk-RFGEM5JC.js → chunk-XBMD3FEZ.js} +1 -1
- package/dist/{chunk-I6FRVYGE.js → chunk-XDVPIGXE.js} +1 -1
- package/dist/chunk-XLIJYJ6Q.js +1 -0
- package/dist/chunk-XUHGWIWW.js +4 -0
- package/dist/{chunk-2ORRV7GH.js → chunk-XWSWXQCC.js} +1 -1
- package/dist/{chunk-Q66CI37F.js → chunk-Y55T4IIQ.js} +1 -1
- package/dist/{chunk-WMAFG2JD.js → chunk-Y5CVX5LJ.js} +1 -1
- package/dist/{chunk-VHUD3CBC.js → chunk-Y6J46XYF.js} +1 -1
- package/dist/{chunk-DJAZBPYA.js → chunk-YKMINHYY.js} +1 -1
- package/dist/{chunk-KKPOOIE4.js → chunk-YSWVYPWR.js} +1 -1
- package/dist/{chunk-D7NB7YR6.js → chunk-YV2TP44L.js} +1 -1
- package/dist/{chunk-7IFE4UQY.js → chunk-Z2WAW6MM.js} +1 -1
- package/dist/chunk-ZBL7XMJ6.js +25 -0
- package/dist/{chunk-YTUDXZLN.js → chunk-ZGBTO46A.js} +1 -1
- package/dist/{chunk-ZQDDRIBA.js → chunk-ZJOX5HW4.js} +4 -4
- package/dist/{chunk-MXJAH2GW.js → chunk-ZOOT3GBY.js} +1 -1
- package/dist/{chunk-ZAA2DXK5.js → chunk-ZRI3SSLG.js} +1 -1
- package/dist/cli/commands/app/build.js +1 -1
- package/dist/cli/commands/app/bulk/cancel.js +1 -1
- package/dist/cli/commands/app/bulk/execute.js +1 -1
- package/dist/cli/commands/app/bulk/status.js +1 -1
- package/dist/cli/commands/app/config/link.js +1 -1
- package/dist/cli/commands/app/config/pull.js +1 -1
- package/dist/cli/commands/app/config/use.js +1 -1
- package/dist/cli/commands/app/config/validate.js +1 -1
- package/dist/cli/commands/app/demo/watcher.js +1 -1
- package/dist/cli/commands/app/deploy.js +1 -1
- package/dist/cli/commands/app/dev/clean.js +1 -1
- package/dist/cli/commands/app/dev.js +1 -1
- package/dist/cli/commands/app/env/pull.js +1 -1
- package/dist/cli/commands/app/env/show.js +1 -1
- package/dist/cli/commands/app/execute.js +1 -1
- package/dist/cli/commands/app/function/build.js +1 -1
- package/dist/cli/commands/app/function/info.js +1 -1
- package/dist/cli/commands/app/function/replay.js +1 -1
- package/dist/cli/commands/app/function/run.js +1 -1
- package/dist/cli/commands/app/function/schema.js +1 -1
- package/dist/cli/commands/app/function/typegen.js +1 -1
- package/dist/cli/commands/app/generate/extension.js +1 -1
- package/dist/cli/commands/app/graphiql.js +1 -1
- package/dist/cli/commands/app/import/channel-config.js +1 -1
- package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
- package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
- package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
- package/dist/cli/commands/app/import-extensions.js +1 -1
- package/dist/cli/commands/app/info.js +1 -1
- package/dist/cli/commands/app/init.js +1 -1
- package/dist/cli/commands/app/logs.js +1 -1
- package/dist/cli/commands/app/release.js +1 -1
- package/dist/cli/commands/app/security/check.js +1 -1
- package/dist/cli/commands/app/security/clean.js +1 -1
- package/dist/cli/commands/app/security/instructions.js +1 -1
- package/dist/cli/commands/app/security/record.js +1 -1
- package/dist/cli/commands/app/security/review.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
- package/dist/cli/commands/app/versions/list.js +1 -1
- package/dist/cli/commands/app/webhook/trigger.js +1 -1
- package/dist/cli/commands/auth/login.js +1 -1
- package/dist/cli/commands/auth/logout.js +1 -1
- package/dist/cli/commands/cache/clear.js +1 -1
- package/dist/cli/commands/config/autoupgrade/off.js +1 -1
- package/dist/cli/commands/config/autoupgrade/on.js +1 -1
- package/dist/cli/commands/config/autoupgrade/status.js +1 -1
- package/dist/cli/commands/debug/command-flags.js +1 -1
- package/dist/cli/commands/doc/fetch.js +1 -1
- package/dist/cli/commands/doc/search.js +1 -1
- package/dist/cli/commands/docs/generate.js +1 -1
- package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
- package/dist/cli/commands/doctor-release/theme/index.js +1 -1
- package/dist/cli/commands/help.js +1 -1
- package/dist/cli/commands/kitchen-sink/async.js +1 -1
- package/dist/cli/commands/kitchen-sink/index.js +1 -1
- package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
- package/dist/cli/commands/kitchen-sink/static.js +1 -1
- package/dist/cli/commands/notifications/generate.js +1 -1
- package/dist/cli/commands/notifications/list.js +1 -1
- package/dist/cli/commands/organization/list.js +1 -1
- package/dist/cli/commands/search.js +1 -1
- package/dist/cli/commands/send-analytics.js +1 -1
- package/dist/cli/commands/theme/check.js +1 -1
- package/dist/cli/commands/theme/console.js +1 -1
- package/dist/cli/commands/theme/delete.js +1 -1
- package/dist/cli/commands/theme/dev.js +1 -1
- package/dist/cli/commands/theme/duplicate.js +1 -1
- package/dist/cli/commands/theme/info.js +1 -1
- package/dist/cli/commands/theme/init.js +1 -1
- package/dist/cli/commands/theme/language-server.js +1 -1
- package/dist/cli/commands/theme/list.js +1 -1
- package/dist/cli/commands/theme/metafields/pull.js +1 -1
- package/dist/cli/commands/theme/open.js +1 -1
- package/dist/cli/commands/theme/package.js +1 -1
- package/dist/cli/commands/theme/preview.js +1 -1
- package/dist/cli/commands/theme/profile.js +1 -1
- package/dist/cli/commands/theme/publish.js +1 -1
- package/dist/cli/commands/theme/pull.js +1 -1
- package/dist/cli/commands/theme/push.js +1 -1
- package/dist/cli/commands/theme/rename.js +1 -1
- package/dist/cli/commands/theme/share.js +1 -1
- package/dist/cli/commands/upgrade.js +1 -1
- package/dist/cli/commands/version.js +1 -1
- package/dist/cli/help.js +1 -1
- package/dist/{command-json-schema-2UMKY7MY.js → command-json-schema-F5XF7XHL.js} +1 -1
- package/dist/command-registry.js +1 -1
- package/dist/{conf-store-RI3TL6I4.js → conf-store-5CBLWTOC.js} +1 -1
- package/dist/{custom-oclif-loader-IZCKN67O.js → custom-oclif-loader-UDVUFKMD.js} +1 -1
- package/dist/{deprecations-IFVUXXDB.js → deprecations-EOHPSTCS.js} +1 -1
- package/dist/dist-RNV3GFZ7.js +1 -0
- package/dist/dist-ZFKWJVNB.js +1 -0
- package/dist/{environments-CYMEN7NV.js → environments-4FLRZW4P.js} +1 -1
- package/dist/{error-IL6WQMSW.js → error-JY2ADS6S.js} +1 -1
- package/dist/{error-handler-74HKA23T.js → error-handler-4GCXKC6I.js} +1 -1
- package/dist/{fs-AINFLJ2E.js → fs-XS5YF34R.js} +1 -1
- package/dist/hooks/did-you-mean.js +1 -1
- package/dist/hooks/hydrogen-init.js +1 -1
- package/dist/hooks/postrun.js +1 -1
- package/dist/hooks/prerun.js +1 -1
- package/dist/hooks/public-metadata.js +1 -1
- package/dist/hooks/sensitive-metadata.js +1 -1
- package/dist/hooks/tunnel-provider.js +1 -1
- package/dist/hooks/tunnel-start.js +1 -1
- package/dist/index.js +12 -12
- package/dist/{is-global-2VLKV46Q.js → is-global-27MUENOK.js} +1 -1
- package/dist/{json-error-HZB5YIHV.js → json-error-S5XFS3UX.js} +1 -1
- package/dist/{local-KOZETREJ.js → local-OKPVB4NH.js} +1 -1
- package/dist/{metadata-IBPHZB7N.js → metadata-2YJBAKR7.js} +1 -1
- package/dist/{node-package-manager-DXSRNEDC.js → node-package-manager-B3OW3PFQ.js} +1 -1
- package/dist/{notifications-system-XA3EBOGJ.js → notifications-system-BWTDYBG2.js} +1 -1
- package/dist/{os-X73O7BAB.js → os-F6QKJCFW.js} +1 -1
- package/dist/{output-3OYXK3Z5.js → output-BRIPK7UC.js} +1 -1
- package/dist/{system-JWYYT4PM.js → system-466QKFDI.js} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{ui-PCG5D6RZ.js → ui-VJTNGCS6.js} +1 -1
- package/dist/{upgrade-7U2TUNC4.js → upgrade-VHVJLXKX.js} +1 -1
- package/dist/{version-7DGU2KYH.js → version-FETZRLZO.js} +1 -1
- package/dist/version-T4XXTJMB.js +1 -0
- package/dist/{workerd-MQZ3NKJI.js → workerd-32DMKLMN.js} +1 -1
- package/oclif.manifest.json +6 -3
- package/package.json +7 -7
- package/dist/chunk-3C6VLJ5D.js +0 -319
- package/dist/chunk-4C2DAX5T.js +0 -1
- package/dist/chunk-7LAKWAKX.js +0 -25
- package/dist/chunk-7RPFJZLP.js +0 -1
- package/dist/chunk-CEIJKJOF.js +0 -11
- package/dist/chunk-DNMXVMJM.js +0 -47
- package/dist/chunk-FDXHQZTO.js +0 -26
- package/dist/chunk-JDR6UVZA.js +0 -8
- package/dist/chunk-JEA3C7ON.js +0 -3
- package/dist/chunk-JOJV5E2K.js +0 -1
- package/dist/chunk-LVLAOBJM.js +0 -103
- package/dist/chunk-OQ5CLM2H.js +0 -4
- package/dist/chunk-OVWUGAEU.js +0 -11
- package/dist/chunk-PMHP57MH.js +0 -20
- package/dist/chunk-RVQV6G5M.js +0 -1
- package/dist/chunk-T2IUXXCT.js +0 -1
- package/dist/chunk-WDFCOZAY.js +0 -16
- package/dist/chunk-X2H6I2WW.js +0 -5
- package/dist/chunk-ZGV3HNEV.js +0 -1
- package/dist/dist-4H2B7BMN.js +0 -1
- package/dist/dist-QNWOGQN3.js +0 -1
- package/dist/version-SXQTRBXB.js +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{a as Xt}from"./chunk-UOHNRH6E.js";import{b as Qr}from"./chunk-PF53E2DC.js";import{a as Xr}from"./chunk-DLVB3237.js";import{a as Zr}from"./chunk-AQKWPRZE.js";import{a as eo}from"./chunk-UBP3LQFY.js";import{a as Wr}from"./chunk-UXVXVI6O.js";import{a as qr,b as Hr,c as jr,d as Gr}from"./chunk-OJULL7HT.js";import{a as Yr}from"./chunk-OMPQ7REW.js";import{a as Br}from"./chunk-KNWT7JLL.js";import{a as Kr}from"./chunk-QDCLL5OI.js";import{a as Jr}from"./chunk-2ZBXHCQZ.js";import{a as Vr}from"./chunk-RPCIFYCY.js";import{a as zr}from"./chunk-AQ6EVL73.js";import{a as Ar}from"./chunk-5ED7SOQZ.js";import{a as Cr}from"./chunk-MXEXP3HT.js";import{a as Lr}from"./chunk-2WJOTJOD.js";import{a as Fr}from"./chunk-FEBOZ2XX.js";import{g as kr}from"./chunk-USXIXANP.js";import{a as dt}from"./chunk-TFPW2VGN.js";import{c as ut,o as ft}from"./chunk-IJY3RJPJ.js";import{a as Dr}from"./chunk-XBMD3FEZ.js";import{a as Mr}from"./chunk-2A2JSAAA.js";import{a as _r}from"./chunk-IHXGZW42.js";import{b as Tr,g as Oe,j as pt,u as Ir}from"./chunk-H6GYBLVQ.js";import{a as Nr}from"./chunk-WBVS5NBV.js";import{a as Fo,b as Do,c as Mo,d as Oo}from"./chunk-KZRLZWOU.js";import{d as Or}from"./chunk-SACNUF4I.js";import{a as Ur,b as Rr,c as Lo,d as ko,e as gt,f as $o,g as No}from"./chunk-W37IFK3P.js";import{a as M,b as lt}from"./chunk-H6GNKWYM.js";import{a as vr,b as Pr,d as De,f as Er,m as Me,n as K,s as G,u as xr,v as Sr,w as br}from"./chunk-Q7BOSHWX.js";import{a as yr}from"./chunk-P4VZYOKO.js";import{a as Wo,b as qo,c as Ho,d as wt,e as jo,f as Go,g as Bo,h as Ko,i as Vo,j as zo,k as Yo,l as Jo,m as Qo,n as Xo,o as Zo,p as yt}from"./chunk-ZOOT3GBY.js";import{a as Uo,b as ht,c as ne,d as Ro}from"./chunk-MGHPF7HU.js";import{a as Ao,b as To,c as Io,d as _o,e as Co}from"./chunk-HXZAY5OA.js";import{a as ro}from"./chunk-7CCTPBCT.js";import{a as bo}from"./chunk-J55GQLP4.js";import{a as So}from"./chunk-VHZ6RL67.js";import{a as to}from"./chunk-NVKJ7ZLP.js";import{Aa as qe,L as mo,Ma as xo,N as ho,P as oe,Z as go,_ as Po,i as oo,ia as Eo,j as B,k as no,n as ao,p as fs,t as mt,u as io,v as co,w as lo,x as po,y as uo,z as fo,za as We}from"./chunk-U2T5HPRD.js";import{E as so,ea as wo,fa as Ne,ga as yo,s as re,ta as vo,x as fe}from"./chunk-33ZE3DRQ.js";import{a as $r}from"./chunk-YV2TP44L.js";import{d as hr}from"./chunk-TODZ3TJR.js";import{a as z}from"./chunk-N57Y7THE.js";import{M as zt,_ as ee,aa as Yt,c as jt,h as Gt,j as Bt,m as Kt,o as Vt,p as Re,ta as Jt,u as Ae}from"./chunk-GQLNG537.js";import{b as gr,c as wr,e as Fe}from"./chunk-3KM5ZOW2.js";import{B as ue,I as Le,M as cr,O as ke,T as $e,U as de,V as ct,W as pr,Y as ur,a as Ht,d as D,e as Te,f as st,g as F,h as W,j as Ie,k as _e,l as Zt,m as er,n as tr,o as rr,p as or,q as nr,r as at,s as it,t as sr,u as ar,w as ir,z as Ce}from"./chunk-D2KIGKBI.js";import{b as pe,d as be,j as Ue,m as qt}from"./chunk-335BUVBP.js";import{a as we}from"./chunk-BN7ZXAZJ.js";import{a as ds}from"./chunk-7UNQOKZW.js";import{d as Qt}from"./chunk-CXI3RHPW.js";import{h as I,j as lr,k as te}from"./chunk-M5VIFG2V.js";import{a as He}from"./chunk-5IDJALJH.js";import{Aa as Dt,Ba as Mt,Bb as y,Cb as L,Da as Ot,Hb as mr,Ma as Se,P as rt,Sa as N,Va as le,_a as Nt,bb as Wt,la as k,qb as R,sb as T,ta as xe,va as Z,xa as ot,ya as Ft,yb as V}from"./chunk-JLQRDFR5.js";import{b as A,c as ie,d as ce,j as nt}from"./chunk-FZCGRIOM.js";import{e as dr,g as fr}from"./chunk-LHXFTFFM.js";import{b as us}from"./chunk-YTUUU33R.js";import{a as ye}from"./chunk-JD5P5RAJ.js";import{c as U,e as tt,f as Lt,h as ve,i as Pe,j as Ee,n as kt,o as $t}from"./chunk-IWTNUJGY.js";import{e as X,g as u}from"./chunk-VKWPEFWQ.js";u();u();u();u();u();u();var ms=300*1e3,hs='The host theme could not be created to host your theme app extension. Please try again or use the "--theme" flag to use an existing theme as the host theme.';async function en(t,e,r=Date.now()){for(;await gs(t,e,r););}async function gs(t,e,r){let o=await Oe(t,e);if(!o||ws(o,r))throw new I(hs);return await de(3),o.processing}function ws(t,e){return t.processing&&Date.now()-e>=ms}var ys="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",vs="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",vt=3,je=class extends _r{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=qr(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??=this.devPreview?await this.createHostTheme():await this.create(),e}setTheme(e){Hr(this.adminSession.storeFqdn,e)}removeTheme(){jr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:Tr,name:this.generateThemeName(this.context),src:ys};for(let o=0;o<vt;o++){y(`Attempt ${o}/${vt}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await pt(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),y(`Waiting for theme with id "${n.id}" to be processed`),await en(n.id,this.adminSession),n;throw new Error}catch(n){if(n instanceof lr||Ir(n))throw n;y(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}y(`Theme creation failed after ${vt} retries. Creating theme using fallback theme zip`);let r=await pt({...e,src:vs},this.adminSession);if(!r)throw y("Theme creation failed. Exiting process."),new te(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};u();var Ps={"theme:init":Nr,"theme:check":Ar,"theme:console":Cr,"theme:delete":Lr,"theme:dev":Fr,"theme:duplicate":Dr,"theme:info":Mr,"theme:language-server":Wr,"theme:list":Gr,"theme:metafields:pull":Yr,"theme:open":Br,"theme:package":Kr,"theme:profile":Vr,"theme:publish":zr,"theme:preview":Jr,"theme:pull":Qr,"theme:push":Xr,"theme:rename":Zr,"theme:share":eo},Li=Ps;async function tn(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(E=>E.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[c,f]=await Promise.all([zt(t.storeFqdn),Ss(e)]),l=c.storeFqdn,[p,h]=await Promise.all([ft(c),ut(c)]),g=h?await dt(t.storePassword,l,p):void 0,d=await xs(c,t.theme),m=d.id.toString();return Ce({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:f}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${l}/admin/themes/${m}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:Es,options:{theme:d,adminSession:c,storefrontPassword:g,crawlerSignatureHeaders:p,themeExtensionDirectory:a,themeExtensionPort:i}}}var Es=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await kr(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function xs(t,e){let r;if(e)y(`Fetching theme with provided id ${e}`),r=await Oe(parseInt(e,10),t);else{let o=new je(t,{devPreview:!0});await Le([{title:"Configuring host theme for theme app extension",task:async()=>{y("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new I("Could not find or create a host theme for theme app extensions");return r}async function Ss(t){return t.developerPlatformClient?.clientName===vo.AppManagement?`https://${await Re()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Vt()}/${t.organizationId}/apps/${t.id}/test`}u();u();u();u();u();u();async function bs(t){let e=U(t.directory,"locales");return le([U(e,"*.json")])}async function rn(t,e){let r=await bs(t);if(!r.length)return{localization:void 0,status:""};let o=e.currentLocalizationPayload??{defaultLocale:"en",translations:{},lastUpdated:0},n="success";try{await Promise.all(r.map(async s=>{let[a,...i]=s.split("/").pop().split(".");if(a)return i[0]==="default"&&(o.defaultLocale=a),Us(a,s,o,t,e)})),o.lastUpdated=Date.now(),y(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function Us(t,e,r,o,n){let s;try{s=await k(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw L(i,n.stderr),new Error(i)}}u();function Ge(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}var Pt=".js.map";async function se(t,e,r,o){return D({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await rn(t,r),c=await no(t),f=t.outputRelativePath?ve(n):n,l=await Rs(t,s,f,o),p=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(p=on(t.configuration.metafields)),{assets:{main:me(l)&&l[0]?.assets?.main?l[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await Se(n)??0}},supportedFeatures:{runsOffline:t.configuration.supported_features?.runs_offline??!1},capabilities:{blockProgress:t.configuration.capabilities?.block_progress??!1,networkAccess:t.configuration.capabilities?.network_access??!1,apiAccess:t.configuration.capabilities?.api_access??!1,collectBuyerConsent:{smsMarketing:t.configuration.capabilities?.collect_buyer_consent?.sms_marketing??!1,customerPrivacy:t.configuration.capabilities?.collect_buyer_consent?.customer_privacy??!1},iframe:{sources:t.configuration.capabilities?.iframe?.sources??[]}},development:{...r.currentDevelopmentPayload,resource:Ge(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:l,localization:a??null,metafields:p,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:c?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function Rs(t,e,r,o){let n=t.configuration,s=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(s=[{target:"purchase.post.render"}]),me(s)){let a=await As(r);return Promise.all(s.map(async i=>{let{target:c,resource:f}=i,l="metafields"in i?on(i.metafields??[]):void 0,p={...i,...l?{metafields:l}:{},surface:qe(c),root:{url:`${e}/${c}`},resource:f||{url:""}},h=a?.[c];if(!h)return p;let d=await ks(h,{target:c,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...p,...d}}))}return s}async function As(t){try{let e=U(t,"manifest.json"),r=await k(e);return JSON.parse(r)}catch(e){if(e instanceof SyntaxError)throw new Error(`Invalid manifest.json in ${t}: ${e.message}`);return null}}async function Ts({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,c=e[s];if(typeof c=="string"){let g=await Be(s,i,typeof a=="string"?a:c,r,o,n,typeof a=="string"?c:void 0);return{assets:{[g.name]:g}}}let l=e.build_manifest?.assets?.[s];if(l?.filepath){let p=await Be(s,i,l.filepath,r,o,n,l.module);return{assets:{[p.name]:p}}}return{}}async function Is({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await Se(U(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function _s({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,c)=>{let f=i.schema,l=s[c]?.schema,p=typeof l=="string"?l:f,h=typeof l=="string"?f:void 0;return{...i,schema:await Be("schema",`${t}/intents/${c}/schema`,p,r,o,n,h)}}))}:{}}async function Cs({target:t,url:e,extension:r,resolver:o},n,s){let a=await Be(n,`${t}/${n}`,s,e,r,o);return await Ls(t,s,r,o),{assets:{[a.name]:a}}}async function Ls(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(Pt)&&await N(U(r.directory,n))&&o.set(`${t}/${Pe(n)}`,n)}async function ks(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return $s(o,n)?_s(e,n):Fs(o,n)?Cs(e,o,n):Ds(o,n)?Is(e,o,n):Ts(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function on(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function me(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Be(t,e,r,o,n,s,a){let i=`${e}${Ee(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await Se(U(n.directory,a??r))??0}}function $s(t,e){return t==="intents"&&Array.isArray(e)}function Fs(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function Ds(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as Ms}from"events";var he;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(he||(he={}));async function nn(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:Lo(t.storeFqdn,t.apiKey),mobileUrl:$o(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>se(n,e,t,r&&Et(r,n.devUUID))))}}function Et(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var Ke=class extends Ms{options;rawPayload;assetResolvers;constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=ee(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(me(n.extensionPoints)&&me(o.extensionPoints)){let s=n.extensionPoints.reduce((c,f)=>({...c,[f.target]:f}),{});o.extensionPoints=ee(o.extensionPoints,n.extensionPoints,c=>c.map(f=>{let l=s[f.target];return l?ee(f,l,(p,h)=>h):f}));let{extensionPoints:a,...i}=n;return ee(o,i)}return ee(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){y(T`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await se(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},Et(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await se(e,r,this.options,Et(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(he.Update,e)}};u();u();var Y;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(Y||(Y={}));function sn(t,e){return(r,o,n)=>{r.url==="/extensions"&&(y("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,Os(t,e)))}}function Os(t,e){return r=>{y("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};y(T`Sending connected payload: ${R.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",js(t,e))}}function Ns(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?R.json(o).output():String(o)).join(" ");return T`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var Ws={debug:t=>R.gray(t),warn:t=>R.yellow(t),error:t=>R.errorText(t)};function qs({type:t,message:e}){let r=Ns(e);switch(t){case"debug":case"warn":case"error":return T`${Ws[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function Hs(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(qs(t))})}function js(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(y(T`Received websocket message with event type ${n} and data:
|
|
2
|
+
${R.json(s)}
|
|
3
|
+
`,e.stdout),n===Y.Update){let a=e.payloadStore.getRawPayload().app.apiKey,i=s.app?.apiKey;if(s.app){if(a!==i)return;e.payloadStore.updateApp(s.app)}s.extensions&&e.payloadStore.updateExtensions(s.extensions)}else if(n===Y.Dispatch){let a=Gs(o,e);cn(t,a,e)}else n===Y.Log&&Hs(s,e)}}function an(t,e){return r=>{let o={event:Y.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};y(T`Sending websocket update event to the websocket clients:
|
|
4
|
+
${R.json(o)}
|
|
5
|
+
`,e.stdout),cn(t,o,e)}}function cn(t,e,r){y(T`Sending websocket with event type ${e.event} and data:
|
|
6
|
+
${R.json(e.data)}
|
|
7
|
+
`,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function Gs(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var Bs=10;function ln(t){let e=new Xt.default({noServer:!0,clientTracking:!0}),r=Ks(e);return t.httpServer.on("upgrade",sn(e,t)),t.payloadStore.on(he.Update,an(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function Ks(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},Bs*1e3)}u();u();u();function pn(t,e){let{url:r}=Ge(t.type,e);if(t.surface==="checkout"&&r){let o=new URL(`https://${e.storeFqdn}/`);return o.pathname=r,o.searchParams.append("dev",`${e.url}/extensions`),o.toString()}else{let o=new URL(`https://${e.storeFqdn}/`);return o.pathname="admin/extensions-dev",o.searchParams.append("url",Ve(t,e)),o.toString()}}function un(t,e,r){let o=qe(t),n=new URL(`https://${r.storeFqdn}/`);switch(o){case"checkout":n.pathname=r.checkoutCartUrl,n.searchParams.append("dev",`${r.url}/extensions`);break;case"post_purchase":if(n.pathname=r.checkoutCartUrl,n.searchParams.set("script_url",`${r.url}/extensions/${e.devUUID}/assets/${e.localIdentifier}.js`),n.searchParams.set("post_purchase_dev_api_key",r.apiKey),e.devUUID&&r.websocketURL&&(n.searchParams.set("uuid",e.devUUID),n.searchParams.set("socket_url",r.websocketURL)),"metafields"in e.configuration){let s={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(s))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",Ve(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=Vs(e,r,t);break;default:return}return n.toString()}function Vs(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,s="shopify.com",a=new URL(`https://${s}/${n}/account/extensions-development`);return a.searchParams.append("origin",o),a.searchParams.append("extensionId",t.devUUID),a.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),a.searchParams.append("appId",e.id??""),r!==""&&a.searchParams.append("target",r),a}function Ve(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function q(t,e){Pr(t,vr(e))}u();var xt=class extends te{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function dn(t){let e=await zs(t),r=await k(e);return yr(r,t.data)}async function zs(t){let e=await Ys(),r=[];t.extensionSurface&&r.push(U(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(U(e,`${t.template}.html.liquid`));let o=await le(r);if(o.length===0)throw new xt(t);return o[0]}async function Ys(){return await Nt("templates/ui-extensions/html",{type:"directory",cwd:$t(import.meta.url)})}var fn=G(t=>{K(t,"Access-Control-Allow-Origin","*"),K(t,"Access-Control-Allow-Methods","GET, OPTIONS"),K(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),mn=G(t=>{K(t,"Cache-Control","no-cache")}),St=G(async t=>Me(t,"/extensions",307));async function Js(t,e){let{filePath:r}=e;if(!await N(r))return q(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Ot(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await N(r)))return q(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await k(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".map":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},s=Ee(r),a=n[s]||"text/plain";return K(t,"Content-Type",a),o}function hn({getExtensions:t,payloadStore:e}){return G(async r=>{let{extensionId:o,assetPath:n=""}=De(r),s=t().find(h=>h.devUUID===o);if(!s)return q(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n),c=i??n,f=c.endsWith(Pt);if(f&&i===void 0)return q(r,{statusCode:404,statusMessage:"Not Found"});let l=tt(f?s.directory:ao(s.outputPath)),p=tt(U(l,c));return kt(l,p)?Js(r,{filePath:p}):q(r,{statusCode:404,statusMessage:"Not Found"})})}function bt({payloadStore:t}){return G(e=>(K(e,"content-type","application/json"),t.getRawPayload()))}function gn({devOptions:t}){return G(e=>{y(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function Ut({devOptions:t,getExtensions:e}){return G(async r=>{let{extensionId:o}=De(r),n=e().find(i=>i.devUUID===o);if(!n)return q(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(Er(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return dn({data:{url:Ve(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=pn(n,t);return Me(r,i,307)}}let a=t.appWatcher.buildOutputPath;return K(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:ae(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await se(n,a,t)}})}function wn({devOptions:t,getExtensions:e}){return G(async r=>{let{extensionId:o,extensionPointTarget:n=""}=De(r),s=e().find(i=>i.devUUID===o);if(!s)return q(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return q(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=un(n,s,t);return a?Me(r,a,307):q(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as Qs}from"http";function yn(t){let e=xr(),r=Sr();e.use(gn(t)),e.use(fn),e.use(mn),r.use("/extensions/dev-console",St),r.use("/extensions/:extensionId",Ut(t)),r.use("/extensions/:extensionId/",Ut(t)),r.use("/extensions/:extensionId/:extensionPointTarget",wn(t)),r.use("/extensions/:extensionId/assets/**:assetPath",hn(t)),r.use("/extensions",bt(t)),r.use("/extensions/",bt(t)),r.use("/",St),e.use(r);let o=Qs(br(e));return o.listen(t.devOptions.port,"localhost"),o}async function vn(t){let e={...t,websocketURL:ae(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await nn(e,r,o),s=new Ke(n,e,o),a=e.extensions.filter(p=>p.isPreviewable),i=()=>a;y("Setting up the UI extensions HTTP server...",e.stdout);let c=yn({devOptions:e,payloadStore:s,getExtensions:i});y("Setting up the UI extensions Websocket server...",e.stdout);let f=ln({...e,httpServer:c,payloadStore:s});y("Setting up the UI extensions bundler and file watching...",e.stdout);let l=async({appWasReloaded:p,app:h,extensionEvents:g})=>{p&&(a=h.allExtensions.filter(d=>d.isPreviewable));for(let d of g){if(!d.extension.isPreviewable)continue;let m=d.buildResult?.status==="ok"?"success":"error",E=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case ne.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl){let S=await We(e.extensions,e.storeFqdn);e.checkoutCartUrl=S}await s.addExtension(d.extension,r);break;case ne.Updated:await s.updateExtension(d.extension,e,r,{status:m,error:E});break;case ne.Deleted:e.extensions=e.extensions.filter(S=>S.devUUID!==d.extension.devUUID),await s.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(l).onStart(l),e.signal.addEventListener("abort",()=>{y("Closing the UI extensions dev server..."),f.close(),c.close()})}function ae(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var Xs="3",Zs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:c,proxyUrl:f,appName:l,appDotEnvFile:p,appId:h,grantedScopes:g,allExtensions:d,appDirectory:m,appWatcher:E})=>{await vn({appName:l,appDotEnvFile:p,appDirectory:m,id:h,extensions:d,stdout:e,stderr:t,signal:r,url:f,port:i,storeFqdn:Ae(n),storeId:s,apiKey:o,grantedScopes:g,checkoutCartUrl:c,subscriptionProductUrl:a,manifestVersion:Xs,appWatcher:E})};async function Pn({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await We(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:Zs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}u();u();function J(t){let e=t.find(o=>oe(o,B.Frontend)),r=t.find(o=>oe(o,B.Backend));return{frontendConfig:e,backendConfig:r}}u();async function En(t){let r={topic:"app/uninstalled",api_version:(await Fo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:Oo.LOCALHOST,shared_secret:t.sharedSecret},o=await Do(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await de(3);let n=await ea(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function ea(t,e){let r=0;for(;r<3;){try{return await Mo(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof Gt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await de(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var ta=async({stdout:t},e)=>{await En({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function xn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=J(t),c=t.map(({configuration:l})=>l.webhooks_path).find(l=>l)??"/api/webhooks";if(c&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:ta,options:{deliveryPort:a?r:o,webhooksPath:c,organizationId:n,...s}}}u();async function Sn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:ra}}var ra=async({stdout:t,abortSignal:e},r)=>{let o=No({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=Rr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",()=>{n.close()})};u();async function Un({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=J(t),c=i?.configuration.hmr_server?await M():void 0,f=void 0,l=t.map(async p=>{let h=await oa({web:p,frontendPort:r,backendPort:o}),g=c&&p.configuration.roles.includes(B.Frontend)?{port:c,httpPaths:p.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:p.configuration.name??["web",...p.configuration.roles].join("-"),function:na,options:{port:h,portFromConfig:p.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:p.directory,devCommand:p.configuration.commands.dev,preDevCommand:p.configuration.commands.predev,scopes:a,shopCustomDomain:f,hmrServerOptions:g,roles:p.configuration.roles}}});return Promise.all(l)}async function oa({web:t,frontendPort:e,backendPort:r}){return oe(t,B.Frontend)?e:oe(t,B.Backend)?r:M()}async function na({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:c,directory:f,devCommand:l,preDevCommand:p,scopes:h,shopCustomDomain:g,hmrServerOptions:d}){let m=d?.port,E={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:h,NODE_ENV:"development",...g&&{SHOP_CUSTOM_DOMAIN:g},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${c}`,...m&&{HMR_SERVER_PORT:`${m}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},S={signal:r,directory:f,port:o,env:E,stdout:t,stderr:e};p&&(t.write(`Running pre-dev command: "${p}"`),await bn({...S,command:p,showOutput:dr()})),await bn({...S,command:l,showOutput:!0})}async function bn({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let c=t.split("&&").map(f=>f.trim())??[];for(let f of c){let[l,...p]=f.split(" ");l?.length!==0&&await $e(l,p,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}u();u();u();var ze=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(T`${R.yellow(e)}`.value)}async success(e){await this.log(T`${R.green(e)}`.value)}async debug(e){y(e,this.stdout)}async error(e,r){let o=R.errorText("\u274C Error"),n=R.errorText(`\u2514 ${e}`);await this.log(T`${o}`.value,r),await this.log(T`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e,r){if(!e||r.status==="remote-error"||r.status==="unknown-error")return;let o={status:r.status},n=e.extensionEvents??[],a=(await Promise.all(n.map(async c=>c.type===ne.Deleted?[]:(await c.extension.getDevSessionUpdateMessages(o))?.map(l=>({message:l,prefix:c.extension.handle}))??[]))).flat(),i=a.map((c,f)=>{let l=T`${R.gray(f===a.length-1?"\u2514 ":"\u2502 ")}${c.message}`.value;return this.log(l,c.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=R.errorText("\u274C Error");await this.log(T`${r}`.value,"app-preview");let o=e.map(n=>{let s=R.errorText(`\u2514 ${n.error}`);return this.log(T`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(`${e}
|
|
8
|
+
`)})}};u();var Ye=class{processBatch;queue=[];processingPromise=void 0;constructor(e){this.processBatch=e}enqueue(e){this.queue.push(e),this.processingPromise??=this.startProcessing()}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var Je=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}statusManager;logger;options;appWatcher;bundlePath;appEventsProcessor;failedEvents=[];currentSessionState=null;constructor(e,r){this.statusManager=e.devSessionStatusManager,this.logger=new ze(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ye(o=>this.processEvents(o))}async start(){await this.logger.info(`Preparing dev preview on ${this.options.storeFqdn}`),this.statusManager.setMessage("LOADING"),this.appWatcher.onEvent(async e=>this.onEvent(e)).onStart(async e=>this.onStart(e)).onError(async e=>this.handleDevSessionResult({status:"unknown-error",error:e}))}async onEvent(e){await this.validateAppEvent(e)&&this.appEventsProcessor.enqueue(e)}async processEvents(e){let r=[...this.failedEvents,...e],o=this.consolidateAppEvents(r);if(this.failedEvents=[],!o)return;this.statusManager.setMessage("CHANGE_DETECTED"),this.updatePreviewURL(o),await this.logger.logExtensionEvents(o);let n=Uo(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${ht(n)}ms - Total: ${ht(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let a of e)for(let i of a.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new I(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:o.buildResult?.status==="error"&&o.buildResult.error||"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){if(e.status==="updated")await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage();else if(e.status==="created")this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r,e),this.statusManager.setMessage("READY");else if(e.status==="remote-error"||e.status==="unknown-error"){let o=e.error instanceof Error?[e.error.message]:e.error.map(n=>n.message);await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR",o):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR",o))}!this.statusManager.status.isReady&&!fr()&&setImmediate(()=>{throw new I("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:this.options.appPreviewURL,appEmbedded:e.app.configuration.embedded,hasExtensions:r})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=ae(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new I("Auth session expired. Please run `shopify app dev` again.");if(r instanceof jt)throw r.response.status===401||r.response.status===403?new I("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new I("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await Ao(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await Wt(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=U(ve(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...To];r&&n.push("manifest.json"),await Io(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await _o(s,o),s}async getSignedURLWithRetry(){return Co(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.warnings??[],s=r.devSessionUpdate?.devSession;if(s&&this.currentSessionState){let a=ae(this.options.url),i=this.currentSessionState?.userId;if(s.websocketUrl!==a||s.user?.id!==i){let c=s.user?.email;await this.logger.error(`Another developer ${c?`(${c}) `:""}has taken ownership of this dev preview.`);let f=`Another user${c?` (${c})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,l=["You can restart by running",{command:"shopify app dev"},"again."];throw new I(f,l)}this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}}return n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"created"}}async logWarnings(e){await Promise.all(e.map(r=>{let o=r.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${r.message}`:r.message;return this.logger.warning(o)}))}};async function Rn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:sa,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var sa=async({stdout:t},e)=>{await Je.start(e,t)};u();u();u();var An=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=be().substring(0,6),i=`${aa(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,c=Zo({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),f=U(n,i);try{return await Z(n),await xe(f,c),{fullOutputPath:f,identifier:s}}catch(l){throw r.write(`Error while writing log to file: ${l}
|
|
9
|
+
`),l}};function aa(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),s=e.getUTCHours().toString().padStart(2,"0"),a=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),c=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${c}Z`}var Qe=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:f=0})=>{if(!i?.aborted)try{let l=e,p=Ho,h=f,g=await o.appLogs({jwtToken:e,cursor:r},a),{errors:d,status:m}=g;if(m===200){h=0;let{app_logs:S}=g;for(let v of S){let w=JSON.parse(v.payload);await D({outputPrefix:v.source,stripAnsi:!1},async()=>{v.log_type===Bo?(ia(v,w,t),w=new Wo(qo(w))):v.log_type.startsWith(Ko)?ca(v,w,t):t.write(JSON.stringify(w));let x=await An({appLog:v,appLogPayload:w,stdout:t,storeName:s,logsDir:c});t.write(T`${R.gray("\u2514 ")}${R.link("Open log file",`file://${x.fullOutputPath}`,`Log: ${x.fullOutputPath}`)} ${R.gray(`(${x.identifier})`)}\n`.value)})}}else{let S={errors:d.map(w=>({message:w,status:m}))},v=await Xo({response:S,onThrottle:w=>{L("Request throttled while polling app logs.",t),L(`Retrying in ${w/1e3} seconds.`,t)},onUnknownError:w=>{L("Error while polling app logs.",t),L(`Retrying in ${w/1e3} seconds.`,t)},onResubscribe:()=>n()});if(v.resubscribeResult==="failed"){if(h+=1,h>=jo){L("App log streaming session has expired. Please restart your dev session.",t);return}}else v.resubscribeResult==="succeeded"&&(h=0);v.nextJwtToken&&(l=v.nextJwtToken),p=v.retryIntervalMs}let{cursor:E}=g;setTimeout(()=>{Qe({stdout:t,appLogsFetchInput:{jwtToken:l,cursor:E??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c,consecutiveResubscribeFailures:h}).catch(S=>{y(`Unexpected error during polling: ${S}}
|
|
10
|
+
`)})},p)}catch(l){L("Error while polling app logs.",t),L(`Retrying in ${wt/1e3} seconds.`,t),y(`${l}}
|
|
11
|
+
`),setTimeout(()=>{Qe({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:c}).catch(p=>{y(`Unexpected error during polling: ${p}}
|
|
12
|
+
`)})},wt)}};function ia(t,e,r){let o=(e.fuel_consumed/Go).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
|
|
13
|
+
`).filter(Boolean).map(s=>T`${R.gray("\u2502 ")}${s}`.value).join(`
|
|
14
|
+
`))}function ca(t,e,r){t.log_type===Vo?r.write("Function network access response retrieved from cache."):t.log_type===zo?e.reason===Jo?r.write("Function network access request executing in background because there is no cached response."):e.reason===Qo&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===Yo&&(t.status==="success"?r.write("Function network access request executed successfully."):t.status==="failure"&&r.write(`\u274C Function network access request failed to execute with error: ${e.error}.`))}function la(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function Tn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:pa,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var pa=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:c})=>{async function f(l){let p=await yt(o,n,a,t),h=c.getLogsDir();await Z(h),await Qe({stdout:t,appLogsFetchInput:{jwtToken:p},resubscribeCallback:()=>yt(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:l,logsDir:h})}try{let l=!1,p,h=async g=>{let d=la(g.app);if(d&&!l){y("Function extensions detected, starting logs polling"),l=!0,p=new AbortController;try{await f(p.signal)}catch(m){y(`Failed to start function logs: ${m}`,e)}}else!d&&l&&(y("No function extensions detected, stopping logs polling"),l=!1,p?.abort(),p=void 0)};i.onStart(h).onEvent(h)}catch{}};u();async function In(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:ua}}var ua=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};u();import{EventEmitter as da}from"events";var fa={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},Xe=class extends da{currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0};constructor(e){super(),e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};Yt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e,r){let o=fa[e],n=o.type==="success"?[]:r;this.updateStatus({statusMessage:o,...n?{errors:n}:{}})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};u();import*as _n from"http";import*as Cn from"https";function Ln(t){return"errors"in t&&Array.isArray(t.errors)}async function kn(t,e,r,o){let s=(await import("./http-proxy-node16-D3JUYA5D.js")).default.createProxyServer(),a=ha(t,s,o),i=r?Cn.createServer(r,a):_n.createServer(a);return i.on("upgrade",ma(t,s,o)),e.addEventListener("abort",()=>{y("Closing reverse HTTP proxy"),i.close()}),{server:i}}function ma(t,e,r){return function(o,n,s){let a=$n(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let f=(Ln(i)?i.errors[i.errors.length-1]:void 0)??i;L(`Error forwarding websocket request: ${f.message}`,r),L(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function ha(t,e,r){return function(o,n){let s=$n(t,o);if(s)return o.method==="OPTIONS"?(n.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin??"*","Access-Control-Allow-Methods":o.headers["access-control-request-method"]??"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]??"Content-Type, Authorization","Access-Control-Max-Age":"86400"}),n.end()):e.web(o,n,{target:s},a=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let c=(Ln(a)?a.errors[a.errors.length-1]:void 0)??a;L(`Error forwarding web request: ${c.message}`,r),L(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});y(T`
|
|
15
|
+
Reverse HTTP proxy error - Invalid path: ${o.url??""}
|
|
16
|
+
These are the allowed paths:
|
|
17
|
+
${R.json(JSON.stringify(t))}
|
|
18
|
+
`),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function $n(t,e,r=!1){let o=e.url??"/";for(let n in t)if(o.startsWith(n))return t[n];return r&&t.websocket?t.websocket:t.default}async function Fn({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:c,graphiqlKey:f,apiSecret:l}){let p=o.apiKey,h=Ue(),g=!ye(h[re.disableGraphiQLExplorer]),d=await ho(t),m=l??(d.webs.length>0?await Ne(o):void 0),E=g&&m!==void 0,S=new Ro(d,i.proxyUrl),v=await Re(),w=ko(n,p,v),x=w,C=m===void 0?void 0:Ur(f,m,n),O=E&&C?`http://localhost:${c}/graphiql?key=${encodeURIComponent(C)}`:void 0,H=d.configuration.embedded,b=d.nonConfigExtensions.length>0,j=new Xe({isReady:!1,previewURL:x,graphiqlURL:O,appEmbedded:H,hasExtensions:b}),et=[...m===void 0?[]:await Un({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:p,apiSecret:m,scopes:oo(d.configuration)}),E&&m!==void 0?await Sn({appName:o.title,appUrl:w,port:c,apiKey:p,apiSecret:m,key:C,storeFqdn:n}):void 0,await Pn({allExtensions:d.realExtensions,storeFqdn:n,storeId:s,apiKey:p,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:S}),await Rn({app:d,apiKey:p,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:S,appPreviewURL:w,devSessionStatusManager:j,unsafeValidation:a.unsafeValidation}),await tn({remoteApp:o,localApp:d,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),m===void 0?void 0:xn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:m,remoteAppUpdated:e}),await Tn({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:p},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:S}),await In({appWatcher:S})].filter(ga);return{processes:await wa(et,i.proxyPort,i.reverseProxyCert),previewUrl:x,graphiqlUrl:O,devSessionStatusManager:j}}var ga=t=>t!==void 0&&t!==!1;async function wa(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(B.Frontend)){let c=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${c}`;let f=a.options.hmrServerOptions;f&&(i.websocket=`http://localhost:${f.port}`,f.httpPaths.forEach(l=>i[l]=`http://localhost:${f.port}`)),a.options.port=c}else if(a.type==="previewable-extension"){let c=await M();i[a.options.pathPrefix]=`http://localhost:${c}`,a.options.port=c}return{process:a,rules:i}})),n=o.map(({process:a})=>a),s=o.map(({rules:a})=>a).reduce((a,i)=>({...a,...i}),{});return Object.keys(s).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:ya,options:{port:e,rules:s,localhostCert:r}}),n}var ya=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await kn(o,t,n,e);V(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};u();async function Dn({remoteApp:t,hasWebs:e,graphiqlEnabled:r}){if(e)return Ne(t);if(!r)return;let o=await wo(t);return o||L(`GraphiQL isn't available because the App Management API didn't return the app's client secret for your credentials. ${yo()}`),o}u();u();u();var _=X(st(),1);var Mn=.9,On=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Zt(),{isRawModeSupported:o}=Ie(),[n,s]=(0,_.useState)(e),[a,i]=(0,_.useState)(Math.floor(r.columns*Mn)),[c,f]=(0,_.useState)(!0),l=(0,_.useRef)(null);if(!n)throw new Error("No tabs provided");_e((d,m)=>{(async()=>{if(m?.leftArrow||m?.rightArrow||m?.tab){let w=Object.entries(t).filter(([b,j])=>j.content),x=w.findIndex(([b])=>b===n);if(x===-1)return;let C=m?.leftArrow?-1:1,O=(x+C+w.length)%w.length,H=w[O];H&&s(H[0])}let S=t[d];if(S){S.action?await S.action():s(d);return}let v=t[n];if(v?.shortcuts){let w=v.shortcuts.find(x=>x.key===d);w&&(!w.condition||w.condition())&&await w.action()}})()},{isActive:!!o}),(0,_.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*Mn)),!l.current)return;let m=er(l.current);f(m.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let p=Object.entries(t).map(([d,m])=>({...m,inputKey:d,header:` (${d}) ${m.label} `})),h=p.filter(d=>!d.action),g=p.filter(d=>d.action);return _.default.createElement(_.default.Fragment,null,_.default.createElement(F,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},_.default.createElement(F,{ref:l,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},_.default.createElement(W,{wrap:"truncate-end"},"\u2502",h.map(d=>_.default.createElement(_.default.Fragment,{key:d.inputKey},_.default.createElement(W,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),c&&_.default.createElement(F,{flexGrow:1,justifyContent:"flex-end"},g.map((d,m)=>_.default.createElement(W,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,m<g.length-1&&" \u2502 ")))),_.default.createElement(F,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var P=X(st(),1);var va=({message:t,type:e})=>e==="loading"?P.default.createElement(ir,{title:t}):P.default.createElement(W,null,e==="success"?"\u2705":"\u274C"," ",t),Nn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:c,onAbort:f})=>{let{isRawModeSupported:l}=Ie(),[p,h]=(0,P.useState)(void 0),[g,d]=(0,P.useState)(void 0),[m,E]=(0,P.useState)(r.status),[S,v]=(0,P.useState)(!1),{isAborted:w}=ar(t.signal,async b=>{b&&d(typeof b=="string"?b:b.message),r.status.isReady?v(!0):(h("Shutting down dev ..."),await f()),He()}),x=(0,P.useMemo)(()=>e.map(b=>({...b,action:async(j,et,Ct)=>{try{return await b.action(j,et,Ct)}catch(ps){t.abort(ps)}}})),[e,t]);(0,P.useEffect)(()=>(r.on("dev-session-update",E),()=>{r.off("dev-session-update",E)}),[]),_e((b,j)=>{rr(b,j,()=>t.abort())},{isActive:!!l});let C=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:m.previewURL,condition:()=>!!(m.isReady&&m.previewURL),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),m.previewURL&&await ke(m.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:gt(o),condition:()=>!!(m.isReady&&m.appEmbedded===!1&&m.hasExtensions),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await ke(gt(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:m.graphiqlURL,condition:()=>!!(m.isReady&&m.graphiqlURL),action:async()=>{await z.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),m.graphiqlURL&&await ke(m.graphiqlURL)}}],O=C.filter(b=>b.condition?.()??!0),H={d:{label:"Dev status",shortcuts:C,content:P.default.createElement(P.default.Fragment,null,m.statusMessage&&P.default.createElement(va,{message:m.statusMessage.message,type:m.statusMessage.type}),l&&O.length>0&&P.default.createElement(F,{marginTop:1,flexDirection:"column"},O.map(b=>P.default.createElement(W,{key:b.key},or.pointerSmall," ",P.default.createElement(W,{bold:!0},"(",b.key,")")," ",ct()&&b.url?P.default.createElement(at,{url:b.url,label:b.shortcutLabel}):b.shortcutLabel))),P.default.createElement(F,{marginTop:l?1:0,flexDirection:"column"},p?P.default.createElement(W,null,p):P.default.createElement(P.default.Fragment,null,m.isReady&&!(l&&ct())&&P.default.createElement(P.default.Fragment,null,O.filter(b=>b.url).map(b=>P.default.createElement(W,{key:b.key},b.linkLabel," URL: ",P.default.createElement(at,{url:b.url})))))))},a:{label:"App info",content:P.default.createElement(F,{flexDirection:"column"},P.default.createElement(it,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":c??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,b])=>b)}))},s:{label:"Store info",content:P.default.createElement(F,{flexDirection:"column"},P.default.createElement(it,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,b])=>b)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return P.default.createElement(P.default.Fragment,null,P.default.createElement(nr,{processes:x,prefixColumnSize:so,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),S&&P.default.createElement(F,{marginTop:1,flexDirection:"column"},P.default.createElement(sr,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),w?null:P.default.createElement(F,{paddingTop:1,flexDirection:"column",flexGrow:1},l?P.default.createElement(On,{tabs:H,initialActiveTab:"d"}):P.default.createElement(F,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},H.d?.content)),g?P.default.createElement(F,{marginTop:1,flexDirection:"column"},P.default.createElement(W,{color:"red"},g)):null)};var qn=X(st(),1);import{Writable as Hn}from"stream";async function jn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:c,organizationName:f,configPath:l,localURL:p}){let h=()=>o.abort();process.on("shopify:signal",h);try{if(nt()!=="json"&&pr())return await tr(qn.default.createElement(Nn,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:c,organizationName:f,configPath:l,localURL:p,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await Pa({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o}),He()}finally{process.removeListener("shopify:signal",h)}}async function Pa({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){let n=nt()==="json";n||(process.stdout.write(`
|
|
19
|
+
Preview URL: ${e}
|
|
20
|
+
`),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
|
|
21
|
+
`));let{signal:s}=o,a=()=>o.abort();process.once("SIGINT",a),process.once("SIGTERM",a);let i=()=>{},c=new Promise(l=>{i=l,s.addEventListener("abort",i,{once:!0}),s.aborted&&l()}),f=t.map(async l=>{let p=new Hn({write:(h,g,d)=>d()});return l.action(n?p:Wn(process.stdout),n?p:Wn(process.stderr),s)});try{await Promise.all([...f,c])}catch(l){if(!s.aborted)throw l}finally{o.abort(),await Promise.allSettled(f),s.removeEventListener("abort",i),process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a)}}function Wn(t){return new Hn({decodeStrings:!1,write(e,r,o){let n=typeof e=="string"?Buffer.from(e,r):e,s=typeof e=="string"&&n.length>0&&n[n.length-1]!==10;t.write(s?Buffer.concat([n,Buffer.from(`
|
|
22
|
+
`)]):n,o)}})}u();function Gn(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];ue({headline:[`A random port will be used for ${n.for} because ${n?.requested} is not available.`],body:["If you want to use a specific port, you can choose a different one by setting the ",{command:n?.flagToRemedy}," flag."]});return}let r=rt(e.map(n=>n.for)).join(" "),o=rt(e.map(n=>({command:n.flagToRemedy})));ue({headline:[`Random ports will be used for ${r} because the requested ports are not available.`],body:["If you want to use specific ports, you can choose different ports using the",...o,"flags."]})}u();async function Bn(t,e){return e?e.includes("localhost")?"localhost":(await Kt(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}u();var Kn=X(ds(),1);var Q="v1.4.4",Vn="FiloSottile/mkcert",Rt=R.genericShellCommand("mkcert");async function Ea(t,e,r,o){let n=e[re.mkcertBinaryPath];if(n)return n;let a=U(t,r==="win32"?"mkcert.exe":"mkcert");if(await N(a))return a;let i=await(0,Kn.default)("mkcert",{nothrow:!0});return i?(y(T`Found ${Rt} at ${R.path(i)}`),i):(await xa(a,r,o),a)}async function xa(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${Q}-darwin-arm64`:`mkcert-${Q}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${Q}-linux-arm64`:`mkcert-${Q}-linux-amd64`;break;case"win32":o=`mkcert-${Q}-windows-amd64.exe`;break;default:throw new te(`Unsupported platform: ${e}`)}await Or(Vn,Q,o,t),y(T`${Rt} saved to ${R.path(t)}`)}async function Sa(t){let e=U(t,"mkcert-LICENSE");if(await N(e))return;let r=`https://raw.githubusercontent.com/${Vn}/refs/tags/${Q}/LICENSE`,o={headline:"Failed to download mkcert license.",body:["We tried to download the license for mkcert, but the request failed. You can ",{link:{url:r,label:"view the license here"}}]},n;try{if(n=await Bt(r),!n.ok)return o}catch{return o}let s=await n.text();await xe(e,s)}async function zn({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=U(".shopify","localhost-key.pem"),a=U(".shopify","localhost.pem"),i=U(t,s),c=U(t,a);if(await N(i)&&await N(c))return{keyContent:await k(i),certContent:await k(c),certPath:a};if(!(e??await go()))throw new I(`Localhost certificate and key are required at ${a} and ${s}`);let l="",p;return await Le([{title:"Finding or downloading mkcert binary",task:async()=>{let g=U(t,".shopify");l=await Ea(g,r,o,n),p=await Sa(g),y(T`${Rt} found at: ${R.path(l)}`)}}]),p&&Ce(p),V(T`Generating self-signed certificate for localhost. You may be prompted for your password.`),await $e(l,["-install","-key-file",i,"-cert-file",c,"localhost"]),V(T`${R.successIcon()} Certificate generated at ${a}\n`),await ur()&&(ue({headline:"It looks like you're using WSL.",body:["Additional steps are required to configure certificate trust in Windows."],link:{label:"See Shopify CLI documentation",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development-with-windows-subsystem-for-linux-wsl"}}),V("\u{1F449} Press any key to continue"),await cr(),V("")),{keyContent:await k(i),certContent:await k(c),certPath:Lt(t,c)}}u();function Yn(){let t=["Your app has extensions which need to be assigned",{command:"uid"},"identifiers."],e=["You must first map IDs to your existing extensions by running",{command:"shopify app deploy"},"interactively, without",{command:"--allow-updates"},"or",{command:"--allow-deletes"},", to finish the migration."],r={title:"Reference",body:{list:{items:[{link:{label:"Migrating from the Partner Dashboard",url:"https://shopify.dev/docs/apps/build/dev-dashboard/migrate-from-partners"}}]}}};throw new I(t,void 0,[e],[r])}u();u();import{createWriteStream as ba}from"fs";import{Writable as Ua}from"stream";import{finished as Ra}from"stream/promises";import{StringDecoder as Aa}from"string_decoder";import{once as Ta}from"events";var ge=we({name:"DevInstanceLogEntry",schema:A.object({timestamp:ie,source:A.string().describe("What produced the line, for example a process prefix like web or extensions."),level:A.enum(["debug","info","warning","error"]).optional(),message:A.string()}).strict()});function Qn({logFile:t,logOutput:e,isActive:r,onError:o}){let n=ba(t,{flags:"w",mode:384});n.on("error",o),e?.on("error",o);let s=Ta(n,"open"),a=new Set,i=async c=>{if(!r())return;let f=ge.validate({...c,timestamp:c.timestamp??ce(new Date)}),l=`${JSON.stringify(f)}
|
|
23
|
+
`;try{await Ze(n,l),e&&await Ze(e,l)}catch(p){throw o(p),p}};return{opened:s,log:i,tee:(c,{source:f,stringWritesAreMessages:l=!1})=>{let p=new Aa("utf8"),h="",g=f,d=async v=>{let w=v.split(/\r?\n/);h=w.pop()??"",await Promise.all(w.map(async x=>{let C=mr(x).trimEnd();C.length>0&&await i({source:g,message:C})}))},m=()=>d(`${h}${p.end()}
|
|
24
|
+
`),E=new At({decodeStrings:!l,write(v,w,x){let C=Te()?.outputPrefix??f,O=l&&typeof v=="string",H=C!==g||O?m():Promise.resolve();g=C,Promise.all([H,Ze(c,v,w),d(h+p.write(typeof v=="string"?Buffer.from(v,w):v)+(O?`
|
|
25
|
+
`:""))]).then(()=>x()).catch(x)},final(v){m().then(()=>v()).catch(v)}}),S=v=>E.destroy(v);return c.on("error",S),E.on("error",v=>o(v)),E.once("close",()=>{c.off("error",S)}),a.add(E),E},flush:()=>Promise.allSettled([...a].map(c=>Jn(c))),close:async()=>{try{await Jn(n),e&&!e.destroyed&&await Ze(e,"")}finally{e?.off("error",o)}}}}var At=class extends Ua{contexts=[];constructor(e){super({...e,write:(r,o,n)=>{D(this.contexts.shift()??{},()=>e.write.call(this,r,o,n))}})}write(e,r,o){return this.contexts.push(Te()),typeof r=="string"?super.write(e,r,o):super.write(e,r??o)}end(e,r,o){return e!=null&&typeof e!="function"&&this.contexts.push(Te()),typeof e=="function"?super.end(e):typeof r=="string"?super.end(e,r,o):super.end(e,r??o)}};async function Ze(t,e,r="utf8"){await new Promise((o,n)=>{t.write(e,r,s=>s?n(s):o())})}async function Jn(t){let e=Ra(t,{cleanup:!0});t.end(),await e}var Zn=X(fs());import Tt,{readFileSync as Ia}from"fs";import{mkdir as _a,rmdir as Ca,writeFile as La}from"fs/promises";var It="dev_instance_already_running",ka="dev",$a=15e3;function Fa(t){let e=U(t.directory,".shopify",ka),r=Na(t);return{folder:e,infoFile:U(e,`${r}.json`),lockFile:U(e,`${r}.lock`),logFile:U(e,`${r}.jsonl`)}}async function Da(t){let e=Fa(t);await $r(t.directory),await Z(e.folder);let r=`${e.lockFile}.acquire`;try{await _a(r,{mode:448})}catch(o){if(o.code!=="EEXIST")throw o;let n=new I(`Another \`shopify ${t.command}\` is starting, or a previous startup was interrupted.`,"Wait for other starts to finish. If none is running, remove the startup lock below and try again.",[["Startup lock",{filePath:r}]]);throw n.code=It,n}try{return await Ma(t,e)}catch(o){if(!Oa(o))throw o;let n=await rs(e.infoFile);throw os(t,n&&ts(n.pid)?n:void 0)}finally{await Ca(r)}}async function es(t,e){let r=await Da(t);try{return await e(r)}finally{await r.release()}}async function Ma(t,e){let r=await rs(e.infoFile);if(r&&ts(r.pid))throw os(t,r);let o=be(),n=new AbortController,s=!1,a=()=>{if(s)return!1;try{return JSON.parse(Ia(e.infoFile,"utf8")).sessionId===o}catch{return!1}},i=!1,c=w=>{if(!(i&&!a()))try{Tt.rmdirSync(w)}catch(x){if(x.code!=="ENOENT")throw x}},f={realpath:!1,lockfilePath:e.lockFile,stale:$a,retries:0,onCompromised:w=>{s=!0,y(`The ${t.command} instance lock was compromised: ${w.message}`),n.abort(new I(`The ${t.command} instance lost its lock.`,"Start the command again."))},fs:{...Tt,rmdir:(w,x)=>{if(i&&!a())return x(null);Tt.rmdir(w,x)},rmdirSync:c}};r&&await Mt(e.lockFile,{force:!0});let l=await Zn.default.lock(e.infoFile,f),p=ce(new Date),h={schemaVersion:1,sessionId:o,command:t.command,...t.key?{key:t.key}:{},pid:process.pid,status:"starting",startedAt:p,updatedAt:p,directory:t.directory,logFile:e.logFile,details:{...t.details??{}}},g=Promise.resolve(),d=!1,m=Qn({logFile:e.logFile,logOutput:t.logOutput,isActive:()=>!d&&!s,onError:w=>n.abort(w)}),E,S=()=>{!d&&a()&&(c(e.lockFile),Dt(e.infoFile))};process.once("exit",S);let v={info:h,paths:e,abortSignal:n.signal,update:async w=>{if(E||s)return;w.status&&(h.status=w.status),w.details&&(h.details={...h.details,...w.details}),h.updatedAt=ce(new Date);let x={...h,details:{...h.details}},C=g.then(async()=>{s||await Xn(e.infoFile,x)});g=C.catch(()=>{}),await C},log:m.log,tee:m.tee,release:()=>(E??=(async()=>{try{let x=(await m.flush()).find(C=>C.status==="rejected");if(await g,x?.status==="rejected")throw x.reason}finally{d=!0,process.removeListener("exit",S);try{await m.close()}finally{let w=a();await l().catch(x=>y(`Failed to release the dev instance lock: ${x.message}`)),w&&await ot(e.infoFile).catch(()=>{})}}})(),E)};try{return await m.opened,await Xn(e.infoFile,h),i=!0,v}catch(w){throw await v.release().catch(x=>y(x.message)),await ot(`${e.infoFile}.${o}.tmp`),w}}function ts(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(e){return e.code==="EPERM"}}async function rs(t){try{let e=JSON.parse(await k(t));return typeof e?.pid=="number"?e:void 0}catch{return}}async function Xn(t,e){let r=`${t}.${e.sessionId}.tmp`;await La(r,`${JSON.stringify(e,null,2)}
|
|
26
|
+
`,{mode:384}),await Ft(r,t)}function Oa(t){return t?.code==="ELOCKED"}function Na({command:t,key:e}){let r=[t,e].filter(Boolean).join("-").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),o=pe(JSON.stringify([t,e??""])).slice(0,4);return`${r}-${o}`}function os(t,e){let r=`shopify ${t.command}`;if(!e){let a=new I(`Another \`${r}\` is starting for this project.`,"Wait a few seconds and try again, or stop the other process first.");return a.code=It,a}let o=process.platform==="win32"?`taskkill /PID ${e.pid} /F`:`kill ${e.pid}`,n=Object.entries(e.details).filter(([,a])=>typeof a=="string"||typeof a=="number"||typeof a=="boolean").map(([a,i])=>[a,String(i)]),s=new I(`Another \`${r}\` is already running for this project.`,"Use the running instance, or stop it before starting a new one.",[["Read its output in",{filePath:e.logFile}],["Stop it with",{command:o}]],[{body:{tabularData:[["PID",String(e.pid)],["Started",e.startedAt],...n],firstColumnSubdued:!0}}]);return s.code=It,s.details={instance:e},s}function ss({app:t,remoteApp:e,json:r=!1},o){return es({command:"app dev",directory:t.directory,key:Pe(t.configPath),details:{configPath:t.configPath,appName:e.title,clientId:e.apiKey},logOutput:r?process.stdout:void 0},o)}async function as(t){let e=new Ht,r;try{if(t.tunnel.mode==="auto"){let c=await M();r=await fo(t.commandConfig,c,"cloudflare"),e.signal.addEventListener("abort",()=>r?.stopTunnel(),{once:!0})}let o=await Wa(t,r);await qa(o);let{processes:n,graphiqlUrl:s,previewUrl:a,devSessionStatusManager:i}=await Fn(o);await ja(o),await Ka({processes:n,previewUrl:a,graphiqlUrl:s,config:o,devSessionStatusManager:i,abortController:e})}finally{e.abort()}}async function Wa(t,e){let{app:r,remoteApp:o,developerPlatformClient:n,store:s,specifications:a,tunnel:i}=t,c=await Po(o,n,a,o.flags);o.configuration=c;let f=await Dn({remoteApp:o,hasWebs:r.webs.length>0,graphiqlEnabled:!ye(Ue()[re.disableGraphiQLExplorer])});Eo({app:r,remoteApp:o,selectedStore:s,cachedInfo:mt(t.directory),organization:t.organization,tunnelMode:i.mode}),r.configuration.build?.dev_store_url&&(r.configuration.build={...r.configuration.build,dev_store_url:s.shopDomain},await(await hr.read(r.configPath)).patch({build:{dev_store_url:s.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await ro(t.project);let l=t.graphiqlPort??await M(fe.graphiql),p=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??fe.graphiql,actual:l}];i.mode==="use-localhost"&&p.push({for:"localhost",flagToRemedy:"--localhost-port",requested:i.requestedPort,actual:i.actualPort}),Gn(p);let{webs:h,...g}=await Ba(r.directory,r.webs,l,i,e,o.configuration,t.installMkcert);r.webs=h;let d=r.configuration.build?.automatically_update_urls_on_dev,m=mt(t.directory)?.previousAppId,E=o.apiKey,S=await Ga(h,t.update,g,r,d,o,E);return{storeFqdn:s.shopDomain,storeId:s.shopId,remoteApp:o,remoteAppUpdated:o.apiKey!==m,localApp:r,developerPlatformClient:n,commandOptions:t,network:g,partnerUrlsUpdated:S,graphiqlPort:l,graphiqlKey:t.graphiqlKey,apiSecret:f}}async function qa(t){await Ha(t)}async function Ha(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||Yn()}async function ja(t){io({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await Va({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Jt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function Ga(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=J(t),f=!1;if((c??i)&&e){let l=lo(r.proxyUrl,t.map(({configuration:p})=>p.auth_callback_path).find(p=>p),o.configuration.app_proxy);f=await uo({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:l}),f&&o.setDevApplicationURLs(l)}return f}async function Ba(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:c}=J(e);await za(e,r);let f=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:l,frontendPort:p,usingLocalhost:h},g,d]=await Promise.all([co(f),qt()??i?.configuration.port??M(),po(s)]),m=h?`${l}:${p}`:l,E=c?.configuration.port;c&&(E??=c===i?g:await M(),c.configuration.port=E),E=E??await M();let S;if(o.mode==="use-localhost"){let{keyContent:v,certContent:w,certPath:x}=await zn({appDirectory:t,forceInstall:a});S={key:v,cert:w,certPath:x,port:o.actualPort}}return{proxyUrl:m,proxyPort:p,frontendPort:E,backendPort:g,currentUrls:d,webs:e,reverseProxyCert:S}}async function Ka({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n,abortController:s}){let a=o.commandOptions.devInstance,i=t.map(g=>({prefix:g.prefix,action:async(m,E,S)=>{let v=g.function,w=a?a.tee(m,{source:g.prefix,stringWritesAreMessages:!0}):m,x=a?a.tee(E,{source:g.prefix,stringWritesAreMessages:!0}):E;return v({stdout:w,stderr:x,abortSignal:S},g.options)}}));if(a){let g={storeFqdn:o.storeFqdn,previewUrl:e,graphiqlUrl:r,appUrl:o.localApp.devApplicationURLs?.applicationUrl,localUrl:o.network.proxyUrl};await a.update({status:"running",details:{...g,preview:ns(n.status)}}),await a.log({source:"app dev",level:"info",message:`Preview URL: ${e}`}),r&&await a.log({source:"app dev",level:"info",message:`GraphiQL URL (Admin API): ${r}`})}let c=o.developerPlatformClient,f={id:o.remoteApp.id,developerPlatformClient:c},l,p=g=>{let d=[a?.update({details:{preview:ns(g)}})],m=g.statusMessage;m&&(m.message!==l?.message||m.type!==l?.type)&&d.push(a?.log({source:"app dev",level:m.type==="error"?"error":"info",message:m.message})),l=m,Promise.all(d).catch(E=>{y(`Failed to save dev status: ${E.message}`)})};a&&(n.on("dev-session-update",p),p(n.status));let h=()=>s.abort(a?.abortSignal.reason);try{a?.abortSignal.throwIfAborted(),a?.abortSignal.addEventListener("abort",h,{once:!0}),await jn({processes:i,previewUrl:e,graphiqlUrl:r,app:f,abortController:s,shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl}),a?.abortSignal.throwIfAborted()}finally{a?.abortSignal.removeEventListener("abort",h),a&&n.off("dev-session-update",p)}}function ns({isReady:t,statusMessage:e,errors:r}){let o=t?"ready":"starting";return t&&e?.type==="loading"&&(o="updating"),e?.type==="error"&&(o="error"),{state:o,message:e?.message??null,errors:r??[]}}async function Va(t){let e=await Bn(t.devOptions.commandConfig,t.tunnelUrl);await z.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?pe(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:pe(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await z.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function za(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);if(o)throw new I(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await lt(n))throw new I(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await lt(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new I(s,a)}})()])}u();var is=A.object({state:A.enum(["starting","updating","ready","error"]),message:A.string().nullable(),errors:A.array(A.string())}).strict().describe("The CLI-reported preview state in the instance file; this is not a health check."),Ya=A.object({schemaVersion:A.literal(1),sessionId:A.string(),command:A.literal("app dev"),key:A.string().optional(),pid:A.number().int().positive(),status:A.enum(["starting","running"]),startedAt:ie,updatedAt:ie,directory:A.string(),logFile:A.string(),details:A.object({configPath:A.string(),appName:A.string(),clientId:A.string(),storeFqdn:A.string().optional(),previewUrl:A.string().optional(),graphiqlUrl:A.string().optional(),appUrl:A.string().optional(),localUrl:A.string().optional(),preview:is.optional()}).strict()}).strict().describe("The instance JSON file under .shopify/dev/. This object is not emitted to stdout."),cs=we({name:ge.name,schema:ge.schema,definitions:{DevInstance:Ya,DevPreview:is}});u();async function ls({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??fe.localhost,n=await M(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new I(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var $=X(us(),1);var _t=class t extends So{static get requiresSyncAnalytics(){return!0}static summary="Run the app.";static descriptionWithMarkdown="Builds and previews your app on a dev store, and watches for changes. [Read more about testing apps locally](https://shopify.dev/docs/apps/build/cli-for-apps/test-apps-locally).";static get jsonOutputSchema(){return cs}static description=this.descriptionForHelp();static flags={...gr,...to,...wr,"client-id":$.Flags.string({hidden:!1,description:"The Client ID of your app. Use with --config to run dev with that configuration for a different app than the one it is linked to.",env:"SHOPIFY_FLAG_CLIENT_ID"}),store:$.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>Ae(e)}),"skip-dependencies-installation":$.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":$.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"unsafe-validation":$.Flags.boolean({description:"Allow app dev to continue with warnings for eligible app version validation failures.",env:"SHOPIFY_FLAG_UNSAFE_VALIDATION",default:!1}),"subscription-product-url":$.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":$.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":$.Flags.string({description:'Use a custom tunnel, it must be running before executing dev. Format: "https://my-tunnel-url:port".',env:"SHOPIFY_FLAG_TUNNEL_URL",exclusive:["tunnel"]}),"use-localhost":$.Flags.boolean({description:"Service entry point will listen to localhost. A tunnel won't be used. Will work for testing many app features, but not those that directly invoke your app (E.g: Webhooks)",env:"SHOPIFY_FLAG_USE_LOCALHOST",exclusive:["tunnel-url"]}),"install-mkcert":$.Flags.boolean({description:"Install and use mkcert to generate localhost certificates when --use-localhost is enabled without prompting.",env:"SHOPIFY_FLAG_INSTALL_MKCERT",dependsOn:["use-localhost"]}),"localhost-port":Fe({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:$.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Fe({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":$.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:$.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":Fe({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":$.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(t),r=await ls({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Qt(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await mo(e.path);let o=await xo({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config});return ss({...o,json:e.json},async n=>{let s=await bo({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option"}),a={...o,store:s,directory:e.path,update:!e["no-update"],unsafeValidation:e["unsafe-validation"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],storePassword:e["store-password"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],installMkcert:e["install-mkcert"],tunnel:r,devInstance:n};return await as(a),{app:o.app}})}};export{Li as a,_t as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as p}from"./chunk-335BUVBP.js";import{a as i}from"./chunk-BN7ZXAZJ.js";import{Bb as v,Cb as h,Gb as C,gb as c,hb as f,ub as g,yb as a}from"./chunk-
|
|
1
|
+
import{o as p}from"./chunk-335BUVBP.js";import{a as i}from"./chunk-BN7ZXAZJ.js";import{Bb as v,Cb as h,Gb as C,gb as c,hb as f,ub as g,yb as a}from"./chunk-JLQRDFR5.js";import{e as u,f as d,g as e,h as m,j as r}from"./chunk-FZCGRIOM.js";import{g as E}from"./chunk-LHXFTFFM.js";import{g as t}from"./chunk-VKWPEFWQ.js";t();t();function b(o){let n=JSON.stringify(e.parse(o));E()&&g("info",n),C("info",c,n)}function R(o,n){if(r()!==void 0)return n();let s=p(process.env,o)?"json":"text";return m({outputMode:s,sink:s==="json"?O:(l,S)=>{S?.alreadyRendered||x(l)}},n)}var T=i({name:"CommandEvent",schema:e,definitions:{CommandDiagnosticEvent:u,CommandProgressEvent:d}});function x(o){if(o.type==="progress"){a(o.message??o.operation);return}switch(o.level){case"debug":v(o.message);break;case"info":a(o.message);break;case"warning":h(o.message);break;case"error":f(o.message,"error");break}}function O(o){b(o)}export{R as a,T as b,O as c};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{c as ae}from"./chunk-PTSCGSQV.js";import{b as P}from"./chunk-P4VZYOKO.js";import{a as fe}from"./chunk-26PWHH3B.js";import{a as ue}from"./chunk-VHZ6RL67.js";import{a as ie}from"./chunk-NVKJ7ZLP.js";import{a as re}from"./chunk-U6YOP562.js";import{L as pe,Ma as me,N as de,d as ce,e as le}from"./chunk-U2T5HPRD.js";import{t as k,v as oe,w as se}from"./chunk-33ZE3DRQ.js";import{a as F}from"./chunk-N57Y7THE.js";import{C as B,p as O,x as W,y as S}from"./chunk-QQJNQNKP.js";import{b as te,c as ne,f as A}from"./chunk-3KM5ZOW2.js";import{A as H,B as z,E as X,G as K,I as R,K as Q}from"./chunk-D2KIGKBI.js";import{e as b}from"./chunk-335BUVBP.js";import{a as G}from"./chunk-BN7ZXAZJ.js";import{h as u}from"./chunk-M5VIFG2V.js";import{Na as V,Sa as x,Ta as Y,Va as J,X as h,_ as q,ja as w,pa as U,rb as T,va as v,wb as ee,xa as E}from"./chunk-JLQRDFR5.js";import{b as f}from"./chunk-FZCGRIOM.js";import{f as Z}from"./chunk-LHXFTFFM.js";import{b as Re}from"./chunk-YTUUU33R.js";import{c as d,e as N,g as D,m as L,p as $}from"./chunk-IWTNUJGY.js";import{e as Se,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();async function he(e,t,r,n={}){let{templates:a,groupOrder:i}=await e.templateSpecifications(t,n);return{templates:a.filter(o=>r.includes(o.identifier)||r.includes(o.type)),groupOrder:i}}p();p();async function ye(e,t){let r=e?.path??"",n=d(t,r);if(!await x(n))throw new u(`
|
|
2
|
+
The extension is not available for ${e?.value}`);return n}async function xe({name:e,app:t}){let r=q(e),n=d(t.directory,se.extensions.directoryName,r);if(await x(n))throw new u(`
|
|
3
|
+
A directory with this name (${r}) already exists.
|
|
4
|
+
Choose a new name for your extension.`);return await v(n),await U(d(n,k.lockFile)),n}var ge=["vanilla-js","preact","react","typescript","typescript-react","rust","wasm","liquid","config-only"];function C(e){switch(e){case"vanilla-js":case"preact":case"react":case"typescript":case"typescript-react":return"javascript";case"rust":case"wasm":return e;case void 0:case"liquid":case"config-only":return}}async function we(e){let t=e.extensionChoices.name,r=e.extensionChoices.flavor,n=e.extensionTemplate.supportedFlavors.find(o=>o.value===r),a=await xe({app:e.app,name:t}),i=e.cloneUrl??e.extensionTemplate.url,s={directory:a,url:i,app:e.app,project:e.project,type:e.extensionTemplate.type,name:t,extensionFlavor:n,onGetTemplateRepository:e.onGetTemplateRepository??(async(o,l)=>{await ae({repoUrl:o,destination:l,shallow:!0})})};return await Ae(s),{directory:L(a),extensionTemplate:e.extensionTemplate}}async function Ae(e){try{switch(e.type){case"theme":await Me(e);break;case"function":await je(e);break;default:await Ge(e);break}let t=d(e.directory,k.lockFile);await E(t)}catch(t){throw await Ce(e.directory),e.project.packageManager==="pnpm"&&Ie(t)?new u("Your extension couldn't be generated because pnpm blocked the build scripts of some of its dependencies.",null,[["Run",{command:"pnpm approve-builds"},"in your app directory to approve the build scripts."],["Run",{command:T(e.project.packageManager,"shopify app generate extension")},"again."]]):t}}async function Ce(e){try{await E(e,{maxRetries:10,retryDelay:100})}catch{z({headline:["Couldn't remove",{filePath:e},{char:"."}],body:"Delete this directory manually before generating an extension with the same name."})}}function Ie(e){return e instanceof Error&&e.message.includes("ERR_PNPM_IGNORED_BUILDS")}async function Me({directory:e,url:t,type:r,name:n,extensionFlavor:a,onGetTemplateRepository:i}){return w(async s=>{let o=await I(t,a,s,i);await P(o,e,{name:n,type:r,uid:b(h(n))})})}async function je({directory:e,url:t,app:r,project:n,name:a,extensionFlavor:i,onGetTemplateRepository:s}){let o=C(i?.value),l=[];l.push({title:"Generating function extension",task:async()=>{if(await w(async c=>{let m=await I(t,i,c,s);await P(m,e,{name:a,handle:h(a),flavor:i?.value,uid:b(h(a))})}),o==="javascript"){let c=ve(i?.value??"rust");await Ee(e,c,"!(*.graphql)")}}}),o==="javascript"&&l.push({title:"Installing additional dependencies",task:async()=>{n.usesWorkspaces&&await O({packageManager:n.packageManager,directory:n.directory});let c=Ne(o);await S(c,{packageManager:n.packageManager,type:"prod",directory:n.usesWorkspaces?e:n.directory})}}),o==="javascript"&&l.push({title:"Building GraphQL types",task:async()=>{let c=re();try{await le({directory:e,isJavaScript:!0},{...c,app:r})}finally{c.stdout!==process.stdout&&c.stdout.end(),c.stderr!==process.stderr&&c.stderr.end()}}}),await R(l)}async function Ge({directory:e,url:t,app:r,project:n,name:a,extensionFlavor:i,onGetTemplateRepository:s}){let o=C(i?.value),l=[{title:"Generating extension",task:async()=>{let c=ve(i?.value??"vanilla-js");await w(async m=>{let y=await I(t,i,m,s);await P(y,e,{srcFileExtension:c,name:a,handle:h(a),flavor:i?.value??"",uid:b(h(a))})}),o==="javascript"&&await Ee(e,c)}},{title:"Installing dependencies",task:async()=>{let c=n.packageManager;if(n.usesWorkspaces)C(i?.value)==="javascript"&&await O({packageManager:c,directory:n.directory});else{await De(n.directory,i?.value);let m=d(e,"package.json"),y=await Le(m);await S(y,{packageManager:c,type:"prod",directory:n.directory}),await E(m)}}}];l.push({title:"Update shared type definition",task:async()=>{await de(r)}}),await R(l)}function ve(e){return{"vanilla-js":"js",preact:"jsx",react:"jsx",typescript:"ts","typescript-react":"tsx",rust:"rs",wasm:"wasm",liquid:"liquid","config-only":""}[e]??"js"}function Ne(e){let t=[];return e==="javascript"&&t.push({name:"@shopify/shopify_function",version:`~${ce}.0.0`}),t}async function Ee(e,t,r="*"){let n=await J(d(e,"src",r)),a=[];for(let i of n)a.push(V(i,`${i}.${t}`));await Promise.all(a)}async function De(e,t){t==="typescript-react"&&await B(e,{"@types/react":oe.reactTypes})}async function Le(e){if(!await x(e))return[];let t=await W(e);return Object.entries(t?.dependencies??{}).map(([r,n])=>({name:r,version:n}))}async function I(e,t,r,n){let a=d(r,"download");return await v(a),await n(e,a),ye(t,a)}p();function $e(e,t=[]){let r=[...e.map(a=>({label:a.name,value:a.identifier,group:a.group||"Other",sortPriority:a.sortPriority??Number.MAX_SAFE_INTEGER})),...t.map(a=>({label:`${a.name} (limit reached)`,value:a.identifier,group:a.group||"Other",disabled:!0,sortPriority:a.sortPriority??Number.MAX_SAFE_INTEGER}))],n=(a,i)=>a.sortPriority===i.sortPriority?a.label.localeCompare(i.label):a.sortPriority-i.sortPriority;return r.sort(n)}var qe=async e=>{let t=e.extensionTemplates,r=e.templateType,n=e.extensionFlavor;if(!r){if(n&&(t=t.filter(l=>l.supportedFlavors.map(c=>c.value).includes(n))),t.length===0)throw new u("You have reached the limit for the number of extensions you can create.");r=await K({message:"Type of extension?",choices:$e(t,e.unavailableExtensions),groupOrder:e.groupOrder})}let a=t.find(l=>l.identifier===r),i=e.name||await be(e.directory,a.defaultName),s=e.extensionFlavor??await Ue(a);return{extensionTemplate:a,extensionContent:{name:i,flavor:s}}};async function be(e,t,r=1){let n=t.includes(" ")?" ":"-",a=r<=1?t:`${t}${n}${r}`,i=d(e,h(a));return Y(i)?be(e,t,r+1):Q({message:"Name your extension:",defaultValue:a})}async function Ue(e){if(e.supportedFlavors.length!==0)return e.supportedFlavors.length===1&&e.supportedFlavors[0]?e.supportedFlavors[0].value:X({message:"What would you like to work in?",choices:e.supportedFlavors.map(t=>({label:t.name,value:t.value})),defaultValue:"react"})}var Te=qe;async function Ve(e){let{app:t,developerPlatformClient:r,remoteApp:n,specifications:a,template:i}=e,s=a.map(Oe=>Oe.identifier),{templates:o,groupOrder:l}=await he(r,n,s,{requestedTemplate:i}),c=await Ye(o,l,a,t,e),m=await Te(c);await We(m,i);let y=Be(m,t,e,r),j=await we(y);return{status:"success",extension:{directory:j.directory,extensionTemplate:j.extensionTemplate,name:m.extensionContent.name,flavor:m.extensionContent.flavor},packageManager:e.project.packageManager}}async function Ye(e,t,r,n,a){let i=await ze(a.template,n,e,r);He(i?[i]:e,a.flavor);let{validTemplates:s,templatesOverlimit:o}=Je(e,r,n);return{templateType:i?.identifier,name:a.name,extensionFlavor:a.flavor,directory:d(a.directory,"extensions"),app:n,extensionTemplates:s??[],unavailableExtensions:o??[],reset:a.reset,groupOrder:t}}function Je(e,t,r){return fe(e,a=>!Pe(r,t,a)?"validTemplates":"templatesOverlimit")}function Pe(e,t,r){let n=r.type,a=t.find(s=>s.identifier===n||s.externalIdentifier===n);return e.extensionsForType({identifier:n,externalIdentifier:n}).length>=(a?.registrationLimit??1)}async function We(e,t){let{extensionContent:r}=e;return F.addPublicMetadata(()=>({cmd_scaffold_template_flavor:r.flavor,cmd_scaffold_type:e.extensionTemplate.identifier,cmd_scaffold_used_prompts_for_type:!t}))}function Be(e,t,r,n){return{app:t,project:r.project,cloneUrl:r.cloneUrl,extensionChoices:e.extensionContent,extensionTemplate:e.extensionTemplate,developerPlatformClient:n}}function He(e,t){if(t===void 0)return;let r=[...new Set(e.flatMap(n=>n.supportedFlavors.map(a=>a.value)))];if(!r.includes(t))throw new u("Invalid extension flavor",`Expected flavor to be one of the following: ${r.join(", ")}.`)}async function ze(e,t,r,n){if(!e)return;let a=r.find(i=>i.identifier===e);if(!a){let i=await Z(),s=r.map(l=>l.identifier),o=i?"You might need to enable some flags on your Organization or App":void 0;throw new u(`Unknown extension type: ${e}.
|
|
5
|
+
The following extension types are supported: ${s.join(", ")}`,o)}if(Pe(t,n,a))throw new u(`Invalid extension type: ${e}`,`You have reached the limit of extension(s) of type ${a.type} per app`);return a}var ke=Ve;p();var Fe=f.object({name:f.string().min(1).describe("The name selected for the generated extension."),type:f.string().min(1).describe("The extension type, such as function, theme, or ui_extension."),template:f.string().min(1).describe("The identifier of the selected extension template."),flavor:f.string().nullable().describe("The selected template flavor, or null when the template has no flavors."),directory:f.string().refine(D,"Expected an absolute filesystem path.").describe("The absolute native filesystem path of the generated extension directory.")}).strict(),_=G({name:"AppGenerateExtensionResult",schema:f.object({status:f.literal("success"),extension:Fe}).strict(),definitions:{GeneratedExtension:Fe}});p();function _e(e,t=!1){let{extension:r,packageManager:n}=e;if(t){ee(_.encode({status:e.status,extension:{name:r.name,type:r.extensionTemplate.type,template:r.extensionTemplate.identifier,flavor:r.flavor??null,directory:N($(),r.directory)}}));return}H(Xe(r.extensionTemplate,r.directory,n))}function Xe(e,t,r){let n={headline:["Your extension was created in",{filePath:t},{char:"."}],nextSteps:[],reference:[]};return e.type!=="function"&&n.nextSteps.push(["To preview this extension along with the rest of the project, run",{command:T(r,"shopify app dev")}]),e.supportLinks[0]&&n.reference.push(["For more details, see the",{link:{label:"docs",url:e.supportLinks[0]}}]),n}var g=Se(Re(),1);var M=class e extends ue{static summary="Generate a new app Extension.";static descriptionWithMarkdown=`Generates a new [app extension](https://shopify.dev/docs/apps/build/app-extensions). For a list of app extensions that you can generate using this command, refer to [Supported extensions](https://shopify.dev/docs/apps/build/app-extensions/list-of-app-extensions).
|
|
6
|
+
|
|
7
|
+
Each new app extension is created in a folder under \`extensions/\`. To learn more about the extensions file structure, refer to [App structure](https://shopify.dev/docs/apps/build/cli-for-apps/app-structure) and the documentation for your extension.
|
|
8
|
+
`;static get jsonOutputSchema(){return _}static description=this.descriptionForHelp();static flags={...te,...ie,...ne,template:A(g.Flags.string({char:"t",hidden:!1,description:"Extension template",env:"SHOPIFY_FLAG_EXTENSION_TEMPLATE"})),name:A(g.Flags.string({char:"n",hidden:!1,description:"name of your Extension",env:"SHOPIFY_FLAG_NAME"})),"clone-url":g.Flags.string({hidden:!0,char:"u",description:"The Git URL to clone the function extensions templates from. Defaults to: https://github.com/Shopify/function-examples",env:"SHOPIFY_FLAG_CLONE_URL"}),flavor:g.Flags.string({hidden:!1,description:"Choose a starting template for your extension, where applicable. Supported flavors depend on the selected extension template. Required if non interactive when the selected extension template supports multiple flavors.",options:[...ge],env:"SHOPIFY_FLAG_FLAVOR"})};async run(){let{flags:t}=await this.parse(e);await F.addPublicMetadata(()=>({cmd_scaffold_required_auth:!0,cmd_scaffold_template_custom:t["clone-url"]!==void 0,cmd_scaffold_type_owner:"@shopify/app"})),await pe(t.path);let{app:r,project:n,specifications:a,remoteApp:i,developerPlatformClient:s}=await me({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),o=await ke({directory:t.path,reset:t.reset,name:t.name,cloneUrl:t["clone-url"],template:t.template,flavor:t.flavor,app:r,project:n,specifications:a,remoteApp:i,developerPlatformClient:s});return _e(o,t.json),{app:r}}};export{M as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u}from"./chunk-43R5VGKT.js";import{b as r,c as I,e as p}from"./chunk-ZDQO6CNY.js";import{a as o}from"./chunk-JD5P5RAJ.js";import{g as c}from"./chunk-VKWPEFWQ.js";c();c();function i(t){return!(t===void 0||t.trim()==="")}function s(t,e){switch(t){case"bitbucket":return{branch:e.BITBUCKET_BRANCH,build:e.BITBUCKET_BUILD_NUMBER,commitSha:e.BITBUCKET_COMMIT,run:e.BITBUCKET_BUILD_NUMBER,url:`https://bitbucket.org/${e.BITBUCKET_WORKSPACE}/${e.BITBUCKET_REPO_SLUG}/pipelines/results/${e.BITBUCKET_BUILD_NUMBER}`};case"circleci":return{actor:e.CIRCLE_USERNAME,branch:e.CIRCLE_BRANCH,build:e.CIRCLE_BUILD_NUM,commitSha:e.CIRCLE_SHA1,run:e.CIRCLE_WORKFLOW_ID,url:e.CIRCLE_BUILD_URL};case"github":return{actor:e.GITHUB_ACTOR,attempt:e.GITHUB_RUN_ATTEMPT,branch:e.GITHUB_REF_NAME,build:e.GITHUB_RUN_ID,commitSha:e.GITHUB_SHA,run:e.GITHUB_RUN_ID,runNumber:e.GITHUB_RUN_NUMBER,url:`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`};case"gitlab":return{actor:e.GITLAB_USER_LOGIN,branch:e.CI_COMMIT_REF_NAME,build:e.CI_PIPELINE_ID,commitSha:e.CI_COMMIT_SHA,commitMessage:e.CI_COMMIT_MESSAGE,run:e.CI_RUNNER_ID,url:e.CI_PIPELINE_URL};case"buildkite":return{branch:e.BUILDKITE_BRANCH,build:e.BUILDKITE_BUILD_NUMBER,commitSha:e.BUILDKITE_COMMIT,commitMessage:e.BUILDKITE_MESSAGE,run:e.BUILDKITE_BUILD_NUMBER,url:e.BUILDKITE_BUILD_URL};default:return{}}}import{randomUUID as m}from"crypto";import{homedir as f,networkInterfaces as U}from"os";async function _(t){let{fileExists:e}=await import("./fs-
|
|
1
|
+
import{b as u}from"./chunk-43R5VGKT.js";import{b as r,c as I,e as p}from"./chunk-ZDQO6CNY.js";import{a as o}from"./chunk-JD5P5RAJ.js";import{g as c}from"./chunk-VKWPEFWQ.js";c();c();function i(t){return!(t===void 0||t.trim()==="")}function s(t,e){switch(t){case"bitbucket":return{branch:e.BITBUCKET_BRANCH,build:e.BITBUCKET_BUILD_NUMBER,commitSha:e.BITBUCKET_COMMIT,run:e.BITBUCKET_BUILD_NUMBER,url:`https://bitbucket.org/${e.BITBUCKET_WORKSPACE}/${e.BITBUCKET_REPO_SLUG}/pipelines/results/${e.BITBUCKET_BUILD_NUMBER}`};case"circleci":return{actor:e.CIRCLE_USERNAME,branch:e.CIRCLE_BRANCH,build:e.CIRCLE_BUILD_NUM,commitSha:e.CIRCLE_SHA1,run:e.CIRCLE_WORKFLOW_ID,url:e.CIRCLE_BUILD_URL};case"github":return{actor:e.GITHUB_ACTOR,attempt:e.GITHUB_RUN_ATTEMPT,branch:e.GITHUB_REF_NAME,build:e.GITHUB_RUN_ID,commitSha:e.GITHUB_SHA,run:e.GITHUB_RUN_ID,runNumber:e.GITHUB_RUN_NUMBER,url:`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`};case"gitlab":return{actor:e.GITLAB_USER_LOGIN,branch:e.CI_COMMIT_REF_NAME,build:e.CI_PIPELINE_ID,commitSha:e.CI_COMMIT_SHA,commitMessage:e.CI_COMMIT_MESSAGE,run:e.CI_RUNNER_ID,url:e.CI_PIPELINE_URL};case"buildkite":return{branch:e.BUILDKITE_BRANCH,build:e.BUILDKITE_BUILD_NUMBER,commitSha:e.BUILDKITE_COMMIT,commitMessage:e.BUILDKITE_MESSAGE,run:e.BUILDKITE_BUILD_NUMBER,url:e.BUILDKITE_BUILD_URL};default:return{}}}import{randomUUID as m}from"crypto";import{homedir as f,networkInterfaces as U}from"os";async function _(t){let{fileExists:e}=await import("./fs-XS5YF34R.js");return e(t)}async function T(t,e){let{exec:a}=await import("./system-466QKFDI.js");await a(t,e)}function N(){return!!(!u()&&process.stdout.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}function A(){return f()}var d,l;function y(){l=void 0}function B(t=process.env){return t[r.env]==="development"}function g(t=process.env){return t===process.env?d??=o(t[r.verbose])||process.argv.includes("--verbose"):o(t[r.verbose])||process.argv.includes("--verbose")}async function S(t=process.env){return Object.prototype.hasOwnProperty.call(t,r.runAsUser)?!o(t[r.runAsUser]):await _(p.executables.dev)}function K(t=process.env){return t===process.env?l??=o(t[r.unitTest]):o(t[r.unitTest])}function G(t=process.env){return o(t[r.noAnalytics])||o(t[r.optOutInstrumentation])||B(t)}function O(t=process.env){return o(t[r.alwaysLogAnalytics])}function H(t=process.env){return o(t[r.alwaysLogMetrics])}function w(t=process.env){return o(t[r.doctor])}function P(t=process.env){return t[r.gitpod]}function k(t=process.env){return t[r.codespaceName]}function z(t=process.env){return t[r.codespacePortForwardingDomain]}function F(t=process.env){return E(t).platform!=="localhost"}function $(t=process.env){return t[r.themeToken]}function E(t=process.env){return i(t[r.codespaces])?{platform:"codespaces",editor:!0}:i(t[r.gitpod])?{platform:"gitpod",editor:!0}:i(t[r.cloudShell])?{platform:"cloudShell",editor:!0}:{platform:"localhost",editor:!1}}async function V(){try{return await T("git",["--version"]),!0}catch{return!1}}function W(t=process.env){if(o(t.CI)){let e="unknown";return i(t.BITBUCKET_BUILD_NUMBER)?e="bitbucket":o(t.CIRCLECI)?e="circleci":i(t.GITHUB_ACTION)?e="github":o(t.GITLAB_CI)?e="gitlab":i(t.BUILDKITE)&&(e="buildkite"),{isCI:!0,name:e,metadata:s(e,t)}}else if(o(t.TF_BUILD))return{isCI:!0,name:"azure",metadata:s("azure",t)};return{isCI:!1}}async function j(){let t="00:00:00:00:00:00",e=Object.values(U()).flat().filter(n=>!!(n&&n.mac!==t));return(e.find(n=>!n.internal)??e[0])?.mac??m()}function Y(t=process.env){let e=t[r.themeKitAccessDomain];return i(e)?e:I}function q(t=process.env){let e=t[r.otelURL];return i(e)?e:"https://otlp-http-production-cli.shopifysvc.com"}export{N as a,A as b,y as c,B as d,g as e,S as f,K as g,G as h,O as i,H as j,w as k,P as l,k as m,z as n,F as o,$ as p,E as q,V as r,W as s,j as t,Y as u,q as v};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as h}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-ZJOX5HW4.js";import{b as u,c as m}from"./chunk-3KM5ZOW2.js";import{O as i}from"./chunk-D2KIGKBI.js";import{a as n}from"./chunk-BN7ZXAZJ.js";import{wb as p}from"./chunk-JLQRDFR5.js";import{b as s}from"./chunk-FZCGRIOM.js";import{b as g}from"./chunk-YTUUU33R.js";import{e as S,g as e}from"./chunk-VKWPEFWQ.js";e();e();async function f(t){let r=new URLSearchParams;return r.append("search",t??""),{url:`https://shopify.dev/docs?${r.toString()}`}}e();e();var o=n({name:"SearchResult",schema:s.object({url:s.string().url()})});async function l(t,r){r==="json"?p(o.encode(t)):await i(t.url)}var d=S(g(),1),a=class t extends h{static descriptionWithMarkdown="Search shopify.dev for the most relevant content matching a query. Best for discovery \u2014 surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`.";static description=this.descriptionForHelp();static usage="search [query]";static examples=[`# open the search modal on Shopify.dev
|
|
2
2
|
shopify search
|
|
3
3
|
|
|
4
4
|
# search for a term on Shopify.dev
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{a as V}from"./chunk-67L7FIB6.js";import{a as K}from"./chunk-VHZ6RL67.js";import{a as D}from"./chunk-NVKJ7ZLP.js";import{Ma as Y,i as m,ka as M}from"./chunk-U2T5HPRD.js";import{ea as W,ha as $,t as b}from"./chunk-33ZE3DRQ.js";import{G as F,H as O}from"./chunk-GQLNG537.js";import{a as f}from"./chunk-HSKDFEXW.js";import{b as R,c as L}from"./chunk-3KM5ZOW2.js";import{z as N}from"./chunk-D2KIGKBI.js";import{c as g}from"./chunk-GW7YIJPJ.js";import{a as _}from"./chunk-BN7ZXAZJ.js";import{Ib as k,L as w,N as x,rb as T,wb as U}from"./chunk-JLQRDFR5.js";import{b as e}from"./chunk-FZCGRIOM.js";import{b as ae}from"./chunk-YTUUU33R.js";import{f as u,i as P}from"./chunk-IWTNUJGY.js";import{e as se,g as c}from"./chunk-VKWPEFWQ.js";c();c();c();var l=e.record(e.unknown()),S=e.object({id:e.string(),name:e.string(),continueOnError:e.boolean().optional()}),J=e.array(e.object({lifecycle:e.literal("deploy"),steps:e.array(e.discriminatedUnion("type",[S.extend({type:e.literal("include_assets"),config:e.object({generatesAssetsManifest:e.boolean().optional(),inclusions:e.array(e.discriminatedUnion("type",[e.object({type:e.literal("pattern"),baseDir:e.string().optional(),include:e.array(e.string()).optional(),ignore:e.array(e.string()).optional(),destination:e.string().optional()}),e.object({type:e.literal("static"),source:e.string(),destination:e.string().optional()}),e.object({type:e.literal("configKey"),key:e.string(),destination:e.string().optional(),anchor:e.string().optional(),groupBy:e.string().optional(),preserveFilePaths:e.boolean().optional()})]))})}),S.extend({type:e.literal("bundle_ui"),config:e.object({generatesAssetsManifest:e.boolean().optional(),bundleFolder:e.string().optional()}).optional()}),S.extend({type:e.enum(["build_theme","bundle_theme","build_function","create_tax_stub"]),config:e.record(e.never()).optional()})]))})),A=e.object({identifier:e.string(),externalIdentifier:e.string(),externalName:e.string(),group:e.string().optional(),additionalIdentifiers:e.array(e.string()),partnersWebIdentifier:e.string(),surface:e.string(),registrationLimit:e.number(),experience:e.enum(["extension","configuration"]),uidStrategy:e.enum(["single","dynamic","uuid"]),dependency:e.string().optional(),graphQLType:e.string().optional(),clientSteps:J.optional(),loadedRemoteSpecs:e.boolean().optional()}),v=e.object({name:e.string(),type:e.string(),externalType:e.string(),humanName:e.string(),surface:e.string(),features:e.array(e.string()),dependency:e.string().optional(),entrySourceFilePath:e.string(),devUUID:e.string(),localIdentifier:e.string(),idEnvironmentVariableName:e.string(),directory:e.string(),configuration:l,configurationPath:e.string(),outputPath:e.string(),handle:e.string(),specification:A,uid:e.string()}).passthrough(),q=e.object({directory:e.string(),configuration:l.optional()}).passthrough(),Q=e.object({file:e.string(),message:e.string()}).passthrough(),h=e.object({id:e.string(),title:e.string(),apiKey:e.string(),organizationId:e.string(),appType:e.string().optional(),newApp:e.boolean().optional(),grantedScopes:e.array(e.string()),developmentStorePreviewEnabled:e.boolean().optional(),applicationUrl:e.string().optional(),redirectUrlWhitelist:e.array(e.string()).optional(),requestedAccessScopes:e.array(e.string()).optional(),webhookApiVersion:e.string().optional(),embedded:e.boolean().optional(),posEmbedded:e.boolean().optional(),preferencesUrl:e.string().optional(),gdprWebhooks:e.object({customerDeletionUrl:e.string().optional(),customerDataRequestUrl:e.string().optional(),shopDeletionUrl:e.string().optional()}).optional(),appProxy:e.object({subPath:e.string(),subPathPrefix:e.string(),url:e.string()}).optional(),configuration:l.optional(),flags:e.array(e.string())}),B=e.object({path:e.string(),message:e.string()}),I=e.object({path:e.string(),content:l,errors:e.array(B)}),G=e.object({directory:e.string(),appConfigFiles:e.array(I),extensionConfigFiles:e.array(I),webConfigFiles:e.array(I),dotenvFiles:e.array(e.object({path:e.string()})),errors:e.array(B)}),X=e.object({cliVersion:e.string(),nodeVersion:e.string(),platform:e.string(),arch:e.string(),shell:e.string().optional()}),H=e.object({remoteApp:h,account:e.discriminatedUnion("type",[e.object({type:e.literal("UserAccount"),email:e.string()}),e.object({type:e.literal("ServiceAccount"),orgName:e.string()}),e.object({type:e.literal("UnknownAccount")})]),project:G,system:X,devStoreUrl:e.string().optional(),name:e.string(),idEnvironmentVariableName:e.literal("SHOPIFY_API_KEY"),directory:e.string(),configPath:e.string(),configuration:l,webs:e.array(q),dotenv:e.object({path:e.string(),variables:e.record(e.string())}).passthrough().optional(),errors:e.object({errors:e.array(Q)}).passthrough(),specifications:e.array(A),remoteFlags:e.array(e.string()),realExtensions:e.array(v),devApplicationURLs:l.optional(),_hiddenConfig:l,packageManager:e.string(),nodeDependencies:e.record(e.string()),usesWorkspaces:e.boolean(),organization:e.object({id:e.string(),businessName:e.string(),source:e.string()}),allExtensions:e.array(v)}).passthrough(),z=e.object({SHOPIFY_API_KEY:e.string(),SHOPIFY_API_SECRET:e.string().optional(),SCOPES:e.string()}),d=_({name:"AppInfoResult",schema:e.union([z,H]),definitions:{AppInfo:H,AppInfoRemoteApp:h,AppInfoProject:G,AppInfoSystem:X,AppInfoWebEnvironment:z,AppInfoExtension:v,AppInfoSpecification:A,AppInfoClientSteps:J,AppInfoWeb:q,AppInfoConfigurationError:Q}});async function ee(r,t,o,n,i){if(i.webEnv){await M(t,o.source);let a=await W(t);return a||$(),{SHOPIFY_API_KEY:t.apiKey,...a?{SHOPIFY_API_SECRET:a}:{},SCOPES:m(r.configuration)}}let s={...r,packageManager:n.packageManager,nodeDependencies:n.nodeDependencies,usesWorkspaces:n.usesWorkspaces,organization:{id:o.id,businessName:o.businessName,source:o.source},remoteApp:h.parse(t),account:await t.developerPlatformClient.accountInfo(),project:{directory:n.directory,appConfigFiles:n.appConfigFiles.map(E),extensionConfigFiles:n.extensionConfigFiles.map(E),webConfigFiles:n.webConfigFiles.map(E),dotenvFiles:[...n.dotenvFiles.values()].map(({path:a})=>({path:a})),errors:(n.errors??[]).map(({path:a,message:ie})=>({path:a,message:ie}))},system:{cliVersion:f,nodeVersion:process.version,...g(),shell:process.env.SHELL},devStoreUrl:r.configuration.build?.dev_store_url??r.hiddenConfig.dev_store_url,allExtensions:Z(r.allExtensions.filter(a=>a.isReturnedAsInfo())),realExtensions:Z(r.realExtensions),specifications:r.specifications.map(te)},p=JSON.parse(JSON.stringify(Object.fromEntries(Object.entries(s).filter(([a])=>a!=="configSchema"))));return d.validate(p)}function te(r){return{identifier:r.identifier,externalIdentifier:r.externalIdentifier,externalName:r.externalName,group:r.group,additionalIdentifiers:r.additionalIdentifiers,partnersWebIdentifier:r.partnersWebIdentifier,surface:r.surface,registrationLimit:r.registrationLimit,experience:r.experience,uidStrategy:r.uidStrategy,dependency:r.dependency,graphQLType:r.graphQLType,clientSteps:r.clientSteps,..."loadedRemoteSpecs"in r?{loadedRemoteSpecs:r.loadedRemoteSpecs}:{}}}function E({path:r,content:t,errors:o}){return{path:r,content:t,errors:o.map(({path:n,message:i})=>({path:n,message:i}))}}function Z(r){return r.map(t=>({...t,name:t.name,type:t.type,externalType:t.externalType,humanName:t.humanName,surface:t.surface,features:t.features,dependency:t.dependency,specification:te(t.specification)}))}c();async function pe(r){let{app:t,remoteApp:o,organization:n,project:i}=r,s=await o.developerPlatformClient.accountInfo();return new C(t,o,n,i,s).output()}async function ne(r){N({customSections:await pe(r)})}function ce(r,t){if(t==="json")return d.encode(r);if(!("name"in r))return V({variables:Object.entries(r).map(([o,n])=>({name:o,value:n}))});throw new Error("App information text output requires the loaded app context.")}function oe(r,t){U(ce(r,t))}var le="unknown",y={subdued:"Not yet configured"},ue="NOT LOADED",C=class{app;remoteApp;organization;project;account;constructor(t,o,n,i,s){this.app=t,this.remoteApp=o,this.organization=n,this.project=i,this.account=s}async output(){return[...await this.devConfigsSection(),this.projectSettingsSection(),...await this.appComponentsSection(),await this.systemInfoSection()]}async devConfigsSection(){let t=y;this.app.configuration.build?.automatically_update_urls_on_dev!==void 0&&(t=this.app.configuration.build.automatically_update_urls_on_dev?"Yes":"No");let o=["User","unknown"],n=this.account;return O(n)?o=["Service account",n.orgName]:F(n)&&(o[1]=n.email),[this.tableSection("Current app configuration",[["Configuration file",{filePath:P(this.app.configPath)||b.app}],["App name",this.remoteApp.title?{userInput:this.remoteApp.title}:y],["Client ID",this.remoteApp.apiKey||y],["Organization",`${this.organization.businessName} (${this.organization.id})`],["Access scopes",m(this.app.configuration)],["Dev store",this.app.configuration.build?.dev_store_url??this.app.hiddenConfig.dev_store_url??y],["Update URLs",t],o],{isFirstItem:!0}),{body:["\u{1F4A1} To change these, run",{command:T(this.project.packageManager,"shopify app config link")}]}]}projectSettingsSection(){return this.tableSection("Your Project",[["Root location",{filePath:this.app.directory}]])}async appComponentsSection(){let t=this.webComponentsSection();return[{title:`
|
|
2
|
+
Directory components`.toUpperCase(),body:""},...t?[t]:[],...this.extensionsSections()]}webComponentsSection(){let t=[],o=[];if(this.app.webs[0])return this.app.webs.forEach(n=>{if(n.configuration)if(n.configuration.name){let{name:i,roles:s}=n.configuration,p=u(this.app.directory,n.directory);o.push([` \u{1F4C2} ${i}`,{filePath:p||"/"}]),s.length>0&&o.push([" roles",s.join(", ")])}else n.configuration.roles.forEach(i=>{o.push([` \u{1F4C2} ${i}`,{filePath:u(this.app.directory,n.directory)}])});else o.push([{subdued:` \u{1F4C2} ${le}`},{filePath:u(this.app.directory,n.directory)}]);if(!this.app.errors.isEmpty()){let i=this.app.errors.getErrors(`${n.directory}/${b.web}`);t.push(...i.map(s=>s.message))}}),this.subtableSection("web",[["\u{1F4C2} web",""],...o,...t.map(n=>[{error:"error"},{error:this.formattedError(n)}])])}extensionsSections(){let t=this.app.allExtensions.filter(i=>i.isReturnedAsInfo()),n=x(t.map(i=>i.type)).map(i=>{let s=t.filter(p=>p.type===i);if(s[0])return this.subtableSection(s[0].externalType,s.flatMap(p=>this.extensionSubSection(p)))});return w(n)}extensionSubSection(t){let o=t.configuration,n=[[`\u{1F4C2} ${t.handle||ue}`,{filePath:u(this.app.directory,t.directory)}],[" config file",{filePath:u(t.directory,t.configurationPath)}]];o&&"metafields"in o&&Array.isArray(o.metafields)&&o.metafields.length>0&&n.push([" metafields",`${o.metafields.length}`]);let i=this.app.errors.getErrors(t.configurationPath);for(let s of i)n.push([{error:" error"},{error:this.formattedError(s.message)}]);return n}formattedError(t){let o=t.trim();if(k())return o;let[n,...i]=o.split(`
|
|
3
|
+
`);return[`! ${n}`,...i.map(s=>` ${s}`)].join(`
|
|
4
|
+
`)}async systemInfoSection(){let{platform:t,arch:o}=g();return this.tableSection("Tooling and System",[["Shopify CLI",f],["Package manager",this.project.packageManager],["OS",`${t}-${o}`],["Shell",process.env.SHELL??"unknown"],["Node version",process.version]])}tableSection(t,o,{isFirstItem:n=!1}={}){return{title:`${n?"":`
|
|
5
|
+
`}${t.toUpperCase()}
|
|
6
|
+
`,body:{tabularData:o,firstColumnSubdued:!0}}}subtableSection(t,o){return{title:t,body:{tabularData:o,firstColumnSubdued:!0}}}};var re=se(ae(),1);var j=class r extends K{static summary="Print basic information about your app and extensions.";static descriptionWithMarkdown=`The information returned includes the following:
|
|
7
|
+
|
|
8
|
+
- The app and dev store that's used when you run the [dev](https://shopify.dev/docs/api/shopify-cli/app/app-dev) command. You can reset these configurations using [\`dev --reset\`](https://shopify.dev/docs/api/shopify-cli/app/app-dev#flags-propertydetail-reset).
|
|
9
|
+
- The [structure](https://shopify.dev/docs/apps/tools/cli/structure) of your app project.
|
|
10
|
+
- The [access scopes](https://shopify.dev/docs/api/usage) your app has requested.
|
|
11
|
+
- System information, including the package manager and version of Shopify CLI used in the project.`;static get jsonOutputSchema(){return d}static description=this.descriptionForHelp();static flags={...R,...D,...L,"web-env":re.Flags.boolean({hidden:!1,description:"Outputs environment variables necessary for running and deploying web/.",env:"SHOPIFY_FLAG_OUTPUT_WEB_ENV",default:!1})};async run(){let{flags:t}=await this.parse(r),{app:o,project:n,remoteApp:i,organization:s}=await Y({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config,unsafeTolerateErrors:!0});if(t.json||t["web-env"]){let p=await ee(o,i,s,n,{webEnv:t["web-env"]});oe(p,t.json?"json":"text")}else await ne({app:o,remoteApp:i,organization:s,project:n});return o.errors.isEmpty()||process.exit(2),{app:o}}};export{j as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Eb as f,db as E,pb as h,xb as g}from"./chunk-
|
|
1
|
+
import{Eb as f,db as E,pb as h,xb as g}from"./chunk-JLQRDFR5.js";import{b as P}from"./chunk-YTUUU33R.js";import{d as m}from"./chunk-IWTNUJGY.js";import{e as O,g as i}from"./chunk-VKWPEFWQ.js";i();i();i();var R=new Set(["THROTTLED","429"]),b=new Set(["ACCESS_DENIED","access_denied"]);function I(e){return Array.isArray(e)?e.flatMap(t=>{let s=[],n=t,r=n?.extensions?.code;typeof r=="string"&&s.push(r);let o=n?.extensions?.app_errors?.errors;if(Array.isArray(o))for(let p of o){let l=p?.category;typeof l=="string"&&s.push(l)}return s}):[]}function T(e){return e!==void 0&&R.has(e)}function _(e){return e!==void 0&&b.has(e)}function S(e){return I(e).some(T)}i();var C=new Set([502,503,504]);function x(e){return e!==void 0&&C.has(e)}var A=O(P(),1),a;(function(e){e[e.Abort=0]="Abort",e[e.AbortSilent=1]="AbortSilent",e[e.Bug=2]="Bug"})(a||(a={}));var y=class extends Error{},c=class extends Error{tryMessage;type;nextSteps;formattedMessage;customSections;code;details;skipOclifErrorHandling;constructor(t,s,n=null,r,o){let p=typeof t=="string"||"value"in t;super(p?f(t):E(t)),n?n instanceof h?this.tryMessage=f(n):this.tryMessage=n:this.tryMessage=null,this.type=s,this.nextSteps=r,this.customSections=o,this.skipOclifErrorHandling=!0,p||(this.formattedMessage=t)}},d=class extends c{constructor(t,s=null,n,r){super(t,a.Abort,s,n,r)}},w=class extends c{command;args;constructor(t,s,n,r=null){super(t,a.Abort,r),this.command=s,this.args=n}},M=class extends c{constructor(){super("",a.AbortSilent)}},u=class extends c{constructor(t,s=null){super(t,a.Bug,s)}};async function z(e){let t;if(k(e))t=e;else if(typeof e=="string")t=new u(e);else if(e instanceof Error)t=new u(e.message),t.stack=e.stack;else{let o=e;t=new u(o?.message??"Unknown error"),o?.stack&&(t.stack=o?.stack)}let{jsonOutputEnabled:s}=await import("./environment-O7ECODHU.js"),{commandEventOutputMode:n}=await import("./command-event-context-LFUZ7UCA.js");if(s()||n()==="json"){let{renderFatalErrorAsJson:o}=await import("./json-error-S5XFS3UX.js");return o(t),await g(),e}let{renderFatalError:r}=await import("./ui-VJTNGCS6.js");return r(t),Promise.resolve(e)}function J(e){if(e instanceof A.Errors.CLIError){let t=new d(e.message);return t.stack=e.stack,Promise.resolve(t)}else return Promise.resolve(e)}function k(e){try{return Object.prototype.hasOwnProperty.call(e,"type")}catch{return!1}}function Q(e){if(!k(e)){if(e instanceof Error){if(v(e))return!1;let t=e.message;return!L(t)}return!0}return e.type===a.Bug}function v(e){let t=e;if(typeof t.response!="object"||t.response===null||t.request===void 0)return!1;let s=t.response.status;return s===401||s===429||x(s)?!0:S(t.response.errors)}function W(e){return m(e).replace("file:/","/").replace(/^\/?[A-Z]:/,"")}function L(e){return["EPERM: operation not permitted, scandir","EPERM: operation not permitted, rename","EACCES: permission denied","EPERM: operation not permitted, symlink","This version of npm supports the following node versions","EBUSY: resource busy or locked","ENOTEMPTY: directory not empty","getaddrinfo ENOTFOUND","Client network socket disconnected before secure TLS connection was established","spawn EPERM","socket hang up","The user aborted a request.","write EPIPE","Unsupported platform"].some(n=>e.includes(n))}export{I as a,T as b,_ as c,x as d,a as e,y as f,c as g,d as h,w as i,M as j,u as k,z as l,J as m,Q as n,W as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as R}from"./chunk-
|
|
1
|
+
import{o as R}from"./chunk-USXIXANP.js";import{a as k}from"./chunk-PWAT52M4.js";import{c as D}from"./chunk-QW52RPAU.js";import{e as S}from"./chunk-QFWWCZOI.js";import{s as A}from"./chunk-H6GYBLVQ.js";import{r as v}from"./chunk-YKMINHYY.js";import{a as E}from"./chunk-YV2TP44L.js";import{N as g}from"./chunk-GQLNG537.js";import{A as b,B as P,C}from"./chunk-D2KIGKBI.js";import{Bb as M,ua as O,wb as j}from"./chunk-JLQRDFR5.js";import{b as e,i as T}from"./chunk-FZCGRIOM.js";import{c as u,e as h,g as y,p as w}from"./chunk-IWTNUJGY.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();import{resolve as x}from"node:path";var I=e.object({name:e.string(),category:e.string()}),L=e.object({key:e.string(),namespace:e.string(),name:e.string(),description:e.string().nullish(),type:I}),a={article:"ARTICLE",blog:"BLOG",collection:"COLLECTION",company:"COMPANY",company_location:"COMPANY_LOCATION",location:"LOCATION",market:"MARKET",order:"ORDER",page:"PAGE",product:"PRODUCT",variant:"PRODUCTVARIANT",shop:"SHOP"},$=e.object(Object.fromEntries(Object.keys(a).map(t=>[t,e.array(L)]))),N=e.object({ownerType:e.string().describe("The upstream owner type, such as PRODUCT or COMPANY_LOCATION."),key:e.string(),namespace:e.string(),name:e.string(),description:e.string().nullable(),type:e.object({name:e.string().describe("The upstream metafield type, such as single_line_text_field."),category:e.string().describe("The upstream metafield category.")}).strict()}).strict(),F=S({name:"ThemeMetafieldsPullResult",schema:e.union([e.object({status:e.enum(["success","partial"]),changed:e.literal(!0),path:e.string().refine(y).describe("The absolute path of the native language-server metafields JSON artifact."),definitions:e.array(N).describe("All fetched definitions, flattened across owner types."),failedOwnerTypes:e.array(e.string()).describe("Upstream owner types whose fetch failed.")}).strict(),e.object({status:e.literal("skipped"),reason:e.literal("not-a-theme")}).strict()]),definitions:{MetafieldDefinition:N},project:t=>{let i=t;if(i.status==="failed")throw new Error("Failed downloads must use the fatal error envelope.");return i.status==="skipped"?i.reason==="cancelled"?{status:"cancelled"}:{status:"skipped",reason:i.reason}:{status:i.failedOwnerTypes.length?"partial":"success",changed:!0,path:x(i.path),definitions:Object.entries(i.definitions).flatMap(([r,o])=>o.map(n=>({ownerType:a[r],key:n.key,namespace:n.namespace,name:n.name,description:n.description??null,type:{name:n.type.name,category:n.type.category}}))),failedOwnerTypes:i.failedOwnerTypes}}});s();function _(t,i,r=!1){t.status==="downloaded"&&t.failedOwnerTypes.length>0&&M(`Failed to fetch metafield definitions for the following owner types: ${t.failedOwnerTypes.join(", ")}`),!r&&(i==="json"?(t.status==="failed"&&T({type:"diagnostic",level:"error",message:"Failed to fetch metafield definitions."}),j(F.encode(t))):t.status==="downloaded"?t.failedOwnerTypes.length>0?P({body:`Metafield definitions were partially downloaded. Failed owner types: ${t.failedOwnerTypes.join(", ")}.`}):b({body:"Metafield definitions have been successfully downloaded."}):t.status==="failed"&&C({body:"Failed to fetch metafield definitions.",nextSteps:["Check your network connection and try again.","Ensure you have the permission to fetch metafield definitions."],reference:[{link:{label:"Metafield Definition API",url:"https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition"}}]}))}s();async function me(t){let i=await J(t);_(i,"text",t.silent)}async function J(t){k({verbose:t.verbose,noColor:t.noColor});let i=v({store:t.store}),r=await g(i,t.password);return U(r,{path:h(t.path??w()),force:t.force??!1})}async function U(t,i){let{force:r,path:o}=i;if(!await R(o)){if(process.env.SHOPIFY_LANGUAGE_SERVER==="1")return{status:"skipped",reason:"not-a-theme"};if(!await D(r))return{status:"skipped",reason:"cancelled"}}let n=[],f=[];for(let[l,c]of Object.entries(a))n.push(A(c,t).catch(m=>(f.push(c),[])).then(m=>({[l]:m})));let p=(await Promise.all(n)).reduce((l,c)=>({...l,...c})),d=Object.values(a).filter(l=>f.includes(l));return d.length===Object.values(a).length?{status:"failed",failedOwnerTypes:d}:{status:"downloaded",path:await G(o,p),definitions:p,failedOwnerTypes:d}}async function G(t,i){let r=await E(t),o=u(r,"metafields.json"),n=JSON.stringify(i,null,2);return O(o,n),o}export{F as a,_ as b,me as c,J as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _,j as B,n as $}from"./chunk-
|
|
1
|
+
import{a as _,j as B,n as $}from"./chunk-USXIXANP.js";import{e as U,f as C}from"./chunk-IJY3RJPJ.js";import{e as y}from"./chunk-QW52RPAU.js";import{l as v,m as P}from"./chunk-H6GYBLVQ.js";import{xa as E}from"./chunk-GQLNG537.js";import{Bb as m}from"./chunk-JLQRDFR5.js";import{g as T}from"./chunk-VKWPEFWQ.js";T();var w=20,L=1024*1024,A=2;function re(t,e,r,s,o={},l){let n=_(r),i=new Map,c=!1,u=a=>{c||=a.success,i.set(a.key,a)},g=a=>a.total===0?"[100%]":`[${Math.round(a.current/a.total*100)}%]`,h=S(t,e,n).then(a=>{a.forEach(u)}),p=Promise.all([s.ready(),h]).then(()=>I(n,s,t,e,u)),d=p.then(a=>a.promise).then(()=>x(n,s,t,e,o,u)),f=o?.deferPartialWork?h:d.then(a=>a.promise);return o?.backgroundWorkCatch&&Promise.all([h,p.then(a=>a.promise),d.then(a=>a.promise)]).catch(o.backgroundWorkCatch),{uploadResults:i,get hasChanges(){return c},workPromise:f,renderThemeSyncProgress:async()=>{if(o?.deferPartialWork)return;let{progress:a,promise:F}=await p,k=o.multiEnvironment?4e3:1e3;await y(b({promise:F,titleGetter:()=>`Uploading files to remote theme ${g(a)}`,updateInterval:k}),l?.stderr,o?.multiEnvironment);let{progress:J,promise:j}=await d;await y(b({promise:j,titleGetter:()=>`Cleaning your remote theme ${g(J)}`,updateInterval:k}),l?.stderr,o?.multiEnvironment),await y([{title:"Theme upload complete",task:async()=>{}}],l?.stderr,o?.multiEnvironment),G(i,o?.environment)}}}function b({promise:t,titleGetter:e,updateInterval:r}){let s=[],o=()=>{s.push({title:e(),task:async(l,n)=>{await Promise.race([t,new Promise(c=>setTimeout(()=>c("timeout"),r))])==="timeout"?o():n.title=e()}})};return o(),s}function x(t,e,r,s,o,l){if(o.nodelete)return{progress:{current:0,total:0},promise:Promise.resolve()};let n=R(t,e),i=D(n),c={current:0,total:i.length};if(i.length===0)return{progress:c,promise:Promise.resolve()};let u=[];for(let h=0;h<i.length;h+=w){let p=i.slice(h,h+w),d=v(r.id,p.map(f=>f.key),s).then(f=>{f.forEach(a=>{if(l(a),!a.success){let F=a.errors?.asset?.map(k=>`-${k}`).join(`
|
|
2
2
|
`);C(a.key,"delete")(new Error(`Failed to delete ${a.key}: ${F}`))}}),c.current+=p.length});u.push(d)}let g=Promise.all(u).then(()=>{c.current=c.total});return{progress:c,promise:g}}function R(t,e){let s=e.applyIgnoreFilters(t).filter(o=>!e.files.has(o.key));return m(`Files to be deleted:
|
|
3
3
|
${s.map(o=>`-${o.key}`).join(`
|
|
4
4
|
`)}`),s}function D(t){let e=$(t);return[...e.contextualizedJsonFiles,...e.templateJsonFiles,...e.sectionJsonFiles,...e.otherJsonFiles,...e.sectionLiquidFiles,...e.blockLiquidFiles,...e.layoutFiles,...e.otherLiquidFiles,...e.configDataFile,...e.configStylesheetFiles,...e.documentationFiles,...e.configSchemaFile,...e.staticAssetFiles]}var q=[{key:"config/settings_schema.json",value:"[]"},{key:"layout/password.liquid",value:"{{ content_for_header }}{{ content_for_layout }}"},{key:"layout/theme.liquid",value:"{{ content_for_header }}{{ content_for_layout }}"}];async function S(t,e,r){let s=new Set(r.map(l=>l.key)),o=q.filter(({key:l})=>!s.has(l));return o.length>0?P(t.id,o,e):[]}function I(t,e,r,s,o){let l=z(e,t);e.unsyncedFileKeys.clear(),l.forEach(d=>e.unsyncedFileKeys.add(d.key));let{independentFiles:n,dependentFiles:i}=K(l),c={current:0,total:l.length},u=d=>d.length===0?Promise.resolve():Promise.all(N(d).map(f=>H(f,e,s,r.id,o).then(()=>{c.current+=f.length,f.forEach(a=>e.unsyncedFileKeys.delete(a.key))}))).then(()=>{}),g=i.reduce((d,f)=>d.then(()=>u(f)),Promise.resolve()),h=Promise.resolve().then(()=>u(n.flat())),p=Promise.all([g,h]).then(()=>{c.current=c.total});return{progress:c,promise:p}}function z(t,e){let r=W(t),s=t.applyIgnoreFilters(r),o=new Map(e.map(n=>[n.key,n])),l=s.filter(n=>{let i=o.get(n.key);return!i||i.checksum!==n.checksum});return m(`Files to be uploaded:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as L}from"./chunk-
|
|
1
|
+
import{a as L}from"./chunk-26PWHH3B.js";import{N as H}from"./chunk-U2T5HPRD.js";import{t as W}from"./chunk-33ZE3DRQ.js";import{a as X}from"./chunk-VJEKDBGZ.js";import{a as D,d as T,x as k}from"./chunk-D2KIGKBI.js";import{h as S}from"./chunk-M5VIFG2V.js";import{Ba as I,Bb as p,Sa as A,Ta as y,ab as w,ma as O,va as g}from"./chunk-JLQRDFR5.js";import{g as N}from"./chunk-LHXFTFFM.js";import{c as x,d as m,f as v,h as P}from"./chunk-IWTNUJGY.js";import{e as J,g as u}from"./chunk-VKWPEFWQ.js";u();function _(){return process.hrtime()}function U(r){let t=process.hrtime(r);return(t[0]*1e3+t[1]/1e6).toFixed(2)}u();u();var $=J(X(),1),q=200,K=6e4,M=200,Y=500,Q=["**/node_modules/**","**/.git/**","**/.shopify/**","**/.DS_Store","**/*.swp","**/*.swo","**/*~"],b=class{currentEvents=[];extensionPaths=[];app;options;onChangeCallback;watcher;debouncedEmit;ignored={};extensionWatchedFiles=new Map;constructor(t,e,s=q){this.app=t,this.options=e,this.debouncedEmit=k(this.emitEvents.bind(this),s,{leading:!0,trailing:!0}),this.updateApp(t)}onChange(t){this.onChangeCallback=t}async start(){let e=[...this.app.configuration.extension_directories??["extensions"]].map(a=>x(this.app.directory,a));await Promise.all(e.map(async a=>{try{await g(a.replace(/\/\*+$/,""))}catch{}}));let s=[this.app.configPath,...e],i=this.getAllWatchedFiles();s.push(...i),this.close();let{default:n}=await import("./chokidar-5RWEYTNQ.js"),o=new Map;this.watcher=n.watch(s,{ignored:[...Q,a=>{let d=m(a);return this.app.realExtensions.some(c=>{if(!c.isFunctionExtension)return!1;let h=m(x(c.directory,P(c.outputRelativePath)));return d===h||d.startsWith(`${h}/`)})||Z(d,o)}],persistent:!0,ignoreInitial:!0}),this.watcher.on("all",this.handleFileEvent),this.addAbortListener(),p(`File watcher started with ${s.length} paths`,this.options.stdout)}updateApp(t){this.app=t,this.extensionPaths=this.app.nonConfigExtensions.map(e=>m(e.directory)).filter(e=>e!==this.app.directory),this.extensionPaths.forEach(e=>{this.ignored[e]??=this.createIgnoreInstance(e)})}addAbortListener(){this.options.signal.removeEventListener("abort",this.close),this.options.signal.addEventListener("abort",this.close)}getAllWatchedFiles(){this.extensionWatchedFiles.clear();let t=this.app.realExtensions.map(s=>({extension:s,watchedFiles:s.watchedFiles()})),e=new Set;for(let{extension:s,watchedFiles:i}of t)for(let n of i){let o=m(n);e.add(o);let a=this.extensionWatchedFiles.get(o)??new Set;a.add(s.handle),this.extensionWatchedFiles.set(o,a)}return Array.from(e)}emitEvents=()=>{let t=this.currentEvents;this.currentEvents=[];let e=`\u{1F509} ${t.length} EVENTS EMITTED in files: ${t.map(s=>s.path).join(`
|
|
2
2
|
`)}`;p(e,this.options.stdout),this.onChangeCallback?.(t)};pushEvent(t){this.shouldIgnoreEvent(t)||(t.type==="extension_folder_created"&&(this.ignored[t.path]=this.createIgnoreInstance(t.path)),!this.currentEvents.some(e=>e.path===t.path&&e.type===t.type&&e.extensionHandle===t.extensionHandle)&&this.currentEvents.push(t))}shouldIgnoreEvent(t){if(t.type==="extension_folder_deleted"||t.type==="extension_folder_created"||t.extensionHandle&&this.extensionWatchedFiles.get(m(t.path))?.has(t.extensionHandle))return!1;let s=(t.extensionHandle?this.app.realExtensions.find(n=>n.handle===t.extensionHandle):void 0)?.watchedFiles(),i=this.ignored[t.extensionPath];if(s)return!s.some(o=>w(t.path,o));if(i){let n=v(t.extensionPath,t.path);return i.ignores(n)}return!1}handleFileEvent=(t,e)=>{let s=_(),i=m(e),n=e===this.app.configPath,o=e.endsWith(".extension.toml");if(p(`\u{1F300}: ${t} ${e.replace(this.app.directory,"")}
|
|
3
3
|
`),n)this.handleEventForExtension(t,e,this.app.directory,s,!1);else{let a=this.extensionWatchedFiles.get(i),d=a===void 0||a.size===0;if(d&&t==="add"&&!o){let l=this.discoverFileOwners(i);l.size>0&&(this.extensionWatchedFiles.set(i,l),a=l,d=!1)}if(d&&!o&&!n){p(`\u{1F300}: File ${e} is not watched by any extension`,this.options.stdout);return}for(let l of a??[]){let c=this.app.realExtensions.find(E=>E.handle===l),h=c?m(c.directory):this.app.directory;this.handleEventForExtension(t,e,h,s,!1,l)}d&&this.handleEventForExtension(t,e,this.app.directory,s,!0)}this.debouncedEmit()};discoverFileOwners(t){let e=new Set;for(let s of this.app.realExtensions){let i=m(s.directory);i!==this.app.directory&&t.startsWith(`${i}/`)&&this.pathMatchesWatchPatterns(t,s)&&e.add(s.handle)}return e}pathMatchesWatchPatterns(t,e){let{paths:s,ignore:i}=e.watchPatterns(),n=v(m(e.directory),t);return i.some(o=>w(n,o))?!1:s.some(o=>w(n,o))}handleEventForExtension(t,e,s,i,n,o){let a=e.endsWith(".extension.toml"),d=e===this.app.configPath;switch(t){case"change":if(n)break;a||d?this.pushEvent({type:"extensions_config_updated",path:e,extensionPath:s,extensionHandle:o,startTime:i}):this.pushEvent({type:"file_updated",path:e,extensionPath:s,extensionHandle:o,startTime:i});break;case"add":if(!a){this.pushEvent({type:"file_created",path:e,extensionPath:s,extensionHandle:o,startTime:i});break}let l=0,c=P(e),h=setInterval(()=>{y(x(c,W.lockFile))?(p(`Waiting for extension to complete creation: ${e}
|
|
4
4
|
`),l+=M):(clearInterval(h),this.extensionPaths.push(c),this.pushEvent({type:"extension_folder_created",path:c,extensionPath:s,startTime:i}),this.debouncedEmit()),l>=K&&(clearInterval(h),this.options.stderr.write(`Error loading new extension at path: ${e}.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as yo}from"./chunk-RJ5VF3QY.js";import{h as nn,k as _o}from"./chunk-2VSNFOKD.js";import{$a as mo,Bb as Ve,Qa as tn,Ra as ur,Ta as rn,sb as Fe}from"./chunk-LWCTKI4Z.js";import{g as go}from"./chunk-3A3DZVEJ.js";import{a as cr,b as po}from"./chunk-ZDQO6CNY.js";import{e as ar,h as en}from"./chunk-IWTNUJGY.js";import{a as Rc}from"./chunk-CX5CC6P5.js";import{c as g,e as Qr,g as u}from"./chunk-VKWPEFWQ.js";var kt=g(q=>{"use strict";u();Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var Ot=class{};q._CodeOrName=Ot;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ge=class extends Ot{constructor(e){if(super(),!q.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=Ge;var se=class extends Ot{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ge&&(r[n.str]=(r[n.str]||0)+1),r),{})}};q._Code=se;q.nil=new se("");function xo(t,...e){let r=[t[0]],n=0;for(;n<e.length;)_n(r,e[n]),r.push(t[++n]);return new se(r)}q._=xo;var yn=new se("+");function zo(t,...e){let r=[Tt(t[0])],n=0;for(;n<e.length;)r.push(yn),_n(r,e[n]),r.push(yn,Tt(t[++n]));return Lc(r),new se(r)}q.str=zo;function _n(t,e){e instanceof se?t.push(...e._items):e instanceof Ge?t.push(e):t.push(Hc(e))}q.addCodeArg=_n;function Lc(t){let e=1;for(;e<t.length-1;){if(t[e]===yn){let r=Kc(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Kc(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ge||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ge))return`"${t}${e.slice(1)}`}function Gc(t,e){return e.emptyStr()?t:t.emptyStr()?e:zo`${t}${e}`}q.strConcat=Gc;function Hc(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Tt(Array.isArray(t)?t.join(","):t)}function Wc(t){return new se(Tt(t))}q.stringify=Wc;function Tt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q.safeStringify=Tt;function Jc(t){return typeof t=="string"&&q.IDENTIFIER.test(t)?new se(`.${t}`):xo`[${t}]`}q.getProperty=Jc;function Yc(t){if(typeof t=="string"&&q.IDENTIFIER.test(t))return new se(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}q.getEsmExportName=Yc;function Bc(t){return new se(t.toString())}q.regexpCode=Bc});var vn=g(Q=>{"use strict";u();Object.defineProperty(Q,"__esModule",{value:!0});Q.ValueScope=Q.ValueScopeName=Q.Scope=Q.varKinds=Q.UsedValueState=void 0;var Z=kt(),gn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},hr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(hr||(Q.UsedValueState=hr={}));Q.varKinds={const:new Z.Name("const"),let:new Z.Name("let"),var:new Z.Name("var")};var pr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Z.Name?e:this.name(e)}name(e){return new Z.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Q.Scope=pr;var mr=class extends Z.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Z._)`.${new Z.Name(r)}[${n}]`}};Q.ValueScopeName=mr;var Xc=(0,Z._)`\n`,$n=class extends pr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Xc:Z.nil}}get(){return this._scope}name(e){return new mr(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let d=a.get(i);if(d)return d}else a=this._values[o]=new Map;a.set(i,s);let c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=r.ref,s.setValue(r,{property:o,itemIndex:l}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Z._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let o=Z.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,hr.Started);let d=r(l);if(d){let f=this.opts.es5?Q.varKinds.var:Q.varKinds.const;o=(0,Z._)`${o}${f} ${l} = ${d};${this.opts._n}`}else if(d=s?.(l))o=(0,Z._)`${o}${d}${this.opts._n}`;else throw new gn(l);c.set(l,hr.Completed)})}return o}};Q.ValueScope=$n});var b=g(P=>{"use strict";u();Object.defineProperty(P,"__esModule",{value:!0});P.or=P.and=P.not=P.CodeGen=P.operators=P.varKinds=P.ValueScopeName=P.ValueScope=P.Scope=P.Name=P.regexpCode=P.stringify=P.getProperty=P.nil=P.strConcat=P.str=P._=void 0;var O=kt(),le=vn(),ke=kt();Object.defineProperty(P,"_",{enumerable:!0,get:function(){return ke._}});Object.defineProperty(P,"str",{enumerable:!0,get:function(){return ke.str}});Object.defineProperty(P,"strConcat",{enumerable:!0,get:function(){return ke.strConcat}});Object.defineProperty(P,"nil",{enumerable:!0,get:function(){return ke.nil}});Object.defineProperty(P,"getProperty",{enumerable:!0,get:function(){return ke.getProperty}});Object.defineProperty(P,"stringify",{enumerable:!0,get:function(){return ke.stringify}});Object.defineProperty(P,"regexpCode",{enumerable:!0,get:function(){return ke.regexpCode}});Object.defineProperty(P,"Name",{enumerable:!0,get:function(){return ke.Name}});var $r=vn();Object.defineProperty(P,"Scope",{enumerable:!0,get:function(){return $r.Scope}});Object.defineProperty(P,"ValueScope",{enumerable:!0,get:function(){return $r.ValueScope}});Object.defineProperty(P,"ValueScopeName",{enumerable:!0,get:function(){return $r.ValueScopeName}});Object.defineProperty(P,"varKinds",{enumerable:!0,get:function(){return $r.varKinds}});P.operators={GT:new O._Code(">"),GTE:new O._Code(">="),LT:new O._Code("<"),LTE:new O._Code("<="),EQ:new O._Code("==="),NEQ:new O._Code("!=="),NOT:new O._Code("!"),OR:new O._Code("||"),AND:new O._Code("&&"),ADD:new O._Code("+")};var Pe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},wn=class extends Pe{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?le.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=ot(this.rhs,e,r)),this}get names(){return this.rhs instanceof O._CodeOrName?this.rhs.names:{}}},yr=class extends Pe{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof O.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ot(this.rhs,e,r),this}get names(){let e=this.lhs instanceof O.Name?{}:{...this.lhs.names};return gr(e,this.rhs)}},En=class extends yr{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Sn=class extends Pe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},bn=class extends Pe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Pn=class extends Pe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Nn=class extends Pe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=ot(this.code,e,r),this}get names(){return this.code instanceof O._CodeOrName?this.code.names:{}}},Rt=class extends Pe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(e,r)||(Zc(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Je(e,r.names),{})}},Ne=class extends Rt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},In=class extends Rt{},st=class extends Ne{};st.kind="else";var He=class t extends Ne{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new st(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Fo(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=ot(this.condition,e,r),this}get names(){let e=super.names;return gr(e,this.condition),this.else&&Je(e,this.else.names),e}};He.kind="if";var We=class extends Ne{};We.kind="for";var On=class extends We{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=ot(this.iteration,e,r),this}get names(){return Je(super.names,this.iteration.names)}},Tn=class extends We{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?le.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return`for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=gr(super.names,this.from);return gr(e,this.to)}},_r=class extends We{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=ot(this.iterable,e,r),this}get names(){return Je(super.names,this.iterable.names)}},jt=class extends Ne{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};jt.kind="func";var qt=class extends Rt{render(e){return"return "+super.render(e)}};qt.kind="return";var kn=class extends Ne{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Je(e,this.catch.names),this.finally&&Je(e,this.finally.names),e}},At=class extends Ne{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};At.kind="catch";var Ct=class extends Ne{render(e){return"finally"+super.render(e)}};Ct.kind="finally";var Rn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
1
|
+
import{a as yo}from"./chunk-RJ5VF3QY.js";import{h as nn,k as _o}from"./chunk-M5VIFG2V.js";import{$a as mo,Bb as Ve,Qa as tn,Ra as ur,Ta as rn,sb as Fe}from"./chunk-JLQRDFR5.js";import{g as go}from"./chunk-LHXFTFFM.js";import{a as cr,b as po}from"./chunk-ZDQO6CNY.js";import{e as ar,h as en}from"./chunk-IWTNUJGY.js";import{a as Rc}from"./chunk-CX5CC6P5.js";import{c as g,e as Qr,g as u}from"./chunk-VKWPEFWQ.js";var kt=g(q=>{"use strict";u();Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var Ot=class{};q._CodeOrName=Ot;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ge=class extends Ot{constructor(e){if(super(),!q.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=Ge;var se=class extends Ot{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ge&&(r[n.str]=(r[n.str]||0)+1),r),{})}};q._Code=se;q.nil=new se("");function xo(t,...e){let r=[t[0]],n=0;for(;n<e.length;)_n(r,e[n]),r.push(t[++n]);return new se(r)}q._=xo;var yn=new se("+");function zo(t,...e){let r=[Tt(t[0])],n=0;for(;n<e.length;)r.push(yn),_n(r,e[n]),r.push(yn,Tt(t[++n]));return Lc(r),new se(r)}q.str=zo;function _n(t,e){e instanceof se?t.push(...e._items):e instanceof Ge?t.push(e):t.push(Hc(e))}q.addCodeArg=_n;function Lc(t){let e=1;for(;e<t.length-1;){if(t[e]===yn){let r=Kc(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Kc(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ge||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ge))return`"${t}${e.slice(1)}`}function Gc(t,e){return e.emptyStr()?t:t.emptyStr()?e:zo`${t}${e}`}q.strConcat=Gc;function Hc(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Tt(Array.isArray(t)?t.join(","):t)}function Wc(t){return new se(Tt(t))}q.stringify=Wc;function Tt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q.safeStringify=Tt;function Jc(t){return typeof t=="string"&&q.IDENTIFIER.test(t)?new se(`.${t}`):xo`[${t}]`}q.getProperty=Jc;function Yc(t){if(typeof t=="string"&&q.IDENTIFIER.test(t))return new se(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}q.getEsmExportName=Yc;function Bc(t){return new se(t.toString())}q.regexpCode=Bc});var vn=g(Q=>{"use strict";u();Object.defineProperty(Q,"__esModule",{value:!0});Q.ValueScope=Q.ValueScopeName=Q.Scope=Q.varKinds=Q.UsedValueState=void 0;var Z=kt(),gn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},hr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(hr||(Q.UsedValueState=hr={}));Q.varKinds={const:new Z.Name("const"),let:new Z.Name("let"),var:new Z.Name("var")};var pr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Z.Name?e:this.name(e)}name(e){return new Z.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Q.Scope=pr;var mr=class extends Z.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Z._)`.${new Z.Name(r)}[${n}]`}};Q.ValueScopeName=mr;var Xc=(0,Z._)`\n`,$n=class extends pr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Xc:Z.nil}}get(){return this._scope}name(e){return new mr(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let d=a.get(i);if(d)return d}else a=this._values[o]=new Map;a.set(i,s);let c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=r.ref,s.setValue(r,{property:o,itemIndex:l}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Z._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let o=Z.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,hr.Started);let d=r(l);if(d){let f=this.opts.es5?Q.varKinds.var:Q.varKinds.const;o=(0,Z._)`${o}${f} ${l} = ${d};${this.opts._n}`}else if(d=s?.(l))o=(0,Z._)`${o}${d}${this.opts._n}`;else throw new gn(l);c.set(l,hr.Completed)})}return o}};Q.ValueScope=$n});var b=g(P=>{"use strict";u();Object.defineProperty(P,"__esModule",{value:!0});P.or=P.and=P.not=P.CodeGen=P.operators=P.varKinds=P.ValueScopeName=P.ValueScope=P.Scope=P.Name=P.regexpCode=P.stringify=P.getProperty=P.nil=P.strConcat=P.str=P._=void 0;var O=kt(),le=vn(),ke=kt();Object.defineProperty(P,"_",{enumerable:!0,get:function(){return ke._}});Object.defineProperty(P,"str",{enumerable:!0,get:function(){return ke.str}});Object.defineProperty(P,"strConcat",{enumerable:!0,get:function(){return ke.strConcat}});Object.defineProperty(P,"nil",{enumerable:!0,get:function(){return ke.nil}});Object.defineProperty(P,"getProperty",{enumerable:!0,get:function(){return ke.getProperty}});Object.defineProperty(P,"stringify",{enumerable:!0,get:function(){return ke.stringify}});Object.defineProperty(P,"regexpCode",{enumerable:!0,get:function(){return ke.regexpCode}});Object.defineProperty(P,"Name",{enumerable:!0,get:function(){return ke.Name}});var $r=vn();Object.defineProperty(P,"Scope",{enumerable:!0,get:function(){return $r.Scope}});Object.defineProperty(P,"ValueScope",{enumerable:!0,get:function(){return $r.ValueScope}});Object.defineProperty(P,"ValueScopeName",{enumerable:!0,get:function(){return $r.ValueScopeName}});Object.defineProperty(P,"varKinds",{enumerable:!0,get:function(){return $r.varKinds}});P.operators={GT:new O._Code(">"),GTE:new O._Code(">="),LT:new O._Code("<"),LTE:new O._Code("<="),EQ:new O._Code("==="),NEQ:new O._Code("!=="),NOT:new O._Code("!"),OR:new O._Code("||"),AND:new O._Code("&&"),ADD:new O._Code("+")};var Pe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},wn=class extends Pe{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?le.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=ot(this.rhs,e,r)),this}get names(){return this.rhs instanceof O._CodeOrName?this.rhs.names:{}}},yr=class extends Pe{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof O.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ot(this.rhs,e,r),this}get names(){let e=this.lhs instanceof O.Name?{}:{...this.lhs.names};return gr(e,this.rhs)}},En=class extends yr{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Sn=class extends Pe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},bn=class extends Pe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Pn=class extends Pe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Nn=class extends Pe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=ot(this.code,e,r),this}get names(){return this.code instanceof O._CodeOrName?this.code.names:{}}},Rt=class extends Pe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(e,r)||(Zc(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Je(e,r.names),{})}},Ne=class extends Rt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},In=class extends Rt{},st=class extends Ne{};st.kind="else";var He=class t extends Ne{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new st(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Fo(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=ot(this.condition,e,r),this}get names(){let e=super.names;return gr(e,this.condition),this.else&&Je(e,this.else.names),e}};He.kind="if";var We=class extends Ne{};We.kind="for";var On=class extends We{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=ot(this.iteration,e,r),this}get names(){return Je(super.names,this.iteration.names)}},Tn=class extends We{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?le.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return`for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=gr(super.names,this.from);return gr(e,this.to)}},_r=class extends We{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=ot(this.iterable,e,r),this}get names(){return Je(super.names,this.iterable.names)}},jt=class extends Ne{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};jt.kind="func";var qt=class extends Rt{render(e){return"return "+super.render(e)}};qt.kind="return";var kn=class extends Ne{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Je(e,this.catch.names),this.finally&&Je(e,this.finally.names),e}},At=class extends Ne{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};At.kind="catch";var Ct=class extends Ne{render(e){return"finally"+super.render(e)}};Ct.kind="finally";var Rn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
2
|
`:""},this._extScope=e,this._scope=new le.Scope({parent:e}),this._nodes=[new In]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,s){let o=this._scope.toName(r);return n!==void 0&&s&&(this._constants[o.str]=n),this._leafNode(new wn(e,o,n)),o}const(e,r,n){return this._def(le.varKinds.const,e,r,n)}let(e,r,n){return this._def(le.varKinds.let,e,r,n)}var(e,r,n){return this._def(le.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new yr(e,r,n))}add(e,r){return this._leafNode(new En(e,P.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==O.nil&&this._leafNode(new Nn(e)),this}object(...e){let r=["{"];for(let[n,s]of e)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0,O.addCodeArg)(r,s));return r.push("}"),new O._Code(r)}if(e,r,n){if(this._blockNode(new He(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new He(e))}else(){return this._elseNode(new st)}endIf(){return this._endBlockNode(He,st)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new On(e),r)}forRange(e,r,n,s,o=this.opts.es5?le.varKinds.var:le.varKinds.let){let i=this._scope.toName(e);return this._for(new Tn(o,i,r,n),()=>s(i))}forOf(e,r,n,s=le.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let i=r instanceof O.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,O._)`${i}.length`,a=>{this.var(o,(0,O._)`${i}[${a}]`),n(o)})}return this._for(new _r("of",s,o,r),()=>n(o))}forIn(e,r,n,s=this.opts.es5?le.varKinds.var:le.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,O._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new _r("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(We)}label(e){return this._leafNode(new Sn(e))}break(e){return this._leafNode(new bn(e))}return(e){let r=new qt;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(qt)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new kn;if(this._blockNode(s),this.code(e),r){let o=this.name("e");this._currNode=s.catch=new At(o),r(o)}return n&&(this._currNode=s.finally=new Ct,this.code(n)),this._endBlockNode(At,Ct)}throw(e){return this._leafNode(new Pn(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=O.nil,n,s){return this._blockNode(new jt(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(jt)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof He))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};P.CodeGen=Rn;function Je(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function gr(t,e){return e instanceof O._CodeOrName?Je(t,e.names):t}function ot(t,e,r){if(t instanceof O.Name)return n(t);if(!s(t))return t;return new O._Code(t._items.reduce((o,i)=>(i instanceof O.Name&&(i=n(i)),i instanceof O._Code?o.push(...i._items):o.push(i),o),[]));function n(o){let i=r[o.str];return i===void 0||e[o.str]!==1?o:(delete e[o.str],i)}function s(o){return o instanceof O._Code&&o._items.some(i=>i instanceof O.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Zc(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Fo(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,O._)`!${jn(t)}`}P.not=Fo;var Qc=Vo(P.operators.AND);function eu(...t){return t.reduce(Qc)}P.and=eu;var tu=Vo(P.operators.OR);function ru(...t){return t.reduce(tu)}P.or=ru;function Vo(t){return(e,r)=>e===O.nil?r:r===O.nil?e:(0,O._)`${jn(e)} ${t} ${jn(r)}`}function jn(t){return t instanceof O.Name?t:(0,O._)`(${t})`}});var k=g(N=>{"use strict";u();Object.defineProperty(N,"__esModule",{value:!0});N.checkStrictMode=N.getErrorPath=N.Type=N.useFunc=N.setEvaluated=N.evaluatedPropsToName=N.mergeEvaluated=N.eachItem=N.unescapeJsonPointer=N.escapeJsonPointer=N.escapeFragment=N.unescapeFragment=N.schemaRefOrVal=N.schemaHasRulesButRef=N.schemaHasRules=N.checkUnknownRules=N.alwaysValidSchema=N.toHash=void 0;var C=b(),nu=kt();function su(t){let e={};for(let r of t)e[r]=!0;return e}N.toHash=su;function ou(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ko(t,e),!Go(e,t.self.RULES.all))}N.alwaysValidSchema=ou;function Ko(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let s=n.RULES.keywords;for(let o in e)s[o]||Jo(t,`unknown keyword: "${o}"`)}N.checkUnknownRules=Ko;function Go(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}N.schemaHasRules=Go;function iu(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}N.schemaHasRulesButRef=iu;function au({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,C._)`${r}`}return(0,C._)`${t}${e}${(0,C.getProperty)(n)}`}N.schemaRefOrVal=au;function cu(t){return Ho(decodeURIComponent(t))}N.unescapeFragment=cu;function uu(t){return encodeURIComponent(An(t))}N.escapeFragment=uu;function An(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}N.escapeJsonPointer=An;function Ho(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}N.unescapeJsonPointer=Ho;function lu(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}N.eachItem=lu;function Uo({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof C.Name?(o instanceof C.Name?t(s,o,i):e(s,o,i),i):o instanceof C.Name?(e(s,i,o),o):r(o,i);return a===C.Name&&!(c instanceof C.Name)?n(s,c):c}}N.mergeEvaluated={props:Uo({mergeNames:(t,e,r)=>t.if((0,C._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,C._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,C._)`${r} || {}`).code((0,C._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,C._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,C._)`${r} || {}`),Cn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Wo}),items:Uo({mergeNames:(t,e,r)=>t.if((0,C._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,C._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,C._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,C._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Wo(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,C._)`{}`);return e!==void 0&&Cn(t,r,e),r}N.evaluatedPropsToName=Wo;function Cn(t,e,r){Object.keys(r).forEach(n=>t.assign((0,C._)`${e}${(0,C.getProperty)(n)}`,!0))}N.setEvaluated=Cn;var Lo={};function du(t,e){return t.scopeValue("func",{ref:e,code:Lo[e.code]||(Lo[e.code]=new nu._Code(e.code))})}N.useFunc=du;var qn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(qn||(N.Type=qn={}));function fu(t,e,r){if(t instanceof C.Name){let n=e===qn.Num;return r?n?(0,C._)`"[" + ${t} + "]"`:(0,C._)`"['" + ${t} + "']"`:n?(0,C._)`"/" + ${t}`:(0,C._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,C.getProperty)(t).toString():"/"+An(t)}N.getErrorPath=fu;function Jo(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}N.checkStrictMode=Jo});var Ie=g(Dn=>{"use strict";u();Object.defineProperty(Dn,"__esModule",{value:!0});var H=b(),hu={data:new H.Name("data"),valCxt:new H.Name("valCxt"),instancePath:new H.Name("instancePath"),parentData:new H.Name("parentData"),parentDataProperty:new H.Name("parentDataProperty"),rootData:new H.Name("rootData"),dynamicAnchors:new H.Name("dynamicAnchors"),vErrors:new H.Name("vErrors"),errors:new H.Name("errors"),this:new H.Name("this"),self:new H.Name("self"),scope:new H.Name("scope"),json:new H.Name("json"),jsonPos:new H.Name("jsonPos"),jsonLen:new H.Name("jsonLen"),jsonPart:new H.Name("jsonPart")};Dn.default=hu});var Dt=g(W=>{"use strict";u();Object.defineProperty(W,"__esModule",{value:!0});W.extendErrors=W.resetErrorsCount=W.reportExtraError=W.reportError=W.keyword$DataError=W.keywordError=void 0;var R=b(),vr=k(),Y=Ie();W.keywordError={message:({keyword:t})=>(0,R.str)`must pass "${t}" keyword validation`};W.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,R.str)`"${t}" keyword must be ${e} ($data)`:(0,R.str)`"${t}" keyword is invalid ($data)`};function pu(t,e=W.keywordError,r,n){let{it:s}=t,{gen:o,compositeRule:i,allErrors:a}=s,c=Xo(t,e,r);n??(i||a)?Yo(o,c):Bo(s,(0,R._)`[${c}]`)}W.reportError=pu;function mu(t,e=W.keywordError,r){let{it:n}=t,{gen:s,compositeRule:o,allErrors:i}=n,a=Xo(t,e,r);Yo(s,a),o||i||Bo(n,Y.default.vErrors)}W.reportExtraError=mu;function yu(t,e){t.assign(Y.default.errors,e),t.if((0,R._)`${Y.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,R._)`${Y.default.vErrors}.length`,e),()=>t.assign(Y.default.vErrors,null)))}W.resetErrorsCount=yu;function _u({gen:t,keyword:e,schemaValue:r,data:n,errsCount:s,it:o}){if(s===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",s,Y.default.errors,a=>{t.const(i,(0,R._)`${Y.default.vErrors}[${a}]`),t.if((0,R._)`${i}.instancePath === undefined`,()=>t.assign((0,R._)`${i}.instancePath`,(0,R.strConcat)(Y.default.instancePath,o.errorPath))),t.assign((0,R._)`${i}.schemaPath`,(0,R.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,R._)`${i}.schema`,r),t.assign((0,R._)`${i}.data`,n))})}W.extendErrors=_u;function Yo(t,e){let r=t.const("err",e);t.if((0,R._)`${Y.default.vErrors} === null`,()=>t.assign(Y.default.vErrors,(0,R._)`[${r}]`),(0,R._)`${Y.default.vErrors}.push(${r})`),t.code((0,R._)`${Y.default.errors}++`)}function Bo(t,e){let{gen:r,validateName:n,schemaEnv:s}=t;s.$async?r.throw((0,R._)`new ${t.ValidationError}(${e})`):(r.assign((0,R._)`${n}.errors`,e),r.return(!1))}var Ye={keyword:new R.Name("keyword"),schemaPath:new R.Name("schemaPath"),params:new R.Name("params"),propertyName:new R.Name("propertyName"),message:new R.Name("message"),schema:new R.Name("schema"),parentSchema:new R.Name("parentSchema")};function Xo(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,R._)`{}`:gu(t,e,r)}function gu(t,e,r={}){let{gen:n,it:s}=t,o=[$u(s,r),vu(t,r)];return wu(t,e,o),n.object(...o)}function $u({errorPath:t},{instancePath:e}){let r=e?(0,R.str)`${t}${(0,vr.getErrorPath)(e,vr.Type.Str)}`:t;return[Y.default.instancePath,(0,R.strConcat)(Y.default.instancePath,r)]}function vu({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let s=n?e:(0,R.str)`${e}/${t}`;return r&&(s=(0,R.str)`${s}${(0,vr.getErrorPath)(r,vr.Type.Str)}`),[Ye.schemaPath,s]}function wu(t,{params:e,message:r},n){let{keyword:s,data:o,schemaValue:i,it:a}=t,{opts:c,propertyName:l,topSchemaRef:d,schemaPath:f}=a;n.push([Ye.keyword,s],[Ye.params,typeof e=="function"?e(t):e||(0,R._)`{}`]),c.messages&&n.push([Ye.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Ye.schema,i],[Ye.parentSchema,(0,R._)`${d}${f}`],[Y.default.data,o]),l&&n.push([Ye.propertyName,l])}});var Qo=g(it=>{"use strict";u();Object.defineProperty(it,"__esModule",{value:!0});it.boolOrEmptySchema=it.topBoolOrEmptySchema=void 0;var Eu=Dt(),Su=b(),bu=Ie(),Pu={message:"boolean schema is false"};function Nu(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Zo(t,!1):typeof r=="object"&&r.$async===!0?e.return(bu.default.data):(e.assign((0,Su._)`${n}.errors`,null),e.return(!0))}it.topBoolOrEmptySchema=Nu;function Iu(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Zo(t)):r.var(e,!0)}it.boolOrEmptySchema=Iu;function Zo(t,e){let{gen:r,data:n}=t,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Eu.reportError)(s,Pu,void 0,e)}});var Mn=g(at=>{"use strict";u();Object.defineProperty(at,"__esModule",{value:!0});at.getRules=at.isJSONType=void 0;var Ou=["string","number","integer","boolean","null","object","array"],Tu=new Set(Ou);function ku(t){return typeof t=="string"&&Tu.has(t)}at.isJSONType=ku;function Ru(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}at.getRules=Ru});var xn=g(Re=>{"use strict";u();Object.defineProperty(Re,"__esModule",{value:!0});Re.shouldUseRule=Re.shouldUseGroup=Re.schemaHasRulesForType=void 0;function ju({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&ei(t,n)}Re.schemaHasRulesForType=ju;function ei(t,e){return e.rules.some(r=>ti(t,r))}Re.shouldUseGroup=ei;function ti(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Re.shouldUseRule=ti});var Mt=g(J=>{"use strict";u();Object.defineProperty(J,"__esModule",{value:!0});J.reportTypeError=J.checkDataTypes=J.checkDataType=J.coerceAndCheckDataType=J.getJSONTypes=J.getSchemaTypes=J.DataType=void 0;var qu=Mn(),Au=xn(),Cu=Dt(),S=b(),ri=k(),ct;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(ct||(J.DataType=ct={}));function Du(t){let e=ni(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}J.getSchemaTypes=Du;function ni(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(qu.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}J.getJSONTypes=ni;function Mu(t,e){let{gen:r,data:n,opts:s}=t,o=xu(e,s.coerceTypes),i=e.length>0&&!(o.length===0&&e.length===1&&(0,Au.schemaHasRulesForType)(t,e[0]));if(i){let a=Fn(e,n,s.strictNumbers,ct.Wrong);r.if(a,()=>{o.length?zu(t,e,o):Vn(t)})}return i}J.coerceAndCheckDataType=Mu;var si=new Set(["string","number","integer","boolean","null"]);function xu(t,e){return e?t.filter(r=>si.has(r)||e==="array"&&r==="array"):[]}function zu(t,e,r){let{gen:n,data:s,opts:o}=t,i=n.let("dataType",(0,S._)`typeof ${s}`),a=n.let("coerced",(0,S._)`undefined`);o.coerceTypes==="array"&&n.if((0,S._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,S._)`${s}[0]`).assign(i,(0,S._)`typeof ${s}`).if(Fn(e,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,S._)`${a} !== undefined`);for(let l of r)(si.has(l)||l==="array"&&o.coerceTypes==="array")&&c(l);n.else(),Vn(t),n.endIf(),n.if((0,S._)`${a} !== undefined`,()=>{n.assign(s,a),Fu(t,a)});function c(l){switch(l){case"string":n.elseIf((0,S._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,S._)`"" + ${s}`).elseIf((0,S._)`${s} === null`).assign(a,(0,S._)`""`);return;case"number":n.elseIf((0,S._)`${i} == "boolean" || ${s} === null
|
|
3
3
|
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,S._)`+${s}`);return;case"integer":n.elseIf((0,S._)`${i} === "boolean" || ${s} === null
|
|
4
4
|
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,S._)`+${s}`);return;case"boolean":n.elseIf((0,S._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,S._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,S._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,S._)`${i} === "string" || ${i} === "number"
|