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.28.1 to 0.29.0

4

dist/index.js

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

import{definePlugin as $,NoSuchCommandError as q,NoCommandGivenError as R}from"@clerc/core";import z from"tty";const I=new Uint32Array(65536),Z=(t,e)=>{const s=t.length,x=e.length,i=1<<s-1;let u=-1,f=0,S=s,l=s;for(;l--;)I[t.charCodeAt(l)]|=1<<l;for(l=0;l<x;l++){let b=I[e.charCodeAt(l)];const d=b|f;b|=(b&u)+u^u,f|=~(b|u),u&=b,f&i&&S++,u&i&&S--,f=f<<1|1,u=u<<1|~(d|f),f&=d}for(l=s;l--;)I[t.charCodeAt(l)]=0;return S},B=(t,e)=>{const s=e.length,x=t.length,i=[],u=[],f=Math.ceil(s/32),S=Math.ceil(x/32);for(let r=0;r<f;r++)u[r]=-1,i[r]=0;let l=0;for(;l<S-1;l++){let r=0,c=-1;const h=l*32,y=Math.min(32,x)+h;for(let a=h;a<y;a++)I[t.charCodeAt(a)]|=1<<a;for(let a=0;a<s;a++){const E=I[e.charCodeAt(a)],A=u[a/32|0]>>>a&1,C=i[a/32|0]>>>a&1,M=E|r,k=((E|C)&c)+c^c|E|C;let _=r|~(k|c),O=c&k;_>>>31^A&&(u[a/32|0]^=1<<a),O>>>31^C&&(i[a/32|0]^=1<<a),_=_<<1|A,O=O<<1|C,c=O|~(M|_),r=_&M}for(let a=h;a<y;a++)I[t.charCodeAt(a)]=0}let b=0,d=-1;const T=l*32,o=Math.min(32,x-T)+T;for(let r=T;r<o;r++)I[t.charCodeAt(r)]|=1<<r;let n=x;for(let r=0;r<s;r++){const c=I[e.charCodeAt(r)],h=u[r/32|0]>>>r&1,y=i[r/32|0]>>>r&1,a=c|b,E=((c|y)&d)+d^d|c|y;let A=b|~(E|d),C=d&E;n+=A>>>x-1&1,n-=C>>>x-1&1,A>>>31^h&&(u[r/32|0]^=1<<r),C>>>31^y&&(i[r/32|0]^=1<<r),A=A<<1|h,C=C<<1|y,d=C|~(a|A),b=A&a}for(let r=T;r<o;r++)I[t.charCodeAt(r)]=0;return n},N=(t,e)=>{if(t.length<e.length){const s=e;e=t,t=s}return e.length===0?t.length:t.length<=32?Z(t,e):B(t,e)};var v=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+"]",tt=RegExp(X,"g"),et={\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"},rt=typeof v=="object"&&v&&v.Object===Object&&v,ot=typeof self=="object"&&self&&self.Object===Object&&self,nt=rt||ot||Function("return this")();function ut(t){return function(e){return t==null?void 0:t[e]}}var st=ut(et),ct=Object.prototype,it=ct.toString,H=nt.Symbol,j=H?H.prototype:void 0,D=j?j.toString:void 0;function xt(t){if(typeof t=="string")return t;if(mt(t))return D?D.call(t):"";var e=t+"";return e=="0"&&1/t==-J?"-0":e}function lt(t){return!!t&&typeof t=="object"}function mt(t){return typeof t=="symbol"||lt(t)&&it.call(t)==K}function at(t){return t==null?"":xt(t)}function ft(t){return t=at(t),t&&t.replace(W,st).replace(tt,"")}var ht=ft;let g,p;(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"}(p||(p={}));const Y=new Error("unknown returnType"),w=new Error("unknown thresholdType"),F=(t,e)=>{let s=t;return e.trimSpaces&&(s=s.trim().replace(/\s+/g," ")),e.deburr&&(s=ht(s)),e.caseSensitive||(s=s.toLowerCase()),s},U=(t,e)=>{const{matchPath:s}=e,x=((i,u)=>{const f=u.length>0?u.reduce((S,l)=>S==null?void 0:S[l],i):i;return typeof f!="string"?"":f})(t,s);return F(x,e)};function bt(t,e,s){const x=(o=>{const n={caseSensitive:!1,deburr:!0,matchPath:[],returnType:g.FIRST_CLOSEST_MATCH,thresholdType:p.SIMILARITY,trimSpaces:!0,...o};switch(n.thresholdType){case p.EDIT_DISTANCE:return{threshold:20,...n};case p.SIMILARITY:return{threshold:.4,...n};default:throw w}})(s),{returnType:i,threshold:u,thresholdType:f}=x,S=F(t,x);let l,b;switch(f){case p.EDIT_DISTANCE:l=o=>o<=u,b=o=>N(S,U(o,x));break;case p.SIMILARITY:l=o=>o>=u,b=o=>((n,r)=>{if(!n||!r)return 0;if(n===r)return 1;const c=N(n,r),h=Math.max(n.length,r.length);return(h-c)/h})(S,U(o,x));break;default:throw w}const d=[],T=e.length;switch(i){case g.ALL_CLOSEST_MATCHES:case g.FIRST_CLOSEST_MATCH:{const o=[];let n;switch(f){case p.EDIT_DISTANCE:n=1/0;for(let c=0;c<T;c+=1){const h=b(e[c]);n>h&&(n=h),o.push(h)}break;case p.SIMILARITY:n=0;for(let c=0;c<T;c+=1){const h=b(e[c]);n<h&&(n=h),o.push(h)}break;default:throw w}const r=o.length;for(let c=0;c<r;c+=1){const h=o[c];l(h)&&h===n&&d.push(c)}break}case g.ALL_MATCHES:for(let o=0;o<T;o+=1)l(b(e[o]))&&d.push(o);break;case g.ALL_SORTED_MATCHES:{const o=[];for(let n=0;n<T;n+=1){const r=b(e[n]);l(r)&&o.push({score:r,index:n})}switch(f){case p.EDIT_DISTANCE:o.sort((n,r)=>n.score-r.score);break;case p.SIMILARITY:o.sort((n,r)=>r.score-n.score);break;default:throw w}for(const n of o)d.push(n.index);break}case g.FIRST_MATCH:for(let o=0;o<T;o+=1)if(l(b(e[o]))){d.push(o);break}break;default:throw Y}return((o,n,r)=>{switch(r){case g.ALL_CLOSEST_MATCHES:case g.ALL_MATCHES:case g.ALL_SORTED_MATCHES:return n.map(c=>o[c]);case g.FIRST_CLOSEST_MATCH:case g.FIRST_MATCH:return n.length?o[n[0]]:null;default:throw Y}})(e,d,i)}var L={exports:{}};let dt=z,St=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||dt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),m=(t,e,s=t)=>x=>{let i=""+x,u=i.indexOf(e,t.length);return~u?t+G(i,e,s,u)+e:t+i+e},G=(t,e,s,x)=>{let i=t.substring(0,x)+s,u=t.substring(x+e.length),f=u.indexOf(e);return~f?i+G(u,e,s,f):i+u},P=(t=St)=>({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});L.exports=P(),L.exports.createColors=P;const gt=t=>t.length<=1?t[0]:`${t.slice(0,-1).map(L.exports.bold).join(", ")} and ${L.exports.bold(t[t.length-1])}`,pt=()=>$({setup:t=>t.inspector({enforce:"pre",fn:(e,s)=>{const x=Object.keys(t._commands),i=!!x.length;try{s()}catch(u){if(!(u instanceof q||u instanceof R))throw u;if(e.raw._.length===0||u instanceof R){console.error("No command given."),i&&console.error(`Possible commands: ${gt(x)}.`);return}const f=u.commandName,S=bt(f,x);console.error(`Command "${L.exports.strikethrough(f)}" not found.`),i&&S?console.error(`Did you mean "${L.exports.bold(S)}"?`):i||console.error("NOTE: You haven't register any command yet."),process.stderr.write(`
`),process.exit(2)}}})});export{pt as notFoundPlugin};
import{definePlugin as z,NoSuchCommandError as q,NoCommandGivenError as N}from"@clerc/core";import $ from"tty";const B={en:{"utils.and":"%s and %s"},"zh-CN":{"utils.and":"%s \u548C %s"}},Z=(t,{add:e,t:u})=>(e(B),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=$,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",Z(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};
{
"name": "@clerc/plugin-not-found",
"version": "0.28.1",
"version": "0.29.0",
"author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",

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

"picocolors": "^1.0.0",
"@clerc/core": "0.28.1",
"@clerc/utils": "0.28.1"
"@clerc/core": "0.29.0",
"@clerc/utils": "0.29.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