Skip to content

Commit

Permalink
chore: update yarn-plugin-deduplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Aug 18, 2020
1 parent c91994f commit 644c36a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .yarn/plugins/@yarnpkg/plugin-deduplicate.cjs
Expand Up @@ -2,7 +2,10 @@
module.exports = {
name: "@yarnpkg/plugin-deduplicate",
factory: function (require) {
var plugin;plugin=(()=>{"use strict";var e={587:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var o=r(594),s=r(966),a=r(42),n=r(513),i=function(e,t,r,o){var s,a=arguments.length,n=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,o);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(n=(a<3?s(n):a>3?s(t,r,n):s(t,r))||n);return a>3&&n&&Object.defineProperty(t,r,n),n};class c extends o.BaseCommand{async execute(){const e=await s.Configuration.find(this.context.cwd,this.context.plugins),{project:t}=await s.Project.find(e,this.context.cwd);await t.restoreInstallState();const r=await s.StreamReport.start({configuration:e,stdout:this.context.stdout,includeFooter:!1},async e=>{e.startTimerSync("deduplication step",()=>{!function(e,t){const r=new Map;for(const[t,o]of e.storedResolutions.entries()){const s=o,a=e.storedDescriptors.get(t).identHash,n=r.get(a);void 0===n?r.set(a,new Set([s])):r.set(a,n.add(s))}for(const o of e.storedResolutions.keys()){const a=e.storedDescriptors.get(o),i=r.get(a.identHash),c=a.range.match(/^npm:(.*)$/);if(null!==c&&(void 0!==i&&i.size>1)){const r=Array.from(i).map(t=>{const r=e.storedPackages.get(t);if(void 0===r)throw new TypeError(`Can't find package for locator hash '${t}'`);if(s.structUtils.isVirtualLocator(r)){const t=s.structUtils.devirtualizeLocator(r);return e.storedPackages.get(t.locatorHash)}return r}).filter(e=>null!==e.version&&n.satisfies(e.version,c[1])).sort((e,t)=>n.gt(e.version,t.version)?-1:1);if(r.length>1){const n=r[0].locatorHash,i=e.storedResolutions.get(o),c=e.storedPackages.get(n),d=e.storedPackages.get(i);!1===s.structUtils.areLocatorsEqual(d,c)&&(t.reportInfo(s.MessageName.UNNAMED,`${s.structUtils.stringifyDescriptor(a)} can be deduplicated from ${d.name}@${d.version} to ${c.name}@${c.version}`),e.storedResolutions.set(o,n))}}}}(t,e)})});if(r.hasErrors())return r.exitCode();const o=await s.Cache.find(e);return(await s.StreamReport.start({configuration:e,stdout:this.context.stdout,includeLogs:!0},async e=>{await t.install({cache:o,report:e})})).exitCode()}}c.usage=a.Command.Usage({category:"Workspace-related commands",description:"Reduces dependencies with overlapping ranges to a smaller set of packages",details:"https://github.com/atlassian/yarn-deduplicate for yarn v2",examples:[]}),i([a.Command.Path("deduplicate")],c.prototype,"execute",null);const d={commands:[c]}},594:e=>{e.exports=require("@yarnpkg/cli")},966:e=>{e.exports=require("@yarnpkg/core")},42:e=>{e.exports=require("clipanion")},513:e=>{e.exports=require("semver")}},t={};function r(o){if(t[o])return t[o].exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}return r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(587)})();
var plugin;plugin=(()=>{"use strict";var e={587:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var o=r(594),s=r(966),a=r(42),n=r(513),i=function(e,t,r,o){var s,a=arguments.length,n=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,o);else for(var i=e.length-1;i>=0;i--)(s=e[i])&&(n=(a<3?s(n):a>3?s(t,r,n):s(t,r))||n);return a>3&&n&&Object.defineProperty(t,r,n),n};class c extends o.BaseCommand{async execute(){const e=await s.Configuration.find(this.context.cwd,this.context.plugins),{project:t}=await s.Project.find(e,this.context.cwd);await t.restoreInstallState();const r=await s.StreamReport.start({configuration:e,stdout:this.context.stdout,includeFooter:!1},async e=>{e.startTimerSync("deduplication step",()=>{!function(e,t){const r=new Map;for(const[t,o]of e.storedResolutions.entries()){const s=o,a=e.storedDescriptors.get(t).identHash,n=r.get(a);void 0===n?r.set(a,new Set([s])):r.set(a,n.add(s))}for(const o of e.storedResolutions.keys()){const a=e.storedDescriptors.get(o),i=r.get(a.identHash),c=a.range.match(/^npm:(.*)$/);if(null!==c&&(void 0!==i&&i.size>1)){const r=Array.from(i).map(t=>{const r=e.storedPackages.get(t);if(void 0===r)throw new TypeError(`Can't find package for locator hash '${t}'`);if(s.structUtils.isVirtualLocator(r)){const t=s.structUtils.devirtualizeLocator(r);return e.storedPackages.get(t.locatorHash)}return r}).filter(e=>null!==e.version&&n.satisfies(e.version,c[1])).sort((e,t)=>n.gt(e.version,t.version)?-1:1);if(r.length>1){const n=r[0].locatorHash,i=e.storedResolutions.get(o),c=e.storedPackages.get(n),d=e.storedPackages.get(i);!1===s.structUtils.areLocatorsEqual(d,c)&&(t.reportInfo(s.MessageName.UNNAMED,`${s.structUtils.stringifyDescriptor(a)} can be deduplicated from ${d.name}@${d.version} to ${c.name}@${c.version}`),e.storedResolutions.set(o,n))}}}}
/**
* @license MIT
*/(t,e)})});if(r.hasErrors())return r.exitCode();const o=await s.Cache.find(e);return(await s.StreamReport.start({configuration:e,stdout:this.context.stdout,includeLogs:!0},async e=>{await t.install({cache:o,report:e})})).exitCode()}}c.usage=a.Command.Usage({category:"Workspace-related commands",description:"Reduces dependencies with overlapping ranges to a smaller set of packages",details:"https://github.com/atlassian/yarn-deduplicate for yarn v2",examples:[]}),i([a.Command.Path("deduplicate")],c.prototype,"execute",null);const d={commands:[c]}},594:e=>{e.exports=require("@yarnpkg/cli")},966:e=>{e.exports=require("@yarnpkg/core")},42:e=>{e.exports=require("clipanion")},513:e=>{e.exports=require("semver")}},t={};function r(o){if(t[o])return t[o].exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}return r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(587)})();
return plugin;
}
};

0 comments on commit 644c36a

Please sign in to comment.