36 lines
72 KiB
JavaScript
36 lines
72 KiB
JavaScript
|
/* eslint-disable */
|
||
|
//prettier-ignore
|
||
|
module.exports = {
|
||
|
name: "@yarnpkg/plugin-outdated",
|
||
|
factory: function (require) {
|
||
|
var plugin=(()=>{var ur=Object.create,_t=Object.defineProperty,hr=Object.defineProperties,pr=Object.getOwnPropertyDescriptor,fr=Object.getOwnPropertyDescriptors,dr=Object.getOwnPropertyNames,xe=Object.getOwnPropertySymbols,gr=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable;var Ee=(e,t,s)=>t in e?_t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,E=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&Ee(e,s,t[s]);if(xe)for(var s of xe(t))mr.call(t,s)&&Ee(e,s,t[s]);return e},k=(e,t)=>hr(e,fr(t)),yr=e=>_t(e,"__esModule",{value:!0});var q=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ar=(e,t)=>{for(var s in t)_t(e,s,{get:t[s],enumerable:!0})},Rr=(e,t,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of dr(t))!Ce.call(e,r)&&r!=="default"&&_t(e,r,{get:()=>t[r],enumerable:!(s=pr(t,r))||s.enumerable});return e},J=e=>Rr(yr(_t(e!=null?ur(gr(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var Nt=M(st=>{"use strict";st.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;st.find=(e,t)=>e.nodes.find(s=>s.type===t);st.exceedsLimit=(e,t,s=1,r)=>r===!1||!st.isInteger(e)||!st.isInteger(t)?!1:(Number(t)-Number(e))/Number(s)>=r;st.escapeNode=(e,t=0,s)=>{let r=e.nodes[t];!r||(s&&r.type===s||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)};st.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0==0?(e.invalid=!0,!0):!1;st.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0==0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;st.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;st.reduce=e=>e.reduce((t,s)=>(s.type==="text"&&t.push(s.value),s.type==="range"&&(s.type="text"),t),[]);st.flatten=(...e)=>{let t=[],s=r=>{for(let i=0;i<r.length;i++){let n=r[i];Array.isArray(n)?s(n,t):n!==void 0&&t.push(n)}return t};return s(e),t}});var Dt=M((tn,$e)=>{"use strict";var Se=Nt();$e.exports=(e,t={})=>{let s=(r,i={})=>{let n=t.escapeInvalid&&Se.isInvalidBrace(i),o=r.invalid===!0&&t.escapeInvalid===!0,a="";if(r.value)return(n||o)&&Se.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(let d of r.nodes)a+=s(d);return a};return s(e)}});var ve=M((en,we)=>{"use strict";we.exports=function(e){return typeof e=="number"?e-e==0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var Me=M((sn,De)=>{"use strict";var Te=ve(),dt=(e,t,s)=>{if(Te(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(Te(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let r=E({relaxZeros:!0},s);typeof r.strictZeros=="boolean"&&(r.relaxZeros=r.strictZeros===!1);let i=String(r.relaxZeros),n=String(r.shorthand),o=String(r.capture),a=String(r.wrap),d=e+":"+t+"="+i+n+o+a;if(dt.cache.hasOwnProperty(d))return dt.cache[d].result;let f=Math.min(e,t),h=Math.max(e,t);if(Math.abs(f-h)===1){let R=e+"|"+t;return r.capture?`(${R})`:r.wrap===!1?R:`(?:${R})`}let g=Ne(e)||Ne(t),l={min:e,max:t,a:f,b:h},_=[],A=[];if(g&&(l.isPadded=g,l.maxLen=String(l.max).length),f<0){let R=h<0?Math.abs(h):1;A=He(R,Math.abs(f),l,r),f=l.a=0}return h>=0&&(_=He(f,h,l,r)),l.negatives=A,l.positives=_,l.result=_r(A,_,r),r.capture===!0?l.result=`(${l.result})`:r.wrap!==!1&&_.length+A.length>1&&(l.result=`(?:${l.result})`),dt.cache[d]=l,l.result};function _r(e,t,s){let r=Vt(e,t,"-",!1,s)||[],i=Vt(t,e,"",!1,s)||[],n=Vt(e,t,"-?",!0,s)||[];return r.concat(n).concat(i).join("|")}function br(e,t){let s=1,r=1,i=Oe(e,s),n=new Set([t]);for(;e<=i&&i<=t;)n.add(i),s+=1,i=Oe(e,s);for(i=ke(t+1,r)-1;e<i&&i<=t;)n.add(i),r+=1,i=ke(t+1,r)-1;return n=[...n],n.sort(Er),n}function xr(e,t,s){if(e===t)return{pattern:e,count:[],digits:0};let r=
|
||
|
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var is=M((ln,rs)=>{"use strict";var Ur=Dt(),{MAX_LENGTH:ts,CHAR_BACKSLASH:te,CHAR_BACKTICK:zr,CHAR_COMMA:Br,CHAR_DOT:jr,CHAR_LEFT_PARENTHESES:Fr,CHAR_RIGHT_PARENTHESES:Wr,CHAR_LEFT_CURLY_BRACE:Gr,CHAR_RIGHT_CURLY_BRACE:qr,CHAR_LEFT_SQUARE_BRACKET:es,CHAR_RIGHT_SQUARE_BRACKET:ss,CHAR_DOUBLE_QUOTE:Kr,CHAR_SINGLE_QUOTE:Qr,CHAR_NO_BREAK_SPACE:Xr,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Vr}=Je(),Zr=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let s=t||{},r=typeof s.maxLength=="number"?Math.min(ts,s.maxLength):ts;if(e.length>r)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${r})`);let i={type:"root",input:e,nodes:[]},n=[i],o=i,a=i,d=0,f=e.length,h=0,g=0,l,_={},A=()=>e[h++],R=x=>{if(x.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&x.type==="text"){a.value+=x.value;return}return o.nodes.push(x),x.parent=o,x.prev=a,a=x,x};for(R({type:"bos"});h<f;)if(o=n[n.length-1],l=A(),!(l===Vr||l===Xr)){if(l===te){R({type:"text",value:(t.keepEscaping?l:"")+A()});continue}if(l===ss){R({type:"text",value:"\\"+l});continue}if(l===es){d++;let x=!0,$;for(;h<f&&($=A());){if(l+=$,$===es){d++;continue}if($===te){l+=A();continue}if($===ss&&(d--,d===0))break}R({type:"text",value:l});continue}if(l===Fr){o=R({type:"paren",nodes:[]}),n.push(o),R({type:"text",value:l});continue}if(l===Wr){if(o.type!=="paren"){R({type:"text",value:l});continue}o=n.pop(),R({type:"text",value:l}),o=n[n.length-1];continue}if(l===Kr||l===Qr||l===zr){let x=l,$;for(t.keepQuotes!==!0&&(l="");h<f&&($=A());){if($===te){l+=$+A();continue}if($===x){t.keepQuotes===!0&&(l+=$);break}l+=$}R({type:"text",value:l});continue}if(l===Gr){g++;let x=a.value&&a.value.slice(-1)==="$"||o.dollar===!0;o=R({type:"brace",open:!0,close:!1,dollar:x,depth:g,commas:0,ranges:0,nodes:[]}),n.push(o),R({type:"open",value:l});continue}if(l===qr){if(o.type!=="brace"){R({type:"text",value:l});continue}let x="close";o=n.pop(),o.close=!0,R({type:x,value:l}),g--,o=n[n.length-1];continue}if(l===Br&&g>0){if(o.ranges>0){o.ranges=0;let x=o.nodes.shift();o.nodes=[x,{type:"text",value:Ur(o)}]}R({type:"comma",value:l}),o.commas++;continue}if(l===jr&&g>0&&o.commas===0){let x=o.nodes;if(g===0||x.length===0){R({type:"text",value:l});continue}if(a.type==="dot"){if(o.range=[],a.value+=l,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){x.pop();let $=x[x.length-1];$.value+=a.value+l,a=$,o.ranges--;continue}R({type:"dot",value:l});continue}R({type:"text",value:l})}do if(o=n.pop(),o.type!=="root"){o.nodes.forEach(H=>{H.nodes||(H.type==="open"&&(H.isOpen=!0),H.type==="close"&&(H.isClose=!0),H.nodes||(H.type="text"),H.invalid=!0)});let x=n[n.length-1],$=x.nodes.indexOf(o);x.nodes.splice($,1,...o.nodes)}while(n.length>0);return R({type:"eos"}),i};rs.exports=Zr});var as=M((cn,os)=>{"use strict";var ns=Dt(),Yr=Qe(),Jr=Ze(),ti=is(),tt=(e,t={})=>{let s=[];if(Array.isArray(e))for(let r of e){let i=tt.create(r,t);Array.isArray(i)?s.push(...i):s.push(i)}else s=[].concat(tt.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(s=[...new Set(s)]),s};tt.parse=(e,t={})=>ti(e,t);tt.stringify=(e,t={})=>typeof e=="string"?ns(tt.parse(e,t),t):ns(e,t);tt.compile=(e,t={})=>(typeof e=="string"&&(e=tt.parse(e,t)),Yr(e,t));tt.expand=(e,t={})=>{typeof e=="string"&&(e=tt.parse(e,t));let s=Jr(e,t);return t.noempty===!0&&(s=s.filter(Boolean)),t.nodupes===!0&&(s=[...new Set(s)]),s};tt.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?tt.compile(e,t):tt.expand(e,t);os.exports=tt});var xt=M((un,ps)=>{"use strict";var ei=q("path"),at="\\\\/",ls=`[^${at}]`,ct="\\.",si="\\+",ri="\\?",Pt="\\/",ii="(?=.)",cs="[^/]",ee=`(?:${Pt}|$)`,us=`(?:^|${Pt})`,se=`${ct}{1,2}${ee}`,ni=`(?!$
|
||
|
`)}writeMarkdown(t,s,r){if(!r.length){this.context.stdout.write(or+`
|
||
|
`);return}new qt("markdown",n=>this.context.stdout.write(n+`
|
||
|
`),t,r,{range:this.includeRange,url:this.includeURL(t),workspace:this.includeWorkspace(s)}).print()}async checkOutdatedDependencies(t,s,r,i,n){let o=null;await n.startTimerPromise("Checking for outdated dependencies",async()=>{let a=r.length,d=P.StreamReport.progressViaCounter(a);n.reportProgress(d),o=await this.getOutdatedDependencies(t,s,i,r,d)}),n.reportSeparator(),o.length?(new qt("text",d=>n.reportInfo(P.MessageName.UNNAMED,d),t,o,{range:this.includeRange,url:this.includeURL(t),workspace:this.includeWorkspace(s)}).print(),n.reportSeparator(),this.printOutdatedCount(n,o.length)):n.reportInfo(P.MessageName.UNNAMED,P.formatUtils.pretty(t,or,"green"))}async loadProject(){let t=await P.Configuration.find(this.context.cwd,this.context.plugins),[s,{project:r,workspace:i}]=await Promise.all([P.Cache.find(t),P.Project.find(t,this.context.cwd)]);if(await r.restoreInstallState(),!i)throw new Kt.WorkspaceRequiredError(r.cwd,this.context.cwd);return{cache:s,configuration:t,project:r,workspace:i}}getWorkspaces(t){let s=this.workspace;return s?s[0]==="."?t.workspaces.filter(r=>r.cwd===this.context.cwd):t.workspaces.filter(r=>{let i=[...s,...s.map(n=>nr.default.join(this.context.cwd,n))];return be.default.some([this.getWorkspaceName(r),r.cwd],i)}):t.workspaces}includeWorkspace(t){return t.workspaces.length>1}get dependencyTypes(){return this.type?[this.type]:_e}getDependencies(t,s){let r=[];for(let n of s){let{anchoredLocator:o,project:a}=n,d=a.storedPackages.get(o.locatorHash);d||this.throw(t,o);for(let f of this.dependencyTypes)for(let h of n.manifest[f].values()){let{range:g}=h;if(g.includes(":")&&!/(npm|patch):/.test(g))continue;let l=d.dependencies.get(h.identHash);l||this.throw(t,h);let _=a.storedResolutions.get(l.descriptorHash);_||this.throw(t,l);let A=a.storedPackages.get(_);A||this.throw(t,l),!n.project.tryWorkspaceByLocator(A)&&(A.reference.includes("github.com")||r.push({dependencyType:f,descriptor:h,name:P.structUtils.stringifyIdent(h),pkg:A,workspace:n}))}}if(!this.patterns.length)return r;let i=r.filter(({name:n})=>be.default.isMatch(n,this.patterns));if(!i.length)throw new V.UsageError(`Pattern ${P.formatUtils.prettyList(t,this.patterns,P.FormatType.CODE)} doesn't match any packages referenced by any workspace`);return i}throw(t,s){let r=P.structUtils.prettyIdent(t,s);throw new Error(`Package for ${r} not found in the project`)}getSeverity(t,s){let r=Qt.default.coerce(t),i=Qt.default.coerce(s);return Qt.default.eq(r,i)?null:r.major===0||i.major>r.major?"major":i.minor>r.minor?"minor":"patch"}async getOutdatedDependencies(t,s,r,i,n){let o=i.map(async({dependencyType:a,descriptor:d,name:f,pkg:h,workspace:g})=>{let{latest:l,range:_,url:A}=await r.fetch({descriptor:d,includeRange:this.includeRange,includeURL:this.includeURL(t),pkg:h});if(n==null||n.tick(),tr(h.version,l))return{current:h.version,latest:l,name:f,range:_,severity:{latest:this.getSeverity(h.version,l),range:_?this.getSeverity(h.version,_):null},type:a,url:A,workspace:this.includeWorkspace(s)?this.getWorkspaceName(g):void 0}});return(await Promise.all(o)).filter(Ys).filter(a=>{var d,f;return(f=(d=this.severity)==null?void 0:d.includes(a.severity.latest))!=null?f:!0}).sort((a,d)=>a.name.localeCompare(d.name))}getWorkspaceName(t){return t.manifest.name?P.structUtils.stringifyIdent(t.manifest.name):t.computeCandidateName()}printOutdatedCount(t,s){let r=[P.MessageName.UNNAMED,s===1?"1 dependency is out of date":`${s} dependencies are out of date`];this.check?t.reportError(...r):t.reportWarning(...r)}};Ht.paths=[["outdated"]],Ht.usage=V.Command.Usage({description:"view outdated dependencies",details:`
|
||
|
This command finds outdated dependencies in a project and prints the result in a table or JSON format.
|
||
|
|
||
|
This command accepts glob patterns as arguments to filter the output. Make sure to escape the patterns, to prevent your own shell from trying to expand them.
|
||
|
`,examples:[["View outdated dependencies","yarn outdated"],["View outdated dependencies with the `@babel` scope","yarn outdated '@babel/*'"],["Filter results to only include devDependencies","yarn outdated --type devDependencies"],["Filter results to only include major version updates","yarn outdated --severity major"]]});var Xi={commands:[Ht],configuration:{outdatedIncludeUrl:{default:!1,description:"If true, the outdated command will include the package homepage URL by default",type:ar.SettingsType.BOOLEAN}}},Vi=Xi;return Zi;})();
|
||
|
/*!
|
||
|
* fill-range <https://github.com/jonschlinkert/fill-range>
|
||
|
*
|
||
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
||
|
* Licensed under the MIT License.
|
||
|
*/
|
||
|
/*!
|
||
|
* is-number <https://github.com/jonschlinkert/is-number>
|
||
|
*
|
||
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
||
|
* Released under the MIT License.
|
||
|
*/
|
||
|
/*!
|
||
|
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
||
|
*
|
||
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
||
|
* Released under the MIT License.
|
||
|
*/
|
||
|
return plugin;
|
||
|
}
|
||
|
};
|