git-publish 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +16 -16
  2. package/dist/index.js +5 -5
  3. package/package.json +26 -52
package/README.md CHANGED
@@ -6,32 +6,32 @@ Publish your npm package to a Git branch.
6
6
 
7
7
  ## Why?
8
8
 
9
- For testing published packages without publishing to npm.
9
+ To test a package without publishing to npm.
10
10
 
11
- Making a prerelease to npm using `npm publish` has the following drawbacks:
11
+ When using `npm publish` to make a pre-release, you have the following drawbacks:
12
12
 
13
- - Needs a unique version for every release.
13
+ - **Versioning concerns:** even though you're just testing, you still need to version bump
14
+ - **Undeleteable:** releases are hard to remove due to npm's [strict unpublish policy](https://docs.npmjs.com/policies/unpublish)
15
+ - **Unverifyable:** npm does not offer a great way to browse the contents of a package
16
+ - **Risky:** Publishing tests to a production environment can be dangerous (eg. accidentally publish as stable)
14
17
 
15
- - Hard to remove due to npm's [strict unpublish policy](https://docs.npmjs.com/policies/unpublish).
16
-
17
- - Cumbersome to verify the contents of the published package.
18
-
19
- - Production environment—risky if you make a mistake (eg. accidentally publish as stable).
20
-
21
- Using `npm link` has the drawback of not running [npm life cycle scripts](https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts) and including non-publishable assets.
18
+ When using `npm link`, you have the following drawbacks:
19
+ - No [npm life cycle scripts](https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts)
20
+ - Includes non-publishable assets
21
+ - Doesn't install dependencies
22
22
 
23
23
 
24
24
  In contrast, `git-publish` has the following benefits:
25
25
 
26
- - **Unversioned** Instead of versions, branch names are used. Branches can be updated to reflect latest change.
26
+ - **No versions:** Instead of versions, branch names are used. Branches can be updated to reflect latest change.
27
27
 
28
- - **Deletable** Simply delete the branch when you're done with it.
28
+ - **Deletable:** Simply delete the branch when you're done with it.
29
29
 
30
- - **Browsable** Use GitHub to verify the contents of the branch. You can even share a link for others to see.
30
+ - **Browsable:** Use GitHub to easily verify the contents of the branch. You can even share a link for others to see.
31
31
 
32
- - **Dev environment** Low risk of mistakes.
32
+ - **Dev environment:** Low risk of mistakes.
33
33
 
34
- - **Simulates `npm publish`** Runs npm life cycle scripts and only includes publishable assets.
34
+ - **Simulates `npm publish`:** Runs npm life cycle scripts and only includes publishable assets.
35
35
 
36
36
  ## Usage
37
37
 
@@ -79,7 +79,7 @@ git-publish
79
79
 
80
80
  ### How can I include a build step?
81
81
 
82
- Call the build command it in the [`prepack` script](https://docs.npmjs.com/cli/v8/using-npm/scripts#:~:text=on%20npm%20publish.-,prepack,-Runs%20BEFORE%20a).
82
+ Like `npm publish`, you can call the build command it in the [`prepack` script](https://docs.npmjs.com/cli/v8/using-npm/scripts#:~:text=on%20npm%20publish.-,prepack,-Runs%20BEFORE%20a).
83
83
 
84
84
  ### What does this script do?
85
85
 
package/dist/index.js CHANGED
@@ -84,12 +84,12 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
84
84
  `);if(d.postprocess){let{postprocess:g}=d;E=E.map((C,y)=>g.call(d,C,y))}return d.paddingTop&&E.unshift(...Jf(d.paddingTop)),d.paddingBottom&&E.push(...Jf(d.paddingBottom)),E.length>s&&(s=E.length),Vo(gi({},d),{lines:E})}),c=[];for(let d=0;d<s;d+=1){let h=l.map(m=>{var E;let g=(E=m.lines[d])!=null?E:"",C=Number.isFinite(m.width)?" ".repeat(m.width-mn(g)):"",y=m.paddingLeftString;return m.align==="right"&&(y+=C),y+=g,m.align==="left"&&(y+=C),y+m.paddingRightString}).join("");c.push(h)}u.push(c.join(`
85
85
  `))}return u.join(`
86
86
  `)}function kE(e,t){if(!e||e.length===0)return"";let u=hE(e),i=u.length;if(i===0)return"";let{stdoutColumns:o,columns:s}=cE(t);if(s.length>i)throw new Error(`${s.length} columns defined, but only ${i} columns found`);let l=EE(o,s,u);return e.map(c=>xE(l,c)).join(`
87
- `)}Me();var _E=["<",">","=",">=","<="];function OE(e){if(!_E.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function IE(e){let t=Object.keys(e).map(u=>{let[i,o]=u.split(" ");OE(i);let s=Number.parseInt(o,10);if(Number.isNaN(s))throw new TypeError(`Invalid breakpoint value: ${o}`);let l=e[u];return{operator:i,breakpoint:s,value:l}}).sort((u,i)=>i.breakpoint-u.breakpoint);return u=>{var i;return(i=t.find(({operator:o,breakpoint:s})=>o==="="&&u===s||o===">"&&u>s||o==="<"&&u<s||o===">="&&u>=s||o==="<="&&u<=s))==null?void 0:i.value}}const RE=e=>e.replace(/[-_ ](\w)/g,(t,u)=>u.toUpperCase()),PE=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),NE={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:e=>e.trim()},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function TE(e){let t=!1;const u=Object.keys(e).sort((i,o)=>i.localeCompare(o)).map(i=>{const o=e[i],s="alias"in o;return s&&(t=!0),{name:i,flag:o,flagFormatted:`--${PE(i)}`,aliasesEnabled:t,aliasFormatted:s?`-${o.alias}`:void 0}}).map(i=>(i.aliasesEnabled=t,[{type:"flagName",data:i},{type:"flagDescription",data:i}]));return{type:"table",data:{tableData:u,tableBreakpoints:NE}}}const Vf=e=>{var t;return!e||((t=e.version)!=null?t:e.help?e.help.version:void 0)},Kf=e=>{var t;const u="parent"in e&&((t=e.parent)==null?void 0:t.name);return(u?`${u} `:"")+e.name};function $E(e){var t;const u=[];e.name&&u.push(Kf(e));const i=(t=Vf(e))!=null?t:"parent"in e&&Vf(e.parent);if(i&&u.push(`v${i}`),u.length!==0)return{id:"name",type:"text",data:`${u.join(" ")}
87
+ `)}Me();var _E=["<",">","=",">=","<="];function OE(e){if(!_E.includes(e))throw new TypeError(`Invalid breakpoint operator: ${e}`)}function IE(e){let t=Object.keys(e).map(u=>{let[i,o]=u.split(" ");OE(i);let s=Number.parseInt(o,10);if(Number.isNaN(s))throw new TypeError(`Invalid breakpoint value: ${o}`);let l=e[u];return{operator:i,breakpoint:s,value:l}}).sort((u,i)=>i.breakpoint-u.breakpoint);return u=>{var i;return(i=t.find(({operator:o,breakpoint:s})=>o==="="&&u===s||o===">"&&u>s||o==="<"&&u<s||o===">="&&u>=s||o==="<="&&u<=s))==null?void 0:i.value}}const RE=e=>e.replace(/[-_ ](\w)/g,(t,u)=>u.toUpperCase()),PE=e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),NE={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:e=>e.trim()},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function TE(e){let t=!1;return{type:"table",data:{tableData:Object.keys(e).sort((i,o)=>i.localeCompare(o)).map(i=>{const o=e[i],s="alias"in o;return s&&(t=!0),{name:i,flag:o,flagFormatted:`--${PE(i)}`,aliasesEnabled:t,aliasFormatted:s?`-${o.alias}`:void 0}}).map(i=>(i.aliasesEnabled=t,[{type:"flagName",data:i},{type:"flagDescription",data:i}])),tableBreakpoints:NE}}}const Vf=e=>{var t;return!e||((t=e.version)!=null?t:e.help?e.help.version:void 0)},Kf=e=>{var t;const u="parent"in e&&((t=e.parent)==null?void 0:t.name);return(u?`${u} `:"")+e.name};function $E(e){var t;const u=[];e.name&&u.push(Kf(e));const i=(t=Vf(e))!=null?t:"parent"in e&&Vf(e.parent);if(i&&u.push(`v${i}`),u.length!==0)return{id:"name",type:"text",data:`${u.join(" ")}
88
88
  `}}function LE(e){const{help:t}=e;if(!(!t||!t.description))return{id:"description",type:"text",data:`${t.description}
89
89
  `}}function jE(e){var t;const u=e.help||{};if("usage"in u)return u.usage?{id:"usage",type:"section",data:{title:"Usage:",body:Array.isArray(u.usage)?u.usage.join(`
90
90
  `):u.usage}}:void 0;if(e.name){const i=[],o=[Kf(e)];if(e.flags&&Object.keys(e.flags).length>0&&o.push("[flags...]"),e.parameters&&e.parameters.length>0){const{parameters:s}=e,l=s.indexOf("--"),c=l>-1&&s.slice(l+1).some(d=>d.startsWith("<"));o.push(s.map(d=>d!=="--"?d:c?"--":"[--]").join(" "))}if(o.length>1&&i.push(o.join(" ")),"commands"in e&&((t=e.commands)==null?void 0:t.length)&&i.push(`${e.name} <command>`),i.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:i.join(`
91
- `)}}}}function ME(e){var t;if(!("commands"in e)||!((t=e.commands)!=null&&t.length))return;const u=e.commands.map(i=>[i.options.name,i.options.help?i.options.help.description:""]);return{id:"commands",type:"section",data:{title:"Commands:",body:{type:"table",data:{tableData:u,tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}function zE(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:TE(e.flags),indentBody:0}}}function UE(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:u}=t;if(Array.isArray(u)&&(u=u.join(`
92
- `)),u)return{id:"examples",type:"section",data:{title:"Examples:",body:u}}}function GE(e){if(!("alias"in e)||!e.alias)return;const{alias:t}=e,u=Array.isArray(t)?t.join(", "):t;return{id:"aliases",type:"section",data:{title:"Aliases:",body:u}}}const HE=e=>[$E,LE,jE,ME,zE,UE,GE].map(t=>t(e)).filter(t=>Boolean(t)),WE=rc.default.WriteStream.prototype.hasColors();class qE{text(t){return t}bold(t){return WE?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:u}){return t.replace(/^/gm," ".repeat(u))}heading(t){return this.bold(t)}section({title:t,body:u,indentBody:i=2}){return`${(t?`${this.heading(t)}
91
+ `)}}}}function ME(e){var t;return!("commands"in e)||!((t=e.commands)!=null&&t.length)?void 0:{id:"commands",type:"section",data:{title:"Commands:",body:{type:"table",data:{tableData:e.commands.map(i=>[i.options.name,i.options.help?i.options.help.description:""]),tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}function zE(e){if(!(!e.flags||Object.keys(e.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:TE(e.flags),indentBody:0}}}function UE(e){const{help:t}=e;if(!t||!t.examples||t.examples.length===0)return;let{examples:u}=t;if(Array.isArray(u)&&(u=u.join(`
92
+ `)),u)return{id:"examples",type:"section",data:{title:"Examples:",body:u}}}function GE(e){if(!("alias"in e)||!e.alias)return;const{alias:t}=e;return{id:"aliases",type:"section",data:{title:"Aliases:",body:Array.isArray(t)?t.join(", "):t}}}const HE=e=>[$E,LE,jE,ME,zE,UE,GE].map(t=>t(e)).filter(t=>Boolean(t)),WE=rc.default.WriteStream.prototype.hasColors();class qE{text(t){return t}bold(t){return WE?`\x1B[1m${t}\x1B[22m`:t.toLocaleUpperCase()}indentText({text:t,spaces:u}){return t.replace(/^/gm," ".repeat(u))}heading(t){return this.bold(t)}section({title:t,body:u,indentBody:i=2}){return`${(t?`${this.heading(t)}
93
93
  `:"")+(u?this.indentText({text:this.render(u),spaces:i}):"")}
94
94
  `}table({tableData:t,tableOptions:u,tableBreakpoints:i}){return kE(t.map(o=>o.map(s=>this.render(s))),i?IE(i):u)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:u,flagFormatted:i,aliasesEnabled:o,aliasFormatted:s}=t;let l="";if(s?l+=`${s}, `:o&&(l+=" "),l+=i,"placeholder"in u&&typeof u.placeholder=="string")l+=`${this.flagOperator(t)}${u.placeholder}`;else{const c=this.flagParameter("type"in u?u.type:u);c&&(l+=`${this.flagOperator(t)}${c}`)}return l}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){var u;let i="description"in t&&(u=t.description)!=null?u:"";if("default"in t){let{default:o}=t;typeof o=="function"&&(o=o()),o&&(i+=` (default: ${this.flagDefault(o)})`)}return i}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(u=>this.render(u)).join(`
95
95
  `);if("type"in t&&this[t.type]){const u=this[t.type];if(typeof u=="function")return u.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const Yf=/^[\w.-]+$/;var QE=Object.defineProperty,JE=Object.defineProperties,VE=Object.getOwnPropertyDescriptors,Xf=Object.getOwnPropertySymbols,KE=Object.prototype.hasOwnProperty,YE=Object.prototype.propertyIsEnumerable,Zf=(e,t,u)=>t in e?QE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[t]=u,qn=(e,t)=>{for(var u in t||(t={}))KE.call(t,u)&&Zf(e,u,t[u]);if(Xf)for(var u of Xf(t))YE.call(t,u)&&Zf(e,u,t[u]);return e},es=(e,t)=>JE(e,VE(t));const{stringify:yt}=JSON,XE=/[|\\{}()[\]^$+*?.]/;function ts(e){const t=[];let u,i;for(const o of e){if(i)throw new Error(`Invalid parameter: Spread parameter ${yt(i)} must be last`);const s=o[0],l=o[o.length-1];let c;if(s==="<"&&l===">"&&(c=!0,u))throw new Error(`Invalid parameter: Required parameter ${yt(o)} cannot come after optional parameter ${yt(u)}`);if(s==="["&&l==="]"&&(c=!1,u=o),c===void 0)throw new Error(`Invalid parameter: ${yt(o)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let d=o.slice(1,-1);const h=d.slice(-3)==="...";h&&(i=o,d=d.slice(0,-3));const m=d.match(XE);if(m)throw new Error(`Invalid parameter: ${yt(o)}. Invalid character found ${yt(m[0])}`);t.push({name:d,required:c,spread:h})}return t}function ns(e,t,u,i){for(let o=0;o<t.length;o+=1){const{name:s,required:l,spread:c}=t[o],d=RE(s);if(d in e)throw new Error(`Invalid parameter: ${yt(s)} is used more than once.`);const h=c?u.slice(o):u[o];if(c&&(o=t.length),l&&(!h||c&&h.length===0))return console.error(`Error: Missing required parameter ${yt(s)}
@@ -98,7 +98,7 @@ globstar while`,t,E,u,g,C),this.matchOne(t.slice(E),u.slice(g),i))return this.de
98
98
  >>> no match, partial?`,t,E,u,g),E===c))}var y;if(typeof h=="string"?(y=m===h,this.debug("string match",h,m,y)):(y=m.match(h),this.debug("pattern match",h,m,y)),!y)return!1}if(s===c&&l===d)return!0;if(s===c)return i;if(l===d)return s===c-1&&t[s]==="";throw new Error("wtf?")}braceExpand(){return md(this.pattern,this.options)}parse(t,u){Ci(t);const i=this.options;if(t==="**")if(i.noglobstar)t="*";else return ht;if(t==="")return"";let o="",s=!!i.nocase,l=!1;const c=[],d=[];let h,m=!1,E=-1,g=-1,C,y,v;const k=t.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",R=()=>{if(h){switch(h){case"*":o+=ls,s=!0;break;case"?":o+=ss,s=!0;break;default:o+="\\"+h;break}this.debug("clearStateChar %j %j",h,o),h=!1}};for(let w=0,B;w<t.length&&(B=t.charAt(w));w++){if(this.debug("%s %s %s %j",t,w,o,B),l){if(B==="/")return!1;pd[B]&&(o+="\\"),o+=B,l=!1;continue}switch(B){case"/":return!1;case"\\":R(),l=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,w,o,B),m){this.debug(" in class"),B==="!"&&w===g+1&&(B="^"),o+=B;continue}this.debug("call clearStateChar %j",h),R(),h=B,i.noext&&R();continue;case"(":if(m){o+="(";continue}if(!h){o+="\\(";continue}c.push({type:h,start:w-1,reStart:o.length,open:dd[h].open,close:dd[h].close}),o+=h==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",h,o),h=!1;continue;case")":if(m||!c.length){o+="\\)";continue}R(),s=!0,y=c.pop(),o+=y.close,y.type==="!"&&d.push(y),y.reEnd=o.length;continue;case"|":if(m||!c.length){o+="\\|";continue}R(),o+="|";continue;case"[":if(R(),m){o+="\\"+B;continue}m=!0,g=w,E=o.length,o+=B;continue;case"]":if(w===g+1||!m){o+="\\"+B;continue}C=t.substring(g+1,w);try{RegExp("["+C+"]")}catch{v=this.parse(C,bi),o=o.substr(0,E)+"\\["+v[0]+"\\]",s=s||v[1],m=!1;continue}s=!0,m=!1,o+=B;continue;default:R(),pd[B]&&!(B==="^"&&m)&&(o+="\\"),o+=B;break}}for(m&&(C=t.substr(g+1),v=this.parse(C,bi),o=o.substr(0,E)+"\\["+v[0],s=s||v[1]),y=c.pop();y;y=c.pop()){let w;w=o.slice(y.reStart+y.open.length),this.debug("setting tail",o,y),w=w.replace(/((?:\\{2}){0,64})(\\?)\|/g,(x,P,_)=>(_||(_="\\"),P+P+_+"|")),this.debug(`tail=%j
99
99
  %s`,w,w,y,o);const B=y.type==="*"?ls:y.type==="?"?ss:"\\"+y.type;s=!0,o=o.slice(0,y.reStart)+B+"\\("+w}R(),l&&(o+="\\\\");const N=SC[o.charAt(0)];for(let w=d.length-1;w>-1;w--){const B=d[w],x=o.slice(0,B.reStart),P=o.slice(B.reStart,B.reEnd-8);let _=o.slice(B.reEnd);const T=o.slice(B.reEnd-8,B.reEnd)+_,H=x.split("(").length-1;let G=_;for(let ee=0;ee<H;ee++)G=G.replace(/\)[+*?]?/,"");_=G;const X=_===""&&u!==bi?"$":"";o=x+P+_+X+T}if(o!==""&&s&&(o="(?=.)"+o),N&&(o=k+o),u===bi)return[o,s];if(!s)return AC(t);const z=i.nocase?"i":"";try{return Object.assign(new RegExp("^"+o+"$",z),{_glob:t,_src:o})}catch{return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const u=this.options,i=u.noglobstar?ls:u.dot?vC:wC,o=u.nocase?"i":"";let s=t.map(l=>(l=l.map(c=>typeof c=="string"?xC(c):c===ht?ht:c._src).reduce((c,d)=>(c[c.length-1]===ht&&d===ht||c.push(d),c),[]),l.forEach((c,d)=>{c!==ht||l[d-1]===ht||(d===0?l.length>1?l[d+1]="(?:\\/|"+i+"\\/)?"+l[d+1]:l[d]=i:d===l.length-1?l[d-1]+="(?:\\/|"+i+")?":(l[d-1]+="(?:\\/|\\/"+i+"\\/)"+l[d+1],l[d+1]=ht))}),l.filter(c=>c!==ht).join("/"))).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,o)}catch{this.regexp=!1}return this.regexp}match(t,u=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&u)return!0;const i=this.options;os.sep!=="/"&&(t=t.split(os.sep).join("/")),t=t.split(gd),this.debug(this.pattern,"split",t);const o=this.set;this.debug(this.pattern,"set",o);let s;for(let l=t.length-1;l>=0&&(s=t[l],!s);l--);for(let l=0;l<o.length;l++){const c=o[l];let d=t;if(i.matchBase&&c.length===1&&(d=[s]),this.matchOne(d,c,u))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return Ve.defaults(t).Minimatch}}Ve.Minimatch=yi;const Zt=rt.default,cs=Oe.default,kC=wr.default.EventEmitter,_C=Mr.Minimatch;class Wr extends kC{constructor(t){t=t||{},super(t),this.isSymbolicLink=t.isSymbolicLink,this.path=t.path||process.cwd(),this.basename=cs.basename(this.path),this.ignoreFiles=t.ignoreFiles||[".ignore"],this.ignoreRules={},this.parent=t.parent||null,this.includeEmpty=!!t.includeEmpty,this.root=this.parent?this.parent.root:this.path,this.follow=!!t.follow,this.result=this.parent?this.parent.result:new Set,this.entries=null,this.sawError=!1}sort(t,u){return t.localeCompare(u,"en")}emit(t,u){let i=!1;return this.sawError&&t==="error"||(t==="error"?this.sawError=!0:t==="done"&&!this.parent&&(u=Array.from(u).map(o=>/^@/.test(o)?`./${o}`:o).sort(this.sort),this.result=u),t==="error"&&this.parent?i=this.parent.emit("error",u):i=super.emit(t,u)),i}start(){return Zt.readdir(this.path,(t,u)=>t?this.emit("error",t):this.onReaddir(u)),this}isIgnoreFile(t){return t!=="."&&t!==".."&&this.ignoreFiles.indexOf(t)!==-1}onReaddir(t){this.entries=t,t.length===0?(this.includeEmpty&&this.result.add(this.path.slice(this.root.length+1)),this.emit("done",this.result)):this.entries.some(i=>this.isIgnoreFile(i))?this.addIgnoreFiles():this.filterEntries()}addIgnoreFiles(){const t=this.entries.filter(o=>this.isIgnoreFile(o));let u=t.length;const i=o=>{--u===0&&this.filterEntries()};t.forEach(o=>this.addIgnoreFile(o,i))}addIgnoreFile(t,u){const i=cs.resolve(this.path,t);Zt.readFile(i,"utf8",(o,s)=>o?this.emit("error",o):this.onReadIgnoreFile(t,s,u))}onReadIgnoreFile(t,u,i){const o={matchBase:!0,dot:!0,flipNegate:!0,nocase:!0},s=u.split(/\r?\n/).filter(l=>!/^#|^$/.test(l.trim())).map(l=>new _C(l.trim(),o));this.ignoreRules[t]=s,i()}filterEntries(){const t=this.entries.map(i=>{const o=this.filterEntry(i),s=this.filterEntry(i,!0);return o||s?[i,o,s]:!1}).filter(i=>i);let u=t.length;if(u===0)this.emit("done",this.result);else{const i=o=>{--u===0&&this.emit("done",this.result)};t.forEach(o=>{const s=o[0],l=o[1],c=o[2];this.stat({entry:s,file:l,dir:c},i)})}}onstat({st:t,entry:u,file:i,dir:o,isSymbolicLink:s},l){const c=this.path+"/"+u;t.isDirectory()?o?this.walker(u,{isSymbolicLink:s},l):l():(i&&this.result.add(c.slice(this.root.length+1)),l())}stat({entry:t,file:u,dir:i},o){const s=this.path+"/"+t;Zt.lstat(s,(l,c)=>{if(l)this.emit("error",l);else{const d=c.isSymbolicLink();this.follow&&d?Zt.stat(s,(h,m)=>{h?this.emit("error",h):this.onstat({st:m,entry:t,file:u,dir:i,isSymbolicLink:d},o)}):this.onstat({st:c,entry:t,file:u,dir:i,isSymbolicLink:d},o)}})}walkerOpt(t,u){return{path:this.path+"/"+t,parent:this,ignoreFiles:this.ignoreFiles,follow:this.follow,includeEmpty:this.includeEmpty,...u}}walker(t,u,i){new Wr(this.walkerOpt(t,u)).on("done",i).start()}filterEntry(t,u){let i=!0;if(this.parent&&this.parent.filterEntry){var o=this.basename+"/"+t;i=this.parent.filterEntry(o,u)}return this.ignoreFiles.forEach(s=>{this.ignoreRules[s]&&this.ignoreRules[s].forEach(l=>{l.negate!==i&&(l.match("/"+t)||l.match(t)||!!u&&(l.match("/"+t+"/")||l.match(t+"/"))||!!u&&l.negate&&(l.match("/"+t,!0)||l.match(t,!0)))&&(i=l.negate)})}),i}}class Ai extends Wr{start(){return this.onReaddir(Zt.readdirSync(this.path)),this}addIgnoreFile(t,u){const i=cs.resolve(this.path,t);this.onReadIgnoreFile(t,Zt.readFileSync(i,"utf8"),u)}stat({entry:t,file:u,dir:i},o){const s=this.path+"/"+t;let l=Zt.lstatSync(s);const c=l.isSymbolicLink();this.follow&&c&&(l=Zt.statSync(s)),this.onstat({st:l,entry:t,file:u,dir:i,isSymbolicLink:c},o)}walker(t,u,i){new Ai(this.walkerOpt(t,u)).start(),i()}}const Fi=(e,t)=>{const u=new Promise((i,o)=>{new Wr(e).on("done",i).on("error",o).start()});return t?u.then(i=>t(null,i),t):u},OC=e=>new Ai(e).start().result;var IC=Fi;Fi.sync=OC,Fi.Walker=Wr,Fi.WalkerSync=Ai;var Ds={},En=Oe.default,en=process.platform==="win32",tn=rt.default,RC=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function PC(){var e;if(RC){var t=new Error;e=u}else e=i;return e;function u(o){o&&(t.message=o.message,o=t,i(o))}function i(o){if(o){if(process.throwDeprecation)throw o;if(!process.noDeprecation){var s="fs: missing callback "+(o.stack||o.message);process.traceDeprecation?console.trace(s):console.error(s)}}}}function NC(e){return typeof e=="function"?e:PC()}if(En.normalize,en)var Cn=/(.*?)(?:[\/\\]+|$)/g;else var Cn=/(.*?)(?:[\/]+|$)/g;if(en)var Es=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else var Es=/^[\/]*/;Ds.realpathSync=function(t,u){if(t=En.resolve(t),u&&Object.prototype.hasOwnProperty.call(u,t))return u[t];var i=t,o={},s={},l,c,d,h;m();function m(){var k=Es.exec(t);l=k[0].length,c=k[0],d=k[0],h="",en&&!s[d]&&(tn.lstatSync(d),s[d]=!0)}for(;l<t.length;){Cn.lastIndex=l;var E=Cn.exec(t);if(h=c,c+=E[0],d=h+E[1],l=Cn.lastIndex,!(s[d]||u&&u[d]===d)){var g;if(u&&Object.prototype.hasOwnProperty.call(u,d))g=u[d];else{var C=tn.lstatSync(d);if(!C.isSymbolicLink()){s[d]=!0,u&&(u[d]=d);continue}var y=null;if(!en){var v=C.dev.toString(32)+":"+C.ino.toString(32);o.hasOwnProperty(v)&&(y=o[v])}y===null&&(tn.statSync(d),y=tn.readlinkSync(d)),g=En.resolve(h,y),u&&(u[d]=g),en||(o[v]=y)}t=En.resolve(g,t.slice(l)),m()}}return u&&(u[i]=t),t},Ds.realpath=function(t,u,i){if(typeof i!="function"&&(i=NC(u),u=null),t=En.resolve(t),u&&Object.prototype.hasOwnProperty.call(u,t))return process.nextTick(i.bind(null,null,u[t]));var o=t,s={},l={},c,d,h,m;E();function E(){var k=Es.exec(t);c=k[0].length,d=k[0],h=k[0],m="",en&&!l[h]?tn.lstat(h,function(R){if(R)return i(R);l[h]=!0,g()}):process.nextTick(g)}function g(){if(c>=t.length)return u&&(u[o]=t),i(null,t);Cn.lastIndex=c;var k=Cn.exec(t);return m=d,d+=k[0],h=m+k[1],c=Cn.lastIndex,l[h]||u&&u[h]===h?process.nextTick(g):u&&Object.prototype.hasOwnProperty.call(u,h)?v(u[h]):tn.lstat(h,C)}function C(k,R){if(k)return i(k);if(!R.isSymbolicLink())return l[h]=!0,u&&(u[h]=h),process.nextTick(g);if(!en){var N=R.dev.toString(32)+":"+R.ino.toString(32);if(s.hasOwnProperty(N))return y(null,s[N],h)}tn.stat(h,function(z){if(z)return i(z);tn.readlink(h,function(w,B){en||(s[N]=B),y(w,B)})})}function y(k,R,N){if(k)return i(k);var z=En.resolve(m,R);u&&(u[N]=z),v(z)}function v(k){t=En.resolve(k,t.slice(c)),E()}};var Ed=nn;nn.realpath=nn,nn.sync=hs,nn.realpathSync=hs,nn.monkeypatch=$C,nn.unmonkeypatch=LC;var Jn=rt.default,fs=Jn.realpath,ds=Jn.realpathSync,TC=process.version,Cd=/^v[0-5]\./.test(TC),bd=Ds;function yd(e){return e&&e.syscall==="realpath"&&(e.code==="ELOOP"||e.code==="ENOMEM"||e.code==="ENAMETOOLONG")}function nn(e,t,u){if(Cd)return fs(e,t,u);typeof t=="function"&&(u=t,t=null),fs(e,t,function(i,o){yd(i)?bd.realpath(e,t,u):u(i,o)})}function hs(e,t){if(Cd)return ds(e,t);try{return ds(e,t)}catch(u){if(yd(u))return bd.realpathSync(e,t);throw u}}function $C(){Jn.realpath=nn,Jn.realpathSync=hs}function LC(){Jn.realpath=fs,Jn.realpathSync=ds}var jC=require,Fd={exports:{}},vi={exports:{}},vd;function MC(){return vd||(vd=1,typeof Object.create=="function"?vi.exports=function(t,u){u&&(t.super_=u,t.prototype=Object.create(u.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:vi.exports=function(t,u){if(u){t.super_=u;var i=function(){};i.prototype=u.prototype,t.prototype=new i,t.prototype.constructor=t}}),vi.exports}(function(e){try{var t=jC("util");if(typeof t.inherits!="function")throw"";e.exports=t.inherits}catch{e.exports=MC()}})(Fd);var Vn={exports:{}};function wd(e){return e.charAt(0)==="/"}function Sd(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,u=t.exec(e),i=u[1]||"",o=Boolean(i&&i.charAt(1)!==":");return Boolean(u[2]||o)}Vn.exports=process.platform==="win32"?Sd:wd,Vn.exports.posix=wd,Vn.exports.win32=Sd;var Pt={};Pt.setopts=qC,Pt.ownProp=Bd,Pt.makeAbs=zr,Pt.finish=QC,Pt.mark=JC,Pt.isIgnored=xd,Pt.childrenIgnored=VC;function Bd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var zC=rt.default,Kn=Oe.default,UC=Mr,Ad=Vn.exports,ps=UC.Minimatch;function GC(e,t){return e.localeCompare(t,"en")}function HC(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]),e.ignore.length&&(e.ignore=e.ignore.map(WC))}function WC(e){var t=null;if(e.slice(-3)==="/**"){var u=e.replace(/(\/\*\*)+$/,"");t=new ps(u,{dot:!0})}return{matcher:new ps(e,{dot:!0}),gmatcher:t}}function qC(e,t,u){if(u||(u={}),u.matchBase&&t.indexOf("/")===-1){if(u.noglobstar)throw new Error("base matching requires globstar");t="**/"+t}e.silent=!!u.silent,e.pattern=t,e.strict=u.strict!==!1,e.realpath=!!u.realpath,e.realpathCache=u.realpathCache||Object.create(null),e.follow=!!u.follow,e.dot=!!u.dot,e.mark=!!u.mark,e.nodir=!!u.nodir,e.nodir&&(e.mark=!0),e.sync=!!u.sync,e.nounique=!!u.nounique,e.nonull=!!u.nonull,e.nosort=!!u.nosort,e.nocase=!!u.nocase,e.stat=!!u.stat,e.noprocess=!!u.noprocess,e.absolute=!!u.absolute,e.fs=u.fs||zC,e.maxLength=u.maxLength||1/0,e.cache=u.cache||Object.create(null),e.statCache=u.statCache||Object.create(null),e.symlinks=u.symlinks||Object.create(null),HC(e,u),e.changedCwd=!1;var i=process.cwd();Bd(u,"cwd")?(e.cwd=Kn.resolve(u.cwd),e.changedCwd=e.cwd!==i):e.cwd=i,e.root=u.root||Kn.resolve(e.cwd,"/"),e.root=Kn.resolve(e.root),process.platform==="win32"&&(e.root=e.root.replace(/\\/g,"/")),e.cwdAbs=Ad(e.cwd)?e.cwd:zr(e,e.cwd),process.platform==="win32"&&(e.cwdAbs=e.cwdAbs.replace(/\\/g,"/")),e.nomount=!!u.nomount,u.nonegate=!0,u.nocomment=!0,u.allowWindowsEscape=!0,e.minimatch=new ps(t,u),e.options=e.minimatch.options}function QC(e){for(var t=e.nounique,u=t?[]:Object.create(null),i=0,o=e.matches.length;i<o;i++){var s=e.matches[i];if(!s||Object.keys(s).length===0){if(e.nonull){var l=e.minimatch.globSet[i];t?u.push(l):u[l]=!0}}else{var c=Object.keys(s);t?u.push.apply(u,c):c.forEach(function(d){u[d]=!0})}}if(t||(u=Object.keys(u)),e.nosort||(u=u.sort(GC)),e.mark){for(var i=0;i<u.length;i++)u[i]=e._mark(u[i]);e.nodir&&(u=u.filter(function(d){var h=!/\/$/.test(d),m=e.cache[d]||e.cache[zr(e,d)];return h&&m&&(h=m!=="DIR"&&!Array.isArray(m)),h}))}e.ignore.length&&(u=u.filter(function(d){return!xd(e,d)})),e.found=u}function JC(e,t){var u=zr(e,t),i=e.cache[u],o=t;if(i){var s=i==="DIR"||Array.isArray(i),l=t.slice(-1)==="/";if(s&&!l?o+="/":!s&&l&&(o=o.slice(0,-1)),o!==t){var c=zr(e,o);e.statCache[c]=e.statCache[u],e.cache[c]=e.cache[u]}}return o}function zr(e,t){var u=t;return t.charAt(0)==="/"?u=Kn.join(e.root,t):Ad(t)||t===""?u=t:e.changedCwd?u=Kn.resolve(e.cwd,t):u=Kn.resolve(t),process.platform==="win32"&&(u=u.replace(/\\/g,"/")),u}function xd(e,t){return e.ignore.length?e.ignore.some(function(u){return u.matcher.match(t)||!!(u.gmatcher&&u.gmatcher.match(t))}):!1}function VC(e,t){return e.ignore.length?e.ignore.some(function(u){return!!(u.gmatcher&&u.gmatcher.match(t))}):!1}var gs,kd;function KC(){if(kd)return gs;kd=1,gs=m,m.GlobSync=E;var e=Ed,t=Mr;t.Minimatch,Nd().Glob;var u=Oe.default,i=Lu.default,o=Vn.exports,s=Pt,l=s.setopts,c=s.ownProp,d=s.childrenIgnored,h=s.isIgnored;function m(g,C){if(typeof C=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
100
100
  See: https://github.com/isaacs/node-glob/issues/167`);return new E(g,C).found}function E(g,C){if(!g)throw new Error("must provide pattern");if(typeof C=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
101
- See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof E))return new E(g,C);if(l(this,g,C),this.noprocess)return this;var y=this.minimatch.set.length;this.matches=new Array(y);for(var v=0;v<y;v++)this._process(this.minimatch.set[v],v,!1);this._finish()}return E.prototype._finish=function(){if(i(this instanceof E),this.realpath){var g=this;this.matches.forEach(function(C,y){var v=g.matches[y]=Object.create(null);for(var k in C)try{k=g._makeAbs(k);var R=e.realpathSync(k,g.realpathCache);v[R]=!0}catch(N){if(N.syscall==="stat")v[g._makeAbs(k)]=!0;else throw N}})}s.finish(this)},E.prototype._process=function(g,C,y){i(this instanceof E);for(var v=0;typeof g[v]=="string";)v++;var k;switch(v){case g.length:this._processSimple(g.join("/"),C);return;case 0:k=null;break;default:k=g.slice(0,v).join("/");break}var R=g.slice(v),N;k===null?N=".":((o(k)||o(g.map(function(B){return typeof B=="string"?B:"[*]"}).join("/")))&&(!k||!o(k))&&(k="/"+k),N=k);var z=this._makeAbs(N);if(!d(this,N)){var w=R[0]===t.GLOBSTAR;w?this._processGlobStar(k,N,z,R,C,y):this._processReaddir(k,N,z,R,C,y)}},E.prototype._processReaddir=function(g,C,y,v,k,R){var N=this._readdir(y,R);if(!!N){for(var z=v[0],w=!!this.minimatch.negate,B=z._glob,x=this.dot||B.charAt(0)===".",P=[],_=0;_<N.length;_++){var T=N[_];if(T.charAt(0)!=="."||x){var H;w&&!g?H=!T.match(z):H=T.match(z),H&&P.push(T)}}var G=P.length;if(G!==0){if(v.length===1&&!this.mark&&!this.stat){this.matches[k]||(this.matches[k]=Object.create(null));for(var _=0;_<G;_++){var T=P[_];g&&(g.slice(-1)!=="/"?T=g+"/"+T:T=g+T),T.charAt(0)==="/"&&!this.nomount&&(T=u.join(this.root,T)),this._emitMatch(k,T)}return}v.shift();for(var _=0;_<G;_++){var T=P[_],X;g?X=[g,T]:X=[T],this._process(X.concat(v),k,R)}}}},E.prototype._emitMatch=function(g,C){if(!h(this,C)){var y=this._makeAbs(C);if(this.mark&&(C=this._mark(C)),this.absolute&&(C=y),!this.matches[g][C]){if(this.nodir){var v=this.cache[y];if(v==="DIR"||Array.isArray(v))return}this.matches[g][C]=!0,this.stat&&this._stat(C)}}},E.prototype._readdirInGlobStar=function(g){if(this.follow)return this._readdir(g,!1);var C,y;try{y=this.fs.lstatSync(g)}catch(k){if(k.code==="ENOENT")return null}var v=y&&y.isSymbolicLink();return this.symlinks[g]=v,!v&&y&&!y.isDirectory()?this.cache[g]="FILE":C=this._readdir(g,!1),C},E.prototype._readdir=function(g,C){if(C&&!c(this.symlinks,g))return this._readdirInGlobStar(g);if(c(this.cache,g)){var y=this.cache[g];if(!y||y==="FILE")return null;if(Array.isArray(y))return y}try{return this._readdirEntries(g,this.fs.readdirSync(g))}catch(v){return this._readdirError(g,v),null}},E.prototype._readdirEntries=function(g,C){if(!this.mark&&!this.stat)for(var y=0;y<C.length;y++){var v=C[y];g==="/"?v=g+v:v=g+"/"+v,this.cache[v]=!0}return this.cache[g]=C,C},E.prototype._readdirError=function(g,C){switch(C.code){case"ENOTSUP":case"ENOTDIR":var y=this._makeAbs(g);if(this.cache[y]="FILE",y===this.cwdAbs){var v=new Error(C.code+" invalid cwd "+this.cwd);throw v.path=this.cwd,v.code=C.code,v}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(g)]=!1;break;default:if(this.cache[this._makeAbs(g)]=!1,this.strict)throw C;this.silent||console.error("glob error",C);break}},E.prototype._processGlobStar=function(g,C,y,v,k,R){var N=this._readdir(y,R);if(!!N){var z=v.slice(1),w=g?[g]:[],B=w.concat(z);this._process(B,k,!1);var x=N.length,P=this.symlinks[y];if(!(P&&R))for(var _=0;_<x;_++){var T=N[_];if(!(T.charAt(0)==="."&&!this.dot)){var H=w.concat(N[_],z);this._process(H,k,!0);var G=w.concat(N[_],v);this._process(G,k,!0)}}}},E.prototype._processSimple=function(g,C){var y=this._stat(g);if(this.matches[C]||(this.matches[C]=Object.create(null)),!!y){if(g&&o(g)&&!this.nomount){var v=/[\/\\]$/.test(g);g.charAt(0)==="/"?g=u.join(this.root,g):(g=u.resolve(this.root,g),v&&(g+="/"))}process.platform==="win32"&&(g=g.replace(/\\/g,"/")),this._emitMatch(C,g)}},E.prototype._stat=function(g){var C=this._makeAbs(g),y=g.slice(-1)==="/";if(g.length>this.maxLength)return!1;if(!this.stat&&c(this.cache,C)){var R=this.cache[C];if(Array.isArray(R)&&(R="DIR"),!y||R==="DIR")return R;if(y&&R==="FILE")return!1}var v=this.statCache[C];if(!v){var k;try{k=this.fs.lstatSync(C)}catch(N){if(N&&(N.code==="ENOENT"||N.code==="ENOTDIR"))return this.statCache[C]=!1,!1}if(k&&k.isSymbolicLink())try{v=this.fs.statSync(C)}catch{v=k}else v=k}this.statCache[C]=v;var R=!0;return v&&(R=v.isDirectory()?"DIR":"FILE"),this.cache[C]=this.cache[C]||R,y&&R==="FILE"?!1:R},E.prototype._mark=function(g){return s.mark(this,g)},E.prototype._makeAbs=function(g){return s.makeAbs(this,g)},gs}var _d=Od;function Od(e,t){if(e&&t)return Od(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(i){u[i]=e[i]}),u;function u(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];var s=e.apply(this,i),l=i[i.length-1];return typeof s=="function"&&s!==l&&Object.keys(l).forEach(function(c){s[c]=l[c]}),s}}var wi={exports:{}},Id=_d;wi.exports=Id(Si),wi.exports.strict=Id(Rd),Si.proto=Si(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Si(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Rd(this)},configurable:!0})});function Si(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function Rd(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},u=e.name||"Function wrapped with `once`";return t.onceError=u+" shouldn't be called more than once",t.called=!1,t}var YC=_d,Ur=Object.create(null),XC=wi.exports,ZC=YC(eb);function eb(e,t){return Ur[e]?(Ur[e].push(t),null):(Ur[e]=[t],tb(e))}function tb(e){return XC(function t(){var u=Ur[e],i=u.length,o=nb(arguments);try{for(var s=0;s<i;s++)u[s].apply(null,o)}finally{u.length>i?(u.splice(0,i),process.nextTick(function(){t.apply(null,o)})):delete Ur[e]}})}function nb(e){for(var t=e.length,u=[],i=0;i<t;i++)u[i]=e[i];return u}var ms,Pd;function Nd(){if(Pd)return ms;Pd=1,ms=v;var e=Ed,t=Mr;t.Minimatch;var u=Fd.exports,i=wr.default.EventEmitter,o=Oe.default,s=Lu.default,l=Vn.exports,c=KC(),d=Pt,h=d.setopts,m=d.ownProp,E=ZC,g=d.childrenIgnored,C=d.isIgnored,y=wi.exports;function v(w,B,x){if(typeof B=="function"&&(x=B,B={}),B||(B={}),B.sync){if(x)throw new TypeError("callback provided to sync glob");return c(w,B)}return new N(w,B,x)}v.sync=c;var k=v.GlobSync=c.GlobSync;v.glob=v;function R(w,B){if(B===null||typeof B!="object")return w;for(var x=Object.keys(B),P=x.length;P--;)w[x[P]]=B[x[P]];return w}v.hasMagic=function(w,B){var x=R({},B);x.noprocess=!0;var P=new N(w,x),_=P.minimatch.set;if(!w)return!1;if(_.length>1)return!0;for(var T=0;T<_[0].length;T++)if(typeof _[0][T]!="string")return!0;return!1},v.Glob=N,u(N,i);function N(w,B,x){if(typeof B=="function"&&(x=B,B=null),B&&B.sync){if(x)throw new TypeError("callback provided to sync glob");return new k(w,B)}if(!(this instanceof N))return new N(w,B,x);h(this,w,B),this._didRealPath=!1;var P=this.minimatch.set.length;this.matches=new Array(P),typeof x=="function"&&(x=y(x),this.on("error",x),this.on("end",function(X){x(null,X)}));var _=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(P===0)return G();for(var T=!0,H=0;H<P;H++)this._process(this.minimatch.set[H],H,!1,G);T=!1;function G(){--_._processing,_._processing<=0&&(T?process.nextTick(function(){_._finish()}):_._finish())}}N.prototype._finish=function(){if(s(this instanceof N),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();d.finish(this),this.emit("end",this.found)}},N.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var w=this.matches.length;if(w===0)return this._finish();for(var B=this,x=0;x<this.matches.length;x++)this._realpathSet(x,P);function P(){--w===0&&B._finish()}},N.prototype._realpathSet=function(w,B){var x=this.matches[w];if(!x)return B();var P=Object.keys(x),_=this,T=P.length;if(T===0)return B();var H=this.matches[w]=Object.create(null);P.forEach(function(G,X){G=_._makeAbs(G),e.realpath(G,_.realpathCache,function(ee,we){ee?ee.syscall==="stat"?H[G]=!0:_.emit("error",ee):H[we]=!0,--T===0&&(_.matches[w]=H,B())})})},N.prototype._mark=function(w){return d.mark(this,w)},N.prototype._makeAbs=function(w){return d.makeAbs(this,w)},N.prototype.abort=function(){this.aborted=!0,this.emit("abort")},N.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))},N.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var w=this._emitQueue.slice(0);this._emitQueue.length=0;for(var B=0;B<w.length;B++){var x=w[B];this._emitMatch(x[0],x[1])}}if(this._processQueue.length){var P=this._processQueue.slice(0);this._processQueue.length=0;for(var B=0;B<P.length;B++){var _=P[B];this._processing--,this._process(_[0],_[1],_[2],_[3])}}}},N.prototype._process=function(w,B,x,P){if(s(this instanceof N),s(typeof P=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([w,B,x,P]);return}for(var _=0;typeof w[_]=="string";)_++;var T;switch(_){case w.length:this._processSimple(w.join("/"),B,P);return;case 0:T=null;break;default:T=w.slice(0,_).join("/");break}var H=w.slice(_),G;T===null?G=".":((l(T)||l(w.map(function(we){return typeof we=="string"?we:"[*]"}).join("/")))&&(!T||!l(T))&&(T="/"+T),G=T);var X=this._makeAbs(G);if(g(this,G))return P();var ee=H[0]===t.GLOBSTAR;ee?this._processGlobStar(T,G,X,H,B,x,P):this._processReaddir(T,G,X,H,B,x,P)}},N.prototype._processReaddir=function(w,B,x,P,_,T,H){var G=this;this._readdir(x,T,function(X,ee){return G._processReaddir2(w,B,x,P,_,T,ee,H)})},N.prototype._processReaddir2=function(w,B,x,P,_,T,H,G){if(!H)return G();for(var X=P[0],ee=!!this.minimatch.negate,we=X._glob,Fe=this.dot||we.charAt(0)===".",Ae=[],oe=0;oe<H.length;oe++){var ie=H[oe];if(ie.charAt(0)!=="."||Fe){var it;ee&&!w?it=!ie.match(X):it=ie.match(X),it&&Ae.push(ie)}}var Ft=Ae.length;if(Ft===0)return G();if(P.length===1&&!this.mark&&!this.stat){this.matches[_]||(this.matches[_]=Object.create(null));for(var oe=0;oe<Ft;oe++){var ie=Ae[oe];w&&(w!=="/"?ie=w+"/"+ie:ie=w+ie),ie.charAt(0)==="/"&&!this.nomount&&(ie=o.join(this.root,ie)),this._emitMatch(_,ie)}return G()}P.shift();for(var oe=0;oe<Ft;oe++){var ie=Ae[oe];w&&(w!=="/"?ie=w+"/"+ie:ie=w+ie),this._process([ie].concat(P),_,T,G)}G()},N.prototype._emitMatch=function(w,B){if(!this.aborted&&!C(this,B)){if(this.paused){this._emitQueue.push([w,B]);return}var x=l(B)?B:this._makeAbs(B);if(this.mark&&(B=this._mark(B)),this.absolute&&(B=x),!this.matches[w][B]){if(this.nodir){var P=this.cache[x];if(P==="DIR"||Array.isArray(P))return}this.matches[w][B]=!0;var _=this.statCache[x];_&&this.emit("stat",B,_),this.emit("match",B)}}},N.prototype._readdirInGlobStar=function(w,B){if(this.aborted)return;if(this.follow)return this._readdir(w,!1,B);var x="lstat\0"+w,P=this,_=E(x,T);_&&P.fs.lstat(w,_);function T(H,G){if(H&&H.code==="ENOENT")return B();var X=G&&G.isSymbolicLink();P.symlinks[w]=X,!X&&G&&!G.isDirectory()?(P.cache[w]="FILE",B()):P._readdir(w,!1,B)}},N.prototype._readdir=function(w,B,x){if(!this.aborted&&(x=E("readdir\0"+w+"\0"+B,x),!!x)){if(B&&!m(this.symlinks,w))return this._readdirInGlobStar(w,x);if(m(this.cache,w)){var P=this.cache[w];if(!P||P==="FILE")return x();if(Array.isArray(P))return x(null,P)}var _=this;_.fs.readdir(w,z(this,w,x))}};function z(w,B,x){return function(P,_){P?w._readdirError(B,P,x):w._readdirEntries(B,_,x)}}return N.prototype._readdirEntries=function(w,B,x){if(!this.aborted){if(!this.mark&&!this.stat)for(var P=0;P<B.length;P++){var _=B[P];w==="/"?_=w+_:_=w+"/"+_,this.cache[_]=!0}return this.cache[w]=B,x(null,B)}},N.prototype._readdirError=function(w,B,x){if(!this.aborted){switch(B.code){case"ENOTSUP":case"ENOTDIR":var P=this._makeAbs(w);if(this.cache[P]="FILE",P===this.cwdAbs){var _=new Error(B.code+" invalid cwd "+this.cwd);_.path=this.cwd,_.code=B.code,this.emit("error",_),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(w)]=!1;break;default:this.cache[this._makeAbs(w)]=!1,this.strict&&(this.emit("error",B),this.abort()),this.silent||console.error("glob error",B);break}return x()}},N.prototype._processGlobStar=function(w,B,x,P,_,T,H){var G=this;this._readdir(x,T,function(X,ee){G._processGlobStar2(w,B,x,P,_,T,ee,H)})},N.prototype._processGlobStar2=function(w,B,x,P,_,T,H,G){if(!H)return G();var X=P.slice(1),ee=w?[w]:[],we=ee.concat(X);this._process(we,_,!1,G);var Fe=this.symlinks[x],Ae=H.length;if(Fe&&T)return G();for(var oe=0;oe<Ae;oe++){var ie=H[oe];if(!(ie.charAt(0)==="."&&!this.dot)){var it=ee.concat(H[oe],X);this._process(it,_,!0,G);var Ft=ee.concat(H[oe],P);this._process(Ft,_,!0,G)}}G()},N.prototype._processSimple=function(w,B,x){var P=this;this._stat(w,function(_,T){P._processSimple2(w,B,_,T,x)})},N.prototype._processSimple2=function(w,B,x,P,_){if(this.matches[B]||(this.matches[B]=Object.create(null)),!P)return _();if(w&&l(w)&&!this.nomount){var T=/[\/\\]$/.test(w);w.charAt(0)==="/"?w=o.join(this.root,w):(w=o.resolve(this.root,w),T&&(w+="/"))}process.platform==="win32"&&(w=w.replace(/\\/g,"/")),this._emitMatch(B,w),_()},N.prototype._stat=function(w,B){var x=this._makeAbs(w),P=w.slice(-1)==="/";if(w.length>this.maxLength)return B();if(!this.stat&&m(this.cache,x)){var _=this.cache[x];if(Array.isArray(_)&&(_="DIR"),!P||_==="DIR")return B(null,_);if(P&&_==="FILE")return B()}var T=this.statCache[x];if(T!==void 0){if(T===!1)return B(null,T);var H=T.isDirectory()?"DIR":"FILE";return P&&H==="FILE"?B():B(null,H,T)}var G=this,X=E("stat\0"+x,ee);X&&G.fs.lstat(x,X);function ee(we,Fe){if(Fe&&Fe.isSymbolicLink())return G.fs.stat(x,function(Ae,oe){Ae?G._stat2(w,x,null,Fe,B):G._stat2(w,x,Ae,oe,B)});G._stat2(w,x,we,Fe,B)}},N.prototype._stat2=function(w,B,x,P,_){if(x&&(x.code==="ENOENT"||x.code==="ENOTDIR"))return this.statCache[B]=!1,_();var T=w.slice(-1)==="/";if(this.statCache[B]=P,B.slice(-1)==="/"&&P&&!P.isDirectory())return _(null,!1,P);var H=!0;return P&&(H=P.isDirectory()?"DIR":"FILE"),this.cache[B]=this.cache[B]||H,T&&H==="FILE"?_():_(null,H,P)},ms}const rb=cC,ub=rb.BundleWalker,ib=IC,ab=ib.Walker,Td=Symbol("root-builtin-rules"),$d=Symbol("package-necessary-rules"),Le=Oe.default,ob=rd,Ld="readme|copying|license|licence",sb=`@(${Ld}){,.*[^~$]}`,lb=new RegExp(`^(${Ld})(\\..*[^~$])?$`,"i"),jd=rt.default,cb=Nd(),Gr=e=>e.split("\\").join("/"),Md=(e,t,u="")=>{for(const l of[".npmignore",".gitignore"])try{u+=jd.readFileSync(Le.join(e,l),{encoding:"utf8"})+`
101
+ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof E))return new E(g,C);if(l(this,g,C),this.noprocess)return this;var y=this.minimatch.set.length;this.matches=new Array(y);for(var v=0;v<y;v++)this._process(this.minimatch.set[v],v,!1);this._finish()}return E.prototype._finish=function(){if(i(this instanceof E),this.realpath){var g=this;this.matches.forEach(function(C,y){var v=g.matches[y]=Object.create(null);for(var k in C)try{k=g._makeAbs(k);var R=e.realpathSync(k,g.realpathCache);v[R]=!0}catch(N){if(N.syscall==="stat")v[g._makeAbs(k)]=!0;else throw N}})}s.finish(this)},E.prototype._process=function(g,C,y){i(this instanceof E);for(var v=0;typeof g[v]=="string";)v++;var k;switch(v){case g.length:this._processSimple(g.join("/"),C);return;case 0:k=null;break;default:k=g.slice(0,v).join("/");break}var R=g.slice(v),N;k===null?N=".":((o(k)||o(g.map(function(B){return typeof B=="string"?B:"[*]"}).join("/")))&&(!k||!o(k))&&(k="/"+k),N=k);var z=this._makeAbs(N);if(!d(this,N)){var w=R[0]===t.GLOBSTAR;w?this._processGlobStar(k,N,z,R,C,y):this._processReaddir(k,N,z,R,C,y)}},E.prototype._processReaddir=function(g,C,y,v,k,R){var N=this._readdir(y,R);if(!!N){for(var z=v[0],w=!!this.minimatch.negate,B=z._glob,x=this.dot||B.charAt(0)===".",P=[],_=0;_<N.length;_++){var T=N[_];if(T.charAt(0)!=="."||x){var H;w&&!g?H=!T.match(z):H=T.match(z),H&&P.push(T)}}var G=P.length;if(G!==0){if(v.length===1&&!this.mark&&!this.stat){this.matches[k]||(this.matches[k]=Object.create(null));for(var _=0;_<G;_++){var T=P[_];g&&(g.slice(-1)!=="/"?T=g+"/"+T:T=g+T),T.charAt(0)==="/"&&!this.nomount&&(T=u.join(this.root,T)),this._emitMatch(k,T)}return}v.shift();for(var _=0;_<G;_++){var T=P[_],X;g?X=[g,T]:X=[T],this._process(X.concat(v),k,R)}}}},E.prototype._emitMatch=function(g,C){if(!h(this,C)){var y=this._makeAbs(C);if(this.mark&&(C=this._mark(C)),this.absolute&&(C=y),!this.matches[g][C]){if(this.nodir){var v=this.cache[y];if(v==="DIR"||Array.isArray(v))return}this.matches[g][C]=!0,this.stat&&this._stat(C)}}},E.prototype._readdirInGlobStar=function(g){if(this.follow)return this._readdir(g,!1);var C,y;try{y=this.fs.lstatSync(g)}catch(k){if(k.code==="ENOENT")return null}var v=y&&y.isSymbolicLink();return this.symlinks[g]=v,!v&&y&&!y.isDirectory()?this.cache[g]="FILE":C=this._readdir(g,!1),C},E.prototype._readdir=function(g,C){if(C&&!c(this.symlinks,g))return this._readdirInGlobStar(g);if(c(this.cache,g)){var y=this.cache[g];if(!y||y==="FILE")return null;if(Array.isArray(y))return y}try{return this._readdirEntries(g,this.fs.readdirSync(g))}catch(v){return this._readdirError(g,v),null}},E.prototype._readdirEntries=function(g,C){if(!this.mark&&!this.stat)for(var y=0;y<C.length;y++){var v=C[y];g==="/"?v=g+v:v=g+"/"+v,this.cache[v]=!0}return this.cache[g]=C,C},E.prototype._readdirError=function(g,C){switch(C.code){case"ENOTSUP":case"ENOTDIR":var y=this._makeAbs(g);if(this.cache[y]="FILE",y===this.cwdAbs){var v=new Error(C.code+" invalid cwd "+this.cwd);throw v.path=this.cwd,v.code=C.code,v}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(g)]=!1;break;default:if(this.cache[this._makeAbs(g)]=!1,this.strict)throw C;this.silent||console.error("glob error",C);break}},E.prototype._processGlobStar=function(g,C,y,v,k,R){var N=this._readdir(y,R);if(!!N){var z=v.slice(1),w=g?[g]:[],B=w.concat(z);this._process(B,k,!1);var x=N.length,P=this.symlinks[y];if(!(P&&R))for(var _=0;_<x;_++){var T=N[_];if(!(T.charAt(0)==="."&&!this.dot)){var H=w.concat(N[_],z);this._process(H,k,!0);var G=w.concat(N[_],v);this._process(G,k,!0)}}}},E.prototype._processSimple=function(g,C){var y=this._stat(g);if(this.matches[C]||(this.matches[C]=Object.create(null)),!!y){if(g&&o(g)&&!this.nomount){var v=/[\/\\]$/.test(g);g.charAt(0)==="/"?g=u.join(this.root,g):(g=u.resolve(this.root,g),v&&(g+="/"))}process.platform==="win32"&&(g=g.replace(/\\/g,"/")),this._emitMatch(C,g)}},E.prototype._stat=function(g){var C=this._makeAbs(g),y=g.slice(-1)==="/";if(g.length>this.maxLength)return!1;if(!this.stat&&c(this.cache,C)){var R=this.cache[C];if(Array.isArray(R)&&(R="DIR"),!y||R==="DIR")return R;if(y&&R==="FILE")return!1}var v=this.statCache[C];if(!v){var k;try{k=this.fs.lstatSync(C)}catch(N){if(N&&(N.code==="ENOENT"||N.code==="ENOTDIR"))return this.statCache[C]=!1,!1}if(k&&k.isSymbolicLink())try{v=this.fs.statSync(C)}catch{v=k}else v=k}this.statCache[C]=v;var R=!0;return v&&(R=v.isDirectory()?"DIR":"FILE"),this.cache[C]=this.cache[C]||R,y&&R==="FILE"?!1:R},E.prototype._mark=function(g){return s.mark(this,g)},E.prototype._makeAbs=function(g){return s.makeAbs(this,g)},gs}var _d=Od;function Od(e,t){if(e&&t)return Od(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(i){u[i]=e[i]}),u;function u(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];var s=e.apply(this,i),l=i[i.length-1];return typeof s=="function"&&s!==l&&Object.keys(l).forEach(function(c){s[c]=l[c]}),s}}var wi={exports:{}},Id=_d;wi.exports=Id(Si),wi.exports.strict=Id(Rd),Si.proto=Si(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Si(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Rd(this)},configurable:!0})});function Si(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function Rd(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},u=e.name||"Function wrapped with `once`";return t.onceError=u+" shouldn't be called more than once",t.called=!1,t}var YC=_d,Ur=Object.create(null),XC=wi.exports,ZC=YC(eb);function eb(e,t){return Ur[e]?(Ur[e].push(t),null):(Ur[e]=[t],tb(e))}function tb(e){return XC(function t(){var u=Ur[e],i=u.length,o=nb(arguments);try{for(var s=0;s<i;s++)u[s].apply(null,o)}finally{u.length>i?(u.splice(0,i),process.nextTick(function(){t.apply(null,o)})):delete Ur[e]}})}function nb(e){for(var t=e.length,u=[],i=0;i<t;i++)u[i]=e[i];return u}var ms,Pd;function Nd(){if(Pd)return ms;Pd=1,ms=v;var e=Ed,t=Mr;t.Minimatch;var u=Fd.exports,i=wr.default.EventEmitter,o=Oe.default,s=Lu.default,l=Vn.exports,c=KC(),d=Pt,h=d.setopts,m=d.ownProp,E=ZC,g=d.childrenIgnored,C=d.isIgnored,y=wi.exports;function v(w,B,x){if(typeof B=="function"&&(x=B,B={}),B||(B={}),B.sync){if(x)throw new TypeError("callback provided to sync glob");return c(w,B)}return new N(w,B,x)}v.sync=c;var k=v.GlobSync=c.GlobSync;v.glob=v;function R(w,B){if(B===null||typeof B!="object")return w;for(var x=Object.keys(B),P=x.length;P--;)w[x[P]]=B[x[P]];return w}v.hasMagic=function(w,B){var x=R({},B);x.noprocess=!0;var P=new N(w,x),_=P.minimatch.set;if(!w)return!1;if(_.length>1)return!0;for(var T=0;T<_[0].length;T++)if(typeof _[0][T]!="string")return!0;return!1},v.Glob=N,u(N,i);function N(w,B,x){if(typeof B=="function"&&(x=B,B=null),B&&B.sync){if(x)throw new TypeError("callback provided to sync glob");return new k(w,B)}if(!(this instanceof N))return new N(w,B,x);h(this,w,B),this._didRealPath=!1;var P=this.minimatch.set.length;this.matches=new Array(P),typeof x=="function"&&(x=y(x),this.on("error",x),this.on("end",function(X){x(null,X)}));var _=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(P===0)return G();for(var T=!0,H=0;H<P;H++)this._process(this.minimatch.set[H],H,!1,G);T=!1;function G(){--_._processing,_._processing<=0&&(T?process.nextTick(function(){_._finish()}):_._finish())}}N.prototype._finish=function(){if(s(this instanceof N),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();d.finish(this),this.emit("end",this.found)}},N.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var w=this.matches.length;if(w===0)return this._finish();for(var B=this,x=0;x<this.matches.length;x++)this._realpathSet(x,P);function P(){--w===0&&B._finish()}},N.prototype._realpathSet=function(w,B){var x=this.matches[w];if(!x)return B();var P=Object.keys(x),_=this,T=P.length;if(T===0)return B();var H=this.matches[w]=Object.create(null);P.forEach(function(G,X){G=_._makeAbs(G),e.realpath(G,_.realpathCache,function(ee,we){ee?ee.syscall==="stat"?H[G]=!0:_.emit("error",ee):H[we]=!0,--T===0&&(_.matches[w]=H,B())})})},N.prototype._mark=function(w){return d.mark(this,w)},N.prototype._makeAbs=function(w){return d.makeAbs(this,w)},N.prototype.abort=function(){this.aborted=!0,this.emit("abort")},N.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))},N.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var w=this._emitQueue.slice(0);this._emitQueue.length=0;for(var B=0;B<w.length;B++){var x=w[B];this._emitMatch(x[0],x[1])}}if(this._processQueue.length){var P=this._processQueue.slice(0);this._processQueue.length=0;for(var B=0;B<P.length;B++){var _=P[B];this._processing--,this._process(_[0],_[1],_[2],_[3])}}}},N.prototype._process=function(w,B,x,P){if(s(this instanceof N),s(typeof P=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([w,B,x,P]);return}for(var _=0;typeof w[_]=="string";)_++;var T;switch(_){case w.length:this._processSimple(w.join("/"),B,P);return;case 0:T=null;break;default:T=w.slice(0,_).join("/");break}var H=w.slice(_),G;T===null?G=".":((l(T)||l(w.map(function(we){return typeof we=="string"?we:"[*]"}).join("/")))&&(!T||!l(T))&&(T="/"+T),G=T);var X=this._makeAbs(G);if(g(this,G))return P();var ee=H[0]===t.GLOBSTAR;ee?this._processGlobStar(T,G,X,H,B,x,P):this._processReaddir(T,G,X,H,B,x,P)}},N.prototype._processReaddir=function(w,B,x,P,_,T,H){var G=this;this._readdir(x,T,function(X,ee){return G._processReaddir2(w,B,x,P,_,T,ee,H)})},N.prototype._processReaddir2=function(w,B,x,P,_,T,H,G){if(!H)return G();for(var X=P[0],ee=!!this.minimatch.negate,we=X._glob,Fe=this.dot||we.charAt(0)===".",Ae=[],oe=0;oe<H.length;oe++){var ie=H[oe];if(ie.charAt(0)!=="."||Fe){var it;ee&&!w?it=!ie.match(X):it=ie.match(X),it&&Ae.push(ie)}}var Ft=Ae.length;if(Ft===0)return G();if(P.length===1&&!this.mark&&!this.stat){this.matches[_]||(this.matches[_]=Object.create(null));for(var oe=0;oe<Ft;oe++){var ie=Ae[oe];w&&(w!=="/"?ie=w+"/"+ie:ie=w+ie),ie.charAt(0)==="/"&&!this.nomount&&(ie=o.join(this.root,ie)),this._emitMatch(_,ie)}return G()}P.shift();for(var oe=0;oe<Ft;oe++){var ie=Ae[oe];w&&(w!=="/"?ie=w+"/"+ie:ie=w+ie),this._process([ie].concat(P),_,T,G)}G()},N.prototype._emitMatch=function(w,B){if(!this.aborted&&!C(this,B)){if(this.paused){this._emitQueue.push([w,B]);return}var x=l(B)?B:this._makeAbs(B);if(this.mark&&(B=this._mark(B)),this.absolute&&(B=x),!this.matches[w][B]){if(this.nodir){var P=this.cache[x];if(P==="DIR"||Array.isArray(P))return}this.matches[w][B]=!0;var _=this.statCache[x];_&&this.emit("stat",B,_),this.emit("match",B)}}},N.prototype._readdirInGlobStar=function(w,B){if(this.aborted)return;if(this.follow)return this._readdir(w,!1,B);var x="lstat\0"+w,P=this,_=E(x,T);_&&P.fs.lstat(w,_);function T(H,G){if(H&&H.code==="ENOENT")return B();var X=G&&G.isSymbolicLink();P.symlinks[w]=X,!X&&G&&!G.isDirectory()?(P.cache[w]="FILE",B()):P._readdir(w,!1,B)}},N.prototype._readdir=function(w,B,x){if(!this.aborted&&(x=E("readdir\0"+w+"\0"+B,x),!!x)){if(B&&!m(this.symlinks,w))return this._readdirInGlobStar(w,x);if(m(this.cache,w)){var P=this.cache[w];if(!P||P==="FILE")return x();if(Array.isArray(P))return x(null,P)}var _=this;_.fs.readdir(w,z(this,w,x))}};function z(w,B,x){return function(P,_){P?w._readdirError(B,P,x):w._readdirEntries(B,_,x)}}return N.prototype._readdirEntries=function(w,B,x){if(!this.aborted){if(!this.mark&&!this.stat)for(var P=0;P<B.length;P++){var _=B[P];w==="/"?_=w+_:_=w+"/"+_,this.cache[_]=!0}return this.cache[w]=B,x(null,B)}},N.prototype._readdirError=function(w,B,x){if(!this.aborted){switch(B.code){case"ENOTSUP":case"ENOTDIR":var P=this._makeAbs(w);if(this.cache[P]="FILE",P===this.cwdAbs){var _=new Error(B.code+" invalid cwd "+this.cwd);_.path=this.cwd,_.code=B.code,this.emit("error",_),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(w)]=!1;break;default:this.cache[this._makeAbs(w)]=!1,this.strict&&(this.emit("error",B),this.abort()),this.silent||console.error("glob error",B);break}return x()}},N.prototype._processGlobStar=function(w,B,x,P,_,T,H){var G=this;this._readdir(x,T,function(X,ee){G._processGlobStar2(w,B,x,P,_,T,ee,H)})},N.prototype._processGlobStar2=function(w,B,x,P,_,T,H,G){if(!H)return G();var X=P.slice(1),ee=w?[w]:[],we=ee.concat(X);this._process(we,_,!1,G);var Fe=this.symlinks[x],Ae=H.length;if(Fe&&T)return G();for(var oe=0;oe<Ae;oe++){var ie=H[oe];if(!(ie.charAt(0)==="."&&!this.dot)){var it=ee.concat(H[oe],X);this._process(it,_,!0,G);var Ft=ee.concat(H[oe],P);this._process(Ft,_,!0,G)}}G()},N.prototype._processSimple=function(w,B,x){var P=this;this._stat(w,function(_,T){P._processSimple2(w,B,_,T,x)})},N.prototype._processSimple2=function(w,B,x,P,_){if(this.matches[B]||(this.matches[B]=Object.create(null)),!P)return _();if(w&&l(w)&&!this.nomount){var T=/[\/\\]$/.test(w);w.charAt(0)==="/"?w=o.join(this.root,w):(w=o.resolve(this.root,w),T&&(w+="/"))}process.platform==="win32"&&(w=w.replace(/\\/g,"/")),this._emitMatch(B,w),_()},N.prototype._stat=function(w,B){var x=this._makeAbs(w),P=w.slice(-1)==="/";if(w.length>this.maxLength)return B();if(!this.stat&&m(this.cache,x)){var _=this.cache[x];if(Array.isArray(_)&&(_="DIR"),!P||_==="DIR")return B(null,_);if(P&&_==="FILE")return B()}var T=this.statCache[x];if(T!==void 0){if(T===!1)return B(null,T);var H=T.isDirectory()?"DIR":"FILE";return P&&H==="FILE"?B():B(null,H,T)}var G=this,X=E("stat\0"+x,ee);X&&G.fs.lstat(x,X);function ee(we,Fe){if(Fe&&Fe.isSymbolicLink())return G.fs.stat(x,function(Ae,oe){Ae?G._stat2(w,x,null,Fe,B):G._stat2(w,x,Ae,oe,B)});G._stat2(w,x,we,Fe,B)}},N.prototype._stat2=function(w,B,x,P,_){if(x&&(x.code==="ENOENT"||x.code==="ENOTDIR"))return this.statCache[B]=!1,_();var T=w.slice(-1)==="/";if(this.statCache[B]=P,B.slice(-1)==="/"&&P&&!P.isDirectory())return _(null,!1,P);var H=!0;return P&&(H=P.isDirectory()?"DIR":"FILE"),this.cache[B]=this.cache[B]||H,T&&H==="FILE"?_():_(null,H,P)},ms}const rb=cC,ub=rb.BundleWalker,ib=IC,ab=ib.Walker,Td=Symbol("root-builtin-rules"),$d=Symbol("package-necessary-rules"),Le=Oe.default,ob=rd,Ld="readme|copying|license|licence",sb=`@(${Ld}){,.*[^~$]}`,lb=new RegExp(`^(${Ld})(\\..*[^~$])?$`,"i"),jd=rt.default,cb=Nd(),Gr=e=>e.split("\\").join("/"),Md=(e,t,u="")=>{for(const l of[".npmignore",".gitignore"])try{const c=jd.readFileSync(Le.join(e,l),{encoding:"utf8"});u+=c+`
102
102
  `;break}catch(c){if(c.code!=="ENOENT")throw c}if(!t)return u;const i=t.split(Le.sep)[0],o=Le.join(e,i),s=Le.relative(o,Le.join(e,t));return Md(o,s,u)},Db=e=>{if(!e.startsWith("node_modules/"))return!1;const t=e.slice(13).split("/",2);return t[0].startsWith("@")?t.length===2:!0},fb=e=>{const t=e.slice(13).split("/",2);return t[0].startsWith("@")?t.join("/"):t[0]},db=[".npmignore",".gitignore","**/.git","**/.svn","**/.hg","**/CVS","**/.git/**","**/.svn/**","**/.hg/**","**/CVS/**","/.lock-wscript","/.wafpickle-*","/build/config.gypi","npm-debug.log","**/.npmrc",".*.swp",".DS_Store","**/.DS_Store/**","._*","**/._*/**","*.orig","/package-lock.json","/yarn.lock","/pnpm-lock.yaml","/archived-packages/**"],hb=e=>/\*/.test(e);class xi extends ab{constructor(t){t=t||{},t.ignoreFiles=[Td,"package.json",".npmignore",".gitignore",$d],t.includeEmpty=!1,t.path=t.path||process.cwd();const u=/^(?:\/node_modules\/(?:@[^/]+\/[^/]+|[^/]+)\/)*\/node_modules(?:\/@[^/]+)?$/,i=t.parent?t.parent.root:t.path,o=t.path.replace(/\\/g,"/").slice(i.length);if(t.follow=u.test(o),super(t),this.isProject){this.bundled=t.bundled||[],this.bundledScopes=Array.from(new Set(this.bundled.filter(l=>/^@/.test(l)).map(l=>l.split("/")[0]))),this.packageJsonCache=this.parent?this.parent.packageJsonCache:t.packageJsonCache||new Map;let s=db.join(`
103
103
  `)+`
104
104
  `;if(t.prefix&&t.workspaces){const l=Gr(t.path),c=Gr(t.prefix),d=t.workspaces.map(h=>Gr(h));if(l!==c&&d.includes(l)){const h=Le.relative(t.prefix,Le.dirname(t.path));s+=Md(t.prefix,h)}else l===c&&(s+=t.workspaces.map(h=>Gr(Le.relative(t.path,h))).join(`
@@ -106,4 +106,4 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof E))re
106
106
  `)+`
107
107
  `,i);else{const s=this.mustHaveFilesFromPackage(u).map(l=>`!${l}`).join(`
108
108
  `)+`
109
- `;super.onReadIgnoreFile($d,s,i)}}stat({entry:t,file:u,dir:i},o){hb(t)?o():super.stat({entry:t,file:u,dir:i},o)}onstat({st:t,entry:u,file:i,dir:o,isSymbolicLink:s},l){t.isSymbolicLink()?l():super.onstat({st:t,entry:u,file:i,dir:o,isSymbolicLink:s},l)}onReadIgnoreFile(t,u,i){if(t==="package.json")try{const o=Le.resolve(this.path,t);this.onPackageJson(o,JSON.parse(u),i)}catch{i()}else super.onReadIgnoreFile(t,u,i)}sort(t,u){const i=Le.extname(t).toLowerCase(),o=Le.extname(u).toLowerCase(),s=Le.basename(t).toLowerCase(),l=Le.basename(u).toLowerCase();return i.localeCompare(o,"en")||s.localeCompare(l,"en")||t.localeCompare(u,"en")}globFiles(t,u){cb(Gr(t),{dot:!0,cwd:this.path,nocase:!0},u)}readPackageJson(t){jd.readFile(this.path+"/package.json",(u,i)=>this.onReadPackageJson(t,u,i))}walker(t,u,i){new xi(this.walkerOpt(t,u)).on("done",i).start()}}const zd=(e,t)=>{e=e||{};const u=new Promise((i,o)=>{const s=new ub(e);s.on("done",l=>{e.bundled=l,e.packageJsonCache=s.packageJsonCache,new xi(e).on("done",i).on("error",o).start()}),s.start()});return t?u.then(i=>t(null,i),t):u};var pb=zd;zd.Walker=xi;var gb="git-publish",mb="1.0.0",Eb="Publish your npm package to a GitHub repository branch";async function Cb(){const{stdout:e}=await Qe("git",["status","--porcelain","--untracked-files=no"]).catch(t=>{throw t.stderr.includes("not a git repository")?new Error("Not in a git repository"):t});if(e)throw new Error("Working tree is not clean")}async function bb(){const e=()=>{},t=await Qe("git",["symbolic-ref","--short","-q","HEAD"]).then(({stdout:i})=>i,e);if(t)return t;const u=await Qe("git",["describe","--tags"]).then(({stdout:i})=>i,e);if(u)return u;throw new Error("Failed to get current branch name")}async function yb(e){const t=await rt.default.promises.readFile(e,"utf8");try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON file: ${e}`)}}const{stringify:rn}=JSON;(async()=>{const e=tC({name:gb,version:mb,flags:{branch:{type:String,alias:"b",placeholder:"<branch name>",description:'The branch to publish the package to. Defaults to prefixing "npm/" to the current branch or tag name.'},remote:{type:String,alias:"r",placeholder:"<remote>",description:"The remote to push to.",default:"origin"},dry:{type:Boolean,alias:"d",description:"Dry run mode. Will not commit or push to the remote."}},help:{description:Eb}});await Cb();const t=await bb(),u="package.json";await rt.default.promises.access(u).catch(()=>{throw new Error("No package.json found in current working directory")});const{branch:i=`npm/${t}`,remote:o,dry:s}=e.flags;await T2(`Publishing branch ${rn(t)} \u2192 ${rn(i)}`,async({task:l,setTitle:c,setStatus:d,setOutput:h})=>{s&&d("Dry run");const m=`git-publish/${i}-${Date.now()}`;let E=!1;try{let g=[];const C=await l("Running hooks",async({setWarning:z,setTitle:w})=>{if(s){z("");return}w('Running hook "prepare"'),await Qe("npm",["run","--if-present","prepare"]),w('Running hook "prepack"'),await Qe("npm",["run","--if-present","prepack"])});s||C.clear();const y=await l("Getting publish files",async({setWarning:z})=>{if(s){z("");return}if(g=await pb(),g.length===0)throw new Error("No publish files found")});s||y.clear();const v=await l('Removing "prepare" & "prepack" hooks',async({setWarning:z})=>{if(s){z("");return}const w=await yb(u);if(!("scripts"in w))return;const{scripts:B}=w;let x=!1;"prepare"in B&&(delete B.prepare,x=!0),"prepack"in B&&(delete B.prepack,x=!0),x&&await rt.default.promises.writeFile(u,rn(w,null,2))});s||v.clear();const k=await l(`Checking out branch ${rn(i)}`,async({setWarning:z})=>{if(s){z("");return}await Qe("git",["checkout","--orphan",m]),await Qe("git",["reset"])});s||k.clear();const R=await l("Commiting publish assets",async({setWarning:z})=>{if(s){z("");return}await Qe("git",["add","-f",...g]),await Qe("git",["commit","-nm",`Published branch ${rn(t)}`])});s||R.clear();const N=await l(`Force pushing branch ${rn(i)} to remote ${rn(o)}`,async({setWarning:z})=>{if(s){z("");return}await Qe("git",["push","-f",o,`${m}:${i}`]),E=!0});s||N.clear()}finally{(await l(`Switching branch back to ${rn(t)}`,async({setWarning:C})=>{if(s){C("");return}await Qe("git",["reset","--hard"]),await Qe("git",["checkout","-f",t]),await Qe("git",["branch","-D",m])})).clear()}if(E){let g=o;try{const{stdout:y}=await Qe("git",["remote","get-url",g]);g=y.trim()}catch{}const C=g.match(/github\.com:(.+)\.git$/);if(C){const[,y]=C;c("Successfully published branch! Install with command:"),h(`npm i '${y}#${i}'`)}}})})().catch(e=>{console.error("Error:",e.message),process.exit(1)});
109
+ `;super.onReadIgnoreFile($d,s,i)}}stat({entry:t,file:u,dir:i},o){hb(t)?o():super.stat({entry:t,file:u,dir:i},o)}onstat({st:t,entry:u,file:i,dir:o,isSymbolicLink:s},l){t.isSymbolicLink()?l():super.onstat({st:t,entry:u,file:i,dir:o,isSymbolicLink:s},l)}onReadIgnoreFile(t,u,i){if(t==="package.json")try{const o=Le.resolve(this.path,t);this.onPackageJson(o,JSON.parse(u),i)}catch{i()}else super.onReadIgnoreFile(t,u,i)}sort(t,u){const i=Le.extname(t).toLowerCase(),o=Le.extname(u).toLowerCase(),s=Le.basename(t).toLowerCase(),l=Le.basename(u).toLowerCase();return i.localeCompare(o,"en")||s.localeCompare(l,"en")||t.localeCompare(u,"en")}globFiles(t,u){cb(Gr(t),{dot:!0,cwd:this.path,nocase:!0},u)}readPackageJson(t){jd.readFile(this.path+"/package.json",(u,i)=>this.onReadPackageJson(t,u,i))}walker(t,u,i){new xi(this.walkerOpt(t,u)).on("done",i).start()}}const zd=(e,t)=>{e=e||{};const u=new Promise((i,o)=>{const s=new ub(e);s.on("done",l=>{e.bundled=l,e.packageJsonCache=s.packageJsonCache,new xi(e).on("done",i).on("error",o).start()}),s.start()});return t?u.then(i=>t(null,i),t):u};var pb=zd;zd.Walker=xi;var gb="git-publish",mb="1.0.2",Eb="Publish your npm package to a GitHub repository branch";async function Cb(){const{stdout:e}=await Qe("git",["status","--porcelain","--untracked-files=no"]).catch(t=>{throw t.stderr.includes("not a git repository")?new Error("Not in a git repository"):t});if(e)throw new Error("Working tree is not clean")}async function bb(){const e=()=>{},t=await Qe("git",["symbolic-ref","--short","-q","HEAD"]).then(({stdout:i})=>i,e);if(t)return t;const u=await Qe("git",["describe","--tags"]).then(({stdout:i})=>i,e);if(u)return u;throw new Error("Failed to get current branch name")}async function yb(e){const t=await rt.default.promises.readFile(e,"utf8");try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON file: ${e}`)}}const{stringify:rn}=JSON;(async()=>{const e=tC({name:gb,version:mb,flags:{branch:{type:String,alias:"b",placeholder:"<branch name>",description:'The branch to publish the package to. Defaults to prefixing "npm/" to the current branch or tag name.'},remote:{type:String,alias:"r",placeholder:"<remote>",description:"The remote to push to.",default:"origin"},dry:{type:Boolean,alias:"d",description:"Dry run mode. Will not commit or push to the remote."}},help:{description:Eb}});await Cb();const t=await bb(),u="package.json";await rt.default.promises.access(u).catch(()=>{throw new Error("No package.json found in current working directory")});const{branch:i=`npm/${t}`,remote:o,dry:s}=e.flags;await T2(`Publishing branch ${rn(t)} \u2192 ${rn(i)}`,async({task:l,setTitle:c,setStatus:d,setOutput:h})=>{s&&d("Dry run");const m=`git-publish/${i}-${Date.now()}`;let E=!1;try{let g=[];const C=await l("Running hooks",async({setWarning:z,setTitle:w})=>{if(s){z("");return}w('Running hook "prepare"'),await Qe("npm",["run","--if-present","prepare"]),w('Running hook "prepack"'),await Qe("npm",["run","--if-present","prepack"])});s||C.clear();const y=await l("Getting publish files",async({setWarning:z})=>{if(s){z("");return}if(g=await pb(),g.length===0)throw new Error("No publish files found")});s||y.clear();const v=await l('Removing "prepare" & "prepack" hooks',async({setWarning:z})=>{if(s){z("");return}const w=await yb(u);if(!("scripts"in w))return;const{scripts:B}=w;let x=!1;"prepare"in B&&(delete B.prepare,x=!0),"prepack"in B&&(delete B.prepack,x=!0),x&&await rt.default.promises.writeFile(u,rn(w,null,2))});s||v.clear();const k=await l(`Checking out branch ${rn(i)}`,async({setWarning:z})=>{if(s){z("");return}await Qe("git",["checkout","--orphan",m]),await Qe("git",["reset"])});s||k.clear();const R=await l("Commiting publish assets",async({setWarning:z})=>{if(s){z("");return}await Qe("git",["add","-f",...g]),await Qe("git",["commit","--no-verify","-m",`Published branch ${rn(t)}`])});s||R.clear();const N=await l(`Force pushing branch ${rn(i)} to remote ${rn(o)}`,async({setWarning:z})=>{if(s){z("");return}await Qe("git",["push","--no-verify","-f",o,`${m}:${i}`]),E=!0});s||N.clear()}finally{(await l(`Switching branch back to ${rn(t)}`,async({setWarning:C})=>{if(s){C("");return}await Qe("git",["reset","--hard"]),await Qe("git",["checkout","-f",t]),await Qe("git",["branch","-D",m])})).clear()}if(E){let g=o;try{const{stdout:y}=await Qe("git",["remote","get-url",g]);g=y.trim()}catch{}const C=g.match(/github\.com:(.+)\.git$/);if(C){const[,y]=C;c("Successfully published branch! Install with command:"),h(`npm i '${y}#${i}'`)}}})})().catch(e=>{console.error("Error:",e.message),process.exit(1)});
package/package.json CHANGED
@@ -1,53 +1,27 @@
1
1
  {
2
- "name": "git-publish",
3
- "version": "1.0.0",
4
- "description": "Publish your npm package to a GitHub repository branch",
5
- "keywords": [
6
- "npm",
7
- "publish",
8
- "git",
9
- "github",
10
- "branch",
11
- "branches"
12
- ],
13
- "license": "MIT",
14
- "repository": "privatenumber/git-publish",
15
- "funding": "https://github.com/privatenumber/git-publish?sponsor=1",
16
- "author": {
17
- "name": "Hiroki Osame",
18
- "email": "hiroki.osame@gmail.com"
19
- },
20
- "files": [
21
- "bin",
22
- "dist"
23
- ],
24
- "bin": "dist/index.js",
25
- "scripts": {
26
- "build": "pkgroll --minify --target=node12.19",
27
- "lint": "eslint .",
28
- "prepack": "npm run build",
29
- "pretest": "npm run build",
30
- "test": "tsx tests"
31
- },
32
- "dependencies": {
33
- "yoga-layout-prebuilt": "^1.10.0"
34
- },
35
- "devDependencies": {
36
- "@pvtnbr/eslint-config": "^0.27.0",
37
- "@types/node": "^18.6.4",
38
- "@types/npm-packlist": "^3.0.0",
39
- "cleye": "^1.2.1",
40
- "eslint": "^8.21.0",
41
- "execa": "^6.1.0",
42
- "fs-fixture": "^1.1.0",
43
- "manten": "^0.2.1",
44
- "npm-packlist": "^5.1.1",
45
- "pkgroll": "^1.4.0",
46
- "tasuku": "^2.0.0",
47
- "tsx": "^3.8.0",
48
- "typescript": "^4.7.4"
49
- },
50
- "eslintConfig": {
51
- "extends": "@pvtnbr"
52
- }
53
- }
2
+ "name": "git-publish",
3
+ "version": "1.0.2",
4
+ "description": "Publish your npm package to a GitHub repository branch",
5
+ "keywords": [
6
+ "npm",
7
+ "publish",
8
+ "git",
9
+ "github",
10
+ "branch",
11
+ "branches"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": "privatenumber/git-publish",
15
+ "funding": "https://github.com/privatenumber/git-publish?sponsor=1",
16
+ "author": {
17
+ "name": "Hiroki Osame",
18
+ "email": "hiroki.osame@gmail.com"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "bin": "dist/index.js",
24
+ "dependencies": {
25
+ "yoga-layout-prebuilt": "^1.10.0"
26
+ }
27
+ }