New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@clerc/plugin-not-found

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clerc/plugin-not-found - npm Package Compare versions

Comparing version 0.37.0 to 0.38.0

4

dist/index.js

@@ -1,2 +0,2 @@

import{definePlugin as z,NoSuchCommandError as q,NoCommandGivenError as N}from"@clerc/core";import B from"tty";const Z={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},$=(t,{add:e,t:u})=>(e(Z),t.length<=1?t[0]:u("utils.and",t.slice(0,-1).join(", "),t[t.length-1])),E=new Uint32Array(65536),J=(t,e)=>{const u=t.length,d=e.length,a=1<<u-1;let s=-1,l=0,b=u,c=u;for(;c--;)E[t.charCodeAt(c)]|=1<<c;for(c=0;c<d;c++){let f=E[e.charCodeAt(c)];const S=f|l;f|=(f&s)+s^s,l|=~(f|s),s&=f,l&a&&b++,s&a&&b--,l=l<<1|1,s=s<<1|~(S|l),l&=S}for(c=u;c--;)E[t.charCodeAt(c)]=0;return b},K=(t,e)=>{const u=e.length,d=t.length,a=[],s=[],l=Math.ceil(u/32),b=Math.ceil(d/32);for(let o=0;o<l;o++)s[o]=-1,a[o]=0;let c=0;for(;c<b-1;c++){let o=0,i=-1;const h=c*32,y=Math.min(32,d)+h;for(let x=h;x<y;x++)E[t.charCodeAt(x)]|=1<<x;for(let x=0;x<u;x++){const I=E[e.charCodeAt(x)],A=s[x/32|0]>>>x&1,T=a[x/32|0]>>>x&1,w=I|o,M=((I|T)&i)+i^i|I|T;let L=o|~(M|i),_=i&M;L>>>31^A&&(s[x/32|0]^=1<<x),_>>>31^T&&(a[x/32|0]^=1<<x),L=L<<1|A,_=_<<1|T,i=_|~(w|L),o=L&w}for(let x=h;x<y;x++)E[t.charCodeAt(x)]=0}let f=0,S=-1;const p=c*32,r=Math.min(32,d-p)+p;for(let o=p;o<r;o++)E[t.charCodeAt(o)]|=1<<o;let n=d;for(let o=0;o<u;o++){const i=E[e.charCodeAt(o)],h=s[o/32|0]>>>o&1,y=a[o/32|0]>>>o&1,x=i|f,I=((i|y)&S)+S^S|i|y;let A=f|~(I|S),T=S&I;n+=A>>>d-1&1,n-=T>>>d-1&1,A>>>31^h&&(s[o/32|0]^=1<<o),T>>>31^y&&(a[o/32|0]^=1<<o),A=A<<1|h,T=T<<1|y,S=T|~(x|A),f=A&x}for(let o=p;o<r;o++)E[t.charCodeAt(o)]=0;return n},R=(t,e)=>{if(t.length<e.length){const u=e;e=t,t=u}return e.length===0?t.length:t.length<=32?J(t,e):K(t,e)};var F=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},W=1/0,Q="[object Symbol]",V=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,X="\\u0300-\\u036f\\ufe20-\\ufe23",tt="\\u20d0-\\u20f0",et="["+X+tt+"]",ot=RegExp(et,"g"),rt={\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"},nt=typeof F=="object"&&F&&F.Object===Object&&F,ut=typeof self=="object"&&self&&self.Object===Object&&self,st=nt||ut||Function("return this")();function ct(t){return function(e){return t==null?void 0:t[e]}}var it=ct(rt),mt=Object.prototype,at=mt.toString,k=st.Symbol,D=k?k.prototype:void 0,H=D?D.toString:void 0;function lt(t){if(typeof t=="string")return t;if(dt(t))return H?H.call(t):"";var e=t+"";return e=="0"&&1/t==-W?"-0":e}function xt(t){return!!t&&typeof t=="object"}function dt(t){return typeof t=="symbol"||xt(t)&&at.call(t)==Q}function ft(t){return t==null?"":lt(t)}function ht(t){return t=ft(t),t&&t.replace(V,it).replace(ot,"")}var bt=ht;let g,C;(function(t){t.ALL_CLOSEST_MATCHES="all-closest-matches",t.ALL_MATCHES="all-matches",t.ALL_SORTED_MATCHES="all-sorted-matches",t.FIRST_CLOSEST_MATCH="first-closest-match",t.FIRST_MATCH="first-match"})(g||(g={})),function(t){t.EDIT_DISTANCE="edit-distance",t.SIMILARITY="similarity"}(C||(C={}));const j=new Error("unknown returnType"),O=new Error("unknown thresholdType"),Y=(t,e)=>{let u=t;return e.trimSpaces&&(u=u.trim().replace(/\s+/g," ")),e.deburr&&(u=bt(u)),e.caseSensitive||(u=u.toLowerCase()),u},U=(t,e)=>{const{matchPath:u}=e,d=((a,s)=>{const l=s.length>0?s.reduce((b,c)=>b==null?void 0:b[c],a):a;return typeof l!="string"?"":l})(t,u);return Y(d,e)};function St(t,e,u){const d=(r=>{const n={caseSensitive:!1,deburr:!0,matchPath:[],returnType:g.FIRST_CLOSEST_MATCH,thresholdType:C.SIMILARITY,trimSpaces:!0,...r};switch(n.thresholdType){case C.EDIT_DISTANCE:return{threshold:20,...n};case C.SIMILARITY:return{threshold:.4,...n};default:throw O}})(u),{returnType:a,threshold:s,thresholdType:l}=d,b=Y(t,d);let c,f;switch(l){case C.EDIT_DISTANCE:c=r=>r<=s,f=r=>R(b,U(r,d));break;case C.SIMILARITY:c=r=>r>=s,f=r=>((n,o)=>{if(!n||!o)return 0;if(n===o)return 1;const i=R(n,o),h=Math.max(n.length,o.length);return(h-i)/h})(b,U(r,d));break;default:throw O}const S=[],p=e.length;switch(a){case g.ALL_CLOSEST_MATCHES:case g.FIRST_CLOSEST_MATCH:{const r=[];let n;switch(l){case C.EDIT_DISTANCE:n=1/0;for(let i=0;i<p;i+=1){const h=f(e[i]);n>h&&(n=h),r.push(h)}break;case C.SIMILARITY:n=0;for(let i=0;i<p;i+=1){const h=f(e[i]);n<h&&(n=h),r.push(h)}break;default:throw O}const o=r.length;for(let i=0;i<o;i+=1){const h=r[i];c(h)&&h===n&&S.push(i)}break}case g.ALL_MATCHES:for(let r=0;r<p;r+=1)c(f(e[r]))&&S.push(r);break;case g.ALL_SORTED_MATCHES:{const r=[];for(let n=0;n<p;n+=1){const o=f(e[n]);c(o)&&r.push({score:o,index:n})}switch(l){case C.EDIT_DISTANCE:r.sort((n,o)=>n.score-o.score);break;case C.SIMILARITY:r.sort((n,o)=>o.score-n.score);break;default:throw O}for(const n of r)S.push(n.index);break}case g.FIRST_MATCH:for(let r=0;r<p;r+=1)if(c(f(e[r]))){S.push(r);break}break;default:throw j}return((r,n,o)=>{switch(o){case g.ALL_CLOSEST_MATCHES:case g.ALL_MATCHES:case g.ALL_SORTED_MATCHES:return n.map(i=>r[i]);case g.FIRST_CLOSEST_MATCH:case g.FIRST_MATCH:return n.length?r[n[0]]:null;default:throw j}})(e,S,a)}var v={exports:{}};let gt=B,Ct=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||gt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),m=(t,e,u=t)=>d=>{let a=""+d,s=a.indexOf(e,t.length);return~s?t+G(a,e,u,s)+e:t+a+e},G=(t,e,u,d)=>{let a=t.substring(0,d)+u,s=t.substring(d+e.length),l=s.indexOf(e);return~l?a+G(s,e,u,l):a+s},P=(t=Ct)=>({isColorSupported:t,reset:t?e=>`\x1B[0m${e}\x1B[0m`:String,bold:t?m("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:t?m("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:t?m("\x1B[3m","\x1B[23m"):String,underline:t?m("\x1B[4m","\x1B[24m"):String,inverse:t?m("\x1B[7m","\x1B[27m"):String,hidden:t?m("\x1B[8m","\x1B[28m"):String,strikethrough:t?m("\x1B[9m","\x1B[29m"):String,black:t?m("\x1B[30m","\x1B[39m"):String,red:t?m("\x1B[31m","\x1B[39m"):String,green:t?m("\x1B[32m","\x1B[39m"):String,yellow:t?m("\x1B[33m","\x1B[39m"):String,blue:t?m("\x1B[34m","\x1B[39m"):String,magenta:t?m("\x1B[35m","\x1B[39m"):String,cyan:t?m("\x1B[36m","\x1B[39m"):String,white:t?m("\x1B[37m","\x1B[39m"):String,gray:t?m("\x1B[90m","\x1B[39m"):String,bgBlack:t?m("\x1B[40m","\x1B[49m"):String,bgRed:t?m("\x1B[41m","\x1B[49m"):String,bgGreen:t?m("\x1B[42m","\x1B[49m"):String,bgYellow:t?m("\x1B[43m","\x1B[49m"):String,bgBlue:t?m("\x1B[44m","\x1B[49m"):String,bgMagenta:t?m("\x1B[45m","\x1B[49m"):String,bgCyan:t?m("\x1B[46m","\x1B[49m"):String,bgWhite:t?m("\x1B[47m","\x1B[49m"):String});v.exports=P(),v.exports.createColors=P;const pt={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"}},Tt=()=>z({setup:t=>{const{t:e,add:u}=t.i18n;return u(pt),t.inspector({enforce:"pre",fn:(d,a)=>{const s=Object.keys(t._commands),l=!!s.length;try{a()}catch(b){if(!(b instanceof q||b instanceof N))throw b;if(d.raw._.length===0||b instanceof N){console.error(e("core.noCommandGiven")),l&&console.error(e("notFound.possibleCommands",$(s,t.i18n)));return}const c=b.commandName,f=St(c,s);console.error(e("notFound.commandNotFound",v.exports.strikethrough(c))),l&&f?console.error(e("notFound.didyoumean",v.exports.bold(f))):l||console.error(e("notFound.commandNotRegisteredNote")),process.stderr.write(`
`),process.exit(2)}}})}});export{Tt as notFoundPlugin};
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(`
`),process.exit(2)}}})}});export{be as notFoundPlugin};
{
"name": "@clerc/plugin-not-found",
"version": "0.37.0",
"version": "0.38.0",
"author": "Ray <i@mk1.io> (https://github.com/so1ve)",

@@ -55,5 +55,5 @@ "description": "Clerc plugin not found (did you mean)",

"didyoumean2": "^5.0.0",
"picocolors": "^1.0.0",
"@clerc/utils": "0.37.0",
"@clerc/core": "0.37.0"
"yoctocolors": "^1.0.0",
"@clerc/utils": "0.38.0",
"@clerc/core": "0.38.0"
},

@@ -60,0 +60,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc