@clerc/plugin-not-found 0.38.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{definePlugin as Y,NoSuchCommandError as G,NoCommandGivenError as O}from"@clerc/core";import P from"node:tty";const z={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},q=(e,{add:o,t:r})=>(o(z),e.length<=1?e[0]:r("utils.and",e.slice(0,-1).join(", "),e[e.length-1])),E=new Uint32Array(65536),B=(e,o)=>{const r=e.length,h=o.length,x=1<<r-1;let a=-1,l=0,m=r,s=r;for(;s--;)E[e.charCodeAt(s)]|=1<<s;for(s=0;s<h;s++){let i=E[o.charCodeAt(s)];const S=i|l;i|=(i&a)+a^a,l|=~(i|a),a&=i,l&x&&m++,a&x&&m--,l=l<<1|1,a=a<<1|~(S|l),l&=S}for(s=r;s--;)E[e.charCodeAt(s)]=0;return m},Z=(e,o)=>{const r=o.length,h=e.length,x=[],a=[],l=Math.ceil(r/32),m=Math.ceil(h/32);for(let t=0;t<l;t++)a[t]=-1,x[t]=0;let s=0;for(;s<m-1;s++){let t=0,c=-1;const f=s*32,I=Math.min(32,h)+f;for(let d=f;d<I;d++)E[e.charCodeAt(d)]|=1<<d;for(let d=0;d<r;d++){const y=E[o.charCodeAt(d)],p=a[d/32|0]>>>d&1,A=x[d/32|0]>>>d&1,M=y|t,N=((y|A)&c)+c^c|y|A;let g=t|~(N|c),L=c&N;g>>>31^p&&(a[d/32|0]^=1<<d),L>>>31^A&&(x[d/32|0]^=1<<d),g=g<<1|p,L=L<<1|A,c=L|~(M|g),t=g&M}for(let d=f;d<I;d++)E[e.charCodeAt(d)]=0}let i=0,S=-1;const b=s*32,u=Math.min(32,h-b)+b;for(let t=b;t<u;t++)E[e.charCodeAt(t)]|=1<<t;let n=h;for(let t=0;t<r;t++){const c=E[o.charCodeAt(t)],f=a[t/32|0]>>>t&1,I=x[t/32|0]>>>t&1,d=c|i,y=((c|I)&S)+S^S|c|I;let p=i|~(y|S),A=S&y;n+=p>>>h-1&1,n-=A>>>h-1&1,p>>>31^f&&(a[t/32|0]^=1<<t),A>>>31^I&&(x[t/32|0]^=1<<t),p=p<<1|f,A=A<<1|I,S=A|~(d|p),i=p&d}for(let t=b;t<u;t++)E[e.charCodeAt(t)]=0;return n},w=(e,o)=>{if(e.length<o.length){const r=o;o=e,e=r}return o.length===0?e.length:e.length<=32?B(e,o):Z(e,o)};var F=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},J=1/0,K="[object Symbol]",W=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Q="\\u0300-\\u036f\\ufe20-\\ufe23",V="\\u20d0-\\u20f0",X="["+Q+V+"]",$=RegExp(X,"g"),ee={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},te=typeof F=="object"&&F&&F.Object===Object&&F,oe=typeof self=="object"&&self&&self.Object===Object&&self,ue=te||oe||Function("return this")();function ne(e){return function(o){return e==null?void 0:e[o]}}var re=ne(ee),se=Object.prototype,ce=se.toString,v=ue.Symbol,R=v?v.prototype:void 0,k=R?R.toString:void 0;function ae(e){if(typeof e=="string")return e;if(le(e))return k?k.call(e):"";var o=e+"";return o=="0"&&1/e==-J?"-0":o}function de(e){return!!e&&typeof e=="object"}function le(e){return typeof e=="symbol"||de(e)&&ce.call(e)==K}function ie(e){return e==null?"":ae(e)}function fe(e){return e=ie(e),e&&e.replace(W,re).replace($,"")}var he=fe;let C,T;(function(e){e.ALL_CLOSEST_MATCHES="all-closest-matches",e.ALL_MATCHES="all-matches",e.ALL_SORTED_MATCHES="all-sorted-matches",e.FIRST_CLOSEST_MATCH="first-closest-match",e.FIRST_MATCH="first-match"})(C||(C={})),function(e){e.EDIT_DISTANCE="edit-distance",e.SIMILARITY="similarity"}(T||(T={}));const D=new Error("unknown returnType"),_=new Error("unknown thresholdType"),H=(e,o)=>{let r=e;return o.trimSpaces&&(r=r.trim().replace(/\s+/g," ")),o.deburr&&(r=he(r)),o.caseSensitive||(r=r.toLowerCase()),r},j=(e,o)=>{const{matchPath:r}=o,h=((x,a)=>{const l=a.length>0?a.reduce((m,s)=>m==null?void 0:m[s],x):x;return typeof l!="string"?"":l})(e,r);return H(h,o)};function me(e,o,r){const h=(u=>{const n={caseSensitive:!1,deburr:!0,matchPath:[],returnType:C.FIRST_CLOSEST_MATCH,thresholdType:T.SIMILARITY,trimSpaces:!0,...u};switch(n.thresholdType){case T.EDIT_DISTANCE:return{threshold:20,...n};case T.SIMILARITY:return{threshold:.4,...n};default:throw _}})(r),{returnType:x,threshold:a,thresholdType:l}=h,m=H(e,h);let s,i;switch(l){case T.EDIT_DISTANCE:s=u=>u<=a,i=u=>w(m,j(u,h));break;case T.SIMILARITY:s=u=>u>=a,i=u=>((n,t)=>{if(!n||!t)return 0;if(n===t)return 1;const c=w(n,t),f=Math.max(n.length,t.length);return(f-c)/f})(m,j(u,h));break;default:throw _}const S=[],b=o.length;switch(x){case C.ALL_CLOSEST_MATCHES:case C.FIRST_CLOSEST_MATCH:{const u=[];let n;switch(l){case T.EDIT_DISTANCE:n=1/0;for(let c=0;c<b;c+=1){const f=i(o[c]);n>f&&(n=f),u.push(f)}break;case T.SIMILARITY:n=0;for(let c=0;c<b;c+=1){const f=i(o[c]);n<f&&(n=f),u.push(f)}break;default:throw _}const t=u.length;for(let c=0;c<t;c+=1){const f=u[c];s(f)&&f===n&&S.push(c)}break}case C.ALL_MATCHES:for(let u=0;u<b;u+=1)s(i(o[u]))&&S.push(u);break;case C.ALL_SORTED_MATCHES:{const u=[];for(let n=0;n<b;n+=1){const t=i(o[n]);s(t)&&u.push({score:t,index:n})}switch(l){case T.EDIT_DISTANCE:u.sort((n,t)=>n.score-t.score);break;case T.SIMILARITY:u.sort((n,t)=>t.score-n.score);break;default:throw _}for(const n of u)S.push(n.index);break}case C.FIRST_MATCH:for(let u=0;u<b;u+=1)if(s(i(o[u]))){S.push(u);break}break;default:throw D}return((u,n,t)=>{switch(t){case C.ALL_CLOSEST_MATCHES:case C.ALL_MATCHES:case C.ALL_SORTED_MATCHES:return n.map(c=>u[c]);case C.FIRST_CLOSEST_MATCH:case C.FIRST_MATCH:return n.length?u[n[0]]:null;default:throw D}})(o,S,x)}const xe=P.WriteStream.prototype.hasColors(),U=(e,o)=>xe?r=>"\x1B["+e+"m"+r+"\x1B["+o+"m":r=>r,Se=U(1,22),Ce=U(9,29),Te={en:{"notFound.possibleCommands":"Possible commands: %s.","notFound.commandNotFound":'Command "%s" not found.',"notFound.didyoumean":'Did you mean "%s"?',"notFound.commandNotRegisteredNote":"NOTE: You haven't register any command yet."},"zh-CN":{"notFound.possibleCommands":"\u53EF\u80FD\u7684\u547D\u4EE4: %s\u3002","notFound.commandNotFound":'\u672A\u627E\u5230\u547D\u4EE4 "%s"\u3002',"notFound.didyoumean":'\u4F60\u662F\u4E0D\u662F\u6307 "%s"\uFF1F',"notFound.commandNotRegisteredNote":"\u63D0\u793A: \u4F60\u8FD8\u6CA1\u6709\u6CE8\u518C\u4EFB\u4F55\u547D\u4EE4\u3002"}},be=()=>Y({setup:e=>{const{t:o,add:r}=e.i18n;return r(Te),e.inspector({enforce:"pre",fn:(h,x)=>{const a=Object.keys(e._commands),l=!!a.length;try{x()}catch(m){if(!(m instanceof G||m instanceof O))throw m;if(h.raw._.length===0||m instanceof O){console.error(o("core.noCommandGiven")),l&&console.error(o("notFound.possibleCommands",q(a,e.i18n)));return}const s=m.commandName,i=me(s,a);console.error(o("notFound.commandNotFound",Ce(s))),l&&i?console.error(o("notFound.didyoumean",Se(i))):l||console.error(o("notFound.commandNotRegisteredNote")),process.stderr.write(`
2
- `),process.exit(2)}}})}});export{be as notFoundPlugin};
1
+ import{definePlugin as Y,NoSuchCommandError as P,NoCommandGivenError as w}from"@clerc/core";import G from"node:tty";const z={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},q=(e,{add:o,t:r})=>(o(z),e.length<=1?e[0]:r("utils.and",e.slice(0,-1).join(", "),e[e.length-1])),E=new Uint32Array(65536),B=(e,o)=>{const r=e.length,h=o.length,x=1<<r-1;let a=-1,l=0,m=r,s=r;for(;s--;)E[e.charCodeAt(s)]|=1<<s;for(s=0;s<h;s++){let f=E[o.charCodeAt(s)];const S=f|l;f|=(f&a)+a^a,l|=~(f|a),a&=f,l&x&&m++,a&x&&m--,l=l<<1|1,a=a<<1|~(S|l),l&=S}for(s=r;s--;)E[e.charCodeAt(s)]=0;return m},Z=(e,o)=>{const r=o.length,h=e.length,x=[],a=[],l=Math.ceil(r/32),m=Math.ceil(h/32);for(let t=0;t<l;t++)a[t]=-1,x[t]=0;let s=0;for(;s<m-1;s++){let t=0,c=-1;const i=s*32,y=Math.min(32,h)+i;for(let d=i;d<y;d++)E[e.charCodeAt(d)]|=1<<d;for(let d=0;d<r;d++){const I=E[o.charCodeAt(d)],A=a[d/32|0]>>>d&1,T=x[d/32|0]>>>d&1,O=I|t,M=((I|T)&c)+c^c|I|T;let g=t|~(M|c),L=c&M;g>>>31^A&&(a[d/32|0]^=1<<d),L>>>31^T&&(x[d/32|0]^=1<<d),g=g<<1|A,L=L<<1|T,c=L|~(O|g),t=g&O}for(let d=i;d<y;d++)E[e.charCodeAt(d)]=0}let f=0,S=-1;const p=s*32,u=Math.min(32,h-p)+p;for(let t=p;t<u;t++)E[e.charCodeAt(t)]|=1<<t;let n=h;for(let t=0;t<r;t++){const c=E[o.charCodeAt(t)],i=a[t/32|0]>>>t&1,y=x[t/32|0]>>>t&1,d=c|f,I=((c|y)&S)+S^S|c|y;let A=f|~(I|S),T=S&I;n+=A>>>h-1&1,n-=T>>>h-1&1,A>>>31^i&&(a[t/32|0]^=1<<t),T>>>31^y&&(x[t/32|0]^=1<<t),A=A<<1|i,T=T<<1|y,S=T|~(d|A),f=A&d}for(let t=p;t<u;t++)E[e.charCodeAt(t)]=0;return n},N=(e,o)=>{if(e.length<o.length){const r=o;o=e,e=r}return o.length===0?e.length:e.length<=32?B(e,o):Z(e,o)};var _=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function J(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var K=1/0,W="[object Symbol]",Q=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,V="\\u0300-\\u036f\\ufe20-\\ufe23",X="\\u20d0-\\u20f0",$="["+V+X+"]",ee=RegExp($,"g"),te={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},oe=typeof _=="object"&&_&&_.Object===Object&&_,ue=typeof self=="object"&&self&&self.Object===Object&&self,ne=oe||ue||Function("return this")();function re(e){return function(o){return e==null?void 0:e[o]}}var se=re(te),ce=Object.prototype,ae=ce.toString,v=ne.Symbol,D=v?v.prototype:void 0,R=D?D.toString:void 0;function de(e){if(typeof e=="string")return e;if(fe(e))return R?R.call(e):"";var o=e+"";return o=="0"&&1/e==-K?"-0":o}function le(e){return!!e&&typeof e=="object"}function fe(e){return typeof e=="symbol"||le(e)&&ae.call(e)==W}function ie(e){return e==null?"":de(e)}function he(e){return e=ie(e),e&&e.replace(Q,se).replace(ee,"")}var me=he,xe=J(me);let C,b;(function(e){e.ALL_CLOSEST_MATCHES="all-closest-matches",e.ALL_MATCHES="all-matches",e.ALL_SORTED_MATCHES="all-sorted-matches",e.FIRST_CLOSEST_MATCH="first-closest-match",e.FIRST_MATCH="first-match"})(C||(C={})),function(e){e.EDIT_DISTANCE="edit-distance",e.SIMILARITY="similarity"}(b||(b={}));const k=new Error("unknown returnType"),F=new Error("unknown thresholdType"),j=(e,o)=>{let r=e;return o.trimSpaces&&(r=r.trim().replace(/\s+/g," ")),o.deburr&&(r=xe(r)),o.caseSensitive||(r=r.toLowerCase()),r},H=(e,o)=>{const{matchPath:r}=o,h=((x,a)=>{const l=a.length>0?a.reduce((m,s)=>m==null?void 0:m[s],x):x;return typeof l!="string"?"":l})(e,r);return j(h,o)};function Se(e,o,r){const h=(u=>{const n={caseSensitive:!1,deburr:!0,matchPath:[],returnType:C.FIRST_CLOSEST_MATCH,thresholdType:b.SIMILARITY,trimSpaces:!0,...u};switch(n.thresholdType){case b.EDIT_DISTANCE:return{threshold:20,...n};case b.SIMILARITY:return{threshold:.4,...n};default:throw F}})(r),{returnType:x,threshold:a,thresholdType:l}=h,m=j(e,h);let s,f;switch(l){case b.EDIT_DISTANCE:s=u=>u<=a,f=u=>N(m,H(u,h));break;case b.SIMILARITY:s=u=>u>=a,f=u=>((n,t)=>{if(!n||!t)return 0;if(n===t)return 1;const c=N(n,t),i=Math.max(n.length,t.length);return(i-c)/i})(m,H(u,h));break;default:throw F}const S=[],p=o.length;switch(x){case C.ALL_CLOSEST_MATCHES:case C.FIRST_CLOSEST_MATCH:{const u=[];let n;switch(l){case b.EDIT_DISTANCE:n=1/0;for(let c=0;c<p;c+=1){const i=f(o[c]);n>i&&(n=i),u.push(i)}break;case b.SIMILARITY:n=0;for(let c=0;c<p;c+=1){const i=f(o[c]);n<i&&(n=i),u.push(i)}break;default:throw F}const t=u.length;for(let c=0;c<t;c+=1){const i=u[c];s(i)&&i===n&&S.push(c)}break}case C.ALL_MATCHES:for(let u=0;u<p;u+=1)s(f(o[u]))&&S.push(u);break;case C.ALL_SORTED_MATCHES:{const u=[];for(let n=0;n<p;n+=1){const t=f(o[n]);s(t)&&u.push({score:t,index:n})}switch(l){case b.EDIT_DISTANCE:u.sort((n,t)=>n.score-t.score);break;case b.SIMILARITY:u.sort((n,t)=>t.score-n.score);break;default:throw F}for(const n of u)S.push(n.index);break}case C.FIRST_MATCH:for(let u=0;u<p;u+=1)if(s(f(o[u]))){S.push(u);break}break;default:throw k}return((u,n,t)=>{switch(t){case C.ALL_CLOSEST_MATCHES:case C.ALL_MATCHES:case C.ALL_SORTED_MATCHES:return n.map(c=>u[c]);case C.FIRST_CLOSEST_MATCH:case C.FIRST_MATCH:return n.length?u[n[0]]:null;default:throw k}})(o,S,x)}const Ce=G.WriteStream.prototype.hasColors(),U=(e,o)=>Ce?r=>"\x1B["+e+"m"+r+"\x1B["+o+"m":r=>r,be=U(1,22),pe=U(9,29),Te={en:{"notFound.possibleCommands":"Possible commands: %s.","notFound.commandNotFound":'Command "%s" not found.',"notFound.didyoumean":'Did you mean "%s"?',"notFound.commandNotRegisteredNote":"NOTE: You haven't register any command yet."},"zh-CN":{"notFound.possibleCommands":"\u53EF\u80FD\u7684\u547D\u4EE4: %s\u3002","notFound.commandNotFound":'\u672A\u627E\u5230\u547D\u4EE4 "%s"\u3002',"notFound.didyoumean":'\u4F60\u662F\u4E0D\u662F\u6307 "%s"\uFF1F',"notFound.commandNotRegisteredNote":"\u63D0\u793A: \u4F60\u8FD8\u6CA1\u6709\u6CE8\u518C\u4EFB\u4F55\u547D\u4EE4\u3002"}},Ae=()=>Y({setup:e=>{const{t:o,add:r}=e.i18n;return r(Te),e.inspector({enforce:"pre",fn:(h,x)=>{const a=Object.keys(e._commands),l=!!a.length;try{x()}catch(m){if(!(m instanceof P||m instanceof w))throw m;if(h.raw._.length===0||m instanceof w){console.error(o("core.noCommandGiven")),l&&console.error(o("notFound.possibleCommands",q(a,e.i18n)));return}const s=m.commandName,f=Se(s,a);console.error(o("notFound.commandNotFound",pe(s))),l&&f?console.error(o("notFound.didyoumean",be(f))):l||console.error(o("notFound.commandNotRegisteredNote")),process.stderr.write(`
2
+ `),process.exit(2)}}})}});export{Ae as notFoundPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-not-found",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "description": "Clerc plugin not found (did you mean)",
6
6
  "keywords": [
@@ -53,11 +53,11 @@
53
53
  "devDependencies": {
54
54
  "didyoumean2": "^5.0.0",
55
55
  "yoctocolors": "^1.0.0",
56
- "@clerc/utils": "0.38.0",
57
- "@clerc/core": "0.38.0"
56
+ "@clerc/core": "0.39.0",
57
+ "@clerc/utils": "0.39.0"
58
58
  },
59
59
  "scripts": {
60
- "build": "puild --minify",
61
- "watch": "puild --watch"
60
+ "build": "pkgroll --minify",
61
+ "watch": "pkgroll --watch"
62
62
  }
63
63
  }