* Gets all of the outdated packages and sorts them appropriately
(lockfile, install, config, reporter, filterByPatterns, flags)
| 38416 | */ |
| 38417 | |
| 38418 | static getOutdatedPackages(lockfile, install, config, reporter, filterByPatterns, flags) { |
| 38419 | return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { |
| 38420 | var _ref5 = yield install.fetchRequestFromCwd(); |
| 38421 | |
| 38422 | const reqPatterns = _ref5.requests, |
| 38423 | workspaceLayout = _ref5.workspaceLayout; |
| 38424 | |
| 38425 | // Filter out workspace patterns if necessary |
| 38426 | |
| 38427 | let depReqPatterns = workspaceLayout ? reqPatterns.filter(function (p) { |
| 38428 | return !workspaceLayout.getManifestByPattern(p.pattern); |
| 38429 | }) : reqPatterns; |
| 38430 | |
| 38431 | // filter the list down to just the packages requested. |
| 38432 | // prevents us from having to query the metadata for all packages. |
| 38433 | if (filterByPatterns && filterByPatterns.length || flags && flags.pattern) { |
| 38434 | const filterByNames = filterByPatterns && filterByPatterns.length ? filterByPatterns.map(function (pattern) { |
| 38435 | return (0, (_normalizePattern4 || _load_normalizePattern()).normalizePattern)(pattern).name; |
| 38436 | }) : []; |
| 38437 | depReqPatterns = depReqPatterns.filter(function (dep) { |
| 38438 | return filterByNames.indexOf((0, (_normalizePattern4 || _load_normalizePattern()).normalizePattern)(dep.pattern).name) >= 0 || flags && flags.pattern && micromatch.contains((0, (_normalizePattern4 || _load_normalizePattern()).normalizePattern)(dep.pattern).name, flags.pattern); |
| 38439 | }); |
| 38440 | } |
| 38441 | |
| 38442 | const deps = yield Promise.all(depReqPatterns.map((() => { |
| 38443 | var _ref6 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* ({ pattern, hint, workspaceName, workspaceLoc }) { |
| 38444 | const locked = lockfile.getLocked(pattern); |
| 38445 | if (!locked) { |
| 38446 | throw new (_errors || _load_errors()).MessageError(reporter.lang('lockfileOutdated')); |
| 38447 | } |
| 38448 | |
| 38449 | const name = locked.name, |
| 38450 | current = locked.version; |
| 38451 | |
| 38452 | let latest = ''; |
| 38453 | let wanted = ''; |
| 38454 | let url = ''; |
| 38455 | |
| 38456 | const normalized = (0, (_normalizePattern4 || _load_normalizePattern()).normalizePattern)(pattern); |
| 38457 | |
| 38458 | if ((0, (_index || _load_index()).getExoticResolver)(pattern) || (0, (_index || _load_index()).getExoticResolver)(normalized.range)) { |
| 38459 | latest = wanted = 'exotic'; |
| 38460 | url = normalized.range; |
| 38461 | } else { |
| 38462 | const registry = config.registries[locked.registry]; |
| 38463 | |
| 38464 | var _ref7 = yield registry.checkOutdated(config, name, normalized.range); |
| 38465 | |
| 38466 | latest = _ref7.latest; |
| 38467 | wanted = _ref7.wanted; |
| 38468 | url = _ref7.url; |
| 38469 | } |
| 38470 | |
| 38471 | return { |
| 38472 | name, |
| 38473 | current, |
| 38474 | wanted, |
| 38475 | latest, |
no test coverage detected