xl1 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bash1/index.js +2 -0
- package/dist/chunk-2CJVU2ON.js +6 -0
- package/dist/chunk-NEJSZOZX.js +1 -0
- package/dist/jsh1/index.js +2 -2
- package/dist/xl1/index.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-5KSN6VOA.js +0 -6
@@ -0,0 +1,2 @@
|
|
1
|
+
#! /usr/bin/env node
|
2
|
+
"use strict";var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var l=_chunkNEJSZOZXjs.a.call(void 0, "fs"),{spawn:h}=_chunkNEJSZOZXjs.a.call(void 0, "child_process");(()=>{let a=e=>{let o={};for(let s=0;s<e.length;s++)if(e[s].startsWith("-")){let p=e[s].replace(/^-+/,""),r=e[s+1]&&!e[s+1].startsWith("-")?e[s+1]:!0;o[p]=r,typeof r!="boolean"&&s++}else o._||(o._=[]),o._.push(e[s]);return o},[u,f,t,...c]=process.argv,i=process.env.BASH1||(process.platform=="win32"?["C:\\Windows\\System32\\bash.exe",path.join(process.env.USERPROFILE,"scoop\\apps\\git\\current\\bin\\bash.exe")].find(e=>l.existsSync(e)):"");t&&h(t,c,{stdio:"inherit",shell:i||!0,cwd:process.cwd()}).on("error",o=>{console.error(o.message)})})();
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNEJSZOZXjs = require('./chunk-NEJSZOZX.js');var Pt=_chunkNEJSZOZXjs.b.call(void 0, ct=>{var C=_chunkNEJSZOZXjs.a.call(void 0, "path"),L=process.platform==="win32",N=_chunkNEJSZOZXjs.a.call(void 0, "fs"),Rr=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function Dr(){var t;if(Rr){var r=new Error;t=e}else t=i;return t;function e(n){n&&(r.message=n.message,n=r,i(n))}function i(n){if(n){if(process.throwDeprecation)throw n;if(!process.noDeprecation){var s="fs: missing callback "+(n.stack||n.message);process.traceDeprecation?console.trace(s):console.error(s)}}}}function Tr(t){return typeof t=="function"?t:Dr()}var De=C.normalize;L?q=/(.*?)(?:[\/\\]+|$)/g:q=/(.*?)(?:[\/]+|$)/g;var q;L?x=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/:x=/^[\/]*/;var x;ct.realpathSync=function(r,e){if(r=C.resolve(r),e&&Object.prototype.hasOwnProperty.call(e,r))return e[r];var i=r,n={},s={},a,u,o,c;f();function f(){var m=x.exec(r);a=m[0].length,u=m[0],o=m[0],c="",L&&!s[o]&&(N.lstatSync(o),s[o]=!0)}for(;a<r.length;){q.lastIndex=a;var p=q.exec(r);if(c=u,u+=p[0],o=c+p[1],a=q.lastIndex,!(s[o]||e&&e[o]===o)){var l;if(e&&Object.prototype.hasOwnProperty.call(e,o))l=e[o];else{var h=N.lstatSync(o);if(!h.isSymbolicLink()){s[o]=!0,e&&(e[o]=o);continue}var v=null;if(!L){var d=h.dev.toString(32)+":"+h.ino.toString(32);n.hasOwnProperty(d)&&(v=n[d])}v===null&&(N.statSync(o),v=N.readlinkSync(o)),l=C.resolve(c,v),e&&(e[o]=l),L||(n[d]=v)}r=C.resolve(l,r.slice(a)),f()}}return e&&(e[i]=r),r};ct.realpath=function(r,e,i){if(typeof i!="function"&&(i=Tr(e),e=null),r=C.resolve(r),e&&Object.prototype.hasOwnProperty.call(e,r))return process.nextTick(i.bind(null,null,e[r]));var n=r,s={},a={},u,o,c,f;p();function p(){var m=x.exec(r);u=m[0].length,o=m[0],c=m[0],f="",L&&!a[c]?N.lstat(c,function(y){if(y)return i(y);a[c]=!0,l()}):process.nextTick(l)}function l(){if(u>=r.length)return e&&(e[n]=r),i(null,r);q.lastIndex=u;var m=q.exec(r);return f=o,o+=m[0],c=f+m[1],u=q.lastIndex,a[c]||e&&e[c]===c?process.nextTick(l):e&&Object.prototype.hasOwnProperty.call(e,c)?d(e[c]):N.lstat(c,h)}function h(m,y){if(m)return i(m);if(!y.isSymbolicLink())return a[c]=!0,e&&(e[c]=c),process.nextTick(l);if(!L){var b=y.dev.toString(32)+":"+y.ino.toString(32);if(s.hasOwnProperty(b))return v(null,s[b],c)}N.stat(c,function(k){if(k)return i(k);N.readlink(c,function(_,j){L||(s[b]=j),v(_,j)})})}function v(m,y,b){if(m)return i(m);var k=C.resolve(f,y);e&&(e[b]=k),d(k)}function d(m){r=C.resolve(m,r.slice(u)),p()}}});var vt=_chunkNEJSZOZXjs.b.call(void 0, (Ce,Qt)=>{Qt.exports=M;M.realpath=M;M.sync=lt;M.realpathSync=lt;M.monkeypatch=Gr;M.unmonkeypatch=Pr;var B=_chunkNEJSZOZXjs.a.call(void 0, "fs"),ht=B.realpath,ft=B.realpathSync,Cr=process.version,$t=/^v[0-5]\./.test(Cr),Ft=Pt();function Bt(t){return t&&t.syscall==="realpath"&&(t.code==="ELOOP"||t.code==="ENOMEM"||t.code==="ENAMETOOLONG")}function M(t,r,e){if($t)return ht(t,r,e);typeof r=="function"&&(e=r,r=null),ht(t,r,function(i,n){Bt(i)?Ft.realpath(t,r,e):e(i,n)})}function lt(t,r){if($t)return ft(t,r);try{return ft(t,r)}catch(e){if(Bt(e))return Ft.realpathSync(t,r);throw e}}function Gr(){B.realpath=M,B.realpathSync=lt}function Pr(){B.realpath=ht,B.realpathSync=ft}});var Wt=_chunkNEJSZOZXjs.b.call(void 0, (Ge,Ut)=>{Ut.exports=function(t,r){for(var e=[],i=0;i<t.length;i++){var n=r(t[i],i);$r(n)?e.push.apply(e,n):e.push(n)}return e};var $r=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"}});var Kt=_chunkNEJSZOZXjs.b.call(void 0, (Pe,Zt)=>{"use strict";Zt.exports=zt;function zt(t,r,e){t instanceof RegExp&&(t=xt(t,e)),r instanceof RegExp&&(r=xt(r,e));var i=Ht(t,r,e);return i&&{start:i[0],end:i[1],pre:e.slice(0,i[0]),body:e.slice(i[0]+t.length,i[1]),post:e.slice(i[1]+r.length)}}function xt(t,r){var e=r.match(t);return e?e[0]:null}zt.range=Ht;function Ht(t,r,e){var i,n,s,a,u,o=e.indexOf(t),c=e.indexOf(r,o+1),f=o;if(o>=0&&c>0){if(t===r)return[o,c];for(i=[],s=e.length;f>=0&&!u;)f==o?(i.push(f),o=e.indexOf(t,f+1)):i.length==1?u=[i.pop(),c]:(n=i.pop(),n<s&&(s=n,a=c),c=e.indexOf(r,f+1)),f=o<c&&o>=0?o:c;i.length&&(u=[s,a])}return u}});var ir=_chunkNEJSZOZXjs.b.call(void 0, ($e,er)=>{var Fr=Wt(),Vt=Kt();er.exports=Ur;var Xt="\0SLASH"+Math.random()+"\0",Jt="\0OPEN"+Math.random()+"\0",dt="\0CLOSE"+Math.random()+"\0",Yt="\0COMMA"+Math.random()+"\0",tr="\0PERIOD"+Math.random()+"\0";function pt(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function Br(t){return t.split("\\\\").join(Xt).split("\\{").join(Jt).split("\\}").join(dt).split("\\,").join(Yt).split("\\.").join(tr)}function Qr(t){return t.split(Xt).join("\\").split(Jt).join("{").split(dt).join("}").split(Yt).join(",").split(tr).join(".")}function rr(t){if(!t)return[""];var r=[],e=Vt("{","}",t);if(!e)return t.split(",");var i=e.pre,n=e.body,s=e.post,a=i.split(",");a[a.length-1]+="{"+n+"}";var u=rr(s);return s.length&&(a[a.length-1]+=u.shift(),a.push.apply(a,u)),r.push.apply(r,a),r}function Ur(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Q(Br(t),!0).map(Qr)):[]}function Wr(t){return"{"+t+"}"}function xr(t){return/^-?0\d/.test(t)}function zr(t,r){return t<=r}function Hr(t,r){return t>=r}function Q(t,r){var e=[],i=Vt("{","}",t);if(!i||/\$$/.test(i.pre))return[t];var n=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),a=n||s,u=i.body.indexOf(",")>=0;if(!a&&!u)return i.post.match(/,.*\}/)?(t=i.pre+"{"+i.body+dt+i.post,Q(t)):[t];var o;if(a)o=i.body.split(/\.\./);else if(o=rr(i.body),o.length===1&&(o=Q(o[0],!1).map(Wr),o.length===1)){var f=i.post.length?Q(i.post,!1):[""];return f.map(function(at){return i.pre+o[0]+at})}var c=i.pre,f=i.post.length?Q(i.post,!1):[""],p;if(a){var l=pt(o[0]),h=pt(o[1]),v=Math.max(o[0].length,o[1].length),d=o.length==3?Math.abs(pt(o[2])):1,m=zr,y=h<l;y&&(d*=-1,m=Hr);var b=o.some(xr);p=[];for(var k=l;m(k,h);k+=d){var _;if(s)_=String.fromCharCode(k),_==="\\"&&(_="");else if(_=String(k),b){var j=v-_.length;if(j>0){var V=new Array(j+1).join("0");k<0?_="-"+V+_.slice(1):_=V+_}}p.push(_)}}else p=Fr(o,function(X){return Q(X,!1)});for(var F=0;F<p.length;F++)for(var T=0;T<f.length;T++){var I=c+p[F]+f[T];(!r||a||I)&&e.push(I)}return e}});var tt=_chunkNEJSZOZXjs.b.call(void 0, (Fe,ur)=>{ur.exports=A;A.Minimatch=E;var z=function(){try{return _chunkNEJSZOZXjs.a.call(void 0, "path")}catch (e2){}}()||{sep:"/"};A.sep=z.sep;var yt=A.GLOBSTAR=E.GLOBSTAR={},Zr=ir(),nr={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},mt="[^/]",gt=mt+"*?",Kr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Vr="(?:(?!(?:\\/|^)\\.).)*?",ar=Xr("().*{}+?[]^$\\!");function Xr(t){return t.split("").reduce(function(r,e){return r[e]=!0,r},{})}var sr=/\/+/;A.filter=Jr;function Jr(t,r){return r=r||{},function(e,i,n){return A(e,t,r)}}function R(t,r){r=r||{};var e={};return Object.keys(t).forEach(function(i){e[i]=t[i]}),Object.keys(r).forEach(function(i){e[i]=r[i]}),e}A.defaults=function(t){if(!t||typeof t!="object"||!Object.keys(t).length)return A;var r=A,e=function(n,s,a){return r(n,s,R(t,a))};return e.Minimatch=function(n,s){return new r.Minimatch(n,R(t,s))},e.Minimatch.defaults=function(n){return r.defaults(R(t,n)).Minimatch},e.filter=function(n,s){return r.filter(n,R(t,s))},e.defaults=function(n){return r.defaults(R(t,n))},e.makeRe=function(n,s){return r.makeRe(n,R(t,s))},e.braceExpand=function(n,s){return r.braceExpand(n,R(t,s))},e.match=function(i,n,s){return r.match(i,n,R(t,s))},e};E.defaults=function(t){return A.defaults(t).Minimatch};function A(t,r,e){return Y(r),e||(e={}),!e.nocomment&&r.charAt(0)==="#"?!1:new E(r,e).match(t)}function E(t,r){if(!(this instanceof E))return new E(t,r);Y(t),r||(r={}),t=t.trim(),!r.allowWindowsEscape&&z.sep!=="/"&&(t=t.split(z.sep).join("/")),this.options=r,this.set=[],this.pattern=t,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.make()}E.prototype.debug=function(){};E.prototype.make=Yr;function Yr(){var t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate();var e=this.globSet=this.braceExpand();r.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,e),e=this.globParts=e.map(function(i){return i.split(sr)}),this.debug(this.pattern,e),e=e.map(function(i,n,s){return i.map(this.parse,this)},this),this.debug(this.pattern,e),e=e.filter(function(i){return i.indexOf(!1)===-1}),this.debug(this.pattern,e),this.set=e}E.prototype.parseNegate=te;function te(){var t=this.pattern,r=!1,e=this.options,i=0;if(!e.nonegate){for(var n=0,s=t.length;n<s&&t.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=t.substr(i)),this.negate=r}}A.braceExpand=function(t,r){return or(t,r)};E.prototype.braceExpand=or;function or(t,r){return r||(this instanceof E?r=this.options:r={}),t=typeof t>"u"?this.pattern:t,Y(t),r.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Zr(t)}var re=1024*64,Y=function(t){if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>re)throw new TypeError("pattern is too long")};E.prototype.parse=ee;var J={};function ee(t,r){Y(t);var e=this.options;if(t==="**")if(e.noglobstar)t="*";else return yt;if(t==="")return"";var i="",n=!!e.nocase,s=!1,a=[],u=[],o,c=!1,f=-1,p=-1,l=t.charAt(0)==="."?"":e.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",h=this;function v(){if(o){switch(o){case"*":i+=gt,n=!0;break;case"?":i+=mt,n=!0;break;default:i+="\\"+o;break}h.debug("clearStateChar %j %j",o,i),o=!1}}for(var d=0,m=t.length,y;d<m&&(y=t.charAt(d));d++){if(this.debug("%s %s %s %j",t,d,i,y),s&&ar[y]){i+="\\"+y,s=!1;continue}switch(y){case"/":return!1;case"\\":v(),s=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,d,i,y),c){this.debug(" in class"),y==="!"&&d===p+1&&(y="^"),i+=y;continue}h.debug("call clearStateChar %j",o),v(),o=y,e.noext&&v();continue;case"(":if(c){i+="(";continue}if(!o){i+="\\(";continue}a.push({type:o,start:d-1,reStart:i.length,open:nr[o].open,close:nr[o].close}),i+=o==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",o,i),o=!1;continue;case")":if(c||!a.length){i+="\\)";continue}v(),n=!0;var b=a.pop();i+=b.close,b.type==="!"&&u.push(b),b.reEnd=i.length;continue;case"|":if(c||!a.length||s){i+="\\|",s=!1;continue}v(),i+="|";continue;case"[":if(v(),c){i+="\\"+y;continue}c=!0,p=d,f=i.length,i+=y;continue;case"]":if(d===p+1||!c){i+="\\"+y,s=!1;continue}var k=t.substring(p+1,d);try{RegExp("["+k+"]")}catch (e3){var _=this.parse(k,J);i=i.substr(0,f)+"\\["+_[0]+"\\]",n=n||_[1],c=!1;continue}n=!0,c=!1,i+=y;continue;default:v(),s?s=!1:ar[y]&&!(y==="^"&&c)&&(i+="\\"),i+=y}}for(c&&(k=t.substr(p+1),_=this.parse(k,J),i=i.substr(0,f)+"\\["+_[0],n=n||_[1]),b=a.pop();b;b=a.pop()){var j=i.slice(b.reStart+b.open.length);this.debug("setting tail",i,b),j=j.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(Ct,Gt,ut){return ut||(ut="\\"),Gt+Gt+ut+"|"}),this.debug(`tail=%j
|
2
|
+
%s`,j,j,b,i);var V=b.type==="*"?gt:b.type==="?"?mt:"\\"+b.type;n=!0,i=i.slice(0,b.reStart)+V+"\\("+j}v(),s&&(i+="\\\\");var F=!1;switch(i.charAt(0)){case"[":case".":case"(":F=!0}for(var T=u.length-1;T>-1;T--){var I=u[T],X=i.slice(0,I.reStart),at=i.slice(I.reStart,I.reEnd-8),Dt=i.slice(I.reEnd-8,I.reEnd),W=i.slice(I.reEnd);Dt+=W;var Nr=X.split("(").length-1,st=W;for(d=0;d<Nr;d++)st=st.replace(/\)[+*?]?/,"");W=st;var Tt="";W===""&&r!==J&&(Tt="$");var Lr=X+at+W+Tt+Dt;i=Lr}if(i!==""&&n&&(i="(?=.)"+i),F&&(i=l+i),r===J)return[i,n];if(!n)return ne(t);var Mr=e.nocase?"i":"";try{var ot=new RegExp("^"+i+"$",Mr)}catch (e4){return new RegExp("$.")}return ot._glob=t,ot._src=i,ot}A.makeRe=function(t,r){return new E(t,r||{}).makeRe()};E.prototype.makeRe=ie;function ie(){if(this.regexp||this.regexp===!1)return this.regexp;var t=this.set;if(!t.length)return this.regexp=!1,this.regexp;var r=this.options,e=r.noglobstar?gt:r.dot?Kr:Vr,i=r.nocase?"i":"",n=t.map(function(s){return s.map(function(a){return a===yt?e:typeof a=="string"?ae(a):a._src}).join("\\/")}).join("|");n="^(?:"+n+")$",this.negate&&(n="^(?!"+n+").*$");try{this.regexp=new RegExp(n,i)}catch (e5){this.regexp=!1}return this.regexp}A.match=function(t,r,e){e=e||{};var i=new E(r,e);return t=t.filter(function(n){return i.match(n)}),i.options.nonull&&!t.length&&t.push(r),t};E.prototype.match=function(r,e){if(typeof e>"u"&&(e=this.partial),this.debug("match",r,this.pattern),this.comment)return!1;if(this.empty)return r==="";if(r==="/"&&e)return!0;var i=this.options;z.sep!=="/"&&(r=r.split(z.sep).join("/")),r=r.split(sr),this.debug(this.pattern,"split",r);var n=this.set;this.debug(this.pattern,"set",n);var s,a;for(a=r.length-1;a>=0&&(s=r[a],!s);a--);for(a=0;a<n.length;a++){var u=n[a],o=r;i.matchBase&&u.length===1&&(o=[s]);var c=this.matchOne(o,u,e);if(c)return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate};E.prototype.matchOne=function(t,r,e){var i=this.options;this.debug("matchOne",{this:this,file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var n=0,s=0,a=t.length,u=r.length;n<a&&s<u;n++,s++){this.debug("matchOne loop");var o=r[s],c=t[n];if(this.debug(r,o,c),o===!1)return!1;if(o===yt){this.debug("GLOBSTAR",[r,o,c]);var f=n,p=s+1;if(p===u){for(this.debug("** at the end");n<a;n++)if(t[n]==="."||t[n]===".."||!i.dot&&t[n].charAt(0)===".")return!1;return!0}for(;f<a;){var l=t[f];if(this.debug(`
|
3
|
+
globstar while`,t,f,r,p,l),this.matchOne(t.slice(f),r.slice(p),e))return this.debug("globstar found match!",f,a,l),!0;if(l==="."||l===".."||!i.dot&&l.charAt(0)==="."){this.debug("dot detected!",t,f,r,p);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(e&&(this.debug(`
|
4
|
+
>>> no match, partial?`,t,f,r,p),f===a))}var h;if(typeof o=="string"?(h=c===o,this.debug("string match",o,c,h)):(h=c.match(o),this.debug("pattern match",o,c,h)),!h)return!1}if(n===a&&s===u)return!0;if(n===a)return e;if(s===u)return n===a-1&&t[n]==="";throw new Error("wtf?")};function ne(t){return t.replace(/\\(.)/g,"$1")}function ae(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var cr=_chunkNEJSZOZXjs.b.call(void 0, (Be,bt)=>{typeof Object.create=="function"?bt.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:bt.exports=function(r,e){if(e){r.super_=e;var i=function(){};i.prototype=e.prototype,r.prototype=new i,r.prototype.constructor=r}}});var hr=_chunkNEJSZOZXjs.b.call(void 0, (Qe,_t)=>{try{if(wt=_chunkNEJSZOZXjs.a.call(void 0, "util"),typeof wt.inherits!="function")throw"";_t.exports=wt.inherits}catch (e6){_t.exports=cr()}var wt});var et=_chunkNEJSZOZXjs.b.call(void 0, (Ue,rt)=>{"use strict";function fr(t){return t.charAt(0)==="/"}function lr(t){var r=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,e=r.exec(t),i=e[1]||"",n=!!(i&&i.charAt(1)!==":");return!!(e[2]||n)}rt.exports=process.platform==="win32"?lr:fr;rt.exports.posix=fr;rt.exports.win32=lr});var kt=_chunkNEJSZOZXjs.b.call(void 0, D=>{D.setopts=fe;D.ownProp=vr;D.makeAbs=H;D.finish=le;D.mark=ve;D.isIgnored=dr;D.childrenIgnored=pe;function vr(t,r){return Object.prototype.hasOwnProperty.call(t,r)}var se=_chunkNEJSZOZXjs.a.call(void 0, "fs"),U=_chunkNEJSZOZXjs.a.call(void 0, "path"),oe=tt(),pr=et(),Et=oe.Minimatch;function ue(t,r){return t.localeCompare(r,"en")}function ce(t,r){t.ignore=r.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(he))}function he(t){var r=null;if(t.slice(-3)==="/**"){var e=t.replace(/(\/\*\*)+$/,"");r=new Et(e,{dot:!0})}return{matcher:new Et(t,{dot:!0}),gmatcher:r}}function fe(t,r,e){if(e||(e={}),e.matchBase&&r.indexOf("/")===-1){if(e.noglobstar)throw new Error("base matching requires globstar");r="**/"+r}t.silent=!!e.silent,t.pattern=r,t.strict=e.strict!==!1,t.realpath=!!e.realpath,t.realpathCache=e.realpathCache||Object.create(null),t.follow=!!e.follow,t.dot=!!e.dot,t.mark=!!e.mark,t.nodir=!!e.nodir,t.nodir&&(t.mark=!0),t.sync=!!e.sync,t.nounique=!!e.nounique,t.nonull=!!e.nonull,t.nosort=!!e.nosort,t.nocase=!!e.nocase,t.stat=!!e.stat,t.noprocess=!!e.noprocess,t.absolute=!!e.absolute,t.fs=e.fs||se,t.maxLength=e.maxLength||1/0,t.cache=e.cache||Object.create(null),t.statCache=e.statCache||Object.create(null),t.symlinks=e.symlinks||Object.create(null),ce(t,e),t.changedCwd=!1;var i=process.cwd();vr(e,"cwd")?(t.cwd=U.resolve(e.cwd),t.changedCwd=t.cwd!==i):t.cwd=i,t.root=e.root||U.resolve(t.cwd,"/"),t.root=U.resolve(t.root),process.platform==="win32"&&(t.root=t.root.replace(/\\/g,"/")),t.cwdAbs=pr(t.cwd)?t.cwd:H(t,t.cwd),process.platform==="win32"&&(t.cwdAbs=t.cwdAbs.replace(/\\/g,"/")),t.nomount=!!e.nomount,e.nonegate=!0,e.nocomment=!0,e.allowWindowsEscape=!1,t.minimatch=new Et(r,e),t.options=t.minimatch.options}function le(t){for(var r=t.nounique,e=r?[]:Object.create(null),i=0,n=t.matches.length;i<n;i++){var s=t.matches[i];if(!s||Object.keys(s).length===0){if(t.nonull){var a=t.minimatch.globSet[i];r?e.push(a):e[a]=!0}}else{var u=Object.keys(s);r?e.push.apply(e,u):u.forEach(function(o){e[o]=!0})}}if(r||(e=Object.keys(e)),t.nosort||(e=e.sort(ue)),t.mark){for(var i=0;i<e.length;i++)e[i]=t._mark(e[i]);t.nodir&&(e=e.filter(function(o){var c=!/\/$/.test(o),f=t.cache[o]||t.cache[H(t,o)];return c&&f&&(c=f!=="DIR"&&!Array.isArray(f)),c}))}t.ignore.length&&(e=e.filter(function(o){return!dr(t,o)})),t.found=e}function ve(t,r){var e=H(t,r),i=t.cache[e],n=r;if(i){var s=i==="DIR"||Array.isArray(i),a=r.slice(-1)==="/";if(s&&!a?n+="/":!s&&a&&(n=n.slice(0,-1)),n!==r){var u=H(t,n);t.statCache[u]=t.statCache[e],t.cache[u]=t.cache[e]}}return n}function H(t,r){var e=r;return r.charAt(0)==="/"?e=U.join(t.root,r):pr(r)||r===""?e=r:t.changedCwd?e=U.resolve(t.cwd,r):e=U.resolve(r),process.platform==="win32"&&(e=e.replace(/\\/g,"/")),e}function dr(t,r){return t.ignore.length?t.ignore.some(function(e){return e.matcher.match(r)||!!(e.gmatcher&&e.gmatcher.match(r))}):!1}function pe(t,r){return t.ignore.length?t.ignore.some(function(e){return!!(e.gmatcher&&e.gmatcher.match(r))}):!1}});var wr=_chunkNEJSZOZXjs.b.call(void 0, (Ze,br)=>{br.exports=yr;yr.GlobSync=w;var de=vt(),mr=tt(),xe=mr.Minimatch,ze=_r().Glob,He=_chunkNEJSZOZXjs.a.call(void 0, "util"),St=_chunkNEJSZOZXjs.a.call(void 0, "path"),gr=_chunkNEJSZOZXjs.a.call(void 0, "assert"),it=et(),G=kt(),me=G.setopts,Ot=G.ownProp,ge=G.childrenIgnored,ye=G.isIgnored;function yr(t,r){if(typeof r=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
|
5
|
+
See: https://github.com/isaacs/node-glob/issues/167`);return new w(t,r).found}function w(t,r){if(!t)throw new Error("must provide pattern");if(typeof r=="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 w))return new w(t,r);if(me(this,t,r),this.noprocess)return this;var e=this.minimatch.set.length;this.matches=new Array(e);for(var i=0;i<e;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}w.prototype._finish=function(){if(gr.ok(this instanceof w),this.realpath){var t=this;this.matches.forEach(function(r,e){var i=t.matches[e]=Object.create(null);for(var n in r)try{n=t._makeAbs(n);var s=de.realpathSync(n,t.realpathCache);i[s]=!0}catch(a){if(a.syscall==="stat")i[t._makeAbs(n)]=!0;else throw a}})}G.finish(this)};w.prototype._process=function(t,r,e){gr.ok(this instanceof w);for(var i=0;typeof t[i]=="string";)i++;var n;switch(i){case t.length:this._processSimple(t.join("/"),r);return;case 0:n=null;break;default:n=t.slice(0,i).join("/");break}var s=t.slice(i),a;n===null?a=".":((it(n)||it(t.map(function(c){return typeof c=="string"?c:"[*]"}).join("/")))&&(!n||!it(n))&&(n="/"+n),a=n);var u=this._makeAbs(a);if(!ge(this,a)){var o=s[0]===mr.GLOBSTAR;o?this._processGlobStar(n,a,u,s,r,e):this._processReaddir(n,a,u,s,r,e)}};w.prototype._processReaddir=function(t,r,e,i,n,s){var a=this._readdir(e,s);if(a){for(var u=i[0],o=!!this.minimatch.negate,c=u._glob,f=this.dot||c.charAt(0)===".",p=[],l=0;l<a.length;l++){var h=a[l];if(h.charAt(0)!=="."||f){var v;o&&!t?v=!h.match(u):v=h.match(u),v&&p.push(h)}}var d=p.length;if(d!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var l=0;l<d;l++){var h=p[l];t&&(t.slice(-1)!=="/"?h=t+"/"+h:h=t+h),h.charAt(0)==="/"&&!this.nomount&&(h=St.join(this.root,h)),this._emitMatch(n,h)}return}i.shift();for(var l=0;l<d;l++){var h=p[l],m;t?m=[t,h]:m=[h],this._process(m.concat(i),n,s)}}}};w.prototype._emitMatch=function(t,r){if(!ye(this,r)){var e=this._makeAbs(r);if(this.mark&&(r=this._mark(r)),this.absolute&&(r=e),!this.matches[t][r]){if(this.nodir){var i=this.cache[e];if(i==="DIR"||Array.isArray(i))return}this.matches[t][r]=!0,this.stat&&this._stat(r)}}};w.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var r,e,i;try{e=this.fs.lstatSync(t)}catch(s){if(s.code==="ENOENT")return null}var n=e&&e.isSymbolicLink();return this.symlinks[t]=n,!n&&e&&!e.isDirectory()?this.cache[t]="FILE":r=this._readdir(t,!1),r};w.prototype._readdir=function(t,r){var e;if(r&&!Ot(this.symlinks,t))return this._readdirInGlobStar(t);if(Ot(this.cache,t)){var i=this.cache[t];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(t,this.fs.readdirSync(t))}catch(n){return this._readdirError(t,n),null}};w.prototype._readdirEntries=function(t,r){if(!this.mark&&!this.stat)for(var e=0;e<r.length;e++){var i=r[e];t==="/"?i=t+i:i=t+"/"+i,this.cache[i]=!0}return this.cache[t]=r,r};w.prototype._readdirError=function(t,r){switch(r.code){case"ENOTSUP":case"ENOTDIR":var e=this._makeAbs(t);if(this.cache[e]="FILE",e===this.cwdAbs){var i=new Error(r.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=r.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:if(this.cache[this._makeAbs(t)]=!1,this.strict)throw r;this.silent||console.error("glob error",r);break}};w.prototype._processGlobStar=function(t,r,e,i,n,s){var a=this._readdir(e,s);if(a){var u=i.slice(1),o=t?[t]:[],c=o.concat(u);this._process(c,n,!1);var f=a.length,p=this.symlinks[e];if(!(p&&s))for(var l=0;l<f;l++){var h=a[l];if(!(h.charAt(0)==="."&&!this.dot)){var v=o.concat(a[l],u);this._process(v,n,!0);var d=o.concat(a[l],i);this._process(d,n,!0)}}}};w.prototype._processSimple=function(t,r){var e=this._stat(t);if(this.matches[r]||(this.matches[r]=Object.create(null)),!!e){if(t&&it(t)&&!this.nomount){var i=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=St.join(this.root,t):(t=St.resolve(this.root,t),i&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(r,t)}};w.prototype._stat=function(t){var r=this._makeAbs(t),e=t.slice(-1)==="/";if(t.length>this.maxLength)return!1;if(!this.stat&&Ot(this.cache,r)){var a=this.cache[r];if(Array.isArray(a)&&(a="DIR"),!e||a==="DIR")return a;if(e&&a==="FILE")return!1}var i,n=this.statCache[r];if(!n){var s;try{s=this.fs.lstatSync(r)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[r]=!1,!1}if(s&&s.isSymbolicLink())try{n=this.fs.statSync(r)}catch (e7){n=s}else n=s}this.statCache[r]=n;var a=!0;return n&&(a=n.isDirectory()?"DIR":"FILE"),this.cache[r]=this.cache[r]||a,e&&a==="FILE"?!1:a};w.prototype._mark=function(t){return G.mark(this,t)};w.prototype._makeAbs=function(t){return G.makeAbs(this,t)}});var At=_chunkNEJSZOZXjs.b.call(void 0, (Ke,kr)=>{kr.exports=Er;function Er(t,r){if(t&&r)return Er(t)(r);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(i){e[i]=t[i]}),e;function e(){for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];var s=t.apply(this,i),a=i[i.length-1];return typeof s=="function"&&s!==a&&Object.keys(a).forEach(function(u){s[u]=a[u]}),s}}});var It=_chunkNEJSZOZXjs.b.call(void 0, (Ve,jt)=>{var Sr=At();jt.exports=Sr(nt);jt.exports.strict=Sr(Or);nt.proto=nt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return nt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Or(this)},configurable:!0})});function nt(t){var r=function(){return r.called?r.value:(r.called=!0,r.value=t.apply(this,arguments))};return r.called=!1,r}function Or(t){var r=function(){if(r.called)throw new Error(r.onceError);return r.called=!0,r.value=t.apply(this,arguments)},e=t.name||"Function wrapped with `once`";return r.onceError=e+" shouldn't be called more than once",r.called=!1,r}});var jr=_chunkNEJSZOZXjs.b.call(void 0, (Xe,Ar)=>{var be=At(),Z=Object.create(null),we=It();Ar.exports=be(_e);function _e(t,r){return Z[t]?(Z[t].push(r),null):(Z[t]=[r],Ee(t))}function Ee(t){return we(function r(){var e=Z[t],i=e.length,n=ke(arguments);try{for(var s=0;s<i;s++)e[s].apply(null,n)}finally{e.length>i?(e.splice(0,i),process.nextTick(function(){r.apply(null,n)})):delete Z[t]}})}function ke(t){for(var r=t.length,e=[],i=0;i<r;i++)e[i]=t[i];return e}});var _r=_chunkNEJSZOZXjs.b.call(void 0, (ti,qr)=>{qr.exports=P;var Se=vt(),Ir=tt(),Je=Ir.Minimatch,Oe=hr(),Ae=_chunkNEJSZOZXjs.a.call(void 0, "events").EventEmitter,qt=_chunkNEJSZOZXjs.a.call(void 0, "path"),Nt=_chunkNEJSZOZXjs.a.call(void 0, "assert"),K=et(),Mt=wr(),$=kt(),je=$.setopts,Lt=$.ownProp,Rt=jr(),Ye=_chunkNEJSZOZXjs.a.call(void 0, "util"),Ie=$.childrenIgnored,qe=$.isIgnored,Ne=It();function P(t,r,e){if(typeof r=="function"&&(e=r,r={}),r||(r={}),r.sync){if(e)throw new TypeError("callback provided to sync glob");return Mt(t,r)}return new g(t,r,e)}P.sync=Mt;var Le=P.GlobSync=Mt.GlobSync;P.glob=P;function Me(t,r){if(r===null||typeof r!="object")return t;for(var e=Object.keys(r),i=e.length;i--;)t[e[i]]=r[e[i]];return t}P.hasMagic=function(t,r){var e=Me({},r);e.noprocess=!0;var i=new g(t,e),n=i.minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var s=0;s<n[0].length;s++)if(typeof n[0][s]!="string")return!0;return!1};P.Glob=g;Oe(g,Ae);function g(t,r,e){if(typeof r=="function"&&(e=r,r=null),r&&r.sync){if(e)throw new TypeError("callback provided to sync glob");return new Le(t,r)}if(!(this instanceof g))return new g(t,r,e);je(this,t,r),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof e=="function"&&(e=Ne(e),this.on("error",e),this.on("end",function(o){e(null,o)}));var n=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return u();for(var s=!0,a=0;a<i;a++)this._process(this.minimatch.set[a],a,!1,u);s=!1;function u(){--n._processing,n._processing<=0&&(s?process.nextTick(function(){n._finish()}):n._finish())}}g.prototype._finish=function(){if(Nt(this instanceof g),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();$.finish(this),this.emit("end",this.found)}};g.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var t=this.matches.length;if(t===0)return this._finish();for(var r=this,e=0;e<this.matches.length;e++)this._realpathSet(e,i);function i(){--t===0&&r._finish()}};g.prototype._realpathSet=function(t,r){var e=this.matches[t];if(!e)return r();var i=Object.keys(e),n=this,s=i.length;if(s===0)return r();var a=this.matches[t]=Object.create(null);i.forEach(function(u,o){u=n._makeAbs(u),Se.realpath(u,n.realpathCache,function(c,f){c?c.syscall==="stat"?a[u]=!0:n.emit("error",c):a[f]=!0,--s===0&&(n.matches[t]=a,r())})})};g.prototype._mark=function(t){return $.mark(this,t)};g.prototype._makeAbs=function(t){return $.makeAbs(this,t)};g.prototype.abort=function(){this.aborted=!0,this.emit("abort")};g.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};g.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var t=this._emitQueue.slice(0);this._emitQueue.length=0;for(var r=0;r<t.length;r++){var e=t[r];this._emitMatch(e[0],e[1])}}if(this._processQueue.length){var i=this._processQueue.slice(0);this._processQueue.length=0;for(var r=0;r<i.length;r++){var n=i[r];this._processing--,this._process(n[0],n[1],n[2],n[3])}}}};g.prototype._process=function(t,r,e,i){if(Nt(this instanceof g),Nt(typeof i=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([t,r,e,i]);return}for(var n=0;typeof t[n]=="string";)n++;var s;switch(n){case t.length:this._processSimple(t.join("/"),r,i);return;case 0:s=null;break;default:s=t.slice(0,n).join("/");break}var a=t.slice(n),u;s===null?u=".":((K(s)||K(t.map(function(f){return typeof f=="string"?f:"[*]"}).join("/")))&&(!s||!K(s))&&(s="/"+s),u=s);var o=this._makeAbs(u);if(Ie(this,u))return i();var c=a[0]===Ir.GLOBSTAR;c?this._processGlobStar(s,u,o,a,r,e,i):this._processReaddir(s,u,o,a,r,e,i)}};g.prototype._processReaddir=function(t,r,e,i,n,s,a){var u=this;this._readdir(e,s,function(o,c){return u._processReaddir2(t,r,e,i,n,s,c,a)})};g.prototype._processReaddir2=function(t,r,e,i,n,s,a,u){if(!a)return u();for(var o=i[0],c=!!this.minimatch.negate,f=o._glob,p=this.dot||f.charAt(0)===".",l=[],h=0;h<a.length;h++){var v=a[h];if(v.charAt(0)!=="."||p){var d;c&&!t?d=!v.match(o):d=v.match(o),d&&l.push(v)}}var m=l.length;if(m===0)return u();if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var h=0;h<m;h++){var v=l[h];t&&(t!=="/"?v=t+"/"+v:v=t+v),v.charAt(0)==="/"&&!this.nomount&&(v=qt.join(this.root,v)),this._emitMatch(n,v)}return u()}i.shift();for(var h=0;h<m;h++){var v=l[h],y;t&&(t!=="/"?v=t+"/"+v:v=t+v),this._process([v].concat(i),n,s,u)}u()};g.prototype._emitMatch=function(t,r){if(!this.aborted&&!qe(this,r)){if(this.paused){this._emitQueue.push([t,r]);return}var e=K(r)?r:this._makeAbs(r);if(this.mark&&(r=this._mark(r)),this.absolute&&(r=e),!this.matches[t][r]){if(this.nodir){var i=this.cache[e];if(i==="DIR"||Array.isArray(i))return}this.matches[t][r]=!0;var n=this.statCache[e];n&&this.emit("stat",r,n),this.emit("match",r)}}};g.prototype._readdirInGlobStar=function(t,r){if(this.aborted)return;if(this.follow)return this._readdir(t,!1,r);var e="lstat\0"+t,i=this,n=Rt(e,s);n&&i.fs.lstat(t,n);function s(a,u){if(a&&a.code==="ENOENT")return r();var o=u&&u.isSymbolicLink();i.symlinks[t]=o,!o&&u&&!u.isDirectory()?(i.cache[t]="FILE",r()):i._readdir(t,!1,r)}};g.prototype._readdir=function(t,r,e){if(!this.aborted&&(e=Rt("readdir\0"+t+"\0"+r,e),!!e)){if(r&&!Lt(this.symlinks,t))return this._readdirInGlobStar(t,e);if(Lt(this.cache,t)){var i=this.cache[t];if(!i||i==="FILE")return e();if(Array.isArray(i))return e(null,i)}var n=this;n.fs.readdir(t,Re(this,t,e))}};function Re(t,r,e){return function(i,n){i?t._readdirError(r,i,e):t._readdirEntries(r,n,e)}}g.prototype._readdirEntries=function(t,r,e){if(!this.aborted){if(!this.mark&&!this.stat)for(var i=0;i<r.length;i++){var n=r[i];t==="/"?n=t+n:n=t+"/"+n,this.cache[n]=!0}return this.cache[t]=r,e(null,r)}};g.prototype._readdirError=function(t,r,e){if(!this.aborted){switch(r.code){case"ENOTSUP":case"ENOTDIR":var i=this._makeAbs(t);if(this.cache[i]="FILE",i===this.cwdAbs){var n=new Error(r.code+" invalid cwd "+this.cwd);n.path=this.cwd,n.code=r.code,this.emit("error",n),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:this.cache[this._makeAbs(t)]=!1,this.strict&&(this.emit("error",r),this.abort()),this.silent||console.error("glob error",r);break}return e()}};g.prototype._processGlobStar=function(t,r,e,i,n,s,a){var u=this;this._readdir(e,s,function(o,c){u._processGlobStar2(t,r,e,i,n,s,c,a)})};g.prototype._processGlobStar2=function(t,r,e,i,n,s,a,u){if(!a)return u();var o=i.slice(1),c=t?[t]:[],f=c.concat(o);this._process(f,n,!1,u);var p=this.symlinks[e],l=a.length;if(p&&s)return u();for(var h=0;h<l;h++){var v=a[h];if(!(v.charAt(0)==="."&&!this.dot)){var d=c.concat(a[h],o);this._process(d,n,!0,u);var m=c.concat(a[h],i);this._process(m,n,!0,u)}}u()};g.prototype._processSimple=function(t,r,e){var i=this;this._stat(t,function(n,s){i._processSimple2(t,r,n,s,e)})};g.prototype._processSimple2=function(t,r,e,i,n){if(this.matches[r]||(this.matches[r]=Object.create(null)),!i)return n();if(t&&K(t)&&!this.nomount){var s=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=qt.join(this.root,t):(t=qt.resolve(this.root,t),s&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(r,t),n()};g.prototype._stat=function(t,r){var e=this._makeAbs(t),i=t.slice(-1)==="/";if(t.length>this.maxLength)return r();if(!this.stat&&Lt(this.cache,e)){var n=this.cache[e];if(Array.isArray(n)&&(n="DIR"),!i||n==="DIR")return r(null,n);if(i&&n==="FILE")return r()}var s,a=this.statCache[e];if(a!==void 0){if(a===!1)return r(null,a);var u=a.isDirectory()?"DIR":"FILE";return i&&u==="FILE"?r():r(null,u,a)}var o=this,c=Rt("stat\0"+e,f);c&&o.fs.lstat(e,c);function f(p,l){if(l&&l.isSymbolicLink())return o.fs.stat(e,function(h,v){h?o._stat2(t,e,null,l,r):o._stat2(t,e,h,v,r)});o._stat2(t,e,p,l,r)}};g.prototype._stat2=function(t,r,e,i,n){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return this.statCache[r]=!1,n();var s=t.slice(-1)==="/";if(this.statCache[r]=i,r.slice(-1)==="/"&&i&&!i.isDirectory())return n(null,!1,i);var a=!0;return i&&(a=i.isDirectory()?"DIR":"FILE"),this.cache[r]=this.cache[r]||a,s&&a==="FILE"?n():n(null,a,i)}});exports.a = _r;
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var d=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var e=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);exports.a = d; exports.b = e;
|
package/dist/jsh1/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#! /usr/bin/env node
|
2
|
-
"use strict";var
|
2
|
+
"use strict";var _chunk2CJVU2ONjs = require('../chunk-2CJVU2ON.js');var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var d=_chunkNEJSZOZXjs.b.call(void 0, (X,u)=>{var r=_chunkNEJSZOZXjs.a.call(void 0, "handlebars"),t=_chunkNEJSZOZXjs.a.call(void 0, "fs"),S=_chunkNEJSZOZXjs.a.call(void 0, "js-yaml"),{camelCase:b,capitalCase:F,constantCase:O,dotCase:j,headerCase:E,noCase:w,paramCase:_,pascalCase:I,pathCase:N,sentenceCase:v,snakeCase:D}=_chunkNEJSZOZXjs.a.call(void 0, "change-case");r.registerHelper("camelCase",b);r.registerHelper("capitalCase",F);r.registerHelper("constantCase",O);r.registerHelper("dotCase",j);r.registerHelper("headerCase",E);r.registerHelper("noCase",w);r.registerHelper("paramCase",_);r.registerHelper("pascalCase",I);r.registerHelper("pathCase",N);r.registerHelper("sentenceCase",v);r.registerHelper("snakeCase",D);r.registerHelper("isdefined",function(e){return e!==void 0});r.registerHelper("upper",function(e){return e.toUpperCase()});r.registerHelper("base64",function(e){return t.existsSync(e)?t.readFileSync(e,{encoding:"base64"}):""});r.registerHelper("read",function(e){return t.existsSync(e)?t.readFileSync(e,"utf8"):""});r.registerHelper("readOneLine",function(e){var n;return t.existsSync(e)?(n=t.readFileSync(e,"utf8"))==null?void 0:n.replace(/\n|\r/g," "):""});r.registerHelper("readEscape",function(e){var n;return t.existsSync(e)?(n=t.readFileSync(e,"utf8"))==null?void 0:n.replace(/\n|\r/g," ").replace(/\"/g,'\\"'):""});r.registerHelper("readJson",function(e){return t.existsSync(e)?JSON.parse(t.readFileSync(e,"utf8")):""});r.registerHelper("readYaml",function(e){return t.existsSync(e)?S.load(t.readFileSync(ymlFile,"utf8")):""});var G=(e,n={noEscape:!0})=>r.compile(e,n);u.exports={getEngine:G}});var m=_chunkNEJSZOZXjs.b.call(void 0, (Z,g)=>{var J=_chunkNEJSZOZXjs.a.call(void 0, "path");g.exports={CONFIG_DIR:J.join(__dirname,"config")}});var y=_chunkNEJSZOZXjs.b.call(void 0, (ee,C)=>{var f=_chunkNEJSZOZXjs.a.call(void 0, "path"),R=_chunk2CJVU2ONjs.a.call(void 0, ),k=_chunkNEJSZOZXjs.a.call(void 0, "js-yaml"),A=_chunkNEJSZOZXjs.a.call(void 0, "fs"),{CONFIG_DIR:L}=m(),P=e=>k.load(A.readFileSync(e,"utf8")),T=e=>R.sync(f.join(e)).map(P).reduce((n,o)=>({...n,...o}),{}),U=f.join(L,"*.yml"),Y=()=>T(U);C.exports={getConfig:Y}});var x=_chunkNEJSZOZXjs.b.call(void 0, (re,H)=>{var{getEngine:$}=d(),z=_chunkNEJSZOZXjs.a.call(void 0, "os"),p=y().getConfig(),{execSync:B,spawn:K}=_chunkNEJSZOZXjs.a.call(void 0, "child_process"),M=e=>e in p?p[e]:e;function Q(e,n,o=!1){if(o){let[a,...i]=e.split(" ");K(a,i,{stdio:"inherit",shell:n||!0,cwd:process.cwd()}).on("error",h=>{console.error("Error executing command:",h.message)})}else try{return B(e,{encoding:"utf-8"}).trim()}catch(a){throw console.error("Error executing command:",a.message),a}}var V={command:"*",describe:"convert json to yaml, csv, tsv, xlsx",builder:{template:{alias:"t",describe:"template string",demandOption:!1,default:void 0,type:"string"},exec:{alias:"e",describe:"execute command",demandOption:!1,type:"boolean"},print:{alias:"p",describe:"print command",demandOption:!1,type:"boolean"},shell:{alias:"s",describe:"shell",demandOption:!1,type:"string"}},handler(e){(async()=>{let{template:n,exec:o,print:a}=e;if(!n){console.log(`jsh1 -t {template} [options]
|
3
3
|
|
4
4
|
template:
|
5
5
|
`,Object.keys(p).map(c=>` ${c}
|
6
|
-
`).join(""));return}let i=$(M(n),{noEscape:!0})(e);if(o){let c=i;z.platform()==="win32"&&(c="chcp 65001 && "+i),Q(c,e.shell,!0),a&&console.log(i)}else console.log(i)})()}};H.exports=V});var W=()=>{let e=
|
6
|
+
`).join(""));return}let i=$(M(n),{noEscape:!0})(e);if(o){let c=i;z.platform()==="win32"&&(c="chcp 65001 && "+i),Q(c,e.shell,!0),a&&console.log(i)}else console.log(i)})()}};H.exports=V});var W=()=>{let e=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("fmt1");e.command(x());let n=e.parse()};W();
|
package/dist/xl1/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#! /usr/bin/env node
|
2
|
-
"use strict";var _chunk5KSN6VOAjs = require('../chunk-5KSN6VOA.js');var E=_chunk5KSN6VOAjs.b.call(void 0, (Ye,Q)=>{var T=_chunk5KSN6VOAjs.a.call(void 0, "fs"),W=_chunk5KSN6VOAjs.a.call(void 0, "xlsx"),me=e=>{let{file:t,sheet:s,range:n,defval:o,noNullRow:r}=e;if(!T.existsSync(t)){console.log("file not found, ",t);return}if(![".xlsx",".xlsm"].find(u=>t.endsWith(u))){console.log("file type error, ",t);return}let l=W.readFile(t,{bookSheets:!1});if(!l)return null;let h=l.Sheets[s||l.SheetNames[0]],i={range:n,blankrows:!1,defval:o},d=W.utils.sheet_to_json(h,i);return r?d.filter(u=>Object.values(u).some(p=>!!p)):d},ye=e=>{let{file:t,data:s,sheet:n}=e;if(!(t&&s&&Array.isArray(s)&&s.length>0))return;let o=Array.isArray(s[0])?W.utils.aoa_to_sheet(s):W.utils.json_to_sheet(s),r=T.existsSync(t)?W.readFile(t,{cellDates:!0}):W.utils.book_new();W.utils.book_append_sheet(r,o,n?n.substring(0,31):"Sheet1",!0),W.writeFile(r,t,{compression:!0})},N=e=>{let[t,s]=e.split(":"),n=t.replace(/\D/g,""),o=s.replace(/\D/g,""),r=t.replace(/\d/g,""),l=s.replace(/\d/g,"");return{startRow:parseInt(n),endRow:parseInt(o),startCol:r,endCol:l,firstRow:`${t}:${l}${n}`,firstCol:`${t}:${r}${o}`}},z=(e,t,s,n,o)=>{let r=[];for(let l=t;l<=s;l++){let c=[];for(let h=n;h<=o;h++){let d=e[""];c.push(d?d.v:null)}r.push(c)}return r},Z=(e,t)=>{let s=N(t);return z(e,s.startRow,s.endRow,s.startCol,s.endCol)},be=(e,t)=>{let s=N(t);return Z(e,s.firstRow)[0]},Se=(e,t)=>{let s=N(t);return Z(e,s.firstCol)[0]};Q.exports={readXlsx:me,writeXlsx:ye,getSheetData:Z,getSheetData2:z,parseRange:N,getFirstRow:be,getFirstCol:Se}});var G=_chunk5KSN6VOAjs.b.call(void 0, (Ge,le)=>{var L=_chunk5KSN6VOAjs.a.call(void 0, "path"),y=_chunk5KSN6VOAjs.a.call(void 0, "fs"),Y=_chunk5KSN6VOAjs.c.call(void 0, ),U=_chunk5KSN6VOAjs.a.call(void 0, "js-yaml"),J=_chunk5KSN6VOAjs.a.call(void 0, "xlsx"),{readXlsx:V,writeXlsx:ee}=E(),ke=_chunk5KSN6VOAjs.a.call(void 0, "json2xml"),H=(e,t="",s={})=>{for(let n in e)if(e.hasOwnProperty(n)){let o=t?`${t}.${n}`:n;typeof e[n]=="object"&&e[n]!==null&&!Array.isArray(e[n])?H(e[n],o,s):s[o]=e[n]}return s},M=(e,t)=>{let s=L.dirname(t);y.existsSync(s)||y.mkdirSync(s,{recursive:!0}),y.writeFileSync(t,e,{encoding:"utf8"})},Re=e=>Y.sync(L.join(e)),Fe=e=>Y.sync(L.join(e)).find(t=>t!==void 0),Ce=e=>{let t=Y.sync(e,{cwd:".",nocase:!0,nodir:!1});return t&&t.length>0},te=e=>y.existsSync(e)?JSON.parse(y.readFileSync(e,"utf8")):null,se=e=>y.existsSync(e)?U.load(y.readFileSync(e,"utf8")):null,ne=e=>{let{file:t,data:s}=e;if(Array.isArray(s)){let n=y.createWriteStream(t);n.write("[","utf-8"),s.map((o,r)=>n.write(JSON.stringify(o)+(r===s.length-1?"":","),"utf-8")),n.write("]","utf-8"),n.end(),n.on("finish",()=>{}),n.on("error",o=>{console.error(o)})}else y.writeFileSync(t,JSON.stringify(s,null,2),{encoding:"utf8"})},oe=e=>{let{file:t,data:s}=e,n=U.dump(s);y.writeFileSync(t,n,"utf8")},_e=e=>{let{file:t}=e;if(!y.existsSync(t))return null;if(t.endsWith(".json"))return te(t);if(t.endsWith(".yaml")||t.endsWith(".yml"))return se(t);if(t.endsWith(".xlsx"))return V(e)},We=e=>!![".json",".yaml",".xlsx",".yml"].find(s=>e.endsWith(s)),re=(e,t,s)=>{if(e.endsWith(".json"))return ne({file:e,data:t});if(e.endsWith(".yaml")||e.endsWith(".yml"))return oe({file:e,data:t});if(e.endsWith(".xlsx"))return ee({file:e,data:t.map(H),sheet:s&&s.sheet?s.sheet:"Sheet1"});if(e.endsWith(".csv")){let n=J.utils.json_to_sheet(t.map(H)),o=J.utils.sheet_to_csv(n);return M(o,e)}if(e.endsWith(".tsv")){let n=J.utils.json_to_sheet(t.map(H)),o=J.utils.sheet_to_csv(n,{FS:" "});return M(o,e)}if(e.endsWith(".xml")){let n=ke(t,{header:!0});return M(n,e)}console.error("not support type")},Ae=e=>{let{files:t,data:s,sheet:n}=e;t&&t.length>0&&t.map(o=>{re(o,s,{sheet:n})})};le.exports={save:M,find:Re,findOne:Fe,isExsit:Ce,readJson:te,writeJson:ne,readYaml:se,writeYaml:oe,readXlsx:V,writeXlsx:ee,readFile:_e,canReadFile:We,writeFile:re,writeFiles:Ae}});var ce=_chunk5KSN6VOAjs.b.call(void 0, (Ke,ae)=>{var{readXlsx:Oe}=E(),{writeFile:ve}=G(),je={command:"read",describe:"load excel file",builder:{file:{alias:"f",describe:"load xlsx file ",demandOption:!0,type:"string"},sheet:{alias:"s",describe:"xlsx sheet name",demandOption:!1,type:"string"},range:{alias:"r",describe:"range of excel",default:"A1:Z2000",demandOption:!1,type:"string"},defval:{describe:"defval of cell",demandOption:!1,default:void 0,type:"string"},output:{alias:"o",describe:"output file: json, yaml, csv, tsv, xlsx",demandOption:!1,default:void 0,type:"string"}},handler(e){(async()=>{let t=Oe(e);e.output?ve(e.output,t):console.log(JSON.stringify(t,null,2))})()}};ae.exports=je});var ue=_chunk5KSN6VOAjs.b.call(void 0, (Be,de)=>{var qe=_chunk5KSN6VOAjs.a.call(void 0, "fs"),ie=_chunk5KSN6VOAjs.a.call(void 0, "exceljs"),Ie=async e=>{let{file:t,sheet:s,range:n,defval:o,noNullRow:r}=e;if(!qe.existsSync(t)){console.log("file not found, ",t);return}if(![".xlsx",".xlsm"].find(b=>t.endsWith(b))){console.log("file type error, ",t);return}let l=new ie.Workbook;await l.xlsx.readFile(t);let c=s?l.getWorksheet(s):l.worksheets[0];if(!c)return null;let{startRow:h,endRow:i,startCol:d,endCol:u}=D(n||"A1:Z2000"),p=[];return c.eachRow({includeEmpty:!1},(b,F)=>{if(F>=h&&F<=i){let S={};b.eachCell({includeEmpty:!0},(w,m)=>{if(m>=d&&m<=u){let f=c.getRow(h).getCell(m).value||`__EMPTY_${m-1}`;S[f]=w.value!==null?w.value:o}}),(!r||Object.values(S).some(w=>w!==null))&&p.push(S)}}),p},$e=async e=>{let{file:t,data:s,sheet:n}=e;if(!(t&&s&&Array.isArray(s)&&s.length>0))return;let o=new ie.Workbook,r=o.addWorksheet(n?n.substring(0,31):"Sheet1");if(Array.isArray(s[0]))r.addRows(s);else{let l=Object.keys(s[0]);r.addRow(l),s.forEach(c=>{r.addRow(l.map(h=>c[h]))})}await o.xlsx.writeFile(t)},D=e=>{let[t,s]=e.split(":"),n=t.replace(/\D/g,""),o=s.replace(/\D/g,""),r=t.replace(/\d/g,""),l=s.replace(/\d/g,"");return{startRow:parseInt(n),endRow:parseInt(o),startCol:r,endCol:l,firstRow:`${t}:${l}${t.replace(/\D/g,"")}`,firstCol:`${t}:${r}${s.replace(/\D/g,"")}`}},De=async(e,t)=>{let{startRow:s,endRow:n,startCol:o,endCol:r}=D(t),l=[];for(let c=s;c<=n;c++){let h=[];for(let i=o;i<=r;i++){let d=e.getCell(c,i);h.push(d.value)}l.push(h)}return l},Xe=async(e,t)=>{let{startRow:s,startCol:n,endCol:o}=D(t),r=[];for(let l=n;l<=o;l++){let c=e.getCell(s,l);r.push(c.value)}return r},Ne=async(e,t)=>{let{startRow:s,endRow:n,startCol:o}=D(t),r=[];for(let l=s;l<=n;l++){let c=e.getCell(l,o);r.push(c.value)}return r};de.exports={readXlsx:Ie,writeXlsx:$e,getSheetData:De,parseRange:D,getFirstRow:Xe,getFirstCol:Ne}});var pe=_chunk5KSN6VOAjs.b.call(void 0, (Te,he)=>{var fe=_chunk5KSN6VOAjs.a.call(void 0, "fs"),Ee=async e=>{let{readXlsx:t,parseRange:s}=E(),n=_chunk5KSN6VOAjs.a.call(void 0, "xlsx"),o=(...a)=>{e.debug&&console.log(...a)},r=a=>{let[x,C,j]=a.split("|");return{file:x,sheet:C,range:j||"A1:Z2000",defval:null,noNullRow:!0,debug:e.debug}},l=a=>{let x=Object.values(a);return x&&x.length>0?x[0]:""},[c,...h]=e.files,i=r(c),d=n.readFile(i.file,{bookSheets:!1}),u=d.Sheets[i.sheet||d.SheetNames[0]],p=s(i.range),b=n.utils.sheet_to_json(u,{header:1,range:p.firstRow,blankrows:!0,defval:null})[0],F=n.utils.sheet_to_json(u,{header:1,range:p.firstCol,blankrows:!0,defval:null}).map(a=>a[0]);o(s(i.range)),o("Header",b),o("RowIds",F);let S=h.map(r);S.forEach((a,x)=>{let C=t(a),j=C.map(l);console.log(`================${a.sheet}=================`),j.forEach((k,q)=>{let R=F.findIndex(_=>k&&k===_);if(o(a.sheet,k,R>-1?"OK":"NG",`SheetProcess:${x+1}/${S.length}`),R>-1){let _=C[q],X=Object.keys(_).slice(1);X.forEach((A,P)=>{let I=b.findIndex(B=>B&&A===B),O=R,$=I,K=n.utils.encode_cell({r:O,c:$});u[K]={t:"s",v:_[A]},e.debug&&console.log(a.sheet,k,`RowProcess:${(P+1)/X.length*100}%`,[K,O,$,_[A]])})}})}),console.log("Merge completed successfully.");let w=e.output,m=fe.existsSync(w)?n.readFile(w,{cellDates:!0}):n.utils.book_new(),f=(e.sheet||"MergedSheet").substring(0,31);n.utils.book_append_sheet(m,u,f,!0),n.writeFile(m,w,{compression:!0})},Je=async e=>{let{readXlsx:t,parseRange:s}=ue(),n=_chunk5KSN6VOAjs.a.call(void 0, "exceljs"),o=(...f)=>{e.debug&&console.log(...f)},r=f=>{let[a,x,C]=f.split("|");return{file:a,sheet:x,range:C||"A1:Z2000",defval:null,noNullRow:!0,debug:e.debug}},l=f=>{let a=Object.values(f);return a&&a.length>0?a[0]:""},[c,...h]=e.files,i=r(c),d=new n.Workbook;await d.xlsx.readFile(i.file);let u=d.getWorksheet(i.sheet||d.worksheets[0].name),p=s(i.range),b=u.getRow(p.startRow).values.slice(p.startCol,p.endCol+1),F=u.getColumn(p.startCol).values.slice(p.startRow,p.endRow+1);o(s(i.range)),o("Header",b),o("RowIds",F);let S=h.map(r);for(let[f,a]of S.entries()){let x=await t(a),C=x.map(l);console.log(`================${a.sheet}=================`);for(let[j,k]of C.entries()){let q=F.findIndex(R=>k&&k===R);if(o(a.sheet,k,q>-1?"OK":"NG",`SheetProcess:${f+1}/${S.length}`),q>-1){let R=x[j],_=Object.keys(R).slice(1);for(let[X,A]of _.entries()){let P=b.findIndex($=>$&&A===$),I=q+p.startRow,O=P+p.startCol;u.getCell(I,O).value=R[A],e.debug&&console.log(a.sheet,k,`RowProcess:${(X+1)/_.length*100}%`,[u.getCell(I,O).address,I,O,R[A]])}}}}console.log("Merge completed successfully.");let w=e.output,m=(e.sheet||"MergedSheet").substring(0,31);if(fe.existsSync(w)){let f=new n.Workbook;await f.xlsx.readFile(w);let a=f.getWorksheet(m);a&&f.removeWorksheet(a.id),f.addWorksheet(m,u),await f.xlsx.writeFile(w)}else u.name=m,await d.xlsx.writeFile(w)},He={command:"merge <files..>",describe:"merge multiple excel sheets into the first sheet. (format: file|sheet|range, file|Sheet1|A1:Z2000)",builder:{output:{alias:"o",describe:"output file name",default:"MergedBook.xlsx",type:"string"},sheet:{alias:"s",describe:"xlsx sheet name",demandOption:!1,type:"string"},engine:{alias:"e",describe:"excel engine, sheetjs|exceljs",default:"sheetjs",demandOption:!1,type:"string"},debug:{alias:"d",describe:"print debug log",demandOption:!1,type:"boolean"}},handler(e){e.engine==="exceljs"?Je(e):Ee(e)}};he.exports=He});var we=_chunk5KSN6VOAjs.b.call(void 0, (ze,ge)=>{var{writeFiles:Me}=G(),{getStdin:Pe}=_chunk5KSN6VOAjs.a.call(void 0, "ts-stdin"),Ze={command:"json2",describe:"convert json to yaml, csv, tsv, xlsx",builder:{data:{alias:"d",describe:"json data",demandOption:!1,default:void 0,type:"string"},output:{alias:"o",describe:"output the request data, type: yaml, csv, tsv, xlsx",demandOption:!0,type:"array"}},handler(e){(async()=>{let t=e.data?JSON.parse(e.data):JSON.parse(await Pe());e.output&&Me({files:e.output,data:t})})()}};ge.exports=Ze});var Le=()=>{let e=_chunk5KSN6VOAjs.a.call(void 0, "yargs").scriptName("xl1");e.command(ce()),e.command(pe()),e.command(we());let t=e.parse();(!t._||t._.length===0)&&e.showHelp()};Le();
|
2
|
+
"use strict";var _chunk2CJVU2ONjs = require('../chunk-2CJVU2ON.js');var _chunkNEJSZOZXjs = require('../chunk-NEJSZOZX.js');var E=_chunkNEJSZOZXjs.b.call(void 0, (Ye,Q)=>{var T=_chunkNEJSZOZXjs.a.call(void 0, "fs"),W=_chunkNEJSZOZXjs.a.call(void 0, "xlsx"),me=e=>{let{file:t,sheet:s,range:n,defval:o,noNullRow:r}=e;if(!T.existsSync(t)){console.log("file not found, ",t);return}if(![".xlsx",".xlsm"].find(u=>t.endsWith(u))){console.log("file type error, ",t);return}let l=W.readFile(t,{bookSheets:!1});if(!l)return null;let h=l.Sheets[s||l.SheetNames[0]],i={range:n,blankrows:!1,defval:o},d=W.utils.sheet_to_json(h,i);return r?d.filter(u=>Object.values(u).some(p=>!!p)):d},ye=e=>{let{file:t,data:s,sheet:n}=e;if(!(t&&s&&Array.isArray(s)&&s.length>0))return;let o=Array.isArray(s[0])?W.utils.aoa_to_sheet(s):W.utils.json_to_sheet(s),r=T.existsSync(t)?W.readFile(t,{cellDates:!0}):W.utils.book_new();W.utils.book_append_sheet(r,o,n?n.substring(0,31):"Sheet1",!0),W.writeFile(r,t,{compression:!0})},N=e=>{let[t,s]=e.split(":"),n=t.replace(/\D/g,""),o=s.replace(/\D/g,""),r=t.replace(/\d/g,""),l=s.replace(/\d/g,"");return{startRow:parseInt(n),endRow:parseInt(o),startCol:r,endCol:l,firstRow:`${t}:${l}${n}`,firstCol:`${t}:${r}${o}`}},z=(e,t,s,n,o)=>{let r=[];for(let l=t;l<=s;l++){let c=[];for(let h=n;h<=o;h++){let d=e[""];c.push(d?d.v:null)}r.push(c)}return r},Z=(e,t)=>{let s=N(t);return z(e,s.startRow,s.endRow,s.startCol,s.endCol)},be=(e,t)=>{let s=N(t);return Z(e,s.firstRow)[0]},Se=(e,t)=>{let s=N(t);return Z(e,s.firstCol)[0]};Q.exports={readXlsx:me,writeXlsx:ye,getSheetData:Z,getSheetData2:z,parseRange:N,getFirstRow:be,getFirstCol:Se}});var G=_chunkNEJSZOZXjs.b.call(void 0, (Ge,le)=>{var L=_chunkNEJSZOZXjs.a.call(void 0, "path"),y=_chunkNEJSZOZXjs.a.call(void 0, "fs"),Y=_chunk2CJVU2ONjs.a.call(void 0, ),U=_chunkNEJSZOZXjs.a.call(void 0, "js-yaml"),J=_chunkNEJSZOZXjs.a.call(void 0, "xlsx"),{readXlsx:V,writeXlsx:ee}=E(),ke=_chunkNEJSZOZXjs.a.call(void 0, "json2xml"),H=(e,t="",s={})=>{for(let n in e)if(e.hasOwnProperty(n)){let o=t?`${t}.${n}`:n;typeof e[n]=="object"&&e[n]!==null&&!Array.isArray(e[n])?H(e[n],o,s):s[n]=e[n]}return s},M=(e,t)=>{let s=L.dirname(t);y.existsSync(s)||y.mkdirSync(s,{recursive:!0}),y.writeFileSync(t,e,{encoding:"utf8"})},Re=e=>Y.sync(L.join(e)),Fe=e=>Y.sync(L.join(e)).find(t=>t!==void 0),Ce=e=>{let t=Y.sync(e,{cwd:".",nocase:!0,nodir:!1});return t&&t.length>0},te=e=>y.existsSync(e)?JSON.parse(y.readFileSync(e,"utf8")):null,se=e=>y.existsSync(e)?U.load(y.readFileSync(e,"utf8")):null,ne=e=>{let{file:t,data:s}=e;if(Array.isArray(s)){let n=y.createWriteStream(t);n.write("[","utf-8"),s.map((o,r)=>n.write(JSON.stringify(o)+(r===s.length-1?"":","),"utf-8")),n.write("]","utf-8"),n.end(),n.on("finish",()=>{}),n.on("error",o=>{console.error(o)})}else y.writeFileSync(t,JSON.stringify(s,null,2),{encoding:"utf8"})},oe=e=>{let{file:t,data:s}=e,n=U.dump(s);y.writeFileSync(t,n,"utf8")},_e=e=>{let{file:t}=e;if(!y.existsSync(t))return null;if(t.endsWith(".json"))return te(t);if(t.endsWith(".yaml")||t.endsWith(".yml"))return se(t);if(t.endsWith(".xlsx"))return V(e)},We=e=>!![".json",".yaml",".xlsx",".yml"].find(s=>e.endsWith(s)),re=(e,t,s)=>{if(e.endsWith(".json"))return ne({file:e,data:t});if(e.endsWith(".yaml")||e.endsWith(".yml"))return oe({file:e,data:t});if(e.endsWith(".xlsx"))return ee({file:e,data:t.map(n=>H(n)),sheet:s&&s.sheet?s.sheet:"Sheet1"});if(e.endsWith(".csv")){let n=J.utils.json_to_sheet(t.map(r=>H(r))),o=J.utils.sheet_to_csv(n);return M(o,e)}if(e.endsWith(".tsv")){let n=J.utils.json_to_sheet(t.map(r=>H(r))),o=J.utils.sheet_to_csv(n,{FS:" "});return M(o,e)}if(e.endsWith(".xml")){let n=ke(t,{header:!0});return M(n,e)}console.error("not support type")},Ae=e=>{let{files:t,data:s,sheet:n}=e;t&&t.length>0&&t.map(o=>{re(o,s,{sheet:n})})};le.exports={save:M,find:Re,findOne:Fe,isExsit:Ce,readJson:te,writeJson:ne,readYaml:se,writeYaml:oe,readXlsx:V,writeXlsx:ee,readFile:_e,canReadFile:We,writeFile:re,writeFiles:Ae}});var ce=_chunkNEJSZOZXjs.b.call(void 0, (Ke,ae)=>{var{readXlsx:Oe}=E(),{writeFile:ve}=G(),je={command:"read",describe:"load excel file",builder:{file:{alias:"f",describe:"load xlsx file ",demandOption:!0,type:"string"},sheet:{alias:"s",describe:"xlsx sheet name",demandOption:!1,type:"string"},range:{alias:"r",describe:"range of excel",default:"A1:Z2000",demandOption:!1,type:"string"},defval:{describe:"defval of cell",demandOption:!1,default:void 0,type:"string"},output:{alias:"o",describe:"output file: json, yaml, csv, tsv, xlsx",demandOption:!1,default:void 0,type:"string"}},handler(e){(async()=>{let t=Oe(e);e.output?ve(e.output,t):console.log(JSON.stringify(t,null,2))})()}};ae.exports=je});var ue=_chunkNEJSZOZXjs.b.call(void 0, (Be,de)=>{var qe=_chunkNEJSZOZXjs.a.call(void 0, "fs"),ie=_chunkNEJSZOZXjs.a.call(void 0, "exceljs"),Ie=async e=>{let{file:t,sheet:s,range:n,defval:o,noNullRow:r}=e;if(!qe.existsSync(t)){console.log("file not found, ",t);return}if(![".xlsx",".xlsm"].find(b=>t.endsWith(b))){console.log("file type error, ",t);return}let l=new ie.Workbook;await l.xlsx.readFile(t);let c=s?l.getWorksheet(s):l.worksheets[0];if(!c)return null;let{startRow:h,endRow:i,startCol:d,endCol:u}=D(n||"A1:Z2000"),p=[];return c.eachRow({includeEmpty:!1},(b,F)=>{if(F>=h&&F<=i){let S={};b.eachCell({includeEmpty:!0},(w,m)=>{if(m>=d&&m<=u){let f=c.getRow(h).getCell(m).value||`__EMPTY_${m-1}`;S[f]=w.value!==null?w.value:o}}),(!r||Object.values(S).some(w=>w!==null))&&p.push(S)}}),p},$e=async e=>{let{file:t,data:s,sheet:n}=e;if(!(t&&s&&Array.isArray(s)&&s.length>0))return;let o=new ie.Workbook,r=o.addWorksheet(n?n.substring(0,31):"Sheet1");if(Array.isArray(s[0]))r.addRows(s);else{let l=Object.keys(s[0]);r.addRow(l),s.forEach(c=>{r.addRow(l.map(h=>c[h]))})}await o.xlsx.writeFile(t)},D=e=>{let[t,s]=e.split(":"),n=t.replace(/\D/g,""),o=s.replace(/\D/g,""),r=t.replace(/\d/g,""),l=s.replace(/\d/g,"");return{startRow:parseInt(n),endRow:parseInt(o),startCol:r,endCol:l,firstRow:`${t}:${l}${t.replace(/\D/g,"")}`,firstCol:`${t}:${r}${s.replace(/\D/g,"")}`}},De=async(e,t)=>{let{startRow:s,endRow:n,startCol:o,endCol:r}=D(t),l=[];for(let c=s;c<=n;c++){let h=[];for(let i=o;i<=r;i++){let d=e.getCell(c,i);h.push(d.value)}l.push(h)}return l},Xe=async(e,t)=>{let{startRow:s,startCol:n,endCol:o}=D(t),r=[];for(let l=n;l<=o;l++){let c=e.getCell(s,l);r.push(c.value)}return r},Ne=async(e,t)=>{let{startRow:s,endRow:n,startCol:o}=D(t),r=[];for(let l=s;l<=n;l++){let c=e.getCell(l,o);r.push(c.value)}return r};de.exports={readXlsx:Ie,writeXlsx:$e,getSheetData:De,parseRange:D,getFirstRow:Xe,getFirstCol:Ne}});var pe=_chunkNEJSZOZXjs.b.call(void 0, (Te,he)=>{var fe=_chunkNEJSZOZXjs.a.call(void 0, "fs"),Ee=async e=>{let{readXlsx:t,parseRange:s}=E(),n=_chunkNEJSZOZXjs.a.call(void 0, "xlsx"),o=(...a)=>{e.debug&&console.log(...a)},r=a=>{let[x,C,j]=a.split("|");return{file:x,sheet:C,range:j||"A1:Z2000",defval:null,noNullRow:!0,debug:e.debug}},l=a=>{let x=Object.values(a);return x&&x.length>0?x[0]:""},[c,...h]=e.files,i=r(c),d=n.readFile(i.file,{bookSheets:!1}),u=d.Sheets[i.sheet||d.SheetNames[0]],p=s(i.range),b=n.utils.sheet_to_json(u,{header:1,range:p.firstRow,blankrows:!0,defval:null})[0],F=n.utils.sheet_to_json(u,{header:1,range:p.firstCol,blankrows:!0,defval:null}).map(a=>a[0]);o(s(i.range)),o("Header",b),o("RowIds",F);let S=h.map(r);S.forEach((a,x)=>{let C=t(a),j=C.map(l);console.log(`================${a.sheet}=================`),j.forEach((k,q)=>{let R=F.findIndex(_=>k&&k===_);if(o(a.sheet,k,R>-1?"OK":"NG",`SheetProcess:${x+1}/${S.length}`),R>-1){let _=C[q],X=Object.keys(_).slice(1);X.forEach((A,P)=>{let I=b.findIndex(B=>B&&A===B),O=R,$=I,K=n.utils.encode_cell({r:O,c:$});u[K]={t:"s",v:_[A]},e.debug&&console.log(a.sheet,k,`RowProcess:${(P+1)/X.length*100}%`,[K,O,$,_[A]])})}})}),console.log("Merge completed successfully.");let w=e.output,m=fe.existsSync(w)?n.readFile(w,{cellDates:!0}):n.utils.book_new(),f=(e.sheet||"MergedSheet").substring(0,31);n.utils.book_append_sheet(m,u,f,!0),n.writeFile(m,w,{compression:!0})},Je=async e=>{let{readXlsx:t,parseRange:s}=ue(),n=_chunkNEJSZOZXjs.a.call(void 0, "exceljs"),o=(...f)=>{e.debug&&console.log(...f)},r=f=>{let[a,x,C]=f.split("|");return{file:a,sheet:x,range:C||"A1:Z2000",defval:null,noNullRow:!0,debug:e.debug}},l=f=>{let a=Object.values(f);return a&&a.length>0?a[0]:""},[c,...h]=e.files,i=r(c),d=new n.Workbook;await d.xlsx.readFile(i.file);let u=d.getWorksheet(i.sheet||d.worksheets[0].name),p=s(i.range),b=u.getRow(p.startRow).values.slice(p.startCol,p.endCol+1),F=u.getColumn(p.startCol).values.slice(p.startRow,p.endRow+1);o(s(i.range)),o("Header",b),o("RowIds",F);let S=h.map(r);for(let[f,a]of S.entries()){let x=await t(a),C=x.map(l);console.log(`================${a.sheet}=================`);for(let[j,k]of C.entries()){let q=F.findIndex(R=>k&&k===R);if(o(a.sheet,k,q>-1?"OK":"NG",`SheetProcess:${f+1}/${S.length}`),q>-1){let R=x[j],_=Object.keys(R).slice(1);for(let[X,A]of _.entries()){let P=b.findIndex($=>$&&A===$),I=q+p.startRow,O=P+p.startCol;u.getCell(I,O).value=R[A],e.debug&&console.log(a.sheet,k,`RowProcess:${(X+1)/_.length*100}%`,[u.getCell(I,O).address,I,O,R[A]])}}}}console.log("Merge completed successfully.");let w=e.output,m=(e.sheet||"MergedSheet").substring(0,31);if(fe.existsSync(w)){let f=new n.Workbook;await f.xlsx.readFile(w);let a=f.getWorksheet(m);a&&f.removeWorksheet(a.id),f.addWorksheet(m,u),await f.xlsx.writeFile(w)}else u.name=m,await d.xlsx.writeFile(w)},He={command:"merge <files..>",describe:"merge multiple excel sheets into the first sheet. (format: file|sheet|range, file|Sheet1|A1:Z2000)",builder:{output:{alias:"o",describe:"output file name",default:"MergedBook.xlsx",type:"string"},sheet:{alias:"s",describe:"xlsx sheet name",demandOption:!1,type:"string"},engine:{alias:"e",describe:"excel engine, sheetjs|exceljs",default:"sheetjs",demandOption:!1,type:"string"},debug:{alias:"d",describe:"print debug log",demandOption:!1,type:"boolean"}},handler(e){e.engine==="exceljs"?Je(e):Ee(e)}};he.exports=He});var we=_chunkNEJSZOZXjs.b.call(void 0, (ze,ge)=>{var{writeFiles:Me}=G(),{getStdin:Pe}=_chunkNEJSZOZXjs.a.call(void 0, "ts-stdin"),Ze={command:"json2",describe:"convert json to yaml, csv, tsv, xlsx",builder:{data:{alias:"d",describe:"json data",demandOption:!1,default:void 0,type:"string"},output:{alias:"o",describe:"output the request data, type: yaml, csv, tsv, xlsx",demandOption:!0,type:"array"}},handler(e){(async()=>{let t=e.data?JSON.parse(e.data):JSON.parse(await Pe());e.output&&Me({files:e.output,data:t})})()}};ge.exports=Ze});var Le=()=>{let e=_chunkNEJSZOZXjs.a.call(void 0, "yargs").scriptName("xl1");e.command(ce()),e.command(pe()),e.command(we());let t=e.parse();(!t._||t._.length===0)&&e.showHelp()};Le();
|
package/package.json
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "xl1",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.7",
|
4
4
|
"description": "just some xlsx script.",
|
5
5
|
"bin": {
|
6
|
-
"
|
7
|
-
"
|
6
|
+
"bash1": "dist/bash1/index.js",
|
7
|
+
"jsh1": "dist/jsh1/index.js",
|
8
|
+
"xl1": "dist/xl1/index.js"
|
8
9
|
},
|
9
10
|
"files": [
|
10
11
|
"dist",
|
package/dist/chunk-5KSN6VOA.js
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var O=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(r,e)=>(typeof require<"u"?require:r)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var S=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var Pt=S(ct=>{var C=O("path"),L=process.platform==="win32",N=O("fs"),Rr=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function Dr(){var t;if(Rr){var r=new Error;t=e}else t=i;return t;function e(n){n&&(r.message=n.message,n=r,i(n))}function i(n){if(n){if(process.throwDeprecation)throw n;if(!process.noDeprecation){var s="fs: missing callback "+(n.stack||n.message);process.traceDeprecation?console.trace(s):console.error(s)}}}}function Tr(t){return typeof t=="function"?t:Dr()}var Te=C.normalize;L?q=/(.*?)(?:[\/\\]+|$)/g:q=/(.*?)(?:[\/]+|$)/g;var q;L?x=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/:x=/^[\/]*/;var x;ct.realpathSync=function(r,e){if(r=C.resolve(r),e&&Object.prototype.hasOwnProperty.call(e,r))return e[r];var i=r,n={},s={},a,u,o,c;f();function f(){var m=x.exec(r);a=m[0].length,u=m[0],o=m[0],c="",L&&!s[o]&&(N.lstatSync(o),s[o]=!0)}for(;a<r.length;){q.lastIndex=a;var p=q.exec(r);if(c=u,u+=p[0],o=c+p[1],a=q.lastIndex,!(s[o]||e&&e[o]===o)){var l;if(e&&Object.prototype.hasOwnProperty.call(e,o))l=e[o];else{var h=N.lstatSync(o);if(!h.isSymbolicLink()){s[o]=!0,e&&(e[o]=o);continue}var v=null;if(!L){var d=h.dev.toString(32)+":"+h.ino.toString(32);n.hasOwnProperty(d)&&(v=n[d])}v===null&&(N.statSync(o),v=N.readlinkSync(o)),l=C.resolve(c,v),e&&(e[o]=l),L||(n[d]=v)}r=C.resolve(l,r.slice(a)),f()}}return e&&(e[i]=r),r};ct.realpath=function(r,e,i){if(typeof i!="function"&&(i=Tr(e),e=null),r=C.resolve(r),e&&Object.prototype.hasOwnProperty.call(e,r))return process.nextTick(i.bind(null,null,e[r]));var n=r,s={},a={},u,o,c,f;p();function p(){var m=x.exec(r);u=m[0].length,o=m[0],c=m[0],f="",L&&!a[c]?N.lstat(c,function(y){if(y)return i(y);a[c]=!0,l()}):process.nextTick(l)}function l(){if(u>=r.length)return e&&(e[n]=r),i(null,r);q.lastIndex=u;var m=q.exec(r);return f=o,o+=m[0],c=f+m[1],u=q.lastIndex,a[c]||e&&e[c]===c?process.nextTick(l):e&&Object.prototype.hasOwnProperty.call(e,c)?d(e[c]):N.lstat(c,h)}function h(m,y){if(m)return i(m);if(!y.isSymbolicLink())return a[c]=!0,e&&(e[c]=c),process.nextTick(l);if(!L){var b=y.dev.toString(32)+":"+y.ino.toString(32);if(s.hasOwnProperty(b))return v(null,s[b],c)}N.stat(c,function(k){if(k)return i(k);N.readlink(c,function(_,j){L||(s[b]=j),v(_,j)})})}function v(m,y,b){if(m)return i(m);var k=C.resolve(f,y);e&&(e[b]=k),d(k)}function d(m){r=C.resolve(m,r.slice(u)),p()}}});var vt=S((Ge,Qt)=>{Qt.exports=M;M.realpath=M;M.sync=lt;M.realpathSync=lt;M.monkeypatch=Gr;M.unmonkeypatch=Pr;var B=O("fs"),ht=B.realpath,ft=B.realpathSync,Cr=process.version,$t=/^v[0-5]\./.test(Cr),Ft=Pt();function Bt(t){return t&&t.syscall==="realpath"&&(t.code==="ELOOP"||t.code==="ENOMEM"||t.code==="ENAMETOOLONG")}function M(t,r,e){if($t)return ht(t,r,e);typeof r=="function"&&(e=r,r=null),ht(t,r,function(i,n){Bt(i)?Ft.realpath(t,r,e):e(i,n)})}function lt(t,r){if($t)return ft(t,r);try{return ft(t,r)}catch(e){if(Bt(e))return Ft.realpathSync(t,r);throw e}}function Gr(){B.realpath=M,B.realpathSync=lt}function Pr(){B.realpath=ht,B.realpathSync=ft}});var Wt=S((Pe,Ut)=>{Ut.exports=function(t,r){for(var e=[],i=0;i<t.length;i++){var n=r(t[i],i);$r(n)?e.push.apply(e,n):e.push(n)}return e};var $r=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"}});var Kt=S(($e,Zt)=>{"use strict";Zt.exports=zt;function zt(t,r,e){t instanceof RegExp&&(t=xt(t,e)),r instanceof RegExp&&(r=xt(r,e));var i=Ht(t,r,e);return i&&{start:i[0],end:i[1],pre:e.slice(0,i[0]),body:e.slice(i[0]+t.length,i[1]),post:e.slice(i[1]+r.length)}}function xt(t,r){var e=r.match(t);return e?e[0]:null}zt.range=Ht;function Ht(t,r,e){var i,n,s,a,u,o=e.indexOf(t),c=e.indexOf(r,o+1),f=o;if(o>=0&&c>0){if(t===r)return[o,c];for(i=[],s=e.length;f>=0&&!u;)f==o?(i.push(f),o=e.indexOf(t,f+1)):i.length==1?u=[i.pop(),c]:(n=i.pop(),n<s&&(s=n,a=c),c=e.indexOf(r,f+1)),f=o<c&&o>=0?o:c;i.length&&(u=[s,a])}return u}});var ir=S((Fe,er)=>{var Fr=Wt(),Vt=Kt();er.exports=Ur;var Xt="\0SLASH"+Math.random()+"\0",Jt="\0OPEN"+Math.random()+"\0",dt="\0CLOSE"+Math.random()+"\0",Yt="\0COMMA"+Math.random()+"\0",tr="\0PERIOD"+Math.random()+"\0";function pt(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function Br(t){return t.split("\\\\").join(Xt).split("\\{").join(Jt).split("\\}").join(dt).split("\\,").join(Yt).split("\\.").join(tr)}function Qr(t){return t.split(Xt).join("\\").split(Jt).join("{").split(dt).join("}").split(Yt).join(",").split(tr).join(".")}function rr(t){if(!t)return[""];var r=[],e=Vt("{","}",t);if(!e)return t.split(",");var i=e.pre,n=e.body,s=e.post,a=i.split(",");a[a.length-1]+="{"+n+"}";var u=rr(s);return s.length&&(a[a.length-1]+=u.shift(),a.push.apply(a,u)),r.push.apply(r,a),r}function Ur(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Q(Br(t),!0).map(Qr)):[]}function Wr(t){return"{"+t+"}"}function xr(t){return/^-?0\d/.test(t)}function zr(t,r){return t<=r}function Hr(t,r){return t>=r}function Q(t,r){var e=[],i=Vt("{","}",t);if(!i||/\$$/.test(i.pre))return[t];var n=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),a=n||s,u=i.body.indexOf(",")>=0;if(!a&&!u)return i.post.match(/,.*\}/)?(t=i.pre+"{"+i.body+dt+i.post,Q(t)):[t];var o;if(a)o=i.body.split(/\.\./);else if(o=rr(i.body),o.length===1&&(o=Q(o[0],!1).map(Wr),o.length===1)){var f=i.post.length?Q(i.post,!1):[""];return f.map(function(at){return i.pre+o[0]+at})}var c=i.pre,f=i.post.length?Q(i.post,!1):[""],p;if(a){var l=pt(o[0]),h=pt(o[1]),v=Math.max(o[0].length,o[1].length),d=o.length==3?Math.abs(pt(o[2])):1,m=zr,y=h<l;y&&(d*=-1,m=Hr);var b=o.some(xr);p=[];for(var k=l;m(k,h);k+=d){var _;if(s)_=String.fromCharCode(k),_==="\\"&&(_="");else if(_=String(k),b){var j=v-_.length;if(j>0){var V=new Array(j+1).join("0");k<0?_="-"+V+_.slice(1):_=V+_}}p.push(_)}}else p=Fr(o,function(X){return Q(X,!1)});for(var F=0;F<p.length;F++)for(var T=0;T<f.length;T++){var I=c+p[F]+f[T];(!r||a||I)&&e.push(I)}return e}});var tt=S((Be,ur)=>{ur.exports=A;A.Minimatch=E;var z=function(){try{return O("path")}catch (e2){}}()||{sep:"/"};A.sep=z.sep;var yt=A.GLOBSTAR=E.GLOBSTAR={},Zr=ir(),nr={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},mt="[^/]",gt=mt+"*?",Kr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Vr="(?:(?!(?:\\/|^)\\.).)*?",ar=Xr("().*{}+?[]^$\\!");function Xr(t){return t.split("").reduce(function(r,e){return r[e]=!0,r},{})}var sr=/\/+/;A.filter=Jr;function Jr(t,r){return r=r||{},function(e,i,n){return A(e,t,r)}}function R(t,r){r=r||{};var e={};return Object.keys(t).forEach(function(i){e[i]=t[i]}),Object.keys(r).forEach(function(i){e[i]=r[i]}),e}A.defaults=function(t){if(!t||typeof t!="object"||!Object.keys(t).length)return A;var r=A,e=function(n,s,a){return r(n,s,R(t,a))};return e.Minimatch=function(n,s){return new r.Minimatch(n,R(t,s))},e.Minimatch.defaults=function(n){return r.defaults(R(t,n)).Minimatch},e.filter=function(n,s){return r.filter(n,R(t,s))},e.defaults=function(n){return r.defaults(R(t,n))},e.makeRe=function(n,s){return r.makeRe(n,R(t,s))},e.braceExpand=function(n,s){return r.braceExpand(n,R(t,s))},e.match=function(i,n,s){return r.match(i,n,R(t,s))},e};E.defaults=function(t){return A.defaults(t).Minimatch};function A(t,r,e){return Y(r),e||(e={}),!e.nocomment&&r.charAt(0)==="#"?!1:new E(r,e).match(t)}function E(t,r){if(!(this instanceof E))return new E(t,r);Y(t),r||(r={}),t=t.trim(),!r.allowWindowsEscape&&z.sep!=="/"&&(t=t.split(z.sep).join("/")),this.options=r,this.set=[],this.pattern=t,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.make()}E.prototype.debug=function(){};E.prototype.make=Yr;function Yr(){var t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate();var e=this.globSet=this.braceExpand();r.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,e),e=this.globParts=e.map(function(i){return i.split(sr)}),this.debug(this.pattern,e),e=e.map(function(i,n,s){return i.map(this.parse,this)},this),this.debug(this.pattern,e),e=e.filter(function(i){return i.indexOf(!1)===-1}),this.debug(this.pattern,e),this.set=e}E.prototype.parseNegate=te;function te(){var t=this.pattern,r=!1,e=this.options,i=0;if(!e.nonegate){for(var n=0,s=t.length;n<s&&t.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=t.substr(i)),this.negate=r}}A.braceExpand=function(t,r){return or(t,r)};E.prototype.braceExpand=or;function or(t,r){return r||(this instanceof E?r=this.options:r={}),t=typeof t>"u"?this.pattern:t,Y(t),r.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Zr(t)}var re=1024*64,Y=function(t){if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>re)throw new TypeError("pattern is too long")};E.prototype.parse=ee;var J={};function ee(t,r){Y(t);var e=this.options;if(t==="**")if(e.noglobstar)t="*";else return yt;if(t==="")return"";var i="",n=!!e.nocase,s=!1,a=[],u=[],o,c=!1,f=-1,p=-1,l=t.charAt(0)==="."?"":e.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",h=this;function v(){if(o){switch(o){case"*":i+=gt,n=!0;break;case"?":i+=mt,n=!0;break;default:i+="\\"+o;break}h.debug("clearStateChar %j %j",o,i),o=!1}}for(var d=0,m=t.length,y;d<m&&(y=t.charAt(d));d++){if(this.debug("%s %s %s %j",t,d,i,y),s&&ar[y]){i+="\\"+y,s=!1;continue}switch(y){case"/":return!1;case"\\":v(),s=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,d,i,y),c){this.debug(" in class"),y==="!"&&d===p+1&&(y="^"),i+=y;continue}h.debug("call clearStateChar %j",o),v(),o=y,e.noext&&v();continue;case"(":if(c){i+="(";continue}if(!o){i+="\\(";continue}a.push({type:o,start:d-1,reStart:i.length,open:nr[o].open,close:nr[o].close}),i+=o==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",o,i),o=!1;continue;case")":if(c||!a.length){i+="\\)";continue}v(),n=!0;var b=a.pop();i+=b.close,b.type==="!"&&u.push(b),b.reEnd=i.length;continue;case"|":if(c||!a.length||s){i+="\\|",s=!1;continue}v(),i+="|";continue;case"[":if(v(),c){i+="\\"+y;continue}c=!0,p=d,f=i.length,i+=y;continue;case"]":if(d===p+1||!c){i+="\\"+y,s=!1;continue}var k=t.substring(p+1,d);try{RegExp("["+k+"]")}catch (e3){var _=this.parse(k,J);i=i.substr(0,f)+"\\["+_[0]+"\\]",n=n||_[1],c=!1;continue}n=!0,c=!1,i+=y;continue;default:v(),s?s=!1:ar[y]&&!(y==="^"&&c)&&(i+="\\"),i+=y}}for(c&&(k=t.substr(p+1),_=this.parse(k,J),i=i.substr(0,f)+"\\["+_[0],n=n||_[1]),b=a.pop();b;b=a.pop()){var j=i.slice(b.reStart+b.open.length);this.debug("setting tail",i,b),j=j.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(Ct,Gt,ut){return ut||(ut="\\"),Gt+Gt+ut+"|"}),this.debug(`tail=%j
|
2
|
-
%s`,j,j,b,i);var V=b.type==="*"?gt:b.type==="?"?mt:"\\"+b.type;n=!0,i=i.slice(0,b.reStart)+V+"\\("+j}v(),s&&(i+="\\\\");var F=!1;switch(i.charAt(0)){case"[":case".":case"(":F=!0}for(var T=u.length-1;T>-1;T--){var I=u[T],X=i.slice(0,I.reStart),at=i.slice(I.reStart,I.reEnd-8),Dt=i.slice(I.reEnd-8,I.reEnd),W=i.slice(I.reEnd);Dt+=W;var Nr=X.split("(").length-1,st=W;for(d=0;d<Nr;d++)st=st.replace(/\)[+*?]?/,"");W=st;var Tt="";W===""&&r!==J&&(Tt="$");var Lr=X+at+W+Tt+Dt;i=Lr}if(i!==""&&n&&(i="(?=.)"+i),F&&(i=l+i),r===J)return[i,n];if(!n)return ne(t);var Mr=e.nocase?"i":"";try{var ot=new RegExp("^"+i+"$",Mr)}catch (e4){return new RegExp("$.")}return ot._glob=t,ot._src=i,ot}A.makeRe=function(t,r){return new E(t,r||{}).makeRe()};E.prototype.makeRe=ie;function ie(){if(this.regexp||this.regexp===!1)return this.regexp;var t=this.set;if(!t.length)return this.regexp=!1,this.regexp;var r=this.options,e=r.noglobstar?gt:r.dot?Kr:Vr,i=r.nocase?"i":"",n=t.map(function(s){return s.map(function(a){return a===yt?e:typeof a=="string"?ae(a):a._src}).join("\\/")}).join("|");n="^(?:"+n+")$",this.negate&&(n="^(?!"+n+").*$");try{this.regexp=new RegExp(n,i)}catch (e5){this.regexp=!1}return this.regexp}A.match=function(t,r,e){e=e||{};var i=new E(r,e);return t=t.filter(function(n){return i.match(n)}),i.options.nonull&&!t.length&&t.push(r),t};E.prototype.match=function(r,e){if(typeof e>"u"&&(e=this.partial),this.debug("match",r,this.pattern),this.comment)return!1;if(this.empty)return r==="";if(r==="/"&&e)return!0;var i=this.options;z.sep!=="/"&&(r=r.split(z.sep).join("/")),r=r.split(sr),this.debug(this.pattern,"split",r);var n=this.set;this.debug(this.pattern,"set",n);var s,a;for(a=r.length-1;a>=0&&(s=r[a],!s);a--);for(a=0;a<n.length;a++){var u=n[a],o=r;i.matchBase&&u.length===1&&(o=[s]);var c=this.matchOne(o,u,e);if(c)return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate};E.prototype.matchOne=function(t,r,e){var i=this.options;this.debug("matchOne",{this:this,file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var n=0,s=0,a=t.length,u=r.length;n<a&&s<u;n++,s++){this.debug("matchOne loop");var o=r[s],c=t[n];if(this.debug(r,o,c),o===!1)return!1;if(o===yt){this.debug("GLOBSTAR",[r,o,c]);var f=n,p=s+1;if(p===u){for(this.debug("** at the end");n<a;n++)if(t[n]==="."||t[n]===".."||!i.dot&&t[n].charAt(0)===".")return!1;return!0}for(;f<a;){var l=t[f];if(this.debug(`
|
3
|
-
globstar while`,t,f,r,p,l),this.matchOne(t.slice(f),r.slice(p),e))return this.debug("globstar found match!",f,a,l),!0;if(l==="."||l===".."||!i.dot&&l.charAt(0)==="."){this.debug("dot detected!",t,f,r,p);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(e&&(this.debug(`
|
4
|
-
>>> no match, partial?`,t,f,r,p),f===a))}var h;if(typeof o=="string"?(h=c===o,this.debug("string match",o,c,h)):(h=c.match(o),this.debug("pattern match",o,c,h)),!h)return!1}if(n===a&&s===u)return!0;if(n===a)return e;if(s===u)return n===a-1&&t[n]==="";throw new Error("wtf?")};function ne(t){return t.replace(/\\(.)/g,"$1")}function ae(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var cr=S((Qe,bt)=>{typeof Object.create=="function"?bt.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:bt.exports=function(r,e){if(e){r.super_=e;var i=function(){};i.prototype=e.prototype,r.prototype=new i,r.prototype.constructor=r}}});var hr=S((Ue,_t)=>{try{if(wt=O("util"),typeof wt.inherits!="function")throw"";_t.exports=wt.inherits}catch (e6){_t.exports=cr()}var wt});var et=S((We,rt)=>{"use strict";function fr(t){return t.charAt(0)==="/"}function lr(t){var r=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,e=r.exec(t),i=e[1]||"",n=!!(i&&i.charAt(1)!==":");return!!(e[2]||n)}rt.exports=process.platform==="win32"?lr:fr;rt.exports.posix=fr;rt.exports.win32=lr});var kt=S(D=>{D.setopts=fe;D.ownProp=vr;D.makeAbs=H;D.finish=le;D.mark=ve;D.isIgnored=dr;D.childrenIgnored=pe;function vr(t,r){return Object.prototype.hasOwnProperty.call(t,r)}var se=O("fs"),U=O("path"),oe=tt(),pr=et(),Et=oe.Minimatch;function ue(t,r){return t.localeCompare(r,"en")}function ce(t,r){t.ignore=r.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(he))}function he(t){var r=null;if(t.slice(-3)==="/**"){var e=t.replace(/(\/\*\*)+$/,"");r=new Et(e,{dot:!0})}return{matcher:new Et(t,{dot:!0}),gmatcher:r}}function fe(t,r,e){if(e||(e={}),e.matchBase&&r.indexOf("/")===-1){if(e.noglobstar)throw new Error("base matching requires globstar");r="**/"+r}t.silent=!!e.silent,t.pattern=r,t.strict=e.strict!==!1,t.realpath=!!e.realpath,t.realpathCache=e.realpathCache||Object.create(null),t.follow=!!e.follow,t.dot=!!e.dot,t.mark=!!e.mark,t.nodir=!!e.nodir,t.nodir&&(t.mark=!0),t.sync=!!e.sync,t.nounique=!!e.nounique,t.nonull=!!e.nonull,t.nosort=!!e.nosort,t.nocase=!!e.nocase,t.stat=!!e.stat,t.noprocess=!!e.noprocess,t.absolute=!!e.absolute,t.fs=e.fs||se,t.maxLength=e.maxLength||1/0,t.cache=e.cache||Object.create(null),t.statCache=e.statCache||Object.create(null),t.symlinks=e.symlinks||Object.create(null),ce(t,e),t.changedCwd=!1;var i=process.cwd();vr(e,"cwd")?(t.cwd=U.resolve(e.cwd),t.changedCwd=t.cwd!==i):t.cwd=i,t.root=e.root||U.resolve(t.cwd,"/"),t.root=U.resolve(t.root),process.platform==="win32"&&(t.root=t.root.replace(/\\/g,"/")),t.cwdAbs=pr(t.cwd)?t.cwd:H(t,t.cwd),process.platform==="win32"&&(t.cwdAbs=t.cwdAbs.replace(/\\/g,"/")),t.nomount=!!e.nomount,e.nonegate=!0,e.nocomment=!0,e.allowWindowsEscape=!1,t.minimatch=new Et(r,e),t.options=t.minimatch.options}function le(t){for(var r=t.nounique,e=r?[]:Object.create(null),i=0,n=t.matches.length;i<n;i++){var s=t.matches[i];if(!s||Object.keys(s).length===0){if(t.nonull){var a=t.minimatch.globSet[i];r?e.push(a):e[a]=!0}}else{var u=Object.keys(s);r?e.push.apply(e,u):u.forEach(function(o){e[o]=!0})}}if(r||(e=Object.keys(e)),t.nosort||(e=e.sort(ue)),t.mark){for(var i=0;i<e.length;i++)e[i]=t._mark(e[i]);t.nodir&&(e=e.filter(function(o){var c=!/\/$/.test(o),f=t.cache[o]||t.cache[H(t,o)];return c&&f&&(c=f!=="DIR"&&!Array.isArray(f)),c}))}t.ignore.length&&(e=e.filter(function(o){return!dr(t,o)})),t.found=e}function ve(t,r){var e=H(t,r),i=t.cache[e],n=r;if(i){var s=i==="DIR"||Array.isArray(i),a=r.slice(-1)==="/";if(s&&!a?n+="/":!s&&a&&(n=n.slice(0,-1)),n!==r){var u=H(t,n);t.statCache[u]=t.statCache[e],t.cache[u]=t.cache[e]}}return n}function H(t,r){var e=r;return r.charAt(0)==="/"?e=U.join(t.root,r):pr(r)||r===""?e=r:t.changedCwd?e=U.resolve(t.cwd,r):e=U.resolve(r),process.platform==="win32"&&(e=e.replace(/\\/g,"/")),e}function dr(t,r){return t.ignore.length?t.ignore.some(function(e){return e.matcher.match(r)||!!(e.gmatcher&&e.gmatcher.match(r))}):!1}function pe(t,r){return t.ignore.length?t.ignore.some(function(e){return!!(e.gmatcher&&e.gmatcher.match(r))}):!1}});var wr=S((Ke,br)=>{br.exports=yr;yr.GlobSync=w;var de=vt(),mr=tt(),ze=mr.Minimatch,He=_r().Glob,Ze=O("util"),St=O("path"),gr=O("assert"),it=et(),G=kt(),me=G.setopts,Ot=G.ownProp,ge=G.childrenIgnored,ye=G.isIgnored;function yr(t,r){if(typeof r=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
|
5
|
-
See: https://github.com/isaacs/node-glob/issues/167`);return new w(t,r).found}function w(t,r){if(!t)throw new Error("must provide pattern");if(typeof r=="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 w))return new w(t,r);if(me(this,t,r),this.noprocess)return this;var e=this.minimatch.set.length;this.matches=new Array(e);for(var i=0;i<e;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}w.prototype._finish=function(){if(gr.ok(this instanceof w),this.realpath){var t=this;this.matches.forEach(function(r,e){var i=t.matches[e]=Object.create(null);for(var n in r)try{n=t._makeAbs(n);var s=de.realpathSync(n,t.realpathCache);i[s]=!0}catch(a){if(a.syscall==="stat")i[t._makeAbs(n)]=!0;else throw a}})}G.finish(this)};w.prototype._process=function(t,r,e){gr.ok(this instanceof w);for(var i=0;typeof t[i]=="string";)i++;var n;switch(i){case t.length:this._processSimple(t.join("/"),r);return;case 0:n=null;break;default:n=t.slice(0,i).join("/");break}var s=t.slice(i),a;n===null?a=".":((it(n)||it(t.map(function(c){return typeof c=="string"?c:"[*]"}).join("/")))&&(!n||!it(n))&&(n="/"+n),a=n);var u=this._makeAbs(a);if(!ge(this,a)){var o=s[0]===mr.GLOBSTAR;o?this._processGlobStar(n,a,u,s,r,e):this._processReaddir(n,a,u,s,r,e)}};w.prototype._processReaddir=function(t,r,e,i,n,s){var a=this._readdir(e,s);if(a){for(var u=i[0],o=!!this.minimatch.negate,c=u._glob,f=this.dot||c.charAt(0)===".",p=[],l=0;l<a.length;l++){var h=a[l];if(h.charAt(0)!=="."||f){var v;o&&!t?v=!h.match(u):v=h.match(u),v&&p.push(h)}}var d=p.length;if(d!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var l=0;l<d;l++){var h=p[l];t&&(t.slice(-1)!=="/"?h=t+"/"+h:h=t+h),h.charAt(0)==="/"&&!this.nomount&&(h=St.join(this.root,h)),this._emitMatch(n,h)}return}i.shift();for(var l=0;l<d;l++){var h=p[l],m;t?m=[t,h]:m=[h],this._process(m.concat(i),n,s)}}}};w.prototype._emitMatch=function(t,r){if(!ye(this,r)){var e=this._makeAbs(r);if(this.mark&&(r=this._mark(r)),this.absolute&&(r=e),!this.matches[t][r]){if(this.nodir){var i=this.cache[e];if(i==="DIR"||Array.isArray(i))return}this.matches[t][r]=!0,this.stat&&this._stat(r)}}};w.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var r,e,i;try{e=this.fs.lstatSync(t)}catch(s){if(s.code==="ENOENT")return null}var n=e&&e.isSymbolicLink();return this.symlinks[t]=n,!n&&e&&!e.isDirectory()?this.cache[t]="FILE":r=this._readdir(t,!1),r};w.prototype._readdir=function(t,r){var e;if(r&&!Ot(this.symlinks,t))return this._readdirInGlobStar(t);if(Ot(this.cache,t)){var i=this.cache[t];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(t,this.fs.readdirSync(t))}catch(n){return this._readdirError(t,n),null}};w.prototype._readdirEntries=function(t,r){if(!this.mark&&!this.stat)for(var e=0;e<r.length;e++){var i=r[e];t==="/"?i=t+i:i=t+"/"+i,this.cache[i]=!0}return this.cache[t]=r,r};w.prototype._readdirError=function(t,r){switch(r.code){case"ENOTSUP":case"ENOTDIR":var e=this._makeAbs(t);if(this.cache[e]="FILE",e===this.cwdAbs){var i=new Error(r.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=r.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:if(this.cache[this._makeAbs(t)]=!1,this.strict)throw r;this.silent||console.error("glob error",r);break}};w.prototype._processGlobStar=function(t,r,e,i,n,s){var a=this._readdir(e,s);if(a){var u=i.slice(1),o=t?[t]:[],c=o.concat(u);this._process(c,n,!1);var f=a.length,p=this.symlinks[e];if(!(p&&s))for(var l=0;l<f;l++){var h=a[l];if(!(h.charAt(0)==="."&&!this.dot)){var v=o.concat(a[l],u);this._process(v,n,!0);var d=o.concat(a[l],i);this._process(d,n,!0)}}}};w.prototype._processSimple=function(t,r){var e=this._stat(t);if(this.matches[r]||(this.matches[r]=Object.create(null)),!!e){if(t&&it(t)&&!this.nomount){var i=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=St.join(this.root,t):(t=St.resolve(this.root,t),i&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(r,t)}};w.prototype._stat=function(t){var r=this._makeAbs(t),e=t.slice(-1)==="/";if(t.length>this.maxLength)return!1;if(!this.stat&&Ot(this.cache,r)){var a=this.cache[r];if(Array.isArray(a)&&(a="DIR"),!e||a==="DIR")return a;if(e&&a==="FILE")return!1}var i,n=this.statCache[r];if(!n){var s;try{s=this.fs.lstatSync(r)}catch(u){if(u&&(u.code==="ENOENT"||u.code==="ENOTDIR"))return this.statCache[r]=!1,!1}if(s&&s.isSymbolicLink())try{n=this.fs.statSync(r)}catch (e7){n=s}else n=s}this.statCache[r]=n;var a=!0;return n&&(a=n.isDirectory()?"DIR":"FILE"),this.cache[r]=this.cache[r]||a,e&&a==="FILE"?!1:a};w.prototype._mark=function(t){return G.mark(this,t)};w.prototype._makeAbs=function(t){return G.makeAbs(this,t)}});var At=S((Ve,kr)=>{kr.exports=Er;function Er(t,r){if(t&&r)return Er(t)(r);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(i){e[i]=t[i]}),e;function e(){for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];var s=t.apply(this,i),a=i[i.length-1];return typeof s=="function"&&s!==a&&Object.keys(a).forEach(function(u){s[u]=a[u]}),s}}});var It=S((Xe,jt)=>{var Sr=At();jt.exports=Sr(nt);jt.exports.strict=Sr(Or);nt.proto=nt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return nt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Or(this)},configurable:!0})});function nt(t){var r=function(){return r.called?r.value:(r.called=!0,r.value=t.apply(this,arguments))};return r.called=!1,r}function Or(t){var r=function(){if(r.called)throw new Error(r.onceError);return r.called=!0,r.value=t.apply(this,arguments)},e=t.name||"Function wrapped with `once`";return r.onceError=e+" shouldn't be called more than once",r.called=!1,r}});var jr=S((Je,Ar)=>{var be=At(),Z=Object.create(null),we=It();Ar.exports=be(_e);function _e(t,r){return Z[t]?(Z[t].push(r),null):(Z[t]=[r],Ee(t))}function Ee(t){return we(function r(){var e=Z[t],i=e.length,n=ke(arguments);try{for(var s=0;s<i;s++)e[s].apply(null,n)}finally{e.length>i?(e.splice(0,i),process.nextTick(function(){r.apply(null,n)})):delete Z[t]}})}function ke(t){for(var r=t.length,e=[],i=0;i<r;i++)e[i]=t[i];return e}});var _r=S((ri,qr)=>{qr.exports=P;var Se=vt(),Ir=tt(),Ye=Ir.Minimatch,Oe=hr(),Ae=O("events").EventEmitter,qt=O("path"),Nt=O("assert"),K=et(),Mt=wr(),$=kt(),je=$.setopts,Lt=$.ownProp,Rt=jr(),ti=O("util"),Ie=$.childrenIgnored,qe=$.isIgnored,Ne=It();function P(t,r,e){if(typeof r=="function"&&(e=r,r={}),r||(r={}),r.sync){if(e)throw new TypeError("callback provided to sync glob");return Mt(t,r)}return new g(t,r,e)}P.sync=Mt;var Le=P.GlobSync=Mt.GlobSync;P.glob=P;function Me(t,r){if(r===null||typeof r!="object")return t;for(var e=Object.keys(r),i=e.length;i--;)t[e[i]]=r[e[i]];return t}P.hasMagic=function(t,r){var e=Me({},r);e.noprocess=!0;var i=new g(t,e),n=i.minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var s=0;s<n[0].length;s++)if(typeof n[0][s]!="string")return!0;return!1};P.Glob=g;Oe(g,Ae);function g(t,r,e){if(typeof r=="function"&&(e=r,r=null),r&&r.sync){if(e)throw new TypeError("callback provided to sync glob");return new Le(t,r)}if(!(this instanceof g))return new g(t,r,e);je(this,t,r),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof e=="function"&&(e=Ne(e),this.on("error",e),this.on("end",function(o){e(null,o)}));var n=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return u();for(var s=!0,a=0;a<i;a++)this._process(this.minimatch.set[a],a,!1,u);s=!1;function u(){--n._processing,n._processing<=0&&(s?process.nextTick(function(){n._finish()}):n._finish())}}g.prototype._finish=function(){if(Nt(this instanceof g),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();$.finish(this),this.emit("end",this.found)}};g.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var t=this.matches.length;if(t===0)return this._finish();for(var r=this,e=0;e<this.matches.length;e++)this._realpathSet(e,i);function i(){--t===0&&r._finish()}};g.prototype._realpathSet=function(t,r){var e=this.matches[t];if(!e)return r();var i=Object.keys(e),n=this,s=i.length;if(s===0)return r();var a=this.matches[t]=Object.create(null);i.forEach(function(u,o){u=n._makeAbs(u),Se.realpath(u,n.realpathCache,function(c,f){c?c.syscall==="stat"?a[u]=!0:n.emit("error",c):a[f]=!0,--s===0&&(n.matches[t]=a,r())})})};g.prototype._mark=function(t){return $.mark(this,t)};g.prototype._makeAbs=function(t){return $.makeAbs(this,t)};g.prototype.abort=function(){this.aborted=!0,this.emit("abort")};g.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};g.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var t=this._emitQueue.slice(0);this._emitQueue.length=0;for(var r=0;r<t.length;r++){var e=t[r];this._emitMatch(e[0],e[1])}}if(this._processQueue.length){var i=this._processQueue.slice(0);this._processQueue.length=0;for(var r=0;r<i.length;r++){var n=i[r];this._processing--,this._process(n[0],n[1],n[2],n[3])}}}};g.prototype._process=function(t,r,e,i){if(Nt(this instanceof g),Nt(typeof i=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([t,r,e,i]);return}for(var n=0;typeof t[n]=="string";)n++;var s;switch(n){case t.length:this._processSimple(t.join("/"),r,i);return;case 0:s=null;break;default:s=t.slice(0,n).join("/");break}var a=t.slice(n),u;s===null?u=".":((K(s)||K(t.map(function(f){return typeof f=="string"?f:"[*]"}).join("/")))&&(!s||!K(s))&&(s="/"+s),u=s);var o=this._makeAbs(u);if(Ie(this,u))return i();var c=a[0]===Ir.GLOBSTAR;c?this._processGlobStar(s,u,o,a,r,e,i):this._processReaddir(s,u,o,a,r,e,i)}};g.prototype._processReaddir=function(t,r,e,i,n,s,a){var u=this;this._readdir(e,s,function(o,c){return u._processReaddir2(t,r,e,i,n,s,c,a)})};g.prototype._processReaddir2=function(t,r,e,i,n,s,a,u){if(!a)return u();for(var o=i[0],c=!!this.minimatch.negate,f=o._glob,p=this.dot||f.charAt(0)===".",l=[],h=0;h<a.length;h++){var v=a[h];if(v.charAt(0)!=="."||p){var d;c&&!t?d=!v.match(o):d=v.match(o),d&&l.push(v)}}var m=l.length;if(m===0)return u();if(i.length===1&&!this.mark&&!this.stat){this.matches[n]||(this.matches[n]=Object.create(null));for(var h=0;h<m;h++){var v=l[h];t&&(t!=="/"?v=t+"/"+v:v=t+v),v.charAt(0)==="/"&&!this.nomount&&(v=qt.join(this.root,v)),this._emitMatch(n,v)}return u()}i.shift();for(var h=0;h<m;h++){var v=l[h],y;t&&(t!=="/"?v=t+"/"+v:v=t+v),this._process([v].concat(i),n,s,u)}u()};g.prototype._emitMatch=function(t,r){if(!this.aborted&&!qe(this,r)){if(this.paused){this._emitQueue.push([t,r]);return}var e=K(r)?r:this._makeAbs(r);if(this.mark&&(r=this._mark(r)),this.absolute&&(r=e),!this.matches[t][r]){if(this.nodir){var i=this.cache[e];if(i==="DIR"||Array.isArray(i))return}this.matches[t][r]=!0;var n=this.statCache[e];n&&this.emit("stat",r,n),this.emit("match",r)}}};g.prototype._readdirInGlobStar=function(t,r){if(this.aborted)return;if(this.follow)return this._readdir(t,!1,r);var e="lstat\0"+t,i=this,n=Rt(e,s);n&&i.fs.lstat(t,n);function s(a,u){if(a&&a.code==="ENOENT")return r();var o=u&&u.isSymbolicLink();i.symlinks[t]=o,!o&&u&&!u.isDirectory()?(i.cache[t]="FILE",r()):i._readdir(t,!1,r)}};g.prototype._readdir=function(t,r,e){if(!this.aborted&&(e=Rt("readdir\0"+t+"\0"+r,e),!!e)){if(r&&!Lt(this.symlinks,t))return this._readdirInGlobStar(t,e);if(Lt(this.cache,t)){var i=this.cache[t];if(!i||i==="FILE")return e();if(Array.isArray(i))return e(null,i)}var n=this;n.fs.readdir(t,Re(this,t,e))}};function Re(t,r,e){return function(i,n){i?t._readdirError(r,i,e):t._readdirEntries(r,n,e)}}g.prototype._readdirEntries=function(t,r,e){if(!this.aborted){if(!this.mark&&!this.stat)for(var i=0;i<r.length;i++){var n=r[i];t==="/"?n=t+n:n=t+"/"+n,this.cache[n]=!0}return this.cache[t]=r,e(null,r)}};g.prototype._readdirError=function(t,r,e){if(!this.aborted){switch(r.code){case"ENOTSUP":case"ENOTDIR":var i=this._makeAbs(t);if(this.cache[i]="FILE",i===this.cwdAbs){var n=new Error(r.code+" invalid cwd "+this.cwd);n.path=this.cwd,n.code=r.code,this.emit("error",n),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:this.cache[this._makeAbs(t)]=!1,this.strict&&(this.emit("error",r),this.abort()),this.silent||console.error("glob error",r);break}return e()}};g.prototype._processGlobStar=function(t,r,e,i,n,s,a){var u=this;this._readdir(e,s,function(o,c){u._processGlobStar2(t,r,e,i,n,s,c,a)})};g.prototype._processGlobStar2=function(t,r,e,i,n,s,a,u){if(!a)return u();var o=i.slice(1),c=t?[t]:[],f=c.concat(o);this._process(f,n,!1,u);var p=this.symlinks[e],l=a.length;if(p&&s)return u();for(var h=0;h<l;h++){var v=a[h];if(!(v.charAt(0)==="."&&!this.dot)){var d=c.concat(a[h],o);this._process(d,n,!0,u);var m=c.concat(a[h],i);this._process(m,n,!0,u)}}u()};g.prototype._processSimple=function(t,r,e){var i=this;this._stat(t,function(n,s){i._processSimple2(t,r,n,s,e)})};g.prototype._processSimple2=function(t,r,e,i,n){if(this.matches[r]||(this.matches[r]=Object.create(null)),!i)return n();if(t&&K(t)&&!this.nomount){var s=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=qt.join(this.root,t):(t=qt.resolve(this.root,t),s&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(r,t),n()};g.prototype._stat=function(t,r){var e=this._makeAbs(t),i=t.slice(-1)==="/";if(t.length>this.maxLength)return r();if(!this.stat&&Lt(this.cache,e)){var n=this.cache[e];if(Array.isArray(n)&&(n="DIR"),!i||n==="DIR")return r(null,n);if(i&&n==="FILE")return r()}var s,a=this.statCache[e];if(a!==void 0){if(a===!1)return r(null,a);var u=a.isDirectory()?"DIR":"FILE";return i&&u==="FILE"?r():r(null,u,a)}var o=this,c=Rt("stat\0"+e,f);c&&o.fs.lstat(e,c);function f(p,l){if(l&&l.isSymbolicLink())return o.fs.stat(e,function(h,v){h?o._stat2(t,e,null,l,r):o._stat2(t,e,h,v,r)});o._stat2(t,e,p,l,r)}};g.prototype._stat2=function(t,r,e,i,n){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return this.statCache[r]=!1,n();var s=t.slice(-1)==="/";if(this.statCache[r]=i,r.slice(-1)==="/"&&i&&!i.isDirectory())return n(null,!1,i);var a=!0;return i&&(a=i.isDirectory()?"DIR":"FILE"),this.cache[r]=this.cache[r]||a,s&&a==="FILE"?n():n(null,a,i)}});exports.a = O; exports.b = S; exports.c = _r;
|