import{t as e}from"./subsystem-kTFXkQM5.js";import{jo as t}from"./auth-profiles-qXC1L8hs.js";import{d as n,f as r,j as i}from"./agent-scope-BKE4M04k.js";import{c as a,l as o}from"./compact-BJve-7Ci.js";import{d as s}from"./npm-pack-install-C3zwwLzE.js";import c from"node:path";const l=e(`plugins`);function u(e){let s=e?.config??t(),c=e?.workspaceDir?e.workspaceDir:n(s,r(s))??i();return{workspaceDir:c,...o({config:s,workspaceDir:c,logger:a(l)})}}function d(e,t){return e.startsWith(`.`)||e.startsWith(`~`)||c.isAbsolute(e)||t.some(t=>e.endsWith(t))}function f(e){let t=e.pin&&e.resolvedSpec?e.resolvedSpec:e.rawSpec;return e.pin?e.resolvedSpec?{recordSpec:t,pinNotice:`Pinned npm install record to ${e.resolvedSpec}.`}:{recordSpec:t,pinWarning:`Could not resolve exact npm version for --pin; storing original npm spec.`}:{recordSpec:t}}function p(e){return{source:`npm`,spec:e.spec,installPath:e.installPath,version:e.version,...s(e.resolution)}}function m(e){let t=f({rawSpec:e.rawSpec,pin:e.pin,resolvedSpec:e.resolution?.resolvedSpec});return g(t,e.log,e.warn),p({spec:t.recordSpec,installPath:e.installPath,version:e.version,resolution:e.resolution})}function h(e,t,n,r,i,a,o){return m({rawSpec:e,pin:t,installPath:n,version:r,resolution:i,log:a,warn:e=>a(o(e))})}function g(e,t,n){e.pinWarning&&n(e.pinWarning),e.pinNotice&&t(e.pinNotice)}export{u as i,h as n,d as r,p as t};
