@visulima/vis 6.0.0 → 6.1.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 +49 -0
- package/LICENSE.md +89 -152
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +4 -4
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +52 -61
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +150 -152
- package/dist/packem_chunks/dart-plan.js +1 -1
- package/dist/packem_chunks/dart-projects.js +1 -1
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +4 -4
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +4 -4
- 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 +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +4 -4
- 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/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +2 -2
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +7 -7
- package/dist/packem_chunks/handler61.js +3 -3
- package/dist/packem_chunks/handler62.js +2 -2
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +2 -2
- package/dist/packem_chunks/handler65.js +4 -4
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +20 -31
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +6 -6
- package/dist/packem_chunks/handler71.js +26 -46
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +17 -17
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +2 -2
- package/dist/packem_chunks/handler78.js +31 -31
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +7 -40
- package/dist/packem_chunks/index2.js +11 -11
- package/dist/packem_chunks/index6.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +1 -1
- package/dist/packem_chunks/prompts.js +1 -1
- 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 +5 -5
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/Table-Bo1JKNCN-CGGet8ES.js +34 -0
- package/dist/packem_shared/{affected-selection-DDxwjwM4.js → affected-selection-DGb6Xu5K.js} +1 -1
- package/dist/packem_shared/{affected-shas-BuaWvmsG.js → affected-shas-B_kfSKss.js} +1 -1
- package/dist/packem_shared/{ai-fix-C2BhFFhi.js → ai-fix-D9MxigBQ.js} +5 -5
- package/dist/packem_shared/{augment-CxUPE8KX.js → augment-B9kSZuvW.js} +1 -1
- package/dist/packem_shared/{bin-Be7_QhQK.js → bin-AZQv95jh.js} +1 -1
- package/dist/packem_shared/{build-scripts-DxyVSkgM.js → build-scripts-CEDx_nJp.js} +1 -1
- package/dist/packem_shared/{command-runtime-BXvH5EC0.js → command-runtime-HSsYGCQd.js} +1 -1
- package/dist/packem_shared/{dart-pubspec-DvmyleIr.js → dart-pubspec-BK_cK2EP.js} +2 -2
- package/dist/packem_shared/dependency-scan-CawAKoU_.js +1 -0
- package/dist/packem_shared/detect-CbMRSXkM.js +1 -0
- package/dist/packem_shared/{docker-BTuwdXaC.js → docker-DXqV-07f.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-BpQNUJzN.js → ecosystem-gate-DiqQj0LJ.js} +1 -1
- package/dist/packem_shared/env-consistency-B4rU4MQb.js +1 -0
- package/dist/packem_shared/{failure-log-kp0n2rbD.js → failure-log-BP-gCUb5.js} +1 -1
- package/dist/packem_shared/{formatBytes-BHAzNIrn-DRcKvqnb.js → formatBytes-_HvjOy8a-B_qQr4Hw.js} +3 -3
- package/dist/packem_shared/{getRandomSpinner-4ZEcbTYv-DCyIuj19.js → getRandomSpinner-DX11qCB2-CoIsn7ZU.js} +1 -1
- package/dist/packem_shared/index-BisalDCf.js +39 -0
- package/dist/packem_shared/{index-BdMIfGVZ.js → index-BzhrR_iC.js} +15 -15
- package/dist/packem_shared/{index-DQfNpt2u.js → index-CDHP1kby.js} +1 -1
- package/dist/packem_shared/{index-DsSWb5XH.js → index-JRb5wabN.js} +1 -1
- package/dist/packem_shared/index.server-Ca_EEVfw.js +2 -0
- package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-BwaMhQs0.js → isAccessibleSync-DYKTrrvc-C-_5cgwu.js} +1 -1
- package/dist/packem_shared/{lifecycle-BAhkhE2L.js → lifecycle-DvmDIRbb.js} +1 -1
- package/dist/packem_shared/{lockfile-DHmlPGk1.js → lockfile-CiUtEbnt.js} +1 -1
- package/dist/packem_shared/{manifests-Dd4Hoztt.js → manifests-Du4yKlf_.js} +1 -1
- package/dist/packem_shared/{min-release-age-BJnOQaoF.js → min-release-age-JViyQuBM.js} +1 -1
- package/dist/packem_shared/{missing-package-json-DfzrGwe1.js → missing-package-json-Cu5YVAot.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-BIa6xvJc.js → multi-eco-lockfiles-B2X3yhyo.js} +1 -1
- package/dist/packem_shared/{native-config-sync-Dr9XvxOf.js → native-config-sync-TdTWjVgI.js} +1 -1
- package/dist/packem_shared/osv-bloom-BCAX5ARR.js +2 -0
- package/dist/packem_shared/package-version-KLwH0Ivy.js +4 -0
- package/dist/packem_shared/{packument-C9nRiBJf.js → packument-zb18Jnlw.js} +1 -1
- package/dist/packem_shared/{pm-runner-ImwtpnWY.js → pm-runner-RM72mDZg.js} +1 -1
- package/dist/packem_shared/{project-name-filter-C2rkW-Vn.js → project-name-filter-B1ZCsbOW.js} +1 -1
- package/dist/packem_shared/{provenance-DF-ypZj3.js → provenance-L1M2FPy_.js} +1 -1
- package/dist/packem_shared/{readJsonSync-CbryXYxN-Bm5i10UW.js → readJsonSync-CbryXYxN-EWl7_7KX.js} +1 -1
- package/dist/packem_shared/{registry-keys-BLuHOyZu.js → registry-keys-DxdqMzyp.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BDaQRR6o.js → resolve-explicit-CQa37JSq.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-Cr19Pk6L.js → resolve-runtime-DNukUjIr.js} +1 -1
- package/dist/packem_shared/{run-file-XbRCF6Mp.js → run-file-UBukWaha.js} +1 -1
- package/dist/packem_shared/runtime-check-D3cRDuoi.js +1 -0
- package/dist/packem_shared/{s1ngularity-UCZN7skW.js → s1ngularity-CO5GkkqX.js} +1 -1
- package/dist/packem_shared/scaffold-files-DVyfB0yz.js +28 -0
- package/dist/packem_shared/{scan-progress-DcYI76zE.js → scan-progress-RwCRxJdX.js} +1 -1
- package/dist/packem_shared/{selectors-DCiEU0iv.js → selectors-edwcgNl3.js} +2 -2
- package/dist/packem_shared/{signatures-CicxPHN4.js → signatures-DIqFUOfs.js} +1 -1
- package/dist/packem_shared/spinner-BJjbNl1F.js +1 -0
- package/dist/packem_shared/target-merge-DVJl-7Qz.js +4 -0
- package/dist/packem_shared/{target-options-PgWIuJnb.js → target-options-DsHFmRZH.js} +1 -1
- package/dist/packem_shared/{task-env-Dl08aklA.js → task-env-DzR4RkOj.js} +1 -1
- package/dist/packem_shared/toolchain-CP79HNVy.js +5 -0
- package/dist/packem_shared/{typosquats-DxPzyK7u.js → typosquats-D4DEHhFy.js} +1 -1
- package/dist/packem_shared/{verify-CadR9PUk.js → verify-B_MblU_Q.js} +1 -1
- package/dist/packem_shared/{vis-update-app-DrFWQyPn.js → vis-update-app-9b2kSk9f.js} +1 -1
- package/dist/packem_shared/{vis-user-error-k7CLTpA4.js → vis-user-error-CRmrBaD1.js} +15 -15
- package/dist/packem_shared/{watch-Dr_6yz3o.js → watch-CcTketln.js} +1 -1
- package/dist/packem_shared/watch-loop-D1_e-qIl.js +11 -0
- package/dist/packem_shared/{writeFileSync-DJoHk3Ks-Dhem3Uof.js → writeFileSync-DJoHk3Ks-BPRoepNw.js} +1 -1
- package/dist/runtime/preload.js +1 -1
- package/index.js +26 -26
- package/package.json +12 -12
- package/dist/packem_shared/dependency-scan-DKK3ZEZI.js +0 -1
- package/dist/packem_shared/env-consistency-CUBJHENL.js +0 -1
- package/dist/packem_shared/index-C9ENZqH9.js +0 -39
- package/dist/packem_shared/index.server-D8BLnYZO.js +0 -2
- package/dist/packem_shared/osv-bloom-t40ra5U5.js +0 -2
- package/dist/packem_shared/package-version-CFuNUWDG.js +0 -4
- package/dist/packem_shared/runtime-check-Bh5q9IrT.js +0 -1
- package/dist/packem_shared/spinner-ukDEdGvp.js +0 -1
- package/dist/packem_shared/target-merge-BClIXg2k.js +0 -14
- package/dist/packem_shared/toolchain-DvUxlbDz.js +0 -5
- package/dist/packem_shared/watch-loop-BId9vT7Q.js +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as ws}from"node:module";import{VersionActions as C}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{VisReleaseError as g}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import Ue from"./index.js";import{tagExists as ue,renderTagPattern as z,defaultTagFor as Be}from"./git.js";import{a as Cs,s as ge,o as me,i as he}from"../packem_shared/gradle-build-CHZDHyjI.js";import{
|
|
1
|
+
import{createRequire as ws}from"node:module";import{VersionActions as C}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{VisReleaseError as g}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import Ue from"./index.js";import{tagExists as ue,renderTagPattern as z,defaultTagFor as Be}from"./git.js";import{a as Cs,s as ge,o as me,i as he}from"../packem_shared/gradle-build-CHZDHyjI.js";import{L as Ps}from"../packem_shared/index-BisalDCf.js";import{resolveCleanStripList as Ns}from"./DEFAULT_CLEAN_KEEP.js";import{assertValidPackageName as x,resolveCustomCommands as re,interpolateCommand as te}from"./security.js";let bs;const ys=r=>(bs??=ws(import.meta.url))(r),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=r=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[e,s]=F.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return F.getBuiltinModule(r)}return ys(r)},{readFile:P,readdir:ce,rm:le,access:Fe,writeFile:B,mkdtemp:ks}=U("node:fs/promises"),{isAbsolute:G,join:f,dirname:E,resolve:Me,relative:Te,sep:Ge,basename:j}=U("node:path"),{realpathSync:vs,mkdtempSync:se,writeFileSync:$s}=U("node:fs"),{fileURLToPath:Is}=U("node:url"),{tmpdir:J}=U("node:os"),As=["dependencies","devDependencies","peerDependencies","optionalDependencies"],We=(r,e)=>{if(r.startsWith("catalog:")||r==="*"||r==="workspace:*"||r==="workspace:^"||r==="workspace:~")return r;if(r.startsWith("workspace:")){const t=r.slice(10);return`workspace:${ee(t)}${e}`}if(r.startsWith("npm:")){const t=r.lastIndexOf("@");if(t<=4)return r;const n=r.slice(4,t),a=r.slice(t+1),i=ee(a);return`npm:${n}@${i}${e}`}return`${ee(r)}${e}`},_s=/^([\^~=]|>=?|<=?)/,ee=r=>{const e=_s.exec(r);return e?e[1]??"^":"^"},bt=async(r,e,s={})=>{const t=s.serializeManifest??Ds,n=s.changelogPath??Ls,a=s.renderChangelogEntry??Rs,i=new Map(r.releases.map(d=>[d.name,d.newVersion])),o=await Promise.all(r.releases.map(async d=>{const p=e.getPackage(d.name);if(!p)return;const u=Ss(p.manifest,d.newVersion,i),m=s.readManifest?.(p.manifestPath),h=n(p);return{changelogEntry:await a(d),changelogPath:h,manifestWrite:p.ecosystem===void 0?{content:t(u,m),path:p.manifestPath}:void 0}})),c=[],l=new Map;for(const d of o){if(!d)continue;d.manifestWrite&&c.push(d.manifestWrite);const p=l.get(d.changelogPath);p?p.push(d.changelogEntry):l.set(d.changelogPath,[d.changelogEntry])}for(const[d,p]of l){const u=p.join(`
|
|
2
2
|
|
|
3
3
|
`),m=s.readChangelog?.(d);c.push({content:Es(u,m),path:d})}return{deletions:r.consumedChangeFiles.map(d=>d.path),writes:c}},Ss=(r,e,s)=>{const t={...r,version:e};for(const n of As){const a=r[n];if(!a||typeof a!="object")continue;const i={...a};let o=!1;for(const[c,l]of Object.entries(a)){const d=s.get(c);if(d===void 0)continue;const p=We(l,d);p!==l&&(i[c]=p,o=!0)}o&&(t[n]=i)}return t},Vs=/^# .+/,Os=/^## /m,Es=(r,e)=>{const s=r.trim();if(!e||e.trim()==="")return`# Changelog
|
|
4
4
|
|
|
@@ -11,12 +11,12 @@ ${s}
|
|
|
11
11
|
${e.trimStart()}`:`${s}
|
|
12
12
|
|
|
13
13
|
${e.trimStart()}`},Ds=(r,e)=>{const s=js(e);return`${JSON.stringify(r,null,s)}
|
|
14
|
-
`},js=r=>{if(!r)return 4;const e=/\n(\s+)"/.exec(r);if(!e)return 4;const s=(e[1]??"").length;return s===2||s===4?s:4},
|
|
15
|
-
`)},
|
|
14
|
+
`},js=r=>{if(!r)return 4;const e=/\n(\s+)"/.exec(r);if(!e)return 4;const s=(e[1]??"").length;return s===2||s===4?s:4},Ls=r=>`${r.dir}/CHANGELOG.md`,Rs=r=>{const e=new Date().toISOString().slice(0,10),s=[`## ${r.newVersion}`,`<sub>${e}</sub>`,""];if(r.isCascadeBump||r.isGroupBump)for(const t of r.sources)s.push(`- Version bump from ${t.name}@${t.newVersion}`);else if(r.isDependencyBump&&r.changeFiles.length===0)for(const t of r.sources)t.newVersion===""?s.push(`- Removed dependency ${t.name}`):s.push(`- Updated dependency ${t.name}@${t.newVersion}`);else for(const t of r.changeFiles)for(const n of t.body.split(/\r?\n/)){if(n.trim()===""){s.push("");continue}s.push(n.startsWith("-")||n.startsWith("*")?n:`- ${n}`)}return s.join(`
|
|
15
|
+
`)},Fs=["dependencies","devDependencies","peerDependencies","optionalDependencies"],fe={default:{},named:{}},Ms=r=>{if(!r)return fe;let e;try{e=Ps(r,{strict:!0})}catch(n){throw new g({cause:n,code:"CONFIG_INVALID",message:`Failed to parse pnpm-workspace.yaml: ${n.message}`})}if(typeof e!="object"||e===null||Array.isArray(e))return fe;const s=e,t={default:{},named:{}};if(typeof s.catalog=="object"&&s.catalog!==null&&!Array.isArray(s.catalog))for(const[n,a]of Object.entries(s.catalog))typeof a=="string"&&(t.default[n]=a);if(typeof s.catalogs=="object"&&s.catalogs!==null&&!Array.isArray(s.catalogs))for(const[n,a]of Object.entries(s.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);t.named[n]=i}return t},He=(r,e,s)=>{if(!r.startsWith("catalog:"))return r;const t=r.slice(8),n=t===""?s.default:s.named[t];if(n)return n[e]},de=(r,e)=>{const s={...r};for(const t of Fs){const n=r[t];if(!n||typeof n!="object")continue;const a={...n};for(const[i,o]of Object.entries(n)){if(!o.startsWith("catalog:"))continue;const c=He(o,i,e);if(c===void 0)throw new g({code:"CONFIG_INVALID",message:`Cannot resolve "${o}" for dependency "${i}" in package "${r.name}". Add it to pnpm-workspace.yaml's "catalog" or "catalogs" block.`,packageName:r.name});a[i]=c}s[t]=a}return s},yt=Object.defineProperty({__proto__:null,parseCatalogs:Ms,resolveCatalogRef:He,rewriteCatalogRefs:de},Symbol.toStringTag,{value:"Module"}),Ke={"Cargo.toml":"cargo","tauri.conf.json":"tauri"},pe=Object.keys(Ke),Ts=r=>r.replaceAll("\\","/").split("/").pop()??r,R=r=>Ke[Ts(r)],Gs=new Set(["package","workspace.package"]),Us=/^\s*\[\[?\s*([^\]]+?)\s*\]\]?\s*(?:#.*)?$/,Bs=/^(\s*version\s*=\s*)(["'])[^"']*\2/,qe=(r,e,s=Gs)=>{const t=r.split(`
|
|
16
16
|
`);let n="",a=!1;for(let i=0;i<t.length;i++){const o=t[i],c=Us.exec(o);if(c){n=c[1].replaceAll(/\s+/g,"");continue}if(!s.has(n))continue;const l=Bs.exec(o);l&&(a=!0,t[i]=`${l[1]}${l[2]}${e}${l[2]}${o.slice(l[0].length)}`)}return a?{content:t.join(`
|
|
17
|
-
`),found:a}:{found:a}},Je=(r,e)=>{const s=[];let t,n=0;for(;n<r.length;){const a=r[n];if(a==="{"||a==="["){s.push({isObject:a==="{",key:t}),t=void 0,n++;continue}if(a==="}"||a==="]"){s.pop(),t=void 0,n++;continue}if(a===","){t=void 0,n++;continue}if(a!=='"'){n++;continue}const i=n;for(n++;n<r.length&&r[n]!=='"';)n+=r[n]==="\\"?2:1;n++;const o=r.slice(i,n);let c=n;for(;c<r.length&&/\s/.test(r[c]);)c++;if(r[c]===":"){t=JSON.parse(o),n=c+1;continue}const l=s[s.length-1];if(t!==void 0&&l?.isObject){const d=[...s.slice(1).map(p=>p.key??""),t];if(d.length===e.length&&d.every((p,u)=>p===e[u]))return{end:n,start:i,value:JSON.parse(o)}}}},Ye=r=>{if(typeof r!="object"||r===null)return;const e=r;if(typeof e.version=="string")return["version"];if(typeof e.package?.version=="string")return["package","version"]},Xe=(r,e)=>{let s;try{s=JSON.parse(r)}catch{return{delegated:!1,found:!1}}const t=Ye(s);if(!t)return{delegated:!1,found:!1};const n=Je(r,t);return n?n.value.startsWith(".")||n.value.startsWith("/")?{delegated:!0,found:!0}:{content:`${r.slice(0,n.start)}${JSON.stringify(e)}${r.slice(n.end)}`,delegated:!1,found:!0}:{delegated:!1,found:!1}},ze=async(r,e)=>{const s=
|
|
17
|
+
`),found:a}:{found:a}},Je=(r,e)=>{const s=[];let t,n=0;for(;n<r.length;){const a=r[n];if(a==="{"||a==="["){s.push({isObject:a==="{",key:t}),t=void 0,n++;continue}if(a==="}"||a==="]"){s.pop(),t=void 0,n++;continue}if(a===","){t=void 0,n++;continue}if(a!=='"'){n++;continue}const i=n;for(n++;n<r.length&&r[n]!=='"';)n+=r[n]==="\\"?2:1;n++;const o=r.slice(i,n);let c=n;for(;c<r.length&&/\s/.test(r[c]);)c++;if(r[c]===":"){t=JSON.parse(o),n=c+1;continue}const l=s[s.length-1];if(t!==void 0&&l?.isObject){const d=[...s.slice(1).map(p=>p.key??""),t];if(d.length===e.length&&d.every((p,u)=>p===e[u]))return{end:n,start:i,value:JSON.parse(o)}}}},Ye=r=>{if(typeof r!="object"||r===null)return;const e=r;if(typeof e.version=="string")return["version"];if(typeof e.package?.version=="string")return["package","version"]},Xe=(r,e)=>{let s;try{s=JSON.parse(r)}catch{return{delegated:!1,found:!1}}const t=Ye(s);if(!t)return{delegated:!1,found:!1};const n=Je(r,t);return n?n.value.startsWith(".")||n.value.startsWith("/")?{delegated:!0,found:!0}:{content:`${r.slice(0,n.start)}${JSON.stringify(e)}${r.slice(n.end)}`,delegated:!1,found:!0}:{delegated:!1,found:!1}},ze=async(r,e)=>{const s=R(r);if(s==="cargo"){const{parse:t}=await import("./index4.js"),n=t(e),a=n.package?.version,i=typeof a=="string"?a:n.workspace?.package?.version;return typeof i=="string"?{version:i}:void 0}if(s==="tauri"){let t;try{t=JSON.parse(e)}catch{return}const n=Ye(t);if(!n)return;const a=Je(e,n);return a?a.value.startsWith(".")||a.value.startsWith("/")?{delegated:!0}:{version:a.value}:void 0}},Qe=(r,e)=>{for(const s of e)if(!R(s))throw new g({code:"CONFIG_INVALID",hint:`Supported basenames: ${pe.join(", ")}. Use extraFiles for other manifests.`,message:`versionFiles entry "${s}" for ${r} is not a supported version manifest.`})},Ws=async(r,e,s,t,n=new Map)=>{Qe(t,e);const a=[];for(const i of e){const o=R(i),c=G(i)?i:f(r,i);let l=n.get(c);if(l===void 0)try{l=await P(c,"utf8")}catch(p){const u=p.code==="ENOENT"?"does not exist":`could not be read (${p.message})`;throw new g({code:"CONFIG_INVALID",file:c,message:`versionFiles: ${t} → ${c} ${u}.`})}const d=o==="cargo"?qe(l,s):Xe(l,s);if(!d.found)throw new g({code:"CONFIG_INVALID",file:c,message:`versionFiles: ${t} → no version field found in ${c}.`});d.content!==void 0&&d.content!==l&&a.push({content:d.content,path:c})}return{writes:a}},Hs=async r=>{const{entry:e,packageDir:s,packageName:t,packageVersion:n}=r,a=`version-files/${t}/${e}`,i=G(e)?e:f(s,e);if(!R(e))return{message:`${t}: versionFiles entry "${e}" is not a supported manifest. Supported basenames: ${pe.join(", ")}.`,name:a,severity:"warn",status:"fail"};let o;try{o=await P(i,"utf8")}catch{return{message:`${t}: versionFiles entry "${e}" doesn't exist (expected ${i}).`,name:a,severity:"warn",status:"fail"}}let c;try{c=await ze(e,o)}catch(l){return{message:`${t}: could not parse ${i}: ${l.message}`,name:a,severity:"warn",status:"fail"}}return c?.delegated?{message:`${e} of ${t} delegates its version to another file.`,name:a,severity:"info",status:"pass"}:c?.version===void 0?{message:`${t}: no version field found in ${i}.`,name:a,severity:"warn",status:"fail"}:c.version===n?{message:`${e} of ${t} matches package.json (${n}).`,name:a,severity:"info",status:"pass"}:{message:`${t}: ${e} declares ${c.version} but package.json declares ${n}. Set the two to the same version by hand; the next release only rewrites them when it bumps the package.`,name:a,severity:"warn",status:"fail"}},kt=Object.defineProperty({__proto__:null,SUPPORTED_VERSION_FILES:pe,applyVersionFilesForRelease:Ws,assertSupportedVersionFiles:Qe,checkVersionFile:Hs,readManifestVersion:ze,resolveVersionFileKind:R,rewriteCargoVersion:qe,rewriteTauriVersion:Xe},Symbol.toStringTag,{value:"Module"}),Ks="[[package]]",Ze=(r,e,s)=>{const t=r.split(`
|
|
18
18
|
`);let n=!1,a=-1;const i=[];for(const[o,c]of t.entries())c.trim()===Ks&&(a!==-1&&i.push({end:o,start:a}),a=o);a!==-1&&i.push({end:t.length,start:a});for(const{end:o,start:c}of i){let l,d=-1,p=!1;for(let u=c+1;u<o;u++){const m=t[u],h=/^name\s*=\s*"([^"]+)"\s*$/.exec(m),b=/^version\s*=\s*"[^"]*"\s*$/.exec(m);h&&l===void 0?[,l]=h:b&&d===-1?d=u:/^source\s*=/.test(m)&&(p=!0)}l!==e||p||d===-1||(t[d]=`version = "${s}"${t[d].endsWith("\r")?"\r":""}`,n=!0)}return n?{content:t.join(`
|
|
19
|
-
`),found:n}:{found:n}},R=r=>{const e=Me(r);try{return vs.native(e)}catch{return e}},xe=async(r,e)=>es(r,e,"Cargo.lock"),es=async(r,e,s)=>{const t=R(e);let n=R(r);for(;;){const a=f(n,s);try{return await P(a,"utf8"),a}catch{}if(n===t)return;const i=E(n),o=Te(t,i);if(i===n||o.startsWith("..")||G(o))return;n=i}},ss=async(r,e)=>{const{parse:s}=await import("./index4.js");try{const t=s(r);return typeof t.package?.name=="string"?t.package.name:void 0}catch(t){throw new g({cause:t,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${t.message}`})}},qs=(r,e)=>{const s=new Set;for(const t of e.versionFiles??[])F(t)==="cargo"&&s.add(G(t)?t:f(r,t));if(e.versionActions==="cargo"){const t=e.cargoTomlPath??"Cargo.toml";s.add(G(t)?t:f(r,t))}return[...s]},Js=async r=>{const{entries:e,pending:s,workspaceRoot:t}=r,n=[],a=[];for(const{manifestPath:i,newVersion:o}of e){let c=s.get(i);if(c===void 0)try{c=await P(i,"utf8")}catch{continue}const l=await ss(c,i);if(l===void 0)continue;const d=await xe(E(i),t);if(d===void 0)continue;let p=s.get(d);p===void 0&&(p=await P(d,"utf8"));const u=Ze(p,l,o);if(!u.found){n.push(`cargo-lock: ${l} has no workspace-member entry in ${d}; run \`cargo generate-lockfile\` or build once to add it.`);continue}if(u.content!==void 0&&u.content!==p){s.set(d,u.content);const m=a.findIndex(b=>b.path===d),h={content:u.content,path:d};m===-1?a.push(h):a[m]=h}}return{warnings:n,writes:a}},vt=Object.defineProperty({__proto__:null,canonicalPath:R,cargoManifestPaths:qs,findCargoLock:xe,findLockfile:es,readCrateName:ss,rewriteCargoLockVersion:Ze,syncCargoLocks:Js},Symbol.toStringTag,{value:"Module"}),Ys=async(r,e)=>{let s=[r];for(const t of e.split("/").filter(n=>n!==""&&n!==".")){if(t==="**")throw new g({code:"CONFIG_INVALID",message:`Unsupported [workspace].members pattern "${e}": "**" is not supported. List the crate directories explicitly or use "dir/*".`});const n=/[*?[{]/.test(t),a=[];for(const i of s){if(!n){a.push(f(i,t));continue}const o=await ce(i,{withFileTypes:!0}).catch(()=>[]);for(const c of o)c.isDirectory()&&Ue(t,c.name)&&a.push(f(i,c.name))}s=a}return s},Xs=(r,e)=>{for(const s of e)if(r===s||r.startsWith(`${s}${Ge}`))return!0;return!1},rs=async r=>{let e=E(R(r));for(;;){const s=f(e,"Cargo.toml"),t=await ne(s);if(t!==void 0){const i=(await Y(t,s)).workspace?.package?.version;if(typeof i=="string")return i}const n=E(e);if(n===e)return;e=n}},ne=async r=>{try{return await P(r,"utf8")}catch{return}},Y=async(r,e)=>{const{parse:s}=await import("./index4.js");try{return s(r)}catch(t){throw new g({cause:t,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${t.message}`})}},we=r=>Array.isArray(r)?r.filter(e=>typeof e=="string"):[],Q=r=>typeof r=="object"&&r!==null&&r.workspace===!0,zs=(r,e)=>{const s=Q(r.publish)?e.workspace?.package?.publish:r.publish;return s===!1||Array.isArray(s)&&s.length===0},Qs=(r,e,s,t)=>{const n=[];for(const[a,i]of Object.entries(r.dependencies??{})){const o=i,c=Q(o),l=c?e.workspace?.dependencies?.[a]:o,d=c?t:s;l===void 0||typeof l!="object"||typeof l.path!="string"||n.push({dir:Me(d,l.path),name:typeof l.package=="string"?l.package:a,requirement:typeof l.version=="string"?l.version:"*"})}return n},Zs=async r=>{const{claimedDirs:e,cwd:s}=r,t=f(s,"Cargo.toml"),n=await ne(t);if(n===void 0)return[];const a=await Y(n,t),i=new Set;a.package&&i.add(s);const o=we(a.workspace?.exclude);for(const p of we(a.workspace?.members))for(const u of await Ys(s,p)){const m=Te(s,u).split(Ge).join("/");m.split("/").includes("target")||o.some(h=>Ue(h,m))||i.add(u)}const c=new Set([...e].map(p=>R(p))),l=[];for(const p of[...i].sort()){if(Xs(R(p),c))continue;const u=f(p,"Cargo.toml"),m=await ne(u);if(m===void 0)continue;const h=await Y(m,u);if(!h.package)continue;const{name:b}=h.package;if(typeof b!="string"||b==="")throw new g({code:"CONFIG_INVALID",file:u,message:`${u} has a [package] table without a name.`});const N=h.package.version,k=typeof N=="string"?N:Q(N)?a.workspace?.package?.version:void 0;if(typeof k!="string")throw new g({code:"CONFIG_INVALID",file:u,message:`${u} has no resolvable [package].version.`});l.push({dir:p,manifestPath:u,name:b,pathDeps:Qs(h,a,p,s),private:zs(h.package,a),version:k})}const d=new Map(l.map(p=>[p.dir,p]));return l.map(p=>{const u={};for(const h of p.pathDeps){const b=d.get(h.dir);b&&(u[b.name]=h.requirement)}const m={dependencies:u,name:p.name,private:p.private,version:p.version};return{dir:p.dir,ecosystem:"cargo",manifest:m,manifestPath:p.manifestPath,name:p.name,private:p.private,version:p.version}})},$t=Object.defineProperty({__proto__:null,discoverCargoCrates:Zs,findInheritedWorkspaceVersion:rs,inheritsFromWorkspace:Q,parseCargoDoc:Y},Symbol.toStringTag,{value:"Module"}),xs="ACTIONS_ID_TOKEN_REQUEST_URL",ts=r=>{const e=!!r.env[xs],s=!!r.env[r.staticTokenVar],t=r.workspaceConfig?.publish?.preferStaticToken===!0;return e&&!(t&&s)?"oidc":s?"token":"missing"};let W;const er="https://github.com/visulima/visulima",sr=async()=>{try{let e=E(Is(import.meta.url));for(let s=0;s<6;s+=1){const t=f(e,"package.json");try{const a=await P(t,"utf8"),i=JSON.parse(a);if(i.name==="@visulima/vis"&&typeof i.version=="string")return i.version}catch{}const n=E(e);if(n===e)break;e=n}}catch{}return"unknown"},rr=async()=>(W!==void 0||(W=`vis-release/${await sr()} (+${er})`),W),be=new Map,tr=async r=>{const e=be.get(r);if(e!==void 0)return e;try{const s=await import("./index7.js").then(n=>n.i),t=new s.ProxyAgent(r);return be.set(r,t),t}catch{return}},nr=r=>r===301||r===302||r===303||r===307||r===308,ar=(r,e)=>{try{const s=new URL(r),t=new URL(e);return s.host===t.host&&s.protocol===t.protocol}catch{return!1}},S=async(r,e={})=>{const s=e.maxRedirects??2,n={"User-Agent":await rr(),...e.headers};e.headers?.["User-Agent"]&&(n["User-Agent"]=e.headers["User-Agent"]);let a=r,i=0;const o=e.httpProxy?await tr(e.httpProxy):void 0;for(;;){let c;try{const p=e.fetchImpl??globalThis.fetch,u={headers:n,method:e.method??"GET",redirect:"manual"};o&&(u.dispatcher=o),c=await p(a,u)}catch{return{json:async()=>{},ok:!1,status:0,text:async()=>""}}if(!nr(c.status))return{json:async()=>{try{return await c.json()}catch{return}},ok:c.ok,status:c.status,text:async()=>{try{return await c.text()}catch{return""}}};const l=c.headers.get("location")??c.headers.get("Location");if(!l||i>=s)return{json:async()=>{},ok:!1,status:0,text:async()=>""};let d;try{d=new URL(l,a).toString()}catch{return{json:async()=>{},ok:!1,status:0,text:async()=>""}}if(!ar(r,d))return{json:async()=>{},ok:!1,status:0,text:async()=>""};a=d,i+=1}},ir="https://crates.io/api/v1/crates",or="Cargo.toml",ye=async r=>{let e;try{e=await P(r,"utf8")}catch(o){throw new g({cause:o,code:"CONFIG_INVALID",file:r,message:`Failed to read Cargo.toml at ${r}: ${o.message}`})}const{parse:s}=await import("./index4.js");let t;try{t=s(e)}catch(o){throw new g({cause:o,code:"CONFIG_INVALID",file:r,message:`Failed to parse Cargo.toml at ${r}: ${o.message}`})}if(!t.package)throw new g({code:"CONFIG_INVALID",file:r,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 ${r} has no [package] table.`});const{name:n}=t.package;if(typeof n!="string"||n.length===0)throw new g({code:"CONFIG_INVALID",file:r,message:`Cargo.toml at ${r} is missing [package].name.`});const a=t.package.version;let i;if(typeof a=="string"?i=a:a&&typeof a=="object"&&a.workspace===!0&&(i=await rs(r)??t.workspace?.package?.version),typeof i!="string"||i.length===0)throw new g({code:"CONFIG_INVALID",file:r,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 ${r} has no resolvable [package].version.`});return{name:n,version:i}},ke=async(r,e)=>{const s=`${ir}/${encodeURIComponent(r)}`;try{const t=await S(s,{headers:{Accept:"application/json"},httpProxy:e});if(t.status===404||!t.ok)return;const n=await t.json();return n?.crate?.max_stable_version??n?.crate?.max_version??void 0}catch{return}},cr=(r,e)=>ts({env:r,staticTokenVar:"CARGO_REGISTRY_TOKEN",workspaceConfig:e})==="oidc",lr=async(r,e)=>{const s=await r.run("cargo",["package","--list","--allow-dirty"],{cwd:e,silent:!0});return s.exitCode!==0?[]:s.stdout.split(/\r?\n/).map(t=>t.trim()).filter(t=>t.length>0)};class ur extends C{id="cargo";async readPublishedVersion(e){const s=ae(e.pkg);try{const{name:t}=await ye(s);return await ke(t)}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run / cargo] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const s=ae(e.pkg,e.perPackageConfig),t=dr(e.pkg,e.perPackageConfig),{name:n,version:a}=await ye(s);if(a!==e.release.newVersion)throw new g({code:"CONFIG_INVALID",file:s,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 ke(n,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[cargo] ${n}@${e.release.newVersion} already on crates.io`,published:!1};const o=cr(process.env,e.workspaceConfig);if(!o&&!process.env.CARGO_REGISTRY_TOKEN)throw new g({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 ${n}@${e.release.newVersion}: neither CARGO_REGISTRY_TOKEN nor OIDC trusted publishing is available.`,packageName:e.pkg.name});const c=e.workspaceConfig?.publish?.guards;if(c?.packSecretScan){const p=await lr(e.pm.runner,t);if(p.length>0){const{runPackSecretScan:u}=await import("./publish-guards.js"),m=typeof c.packSecretScan=="object"?c.packSecretScan.ignore:void 0,h=await u({files:p,ignore:m,pkgDir:t});if(!h.passed){const{redactTokens:b}=await import("./security.js"),N=h.findings.map(k=>` • [packSecretScan] ${b(k.message)}${k.hint?`
|
|
19
|
+
`),found:n}:{found:n}},L=r=>{const e=Me(r);try{return vs.native(e)}catch{return e}},xe=async(r,e)=>es(r,e,"Cargo.lock"),es=async(r,e,s)=>{const t=L(e);let n=L(r);for(;;){const a=f(n,s);try{return await P(a,"utf8"),a}catch{}if(n===t)return;const i=E(n),o=Te(t,i);if(i===n||o.startsWith("..")||G(o))return;n=i}},ss=async(r,e)=>{const{parse:s}=await import("./index4.js");try{const t=s(r);return typeof t.package?.name=="string"?t.package.name:void 0}catch(t){throw new g({cause:t,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${t.message}`})}},qs=(r,e)=>{const s=new Set;for(const t of e.versionFiles??[])R(t)==="cargo"&&s.add(G(t)?t:f(r,t));if(e.versionActions==="cargo"){const t=e.cargoTomlPath??"Cargo.toml";s.add(G(t)?t:f(r,t))}return[...s]},Js=async r=>{const{entries:e,pending:s,workspaceRoot:t}=r,n=[],a=[];for(const{manifestPath:i,newVersion:o}of e){let c=s.get(i);if(c===void 0)try{c=await P(i,"utf8")}catch{continue}const l=await ss(c,i);if(l===void 0)continue;const d=await xe(E(i),t);if(d===void 0)continue;let p=s.get(d);p===void 0&&(p=await P(d,"utf8"));const u=Ze(p,l,o);if(!u.found){n.push(`cargo-lock: ${l} has no workspace-member entry in ${d}; run \`cargo generate-lockfile\` or build once to add it.`);continue}if(u.content!==void 0&&u.content!==p){s.set(d,u.content);const m=a.findIndex(b=>b.path===d),h={content:u.content,path:d};m===-1?a.push(h):a[m]=h}}return{warnings:n,writes:a}},vt=Object.defineProperty({__proto__:null,canonicalPath:L,cargoManifestPaths:qs,findCargoLock:xe,findLockfile:es,readCrateName:ss,rewriteCargoLockVersion:Ze,syncCargoLocks:Js},Symbol.toStringTag,{value:"Module"}),Ys=async(r,e)=>{let s=[r];for(const t of e.split("/").filter(n=>n!==""&&n!==".")){if(t==="**")throw new g({code:"CONFIG_INVALID",message:`Unsupported [workspace].members pattern "${e}": "**" is not supported. List the crate directories explicitly or use "dir/*".`});const n=/[*?[{]/.test(t),a=[];for(const i of s){if(!n){a.push(f(i,t));continue}const o=await ce(i,{withFileTypes:!0}).catch(()=>[]);for(const c of o)c.isDirectory()&&Ue(t,c.name)&&a.push(f(i,c.name))}s=a}return s},Xs=(r,e)=>{for(const s of e)if(r===s||r.startsWith(`${s}${Ge}`))return!0;return!1},rs=async r=>{let e=E(L(r));for(;;){const s=f(e,"Cargo.toml"),t=await ne(s);if(t!==void 0){const i=(await Y(t,s)).workspace?.package?.version;if(typeof i=="string")return i}const n=E(e);if(n===e)return;e=n}},ne=async r=>{try{return await P(r,"utf8")}catch{return}},Y=async(r,e)=>{const{parse:s}=await import("./index4.js");try{return s(r)}catch(t){throw new g({cause:t,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${t.message}`})}},we=r=>Array.isArray(r)?r.filter(e=>typeof e=="string"):[],Q=r=>typeof r=="object"&&r!==null&&r.workspace===!0,zs=(r,e)=>{const s=Q(r.publish)?e.workspace?.package?.publish:r.publish;return s===!1||Array.isArray(s)&&s.length===0},Qs=(r,e,s,t)=>{const n=[];for(const[a,i]of Object.entries(r.dependencies??{})){const o=i,c=Q(o),l=c?e.workspace?.dependencies?.[a]:o,d=c?t:s;l===void 0||typeof l!="object"||typeof l.path!="string"||n.push({dir:Me(d,l.path),name:typeof l.package=="string"?l.package:a,requirement:typeof l.version=="string"?l.version:"*"})}return n},Zs=async r=>{const{claimedDirs:e,cwd:s}=r,t=f(s,"Cargo.toml"),n=await ne(t);if(n===void 0)return[];const a=await Y(n,t),i=new Set;a.package&&i.add(s);const o=we(a.workspace?.exclude);for(const p of we(a.workspace?.members))for(const u of await Ys(s,p)){const m=Te(s,u).split(Ge).join("/");m.split("/").includes("target")||o.some(h=>Ue(h,m))||i.add(u)}const c=new Set([...e].map(p=>L(p))),l=[];for(const p of[...i].sort()){if(Xs(L(p),c))continue;const u=f(p,"Cargo.toml"),m=await ne(u);if(m===void 0)continue;const h=await Y(m,u);if(!h.package)continue;const{name:b}=h.package;if(typeof b!="string"||b==="")throw new g({code:"CONFIG_INVALID",file:u,message:`${u} has a [package] table without a name.`});const N=h.package.version,k=typeof N=="string"?N:Q(N)?a.workspace?.package?.version:void 0;if(typeof k!="string")throw new g({code:"CONFIG_INVALID",file:u,message:`${u} has no resolvable [package].version.`});l.push({dir:p,manifestPath:u,name:b,pathDeps:Qs(h,a,p,s),private:zs(h.package,a),version:k})}const d=new Map(l.map(p=>[p.dir,p]));return l.map(p=>{const u={};for(const h of p.pathDeps){const b=d.get(h.dir);b&&(u[b.name]=h.requirement)}const m={dependencies:u,name:p.name,private:p.private,version:p.version};return{dir:p.dir,ecosystem:"cargo",manifest:m,manifestPath:p.manifestPath,name:p.name,private:p.private,version:p.version}})},$t=Object.defineProperty({__proto__:null,discoverCargoCrates:Zs,findInheritedWorkspaceVersion:rs,inheritsFromWorkspace:Q,parseCargoDoc:Y},Symbol.toStringTag,{value:"Module"}),xs="ACTIONS_ID_TOKEN_REQUEST_URL",ts=r=>{const e=!!r.env[xs],s=!!r.env[r.staticTokenVar],t=r.workspaceConfig?.publish?.preferStaticToken===!0;return e&&!(t&&s)?"oidc":s?"token":"missing"};let W;const er="https://github.com/visulima/visulima",sr=async()=>{try{let e=E(Is(import.meta.url));for(let s=0;s<6;s+=1){const t=f(e,"package.json");try{const a=await P(t,"utf8"),i=JSON.parse(a);if(i.name==="@visulima/vis"&&typeof i.version=="string")return i.version}catch{}const n=E(e);if(n===e)break;e=n}}catch{}return"unknown"},rr=async()=>(W!==void 0||(W=`vis-release/${await sr()} (+${er})`),W),be=new Map,tr=async r=>{const e=be.get(r);if(e!==void 0)return e;try{const s=await import("./index7.js").then(n=>n.i),t=new s.ProxyAgent(r);return be.set(r,t),t}catch{return}},nr=r=>r===301||r===302||r===303||r===307||r===308,ar=(r,e)=>{try{const s=new URL(r),t=new URL(e);return s.host===t.host&&s.protocol===t.protocol}catch{return!1}},S=async(r,e={})=>{const s=e.maxRedirects??2,n={"User-Agent":await rr(),...e.headers};e.headers?.["User-Agent"]&&(n["User-Agent"]=e.headers["User-Agent"]);let a=r,i=0;const o=e.httpProxy?await tr(e.httpProxy):void 0;for(;;){let c;try{const p=e.fetchImpl??globalThis.fetch,u={headers:n,method:e.method??"GET",redirect:"manual"};o&&(u.dispatcher=o),c=await p(a,u)}catch{return{json:async()=>{},ok:!1,status:0,text:async()=>""}}if(!nr(c.status))return{json:async()=>{try{return await c.json()}catch{return}},ok:c.ok,status:c.status,text:async()=>{try{return await c.text()}catch{return""}}};const l=c.headers.get("location")??c.headers.get("Location");if(!l||i>=s)return{json:async()=>{},ok:!1,status:0,text:async()=>""};let d;try{d=new URL(l,a).toString()}catch{return{json:async()=>{},ok:!1,status:0,text:async()=>""}}if(!ar(r,d))return{json:async()=>{},ok:!1,status:0,text:async()=>""};a=d,i+=1}},ir="https://crates.io/api/v1/crates",or="Cargo.toml",ye=async r=>{let e;try{e=await P(r,"utf8")}catch(o){throw new g({cause:o,code:"CONFIG_INVALID",file:r,message:`Failed to read Cargo.toml at ${r}: ${o.message}`})}const{parse:s}=await import("./index4.js");let t;try{t=s(e)}catch(o){throw new g({cause:o,code:"CONFIG_INVALID",file:r,message:`Failed to parse Cargo.toml at ${r}: ${o.message}`})}if(!t.package)throw new g({code:"CONFIG_INVALID",file:r,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 ${r} has no [package] table.`});const{name:n}=t.package;if(typeof n!="string"||n.length===0)throw new g({code:"CONFIG_INVALID",file:r,message:`Cargo.toml at ${r} is missing [package].name.`});const a=t.package.version;let i;if(typeof a=="string"?i=a:a&&typeof a=="object"&&a.workspace===!0&&(i=await rs(r)??t.workspace?.package?.version),typeof i!="string"||i.length===0)throw new g({code:"CONFIG_INVALID",file:r,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 ${r} has no resolvable [package].version.`});return{name:n,version:i}},ke=async(r,e)=>{const s=`${ir}/${encodeURIComponent(r)}`;try{const t=await S(s,{headers:{Accept:"application/json"},httpProxy:e});if(t.status===404||!t.ok)return;const n=await t.json();return n?.crate?.max_stable_version??n?.crate?.max_version??void 0}catch{return}},cr=(r,e)=>ts({env:r,staticTokenVar:"CARGO_REGISTRY_TOKEN",workspaceConfig:e})==="oidc",lr=async(r,e)=>{const s=await r.run("cargo",["package","--list","--allow-dirty"],{cwd:e,silent:!0});return s.exitCode!==0?[]:s.stdout.split(/\r?\n/).map(t=>t.trim()).filter(t=>t.length>0)};class ur extends C{id="cargo";async readPublishedVersion(e){const s=ae(e.pkg);try{const{name:t}=await ye(s);return await ke(t)}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run / cargo] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const s=ae(e.pkg,e.perPackageConfig),t=dr(e.pkg,e.perPackageConfig),{name:n,version:a}=await ye(s);if(a!==e.release.newVersion)throw new g({code:"CONFIG_INVALID",file:s,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 ke(n,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[cargo] ${n}@${e.release.newVersion} already on crates.io`,published:!1};const o=cr(process.env,e.workspaceConfig);if(!o&&!process.env.CARGO_REGISTRY_TOKEN)throw new g({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 ${n}@${e.release.newVersion}: neither CARGO_REGISTRY_TOKEN nor OIDC trusted publishing is available.`,packageName:e.pkg.name});const c=e.workspaceConfig?.publish?.guards;if(c?.packSecretScan){const p=await lr(e.pm.runner,t);if(p.length>0){const{runPackSecretScan:u}=await import("./publish-guards.js"),m=typeof c.packSecretScan=="object"?c.packSecretScan.ignore:void 0,h=await u({files:p,ignore:m,pkgDir:t});if(!h.passed){const{redactTokens:b}=await import("./security.js"),N=h.findings.map(k=>` • [packSecretScan] ${b(k.message)}${k.hint?`
|
|
20
20
|
→ ${b(k.hint)}`:""}`).join(`
|
|
21
21
|
`);throw new g({code:"PUBLISH_FAILED",message:`Pre-publish secret scan failed for ${n}@${e.release.newVersion}:
|
|
22
22
|
${N}`,packageName:e.pkg.name})}}}const l=["publish","--allow-dirty"];e.registry&&e.registry!=="https://crates.io"&&l.push("--registry",e.registry);const d=await e.pm.runner.run("cargo",l,{cwd:t,silent:!1});if(d.exitCode!==0)throw new g({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 ${n}@${e.release.newVersion}: exit ${d.exitCode}. stderr: ${d.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[cargo] published ${n}@${e.release.newVersion}${o?" (trusted publishing)":""}`,published:!0}}}const ae=(r,e)=>{const s=e?.cargoTomlPath??or;return f(r.dir,s)},dr=(r,e)=>E(ae(r,e)),pr=(r,e,s)=>z(r?.releaseTagPattern??"v{version}",{name:e,version:s});class gr extends C{id="composer";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=pr(e.perPackageConfig,s,t);if(e.dryRun)return{output:`[dry-run / composer] would tag ${n} for ${s}@${t}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be released from Windows yet: the Composer tag path is not tested there. Release from a POSIX runner.`,packageName:s});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new g({code:"CONFIG_INVALID",message:`${s} needs git on PATH to release its tag, and git --version failed.`,packageName:s});return await ue({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[composer] ${s}@${t} is already tagged ${n}; skipped`,published:!1}:{output:`[composer] ${s}@${t} released by tag ${n}`,published:!0}}}const mr=["linux/amd64","linux/arm64"],hr=r=>{const e=r.indexOf("/");if(e===-1)return{registry:"docker.io",repository:`library/${r}`};const s=r.slice(0,e),t=r.slice(e+1);return s==="localhost"||s.includes(".")||s.includes(":")?{registry:s,repository:t}:t.includes("/")?{registry:"docker.io",repository:r}:{registry:"docker.io",repository:`${s}/${t}`}},ve=(r,e)=>{const{registry:s,repository:t}=hr(r);return`https://${s==="docker.io"?"registry-1.docker.io":s}/v2/${t}/manifests/${encodeURIComponent(e)}`},ns=r=>{const e=r??{};return{buildContext:e.buildContext,containerBuildArgs:e.containerBuildArgs,containerImage:e.containerImage,containerPlatforms:e.containerPlatforms,containerSigning:e.containerSigning,containerSkipLatest:e.containerSkipLatest}},fr=(r,e)=>{const s=ns(r);if(typeof s.containerImage!="string"||s.containerImage.length===0)throw new g({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(`
|
|
@@ -24,11 +24,11 @@ ${N}`,packageName:e.pkg.name})}}}const l=["publish","--allow-dirty"];e.registry&
|
|
|
24
24
|
`),message:`docker buildx failed for ${e.pkg.name}@${e.release.newVersion}: exit ${n.exitCode}. stderr: ${n.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});if(s.containerSigning==="cosign"){const a=`${s.containerImage}:${e.release.newVersion}`,i=await e.pm.runner.run("cosign",["sign","--yes",a],{cwd:e.pkg.dir,silent:!1});if(i.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:"cosign signing failed. For keyless cosign, ensure COSIGN_EXPERIMENTAL=1 (cosign <2.0) and the CI runner has the OIDC token (`id-token: write` permission on GH Actions).",message:`cosign sign failed for ${a}: exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[container] published ${s.containerImage}:${e.release.newVersion}${s.containerSkipLatest?"":" + :latest"}${s.containerSigning==="cosign"?" (signed via cosign)":""}`,published:!0}}}const $e=(r,e)=>{if(!e.containerImage)throw new Error("buildBuildxCommand requires config.containerImage");const s=(e.containerPlatforms??mr).join(","),t=`${e.containerImage}:${r.release.newVersion}`,n=`${e.containerImage}:latest`,a=e.buildContext??".",i=["docker","buildx","build","--platform",s,"-t",t];e.containerSkipLatest||i.push("-t",n);for(const[o,c]of Object.entries(e.containerBuildArgs??{}))i.push("--build-arg",`${o}=${c}`);return i.push("--label",`org.opencontainers.image.version=${r.release.newVersion}`),i.push("--label",`org.opencontainers.image.title=${r.pkg.name}`),i.push("--push",a),{command:i}},br=r=>`https://pub.dev/api/packages/${encodeURIComponent(r)}`,yr=async r=>{try{const e=await S(br(r.pkg.name),{headers:{Accept:"application/vnd.pub.v2+json"},httpProxy:r.workspaceConfig?.httpProxy});if(!e.ok)return!1;const s=JSON.parse(await e.text());return Array.isArray(s.versions)&&s.versions.some(t=>t.version===r.release.newVersion)}catch{return!1}};class kr extends C{id="dart";async readPublishedVersion(e){}async publish(e){const{dir:s,name:t}=e.pkg,n=e.release.newVersion;if(e.dryRun)return{output:`[dry-run / dart] would run dart pub publish --force in ${s} for ${t}@${n}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${t} cannot be published from Windows yet: the Dart path is only verified on POSIX. Publish from a POSIX runner.`,packageName:t});try{const i=await e.pm.runner.run("dart",["--version"],{cwd:s,silent:!0});if(i.exitCode!==0)throw new Error(`exit ${i.exitCode}`)}catch{throw new g({code:"CONFIG_INVALID",message:`${t} needs the Dart SDK to publish, and "dart" is not on PATH. Install the Dart SDK on the runner.`,packageName:t})}if(await yr(e))return{alreadyPublished:!0,output:`[dart] ${t}@${n} is already on pub.dev; skipped`,published:!1};const a=await e.pm.runner.run("dart",["pub","publish","--force"],{cwd:s,silent:!1});if(a.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Failing command: dart pub publish --force in ${s}
|
|
25
25
|
Check the output above. Authenticate with "dart pub token add https://pub.dev" on this runner, or configure automated publishing (OIDC) for the pub.dev package. Errors stop the upload; warnings do not.`,message:`dart pub publish failed for ${t}@${n}: exit ${a.exitCode}. stderr: ${a.stderr.trim().slice(0,500)}`,packageName:t});return{output:`[dart] published ${t}@${n} to pub.dev`,published:!0}}}const vr="https://rubygems.org",$r=async(r,e,s)=>{const t=`${vr}/api/v1/versions/${encodeURIComponent(r)}.json`;try{const n=await S(t,{headers:{Accept:"application/json"},httpProxy:s.workspaceConfig?.httpProxy});if(!n.ok)return!1;const a=await n.json();return Array.isArray(a)&&a.some(i=>typeof i=="object"&&i!==null&&i.number===e)}catch{return!1}},Ir=async(r,e)=>{try{return(await r.pm.runner.run("gem",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class Cr extends C{id="gem";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=j(e.pkg.manifestPath),a=`${s}-${t}.gem`,i=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / gem] would run gem build ${n} and gem push ${a} for ${s}@${t}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be published from Windows yet: the gem path is only verified on POSIX. Publish from a POSIX runner.`,packageName:s});if(!await Ir(e,i))throw new g({code:"CONFIG_INVALID",message:`${s} needs the gem command on PATH to publish, and "gem --version" failed. Install Ruby (which ships RubyGems) on the runner.`,packageName:s});if(await $r(s,t,e))return{alreadyPublished:!0,output:`[gem] ${s}@${t} is already on RubyGems; skipped`,published:!1};const o=await e.pm.runner.run("gem",["build",n],{cwd:i,silent:!1});if(o.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Failing step: gem build ${n} in ${i}
|
|
26
26
|
Fix the gemspec validation error above.`,message:`gem build failed for ${s}@${t}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:s});try{const c=await e.pm.runner.run("gem",["push",a],{cwd:i,silent:!1});if(c.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Failing step: gem push ${a}
|
|
27
|
-
Check the output above. Credentials come from GEM_HOST_API_KEY in the environment; a gem push to an existing version is refused by RubyGems.`,message:`gem push failed for ${s}@${t}: exit ${c.exitCode}. stderr: ${c.stderr.trim().slice(0,500)}`,packageName:s})}finally{await le(f(i,a),{force:!0})}return{output:`[gem] published ${s}@${t} (${a})`,published:!0}}}const Pr=(r,e,s)=>z(r?.releaseTagPattern??"v{version}",{name:e,version:s});class Nr extends C{id="go";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=Pr(e.perPackageConfig,s,t);if(e.dryRun)return{output:`[dry-run / go] would tag ${n} for ${s}@${t}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be released from Windows yet: the Go tag path is not tested there. Release from a POSIX runner.`,packageName:s});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new g({code:"CONFIG_INVALID",message:`${s} needs git on PATH to release its tag, and git --version failed.`,packageName:s});return await ue({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[go] ${s}@${t} is already tagged ${n}; skipped`,published:!1}:{output:`[go] ${s}@${t} released by tag ${n}`,published:!0}}}const Ie=["build.gradle.kts","build.gradle"],as=["settings.gradle.kts","settings.gradle"],D=(r,e)=>new g({code:"CONFIG_INVALID",file:r,message:e}),Ar=async(r,e)=>{for(const s of new Set([f(r,"gradle.properties"),f(e,"gradle.properties")])){let t;try{t=await P(s,"utf8")}catch{continue}if(/^\s*version\s*[=:]/m.test(t))return s}},_r=r=>
|
|
28
|
-
`);const i=t?ge(t.raw):void 0,o=i?.assignments??[],c=[];t&&c.push({build:t,dir:s,isRoot:!0,path:"",taskPath:""});for(const u of a?.includes??[]){const m=f(s,u),h=await q(m,Ie);h&&c.push({build:h,dir:m,isRoot:!1,path:u,taskPath:`:${u.replaceAll("/",":")}`})}const l=[];for(const u of c){if(e.has(u.dir))continue;const m=u.isRoot&&i?i:ge(u.build.raw),h=H(me(m.assignments,"version"),u.build.path,"version");if(u.isRoot&&h===void 0)continue;const b=h?void 0:H(he(o,"version",u.isRoot),t?.path??u.build.path,"version"),N=h??b;if(!N){const y=await Ar(u.dir,s);if(y!==void 0)throw D(y,`${y} sets version, and vis reads only a string literal in a build script. Move it to version = "…" in ${u.build.path}, or remove it.`);continue}const k=H(me(m.assignments,"group"),u.build.path,"group")??H(he(o,"group",u.isRoot),t?.path??u.build.path,"group");if(k===void 0)throw D(u.build.path,`${u.build.path} has a version but no group. Declare group = "…" in its build script or in the root build script's allprojects block.`);if(m.usesArchiveName||i?.usesArchiveName)throw D(u.build.path,`${u.build.path} renames its archive (archivesName). vis cannot read the artifact name from that; remove it or release the module with a shell publish.`);const O=u.isRoot?a?.rootName??j(s):j(u.dir);l.push({kind:h?"literal":"inherited",line:N.assignment.line,module:u,name:`${k.value}:${O}`,owner:h?u.build.path:t.path,scan:m,version:N.value})}const d=new Map;for(const u of l){const m=d.get(u.name);if(m!==void 0)throw D(u.module.build.path,`${u.name} is declared by both ${m} and ${u.module.build.path}. Gradle coordinates must be unique to release them.`);d.set(u.name,u.module.build.path)}const p=new Map(l.map(u=>[u.module.path,u.name]));return l.map(({kind:u,line:m,module:h,name:b,owner:N,scan:k,version:O})=>{const y={};for(const v of k.projectRefs){const I=p.get(v.replace(/^:+/,"").split(":").filter($=>$!=="").join("/"));I!==void 0&&I!==b&&(y[I]="*")}const w={dependencies:y,name:b,private:!1,version:O};return{kind:u,line:m,name:b,owner:N,package:{dir:h.dir,ecosystem:"gradle",manifest:w,manifestPath:h.build.path,name:b,private:!1,version:O},taskPath:h.taskPath}})},is=async r=>{let e=r;for(;;){if(await _r(f(e,"gradlew"))||await q(e,as)!==void 0)return e;const s=E(e);if(s===e)return;e=s}},It=Object.defineProperty({__proto__:null,discoverGradleProjects:Sr,findGradleRoot:is},Symbol.toStringTag,{value:"Module"}),Vr=/<!--[\s\S]*?-->/g,Or=/<project\b[^>]*>([\s\S]*)/i,Ce=/<version>\s*([^<]+?)\s*<\/version>/i,Pe=/<groupId>\s*([^<]+?)\s*<\/groupId>/i,Ne=/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i,Er=/<modules\b[^>]*>[\s\S]*?<module\b/i,Ae=r=>{const e=r.replaceAll(Vr,""),t=Or.exec(e)?.[1]??e,n=t.replaceAll(/<parent\b[\s\S]*?<\/parent>/gi,"").replaceAll(/<dependencyManagement\b[\s\S]*?<\/dependencyManagement>/gi,"").replaceAll(/<dependencies\b[\s\S]*?<\/dependencies>/gi,"").replaceAll(/<build\b[\s\S]*?<\/build>/gi,"").replaceAll(/<profiles\b[\s\S]*?<\/profiles>/gi,"").replaceAll(/<pluginRepositories\b[\s\S]*?<\/pluginRepositories>/gi,"").replaceAll(/<repositories\b[\s\S]*?<\/repositories>/gi,""),a=Ce.exec(n)??Ce.exec(t),i=Pe.exec(n)??Pe.exec(t),o=Ne.exec(n)??Ne.exec(t),c=Er.test(t);return{artifactId:o?.[1],groupId:i?.[1],hasModules:c,version:a?.[1]}},Dr=r=>{const e=/<latest>\s*([^<]+?)\s*<\/latest>/i.exec(r);if(e?.[1])return e[1];const s=/<versions>([\s\S]*?)<\/versions>/i.exec(r);return s?[...s[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(n=>n[1]).at(-1):void 0},jr=r=>{const e=/<versions>([\s\S]*?)<\/versions>/i.exec(r);return e?[...e[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(s=>s[1]):[]},os=(r,e)=>{const s=r.split(".").map(n=>encodeURIComponent(n)).join("/"),t=encodeURIComponent(e);return`https://repo1.maven.org/maven2/${s}/${t}/maven-metadata.xml`};class
|
|
27
|
+
Check the output above. Credentials come from GEM_HOST_API_KEY in the environment; a gem push to an existing version is refused by RubyGems.`,message:`gem push failed for ${s}@${t}: exit ${c.exitCode}. stderr: ${c.stderr.trim().slice(0,500)}`,packageName:s})}finally{await le(f(i,a),{force:!0})}return{output:`[gem] published ${s}@${t} (${a})`,published:!0}}}const Pr=(r,e,s)=>z(r?.releaseTagPattern??"v{version}",{name:e,version:s});class Nr extends C{id="go";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=Pr(e.perPackageConfig,s,t);if(e.dryRun)return{output:`[dry-run / go] would tag ${n} for ${s}@${t}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be released from Windows yet: the Go tag path is not tested there. Release from a POSIX runner.`,packageName:s});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new g({code:"CONFIG_INVALID",message:`${s} needs git on PATH to release its tag, and git --version failed.`,packageName:s});return await ue({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[go] ${s}@${t} is already tagged ${n}; skipped`,published:!1}:{output:`[go] ${s}@${t} released by tag ${n}`,published:!0}}}const Ie=["build.gradle.kts","build.gradle"],as=["settings.gradle.kts","settings.gradle"],D=(r,e)=>new g({code:"CONFIG_INVALID",file:r,message:e}),Ar=async(r,e)=>{for(const s of new Set([f(r,"gradle.properties"),f(e,"gradle.properties")])){let t;try{t=await P(s,"utf8")}catch{continue}if(/^\s*version\s*[=:]/m.test(t))return s}},_r=r=>Fe(r).then(()=>!0,()=>!1),q=async(r,e)=>{for(const s of e){const t=f(r,s);try{return{path:t,raw:await P(t,"utf8")}}catch{}}},H=(r,e,s)=>{if(r.length===0)return;if(r.length>1)throw D(e,`${e} declares ${s} ${r.length} times on the path that reaches a module (lines ${r.map(n=>n.line).join(", ")}). vis cannot tell which one applies.`);const[t]=r;if(t.literal===void 0)throw D(e,`${e} sets ${s} to an expression on line ${t.line}. vis reads only a plain string literal, such as ${s} = "1.0.0".`);return{assignment:t,value:t.literal.value}},Sr=async r=>{const{claimedDirs:e,cwd:s}=r,t=await q(s,Ie),n=await q(s,as);if(!t&&!n)return[];const a=n?Cs(n.raw):void 0;if(a?.unsupported.length)throw D(n.path,`${n.path} moves a project (${a.unsupported.join(", ")}). vis cannot follow that to a version; remove it or release the module with a shell publish.`);a?.dynamicIncludes&&process.stderr.write(`[vis release] ⚠ ${n.path} builds part of its include list from code; vis only reads literal include("…") entries.
|
|
28
|
+
`);const i=t?ge(t.raw):void 0,o=i?.assignments??[],c=[];t&&c.push({build:t,dir:s,isRoot:!0,path:"",taskPath:""});for(const u of a?.includes??[]){const m=f(s,u),h=await q(m,Ie);h&&c.push({build:h,dir:m,isRoot:!1,path:u,taskPath:`:${u.replaceAll("/",":")}`})}const l=[];for(const u of c){if(e.has(u.dir))continue;const m=u.isRoot&&i?i:ge(u.build.raw),h=H(me(m.assignments,"version"),u.build.path,"version");if(u.isRoot&&h===void 0)continue;const b=h?void 0:H(he(o,"version",u.isRoot),t?.path??u.build.path,"version"),N=h??b;if(!N){const y=await Ar(u.dir,s);if(y!==void 0)throw D(y,`${y} sets version, and vis reads only a string literal in a build script. Move it to version = "…" in ${u.build.path}, or remove it.`);continue}const k=H(me(m.assignments,"group"),u.build.path,"group")??H(he(o,"group",u.isRoot),t?.path??u.build.path,"group");if(k===void 0)throw D(u.build.path,`${u.build.path} has a version but no group. Declare group = "…" in its build script or in the root build script's allprojects block.`);if(m.usesArchiveName||i?.usesArchiveName)throw D(u.build.path,`${u.build.path} renames its archive (archivesName). vis cannot read the artifact name from that; remove it or release the module with a shell publish.`);const O=u.isRoot?a?.rootName??j(s):j(u.dir);l.push({kind:h?"literal":"inherited",line:N.assignment.line,module:u,name:`${k.value}:${O}`,owner:h?u.build.path:t.path,scan:m,version:N.value})}const d=new Map;for(const u of l){const m=d.get(u.name);if(m!==void 0)throw D(u.module.build.path,`${u.name} is declared by both ${m} and ${u.module.build.path}. Gradle coordinates must be unique to release them.`);d.set(u.name,u.module.build.path)}const p=new Map(l.map(u=>[u.module.path,u.name]));return l.map(({kind:u,line:m,module:h,name:b,owner:N,scan:k,version:O})=>{const y={};for(const v of k.projectRefs){const I=p.get(v.replace(/^:+/,"").split(":").filter($=>$!=="").join("/"));I!==void 0&&I!==b&&(y[I]="*")}const w={dependencies:y,name:b,private:!1,version:O};return{kind:u,line:m,name:b,owner:N,package:{dir:h.dir,ecosystem:"gradle",manifest:w,manifestPath:h.build.path,name:b,private:!1,version:O},taskPath:h.taskPath}})},is=async r=>{let e=r;for(;;){if(await _r(f(e,"gradlew"))||await q(e,as)!==void 0)return e;const s=E(e);if(s===e)return;e=s}},It=Object.defineProperty({__proto__:null,discoverGradleProjects:Sr,findGradleRoot:is},Symbol.toStringTag,{value:"Module"}),Vr=/<!--[\s\S]*?-->/g,Or=/<project\b[^>]*>([\s\S]*)/i,Ce=/<version>\s*([^<]+?)\s*<\/version>/i,Pe=/<groupId>\s*([^<]+?)\s*<\/groupId>/i,Ne=/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i,Er=/<modules\b[^>]*>[\s\S]*?<module\b/i,Ae=r=>{const e=r.replaceAll(Vr,""),t=Or.exec(e)?.[1]??e,n=t.replaceAll(/<parent\b[\s\S]*?<\/parent>/gi,"").replaceAll(/<dependencyManagement\b[\s\S]*?<\/dependencyManagement>/gi,"").replaceAll(/<dependencies\b[\s\S]*?<\/dependencies>/gi,"").replaceAll(/<build\b[\s\S]*?<\/build>/gi,"").replaceAll(/<profiles\b[\s\S]*?<\/profiles>/gi,"").replaceAll(/<pluginRepositories\b[\s\S]*?<\/pluginRepositories>/gi,"").replaceAll(/<repositories\b[\s\S]*?<\/repositories>/gi,""),a=Ce.exec(n)??Ce.exec(t),i=Pe.exec(n)??Pe.exec(t),o=Ne.exec(n)??Ne.exec(t),c=Er.test(t);return{artifactId:o?.[1],groupId:i?.[1],hasModules:c,version:a?.[1]}},Dr=r=>{const e=/<latest>\s*([^<]+?)\s*<\/latest>/i.exec(r);if(e?.[1])return e[1];const s=/<versions>([\s\S]*?)<\/versions>/i.exec(r);return s?[...s[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(n=>n[1]).at(-1):void 0},jr=r=>{const e=/<versions>([\s\S]*?)<\/versions>/i.exec(r);return e?[...e[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(s=>s[1]):[]},os=(r,e)=>{const s=r.split(".").map(n=>encodeURIComponent(n)).join("/"),t=encodeURIComponent(e);return`https://repo1.maven.org/maven2/${s}/${t}/maven-metadata.xml`};class Lr extends C{id="maven";warnedMultiModule=new WeakSet;warnIfMultiModule(e,s){!s.hasModules||this.warnedMultiModule.has(e)||(this.warnedMultiModule.add(e),process.stderr.write(`[vis release] ⚠ ${e.name} (${s.groupId??"?"}:${s.artifactId??"?"}) is a multi-module Maven project (<modules> present). vis treats it as a single artifact for version-read + already-published checks. For proper reactor handling, use \`versionActions: "shell"\` with \`mvn -B -ntp deploy\`.
|
|
29
29
|
`))}async readPublishedVersion(e){const s=e.perPackageConfig??{},t=f(e.pkg.dir,s.pomPath??"pom.xml");let n;try{n=await P(t,"utf8")}catch{return}const a=Ae(n);if(this.warnIfMultiModule(e.pkg,a),!a.groupId||!a.artifactId||s.mavenMetadataUrl==="")return;const i=s.mavenMetadataUrl??os(a.groupId,a.artifactId);try{const o=await S(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 Dr(c)}catch{return}}async publish(e){const s=e.perPackageConfig??{},t=f(e.pkg.dir,s.pomPath??"pom.xml");let n;try{const o=await P(t,"utf8");n=Ae(o)}catch{n=void 0}const a=n?.groupId&&n?.artifactId?`${n.groupId}:${n.artifactId}`:e.pkg.name;if(e.dryRun)return{output:`[dry-run / maven] would run mvn -B -N -f ${t} deploy for ${e.pkg.name}@${e.release.newVersion} (${a})`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be published from Windows yet: Maven publish is POSIX-only for now. Publish from a POSIX runner.`,packageName:e.pkg.name});const i=await e.pm.runner.run("mvn",["-B","-N","-f",t,"deploy"],{cwd:e.pkg.dir,silent:!1});if(i.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Failing artifact: ${a}
|
|
30
30
|
Pom: ${t}
|
|
31
|
-
Check the mvn output above. Credentials come from ~/.m2/settings.xml, and the pom needs a deploy target (distributionManagement or central-publishing-maven-plugin). See docs/guides/release-maven.mdx.`,message:`mvn deploy failed for ${e.pkg.name}@${e.release.newVersion} (${a}): exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[maven] deployed ${e.pkg.name}@${e.release.newVersion} (${a})`,published:!0}}}const
|
|
31
|
+
Check the mvn output above. Credentials come from ~/.m2/settings.xml, and the pom needs a deploy target (distributionManagement or central-publishing-maven-plugin). See docs/guides/release-maven.mdx.`,message:`mvn deploy failed for ${e.pkg.name}@${e.release.newVersion} (${a}): exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[maven] deployed ${e.pkg.name}@${e.release.newVersion} (${a})`,published:!0}}}const Rr=r=>{const e=r.indexOf(":");return e===-1?void 0:{artifactId:r.slice(e+1),groupId:r.slice(0,e)}},Fr=async r=>{const e=r.perPackageConfig??{},s=Rr(r.pkg.name);if(e.mavenMetadataUrl===""||s===void 0)return!1;const t=e.mavenMetadataUrl??os(s.groupId,s.artifactId);try{const n=await S(t,{headers:{Accept:"text/xml,application/xml;q=0.9,*/*;q=0.8"},httpProxy:r.workspaceConfig?.httpProxy});return n.ok&&jr(await n.text()).includes(r.release.newVersion)}catch{return!1}};class Mr extends C{id="gradle";async readPublishedVersion(e){}async publish(e){const s=await is(e.pkg.dir);if(s===void 0)throw new g({code:"CONFIG_INVALID",file:e.pkg.manifestPath,message:`${e.pkg.name} has no Gradle build root (no gradlew or settings.gradle above ${e.pkg.dir}).`,packageName:e.pkg.name});const t=e.pkg.dir===s?"":e.pkg.dir.slice(s.length+1).split("\\").join("/"),n=t===""?":publish":`:${t.replaceAll("/",":")}:publish`;if(e.dryRun)return{output:`[dry-run / gradle] would run ${f(s,"gradlew")} ${n} for ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be published from Windows yet: vis runs ./gradlew without a shell, and gradlew.bat needs one. Publish from a POSIX runner.`,packageName:e.pkg.name});const a=f(s,"gradlew");try{await Fe(a)}catch{throw new g({code:"CONFIG_INVALID",message:`${e.pkg.name} needs ${a} to publish, and the build root has none. Add the Gradle wrapper (gradle wrapper) at the root.`,packageName:e.pkg.name})}if(await Fr(e))return{alreadyPublished:!0,output:`[gradle] ${e.pkg.name}@${e.release.newVersion} is already on the repository; skipped`,published:!1};const i=await e.pm.runner.run(a,[n],{cwd:s,silent:!1});if(i.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Failing task: ${n} in ${s}
|
|
32
32
|
Check the Gradle output above. The module needs a publishing plugin and repository (for example maven-publish). Credentials come from your Gradle properties or environment.`,message:`gradle ${n} failed for ${e.pkg.name}@${e.release.newVersion}: exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[gradle] published ${e.pkg.name}@${e.release.newVersion} (${n})`,published:!0}}}const Tr="https://hex.pm",Gr=async(r,e,s)=>{const t=`${Tr}/api/packages/${encodeURIComponent(r)}`;try{const n=await S(t,{headers:{Accept:"application/json"},httpProxy:s.workspaceConfig?.httpProxy});if(!n.ok)return!1;const a=await n.json(),i=typeof a=="object"&&a!==null?a.releases:void 0;return Array.isArray(i)&&i.some(o=>typeof o=="object"&&o!==null&&o.version===e)}catch{return!1}},Ur=async(r,e)=>{try{return(await r.pm.runner.run("mix",["help"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class Br extends C{id="hex";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / hex] would run mix hex.publish --yes in ${j(n)} for ${s}@${t}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be published from Windows yet: the mix path is only verified on POSIX. Publish from a POSIX runner.`,packageName:s});if(!await Ur(e,n))throw new g({code:"CONFIG_INVALID",message:`${s} needs the mix command on PATH to publish, and "mix help" failed. Install Elixir (which ships Mix) on the runner.`,packageName:s});if(await Gr(s,t,e))return{alreadyPublished:!0,output:`[hex] ${s}@${t} is already on hex.pm; skipped`,published:!1};const a=await e.pm.runner.run("mix",["hex.publish","--yes"],{cwd:n,silent:!1});if(a.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Failing step: mix hex.publish --yes in ${n}
|
|
33
33
|
Check the output above. Credentials come from HEX_API_KEY in the environment; Hex refuses to replace an existing version.`,message:`mix hex.publish failed for ${s}@${t}: exit ${a.exitCode}. stderr: ${a.stderr.trim().slice(0,500)}`,packageName:s});return{output:`[hex] published ${s}@${t}`,published:!0}}}const cs=(r,e)=>{if(e===!1)return{...r};const s=new Set(Ns(e)),t={name:r.name,version:r.version};for(const[n,a]of Object.entries(r))s.has(n)||(t[n]=a);return t},ls="https://registry.npmjs.org/",Wr="npm:registry.npmjs.org",_e=async r=>{const e=f(r,"npm");try{return(await ce(e,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name)}catch{return[]}},Hr=async r=>{const e=r.ACTIONS_ID_TOKEN_REQUEST_URL,s=r.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!e||!s)return;const t=`${e}${e.includes("?")?"&":"?"}audience=${encodeURIComponent(Wr)}`,n=await fetch(t,{headers:{Authorization:`Bearer ${s}`}});if(!n.ok)return;const a=await n.json().catch(()=>({}));return typeof a.value=="string"?a.value:void 0},Kr=async(r,e)=>{const s=await fetch(`${ls}-/npm/v1/oidc/token/exchange/package/${encodeURIComponent(r)}`,{headers:{Authorization:`Bearer ${e}`},method:"POST"});if(!s.ok)return;const t=await s.json().catch(()=>({}));return typeof t.token=="string"?t.token:void 0},Se=async(r,e,s)=>{if(e){const n=await Kr(r,e);if(n)return{source:"oidc",token:n}}const t=s.NPM_TOKEN;if(t)return{source:"NPM_TOKEN",token:t};throw new g({code:"AUTH_MISSING",message:`Cannot publish ${r}: OIDC exchange did not succeed and NPM_TOKEN is not set.`,packageName:r})},Ve=(r,e)=>{$s(r,`//registry.npmjs.org/:_authToken=${e}
|
|
34
34
|
registry=${ls}
|
|
@@ -53,6 +53,6 @@ ${V}`,packageName:e.pkg.name})}}const{hashTarball:u}=await import("./publish-gua
|
|
|
53
53
|
`)},packageName:e.pkg.name,pollIntervalMs:s.pollIntervalMs,runner:e.pm.runner,stageId:t,timeoutMs:s.timeoutMs,version:e.release.newVersion});return i==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted on resume (${Math.round((Date.now()-n)/1e3)}s).
|
|
54
54
|
`),{output:`[resumed] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}):i==="rejected"?(process.stdout.write(`::warning::Stage rejected on resume for ${e.pkg.name}@${e.release.newVersion} (id ${t}).
|
|
55
55
|
`),{alreadyPublished:!1,output:`stage-rejected: ${t}`,published:!1,stageId:t}):(process.stdout.write(`::warning::Stage timeout on resume for ${e.pkg.name}@${e.release.newVersion} (id ${t}) after ${Math.round(s.timeoutMs/6e4)}m.
|
|
56
|
-
`),{alreadyPublished:!1,output:`stage-timeout: ${t}`,published:!1,stageId:t})}}const Yr=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Xr=(r,e)=>{const s={...r};for(const t of Yr){const n=r[t];if(!n||typeof n!="object")continue;const a={...n};for(const[i,o]of Object.entries(n)){if(!o.startsWith("workspace:"))continue;const c=e.get(i);c&&(a[i]=We(o.slice(10)==="*"?"*":o,c.version),a[i].startsWith("workspace:")&&(a[i]=a[i].slice(10)))}s[t]=a}return s},zr=Object.defineProperty({__proto__:null,NpmVersionActions:us},Symbol.toStringTag,{value:"Module"}),je="https://api.nuget.org/v3/index.json",Qr="https://api.nuget.org/v3-flatcontainer",M="NUGET_API_KEY",T=[10,0,300],Zr=r=>{const e=/^(\d+)\.(\d+)\.(\d+)(-[\w.-]+)?/.exec(r.trim());if(!e)return!1;const s=[Number(e[1]),Number(e[2]),Number(e[3])];for(const[t,n]of s.entries())if(n!==T[t])return n>T[t];return e[4]===void 0},
|
|
57
|
-
Fix the build or packaging error above.`,message:`dotnet pack failed for ${s}@${t}: exit ${l.exitCode}. stderr: ${
|
|
58
|
-
Check the output above. A version nuget.org already has is refused. The key comes from ${M}, which dotnet nuget push reads on .NET SDK ${T.join(".")} or later.`,message:`dotnet nuget push failed for ${s}@${t}: exit ${u.exitCode}. stderr: ${Fe(u.stderr,o)}`,packageName:s})}finally{await le(c,{force:!0,recursive:!0})}return{output:`[nuget] published ${s}@${t} to nuget.org`,published:!0}}}class st extends C{id="private";async readPublishedVersion(e){}async publish(e){return{output:`[private] skipped publish for ${e.pkg.name}@${e.release.newVersion}`,published:!1}}}const ds=r=>`https://pypi.org/pypi/${encodeURIComponent(r.toLowerCase())}/json`,rt=(r,e)=>e?.uvLockPath?f(r.dir,e.uvLockPath):f(r.dir,"uv.lock"),tt=async(r,e)=>{let s;try{s=await X(r)}catch{return"no-root-pyproject"}if(s===void 0)return"no-root-pyproject";const t=s.tool?.uv?.workspace?.members;if(!Array.isArray(t)||t.length===0)return"no-workspace";const n=e.replace(/^\.\//,"").replaceAll("\\","/");for(const a of t){if(typeof a!="string")continue;const i=a.replace(/^\.\//,"").replaceAll("\\","/");if(i===n)return"member";if(i.endsWith("/*")){const o=i.slice(0,-2);if(n.startsWith(`${o}/`)&&!n.slice(o.length+1).includes("/"))return"member"}if(i.endsWith("/**")){const o=i.slice(0,-3);if(n===o||n.startsWith(`${o}/`))return"member"}}return"missing"},X=async r=>{const e=f(r,"pyproject.toml");let s;try{s=await P(e,"utf8")}catch(n){const{code:a}=n;if(a==="ENOENT")return;throw new g({cause:n,code:"BUMP_FILE_INVALID",file:e,message:`Failed to read ${e}: ${n.message}`})}const{parse:t}=await import("./index4.js");try{return t(s)}catch(n){throw new g({cause:n,code:"BUMP_FILE_INVALID",file:e,message:`Failed to parse ${e}: ${n.message}`})}},ps=async(r,e)=>{try{return(await r.run("uv",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}},gs=r=>{const e=r?.["build-system"]?.["build-backend"];return e?e.startsWith("hatchling")?"hatch":e.startsWith("poetry.core")||e.startsWith("poetry_core")?"poetry":e.startsWith("pdm.backend")||e.startsWith("pdm_backend")?"pdm":e.startsWith("setuptools")?"setuptools":e.startsWith("uv_build")||e.startsWith("uv.build")?"uv":"unknown":"unknown"},ms=(r,e)=>r==="uv"||r==="unknown"&&e?{backend:r,buildCommand:{args:["build"],binary:"uv"},hasUv:e,publishCommand:{args:["publish"],binary:"uv"}}:{backend:r,buildCommand:{args:["-m","build"],binary:"python"},hasUv:e,publishCommand:{args:["upload","dist/*"],binary:"twine"}},hs=(r,e)=>ts({env:r,staticTokenVar:"TWINE_PASSWORD",workspaceConfig:e}),ie=async(r,e)=>{try{const s=await S(ds(r),{headers:{Accept:"application/json"},httpProxy:e});return s.status===404||!s.ok?void 0:(await s.json())?.info?.version}catch{return}},oe=(r,e)=>e?.pythonProjectDir?f(r.dir,e.pythonProjectDir):r.dir;class fs extends C{id="python";async readPublishedVersion(e){const s=oe(e.pkg,e.perPackageConfig),n=(await X(s).catch(()=>{}))?.project?.name??e.pkg.name.replace(/^@[^/]+\//,"");return ie(n)}async publish(e){if(e.dryRun)return{output:`[dry-run / python] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const s=e.perPackageConfig??{},t=oe(e.pkg,s),n=await X(t);if(n?.project?.dynamic?.includes("version"))throw new g({code:"CONFIG_INVALID",file:f(t,"pyproject.toml"),hint:"Dynamic versioning isn't supported by PythonVersionActions yet; use versionActions: 'shell' with your build backend's version-bump tool (e.g. `hatch version` or `poetry version` for non-vcs setups).",message:`${e.pkg.name}: pyproject.toml declares dynamic = ["version", ...]; PythonVersionActions requires a static [project] version.`,packageName:e.pkg.name});if(n?.project?.version&&n.project.version!==e.release.newVersion)throw new g({code:"BUMP_FILE_INVALID",file:f(t,"pyproject.toml"),hint:`Ensure the pyproject() preset is wired up for this package so the version literal in [project] is bumped before publish. Expected ${e.release.newVersion}, found ${n.project.version}.`,message:`${e.pkg.name}: pyproject.toml version ${n.project.version} differs from planned ${e.release.newVersion}.`,packageName:e.pkg.name});const a=n?.project?.name??e.pkg.name.replace(/^@[^/]+\//,"");if(await ie(a,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[python] ${a}@${e.release.newVersion} already on PyPI`,published:!1};const o=await ps(e.pm.runner,e.pkg.dir),c=gs(n),l=ms(c,o),d=hs(process.env,e.workspaceConfig);if(d==="missing")throw new g({code:"AUTH_MISSING",hint:["Set TWINE_PASSWORD to a PyPI API token (`TWINE_USERNAME=__token__` is injected automatically), OR","configure trusted publishing on PyPI and grant the workflow `permissions: id-token: write` so ACTIONS_ID_TOKEN_REQUEST_URL is exposed.","See https://docs.pypi.org/trusted-publishers/"].join(" "),message:`${e.pkg.name}: no PyPI credentials detected (neither TWINE_PASSWORD nor OIDC trusted-publishing env).`,packageName:e.pkg.name});const p=await e.pm.runner.run(l.buildCommand.binary,l.buildCommand.args,{cwd:t,silent:!1});if(p.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Inspect the ${l.buildCommand.binary} ${l.buildCommand.args.join(" ")} output above. Common causes: missing ${l.backend==="uv"?"uv":"build/setuptools/wheel"} dependency, broken pyproject.toml, source files missing from \`include\`.`,message:`${e.pkg.name}: build failed (${l.buildCommand.binary} ${l.buildCommand.args.join(" ")}): exit ${p.exitCode}. stderr: ${p.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});const u={...process.env};d==="token"&&!u.TWINE_USERNAME&&(u.TWINE_USERNAME="__token__");const m=await e.pm.runner.run(l.publishCommand.binary,l.publishCommand.args,{cwd:t,env:u,silent:!1});if(m.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Inspect the ${l.publishCommand.binary} output above. Common causes: invalid API token, version already published (this should have been caught by readPublishedVersion — file a vis bug), 2FA required without a token.`,message:`${e.pkg.name}: publish failed (${l.publishCommand.binary} ${l.publishCommand.args.join(" ")}): exit ${m.exitCode}. stderr: ${m.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[python/${l.backend}${l.hasUv?"+uv":""}] published ${a}@${e.release.newVersion}`,published:!0}}}const Ct=Object.defineProperty({__proto__:null,PYPI_PROJECT_URL:ds,PythonVersionActions:fs,checkUvWorkspaceMembership:tt,detectAuthMode:hs,detectBackend:gs,detectUv:ps,fetchPyPiVersion:ie,readPyProject:X,resolveBuildEnv:ms,resolveProjectDir:oe,resolveUvLockPath:rt},Symbol.toStringTag,{value:"Module"}),K=async(r,e,s,t)=>{const n=te(s,t),a=process.platform==="win32",i=a?"cmd":"sh",o=a?["/c",n]:["-c",n];return r.run(i,o,{cwd:e,silent:!1})};class nt extends C{id="shell";async readPublishedVersion(e){const s=e.perPackageConfig??{},{workspaceConfig:t}=e;if(!t)return;const n=re(e.pkg.name,s,t);if(!n.checkPublished)return;const a=await K(e.pm.runner,e.pkg.dir,n.checkPublished,{name:e.pkg.name,version:e.pkg.version});if(a.exitCode!==0)return;const i=a.stdout.trim();return/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(i)?.[0]}async publish(e){if(e.dryRun)return{output:`[dry-run / shell] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const{workspaceConfig:s}=e,t=e.perPackageConfig??{};if(!s)throw new g({code:"CONFIG_INVALID",message:`Shell publish actions for ${e.pkg.name} require a workspace config (release.allowCustomCommands gate).`,packageName:e.pkg.name});const n=re(e.pkg.name,t,s);if(!n.publishCommand)throw new g({code:"CONFIG_INVALID",hint:`Set release.allowCustomCommands (workspace-wide boolean or an allow-list including "${e.pkg.name}") and configure release.packages["${e.pkg.name}"].publishCommand.`,message:`Shell publish actions for ${e.pkg.name} require a publishCommand AND the trust gate to permit it.`,packageName:e.pkg.name});const a={name:e.pkg.name,registry:e.registry,tag:e.tag,version:e.release.newVersion};if(n.checkPublished){const o=await K(e.pm.runner,e.pkg.dir,n.checkPublished,a);if(o.exitCode===0&&/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(o.stdout.trim())?.[0]===e.release.newVersion)return{alreadyPublished:!0,output:`[shell] ${e.pkg.name}@${e.release.newVersion} already on the registry`,published:!1}}if(n.buildCommand){const o=await K(e.pm.runner,e.pkg.dir,n.buildCommand,a);if(o.exitCode!==0)throw new g({code:"PUBLISH_FAILED",message:`buildCommand failed for ${e.pkg.name}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}const i=Array.isArray(n.publishCommand)?n.publishCommand:[n.publishCommand];for(const o of i){const c=await K(e.pm.runner,e.pkg.dir,o,a);if(c.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:"Inspect the publishCommand output above. Common causes: missing auth token, registry unreachable, version already published (re-run safe — `checkPublished` short-circuits subsequent runs).",message:`publishCommand failed for ${e.pkg.name}@${e.release.newVersion}: exit ${c.exitCode}. stderr: ${c.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[shell] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}}const at=async(r,e)=>{try{return(await r.pm.runner.run("git",["rev-parse","--quiet","--verify",`refs/tags/${e}`],{cwd:r.pkg.dir,silent:!0})).exitCode===0}catch{return!1}};class it extends C{id="swift";async readPublishedVersion(e){}async publish(e){const s=e.release.newVersion,t=e.perPackageConfig?.releaseTagPattern??e.workspaceConfig?.releaseTagPattern,n=t===void 0?Be(e.pkg.name,s):z(t,{name:e.pkg.name,version:s});if(e.dryRun)return{output:`[dry-run / swift] would tag ${n} for ${e.pkg.name}@${s}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be released from Windows yet: SwiftPM is not run on Windows here. Release from a POSIX runner.`,packageName:e.pkg.name});return await at(e,n)?{alreadyPublished:!0,output:`[swift] tag ${n} already exists; ${e.pkg.name}@${s} skipped`,published:!1}:{output:`[swift] ${e.pkg.name}@${s} is released by tag ${n}, created with the release`,published:!0}}}const ot=(r,e,s)=>{const t=s.perPackageConfig?.releaseTagPattern??s.workspaceConfig?.releaseTagPattern;return t?z(t,{channel:s.channel,name:r,version:e}):Be(r,e)};class ct extends C{id="zig";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=ot(s,t,{channel:e.tag,perPackageConfig:e.perPackageConfig,workspaceConfig:e.workspaceConfig});if(e.dryRun)return{output:`[dry-run / zig] would tag ${n} for ${s}@${t}; nothing is uploaded`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be released from Windows yet: the Zig path is only verified on POSIX. Release from a POSIX runner.`,packageName:s});return await ue({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[zig] tag ${n} already exists for ${s}@${t}; skipped`,published:!1}:{output:`[zig] ${s}@${t} has no registry; tag ${n} is created by the release`,published:!0}}}const Pt=r=>{switch(r){case"cargo":return new ur;case"composer":return new gr;case"container":return new wr;case"dart":return new kr;case"gem":return new Cr;case"go":return new Nr;case"gradle":return new Mr;case"hex":return new Br;case"maven":return new Rr;case"native-addon":return new qr;case"nuget":return new et;case"private":return new st;case"python":return new fs;case"shell":return new nt;case"swift":return new it;case"zig":return new ct;default:return new us}};export{We as a,Pt as b,cs as c,Es as d,Y as e,qe as f,R as g,Ys as h,Q as i,Xs as j,es as k,qs as l,bt as m,yt as n,vt as o,Ms as p,$t as q,de as r,Js as s,It as t,Ct as u,kt as v};
|
|
56
|
+
`),{alreadyPublished:!1,output:`stage-timeout: ${t}`,published:!1,stageId:t})}}const Yr=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Xr=(r,e)=>{const s={...r};for(const t of Yr){const n=r[t];if(!n||typeof n!="object")continue;const a={...n};for(const[i,o]of Object.entries(n)){if(!o.startsWith("workspace:"))continue;const c=e.get(i);c&&(a[i]=We(o.slice(10)==="*"?"*":o,c.version),a[i].startsWith("workspace:")&&(a[i]=a[i].slice(10)))}s[t]=a}return s},zr=Object.defineProperty({__proto__:null,NpmVersionActions:us},Symbol.toStringTag,{value:"Module"}),je="https://api.nuget.org/v3/index.json",Qr="https://api.nuget.org/v3-flatcontainer",M="NUGET_API_KEY",T=[10,0,300],Zr=r=>{const e=/^(\d+)\.(\d+)\.(\d+)(-[\w.-]+)?/.exec(r.trim());if(!e)return!1;const s=[Number(e[1]),Number(e[2]),Number(e[3])];for(const[t,n]of s.entries())if(n!==T[t])return n>T[t];return e[4]===void 0},Le=r=>r.split("+")[0].toLowerCase(),xr=async(r,e,s)=>{try{const t=await S(`${Qr}/${encodeURIComponent(r)}/index.json`,{headers:{Accept:"application/json"},httpProxy:s.workspaceConfig?.httpProxy});if(!t.ok)return!1;const n=await t.json();return(typeof n=="object"&&n!==null&&Array.isArray(n.versions)?n.versions:[]).some(i=>typeof i=="string"&&Le(i)===Le(e))}catch{return!1}},Re=(r,e)=>r.split(e).join("***").trim().slice(0,500);class et extends C{id="nuget";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=e.pkg.manifestPath,a=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / nuget] would run dotnet pack ${j(n)} -c Release, then dotnet nuget push the package to ${je} for ${s}@${t}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be published from Windows yet: the NuGet path is only verified on POSIX. Publish from a POSIX runner.`,packageName:s});const i=await e.pm.runner.run("dotnet",["--version"],{cwd:a,silent:!0}).then(l=>l.exitCode===0?l.stdout:void 0).catch(()=>{});if(i===void 0)throw new g({code:"CONFIG_INVALID",message:`${s} needs the dotnet CLI on PATH to publish, and "dotnet --version" failed. Install the .NET SDK on the runner.`,packageName:s});if(!Zr(i))throw new g({code:"CONFIG_INVALID",message:`${s} publishes with the ${M} environment variable, which dotnet nuget push reads from .NET SDK ${T.join(".")} (NuGet 7.6) on. This runner has dotnet ${i.trim()}. Install .NET SDK ${T.join(".")} or later on the runner.`,packageName:s});if(await xr(s,t,e))return{alreadyPublished:!0,output:`[nuget] ${s}@${t} is already on nuget.org; skipped`,published:!1};const o=process.env[M];if(o===void 0||o==="")throw new g({code:"CONFIG_INVALID",message:`${s} needs the API key in the ${M} environment variable to push to nuget.org. Set it on the runner; vis never logs it.`,packageName:s});const c=await ks(f(J(),"vis-nuget-"));try{const l=await e.pm.runner.run("dotnet",["pack",n,"-c","Release","-o",c],{cwd:a,silent:!1});if(l.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Failing step: dotnet pack ${j(n)}
|
|
57
|
+
Fix the build or packaging error above.`,message:`dotnet pack failed for ${s}@${t}: exit ${l.exitCode}. stderr: ${Re(l.stderr,o)}`,packageName:s});const p=(await ce(c)).filter(m=>m.endsWith(".nupkg")&&!m.endsWith(".symbols.nupkg"));if(p.length!==1)throw new g({code:"PUBLISH_FAILED",hint:`dotnet pack wrote ${p.length} packages to a temporary directory. vis pushes exactly one per project.`,message:`expected one .nupkg for ${s}@${t}, found ${p.length}`,packageName:s});const u=await e.pm.runner.run("dotnet",["nuget","push",f(c,p[0]),"--source",je],{cwd:a,env:{[M]:o},silent:!1});if(u.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Failing step: dotnet nuget push
|
|
58
|
+
Check the output above. A version nuget.org already has is refused. The key comes from ${M}, which dotnet nuget push reads on .NET SDK ${T.join(".")} or later.`,message:`dotnet nuget push failed for ${s}@${t}: exit ${u.exitCode}. stderr: ${Re(u.stderr,o)}`,packageName:s})}finally{await le(c,{force:!0,recursive:!0})}return{output:`[nuget] published ${s}@${t} to nuget.org`,published:!0}}}class st extends C{id="private";async readPublishedVersion(e){}async publish(e){return{output:`[private] skipped publish for ${e.pkg.name}@${e.release.newVersion}`,published:!1}}}const ds=r=>`https://pypi.org/pypi/${encodeURIComponent(r.toLowerCase())}/json`,rt=(r,e)=>e?.uvLockPath?f(r.dir,e.uvLockPath):f(r.dir,"uv.lock"),tt=async(r,e)=>{let s;try{s=await X(r)}catch{return"no-root-pyproject"}if(s===void 0)return"no-root-pyproject";const t=s.tool?.uv?.workspace?.members;if(!Array.isArray(t)||t.length===0)return"no-workspace";const n=e.replace(/^\.\//,"").replaceAll("\\","/");for(const a of t){if(typeof a!="string")continue;const i=a.replace(/^\.\//,"").replaceAll("\\","/");if(i===n)return"member";if(i.endsWith("/*")){const o=i.slice(0,-2);if(n.startsWith(`${o}/`)&&!n.slice(o.length+1).includes("/"))return"member"}if(i.endsWith("/**")){const o=i.slice(0,-3);if(n===o||n.startsWith(`${o}/`))return"member"}}return"missing"},X=async r=>{const e=f(r,"pyproject.toml");let s;try{s=await P(e,"utf8")}catch(n){const{code:a}=n;if(a==="ENOENT")return;throw new g({cause:n,code:"BUMP_FILE_INVALID",file:e,message:`Failed to read ${e}: ${n.message}`})}const{parse:t}=await import("./index4.js");try{return t(s)}catch(n){throw new g({cause:n,code:"BUMP_FILE_INVALID",file:e,message:`Failed to parse ${e}: ${n.message}`})}},ps=async(r,e)=>{try{return(await r.run("uv",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}},gs=r=>{const e=r?.["build-system"]?.["build-backend"];return e?e.startsWith("hatchling")?"hatch":e.startsWith("poetry.core")||e.startsWith("poetry_core")?"poetry":e.startsWith("pdm.backend")||e.startsWith("pdm_backend")?"pdm":e.startsWith("setuptools")?"setuptools":e.startsWith("uv_build")||e.startsWith("uv.build")?"uv":"unknown":"unknown"},ms=(r,e)=>r==="uv"||r==="unknown"&&e?{backend:r,buildCommand:{args:["build"],binary:"uv"},hasUv:e,publishCommand:{args:["publish"],binary:"uv"}}:{backend:r,buildCommand:{args:["-m","build"],binary:"python"},hasUv:e,publishCommand:{args:["upload","dist/*"],binary:"twine"}},hs=(r,e)=>ts({env:r,staticTokenVar:"TWINE_PASSWORD",workspaceConfig:e}),ie=async(r,e)=>{try{const s=await S(ds(r),{headers:{Accept:"application/json"},httpProxy:e});return s.status===404||!s.ok?void 0:(await s.json())?.info?.version}catch{return}},oe=(r,e)=>e?.pythonProjectDir?f(r.dir,e.pythonProjectDir):r.dir;class fs extends C{id="python";async readPublishedVersion(e){const s=oe(e.pkg,e.perPackageConfig),n=(await X(s).catch(()=>{}))?.project?.name??e.pkg.name.replace(/^@[^/]+\//,"");return ie(n)}async publish(e){if(e.dryRun)return{output:`[dry-run / python] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const s=e.perPackageConfig??{},t=oe(e.pkg,s),n=await X(t);if(n?.project?.dynamic?.includes("version"))throw new g({code:"CONFIG_INVALID",file:f(t,"pyproject.toml"),hint:"Dynamic versioning isn't supported by PythonVersionActions yet; use versionActions: 'shell' with your build backend's version-bump tool (e.g. `hatch version` or `poetry version` for non-vcs setups).",message:`${e.pkg.name}: pyproject.toml declares dynamic = ["version", ...]; PythonVersionActions requires a static [project] version.`,packageName:e.pkg.name});if(n?.project?.version&&n.project.version!==e.release.newVersion)throw new g({code:"BUMP_FILE_INVALID",file:f(t,"pyproject.toml"),hint:`Ensure the pyproject() preset is wired up for this package so the version literal in [project] is bumped before publish. Expected ${e.release.newVersion}, found ${n.project.version}.`,message:`${e.pkg.name}: pyproject.toml version ${n.project.version} differs from planned ${e.release.newVersion}.`,packageName:e.pkg.name});const a=n?.project?.name??e.pkg.name.replace(/^@[^/]+\//,"");if(await ie(a,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[python] ${a}@${e.release.newVersion} already on PyPI`,published:!1};const o=await ps(e.pm.runner,e.pkg.dir),c=gs(n),l=ms(c,o),d=hs(process.env,e.workspaceConfig);if(d==="missing")throw new g({code:"AUTH_MISSING",hint:["Set TWINE_PASSWORD to a PyPI API token (`TWINE_USERNAME=__token__` is injected automatically), OR","configure trusted publishing on PyPI and grant the workflow `permissions: id-token: write` so ACTIONS_ID_TOKEN_REQUEST_URL is exposed.","See https://docs.pypi.org/trusted-publishers/"].join(" "),message:`${e.pkg.name}: no PyPI credentials detected (neither TWINE_PASSWORD nor OIDC trusted-publishing env).`,packageName:e.pkg.name});const p=await e.pm.runner.run(l.buildCommand.binary,l.buildCommand.args,{cwd:t,silent:!1});if(p.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Inspect the ${l.buildCommand.binary} ${l.buildCommand.args.join(" ")} output above. Common causes: missing ${l.backend==="uv"?"uv":"build/setuptools/wheel"} dependency, broken pyproject.toml, source files missing from \`include\`.`,message:`${e.pkg.name}: build failed (${l.buildCommand.binary} ${l.buildCommand.args.join(" ")}): exit ${p.exitCode}. stderr: ${p.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});const u={...process.env};d==="token"&&!u.TWINE_USERNAME&&(u.TWINE_USERNAME="__token__");const m=await e.pm.runner.run(l.publishCommand.binary,l.publishCommand.args,{cwd:t,env:u,silent:!1});if(m.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Inspect the ${l.publishCommand.binary} output above. Common causes: invalid API token, version already published (this should have been caught by readPublishedVersion — file a vis bug), 2FA required without a token.`,message:`${e.pkg.name}: publish failed (${l.publishCommand.binary} ${l.publishCommand.args.join(" ")}): exit ${m.exitCode}. stderr: ${m.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[python/${l.backend}${l.hasUv?"+uv":""}] published ${a}@${e.release.newVersion}`,published:!0}}}const Ct=Object.defineProperty({__proto__:null,PYPI_PROJECT_URL:ds,PythonVersionActions:fs,checkUvWorkspaceMembership:tt,detectAuthMode:hs,detectBackend:gs,detectUv:ps,fetchPyPiVersion:ie,readPyProject:X,resolveBuildEnv:ms,resolveProjectDir:oe,resolveUvLockPath:rt},Symbol.toStringTag,{value:"Module"}),K=async(r,e,s,t)=>{const n=te(s,t),a=process.platform==="win32",i=a?"cmd":"sh",o=a?["/c",n]:["-c",n];return r.run(i,o,{cwd:e,silent:!1})};class nt extends C{id="shell";async readPublishedVersion(e){const s=e.perPackageConfig??{},{workspaceConfig:t}=e;if(!t)return;const n=re(e.pkg.name,s,t);if(!n.checkPublished)return;const a=await K(e.pm.runner,e.pkg.dir,n.checkPublished,{name:e.pkg.name,version:e.pkg.version});if(a.exitCode!==0)return;const i=a.stdout.trim();return/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(i)?.[0]}async publish(e){if(e.dryRun)return{output:`[dry-run / shell] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const{workspaceConfig:s}=e,t=e.perPackageConfig??{};if(!s)throw new g({code:"CONFIG_INVALID",message:`Shell publish actions for ${e.pkg.name} require a workspace config (release.allowCustomCommands gate).`,packageName:e.pkg.name});const n=re(e.pkg.name,t,s);if(!n.publishCommand)throw new g({code:"CONFIG_INVALID",hint:`Set release.allowCustomCommands (workspace-wide boolean or an allow-list including "${e.pkg.name}") and configure release.packages["${e.pkg.name}"].publishCommand.`,message:`Shell publish actions for ${e.pkg.name} require a publishCommand AND the trust gate to permit it.`,packageName:e.pkg.name});const a={name:e.pkg.name,registry:e.registry,tag:e.tag,version:e.release.newVersion};if(n.checkPublished){const o=await K(e.pm.runner,e.pkg.dir,n.checkPublished,a);if(o.exitCode===0&&/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(o.stdout.trim())?.[0]===e.release.newVersion)return{alreadyPublished:!0,output:`[shell] ${e.pkg.name}@${e.release.newVersion} already on the registry`,published:!1}}if(n.buildCommand){const o=await K(e.pm.runner,e.pkg.dir,n.buildCommand,a);if(o.exitCode!==0)throw new g({code:"PUBLISH_FAILED",message:`buildCommand failed for ${e.pkg.name}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}const i=Array.isArray(n.publishCommand)?n.publishCommand:[n.publishCommand];for(const o of i){const c=await K(e.pm.runner,e.pkg.dir,o,a);if(c.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:"Inspect the publishCommand output above. Common causes: missing auth token, registry unreachable, version already published (re-run safe — `checkPublished` short-circuits subsequent runs).",message:`publishCommand failed for ${e.pkg.name}@${e.release.newVersion}: exit ${c.exitCode}. stderr: ${c.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[shell] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}}const at=async(r,e)=>{try{return(await r.pm.runner.run("git",["rev-parse","--quiet","--verify",`refs/tags/${e}`],{cwd:r.pkg.dir,silent:!0})).exitCode===0}catch{return!1}};class it extends C{id="swift";async readPublishedVersion(e){}async publish(e){const s=e.release.newVersion,t=e.perPackageConfig?.releaseTagPattern??e.workspaceConfig?.releaseTagPattern,n=t===void 0?Be(e.pkg.name,s):z(t,{name:e.pkg.name,version:s});if(e.dryRun)return{output:`[dry-run / swift] would tag ${n} for ${e.pkg.name}@${s}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be released from Windows yet: SwiftPM is not run on Windows here. Release from a POSIX runner.`,packageName:e.pkg.name});return await at(e,n)?{alreadyPublished:!0,output:`[swift] tag ${n} already exists; ${e.pkg.name}@${s} skipped`,published:!1}:{output:`[swift] ${e.pkg.name}@${s} is released by tag ${n}, created with the release`,published:!0}}}const ot=(r,e,s)=>{const t=s.perPackageConfig?.releaseTagPattern??s.workspaceConfig?.releaseTagPattern;return t?z(t,{channel:s.channel,name:r,version:e}):Be(r,e)};class ct extends C{id="zig";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=ot(s,t,{channel:e.tag,perPackageConfig:e.perPackageConfig,workspaceConfig:e.workspaceConfig});if(e.dryRun)return{output:`[dry-run / zig] would tag ${n} for ${s}@${t}; nothing is uploaded`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be released from Windows yet: the Zig path is only verified on POSIX. Release from a POSIX runner.`,packageName:s});return await ue({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[zig] tag ${n} already exists for ${s}@${t}; skipped`,published:!1}:{output:`[zig] ${s}@${t} has no registry; tag ${n} is created by the release`,published:!0}}}const Pt=r=>{switch(r){case"cargo":return new ur;case"composer":return new gr;case"container":return new wr;case"dart":return new kr;case"gem":return new Cr;case"go":return new Nr;case"gradle":return new Mr;case"hex":return new Br;case"maven":return new Lr;case"native-addon":return new qr;case"nuget":return new et;case"private":return new st;case"python":return new fs;case"shell":return new nt;case"swift":return new it;case"zig":return new ct;default:return new us}};export{We as a,Pt as b,cs as c,Es as d,Y as e,qe as f,L as g,Ys as h,Q as i,Xs as j,es as k,qs as l,bt as m,yt as n,vt as o,Ms as p,$t as q,de as r,Js as s,It as t,Ct as u,kt as v};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as nt,e as st,a as O}from"../packem_shared/index-BdMIfGVZ.js";import{l as At}from"./ts-loader.js";import{y as Et}from"../packem_shared/index-C9ENZqH9.js";import{p as bt}from"./cli-main.js";import{q as xt,L as Ct,T as S,R as L,B as W,U as E,O as z,K as Q,Z as V,W as jt,r as K,t as kt,F as D,u as Y,x as J,H as Lt,w as Wt,M as Ut,C as St,P as Tt,v as Ot,y as Pt,Y as _t,z as It,J as Rt,A as Nt,V as zt,E as vt,G as Ft,I as Mt,N as Bt}from"../packem_shared/formatBytes-BHAzNIrn-DRcKvqnb.js";import{a3 as I,L as qt}from"./catalog.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},v=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(v.has(e)){const r=v.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return v.set(e,n),n},Yt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Jt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const F=t=>rt[t],Z=t=>ot[t],M=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Zt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Zt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&F(l),p=h&&h<128&&F(h),d=l&&l<128&&Z(l),c=l&&l<128&&M(l),u=h&&h<128&&M(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&F(y),g=y&&y<128&&M(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&Z(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!z.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!z.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!z.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Jt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>Y.test(p)||J.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||Ut.test(p)||St.test(p)||Tt.test(p)||Ot.test(p)||Pt.test(p)||_t.test(p)||It.test(p)||Rt.test(p)||Nt.test(p)||zt.test(p)||vt.test(p)||Ft.test(p)||Mt.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>Y.test(i)||J.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Ht=(t,e,s)=>{const n=[],r=S.test(t)?t.split(S).filter(Boolean):[t];for(const o of r){const a=o;if(S.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Yt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Ht(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Xt=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,N=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(S.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Xt(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&S.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=N(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),H={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=H[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
|
|
1
|
+
import{a as nt,e as st,z as O}from"../packem_shared/index-BzhrR_iC.js";import{l as At}from"./ts-loader.js";import{L as Et}from"../packem_shared/index-BisalDCf.js";import{p as bt}from"./cli-main.js";import{q as xt,L as Ct,T as S,R as L,B as W,U as E,O as z,K as Q,Z as V,W as jt,r as K,t as kt,F as D,u as Y,x as J,H as Lt,w as Wt,M as Ut,C as St,P as Tt,v as Ot,y as Pt,Y as _t,A as It,J as Rt,E as Nt,V as zt,$ as vt,G as Ft,I as Mt,N as Bt}from"../packem_shared/formatBytes-_HvjOy8a-B_qQr4Hw.js";import{a3 as I,L as qt}from"./catalog.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},v=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(v.has(e)){const r=v.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return v.set(e,n),n},Yt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Jt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const F=t=>rt[t],Z=t=>ot[t],M=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Zt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Zt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&F(l),p=h&&h<128&&F(h),d=l&&l<128&&Z(l),c=l&&l<128&&M(l),u=h&&h<128&&M(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&F(y),g=y&&y<128&&M(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&Z(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!z.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!z.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!z.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Jt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>Y.test(p)||J.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||Ut.test(p)||St.test(p)||Tt.test(p)||Ot.test(p)||Pt.test(p)||_t.test(p)||It.test(p)||Rt.test(p)||Nt.test(p)||zt.test(p)||vt.test(p)||Ft.test(p)||Mt.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>Y.test(i)||J.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Ht=(t,e,s)=>{const n=[],r=S.test(t)?t.split(S).filter(Boolean):[t];for(const o of r){const a=o;if(S.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Yt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Ht(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Xt=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,N=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(S.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Xt(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&S.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=N(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),H={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=H[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
|
|
2
2
|
`)&&!t.startsWith(`${k}\r
|
|
3
3
|
`))return{body:t};const s=t.indexOf(`
|
|
4
4
|
${k}`,k.length);if(s===-1)return{body:t};let n=s+1+k.length;t[n]==="\r"&&(n+=1),t[n]===`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as s}from"./cli-main.js";import{c as a,f as c}from"../packem_shared/registry-keys-
|
|
1
|
+
import{p as s}from"./cli-main.js";import{c as a,f as c}from"../packem_shared/registry-keys-DxdqMzyp.js";const f=async({options:r})=>{if(r.clear){const t=a();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
|
|
2
2
|
`);return}s.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await c({forceRefresh:!0});if(e===void 0){if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
|
|
3
3
|
`),process.exitCode=1;return}s.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(r.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){s.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}s.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)};export{f as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as d,U as a}from"../packem_shared/index-BzhrR_iC.js";import{r as m}from"../packem_shared/resolve-runtime-DNukUjIr.js";import{r as l}from"../packem_shared/run-file-UBukWaha.js";const p=s=>{let r,o=!1,n;const i=[];for(let e=0;e<s.length;e+=1){const t=s[e];if(n===void 0){if(t==="--node"){o=!0;continue}if(t==="--runtime"){r=s[e+1],e+=1;continue}if(t.startsWith("--runtime=")){r=t.slice(10);continue}n=t;continue}i.push(t)}return i[0]==="--"&&i.shift(),{file:n,node:o,runtimeFlag:r,scriptArguments:i}},w=async s=>{const{file:r,node:o,runtimeFlag:n,scriptArguments:i}=p(s);if(r===void 0){process.stderr.write(`No file specified. Usage: vis x <file> [args...]
|
|
2
2
|
`),process.exitCode=1;return}const e=process.cwd(),t=d(r)?r:a(e,r);if(o){const c=await l(t,i,"node",e,{node:!0});c!==0&&(process.exitCode=c);return}let u;try{u=m(e,{flag:n})}catch(c){process.stderr.write(`${c.message}
|
|
3
3
|
`),process.exitCode=1;return}const f=await l(t,i,u.runtime,e);f!==0&&(process.exitCode=f)};export{p as parseLeanXArgs,w as runLeanX};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as _}from"node:module";import{w as x,p as t,x as R}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-
|
|
1
|
+
import{createRequire as _}from"node:module";import{w as x,p as t,x as R}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-RM72mDZg.js";import{a as M}from"../packem_shared/build-scripts-CEDx_nJp.js";import{e as v}from"../packem_shared/index-BzhrR_iC.js";import{y as w}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as q}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");w(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!w($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=d.includes("/")?d.split("/").pop():d;b(k,d,s)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))b(k,d,s);const g=v(s,"node_modules");w(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),F=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?x(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
|
|
2
2
|
`);return}if(t.info(`Build-script status (${p.name}):
|
|
3
3
|
`),n.installed.length===0&&n.unapproved.length===0&&t.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){t.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)t.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){t.info(""),t.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)t.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);t.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){t.info(""),t.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)t.info(` ! ${e}`);t.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){t.info(""),t.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:s}of n.versionDrift)t.info(` ${e} → ${s}`);t.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(o.length>0){t.info(""),t.warn(` Bin conflicts (${String(o.length)}) — multiple packages expose the same bin name:`);for(const e of o)t.info(` ${e.bin} ← ${e.packages.map(s=>s.name).join(", ")}`);t.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(r?.hasDrift){t.info("");for(const e of R(r))t.warn(e)}};export{F as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-
|
|
1
|
+
import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-RM72mDZg.js";let _;const w=e=>(_??=f(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,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",v=()=>!!process.stdout.isTTY&&process.env.CI!=="true",$=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,a=>{r.close();const n=a.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=p(e),r=I(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},C=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},R=e=>{let t="pnpm";try{t=p(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),E=async(e={})=>{const t=e.interactive??v(),r=e.prompt??$,a=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),i=R(l);try{return await n()}catch(d){const{code:u,message:m}=d;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!m.includes(s))throw d}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
|
|
2
2
|
${i}`);if(!await r(`${s} isn't installed. Install it now?`))throw new Error(`${s} install declined. Re-run \`vis attest\` after installing manually:
|
|
3
3
|
${i}`);const c=await a(l);if(c.exitCode!==0)throw new Error(`Install of ${s} failed (exit ${String(c.exitCode)}). Install manually and retry:
|
|
4
4
|
${i}`);return await n()};export{R as installCommandFor,C as isSigstoreInstalled,E as loadOptionalSigstore};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as ta}from"node:module";import{a as J}from"../packem_shared/index-B4AjSxHU.js";import{DEFAULT_CHANGES_DIR as oe,DEFAULT_DEPENDENCY_BUMP_RULES as ga,DEFAULT_CONFIG as ua}from"./DEFAULT_CLEAN_KEEP.js";import{VisReleaseError as E}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{l as ma,m as fa,p as ha,b as wa}from"./index2.js";import{
|
|
1
|
+
import{createRequire as ta}from"node:module";import{a as J}from"../packem_shared/index-B4AjSxHU.js";import{DEFAULT_CHANGES_DIR as oe,DEFAULT_DEPENDENCY_BUMP_RULES as ga,DEFAULT_CONFIG as ua}from"./DEFAULT_CLEAN_KEEP.js";import{VisReleaseError as E}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{l as ma,m as fa,p as ha,b as wa}from"./index2.js";import{L as ya}from"../packem_shared/index-BisalDCf.js";import{BUMP_LEVELS as be,maxBump as we,normaliseGroup as $e,bumpRank as ce}from"../release/types.js";import{isValidPackageName as va,escapeMarkdown as ka,assertValidPackageName as Pa}from"./security.js";import le from"./index.js";import{d as ba,c as $a}from"./index3.js";import{createShellRunner as re}from"./shell-runner.js";let ra;const ia=e=>(ra??=ta(import.meta.url))(e),ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=e=>{if(typeof ne<"u"&&ne.versions&&ne.versions.node){const[a,s]=ne.versions.node.split(".").map(Number);if(a>22||a===22&&s>=3||a===20&&s>=16)return ne.getBuiltinModule(e)}return ia(e)},{readdir:oa,readFile:ca,writeFile:la,unlink:da}=Pe("node:fs/promises"),{resolve:W,sep:x,join:pa,dirname:ge}=Pe("node:path"),{realpathSync:Ce}=Pe("node:fs"),Ca=/^exit[\s-]prerelease\s*:\s*(.+)$/i,Ra=/^(.+)@(\d+\.\d+\.\d+(?:[-+].*)?)$/,Re=(e,a,s)=>{if(!va(e))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Invalid replay condition "${a}": ${JSON.stringify(e)} is not a valid package name.`,packageName:e||void 0});return e},Aa=(e,a)=>{if(typeof e!="string"||e.trim()==="")throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid replay condition: ${JSON.stringify(e)}. Expected "name@1.2.0" or "exit-prerelease:name".`});const s=e.trim(),n=Ca.exec(s);if(n)return{kind:"exit-prerelease",package:Re((n[1]??"").trim(),s,a)};const t=Ra.exec(s);if(t)return{kind:"version",package:Re((t[1]??"").trim(),s,a),version:t[2]??""};throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid replay condition "${s}". Expected "name@1.2.0" or "exit-prerelease:name".`})},Na=(e,a)=>{if(!Array.isArray(e))throw new E({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(s=>Aa(s,a))},ye=e=>!("bumps"in e.payload)&&Array.isArray(e.payload.replay)&&e.payload.replay.length>0,Ae=e=>/^\d+\.\d+\.\d+-/.test(e),Ea=(e,a)=>e.package!==a.name?!1:e.kind==="version"?a.newVersion===e.version:Ae(a.oldVersion)&&!Ae(a.newVersion),Ia=(e,a)=>{const s=new Map,n=[],t=[];for(const r of e){if(!ye(r))continue;const l=r.payload.replay;let c=!0;for(const i of l){const o=a.find(d=>Ea(i,d));if(o){const d=s.get(o.name)??[];d.some(u=>u.id===r.id)||d.push(r),s.set(o.name,d)}else c=!1}c?n.push(r):t.push(r)}return{consumed:n,injectionsByPackage:s,retained:t}},Ma=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,Da=e=>{const a=Ma.exec(e);return a?{body:(a[2]??"").trim(),frontmatter:a[1]??""}:null},ja=/^(?:@[a-z0-9-]+\/)?[\w.-]+(?:\/[\w.-]+)*(?::[\w.-]+)?$/i,_a=214,Sa=e=>e.length===0||e.length>_a||e.startsWith(".")||e.startsWith("_")||e.startsWith("-")?!1:ja.test(e),ve=e=>typeof e=="string"&&be.includes(e),Va=/^ {0,3}(#{1,3})\s+\S/,Fa=/^ {0,3}(?:```|~~~)/,Ta=e=>{let a,s=0,n=!1;for(const t of e.split(/\r?\n/)){if(Fa.test(t)){n=!n;continue}if(n)continue;const r=Va.exec(t);if(!r)continue;const l=(r[1]??"").length,c=4-l;c>s&&(s=c,a=l===1?"major":l===2?"minor":"patch")}return a},La=/^\s*(pr|commit|author)\s*:\s*(.+?)\s*$/i,Oa=e=>{const a=e.split(/\r?\n/),s={};let n=0;for(const r of a){if(r.trim()===""){n+=1;continue}const l=La.exec(r);if(!l)break;const[,c="",i=""]=l;switch(c.toLowerCase()){case"author":{s.author=i.startsWith("@")?i:`@${i}`;break}case"commit":{s.commit=i;break}case"pr":{const d=Number.parseInt(i,10);!Number.isNaN(d)&&d>0&&(s.pr=d);break}}n+=1}const t=a.slice(n).join(`
|
|
2
2
|
`).trim();return{meta:Object.keys(s).length>0?s:void 0,remainder:t}},Ne=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&("bump"in e||"replay"in e),Ba=(e,a,s)=>{const n=a.replay!==void 0;if(n&&a.bump!==void 0)throw new E({code:"BUMP_FILE_INVALID",file:s,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 t=a.bump===void 0&&n?"none":a.bump;if(!ve(t))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Invalid bump level for "${e}": ${JSON.stringify(a.bump)}. Expected one of: ${be.join(", ")}`,packageName:e});const r={bump:t,package:e};if(n&&(r.replay=Na(a.replay,s)),a.releaseAs!==void 0){if(typeof a.releaseAs!="string"||!/^\d+\.\d+\.\d+(?:[-+].*)?$/.test(a.releaseAs))throw new E({code:"BUMP_FILE_INVALID",file:s,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});r.releaseAs=a.releaseAs}if(a.cascade!==void 0){if(typeof a.cascade!="object"||a.cascade===null||Array.isArray(a.cascade))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Cascade block for "${e}" must be an object mapping package globs to bump levels.`,packageName:e});const l={};for(const[c,i]of Object.entries(a.cascade)){if(!ve(i))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Invalid cascade bump level for "${c}": ${JSON.stringify(i)}.`,packageName:e});l[c]=i}r.cascade=l}return r},ue=e=>e.replaceAll(/^.*[/\\]/g,"").replace(/\.md$/i,""),Ga=(e,a)=>{const s=Da(e);if(!s)throw new E({code:"BUMP_FILE_INVALID",file:a,message:"Change file is missing YAML frontmatter (expected `---` delimiters)."});let n;try{n=ya(s.frontmatter,{strict:!0})}catch(i){throw new E({cause:i,code:"BUMP_FILE_INVALID",file:a,message:`YAML parse failed: ${i.message}`})}if(n==null)return{body:s.body.trim(),id:ue(a),path:a,payload:{bumps:{}}};if(typeof n!="object"||Array.isArray(n))throw new E({code:"BUMP_FILE_INVALID",file:a,message:"Frontmatter must be a YAML object mapping package names to bump levels."});const t=Object.entries(n);if(t.length===0)return{body:s.body.trim(),id:ue(a),path:a,payload:{bumps:{}}};for(const[i]of t)if(!Sa(i))throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid package name: ${JSON.stringify(i)}.`,packageName:i});let r;if(t.length===1&&Ne(t[0][1])){const[i,o]=t[0];r=Ba(i,o,a)}else{const i={},o=[];for(const[d,u]of t){if(Ne(u))throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Mixed simple + nested entries are not allowed. Package "${d}" uses the nested shape but the file has multiple top-level entries.`,packageName:d});if(u==null||u===""){o.push(d);continue}if(!ve(u))throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid bump level for "${d}": ${JSON.stringify(u)}. Expected one of: ${be.join(", ")}`,packageName:d});i[d]=u}if(o.length>0){const d=Ta(s.body);if(!d)throw new E({code:"BUMP_FILE_INVALID",file:a,message:`No bump level for ${o.map(u=>`"${u}"`).join(", ")}: the entry is empty and the body has no markdown heading to infer one from. Add an explicit level (e.g. \`${o[0]}: minor\`) or a heading (\`# major\`, \`## minor\`, \`### patch\`).`,packageName:o[0]});for(const u of o)i[u]=d}r={bumps:i}}const{meta:l,remainder:c}=Oa(s.body);return{body:c,id:ue(a),meta:l,path:a,payload:r}},Bs=(e,a)=>{let s;if("bumps"in e){const n=Object.entries(e.bumps).map(([t,r])=>`${me(t)}: ${r}`);s=n.length>0?n.join(`
|
|
3
3
|
`):"{}"}else{const n=[`${me(e.package)}:`,` bump: ${e.bump}`];if(e.releaseAs&&n.push(` releaseAs: ${e.releaseAs}`),e.cascade){n.push(" cascade:");for(const[t,r]of Object.entries(e.cascade))n.push(` ${me(t)}: ${r}`)}if(e.replay&&e.replay.length>0){n.push(" replay:");for(const t of e.replay){const r=t.kind==="version"?`${t.package}@${t.version}`:`exit-prerelease:${t.package}`;n.push(` - "${r}"`)}}s=n.join(`
|
|
4
4
|
`)}return`---
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as p}from"node:module";import{F as i}from"../packem_shared/index.server-
|
|
1
|
+
import{createRequire as p}from"node:module";import{F as i}from"../packem_shared/index.server-Ca_EEVfw.js";let m;const d=r=>(m??=p(import.meta.url))(r),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,t]=c.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return c.getBuiltinModule(r)}return d(r)},{createInterface:a}=w("node:readline"),l=(r,e)=>new Promise(t=>{r.question(e,n=>{t(n.trim())})}),y=async(r,e=!0)=>{const t=a({input:process.stdin,output:process.stdout});try{const s=await l(t,`${r} ${i(e?"[Y/n]":"[y/N]")} `);return s===""?e:/^y(?:es)?$/i.test(s)}finally{t.close()}},$=async(r,e="")=>{const t=a({input:process.stdin,output:process.stdout});try{const n=e?` ${i(`(${e})`)}`:"",s=await l(t,`${r}${n} `);return s===""?e:s}finally{t.close()}},_=async(r,e)=>{if(e.length===0)throw new Error("selectPrompt called with no options.");const t=a({input:process.stdin,output:process.stdout});try{process.stdout.write(`${r}
|
|
2
2
|
`);for(const[n,s]of e.entries())process.stdout.write(` ${n+1}) ${s.label}
|
|
3
3
|
`);for(;;){const n=await l(t,i(` [1-${e.length}] `)),s=Number.parseInt(n,10);if(!Number.isNaN(s)&&s>=1&&s<=e.length)return e[s-1].value;process.stdout.write(i(` Please enter a number between 1 and ${e.length}.
|
|
4
4
|
`))}}finally{t.close()}},b=async(r,e)=>{if(e.length===0)throw new Error("multiSelectPrompt called with no options.");const t=a({input:process.stdin,output:process.stdout});try{process.stdout.write(`${r}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as d,F as i,J as l}from"../packem_shared/index.server-
|
|
1
|
+
import{b as d,F as i,J as l}from"../packem_shared/index.server-Ca_EEVfw.js";import{p as a}from"./cli-main.js";import{r as y,g}from"./catalog.js";const h=n=>{if(n===0)return"0 B";const r=["B","KB","MB","GB"],o=Math.min(Math.floor(Math.log(n)/Math.log(1024)),r.length-1),s=n/1024**o;return`${s.toFixed(s<10&&o>0?1:0)} ${r[o]}`},v=n=>{if(!n)return"never";const r=Date.parse(n);if(Number.isNaN(r))return n;const o=Date.now()-r;if(o<0)return n;const s=Math.floor(o/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const t=Math.floor(s/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`},$=async({logger:n,options:r,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const s=r.db??y(o),t=await g(o,s);if(r.format==="json"){process.stdout.write(`${JSON.stringify({dbPath:s,ecosystems:t.ecosystems.map(e=>({advisoryCount:e.advisoryCount,lastSyncIso:e.lastSyncIso,manifestEtag:e.manifestEtag??null,name:e.name})),exists:t.exists,schemaVersion:t.schemaVersion,sizeBytes:t.sizeBytes},void 0,2)}
|
|
2
2
|
`);return}if(a.info(`DB: ${s}`),!t.exists){a.warn(`No advisory DB yet. Run ${d("vis advisories sync")} to populate.`);return}if(a.info(`Schema: v${t.schemaVersion} Size: ${h(t.sizeBytes)}`),t.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 t.ecosystems){const c=e.name.padEnd(10),u=e.advisoryCount.toLocaleString().padStart(10),m=`${e.lastSyncIso||"never"} (${v(e.lastSyncIso)})`.padEnd(19),f=e.manifestEtag??i("—");a.info(`${l(c)} ${u} ${m} ${f}`)}},E=$;export{E as advisoriesStatusExecute};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{F as v}from"../packem_shared/index.server-
|
|
1
|
+
import{F as v}from"../packem_shared/index.server-Ca_EEVfw.js";import{p as c}from"./cli-main.js";import{s as S}from"../packem_shared/scan-progress-RwCRxJdX.js";import{D as $,s as b,A as D}from"./catalog.js";import{c as w}from"../packem_shared/multi-eco-lockfiles-B2X3yhyo.js";const E=o=>o?.security?.audit?.advisories??{},A=o=>o?o.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(t=>w(t)):["npm"],C=async({logger:o,options:t,visConfig:p,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const l=t.format==="json",u=E(p),m=t.source??u.source??$,f=A(t.ecosystem),y=f.map(s=>({id:s,label:`Sync ${s} advisories`})),n=S(y,{live:!l}),i=[];try{for(const s of f){n.start(s);const e=Date.now();try{const r=await b({allowedHosts:u.allowedHosts,dbPath:t.db,ecosystem:s,force:!!t.force,source:m,workspaceRoot:d});i.push({ecosystem:s,result:r}),r.upToDate?n.finish(s,"ok",`up to date · ${h(Date.now()-e)}`):n.finish(s,"ok",`${r.advisoriesIngested.toLocaleString()} advisories · ${h(r.durationMs)}`)}catch(r){const a=r instanceof Error?r.message:String(r);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}const g=i.find(s=>s.result?.rebuiltFromSchema!==void 0)?.result?.rebuiltFromSchema;if(g!==void 0){const s=`advisory database is schema v${String(g)}; rebuilt to v${String(D)}`;l?process.stderr.write(`${s}
|
|
2
2
|
`):c.info(s)}if(l){const s={ecosystems:i.map(e=>({advisoriesIngested:e.result?.advisoriesIngested??0,dbPath:e.result?.dbPath??null,durationMs:e.result?.durationMs??0,ecosystem:e.ecosystem,error:e.error??null,upToDate:e.result?.upToDate??!1})),source:m};process.stdout.write(`${JSON.stringify(s,void 0,2)}
|
|
3
3
|
`)}else{const s=i.filter(a=>a.error),e=i.filter(a=>a.result),r=e[0];r?.result?.dbPath&&c.info(v(`DB: ${r.result.dbPath}`)),s.length===0?c.success(`Synced ${e.length} ecosystem${e.length===1?"":"s"}.`):c.error(`${s.length} ecosystem${s.length===1?"":"s"} failed to sync.`)}i.some(s=>s.error)&&(process.exitCode=1)},h=o=>o>=1e3?`${(o/1e3).toFixed(1)}s`:`${Math.round(o)}ms`,M=C;export{M as advisoriesSyncExecute,A as parseEcosystems};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as n}from"./cli-main.js";import{d as u}from"../packem_shared/pm-runner-
|
|
1
|
+
import{p as n}from"./cli-main.js";import{d as u}from"../packem_shared/pm-runner-RM72mDZg.js";import{s as p}from"../packem_shared/native-config-sync-TdTWjVgI.js";import{s as g}from"../packem_shared/min-release-age-JViyQuBM.js";const y=new Set(["bun","npm","pnpm","yarn"]),S=({options:c,visConfig:a,workspaceRoot:l})=>{const i=l??process.cwd(),e=u(i);if(!y.has(e.name)){n.warn(`Package manager '${e.name}' has no native security config to sync.`);return}if(!a?.security){n.warn("vis.config has no `security` block — nothing to sync.");return}const t=a.security.policies??{},r=Object.fromEntries(Object.entries(t.installScripts?.allow??{}).filter(([,o])=>o)),f=t.firstSeen?.minutes,m=t.firstSeen?.exclude??[],s=[];if(Object.keys(r).length>0&&!c.skipAllowBuilds&&s.push(...p(e.name,i,r)),c.skipMinReleaseAge||s.push(...g(e.name,i,f,m)),s.length===0){n.success("Nothing to sync — vis.config and native PM config are aligned.");return}n.info(`Syncing vis.config security settings to ${e.name} native config…
|
|
2
2
|
`);for(const o of s)n.success(` ${o}`)};export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as g}from"node:module";import{e as p}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as g}from"node:module";import{e as p}from"../packem_shared/index-BzhrR_iC.js";import{p as e}from"./cli-main.js";import{d as _}from"../packem_shared/pm-runner-RM72mDZg.js";import{y as u}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as m}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";import{U as $}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";let y;const w=r=>(y??=g(import.meta.url))(r),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[n,s]=c.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return c.getBuiltinModule(r)}return w(r)},{spawnSync:h}=v("node:child_process"),t="@lavamoat/preinstall-always-fail",d=r=>{const n=p(r,"package.json");if(!u(n))return"no-package-json";try{const s=m(n);if(s.devDependencies?.[t]||s.dependencies?.[t])return"installed"}catch{}return"missing"},k=r=>{const n=p(r,"package.json");if(!u(n))return!1;try{const s=m(n);let i=!1;const l=a=>!a||!(t in a)?a:(i=!0,Object.fromEntries(Object.entries(a).filter(([o])=>o!==t)));return s.devDependencies=l(s.devDependencies),s.dependencies=l(s.dependencies),i&&$(n,`${JSON.stringify(s,null,2)}
|
|
2
2
|
`),i}catch{return!1}},I=({options:r,workspaceRoot:n})=>{const s=n??process.cwd();if(r.status){switch(d(s)){case"installed":{e.success(`Preinstall tripwire is installed (${t}).`),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 ${t} as a devDependency.`);break}default:e.error("No package.json found at the workspace root."),process.exitCode=1}return}if(r.remove){k(s)?e.success(`Removed ${t} from package.json. Run your PM's install to clean node_modules.`):e.info(`${t} was not present in package.json.`);return}if(d(s)==="installed"){e.info(`${t} is already installed.`);return}const i=_(s),a={bun:["add","-d",t],npm:["install","--save-dev",t],pnpm:["add","-D","-w",t],yarn:["add","-D",t]}[i.name];if(!a){e.error(`Cannot install tripwire — unsupported package manager '${i.name}'.`),process.exitCode=1;return}e.info(`Installing ${t} via ${i.name}…`);const o=h(i.name,a,{cwd:s,stdio:"inherit"});if(o.error){e.error(`Failed to install tripwire: ${o.error.message}`),process.exitCode=1;return}if(o.signal!==null){e.error(`${i.name} was terminated by signal ${o.signal}`),process.exitCode=1;return}if(o.status!==0){e.error(`${i.name} exited with code ${String(o.status)}`),process.exitCode=o.status??1;return}e.success(`Installed ${t} as a devDependency.`),e.notice(""),e.notice("How the tripwire works:"),e.notice(` ${t} 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{I as default};
|