Files
FlakeTest/client/.yarn/plugins/yarn-plugin-nixify.cjs

1 line
16 KiB
JavaScript
Raw Normal View History

module.exports={name:"yarn-plugin-nixify",factory:function(e){var t;return(()=>{"use strict";var n={d:(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};n.r(o),n.d(o,{default:()=>P});const i=e("@yarnpkg/core"),r=e("clipanion");class a extends r.Command{constructor(...e){super(...e),this.locator=r.Option.String()}async execute(){const e=await i.Configuration.find(this.context.cwd,this.context.plugins),{project:t}=await i.Project.find(e,this.context.cwd),n=await i.Cache.find(e),o=e.makeFetcher();return(await i.StreamReport.start({configuration:e,stdout:this.context.stdout},(async e=>{const{locatorHash:r}=i.structUtils.parseLocator(this.locator,!0),a=t.originalPackages.get(r);a?await o.fetch(a,{checksums:t.storedChecksums,project:t,cache:n,fetcher:o,report:e}):e.reportError(0,"Invalid locator")}))).exitCode()}}a.paths=[["nixify","fetch-one"]];const s=e("@yarnpkg/fslib"),c=e("crypto");class l extends r.Command{constructor(...e){super(...e),this.locator=r.Option.String(),this.source=r.Option.String(),this.installLocation=r.Option.String()}async execute(){const e=await i.Configuration.find(this.context.cwd,this.context.plugins),{project:t}=await i.Project.find(e,this.context.cwd);return(await i.StreamReport.start({configuration:e,stdout:this.context.stdout},(async n=>{await t.resolveEverything({report:n,lockfileOnly:!0});const o=i.structUtils.parseLocator(this.locator,!0),r=t.storedPackages.get(o.locatorHash);if(!r)return void n.reportError(0,"Invalid locator");const a=s.ppath.join(t.cwd,this.installLocation);await s.xfs.mkdirpPromise(s.ppath.dirname(a)),await i.execUtils.execvp("cp",["-R",this.source,a],{cwd:t.cwd,strict:!0}),await i.execUtils.execvp("chmod",["-R","u+w",a],{cwd:t.cwd,strict:!0});const l=(0,c.createHash)("sha512");l.update(process.versions.node),e.triggerHook((e=>e.globalHashGeneration),t,(e=>{l.update("\0"),l.update(e)}));const d=l.digest("hex"),p=new Map,h=e=>{let n=p.get(e.locatorHash);if(void 0!==n)return n;const o=t.storedPackages.get(e.locatorHash);if(void 0===o)throw new Error("Assertion failed: The package should have been registered");const r=(0,c.createHash)("sha512");r.update(e.locatorHash),p.set(e.locatorHash,"<recursive>");for(const e of o.dependencies.values()){const n=t.storedResolutions.get(e.descriptorHash);if(void 0===n)throw new Error(`Assertion failed: The resolution (${i.structUtils.prettyDescriptor(t.configuration,e)}) should have been registered`);const o=t.storedPackages.get(n);if(void 0===o)throw new Error("Assertion failed: The package should have been registered");r.update(h(o))}return n=r.digest("hex"),p.set(e.locatorHash,n),n},u=(0,c.createHash)("sha512").update(d).update(h(r)).update(a).digest("hex");t.storedBuildState.set(r.locatorHash,u),await t.persistInstallStateFile()}))).exitCode()}}l.paths=[["nixify","inject-build"]];const d=e("@yarnpkg/plugin-pnp"),p=JSON.stringify,h=(e,t,n=!1)=>t.split("\n").map((t=>t||n?e+t:t)).join("\n"),u=(e,t)=>{let n=e;for(const[e,o]of Object.entries(t))if("string"==typeof o&&(n=n.replace(`@@${e}@@`,o)),"boolean"==typeof o){const t=n.split("\n"),i=t.indexOf(`#@@ IF ${e}`),r=t.indexOf(`#@@ ENDIF ${e}`);-1!==i&&r>i&&(o?(t.splice(r,1),t.splice(i,1)):t.splice(i,r-i+1),n=t.join("\n"))}return n},f=["pnp","node-modules"];class g extends r.Command{constructor(...e){super(...e),this.binDir=r.Option.String()}async execute(){const e=await i.Configuration.find(this.context.cwd,this.context.plugins),{project:t,workspace:n}=await i.Project.find(e,this.context.cwd);return(await i.StreamReport.start({configuration:e,stdout:this.context.stdout},(async o=>{if(!n||0===n.manifest.bin.size)return;let i=e.get("nodeLinker");f.includes(i)||(i="node-modules",o.reportWarning(0,`The nodeLinker ${i} is not supported - executables may have trouble finding dependencies`));const r=s.npath.toPortablePath(this.binDir),