@shopify/cli
Version:
A CLI tool to build for the Shopify platform
4 lines (3 loc) • 8.99 kB
JavaScript
import{a as l,c as a,d as B,f as C}from"./chunk-ULQG3XQS.js";import{a as I,c as d,e as Q,g as u}from"./chunk-VPRTJUIN.js";var b=d((he,R)=>{"use strict";u();var g={},X=process.nextTick||global.setImmediate||global.setTimeout;g.nextTick=function(e){X(e)};g.parallel=function(e,r){var n=[],t=[],i=0,o=0;function c(s,f,m){f?t[s]=f:n[s]=m,o+=1,o>=i&&r((t.length>0,t),n)}Object.keys(e).forEach(function(s){i+=1;var f=e[s];g.nextTick(function(){f(c.bind(null,s),1)})})};g.promisify=function(e){return new Promise(function(r,n){e(function(t,i){if(t){!t instanceof Error&&(t=new Error(t)),n(t);return}r(i)})})};g.iterate=function(e,r,n){var t=[],i=function(){if(e.length===0){g.nextTick(n.bind(null,t));return}var o=e.shift();if(typeof o=="function"){o(function(c,s){if(c)t.push(c);else for(;s.length>0;)e.unshift(s.pop());i()});return}r(o,function(c,s){c?(t.push(c),i()):g.nextTick(n.bind(null,null,s))})};g.nextTick(i)};R.exports=g});var L=d((_e,y)=>{u();var Z=I("child_process").execFile,ee=/[-\/\\^$*+?.()|[\]{}]/g;function re(e){return e.replace(ee,"\\$&")}y.exports=function(e,r){Z("ipconfig",["/all"],function(n,t){if(n){r(n,null);return}var i=new RegExp(re(e)).exec(t);if(!i){r("did not find interface in `ipconfig /all`",null);return}if(t=t.substring(i.index+e.length),i=/[A-Fa-f0-9]{2}(\-[A-Fa-f0-9]{2}){5}/.exec(t),!i){r("did not find a mac address",null);return}r(null,i[0].toLowerCase().replace(/\-/g,":"))})}});var A=d((ve,w)=>{u();var te=I("child_process").execFile;w.exports=function(e,r){te("/bin/cat",["/sys/class/net/"+e+"/address"],function(n,t){if(n){r(n,null);return}r(null,t.trim().toLowerCase())})}});var U=d((Ce,M)=>{u();var ne=I("child_process").execFile;M.exports=function(e,r){ne("ifconfig",[e],function(n,t){if(n){r(n,null);return}var i=/[a-f0-9]{2}(:[a-f0-9]{2}){5}/.exec(t.toLowerCase());if(!i){r("did not find a mac address",null);return}r(null,i[0].toLowerCase())})}});var S=d((be,O)=>{u();var ie=I("os"),h,N="^[a-z0-9]+$";switch(ie.platform()){case"win32":N="^[a-z0-9 -]+$",h=L();break;case"linux":h=A();break;case"darwin":case"sunos":case"freebsd":h=U();break;default:console.warn("node-macaddress: Unknown os.platform(), defaulting to 'unix'."),h=U();break}var D=new RegExp(N,"i");O.exports=function(e,r){if(!D.test(e)){r(new Error(["invalid iface: '",e,"' (must conform to reg exp /",D,"/)"].join("")),null);return}h(e,r)}});var q=d((Le,k)=>{"use strict";u();var oe=I("child_process").execFile;k.exports=function(e){oe("wmic",["nic","get","NetConnectionID"],function(r,n){if(r){e(r,null);return}for(var t=n.trim().replace(/\s{2,}/g,`
`).split(`
`).slice(1),i=[],o=0;o<t.length;o+=1){var c=t[o].trim();c!==""&&i.push(c)}e(null,i)})}});var K=d((Ae,F)=>{u();var se=I("child_process").execFile;F.exports=function(e){se("/bin/ls",["/sys/class/net"],function(r,n){if(r){e(r,null);return}for(var t=n.split(/[ \t\n]+/),i=[],o=0;o<t.length;o+=1){var c=t[o].trim();c!==""&&i.push(c)}e(null,i)})}});var v=d((De,G)=>{"use strict";u();var ue=I("child_process").execFile;G.exports=function(e){ue("/sbin/ifconfig",["-l"],function(r,n){if(r){e(r,null);return}for(var t=n.split(/[ \t]+/),i=[],o=0;o<t.length;o+=1){var c=t[o].trim();c!==""&&i.push(c)}e(null,i)})}});var P=d((Oe,H)=>{u();var ae=I("os"),T;switch(ae.platform()){case"win32":T=q();break;case"linux":T=K();break;case"darwin":case"sunos":case"freebsd":T=v();break;default:console.warn("node-macaddress: Unknown os.platform(), defaulting to 'unix'."),T=v();break}H.exports=T});var j=d((ke,$)=>{u();var ce=I("os");$.exports=function(){var e={};try{var r=ce.networkInterfaces()}catch(n){if(n.syscall==="uv_interface_addresses")return e;throw n}return Object.keys(r).forEach(function(n){var t={},i=!1;r[n].forEach(function(o){if(!o.internal){var c=typeof o.family=="number"?"ipv"+o.family:(o.family||"").toLowerCase();t[c]=o.address,i=!0,o.mac&&o.mac!=="00:00:00:00:00:00"&&(t.mac=o.mac)}}),i&&(e[n]=t)}),e}});var V=d((Fe,z)=>{"use strict";u();var E=b(),p={};p.getMacAddress=S();p.getAllInterfaces=P();p.networkInterfaces=j();var fe=new RegExp("^((en|eth)[0-9]+|ethernet)$","i"),le=new RegExp("^(vboxnet[0-9]+)$","i");p.one=function(){var e=null,r=null;if(arguments.length>=1&&(typeof arguments[0]=="function"?r=arguments[0]:typeof arguments[0]=="string"&&(e=arguments[0]),arguments.length>=2&&typeof arguments[1]=="function"&&(r=arguments[1])),!r)return E.promisify(function(s){p.one(e,s)});if(e){p.getMacAddress(e,r);return}var n=p.networkInterfaces(),t={},i=[],o=[];if(Object.keys(n).forEach(function(s){o.push(s);var f=0,m=n[s];typeof m.mac=="string"&&m.mac!=="00:00:00:00:00:00"&&(t[s]=m.mac,m.ipv4&&(f+=1),m.ipv6&&(f+=1),fe.test(s)&&(f+=2),le.test(s)&&(f-=3),i.push({name:s,score:f,mac:m.mac}))}),i.length>0){i.sort(function(s,f){var m=f.score-s.score;return m!==0?m:s.name<f.name?-1:s.name>f.name?1:0}),E.nextTick(r.bind(null,null,i[0].mac));return}o.push(p.getAllInterfaces);var c=function(s,f){if(t[s]){f(null,t[s]);return}p.getMacAddress(s,f)};E.iterate(o,c,r)};p.all=function(e){if(typeof e!="function")return E.promisify(p.all);var r=p.networkInterfaces(),n={};return Object.keys(r).forEach(function(t){r[t].mac||(n[t]=p.getMacAddress.bind(null,t))}),Object.keys(n).length===0?(typeof e=="function"&&E.nextTick(e.bind(null,null,r)),r):(E.parallel(n,function(t,i){Object.keys(i).forEach(function(o){r[o].mac=i[o]}),typeof e=="function"&&e(null,r)}),null)};z.exports=p});u();u();function x(e){return!(e===void 0||e.trim()==="")}function _(e,r){switch(e){case"bitbucket":return{branch:r.BITBUCKET_BRANCH,build:r.BITBUCKET_BUILD_NUMBER,commitSha:r.BITBUCKET_COMMIT,run:r.BITBUCKET_BUILD_NUMBER,url:`https://bitbucket.org/${r.BITBUCKET_WORKSPACE}/${r.BITBUCKET_REPO_SLUG}/pipelines/results/${r.BITBUCKET_BUILD_NUMBER}`};case"circleci":return{actor:r.CIRCLE_USERNAME,branch:r.CIRCLE_BRANCH,build:r.CIRCLE_BUILD_NUM,commitSha:r.CIRCLE_SHA1,run:r.CIRCLE_WORKFLOW_ID,url:r.CIRCLE_BUILD_URL};case"github":return{actor:r.GITHUB_ACTOR,attempt:r.GITHUB_RUN_ATTEMPT,branch:r.GITHUB_REF_NAME,build:r.GITHUB_RUN_ID,commitSha:r.GITHUB_SHA,run:r.GITHUB_RUN_ID,runNumber:r.GITHUB_RUN_NUMBER,url:`${r.GITHUB_SERVER_URL}/${r.GITHUB_REPOSITORY}/actions/runs/${r.GITHUB_RUN_ID}`};case"gitlab":return{actor:r.GITLAB_USER_LOGIN,branch:r.CI_COMMIT_REF_NAME,build:r.CI_PIPELINE_ID,commitSha:r.CI_COMMIT_SHA,commitMessage:r.CI_COMMIT_MESSAGE,run:r.CI_RUNNER_ID,url:r.CI_PIPELINE_URL};case"buildkite":return{branch:r.BUILDKITE_BRANCH,build:r.BUILDKITE_BUILD_NUMBER,commitSha:r.BUILDKITE_COMMIT,commitMessage:r.BUILDKITE_MESSAGE,run:r.BUILDKITE_BUILD_NUMBER,url:r.BUILDKITE_BUILD_URL};default:return{}}}var J=Q(V(),1);import{homedir as pe}from"os";async function me(e){let{fileExists:r}=await import("./fs-H7V6IRSH.js");return r(e)}async function de(e,r){let{exec:n}=await import("./system-E6Q3OBX3.js");await n(e,r)}function je(){return!!(process.stdout.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}function ze(){return pe()}var W,Y;function Ie(e=process.env){return e[a.env]==="development"}function Ve(e=process.env){return e===process.env?W??(W=l(e[a.verbose])||process.argv.includes("--verbose")):l(e[a.verbose])||process.argv.includes("--verbose")}async function We(e=process.env){return Object.prototype.hasOwnProperty.call(e,a.runAsUser)?!l(e[a.runAsUser]):await me(C.executables.dev)}function Ye(e=process.env){return e===process.env?Y??(Y=l(e[a.unitTest])):l(e[a.unitTest])}function Je(e=process.env){return l(e[a.noAnalytics])||l(e[a.optOutInstrumentation])||Ie(e)}function Qe(e=process.env){return l(e[a.alwaysLogAnalytics])}function Xe(e=process.env){return l(e[a.alwaysLogMetrics])}function Ze(e=process.env){return l(e[a.firstPartyDev])}function er(e=process.env){return l(e[a.doctor])}function rr(e=process.env){return e[a.gitpod]}function tr(e=process.env){return e[a.codespaceName]}function nr(e=process.env){return e[a.codespacePortForwardingDomain]}function ir(e=process.env){return xe(e).platform!=="localhost"}function or(e=process.env){return e[a.themeToken]}function xe(e=process.env){return x(e[a.codespaces])?{platform:"codespaces",editor:!0}:x(e[a.gitpod])?{platform:"gitpod",editor:!0}:x(e[a.cloudShell])?{platform:"cloudShell",editor:!0}:{platform:"localhost",editor:!1}}async function sr(){try{return await de("git",["--version"]),!0}catch{return!1}}function ur(e=process.env){if(l(e.CI)){let r="unknown";return x(e.BITBUCKET_BUILD_NUMBER)?r="bitbucket":l(e.CIRCLECI)?r="circleci":x(e.GITHUB_ACTION)?r="github":l(e.GITLAB_CI)?r="gitlab":x(e.BUILDKITE)&&(r="buildkite"),{isCI:!0,name:r,metadata:_(r,e)}}else if(l(e.TF_BUILD))return{isCI:!0,name:"azure",metadata:_("azure",e)};return{isCI:!1}}function ar(){return J.default.one()}function cr(e=process.env){let r=e[a.themeKitAccessDomain];return x(r)?r:B}function fr(e=process.env){let r=e[a.otelURL];return x(r)?r:"https://otlp-http-production-cli.shopifysvc.com"}export{je as a,ze as b,Ie as c,Ve as d,We as e,Ye as f,Je as g,Qe as h,Xe as i,Ze as j,er as k,rr as l,tr as m,nr as n,ir as o,or as p,xe as q,sr as r,ur as s,ar as t,cr as u,fr as v};