@shopify/cli
Version:
A CLI tool to build for the Shopify platform
2 lines (1 loc) • 4.19 kB
JavaScript
import{a as U}from"../../../../chunk-3NBK56IK.js";import{b as F,c as P,d as w}from"../../../../chunk-UHJYPEY2.js";import{a as y}from"../../../../chunk-G4BPGWJC.js";import{a as h}from"../../../../chunk-AGNMOFJS.js";import{Ca as x}from"../../../../chunk-54CAKCYR.js";import"../../../../chunk-7ESSIN27.js";import"../../../../chunk-GZS44BUW.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-7QIOUDCX.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-DCPBRWVC.js";import"../../../../chunk-KR6QDE7D.js";import"../../../../chunk-UXVZ2P63.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-EKXY5COY.js";import"../../../../chunk-4DCQNGUV.js";import"../../../../chunk-QBSKKQBN.js";import"../../../../chunk-FQWB2F75.js";import"../../../../chunk-XONFGLJQ.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-L2MGAEV3.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-ZSBA6VIC.js";import"../../../../chunk-F2QU6WWX.js";import"../../../../chunk-XULPJ6UG.js";import{b as l,c as m}from"../../../../chunk-XR6GMMEU.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-MHWV5RQV.js";import"../../../../chunk-XOTA6JTZ.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import{B as g,I as d}from"../../../../chunk-6G6TMKXF.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-WSDN25F5.js";import"../../../../chunk-M56NDIMD.js";import"../../../../chunk-PD5ZHJWI.js";import{r as k}from"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-OBEWZXOQ.js";import{Qb as n}from"../../../../chunk-N5PQPIBF.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YTNDFQJT.js";import"../../../../chunk-ULQG3XQS.js";import"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{e as b,g as f}from"../../../../chunk-VPRTJUIN.js";f();var a=b(k(),1);var r="_start",s=class v extends y{static{this.summary="Run a function locally for testing."}static{this.descriptionWithMarkdown="Runs the function from your current directory for [testing purposes](https://shopify.dev/docs/apps/functions/testing-and-debugging). To learn how you can monitor and debug functions when errors occur, refer to [Shopify Functions error handling](https://shopify.dev/docs/api/functions/errors)."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...l,...h,...F,...m,input:a.Flags.string({char:"i",description:"The input JSON to pass to the function. If omitted, standard input is used.",env:"SHOPIFY_FLAG_INPUT"}),export:a.Flags.string({char:"e",hidden:!1,description:"Name of the WebAssembly export to invoke.",env:"SHOPIFY_FLAG_EXPORT"})}}async run(){let{flags:t}=await this.parse(v),o=r,{app:p}=await x({directory:t.path,userProvidedConfigName:t.config}),e=await P(p,t.path);if(t.export!==void 0)n(`Using export ${t.export} from the --export flag.`),o=t.export;else if(e.configuration.targeting!==void 0&&e.configuration.targeting.length>0){let i=e.configuration.targeting;if(i.length>1&&d({})){let T=i.map(u=>({label:u.target,value:u.export||r}));o=await g({message:"Which target would you like to execute?",choices:T})}else o=i?.[0]?.export||r,n(`Using export '${o}'. Use the --export flag or an interactive terminal to select a different export.`)}else n(`No targeting information found. Using the default export '${o}'. Use the --export flag or an interactive terminal to select a different export.`);let c=e?.configuration.targeting?.[0]?.input_query,A=c&&`${e?.directory}/${c}`,O=await w(e,t.path,t["client-id"],t.reset,t.config);return await U({functionExtension:e,json:t.json,inputPath:t.input,export:o,stdin:"inherit",schemaPath:O,queryPath:A}),{app:p}}};export{s as default};