nw-builder 3.8.2 → 3.8.3

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.
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.8.3] - 2022-08-26
11
+
12
+ ### Changed
13
+
14
+ - `platforms` argument also accepts comma separated (without spaces) values
15
+
16
+ ## [3.8.2] - 2022-08-08
17
+
18
+ ### Added
19
+
20
+ - Support for multiple file paths
21
+
10
22
  ## [3.8.1] - 2022-07-18
11
23
 
12
24
  ### Changed
package/dist/index.cjs CHANGED
@@ -3,4 +3,4 @@ var va=Object.create;var He=Object.defineProperty;var da=Object.getOwnPropertyDe
3
3
  globstar while`,e,h,t,f,p),this.matchOne(e.slice(h),t.slice(f),r))return this.debug("globstar found match!",h,a,p),!0;if(p==="."||p===".."||!n.dot&&p.charAt(0)==="."){this.debug("dot detected!",e,h,t,f);break}this.debug("globstar swallow a segment, and continue"),h++}return!!(r&&(this.debug(`
4
4
  >>> no match, partial?`,e,h,t,f),h===a))}var c;if(typeof o=="string"?(c=l===o,this.debug("string match",o,l,c)):(c=l.match(o),this.debug("pattern match",o,l,c)),!c)return!1}if(i===a&&s===u)return!0;if(i===a)return r;if(s===u)return i===a-1&&e[i]==="";throw new Error("wtf?")};function Lh(e){return e.replace(/\\(.)/g,"$1")}function Th(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var Ps=v((Rp,ur)=>{typeof Object.create=="function"?ur.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:ur.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}});var Ds=v(($p,cr)=>{try{if(lr=require("util"),typeof lr.inherits!="function")throw"";cr.exports=lr.inherits}catch{cr.exports=Ps()}var lr});var Et=v((Np,mt)=>{"use strict";function Gs(e){return e.charAt(0)==="/"}function ks(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=t.exec(e),n=r[1]||"",i=Boolean(n&&n.charAt(1)!==":");return Boolean(r[2]||i)}mt.exports=process.platform==="win32"?ks:Gs;mt.exports.posix=Gs;mt.exports.win32=ks});var fr=v(Q=>{Q.setopts=Gh;Q.ownProp=Fs;Q.makeAbs=ke;Q.finish=kh;Q.mark=Fh;Q.isIgnored=Xs;Q.childrenIgnored=Mh;function Fs(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qh=require("fs"),Oe=require("path"),jh=gt(),Ms=Et(),hr=jh.Minimatch;function Ch(e,t){return e.localeCompare(t,"en")}function Ph(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]),e.ignore.length&&(e.ignore=e.ignore.map(Dh))}function Dh(e){var t=null;if(e.slice(-3)==="/**"){var r=e.replace(/(\/\*\*)+$/,"");t=new hr(r,{dot:!0})}return{matcher:new hr(e,{dot:!0}),gmatcher:t}}function Gh(e,t,r){if(r||(r={}),r.matchBase&&t.indexOf("/")===-1){if(r.noglobstar)throw new Error("base matching requires globstar");t="**/"+t}e.silent=!!r.silent,e.pattern=t,e.strict=r.strict!==!1,e.realpath=!!r.realpath,e.realpathCache=r.realpathCache||Object.create(null),e.follow=!!r.follow,e.dot=!!r.dot,e.mark=!!r.mark,e.nodir=!!r.nodir,e.nodir&&(e.mark=!0),e.sync=!!r.sync,e.nounique=!!r.nounique,e.nonull=!!r.nonull,e.nosort=!!r.nosort,e.nocase=!!r.nocase,e.stat=!!r.stat,e.noprocess=!!r.noprocess,e.absolute=!!r.absolute,e.fs=r.fs||qh,e.maxLength=r.maxLength||1/0,e.cache=r.cache||Object.create(null),e.statCache=r.statCache||Object.create(null),e.symlinks=r.symlinks||Object.create(null),Ph(e,r),e.changedCwd=!1;var n=process.cwd();Fs(r,"cwd")?(e.cwd=Oe.resolve(r.cwd),e.changedCwd=e.cwd!==n):e.cwd=n,e.root=r.root||Oe.resolve(e.cwd,"/"),e.root=Oe.resolve(e.root),process.platform==="win32"&&(e.root=e.root.replace(/\\/g,"/")),e.cwdAbs=Ms(e.cwd)?e.cwd:ke(e,e.cwd),process.platform==="win32"&&(e.cwdAbs=e.cwdAbs.replace(/\\/g,"/")),e.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,r.allowWindowsEscape=!1,e.minimatch=new hr(t,r),e.options=e.minimatch.options}function kh(e){for(var t=e.nounique,r=t?[]:Object.create(null),n=0,i=e.matches.length;n<i;n++){var s=e.matches[n];if(!s||Object.keys(s).length===0){if(e.nonull){var a=e.minimatch.globSet[n];t?r.push(a):r[a]=!0}}else{var u=Object.keys(s);t?r.push.apply(r,u):u.forEach(function(o){r[o]=!0})}}if(t||(r=Object.keys(r)),e.nosort||(r=r.sort(Ch)),e.mark){for(var n=0;n<r.length;n++)r[n]=e._mark(r[n]);e.nodir&&(r=r.filter(function(o){var l=!/\/$/.test(o),h=e.cache[o]||e.cache[ke(e,o)];return l&&h&&(l=h!=="DIR"&&!Array.isArray(h)),l}))}e.ignore.length&&(r=r.filter(function(o){return!Xs(e,o)})),e.found=r}function Fh(e,t){var r=ke(e,t),n=e.cache[r],i=t;if(n){var s=n==="DIR"||Array.isArray(n),a=t.slice(-1)==="/";if(s&&!a?i+="/":!s&&a&&(i=i.slice(0,-1)),i!==t){var u=ke(e,i);e.statCache[u]=e.statCache[r],e.cache[u]=e.cache[r]}}return i}function ke(e,t){var r=t;return t.charAt(0)==="/"?r=Oe.join(e.root,t):Ms(t)||t===""?r=t:e.changedCwd?r=Oe.resolve(e.cwd,t):r=Oe.resolve(t),process.platform==="win32"&&(r=r.replace(/\\/g,"/")),r}function Xs(e,t){return e.ignore.length?e.ignore.some(function(r){return r.matcher.match(t)||!!(r.gmatcher&&r.gmatcher.match(t))}):!1}function Mh(e,t){return e.ignore.length?e.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(t))}):!1}});var zs=v((jp,Vs)=>{Vs.exports=Bs;Bs.GlobSync=A;var Xh=rr(),Us=gt(),Lp=Us.Minimatch,Tp=dr().Glob,qp=require("util"),pr=require("path"),Hs=require("assert"),yt=Et(),ue=fr(),Uh=ue.setopts,vr=ue.ownProp,Hh=ue.childrenIgnored,Bh=ue.isIgnored;function Bs(e,t){if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
5
5
  See: https://github.com/isaacs/node-glob/issues/167`);return new A(e,t).found}function A(e,t){if(!e)throw new Error("must provide pattern");if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
6
- See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof A))return new A(e,t);if(Uh(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;n<r;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}A.prototype._finish=function(){if(Hs.ok(this instanceof A),this.realpath){var e=this;this.matches.forEach(function(t,r){var n=e.matches[r]=Object.create(null);for(var i in t)try{i=e._makeAbs(i);var s=Xh.realpathSync(i,e.realpathCache);n[s]=!0}catch(a){if(a.syscall==="stat")n[e._makeAbs(i)]=!0;else throw a}})}ue.finish(this)};A.prototype._process=function(e,t,r){Hs.ok(this instanceof A);for(var n=0;typeof e[n]=="string";)n++;var i;switch(n){case e.length:this._processSimple(e.join("/"),t);return;case 0:i=null;break;default:i=e.slice(0,n).join("/");break}var s=e.slice(n),a;i===null?a=".":((yt(i)||yt(e.map(function(l){return typeof l=="string"?l:"[*]"}).join("/")))&&(!i||!yt(i))&&(i="/"+i),a=i);var u=this._makeAbs(a);if(!Hh(this,a)){var o=s[0]===Us.GLOBSTAR;o?this._processGlobStar(i,a,u,s,t,r):this._processReaddir(i,a,u,s,t,r)}};A.prototype._processReaddir=function(e,t,r,n,i,s){var a=this._readdir(r,s);if(!!a){for(var u=n[0],o=!!this.minimatch.negate,l=u._glob,h=this.dot||l.charAt(0)===".",f=[],p=0;p<a.length;p++){var c=a[p];if(c.charAt(0)!=="."||h){var m;o&&!e?m=!c.match(u):m=c.match(u),m&&f.push(c)}}var y=f.length;if(y!==0){if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var p=0;p<y;p++){var c=f[p];e&&(e.slice(-1)!=="/"?c=e+"/"+c:c=e+c),c.charAt(0)==="/"&&!this.nomount&&(c=pr.join(this.root,c)),this._emitMatch(i,c)}return}n.shift();for(var p=0;p<y;p++){var c=f[p],b;e?b=[e,c]:b=[c],this._process(b.concat(n),i,s)}}}};A.prototype._emitMatch=function(e,t){if(!Bh(this,t)){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}};A.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,n;try{r=this.fs.lstatSync(e)}catch(s){if(s.code==="ENOENT")return null}var i=r&&r.isSymbolicLink();return this.symlinks[e]=i,!i&&r&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};A.prototype._readdir=function(e,t){var r;if(t&&!vr(this.symlinks,e))return this._readdirInGlobStar(e);if(vr(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return null;if(Array.isArray(n))return n}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(i){return this._readdirError(e,i),null}};A.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var n=t[r];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,t};A.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var n=new Error(t.code+" invalid cwd "+this.cwd);throw n.path=this.cwd,n.code=t.code,n}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};A.prototype._processGlobStar=function(e,t,r,n,i,s){var a=this._readdir(r,s);if(!!a){var u=n.slice(1),o=e?[e]:[],l=o.concat(u);this._process(l,i,!1);var h=a.length,f=this.symlinks[r];if(!(f&&s))for(var p=0;p<h;p++){var c=a[p];if(!(c.charAt(0)==="."&&!this.dot)){var m=o.concat(a[p],u);this._process(m,i,!0);var y=o.concat(a[p],n);this._process(y,i,!0)}}}};A.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&yt(e)&&!this.nomount){var n=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=pr.join(this.root,e):(e=pr.resolve(this.root,e),n&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e)}};A.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&vr(this.cache,t)){var a=this.cache[t];if(Array.isArray(a)&&(a="DIR"),!r||a==="DIR")return a;if(r&&a==="FILE")return!1}var n,i=this.statCache[t];if(!i){var s;try{s=this.fs.lstatSync(t)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{i=this.fs.statSync(t)}catch{i=s}else i=s}this.statCache[t]=i;var a=!0;return i&&(a=i.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||a,r&&a==="FILE"?!1:a};A.prototype._mark=function(e){return ue.mark(this,e)};A.prototype._makeAbs=function(e){return ue.makeAbs(this,e)}});var gr=v((Cp,Ws)=>{Ws.exports=Zs;function Zs(e,t){if(e&&t)return Zs(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(n){r[n]=e[n]}),r;function r(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var s=e.apply(this,n),a=n[n.length-1];return typeof s=="function"&&s!==a&&Object.keys(a).forEach(function(u){s[u]=a[u]}),s}}});var Er=v((Pp,mr)=>{var Ys=gr();mr.exports=Ys(bt);mr.exports.strict=Ys(Qs);bt.proto=bt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return bt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Qs(this)},configurable:!0})});function bt(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function Qs(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}});var Js=v((Dp,Ks)=>{var Vh=gr(),Fe=Object.create(null),zh=Er();Ks.exports=Vh(Zh);function Zh(e,t){return Fe[e]?(Fe[e].push(t),null):(Fe[e]=[t],Wh(e))}function Wh(e){return zh(function t(){var r=Fe[e],n=r.length,i=Yh(arguments);try{for(var s=0;s<n;s++)r[s].apply(null,i)}finally{r.length>n?(r.splice(0,n),process.nextTick(function(){t.apply(null,i)})):delete Fe[e]}})}function Yh(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n]=e[n];return r}});var dr=v((Fp,ta)=>{ta.exports=le;var Qh=rr(),ea=gt(),Gp=ea.Minimatch,Kh=Ds(),Jh=require("events").EventEmitter,yr=require("path"),br=require("assert"),Me=Et(),_r=zs(),ce=fr(),ef=ce.setopts,wr=ce.ownProp,Or=Js(),kp=require("util"),tf=ce.childrenIgnored,rf=ce.isIgnored,nf=Er();function le(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return _r(e,t)}return new _(e,t,r)}le.sync=_r;var sf=le.GlobSync=_r.GlobSync;le.glob=le;function af(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}le.hasMagic=function(e,t){var r=af({},t);r.noprocess=!0;var n=new _(e,r),i=n.minimatch.set;if(!e)return!1;if(i.length>1)return!0;for(var s=0;s<i[0].length;s++)if(typeof i[0][s]!="string")return!0;return!1};le.Glob=_;Kh(_,Jh);function _(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new sf(e,t)}if(!(this instanceof _))return new _(e,t,r);ef(this,e,t),this._didRealPath=!1;var n=this.minimatch.set.length;this.matches=new Array(n),typeof r=="function"&&(r=nf(r),this.on("error",r),this.on("end",function(o){r(null,o)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(n===0)return u();for(var s=!0,a=0;a<n;a++)this._process(this.minimatch.set[a],a,!1,u);s=!1;function u(){--i._processing,i._processing<=0&&(s?process.nextTick(function(){i._finish()}):i._finish())}}_.prototype._finish=function(){if(br(this instanceof _),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();ce.finish(this),this.emit("end",this.found)}};_.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,n);function n(){--e===0&&t._finish()}};_.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var n=Object.keys(r),i=this,s=n.length;if(s===0)return t();var a=this.matches[e]=Object.create(null);n.forEach(function(u,o){u=i._makeAbs(u),Qh.realpath(u,i.realpathCache,function(l,h){l?l.syscall==="stat"?a[u]=!0:i.emit("error",l):a[h]=!0,--s===0&&(i.matches[e]=a,t())})})};_.prototype._mark=function(e){return ce.mark(this,e)};_.prototype._makeAbs=function(e){return ce.makeAbs(this,e)};_.prototype.abort=function(){this.aborted=!0,this.emit("abort")};_.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};_.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<n.length;t++){var i=n[t];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}};_.prototype._process=function(e,t,r,n){if(br(this instanceof _),br(typeof n=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,n]);return}for(var i=0;typeof e[i]=="string";)i++;var s;switch(i){case e.length:this._processSimple(e.join("/"),t,n);return;case 0:s=null;break;default:s=e.slice(0,i).join("/");break}var a=e.slice(i),u;s===null?u=".":((Me(s)||Me(e.map(function(h){return typeof h=="string"?h:"[*]"}).join("/")))&&(!s||!Me(s))&&(s="/"+s),u=s);var o=this._makeAbs(u);if(tf(this,u))return n();var l=a[0]===ea.GLOBSTAR;l?this._processGlobStar(s,u,o,a,t,r,n):this._processReaddir(s,u,o,a,t,r,n)}};_.prototype._processReaddir=function(e,t,r,n,i,s,a){var u=this;this._readdir(r,s,function(o,l){return u._processReaddir2(e,t,r,n,i,s,l,a)})};_.prototype._processReaddir2=function(e,t,r,n,i,s,a,u){if(!a)return u();for(var o=n[0],l=!!this.minimatch.negate,h=o._glob,f=this.dot||h.charAt(0)===".",p=[],c=0;c<a.length;c++){var m=a[c];if(m.charAt(0)!=="."||f){var y;l&&!e?y=!m.match(o):y=m.match(o),y&&p.push(m)}}var b=p.length;if(b===0)return u();if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var c=0;c<b;c++){var m=p[c];e&&(e!=="/"?m=e+"/"+m:m=e+m),m.charAt(0)==="/"&&!this.nomount&&(m=yr.join(this.root,m)),this._emitMatch(i,m)}return u()}n.shift();for(var c=0;c<b;c++){var m=p[c],O;e&&(e!=="/"?m=e+"/"+m:m=e+m),this._process([m].concat(n),i,s,u)}u()};_.prototype._emitMatch=function(e,t){if(!this.aborted&&!rf(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=Me(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.matches[e][t]=!0;var i=this.statCache[r];i&&this.emit("stat",t,i),this.emit("match",t)}}};_.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,n=this,i=Or(r,s);i&&n.fs.lstat(e,i);function s(a,u){if(a&&a.code==="ENOENT")return t();var o=u&&u.isSymbolicLink();n.symlinks[e]=o,!o&&u&&!u.isDirectory()?(n.cache[e]="FILE",t()):n._readdir(e,!1,t)}};_.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=Or("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!wr(this.symlinks,e))return this._readdirInGlobStar(e,r);if(wr(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return r();if(Array.isArray(n))return r(null,n)}var i=this;i.fs.readdir(e,of(this,e,r))}};function of(e,t,r){return function(n,i){n?e._readdirError(t,n,r):e._readdirEntries(t,i,r)}}_.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<t.length;n++){var i=t[n];e==="/"?i=e+i:i=e+"/"+i,this.cache[i]=!0}return this.cache[e]=t,r(null,t)}};_.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":var n=this._makeAbs(e);if(this.cache[n]="FILE",n===this.cwdAbs){var i=new Error(t.code+" invalid cwd "+this.cwd);i.path=this.cwd,i.code=t.code,this.emit("error",i),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};_.prototype._processGlobStar=function(e,t,r,n,i,s,a){var u=this;this._readdir(r,s,function(o,l){u._processGlobStar2(e,t,r,n,i,s,l,a)})};_.prototype._processGlobStar2=function(e,t,r,n,i,s,a,u){if(!a)return u();var o=n.slice(1),l=e?[e]:[],h=l.concat(o);this._process(h,i,!1,u);var f=this.symlinks[r],p=a.length;if(f&&s)return u();for(var c=0;c<p;c++){var m=a[c];if(!(m.charAt(0)==="."&&!this.dot)){var y=l.concat(a[c],o);this._process(y,i,!0,u);var b=l.concat(a[c],n);this._process(b,i,!0,u)}}u()};_.prototype._processSimple=function(e,t,r){var n=this;this._stat(e,function(i,s){n._processSimple2(e,t,i,s,r)})};_.prototype._processSimple2=function(e,t,r,n,i){if(this.matches[t]||(this.matches[t]=Object.create(null)),!n)return i();if(e&&Me(e)&&!this.nomount){var s=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=yr.join(this.root,e):(e=yr.resolve(this.root,e),s&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),i()};_.prototype._stat=function(e,t){var r=this._makeAbs(e),n=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&wr(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||i==="DIR")return t(null,i);if(n&&i==="FILE")return t()}var s,a=this.statCache[r];if(a!==void 0){if(a===!1)return t(null,a);var u=a.isDirectory()?"DIR":"FILE";return n&&u==="FILE"?t():t(null,u,a)}var o=this,l=Or("stat\0"+r,h);l&&o.fs.lstat(r,l);function h(f,p){if(p&&p.isSymbolicLink())return o.fs.stat(r,function(c,m){c?o._stat2(e,r,null,p,t):o._stat2(e,r,c,m,t)});o._stat2(e,r,f,p,t)}};_.prototype._stat2=function(e,t,r,n,i){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,i();var s=e.slice(-1)==="/";if(this.statCache[t]=n,t.slice(-1)==="/"&&n&&!n.isDirectory())return i(null,!1,n);var a=!0;return n&&(a=n.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||a,s&&a==="FILE"?i():i(null,a,n)}});var ia=v((Mp,na)=>{"use strict";var ra=qi(),uf=require("fs"),lf=require("path"),cf=Bi(),hf=Qi(),ff=cs(),pf=dr(),vf=function(e,t){var r=[];return hf(e).forEach(function(n){var i=n.indexOf("!")===0;i&&(n=n.slice(1));var s=t(n);i?r=cf(r,s):r=ff(r,s)}),r};na.exports=function(){var e=ra.toArray(arguments),t=ra.kindOf(e[0])==="object"?e.shift():{},r=Array.isArray(e[0])?e[0]:e;if(r.length===0)return[];var n=vf(r,function(i){return pf.sync(i,t)});return t.filter&&(n=n.filter(function(i){i=lf.join(t.cwd||"",i);try{return typeof t.filter=="function"?t.filter(i):uf.statSync(i)[t.filter]()}catch{return!1}})),n}});var Ef={};ya(Ef,{Options:()=>Nr,Platform:()=>X,Platforms:()=>$i,checkCache:()=>xi,checkPkgOptions:()=>ua,detectCurrentPlatform:()=>la,parseOptions:()=>ca});module.exports=ba(Ef);var wa={mode:"run",quiet:"info",files:null,version:"latest",flavor:"sdk",cacheDir:"./cache",platforms:[],currentPlatform:null,downloadUrl:"https://dl.nwjs.io/",manifestUrl:"https://nwjs.io/versions.json",appName:!1,appVersion:!1,buildDir:"./build",buildType:"default",forceDownload:!1,macCredits:!1,macIcns:!1,macZip:null,macPlist:!1,winVersionString:{},winIco:null,useRcedit:!1,argv:[],zip:null,zipOptions:null,mergeZip:!0},Nr=wa;var xr={NIX_32:"linux32",NIX_64:"linux64",OSX_32:"osx32",OSX_64:"osx64",WIN_32:"win32",WIN_64:"win64"};Object.freeze(xr);var X=xr;var kt=fe(Ri(),1),Nu={win32:{needsZip:!0,getRunnable:function(){return"nw.exe"},files:{"<=0.9.2":["nw.exe","ffmpegsumo.dll","icudt.dll","libEGL.dll","libGLESv2.dll","nw.pak"],">0.9.2 <0.12.0":["nw.exe","ffmpegsumo.dll","icudtl.dat","libEGL.dll","libGLESv2.dll","nw.pak","locales"],">=0.12.0":["nw.exe","ffmpegsumo.dll","icudtl.dat","libEGL.dll","libGLESv2.dll","nw.pak","locales","d3dcompiler_47.dll","pdf.dll"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-win-ia32.zip"},win64:{needsZip:!0,getRunnable:function(){return"nw.exe"},files:{"<=0.9.2":["nw.exe","ffmpegsumo.dll","icudt.dll","libEGL.dll","libGLESv2.dll","nw.pak","locales"],">0.9.2 <0.12.0":["nw.exe","ffmpegsumo.dll","icudtl.dat","libEGL.dll","libGLESv2.dll","nw.pak","locales"],">=0.12.0":["nw.exe","ffmpegsumo.dll","icudtl.dat","libEGL.dll","libGLESv2.dll","nw.pak","locales","d3dcompiler_47.dll","pdf.dll"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-win-x64.zip"},osx32:{needsZip:!1,getRunnable:function(e){return kt.default.satisfies(e,">=0.12.0 || ~0.12.0-alpha")?"nwjs.app/Contents/MacOS/nwjs":"node-webkit.app/Contents/MacOS/node-webkit"},files:{"<0.12.0-alpha":["node-webkit.app"],">=0.12.0 || ~0.12.0-alpha":["nwjs.app"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-osx-ia32.zip"},osx64:{needsZip:!1,getRunnable:function(e){return kt.default.satisfies(e,">=0.12.0 || ~0.12.0-alpha")?"nwjs.app/Contents/MacOS/nwjs":"node-webkit.app/Contents/MacOS/node-webkit"},files:{"<0.12.0-alpha":["node-webkit.app"],">=0.12.0 || ~0.12.0-alpha":["nwjs.app"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-osx-x64.zip"},linux32:{needsZip:!0,chmod:"0755",getRunnable:function(){return"nw"},files:{"<=0.9.2":["nw","nw.pak","libffmpegsumo.so"],">0.9.2 <=0.10.1":["nw","nw.pak","libffmpegsumo.so","icudtl.dat"],">0.10.1":["nw","nw.pak","libffmpegsumo.so","icudtl.dat","locales"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-linux-ia32.tar.gz"},linux64:{needsZip:!0,chmod:"0755",getRunnable:function(){return"nw"},files:{"<=0.9.2":["nw","nw.pak","libffmpegsumo.so"],">0.9.2 <=0.10.1":["nw","nw.pak","libffmpegsumo.so","icudtl.dat"],">0.10.1":["nw","nw.pak","libffmpegsumo.so","icudtl.dat","locales"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-linux-x64.tar.gz"}},$i=Nu;var it=fe(require("fs"),1),Ni=fe(require("path"),1),xu=(e,t)=>{let r=!1;if(t.length===1&&t[0]==="*")return it.default.existsSync(e)&&it.default.readdirSync(e).length>=2;for(let n of t){if(r)return!1;it.default.existsSync(Ni.default.join(e,n))||(r=!0)}return!r},xi=xu;var sa=fe(require("fs"),1),aa=fe(require("path"),1),oa=fe(ia(),1),df=e=>{let t={},r=(0,oa.default)(e);return r.length===0&&(console.error("[ ERROR ] package.json not found"),process.exit(1)),r.forEach(n=>{aa.default.basename(n)==="package.json"&&(t=sa.default.readFileSync(`${n}`,"utf8"),t=JSON.parse(t))}),console.log(t),t.nwbuild?t.nwbuild:{}},ua=df;var gf=e=>{switch(e.platform){case"darwin":return e.arch==="x64"?X.OSX_64:X.OSX_32;case"win32":return e.arch==="x64"||e.env.PROCESSOR_ARCHITEW6432?X.WIN_64:X.WIN_32;case"linux":return e.arch==="x64"?X.NIX_64:X.NIX_32;default:return}},la=gf;var mf=(e,t)=>{for(let r of Object.keys(e))t.hasOwnProperty(r)&&(t[r]=e[r]);return t},ca=mf;0&&(module.exports={Options,Platform,Platforms,checkCache,checkPkgOptions,detectCurrentPlatform,parseOptions});
6
+ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof A))return new A(e,t);if(Uh(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;n<r;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}A.prototype._finish=function(){if(Hs.ok(this instanceof A),this.realpath){var e=this;this.matches.forEach(function(t,r){var n=e.matches[r]=Object.create(null);for(var i in t)try{i=e._makeAbs(i);var s=Xh.realpathSync(i,e.realpathCache);n[s]=!0}catch(a){if(a.syscall==="stat")n[e._makeAbs(i)]=!0;else throw a}})}ue.finish(this)};A.prototype._process=function(e,t,r){Hs.ok(this instanceof A);for(var n=0;typeof e[n]=="string";)n++;var i;switch(n){case e.length:this._processSimple(e.join("/"),t);return;case 0:i=null;break;default:i=e.slice(0,n).join("/");break}var s=e.slice(n),a;i===null?a=".":((yt(i)||yt(e.map(function(l){return typeof l=="string"?l:"[*]"}).join("/")))&&(!i||!yt(i))&&(i="/"+i),a=i);var u=this._makeAbs(a);if(!Hh(this,a)){var o=s[0]===Us.GLOBSTAR;o?this._processGlobStar(i,a,u,s,t,r):this._processReaddir(i,a,u,s,t,r)}};A.prototype._processReaddir=function(e,t,r,n,i,s){var a=this._readdir(r,s);if(!!a){for(var u=n[0],o=!!this.minimatch.negate,l=u._glob,h=this.dot||l.charAt(0)===".",f=[],p=0;p<a.length;p++){var c=a[p];if(c.charAt(0)!=="."||h){var m;o&&!e?m=!c.match(u):m=c.match(u),m&&f.push(c)}}var y=f.length;if(y!==0){if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var p=0;p<y;p++){var c=f[p];e&&(e.slice(-1)!=="/"?c=e+"/"+c:c=e+c),c.charAt(0)==="/"&&!this.nomount&&(c=pr.join(this.root,c)),this._emitMatch(i,c)}return}n.shift();for(var p=0;p<y;p++){var c=f[p],b;e?b=[e,c]:b=[c],this._process(b.concat(n),i,s)}}}};A.prototype._emitMatch=function(e,t){if(!Bh(this,t)){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}};A.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,n;try{r=this.fs.lstatSync(e)}catch(s){if(s.code==="ENOENT")return null}var i=r&&r.isSymbolicLink();return this.symlinks[e]=i,!i&&r&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};A.prototype._readdir=function(e,t){var r;if(t&&!vr(this.symlinks,e))return this._readdirInGlobStar(e);if(vr(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return null;if(Array.isArray(n))return n}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(i){return this._readdirError(e,i),null}};A.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var n=t[r];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,t};A.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var n=new Error(t.code+" invalid cwd "+this.cwd);throw n.path=this.cwd,n.code=t.code,n}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};A.prototype._processGlobStar=function(e,t,r,n,i,s){var a=this._readdir(r,s);if(!!a){var u=n.slice(1),o=e?[e]:[],l=o.concat(u);this._process(l,i,!1);var h=a.length,f=this.symlinks[r];if(!(f&&s))for(var p=0;p<h;p++){var c=a[p];if(!(c.charAt(0)==="."&&!this.dot)){var m=o.concat(a[p],u);this._process(m,i,!0);var y=o.concat(a[p],n);this._process(y,i,!0)}}}};A.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&yt(e)&&!this.nomount){var n=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=pr.join(this.root,e):(e=pr.resolve(this.root,e),n&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e)}};A.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&vr(this.cache,t)){var a=this.cache[t];if(Array.isArray(a)&&(a="DIR"),!r||a==="DIR")return a;if(r&&a==="FILE")return!1}var n,i=this.statCache[t];if(!i){var s;try{s=this.fs.lstatSync(t)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{i=this.fs.statSync(t)}catch{i=s}else i=s}this.statCache[t]=i;var a=!0;return i&&(a=i.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||a,r&&a==="FILE"?!1:a};A.prototype._mark=function(e){return ue.mark(this,e)};A.prototype._makeAbs=function(e){return ue.makeAbs(this,e)}});var gr=v((Cp,Ws)=>{Ws.exports=Zs;function Zs(e,t){if(e&&t)return Zs(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(n){r[n]=e[n]}),r;function r(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var s=e.apply(this,n),a=n[n.length-1];return typeof s=="function"&&s!==a&&Object.keys(a).forEach(function(u){s[u]=a[u]}),s}}});var Er=v((Pp,mr)=>{var Ys=gr();mr.exports=Ys(bt);mr.exports.strict=Ys(Qs);bt.proto=bt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return bt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Qs(this)},configurable:!0})});function bt(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function Qs(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}});var Js=v((Dp,Ks)=>{var Vh=gr(),Fe=Object.create(null),zh=Er();Ks.exports=Vh(Zh);function Zh(e,t){return Fe[e]?(Fe[e].push(t),null):(Fe[e]=[t],Wh(e))}function Wh(e){return zh(function t(){var r=Fe[e],n=r.length,i=Yh(arguments);try{for(var s=0;s<n;s++)r[s].apply(null,i)}finally{r.length>n?(r.splice(0,n),process.nextTick(function(){t.apply(null,i)})):delete Fe[e]}})}function Yh(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n]=e[n];return r}});var dr=v((Fp,ta)=>{ta.exports=le;var Qh=rr(),ea=gt(),Gp=ea.Minimatch,Kh=Ds(),Jh=require("events").EventEmitter,yr=require("path"),br=require("assert"),Me=Et(),_r=zs(),ce=fr(),ef=ce.setopts,wr=ce.ownProp,Or=Js(),kp=require("util"),tf=ce.childrenIgnored,rf=ce.isIgnored,nf=Er();function le(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return _r(e,t)}return new _(e,t,r)}le.sync=_r;var sf=le.GlobSync=_r.GlobSync;le.glob=le;function af(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}le.hasMagic=function(e,t){var r=af({},t);r.noprocess=!0;var n=new _(e,r),i=n.minimatch.set;if(!e)return!1;if(i.length>1)return!0;for(var s=0;s<i[0].length;s++)if(typeof i[0][s]!="string")return!0;return!1};le.Glob=_;Kh(_,Jh);function _(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new sf(e,t)}if(!(this instanceof _))return new _(e,t,r);ef(this,e,t),this._didRealPath=!1;var n=this.minimatch.set.length;this.matches=new Array(n),typeof r=="function"&&(r=nf(r),this.on("error",r),this.on("end",function(o){r(null,o)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(n===0)return u();for(var s=!0,a=0;a<n;a++)this._process(this.minimatch.set[a],a,!1,u);s=!1;function u(){--i._processing,i._processing<=0&&(s?process.nextTick(function(){i._finish()}):i._finish())}}_.prototype._finish=function(){if(br(this instanceof _),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();ce.finish(this),this.emit("end",this.found)}};_.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,n);function n(){--e===0&&t._finish()}};_.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var n=Object.keys(r),i=this,s=n.length;if(s===0)return t();var a=this.matches[e]=Object.create(null);n.forEach(function(u,o){u=i._makeAbs(u),Qh.realpath(u,i.realpathCache,function(l,h){l?l.syscall==="stat"?a[u]=!0:i.emit("error",l):a[h]=!0,--s===0&&(i.matches[e]=a,t())})})};_.prototype._mark=function(e){return ce.mark(this,e)};_.prototype._makeAbs=function(e){return ce.makeAbs(this,e)};_.prototype.abort=function(){this.aborted=!0,this.emit("abort")};_.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};_.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<n.length;t++){var i=n[t];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}};_.prototype._process=function(e,t,r,n){if(br(this instanceof _),br(typeof n=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,n]);return}for(var i=0;typeof e[i]=="string";)i++;var s;switch(i){case e.length:this._processSimple(e.join("/"),t,n);return;case 0:s=null;break;default:s=e.slice(0,i).join("/");break}var a=e.slice(i),u;s===null?u=".":((Me(s)||Me(e.map(function(h){return typeof h=="string"?h:"[*]"}).join("/")))&&(!s||!Me(s))&&(s="/"+s),u=s);var o=this._makeAbs(u);if(tf(this,u))return n();var l=a[0]===ea.GLOBSTAR;l?this._processGlobStar(s,u,o,a,t,r,n):this._processReaddir(s,u,o,a,t,r,n)}};_.prototype._processReaddir=function(e,t,r,n,i,s,a){var u=this;this._readdir(r,s,function(o,l){return u._processReaddir2(e,t,r,n,i,s,l,a)})};_.prototype._processReaddir2=function(e,t,r,n,i,s,a,u){if(!a)return u();for(var o=n[0],l=!!this.minimatch.negate,h=o._glob,f=this.dot||h.charAt(0)===".",p=[],c=0;c<a.length;c++){var m=a[c];if(m.charAt(0)!=="."||f){var y;l&&!e?y=!m.match(o):y=m.match(o),y&&p.push(m)}}var b=p.length;if(b===0)return u();if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var c=0;c<b;c++){var m=p[c];e&&(e!=="/"?m=e+"/"+m:m=e+m),m.charAt(0)==="/"&&!this.nomount&&(m=yr.join(this.root,m)),this._emitMatch(i,m)}return u()}n.shift();for(var c=0;c<b;c++){var m=p[c],O;e&&(e!=="/"?m=e+"/"+m:m=e+m),this._process([m].concat(n),i,s,u)}u()};_.prototype._emitMatch=function(e,t){if(!this.aborted&&!rf(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=Me(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.matches[e][t]=!0;var i=this.statCache[r];i&&this.emit("stat",t,i),this.emit("match",t)}}};_.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,n=this,i=Or(r,s);i&&n.fs.lstat(e,i);function s(a,u){if(a&&a.code==="ENOENT")return t();var o=u&&u.isSymbolicLink();n.symlinks[e]=o,!o&&u&&!u.isDirectory()?(n.cache[e]="FILE",t()):n._readdir(e,!1,t)}};_.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=Or("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!wr(this.symlinks,e))return this._readdirInGlobStar(e,r);if(wr(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return r();if(Array.isArray(n))return r(null,n)}var i=this;i.fs.readdir(e,of(this,e,r))}};function of(e,t,r){return function(n,i){n?e._readdirError(t,n,r):e._readdirEntries(t,i,r)}}_.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<t.length;n++){var i=t[n];e==="/"?i=e+i:i=e+"/"+i,this.cache[i]=!0}return this.cache[e]=t,r(null,t)}};_.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":var n=this._makeAbs(e);if(this.cache[n]="FILE",n===this.cwdAbs){var i=new Error(t.code+" invalid cwd "+this.cwd);i.path=this.cwd,i.code=t.code,this.emit("error",i),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};_.prototype._processGlobStar=function(e,t,r,n,i,s,a){var u=this;this._readdir(r,s,function(o,l){u._processGlobStar2(e,t,r,n,i,s,l,a)})};_.prototype._processGlobStar2=function(e,t,r,n,i,s,a,u){if(!a)return u();var o=n.slice(1),l=e?[e]:[],h=l.concat(o);this._process(h,i,!1,u);var f=this.symlinks[r],p=a.length;if(f&&s)return u();for(var c=0;c<p;c++){var m=a[c];if(!(m.charAt(0)==="."&&!this.dot)){var y=l.concat(a[c],o);this._process(y,i,!0,u);var b=l.concat(a[c],n);this._process(b,i,!0,u)}}u()};_.prototype._processSimple=function(e,t,r){var n=this;this._stat(e,function(i,s){n._processSimple2(e,t,i,s,r)})};_.prototype._processSimple2=function(e,t,r,n,i){if(this.matches[t]||(this.matches[t]=Object.create(null)),!n)return i();if(e&&Me(e)&&!this.nomount){var s=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=yr.join(this.root,e):(e=yr.resolve(this.root,e),s&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),i()};_.prototype._stat=function(e,t){var r=this._makeAbs(e),n=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&wr(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||i==="DIR")return t(null,i);if(n&&i==="FILE")return t()}var s,a=this.statCache[r];if(a!==void 0){if(a===!1)return t(null,a);var u=a.isDirectory()?"DIR":"FILE";return n&&u==="FILE"?t():t(null,u,a)}var o=this,l=Or("stat\0"+r,h);l&&o.fs.lstat(r,l);function h(f,p){if(p&&p.isSymbolicLink())return o.fs.stat(r,function(c,m){c?o._stat2(e,r,null,p,t):o._stat2(e,r,c,m,t)});o._stat2(e,r,f,p,t)}};_.prototype._stat2=function(e,t,r,n,i){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,i();var s=e.slice(-1)==="/";if(this.statCache[t]=n,t.slice(-1)==="/"&&n&&!n.isDirectory())return i(null,!1,n);var a=!0;return n&&(a=n.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||a,s&&a==="FILE"?i():i(null,a,n)}});var ia=v((Mp,na)=>{"use strict";var ra=qi(),uf=require("fs"),lf=require("path"),cf=Bi(),hf=Qi(),ff=cs(),pf=dr(),vf=function(e,t){var r=[];return hf(e).forEach(function(n){var i=n.indexOf("!")===0;i&&(n=n.slice(1));var s=t(n);i?r=cf(r,s):r=ff(r,s)}),r};na.exports=function(){var e=ra.toArray(arguments),t=ra.kindOf(e[0])==="object"?e.shift():{},r=Array.isArray(e[0])?e[0]:e;if(r.length===0)return[];var n=vf(r,function(i){return pf.sync(i,t)});return t.filter&&(n=n.filter(function(i){i=lf.join(t.cwd||"",i);try{return typeof t.filter=="function"?t.filter(i):uf.statSync(i)[t.filter]()}catch{return!1}})),n}});var Ef={};ya(Ef,{Options:()=>Nr,Platform:()=>X,Platforms:()=>$i,checkCache:()=>xi,checkPkgOptions:()=>ua,detectCurrentPlatform:()=>la,parseOptions:()=>ca});module.exports=ba(Ef);var wa={mode:"run",quiet:"info",files:null,version:"latest",flavor:"sdk",cacheDir:"./cache",platforms:[],currentPlatform:null,downloadUrl:"https://dl.nwjs.io/",manifestUrl:"https://nwjs.io/versions.json",appName:!1,appVersion:!1,buildDir:"./build",buildType:"default",forceDownload:!1,macCredits:!1,macIcns:!1,macZip:null,macPlist:!1,winVersionString:{},winIco:null,useRcedit:!1,argv:[],zip:null,zipOptions:null,mergeZip:!0},Nr=wa;var xr={NIX_32:"linux32",NIX_64:"linux64",OSX_32:"osx32",OSX_64:"osx64",WIN_32:"win32",WIN_64:"win64"};Object.freeze(xr);var X=xr;var kt=fe(Ri(),1),Nu={win32:{needsZip:!0,getRunnable:function(){return"nw.exe"},files:{"<=0.9.2":["nw.exe","ffmpegsumo.dll","icudt.dll","libEGL.dll","libGLESv2.dll","nw.pak"],">0.9.2 <0.12.0":["nw.exe","ffmpegsumo.dll","icudtl.dat","libEGL.dll","libGLESv2.dll","nw.pak","locales"],">=0.12.0":["nw.exe","ffmpegsumo.dll","icudtl.dat","libEGL.dll","libGLESv2.dll","nw.pak","locales","d3dcompiler_47.dll","pdf.dll"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-win-ia32.zip"},win64:{needsZip:!0,getRunnable:function(){return"nw.exe"},files:{"<=0.9.2":["nw.exe","ffmpegsumo.dll","icudt.dll","libEGL.dll","libGLESv2.dll","nw.pak","locales"],">0.9.2 <0.12.0":["nw.exe","ffmpegsumo.dll","icudtl.dat","libEGL.dll","libGLESv2.dll","nw.pak","locales"],">=0.12.0":["nw.exe","ffmpegsumo.dll","icudtl.dat","libEGL.dll","libGLESv2.dll","nw.pak","locales","d3dcompiler_47.dll","pdf.dll"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-win-x64.zip"},osx32:{needsZip:!1,getRunnable:function(e){return kt.default.satisfies(e,">=0.12.0 || ~0.12.0-alpha")?"nwjs.app/Contents/MacOS/nwjs":"node-webkit.app/Contents/MacOS/node-webkit"},files:{"<0.12.0-alpha":["node-webkit.app"],">=0.12.0 || ~0.12.0-alpha":["nwjs.app"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-osx-ia32.zip"},osx64:{needsZip:!1,getRunnable:function(e){return kt.default.satisfies(e,">=0.12.0 || ~0.12.0-alpha")?"nwjs.app/Contents/MacOS/nwjs":"node-webkit.app/Contents/MacOS/node-webkit"},files:{"<0.12.0-alpha":["node-webkit.app"],">=0.12.0 || ~0.12.0-alpha":["nwjs.app"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-osx-x64.zip"},linux32:{needsZip:!0,chmod:"0755",getRunnable:function(){return"nw"},files:{"<=0.9.2":["nw","nw.pak","libffmpegsumo.so"],">0.9.2 <=0.10.1":["nw","nw.pak","libffmpegsumo.so","icudtl.dat"],">0.10.1":["nw","nw.pak","libffmpegsumo.so","icudtl.dat","locales"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-linux-ia32.tar.gz"},linux64:{needsZip:!0,chmod:"0755",getRunnable:function(){return"nw"},files:{"<=0.9.2":["nw","nw.pak","libffmpegsumo.so"],">0.9.2 <=0.10.1":["nw","nw.pak","libffmpegsumo.so","icudtl.dat"],">0.10.1":["nw","nw.pak","libffmpegsumo.so","icudtl.dat","locales"]},versionNameTemplate:"v${ version }/${ name }-v${ version }-linux-x64.tar.gz"}},$i=Nu;var it=fe(require("fs"),1),Ni=fe(require("path"),1),xu=(e,t)=>{let r=!1;if(t.length===1&&t[0]==="*")return it.default.existsSync(e)&&it.default.readdirSync(e).length>=2;for(let n of t){if(r)return!1;it.default.existsSync(Ni.default.join(e,n))||(r=!0)}return!r},xi=xu;var sa=fe(require("fs"),1),aa=fe(require("path"),1),oa=fe(ia(),1),df=e=>{let t={},r=(0,oa.default)(e);return r.length===0&&(console.error("[ ERROR ] package.json not found"),process.exit(1)),r.forEach(n=>{aa.default.basename(n)==="package.json"&&(t=sa.default.readFileSync(`${n}`,"utf8"),t=JSON.parse(t))}),t.nwbuild?t.nwbuild:{}},ua=df;var gf=e=>{switch(e.platform){case"darwin":return e.arch==="x64"?X.OSX_64:X.OSX_32;case"win32":return e.arch==="x64"||e.env.PROCESSOR_ARCHITEW6432?X.WIN_64:X.WIN_32;case"linux":return e.arch==="x64"?X.NIX_64:X.NIX_32;default:return}},la=gf;var mf=(e,t)=>{for(let r of Object.keys(e))t.hasOwnProperty(r)&&(t[r]=e[r]);return t},ca=mf;0&&(module.exports={Options,Platform,Platforms,checkCache,checkPkgOptions,detectCurrentPlatform,parseOptions});
package/docs/api.md ADDED
@@ -0,0 +1,5 @@
1
+ # API Reference
2
+
3
+ Coming soon!
4
+
5
+ For now checkout the API on the project's [README](https://github.com/nwutils/nw-builder#api-reference).
@@ -0,0 +1,138 @@
1
+ # Getting Started
2
+
3
+ ## Installation
4
+
5
+ Download and install `nw-builder` using your preferred node package manager:
6
+
7
+ Via `npm`
8
+
9
+ ```shell
10
+ npm install nw-builder
11
+ ```
12
+
13
+ Via `yarn`
14
+
15
+ ```shell
16
+ yarn add nw-builder
17
+ ```
18
+
19
+ Via `pnpm`
20
+
21
+ ```shell
22
+ pnpm add nw-builder
23
+ ```
24
+
25
+ Run the executable to check if it's working correctly:
26
+
27
+ ```shell
28
+ ./node_modules/bin/nwbuild.cjs
29
+ ```
30
+
31
+ This should give an error:
32
+
33
+ ```shell
34
+ [ ERROR ] package.json not found
35
+ ```
36
+
37
+ ## Write your first application:
38
+
39
+ To learn how to write your NW.js application, follow the steps given [here](https://ayushmxn.github.io/nw-repro/getting-started#write-your-first-nwjs-application).
40
+
41
+ ## Run your first application
42
+
43
+ CLI usage:
44
+
45
+ ```shell
46
+ ./node_modules/bin/nwbuild.cjs ./path/to/nw/app
47
+ ```
48
+
49
+ Module usage:
50
+
51
+ ```javascript
52
+ const { nwbuild } = require("nw-builder");
53
+
54
+ nwbuild({
55
+ files: "./path/to/nw/app"
56
+ })
57
+ .then(() => { ... })
58
+ .catch(() => { ... })
59
+ .finally(() => { ... })
60
+ ```
61
+
62
+ This is the minimum arguments required to run a NW.js application. It detects your current platform, downloads the required NW binary and runs it.
63
+
64
+ ## Build your first application
65
+
66
+ CLI usage:
67
+
68
+ ```shell
69
+ ./node_modules/bin/nwbuild.cjs ./path/to/nw/app --mode=build
70
+ ```
71
+
72
+ Module usage:
73
+
74
+ ```javascript
75
+ const { nwbuild } = require("nw-builder");
76
+
77
+ nwbuild({
78
+ files: "./path/to/nw/app/dir/**/*.*"
79
+ mode: "build"
80
+ })
81
+ .then(() => { ... })
82
+ .catch(() => { ... })
83
+ .finally(() => { ... })
84
+ ```
85
+
86
+ This is the minimum arguments required to build a NW.js application. It detects your current platform, downloads the required NW binary and builds for the current platform.
87
+
88
+ You can learn more about the configuration options in the [API reference](./api).
89
+
90
+ ## Tips
91
+
92
+ You may run or build your app repeatedly and will probably want to automate it. You can add a script in your `package.json`:
93
+
94
+ ```json
95
+ {
96
+ "scripts": {
97
+ "run": "nwbuild ./src/**/*",
98
+ "build": "nwbuild ./src/**/* --mode=build"
99
+ }
100
+ }
101
+ ```
102
+
103
+ However this may not make sense if you have multiple scripts with multiple options potentially leading to a lot of errors and debugging. You can write your run/build script in a module:
104
+
105
+ ```json
106
+ {
107
+ "scripts": {
108
+ "run": "node run.js",
109
+ "build": "node build.js"
110
+ }
111
+ }
112
+ ```
113
+
114
+ You can even define your options in your project's `package.json` under the `nwbuild` property. This is ideal if you only have one NW.js run or build process. Note that the `package.json` options override the CLI and module.
115
+
116
+ `run.js`
117
+
118
+ ```javascript
119
+ nwbuild({
120
+ files: "./",
121
+ });
122
+ ```
123
+
124
+ `package.json`
125
+
126
+ ```json
127
+ {
128
+ "scripts": {
129
+ "override:cli": "nwbuild ./",
130
+ "override:module": "node run.js"
131
+ },
132
+ "nwbuild": {
133
+ "files": "./dist/**/*,
134
+ }
135
+ }
136
+ ```
137
+
138
+ Since `files` is a required argument, you'll have to define it in the CLI or module even if you plan to override it.
package/docs/index.md ADDED
@@ -0,0 +1,12 @@
1
+ # Introduction
2
+
3
+ Helper tool to simplify development of NW.js applications.
4
+
5
+ ## Major Features
6
+
7
+ - Run and build NW.js applications for Mac, Windows and Linux.
8
+ - Use as a command line tool (for CI/CD)
9
+ - Use as a module (directly in your codebase)
10
+ - use from your `package.json`
11
+
12
+ Check out the [getting started](./getting-started) instructions to give `nw-builder` a try.
@@ -133,7 +133,6 @@ module.exports = {
133
133
  files.forEach(function (file) {
134
134
  fs.chmodSync(path.join(destination, file.path), file.mode);
135
135
  });
136
-
137
136
  resolve({ files, destination });
138
137
  });
139
138
  });
package/lib/index.cjs CHANGED
@@ -57,6 +57,8 @@ function NwBuilder(options) {
57
57
 
58
58
  if (this.options.platforms && this.options.platforms.length === 0) {
59
59
  this.options.platforms = [detectCurrentPlatform(process)];
60
+ } else if (this.options.platforms && this.options.platforms.length === 1) {
61
+ this.options.platforms = this.options.platforms[0].split(",");
60
62
  }
61
63
 
62
64
  // Intercept the platforms and check for the legacy platforms of 'osx' and 'win' and
@@ -1092,15 +1094,9 @@ const nwbuild = (options, callback = [() => {}, () => {}, () => {}]) => {
1092
1094
  });
1093
1095
 
1094
1096
  if (nw.options.mode === "run") {
1095
- nw.run()
1096
- .then(callback[0])
1097
- .catch(callback[1])
1098
- .finally(callback[2]);
1097
+ nw.run().then(callback[0]).catch(callback[1]).finally(callback[2]);
1099
1098
  } else if (nw.options.mode === "build") {
1100
- nw.build()
1101
- .then(callback[0])
1102
- .catch(callback[1])
1103
- .finally(callback[2]);
1099
+ nw.build().then(callback[0]).catch(callback[1]).finally(callback[2]);
1104
1100
  } else {
1105
1101
  console.log("[ WARN ] Invalid mode option.");
1106
1102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "3.8.2",
3
+ "version": "3.8.3",
4
4
  "description": "Build NW.js desktop applications for Mac, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
@@ -22,12 +22,13 @@
22
22
  "test": "npm run test:unit && tape './test/*.cjs'",
23
23
  "test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
24
24
  "demo": "cd ./test/demo && npm start",
25
+ "demo:cli": "nwbuild ./** --mode=build --platforms=linux32, linux64 --version=0.67.1",
25
26
  "build": "esbuild src/index.js --bundle --minify --platform=node --outfile=./dist/index.cjs"
26
27
  },
27
28
  "devDependencies": {
28
29
  "decompress-zip": "^0.3.3",
29
30
  "eol": "^0.9.1",
30
- "esbuild": "^0.14.47",
31
+ "esbuild": "^0.15.2",
31
32
  "eslint": "^8.18.0",
32
33
  "eslint-config-tjw-jsdoc": "^1.0.3",
33
34
  "eslint-plugin-jsdoc": "^39.3.3",
@@ -20,8 +20,6 @@ const checkPkgOptions = (files) => {
20
20
  }
21
21
  });
22
22
 
23
- console.log(pkg);
24
-
25
23
  if (pkg.nwbuild) {
26
24
  return pkg.nwbuild;
27
25
  } else {