@baicie/ncu 0.1.15 → 0.1.16

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.
@@ -0,0 +1,374 @@
1
+ import e from"path";import t from"prompts-ncu";import n from"spawn-please";import r from"fs";import i from"os";import a from"cli-table3";import o from"fs/promises";import s from"hosted-git-info";import{URL as c}from"url";import l from"parse-github-url";import*as u from"semver";import d,{intersects as f,minVersion as p,satisfies as m,valid as h,validRange as g}from"semver";import _,{parse as v,parseRange as y}from"semver-utils";import b from"util";import x from"camelcase";import S from"fast-memoize";import C from"ini";import w from"npm-registry-fetch";import T from"untildify";import{findUp as E,findUpSync as ee}from"find-up";import te from"node:fs";import D from"node:os";import O from"node:path";import k from"js-yaml";import A from"jsonlines";import{text as ne}from"node:stream/consumers";import re from"fast-glob";import ie from"picomatch";import{rcFile as ae}from"rc-config-loader";import{dequal as oe}from"dequal";import se from"node:child_process";import{promisify as ce}from"node:util";import{and as le,or as ue}from"fp-and-or";import de from"p-map";import fe from"progress";import{ParseErrorCode as pe,parse as me,stripComments as he}from"jsonc-parser";var ge=Object.create,_e=Object.defineProperty,ve=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyNames,be=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty,j=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),M=(e,t)=>{let n={};for(var r in e)_e(n,r,{get:e[r],enumerable:!0});return t&&_e(n,Symbol.toStringTag,{value:`Module`}),n},Se=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ye(t),a=0,o=i.length,s;a<o;a++)s=i[a],!xe.call(e,s)&&s!==n&&_e(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ve(t,s))||r.enumerable});return e},Ce=(e,t,n)=>(n=e==null?{}:ge(be(e)),Se(t||!e||!e.__esModule?_e(n,`default`,{value:e,enumerable:!0}):n,e)),we=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function.")}),Te=`0.1.16`,Ee=`https://github.com/raineorshine/npm-check-updates`,De={url:`https://github.com/raineorshine/npm-check-updates/issues`},Oe={name:`@baicie/ncu`,version:Te,author:`Tomas Junnonen <tomas1@gmail.com>`,license:`Apache-2.0`,type:`module`,contributors:[`Raine Revere (https://github.com/raineorshine)`,`Imamuzzaki Abu Salam <imamuzzaki@gmail.com>`],description:`Find newer versions of dependencies than what your package.json allows`,keywords:[`dependencies`,`npm`,`package.json`,`update`,`upgrade`,`versions`],engines:{node:`>=20.0.0`,npm:`>=8.12.1`},main:`build/index.js`,types:`build/index.d.ts`,scripts:{dev:`rolldown --watch -c`,build:`rimraf build && npm run build:options && rolldown -m -c`,"build:options":`vite-node src/scripts/build-options.ts`,"build:analyze":`rimraf build && npm run build:options && ANALYZER=true vite build`,lint:`cross-env FORCE_COLOR=1 npm-run-all --parallel --aggregate-output lint:*`,"lint:lockfile":`lockfile-lint`,"lint:markdown":`markdownlint "**/*.md" --ignore "**/node_modules/**/*.md" --ignore build --config .markdownlint.cjs`,"lint:src":`eslint --cache`,prepublishOnly:`npm run build`,prettier:`prettier . --check`,"prettier:fix":`prettier . --write`,test:`npm run test:unit && npm run test:e2e`,"test:bun":`test/bun-install.sh && mocha test/bun`,"test:unit":`mocha test test/package-managers/*`,"test:e2e":`./test/e2e.sh`,ncu:`node build/cli.js`,release:`tsx scripts/release.ts`,"ci-publish":`tsx scripts/publish.ts`},bin:{"npm-check-updates":`build/cli.js`,ncu:`build/cli.js`},repository:{type:`git`,url:`git+https://github.com/raineorshine/npm-check-updates.git`},homepage:Ee,bugs:De,overrides:{ip:`2.0.1`,jsonparse:`https://github.com/ARitz-Cracker/jsonparse/tree/patch-1`,"@yarnpkg/parsers":`2.6.0`},dependencies:{camelcase:`^9.0.0`,"cli-table3":`^0.6.5`,commander:`^14.0.2`,dequal:`^2.0.3`,"fast-glob":`^3.3.3`,"fast-memoize":`^2.5.2`,"find-up":`8.0.0`,"fp-and-or":`^1.0.2`,"hosted-git-info":`^9.0.2`,ini:`^6.0.0`,"js-yaml":`^4.1.1`,"jsonc-parser":`^3.3.1`,jsonlines:`^0.1.1`,lodash:`^4.17.21`,"npm-registry-fetch":`^19.1.1`,"p-map":`^7.0.4`,"parse-github-url":`^1.0.3`,picomatch:`^4.0.3`,progress:`^2.0.3`,"prompts-ncu":`^3.0.2`,"rc-config-loader":`^4.1.3`,rfdc:`^1.4.1`,semver:`^7.7.3`,"semver-utils":`^1.1.4`,"spawn-please":`^3.0.0`,untildify:`^6.0.0`,"update-notifier":`^7.3.1`},devDependencies:{"@baicie/release":`^0.1.11`,"@eslint/js":`^9.39.2`,"@trivago/prettier-plugin-sort-imports":`^6.0.0`,"@types/bun":`^1.3.5`,"@types/chai":`^5.2.3`,"@types/chai-as-promised":`^8.0.2`,"@types/chai-string":`^1.4.5`,"@types/cli-table":`^0.3.4`,"@types/hosted-git-info":`^3.0.5`,"@types/ini":`^4.1.1`,"@types/js-yaml":`^4.0.9`,"@types/jsonlines":`^0.1.5`,"@types/lodash":`^4.17.21`,"@types/mocha":`^10.0.10`,"@types/node":`^25.0.3`,"@types/npm-registry-fetch":`^8.0.9`,"@types/parse-github-url":`^1.0.3`,"@types/picomatch":`^4.0.2`,"@types/progress":`^2.0.7`,"@types/prompts":`^2.4.9`,"@types/semver":`^7.7.1`,"@types/semver-utils":`^1.1.3`,"@types/sinon":`^21.0.0`,"@types/update-notifier":`^6.0.8`,"@typescript-eslint/eslint-plugin":`^8.51.0`,"@typescript-eslint/parser":`^8.51.0`,chai:`^6.2.2`,"chai-as-promised":`^8.0.2`,"chai-string":`^1.6.0`,chalk:`^5.6.2`,"cross-env":`^10.1.0`,eslint:`^9.39.2`,"eslint-config-prettier":`^10.1.8`,"eslint-config-raine":`^0.5.0`,"eslint-config-standard":`^17.1.0`,"eslint-plugin-import":`^2.32.0`,"eslint-plugin-jsdoc":`^61.5.0`,"eslint-plugin-n":`^17.23.1`,"eslint-plugin-promise":`^7.2.1`,"lockfile-lint":`^4.14.1`,"markdownlint-cli":`^0.47.0`,mocha:`^11.7.5`,"npm-run-all":`^4.1.5`,prettier:`^3.7.4`,rimraf:`^6.1.2`,rolldown:`1.0.0-beta.57`,"rolldown-plugin-dts":`^0.20.0`,"rollup-plugin-node-externals":`^8.1.2`,"rollup-plugin-visualizer":`^6.0.5`,should:`^13.2.3`,sinon:`^21.0.1`,"source-map-support":`^0.5.21`,"strip-ansi":`^7.1.2`,"ts-node":`^10.9.2`,tsx:`^4.21.0`,typescript:`^5.9.3`,"typescript-eslint":`^8.51.0`,"typescript-json-schema":`^0.67.1`,verdaccio:`^6.2.4`,vite:`^7.3.0`,"vite-bundle-analyzer":`^1.3.2`,"vite-node":`^5.2.0`,"vite-plugin-dts":`^4.5.4`,yarn:`^1.22.22`},files:[`build`,`!**/test/**`],"lockfile-lint":{"allowed-schemes":[`https:`,`git+ssh:`],"allowed-hosts":[`npm`,`github.com`],"empty-hostname":!1,type:`npm `,path:`package-lock.json`},mocha:{"check-leaks":!0,extension:[`test.ts`],require:[`source-map-support/register`,`ts-node/register`],timeout:6e4,"trace-deprecation":!0,"trace-warnings":!0,use_strict:!0},packageManager:`pnpm@10.27.0`,publishConfig:{access:`public`,registry:`https://registry.npmjs.org/`}};function N(e,t,n={}){let r=Array.isArray(e);return t||=(e=>({[e]:!0})),Object.entries(e||{}).forEach(([e,i],a)=>{let o=r?t(i,a,n):t(e,i,n);Object.entries(o||{}).forEach(e=>{n[e[0]]=e[1]})}),n}var P=N;const ke={blue:!0,bold:!0,cyan:!0,gray:!0,green:!0,magenta:!0,red:!0,yellow:!0},Ae=P(ke,e=>({[e]:e=>e.toString()}));let je;const Me=async e=>{let{default:t,Chalk:n}=await import(`./source.js`);je=e===!0?new n({level:1}):e===null?Ae:t},Ne=()=>{if(!je)throw Error(`Chalk has not been imported yet. Chalk is a dynamic import and requires that you await { chalkInit } from './lib/chalk'.`)};var F=P(ke,e=>{let t=t=>(Ne(),je[e].bold(t)),n=t=>(Ne(),je[e](t));return n.bold=t,{[e]:n}}),I=(e,t)=>P(e,(e,n)=>t(e,n)?{[e]:n}:null),Pe=e=>o.stat(e).then(()=>!0,()=>!1);async function Fe(t,{pkgFile:n}={}){let r=we.resolve.paths(t)||[],i=n?[e.join(e.dirname(n),`node_modules`)]:[],a=[e.join(process.cwd(),`node_modules`)],s=[...i,...a,...r];for(let n of s){let r=e.join(n,t,`package.json`);if(await Pe(r))try{return JSON.parse(await o.readFile(r,`utf-8`))}catch{}}return null}var Ie=Fe;async function Le(e,t,{pkgFile:n}={}){return t?t.version:(await Ie(e,{pkgFile:n}))?.version??null}var Re=Le;async function ze(e,{pkgFile:t}={}){return(await Ie(e,{pkgFile:t}))?.repository??null}async function Be(e,t,{pkgFile:n}={}){let r=t?t.repository?t.repository:null:await ze(e,{pkgFile:n});if(!r)return null;let i,a=``;if(typeof r==`string`){i=r;try{let e=new c(i);if(e.protocol===`https:`||e.protocol===`http:`)return i}catch{}}else typeof r.url==`string`&&(i=r.url,typeof r.directory==`string`&&(a=r.directory));if(typeof i==`string`&&typeof a==`string`){let e=s.fromUrl(i)?.browse(a);return e===void 0?i:e.replace(/\/$/,``).replace(/\/tree\/HEAD$/,``)}return null}var Ve=Be,L=j(((e,t)=>{t.exports=Array.isArray})),He=j(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),R=j(((e,t)=>{var n=He(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),Ue=j(((e,t)=>{t.exports=R().Symbol})),We=j(((e,t)=>{var n=Ue(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),Ge=j(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),Ke=j(((e,t)=>{var n=Ue(),r=We(),i=Ge(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),qe=j(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),Je=j(((e,t)=>{var n=Ke(),r=qe(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),Ye=j(((e,t)=>{var n=L(),r=Je(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Xe=j(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),Ze=j(((e,t)=>{var n=Ke(),r=Xe(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),Qe=j(((e,t)=>{t.exports=R()[`__core-js_shared__`]})),$e=j(((e,t)=>{var n=Qe(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),et=j(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),tt=j(((e,t)=>{var n=Ze(),r=$e(),i=Xe(),a=et(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),nt=j(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),rt=j(((e,t)=>{var n=tt(),r=nt();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),it=j(((e,t)=>{t.exports=rt()(Object,`create`)})),at=j(((e,t)=>{var n=it();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),ot=j(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}t.exports=n})),st=j(((e,t)=>{var n=it(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),ct=j(((e,t)=>{var n=it(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),lt=j(((e,t)=>{var n=it(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=n&&t===void 0?r:t,this}t.exports=i})),ut=j(((e,t)=>{var n=at(),r=ot(),i=st(),a=ct(),o=lt();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),dt=j(((e,t)=>{function n(){this.__data__=[],this.size=0}t.exports=n})),ft=j(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),pt=j(((e,t)=>{var n=ft();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),mt=j(((e,t)=>{var n=pt(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),ht=j(((e,t)=>{var n=pt();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),gt=j(((e,t)=>{var n=pt();function r(e){return n(this.__data__,e)>-1}t.exports=r})),_t=j(((e,t)=>{var n=pt();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),vt=j(((e,t)=>{var n=dt(),r=mt(),i=ht(),a=gt(),o=_t();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),yt=j(((e,t)=>{t.exports=rt()(R(),`Map`)})),bt=j(((e,t)=>{var n=ut(),r=vt(),i=yt();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),xt=j(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),St=j(((e,t)=>{var n=xt();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),Ct=j(((e,t)=>{var n=St();function r(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}t.exports=r})),wt=j(((e,t)=>{var n=St();function r(e){return n(this,e).get(e)}t.exports=r})),Tt=j(((e,t)=>{var n=St();function r(e){return n(this,e).has(e)}t.exports=r})),Et=j(((e,t)=>{var n=St();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),Dt=j(((e,t)=>{var n=bt(),r=Ct(),i=wt(),a=Tt(),o=Et();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Ot=j(((e,t)=>{var n=Dt(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),kt=j(((e,t)=>{var n=Ot(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),At=j(((e,t)=>{var n=kt(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),jt=j(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),Mt=j(((e,t)=>{var n=Ue(),r=jt(),i=L(),a=Je(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),Nt=j(((e,t)=>{var n=Mt();function r(e){return e==null?``:n(e)}t.exports=r})),Pt=j(((e,t)=>{var n=L(),r=Ye(),i=At(),a=Nt();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),Ft=j(((e,t)=>{var n=Je(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),It=j(((e,t)=>{var n=Pt(),r=Ft();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),Lt=j(((e,t)=>{var n=It();function r(e){return function(t){return e==null?void 0:n(e,t)}}t.exports=r}));function Rt(e,t){return e?e.map(e=>({item:e,key:t(e)})).sort((e,t)=>e.key>t.key?1:e.key<t.key?-1:0).map(({item:e})=>e):[]}var zt=Ce(Lt(),1);const Bt=[`major`,`minor`,`patch`],Vt=[`release`,`build`],z=[...Bt,...Vt],Ht={major:``,minor:`.`,patch:`.`,release:`-`,build:`+`},Ut=[`^`,`~`,`.*`,`.x`],Wt=RegExp(`^(${[`^`,`~`,`^*`,`*`,`x`,`x.x`,`x.x.x`].join(`|`).replace(/\^/g,`\\^`).replace(/\*/g,`\\*`)})$`),Gt=/^npm:(.*)@(.*)/;function Kt(e){let[t]=_.parseRange(e);if(!t)throw Error(b.format(`semverutils.parseRange returned null when trying to parse "%s". This is probably a problem with the "semver-utils" dependency. Please report an issue at https://github.com/raineorshine/npm-check-updates/issues.`,e));return z.reduce((e,n)=>t[n]?e+1:e,0)}function B(e,t){return(t?z.slice(0,z.indexOf(t)+1):z).filter(n=>t&&Bt.includes(t)||e[n]).map(t=>Ht[t]+(e[t]||`0`)).join(``)}function qt(e){let[t]=_.parseRange(e);return z.slice().reverse().find((0,zt.default)(t))}function Jt(e,t){let[n]=_.parseRange(e);return B(n,t)}function Yt(e,t){return t===`^`||t===`~`?t+e:Jt(e,`major`)+t}function Xt(e){return Wt.test(e)}function Zt(e){return e===`*`||e===`x`}function Qt(e,t){if(e===t)return`none`;/^[~^]/.test(t)&&t[0]===e[0]&&(t=t.slice(1),e=e.slice(1));let n=t.split(`.`),r=e.split(`.`),i=n.findIndex((e,t)=>e!==r[t]);return i=i>=0?i:n.length,n[0]===`0`?`majorVersionZero`:i===0?`major`:i===1?`minor`:`patch`}function $t(e,t,n){let r=N(e,(r,i,a)=>{let o=t[r],s=Qt(o,i),c=n.groupFunction?.(r,s,y(o),y(i),v(e[r]))??s;return c===`none`?a:{...a,[c]:{...a[c],[r]:i}}}),i={patch:F.green(F.bold(`Patch`)+` Backwards-compatible bug fixes`),minor:F.cyan(F.bold(`Minor`)+` Backwards-compatible features`),major:F.red(F.bold(`Major`)+` Potentially breaking API changes`),majorVersionZero:F.magenta(F.bold(`Major version zero`)+` Anything may change`)};return Array.from(new Set([`patch`,`minor`,`major`,`majorVersionZero`,...Object.keys(r).sort()])).filter(e=>e in r).map(e=>({groupName:e,heading:e in i?i[e]:e,packages:r[e]}))}function en(e,t){let n=``;/^[~^]/.test(t)&&t[0]===e[0]&&(n=t[0],t=t.slice(1),e=e.slice(1));let r=t.split(`.`),i=e.split(`.`),a=r.findIndex((e,t)=>e!==i[t]);a=a>=0?a:r.length;let o=a===0||r[0]===`0`?`red`:a===1?`cyan`:`green`,s=a>0&&a<r.length?`.`:``;return n+r.slice(0,a).join(`.`)+s+F[o](r.slice(a).join(`.`))}const tn=e=>{let t=d.prerelease(e);return t&&t.slice(0,-1).join(`.`)};function nn(e,t){let n=tn(e),r=tn(t);return typeof n!=`string`||typeof r!=`string`||n===r}function rn(e,t){return(d.valid(e)&&d.valid(t)?d.gt(e,t):e>t)?1:e===t?0:-1}function an(e,t,n){if(!d.validRange(t))return null;let r=d.minVersion(t);return[...e].sort(rn).filter(e=>{let t=d.parse(e);return t&&(n===`major`||t.major===r?.major)&&(n===`major`||n===`minor`||t.minor===r?.minor)}).at(-1)||null}function on(e){return qt(e)===`release`}const sn=e=>/^[vV]?\d+$/.test(e),cn=e=>/^[vV]?\d+\.\d+$/.test(e),ln=e=>e.replace(/^[vV]/,``),un=e=>sn(e)?e+`.0.0`:e,dn=e=>cn(e)?e+`.0`:e,fn=e=>dn(un(ln(e)));function pn(e){return e&&(e[0]===`v`||e[1]===`v`)?`v`:``}const mn=(e,t)=>`npm:${e}@${t}`,hn=e=>{let t=e&&e.match&&e.match(Gt);return t&&t.slice(1)},gn=e=>e&&!!e.match(Gt),_n=(e,t)=>{let n=hn(e);return n?mn(n[0],t):null},vn=e=>{if(!e)return!1;let t=null;try{t=l(e)}catch{}if(!t||!t.branch)return!1;let n=decodeURIComponent(t.branch).replace(/^semver:/,``);return!!d.validRange(n)},yn=e=>{if(!e)return null;let t=l(e);if(!t||!t.branch)return null;let n=decodeURIComponent(t.branch).replace(/^semver:/,``);return t&&t.branch&&d.validRange(n)?n:null};function bn(e,t,n={}){if(n.wildcard=n.wildcard||`^`,!t)return e;let[r]=_.parseRange(t);if(!r)return e;if(n.removeRange)return t;if(Xt(e))return e;let i=Rt(_.parseRange(e).filter(e=>e.operator!==`||`&&e.operator!==`-`),e=>Kt(B(e))),[a]=i;function o(e){return(Zt(a[e])?a[e]:Bt.includes(e)&&a[e]||Vt.includes(e)?r[e]:null)||null}let s=B(N(z,e=>({[e]:o(e)}))),c=pn(a.semver)+s,l=Array.from(new Set(i.map(e=>e.operator))),u=l[0]||``,d=Ut.some(e=>s.includes(e)),f=l[0]===`<`||l[0]===`<=`,p=l[0]===`>`,m=l.length>1;return!d&&(f||m)?Yt(c,n.wildcard):(p?`>=`:u)+c}const xn=(e,t)=>{let n=pn(e),r=n?n+t:t;return r=sn(e)?r.slice(0,r.length-4):r,r=cn(e)?r.slice(0,r.length-2):r,r},Sn=(e,t)=>{let n=fn(t),r=l(e);if(!r)return e;let i=decodeURIComponent(r.branch).replace(/^semver:/,``);return e.replace(i,bn(i,xn(i,n)))},Cn={silent:0,error:1,minimal:2,warn:3,info:4,verbose:5,silly:6},wn=e=>!e.startsWith(`file:`)&&!e.startsWith(`link:`)&&!e.startsWith(`workspace:`)&&!/^[^/:@]+\/\w+/.test(e);function V(e,t,n=null,r=`log`){!e.json&&e.loglevel!==`silent`&&(n==null||Cn[e.loglevel??`warn`]>=Cn[n])&&console[r](t)}function Tn(e,t){e.loglevel!==`silent`&&console.log(JSON.stringify(t,null,2))}function En(e,t){console.log(Object.keys(e).map(t=>t+`@`+e[t]).join(t))}function H(e,t,n){V(e,Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}),n)}function Dn(e){let t=new a({colAligns:[`left`,`right`,`right`,`right`,`left`,`left`],chars:{top:``,"top-mid":``,"top-left":``,"top-right":``,bottom:``,"bottom-mid":``,"bottom-left":``,"bottom-right":``,left:``,"left-mid":``,mid:``,"mid-mid":``,right:``,"right-mid":``,middle:``}});return t.push(...e),t.toString().split(`
2
+ `).map(e=>e.trimEnd()).join(`
3
+ `)}function On(e){return vn(e)?yn(e):gn(e)?hn(e)[1]:e}async function kn({from:e,to:t,format:n,ownersChangedDeps:r,pkgFile:i,time:a}){let s=n?.includes(`dep`)&&i?JSON.parse(await o.readFile(i,`utf-8`)):null;return Dn(await Promise.all(Object.keys(t).sort().map(async o=>{let c=(n?.includes(`installedVersion`)?await Re(o,void 0,{pkgFile:i}):e[o])||``,l=o in(s?.devDependencies??{})?`dev`:o in(s?.peerDependencies??{})?`peer`:o in(s?.optionalDependencies??{})?`optional`:``,u=On(t[o]||``),d=r?o in r?r[o]?`*owner changed*`:``:`*unknown*`:``,f=en(On(c),u),p=n?.includes(`repo`)&&await Ve(o,void 0,{pkgFile:i})||``,m=n?.includes(`time`)&&a?.[o]?a[o]:``;return[o,...n?.includes(`dep`)?[l?F.gray(l):``]:[],c,`→`,f,d,...[p,m].filter(e=>e)]})))}async function An({current:e,upgraded:t,ownersChangedDeps:n,pkgFile:r,time:i},a){if(a.format?.includes(`group`)){let o=$t(t,e,a);for(let{heading:t,packages:s}of o)V(a,`
4
+ `+t),V(a,await kn({from:e,to:s,format:a.format,ownersChangedDeps:n,pkgFile:r,time:i}))}else a.format?.includes(`lines`)?En(t,`
5
+ `):V(a,await kn({from:e,to:t,format:a.format,ownersChangedDeps:n,pkgFile:r,time:i}))}function jn(e,t){if(t&&Object.keys(t).length>0){let n=new a({colAligns:[`left`,`right`,`right`,`right`,`left`,`left`],chars:{top:``,"top-mid":``,"top-left":``,"top-right":``,bottom:``,"bottom-mid":``,"bottom-left":``,"bottom-right":``,left:``,"left-mid":``,mid:``,"mid-mid":``,right:``,"right-mid":``,middle:``}});n.push(...Object.entries(t).map(([e,t])=>[e,F.yellow(t)])),V(e,`
6
+ `+n.toString())}}async function Mn(e,{current:t,latest:n,upgraded:r,total:i,ownersChangedDeps:a,pkgFile:o,time:s,errors:c}){e.format?.includes(`group`)||V(e,``);let l=F.green.bold(`:)`),u=Object.keys(c||{}).length,d=typeof e.target==`string`?e.target:`target`,f=Object.keys(r).length;f===0&&i===0&&u===0?Object.keys(t).length===0?V(e,`No dependencies.`):n&&Object.keys(n).length===0&&Object.values(I(t,(e,t)=>wn(t))).length>0?V(e,`No package versions were returned. This may be a problem with your installed ${e.packageManager}, the npm registry, or your Internet connection. Make sure ${F.cyan(`npx pacote packument ncu-test-v2`)} is working before reporting an issue.`):e.global?V(e,`All global packages are up-to-date ${l}`):V(e,`All dependencies match the ${d} package versions ${l}`):f===0&&i>0?V(e,`No dependencies upgraded ${l}`):f>0&&await An({current:t,upgraded:r,ownersChangedDeps:a,pkgFile:o,time:s},e),jn(e,c)}function Nn(e,t){V(e,`
7
+ Ignored incompatible updates (peer dependencies):
8
+ `),V(e,Dn(Object.entries(t).map(([e,{from:t,to:n,reason:r}])=>{let i=`reason: `+Object.entries(r).map(([e,t])=>e+` requires `+t).join(`, `);return[e,t,`→`,en(t,n),i]})))}function Pn(e,t){V(e,`
9
+ Ignored incompatible updates (engines node):
10
+ `),V(e,Dn(Object.entries(t).map(([e,{from:t,to:n,enginesNode:r}])=>[e,t,`→`,en(t,n),`reason: requires node ${r}`])))}function Fn(e,t=10){return typeof e.timestamp==`number`?e.timestamp+60*1e3*t<Date.now():!1}const In=`.ncu-cache.json`,Ln=`~/${In}`,Rn=e.join(i.homedir(),In);function zn(e){return e===Ln?Rn:e}async function Bn(e){e.cacheFile&&await r.promises.rm(zn(e.cacheFile),{force:!0})}async function Vn(e){if(!e.cache||!e.cacheFile)return;let t=zn(e.cacheFile),n={},i=new Set;try{n=JSON.parse(await r.promises.readFile(t,`utf-8`)),Fn(n,e.cacheExpiration)&&(r.promises.rm(t,{force:!0}),n={})}catch{}return typeof n.timestamp!=`number`&&(n.timestamp=Date.now()),n.packages||={},n.peers||={},{get:(e,t)=>{if(!n.packages)return;let r=`${e}___${t}`,a=n.packages[r];return a&&!r.includes(a)&&i.add(e),a},set:(e,t,r)=>{if(!n.packages)return;let i=`${e}___${t}`;n.packages[i]=r},getPeers:(e,t)=>{if(!n.peers)return;let r=`${e}___${t}`,a=n.peers[r];return a&&i.add(e),a},setPeers:(e,t,r)=>{let i=`${e}___${t}`;n.peers&&(n.peers[i]=r)},save:async()=>{await r.promises.writeFile(t,JSON.stringify(n))},log:t=>{let n=i.size;n!==0&&(V(e,`\nUsing ${n} cached package ${t?`peer`:`version`}${n>1?`s`:``}`,`warn`),V(e,i,`verbose`),i.clear())}}}var Hn=(e,t=92)=>{let n=e.split(`
11
+ `),r=[];return n.forEach(e=>{let n=0;if(e.length===0){r.push(``);return}for(;n<e.length;){let i=e.slice(n,n+t+1),a=i.trimEnd();if(a.length<=t){r.push(a);break}let o=i.split(``).reverse().join(``).match(/[ -][^\W]/)?.index||0,s=i.slice(0,i.length-o);if(s.length===0)break;r.push(s.trimEnd()),n+=s.length}n=0}),r.join(`
12
+ `).trim()};const Un=e=>e.map(([e,t])=>[e,Hn(t)]),Wn=e=>`
13
+ <tr>`+e.map(e=>`<td>${e}</td>`).join(``)+`</tr>`;var U=({colAligns:e,markdown:t,rows:n})=>{if(t)return`<table>${n.map(Wn).join(``)}\n</table>`;{let r=new a({...e?{colAligns:e}:null});return r.push(...t?n:Un(n)),r.toString()}};const Gn=[`latest`,`newest`,`greatest`,`minor`,`patch`,`semver`],W=(e,t)=>e.split(`
14
+ `).map(e=>`${``.padStart(t,` `)}${e}`).join(`
15
+ `),G=(e,{markdown:t}={})=>`${t?"```js\n":``}${W(e,t?0:4)}${t?"\n```":``}`,Kn=e=>e.replace(/`/g,``),qn=(e,{markdown:t}={})=>{let n=``;if(e.cli!==!1&&(n=`Usage:
16
+
17
+ ncu --${e.long}${e.arg?` [${e.arg}]`:``}${e.long===`doctor`?` -u`:``}\n`),e.type===`boolean`&&(n+=` ncu --no-${e.long}\n`),e.short&&(n+=` ncu -${e.short}${e.arg?` [${e.arg}]`:``}${e.long===`doctor`?`u`:``}\n`),e.default!==void 0&&!(Array.isArray(e.default)&&e.default.length===0)&&(n+=`\nDefault: ${e.default}\n`),e.help){let r=typeof e.help==`function`?t?e.help({markdown:t}):Kn(e.help({markdown:t})):e.help;n+=`\n${r.trim()}\n\n`}else if(e.description){let r=t?e.description:Kn(e.description);n+=`\n${r.replace(/`/g,``)}\n`}return n.trim()},Jn=[{long:`cache`,description:`Cache versions to a local cache file. Default \`--cacheFile\` is ${Ln} and default \`--cacheExpiration\` is 10 minutes.`,type:`boolean`},{long:`cacheClear`,description:"Clear the default cache, or the cache file specified by `--cacheFile`.",type:`boolean`},{long:`cacheExpiration`,arg:`min`,description:"Cache expiration in minutes. Only works with `--cache`.",parse:e=>parseInt(e,10),default:10,type:`number`},{long:`cacheFile`,arg:`path`,description:"Filepath for the cache file. Only works with `--cache`.",parse:t=>e.isAbsolute(t)?t:e.join(process.cwd(),t),default:Ln,type:`string`},{long:`color`,description:`Force color in terminal.`,type:`boolean`},{long:`concurrency`,arg:`n`,description:`Max number of concurrent HTTP requests to registry.`,parse:e=>parseInt(e,10),default:8,type:`number`},{long:`configFileName`,arg:`s`,description:`Config file name. (default: .ncurc.{json,yml,js,cjs})`,type:`string`},{long:`configFilePath`,arg:`path`,description:"Directory of .ncurc config file. (default: directory of `packageFile`)",type:`string`},{long:`cwd`,arg:`path`,description:`Working directory in which npm will be executed.`,type:`string`},{long:`deep`,description:"Run recursively in current working directory. Alias of (`--packageFile '**/package.json'`).",type:`boolean`},{long:`ignoreDirs`,arg:`dirs`,description:`Ignore directories containing package.json files (comma-delimited).`,type:`string | readonly string[]`,parse:e=>e&&typeof e==`string`?e.split(`,`):e},{long:`dep`,arg:`value`,description:`Check one or more sections of dependencies only: dev, optional, peer, prod, or packageManager (comma-delimited).`,default:[`prod`,`dev`,`optional`,`packageManager`],parse:e=>e&&typeof e==`string`?e.split(`,`):e,type:`string | readonly string[]`},{long:`deprecated`,default:!0,description:"Include deprecated packages. Use `--no-deprecated` to exclude deprecated packages (20–25% slower).",type:`boolean`},{long:`doctor`,short:`d`,description:"Iteratively installs upgrades and runs tests to identify breaking upgrades. Requires `-u` to execute.",type:`boolean`,help:({markdown:e})=>`Iteratively installs upgrades and runs your project's tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.
18
+
19
+ ${F.yellow("Requires `-u` to execute")} (modifies your package file, lock file, and node_modules)
20
+
21
+ To be more precise:
22
+
23
+ 1. Runs \`npm install\` and \`npm test\` to ensure tests are currently passing.
24
+ 2. Runs \`ncu -u\` to optimistically upgrade all dependencies.
25
+ 3. If tests pass, hurray!
26
+ 4. If tests fail, restores package file and lock file.
27
+ 5. For each dependency, install upgrade and run tests.
28
+ 6. Prints broken upgrades with test error.
29
+ 7. Saves working upgrades to package.json.
30
+
31
+ Additional options:
32
+
33
+ ${U({markdown:e,rows:[[F.cyan(`--doctorInstall`),"specify a custom install script (default: `npm install` or `yarn`)"],[F.cyan(`--doctorTest`),"specify a custom test script (default: `npm test`)"]]})}
34
+
35
+ Example:
36
+
37
+ $ ncu --doctor -u
38
+ Running tests before upgrading
39
+ npm install
40
+ npm run test
41
+ Upgrading all dependencies and re-running tests
42
+ ncu -u
43
+ npm install
44
+ npm run test
45
+ Tests failed
46
+ Identifying broken dependencies
47
+ npm install
48
+ npm install --no-save react@16.0.0
49
+ npm run test
50
+ ✓ react 15.0.0 → 16.0.0
51
+ npm install --no-save react-redux@7.0.0
52
+ npm run test
53
+ ✗ react-redux 6.0.0 → 7.0.0
54
+
55
+ /projects/myproject/test.js:13
56
+ throw new Error('Test failed!')
57
+ ^
58
+
59
+ npm install --no-save react-dnd@11.1.3
60
+ npm run test
61
+ ✓ react-dnd 10.0.0 → 11.1.3
62
+ Saving partially upgraded package.json
63
+ `},{long:`doctorInstall`,arg:`command`,description:"Specifies the install script to use in doctor mode. (default: `npm install` or the equivalent for your package manager)",type:`string`},{long:`doctorTest`,arg:`command`,description:"Specifies the test script to use in doctor mode. (default: `npm test`)",type:`string`},{long:`enginesNode`,description:`Include only packages that satisfy engines.node as specified in the package file.`,type:`boolean`},{long:`errorLevel`,short:`e`,arg:`n`,description:`Set the error level. 1: exits with error code 0 if no errors occur. 2: exits with error code 0 if no packages need updating (useful for continuous integration).`,parse:e=>parseInt(e,10),default:1,type:`number`},{long:`filter`,short:`f`,arg:`p`,description:`Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.`,type:`string | RegExp | readonly (string | RegExp)[] | FilterFunction`,parse:(e,t)=>[...t||[],e],help:({markdown:e})=>{let t=t=>e?`\`${t}\``:t;return`Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Only included packages will be checked with ${t(`--peer`)}.
64
+
65
+ ${t(`--filter`)} runs _before_ new versions are fetched, in contrast to ${t(`--filterResults`)} which runs _after_.
66
+
67
+ You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
68
+
69
+ > :warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
70
+
71
+ ${G(`${F.gray(`/**
72
+ @param name The name of the dependency.
73
+ @param semver A parsed Semver array of the current version.
74
+ (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
75
+ @returns True if the package should be included, false if it should be excluded.
76
+ */`)}
77
+ ${F.green(`filter`)}: (name, semver) ${F.cyan(`=>`)} {
78
+ ${F.red(`if`)} (name.startsWith(${F.yellow(`'@myorg/'`)})) {
79
+ ${F.red(`return`)} ${F.cyan(`false`)}
80
+ }
81
+ ${F.red(`return`)} ${F.cyan(`true`)}
82
+ }`,{markdown:e})}
83
+
84
+ `}},{long:`filterResults`,arg:`fn`,cli:!1,description:`Filters results based on a user provided predicate function after fetching new versions.`,type:`FilterResultsFunction`,help:({markdown:e})=>{let t=t=>e?`\`${t}\``:t;return`Filters results based on a user provided predicate function after fetching new versions.
85
+
86
+ ${t(`filterResults`)} runs _after_ new versions are fetched, in contrast to ${t(`filter`)}, ${t(`reject`)}, ${t(`filterVersion`)}, and ${t(`rejectVersion`)}, which run _before_. This allows you to exclude upgrades with ${t(`filterResults`)} based on how the version has changed (e.g. a major version change).
87
+
88
+ > :warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
89
+
90
+ ${G(`${F.gray(`/** Exclude major version updates. Note this could also be achieved with --target semver.
91
+ @param {string} packageName The name of the dependency.
92
+ @param {string} current Current version declaration (may be a range).
93
+ @param {SemVer[]} currentVersionSemver Current version declaration in semantic versioning format (may be a range).
94
+ @param {string} upgraded Upgraded version.
95
+ @param {SemVer} upgradedVersionSemver Upgraded version in semantic versioning format.
96
+ @returns {boolean} Return true if the upgrade should be kept; otherwise, it will be ignored.
97
+ */`)}
98
+ ${F.green(`filterResults`)}: (packageName, { current, currentVersionSemver, upgraded, upgradedVersionSemver }) ${F.cyan(`=>`)} {
99
+ ${F.cyan(`const`)} currentMajor ${F.red(`=`)} parseInt(currentVersionSemver[${F.cyan(`0`)}]?.major, ${F.cyan(`10`)})
100
+ ${F.cyan(`const`)} upgradedMajor ${F.red(`=`)} parseInt(upgradedVersionSemver?.major, ${F.cyan(`10`)})
101
+ ${F.red(`if`)} (currentMajor ${F.red(`&&`)} upgradedMajor) {
102
+ ${F.red(`return`)} currentMajor ${F.red(`>=`)} upgradedMajor
103
+ }
104
+ ${F.red(`return`)} ${F.cyan(`true`)}
105
+ }`,{markdown:e})}
106
+
107
+ For the SemVer type definition, see: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring
108
+
109
+ `}},{long:`filterVersion`,arg:`p`,description:`Filter on package version using comma-or-space-delimited list, /regex/, or predicate function.`,type:`string | RegExp | readonly (string | RegExp)[] | FilterFunction`,parse:(e,t)=>[...t||[],e],help:({markdown:e})=>{let t=t=>e?`\`${t}\``:t;return`Include only versions matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
110
+
111
+ ${t(`--filterVersion`)} runs _before_ new versions are fetched, in contrast to ${t(`--filterResults`)} which runs _after_.
112
+
113
+ You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
114
+
115
+ > :warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions. This function is an alias for the ${t(`filter`)} option function.
116
+
117
+ ${G(`${F.gray(`/**
118
+ @param name The name of the dependency.
119
+ @param semver A parsed Semver array of the current version.
120
+ (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
121
+ @returns True if the package should be included, false if it should be excluded.
122
+ */`)}
123
+ ${F.green(`filterVersion`)}: (name, semver) ${F.cyan(`=>`)} {
124
+ ${F.red(`if`)} (name.startsWith(${F.yellow(`'@myorg/'`)}) ${F.red(`&&`)} parseInt(semver[0]?.major) ${F.cyan(`>`)} ${F.cyan(`5`)}) {
125
+ ${F.red(`return`)} ${F.cyan(`false`)}
126
+ }
127
+ ${F.red(`return`)} ${F.cyan(`true`)}
128
+ }`,{markdown:e})}
129
+
130
+ `}},{long:`format`,arg:`value`,description:`Modify the output formatting or show additional information. Specify one or more comma-delimited values: dep, group, ownerChanged, repo, time, lines, installedVersion.`,parse:e=>typeof e==`string`?e.split(`,`):e,default:[],type:`readonly string[]`,choices:[`dep`,`group`,`ownerChanged`,`repo`,`time`,`lines`,`installedVersion`],help:({markdown:e})=>`Modify the output formatting or show additional information. Specify one or more comma-delimited values.\n\n${W(U({colAligns:[`right`,`left`],markdown:e,rows:[[`dep`,`Prints the dependency type (dev, peer, optional) of each package.`],[`group`,`Groups packages by major, minor, patch, and major version zero updates.`],[`installedVersion`,`Prints the exact current version number instead of a range.`],[`lines`,`Prints name@version on separate lines. Useful for piping to npm install.`],[`ownerChanged`,`Shows if the package owner has changed.`],[`repo`,`Infers and displays links to the package's source code repository. Requires packages to be installed.`],[`time`,`Shows the publish time of each upgrade.`]]}),e?0:4)}
131
+ `},{long:`global`,short:`g`,description:`Check global packages instead of in the current project.`,type:`boolean`},{long:`groupFunction`,arg:`fn`,cli:!1,description:"Customize how packages are divided into groups when using `--format group`.",type:`GroupFunction`,help:({markdown:e})=>`Customize how packages are divided into groups when using \`--format group\`.
132
+
133
+ Only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
134
+
135
+ ${G(`${F.gray(`/**
136
+ @param name The name of the dependency.
137
+ @param defaultGroup The predefined group name which will be used by default.
138
+ @param currentSpec The current version range in your package.json.
139
+ @param upgradedSpec The upgraded version range that will be written to your package.json.
140
+ @param upgradedVersion The upgraded version number returned by the registry.
141
+ @returns A predefined group name ('major' | 'minor' | 'patch' | 'majorVersionZero' | 'none') or a custom string to create your own group.
142
+ */`)}
143
+ ${F.green(`groupFunction`)}: (name, defaultGroup, currentSpec, upgradedSpec, upgradedVersion) ${F.cyan(`=>`)} {
144
+ ${F.red(`if`)} (name ${F.red(`===`)} ${F.yellow(`'typescript'`)} ${F.red(`&&`)} defaultGroup ${F.red(`===`)} ${F.yellow(`'minor'`)}) {
145
+ ${F.red(`return`)} ${F.yellow(`'major'`)}
146
+ }
147
+ ${F.red(`if`)} (name.startsWith(${F.yellow(`'@myorg/'`)})) {
148
+ ${F.red(`return`)} ${F.yellow(`'My Org'`)}
149
+ }
150
+ ${F.red(`return`)} defaultGroup
151
+ }`,{markdown:e})}
152
+
153
+ `},{long:`install`,arg:`value`,description:`Control the auto-install behavior: always, never, prompt.`,help:({markdown:e})=>`Control the auto-install behavior.\n\n${W(U({colAligns:[`right`,`left`],markdown:e,rows:[[`always`,`Runs your package manager's install command automatically after upgrading.`],[`never`,`Does not install and does not prompt.`],[`prompt`,`Shows a message after upgrading that recommends an install, but does not install. In interactive mode, prompts for install. (default)`]]}),e?0:4)}
154
+ `,default:`prompt`,choices:[`always`,`never`,`prompt`],type:`'always' | 'never' | 'prompt'`},{long:`interactive`,short:`i`,description:"Enable interactive prompts for each dependency; implies `-u` unless one of the json options are set.",type:`boolean`},{long:`jsonAll`,short:`j`,description:`Output new package file instead of human-readable message.`,type:`boolean`},{long:`jsonDeps`,description:"Like `jsonAll` but only lists `dependencies`, `devDependencies`, `optionalDependencies`, etc of the new package data.",type:`boolean`},{long:`jsonUpgraded`,description:`Output upgraded dependencies in json.`,type:`boolean`},{long:`loglevel`,short:`l`,arg:`n`,description:`Amount to log: silent, error, minimal, warn, info, verbose, silly.`,default:`warn`,type:`string`},{long:`mergeConfig`,description:"Merges nested configs with the root config file for `--deep` or `--packageFile` options. (default: false)",type:`boolean`},{long:`minimal`,short:`m`,description:`Do not upgrade newer versions that are already satisfied by the version range according to semver.`,type:`boolean`},{long:`packageData`,arg:`value`,description:`Package file data (you can also use stdin).`,type:`string | PackageFile`},{long:`packageFile`,arg:`path|glob`,description:`Package file(s) location. (default: ./package.json)`,type:`string`},{long:`packageManager`,short:`p`,arg:`s`,description:`npm, yarn, pnpm, deno, bun, staticRegistry (default: npm).`,help:({markdown:e})=>`Specifies the package manager to use when looking up versions.\n\n${W(U({colAligns:[`right`,`left`],markdown:e,rows:[[`npm`,`System-installed npm. Default.`],[`yarn`,`System-installed yarn. Automatically used if yarn.lock is present.`],[`pnpm`,`System-installed pnpm. Automatically used if pnpm-lock.yaml is present.`],[`bun`,`System-installed bun. Automatically used if bun.lock or bun.lockb is present.`]]}),e?0:4)}
155
+ `,type:`'npm' | 'yarn' | 'pnpm' | 'deno' | 'bun' | 'staticRegistry'`},{long:`peer`,description:`Check peer dependencies of installed packages and filter updates to compatible versions.`,type:`boolean`,help:({markdown:e})=>{let t=t=>e?`\`${t}\``:t;return`Check peer dependencies of installed packages and filter updates to compatible versions.
156
+
157
+ ${F.bold(`Example`)}:
158
+
159
+ The following example demonstrates how \`--peer\` works, and how it uses peer dependencies from upgraded modules.
160
+
161
+ The package ${F.bold(`ncu-test-peer-update`)} has two versions published:
162
+
163
+ - 1.0.0 has peer dependency ${t(`"ncu-test-return-version": "1.0.x"`)}
164
+ - 1.1.0 has peer dependency ${t(`"ncu-test-return-version": "1.1.x"`)}
165
+
166
+ Our test app has the following dependencies:
167
+
168
+ "ncu-test-peer-update": "1.0.0",
169
+ "ncu-test-return-version": "1.0.0"
170
+
171
+ The latest versions of these packages are:
172
+
173
+ "ncu-test-peer-update": "1.1.0",
174
+ "ncu-test-return-version": "2.0.0"
175
+
176
+ ${F.bold("With `--peer`")}:
177
+
178
+ ncu upgrades packages to the highest version that still adheres to the peer dependency constraints:
179
+
180
+ ncu-test-peer-update 1.0.0 → 1.${F.cyan(`1.0`)}
181
+ ncu-test-return-version 1.0.0 → 1.${F.cyan(`1.0`)}
182
+
183
+ ${F.bold("Without `--peer`")}:
184
+
185
+ As a comparison: without using the \`--peer\` option, ncu will suggest the latest versions, ignoring peer dependencies:
186
+
187
+ ncu-test-peer-update 1.0.0 → 1.${F.cyan(`1.0`)}
188
+ ncu-test-return-version 1.0.0 → ${F.red(`2.0.0`)}
189
+ `}},{long:`pre`,arg:`n`,description:"Include prerelease versions, e.g. -alpha.0, -beta.5, -rc.2. Automatically set to 1 when `--target` is newest or greatest, or when the current version is a prerelease. (default: 0)",parse:e=>!!parseInt(e,10),type:`number`},{long:`prefix`,arg:`path`,description:`Current working directory of npm.`,type:`string`},{long:`registry`,short:`r`,arg:`uri`,description:`Specify the registry to use when looking up package versions.`,type:`string`},{long:`registryType`,arg:`type`,description:`Specify whether --registry refers to a full npm registry or a simple JSON file or url: npm, json. (default: npm)`,help:({markdown:e})=>`${`Specify whether ${(t=>e?`\`${t}\``:t)(`--registry`)} refers to a full npm registry or a simple JSON file.`}\n\n${W(U({colAligns:[`right`,`left`],markdown:e,rows:[[`npm`,`Default npm registry`],[`json`,`Checks versions from a file or url to a simple JSON registry. Must include the ${F.cyan("`--registry`")} option.
190
+
191
+ Example:
192
+
193
+ ${F.gray(`// local file`)}
194
+ ${F.cyan(`$`)} ncu --registryType json --registry ./registry.json
195
+
196
+ ${F.gray(`// url`)}
197
+ ${F.cyan(`$`)} ncu --registryType json --registry https://api.mydomain/registry.json
198
+
199
+ ${F.gray(`// you can omit --registryType when the registry ends in .json`)}
200
+ ${F.cyan(`$`)} ncu --registry ./registry.json
201
+ ${F.cyan(`$`)} ncu --registry https://api.mydomain/registry.json
202
+
203
+ registry.json:
204
+
205
+ {
206
+ "prettier": "2.7.1",
207
+ "typescript": "4.7.4"
208
+ }
209
+
210
+ `]]}),e?0:4)}
211
+ `,type:`'npm' | 'json'`},{long:`reject`,short:`x`,arg:`p`,description:`Exclude packages matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.`,type:`string | RegExp | readonly (string | RegExp)[] | FilterFunction`,parse:(e,t)=>[...t||[],e],help:({markdown:e})=>{let t=t=>e?`\`${t}\``:t;return`The inverse of ${t(`--filter`)}. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. This will also exclude them from the ${t(`--peer`)} check.
212
+
213
+ ${t(`--reject`)} runs _before_ new versions are fetched, in contrast to ${t(`--filterResults`)} which runs _after_.
214
+
215
+ You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
216
+
217
+ > :warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
218
+
219
+ ${G(`${F.gray(`/**
220
+ @param name The name of the dependency.
221
+ @param semver A parsed Semver array of the current version.
222
+ (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
223
+ @returns True if the package should be excluded, false if it should be included.
224
+ */`)}
225
+ ${F.green(`reject`)}: (name, semver) ${F.cyan(`=>`)} {
226
+ ${F.red(`if`)} (name.startsWith(${F.yellow(`'@myorg/'`)})) {
227
+ ${F.red(`return`)} ${F.cyan(`true`)}
228
+ }
229
+ ${F.red(`return`)} ${F.cyan(`false`)}
230
+ }`,{markdown:e})}
231
+
232
+ `}},{long:`rejectVersion`,arg:`p`,description:`Exclude package.json versions using comma-or-space-delimited list, /regex/, or predicate function.`,type:`string | RegExp | readonly (string | RegExp)[] | FilterFunction`,parse:(e,t)=>[...t||[],e],help:({markdown:e})=>{let t=t=>e?`\`${t}\``:t;return`The inverse of ${t(`--filterVersion`)}. Exclude versions matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
233
+
234
+ ${t(`--rejectVersion`)} runs _before_ new versions are fetched, in contrast to ${t(`--filterResults`)} which runs _after_.
235
+
236
+ You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
237
+
238
+ > :warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions. This function is an alias for the reject option function.
239
+
240
+ ${G(`${F.gray(`/**
241
+ @param name The name of the dependency.
242
+ @param semver A parsed Semver array of the current version.
243
+ (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
244
+ @returns True if the package should be excluded, false if it should be included.
245
+ */`)}
246
+ ${F.green(`rejectVersion`)}: (name, semver) ${F.cyan(`=>`)} {
247
+ ${F.red(`if`)} (name.startsWith(${F.yellow(`'@myorg/'`)}) ${F.red(`&&`)} parseInt(semver[0]?.major) ${F.cyan(`>`)} ${F.cyan(`5`)}) {
248
+ ${F.red(`return`)} ${F.cyan(`true`)}
249
+ }
250
+ ${F.red(`return`)} ${F.cyan(`false`)}
251
+ }`,{markdown:e})}
252
+
253
+ `}},{long:`removeRange`,description:`Remove version ranges from the final package version.`,type:`boolean`},{long:`root`,default:!0,description:"Runs updates on the root project in addition to specified workspaces. Only allowed with `--workspace` or `--workspaces`.",type:`boolean`},{long:`retry`,arg:`n`,description:`Number of times to retry failed requests for package info.`,parse:e=>parseInt(e,10),default:3,type:`number`},{long:`silent`,short:`s`,description:"Don't output anything. Alias for `--loglevel` silent.",type:`boolean`},{long:`stdin`,description:`Read package.json from stdin.`,type:`string`},{long:`target`,short:`t`,arg:`value`,description:"Determines the version to upgrade to: latest, newest, greatest, minor, patch, semver, `@[tag]`, or [function]. (default: latest)",help:({markdown:e})=>`Determines the version to upgrade to. (default: "latest")
254
+
255
+ ${W(U({colAligns:[`right`,`left`],markdown:e,rows:[[`greatest`,`Upgrade to the highest version number published, regardless of release date or tag. Includes prereleases.`],[`latest`,`Upgrade to whatever the package's "latest" git tag points to. Excludes prereleases unless --pre is specified.`],[`minor`,`Upgrade to the highest minor version without bumping the major version.`],[`newest`,`Upgrade to the version with the most recent publish date, even if there are other version numbers that are higher. Includes prereleases.`],[`patch`,`Upgrade to the highest patch version without bumping the minor or major versions.`],[`semver`,`Upgrade to the highest version within the semver range specified in your package.json.`],[`@[tag]`,`Upgrade to the version published to a specific tag, e.g. 'next' or 'beta'.`]]}),e?0:4)}
256
+
257
+ e.g.
258
+
259
+ ${G(`ncu --target semver`)}
260
+
261
+ You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
262
+
263
+ > :warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
264
+
265
+ ${G(`${F.gray(`/** Upgrade major version zero to the next minor version, and everything else to latest.
266
+ @param name The name of the dependency.
267
+ @param semver A parsed Semver object of the upgraded version.
268
+ (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
269
+ @returns One of the valid target values (specified in the table above).
270
+ */`)}
271
+ ${F.green(`target`)}: (name, semver) ${F.cyan(`=>`)} {
272
+ ${F.red(`if`)} (parseInt(semver[0]?.major) ${F.red(`===`)} ${F.yellow(`'0'`)}) ${F.red(`return`)} ${F.yellow(`'minor'`)}
273
+ ${F.red(`return`)} ${F.yellow(`'latest'`)}
274
+ }`,{markdown:e})}
275
+ `,type:`${Gn.map(e=>`'${e}'`).join(` | `)} | \`@\${string}\` | TargetFunction`},{long:`timeout`,arg:`ms`,description:`Global timeout in milliseconds. (default: no global timeout and 30 seconds per npm-registry-fetch)`,parse:e=>parseInt(e,10),type:`number`},{long:`upgrade`,short:`u`,description:`Overwrite package file with upgraded versions instead of just outputting to console.`,type:`boolean`},{long:`verbose`,description:"Log additional information for debugging. Alias for `--loglevel` verbose.",type:`boolean`},{long:`workspace`,arg:`s`,parse:(e,t)=>[...t,e],default:[],description:"Run on one or more specified workspaces. Add `--no-root` to exclude the root project.",type:`readonly string[]`},{long:`workspaces`,short:`w`,description:"Run on all workspaces. Add `--no-root` to exclude the root project.",type:`boolean`},{long:`cooldown`,short:`c`,arg:`n`,description:`Sets a minimum age (in days) for package versions to be considered for upgrade, reducing the risk of installing newly published, potentially compromised packages.`,type:`number | CooldownFunction`,help:({markdown:e})=>`The cooldown option helps protect against supply chain attacks by requiring package versions to be published at least the given number of days before considering them for upgrade.
276
+
277
+ Note that previous stable versions will ${F.bold(`not`)} be suggested. The package will be completely ignored if its latest published version is within the cooldown period. This is due to a limitation of the npm registry, which does not provide a way to query previous stable versions.
278
+
279
+ ${F.bold(`Example`)}:
280
+
281
+ Let's examine how cooldown works with a package that has these versions available:
282
+
283
+ 1.0.0 Released 7 days ago (initial version)
284
+ 1.1.0 Released 6 days ago (minor update)
285
+ 1.1.1 Released 5 days ago (patch update)
286
+ 1.2.0 Released 5 days ago (minor update)
287
+ 2.0.0-beta.1 Released 5 days ago (beta release)
288
+ 1.2.1 Released 4 days ago (patch update)
289
+ 1.3.0 Released 4 days ago (minor update) [latest]
290
+ 2.0.0-beta.2 Released 3 days ago (beta release)
291
+ 2.0.0-beta.3 Released 2 days ago (beta release) [beta]
292
+
293
+ ${F.bold(`With default target (latest)`)}:
294
+
295
+ ${G(`${F.cyan(`$`)} ncu --cooldown 5`,{markdown:e})}
296
+
297
+ No update will be suggested because:
298
+
299
+ - Latest version (1.3.0) is only 4 days old.
300
+ - Cooldown requires versions to be at least 5 days old
301
+ - Use \`--cooldown 4\` or lower to allow this update
302
+
303
+ ${F.bold("With `@beta`/`@tag` target")}:
304
+
305
+ ${G(`${F.cyan(`$`)} ncu --cooldown 3 --target @beta`,{markdown:e})}
306
+
307
+ No update will be suggested because:
308
+
309
+ - Current beta (2.0.0-beta.3) is only 2 days old
310
+ - Cooldown requires versions to be at least 3 days old
311
+ - Use \`--cooldown 2\` or lower to allow this update
312
+
313
+ ${F.bold(`With other targets`)}:
314
+
315
+ ${G(`${F.cyan(`$`)} ncu --cooldown 5 --target greatest|newest|minor|patch|semver`,{markdown:e})}
316
+
317
+ Each target will select the best version that is at least 5 days old:
318
+
319
+ greatest → 1.2.0 (highest version number outside cooldown)
320
+ newest → 2.0.0-beta.1 (most recently published version outside cooldown)
321
+ minor → 1.2.0 (highest minor version outside cooldown)
322
+ patch → 1.1.1 (highest patch version outside cooldown)
323
+
324
+ ${F.bold(`Note for latest/tag targets`)}:
325
+
326
+ > :warning: For packages that update frequently (e.g. daily releases), using a long cooldown period (7+ days) with the default \`--target latest\` or \`--target @tag\` may prevent all updates since new versions will be published before older ones meet the cooldown requirement. Please consider this when setting your cooldown period.
327
+
328
+ You can also provide a custom function in your .ncurc.js file or when importing npm-check-updates as a module.
329
+
330
+ > :warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
331
+
332
+ ${G(`${F.gray(`/** Set cooldown to 3 days but skip it for \`@my-company\` packages.
333
+ @param packageName The name of the dependency.
334
+ @returns Cooldown days restriction for given package.
335
+ */`)}
336
+ ${F.green(`cooldown`)}: packageName ${F.cyan(`=>`)} (packageName.startsWith(${F.yellow(`'@my-company'`)}) ? ${F.cyan(`0`)} : ${F.cyan(`3`)})`,{markdown:e})}
337
+ `,parse:e=>typeof e==`function`?e:parseInt(e,10)}],K=Jn.reduce((e,t)=>({...e,...t.short?{[t.short]:t}:null,...t.long?{[t.long]:t}:null}),{});var Yn=Rt(Jn,e=>e.long);const Xn=[`package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,`deno.json`,`deno.jsonc`,`bun.lock`,`bun.lockb`];async function Zn(t,n=o.readdir){try{let r=i.homedir(),a=i.tmpdir(),o=t.cwd?t.cwd:t.packageFile?e.dirname(t.packageFile):`.`;for(o=e.resolve(o);;){let t=await n(o);for(let e of Xn)if(t.includes(e))return{directoryPath:o,filename:e};let i=e.resolve(o,`..`);if(i===o||i===r||i===a)break;o=i}}catch{}return null}const Qn={"package-lock":`npm`,yarn:`yarn`,"pnpm-lock":`pnpm`,deno:`deno`,bun:`bun`},$n=()=>{let e=process.env.npm_config_user_agent??``,t=process.env.npm_execpath??``;return e.startsWith(`yarn/`)||t.includes(`yarn`)||__dirname.includes(`/yarn/`)||__dirname.includes(`\\Yarn\\`)?`yarn`:e.startsWith(`pnpm/`)||t.includes(`pnpm`)||__dirname.includes(`/pnpm/`)||__dirname.includes(`\\pnpm\\`)?`pnpm`:e.startsWith(`bun/`)||typeof Bun<`u`||process.versions.bun||__dirname.includes(`/.bun/`)||__dirname.includes(`\\.bun\\`)?`bun`:`npm`};var er=async(e,t=o.readdir)=>{if(e.packageManager)return e.packageManager;if(e.global)return $n();let n=(await Zn(e,t))?.filename;return n?Qn[n.split(`.`)[0]]:`npm`},tr=class e{constructor(e,t,n){this.__specs=e||{},this.__opts=t||{},this.__providers=or(n.filter(e=>typeof e==`object`&&!!e)),this.__isFiggyPudding=!0}get(e){return nr(this,e,!0)}toJSON(){let e={};return this.forEach((t,n)=>{e[n]=t}),e}forEach(e,t=this){for(let[n,r]of this.entries())e.call(t,r,n,this)}*entries(e){for(let e of Object.keys(this.__specs))yield[e,this.get(e)];let t=e||this.__opts.other;if(t){let e=new Set;for(let n of this.__providers){let r=n.entries?n.entries(t):sr(n);for(let[n,i]of r)t(n)&&!e.has(n)&&(e.add(n),yield[n,i])}}}concat(...t){return new Proxy(new e(this.__specs,this.__opts,or(this.__providers).concat(t)),ir)}};function nr(e,t,n){let r=e.__specs[t];r||={};let i;for(let n of e.__providers)if(i=rr(t,n),i!==void 0)break;return i===void 0&&r.default!==void 0?typeof r.default==`function`?r.default(e):r.default:i}function rr(e,t){let n;return n=t.__isFiggyPudding?nr(t,e,!1):t[e],n}const ir={get(e,t){return typeof t==`symbol`||t.slice(0,2)===`__`||t in tr.prototype?e[t]:e.get(t)}};function ar(e,t){function n(...n){return new Proxy(new tr(e,t,n),ir)}return n}function or(e){let t=[];return e.forEach(e=>t.unshift(e)),t}function sr(e){return Object.keys(e).map(t=>[t,e[t]])}const cr=ar({},{other(){return!0}}),lr=ar({cache:{default:O.join(process.env.HOME||D.homedir(),`.npm`)},configNames:{default:[`npmrc`,`.npmrc`]},envPrefix:{default:/^npm_config_/i},cwd:{default:()=>process.cwd()},globalconfig:{default:()=>O.join(fr(),`etc`,`npmrc`)},userconfig:{default:O.join(process.env.HOME||D.homedir(),`.npmrc`)}});function ur(e,t){let n=lr(t),r={};Object.keys(process.env).forEach(e=>{if(!e.match(n.envPrefix))return;let t=e.toLowerCase().replace(n.envPrefix,``).replace(/(?!^)_/g,`-`);r[t]=process.env[e]});let i=cr(e),a=n.userconfig||i.userconfig||r.userconfig,o=a&&dr(a),s=n.globalconfig||i.globalconfig||r.globalconfig,c=s&&dr(s),l=ee(n.configNames,{cwd:n.cwd}),u={};l&&l!==a&&(u=dr(l));let d=cr(n,c,o,u,r,i);return d.cache?d.concat({cache:O.resolve(i.cache||r.cache?n.cwd:u.cache?O.dirname(l):o.cache?O.dirname(a):c.cache?O.dirname(s):O.dirname(a),d.cache)}):d}function dr(e){let t;try{t=te.readFileSync(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}return C.parse(t)}function fr(){if(process.env.PREFIX)return process.env.PREFIX;if(process.platform===`win32`)return O.dirname(process.execPath);{let e=O.dirname(O.dirname(process.execPath));return process.env.DESTDIR&&(e=O.join(process.env.DESTDIR,e)),e}}var pr=ur;function mr(e,t){return t.deprecated||!e.deprecated}function hr(e,t){return t.pre?!0:!e.version||!on(e.version)}function gr(e,t){if(!t)return!0;let n=d.minVersion(t)?.version;if(!n)return!0;let r=e?.engines?.node;return!r||d.satisfies(n,r)}function _r(e,t){return t?Object.values(t).every(t=>t[e.name]===void 0||d.satisfies(e.version,t[e.name])):!0}function vr(e,t){let n=e.version,r=e?.time?.[n];if(!t)return!0;if(!r)return!1;let i=new Date(r),a=typeof t==`function`?t(e.name)??0:t;return Date.now()-i.getTime()>=a*864e5}function yr(e){let t=[t=>mr(t,e),t=>hr(t,e),e.enginesNode?t=>gr(t,e.nodeEngineVersion):null,e.peerDependencies?t=>_r(t,e.peerDependencies):null,e.cooldown?t=>vr(t,e.cooldown):null];return e=>t.every(t=>t?t(e):!0)}var br=M({default:()=>Kr,defaultPrefix:()=>Fr,distTag:()=>Br,fetchUpgradedPackumentMemo:()=>J,getEngines:()=>Rr,getPeerDependencies:()=>Lr,greatest:()=>Ir,latest:()=>Vr,list:()=>zr,minor:()=>Ur,mockFetchUpgradedPackument:()=>jr,newest:()=>Hr,normalizeNpmConfig:()=>Tr,packageAuthorChanged:()=>kr,parseJson:()=>Or,patch:()=>Wr,semver:()=>Gr});const xr=new Set([`-`,`||`,`&&`,`<`,`<=`,`>`,`>=`]),Sr=e=>y(e).some(e=>xr.has(e.operator||``)),Cr=e=>e&&(!d.validRange(e)||Xt(e)),wr=async(e,t,n,r={},i)=>{let a=w.pickRegistry(e,r),o={"user-agent":r.userAgent||`npm-check-updates/${Te} node/${process.version}`,"ncu-version":Te,"ncu-pkg-id":`registry:${e}`,accept:r.fullMetadata?`application/json`:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`,...r.headers},s=new URL(encodeURIComponent(e),a.endsWith(`/`)?a:`${a}/`);i&&(s.pathname+=`/${i}`);let c={...r,headers:o,spec:e};try{if(r.fullMetadata)return w.json(s.href,c);{n||=`latest`;let r=w.json.stream(s.href,`$*`,c),i={name:e};for await(let{key:e,value:n}of r)if(t.includes(e)&&(i[e]=n,Object.keys(i).length===t.length+1))break;return i}}catch(a){if(a.code!==`E404`||r.fullMetadata)throw a;return wr(e,t,n,{...r,fullMetadata:!0},i)}},q=(e,t)=>{let n=e.version;return{...e,name:t.name,...t?.time?.[n]?{time:t.time}:null}},Tr=(t,n)=>{let i={cafile:t=>{if(!t)return;let i=r.readFileSync(e.resolve(n||``,T(t)),`utf8`),a=`-----END CERTIFICATE-----`;return{ca:i.split(a).filter(e=>!!e.trim()).map(e=>`${e.trimStart()}${a}`)}},maxsockets:`maxSockets`,"strict-ssl":`strictSSL`},a={all:`boolean`,allowsameversion:`boolean`,audit:`boolean`,binlinks:`boolean`,color:`boolean`,commithooks:`boolean`,description:`boolean`,dev:`boolean`,diffignoreallspace:`boolean`,diffnameonly:`boolean`,diffnoprefix:`boolean`,difftext:`boolean`,dryrun:`boolean`,enginestrict:`boolean`,force:`boolean`,foregroundscripts:`boolean`,formatpackagelock:`boolean`,fund:`boolean`,gittagversion:`boolean`,global:`boolean`,globalstyle:`boolean`,ifpresent:`boolean`,ignorescripts:`boolean`,includestaged:`boolean`,includeworkspaceroot:`boolean`,installlinks:`boolean`,json:`boolean`,legacybundling:`boolean`,legacypeerdeps:`boolean`,link:`boolean`,long:`boolean`,offline:`boolean`,omitlockfileregistryresolved:`boolean`,packagelock:`boolean`,packagelockonly:`boolean`,parseable:`boolean`,preferoffline:`boolean`,preferonline:`boolean`,progress:`boolean`,readonly:`boolean`,rebuildbundle:`boolean`,save:`boolean`,savebundle:`boolean`,savedev:`boolean`,saveexact:`boolean`,saveoptional:`boolean`,savepeer:`boolean`,saveprod:`boolean`,shrinkwrap:`boolean`,signgitcommit:`boolean`,signgittag:`boolean`,strictpeerdeps:`boolean`,strictssl:`boolean`,timing:`boolean`,unicode:`boolean`,updatenotifier:`boolean`,usage:`boolean`,version:`boolean`,versions:`boolean`,workspacesupdate:`boolean`,diffunified:`number`,fetchretries:`number`,fetchretryfactor:`number`,fetchretrymaxtimeout:`number`,fetchretrymintimeout:`number`,fetchtimeout:`number`,logsmax:`number`,maxsockets:`number`,searchlimit:`number`,searchstaleness:`number`,ssopollfrequency:`number`,timeout:`number`},o=e=>!!e&&e!==`false`&&e!==`0`,s=e=>parseInt(e)||0;return N(t,(e,t)=>{let n=typeof t==`string`?a[e.replace(/-/g,``).toLowerCase()]===`boolean`?o(t):a[e.replace(/-/g,``).toLowerCase()]===`number`?s(t):t.replace(/\${([^}]+)}/,(e,t)=>process.env[t]):t,{[e]:r}=i;return typeof r==`string`?{[r]:n}:typeof r==`function`?{...r(n.toString())}:{[e.match(/^[a-z]/i)?x(e):e]:n}})},Er=S(e=>{let t;if(e)try{t=C.parse(r.readFileSync(e,`utf-8`))}catch(e){if(e.code===`ENOENT`)return null;throw e}else t={...pr(null,{userconfig:process.env.npm_config_userconfig||process.env.NPM_CONFIG_USERCONFIG}).toJSON(),cache:!1};return Tr(t,e)}),Dr=Er();function Or(e,t){let n;try{n=JSON.parse(e)}catch{throw Error(`Expected JSON from "${t.command}".${t.packageName?` There could be problems with the ${t.packageName} package.`:``} ${e?`Instead received: `+e:`Received empty response.`}`)}return n}async function kr(e,t,n,r={},i){let a=await wr(e,[`versions`],null,{...i,...Dr,fullMetadata:!0,...r.registry?{registry:r.registry,silent:!0}:null});if(a.versions){let e=Object.keys(a.versions),r=d.minSatisfying(e,t),i=d.maxSatisfying(e,n);if(r&&i&&a.versions[r]._npmUser&&a.versions[i]._npmUser)return a.versions[r]._npmUser?.name!==a.versions[i]._npmUser?.name}return!1}const Ar=e=>!!(e&&(e.name||e.engines||e.version||e.versions)),jr=e=>(t,n,r,i)=>{let a=typeof e==`function`?e(i)?.[t]:typeof e==`string`||Ar(e)?e:e[t],o=Ar(a)?a.version:a;if(!o)throw Error(`fetchUpgradedPackument is mocked, but no mock version was supplied for ${t}. Make sure that all dependencies are mocked. `);let s=Ar(a)&&a.time?.[o]||new Date().toISOString(),c={name:t,"dist-tags":{[i.distTag||`latest`]:o},engines:{node:``},time:{[o]:s},version:o,versions:{},...Ar(a)?a:null},{versions:l,...u}=c;return Promise.resolve({...c,versions:{...Ar(a)&&a.versions||{[o]:u}}})},Mr=S(({npmConfigLocal:t,npmConfigUser:n,npmConfigWorkspaceProject:r},i)=>{let a=i.packageFile?e.join(i.packageFile,`../.npmrc`):null,o=i.packageFile?Er(a||void 0):null,s=i.cwd?e.join(i.cwd,`.npmrc`):null,c=i.cwd?Er(s):null;if(r&&Object.keys(r).length>0){V(i,`
338
+ npm config (workspace project):`,`verbose`);let{cache:e,...t}=r;H(i,t,`verbose`)}if(n&&Object.keys(n).length>0){V(i,`
339
+ npm config (user):`,`verbose`);let{cache:e,...t}=n;H(i,t,`verbose`)}if(t&&Object.keys(t).length>0){V(i,`
340
+ npm config (local override):`,`verbose`);let{cache:e,...n}=t;H(i,n,`verbose`)}if(o&&Object.keys(o).length>0){V(i,`\nnpm config (project: ${a}):`,`verbose`);let{cache:e,...t}=o;H(i,t,`verbose`)}if(c&&Object.keys(c).length>0){V(i,`\nnpm config (cwd: ${s}):`,`verbose`);let{cache:e,...t}=c;H(i,t,`verbose`)}let l={...r,...n,...t,...o,...c,...i.registry?{registry:i.registry,silent:!0}:null,...i.timeout?{timeout:i.timeout}:null};if(r||t||o||c){V(i,`
341
+ merged npm config:`,`verbose`);let{cache:e,...t}=l;H(i,t,`verbose`)}return l});async function Nr(e,t,n,r,i=0,a,o){if(process.env.STUB_VERSIONS)return jr(JSON.parse(process.env.STUB_VERSIONS))(e,t,n,r);if(Cr(n))return Promise.resolve({});let s=r.format?.includes(`time`)&&!t.includes(`time`)?[...t,`time`]:t,c=s.includes(`time`),l=Mr({npmConfigUser:{...Dr,fullMetadata:c},npmConfigLocal:a,npmConfigWorkspaceProject:o},r),u;try{let n=r.distTag||`latest`;u=await wr(e,Array.from(new Set([`dist-tags`,...t,...r.deprecated?[]:[`deprecated`,`versions`],...r.enginesNode?[`engines`,`versions`]:[]])),c?null:n,l)}catch(t){if(r.retry&&++i<=r.retry)return Nr(e,s,n,r,i,a);throw t}return u}const J=S(Nr,{serializer:(([e,t,n,r,i,a,o])=>{let{packageFile:s,...c}=r;return JSON.stringify([e,t,Cr(n),c,i,a,o])})});async function Pr(e,t={},r={},i={}){let{stdout:a}=await n(process.platform===`win32`?`npm.cmd`:`npm`,[...t.global?[`--global`]:[],...t.prefix?[`--prefix=${t.prefix}`]:[],`--json`,...Array.isArray(e)?e:[e]],r,i);return a}async function Fr(e){if(e.prefix)return Promise.resolve(e.prefix);let t=process.platform===`win32`?`npm.cmd`:`npm`,r;try{let{stdout:e}=await n(t,[`config`,`get`,`prefix`]);r=e}catch(t){V(e,"Error executing `npm config get prefix`. Caught and ignored. Unsolved: https://github.com/raineorshine/npm-check-updates/issues/703. ERROR: "+(t.message||t||``).toString(),`verbose`,`error`)}return e.global&&r?.match(`Cellar`)?`/usr/local`:process.platform===`win32`&&e.global&&!process.env.prefix?r?r.trim():`${process.env.AppData}\\npm`:void 0}const Ir=async(e,t,n={},r,i)=>{let a=[`versions`];n.cooldown&&a.push(`time`);let o=await J(e,a,t,n,0,r,i),s=o?.versions;return{version:Object.values(s||{}).filter(e=>yr(n)(q(e,o))).map(e=>e.version).sort(rn).at(-1)||null}},Lr=async(e,t,n)=>{let r=[`view`,`${e}@${t}`,`peerDependencies`],i=await Pr(r,{},{rejectOnError:!1},n);return i?Or(i,{command:[...r,`--json`].join(` `)}):{}},Rr=async(e,t,n={},r)=>(await wr(e,[`engines`],null,{...r,...Dr,...n.registry?{registry:n.registry,silent:!0}:null},t)).engines||{},zr=async(e={})=>{let t=Or(await Pr([`ls`,`--depth=0`],{...e.global?{global:!0}:null,...e.prefix?{prefix:e.prefix}:null},{rejectOnError:!1},{...e.cwd?{cwd:e.cwd}:null}),{command:`npm${process.platform===`win32`?`.cmd`:``} ls --json${e.global?` --global`:``}`}).dependencies;return N(t,(e,t)=>({[e]:t.version||t.required?.version}))},Br=async(e,t,n={},r,i)=>{let a=[`dist-tags`];n.cooldown&&a.push(`time`);let o=await J(e,a,t,n,0,r,i),s=o?.[`dist-tags`]?.[n.distTag||`latest`],c=o?.versions?o.versions?.[s]:{name:e,version:s},l=q(c,o);return c&&yr(n)(l)?{version:c.version,...o?.time?.[s]?{time:o.time[s]}:null}:n.cooldown||n.distTag&&n.distTag!==`latest`?{}:Ir(e,t,n,r,i)},Vr=async(e,t,n={},r,i)=>Br(e,t,{...n,distTag:`latest`},r,i),Hr=async(e,t,n={},r,i)=>{let a=await J(e,[`time`,`versions`],t,n,0,r,i),o=N(a?.versions||{},(e,t)=>gr(t,n.nodeEngineVersion)?{[t.version]:!0}:null),s=I(a?.time||{},e=>o[e]&&(n.pre!==!1||!on(e))),c=Rt(Object.entries(s),e=>e[1]).map(([e])=>e);return n.cooldown?{version:c.filter(e=>vr(q(a.versions[e],a),n.cooldown)).at(-1)}:{version:c.at(-1)}},Ur=async(e,t,n={},r,i)=>{let a=[`versions`];n.cooldown&&a.push(`time`);let o=await J(e,a,t,n,0,r,i),s=o?.versions;return{version:an(Object.values(s||{}).filter(e=>yr(n)(q(e,o))).map(e=>e.version),t,`minor`)}},Wr=async(e,t,n={},r,i)=>{let a=[`versions`];n.cooldown&&a.push(`time`);let o=await J(e,a,t,n,0,r,i),s=o?.versions;return{version:an(Object.values(s||{}).filter(e=>yr(n)(q(e,o))).map(e=>e.version),t,`patch`)}},Gr=async(e,t,n={},r,i)=>{let a=[`versions`];n.cooldown&&a.push(`time`);let o=await J(e,a,t,n,0,r,i),s=o?.versions;if(Sr(t))return{version:null};let c=Object.values(s||{}).filter(e=>yr(n)(q(e,o))).map(e=>e.version);return{version:d.maxSatisfying(c,t)}};var Kr=Pr,qr=M({default:()=>Zr,defaultPrefix:()=>Yr,distTag:()=>Br,getEngines:()=>Rr,getPeerDependencies:()=>Lr,greatest:()=>Ir,latest:()=>Vr,list:()=>Xr,minor:()=>Ur,newest:()=>Hr,packageAuthorChanged:()=>kr,patch:()=>Wr,semver:()=>Gr});async function Jr(e,t={},r={},i={}){return n(`bun`,[...t.global?[`--global`]:[],...t.prefix?[`--prefix=${t.prefix}`]:[],...Array.isArray(e)?e:[e]],r,i)}const Yr=async t=>t.global?t.prefix||process.env.BUN_INSTALL||e.dirname((await n(`bun`,[`pm`,`-g`,`bin`])).stdout):void 0,Xr=async(e={})=>{let{default:t}=await import(`./strip-ansi.js`),{stdout:n}=await Jr([`pm`,`ls`],{...e.global?{global:!0}:null,...e.prefix?{prefix:e.prefix}:null},{rejectOnError:!1},{env:{...process.env,NO_COLOR:`1`},...e.cwd?{cwd:e.cwd}:null});return P(t(n).split(`
342
+ `),e=>{let t=e.match(/.* (.+?)@(.+)/);if(t){let[,e,n]=t;return{[e]:n}}return null})};var Zr=Jr,Qr=M({default:()=>li,defaultPrefix:()=>Fr,distTag:()=>ti,getEngines:()=>Rr,getPeerDependencies:()=>Lr,greatest:()=>ni,latest:()=>ri,list:()=>ei,minor:()=>ii,newest:()=>ai,packageAuthorChanged:()=>kr,patch:()=>oi,semver:()=>si});const $r=S(async t=>{let n=await E(`pnpm-workspace.yaml`);if(!n)return{};let r=e.dirname(n),i=e.join(r,`.npmrc`),a;try{a=await o.readFile(i,`utf-8`)}catch{return{}}V(t,`\nUsing pnpm workspace config at ${i}:`,`verbose`);let s=Tr(C.parse(a),r);return V(t,s,`verbose`),s}),ei=async(e={})=>{if(!e.global)return zr(e);let{stdout:t}=await n(process.platform===`win32`?`pnpm.cmd`:`pnpm`,[`ls`,`-g`,`--json`]);return P(JSON.parse(t)[0].dependencies||{},(e,{version:t})=>({[e]:t}))},Y=e=>async(t,n,r={})=>e(t,n,r,{},await $r(r)),ti=Y(Br),ni=Y(Ir),ri=Y(Vr),ii=Y(Ur),ai=Y(Hr),oi=Y(Wr),si=Y(Gr);async function ci(e,t={},r,i){let{stdout:a}=await n(process.platform===`win32`?`pnpm.cmd`:`pnpm`,[...t.global?`global`:[],...Array.isArray(e)?e:[e],...t.prefix?`--prefix=${t.prefix}`:[]],i,r);return a}var li=ci,ui=j(((e,t)=>{function n(e){return e}t.exports=n})),di=j(((e,t)=>{t.exports=rt()(R(),`WeakMap`)})),fi=j(((e,t)=>{var n=di();t.exports=n&&new n})),pi=j(((e,t)=>{var n=ui(),r=fi();t.exports=r?function(e,t){return r.set(e,t),e}:n})),mi=j(((e,t)=>{var n=Xe(),r=Object.create;t.exports=function(){function e(){}return function(t){if(!n(t))return{};if(r)return r(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}()})),hi=j(((e,t)=>{var n=mi(),r=Xe();function i(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var i=n(e.prototype),a=e.apply(i,t);return r(a)?a:i}}t.exports=i})),gi=j(((e,t)=>{var n=hi(),r=R(),i=1;function a(e,t,a){var o=t&i,s=n(e);function c(){return(this&&this!==r&&this instanceof c?s:e).apply(o?a:this,arguments)}return c}t.exports=a})),_i=j(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),vi=j(((e,t)=>{var n=Math.max;function r(e,t,r,i){for(var a=-1,o=e.length,s=r.length,c=-1,l=t.length,u=n(o-s,0),d=Array(l+u),f=!i;++c<l;)d[c]=t[c];for(;++a<s;)(f||a<o)&&(d[r[a]]=e[a]);for(;u--;)d[c++]=e[a++];return d}t.exports=r})),yi=j(((e,t)=>{var n=Math.max;function r(e,t,r,i){for(var a=-1,o=e.length,s=-1,c=r.length,l=-1,u=t.length,d=n(o-c,0),f=Array(d+u),p=!i;++a<d;)f[a]=e[a];for(var m=a;++l<u;)f[m+l]=t[l];for(;++s<c;)(p||a<o)&&(f[m+r[s]]=e[a++]);return f}t.exports=r})),bi=j(((e,t)=>{function n(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}t.exports=n})),xi=j(((e,t)=>{function n(){}t.exports=n})),Si=j(((e,t)=>{var n=mi(),r=xi(),i=4294967295;function a(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=i,this.__views__=[]}a.prototype=n(r.prototype),a.prototype.constructor=a,t.exports=a})),Ci=j(((e,t)=>{function n(){}t.exports=n})),wi=j(((e,t)=>{var n=fi(),r=Ci();t.exports=n?function(e){return n.get(e)}:r})),Ti=j(((e,t)=>{t.exports={}})),Ei=j(((e,t)=>{var n=Ti(),r=Object.prototype.hasOwnProperty;function i(e){for(var t=e.name+``,i=n[t],a=r.call(n,t)?i.length:0;a--;){var o=i[a],s=o.func;if(s==null||s==e)return o.name}return t}t.exports=i})),Di=j(((e,t)=>{var n=mi(),r=xi();function i(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}i.prototype=n(r.prototype),i.prototype.constructor=i,t.exports=i})),Oi=j(((e,t)=>{function n(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}t.exports=n})),ki=j(((e,t)=>{var n=Si(),r=Di(),i=Oi();function a(e){if(e instanceof n)return e.clone();var t=new r(e.__wrapped__,e.__chain__);return t.__actions__=i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}t.exports=a})),Ai=j(((e,t)=>{var n=Si(),r=Di(),i=xi(),a=L(),o=qe(),s=ki(),c=Object.prototype.hasOwnProperty;function l(e){if(o(e)&&!a(e)&&!(e instanceof n)){if(e instanceof r)return e;if(c.call(e,`__wrapped__`))return s(e)}return new r(e)}l.prototype=i.prototype,l.prototype.constructor=l,t.exports=l})),ji=j(((e,t)=>{var n=Si(),r=wi(),i=Ei(),a=Ai();function o(e){var t=i(e),o=a[t];if(typeof o!=`function`||!(t in n.prototype))return!1;if(e===o)return!0;var s=r(o);return!!s&&e===s[0]}t.exports=o})),Mi=j(((e,t)=>{var n=800,r=16,i=Date.now;function a(e){var t=0,a=0;return function(){var o=i(),s=r-(o-a);if(a=o,s>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=a})),Ni=j(((e,t)=>{var n=pi();t.exports=Mi()(n)})),Pi=j(((e,t)=>{var n=/\{\n\/\* \[wrapped with (.+)\] \*/,r=/,? & /;function i(e){var t=e.match(n);return t?t[1].split(r):[]}t.exports=i})),Fi=j(((e,t)=>{var n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function r(e,t){var r=t.length;if(!r)return e;var i=r-1;return t[i]=(r>1?`& `:``)+t[i],t=t.join(r>2?`, `:` `),e.replace(n,`{
343
+ /* [wrapped with `+t+`] */
344
+ `)}t.exports=r})),Ii=j(((e,t)=>{function n(e){return function(){return e}}t.exports=n})),Li=j(((e,t)=>{var n=rt();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),Ri=j(((e,t)=>{var n=Ii(),r=Li(),i=ui();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),zi=j(((e,t)=>{var n=Ri();t.exports=Mi()(n)})),Bi=j(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}t.exports=n})),Vi=j(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}t.exports=n})),Hi=j(((e,t)=>{function n(e){return e!==e}t.exports=n})),Ui=j(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}t.exports=n})),Wi=j(((e,t)=>{var n=Vi(),r=Hi(),i=Ui();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),Gi=j(((e,t)=>{var n=Wi();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),Ki=j(((e,t)=>{var n=Bi(),r=Gi(),i=[[`ary`,128],[`bind`,1],[`bindKey`,2],[`curry`,8],[`curryRight`,16],[`flip`,512],[`partial`,32],[`partialRight`,64],[`rearg`,256]];function a(e,t){return n(i,function(n){var i=`_.`+n[0];t&n[1]&&!r(e,i)&&e.push(i)}),e.sort()}t.exports=a})),qi=j(((e,t)=>{var n=Pi(),r=Fi(),i=zi(),a=Ki();function o(e,t,o){var s=t+``;return i(e,r(s,a(n(s),o)))}t.exports=o})),Ji=j(((e,t)=>{var n=ji(),r=Ni(),i=qi(),a=1,o=2,s=4,c=8,l=32,u=64;function d(e,t,d,f,p,m,h,g,_,v){var y=t&c,b=y?h:void 0,x=y?void 0:h,S=y?m:void 0,C=y?void 0:m;t|=y?l:u,t&=~(y?u:l),t&s||(t&=~(a|o));var w=[e,t,p,S,b,C,x,g,_,v],T=d.apply(void 0,w);return n(e)&&r(T,w),T.placeholder=f,i(T,e,t)}t.exports=d})),Yi=j(((e,t)=>{function n(e){return e.placeholder}t.exports=n})),Xi=j(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e<t}t.exports=i})),Zi=j(((e,t)=>{var n=Oi(),r=Xi(),i=Math.min;function a(e,t){for(var a=e.length,o=i(t.length,a),s=n(e);o--;){var c=t[o];e[o]=r(c,a)?s[c]:void 0}return e}t.exports=a})),Qi=j(((e,t)=>{var n=`__lodash_placeholder__`;function r(e,t){for(var r=-1,i=e.length,a=0,o=[];++r<i;){var s=e[r];(s===t||s===n)&&(e[r]=n,o[a++]=r)}return o}t.exports=r})),$i=j(((e,t)=>{var n=vi(),r=yi(),i=bi(),a=hi(),o=Ji(),s=Yi(),c=Zi(),l=Qi(),u=R(),d=1,f=2,p=8,m=16,h=128,g=512;function _(e,t,v,y,b,x,S,C,w,T){var E=t&h,ee=t&d,te=t&f,D=t&(p|m),O=t&g,k=te?void 0:a(e);function A(){for(var d=arguments.length,f=Array(d),p=d;p--;)f[p]=arguments[p];if(D)var m=s(A),h=i(f,m);if(y&&(f=n(f,y,b,D)),x&&(f=r(f,x,S,D)),d-=h,D&&d<T){var g=l(f,m);return o(e,t,_,A.placeholder,v,f,g,C,w,T-d)}var ne=ee?v:this,re=te?ne[e]:e;return d=f.length,C?f=c(f,C):O&&d>1&&f.reverse(),E&&w<d&&(f.length=w),this&&this!==u&&this instanceof A&&(re=k||a(re)),re.apply(ne,f)}return A}t.exports=_})),ea=j(((e,t)=>{var n=_i(),r=hi(),i=$i(),a=Ji(),o=Yi(),s=Qi(),c=R();function l(e,t,l){var u=r(e);function d(){for(var r=arguments.length,f=Array(r),p=r,m=o(d);p--;)f[p]=arguments[p];var h=r<3&&f[0]!==m&&f[r-1]!==m?[]:s(f,m);return r-=h.length,r<l?a(e,t,i,d.placeholder,void 0,f,h,void 0,void 0,l-r):n(this&&this!==c&&this instanceof d?u:e,this,f)}return d}t.exports=l})),ta=j(((e,t)=>{var n=_i(),r=hi(),i=R(),a=1;function o(e,t,o,s){var c=t&a,l=r(e);function u(){for(var t=-1,r=arguments.length,a=-1,d=s.length,f=Array(d+r),p=this&&this!==i&&this instanceof u?l:e;++a<d;)f[a]=s[a];for(;r--;)f[a++]=arguments[++t];return n(p,c?o:this,f)}return u}t.exports=o})),na=j(((e,t)=>{var n=vi(),r=yi(),i=Qi(),a=`__lodash_placeholder__`,o=1,s=2,c=4,l=8,u=128,d=256,f=Math.min;function p(e,t){var p=e[1],m=t[1],h=p|m,g=h<(o|s|u),_=m==u&&p==l||m==u&&p==d&&e[7].length<=t[8]||m==(u|d)&&t[7].length<=t[8]&&p==l;if(!(g||_))return e;m&o&&(e[2]=t[2],h|=p&o?0:c);var v=t[3];if(v){var y=e[3];e[3]=y?n(y,v,t[4]):v,e[4]=y?i(e[3],a):t[4]}return v=t[5],v&&(y=e[5],e[5]=y?r(y,v,t[6]):v,e[6]=y?i(e[5],a):t[6]),v=t[7],v&&(e[7]=v),m&u&&(e[8]=e[8]==null?t[8]:f(e[8],t[8])),e[9]??=t[9],e[0]=t[0],e[1]=h,e}t.exports=p})),ra=j(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),ia=j(((e,t)=>{var n=ra(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),aa=j(((e,t)=>{var n=ia(),r=Xe(),i=Je(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),oa=j(((e,t)=>{var n=aa(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),sa=j(((e,t)=>{var n=oa();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),ca=j(((e,t)=>{var n=pi(),r=gi(),i=ea(),a=$i(),o=ta(),s=wi(),c=na(),l=Ni(),u=qi(),d=sa(),f=`Expected a function`,p=1,m=2,h=8,g=16,_=32,v=64,y=Math.max;function b(e,t,b,x,S,C,w,T){var E=t&m;if(!E&&typeof e!=`function`)throw TypeError(f);var ee=x?x.length:0;if(ee||(t&=~(_|v),x=S=void 0),w=w===void 0?w:y(d(w),0),T=T===void 0?T:d(T),ee-=S?S.length:0,t&v){var te=x,D=S;x=S=void 0}var O=E?void 0:s(e),k=[e,t,b,x,S,te,D,C,w,T];if(O&&c(k,O),e=k[0],t=k[1],b=k[2],x=k[3],S=k[4],T=k[9]=k[9]===void 0?E?0:e.length:y(k[9]-ee,0),!T&&t&(h|g)&&(t&=~(h|g)),!t||t==p)var A=r(e,t,b);else A=t==h||t==g?i(e,t,T):(t==_||t==(p|_))&&!S.length?o(e,t,b,x):a.apply(void 0,k);return u((O?n:l)(A,k),e,t)}t.exports=b})),la=j(((e,t)=>{var n=ca(),r=8;function i(e,t,a){t=a?void 0:t;var o=n(e,r,void 0,void 0,void 0,void 0,void 0,t);return o.placeholder=i.placeholder,o}i.placeholder={},t.exports=i})),ua=M({default:()=>Na,defaultPrefix:()=>xa,distTag:()=>Ca,getEngines:()=>ja,getPathToLookForYarnrc:()=>ha,getPeerDependencies:()=>Aa,greatest:()=>wa,latest:()=>Ta,list:()=>Sa,minor:()=>Ea,newest:()=>Da,npmAuthTokenKeyValue:()=>pa,packageAuthorChanged:()=>Ma,patch:()=>Oa,semver:()=>ka}),da=Ce(la(),1);const fa=(e,t)=>e.replace(/\$\{([^:-]+)(?:(:)?-([^}]*))?\}/g,(e,n,r,i,a)=>t[n]||(i?a:``)),pa=(0,da.default)((e,t,n)=>{if(n.npmAuthToken){let r=n.npmRegistryServer||e[`@${t}:registry`];if(r){let e=r.replace(/^https?:/,``);return e.endsWith(`/`)&&(e=e.slice(0,-1)),{[`${e}/:_authToken`]:fa(n.npmAuthToken,process.env)}}}return null}),ma=(e,t)=>t.npmRegistryServer?{[`@${e}:registry`]:fa(t.npmRegistryServer,process.env)}:null;async function ha(t,n=o.readdir){if(t.global)return;let r=(await Zn(t,n))?.directoryPath;if(r)return e.join(r,`.yarnrc.yml`)}const ga=S(async t=>{let n=await ha(t),r=e.join(i.homedir(),`.yarnrc.yml`),a=typeof n==`string`&&await Pe(n),s=await Pe(r),c=a?await o.readFile(n,`utf-8`):``,l=s?await o.readFile(r,`utf-8`):``,u=k.load(c),d=k.load(l),f={...N(d?.npmScopes||{},ma),...N(u?.npmScopes||{},ma)};return f={...f,...N(d?.npmScopes||{},pa(f)),...N(u?.npmScopes||{},pa(f))},a&&(V(t,`\nUsing local yarn config at ${n}:`,`verbose`),V(t,u,`verbose`)),s&&(V(t,`\nUsing user yarn config at ${r}:`,`verbose`),V(t,u,`verbose`)),Object.keys(f)&&(V(t,`
345
+ Merged yarn config in npm format:`,`verbose`),V(t,f,`verbose`)),f});function _a(e){return new Promise((t,n)=>{let r={},i=A.parse();i.on(`data`,e=>{if(e.type===`info`&&!e.data.match(/^Visit/)){let[,t,n]=e.data.match(/"(@?.*)@(.*)"/)||[];r[t]={version:n,from:t}}else e.type===`error`&&n(Error(e.data))}),i.on(`end`,()=>{t({dependencies:r})}),i.on(`error`,n),i.write(e),i.end()})}function va(e){return new Promise((t,n)=>{let r=A.parse(),i=!1;r.on(`data`,e=>{i||(i=!0,t(JSON.stringify(e)))}),r.on(`error`,n),r.write(e),r.end()})}const ya=process.platform===`win32`?`yarn.cmd`:`yarn`;async function ba(e,t={},r={},i={}){let{stdout:a}=await n(ya,[...t.global?[`global`]:[],...t.prefix?[`--prefix=${t.prefix}`]:[],`--depth=0`,`--json`,`--no-progress`,...Array.isArray(e)?e:[e]],r,i);return a}async function xa(e){if(e.prefix)return Promise.resolve(e.prefix);let{stdout:t}=await n(ya,[`global`,`dir`]).catch(()=>({stdout:null}));return e.global&&t&&t.match(`Cellar`)?`/usr/local`:process.platform===`win32`&&e.global&&!process.env.prefix?t?t.trim():`${process.env.LOCALAPPDATA}\\Yarn\\Data\\global`:null}const Sa=async(e={},t)=>N((await _a(await ba(`list`,e,{},{...e.cwd?{cwd:e.cwd}:{},...t}))).dependencies,(e,t)=>({[e]:t.version||t.required?.version})),X=e=>async(t,n,r={})=>e(t,n,r,await ga(r)),Ca=X(Br),wa=X(Ir),Ta=X(Vr),Ea=X(Ur),Da=X(Hr),Oa=X(Wr),ka=X(Gr),Aa=async(e,t,r)=>{let{stdout:i}=await n(ya,[`--version`],{rejectOnError:!1},r);if(i.startsWith(`1`)){let i=[`--json`,`info`,`${e}@${t}`,`peerDependencies`],{stdout:a}=await n(ya,i,{rejectOnError:!1},r);return a&&Or(a,{command:i.join(` `)}).data||{}}else{let i=[`--json`,`npm`,`info`,`${e}@${t}`,`--fields`,`peerDependencies`],{stdout:a}=await n(ya,i,{rejectOnError:!1},r);if(!a)return{};try{return Or(a,{command:i.join(` `)}).peerDependencies||{}}catch(e){try{let e=await va(a);if(e)return Or(e,{command:i.join(` `)}).peerDependencies||{}}catch{}throw e}}},ja=async(e,t,n={})=>Rr(e,t,n,await ga(n)),Ma=async(e,t,n,r={})=>kr(e,t,n,r,await ga(r));var Na=ba;function Pa(e,t,{color:n=!0}={}){if(e.cli)V(e,n?F.red(t):t,null,`error`),process.exit(1);else throw Error(t)}var Z=Pa,Fa=async(e,t)=>{let n,r;try{r=await o.readFile(t,`utf-8`),n=JSON.parse(r)}catch{Z(e,`Missing or invalid ${t}`)}return{name:void 0,pkg:n,pkgFile:r,filepath:t}};const Ia={dev:`devDependencies`,peer:`peerDependencies`,prod:`dependencies`,optional:`optionalDependencies`};var La=e=>(e?typeof e==`string`?e.split(`,`):e:K.dep.default).map(e=>Ia[e]||e);function Ra(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}async function za(e,t,n){let r=await o.readFile(e,`utf-8`);return Object.entries(n).filter(([e])=>t[e]).reduce((e,[n,r])=>{let i=t[n],a=`(${Ra(n)}\\s*:\\s*["'])(${Ra(i)})(["'])`,o=`(${Ra(n)}\\s*:\\s*)(${Ra(i)})(\\s*(?:\\n|$))`,s=new RegExp(a,`g`),c=new RegExp(o,`g`);return e.replace(s,`$1${r}$3`).replace(c,`$1${r}$3`)},r)}async function Ba(e,t,n){let r=await o.readFile(e,`utf-8`);return Object.entries(n).filter(([e])=>t[e]).reduce((e,[n,r])=>{let i=t[n],a=`("${Ra(n)}"\\s*:\\s*")(${Ra(i)})(")`,o=new RegExp(a,`g`);return e.replace(o,`$1${r}$3`)},r)}async function Va(t,n,r){let i=e.extname(t);if(i===`.yaml`||i===`.yml`)return za(t,n,r);if(i===`.json`)return Ba(t,n,r);throw Error(`Unsupported catalog file type: ${t}`)}var Ha=Va;function Ua(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}async function Wa(t,n,r,i,a){if(a){let i=e.basename(a),s=e.extname(a);if(a.includes(`#catalog`)){let t=a.replace(`#catalog`,``);if(e.extname(t)===`.json`)return Ha(t,n,r)}if(i===`pnpm-workspace.yaml`||i.includes(`catalog`)&&(s===`.yaml`||s===`.yml`)){let e=JSON.parse(t);if(typeof e==`object`&&e.name===`catalog-dependencies`&&typeof e.dependencies==`object`&&Object.keys(e).length<=3){let e=await o.readFile(a,`utf-8`),t=k.load(e);if(t.catalogs&&=Object.entries(t.catalogs).reduce((e,[t,n])=>({...e,[t]:{...n,...Object.entries(r).filter(([e])=>n[e]).reduce((e,[t,n])=>({...e,[t]:n}),{})}}),{}),t.catalog){let e=t.catalog;t.catalog={...e,...Object.entries(r).filter(([t])=>e[t]).reduce((e,[t,n])=>({...e,[t]:n}),{})}}return t.catalogs?.default&&(t.catalog=t.catalogs.default),JSON.stringify(t,null,2)}return Ha(a,n,r)}if(s===`.json`){let e=JSON.parse(t),i=e.catalog||e.catalogs,o=e.workspaces&&!Array.isArray(e.workspaces)&&(e.workspaces.catalog||e.workspaces.catalogs);if(i||o)return Ha(a,n,r)}}let s=[...La(i.dep),`overrides`],c=RegExp(`"(${s.join(`|`)})"s*:[^}]*`,`g`),l=t.replace(c,e=>Object.entries(r).reduce((e,[t])=>{let i=`"${t}"\\s*:\\s*("|{\\s*"."\\s*:\\s*")(${Ua(n[t])})"`,a=new RegExp(i,`g`);return e.replace(a,(e,n)=>`"${t}${n?`": ${n}`:`: `}${r[t]}"`)},e));if(s.includes(`packageManager`)){let e=JSON.parse(t);if(e.packageManager){let[t]=e.packageManager.split(`@`);r[t]&&(l=l.replace(/"packageManager"\s*:\s*".*?@[^"]*"/,`"packageManager": "${t}@${r[t]}"`))}}return l}var Ga=Wa;const Ka=(e,t,n,{spawnOptions:r,spawnPleaseOptions:i}={})=>{n&&console.log(F.blue([t.packageManager,...e].join(` `)));let a={cwd:t.cwd||process.cwd(),env:{...process.env,...t.packageManager===`pnpm`?null:{CI:`1`},FORCE_COLOR:`1`,...r?.env},...r},o={...t.global?{global:!0}:null,...t.prefix?{prefix:t.prefix}:null};return(t.packageManager===`pnpm`?li:t.packageManager===`yarn`?Na:t.packageManager===`bun`?Zr:Kr)(e,o,i,a)},qa=async e=>{(e.packageData||e.packageFile)&&(console.error(`--packageData and --packageFile are not allowed with --doctor. You must execute "ncu --doctor" in a directory with a package file so it can install dependencies and test them.`),process.exit(1));let t;try{t=await Fa(e,`package.json`)}catch{console.error(`Missing or invalid package.json`),process.exit(1)}return!e.doctorTest&&!t.pkg.scripts?.test&&(console.error(`No npm "test" script defined. You must define a "test" script in the "scripts" section of your package.json to use --doctor.`),process.exit(1)),t};var Ja=async(e,t)=>{await Me();let r=t.packageManager===`yarn`?`yarn.lock`:t.packageManager===`pnpm`?`pnpm-lock.yaml`:t.packageManager===`bun`?`bun.lock`:`package-lock.json`,{pkg:i,pkgFile:a}=await qa(t),s={...i.dependencies,...i.devDependencies,...i.optionalDependencies},c=async()=>{if(t.doctorInstall){let[e,...r]=t.doctorInstall.split(` `);console.log(F.blue(t.doctorInstall)),await n(e,r)}else await Ka([`install`],{packageManager:t.packageManager},!0)},l=async()=>{let e={stderr:e=>{console.error(F.red(e.toString()))},stdout:e=>{process.stdout.write(e.toString())}};if(t.doctorTest){let r=t.doctorTest.matchAll(/"(.+?)"|'(.+?)'|[^ ]+/g),i=[];for(let e of r)i=[...i,e[2]||e[1]||e[0]];let[a,...o]=i;console.log(F.blue(t.doctorTest)),await n(a,o,e)}else await Ka([`run`,`test`],{packageManager:t.packageManager},!0,{spawnPleaseOptions:e})};console.log(`Running tests before upgrading`),await c();let u=``;try{u=await o.readFile(r,`utf-8`)}catch{if(t.packageManager===`bun`){r=`bun.lockb`;try{u=await o.readFile(r,`utf-8`)}catch{}}}try{await l()}catch{console.error(`Tests failed before we even got started!`),process.exit(1)}t.interactive||console.log(`Upgrading all dependencies and re-running tests`),console.log(F.blue(`ncu `+process.argv.slice(2).filter(e=>e!==`--doctor`).join(` `))),process.env.NCU_DOCTOR=`1`;let d=await e({...t,silent:!0,doctor:!1});if(Object.keys(d||{}).length===0){console.log(`All dependencies are up-to-date `+F.green.bold(`:)`));return}let f=!1;try{await c(),f=!0,await l(),console.log(`${F.green(`✓`)} Tests pass`),await Mn(t,{current:s,upgraded:d,total:Object.keys(d||{}).length}),console.log(`\n${t.interactive?`Chosen`:`All`} dependencies upgraded and installed ${F.green(`:)`)}`)}catch{console.error(F.red(f?`Tests failed`:`Install failed`)),console.log(`Identifying broken dependencies`),await o.writeFile(`package.json`,a),u?await o.writeFile(r,u):await o.rm(r,{recursive:!0,force:!0});let e=a;if(f)try{await c()}catch{let e=(t.packageManager||`npm`)+` install`;throw Error(`Error: Doctor mode was about to test individual upgrades, but ${F.cyan(e)} failed after rolling back to your existing package and lock files. This is unexpected since the initial install before any upgrades succeeded. Either npm failed to revert a partial install, or failed anomalously on the second run. Please check your internet connection and retry. If doctor mode fails consistently, report a bug with your complete list of dependency versions at https://github.com/raineorshine/npm-check-updates/issues.`)}let n,p;for([n,p]of Object.entries(d))try{if(await Ka([...t.packageManager===`yarn`||t.packageManager===`pnpm`||t.packageManager===`bun`?[`add`]:[`install`,`--no-save`],`${n}@${p}`],{packageManager:t.packageManager},!0),i.scripts?.prepare)try{await Ka([`run`,`prepare`],{packageManager:t.packageManager},!0)}catch(e){throw console.error(F.red(`Prepare script failed`)),e}await l(),console.log(` ${F.green(`✓`)} ${n} ${s[n]} → ${p}`),e=await Ga(e,{[n]:s[n]},{[n]:p},t),u=await o.readFile(r,`utf-8`)}catch(i){console.error(` ${F.red(`✗`)} ${n} ${s[n]} → ${p}\n`),console.error(F.red(i)),await o.writeFile(r,u),(t.packageManager===`yarn`||t.packageManager===`pnpm`||t.packageManager===`bun`)&&await o.writeFile(`package.json`,e)}e!==a&&(console.log(`Saving partially upgraded package.json`),await o.writeFile(`package.json`,e)),await c()}};async function Ya(t){let n,r=null,i=t.packageFile||`package.json`;function a(n,r){if(n!=null){let r=e.resolve(n);V(t,`${t.upgrade?`Upgrading`:`Checking`} ${r}`)}else Z(t,`${F.red(`No ${r}`)}\n\nPlease add a ${r} to the current directory, specify the ${F.cyan(`--packageFile`)} or ${F.cyan(`--packageData`)} options, or pipe a ${r} to stdin and specify ${F.cyan(`--stdin`)}.`,{color:!1});return o.readFile(n,`utf-8`).catch(e=>{Z(t,e)})}if(V(t,`Running in local mode`,`verbose`),V(t,`Finding package file data`,`verbose`),t.packageData)r=null,n=Promise.resolve(t.packageData);else if(t.packageFile)r=t.packageFile,n=a(r,i);else if(t.stdin){V(t,`Waiting for package data on stdin`,`verbose`);let e=await ne(process.stdin),o=e.trim().length>0?e:null;r=o||!i?null:await E(i),n=o||a(await r,i)}else r=i?await E(!t.packageFile&&t.packageManager===`deno`?[`deno.json`,`deno.jsonc`]:i,{cwd:t.cwd||process.cwd()}):null,n=a(r,i);return{pkgData:await n,pkgFile:r||null,pkgPath:i}}var Xa=Ya;function Za(e){return{ignore:[`**/node_modules/**`,...typeof e.ignoreDirs==`string`?[e.ignoreDirs]:e.ignoreDirs||[]]}}const Qa=async t=>{let n=e.join(e.dirname(t),`pnpm-workspace.yaml`),r;try{r=await o.readFile(n,`utf-8`)}catch{return null}return k.load(r)},$a=async(e,t)=>{let n={};if(e.packageManager===`pnpm`){let e=await Qa(t);e&&!Array.isArray(e)&&(e.catalog&&Object.assign(n,e.catalog),e.catalogs&&Object.assign(n,...Object.values(e.catalogs)))}let r=JSON.parse(await o.readFile(t,`utf-8`));return Object.assign(n,r.catalog,...Object.values(r.catalogs??{})),r.workspaces&&!Array.isArray(r.workspaces)&&Object.assign(n,r.workspaces.catalog,...Object.values(r.workspaces.catalogs??{})),Object.keys(n).length>0?n:null};async function eo(t,n,r,i){let{pkgData:a,pkgPath:o}=await Xa({...t,packageFile:r,loglevel:`silent`}),s=(typeof a==`string`?JSON.parse(a):a).workspaces||await Qa(o||``),c=Array.isArray(s)?s:s?.packages;c||Z(t,`workspaces property missing from package.json. --workspace${t.workspaces?`s`:``} only works when you specify a "workspaces" property in your package.json.`);let l=(c||[]).map(t=>e.join(i,t,`package.json`).replace(/\\/g,`/`)),u=Za(t),d=re.sync(l,u),f=await Promise.all(d.map(async e=>{let n=await Fa(t,e);return n.name=n.pkg.name||e.split(`/`).slice(-2)[0],n})),p=f.map(e=>e.name||``);return t.workspaces===!0?[f,p]:[f.filter(r=>t.workspace?.some(t=>c?.some(a=>r.name===t||r.filepath===e.join(i,e.dirname(a),t,n).replace(/\\/g,`/`)))),p]}async function to(t,n){if(!n)return null;let r=await $a(t,n);if(!r)return null;let i={name:`catalog-dependencies`,version:`1.0.0`,dependencies:r};return{filepath:t.packageManager===`pnpm`?e.join(e.dirname(n),`pnpm-workspace.yaml`):`${n}#catalog`,pkg:i,pkgFile:JSON.stringify(i,null,2),name:`catalogs`}}async function no(t){let n=t.packageFile||`package.json`,r=t.cwd?T(t.cwd):`./`,i=t.packageFile||(t.cwd?e.join(r,`package.json`):`package.json`),a=t.workspaces===!0||t.workspace!==void 0&&t.workspace.length!==0,o=[];if(!a||t.root===!0){let e=i.replace(/\\/g,`/`),n=Za(t),r=re.sync(e,n),a=await Promise.all(r.map(async e=>await Fa(t,e)));o=[...o,...a]}if(!a)return[o,[]];let s=null;if(a){let{pkgPath:e}=await Xa({...t,packageFile:i,loglevel:`silent`});e&&(s=await to(t,e))}let[c,l]=await eo(t,n,i,r);if(o=[...o,...c],s&&(o=[...o,s]),t.ignoreDirs){let n=Array.isArray(t.ignoreDirs)?t.ignoreDirs:[t.ignoreDirs];o=o.filter(t=>{let i=e.relative(r,t.filepath).replace(/\\/g,`/`),a=e.dirname(i).replace(/\\/g,`/`);return!n.some(e=>{let t=ie(e);return t(i)||t(a)||t(`${a}/`)})})}return[o,l]}var ro=no;async function io({configFileName:t,configFilePath:n,packageFile:r,global:a,options:o}){let{default:s,Chalk:c}=await import(`./source.js`),l=o?.color?new c({level:1}):s,u=ae(`ncurc`,{configFileName:t||`.ncurc`,defaultExtension:[`.json`,`.yml`,`.js`],cwd:n||(a?i.homedir():r?e.dirname(r):void 0)}),d=u?.filePath;t&&!d&&Z(o,`Config file ${t} not found in ${n||process.cwd()}`);let{$schema:f,...p}=u?.config||{},m=p;typeof m.format==`string`&&(m.format=K.format.parse(m.format));let h=Object.keys(m).filter(e=>!K[e]);return h.length>0&&(console.error(l.red(`Unknown option${h.length===1?``:`s`} found in config file:`),l.gray(h.join(`, `))),console.info(`Using config file `+d),console.info(`You can change the config file path with ${l.blue(`--configFilePath`)}`)),{filePath:d,args:Object.entries(m).flatMap(([e,t])=>typeof t==`boolean`||K[e]?.type===`boolean`?t?[`--${e}`]:[]:[`--${e}`,t]),config:m}}var ao=io,oo=M({greatest:()=>fo,greatestLevel:()=>po,latest:()=>uo,minor:()=>mo,newest:()=>_o,patch:()=>ho,semver:()=>go});const so=ce(se.execFile);async function co(e){let t=(await so(`git`,[`ls-remote`,`--tags`,e])).stdout,n={};for(let e of t.trim().split(`
346
+ `)){let t=e.split(` `);n[t[1].replace(/^refs\/tags\/|\^{}$/g,``)]=t[0]}return n}async function lo(e,t,n){t=t.replace(/^github:/,``);let{auth:r,protocol:i,host:a,path:o}=l(t),s;try{if(i!==null)s=await co(`${i?i.replace(`git+`,``):`https:`}//${r?r+`@`:``}${a}/${o?.replace(/^:/,``)}`);else try{s=await co(`ssh://git@${a}/${o?.replace(/^:/,``)}`)}catch{s=await co(`https://${r?r+`@`:``}${a}/${o}`)}}catch{V(n??{},`Invalid, private repo, or no tags for ${e}: ${t}`,`verbose`);return}return Object.keys(s).map(fn).filter(e=>h(e)).sort(rn)}const uo=async(e,t,n)=>{let r=await lo(e,t,n);if(!r)return{version:null};let i=n?.pre?r:r.filter(e=>!on(e)),a=i[i.length-1];return{version:a?Sn(t,a):null}},fo=async(e,t,n)=>{let r=await lo(e,t,n);if(!r)return{version:null};let i=r[r.length-1];return{version:i?Sn(t,i):null}},po=e=>async(t,n,r={})=>{let i=decodeURIComponent(l(n).branch).replace(/^semver:/,``),a=await lo(t,n,r);if(!a)return{version:null};let o=an(a.map(e=>e.replace(/^v/,``)),i,e);return{version:o?Sn(n,o):null}},mo=po(`minor`),ho=po(`patch`),go=async(e,t,n)=>({version:null}),_o=fo;var vo=M({latest:()=>xo});const yo=e=>e&&e.startsWith(`http://`)||e.startsWith(`https://`),bo=S(async e=>{let t=e.registry,n;if(yo(t))n=await(await fetch(t)).text();else try{n=await o.readFile(t,`utf8`)}catch{Z(e,`\nThe specified static registry file does not exist: ${e.registry}`)}return JSON.parse(n)}),xo=async(e,t,n)=>({version:(await bo(n||{}))[e]||null});var Q={npm:br,pnpm:Qr,yarn:ua,bun:qr,gitTags:oo,staticRegistry:vo};function So(e){if(typeof e==`string`)return e.trim();if(Array.isArray(e)&&(e.length===0||typeof e[0]==`string`)){let t=e.map(e=>typeof e==`string`?e.trim():e).filter(e=>e);return t.length>0?t:void 0}else return e}function Co(e){try{return new URL(e),!0}catch{return!1}}async function wo(e,{cli:t}={}){let{default:n,Chalk:r}=await import(`./source.js`),i=e.color?new r({level:1}):n;if(!t){let t=Yn.reduce((e,t)=>({...e,...t.default==null?null:{[t.long]:t.default}}),{}),n={jsonUpgraded:!0,silent:e.silent||e.loglevel===void 0&&!e.verbose,args:[]};e={...t,...n,...e}}let a={...e,...e.packageData&&typeof e.packageData!=`string`?{packageData:JSON.stringify(e.packageData,null,2)}:null,cli:t},o=a.silent||a.format?.includes(`lines`)?`silent`:a.verbose?`verbose`:a.loglevel,s=Object.keys(a).filter(e=>e.startsWith(`json`)).some((0,zt.default)(a));!s&&o!==`silent`&&a.rcConfigPath&&!a.doctor&&V(a,`Using config file ${a.rcConfigPath}`);let c=Yn.filter(({long:e,deprecated:t})=>t&&a[e]||e===`packageManager`&&a.packageManager===`staticRegistry`);c.length>0&&(c.forEach(({long:e,description:t})=>{let n=e===`packageManager`?`--packageManager staticRegistry is deprecated. Use --registryType json.`:`--${e}: ${t}`;V(a,i.yellow(n),`warn`)}),V(a,``,`warn`)),Yn.forEach(({long:e,choices:t})=>{if(!t||t.length===0)return;let n=a[e],r=Array.isArray(n)?n:[n];r.length!==0&&r.every(e=>!t.includes(e))&&Z(a,`Invalid option value: --${e} ${n}. Valid values are: ${t.join(`, `)}.`)}),a.cwd&&!await Pe(a.cwd)&&Z(a,`No such directory: ${a.cwd}`);let l=So(a.args),u=So(a.filter),d=So(a.filterVersion),f=So(a.reject),p=So(a.rejectVersion),m=a.registryType||(a.registry?.endsWith(`.json`)?`json`:`npm`);if(a.filter&&l&&!oe(l.join(` `),Array.isArray(u)?u.join(` `):u)?Z(a,`Cannot specify a filter using both --filter and args. Did you forget to quote an argument?
347
+ See: https://github.com/raineorshine/npm-check-updates/issues/759#issuecomment-723587297`):a.packageFile&&a.deep?Z(a,`Cannot specify both --packageFile and --deep. --deep is an alias for --packageFile '**/package.json'`):a.format?.includes(`lines`)&&a.jsonUpgraded?Z(a,`Cannot specify both --format lines and --jsonUpgraded.`):a.format?.includes(`lines`)&&a.jsonAll?Z(a,`Cannot specify both --format lines and --jsonAll.`):a.format?.includes(`lines`)&&a.format.length>1?Z(a,`Cannot use --format lines with other formatting options.`):a.workspace?.length&&a.workspaces?Z(a,`Cannot specify both --workspace and --workspaces.`):a.deep&&(a.workspace?.length||a.workspaces)?Z(a,`Cannot specify both --deep and --workspace${a.workspaces?`s`:``}.`):a.doctor&&(a.workspace?.length||a.workspaces)?Z(a,`Doctor mode is not currently supported with --workspace${a.workspaces?`s`:``}.`):a.packageManager===`staticRegistry`&&!a.registry?Z(a,`When --package-manager staticRegistry is specified, you must provide the path for the registry file with --registry.`):a.registryType===`json`&&!a.registry?Z(a,`When --registryType json is specified, you must provide the path for the registry file with --registry. Run "ncu --help registryType" for details.`):m!==`json`&&a.registry&&!Co(a.registry)&&Z(a,`--registry must be a valid URL. Invalid value: "${a.registry}"`),a.cooldown!=null){let e=typeof a.cooldown==`number`&&!isNaN(a.cooldown)&&a.cooldown>=0,t=typeof a.cooldown==`function`;!e&&!t&&Z(a,`Cooldown must be a non-negative integer representing days since published or a function`)}let h=a.target||`latest`,g=h===`newest`||h===`greatest`,_=await er(a),v={...a,...a.deep?{packageFile:`**/package.json`}:null,..._===`deno`?{dep:[`imports`]}:null,...a.format&&a.format.length>0?{format:a.format}:null,filter:l||u,filterVersion:d,json:s,loglevel:o,minimal:a.minimal===void 0?!1:a.minimal,...a.pre!=null||g?{pre:a.pre==null?g:!!a.pre}:null,reject:f,rejectVersion:p,target:h,...a.interactive&&a.upgrade===void 0?{upgrade:!s}:null,packageManager:_,...a.prefix?{prefix:await(Q[_||``]?.defaultPrefix||Q.npm.defaultPrefix)(a)}:null,registryType:m};v.cacher=await Vn(v);let y=P(v,(e,t)=>t===void 0?null:{[e]:t});return!a.packageManager&&_!==`npm`&&V(y,`Using ${_}`),y}var To=wo;function Eo(e,t){return Array.from(new Set([...e||[],...t||[]]))}function Do(e,t){let n=e||{},r=t||{},i={...n,...r};return Object.keys(i).forEach(e=>{Array.isArray(n[e])&&Array.isArray(r[e])&&(i[e]=Eo(n[e],r[e]))}),i}var Oo=Do,ko=Ce(ui(),1);function Ao(e){let t;if(!e)t=ko.default;else if(typeof e==`string`)if(e[0]===`/`&&e.at(-1)===`/`){let n=new RegExp(e.slice(1,-1));t=e=>n.test(e)}else{let n=e.split(/[\s,]+/);t=e=>n.some(ue(t=>ie(t)(e),t=>!t.includes(`/`)&&e.includes(`/`)&&ie(t)(e.replace(/\//g,`_`))))}else if(Array.isArray(e))t=(t,n)=>e.some(e=>Ao(e)(t,n));else if(e instanceof RegExp)t=t=>e.test(t);else if(typeof e==`function`)t=(t,n)=>e(t,y(n??t));else throw TypeError(`Invalid filter. Must be a RegExp, array, or comma-or-space-delimited list.`);return t}function jo(e,t,n,r){return le((n,r)=>le(e?Ao(e):!0,t?(...e)=>!Ao(t)(...e):!0)(n,r),(e,t)=>le(n?Ao(n):!0,r?(...e)=>!Ao(r)(...e):!0)(t))}var Mo=jo;function No(e,t){return!t||t===`deno`?Q.npm:e.registryType===`json`?Q.staticRegistry:(Q[t]||Z(e,`Invalid package manager: ${t}`),Q[t])}var Po=No;async function Fo(e={}){let t=await Po(e,e.packageManager).list?.({cwd:e.cwd,prefix:e.prefix,global:e.global});t||Z(e,`Unable to retrieve package list`);let n=Mo(e.filter,e.reject,e.filterVersion,e.rejectVersion),r={};try{r=I(t,(e,t)=>!!t&&!Zt(t)&&n(e,t))}catch(t){Z(e,`Invalid filter: `+t.message||t)}return r}var Io=Fo;function Lo(e,t){let n=[[t]];for(;n.length>0;){let t=[];for(let r of n){let n=Object.keys(e[r[0]]??{});for(let e of n){if(e===r.at(-1))return{isCircular:!0,offendingPackage:r[0]};t.push([e,...r])}}n=t}return{isCircular:!1}}async function Ro(e,t){let n=Po(t,t.packageManager);if(!n.getPeerDependencies)return{};let r=Object.keys(e).length,i;!t.json&&t.loglevel!==`silent`&&t.loglevel!==`verbose`&&r>0&&(i=new fe(`[:bar] :current/:total :percent`,{total:r,width:20}),i.render());let a=await de(Object.entries(e),async([e,r])=>{let a,o=t.cacher?.getPeers(e,r);return o?a=o:(a=await n.getPeerDependencies(e,r,{cwd:t.cwd}),t.cacher?.setPeers(e,r,a)),i&&i.tick(),{pkg:e,dependencies:a}},{concurrency:t.concurrency}),o={};for(let{pkg:e,dependencies:t}of a){o[e]=t;let n=Lo(o,e);n.isCircular&&delete o[e][n.offendingPackage]}return await t.cacher?.save(),t.cacher?.log(!0),o}var zo=Ro;function Bo(e,t){let n={};for(let r of t)n[r]=e[r];return n}function $(e,t){let n={};for(let[r,i]of Object.entries(e??{})){let e=r;t(i,e)&&(n[e]=i)}return n}const Vo=[`latest`,`newest`,`greatest`,`minor`,`patch`,`semver`];async function Ho(e,t={}){let{default:n,Chalk:r}=await import(`./source.js`),i=t.color?new r({level:1}):n,a=Object.keys(e),o=Po(t,t.packageManager),s;!t.json&&t.loglevel!==`silent`&&t.loglevel!==`verbose`&&a.length>0&&(s=new fe(`[:bar] :current/:total :percent`,{total:a.length,width:20}),s.render());async function c(n){let r=hn(e[n]),[a,c]=r||[n,e[n]],l=t.target||`latest`,u=typeof l==`string`?l:l(a,y(c)),[d,f]=u.startsWith(`@`)?[`distTag`,u.slice(1)]:[u,`latest`],p=t.cacher?.get(a,d);if(p)return s?.tick(),{version:p};let m,h=vn(e[n]),g=h?Q.gitTags:o,_=h?`github urls`:t.packageManager||`npm`,v=g[d];if(!v){let e=Vo.filter(e=>e in g);Z(t,i.red(`\nUnsupported target "${d}" using ${_}`)+`
348
+ Supported version targets are: `+e.join(`, `)+(h?``:`, and tags (e.g. @next)`),{color:!1})}try{m=await v(a,c,{...t,distTag:f,pre:t.pre==null?u.startsWith(`@`)||on(c):t.pre,retry:t.retry??2}).catch(e=>({error:e?.body?.error||e.toString()})),m.version=!h&&r&&m?.version?mn(a,m.version):m?.version??null}catch(e){let n=e?(e.message||e).toString():``;if(n.match(/E504|Gateway Timeout/i))return{error:`${n}. All ${t.retry} retry attempts failed.`};if(n.match(/E400|E404|ENOTFOUND|404 Not Found|400 Bad Request/i))return{error:`${n.replace(/ - Not found$/i,``)}. All ${t.retry} retry attempts failed. Either your internet connection is down, the registry is inaccessible, the authentication credentials are invalid, or the package does not exist.`};if(e.code===`ERR_INVALID_URL`)return{error:n||`Invalid URL`};throw!process.env.NCU_TESTS&&/(Response|network) timeout/i.test(n)&&console.error(`
349
+
350
+ `+i.red(`FetchError: Request Timeout. npm-registry-fetch defaults to 30000 (30 seconds). Try setting the --timeout option (in milliseconds) to override this.`)+`
351
+ `),e}return s?.tick(),m.version&&t.cacher?.set(a,d,m.version),m}let l=await de(a,c,{concurrency:t.concurrency});return await t.cacher?.save(),t.cacher?.log(),P(l,(e,t)=>e.version||e.error?{[a[t]]:e}:null)}var Uo=Ho,Wo=j(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}t.exports=n})),Go=j(((e,t)=>{var n=Ke(),r=qe(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),Ko=j(((e,t)=>{var n=Go(),r=qe(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),qo=j(((e,t)=>{var n=Ue(),r=Ko(),i=L(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),Jo=j(((e,t)=>{var n=Wo(),r=qo();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c<l;){var u=e[c];t>0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),Yo=j(((e,t)=>{var n=Jo();function r(e){return e!=null&&e.length?n(e,1):[]}t.exports=r})),Xo=j(((e,t)=>{var n=_i(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o<s;)c[o]=a[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=a[o];return l[t]=i(c),n(e,this,l)}}t.exports=i})),Zo=j(((e,t)=>{var n=Yo(),r=Xo(),i=zi();function a(e){return i(r(e,void 0,n),e+``)}t.exports=a})),Qo=j(((e,t)=>{var n=Di(),r=Zo(),i=wi(),a=Ei(),o=L(),s=ji(),c=`Expected a function`,l=8,u=32,d=128,f=256;function p(e){return r(function(t){var r=t.length,p=r,m=n.prototype.thru;for(e&&t.reverse();p--;){var h=t[p];if(typeof h!=`function`)throw TypeError(c);if(m&&!g&&a(h)==`wrapper`)var g=new n([],!0)}for(p=g?p:r;++p<r;){h=t[p];var _=a(h),v=_==`wrapper`?i(h):void 0;g=v&&s(v[0])&&v[1]==(d|l|u|f)&&!v[4].length&&v[9]==1?g[a(v[0])].apply(g,v[3]):h.length==1&&s(h)?g[_]():g.thru(h)}return function(){var e=arguments,n=e[0];if(g&&e.length==1&&o(n))return g.plant(n).value();for(var i=0,a=r?t[i].apply(this,e):n;++i<r;)a=t[i].call(this,a);return a}})}t.exports=p})),$o=j(((e,t)=>{t.exports=Qo()()}));function es(e){if(Object.keys(e).length===0)return null;let t=Object.values(e).reduce((e,t)=>{let n=Ut.find(e=>t&&t.includes(e));return n!==void 0&&(e[n]||=[],e[n].push(t)),e},{}),n=Rt(Object.entries(t).map(([e,t])=>({wildcard:e,instances:t})),e=>-e.instances.length);return n.length>0?n[0].wildcard:null}var ts=es;function ns(e,t,{downgrade:n}={}){if(!u.validRange(e)||Xt(e))return!1;let[r]=_.parseRange(e);if(!r)throw Error(`"${e}" could not be parsed by semver-utils. This is probably a bug. Please file an issue at https://github.com/raineorshine/npm-check-updates.`);let i=fn(t),a=B(r),o=!!u.validRange(a),s=!!u.valid(i);return o&&s&&(!nn(i,a)||!u.satisfies(i,r.operator===`<`?e:a)&&(n||!u.ltr(i,a)))}var rs=ns,is=Ce($o(),1);function as(e,t,n={}){let r=n.target||`latest`;e=I(e,(e,t)=>!!t);let i=ts(e)||`^`,a=(e,t)=>bn(e,t,{wildcard:i,removeRange:n.removeRange});return(0,is.default)([e=>$(e,(e,n)=>n in t),e=>Object.entries(e).reduce((e,[n,r])=>{let i=t[n],a=null,o=null;if(gn(r)&&(a=hn(r)[1]),gn(i)&&(o=hn(i)[1]),vn(r)){let[e]=y(yn(r));a=B(e)}if(vn(i)){let[e]=y(yn(i));o=B(e)}return e[n]={current:r,currentParsed:a,latest:i,latestParsed:o},e},{}),e=>$(e,({current:e,currentParsed:t,latest:n,latestParsed:i},a)=>{let o=on(e)&&(typeof r==`string`?r:r(a,y(e))).startsWith(`@`);return rs(t||e,i||n,{downgrade:o})}),e=>Object.entries(e).reduce((e,[t,{current:n,currentParsed:r,latest:i,latestParsed:o}])=>{let s=a(r||n,o||i);return e[t]=gn(n)?_n(n,s):vn(n)?Sn(n,s):s,e},{})])(e)}var os=as;const ss=(e,t,n)=>{let r={...e,...t},i=$(t,(e,t)=>{let i=n[t];return i?Object.entries(i).every(([e,t])=>r[e]===void 0||!g(t)||f(r[e],t)):!0}),a=Object.keys(t).length>Object.keys(i).length,o=n;return a&&(o=$(n,(e,n)=>i[n]||!t[n])),{violated:a,filteredUpgradedDependencies:i,upgradedPeerDependencies:o}};async function cs(e,t){let n=await Uo(e,t),r=P(n,(n,r)=>r?.version&&(!t.filterResults||t.filterResults(n,{currentVersion:e[n],currentVersionSemver:y(e[n]),upgradedVersion:r.version,upgradedVersionSemver:v(r.version)}))?{[n]:r.version}:null),i=$(os(e,r,t),(n,i)=>!t.jsonUpgraded||!t.minimal||!m(r[i],e[i])),a=$(r,(e,t)=>i[t]),o=[i,n,t.peerDependencies];if(!t.peer||Object.keys(a).length===0)return o;if(t.peer&&Object.keys(a).length>0){let r=await zo(a,t),s;if(oe(t.peerDependencies,{...t.peerDependencies,...r})){if(s=ss(e,i,t.peerDependencies),!s.violated)return o}else s={violated:!1,filteredUpgradedDependencies:i,upgradedPeerDependencies:r};let c=0;do{if(c++>6)throw Error(`Stuck in a while loop. Please report an issue`);let r={...t.peerDependencies,...s.upgradedPeerDependencies};if(oe(t.peerDependencies,r))return[{},n,t.peerDependencies];let[i,a,l]=await cs({...e,...s.filteredUpgradedDependencies},{...t,peerDependencies:r,loglevel:`silent`});o=[{...s.filteredUpgradedDependencies,...i},{...n,...a},l],s=ss(e,o[0],o[2])}while(s.violated)}return o}var ls=cs;async function us(e){V(e,`
352
+ Options:`,`verbose`),H(e,e,`verbose`),V(e,`
353
+ Getting installed packages`,`verbose`);let t={};try{let{cli:n,cwd:r,filter:i,filterVersion:a,global:o,packageManager:s,prefix:c,reject:l,rejectVersion:u}=e;t=await Io({cli:n,cwd:r,filter:i,filterVersion:a,global:o,packageManager:s,prefix:c,reject:l,rejectVersion:u})}catch(t){Z(e,t.message)}V(e,`globalPackages:`,`verbose`),V(e,t,`verbose`),V(e,``,`verbose`),V(e,`Fetching ${e.target} versions`,`verbose`);let[n,r]=await ls(t,e);V(e,r,`verbose`);let i=N(r,(e,t)=>t.time?{[e]:t.time}:null),a=Object.keys(n);await Mn(e,{current:t,upgraded:n,latest:r,total:a.length,time:i});let o=n?a.map(e=>e+`@`+n[e]).join(` `):`[package]`;if(e.json)Tn(e,n);else if(o.length){let t=e.packageManager===`yarn`?`yarn global upgrade`:e.packageManager===`pnpm`?`pnpm -g add`:e.packageManager===`bun`?`bun add -g`:`npm -g install`;V(e,`
354
+ `+F.cyan(`ncu`)+` itself cannot upgrade global packages. Run the following to upgrade all global packages:
355
+
356
+ `+F.cyan(`${t} `+o)+`
357
+ `)}return e.cli&&e.errorLevel===2&&a.length>0&&process.exit(1),n}var ds=us;const fs=(e,t)=>u.validRange(e)&&u.validRange(t)&&u.gt(u.minVersion(e),u.minVersion(t)),ps=e=>{if(!e.packageManager)return{};let[t,n]=e.packageManager.split(`@`);return{[t]:n}};function ms(e={},t={}){let n=La(t.dep).reduce((t,n)=>({...t,...n===`packageManager`?ps(e):I(e[n]||{},(e,n)=>!fs(n,t[e]))}),{}),r=N(t.workspacePackages||[]),i={};try{i=I(I(n,e=>!r[e]),Mo(t.filter||null,t.reject||null,t.filterVersion||null,t.rejectVersion||null))}catch(e){Z(t,`Invalid filter: `+e.message||e)}return i}var hs=ms;async function gs(e,t){let n=Po(t,t.packageManager);if(!n.getEngines)return{};let r=Object.keys(e).length,i;return!t.json&&t.loglevel!==`silent`&&t.loglevel!==`verbose`&&r>0&&(i=new fe(`[:bar] :current/:total :percent`,{total:r,width:20}),i.render()),Object.entries(e).reduce(async(e,[r,a])=>{let o=(await n.getEngines(r,a,t)).node;return i&&i.tick(),{...await e,[r]:o}},Promise.resolve({}))}var _s=gs;const vs=(e,t)=>!e||m(t,e);async function ys(e,t,n={}){if(!n.nodeEngineVersion)return{};let r=p(n.nodeEngineVersion)?.version;if(!r)return{};let[i,a]=await ls(e,{...n,enginesNode:!1,nodeEngineVersion:void 0,loglevel:`silent`}),o=await _s(P(a,(e,t)=>i[e]&&t?.version?{[e]:t.version}:null),n);return Object.entries(i).filter(([e,n])=>t[e]!==n&&!vs(o[e],r)).reduce((t,[n,r])=>({...t,[n]:{from:e[n],to:r,enginesNode:o[n]}}),{})}async function bs(e,t,n,r={}){let i={...e,...t},[a,o]=await ls(e,{...r,peer:!1,peerDependencies:void 0,loglevel:`silent`}),s=await zo(Object.fromEntries(Object.entries(a).map(([e,t])=>[e,g(t)?p(t)?.version??t:t])),r);return Object.entries(a).filter(([e,n])=>t[e]!==n).reduce((t,[r,a])=>{let c=Object.entries(n).filter(([,e])=>e[r]!==void 0&&o[r]?.version&&!m(o[r].version,e[r])).reduce((e,[t,n])=>({...e,[t]:g(n[r])?n[r]:`a range that semver does not understand: ${n[r]}. This range does not work with semver.satisfies or semver.intersects, which npm-check-updates relies on to determine peer dependency compatibility. Either this is a mistake in ${t}, or it relies on a new syntax that is not compatible with the semver package.`}),{});if(Object.keys(c).length===0){let e=s?.[r]||{};c=Object.entries(e).filter(([e,t])=>i[e]&&!(!g(t)||f(i[e],t))).reduce((e,[t,n])=>({...e,[r]:`${t} ${n}`}),{})}return{...t,[r]:{from:e[r],to:a,reason:c}}},{})}var xs=bs;const Ss=process.stdout.columns||80;function Cs(e){return`${e.length?e.slice(0,Math.min(e.length,Ss)):`<empty>`}\n`}function ws(e){return e>Ss?``:`${` `.repeat(e-1)}^\n`}function Ts(e,t,n){let r=e.length;if(r===0)return`<empty>`;if(r===1)return`${Cs(e[0])}${ws(n)}`;let i=Math.min(t+2,r),a=``;for(let r=Math.max(t-2,1);r<=i;r++)a+=Cs(e[r-1]),r===t&&(a+=ws(n));return`${a}\n`}function Es(e){e=he(e);try{return JSON.parse(e)}catch{let t=[],n=me(e,t);if(t.length===0)return n;let r=``,i=e.split(`
358
+ `);for(let e of t){let t=e.offset,n=1,a=1,o=0;for(let e of i){if(o+e.length>=t){a=t-o+1;break}o+=e.length+1,n++}r+=`Error at line ${n}, column ${a}: ${pe[e.error]}\n${Ts(i,n,a)}\n`}throw SyntaxError(r)}}const Ds=`
359
+ ↑/↓: Select a package
360
+ Space: Toggle selection
361
+ a: Toggle all
362
+ Enter: Upgrade`;function Os(e,t){let n=e?Ds.split(`
363
+ `).length:0;return process.stdout.rows?Math.max(3,process.stdout.rows-n-1-(t?.length??0)*2):50}async function ks(e,t,n){let r=Po(n,n.packageManager);return await Object.keys(t).reduce(async(i,a)=>{let o=e[a]||null,s=t[a]||null,c=await r.packageAuthorChanged(a,o,s,n);return{...await i,[a]:c}},{})}const As=async(e,n,r,i)=>{let a=[],o=process.stdout.rows>18,s=P((await kn({from:e,to:n,format:i.format,pkgFile:r||void 0})).toString().split(`
364
+ `),e=>({[e.trim().split(` `)[0]]:e.trim()}));if(Object.keys(n).length>0)if(V(i,``),i.format?.includes(`group`)){let r=$t(n,e,i);a=(await t({choices:[...r.flatMap(({heading:e,groupName:t,packages:n})=>[{title:`
365
+ `+e,heading:!0},...Object.keys(n).sort().map(e=>({title:s[e],value:e,selected:[`patch`,`minor`].includes(t)}))]),{title:` `,heading:!0}],hint:o&&Ds,instructions:!1,message:`Choose which packages to update`,name:`value`,optionsPerPage:Os(o,r),type:`multiselect`,onState:e=>{e.aborted&&process.nextTick(()=>process.exit(1))}})).value}else a=(await t({choices:[...Object.keys(n).sort().map(e=>({title:s[e],value:e,selected:!0})),{title:` `,heading:!0}],hint:o&&Ds+`
366
+ `,instructions:!1,message:`Choose which packages to update`,name:`value`,optionsPerPage:Os(o),type:`multiselect`,onState:e=>{e.aborted&&process.nextTick(()=>process.exit(1))}})).value;return P(a,e=>({[e]:n[e]}))};async function js(e,t,n){V(e,`
367
+ Options:`,`verbose`),H(e,e,`verbose`);let r;try{t?r=Es(t):Z(e,`Missing package data`)}catch(t){Z(e,`Invalid package file${n?`: ${n}`:` from stdin`}. Error details:\n${t.message}`)}let i=hs(r,e);V(e,`
368
+ Current versions:`,`verbose`),V(e,i,`verbose`),e.enginesNode&&(e.nodeEngineVersion=r?.engines?.node),e.peer&&(e.peerDependencies=await zo(Object.fromEntries(Object.entries(i).map(([e,t])=>[e,d.validRange(t)?d.minVersion(t)?.version??t:t])),e));let[a,s,c]=await ls(i,e),l=P(s,(e,t)=>t.version?{[e]:t.version}:null),u=P(s,(e,t)=>t.error?{[e]:t.error}:null),f=P(s,(e,t)=>t.time?{[e]:t.time}:null);e.peer&&(V(e,`
369
+ upgradedPeerDependencies:`,`verbose`),V(e,c,`verbose`)),V(e,`\n${typeof e.target==`string`?`${e.target[0].toUpperCase()}${e.target.slice(1)}`:`Fetched`} versions:`,`verbose`),V(e,l,`verbose`),V(e,`
370
+ Upgraded versions:`,`verbose`),V(e,a,`verbose`);let p=e.minimal?P(a,(e,t)=>d.satisfies(l[e],i[e])?null:{[e]:t}):a,m=(e.format||[]).includes(`ownerChanged`)?await ks(i,p,e):void 0,h=e.interactive?await As(i,p,n,e):p;if(!e.json||e.deep){if(await Mn(e.interactive?{...e,format:(e.format||[]).filter(e=>e!==`group`)}:e,{current:i,upgraded:h,total:Object.keys(a).length,latest:s,ownersChangedDeps:m,pkgFile:n||void 0,errors:u,time:f}),e.peer){let t=await xs(i,a,c,e);Object.keys(t).length>0&&Nn(e,t)}if(e.enginesNode){let t=await ys(i,a,e);Object.keys(t).length>0&&Pn(e,t)}}let g=await Ga(t,i,h,e,n||void 0),_=e.jsonAll?Es(g):e.jsonDeps?Bo(Es(g),La(e.dep)):h,v;if(e.json&&!e.deep&&Tn(e,_),Object.keys(p).length>0&&n)if(e.upgrade)v=o.writeFile(n.replace(`#catalog`,``),g);else{let t=process.env.npm_lifecycle_event===`npx`?`npx npm-check-updates`:`ncu`,n=process.argv.slice(2).map(e=>e.includes(` `)?`"${e}"`:e).join(` `),r=n&&` `+n;V(e,`\nRun ${F.cyan(`${t}${r} -u`)} to upgrade ${e.packageFile||`package.json`}`)}return await v,_}function Ms(e){return e}var Ns=Ms;process.env.INJECT_PROMPTS&&t.inject(JSON.parse(process.env.INJECT_PROMPTS));let Ps=!1;process.on(`unhandledRejection`,e=>{console.error(e),Ps=!0});const Fs=e=>{e.global&&(process.env.VOLTA_HOME||process.env.PATH?.includes(`\\Volta`))&&(V(e,`It appears you are using Volta. \`npm-check-updates --global\` cannot be used with Volta because Volta has its own system for managing global packages which circumvents npm.
371
+
372
+ If you are still receiving this message after uninstalling Volta, ensure your PATH does not contain an entry for Volta and your shell profile does not define VOLTA_HOME. You may need to reboot for changes to your shell profile to take effect.`,`error`),process.exit(1))},Is=async(t,n)=>{let r={...t,cwd:t.cwd||e.resolve(n,`..`),packageFile:n};return t.packageManager===`staticRegistry`?await er({...r,packageManager:void 0}):t.packageManager&&t.packageManager!==`npm`?t.packageManager:await er(r)},Ls=(e,t)=>{let n=e.length===1?{[e[0]]:t}:t;return Object.values(n).some(e=>Object.keys(e).length>0)},Rs=async(r,i,a)=>{if(a.install===`never`){V(a,``);return}if(!Ls(r,i))return;let o=await Is(a,r[0]),s=`Run ${F.cyan(o+` install`)}${r.length>1&&!a.workspace&&!a.workspaces?` in each project directory`:``} to install new versions`,c=a.interactive&&(process.env.NCU_TESTS||!process.env.NCU_DOCTOR),l;if(c&&a.install===`prompt`&&(V(a,``),l=await t({type:`confirm`,name:`value`,message:`${s}?`,initial:!0,onState:e=>{e.aborted&&process.nextTick(()=>process.exit(1))}})),a.install===`always`||c&&l.value){a.install===`always`&&V(a,``),V(a,`Installing dependencies...`);let t=a.workspaces||a.workspace?.length?[`package.json`]:r;for await(let r of t){let t=await Is(a,r),i=t+(process.platform===`win32`&&t!==`bun`?`.cmd`:``),o=a.cwd||e.resolve(r,`..`),s=``;try{await n(i,[`install`],{stdout:e=>{s+=e},stderr:e=>{console.error(F.red(e.toString()))}},{cwd:o,env:{...process.env,...a.color===!1?null:{FORCE_COLOR:!0},...t===`pnpm`?{npm_config_strict_peer_dependencies:!1}:null}}),V(a,s),V(a,`Done`)}catch(e){throw Error(e?.message||e||s)}}}else c||V(a,`\n${s}.`)};async function zs(t,n){let[r,i]=await ro(t),a=r.map(e=>e.filepath),o=t.workspaces||!!t.workspace?.length;t.deep=t.deep||o||r.length>1;let s;if(t.global){let e=await ds(t);return clearTimeout(n),e}else if(t.deep)s=await r.reduce(async(n,r)=>{let a=await n,o=(await ao({packageFile:r.filepath,options:t})).config;t.mergeConfig&&Object.keys(o).length&&(o=Oo(t,o));let s={...t,...o,packageFile:r.filepath,workspacePackages:i},c,l,u;if(r.filepath.includes(`#`)||r.name===`catalogs`){c=r.pkgFile,l=r.filepath,u=r.filepath.includes(`#catalog`)?r.filepath.replace(`#catalog`,``):r.filepath;let t=e.resolve(u);V(s,`${s.upgrade?`Upgrading`:`Checking`} ${t} catalog dependencies`)}else{let e=await Xa(s);c=e.pkgData,l=e.pkgFile||r.filepath,u=l}return{...a,[s.cwd?e.relative(e.resolve(s.cwd),u).replace(/\\/g,`/`):u]:await js(s,c,l)}},Promise.resolve({})),t.json&&Tn(t,s);else{r.length===1&&r[0].filepath!==(t.packageFile||`package.json`)&&(t.packageFile=r[0].filepath);let{pkgData:e,pkgFile:n}=await Xa(t);s=await js(t,e,n)}return clearTimeout(n),t.errorLevel===2&&Ls(a,s)&&Z(t,`
373
+ Dependencies not up-to-date`),t.upgrade&&(t.packageManager===`deno`?V(t,``):await Rs(a,s,t)),s}async function Bs(e={},{cli:t}={}){let n=await To(e,{cli:t}),r=De.url;process.on(`exit`,()=>{Ps&&Z(n,`Unhandled Rejection! This is a bug and should be reported: ${r}`)}),await Me(n.color),Fs(n),V(n,`Initializing`,`verbose`),n.cacheClear&&await Bn(n);let i,a=new Promise(()=>null);if(n.timeout){let e=typeof n.timeout==`string`?Number.parseInt(n.timeout,10):n.timeout;a=new Promise((t,r)=>{i=setTimeout(()=>{let t=`Exceeded global timeout of ${e}ms`;r(t);try{Z(n,t)}catch{}},e)})}if(n.doctor){if(n.upgrade)return Promise.race([a,Ja(Bs,n)]);V(n,`Usage: ncu --doctor\n\n${typeof K.doctor.help==`function`?K.doctor.help({}):K.doctor.help}`,`warn`)}else return Promise.race([a,zs(n,i)])}var Vs=Bs;export{ao as a,Me as c,Te as d,$ as i,Ee as l,Vs as n,Yn as o,Ns as r,qn as s,Bs as t,Oe as u};
374
+ //# sourceMappingURL=src.js.map