@visulima/vis 2.0.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/LICENSE.md +850 -128
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +3 -3
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +67 -67
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +150 -148
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +3 -3
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +3 -3
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +3 -3
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +5 -5
- package/dist/packem_chunks/handler51.js +2 -2
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +4 -4
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +2 -2
- package/dist/packem_chunks/handler61.js +13 -13
- package/dist/packem_chunks/handler62.js +3 -3
- package/dist/packem_chunks/handler63.js +2 -2
- package/dist/packem_chunks/handler64.js +4 -4
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +13 -13
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +15 -15
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +5 -5
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +23 -23
- package/dist/packem_chunks/handler73.js +5 -5
- package/dist/packem_chunks/handler74.js +24 -24
- package/dist/packem_chunks/handler75.js +2 -2
- package/dist/packem_chunks/handler76.js +5 -5
- package/dist/packem_chunks/handler77.js +18 -18
- package/dist/packem_chunks/handler78.js +25 -25
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +2 -2
- package/dist/packem_chunks/heal.js +4 -4
- package/dist/packem_chunks/help-command.js +46 -46
- package/dist/packem_chunks/index2.js +6 -4
- package/dist/packem_chunks/index3.js +3 -3
- package/dist/packem_chunks/index4.js +49 -49
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +2 -2
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +2 -2
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/registry.js +10 -10
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +6 -6
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{advisories-BGeuHJQg.js → advisories-DsXRmIA5.js} +1 -1
- package/dist/packem_shared/{affected-selection-B85ND6JV.js → affected-selection-BE6VFCDV.js} +1 -1
- package/dist/packem_shared/{affected-shas-BWRRAB47.js → affected-shas-BKEu4RZc.js} +1 -1
- package/dist/packem_shared/ai-analysis-DikAj6rX.js +68 -0
- package/dist/packem_shared/{ai-fix-BgBU0TOz.js → ai-fix-bfWo0cZX.js} +4 -4
- package/dist/packem_shared/{augment-HVeX6LpU.js → augment-BkJxi_GW.js} +1 -1
- package/dist/packem_shared/{bin-DKod8Iqo.js → bin-B-TytgzW.js} +1 -1
- package/dist/packem_shared/{build-scripts-CM8M1xcG.js → build-scripts-DWypBQ--.js} +1 -1
- package/dist/packem_shared/{command-runtime-BVi4lL8k.js → command-runtime-DQ7ZpLYL.js} +1 -1
- package/dist/packem_shared/{cyclonedx-y7VLI-1d.js → cyclonedx-DLBi65MV.js} +3 -3
- package/dist/packem_shared/dependency-scan-ZLOuLkGN.js +1 -0
- package/dist/packem_shared/{docker-D1LStSlH.js → docker-B4zAZCZG.js} +28 -28
- package/dist/packem_shared/{en-BxrK-n-J.js → en-BDYMmM2_.js} +13 -13
- package/dist/packem_shared/{failure-log-ChuFC-8f.js → failure-log-DyhWPqno.js} +2 -2
- package/dist/packem_shared/glob-BUjyjdE8-Dp_QcayW.js +1 -0
- package/dist/packem_shared/index-BLtnel38.js +35 -0
- package/dist/packem_shared/index-CuKDxOCI.js +1 -0
- package/dist/packem_shared/index-tNFGWxc0.js +39 -0
- package/dist/packem_shared/index.server-CusjRLCh.js +2 -0
- package/dist/packem_shared/{lifecycle-Db0qh6vR.js → lifecycle-KY9umOg6.js} +1 -1
- package/dist/packem_shared/{lockfile-CDQ0n4P5.js → lockfile-YAuZf1gh.js} +1 -1
- package/dist/packem_shared/{manifests-Da_no4ZH.js → manifests-BwTn_1ad.js} +1 -1
- package/dist/packem_shared/{min-release-age-V6L6dpiP.js → min-release-age-6avfn81h.js} +1 -1
- package/dist/packem_shared/missing-package-json-Cl0vdz6K.js +1 -0
- package/dist/packem_shared/{native-config-sync-C0pUePad.js → native-config-sync-CHMCJx7H.js} +7 -7
- package/dist/packem_shared/{osv-bloom-DNFpvSSO.js → osv-bloom-DdqDnLCt.js} +2 -2
- package/dist/packem_shared/package-version-BNRJ3o9C.js +4 -0
- package/dist/packem_shared/packument-B9-WqReu.js +1 -0
- package/dist/packem_shared/pm-runner-DRybtzOV.js +1 -0
- package/dist/packem_shared/{project-name-filter-u2Q7YpQH.js → project-name-filter-Dw0fC6IO.js} +1 -1
- package/dist/packem_shared/{provenance-9OT8sTqn.js → provenance-CLxuqCfL.js} +1 -1
- package/dist/packem_shared/{readJsonSync-BnWiH5-R-BpnwAB0Z.js → readJsonSync-DweZd5ZA-CtrDlqpb.js} +1 -1
- package/dist/packem_shared/{registry-keys-CYHd7qU2.js → registry-keys-cTN24144.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-DC3XssJa.js → resolve-explicit-Uw6WQl9R.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-f5l4ODsH.js → resolve-runtime-DztanwkZ.js} +1 -1
- package/dist/packem_shared/{run-file-zB4ACnUy.js → run-file-CaE5_xBY.js} +1 -1
- package/dist/packem_shared/{runtime-check-CWvAfu5u.js → runtime-check-C32yE57I.js} +1 -1
- package/dist/packem_shared/{s1ngularity-DsmC71xt.js → s1ngularity-BIYhg82u.js} +1 -1
- package/dist/packem_shared/scan-progress-DWfY4zkp.js +2 -0
- package/dist/packem_shared/{selectors-CtxnIT4X.js → selectors-D2j4M9Ul.js} +1 -1
- package/dist/packem_shared/{signatures-Dwx5fD4g.js → signatures-C8iQ5fUq.js} +1 -1
- package/dist/packem_shared/target-merge-DLxJTcxn.js +11 -0
- package/dist/packem_shared/{target-options-BO4Uxt0k.js → target-options-3t4-2F-F.js} +1 -1
- package/dist/packem_shared/{toolchain-BY8lJaSN.js → toolchain-BPzbahcQ.js} +1 -1
- package/dist/packem_shared/{typosquats-BUGgotNu.js → typosquats-BWrmhh36.js} +1 -1
- package/dist/packem_shared/{use-measured-height-BLZt9dW2.js → use-measured-height-BwAwGHjw.js} +1 -1
- package/dist/packem_shared/verify-CzUPT6Uk.js +1 -0
- package/dist/packem_shared/vis-update-app-D6Wq8ZHM.js +1 -0
- package/dist/packem_shared/vis-user-error-CfM4_ORo.js +30 -0
- package/dist/packem_shared/{watch-CGrUW_JD.js → watch-D_oAxW_Z.js} +1 -1
- package/dist/packem_shared/{watch-loop-DIwSMjlA.js → watch-loop-BrjblOz5.js} +4 -4
- package/dist/runtime/preload.js +1 -1
- package/index.d.ts +204 -204
- package/index.js +52 -52
- package/package.json +16 -16
- package/dist/packem_shared/ai-analysis-oNMAj1wd.js +0 -68
- package/dist/packem_shared/dependency-scan-BAzKpXdW.js +0 -1
- package/dist/packem_shared/glob-BUjyjdE8-BSrdzgma.js +0 -1
- package/dist/packem_shared/index-BJw7gKD1.js +0 -1
- package/dist/packem_shared/index-DND6ptxQ.js +0 -35
- package/dist/packem_shared/index.server-qvZ-cy29.js +0 -2
- package/dist/packem_shared/missing-package-json-Jw8IEHct.js +0 -1
- package/dist/packem_shared/package-version-DjHDww_5.js +0 -4
- package/dist/packem_shared/packument-N3EWbZpL.js +0 -1
- package/dist/packem_shared/pm-runner-Bssje5qH.js +0 -1
- package/dist/packem_shared/public-api-WqUCiyIe.js +0 -131
- package/dist/packem_shared/scan-progress-Ch8s3Uwl.js +0 -2
- package/dist/packem_shared/target-merge-b7bE1AEx.js +0 -11
- package/dist/packem_shared/verify-B0ztxKMa.js +0 -1
- package/dist/packem_shared/vis-update-app-D1gLJB1O.js +0 -1
- package/dist/packem_shared/vis-user-error-DjFv8uxy.js +0 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as r}from"./cli-main.js";import{c as i,f as a}from"../packem_shared/registry-keys-
|
|
1
|
+
import{p as r}from"./cli-main.js";import{c as i,f as a}from"../packem_shared/registry-keys-cTN24144.js";const n=async({options:s})=>{if(s.clear){const t=i();if(s.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
|
|
2
2
|
`);return}r.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await a({forceRefresh:!0});if(e===void 0){if(s.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
|
|
3
3
|
`),process.exitCode=1;return}r.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(s.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
|
|
4
4
|
`);return}if(e.fromCache&&e.stale===!0){r.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}r.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)};export{n as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as a,P as p}from"../packem_shared/index-BLtnel38.js";import{r as l}from"../packem_shared/resolve-runtime-DztanwkZ.js";import{r as f}from"../packem_shared/run-file-CaE5_xBY.js";const m=o=>{let t,n=!1,i;const s=[];for(let e=0;e<o.length;e+=1){const r=o[e];if(i===void 0){if(r==="--node"){n=!0;continue}if(r==="--runtime"){t=o[e+1],e+=1;continue}if(r.startsWith("--runtime=")){t=r.slice(10);continue}i=r;continue}s.push(r)}return s[0]==="--"&&s.shift(),{file:i,node:n,runtimeFlag:t,scriptArguments:s}},x=async o=>{const{file:t,node:n,runtimeFlag:i,scriptArguments:s}=m(o);if(t===void 0){process.stderr.write(`No file specified. Usage: vis x <file> [args...]
|
|
2
2
|
`),process.exitCode=1;return}const e=process.cwd(),r=a(t)?t:p(e,t);if(n){const d=await f(r,s,"node",e,{node:!0});d!==0&&(process.exitCode=d);return}let c;try{c=l(e,{flag:i})}catch(d){process.stderr.write(`${d.message}
|
|
3
3
|
`),process.exitCode=1;return}c.deferredNotice!==void 0&&process.stderr.write(`${c.deferredNotice}
|
|
4
|
-
`);const u=await f(r,s,c.runtime,e);u!==0&&(process.exitCode=u)};export{m as parseLeanXArgs,
|
|
4
|
+
`);const u=await f(r,s,c.runtime,e);u!==0&&(process.exitCode=u)};export{m as parseLeanXArgs,x as runLeanX};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as S}from"node:module";import{j as B,p as o,v as R}from"./cli-main.js";import{A as V}from"../packem_shared/pm-runner-
|
|
1
|
+
import{createRequire as S}from"node:module";import{j as B,p as o,v as R}from"./cli-main.js";import{A as V}from"../packem_shared/pm-runner-DRybtzOV.js";import{W as q}from"../packem_shared/build-scripts-DWypBQ--.js";import{w as y,l as w}from"../packem_shared/index-BLtnel38.js";import{a as W}from"../packem_shared/readJsonSync-DweZd5ZA-CtrDlqpb.js";let j;const D=c=>(j??=S(import.meta.url))(c),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=c=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[r,f]=v.versions.node.split(".").map(Number);if(r>22||r===22&&f>=3||r===20&&f>=16)return v.getBuiltinModule(c)}return D(c)},{readdirSync:k,statSync:M}=x("node:fs"),A=(c,r={})=>{const f=y(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,$=(n,s,t)=>{const e=`${s}@${t}`;if(p.has(e))return;p.add(e);const i=t.startsWith(c)?t.slice(c.length+1):t;let u=l.get(n);u||(u=[],l.set(n,u)),u.some(b=>b.name===s)||u.push({name:s,relativePath:i})},d=(n,s="")=>{let t;try{t=k(n)}catch{return}for(const e of t){const i=y(n,e);if(e.startsWith("@")){d(i,`${e}/`);continue}if(e===".pnpm"&&s===""){let a;try{a=k(i)}catch{continue}for(const m of a){const h=y(i,m,"node_modules");w(h)&&d(h)}continue}if(e.startsWith("."))continue;const u=s+e,b=y(i,"package.json");try{if(!M(i).isDirectory()||!w(b))continue;const a=W(b),m=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const _=m.includes("/")?m.split("/").pop():m;$(_,m,i)}else if(a.bin&&typeof a.bin=="object")for(const _ of Object.keys(a.bin))$(_,m,i);const h=y(i,"node_modules");w(h)&&d(h)}catch{}}};d(f);const g=[];for(const[n,s]of l)s.length<2||r[n]===!0||s.every(t=>r[`${t.name}#${n}`]===!0)||g.push({bin:n,packages:s});return g.sort((n,s)=>n.bin.localeCompare(s.bin))},C=new Set(["bun","npm","pnpm","yarn"]),z=({options:c,visConfig:r,workspaceRoot:f})=>{const l=f??process.cwd(),p=V(l),$=r?.security?.policies?.installScripts?.allow??{},d=r?.security?.allowBins??{},g=r?.security?.pinVersions===!0,n=q(l,$,{pinVersions:g}),s=A(l,d),t=r&&C.has(p.name)?B(r,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:s,drift:t,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:g,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
|
|
2
2
|
`);return}if(o.info(`Build-script status (${p.name}):
|
|
3
3
|
`),n.installed.length===0&&n.unapproved.length===0&&o.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){o.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)o.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){o.info(""),o.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)o.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);o.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){o.info(""),o.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)o.info(` ! ${e}`);o.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){o.info(""),o.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:i}of n.versionDrift)o.info(` ${e} → ${i}`);o.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(s.length>0){o.info(""),o.warn(` Bin conflicts (${String(s.length)}) — multiple packages expose the same bin name:`);for(const e of s)o.info(` ${e.bin} ← ${e.packages.map(i=>i.name).join(", ")}`);o.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(t?.hasDrift){o.info("");for(const e of R(t))o.warn(e)}};export{z as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as m}from"node:module";import{A as d,j as $}from"../packem_shared/pm-runner-
|
|
1
|
+
import{createRequire as m}from"node:module";import{A as d,j as $}from"../packem_shared/pm-runner-DRybtzOV.js";let w;const _=e=>(w??=m(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,s]=o.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return o.getBuiltinModule(e)}return _(e)},{createInterface:y}=g("node:readline"),r="sigstore",h=()=>!!process.stdout.isTTY&&process.env.CI!=="true",v=e=>new Promise(t=>{const s=y({input:process.stdin,output:process.stderr});s.question(`${e} (Y/n) `,i=>{s.close();const n=i.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),I=e=>{const t=d(e),s=$(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[r],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:s})},O=()=>{try{return import.meta.resolve(r),!0}catch{return!1}},D=e=>{let t="pnpm";try{t=d(e).name}catch{}switch(t){case"bun":return`bun add -d ${r}`;case"npm":return`npm install -D ${r}`;case"yarn":return`yarn add -D ${r}`;default:return`pnpm add -D ${r}`}},R=()=>import("sigstore"),T=async(e={})=>{const t=e.interactive??h(),s=e.prompt??v,i=e.runInstall??I,n=e.importImpl??R,l=e.workspaceRoot??process.cwd(),a=D(l);try{return await n()}catch(u){const{code:p,message:f}=u;if(!(p==="ERR_MODULE_NOT_FOUND"||p==="MODULE_NOT_FOUND")||!f.includes(r))throw u}if(!t)throw new Error(`${r} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
|
|
2
2
|
${a}`);if(!await s(`${r} isn't installed. Install it now?`))throw new Error(`${r} install declined. Re-run \`vis attest\` after installing manually:
|
|
3
3
|
${a}`);const c=await i(l);if(c.exitCode!==0)throw new Error(`Install of ${r} failed (exit ${String(c.exitCode)}). Install manually and retry:
|
|
4
4
|
${a}`);return await n()};export{D as installCommandFor,O as isSigstoreInstalled,T as loadOptionalSigstore};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as Ge}from"node:module";import{u as H}from"../packem_shared/index-BAe6e0XE.js";import{DEFAULT_CHANGES_DIR as ae,DEFAULT_DEPENDENCY_BUMP_RULES as qe,DEFAULT_CONFIG as Xe}from"./DEFAULT_CLEAN_KEEP.js";import{VisReleaseError as C}from"../packem_shared/VisReleaseError-DMGRBTNO.js";import{e as Ke,p as Ze,c as Qe}from"./registry.js";import{
|
|
2
|
-
`).trim();return{meta:Object.keys(t).length>0?t:void 0,remainder:s}},Ce=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&("bump"in e||"replay"in e),Pa=(e,a,t)=>{const n=a.replay!==void 0;if(n&&a.bump!==void 0)throw new C({code:"BUMP_FILE_INVALID",file:t,message:`"${e}" sets both \`bump\` and \`replay\`. Replay files are changelog-only and never bump — remove \`bump\`, or drop \`replay\` to make this a normal change file.`,packageName:e});const s=a.bump===void 0&&n?"none":a.bump;if(!fe(s))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Invalid bump level for "${e}": ${JSON.stringify(a.bump)}. Expected one of: ${ye.join(", ")}`,packageName:e});const i={bump:s,package:e};if(n&&(i.replay=pa(a.replay,t)),a.releaseAs!==void 0){if(typeof a.releaseAs!="string"||!/^\d+\.\d+\.\d+(?:[-+].*)?$/.test(a.releaseAs))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Invalid releaseAs for "${e}": ${JSON.stringify(a.releaseAs)}. Expected a semver string like "2.0.0" or "2.0.0-rc.1".`,packageName:e});i.releaseAs=a.releaseAs}if(a.cascade!==void 0){if(typeof a.cascade!="object"||a.cascade===null||Array.isArray(a.cascade))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Cascade block for "${e}" must be an object mapping package globs to bump levels.`,packageName:e});const l={};for(const[c,o]of Object.entries(a.cascade)){if(!fe(o))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Invalid cascade bump level for "${c}": ${JSON.stringify(o)}.`,packageName:e});l[c]=o}i.cascade=l}return i},ce=e=>e.replaceAll(/^.*[/\\]/g,"").replace(/\.md$/i,""),Ca=(e,a)=>{const t=ua(e);if(!t)throw new C({code:"BUMP_FILE_INVALID",file:a,message:"Change file is missing YAML frontmatter (expected `---` delimiters)."});let n;try{n=aa(t.frontmatter,{
|
|
1
|
+
import{createRequire as Ge}from"node:module";import{u as H}from"../packem_shared/index-BAe6e0XE.js";import{DEFAULT_CHANGES_DIR as ae,DEFAULT_DEPENDENCY_BUMP_RULES as qe,DEFAULT_CONFIG as Xe}from"./DEFAULT_CLEAN_KEEP.js";import{VisReleaseError as C}from"../packem_shared/VisReleaseError-DMGRBTNO.js";import{e as Ke,p as Ze,c as Qe}from"./registry.js";import{b as aa}from"../packem_shared/index-tNFGWxc0.js";import{BUMP_LEVELS as ye,maxBump as me,bumpRank as te,normaliseGroup as $e}from"../release/types.js";import{isValidPackageName as ta,escapeMarkdown as na,assertValidPackageName as sa}from"./security.js";import ne from"./index.js";import{d as ra,c as oa}from"./detect.js";import{createShellRunner as Q}from"./shell-runner.js";let Ue;const He=e=>(Ue??=Ge(import.meta.url))(e),X=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,we=e=>{if(typeof X<"u"&&X.versions&&X.versions.node){const[a,t]=X.versions.node.split(".").map(Number);if(a>22||a===22&&t>=3||a===20&&t>=16)return X.getBuiltinModule(e)}return He(e)},{readdir:We,readFile:Je,writeFile:Ye,unlink:ze}=we("node:fs/promises"),{resolve:ge,sep:K,join:ea}=we("node:path"),{realpathSync:ve}=we("node:fs"),ia=/^exit[\s-]prerelease\s*:\s*(.+)$/i,ca=/^(.+)@(\d+\.\d+\.\d+(?:[-+].*)?)$/,ke=(e,a,t)=>{if(!ta(e))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Invalid replay condition "${a}": ${JSON.stringify(e)} is not a valid package name.`,packageName:e||void 0});return e},la=(e,a)=>{if(typeof e!="string"||e.trim()==="")throw new C({code:"BUMP_FILE_INVALID",file:a,message:`Invalid replay condition: ${JSON.stringify(e)}. Expected "name@1.2.0" or "exit-prerelease:name".`});const t=e.trim(),n=ia.exec(t);if(n)return{kind:"exit-prerelease",package:ke((n[1]??"").trim(),t,a)};const s=ca.exec(t);if(s)return{kind:"version",package:ke((s[1]??"").trim(),t,a),version:s[2]??""};throw new C({code:"BUMP_FILE_INVALID",file:a,message:`Invalid replay condition "${t}". Expected "name@1.2.0" or "exit-prerelease:name".`})},pa=(e,a)=>{if(!Array.isArray(e))throw new C({code:"BUMP_FILE_INVALID",file:a,message:'`replay` must be a list of conditions (e.g. ["name@1.2.0", "exit-prerelease:name"]).'});return e.map(t=>la(t,a))},ue=e=>!("bumps"in e.payload)&&Array.isArray(e.payload.replay)&&e.payload.replay.length>0,Pe=e=>/^\d+\.\d+\.\d+-/.test(e),da=(e,a)=>e.package!==a.name?!1:e.kind==="version"?a.newVersion===e.version:Pe(a.oldVersion)&&!Pe(a.newVersion),ga=(e,a)=>{const t=new Map,n=[],s=[];for(const i of e){if(!ue(i))continue;const l=i.payload.replay;let c=!0;for(const o of l){const r=a.find(u=>da(o,u));if(r){const u=t.get(r.name)??[];u.some(g=>g.id===i.id)||u.push(i),t.set(r.name,u)}else c=!1}c?n.push(i):s.push(i)}return{consumed:n,injectionsByPackage:t,retained:s}},ma=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,ua=e=>{const a=ma.exec(e);return a?{body:(a[2]??"").trim(),frontmatter:a[1]??""}:null},fa=/^(?:@[a-z0-9-]+\/)?[\w.-]+$/i,ha=214,wa=e=>e.length===0||e.length>ha||e.startsWith(".")||e.startsWith("_")||e.startsWith("-")?!1:fa.test(e),fe=e=>typeof e=="string"&&ye.includes(e),ya=/^ {0,3}(#{1,3})\s+\S/,ba=/^ {0,3}(?:```|~~~)/,$a=e=>{let a,t=0,n=!1;for(const s of e.split(/\r?\n/)){if(ba.test(s)){n=!n;continue}if(n)continue;const i=ya.exec(s);if(!i)continue;const l=(i[1]??"").length,c=4-l;c>t&&(t=c,a=l===1?"major":l===2?"minor":"patch")}return a},va=/^\s*(pr|commit|author)\s*:\s*(.+?)\s*$/i,ka=e=>{const a=e.split(/\r?\n/),t={};let n=0;for(const i of a){if(i.trim()===""){n+=1;continue}const l=va.exec(i);if(!l)break;const[,c="",o=""]=l;switch(c.toLowerCase()){case"author":{t.author=o.startsWith("@")?o:`@${o}`;break}case"commit":{t.commit=o;break}case"pr":{const r=Number.parseInt(o,10);!Number.isNaN(r)&&r>0&&(t.pr=r);break}}n+=1}const s=a.slice(n).join(`
|
|
2
|
+
`).trim();return{meta:Object.keys(t).length>0?t:void 0,remainder:s}},Ce=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&("bump"in e||"replay"in e),Pa=(e,a,t)=>{const n=a.replay!==void 0;if(n&&a.bump!==void 0)throw new C({code:"BUMP_FILE_INVALID",file:t,message:`"${e}" sets both \`bump\` and \`replay\`. Replay files are changelog-only and never bump — remove \`bump\`, or drop \`replay\` to make this a normal change file.`,packageName:e});const s=a.bump===void 0&&n?"none":a.bump;if(!fe(s))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Invalid bump level for "${e}": ${JSON.stringify(a.bump)}. Expected one of: ${ye.join(", ")}`,packageName:e});const i={bump:s,package:e};if(n&&(i.replay=pa(a.replay,t)),a.releaseAs!==void 0){if(typeof a.releaseAs!="string"||!/^\d+\.\d+\.\d+(?:[-+].*)?$/.test(a.releaseAs))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Invalid releaseAs for "${e}": ${JSON.stringify(a.releaseAs)}. Expected a semver string like "2.0.0" or "2.0.0-rc.1".`,packageName:e});i.releaseAs=a.releaseAs}if(a.cascade!==void 0){if(typeof a.cascade!="object"||a.cascade===null||Array.isArray(a.cascade))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Cascade block for "${e}" must be an object mapping package globs to bump levels.`,packageName:e});const l={};for(const[c,o]of Object.entries(a.cascade)){if(!fe(o))throw new C({code:"BUMP_FILE_INVALID",file:t,message:`Invalid cascade bump level for "${c}": ${JSON.stringify(o)}.`,packageName:e});l[c]=o}i.cascade=l}return i},ce=e=>e.replaceAll(/^.*[/\\]/g,"").replace(/\.md$/i,""),Ca=(e,a)=>{const t=ua(e);if(!t)throw new C({code:"BUMP_FILE_INVALID",file:a,message:"Change file is missing YAML frontmatter (expected `---` delimiters)."});let n;try{n=aa(t.frontmatter,{strict:!0})}catch(o){throw new C({cause:o,code:"BUMP_FILE_INVALID",file:a,message:`YAML parse failed: ${o.message}`})}if(n==null)return{body:t.body.trim(),id:ce(a),path:a,payload:{bumps:{}}};if(typeof n!="object"||Array.isArray(n))throw new C({code:"BUMP_FILE_INVALID",file:a,message:"Frontmatter must be a YAML object mapping package names to bump levels."});const s=Object.entries(n);if(s.length===0)return{body:t.body.trim(),id:ce(a),path:a,payload:{bumps:{}}};for(const[o]of s)if(!wa(o))throw new C({code:"BUMP_FILE_INVALID",file:a,message:`Invalid package name: ${JSON.stringify(o)}.`,packageName:o});let i;if(s.length===1&&Ce(s[0][1])){const[o,r]=s[0];i=Pa(o,r,a)}else{const o={},r=[];for(const[u,g]of s){if(Ce(g))throw new C({code:"BUMP_FILE_INVALID",file:a,message:`Mixed simple + nested entries are not allowed. Package "${u}" uses the nested shape but the file has multiple top-level entries.`,packageName:u});if(g==null||g===""){r.push(u);continue}if(!fe(g))throw new C({code:"BUMP_FILE_INVALID",file:a,message:`Invalid bump level for "${u}": ${JSON.stringify(g)}. Expected one of: ${ye.join(", ")}`,packageName:u});o[u]=g}if(r.length>0){const u=$a(t.body);if(!u)throw new C({code:"BUMP_FILE_INVALID",file:a,message:`No bump level for ${r.map(g=>`"${g}"`).join(", ")}: the entry is empty and the body has no markdown heading to infer one from. Add an explicit level (e.g. \`${r[0]}: minor\`) or a heading (\`# major\`, \`## minor\`, \`### patch\`).`,packageName:r[0]});for(const g of r)o[g]=u}i={bumps:o}}const{meta:l,remainder:c}=ka(t.body);return{body:c,id:ce(a),meta:l,path:a,payload:i}},mt=(e,a)=>{let t;if("bumps"in e){const n=Object.entries(e.bumps).map(([s,i])=>`${le(s)}: ${i}`);t=n.length>0?n.join(`
|
|
3
3
|
`):"{}"}else{const n=[`${le(e.package)}:`,` bump: ${e.bump}`];if(e.releaseAs&&n.push(` releaseAs: ${e.releaseAs}`),e.cascade){n.push(" cascade:");for(const[s,i]of Object.entries(e.cascade))n.push(` ${le(s)}: ${i}`)}if(e.replay&&e.replay.length>0){n.push(" replay:");for(const s of e.replay){const i=s.kind==="version"?`${s.package}@${s.version}`:`exit-prerelease:${s.package}`;n.push(` - "${i}"`)}}t=n.join(`
|
|
4
4
|
`)}return`---
|
|
5
5
|
${t}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as l}from"node:module";import{E as n}from"../packem_shared/index.server-
|
|
1
|
+
import{createRequire as l}from"node:module";import{E as n}from"../packem_shared/index.server-CusjRLCh.js";let u;const p=o=>(u??=l(import.meta.url))(o),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=o=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[e,s]=i.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return i.getBuiltinModule(o)}return p(o)},{createInterface:c}=m("node:readline"),a=(o,e)=>new Promise(s=>{o.question(e,r=>{s(r.trim())})}),w=async(o,e=!0)=>{const s=c({input:process.stdin,output:process.stdout});try{const r=await a(s,`${o} ${n(e?"[Y/n]":"[y/N]")} `);return r===""?e:/^y(?:es)?$/i.test(r)}finally{s.close()}},y=async(o,e="")=>{const s=c({input:process.stdin,output:process.stdout});try{const r=e?` ${n(`(${e})`)}`:"",t=await a(s,`${o}${r} `);return t===""?e:t}finally{s.close()}},$=async(o,e)=>{if(e.length===0)throw new Error("selectPrompt called with no options.");const s=c({input:process.stdin,output:process.stdout});try{process.stdout.write(`${o}
|
|
2
2
|
`);for(const[r,t]of e.entries())process.stdout.write(` ${r+1}) ${t.label}
|
|
3
3
|
`);for(;;){const r=await a(s,n(` [1-${e.length}] `)),t=Number.parseInt(r,10);if(!Number.isNaN(t)&&t>=1&&t<=e.length)return e[t-1].value;process.stdout.write(n(` Please enter a number between 1 and ${e.length}.
|
|
4
4
|
`))}}finally{s.close()}},h=async(o,e)=>{if(e.length===0)throw new Error("multiSelectPrompt called with no options.");const s=c({input:process.stdin,output:process.stdout});try{process.stdout.write(`${o}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{p as o}from"./cli-main.js";import{r as d}from"../packem_shared/advisories-
|
|
1
|
+
import{p as o}from"./cli-main.js";import{r as d}from"../packem_shared/advisories-DsXRmIA5.js";const f=async({fs:c,logger:u,options:e,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const r=e.db??d(s),t=e.format==="json";if(!e.force){o.warn(`Prune is destructive. Will remove: ${r}`),o.info("Re-run with --force to proceed."),t&&process.stdout.write(`${JSON.stringify({dbPath:r,reason:"needs --force",removed:!1})}
|
|
2
2
|
`);return}const a=[r,`${r}-wal`,`${r}-shm`,`${r}-journal`],i=[];for(const n of a)try{await c.rm(n,{force:!0}),i.push(n)}catch{}if(t){process.stdout.write(`${JSON.stringify({dbPath:r,files:i,removed:!0})}
|
|
3
3
|
`);return}o.success(`Removed ${r}.`)},w=f;export{w as advisoriesPruneExecute};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createRequire as Ne}from"node:module";import{VisReleaseError as l}from"../packem_shared/VisReleaseError-DMGRBTNO.js";import{VersionActions as N}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{
|
|
1
|
+
import{createRequire as Ne}from"node:module";import{VisReleaseError as l}from"../packem_shared/VisReleaseError-DMGRBTNO.js";import{VersionActions as N}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{b as Me}from"../packem_shared/index-tNFGWxc0.js";import{resolveCleanStripList as De}from"./DEFAULT_CLEAN_KEEP.js";import{assertValidPackageName as F,resolveCustomCommands as W,interpolateCommand as J}from"./security.js";let _e;const je=t=>(_e??=Ne(import.meta.url))(t),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,V=t=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[e,n]=x.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return x.getBuiltinModule(t)}return je(t)},{readFile:A,writeFile:O,rm:xe,readdir:Ve}=V("node:fs/promises"),{dirname:U,join:h}=V("node:path"),{fileURLToPath:Oe}=V("node:url"),{mkdtempSync:G,writeFileSync:Re}=V("node:fs"),{tmpdir:B}=V("node:os"),Ee=["dependencies","devDependencies","peerDependencies","optionalDependencies"],fe=(t,e)=>{if(t.startsWith("catalog:")||t==="*"||t==="workspace:*"||t==="workspace:^"||t==="workspace:~")return t;if(t.startsWith("workspace:")){const n=t.slice(10);return`workspace:${L(n)}${e}`}if(t.startsWith("npm:")){const n=t.lastIndexOf("@");if(n<=4)return t;const r=t.slice(4,n),s=t.slice(n+1),a=L(s);return`npm:${r}@${a}${e}`}return`${L(t)}${e}`},Fe=/^([\^~=]|>=?|<=?)/,L=t=>{const e=Fe.exec(t);return e?e[1]??"^":"^"},Ut=async(t,e,n={})=>{const r=n.serializeManifest??Be,s=n.changelogPath??Je,a=n.renderChangelogEntry??He,i=new Map(t.releases.map(p=>[p.name,p.newVersion])),o=await Promise.all(t.releases.map(async p=>{const m=e.getPackage(p.name);if(!m)return;const y=Le(m.manifest,p.newVersion,i),b=n.readManifest?.(m.manifestPath),w=s(m);return{changelogEntry:await a(p),changelogPath:w,manifestWrite:{content:r(y,b),path:m.manifestPath}}})),c=[],d=new Map;for(const p of o){if(!p)continue;c.push(p.manifestWrite);const m=d.get(p.changelogPath);m?m.push(p.changelogEntry):d.set(p.changelogPath,[p.changelogEntry])}for(const[p,m]of d){const y=m.join(`
|
|
2
2
|
|
|
3
|
-
`),b=n.readChangelog?.(p);c.push({content:Ge(y,b),path:p})}return{deletions:t.consumedChangeFiles.map(p=>p.path),writes:c}},Le=(t,e,n)=>{const r={...t,version:e};for(const s of
|
|
3
|
+
`),b=n.readChangelog?.(p);c.push({content:Ge(y,b),path:p})}return{deletions:t.consumedChangeFiles.map(p=>p.path),writes:c}},Le=(t,e,n)=>{const r={...t,version:e};for(const s of Ee){const a=t[s];if(!a||typeof a!="object")continue;const i={...a};let o=!1;for(const[c,d]of Object.entries(a)){const p=n.get(c);if(p===void 0)continue;const m=fe(d,p);m!==d&&(i[c]=m,o=!0)}o&&(r[s]=i)}return r},Te=/^# .+/,Ue=/^## /m,Ge=(t,e)=>{const n=t.trim();if(!e||e.trim()==="")return`# Changelog
|
|
4
4
|
|
|
5
5
|
${n}
|
|
6
6
|
`;const r=e.split(/\r?\n/);if(r[0]&&Te.test(r[0])){let s=1;for(;s<r.length&&!(r[s]??"").startsWith("## ");)s+=1;const a=r.slice(0,s),i=r.slice(s);return a.length>0&&a[a.length-1]!==""&&a.push(""),[...a,n,"",...i].join(`
|
|
@@ -12,7 +12,7 @@ ${e.trimStart()}`:`${n}
|
|
|
12
12
|
|
|
13
13
|
${e.trimStart()}`},Be=(t,e)=>{const n=We(e);return`${JSON.stringify(t,null,n)}
|
|
14
14
|
`},We=t=>{if(!t)return 4;const e=/\n(\s+)"/.exec(t);if(!e)return 4;const n=(e[1]??"").length;return n===2||n===4?n:4},Je=t=>`${t.dir}/CHANGELOG.md`,He=t=>{const e=new Date().toISOString().slice(0,10),n=[`## ${t.newVersion}`,`<sub>${e}</sub>`,""];if(t.isCascadeBump||t.isGroupBump)for(const r of t.sources)n.push(`- Version bump from ${r.name}@${r.newVersion}`);else if(t.isDependencyBump&&t.changeFiles.length===0)for(const r of t.sources)r.newVersion===""?n.push(`- Removed dependency ${r.name}`):n.push(`- Updated dependency ${r.name}@${r.newVersion}`);else for(const r of t.changeFiles)for(const s of r.body.split(/\r?\n/)){if(s.trim()===""){n.push("");continue}n.push(s.startsWith("-")||s.startsWith("*")?s:`- ${s}`)}return n.join(`
|
|
15
|
-
`)},Ke=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Q={default:{},named:{}},qe=t=>{if(!t)return Q;let e;try{e=Me(t,{
|
|
15
|
+
`)},Ke=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Q={default:{},named:{}},qe=t=>{if(!t)return Q;let e;try{e=Me(t,{strict:!0})}catch(s){throw new l({cause:s,code:"CONFIG_INVALID",message:`Failed to parse pnpm-workspace.yaml: ${s.message}`})}if(typeof e!="object"||e===null||Array.isArray(e))return Q;const n=e,r={default:{},named:{}};if(typeof n.catalog=="object"&&n.catalog!==null&&!Array.isArray(n.catalog))for(const[s,a]of Object.entries(n.catalog))typeof a=="string"&&(r.default[s]=a);if(typeof n.catalogs=="object"&&n.catalogs!==null&&!Array.isArray(n.catalogs))for(const[s,a]of Object.entries(n.catalogs)){if(typeof a!="object"||a===null||Array.isArray(a))continue;const i={};for(const[o,c]of Object.entries(a))typeof c=="string"&&(i[o]=c);r.named[s]=i}return r},we=(t,e,n)=>{if(!t.startsWith("catalog:"))return t;const r=t.slice(8),s=r===""?n.default:n.named[r];if(s)return s[e]},Y=(t,e)=>{const n={...t};for(const r of Ke){const s=t[r];if(!s||typeof s!="object")continue;const a={...s};for(const[i,o]of Object.entries(s)){if(!o.startsWith("catalog:"))continue;const c=we(o,i,e);if(c===void 0)throw new l({code:"CONFIG_INVALID",message:`Cannot resolve "${o}" for dependency "${i}" in package "${t.name}". Add it to pnpm-workspace.yaml's "catalog" or "catalogs" block.`,packageName:t.name});a[i]=c}n[r]=a}return n},Gt=Object.defineProperty({__proto__:null,parseCatalogs:qe,resolveCatalogRef:we,rewriteCatalogRefs:Y},Symbol.toStringTag,{value:"Module"}),Ye="ACTIONS_ID_TOKEN_REQUEST_URL",z=t=>{const e=!!t.env[Ye],n=!!t.env[t.staticTokenVar],r=t.workspaceConfig?.publish?.preferStaticToken===!0;return e&&!(r&&n)?"oidc":n?"token":"missing"};let T;const ze="https://github.com/visulima/visulima",Qe=async()=>{try{let t=U(Oe(import.meta.url));for(let e=0;e<6;e+=1){const n=h(t,"package.json");try{const s=await A(n,"utf8"),a=JSON.parse(s);if(a.name==="@visulima/vis"&&typeof a.version=="string")return a.version}catch{}const r=U(t);if(r===t)break;t=r}}catch{}return"unknown"},Xe=async()=>(T!==void 0||(T=`vis-release/${await Qe()} (+${ze})`),T),X=new Map,Ze=async t=>{const e=X.get(t);if(e!==void 0)return e;try{const n=await import("./index4.js").then(s=>s.i),r=new n.ProxyAgent(t);return X.set(t,r),r}catch{return}},et=t=>t===301||t===302||t===303||t===307||t===308,tt=(t,e)=>{try{const n=new URL(t),r=new URL(e);return n.host===r.host&&n.protocol===r.protocol}catch{return!1}},j=async(t,e={})=>{const n=e.maxRedirects??2,r={"User-Agent":await Xe(),...e.headers};e.headers?.["User-Agent"]&&(r["User-Agent"]=e.headers["User-Agent"]);let s=t,a=0;const i=e.httpProxy?await Ze(e.httpProxy):void 0;for(;;){let o;try{const p=e.fetchImpl??globalThis.fetch,m={headers:r,method:e.method??"GET",redirect:"manual"};i&&(m.dispatcher=i),o=await p(s,m)}catch{return{json:async()=>{},ok:!1,status:0,text:async()=>""}}if(!et(o.status))return{json:async()=>{try{return await o.json()}catch{return}},ok:o.ok,status:o.status,text:async()=>{try{return await o.text()}catch{return""}}};const c=o.headers.get("location")??o.headers.get("Location");if(!c||a>=n)return{json:async()=>{},ok:!1,status:0,text:async()=>""};let d;try{d=new URL(c,s).toString()}catch{return{json:async()=>{},ok:!1,status:0,text:async()=>""}}if(!tt(t,d))return{json:async()=>{},ok:!1,status:0,text:async()=>""};s=d,a+=1}},nt="https://crates.io/api/v1/crates",rt="Cargo.toml",Z=async t=>{let e;try{e=await A(t,"utf8")}catch(o){throw new l({cause:o,code:"CONFIG_INVALID",file:t,message:`Failed to read Cargo.toml at ${t}: ${o.message}`})}const{parse:n}=await import("./index5.js");let r;try{r=n(e)}catch(o){throw new l({cause:o,code:"CONFIG_INVALID",file:t,message:`Failed to parse Cargo.toml at ${t}: ${o.message}`})}if(!r.package)throw new l({code:"CONFIG_INVALID",file:t,hint:"CargoVersionActions only supports publishable crates with a [package] table. For workspace roots, point per-package config at the member crate directory.",message:`Cargo.toml at ${t} has no [package] table.`});const{name:s}=r.package;if(typeof s!="string"||s.length===0)throw new l({code:"CONFIG_INVALID",file:t,message:`Cargo.toml at ${t} is missing [package].name.`});const a=r.package.version;let i;if(typeof a=="string"?i=a:a&&typeof a=="object"&&a.workspace===!0&&(i=r.workspace?.package?.version),typeof i!="string"||i.length===0)throw new l({code:"CONFIG_INVALID",file:t,hint:"Set [package].version explicitly, or — for workspace-inherited versions — ensure the root Cargo.toml carries [workspace.package].version and point per-package config at it.",message:`Cargo.toml at ${t} has no resolvable [package].version.`});return{name:s,version:i}},ee=async(t,e)=>{const n=`${nt}/${encodeURIComponent(t)}`;try{const r=await j(n,{headers:{Accept:"application/json"},httpProxy:e});if(r.status===404||!r.ok)return;const s=await r.json();return s?.crate?.max_stable_version??s?.crate?.max_version??void 0}catch{return}},st=(t,e)=>z({env:t,staticTokenVar:"CARGO_REGISTRY_TOKEN",workspaceConfig:e})==="oidc",at=async(t,e)=>{const n=await t.run("cargo",["package","--list","--allow-dirty"],{cwd:e,silent:!0});return n.exitCode!==0?[]:n.stdout.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0)};class ot extends N{id="cargo";async readPublishedVersion(e){const n=H(e.pkg);try{const{name:r}=await Z(n);return await ee(r)}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run / cargo] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const n=H(e.pkg,e.perPackageConfig),r=it(e.pkg,e.perPackageConfig),{name:s,version:a}=await Z(n);if(a!==e.release.newVersion)throw new l({code:"CONFIG_INVALID",file:n,hint:`Confirm the cargo() preset's crateDir points at the directory containing this Cargo.toml. Expected ${e.release.newVersion} on disk after the extra-files bump.`,message:`Cargo.toml version (${a}) does not match planned release version (${e.release.newVersion}) for ${e.pkg.name}.`,packageName:e.pkg.name});if(await ee(s,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[cargo] ${s}@${e.release.newVersion} already on crates.io`,published:!1};const i=st(process.env,e.workspaceConfig);if(!i&&!process.env.CARGO_REGISTRY_TOKEN)throw new l({code:"AUTH_MISSING",hint:"Set CARGO_REGISTRY_TOKEN, or run from a GH-Actions job with `permissions: id-token: write` for OIDC trusted publishing.",message:`Cannot publish ${s}@${e.release.newVersion}: neither CARGO_REGISTRY_TOKEN nor OIDC trusted publishing is available.`,packageName:e.pkg.name});const o=e.workspaceConfig?.publish?.guards;if(o?.packSecretScan){const p=await at(e.pm.runner,r);if(p.length>0){const{runPackSecretScan:m}=await import("./publish-guards.js"),y=typeof o.packSecretScan=="object"?o.packSecretScan.ignore:void 0,b=await m({files:p,ignore:y,pkgDir:r});if(!b.passed){const{redactTokens:w}=await import("./security.js"),C=b.findings.map(_=>` • [packSecretScan] ${w(_.message)}${_.hint?`
|
|
16
16
|
→ ${w(_.hint)}`:""}`).join(`
|
|
17
17
|
`);throw new l({code:"PUBLISH_FAILED",message:`Pre-publish secret scan failed for ${s}@${e.release.newVersion}:
|
|
18
18
|
${C}`,packageName:e.pkg.name})}}}const c=["publish","--allow-dirty"];e.registry&&e.registry!=="https://crates.io"&&c.push("--registry",e.registry);const d=await e.pm.runner.run("cargo",c,{cwd:r,silent:!1});if(d.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:"Inspect the cargo output above. Common causes: missing CARGO_REGISTRY_TOKEN, OIDC permission misconfigured, version already published, crates.io rate limit. Re-runs are safe — the published-version probe short-circuits subsequent runs.",message:`cargo publish failed for ${s}@${e.release.newVersion}: exit ${d.exitCode}. stderr: ${d.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[cargo] published ${s}@${e.release.newVersion}${i?" (trusted publishing)":""}`,published:!0}}}const H=(t,e)=>{const n=e?.cargoTomlPath??rt;return h(t.dir,n)},it=(t,e)=>U(H(t,e)),ct=["linux/amd64","linux/arm64"],pt=t=>{const e=t.indexOf("/");if(e===-1)return{registry:"docker.io",repository:`library/${t}`};const n=t.slice(0,e),r=t.slice(e+1);return n==="localhost"||n.includes(".")||n.includes(":")?{registry:n,repository:r}:r.includes("/")?{registry:"docker.io",repository:t}:{registry:"docker.io",repository:`${n}/${r}`}},te=(t,e)=>{const{registry:n,repository:r}=pt(t);return`https://${n==="docker.io"?"registry-1.docker.io":n}/v2/${r}/manifests/${encodeURIComponent(e)}`},ke=t=>{const e=t??{};return{buildContext:e.buildContext,containerBuildArgs:e.containerBuildArgs,containerImage:e.containerImage,containerPlatforms:e.containerPlatforms,containerSigning:e.containerSigning,containerSkipLatest:e.containerSkipLatest}},lt=(t,e)=>{const n=ke(t);if(typeof n.containerImage!="string"||n.containerImage.length===0)throw new l({code:"CONFIG_INVALID",hint:["Container packages must declare `containerImage` in their per-pkg release config:","",' release.packages["<pkg>"] = container({',' image: "ghcr.io/scope/foo",',' platforms: ["linux/amd64", "linux/arm64"],',' signing: "cosign", // optional'," })","",'Or set `versionActions: "container"` + `containerImage` directly.'].join(`
|
|
@@ -22,22 +22,22 @@ ${C}`,packageName:e.pkg.name})}}}const c=["publish","--allow-dirty"];e.registry&
|
|
|
22
22
|
`))}async readPublishedVersion(e){const n=e.perPackageConfig??{},r=h(e.pkg.dir,n.pomPath??"pom.xml");let s;try{s=await A(r,"utf8")}catch{return}const a=pe(s);if(this.warnIfMultiModule(e.pkg,a),!a.groupId||!a.artifactId||n.mavenMetadataUrl==="")return;const i=n.mavenMetadataUrl??yt(a.groupId,a.artifactId);try{const o=await j(i,{headers:{Accept:"text/xml,application/xml;q=0.9,*/*;q=0.8"},httpProxy:e.workspaceConfig?.httpProxy});if(o.status===404||!o.ok)return;const c=await o.text();return bt(c)}catch{return}}async publish(e){const n=e.perPackageConfig??{},r=h(e.pkg.dir,n.pomPath??"pom.xml");let s;try{const o=await A(r,"utf8");s=pe(o)}catch{s=void 0}const a=s?.groupId&&s?.artifactId?`${s.groupId}:${s.artifactId}`:e.pkg.name;if(e.dryRun)return{output:`[dry-run / maven] would publish ${e.pkg.name}@${e.release.newVersion} (${a}) (native publish not yet implemented — would use shell path)`,published:!0};const i=`Failing artifact: ${a}
|
|
23
23
|
Pom: ${r}
|
|
24
24
|
|
|
25
|
-
${$t}`;throw new l({code:"CONFIG_INVALID",hint:i,message:`Native Maven publishing is not implemented for ${e.pkg.name}@${e.release.newVersion} (${a}). Use \`versionActions: "shell"\` with \`mvn deploy\` until the Sonatype Central Portal client lands.`,packageName:e.pkg.name})}}const be=(t,e)=>{if(e===!1)return{...t};const n=new Set(
|
|
25
|
+
${$t}`;throw new l({code:"CONFIG_INVALID",hint:i,message:`Native Maven publishing is not implemented for ${e.pkg.name}@${e.release.newVersion} (${a}). Use \`versionActions: "shell"\` with \`mvn deploy\` until the Sonatype Central Portal client lands.`,packageName:e.pkg.name})}}const be=(t,e)=>{if(e===!1)return{...t};const n=new Set(De(e)),r={name:t.name,version:t.version};for(const[s,a]of Object.entries(t))n.has(s)||(r[s]=a);return r},ye="https://registry.npmjs.org/",It="npm:registry.npmjs.org",le=async t=>{const e=h(t,"npm");try{return(await Ve(e,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name)}catch{return[]}},Ct=async t=>{const e=t.ACTIONS_ID_TOKEN_REQUEST_URL,n=t.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!e||!n)return;const r=`${e}${e.includes("?")?"&":"?"}audience=${encodeURIComponent(It)}`,s=await fetch(r,{headers:{Authorization:`Bearer ${n}`}});if(!s.ok)return;const a=await s.json().catch(()=>({}));return typeof a.value=="string"?a.value:void 0},Pt=async(t,e)=>{const n=await fetch(`${ye}-/npm/v1/oidc/token/exchange/package/${encodeURIComponent(t)}`,{headers:{Authorization:`Bearer ${e}`},method:"POST"});if(!n.ok)return;const r=await n.json().catch(()=>({}));return typeof r.token=="string"?r.token:void 0},ue=async(t,e,n)=>{if(e){const s=await Pt(t,e);if(s)return{source:"oidc",token:s}}const r=n.NPM_TOKEN;if(r)return{source:"NPM_TOKEN",token:r};throw new l({code:"AUTH_MISSING",message:`Cannot publish ${t}: OIDC exchange did not succeed and NPM_TOKEN is not set.`,packageName:t})},de=(t,e)=>{Re(t,`//registry.npmjs.org/:_authToken=${e}
|
|
26
26
|
registry=${ye}
|
|
27
27
|
`)};class St extends N{id="native-addon";async readPublishedVersion(e){try{F(e.pkg.name);const{execFileSync:n}=await import("node:child_process");return n("npm",["view",e.pkg.name,"version"],{stdio:["ignore","pipe","ignore"]}).toString().trim()||void 0}catch{return}}async publish(e){if(e.dryRun){const c=await le(e.pkg.dir);return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion} + ${c.length} platform package(s)`,published:!0}}const n=await le(e.pkg.dir);if(n.length===0){const{NpmVersionActions:c}=await Promise.resolve().then(()=>jt);return new c().publish(e)}const{env:r}=process,s=await Ct(r),a=e.release.newVersion,i=new Map,o=[];try{await Promise.all(n.map(async g=>{const u=h(e.pkg.dir,"npm",g,"package.json"),f=await A(u,"utf8");i.set(u,f);const $=JSON.parse(f);$.version=a,await O(u,`${JSON.stringify($,null,4)}
|
|
28
|
-
`)}));const{execFileSync:c}=await import("node:child_process"),d=await Promise.all(n.map(async g=>{const u=h(e.pkg.dir,"npm",g),f=h(u,"package.json"),$=await A(f,"utf8"),k=JSON.parse($);F(k.name);const P=await ue(k.name,s,r),v=G(h(B(),"vis-release-napi-"));o.push(v);const S=h(v,".npmrc");return de(S,P.token),{manifest:k,npmrcPath:S,platform:g,platformDir:u}})),p=e.workspaceConfig?.publish?.guards;if(p&&Object.values(p).some(g=>g!==void 0&&g!==!1&&g!=="off")){const{runPublishGuards:g}=await import("./publish-guards.js");for(const{manifest:u,platformDir:f}of d){const $=c("npm",["pack","--dry-run","--json"],{cwd:f,stdio:["ignore","pipe","ignore"]}).toString();let k=[];try{k=JSON.parse($)[0]?.files?.map(v=>v.path)??[]}catch{}const P=await g({config:p,manifest:u,packFiles:k,pkgDir:f,runner:e.pm.runner,sourceManifest:u});if(P.blockers.length>0){const v=P.blockers.flatMap(S=>S.findings.map(
|
|
29
|
-
→ ${
|
|
28
|
+
`)}));const{execFileSync:c}=await import("node:child_process"),d=await Promise.all(n.map(async g=>{const u=h(e.pkg.dir,"npm",g),f=h(u,"package.json"),$=await A(f,"utf8"),k=JSON.parse($);F(k.name);const P=await ue(k.name,s,r),v=G(h(B(),"vis-release-napi-"));o.push(v);const S=h(v,".npmrc");return de(S,P.token),{manifest:k,npmrcPath:S,platform:g,platformDir:u}})),p=e.workspaceConfig?.publish?.guards;if(p&&Object.values(p).some(g=>g!==void 0&&g!==!1&&g!=="off")){const{runPublishGuards:g}=await import("./publish-guards.js");for(const{manifest:u,platformDir:f}of d){const $=c("npm",["pack","--dry-run","--json"],{cwd:f,stdio:["ignore","pipe","ignore"]}).toString();let k=[];try{k=JSON.parse($)[0]?.files?.map(v=>v.path)??[]}catch{}const P=await g({config:p,manifest:u,packFiles:k,pkgDir:f,runner:e.pm.runner,sourceManifest:u});if(P.blockers.length>0){const v=P.blockers.flatMap(S=>S.findings.map(E=>` • [${S.gate}] ${E.message}${E.hint?`
|
|
29
|
+
→ ${E.hint}`:""}`)).join(`
|
|
30
30
|
`);throw new l({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${u.name}@${a} (platform package):
|
|
31
|
-
${v}`,packageName:u.name})}}}const m=e.tag??"latest",y=(g,u)=>{const f=["publish",g,"--tag",m,"--access","public","--userconfig",u];return e.provenance&&f.push("--provenance"),f};for(const{manifest:g,npmrcPath:u,platformDir:f}of d)try{c("npm",y(f,u),{env:{...r,NPM_CONFIG_USERCONFIG:u},stdio:"inherit"})}catch($){const k=$.message;if(!k.includes("EPUBLISHCONFLICT")&&!k.includes("cannot publish over"))throw new l({cause:$,code:"PUBLISH_FAILED",message:`Failed to publish platform package ${g.name}@${a}: ${k}`,packageName:g.name})}const b=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,w={...b},C={...b.optionalDependencies};for(const{manifest:g}of d)Object.hasOwn(C,g.name)&&(C[g.name]=a);w.optionalDependencies=C;const _=Y(w,e.catalogs),I=be(_,e.cleanPackageJsonConfig),
|
|
32
|
-
`),F(e.pkg.name);const g=await ue(e.pkg.name,s,r),u=G(h(B(),"vis-release-napi-parent-"));o.push(u);const f=h(u,".npmrc");de(f,g.token);const $=c("npm",["pack","--pack-destination",u,"--json"],{cwd:e.pkg.dir,env:r,stdio:["ignore","pipe","ignore"]}).toString();let k;try{const v=JSON.parse($);v[0]?.filename&&(k=h(u,v[0].filename))}catch{}const P=["publish",k??e.pkg.dir,"--tag",m,"--access","public","--userconfig",f];if(e.provenance&&P.push("--provenance"),c("npm",P,{env:{...r,NPM_CONFIG_USERCONFIG:f},stdio:"inherit"}),k){const{hashTarball:v}=await import("./publish-guards.js");return{published:!0,tarball:await v(k)}}return{published:!0}}finally{await O(e.pkg.manifestPath,
|
|
31
|
+
${v}`,packageName:u.name})}}}const m=e.tag??"latest",y=(g,u)=>{const f=["publish",g,"--tag",m,"--access","public","--userconfig",u];return e.provenance&&f.push("--provenance"),f};for(const{manifest:g,npmrcPath:u,platformDir:f}of d)try{c("npm",y(f,u),{env:{...r,NPM_CONFIG_USERCONFIG:u},stdio:"inherit"})}catch($){const k=$.message;if(!k.includes("EPUBLISHCONFLICT")&&!k.includes("cannot publish over"))throw new l({cause:$,code:"PUBLISH_FAILED",message:`Failed to publish platform package ${g.name}@${a}: ${k}`,packageName:g.name})}const b=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,w={...b},C={...b.optionalDependencies};for(const{manifest:g}of d)Object.hasOwn(C,g.name)&&(C[g.name]=a);w.optionalDependencies=C;const _=Y(w,e.catalogs),I=be(_,e.cleanPackageJsonConfig),D=await A(e.pkg.manifestPath,"utf8");try{await O(e.pkg.manifestPath,`${JSON.stringify(I,null,4)}
|
|
32
|
+
`),F(e.pkg.name);const g=await ue(e.pkg.name,s,r),u=G(h(B(),"vis-release-napi-parent-"));o.push(u);const f=h(u,".npmrc");de(f,g.token);const $=c("npm",["pack","--pack-destination",u,"--json"],{cwd:e.pkg.dir,env:r,stdio:["ignore","pipe","ignore"]}).toString();let k;try{const v=JSON.parse($);v[0]?.filename&&(k=h(u,v[0].filename))}catch{}const P=["publish",k??e.pkg.dir,"--tag",m,"--access","public","--userconfig",f];if(e.provenance&&P.push("--provenance"),c("npm",P,{env:{...r,NPM_CONFIG_USERCONFIG:f},stdio:"inherit"}),k){const{hashTarball:v}=await import("./publish-guards.js");return{published:!0,tarball:await v(k)}}return{published:!0}}finally{await O(e.pkg.manifestPath,D)}}finally{for(const[c,d]of i)try{await O(c,d)}catch{}for(const c of o)try{await xe(c,{force:!0,recursive:!0})}catch{}}}}const At=async(t,e)=>{const{extractPackFilesFromRaw:n}=await import("./publish-guards.js"),r=n(e.raw);if(r!==void 0)return r;const s=await t.pm.runner.run("npm",["pack","--dry-run","--json"],{cwd:t.pkg.dir,silent:!0});if(s.exitCode!==0)return[];try{return n(JSON.parse(s.stdout))??[]}catch{return[]}},me=1800*1e3,ge=15*1e3,he=t=>{if(t===!0)return{enabled:!0,pollIntervalMs:ge,timeoutMs:me};if(t&&typeof t=="object"){const e=t;return{enabled:!0,pollIntervalMs:e.pollIntervalMs??ge,timeoutMs:e.timeoutMs??me}}return{enabled:!1,pollIntervalMs:0,timeoutMs:0}};class $e extends N{id="npm";async readPublishedVersion(e){try{const n=await e.pm.runner.run("npm",["view",e.pkg.name,"version","--silent"],{cwd:e.pkg.dir,silent:!0});return n.exitCode!==0?void 0:n.stdout.trim()||void 0}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(e.resumeStageId){const d=he(e.workspaceConfig?.publish?.stage);if(!d.enabled)throw new l({code:"CONFIG_INVALID",message:`Cannot resume stage ${e.resumeStageId} for ${e.pkg.name}@${e.release.newVersion}: publish.stage is now disabled. Resolve the stage manually via \`vis release stage approve|reject ${e.resumeStageId}\`.`,packageName:e.pkg.name});return this.resumeStagedPublish(e,d)}const n=e.perPackageConfig&&e.workspaceConfig?W(e.pkg.name,e.perPackageConfig,e.workspaceConfig):{};if(n.buildCommand){const d=J(n.buildCommand,{name:e.pkg.name,version:e.release.newVersion}),p=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",d]:["-c",d],{cwd:e.pkg.dir,silent:!1});if(p.exitCode!==0)throw new Error(`buildCommand failed for ${e.pkg.name}: exit ${p.exitCode}`)}const r=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,s=_t(r,e.versionedManifestByName),a=Y(s,e.catalogs),i=be(a,e.cleanPackageJsonConfig),o=await import("node:fs/promises"),c=await o.readFile(e.pkg.manifestPath,"utf8");try{if(await o.writeFile(e.pkg.manifestPath,`${JSON.stringify(i,null,4)}
|
|
33
33
|
`),n.publishCommand){const p={name:e.pkg.name,version:e.release.newVersion},m=Array.isArray(n.publishCommand)?n.publishCommand:[n.publishCommand];for(const y of m){const b=J(y,p),w=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",b]:["-c",b],{cwd:e.pkg.dir,silent:!1});if(w.exitCode!==0)throw new Error(`publishCommand failed for ${e.pkg.name}: exit ${w.exitCode}`)}return{output:`[custom] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}const d=G(h(B(),"vis-release-pack-"));try{const p=await e.pm.pack({cwd:e.pkg.dir,destination:d}),m=e.workspaceConfig?.publish?.guards;if(m&&Object.values(m).some(u=>u!==void 0&&u!==!1&&u!=="off")){const{runPublishGuards:u}=await import("./publish-guards.js"),f=await At(e,p),$=await u({config:m,manifest:i,packFiles:f,pkgDir:e.pkg.dir,runner:e.pm.runner,sourceManifest:e.pkg.manifest});if($.blockers.length>0){const{redactTokens:k}=await import("./security.js"),P=$.blockers.flatMap(v=>v.findings.map(S=>` • [${v.gate}] ${k(S.message)}${S.hint?`
|
|
34
34
|
→ ${k(S.hint)}`:""}`)).join(`
|
|
35
35
|
`);throw new l({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${e.pkg.name}@${e.release.newVersion}:
|
|
36
36
|
${P}`,packageName:e.pkg.name})}}const{hashTarball:y}=await import("./publish-guards.js"),b=await y(p.tarball);if((e.workspaceConfig?.publish?.publishStrategy??"npm-publish-tarball")==="native"){const u=e.pm.id;return e.provenance&&u==="bun"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": bun has no --provenance/OIDC support; ${e.pkg.name}@${e.release.newVersion} publishes without provenance.
|
|
37
37
|
`),e.otp&&u==="yarn"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": \`yarn npm publish\` ignores --otp; configure 2FA via .yarnrc.yml for ${e.pkg.name}.
|
|
38
|
-
`),{...await e.pm.publishNative({access:"public",cwd:e.pkg.dir,otp:e.otp,provenance:e.provenance,registry:e.registry,tag:e.tag}),tarball:b}}const w=he(e.workspaceConfig?.publish?.stage);if(w.enabled){const{refuseRestrictedOidc:u}=await import("./stage-publisher.js"),f=e.pkg.manifest.publishConfig?.access;u(f)}const C=await e.pm.publish({access:"public",otp:e.otp,provenance:e.provenance,registry:e.registry,stage:w.enabled,tag:e.tag,tarball:p.tarball});if(!w.enabled||!C.stageId)return{...C,tarball:b};const{waitForStageDecision:_}=await import("./stage-publisher.js"),{stageId:I}=C,
|
|
38
|
+
`),{...await e.pm.publishNative({access:"public",cwd:e.pkg.dir,otp:e.otp,provenance:e.provenance,registry:e.registry,tag:e.tag}),tarball:b}}const w=he(e.workspaceConfig?.publish?.stage);if(w.enabled){const{refuseRestrictedOidc:u}=await import("./stage-publisher.js"),f=e.pkg.manifest.publishConfig?.access;u(f)}const C=await e.pm.publish({access:"public",otp:e.otp,provenance:e.provenance,registry:e.registry,stage:w.enabled,tag:e.tag,tarball:p.tarball});if(!w.enabled||!C.stageId)return{...C,tarball:b};const{waitForStageDecision:_}=await import("./stage-publisher.js"),{stageId:I}=C,D=Date.now();process.stderr.write(`[vis release] ⏳ ${e.pkg.name}@${e.release.newVersion} staged (id ${I}). Waiting up to ${Math.round(w.timeoutMs/6e4)}m for a maintainer to approve via npmjs.com or \`npm stage approve ${I}\`...
|
|
39
39
|
`);const g=await _({cwd:e.pkg.dir,onProgress:u=>{u>0&&u%3e5<w.pollIntervalMs&&process.stderr.write(`[vis release] still waiting for ${e.pkg.name} stage decision (${Math.round(u/6e4)}m elapsed)...
|
|
40
|
-
`)},packageName:e.pkg.name,pollIntervalMs:w.pollIntervalMs,runner:e.pm.runner,stageId:I,timeoutMs:w.timeoutMs,version:e.release.newVersion});return g==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted (${Math.round((Date.now()-
|
|
40
|
+
`)},packageName:e.pkg.name,pollIntervalMs:w.pollIntervalMs,runner:e.pm.runner,stageId:I,timeoutMs:w.timeoutMs,version:e.release.newVersion});return g==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted (${Math.round((Date.now()-D)/1e3)}s).
|
|
41
41
|
`),{...C,stageId:void 0,tarball:b}):g==="rejected"?(process.stdout.write(`::warning::Stage rejected for ${e.pkg.name}@${e.release.newVersion} (id ${I}). Re-stage by re-running the release once the review feedback is addressed.
|
|
42
42
|
`),{alreadyPublished:!1,output:`stage-rejected: ${I}`,published:!1,stageId:I}):(process.stdout.write(`::warning::Stage timeout for ${e.pkg.name}@${e.release.newVersion} (id ${I}) after ${Math.round(w.timeoutMs/6e4)}m. Re-run \`vis release publish\` once a maintainer can approve, or run \`vis release stage approve ${I}\` manually.
|
|
43
43
|
`),{alreadyPublished:!1,output:`stage-timeout: ${I}`,published:!1,stageId:I})}finally{await o.rm(d,{force:!0,recursive:!0})}}finally{await o.writeFile(e.pkg.manifestPath,c)}}async resumeStagedPublish(e,n){const r=e.resumeStageId,s=Date.now();process.stderr.write(`[vis release] ↻ Resuming wait on staged ${e.pkg.name}@${e.release.newVersion} (id ${r}) — tarball already uploaded; not re-publishing.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as d,E as i,I as y}from"../packem_shared/index.server-
|
|
1
|
+
import{s as d,E as i,I as y}from"../packem_shared/index.server-CusjRLCh.js";import{p as a}from"./cli-main.js";import{r as l,g as h}from"../packem_shared/advisories-DsXRmIA5.js";const p=r=>{if(r===0)return"0 B";const n=["B","KB","MB","GB"],t=Math.min(Math.floor(Math.log(r)/Math.log(1024)),n.length-1),o=r/1024**t;return`${o.toFixed(o<10&&t>0?1:0)} ${n[t]}`},v=r=>{if(!r)return"never";const n=Date.parse(r);if(Number.isNaN(n))return r;const t=Date.now()-n;if(t<0)return r;const o=Math.floor(t/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const s=Math.floor(o/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`},g=async({logger:r,options:n,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const o=n.db??l(t),s=await h(t,o);if(n.format==="json"){process.stdout.write(`${JSON.stringify({dbPath:o,ecosystems:s.ecosystems.map(e=>({advisoryCount:e.advisoryCount,lastSyncIso:e.lastSyncIso,manifestEtag:e.manifestEtag??null,name:e.name})),exists:s.exists,schemaVersion:s.schemaVersion,sizeBytes:s.sizeBytes},void 0,2)}
|
|
2
2
|
`);return}if(a.info(`DB: ${o}`),!s.exists){a.warn(`No advisory DB yet. Run ${d("vis advisories sync")} to populate.`);return}if(a.info(`Schema: v${s.schemaVersion} Size: ${p(s.sizeBytes)}`),s.ecosystems.length===0){a.warn("DB exists but contains no ecosystems. Run `vis advisories sync`.");return}a.info(""),a.info("Ecosystem Advisories Last sync ETag"),a.info(i("────────── ────────── ───────────────── ──────"));for(const e of s.ecosystems){const c=e.name.padEnd(10),f=e.advisoryCount.toLocaleString().padStart(10),m=`${e.lastSyncIso||"never"} (${v(e.lastSyncIso)})`.padEnd(19),u=e.manifestEtag??i("—");a.info(`${y(c)} ${f} ${m} ${u}`)}},S=g;export{S as advisoriesStatusExecute};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{E as g}from"../packem_shared/index.server-
|
|
1
|
+
import{E as g}from"../packem_shared/index.server-CusjRLCh.js";import{p as c}from"./cli-main.js";import{s as $}from"../packem_shared/scan-progress-DWfY4zkp.js";import{s as w,D as v}from"../packem_shared/advisories-DsXRmIA5.js";const S=t=>t?.security?.audit?.advisories??{},D=t=>t?t.split(",").map(r=>r.trim()).filter(r=>r.length>0):["npm"],b=async({logger:t,options:r,visConfig:h,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const l=r.format==="json",u=S(h),m=r.source??u.source??v,p=D(r.ecosystem),y=p.map(s=>({id:s,label:`Sync ${s} advisories`})),n=$(y,{live:!l}),i=[];try{for(const s of p){n.start(s);const o=Date.now();try{const e=await w({allowedHosts:u.allowedHosts,dbPath:r.db,ecosystem:s,force:!!r.force,source:m,workspaceRoot:d});i.push({ecosystem:s,result:e}),e.upToDate?n.finish(s,"ok",`up to date · ${f(Date.now()-o)}`):n.finish(s,"ok",`${e.advisoriesIngested.toLocaleString()} advisories · ${f(e.durationMs)}`)}catch(e){const a=e instanceof Error?e.message:String(e);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}if(l){const s={ecosystems:i.map(o=>({advisoriesIngested:o.result?.advisoriesIngested??0,dbPath:o.result?.dbPath??null,durationMs:o.result?.durationMs??0,ecosystem:o.ecosystem,error:o.error??null,upToDate:o.result?.upToDate??!1})),source:m};process.stdout.write(`${JSON.stringify(s,void 0,2)}
|
|
2
2
|
`)}else{const s=i.filter(a=>a.error),o=i.filter(a=>a.result),e=o[0];e?.result?.dbPath&&c.info(g(`DB: ${e.result.dbPath}`)),s.length===0?c.success(`Synced ${o.length} ecosystem${o.length===1?"":"s"}.`):c.error(`${s.length} ecosystem${s.length===1?"":"s"} failed to sync.`)}i.some(s=>s.error)&&(process.exitCode=1)},f=t=>t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`,R=b;export{R as advisoriesSyncExecute};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e}from"./cli-main.js";import{A as u}from"../packem_shared/pm-runner-
|
|
1
|
+
import{p as e}from"./cli-main.js";import{A as u}from"../packem_shared/pm-runner-DRybtzOV.js";import{O as g}from"../packem_shared/native-config-sync-CHMCJx7H.js";import{S as l}from"../packem_shared/min-release-age-6avfn81h.js";const y=new Set(["bun","npm","pnpm","yarn"]),k=({options:r,visConfig:c,workspaceRoot:f})=>{const s=f??process.cwd(),n=u(s);if(!y.has(n.name)){e.warn(`Package manager '${n.name}' has no native security config to sync.`);return}if(!c?.security){e.warn("vis.config has no `security` block — nothing to sync.");return}const t=c.security.policies??{},a=Object.fromEntries(Object.entries(t.installScripts?.allow??{}).filter(([,o])=>o)),m=t.firstSeen?.minutes,p=t.firstSeen?.exclude??[],i=[];if(Object.keys(a).length>0&&!r.skipAllowBuilds&&i.push(...g(n.name,s,a)),r.skipMinReleaseAge||i.push(...l(n.name,s,m,p)),i.length===0){e.success("Nothing to sync — vis.config and native PM config are aligned.");return}e.info(`Syncing vis.config security settings to ${n.name} native config…
|
|
2
2
|
`);for(const o of i)e.success(` ${o}`)};export{k as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as m}from"node:module";import{
|
|
1
|
+
import{createRequire as m}from"node:module";import{w as d,l as p,j as h}from"../packem_shared/index-BLtnel38.js";import{p as e}from"./cli-main.js";import{A as _}from"../packem_shared/pm-runner-DRybtzOV.js";import{a as u}from"../packem_shared/readJsonSync-DweZd5ZA-CtrDlqpb.js";let g;const w=i=>(g??=m(import.meta.url))(i),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=i=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[t,s]=c.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return c.getBuiltinModule(i)}return w(i)},{spawnSync:v}=y("node:child_process"),n="@lavamoat/preinstall-always-fail",l=i=>{const t=d(i,"package.json");if(!p(t))return"no-package-json";try{const s=u(t);if(s.devDependencies?.[n]||s.dependencies?.[n])return"installed"}catch{}return"missing"},$=i=>{const t=d(i,"package.json");if(!p(t))return!1;try{const s=u(t);let o=!1;const a=r=>!r||!(n in r)?r:(o=!0,Object.fromEntries(Object.entries(r).filter(([f])=>f!==n)));return s.devDependencies=a(s.devDependencies),s.dependencies=a(s.dependencies),o&&h(t,`${JSON.stringify(s,null,2)}
|
|
2
2
|
`),o}catch{return!1}},D=({options:i,workspaceRoot:t})=>{const s=t??process.cwd();if(i.status){switch(l(s)){case"installed":{e.success(`Preinstall tripwire is installed (${n}).`),e.info("Removing 'ignore-scripts=true' will cause future installs to fail loudly.");break}case"missing":{e.warn("Preinstall tripwire is not installed."),e.info(`Run 'vis security tripwire' to add ${n} as a devDependency.`);break}default:e.error("No package.json found at the workspace root."),process.exitCode=1}return}if(i.remove){$(s)?e.success(`Removed ${n} from package.json. Run your PM's install to clean node_modules.`):e.info(`${n} was not present in package.json.`);return}if(l(s)==="installed"){e.info(`${n} is already installed.`);return}const o=_(s),a={bun:["add","-d",n],npm:["install","--save-dev",n],pnpm:["add","-D","-w",n],yarn:["add","-D",n]}[o.name];if(!a){e.error(`Cannot install tripwire — unsupported package manager '${o.name}'.`),process.exitCode=1;return}e.info(`Installing ${n} via ${o.name}…`);const r=v(o.name,a,{cwd:s,stdio:"inherit"});if(r.error){e.error(`Failed to install tripwire: ${r.error.message}`),process.exitCode=1;return}if(r.signal!==null){e.error(`${o.name} was terminated by signal ${r.signal}`),process.exitCode=1;return}if(r.status!==0){e.error(`${o.name} exited with code ${String(r.status)}`),process.exitCode=r.status??1;return}e.success(`Installed ${n} as a devDependency.`),e.notice(""),e.notice("How the tripwire works:"),e.notice(` ${n} declares a preinstall script that always fails.`),e.notice(" When 'ignore-scripts=true' is set (.npmrc / bunfig.toml / .yarnrc.yml),"),e.notice(" the script is skipped and installs succeed normally. If someone deletes"),e.notice(" that setting, the next install fails — loudly — instead of silently"),e.notice(" running every dependency's lifecycle scripts.")};export{D as default};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
`;break;case 114:
|
|
3
|
-
`),l++,p=t,i=14;switch(
|
|
1
|
+
import{createRequire as Qe}from"node:module";import{z as R,i as tt,E as ot,s as rt,L as st,f as it,P as S,J as I,b as z,k as te,w,n as Le,v as be,W as oe,y as nt,_ as ct,l as $,a as lt}from"../packem_shared/index-BLtnel38.js";import{parse as at}from"./index5.js";import"../packem_shared/index-tNFGWxc0.js";import{transformTs as _e}from"#native";let Ye;const Xe=e=>(Ye??=Qe(import.meta.url))(e),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ge=e=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[o,s]=F.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return F.getBuiltinModule(e)}return Xe(e)},{readFileSync:Oe,statSync:Ne,writeFileSync:Ze,unlinkSync:et}=ge("node:fs"),de=ge("node:module"),{createRequire:D}=de,{fileURLToPath:Y,pathToFileURL:ee}=ge("node:url");function pt(e,o,s){const{beforeParse:t,buffer:r,compression:n,encoding:i="utf8",flag:l}={},a=R(e,{buffer:r,compression:n,encoding:i,flag:l}),p=typeof t=="function"?t(a):a;return tt.parse(p,o)}let ut;const dt=e=>(ut??=D(import.meta.url))(e),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=e=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[o,s]=U.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return U.getBuiltinModule(e)}return dt(e)};ft("node:fs/promises");let mt;const ht=e=>(mt??=D(import.meta.url))(e),P=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gt=e=>{if(typeof P<"u"&&P.versions&&P.versions.node){const[o,s]=P.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return P.getBuiltinModule(e)}return ht(e)};gt("node:fs");function Ot(e,o=!1){const s=e.length;let t=0,r="",n=0,i=16,l=0,a=0,p=0,f=0,d=0;function k(c,g){let b=0,m=0;for(;b<c;){let u=e.charCodeAt(t);if(u>=48&&u<=57)m=m*16+u-48;else if(u>=65&&u<=70)m=m*16+u-65+10;else if(u>=97&&u<=102)m=m*16+u-97+10;else break;t++,b++}return b<c&&(m=-1),m}function O(c){t=c,r="",n=0,i=16,d=0}function v(){let c=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&L(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&L(e.charCodeAt(t)))for(t++;t<e.length&&L(e.charCodeAt(t));)t++;else return d=3,e.substring(c,t);let g=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&L(e.charCodeAt(t))){for(t++;t<e.length&&L(e.charCodeAt(t));)t++;g=t}else d=3;return e.substring(c,g)}function T(){let c="",g=t;for(;;){if(t>=s){c+=e.substring(g,t),d=2;break}const b=e.charCodeAt(t);if(b===34){c+=e.substring(g,t),t++;break}if(b===92){if(c+=e.substring(g,t),t++,t>=s){d=2;break}switch(e.charCodeAt(t++)){case 34:c+='"';break;case 92:c+="\\";break;case 47:c+="/";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
|
|
2
|
+
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:const m=k(4);m>=0?c+=String.fromCharCode(m):d=4;break;default:d=5}g=t;continue}if(b>=0&&b<=31)if(W(b)){c+=e.substring(g,t),d=2;break}else d=6;t++}return c}function A(){if(r="",d=0,n=t,a=l,f=p,t>=s)return n=s,i=17;let c=e.charCodeAt(t);if(ne(c)){do t++,r+=String.fromCharCode(c),c=e.charCodeAt(t);while(ne(c));return i=15}if(W(c))return t++,r+=String.fromCharCode(c),c===13&&e.charCodeAt(t)===10&&(t++,r+=`
|
|
3
|
+
`),l++,p=t,i=14;switch(c){case 123:return t++,i=1;case 125:return t++,i=2;case 91:return t++,i=3;case 93:return t++,i=4;case 58:return t++,i=6;case 44:return t++,i=5;case 34:return t++,r=T(),i=10;case 47:const g=t-1;if(e.charCodeAt(t+1)===47){for(t+=2;t<s&&!W(e.charCodeAt(t));)t++;return r=e.substring(g,t),i=12}if(e.charCodeAt(t+1)===42){t+=2;const b=s-1;let m=!1;for(;t<b;){const u=e.charCodeAt(t);if(u===42&&e.charCodeAt(t+1)===47){t+=2,m=!0;break}t++,W(u)&&(u===13&&e.charCodeAt(t)===10&&t++,l++,p=t)}return m||(t++,d=1),r=e.substring(g,t),i=13}return r+=String.fromCharCode(c),t++,i=16;case 45:if(r+=String.fromCharCode(c),t++,t===s||!L(e.charCodeAt(t)))return i=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return r+=v(),i=11;default:for(;t<s&&N(c);)t++,c=e.charCodeAt(t);if(n!==t){switch(r=e.substring(n,t),r){case"true":return i=8;case"false":return i=9;case"null":return i=7}return i=16}return r+=String.fromCharCode(c),t++,i=16}}function N(c){if(ne(c)||W(c))return!1;switch(c){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function h(){let c;do c=A();while(c>=12&&c<=15);return c}return{setPosition:O,getPosition:()=>t,scan:o?h:A,getToken:()=>i,getTokenValue:()=>r,getTokenOffset:()=>n,getTokenLength:()=>t-n,getTokenStartLine:()=>a,getTokenStartCharacter:()=>n-f,getTokenError:()=>d}}function ne(e){return e===32||e===9}function W(e){return e===10||e===13}function L(e){return e>=48&&e<=57}var ve;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(ve||(ve={}));new Array(20).fill(0).map((e,o)=>" ".repeat(o));const _=200;new Array(_).fill(0).map((e,o)=>`
|
|
4
4
|
`+" ".repeat(o)),new Array(_).fill(0).map((e,o)=>"\r"+" ".repeat(o)),new Array(_).fill(0).map((e,o)=>`\r
|
|
5
5
|
`+" ".repeat(o)),new Array(_).fill(0).map((e,o)=>`
|
|
6
6
|
`+" ".repeat(o)),new Array(_).fill(0).map((e,o)=>"\r"+" ".repeat(o)),new Array(_).fill(0).map((e,o)=>`\r
|
|
7
|
-
`+" ".repeat(o));var re;(function(e){e.DEFAULT={allowTrailingComma:!1}})(re||(re={}));function ft(e,o=[],s=re.DEFAULT){let t=null,r=[];const c=[];function i(l){Array.isArray(r)?r.push(l):t!==null&&(r[t]=l)}return mt(e,{onObjectBegin:()=>{const l={};i(l),c.push(r),r=l,t=null},onObjectProperty:l=>{t=l},onObjectEnd:()=>{r=c.pop()},onArrayBegin:()=>{const l=[];i(l),c.push(r),r=l,t=null},onArrayEnd:()=>{r=c.pop()},onLiteralValue:i,onError:(l,a,p)=>{o.push({error:l,offset:a,length:p})}},s),r[0]}function mt(e,o,s=re.DEFAULT){const t=dt(e,!1),r=[];let c=0;function i(y){return y?()=>c===0&&y(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}function l(y){return y?C=>c===0&&y(C,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}function a(y){return y?C=>c===0&&y(C,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>r.slice()):()=>!0}function p(y){return y?()=>{c>0?c++:y(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>r.slice())===!1&&(c=1)}:()=>!0}function f(y){return y?()=>{c>0&&c--,c===0&&y(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter())}:()=>!0}const d=p(o.onObjectBegin),v=a(o.onObjectProperty),O=f(o.onObjectEnd),k=p(o.onArrayBegin),T=f(o.onArrayEnd),A=a(o.onLiteralValue),I=l(o.onSeparator),h=i(o.onComment),n=l(o.onError),g=s&&s.disallowComments,b=s&&s.allowTrailingComma;function m(){for(;;){const y=t.scan();switch(t.getTokenError()){case 4:u(14);break;case 5:u(15);break;case 3:u(13);break;case 1:g||u(11);break;case 2:u(12);break;case 6:u(16);break}switch(y){case 12:case 13:g?u(10):h();break;case 16:u(1);break;case 15:case 14:break;default:return y}}}function u(y,C=[],ye=[]){if(n(y),C.length+ye.length>0){let Q=t.getToken();for(;Q!==17;){if(C.indexOf(Q)!==-1){m();break}else if(ye.indexOf(Q)!==-1)break;Q=m()}}}function E(y){const C=t.getTokenValue();return y?A(C):(v(C),r.push(C)),m(),!0}function R(){switch(t.getToken()){case 11:const y=t.getTokenValue();let C=Number(y);isNaN(C)&&(u(2),C=0),A(C);break;case 7:A(null);break;case 8:A(!0);break;case 9:A(!1);break;default:return!1}return m(),!0}function z(){return t.getToken()!==10?(u(3,[],[2,5]),!1):(E(!1),t.getToken()===6?(I(":"),m(),ie()||u(4,[],[2,5])):u(5,[],[2,5]),r.pop(),!0)}function Ve(){d(),m();let y=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(y||u(4,[],[]),I(","),m(),t.getToken()===2&&b)break}else y&&u(6,[],[]);z()||u(4,[],[2,5]),y=!0}return O(),t.getToken()!==2?u(7,[2],[]):m(),!0}function Je(){k(),m();let y=!0,C=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(C||u(4,[],[]),I(","),m(),t.getToken()===4&&b)break}else C&&u(6,[],[]);y?(r.push(0),y=!1):r[r.length-1]++,ie()||u(4,[],[4,5]),C=!0}return T(),y||r.pop(),t.getToken()!==4?u(8,[4],[]):m(),!0}function ie(){switch(t.getToken()){case 3:return Je();case 1:return Ve();case 10:return E(!0);default:return R()}}return m(),t.getToken()===17?s.allowEmptyContent?!0:(u(4,[],[]),!1):ie()?(t.getToken()!==17&&u(9,[],[]),!0):(u(4,[],[]),!1)}var ve;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(ve||(ve={}));var Ce;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Ce||(Ce={}));const se=ft;var we;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(we||(we={}));function ht(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}const gt=(e,o,s,t)=>{if(e.length===0)return;const r=e[0],c=Ye(o,r.offset),i=new Xe(`${ht(r.error)} at offset ${r.offset}`);throw i.fileName=s,i.codeFrame=Ze(o,{start:c},{tabWidth:!1,...t}),i},Ot=(e,o)=>{const{allowEmptyContent:s,allowTrailingComma:t=!0,beforeParse:r,buffer:c,color:i,compression:l,disallowComments:a,encoding:p="utf8",flag:f}=o??{},d=F(e,{buffer:c,compression:l,encoding:p,flag:f}),v=typeof r=="function"?r(d):d,O=[],k=se(v,O,{allowEmptyContent:s,allowTrailingComma:t,disallowComments:a});return gt(O,v,et(e),{color:i}),k};let bt;const yt=e=>(bt??=D(import.meta.url))(e),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[o,s]=M.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return M.getBuiltinModule(e)}return yt(e)};kt("node:fs/promises");let vt;const Ct=e=>(vt??=D(import.meta.url))(e),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wt=e=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[o,s]=V.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return V.getBuiltinModule(e)}return Ct(e)};wt("node:fs");const Tt=(e,o)=>{const s=F(e,{encoding:"utf8",...o});return st(s)};var J={},Te;function xt(){if(Te)return J;Te=1,Object.defineProperty(J,"__esModule",{value:!0});const e=h=>h!==null&&typeof h=="object",o=(h,n)=>Object.assign(new Error(`[${h}]: ${n}`),{code:h}),s="ERR_INVALID_PACKAGE_CONFIG",t="ERR_INVALID_PACKAGE_TARGET",r="ERR_PACKAGE_PATH_NOT_EXPORTED",c="ERR_PACKAGE_IMPORT_NOT_DEFINED",i=/^\d+$/,l=/^(\.{1,2}|node_modules)$/i,a=/\/|\\/;var p=(h=>(h.Export="exports",h.Import="imports",h))(p||{});const f=(h,n,g,b,m)=>{if(n==null)return[];if(typeof n=="string"){const[u,...E]=n.split(a);if(u===".."||E.some(R=>l.test(R)))throw o(t,`Invalid "${h}" target "${n}" defined in the package config`);return[m?n.replace(/\*/g,m):n]}if(Array.isArray(n))return n.flatMap(u=>f(h,u,g,b,m));if(e(n)){for(const u of Object.keys(n)){if(i.test(u))throw o(s,"Cannot contain numeric property keys");if(u==="default"||b.includes(u))return f(h,n[u],g,b,m)}return[]}throw o(t,`Invalid "${h}" target "${n}"`)},d="*",v=(h,n)=>{const g=h.indexOf(d),b=n.indexOf(d);return g===b?n.length>h.length:b>g};function O(h,n){if(!n.includes(d)&&h.hasOwnProperty(n))return[n];let g,b;for(const m of Object.keys(h))if(m.includes(d)){const[u,E,R]=m.split(d);if(R===void 0&&n.startsWith(u)&&n.endsWith(E)){const z=n.slice(u.length,-E.length||void 0);z&&(!g||v(g,m))&&(g=m,b=z)}}return[g,b]}const k=h=>Object.keys(h).reduce((n,g)=>{const b=g===""||g[0]!==".";if(n===void 0||n===b)return b;throw o(s,'"exports" cannot contain some keys starting with "." and some not')},void 0),T=/^\w+:/,A=(h,n,g)=>{if(!h)throw new Error('"exports" is required');n=n===""?".":`./${n}`,(typeof h=="string"||Array.isArray(h)||e(h)&&k(h))&&(h={".":h});const[b,m]=O(h,n),u=f(p.Export,h[b],n,g,m);if(u.length===0)throw o(r,n==="."?'No "exports" main defined':`Package subpath '${n}' is not defined by "exports"`);for(const E of u)if(!E.startsWith("./")&&!T.test(E))throw o(t,`Invalid "exports" target "${E}" defined in the package config`);return u},I=(h,n,g)=>{if(!h)throw new Error('"imports" is required');const[b,m]=O(h,n),u=f(p.Import,h[b],n,g,m);if(u.length===0)throw o(c,`Package import specifier "${n}" is not defined in package`);return u};return J.resolveExports=A,J.resolveImports=I,J}var Et=xt();let $t;const St=e=>($t??=D(import.meta.url))(e),q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=e=>{if(typeof q<"u"&&q.versions&&q.versions.node){const[o,s]=q.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return q.getBuiltinModule(e)}return St(e)},{statSync:X}=_e("node:fs"),At=_e("node:module"),Le=(e=process.cwd())=>{const{findPnpApi:o}=At;return o?o(e):void 0},It=e=>se(F(e,{buffer:!1})),ce=(e,o,s,t)=>{const r=`resolveFromPackageJsonPath:${e}:${o}:${s?"yes":"no"}`;if(t?.has(r))return t.get(r);const c=It(e);if(!c)return;let i=o||"tsconfig.json";if(!s&&c.exports)try{const[l]=Et.resolveExports(c.exports,o,["require","types"]);i=l}catch{return!1}else!o&&c.tsconfig&&(i=c.tsconfig);return i=w(e,"..",i),t?.set(r,i),i},le="package.json",ae="tsconfig.json",Nt=(e,o,s)=>{let t=e;if(e===".."&&(t=w(t,ae)),e.startsWith(".")&&(t=S(o,t)),be(t)){if($(t)){if(X(t).isFile())return t}else if(!t.endsWith(".json")){const O=`${t}.json`;if($(O))return O}return}const[r="",...c]=e.split("/"),i=r.startsWith("@")?`${r}/${String(c.shift())}`:r,l=c.join("/"),a=Le(o);if(a){const{resolveRequest:O}=a;try{if(i===e){const k=O(w(i,le),o);if(k){const T=ce(k,l,!1,s);if(T&&$(T))return T}}else{let k;try{k=O(e,o,{extensions:[".json"]})}catch{k=O(w(e,ae),o)}if(k)return k}}catch{}}const p=oe(O=>{const k=w(S(O),"node_modules",i);if($(k))return w("node_modules",i)},{cwd:o,type:"directory"});if(!p||!X(p).isDirectory())return;const f=w(p,le);if($(f)){const O=ce(f,l,!1,s);if(O===!1)return;if(O&&$(O)&&X(O).isFile())return O}const d=w(p,l),v=d.endsWith(".json");if(!v){const O=`${d}.json`;if($(O))return O}if($(d)){if(X(d).isDirectory()){const O=w(d,le);if($(O)){const T=ce(O,"",!0,s);if(T&&$(T))return T}const k=w(d,ae);if($(k))return k}else if(v)return d}},jt=e=>{const o=S(e);let s;const t=Le(o);if(t)try{s=t.resolveRequest("typescript/package.json",o)??void 0}catch{}if(s??=oe(r=>w(r,"node_modules","typescript","package.json"),{cwd:o,type:"file"}),!!s)try{const r=se(F(s,{buffer:!1}));if(typeof r?.version=="string")return r.version}catch{}},_t=new Set(["node16","node18","node20","nodenext"]),De=e=>e!==void 0&&_t.has(e),Lt=(e,o)=>{!o.has("target")&&!De(e.module)&&(e.target="es3")},Dt=(e,o)=>{!o.has("target")&&!De(e.module)&&(e.target="es5")},Ft=(e,o)=>{o.has("strict")||(e.strict=!0),o.has("target")||(e.target="es2025"),o.has("module")||(e.module="es2022"),o.has("moduleResolution")||(e.moduleResolution="bundler"),o.has("rootDir")||(e.rootDir="."),o.has("types")||(e.types=[]),o.has("noUncheckedSideEffectImports")||(e.noUncheckedSideEffectImports=!0),o.has("libReplacement")||(e.libReplacement=!1),o.has("alwaysStrict")||(e.alwaysStrict=!0)},Rt=(e,o)=>{o.has("module")||(e.module="esnext"),o.has("moduleResolution")||(e.moduleResolution="bundler"),o.has("stableTypeOrdering")||(e.stableTypeOrdering=!0)},Bt=[[4,Lt],[5,Dt],[6,Ft],[7,Rt]],Ut=/^v?(\d+)/,Pt=e=>{const o=Ut.exec(e);return o?Number(o[1]):void 0},Wt=(e,o)=>{const s=Pt(o);if(s===void 0)return;const t=new Set(Object.keys(e));for(const[r,c]of Bt)r<=s&&c(e,t)},Mt=e=>se(F(e,{buffer:!1})),Vt=e=>e.replaceAll("\\","/"),G=e=>{const o=tt(e);return ot(o)?o:`./${o}`},me=["files","include","exclude"],xe=(e,o,s)=>{const t=w(o,s),r=H(e,t);return te(r)||"./"},Jt=(e,o,s)=>{const t=H(e,o);if(!t)return s;const r=s.startsWith("./")?s.slice(2):s;return`${t}/${r}`},qt=(e,o,s,t,r)=>{if(s.has(e))throw new Error(`Circularity detected while resolving configuration: ${e}`);s.add(e);const c=N(e),i=Fe(e,t,s,r);delete i.references;const{compilerOptions:l}=i;if(l){const{baseUrl:a}=l;a&&!a.startsWith(x)&&(l.baseUrl=xe(o,c,a));const{outDir:p}=l;p&&!p.startsWith(x)&&(l.outDir=xe(o,c,p))}for(const a of me){const p=i[a];p&&(i[a]=p.map(f=>f.startsWith(x)||be(f)?f:Jt(o,c,f)))}return i},Fe=(e,o,s=new Set,t=new Map)=>{let r;try{r=Mt(e)??{}}catch(i){throw new Error(`Cannot resolve tsconfig at path: ${e}`,{cause:i})}if(typeof r!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);const c=N(e);if(r.compilerOptions){const{compilerOptions:i}=r;i.paths&&!i.baseUrl&&(i[Re]=c)}if(r.extends){const i=Array.isArray(r.extends)?r.extends:[r.extends];delete r.extends;const l=i.toReversed();for(let a=0;a<l.length;a++){const p=l[a],f=Nt(p,c,t);if(!f)throw new Ne(`No such file or directory, for '${p}' found.`);const d=qt(f,c,new Set(s),o,t);d.compilerOptions?.rootDir!==void 0&&!d.compilerOptions.rootDir.startsWith(x)&&(d.compilerOptions.rootDir=w(N(f),d.compilerOptions.rootDir));const v={...d,...r,compilerOptions:{...d.compilerOptions,...r.compilerOptions}};d.watchOptions&&(v.watchOptions={...d.watchOptions,...r.watchOptions}),r=v}}if(r.compilerOptions){const{compilerOptions:i}=r;for(const l of["baseUrl","rootDir"]){const a=i[l];if(a&&!a.startsWith(x)){const p=S(c,a);i[l]=G(H(c,p))}}for(const l of["outDir","declarationDir"]){let a=i[l];a&&(Array.isArray(r.exclude)||(r.exclude=["outDir","declarationDir"].map(p=>{const f=i[p];if(f)return f.startsWith(x)||be(f)?f:w(c,f)}).filter(Boolean)),a.startsWith(x)||(a=G(a)),i[l]=a)}}else r.compilerOptions={};if(r.include&&(r.include=r.include.map(i=>Vt(i))),r.files&&(r.files=r.files.map(i=>i.startsWith(x)?i:G(i))),r.watchOptions){const{watchOptions:i}=r;i.excludeDirectories&&(i.excludeDirectories=i.excludeDirectories.map(l=>te(S(c,l)))),i.excludeFiles&&(i.excludeFiles=i.excludeFiles.map(l=>te(S(c,l)))),i.watchFile&&(i.watchFile=i.watchFile.toLowerCase()),i.watchDirectory&&(i.watchDirectory=i.watchDirectory.toLowerCase()),i.fallbackPolling&&(i.fallbackPolling=i.fallbackPolling.toLowerCase())}if(r.compilerOptions.lib&&(r.compilerOptions.lib=r.compilerOptions.lib.map(i=>i.toLowerCase())),r.compilerOptions.module){let i=r.compilerOptions.module.toLowerCase();i==="es2015"&&(i="es6"),r.compilerOptions.module=i}if(r.compilerOptions.target){let i=r.compilerOptions.target.toLowerCase();i==="es2015"&&(i="es6"),r.compilerOptions.target=i}if(r.compilerOptions.moduleResolution){let i=r.compilerOptions.moduleResolution.toLowerCase();i==="node"&&(i="node10"),r.compilerOptions.moduleResolution=i}return r.compilerOptions.jsx&&(r.compilerOptions.jsx=r.compilerOptions.jsx.toLowerCase()),r.compilerOptions.moduleDetection&&(r.compilerOptions.moduleDetection=r.compilerOptions.moduleDetection.toLowerCase()),r.compilerOptions.importsNotUsedAsValues&&(r.compilerOptions.importsNotUsedAsValues=r.compilerOptions.importsNotUsedAsValues.toLowerCase()),r.compilerOptions.newLine&&(r.compilerOptions.newLine=r.compilerOptions.newLine.toLowerCase()),r},Z=(e,o)=>{if(e.startsWith(x))return te(w(o,e.slice(x.length)))},Kt=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],pe=e=>e==="es2022"||e==="es2023"||e==="es2024"||e==="es2025"||e==="esnext",Gt=(e,o)=>{if(e.compilerOptions===void 0)return e;if(e.compilerOptions.rewriteRelativeImportExtensions&&(e.compilerOptions.allowImportingTsExtensions??=!0),e.compilerOptions.composite&&(e.compilerOptions.declaration??=!0,e.compilerOptions.incremental??=!0),e.compilerOptions.checkJs&&(e.compilerOptions.allowJs??=!0),e.compilerOptions.verbatimModuleSyntax&&(e.compilerOptions.isolatedModules??=!0,e.compilerOptions.preserveConstEnums??=!0),["5.4","5.5","5.6","5.7","5.8","5.9"].includes(String(o?.tscCompatible))){if(e.compilerOptions.esModuleInterop===void 0&&(e.compilerOptions.module==="node16"||e.compilerOptions.module==="node18"||e.compilerOptions.module==="node20"||e.compilerOptions.module==="nodenext"||e.compilerOptions.module==="preserve")&&(e.compilerOptions.esModuleInterop=!0),e.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0){let s="classic";if(e.compilerOptions.module!==void 0)switch(e.compilerOptions.module.toLocaleLowerCase()){case"commonjs":{s="node10";break}case"node16":case"node18":{s="node16";break}case"node20":{s="node16";break}case"nodenext":{s="nodenext";break}case"preserve":{s="bundler";break}}s!=="classic"&&(e.compilerOptions.moduleResolution=s)}if(e.compilerOptions.moduleResolution==="bundler"&&(e.compilerOptions.resolveJsonModule??=!0),e.compilerOptions.module&&["node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.resolveJsonModule??=!0),(e.compilerOptions.esModuleInterop||e.compilerOptions.module==="system"||e.compilerOptions.moduleResolution==="bundler")&&e.compilerOptions.allowSyntheticDefaultImports===void 0&&(e.compilerOptions.allowSyntheticDefaultImports=!0),["5.7","5.8","5.9"].includes(String(o?.tscCompatible))&&e.compilerOptions.moduleResolution){let s=!1;["bundler","node16","nodenext"].includes(e.compilerOptions.moduleResolution.toLocaleLowerCase())&&(s=!0),e.compilerOptions.resolvePackageJsonExports===void 0&&s&&(e.compilerOptions.resolvePackageJsonExports=!0),e.compilerOptions.resolvePackageJsonImports===void 0&&s&&(e.compilerOptions.resolvePackageJsonImports=!0)}if(e.compilerOptions.target===void 0){let s="es5";switch(e.compilerOptions.module){case"node16":case"node18":{s="es2022";break}case"node20":{s="es2023";break}case"nodenext":{s="esnext";break}}s!=="es5"&&(e.compilerOptions.target=s)}e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.target&&pe(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!0)}if(["5.6","5.7","5.8","5.9"].includes(String(o?.tscCompatible))&&e.compilerOptions.strict&&e.compilerOptions.strictBuiltinIteratorReturn===void 0&&(e.compilerOptions.strictBuiltinIteratorReturn=!0),["5.4","5.5","5.6","5.7","5.8","5.9"].includes(String(o?.tscCompatible))&&(e.compilerOptions.strict&&(e.compilerOptions.noImplicitAny=e.compilerOptions.noImplicitAny??!0,e.compilerOptions.noImplicitThis=e.compilerOptions.noImplicitThis??!0,e.compilerOptions.strictNullChecks=e.compilerOptions.strictNullChecks??!0,e.compilerOptions.strictFunctionTypes=e.compilerOptions.strictFunctionTypes??!0,e.compilerOptions.strictBindCallApply=e.compilerOptions.strictBindCallApply??!0,e.compilerOptions.strictPropertyInitialization=e.compilerOptions.strictPropertyInitialization??!0,e.compilerOptions.alwaysStrict=e.compilerOptions.alwaysStrict??!0),e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.target&&pe(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!0),e.compilerOptions.strict&&e.compilerOptions.useUnknownInCatchVariables===void 0&&(e.compilerOptions.useUnknownInCatchVariables=!0),e.compilerOptions.isolatedModules&&(e.compilerOptions.preserveConstEnums=e.compilerOptions.preserveConstEnums??!0)),["6.0","7.0","true"].includes(String(o?.tscCompatible))){if(e.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0&&e.compilerOptions.module){const s=e.compilerOptions.module.toLocaleLowerCase();s==="node16"||s==="node18"||s==="node20"?e.compilerOptions.moduleResolution="node16":s==="nodenext"&&(e.compilerOptions.moduleResolution="nodenext")}if(e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&e.compilerOptions.target&&!pe(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!1),e.compilerOptions.isolatedModules&&e.compilerOptions.preserveConstEnums===void 0&&(e.compilerOptions.preserveConstEnums=!0),e.compilerOptions.resolveJsonModule===void 0){const s=e.compilerOptions.module,t=e.compilerOptions.moduleResolution?.toLocaleLowerCase();!(s!==void 0&&["node20","nodenext"].includes(s)||t==="bundler")&&t&&(e.compilerOptions.resolveJsonModule=!1)}if(e.compilerOptions.moduleResolution){const s=e.compilerOptions.moduleResolution.toLocaleLowerCase();["bundler","node16","nodenext"].includes(s)||(e.compilerOptions.resolvePackageJsonExports??=!1,e.compilerOptions.resolvePackageJsonImports??=!1)}}return e.compileOnSave===!1&&delete e.compileOnSave,e},Ht=(e,o)=>{const s=e?.typescriptVersion;if(!(s===!1||s===void 0))return s==="auto"?jt(o):s},x="${configDir}",Re=Symbol("implicitBaseUrl"),zt=(e,o)=>{const s=S(e),t=Fe(s,o),r=N(s),c=Ht(o,r);c&&t.compilerOptions&&Wt(t.compilerOptions,c);const{compilerOptions:i}=t;if(i){for(const a of Kt){const p=i[a];if(p){const f=Z(p,r);i[a]=f?G(H(r,f)):p}}for(const a of["rootDirs","typeRoots"]){const p=i[a];p&&(i[a]=p.map(f=>{const d=Z(f,r);return d?G(H(r,d)):f}))}const{paths:l}=i;if(l){const a=Object.keys(l);for(let p=0;p<a.length;p++){const f=a[p];l[f]=l[f].map(d=>Z(d,r)??d)}}}for(let l=0;l<me.length;l++){const a=me[l],p=t[a];p&&(t[a]=p.map(f=>Z(f,r)??f))}return Gt(t,o)};let Qt;const Yt=e=>(Qt??=D(import.meta.url))(e),K=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xt=e=>{if(typeof K<"u"&&K.versions&&K.versions.node){const[o,s]=K.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return K.getBuiltinModule(e)}return Yt(e)},{statSync:Zt}=Xt("node:fs"),eo=new Map,to="tsconfig.json",oo=(e,o)=>{let s=0;try{s=Zt(e).mtimeMs}catch{}return`${e}::${String(o.tscCompatible)}::${String(o.typescriptVersion)}::${String(s)}`},ro=(e,o={})=>{const s=o.configFileName??to,t=o.configFileName===void 0;let r=oe(s,{...e&&{cwd:e},type:"file"});if(!r&&t&&(r=oe("jsconfig.json",{...e&&{cwd:e},type:"file"})),!r)throw new Ne(t?`No such file or directory, for '${s}' or 'jsconfig.json' found.`:`No such file or directory, for '${s}' found.`);const c=o.cache&&typeof o.cache!="boolean"?o.cache:eo,i=oo(r,o);if(o.cache&&c.has(i))return c.get(i);const l={config:zt(r,{tscCompatible:o.tscCompatible,typescriptVersion:o.typescriptVersion}),path:r};return o.cache&&c.set(i,l),l},so=/\.[cm]?tsx?$/,io=[".yaml",".yml",".toml",".jsonc",".json5",".txt"],Be=/\.(?:ya?ml|toml|jsonc|json5|txt)$/,no=e=>e.endsWith(".yaml")||e.endsWith(".yml")?rt(e):e.endsWith(".toml")?Tt(e):e.endsWith(".jsonc")?Ot(e,{allowTrailingComma:!0}):e.endsWith(".json5")?it(e):Oe(e,"utf8"),he=e=>e===void 0?"undefined":e===null?"null":typeof e=="number"?Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":String(e):typeof e=="bigint"?`${e}n`:typeof e=="boolean"?String(e):typeof e=="string"?JSON.stringify(e):e instanceof Date?`new Date(${JSON.stringify(e.toISOString())})`:Array.isArray(e)?`[${e.map(o=>he(o)).join(",")}]`:typeof e=="object"?`{${Object.entries(e).map(([o,s])=>`${JSON.stringify(o)}:${he(s)}`).join(",")}}`:"null",ue=new Map,co=(e,o)=>e.startsWith(x)?w(o,e.slice(x.length)):e,lo=e=>{if(ue.has(e))return ue.get(e);let o;try{const{config:s,path:t}=ro(e,{cache:!1}),r=N(t),c=s.compilerOptions,i=c?.paths??{};if(c!==void 0){const{baseUrl:l}=c;let a,p=!1;if(l===void 0){const f=c[Re];a=typeof f=="string"?f:r}else p=!0,a=S(r,co(l,r));o={hasBaseUrl:p,paths:i,pathsBase:a}}}catch{o=void 0}return ue.set(e,o),o},Ue=(e,o)=>{const s=lo(o);if(s===void 0)return;const{hasBaseUrl:t,pathsBase:r}=s,c=i=>Pe(i)??We(i);for(const[i,l]of Object.entries(s.paths)){const a=i.indexOf("*");if(a===-1){if(i===e)for(const d of l){const v=c(S(r,d));if(v!==void 0)return v}continue}const p=i.slice(0,a),f=i.slice(a+1);if(e.startsWith(p)&&e.endsWith(f)&&e.length>=p.length+f.length){const d=e.slice(p.length,e.length-f.length);for(const v of l){const O=v.replace("*",d),k=c(S(r,O));if(k!==void 0)return k}}}if(t){const i=c(S(r,e));if(i!==void 0)return i}};let Ee=!1,de=0,$e=!1,Se=!1;const ao=()=>{Se||(Se=!0,process.setSourceMapsEnabled?.(!0))},po=e=>{const o=e.indexOf("?");return o===-1?e:e.slice(0,o)},uo=e=>e.endsWith(".cts")?"commonjs":"module",Ae=[".ts",".tsx",".mts",".cts",".js",".mjs",".cjs",".json"],L=e=>{try{return Ie(e).isFile()}catch{return!1}},fo=e=>{try{return Ie(e).isDirectory()}catch{return!1}},mo=e=>{if(e.endsWith(".js"))return`${e.slice(0,-3)}.ts`;if(e.endsWith(".mjs"))return`${e.slice(0,-4)}.mts`;if(e.endsWith(".cjs"))return`${e.slice(0,-4)}.cts`},Pe=e=>{if(L(e))return e;const o=mo(e);if(o!==void 0&&L(o))return o;for(const s of Ae)if(L(e+s))return e+s;if(fo(e))for(const s of Ae){const t=`${e}/index${s}`;if(L(t))return t}},We=e=>{if(L(e)&&Be.test(e))return e;for(const o of io)if(L(e+o))return e+o},Me=()=>{ao();const{registerHooks:e}=fe;return typeof e!="function"?!1:(Ee||(e({load(o,s,t){const r=po(o);if(r.startsWith("file:")&&so.test(r)){const c=Y(r),{code:i}=je(c,Oe(c,"utf8"));return{format:uo(c),shortCircuit:!0,source:i}}if(r.startsWith("file:")&&Be.test(r)){const c=Y(r),i=no(c);return{format:"module",shortCircuit:!0,source:`export default ${he(i)};
|
|
8
|
-
`}}return t(o,s)},resolve(o,s,t){if((o.startsWith(".")||o.startsWith("/"))&&s.parentURL!==void 0){let r;try{r=new URL(o,s.parentURL)}catch{r=void 0}if(r?.protocol==="file:"){const
|
|
9
|
-
`));const{code:o}=
|
|
7
|
+
`+" ".repeat(o));var re;(function(e){e.DEFAULT={allowTrailingComma:!1}})(re||(re={}));function bt(e,o=[],s=re.DEFAULT){let t=null,r=[];const n=[];function i(l){Array.isArray(r)?r.push(l):t!==null&&(r[t]=l)}return yt(e,{onObjectBegin:()=>{const l={};i(l),n.push(r),r=l,t=null},onObjectProperty:l=>{t=l},onObjectEnd:()=>{r=n.pop()},onArrayBegin:()=>{const l=[];i(l),n.push(r),r=l,t=null},onArrayEnd:()=>{r=n.pop()},onLiteralValue:i,onError:(l,a,p)=>{o.push({error:l,offset:a,length:p})}},s),r[0]}function yt(e,o,s=re.DEFAULT){const t=Ot(e,!1),r=[];let n=0;function i(y){return y?()=>n===0&&y(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}function l(y){return y?C=>n===0&&y(C,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}function a(y){return y?C=>n===0&&y(C,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>r.slice()):()=>!0}function p(y){return y?()=>{n>0?n++:y(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>r.slice())===!1&&(n=1)}:()=>!0}function f(y){return y?()=>{n>0&&n--,n===0&&y(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter())}:()=>!0}const d=p(o.onObjectBegin),k=a(o.onObjectProperty),O=f(o.onObjectEnd),v=p(o.onArrayBegin),T=f(o.onArrayEnd),A=a(o.onLiteralValue),N=l(o.onSeparator),h=i(o.onComment),c=l(o.onError),g=s&&s.disallowComments,b=s&&s.allowTrailingComma;function m(){for(;;){const y=t.scan();switch(t.getTokenError()){case 4:u(14);break;case 5:u(15);break;case 3:u(13);break;case 1:g||u(11);break;case 2:u(12);break;case 6:u(16);break}switch(y){case 12:case 13:g?u(10):h();break;case 16:u(1);break;case 15:case 14:break;default:return y}}}function u(y,C=[],ye=[]){if(c(y),C.length+ye.length>0){let Q=t.getToken();for(;Q!==17;){if(C.indexOf(Q)!==-1){m();break}else if(ye.indexOf(Q)!==-1)break;Q=m()}}}function E(y){const C=t.getTokenValue();return y?A(C):(k(C),r.push(C)),m(),!0}function B(){switch(t.getToken()){case 11:const y=t.getTokenValue();let C=Number(y);isNaN(C)&&(u(2),C=0),A(C);break;case 7:A(null);break;case 8:A(!0);break;case 9:A(!1);break;default:return!1}return m(),!0}function H(){return t.getToken()!==10?(u(3,[],[2,5]),!1):(E(!1),t.getToken()===6?(N(":"),m(),ie()||u(4,[],[2,5])):u(5,[],[2,5]),r.pop(),!0)}function ze(){d(),m();let y=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(y||u(4,[],[]),N(","),m(),t.getToken()===2&&b)break}else y&&u(6,[],[]);H()||u(4,[],[2,5]),y=!0}return O(),t.getToken()!==2?u(7,[2],[]):m(),!0}function He(){v(),m();let y=!0,C=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(C||u(4,[],[]),N(","),m(),t.getToken()===4&&b)break}else C&&u(6,[],[]);y?(r.push(0),y=!1):r[r.length-1]++,ie()||u(4,[],[4,5]),C=!0}return T(),y||r.pop(),t.getToken()!==4?u(8,[4],[]):m(),!0}function ie(){switch(t.getToken()){case 3:return He();case 1:return ze();case 10:return E(!0);default:return B()}}return m(),t.getToken()===17?s.allowEmptyContent?!0:(u(4,[],[]),!1):ie()?(t.getToken()!==17&&u(9,[],[]),!0):(u(4,[],[]),!1)}var ke;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(ke||(ke={}));var Ce;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Ce||(Ce={}));const se=bt;var we;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(we||(we={}));function vt(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}const kt=(e,o,s,t)=>{if(e.length===0)return;const r=e[0],n=ot(o,r.offset),i=new rt(`${vt(r.error)} at offset ${r.offset}`);throw i.fileName=s,i.codeFrame=st(o,{start:n},{tabWidth:!1,...t}),i},Ct=(e,o)=>{const{allowEmptyContent:s,allowTrailingComma:t=!0,beforeParse:r,buffer:n,color:i,compression:l,disallowComments:a,encoding:p="utf8",flag:f}=o??{},d=R(e,{buffer:n,compression:l,encoding:p,flag:f}),k=typeof r=="function"?r(d):d,O=[],v=se(k,O,{allowEmptyContent:s,allowTrailingComma:t,disallowComments:a});return kt(O,k,it(e),{color:i}),v};let wt;const Tt=e=>(wt??=D(import.meta.url))(e),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xt=e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[o,s]=M.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return M.getBuiltinModule(e)}return Tt(e)};xt("node:fs/promises");let Et;const $t=e=>(Et??=D(import.meta.url))(e),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,St=e=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[o,s]=V.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return V.getBuiltinModule(e)}return $t(e)};St("node:fs");const At=(e,o)=>{const s=R(e,{encoding:"utf8",...o});return at(s)};var J={},Te;function It(){if(Te)return J;Te=1,Object.defineProperty(J,"__esModule",{value:!0});const e=h=>h!==null&&typeof h=="object",o=(h,c)=>Object.assign(new Error(`[${h}]: ${c}`),{code:h}),s="ERR_INVALID_PACKAGE_CONFIG",t="ERR_INVALID_PACKAGE_TARGET",r="ERR_PACKAGE_PATH_NOT_EXPORTED",n="ERR_PACKAGE_IMPORT_NOT_DEFINED",i=/^\d+$/,l=/^(\.{1,2}|node_modules)$/i,a=/\/|\\/;var p=(h=>(h.Export="exports",h.Import="imports",h))(p||{});const f=(h,c,g,b,m)=>{if(c==null)return[];if(typeof c=="string"){const[u,...E]=c.split(a);if(u===".."||E.some(B=>l.test(B)))throw o(t,`Invalid "${h}" target "${c}" defined in the package config`);return[m?c.replace(/\*/g,m):c]}if(Array.isArray(c))return c.flatMap(u=>f(h,u,g,b,m));if(e(c)){for(const u of Object.keys(c)){if(i.test(u))throw o(s,"Cannot contain numeric property keys");if(u==="default"||b.includes(u))return f(h,c[u],g,b,m)}return[]}throw o(t,`Invalid "${h}" target "${c}"`)},d="*",k=(h,c)=>{const g=h.indexOf(d),b=c.indexOf(d);return g===b?c.length>h.length:b>g};function O(h,c){if(!c.includes(d)&&h.hasOwnProperty(c))return[c];let g,b;for(const m of Object.keys(h))if(m.includes(d)){const[u,E,B]=m.split(d);if(B===void 0&&c.startsWith(u)&&c.endsWith(E)){const H=c.slice(u.length,-E.length||void 0);H&&(!g||k(g,m))&&(g=m,b=H)}}return[g,b]}const v=h=>Object.keys(h).reduce((c,g)=>{const b=g===""||g[0]!==".";if(c===void 0||c===b)return b;throw o(s,'"exports" cannot contain some keys starting with "." and some not')},void 0),T=/^\w+:/,A=(h,c,g)=>{if(!h)throw new Error('"exports" is required');c=c===""?".":`./${c}`,(typeof h=="string"||Array.isArray(h)||e(h)&&v(h))&&(h={".":h});const[b,m]=O(h,c),u=f(p.Export,h[b],c,g,m);if(u.length===0)throw o(r,c==="."?'No "exports" main defined':`Package subpath '${c}' is not defined by "exports"`);for(const E of u)if(!E.startsWith("./")&&!T.test(E))throw o(t,`Invalid "exports" target "${E}" defined in the package config`);return u},N=(h,c,g)=>{if(!h)throw new Error('"imports" is required');const[b,m]=O(h,c),u=f(p.Import,h[b],c,g,m);if(u.length===0)throw o(n,`Package import specifier "${c}" is not defined in package`);return u};return J.resolveExports=A,J.resolveImports=N,J}var Nt=It();let Lt;const _t=e=>(Lt??=D(import.meta.url))(e),q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,je=e=>{if(typeof q<"u"&&q.versions&&q.versions.node){const[o,s]=q.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return q.getBuiltinModule(e)}return _t(e)},{statSync:X}=je("node:fs"),jt=je("node:module"),De=(e=process.cwd())=>{const{findPnpApi:o}=jt;return o?o(e):void 0},Dt=e=>se(R(e,{buffer:!1})),ce=(e,o,s,t)=>{const r=`resolveFromPackageJsonPath:${e}:${o}:${s?"yes":"no"}`;if(t?.has(r))return t.get(r);const n=Dt(e);if(!n)return;let i=o||"tsconfig.json";if(!s&&n.exports)try{const[l]=Nt.resolveExports(n.exports,o,["require","types"]);i=l}catch{return!1}else!o&&n.tsconfig&&(i=n.tsconfig);return i=w(e,"..",i),t?.set(r,i),i},le="package.json",ae="tsconfig.json",Rt=(e,o,s)=>{let t=e;if(e===".."&&(t=w(t,ae)),e.startsWith(".")&&(t=S(o,t)),be(t)){if($(t)){if(X(t).isFile())return t}else if(!t.endsWith(".json")){const O=`${t}.json`;if($(O))return O}return}const[r="",...n]=e.split("/"),i=r.startsWith("@")?`${r}/${String(n.shift())}`:r,l=n.join("/"),a=De(o);if(a){const{resolveRequest:O}=a;try{if(i===e){const v=O(w(i,le),o);if(v){const T=ce(v,l,!1,s);if(T&&$(T))return T}}else{let v;try{v=O(e,o,{extensions:[".json"]})}catch{v=O(w(e,ae),o)}if(v)return v}}catch{}}const p=te(O=>{const v=w(S(O),"node_modules",i);if($(v))return w("node_modules",i)},{cwd:o,type:"directory"});if(!p||!X(p).isDirectory())return;const f=w(p,le);if($(f)){const O=ce(f,l,!1,s);if(O===!1)return;if(O&&$(O)&&X(O).isFile())return O}const d=w(p,l),k=d.endsWith(".json");if(!k){const O=`${d}.json`;if($(O))return O}if($(d)){if(X(d).isDirectory()){const O=w(d,le);if($(O)){const T=ce(O,"",!0,s);if(T&&$(T))return T}const v=w(d,ae);if($(v))return v}else if(k)return d}},Re=e=>{const o=S(e);let s;const t=De(o);if(t)try{s=t.resolveRequest("typescript/package.json",o)??void 0}catch{}if(s??=te(r=>w(r,"node_modules","typescript","package.json"),{cwd:o,type:"file"}),!!s)try{const r=se(R(s,{buffer:!1}));if(typeof r?.version=="string")return r.version}catch{}},Be=new Set(["node16","node18","node20","nodenext"]),Fe=e=>e!==void 0&&Be.has(e),Bt=e=>{switch(e){case"node20":return"es2023";case"nodenext":return"esnext";default:return"es2022"}},Ft=e=>e==="nodenext"?"nodenext":"node16",Ut=e=>{if(e==="nodenext")return"nodenext";if(e==="node16")return"node16"},Ue=(e,o,s)=>{const t=o.has("module")?e.module:void 0,r=o.has("moduleResolution")?e.moduleResolution:void 0;let n;t!==void 0&&Be.has(t)?n=t:r!==void 0&&(n=Ut(r)),s.target!==void 0&&!o.has("target")&&(e.target=n?Bt(n):s.target),o.has("module")||(e.module=n??s.module),o.has("moduleResolution")||(e.moduleResolution=n?Ft(n):"bundler")},Pt=(e,o)=>{!o.has("target")&&!Fe(e.module)&&(e.target="es3")},Wt=(e,o)=>{!o.has("target")&&!Fe(e.module)&&(e.target="es5")},Mt=(e,o)=>{o.has("strict")||(e.strict=!0),Ue(e,o,{module:"es2022",target:"es2025"}),o.has("rootDir")||(e.rootDir="."),o.has("types")||(e.types=[]),o.has("noUncheckedSideEffectImports")||(e.noUncheckedSideEffectImports=!0),o.has("libReplacement")||(e.libReplacement=!1),o.has("alwaysStrict")||(e.alwaysStrict=!0)},Vt=(e,o)=>{Ue(e,o,{module:"esnext"}),o.has("stableTypeOrdering")||(e.stableTypeOrdering=!0)},Jt=[[4,Pt],[5,Wt],[6,Mt],[7,Vt]],qt=/^v?(\d+)/,Kt=e=>{const o=qt.exec(e);return o?Number(o[1]):void 0},Gt=(e,o)=>{const s=Kt(o);if(s===void 0)return;const t=new Set(Object.keys(e));for(const[r,n]of Jt)r<=s&&n(e,t)},zt=e=>se(R(e,{buffer:!1})),Ht=e=>e.replaceAll("\\","/"),G=e=>{const o=nt(e);return ct(o)?o:`./${o}`},fe=["files","include","exclude"],xe=(e,o,s)=>{const t=w(o,s),r=z(e,t);return oe(r)||"./"},Qt=(e,o,s)=>{const t=z(e,o);if(!t)return s;const r=s.startsWith("./")?s.slice(2):s;return`${t}/${r}`},Yt=(e,o,s,t,r)=>{if(s.has(e))throw new Error(`Circularity detected while resolving configuration: ${e}`);s.add(e);const n=I(e),i=Pe(e,t,s,r);delete i.references;const{compilerOptions:l}=i;if(l){const{baseUrl:a}=l;a&&!a.startsWith(x)&&(l.baseUrl=xe(o,n,a));const{outDir:p}=l;p&&!p.startsWith(x)&&(l.outDir=xe(o,n,p))}for(const a of fe){const p=i[a];p&&(i[a]=p.map(f=>f.startsWith(x)||be(f)?f:Qt(o,n,f)))}return i},Pe=(e,o,s=new Set,t=new Map)=>{let r;try{r=zt(e)??{}}catch(i){throw new Error(`Cannot resolve tsconfig at path: ${e}`,{cause:i})}if(typeof r!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);const n=I(e);if(r.compilerOptions){const{compilerOptions:i}=r;i.paths&&!i.baseUrl&&(i[We]=n)}if(r.extends){const i=Array.isArray(r.extends)?r.extends:[r.extends];delete r.extends;const l=i.toReversed();for(let a=0;a<l.length;a++){const p=l[a],f=Rt(p,n,t);if(!f)throw new Le(`No such file or directory, for '${p}' found.`);const d=Yt(f,n,new Set(s),o,t);d.compilerOptions?.rootDir!==void 0&&!d.compilerOptions.rootDir.startsWith(x)&&(d.compilerOptions.rootDir=w(I(f),d.compilerOptions.rootDir));const k={...d,...r,compilerOptions:{...d.compilerOptions,...r.compilerOptions}};d.watchOptions&&(k.watchOptions={...d.watchOptions,...r.watchOptions}),r=k}}if(r.compilerOptions){const{compilerOptions:i}=r;for(const l of["baseUrl","rootDir"]){const a=i[l];if(a&&!a.startsWith(x)){const p=S(n,a);i[l]=G(z(n,p))}}for(const l of["outDir","declarationDir"]){let a=i[l];a&&(Array.isArray(r.exclude)||(r.exclude=["outDir","declarationDir"].map(p=>{const f=i[p];if(f)return f.startsWith(x)||be(f)?f:w(n,f)}).filter(Boolean)),a.startsWith(x)||(a=G(a)),i[l]=a)}}else r.compilerOptions={};if(r.include&&(r.include=r.include.map(i=>Ht(i))),r.files&&(r.files=r.files.map(i=>i.startsWith(x)?i:G(i))),r.watchOptions){const{watchOptions:i}=r;i.excludeDirectories&&(i.excludeDirectories=i.excludeDirectories.map(l=>oe(S(n,l)))),i.excludeFiles&&(i.excludeFiles=i.excludeFiles.map(l=>oe(S(n,l)))),i.watchFile&&(i.watchFile=i.watchFile.toLowerCase()),i.watchDirectory&&(i.watchDirectory=i.watchDirectory.toLowerCase()),i.fallbackPolling&&(i.fallbackPolling=i.fallbackPolling.toLowerCase())}if(r.compilerOptions.lib&&(r.compilerOptions.lib=r.compilerOptions.lib.map(i=>i.toLowerCase())),r.compilerOptions.module){let i=r.compilerOptions.module.toLowerCase();i==="es2015"&&(i="es6"),r.compilerOptions.module=i}if(r.compilerOptions.target){let i=r.compilerOptions.target.toLowerCase();i==="es2015"&&(i="es6"),r.compilerOptions.target=i}if(r.compilerOptions.moduleResolution){let i=r.compilerOptions.moduleResolution.toLowerCase();i==="node"&&(i="node10"),r.compilerOptions.moduleResolution=i}return r.compilerOptions.jsx&&(r.compilerOptions.jsx=r.compilerOptions.jsx.toLowerCase()),r.compilerOptions.moduleDetection&&(r.compilerOptions.moduleDetection=r.compilerOptions.moduleDetection.toLowerCase()),r.compilerOptions.importsNotUsedAsValues&&(r.compilerOptions.importsNotUsedAsValues=r.compilerOptions.importsNotUsedAsValues.toLowerCase()),r.compilerOptions.newLine&&(r.compilerOptions.newLine=r.compilerOptions.newLine.toLowerCase()),r},Z=(e,o)=>{if(e.startsWith(x))return oe(w(o,e.slice(x.length)))},Xt=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],Ee=e=>e==="es2022"||e==="es2023"||e==="es2024"||e==="es2025"||e==="esnext",Zt=(e,o)=>{if(e.compilerOptions===void 0)return e;if(e.compilerOptions.rewriteRelativeImportExtensions&&(e.compilerOptions.allowImportingTsExtensions??=!0),e.compilerOptions.composite&&(e.compilerOptions.declaration??=!0,e.compilerOptions.incremental??=!0),e.compilerOptions.checkJs&&(e.compilerOptions.allowJs??=!0),e.compilerOptions.verbatimModuleSyntax&&(e.compilerOptions.isolatedModules??=!0,e.compilerOptions.preserveConstEnums??=!0),["5.4","5.5","5.6","5.7","5.8","5.9"].includes(String(o?.tscCompatible))){if(e.compilerOptions.esModuleInterop===void 0&&(e.compilerOptions.module==="node16"||e.compilerOptions.module==="node18"||e.compilerOptions.module==="node20"||e.compilerOptions.module==="nodenext"||e.compilerOptions.module==="preserve")&&(e.compilerOptions.esModuleInterop=!0),e.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0){let s="classic";if(e.compilerOptions.module!==void 0)switch(e.compilerOptions.module.toLocaleLowerCase()){case"commonjs":{s="node10";break}case"node16":case"node18":{s="node16";break}case"node20":{s="node16";break}case"nodenext":{s="nodenext";break}case"preserve":{s="bundler";break}}s!=="classic"&&(e.compilerOptions.moduleResolution=s)}if(e.compilerOptions.moduleResolution==="bundler"&&(e.compilerOptions.resolveJsonModule??=!0),e.compilerOptions.module&&["node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.resolveJsonModule??=!0),(e.compilerOptions.esModuleInterop||e.compilerOptions.module==="system"||e.compilerOptions.moduleResolution==="bundler")&&e.compilerOptions.allowSyntheticDefaultImports===void 0&&(e.compilerOptions.allowSyntheticDefaultImports=!0),["5.7","5.8","5.9"].includes(String(o?.tscCompatible))&&e.compilerOptions.moduleResolution){let s=!1;["bundler","node16","nodenext"].includes(e.compilerOptions.moduleResolution.toLocaleLowerCase())&&(s=!0),e.compilerOptions.resolvePackageJsonExports===void 0&&s&&(e.compilerOptions.resolvePackageJsonExports=!0),e.compilerOptions.resolvePackageJsonImports===void 0&&s&&(e.compilerOptions.resolvePackageJsonImports=!0)}if(e.compilerOptions.target===void 0){let s="es5";switch(e.compilerOptions.module){case"node16":case"node18":{s="es2022";break}case"node20":{s="es2023";break}case"nodenext":{s="esnext";break}}s!=="es5"&&(e.compilerOptions.target=s)}e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.target&&Ee(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!0)}if(["5.6","5.7","5.8","5.9"].includes(String(o?.tscCompatible))&&e.compilerOptions.strict&&e.compilerOptions.strictBuiltinIteratorReturn===void 0&&(e.compilerOptions.strictBuiltinIteratorReturn=!0),["5.4","5.5","5.6","5.7","5.8","5.9"].includes(String(o?.tscCompatible))&&(e.compilerOptions.strict&&(e.compilerOptions.noImplicitAny=e.compilerOptions.noImplicitAny??!0,e.compilerOptions.noImplicitThis=e.compilerOptions.noImplicitThis??!0,e.compilerOptions.strictNullChecks=e.compilerOptions.strictNullChecks??!0,e.compilerOptions.strictFunctionTypes=e.compilerOptions.strictFunctionTypes??!0,e.compilerOptions.strictBindCallApply=e.compilerOptions.strictBindCallApply??!0,e.compilerOptions.strictPropertyInitialization=e.compilerOptions.strictPropertyInitialization??!0,e.compilerOptions.alwaysStrict=e.compilerOptions.alwaysStrict??!0),e.compilerOptions.strict&&e.compilerOptions.useUnknownInCatchVariables===void 0&&(e.compilerOptions.useUnknownInCatchVariables=!0),e.compilerOptions.isolatedModules&&(e.compilerOptions.preserveConstEnums=e.compilerOptions.preserveConstEnums??!0)),["6.0","7.0","true"].includes(String(o?.tscCompatible))){if(e.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0&&e.compilerOptions.module){const s=e.compilerOptions.module.toLocaleLowerCase();s==="node16"||s==="node18"||s==="node20"?e.compilerOptions.moduleResolution="node16":s==="nodenext"&&(e.compilerOptions.moduleResolution="nodenext")}if(e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&e.compilerOptions.target&&!Ee(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!1),e.compilerOptions.isolatedModules&&e.compilerOptions.preserveConstEnums===void 0&&(e.compilerOptions.preserveConstEnums=!0),e.compilerOptions.resolveJsonModule===void 0){const s=e.compilerOptions.module,t=e.compilerOptions.moduleResolution?.toLocaleLowerCase();!(s!==void 0&&["node20","nodenext"].includes(s)||t==="bundler")&&t&&(e.compilerOptions.resolveJsonModule=!1)}if(e.compilerOptions.moduleResolution){const s=e.compilerOptions.moduleResolution.toLocaleLowerCase();["bundler","node16","nodenext"].includes(s)||(e.compilerOptions.resolvePackageJsonExports??=!1,e.compilerOptions.resolvePackageJsonImports??=!1)}}return e.compileOnSave===!1&&delete e.compileOnSave,e},eo=(e,o)=>{const s=e?.typescriptVersion;if(!(s===!1||s===void 0))return s==="auto"?Re(o):s},x="${configDir}",We=Symbol("implicitBaseUrl"),to=(e,o)=>{const s=S(e),t=Pe(s,o),r=I(s),n=eo(o,r);n&&t.compilerOptions&&Gt(t.compilerOptions,n);const{compilerOptions:i}=t;if(i){for(const a of Xt){const p=i[a];if(p){const f=Z(p,r);i[a]=f?G(z(r,f)):p}}for(const a of["rootDirs","typeRoots"]){const p=i[a];p&&(i[a]=p.map(f=>{const d=Z(f,r);return d?G(z(r,d)):f}))}const{paths:l}=i;if(l){const a=Object.keys(l);for(let p=0;p<a.length;p++){const f=a[p];l[f]=l[f].map(d=>Z(d,r)??d)}}}for(let l=0;l<fe.length;l++){const a=fe[l],p=t[a];p&&(t[a]=p.map(f=>Z(f,r)??f))}return Zt(t,o)};let oo;const ro=e=>(oo??=D(import.meta.url))(e),K=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,so=e=>{if(typeof K<"u"&&K.versions&&K.versions.node){const[o,s]=K.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return K.getBuiltinModule(e)}return ro(e)},{statSync:io}=so("node:fs"),no=new Map,me=new WeakMap,co="tsconfig.json",Me=e=>{try{return io(e).mtimeMs}catch{return 0}},lo=(e,o)=>{let s=String(o.typescriptVersion);return o.typescriptVersion==="auto"&&(s=`auto:${String(Re(I(e)))}`),`${e}::${String(o.tscCompatible)}::${s}`},ao=(e,o,s)=>{if(e.has(o)&&me.get(e)?.get(o)===Me(s))return e.get(o)},po=(e,o,s,t)=>{e.set(o,t);let r=me.get(e);r||(r=new Map,me.set(e,r)),r.set(o,Me(s))},uo=(e,o={})=>{const s=o.configFileName??co,t=o.configFileName===void 0;let r=te(s,{...e&&{cwd:e},type:"file"});if(!r&&t&&(r=te("jsconfig.json",{...e&&{cwd:e},type:"file"})),!r)throw new Le(t?`No such file or directory, for '${s}' or 'jsconfig.json' found.`:`No such file or directory, for '${s}' found.`);const n=o.cache&&typeof o.cache!="boolean"?o.cache:no,i=lo(r,o);if(o.cache){const a=ao(n,i,r);if(a)return a}const l={config:to(r,{tscCompatible:o.tscCompatible,typescriptVersion:o.typescriptVersion}),path:r};return o.cache&&po(n,i,r,l),l},fo=/\.[cm]?tsx?$/,mo=[".yaml",".yml",".toml",".jsonc",".json5",".txt"],Ve=/\.(?:ya?ml|toml|jsonc|json5|txt)$/,ho=e=>e.endsWith(".yaml")||e.endsWith(".yml")?lt(e):e.endsWith(".toml")?At(e):e.endsWith(".jsonc")?Ct(e,{allowTrailingComma:!0}):e.endsWith(".json5")?pt(e):Oe(e,"utf8"),he=e=>e===void 0?"undefined":e===null?"null":typeof e=="number"?Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":String(e):typeof e=="bigint"?`${e}n`:typeof e=="boolean"?String(e):typeof e=="string"?JSON.stringify(e):e instanceof Date?`new Date(${JSON.stringify(e.toISOString())})`:Array.isArray(e)?`[${e.map(o=>he(o)).join(",")}]`:typeof e=="object"?`{${Object.entries(e).map(([o,s])=>`${JSON.stringify(o)}:${he(s)}`).join(",")}}`:"null",pe=new Map,go=(e,o)=>e.startsWith(x)?w(o,e.slice(x.length)):e,Oo=e=>{if(pe.has(e))return pe.get(e);let o;try{const{config:s,path:t}=uo(e,{cache:!1}),r=I(t),n=s.compilerOptions,i=n?.paths??{};if(n!==void 0){const{baseUrl:l}=n;let a,p=!1;if(l===void 0){const f=n[We];a=typeof f=="string"?f:r}else p=!0,a=S(r,go(l,r));o={hasBaseUrl:p,paths:i,pathsBase:a}}}catch{o=void 0}return pe.set(e,o),o},Je=(e,o)=>{const s=Oo(o);if(s===void 0)return;const{hasBaseUrl:t,pathsBase:r}=s,n=i=>qe(i)??Ke(i);for(const[i,l]of Object.entries(s.paths)){const a=i.indexOf("*");if(a===-1){if(i===e)for(const d of l){const k=n(S(r,d));if(k!==void 0)return k}continue}const p=i.slice(0,a),f=i.slice(a+1);if(e.startsWith(p)&&e.endsWith(f)&&e.length>=p.length+f.length){const d=e.slice(p.length,e.length-f.length);for(const k of l){const O=k.replace("*",d),v=n(S(r,O));if(v!==void 0)return v}}}if(t){const i=n(S(r,e));if(i!==void 0)return i}};let $e=!1,ue=0,Se=!1,Ae=!1;const bo=()=>{Ae||(Ae=!0,process.setSourceMapsEnabled?.(!0))},yo=e=>{const o=e.indexOf("?");return o===-1?e:e.slice(0,o)},vo=e=>e.endsWith(".cts")?"commonjs":"module",Ie=[".ts",".tsx",".mts",".cts",".js",".mjs",".cjs",".json"],j=e=>{try{return Ne(e).isFile()}catch{return!1}},ko=e=>{try{return Ne(e).isDirectory()}catch{return!1}},Co=e=>{if(e.endsWith(".js"))return`${e.slice(0,-3)}.ts`;if(e.endsWith(".mjs"))return`${e.slice(0,-4)}.mts`;if(e.endsWith(".cjs"))return`${e.slice(0,-4)}.cts`},qe=e=>{if(j(e))return e;const o=Co(e);if(o!==void 0&&j(o))return o;for(const s of Ie)if(j(e+s))return e+s;if(ko(e))for(const s of Ie){const t=`${e}/index${s}`;if(j(t))return t}},Ke=e=>{if(j(e)&&Ve.test(e))return e;for(const o of mo)if(j(e+o))return e+o},Ge=()=>{bo();const{registerHooks:e}=de;return typeof e!="function"?!1:($e||(e({load(o,s,t){const r=yo(o);if(r.startsWith("file:")&&fo.test(r)){const n=Y(r),{code:i}=_e(n,Oe(n,"utf8"));return{format:vo(n),shortCircuit:!0,source:i}}if(r.startsWith("file:")&&Ve.test(r)){const n=Y(r),i=ho(n);return{format:"module",shortCircuit:!0,source:`export default ${he(i)};
|
|
8
|
+
`}}return t(o,s)},resolve(o,s,t){if((o.startsWith(".")||o.startsWith("/"))&&s.parentURL!==void 0){let r;try{r=new URL(o,s.parentURL)}catch{r=void 0}if(r?.protocol==="file:"){const n=Y(r),i=qe(n)??Ke(n);if(i!==void 0)return{shortCircuit:!0,url:ee(i).href}}}if(s.parentURL!==void 0&&!o.startsWith(".")&&!o.startsWith("/")&&!o.startsWith("#")&&!o.startsWith("node:")&&!de.isBuiltin?.(o)){let r;try{r=I(Y(s.parentURL))}catch{r=void 0}if(r!==void 0){const n=Je(o,r);if(n!==void 0)return{shortCircuit:!0,url:ee(n).href}}}return t(o,s)}}),$e=!0),!0)},wo=()=>Ge(),To=async e=>{if(ue+=1,Ge())return await import(`${ee(e).href}?v=${String(ue)}`);Se||(Se=!0,process.stderr.write(`vis: Node < 22.15 has no module.registerHooks — only the entry file is transpiled; local TypeScript imports won't load. Upgrade to Node >= 22.15 for full support.
|
|
9
|
+
`));const{code:o}=_e(e,Oe(e,"utf8")),s=w(I(e),`.vis-ts-${String(ue)}-${String(process.pid)}.mjs`);Ze(s,o);try{return await import(ee(s).href)}finally{try{et(s)}catch{}}},Io=Object.defineProperty({__proto__:null,importTs:To,registerTsHooks:wo,resolveTsConfigPaths:Je},Symbol.toStringTag,{value:"Module"});export{To as i,At as m,wo as r,Io as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p}from"./cli-main.js";import{A as b}from"../packem_shared/pm-runner-
|
|
1
|
+
import{p}from"./cli-main.js";import{A as b}from"../packem_shared/pm-runner-DRybtzOV.js";import{r as y,l as w,L as $}from"../packem_shared/dependency-scan-ZLOuLkGN.js";import{z as v,w as m,l as C}from"../packem_shared/index-BLtnel38.js";import{D as S}from"../packem_shared/package-version-BNRJ3o9C.js";import"../packem_shared/index-tNFGWxc0.js";import{e as x}from"../packem_shared/index-CuKDxOCI.js";const M=e=>{const s=e.trim();return s===""?!1:/^(?:git\+|git:\/\/|git@|ssh:\/\/)/i.test(s)||/^(?:github|gitlab|bitbucket|gist):/i.test(s)||/^[\w.-]+\/[\w.-]+(?:#.+)?$/.test(s)&&!s.includes("@")?!0:/^https?:\/\//i.test(s)},L=(e,s)=>{for(const t of s)if(t===e||t.endsWith("*")&&e.startsWith(t.slice(0,-1)))return!0;return!1},D=(e,s,t={})=>{const o=y(e,s);if(!o)return[];let i;try{i=v(m(e,o.file))}catch{return[]}const n=S(i,o.type);if(n.length===0)return[];const c=t.allow??[],l=[],f=new Set;for(const r of n){const a=`${r.name}@${r.version}`;for(const d of[r.dependencies,r.optionalDependencies])if(d){for(const[u,h]of Object.entries(d))if(!L(u,c))for(const k of h){if(!M(k))continue;const g=`${a}->${u}@${k}`;f.has(g)||(f.add(g),l.push({declaredBy:a,packageName:u,source:k}))}}}return l.sort((r,a)=>r.packageName.localeCompare(a.packageName)||r.declaredBy.localeCompare(a.declaredBy))},E=new Set(["firstSeen","publisherChange"]),N=e=>e.severity==="block"&&e.acceptedRisk===void 0,R=e=>{const s=e.security?.policies?.firstSeen?.minutes,t=typeof s=="number"&&s>0,o=e.security?.policies?.publisherChange?.mode==="no-downgrade",i=e.security?.blockExoticSubdeps===!0;return t||o||i},V=async e=>{const{offline:s=!1,packageManager:t,visConfig:o,workspaceRoot:i}=e,n=Date.now();if(!R(o))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!1,status:"skipped"};const c=y(i,t);if(!c||!C(m(i,c.file)))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!0,status:"fail"};const l=w(i,t,{includeDev:!0}),f=l.length,r=await x({offline:s,packageManager:t,packages:l,workspaceRoot:i},"install",{enabledPolicies:new Set(E),visConfig:o}),a=o.security?.blockExoticSubdeps===!0?D(i,t,{allow:o.security.exoticSubdepsAllow}):[],d=r.some(u=>N(u))||a.length>0;return{decisions:r,durationMs:Date.now()-n,entryCount:f,exoticViolations:a,lockfileMissing:!1,status:d?"fail":"pass"}},B=e=>e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`,P=e=>{if(e.status==="skipped")return["– Lockfile supply-chain verification skipped (no firstSeen / publisherChange / blockExoticSubdeps policy configured)"];if(e.lockfileMissing)return["✗ Lockfile supply-chain verification failed — no lockfile found, the resolved closure cannot be attested"];const s=`(${String(e.entryCount)} ${e.entryCount===1?"entry":"entries"}, ${B(e.durationMs)})`;if(e.status==="pass")return[`✓ Lockfile passes supply-chain policies ${s}`];const t=[`✗ Lockfile failed supply-chain policy check ${s}`];for(const o of e.decisions)o.severity==="block"&&o.acceptedRisk===void 0&&t.push(` [${o.policy}] ${o.reason}`);for(const o of e.exoticViolations)t.push(` [blockExoticSubdeps] ${o.packageName} pulled from exotic source by ${o.declaredBy}: ${o.source}`);return t},J=async({options:e,visConfig:s,workspaceRoot:t})=>{const o=t??process.cwd(),i=b(o);if(!$[i.name]){p.warn(`Package manager '${i.name}' has no lockfile vis can verify.`);return}const n=await V({offline:!!e.offline,packageManager:i.name,visConfig:s??{},workspaceRoot:o});if(e.json){process.stdout.write(`${JSON.stringify(n,void 0,2)}
|
|
2
2
|
`),n.status==="fail"&&(process.exitCode=1);return}const[c,...l]=P(n);if(n.status==="skipped"){p.info(c);return}if(n.status==="pass"){p.success(c);return}p.error(c);for(const f of l)p.error(f);process.exitCode=1};export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as R}from"node:module";import{
|
|
1
|
+
import{createRequire as R}from"node:module";import{K as M}from"./target-merge-DLxJTcxn.js";import{advisoriesQuery as j,advisoriesIngest as q,advisoriesStatus as _,NATIVE_BINDING_VERSION as f}from"#native";let D;const I=s=>(D??=R(import.meta.url))(s),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=s=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,t]=l.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return l.getBuiltinModule(s)}return I(s)},{randomUUID:$}=c("node:crypto"),{existsSync:T,createWriteStream:O}=c("node:fs"),{mkdir:P,unlink:U,stat:k}=c("node:fs/promises"),{join:g,dirname:x}=c("node:path"),{Readable:C}=c("node:stream"),{pipeline:L}=c("node:stream/promises"),w=6;if(f!==w)throw new Error(`vis native binding ABI mismatch in advisories: expected ${w}, got ${f}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const J="https://osv-vulnerabilities.storage.googleapis.com",W=new Set(["osv-vulnerabilities.storage.googleapis.com"]);class B extends Error{cause="DB_NOT_FOUND";constructor(e){super(`No local advisory DB at ${e}. Run 'vis advisories sync' first.`),this.name="AdvisoryDbNotFoundError"}}class p extends Error{cause="SOURCE_NOT_ALLOWED";constructor(e){super(`Advisory source host '${e}' is not in the built-in allowlist. Add it to \`security.audit.advisories.allowedHosts\` if intentional.`),this.name="AdvisorySourceNotAllowedError"}}class A extends Error{cause="SYNC_NETWORK";constructor(e,t){super(`Advisory sync failed for ${e}: ${t}. Check connectivity, proxy env vars, or --source.`),this.name="AdvisorySyncNetworkError"}}const y=s=>{const e=M("vis",{create:!0,cwd:s})??g(s,"node_modules",".cache","vis");return g(e,"advisories","db.sqlite")},V=(s,e)=>{let t;try{t=new URL(s)}catch{throw new p(s)}if(t.protocol!=="https:")throw new p(`${t.protocol}//${t.host}`);if(!new Set([...W,...e??[]]).has(t.host))throw new p(t.host);return t},X=async s=>{const e=s.dbPath??y(s.workspaceRoot);await P(x(e),{recursive:!0});const t=V(s.source,s.allowedHosts),d=new URL(`${s.ecosystem}/all.zip`,z(t.toString())),u=await H(e,s.ecosystem);let r=null;if(!s.force){const i=await b(d,{method:"HEAD"});if(i.ok&&(r=i.headers.get("etag"),r&&u&&r===u))return{advisoriesIngested:0,dbPath:e,durationMs:0,upToDate:!0}}const n=`${e}.${s.ecosystem}.${process.pid}.${$()}.zip.tmp`,o=await b(d,{method:"GET"});if(!o.ok||!o.body)throw new A(d.toString(),o.status);r||(r=o.headers.get("etag"));const v=o.headers.get("content-length"),a=v?Number.parseInt(v,10):null;let m=0;const E=O(n),h=C.fromWeb(o.body);s.onProgress&&a&&h.on("data",i=>{m+=i.byteLength,s.onProgress?.(m,a,"download")}),await L(h,E);try{const i=await q({dbPath:e,ecosystem:s.ecosystem,manifestEtag:r??void 0,zipPath:n},(S,N)=>s.onProgress?.(S,N,"ingest"));return{advisoriesIngested:i.advisoriesIngested,dbPath:e,durationMs:i.durationMs,upToDate:!1}}finally{await U(n).catch(()=>{})}},Z=(s,e)=>{if(s.length===0)return new Map;const t=e.dbPath??y(e.workspaceRoot),d=e.ecosystem??"npm";if(!T(t))throw new B(t);const u=s.map(o=>({ecosystem:d,name:o.name,version:o.version})),r=j(t,u),n=new Map;for(const[o,v]of s.entries()){const a=r[o];!a||a.vulnerabilities.length===0||n.set(v.name,a.vulnerabilities.map(m=>F(m)))}return n},ss=async(s,e)=>{const t=e??y(s);return _(t)},H=async(s,e)=>{try{await k(s)}catch{return null}return _(s).ecosystems.find(t=>t.name===e)?.manifestEtag??null},F=s=>({aliases:s.aliases.length>0?s.aliases:void 0,cvssScore:s.cvssScore??void 0,fixedVersions:s.fixedVersions,id:s.id,severity:K(s.severity),summary:s.summary}),K=s=>{const e=s.toUpperCase();return e==="CRITICAL"||e==="HIGH"||e==="MODERATE"||e==="LOW"?e:"UNKNOWN"},z=s=>s.endsWith("/")?s:`${s}/`,b=async(s,e)=>{try{return await fetch(s,e)}catch(t){throw new A(s.toString(),t instanceof Error?t.message:String(t))}};export{B as A,J as D,ss as g,Z as q,y as r,X as s};
|