@junobuild/cli 0.0.41 → 0.0.42

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -222,7 +222,7 @@ variant ${r} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.displ
222
222
  globstar while`,t,E,r,g,B),this.matchOne(t.slice(E),r.slice(g),n))return this.debug("globstar found match!",E,u,B),!0;if(B==="."||B===".."||!i.dot&&B.charAt(0)==="."){this.debug("dot detected!",t,E,r,g);break}this.debug("globstar swallow a segment, and continue"),E++}return!!(n&&(this.debug(`
223
223
  >>> no match, partial?`,t,E,r,g),E===u))}let Q;if(typeof d=="string"?(Q=h===d,this.debug("string match",d,h,Q)):(Q=d.test(h),this.debug("pattern match",d,h,Q)),!Q)return!1}if(o===u&&a===l)return!0;if(o===u)return n;if(a===l)return o===u-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Pz(this.pattern,this.options)}parse(t){kA(t);let r=this.options;if(t==="**")return ys;if(t==="")return"";let n,i=null;(n=t.match(MDe))?i=r.dot?jDe:qDe:(n=t.match(SDe))?i=(r.nocase?r.dot?FDe:TDe:r.dot?QDe:DDe)(n[1]):(n=t.match(LDe))?i=(r.nocase?r.dot?UDe:$De:r.dot?GDe:HDe)(n):(n=t.match(RDe))?i=r.dot?NDe:ODe:(n=t.match(PDe))&&(i=kDe);let s=mp.fromGlob(t,this.options).toMMPattern();return i?Object.assign(s,{test:i}):s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?zDe:r.dot?JDe:KDe,i=new Set(r.nocase?["i"]:[]),s=t.map(u=>{let l=u.map(d=>{if(d instanceof RegExp)for(let h of d.flags.split(""))i.add(h);return typeof d=="string"?t2e(d):d===ys?ys:d._src});return l.forEach((d,h)=>{let E=l[h+1],g=l[h-1];d!==ys||g===ys||(g===void 0?E!==void 0&&E!==ys?l[h+1]="(?:\\/|"+n+"\\/)?"+E:l[h]=n:E===void 0?l[h-1]=g+"(?:\\/|"+n+")?":E!==ys&&(l[h-1]=g+"(?:\\/|\\/"+n+"\\/)"+E,l[h+1]=ys))}),l.filter(d=>d!==ys).join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a=0;a<s.length;a++){let u=s[a],l=i;if(n.matchBase&&u.length===1&&(l=[o]),this.matchOne(l,u,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return sn.defaults(t).Minimatch}};sn.AST=mp;sn.Minimatch=gp;sn.escape=oQ;sn.unescape=Bu;import{lstatSync as f2e}from"node:fs";import{readFile as Jz}from"node:fs/promises";import{basename as p2e,extname as aQ,join as d2e}from"node:path";var kz="build",Mz=[],qz=[],Qb="**/*.+(css|js|mjs)";import{createReadStream as r2e,createWriteStream as n2e}from"node:fs";import{createGzip as i2e}from"node:zlib";var jz=async({sourceFiles:e,gzip:t})=>{if(t===!1)return[];let r=t===!0?Qb:t,n=e.filter(i=>sn(i,r));return await Promise.all(n.map(s2e))},s2e=async e=>await new Promise((t,r)=>{let n=r2e(e),i=`${e}.gz`,s=n2e(i),o=i2e();n.pipe(o).pipe(s),s.on("close",()=>{t(i)}),s.on("error",r)});import{lstatSync as $z,readdirSync as o2e}from"node:fs";import{basename as a2e,join as Lz}from"node:path";var Uz=({sourceAbsolutePath:e,ignore:t})=>Gz(e).filter(n=>u2e({file:n,ignore:t})),u2e=({file:e,ignore:t})=>$z(e).size<=0||w6.includes(a2e(e).toLowerCase())?!1:t.find(r=>sn(e,r))===void 0,Gz=e=>o2e(e).flatMap(t=>{let r=Lz(e,t);return $z(r).isDirectory()?Gz(r):Lz(r)});var Kz=async()=>{await ri()||await pf();let{satelliteId:e,source:t=kz,ignore:r=Mz,encoding:n=qz,gzip:i=Qb}=await Ii(),s=d2e(process.cwd(),t),o=await y2e({sourceAbsolutePath:s,satelliteId:e,ignore:r,encoding:n,gzip:i});if(o.length===0){console.log("No new files to upload.");return}let a=ni(e),u=h=>h.alternateFile??h.file,l=async h=>{let E=u(h);return await pL({satellite:a,filename:p2e(E),fullPath:Wz({file:E,sourceAbsolutePath:s}),data:new c2e([await Jz(h.file)]),collection:b6,headers:[...h.mime===void 0?[]:[["Content-Type",h.mime]]],encoding:h.encoding})},d=async h=>{for(let E=0;E<h.length;E+=20){let g=h.slice(E,E+20);await new Vz.default(g.map(Q=>({title:`Uploading ${Q.file}`,task:async()=>await l(Q)})),{concurrent:!0}).run()}};await d(o.filter(({alternateFile:h})=>ic(h))),await d(o.filter(({alternateFile:h})=>un(h))),console.log(`
224
224
  \u{1F680} Deploy complete!`)},Wz=({file:e,sourceAbsolutePath:t})=>encodeURI(e.replace(t,"").replace(/\\/g,"/")),h2e=e=>{try{f2e(e)}catch{console.log(`${(0,Yz.red)("Cannot proceed deployment.")}
225
- Are you sure the folder containing your built app (the "source" tag in the juno.json file) files is correctly configured, or have you built your app?`),process.exit(1)}},A2e=async({files:e,sourceAbsolutePath:t,satelliteId:r})=>{let n=await dL({collection:W0,satellite:ni(r)}),i=e.map(async o=>await g2e({file:o,sourceAbsolutePath:t,existingAssets:n}));return(await Promise.all(i)).filter(({upload:o})=>o).map(({file:o})=>o)},m2e=async e=>{let t=await Jz(e);return l2e.createHash("sha256").update(t).digest("base64")},g2e=async({file:e,existingAssets:t,sourceAbsolutePath:r})=>{let n=e.alternateFile??e.file,i=t.assets.find(({fullPath:o})=>o===Wz({file:n,sourceAbsolutePath:r}));if(un(i))return{file:e,upload:!0};let s=await m2e(n);return{file:e,upload:s!==i.encodings.identity?.sha256}},y2e=async({sourceAbsolutePath:e,satelliteId:t,ignore:r,encoding:n,gzip:i})=>{h2e(e);let s=Uz({sourceAbsolutePath:e,ignore:r}),o=await jz({sourceFiles:s,gzip:i}),a=[...s,...o],u=({file:E,ext:g})=>{let B=n.find(([Q,F])=>sn(E,Q));if(ic(B)){let[Q,F]=B;return F}if(g==="Z")return"compress";if(g==="gz")return"gzip";if(aQ(E)===".br")return"br";if(aQ(E)===".zlib")return"deflate"},l=({file:E,encodingType:g})=>{if(!un(g))return a.find(B=>B===E.replace(aQ(E),""))},d=async E=>{let g=await tG(E),B=u({file:E,ext:g?.ext}),Q=l({file:E,encodingType:B}),F=zz.default.lookup(Q??E);return{file:E,alternateFile:Q,mime:typeof F=="string"?F:void 0,encoding:B}},h=await Promise.all(a.map(d));return await A2e({files:h,sourceAbsolutePath:e,satelliteId:t})};var Kt=it(qt(),1);var Tb="0.0.41";var b2e=` __ __ __ __ _ ____
225
+ Are you sure the folder containing your built app (the "source" tag in the juno.json file) files is correctly configured, or have you built your app?`),process.exit(1)}},A2e=async({files:e,sourceAbsolutePath:t,satelliteId:r})=>{let n=await dL({collection:W0,satellite:ni(r)}),i=e.map(async o=>await g2e({file:o,sourceAbsolutePath:t,existingAssets:n}));return(await Promise.all(i)).filter(({upload:o})=>o).map(({file:o})=>o)},m2e=async e=>{let t=await Jz(e);return l2e.createHash("sha256").update(t).digest("base64")},g2e=async({file:e,existingAssets:t,sourceAbsolutePath:r})=>{let n=e.alternateFile??e.file,i=t.assets.find(({fullPath:o})=>o===Wz({file:n,sourceAbsolutePath:r}));if(un(i))return{file:e,upload:!0};let s=await m2e(n);return{file:e,upload:s!==i.encodings.identity?.sha256}},y2e=async({sourceAbsolutePath:e,satelliteId:t,ignore:r,encoding:n,gzip:i})=>{h2e(e);let s=Uz({sourceAbsolutePath:e,ignore:r}),o=await jz({sourceFiles:s,gzip:i}),a=[...s,...o.filter(E=>!s.includes(E))],u=({file:E,ext:g})=>{let B=n.find(([Q,F])=>sn(E,Q));if(ic(B)){let[Q,F]=B;return F}if(g==="Z")return"compress";if(g==="gz")return"gzip";if(aQ(E)===".br")return"br";if(aQ(E)===".zlib")return"deflate"},l=({file:E,encodingType:g})=>{if(!un(g))return a.find(B=>B===E.replace(aQ(E),""))},d=async E=>{let g=await tG(E),B=u({file:E,ext:g?.ext}),Q=l({file:E,encodingType:B}),F=zz.default.lookup(Q??E);return{file:E,alternateFile:Q,mime:typeof F=="string"?F:void 0,encoding:B}},h=await Promise.all(a.map(d));return await A2e({files:h,sourceAbsolutePath:e,satelliteId:t})};var Kt=it(qt(),1);var Tb="0.0.42";var b2e=` __ __ __ __ _ ____
226
226
  __) || | || \\| |/ \\
227
227
  \\___/ \\___/ |_|\\__|\\____/`,yp=`${b2e} CLI ${(0,Kt.grey)(`v${Tb}`)}`,Fb=`
228
228
  ${yp}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/cli",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "description": "The Juno command-line interface",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",