Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
fix: yarn berry upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Jan 16, 2024
1 parent be7fb77 commit 94ea423
Show file tree
Hide file tree
Showing 8 changed files with 6,562 additions and 6,567 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary
20 changes: 10 additions & 10 deletions .yarn/plugins/@yarnpkg/plugin-fetch.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
module.exports = {
name: "@yarnpkg/plugin-fetch",
factory: function (require) {
var plugin=(()=>{var ce=Object.defineProperty;var ae=(n,t,e)=>t in n?ce(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var c=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+n+'" is not supported')});var a=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var u=(n,t,e)=>(ae(n,typeof t!="symbol"?t+"":t,e),e);var w=a((Ke,D)=>{"use strict";D.exports=function(t){return t.map(function(e){return e&&typeof e=="object"?e.op.replace(/(.)/g,"\\$1"):/["\s]/.test(e)&&!/'/.test(e)?"'"+e.replace(/(['\\])/g,"\\$1")+"'":/["'\s]/.test(e)?'"'+e.replace(/(["\\$`!])/g,"\\$1")+'"':String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var B=a((We,A)=>{var C=c("fs"),ie=c("path"),{parseSyml:le}=c("@yarnpkg/parsers");A.exports=function(){let t=C.readFileSync("yarn.lock","utf8"),e=le(t),o=Object.keys(e).filter(r=>r.includes("@workspace:")),s=o.map(r=>{let[,i]=e[r].resolution.trim().split("@workspace:");return i==="."?null:i}).filter(Boolean);o.forEach(r=>{let{dependencies:i,dependenciesMeta:l,peerDependencies:q,peerDependenciesMeta:b,resolution:O,bin:ne}=e[r],[oe,P]=O.trim().split("@workspace:"),re=ie.join(P,"package.json"),h={name:oe,version:"0.0.0",description:"**DON'T COMMIT** Generated file for caching",private:!0,dependencies:i,peerDependencies:q,peerDependenciesMeta:b,bin:ne};if(l){let g={};Object.keys(l).forEach(m=>{g[m]=i[m],delete i[m]}),h.optionalDependencies=g}if(P==="."){s.length>0&&(h.workspaces={packages:s});let g=Object.keys(e),m=p=>{let d=p.trim().split("@");return p.startsWith("@")?d=d.slice(0,2):d=d.slice(0,1),d.join("@")};h.resolutions=g.filter(p=>{if(p.includes("@workspace:")||p.includes(", ")||!p.includes("@npm:"))return!1;let d=m(p);return g.every(y=>p===y?!0:y.split(",").map(k=>m(k)).every(k=>k!==d))}).reduce((p,d)=>{let[y,k]=d.trim().split("@npm:");return p[y]=k.includes("@")?`npm:${k}`:k,p},{})}C.mkdirSync(P,{recursive:!0}),C.writeFileSync(re,`${JSON.stringify(h,null,2)}
`)})}});var j=a((_e,Y)=>{var pe=B();Y.exports=n=>{n.context.stdout.write(`[YARN-FETCH] extracting package.json file(s) from yarn.lock
`),pe()}});var R=a((Ge,H)=>{var f=c("fs"),ue=c("path"),{execSync:de}=c("child_process"),{parseSyml:ke}=c("@yarnpkg/parsers"),{BaseCommand:fe}=c("@yarnpkg/cli"),{Command:me,Option:v}=c("clipanion"),ge=w(),he=j(),x;H.exports=(x=class extends fe{protectPackageJson=v.Boolean("--protect-package-json");args=v.Proxy();async execute(){let{protectPackageJson:t=process.stdout.isTTY}=this,e=[];if(t){this.context.stdout.write(`[YARN-FETCH] backup possible package.json file(s)
`);let s=f.readFileSync("yarn.lock","utf8"),r=ke(s);e=Object.keys(r).filter(l=>l.includes("@workspace:")).map(l=>{let{resolution:q}=r[l],[,b]=q.trim().split("@workspace:");return ue.join(b,"package.json")}),e.forEach(l=>{f.existsSync(l)&&!f.existsSync(`${l}.yarn-plugin-fetch-bak`)&&f.copyFileSync(l,`${l}.yarn-plugin-fetch-bak`)})}he(this);let o=`yarn ${ge(this.args)}`;this.context.stdout.write(`[YARN-FETCH] ${o}
`);try{de(o,{stdio:"inherit"})}catch(s){throw s}finally{t&&(this.context.stdout.write(`[YARN-FETCH] restoring possible package.json file(s)
`),e.forEach(s=>{f.existsSync(`${s}.yarn-plugin-fetch-bak`)?f.renameSync(`${s}.yarn-plugin-fetch-bak`,s):f.unlinkSync(s)}))}}},u(x,"paths",[["fetch"]]),u(x,"usage",me.Usage({description:"fetch dependencies from yarn.lock in Docker build",details:`
var plugin=(()=>{var le=Object.defineProperty;var pe=(s,e,t)=>e in s?le(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var c=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});var i=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var f=(s,e,t)=>(pe(s,typeof e!="symbol"?e+"":e,t),t);var $=i((Ue,A)=>{"use strict";A.exports=function(e){return e.map(function(t){return t&&typeof t=="object"?t.op.replace(/(.)/g,"\\$1"):/["\s]/.test(t)&&!/'/.test(t)?"'"+t.replace(/(['\\])/g,"\\$1")+"'":/["'\s]/.test(t)?'"'+t.replace(/(["\\$`!])/g,"\\$1")+'"':String(t).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var H=i((Ve,v)=>{var C=c("fs"),ue=c("path"),{parseSyml:fe}=c("@yarnpkg/parsers"),ke=["patch","npm","portal","link"],B=s=>{let e=s.trim().split("@");return s.startsWith("@")?e=e.slice(0,2):e=e.slice(0,1),e.join("@")},Y=(s,e)=>{let[t,r]=s.trim().split(`@${e}:`);return{key:t,version:r}},de=s=>{let[,e]=s.split("::")[0].split("#");return e};v.exports=function(){let e=C.readFileSync("yarn.lock","utf8"),t=fe(e),r=Object.keys(t).filter(o=>o.includes("@workspace:")),n=r.map(o=>{let[,l]=t[o].resolution.trim().split("@workspace:");return l==="."?null:l}).filter(Boolean);r.forEach(o=>{let{dependencies:l,dependenciesMeta:u,peerDependencies:b,peerDependenciesMeta:P,resolution:D,bin:ce}=t[o],[ae,w]=D.trim().split("@workspace:"),ie=ue.join(w,"package.json"),y={name:ae,version:"0.0.0",description:"**DON'T COMMIT** Generated file for caching",private:!0,dependencies:l,peerDependencies:b,peerDependenciesMeta:P,bin:ce};if(u){let m={};Object.keys(u).forEach(d=>{m[d]=l[d],delete l[d]}),y.optionalDependencies=m}if(w==="."){n.length>0&&(y.workspaces={packages:n});let m=Object.keys(t),d=new Map;m.forEach(p=>{p.split(",").forEach(k=>{if(k.includes("builtin<compat/"))return;let a=B(k);d.has(a)||d.set(a,[]),d.get(a).push(k)})}),y.resolutions=m.filter(p=>{var a;if(p.includes("@workspace:"))return!1;if(p.includes("@patch:"))return!((a=de(Y(p,"patch").version).match(/(\.\.\/)+/))!=null&&a.length);if(p.includes(", "))return!1;let k=B(p);return d.get(k).length===1}).reduce((p,k)=>(ke.forEach(a=>{if(!k.includes(`@${a}:`))return;let{key:x,version:g}=Y(k,a);switch(a){case"npm":p[x]=g.includes("@")?`${a}:${g}`:g;break;case"patch":k.includes("builtin<compat/")||(p[x]=`${a}:${g.split("::")[0]}`);break;case"portal":case"link":p[x]=`${a}:${g.split("::")[0]}`;break}}),p),{})}C.mkdirSync(w,{recursive:!0}),C.writeFileSync(ie,`${JSON.stringify(y,null,2)}
`)})}});var j=i((Ze,R)=>{var he=H();R.exports=s=>{s.context.stdout.write(`[YARN-FETCH] extracting package.json file(s) from yarn.lock
`),he()}});var K=i((Xe,L)=>{var h=c("fs"),me=c("path"),{execSync:ge}=c("child_process"),{parseSyml:ye}=c("@yarnpkg/parsers"),{BaseCommand:xe}=c("@yarnpkg/cli"),{Command:qe,Option:M}=c("clipanion"),be=$(),Pe=j(),q;L.exports=(q=class extends xe{protectPackageJson=M.Boolean("--protect-package-json");args=M.Proxy();async execute(){let{protectPackageJson:e=process.stdout.isTTY}=this,t=[];if(e){this.context.stdout.write(`[YARN-FETCH] backup possible package.json file(s)
`);let n=h.readFileSync("yarn.lock","utf8"),o=ye(n);t=Object.keys(o).filter(u=>u.includes("@workspace:")).map(u=>{let{resolution:b}=o[u],[,P]=b.trim().split("@workspace:");return me.join(P,"package.json")}),t.forEach(u=>{h.existsSync(u)&&!h.existsSync(`${u}.yarn-plugin-fetch-bak`)&&h.copyFileSync(u,`${u}.yarn-plugin-fetch-bak`)})}Pe(this);let r=`yarn ${be(this.args)}`;this.context.stdout.write(`[YARN-FETCH] ${r}
`);try{ge(r,{stdio:"inherit"})}catch(n){throw n}finally{e&&(this.context.stdout.write(`[YARN-FETCH] restoring possible package.json file(s)
`),t.forEach(n=>{h.existsSync(`${n}.yarn-plugin-fetch-bak`)?h.renameSync(`${n}.yarn-plugin-fetch-bak`,n):h.unlinkSync(n)}))}}},f(q,"paths",[["fetch"]]),f(q,"usage",qe.Usage({description:"fetch dependencies from yarn.lock in Docker build",details:`
expand yarn.lock to package.json file(s) and install dependencies in Docker build.
`,examples:[["yarn fetch --immutable","yarn fetch workspace my-package focus"]]})),x)});var M=a((Qe,L)=>{var{BaseCommand:ye}=c("@yarnpkg/cli"),xe=j(),S;L.exports=(S=class extends ye{async execute(){xe(this)}},u(S,"paths",[["fetch-tools","expand-lock"]]),S)});var K=a((Xe,I)=>{function qe(n,t,e){let o=t.split("."),s=n;for(let r of o){if(s[r]===void 0)return e;s=s[r]}return s}function be(n,t,e){let o=t.split("."),s=n;for(let r=0;r<o.length-1;r++){let i=o[r];(!s[i]||typeof s[i]!="object")&&(s[i]={}),s=s[i]}return s[o[o.length-1]]=e,n}function Pe(n,t){let e=t.split("."),o=n;for(let s=0;s<e.length-1;s++){let r=e[s];if(!o[r])return!1;o=o[r]}return delete o[e[e.length-1]],!0}I.exports={get:qe,set:be,unset:Pe}});var F=a((et,_)=>{var W=c("fs"),{get:we,set:Ce,unset:je}=K();_.exports=function(t,e){let o=JSON.parse(W.readFileSync("package.json","utf-8")),s=we(o,t);s!==void 0&&(Ce(o,e,s),je(o,t),W.writeFileSync("package.json",JSON.stringify(o,null,2)))}});var $=a((tt,z)=>{var Se=F();z.exports=function(){Se("scripts._postinstall","scripts.postinstall")}});var U=a((nt,G)=>{var{BaseCommand:Fe}=c("@yarnpkg/cli"),$e=$(),E;G.exports=(E=class extends Fe{async execute(){$e()}},u(E,"paths",[["fetch-tools","disable-postinstall"]]),E)});var J=a((rt,Z)=>{var Ee=F();Z.exports=function(){Ee("scripts.postinstall","scripts._postinstall")}});var V=a((at,Q)=>{var{BaseCommand:Je}=c("@yarnpkg/cli"),Ne=J(),N;Q.exports=(N=class extends Je{async execute(){Ne()}},u(N,"paths",[["fetch-tools","disable-postinstall"]]),N)});var te=a((pt,ee)=>{var{execSync:Te}=c("child_process"),{BaseCommand:Oe}=c("@yarnpkg/cli"),{Option:X}=c("clipanion"),De=w(),Ae=$(),Be=J(),T;ee.exports=(T=class extends Oe{postinstall=X.Boolean("--postinstall");args=X.Proxy();async execute(){this.postinstall||(this.context.stdout.write(`[YARN-FETCH] disable postinstall command in package.json
`),Be());let t=`yarn workspaces focus --production ${De(this.args)}`;this.context.stdout.write(`[YARN-FETCH] ${t}
`),Te(t,{stdio:"inherit"}),this.postinstall||(this.context.stdout.write(`[YARN-FETCH] re-enable postinstall command in package.json
`),Ae())}},u(T,"paths",[["fetch-tools","production"]]),T)});var Me=a((dt,se)=>{var Ye=R(),ve=M(),He=U(),Re=V(),Le=te();se.exports={commands:[Ye,ve,Re,He,Le]}});return Me();})();
`,examples:[["yarn fetch --immutable","yarn fetch workspace my-package focus"]]})),q)});var W=i((st,I)=>{var{BaseCommand:we}=c("@yarnpkg/cli"),$e=j(),S;I.exports=(S=class extends we{async execute(){$e(this)}},f(S,"paths",[["fetch-tools","expand-lock"]]),S)});var z=i((rt,_)=>{function Ce(s,e,t){let r=e.split("."),n=s;for(let o of r){if(n[o]===void 0)return t;n=n[o]}return n}function je(s,e,t){let r=e.split("."),n=s;for(let o=0;o<r.length-1;o++){let l=r[o];(!n[l]||typeof n[l]!="object")&&(n[l]={}),n=n[l]}return n[r[r.length-1]]=t,s}function Se(s,e){let t=e.split("."),r=s;for(let n=0;n<t.length-1;n++){let o=t[n];if(!r[o])return!1;r=r[o]}return delete r[t[t.length-1]],!0}_.exports={get:Ce,set:je,unset:Se}});var E=i((ot,U)=>{var G=c("fs"),{get:Ee,set:Fe,unset:Je}=z();U.exports=function(e,t){let r=JSON.parse(G.readFileSync("package.json","utf-8")),n=Ee(r,e);n!==void 0&&(Fe(r,t,n),Je(r,e),G.writeFileSync("package.json",JSON.stringify(r,null,2)))}});var F=i((ct,V)=>{var Ne=E();V.exports=function(){Ne("scripts._postinstall","scripts.postinstall")}});var Q=i((it,Z)=>{var{BaseCommand:Te}=c("@yarnpkg/cli"),Oe=F(),J;Z.exports=(J=class extends Te{async execute(){Oe()}},f(J,"paths",[["fetch-tools","disable-postinstall"]]),J)});var N=i((pt,X)=>{var De=E();X.exports=function(){De("scripts.postinstall","scripts._postinstall")}});var te=i((ft,ee)=>{var{BaseCommand:Ae}=c("@yarnpkg/cli"),Be=N(),T;ee.exports=(T=class extends Ae{async execute(){Be()}},f(T,"paths",[["fetch-tools","disable-postinstall"]]),T)});var re=i((ht,ne)=>{var{execSync:Ye}=c("child_process"),{BaseCommand:ve}=c("@yarnpkg/cli"),{Option:se}=c("clipanion"),He=$(),Re=F(),Me=N(),O;ne.exports=(O=class extends ve{postinstall=se.Boolean("--postinstall");args=se.Proxy();async execute(){this.postinstall||(this.context.stdout.write(`[YARN-FETCH] disable postinstall command in package.json
`),Me());let e=`yarn workspaces focus --production ${He(this.args)}`;this.context.stdout.write(`[YARN-FETCH] ${e}
`),Ye(e,{stdio:"inherit"}),this.postinstall||(this.context.stdout.write(`[YARN-FETCH] re-enable postinstall command in package.json
`),Re())}},f(O,"paths",[["fetch-tools","production"]]),O)});var ze=i((gt,oe)=>{var Le=K(),Ke=W(),Ie=Q(),We=te(),_e=re();oe.exports={commands:[Le,Ke,We,Ie,_e]}});return ze();})();
return plugin;
}
};
Loading

0 comments on commit 94ea423

Please sign in to comment.