From 2dd572ffe3b8146011ab3d17b1303e6fbfe39bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sat, 11 Sep 2021 16:54:07 +0200 Subject: [PATCH] Log --- .yarn/plugins/@yarnpkg/plugin-babel-release-tool.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.yarn/plugins/@yarnpkg/plugin-babel-release-tool.cjs b/.yarn/plugins/@yarnpkg/plugin-babel-release-tool.cjs index 7bd91b13c74f..cc64f693bce2 100644 --- a/.yarn/plugins/@yarnpkg/plugin-babel-release-tool.cjs +++ b/.yarn/plugins/@yarnpkg/plugin-babel-release-tool.cjs @@ -54,7 +54,7 @@ globstar while`,e,d,r,h,x),this.matchOne(e.slice(d),r.slice(h),t))return this.de >>> no match, partial?`,e,d,r,h),d===o))}var v;if(typeof s=="string"?(n.nocase?v=l.toLowerCase()===s.toLowerCase():v=l===s,this.debug("string match",s,l,v)):(v=l.match(s),this.debug("pattern match",s,l,v)),!v)return!1}if(i===o&&a===u)return!0;if(i===o)return t;if(a===u){var m=i===o-1&&e[i]==="";return m}throw new Error("wtf?")};function ese(e){return e.replace(/\\(.)/g,"$1")}function rse(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var nse={};fF(nse,{default:()=>tse});var Oa=N(E("@yarnpkg/core"));var Tc=N(E("@yarnpkg/core")),N7=N(E("@yarnpkg/cli")),ur=N(E("clipanion")),Bc=N(cx()),Da=N(E("semver")),W7=N(P7());function jc(e){return(r,t)=>r[e]t[e]?1:0}function j7(e,r){return Promise.all(e.map(r))}function ci(e,r){return j7(xx(e.topLevelWorkspace,e),r)}function xx(e,r){let t=[e];for(let n of t)for(let i of n.workspacesCwds){let a=r.workspacesByCwd.get(i);a&&t.push(a)}return t.shift(),t}function or(e){return e.name.scope?`@${e.name.scope}/${e.name.name}`:e.name.name}var T7=N(E("child_process"));function $r(e){let r=t=>String(t).trim();return new Promise((t,n)=>{(0,T7.exec)(e,(i,a,o)=>{if(i)return n(i);t({stdout:r(a),stderr:r(o)})})})}async function B7(){let{stdout:e}=await $r("git describe --long --dirty --first-parent"),[,r,t,n,i,a]=/^((?:.*@)?(.*))-(\d+)-g([0-9a-f]+)(-dirty)?$/.exec(e)||[];return{lastTagName:r,lastVersion:t,refCount:n,sha:i,isDirty:Boolean(a)}}async function I7(e){let r=JSON.stringify(e),{stdout:t}=await $r(`git tag --sort version:refname --points-at HEAD --list "${r}"`);return t.split(` `).filter(Boolean)}async function M7(e,r){let{stdout:t}=await $r(`git diff --name-only ${e} -- ${r}`);return t===""?[]:t.split(` `)}async function k7(e){let{stdout:r}=await $r(`git diff-tree --name-only --no-commit-id --root -r -c ${e}`);return r.split(` -`)}async function R7(e){await $r("git add ."),await $r(`git commit -m ${JSON.stringify(e)}`)}async function L7(e){await $r(`git tag ${JSON.stringify(e)} -m ${JSON.stringify(e)}`)}var li=N(E("@yarnpkg/core"));async function fi(e,r){let t=await li.Configuration.find(r.cwd,r.plugins),[{project:n,workspace:i},a]=await Promise.all([li.Project.find(t,r.cwd),li.Cache.find(t,{immutable:!0})]);if(n.topLevelWorkspace!==i)throw new Error(`The "yarn ${e}" command must be run in the root workspace.`);return{configuration:t,project:n,cache:a}}var Se=class extends N7.BaseCommand{async execute(){var x,v,m;let{configuration:r,project:t,cache:n}=await fi("release-tool version",this.context),{lastTagName:i,lastVersion:a}=await B7(),o=t.configuration.get("releaseTool"),u=(x=o==null?void 0:o.get("ignoreChanges"))!=null?x:[],s=(v=o==null?void 0:o.get("implicitDependencies"))!=null?v:new Map,l=await this.getChangedWorkspaces(t,i,u,s,new Set(this.forceUpdates)),d;if(this.version==="patch"||this.version==="minor"||this.version==="major"?d=Da.default.inc(a,this.version):d=(m=this.version)!=null?m:await this.promptVersion(a,{Patch:Da.default.inc(a,"patch"),Minor:Da.default.inc(a,"minor"),Major:Da.default.inc(a,"major")}),this.dry){this.logChanges(d,l);return}if(!this.yes&&!await this.promptConfirm(d,l))return 0;t.topLevelWorkspace.manifest.version=d,this.updateManifests(l,xx(t.topLevelWorkspace,t),d);let h=await Tc.StreamReport.start({configuration:r,stdout:this.context.stdout,includeLogs:!0},async b=>{await t.resolveEverything({cache:n,report:b})});if(h.hasErrors())return h.exitCode();await t.persist(),await this.gitCommitAndTag(d)}async getChangedWorkspaces(r,t,n,i,a){let o=n.map(d=>W7.default.filter(`!${d}`,{matchBase:!0,dot:!0})),u=new Set,s=new Map;await ci(r,async d=>{let h=or(d.manifest);if(s.set(h,d),this.all||a.has(h)){u.add(d);return}o.reduce((v,m)=>v.filter(m),await M7(t,d.cwd)).length>0&&u.add(d)});let l;do{l=!1;for(let[d,h]of i){let x=s.get(d);if(!u.has(x))for(let v of h){let m=s.get(v);if(u.has(m)){l=!0,u.add(x);break}}}}while(l);return Array.from(u).sort(jc("cwd"))}async promptVersion(r,t){let n=Object.entries(t).map(([a,o])=>({name:`${a} (${o})`,value:o})),{version:i}=await Bc.default.prompt({type:"list",name:"version",message:`Select a new version (currently ${r}):`,choices:n});return i}async promptConfirm(r,t){this.logChanges(r,t);let{confirm:n}=await Bc.default.prompt({type:"confirm",name:"confirm",message:"Are you sure you want to create these versions?",default:!1});return n}logChanges(r,t){console.log(""),console.log("Changes:");for(let{manifest:n}of t)console.log(` - ${or(n)}: ${n.version} => ${r}`);console.log("")}updateManifests(r,t,n){for(let{manifest:i}of r)i.version=n;for(let{manifest:i}of r)for(let{manifest:a}of t){let{identHash:o}=a.name,u=i.dependencies.get(o);if(u==null?void 0:u.range.includes("workspace:")){let s=u.range.replace(/workspace:[\w\^\~\.\*\-]+/g,`workspace:^${a.version}`),l=Tc.structUtils.makeDescriptor(u,s);i.dependencies.set(o,l)}}}async gitCommitAndTag(r){var n;let t=((n=this.tagVersionPrefix)!=null?n:"v")+r;if(!this.yes){let{confirm:i}=await Bc.default.prompt({type:"confirm",name:"confirm",message:`Are you sure you want to commit and tag these changes as "${t}"?`,default:!1});if(!i)return 0}await R7(t),await L7(t)}};Se.usage=ur.Command.Usage({description:"Bump the version of the updated packages",details:"\n This command will check which packages have been changed since the last git tag. Then, it update the package.json files and then create a new git tag.\n\n If no version is specified, it will prompt for it.\n\n - The `-f,--force` option allows you to specify a package that must be updated even if git doesn't detect any change. It can be specified multiple times, for multiple packages.\n - If the `--all` option is specified, every package will be updated.\n - The `--yes` option disables the confirmation prompts.\n - If `--tag-version-prefix` is specified, it will be used to build the tag name (default: `v`).\n\n This command also reads two options from the .yarnrc.yml file:\n - `releaseTool.ignoreChanges` allows you to specify an array of file patterns to ignore when computing the updated packages.\n - `releaseTool.implicitDependencies` allows you to specify implicit build-time dependencies between packages. When an implicit dependency package is updated, also the implicit dependents will be released.\n "}),ne([ur.Command.String({required:!1})],Se.prototype,"version",2),ne([ur.Command.Array("-f,--force-update")],Se.prototype,"forceUpdates",2),ne([ur.Command.Boolean("--yes")],Se.prototype,"yes",2),ne([ur.Command.String("--tag-version-prefix")],Se.prototype,"tagVersionPrefix",2),ne([ur.Command.Boolean("--all")],Se.prototype,"all",2),ne([ur.Command.Boolean("--dry")],Se.prototype,"dry",2),ne([ur.Command.Path("release-tool","version")],Se.prototype,"execute",1);var U7=Se;var Y7=N(E("@yarnpkg/cli")),sr=N(E("clipanion")),gx=N(E("path"));var G7=class{constructor(r){Wc(this,"value");Wc(this,"next");this.value=r}},$e,qt,At,bx=class{constructor(){qa(this,$e,void 0);qa(this,qt,void 0);qa(this,At,void 0);this.clear()}enqueue(r){var n;let t=new G7(r);Qe(this,$e)?(Qe(this,qt).next=t,qe(this,qt,t)):(qe(this,$e,t),qe(this,qt,t)),qe(this,At,(n=+Qe(this,At))+1)}dequeue(){var t;let r=Qe(this,$e);if(!!r)return qe(this,$e,Qe(this,$e).next),qe(this,At,(t=+Qe(this,At))-1),r.value}clear(){qe(this,$e,void 0),qe(this,qt,void 0),qe(this,At,0)}get size(){return Qe(this,At)}*[Symbol.iterator](){let r=Qe(this,$e);for(;r;)yield r.value,r=r.next}};$e=new WeakMap,qt=new WeakMap,At=new WeakMap;var K7=bx;function wa(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let r=new K7,t=0,n=()=>{t--,r.size>0&&r.dequeue()()},i=async(u,s,l)=>{t++;let d=(async()=>u(...l))();s(d);try{await d}catch{}n()},a=(u,s,l)=>{r.enqueue(i.bind(void 0,u,s,l)),(async()=>{await Promise.resolve(),t0&&r.dequeue()()})()},o=(u,...s)=>new Promise(l=>{a(u,l,s)});return Object.defineProperties(o,{activeCount:{get:()=>t},pendingCount:{get:()=>r.size},clearQueue:{value:()=>{r.clear()}}}),o}var Q7=N(cx());var He=N(E("@yarnpkg/core")),Fa=N(E("@yarnpkg/plugin-npm"));var vx=N(E("@yarnpkg/core"));var z7=class{constructor(){this.dependencies=new Set;this.dependents=new Set}addDependent(r){this.dependents.add(r),r.dependencies.add(this)}unlink(){this.dependencies.forEach(r=>r.dependents.delete(this)),this.dependents.forEach(r=>r.dependencies.delete(this))}*dependenciesIterator(){yield*this.dependencies}*dependentsIterator(){yield*this.dependents}hasDependencies(){return this.dependencies.size>0}},mx=class extends z7{constructor(r){super();this.workspace=r}intersects(r){for(let t of r.workspacesIterator())if(t===this.workspace)return!0;return!1}*workspacesIterator(){yield this.workspace}toString(){return or(this.workspace.manifest)}deleteWorkspace(r){return this.workspace===r}},yx=class extends Set{constructor(r){super();this.packages=new Map;r.forEach(t=>{let n=new mx(t);this.packages.set(t.locator.identHash,n),this.add(n)}),this.packages.forEach(t=>{t.workspace.manifest.dependencies.forEach((n,i)=>{var a;(a=this.packages.get(i))==null||a.addDependent(t)})})}getProcessableWorkspaces(){let r=new Set;for(let t of this)if(!t.hasDependencies())for(let n of t.workspacesIterator())r.add(n);return r}delete(r){return this.has(r)&&r.unlink(),super.delete(r)}deleteWorkspace(r){let t=this.packages.get(r.locator.identHash);return t?t.deleteWorkspace(r)&&this.delete(t):!1}detectCycles(r){let t=[],n=new WeakSet,i=o=>{for(let u=0;u ")}`);return}n.has(o)||(n.add(o),a(o))};function a(o){if(!(o instanceof mx)){r.reportError(vx.MessageName.CYCLIC_DEPENDENCIES,`Dependency cycle detected: ${o}`);return}t.push(o);for(let u of o.dependenciesIterator())i(u);t.pop()}this.forEach(i)}},Ic=yx;var V7=N(E("@yarnpkg/core")),_x=N(E("@yarnpkg/plugin-pack")),$7=N(E("@yarnpkg/plugin-npm"));async function H7(e,r,t){let n=await _x.packUtils.genPackList(e),i=await _x.packUtils.genPackStream(e,n),a=await V7.miscUtils.bufferStream(i);return $7.npmPublishUtils.makePublishBody(e,a,{access:void 0,tag:t,registry:r})}var Hr=class extends Y7.BaseCommand{constructor(){super(...arguments);this.tag="latest";this.tagVersionPrefix="v"}async execute(){let{project:r,configuration:t}=await fi("release-tool publish",this.context);await r.restoreInstallState();let n=await this.getTaggedPackages(r),i=new Ic(n);return(await He.StreamReport.start({configuration:t,stdout:this.context.stdout,includeLogs:!0},async o=>{if(i.detectCycles(o),o.hasErrors())return;let u=await this.packPackages(n,t,o);o.hasErrors()||!this.yes&&!await this.promptConfirm(n)||(await o.startTimerPromise(`Publishing ${n.size} packages`,()=>this.publishPackages(i,u,t,o)),!o.hasErrors()&&await this.runLifecycleScript(n,"postpublish",{report:o}))})).exitCode()}async getTaggedPackages(r){if(!(await I7(`${this.tagVersionPrefix}*.*.*`)).length)throw new Error("No version tag found");let n=await k7("HEAD"),i=new Set(n.filter(o=>gx.default.basename(o)==="package.json").map(o=>gx.default.dirname(o))),a=new Set;return await ci(r,async o=>{i.has(o.relativeCwd)&&!o.manifest.private&&a.add(o)}),a}async packPackages(r,t,n){let i=wa(4),a=new Map,o=Array.from(r,u=>i(async()=>{let s=await this.packPackage(u,t,n);a.set(u,s)}));return await Promise.all(o),a}async packPackage(r,t,n){if(r.manifest.private)throw new sr.UsageError("Private workspaces cannot be published");if(r.manifest.name===null||r.manifest.version===null)throw new sr.UsageError("Workspaces must have valid names and versions to be published on an external registry");let i=Fa.npmConfigUtils.getPublishRegistry(r.manifest,{configuration:t});return await He.scriptUtils.maybeExecuteWorkspaceLifecycleScript(r,"prepublish",{report:n}),await He.scriptUtils.maybeExecuteWorkspaceLifecycleScript(r,"prepublishOnly",{report:n}),await He.scriptUtils.maybeExecuteWorkspaceLifecycleScript(r,"prepack",{report:n}),{registry:i,body:await H7(r,i,this.tag)}}async publishPackages(r,t,n,i){let a=wa(4);do{let o=r.getProcessableWorkspaces();if(o.size===0&&r.size>0)throw new Error(`Some packages could not be published: +`)}async function R7(e){await $r("git add ."),await $r(`git commit -m ${JSON.stringify(e)}`)}async function L7(e){await $r(`git tag ${JSON.stringify(e)} -m ${JSON.stringify(e)}`)}var li=N(E("@yarnpkg/core"));async function fi(e,r){let t=await li.Configuration.find(r.cwd,r.plugins),[{project:n,workspace:i},a]=await Promise.all([li.Project.find(t,r.cwd),li.Cache.find(t,{immutable:!0})]);if(n.topLevelWorkspace!==i)throw new Error(`The "yarn ${e}" command must be run in the root workspace.`);return{configuration:t,project:n,cache:a}}var Se=class extends N7.BaseCommand{async execute(){var x,v,m;let{configuration:r,project:t,cache:n}=await fi("release-tool version",this.context),{lastTagName:i,lastVersion:a}=await B7(),o=t.configuration.get("releaseTool"),u=(x=o==null?void 0:o.get("ignoreChanges"))!=null?x:[],s=(v=o==null?void 0:o.get("implicitDependencies"))!=null?v:new Map,l=await this.getChangedWorkspaces(t,i,u,s,new Set(this.forceUpdates)),d;if(this.version==="patch"||this.version==="minor"||this.version==="major"?d=Da.default.inc(a,this.version):d=(m=this.version)!=null?m:await this.promptVersion(a,{Patch:Da.default.inc(a,"patch"),Minor:Da.default.inc(a,"minor"),Major:Da.default.inc(a,"major")}),this.dry){this.logChanges(d,l);return}if(!this.yes&&!await this.promptConfirm(d,l))return 0;t.topLevelWorkspace.manifest.version=d,this.updateManifests(l,xx(t.topLevelWorkspace,t),d);let h=await Tc.StreamReport.start({configuration:r,stdout:this.context.stdout,includeLogs:!0},async b=>{await t.resolveEverything({cache:n,report:b})});if(h.hasErrors())return h.exitCode();await t.persist(),await this.gitCommitAndTag(d)}async getChangedWorkspaces(r,t,n,i,a){let o=n.map(d=>W7.default.filter(`!${d}`,{matchBase:!0,dot:!0})),u=new Set,s=new Map;await ci(r,async d=>{let h=or(d.manifest);if(s.set(h,d),this.all||a.has(h)){u.add(d);return}o.reduce((v,m)=>v.filter(m),await M7(t,d.cwd)).length>0&&u.add(d)});let l;do{l=!1;for(let[d,h]of i){let x=s.get(d);if(!u.has(x))for(let v of h){let m=s.get(v);if(u.has(m)){l=!0,u.add(x);break}}}}while(l);return Array.from(u).sort(jc("cwd"))}async promptVersion(r,t){let n=Object.entries(t).map(([a,o])=>({name:`${a} (${o})`,value:o})),{version:i}=await Bc.default.prompt({type:"list",name:"version",message:`Select a new version (currently ${r}):`,choices:n});return i}async promptConfirm(r,t){this.logChanges(r,t);let{confirm:n}=await Bc.default.prompt({type:"confirm",name:"confirm",message:"Are you sure you want to create these versions?",default:!1});return n}logChanges(r,t){console.log(""),console.log("Changes:");for(let{manifest:n}of t)console.log(` - ${or(n)}: ${n.version} => ${r}`);console.log("")}updateManifests(r,t,n){for(let{manifest:i}of r)i.version=n;for(let{manifest:i}of r)for(let{manifest:a}of t){let{identHash:o}=a.name,u=i.dependencies.get(o);if(u==null?void 0:u.range.includes("workspace:")){let s=u.range.replace(/workspace:[\w\^\~\.\*\-]+/g,`workspace:^${a.version}`),l=Tc.structUtils.makeDescriptor(u,s);i.dependencies.set(o,l)}}}async gitCommitAndTag(r){var n;let t=((n=this.tagVersionPrefix)!=null?n:"v")+r;if(!this.yes){let{confirm:i}=await Bc.default.prompt({type:"confirm",name:"confirm",message:`Are you sure you want to commit and tag these changes as "${t}"?`,default:!1});if(!i)return 0}await R7(t),await L7(t)}};Se.usage=ur.Command.Usage({description:"Bump the version of the updated packages",details:"\n This command will check which packages have been changed since the last git tag. Then, it update the package.json files and then create a new git tag.\n\n If no version is specified, it will prompt for it.\n\n - The `-f,--force` option allows you to specify a package that must be updated even if git doesn't detect any change. It can be specified multiple times, for multiple packages.\n - If the `--all` option is specified, every package will be updated.\n - The `--yes` option disables the confirmation prompts.\n - If `--tag-version-prefix` is specified, it will be used to build the tag name (default: `v`).\n\n This command also reads two options from the .yarnrc.yml file:\n - `releaseTool.ignoreChanges` allows you to specify an array of file patterns to ignore when computing the updated packages.\n - `releaseTool.implicitDependencies` allows you to specify implicit build-time dependencies between packages. When an implicit dependency package is updated, also the implicit dependents will be released.\n "}),ne([ur.Command.String({required:!1})],Se.prototype,"version",2),ne([ur.Command.Array("-f,--force-update")],Se.prototype,"forceUpdates",2),ne([ur.Command.Boolean("--yes")],Se.prototype,"yes",2),ne([ur.Command.String("--tag-version-prefix")],Se.prototype,"tagVersionPrefix",2),ne([ur.Command.Boolean("--all")],Se.prototype,"all",2),ne([ur.Command.Boolean("--dry")],Se.prototype,"dry",2),ne([ur.Command.Path("release-tool","version")],Se.prototype,"execute",1);var U7=Se;var Y7=N(E("@yarnpkg/cli")),sr=N(E("clipanion")),gx=N(E("path"));var G7=class{constructor(r){Wc(this,"value");Wc(this,"next");this.value=r}},$e,qt,At,bx=class{constructor(){qa(this,$e,void 0);qa(this,qt,void 0);qa(this,At,void 0);this.clear()}enqueue(r){var n;let t=new G7(r);Qe(this,$e)?(Qe(this,qt).next=t,qe(this,qt,t)):(qe(this,$e,t),qe(this,qt,t)),qe(this,At,(n=+Qe(this,At))+1)}dequeue(){var t;let r=Qe(this,$e);if(!!r)return qe(this,$e,Qe(this,$e).next),qe(this,At,(t=+Qe(this,At))-1),r.value}clear(){qe(this,$e,void 0),qe(this,qt,void 0),qe(this,At,0)}get size(){return Qe(this,At)}*[Symbol.iterator](){let r=Qe(this,$e);for(;r;)yield r.value,r=r.next}};$e=new WeakMap,qt=new WeakMap,At=new WeakMap;var K7=bx;function wa(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let r=new K7,t=0,n=()=>{t--,r.size>0&&r.dequeue()()},i=async(u,s,l)=>{t++;let d=(async()=>u(...l))();s(d);try{await d}catch{}n()},a=(u,s,l)=>{r.enqueue(i.bind(void 0,u,s,l)),(async()=>{await Promise.resolve(),t0&&r.dequeue()()})()},o=(u,...s)=>new Promise(l=>{a(u,l,s)});return Object.defineProperties(o,{activeCount:{get:()=>t},pendingCount:{get:()=>r.size},clearQueue:{value:()=>{r.clear()}}}),o}var Q7=N(cx());var He=N(E("@yarnpkg/core")),Fa=N(E("@yarnpkg/plugin-npm"));var vx=N(E("@yarnpkg/core"));var z7=class{constructor(){this.dependencies=new Set;this.dependents=new Set}addDependent(r){this.dependents.add(r),r.dependencies.add(this)}unlink(){this.dependencies.forEach(r=>r.dependents.delete(this)),this.dependents.forEach(r=>r.dependencies.delete(this))}*dependenciesIterator(){yield*this.dependencies}*dependentsIterator(){yield*this.dependents}hasDependencies(){return this.dependencies.size>0}},mx=class extends z7{constructor(r){super();this.workspace=r}intersects(r){for(let t of r.workspacesIterator())if(t===this.workspace)return!0;return!1}*workspacesIterator(){yield this.workspace}toString(){return or(this.workspace.manifest)}deleteWorkspace(r){return this.workspace===r}},yx=class extends Set{constructor(r){super();this.packages=new Map;r.forEach(t=>{let n=new mx(t);this.packages.set(t.locator.identHash,n),this.add(n)}),this.packages.forEach(t=>{t.workspace.manifest.dependencies.forEach((n,i)=>{var a;(a=this.packages.get(i))==null||a.addDependent(t)})})}getProcessableWorkspaces(){let r=new Set;for(let t of this)if(!t.hasDependencies())for(let n of t.workspacesIterator())r.add(n);return r}delete(r){return this.has(r)&&r.unlink(),super.delete(r)}deleteWorkspace(r){let t=this.packages.get(r.locator.identHash);return t?t.deleteWorkspace(r)&&this.delete(t):!1}detectCycles(r){let t=[],n=new WeakSet,i=o=>{for(let u=0;u ")}`);return}n.has(o)||(n.add(o),a(o))};function a(o){if(!(o instanceof mx)){r.reportError(vx.MessageName.CYCLIC_DEPENDENCIES,`Dependency cycle detected: ${o}`);return}t.push(o);for(let u of o.dependenciesIterator())i(u);t.pop()}this.forEach(i)}},Ic=yx;var V7=N(E("@yarnpkg/core")),_x=N(E("@yarnpkg/plugin-pack")),$7=N(E("@yarnpkg/plugin-npm"));async function H7(e,r,t){let n=await _x.packUtils.genPackList(e),i=await _x.packUtils.genPackStream(e,n),a=await V7.miscUtils.bufferStream(i);return $7.npmPublishUtils.makePublishBody(e,a,{access:void 0,tag:t,registry:r})}var Hr=class extends Y7.BaseCommand{constructor(){super(...arguments);this.tag="latest";this.tagVersionPrefix="v"}async execute(){let{project:r,configuration:t}=await fi("release-tool publish",this.context);console.log("PUBLISH TAG",this.tag),await r.restoreInstallState();let n=await this.getTaggedPackages(r),i=new Ic(n);return(await He.StreamReport.start({configuration:t,stdout:this.context.stdout,includeLogs:!0},async o=>{if(i.detectCycles(o),o.hasErrors())return;let u=await this.packPackages(n,t,o);o.hasErrors()||!this.yes&&!await this.promptConfirm(n)||(await o.startTimerPromise(`Publishing ${n.size} packages`,()=>this.publishPackages(i,u,t,o)),!o.hasErrors()&&await this.runLifecycleScript(n,"postpublish",{report:o}))})).exitCode()}async getTaggedPackages(r){if(!(await I7(`${this.tagVersionPrefix}*.*.*`)).length)throw new Error("No version tag found");let n=await k7("HEAD"),i=new Set(n.filter(o=>gx.default.basename(o)==="package.json").map(o=>gx.default.dirname(o))),a=new Set;return await ci(r,async o=>{i.has(o.relativeCwd)&&!o.manifest.private&&a.add(o)}),a}async packPackages(r,t,n){let i=wa(4),a=new Map,o=Array.from(r,u=>i(async()=>{let s=await this.packPackage(u,t,n);a.set(u,s)}));return await Promise.all(o),a}async packPackage(r,t,n){if(r.manifest.private)throw new sr.UsageError("Private workspaces cannot be published");if(r.manifest.name===null||r.manifest.version===null)throw new sr.UsageError("Workspaces must have valid names and versions to be published on an external registry");let i=Fa.npmConfigUtils.getPublishRegistry(r.manifest,{configuration:t});await He.scriptUtils.maybeExecuteWorkspaceLifecycleScript(r,"prepublish",{report:n}),await He.scriptUtils.maybeExecuteWorkspaceLifecycleScript(r,"prepublishOnly",{report:n}),await He.scriptUtils.maybeExecuteWorkspaceLifecycleScript(r,"prepack",{report:n});let a=await H7(r,i,this.tag);return{registry:i,body:a}}async publishPackages(r,t,n,i){let a=wa(4);do{let o=r.getProcessableWorkspaces();if(o.size===0&&r.size>0)throw new Error(`Some packages could not be published: `+Array.from(r,s=>` - ${s}`).join(` `));let u=[];for(let s of o){let{body:l,registry:d}=t.get(s);u.push(a(async()=>{try{await this.publishPackage(s,l,d,n,i)}catch(h){throw i.reportError(He.MessageName.UNNAMED,`Error while publishing ${s.manifest.name}: ${h}`),h}finally{r.deleteWorkspace(s)}}))}await Promise.allSettled(u)}while(r.size>0)}async publishPackage(r,t,n,i,a){let o=r.manifest.name;try{await Fa.npmHttpUtils.put(Fa.npmHttpUtils.getIdentUrl(o),t,{configuration:i,registry:n,ident:o,jsonResponse:!0}),a.reportInfo(null,`Published ${or(r.manifest)} ${r.manifest.version}`)}catch(u){if(u.name!=="HTTPError")throw u;{let s=u.response.body&&u.response.body.error?u.response.body.error:`The remote server answered with HTTP ${u.response.statusCode} ${u.response.statusMessage}`;a.reportError(He.MessageName.NETWORK_ERROR,`[${or(r.manifest)}] ${s}`)}}}async promptConfirm(r){let t=Array.from(r).sort(jc("cwd"));console.log(""),console.log("Updated packages:");for(let{manifest:i}of t)console.log(` - ${or(i)}: ${i.version}`);console.log("");let{confirm:n}=await Q7.default.prompt({type:"confirm",name:"confirm",message:"Are you sure you want to create these versions?",default:!1});return n}async runLifecycleScript(r,t,n){let i=wa(4),a=[];for(let o of r)a.push(i(()=>He.scriptUtils.maybeExecuteWorkspaceLifecycleScript(o,t,n)));await Promise.all(a)}};Hr.usage=sr.Command.Usage({description:"Publish on npm the packages updated in the last version",details:"\n This command will first check that the current git HEAD correspond to a version tag (generated with `yarn release-tool version`), then it will upload the packages modified in that commit to the npm registry.\n\n - The `--tag` option allows you to specify how to tag this release on npm (default: `latest`)\n - The `--yes` option disables the confirmation prompt.\n - If `--tag-version-prefix` is specified, it will be used to find the correct tag name (default: `v`).\n "}),ne([sr.Command.Boolean("--yes")],Hr.prototype,"yes",2),ne([sr.Command.String("--tag")],Hr.prototype,"tag",2),ne([sr.Command.String("--tag-version-prefix")],Hr.prototype,"tagVersionPrefix",2),ne([sr.Command.Path("release-tool","publish")],Hr.prototype,"execute",1);var J7=Hr;var X7=N(E("@yarnpkg/cli")),Ex=N(E("clipanion"));var Z7=N(E("@yarnpkg/core"));var Ca=class extends X7.BaseCommand{async execute(){let{project:r,configuration:t}=await fi("release-tool check-cycles",this.context);await r.restoreInstallState();let n=await this.getWorkspaces(r),i=new Ic(n);return(await Z7.StreamReport.start({configuration:t,stdout:this.context.stdout},async o=>i.detectCycles(o))).exitCode()}async getWorkspaces(r){let t=new Set;return await ci(r,async n=>{n.manifest.private||t.add(n)}),t}};Ca.usage=Ex.Command.Usage({description:"Assert that there aren't dependency cycles that can cause problems while publishing."}),ne([Ex.Command.Path("release-tool","check-cycles")],Ca.prototype,"execute",1);var eF=Ca;var tse={configuration:{releaseTool:{description:"",type:Oa.SettingsType.SHAPE,properties:{ignoreChanges:{description:"",type:Oa.SettingsType.STRING,isArray:!0,default:[]},implicitDependencies:{description:"",type:Oa.SettingsType.MAP,valueDefinition:{description:"",type:Oa.SettingsType.STRING,isArray:!0,default:[]}}}}},commands:[U7,J7,eF]};return nse;})();