@visulima/vis 6.1.0 → 6.1.2
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/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +1226 -1216
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/cargo-lock.js +5 -0
- package/dist/packem_chunks/cargo-plan.js +3 -3
- package/dist/packem_chunks/catalog-detector.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -94
- package/dist/packem_chunks/catalog2.js +11 -0
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +156 -174
- package/dist/packem_chunks/context.js +8 -0
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- 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/handler19.js +5 -5
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler32.js +1 -1
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +3 -3
- package/dist/packem_chunks/handler35.js +1 -1
- package/dist/packem_chunks/handler36.js +1 -1
- package/dist/packem_chunks/handler38.js +2 -2
- package/dist/packem_chunks/handler39.js +5 -5
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler40.js +1 -1
- package/dist/packem_chunks/handler41.js +1 -1
- package/dist/packem_chunks/handler42.js +1 -1
- package/dist/packem_chunks/handler43.js +1 -1
- package/dist/packem_chunks/handler44.js +1 -1
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +1 -1
- package/dist/packem_chunks/handler49.js +1 -1
- package/dist/packem_chunks/handler5.js +4 -4
- package/dist/packem_chunks/handler50.js +5 -5
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +3 -3
- package/dist/packem_chunks/handler57.js +4 -4
- package/dist/packem_chunks/handler58.js +4 -4
- package/dist/packem_chunks/handler59.js +2 -2
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +2 -2
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +3 -3
- package/dist/packem_chunks/handler65.js +2 -2
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +5 -5
- package/dist/packem_chunks/handler68.js +12 -25
- package/dist/packem_chunks/handler69.js +25 -22
- package/dist/packem_chunks/handler70.js +22 -10
- package/dist/packem_chunks/handler71.js +10 -133
- package/dist/packem_chunks/handler72.js +133 -23
- package/dist/packem_chunks/handler73.js +23 -323
- package/dist/packem_chunks/handler74.js +274 -659
- package/dist/packem_chunks/handler75.js +708 -48
- package/dist/packem_chunks/handler76.js +48 -27
- package/dist/packem_chunks/handler77.js +27 -3
- package/dist/packem_chunks/handler78.js +3 -191
- package/dist/packem_chunks/handler79.js +191 -0
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/heal.js +2 -2
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index2.js +3 -58
- package/dist/packem_chunks/index3.js +40 -3
- package/dist/packem_chunks/index6.js +135 -7
- package/dist/packem_chunks/index7.js +7 -135
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/python-plan.js +3 -3
- package/dist/packem_chunks/python-projects.js +1 -1
- package/dist/packem_chunks/python.js +1 -0
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/snapshot.js +2 -2
- package/dist/packem_chunks/state.js +2 -2
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +1 -1
- package/dist/packem_chunks/workspace.js +2 -2
- package/dist/packem_shared/ReleaseClient-CWD9BC5w.js +1 -0
- package/dist/packem_shared/advisories-DO-P0V1_.js +1 -0
- package/dist/packem_shared/{affected-selection-DGb6Xu5K.js → affected-selection-CeeZo7Uy.js} +1 -1
- package/dist/packem_shared/{ai-analysis-pldoS_N4.js → ai-analysis-BCJ1kuDM.js} +3 -3
- package/dist/packem_shared/ai-cache-iSIyY3So.js +1 -0
- package/dist/packem_shared/{ai-fix-D9MxigBQ.js → ai-fix-DIMErSws.js} +6 -6
- package/dist/packem_shared/apply-DoeQAAGm.js +6 -0
- package/dist/packem_shared/apply-release-plan-BalHtK-g.js +15 -0
- package/dist/packem_shared/{bin-AZQv95jh.js → bin-BcLTer1k.js} +1 -1
- package/dist/packem_shared/clean-package-json-rutwkKl-.js +1 -0
- package/dist/packem_shared/createAdapter-DMK4bBET.js +1 -0
- package/dist/packem_shared/createVersionActions-DXo4z8VN.js +1 -0
- package/dist/packem_shared/dependency-scan-D_v3KM59.js +1 -0
- package/dist/packem_shared/{ecosystem-gate-DiqQj0LJ.js → ecosystem-gate-CwsTc7YW.js} +1 -1
- package/dist/packem_shared/env-BSXG3QKH.js +4 -0
- package/dist/packem_shared/failure-log-DIsKBKaI.js +2 -0
- package/dist/packem_shared/formatBytes-_HvjOy8a-iHCer6uX.js +1 -0
- package/dist/packem_shared/glob-Cyk1H9ZL-CL9optrn.js +1 -0
- package/dist/packem_shared/{index-JRb5wabN.js → index-9Ot7jTd4.js} +1 -1
- package/dist/packem_shared/index-BS6A9QR_.js +1 -0
- package/dist/packem_shared/lifecycle-CQjeMPY0.js +2 -0
- package/dist/packem_shared/missing-package-json-1BIoWQq0.js +1 -0
- package/dist/packem_shared/multi-eco-lockfiles-fgkpeHJv.js +1 -0
- package/dist/packem_shared/npmrc-CHsOyMvA.js +2 -0
- package/dist/packem_shared/osv-Do9PMOea.js +1 -0
- package/dist/packem_shared/{package-version-KLwH0Ivy.js → package-version-Bq6Cne_7.js} +1 -1
- package/dist/packem_shared/packument-CbTmbHU4.js +1 -0
- package/dist/packem_shared/{project-name-filter-B1ZCsbOW.js → project-name-filter-ZQaLgytG.js} +1 -1
- package/dist/packem_shared/{provenance-L1M2FPy_.js → provenance-SX1MxPUZ.js} +1 -1
- package/dist/packem_shared/publish-Dc0XGH3K.js +34 -0
- package/dist/packem_shared/registry-Dg9XI6RT.js +81 -0
- package/dist/packem_shared/registry-keys-z038Ecb4.js +1 -0
- package/dist/packem_shared/removeSync-g1D5kONg-LbjATA8v.js +1 -0
- package/dist/packem_shared/renderToString-DR0zDUjh-DXppT6AM.js +3 -0
- package/dist/packem_shared/{resolve-explicit-CQa37JSq.js → resolve-explicit-D9kdTNvl.js} +1 -1
- package/dist/packem_shared/{run-D-uVGHQ4.js → run-DLvd3RIZ.js} +1 -1
- package/dist/packem_shared/run-summary-utils-CMeURYtS.js +1 -0
- package/dist/packem_shared/s1ngularity-BuU9Cxpy.js +1 -0
- package/dist/packem_shared/{scaffold-files-DVyfB0yz.js → scaffold-files-DJlz36Mu.js} +1 -1
- package/dist/packem_shared/scan-progress-DymX71_5.js +2 -0
- package/dist/packem_shared/{signatures-DIqFUOfs.js → signatures-CeL0bOEo.js} +1 -1
- package/dist/packem_shared/spinner-CPoBymcv.js +1 -0
- package/dist/packem_shared/table-oA7p7-yP.js +1 -0
- package/dist/packem_shared/tabs-BiSifphV.js +1 -0
- package/dist/packem_shared/{task-env-DzR4RkOj.js → task-env-C2lmxvzA.js} +1 -1
- package/dist/packem_shared/typosquats-BFKus_aM.js +1 -0
- package/dist/packem_shared/use-measured-height-BHm-HiSF.js +1 -0
- package/dist/packem_shared/vis-update-app-6QOYxnNx.js +1 -0
- package/dist/packem_shared/{vis-user-error-CRmrBaD1.js → vis-user-error-3YS7sPYy.js} +1 -1
- package/dist/packem_shared/{watch-loop-D1_e-qIl.js → watch-loop-CGi66Fs0.js} +1 -1
- package/dist/packem_shared/xxh3-BLHlvhgT.js +1 -0
- package/dist/release/core/package-managers/index.js +1 -1
- package/dist/release/core/version-actions/index.js +1 -1
- package/dist/release/index.js +1 -1
- package/index.js +26 -26
- package/package.json +9 -9
- package/dist/packem_chunks/orchestrator.js +0 -46
- package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +0 -1
- package/dist/packem_shared/createAdapter-F7GidOzU.js +0 -1
- package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +0 -1
- package/dist/packem_shared/dependency-scan-CawAKoU_.js +0 -1
- package/dist/packem_shared/failure-log-BP-gCUb5.js +0 -2
- package/dist/packem_shared/formatBytes-_HvjOy8a-B_qQr4Hw.js +0 -4
- package/dist/packem_shared/glob-Cyk1H9ZL-Dxlf9Swz.js +0 -1
- package/dist/packem_shared/index-CDHP1kby.js +0 -1
- package/dist/packem_shared/lifecycle-DvmDIRbb.js +0 -2
- package/dist/packem_shared/missing-package-json-Cu5YVAot.js +0 -1
- package/dist/packem_shared/multi-eco-lockfiles-B2X3yhyo.js +0 -1
- package/dist/packem_shared/packument-zb18Jnlw.js +0 -1
- package/dist/packem_shared/registry-keys-DxdqMzyp.js +0 -1
- package/dist/packem_shared/s1ngularity-CO5GkkqX.js +0 -1
- package/dist/packem_shared/scan-progress-RwCRxJdX.js +0 -2
- package/dist/packem_shared/spinner-BJjbNl1F.js +0 -1
- package/dist/packem_shared/tabs--uxJGL8N.js +0 -1
- package/dist/packem_shared/typosquats-D4DEHhFy.js +0 -1
- package/dist/packem_shared/use-measured-height-DUZyyias.js +0 -1
- package/dist/packem_shared/vis-update-app-9b2kSk9f.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as At}from"node:module";import{Y as It,w as Wt,e as kt,j,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-Ca_EEVfw.js";import{u as ut,c as B,e as Mt}from"../packem_shared/vis-user-error-
|
|
1
|
+
import{createRequire as At}from"node:module";import{Y as It,w as Wt,e as kt,j,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-Ca_EEVfw.js";import{u as ut,c as B,e as Mt}from"../packem_shared/vis-user-error-3YS7sPYy.js";import{N as R,a as _}from"../packem_shared/Table-Bo1JKNCN-CGGet8ES.js";import{t as Ct}from"../packem_shared/package-version-Bq6Cne_7.js";let Ot;const xt=t=>(Ot??=At(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Et=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[e,n]=E.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return E.getBuiltinModule(t)}return xt(t)},{createRequire:Bt}=Et("node:module"),jt=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,z=t=>{let[,e]=jt.exec(t)??[];const n=e?e.length:0;if(n===3){const s=e.charAt(0),o=e.charAt(1),i=e.charAt(2);e=s+s+o+o+i+i}else if(n!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${t}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},dt=(t,e,n)=>t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(n/51),H=t=>{let e,n,r;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=n=r=((t-232)*10+8)/255;else{t-=16;const i=t%36;e=Math.floor(t/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const s=Math.max(e,n,r)*2;if(s===0)return 30;const o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(e));return s===2?o+60:o},Z=(t,e,n)=>H(dt(t,e,n));function Rt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}const S=(t,e,n)=>e>t?e:Math.min(t,n),m=39,f=49,X=10,tt={close:"",open:""},ht=t=>{const e=t>0?(l,d)=>({close:`\x1B[${String(d)}m`,open:`\x1B[${String(l)}m`}):()=>tt,n=l=>(d,p,g)=>l(dt(Number(d),Number(p),Number(g))),r=l=>d=>{const[p,g,w]=z(d);return l(p,g,w)};let s=l=>e(`38;5;${String(l)}`,m),o=l=>e(`48;5;${String(l)}`,f),i=(l,d,p)=>e(`38;2;${String(l)};${String(d)};${String(p)}`,m),a=(l,d,p)=>e(`48;2;${String(l)};${String(d)};${String(p)}`,f);t===1?(s=l=>e(H(Number(l)),m),o=l=>e(H(Number(l))+X,f),i=(l,d,p)=>e(Z(Number(l),Number(d),Number(p)),m),a=(l,d,p)=>e(Z(Number(l),Number(d),Number(p))+X,f)):t===2&&(i=n(s),a=n(o));const u={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),underlineCurly:e("4:3",24),underlineDashed:e("4:5",24),underlineDotted:e("4:4",24),underlineDouble:e("4:2",24),visible:tt},c={bgBlack:e(40,f),bgBlackBright:e(100,f),bgBlue:e(44,f),bgBlueBright:e(104,f),bgCyan:e(46,f),bgCyanBright:e(106,f),bgGray:e(100,f),bgGreen:e(42,f),bgGreenBright:e(102,f),bgGrey:e(100,f),bgMagenta:e(45,f),bgMagentaBright:e(105,f),bgRed:e(41,f),bgRedBright:e(101,f),bgWhite:e(47,f),bgWhiteBright:e(107,f),bgYellow:e(43,f),bgYellowBright:e(103,f),black:e(30,m),blackBright:e(90,m),blue:e(34,m),blueBright:e(94,m),cyan:e(36,m),cyanBright:e(96,m),gray:e(90,m),green:e(32,m),greenBright:e(92,m),grey:e(90,m),magenta:e(35,m),magentaBright:e(95,m),red:e(31,m),redBright:e(91,m),white:e(37,m),whiteBright:e(97,m),yellow:e(33,m),yellowBright:e(93,m)},h={bg:l=>o(S(l,0,255)),bgHex:r(a),bgRgb:(l,d,p)=>a(S(l,0,255),S(d,0,255),S(p,0,255)),fg:l=>s(S(l,0,255)),hex:r(i),rgb:(l,d,p)=>i(S(l,0,255),S(d,0,255),S(p,0,255))};return{baseColors:c,baseStyles:u,styleMethods:h}},pt=It();Wt();ht(pt);const _t=(t,e,n)=>{if(e==="")return t;let r=t.indexOf(e);if(r<0)return t;const s=e.length;let o=0,i="";for(;~r;)i+=t.slice(o,r)+n,o=r+s,r=t.indexOf(e,o);return i+t.slice(o)},Pt=(t,e,n)=>{if(t==null||t==="")return"";let r;if(t.raw===void 0?r=String(t):r=String.raw(t,...e),r.includes("\x1B"))for(let s=n;s;s=s.props)r=_t(r,s.close,s.open);return r.includes(`
|
|
2
2
|
`)&&(r=r.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+r+n.closeStack},Tt=function(t){const e=t?.level??pt,{baseColors:n,baseStyles:r,styleMethods:s}=ht(e),o={};let i=null;const a=({props:c},{close:h,open:l})=>{const d=(c?.openStack??"")+l,p=h+(c?.closeStack??""),g=(w,...y)=>Pt(w,y,g.props);return Object.setPrototypeOf(g,i),g.props={close:h,closeStack:p,open:l,openStack:d,props:c},g.open=d,g.close=p,g},u=c=>String(c);u.strip=c=>c.replaceAll(Rt(),"");for(const c in n)o[c]={get(){const h=a(this,n[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in r)o[c]={get(){const h=a(this,r[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in s)o[c]={get(){return(...h)=>a(this,s[c](...h))}};return o.ansi256=o.fg,o.bgAnsi256=o.bg,i=Object.defineProperties({},o),Object.setPrototypeOf(u,i),u},Lt=t=>(e,...n)=>{if(!Array.isArray(e)||!Array.isArray(e.raw))throw new TypeError("A tagged template literal must be provided");const r=[e.raw[0]];for(let s=1;s<e.raw.length;s+=1)r.push(String(n[s-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(e.raw[s]));return t(r.join(""))},Ft=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
|
|
3
3
|
`],["r","\r"],["t"," "],["v","\v"]]),mt=t=>{const e=t.startsWith("u"),n=t[1]==="{";return e&&!n&&t.length===5||t.startsWith("x")&&t.length===3?String.fromCodePoint(Number.parseInt(t.slice(1),16)):e&&n?String.fromCodePoint(Number.parseInt(t.slice(2,-1),16)):Ft.get(t)??t},Dt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,et=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Vt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,qt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Ut=/\s*,\s*/,Gt=(t,e)=>{const n=[],r=e.trim().split(Ut);let s;for(const o of r){const i=Number(o);if(!Number.isNaN(i))n.push(i);else if(s=Vt.exec(o))n.push(s[2].replaceAll(qt,(a,u,c)=>u?mt(u):c));else throw new Error(`Invalid template style argument: ${o} (in style '${t}')`)}return n},zt=t=>{et.lastIndex=0;const e=[];let n;for(;(n=et.exec(t))!==null;){const r=n[1];n[2]?e.push([r,...Gt(r,n[2])]):n[3]||n[4]?(n[3]&&e.push(["rgb",...z(n[3])]),n[4]&&e.push(["bgRgb",...z(n[4])])):e.push([r])}return e},nt=(t,e)=>{const n={};for(const s of e)for(const o of s.styles)n[o[0]]=s.inverse?void 0:o.slice(1);let r=t;for(const[s,o]of Object.entries(n))if(Array.isArray(o)){if(!(s in r))throw new Error(`Unknown style: ${s}`);r=o.length>0?r[s](...o):r[s]}return r},Ht=t=>e=>{const n=[],r=[];let s=[];if(e.replaceAll(Dt,(o,i,a,u,c,h)=>{if(i)s.push(mt(i));else if(u){const l=s.join("");s=[],r.push(n.length===0?l:nt(t,n)(l)),n.push({inverse:a,styles:zt(u)})}else if(c){if(n.length===0)throw new Error("Found extraneous } in template literal");r.push(nt(t,n)(s.join(""))),s=[],n.pop()}else s.push(h)}),r.push(s.join("")),n.length>0)throw new Error(`template literal is missing ${String(n.length)} closing bracket${n.length===1?"":"s"} (\`}\`)`);return r.join("")},Yt=new Tt,Jt=Ht(Yt),Kt=Lt(Jt);let Qt;const Zt=t=>(Qt??=Bt(import.meta.url))(t),O=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:A,F=t=>{if(typeof O<"u"&&O.versions&&O.versions.node){const[e,n]=O.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return O.getBuiltinModule(t)}return Zt(t)},A=O,{execFileSync:Xt}=F("node:child_process"),W=F("node:fs"),te=F("node:tty"),ee=F("node:os"),ne=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],re=12288,oe=65510,ie=[12288,12288,65281,65376,65504,65510],se=8361,ae=65518,le=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],ce=32,ue=10630,de=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],he=4352,pe=262141,ft=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],k=(t,e)=>{let n=0,r=Math.floor(t.length/2)-1;for(;n<=r;){const s=Math.floor((n+r)/2),o=s*2;if(e<t[o])r=s-1;else if(e>t[o+1])n=s+1;else return!0}return!1},rt=19968,[me,fe]=ge(ft);function ge(t){let e=t[0],n=t[1];for(let r=0;r<t.length;r+=2){const s=t[r],o=t[r+1];if(rt>=s&&rt<=o)return[s,o];o-s>n-e&&(e=s,n=o)}return[e,n]}const we=t=>t<161||t>1114109?!1:k(ne,t),be=t=>t<re||t>oe?!1:k(ie,t),ye=t=>t<se||t>ae?!1:k(le,t),$e=t=>t<ce||t>ue?!1:k(de,t),Ne=t=>t>=me&&t<=fe?!0:t<he||t>pe?!1:k(ft,t);function ve(t){return we(t)?"ambiguous":be(t)?"fullwidth":ye(t)?"halfwidth":$e(t)?"narrow":Ne(t)?"wide":"neutral"}function Se(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function gt(t){return Se(t),ve(t)}const ot=new Map,Ae=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),Oe=t=>{const e=Ae(t.width);let n=ot.get(e);return n||(n=new Map,ot.set(e,n)),n},M=new RegExp(ut.source,"y"),U=new RegExp(Mt.source,"uy"),C=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,wt=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",xe=(t,e)=>{const n=Oe(e),r=Math.floor(t/65536),s=t%65536;let o=n.get(r);if(o||(o=new Map,n.set(r,o)),o.has(s))return o.get(s);let i;switch(wt(t)){case"control":{i=e.width.control;break}case"latin":{i=e.width.regular;break}case"wide":{i=e.width.wide;break}case"zero":{i=0;break}default:switch(gt(t)){case"ambiguous":{i=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{i=e.width.fullWidth;break}case"wide":{i=e.width.wide;break}default:i=e.width.regular}}return o.set(s,i),i},Ee=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Y=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Y(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},r=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:s}=t,o=s>1e4;let i=0,a=0,u=s,c=!1;const h=t.includes("\x1B")||t.includes("");for(;i<s;){if(h&&(t[i]==="\x1B"||t[i]==="")){if(t.startsWith("\x1B]8;;",i)){const y="\x1B]8;;\x07",v=y.length,D=t.indexOf("\x07",i+5);if(D!==-1){const V=t.indexOf(y,D+1);if(V!==-1){const vt=V+v,St=t.slice(D+1,V).replace(ut,""),Q=Y(St,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,r-a),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),q=Q.width;if(Q.truncated)c=!0,u=Math.min(u,i);else if(a+q>r&&(u=Math.min(u,i),c=!0,a+q>n.truncation.limit))break;if(a+=q,i=vt,c&&a>=n.truncation.limit)break;continue}}}if(M.lastIndex=i,M.test(t)){const y=M.lastIndex-i,v=n.truncation.countAnsiEscapeCodes?y:n.width.ansi;if(a+v>r&&(u=Math.min(u,i),a+v>n.truncation.limit)){c=!0;break}a+=v,i=M.lastIndex;continue}}const p=t.codePointAt(i);if(p===8203||p===65279||p>=8288&&p<=8292){i+=1;continue}if(p===9){if(a+n.width.tab>r&&(u=Math.min(u,i),a+n.width.tab>n.truncation.limit)){c=!0;break}a+=n.width.tab,i+=1;continue}if(C.lastIndex=i,C.test(t)){const y=(C.lastIndex-i)*n.width.regular;if(a+y>r){const v=n.width.regular>0?Math.floor((r-a)/n.width.regular):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=C.lastIndex;continue}if((p<=31||p>=127&&p<=159)&&(B.lastIndex=i,B.test(t))){const y=(B.lastIndex-i)*n.width.control;if(a+y>r){const v=n.width.control>0?Math.floor((r-a)/n.width.control):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=B.lastIndex;continue}if(U.lastIndex=i,U.test(t)){if(a+n.width.emoji>r&&(u=Math.min(u,i),a+n.width.emoji>n.truncation.limit)){c=!0;break}a+=n.width.emoji,i=U.lastIndex;continue}const g=t.codePointAt(i)??0;if(Ee(g)){i+=g>65535?2:1;continue}let w;if(o)w=xe(g,n);else switch(wt(g)){case"control":{w=n.width.control;break}case"latin":{w=n.width.regular;break}case"wide":{w=n.width.wide;break}case"zero":{w=0;break}default:switch(gt(g)){case"ambiguous":{w=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{w=n.width.fullWidth;break}case"wide":{w=n.width.wide;break}default:w=n.width.regular}}if(a+w>r&&(u=Math.min(u,i),a+w>n.truncation.limit)){c=!0;break}a+=w,i+=g>65535?2:1}let l=a,d=!1;return c&&n.truncation.limit>=n.truncation.ellipsisWidth&&(l=n.truncation.limit,d=!0),{ellipsed:d,index:c?u:s,truncated:c,width:l}},Ie=(t,e={})=>Y(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,bt=80,yt=24,J=(t,e,{shell:n,env:r}={})=>Xt(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:r}).trim(),P=(t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),$t=(t,e)=>{const{columns:n,rows:r}=P(t,e);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===bt&&r===yt))return{columns:n,rows:r}},We=()=>{if(A.platform!=="linux")return!0;try{const t=W.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const n=t.slice(e+2).trim().split(/\s+/),r=Number.parseInt(n[2],10),s=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(s)||s<=0?!1:r===s}catch{return!1}};function ke(){const{env:t,stdout:e,stderr:n}=A;if(e?.columns&&e?.rows)return P(e.columns,e.rows);if(n?.columns&&n?.rows)return P(n.columns,n.rows);if(t.COLUMNS&&t.LINES)return P(t.COLUMNS,t.LINES);const r={columns:bt,rows:yt};return A.platform==="win32"?G()??r:A.platform==="darwin"?it()??G()??r:it()??G()??Be()??r}const it=()=>{try{const t=A.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:e,rows:n}=te.WriteStream(W.openSync("/dev/tty",t));return{columns:e,rows:n}}catch{}},G=()=>{try{const t=J("tput",["cols"],{env:{TERM:"dumb",...A.env}}),e=J("tput",["lines"],{env:{TERM:"dumb",...A.env}});if(t&&e)return $t(t,e)}catch{}},Be=()=>{try{if(!We())return;const t=J("resize",["-u"]).match(/\d+/g);if(t.length===2)return $t(t[0],t[1])}catch{}},I=new Map,Me=500,$=t=>{if(!t||t==="")return"";const e=I.get(t);if(e!==void 0)return e;let n;try{n=Kt(Object.assign([],{raw:[t]}))}catch{n=t}if(I.size>=Me){const r=I.keys().next().value;r!==void 0&&I.delete(r)}return I.set(t,n),n},T=()=>{const t=Ct().CEREBRO_TERMINAL_WIDTH;if(t===void 0)return;const e=Number.parseInt(t,10);if(!(Number.isNaN(e)||e<=0))return e};class Nt{lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(ee.EOL)}header(e){this.add(j(e)),this.lines.push("")}}const Ce=t=>t!==void 0&&t>0?t:ke().columns,je=(t,e,n,r)=>{if(t.length===0||t.some(c=>c.length!==2))return;let s=0;for(const c of t){const h=c[0];if(h===void 0)continue;const l=Ie(h);l>s&&(s=l)}if(s===0)return;const o=n+r,i=s+o,a=20+o;if(i+a>e)return;const u=e-i;return[i,u]};class Re extends Nt{constructor(e){if(super(),e.header&&this.header($(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(n=>typeof n=="string"))e.content.forEach(n=>{Array.isArray(n)?n.forEach(r=>{this.add($(r))}):this.add($(n))});else if(typeof e.content=="string")this.add($(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const n=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.addRow([$(e)]),n.toString()}if(Array.isArray(e)&&e.every(n=>typeof n=="string"||Array.isArray(n)&&n.every(r=>typeof r=="string"))){const n=Ce(T()),r=a=>Array.isArray(a)?a.map(u=>$(u)):[$(a)],s=e.map(a=>r(a)),o=je(s,n,4,1),i=R({columnWidths:o,showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:n,truncateOverflow:!1,wordWrap:!0});return s.forEach(a=>{o!==void 0&&a.length===2?i.addRow([{content:a[0],wordWrap:!1},a[1]]):i.addRow(a)}),i.toString()}if(typeof e=="object"){const n=e;if(!n.options||!n.data)throw new Error(`Must have an "options" or "data" property
|
|
4
4
|
${JSON.stringify(e)}`);const r=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.data.forEach(s=>{Array.isArray(s)?r.addRow(s.map(o=>$(o))):r.addRow([$(s)])}),r.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
|
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
|
|
3
|
-
`),
|
|
4
|
-
|
|
5
|
-
${s}
|
|
6
|
-
`;const t=e.split(/\r?\n/);if(t[0]&&Vs.test(t[0])){let n=1;for(;n<t.length&&!(t[n]??"").startsWith("## ");)n+=1;const a=t.slice(0,n),i=t.slice(n);return a.length>0&&a[a.length-1]!==""&&a.push(""),[...a,s,"",...i].join(`
|
|
7
|
-
`).replaceAll(/\n{3,}/g,`
|
|
8
|
-
|
|
9
|
-
`)}return Os.test(e)?`${s}
|
|
10
|
-
|
|
11
|
-
${e.trimStart()}`:`${s}
|
|
12
|
-
|
|
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},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
|
-
`);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=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
|
-
`);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}},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
|
-
→ ${b(k.hint)}`:""}`).join(`
|
|
21
|
-
`);throw new g({code:"PUBLISH_FAILED",message:`Pre-publish secret scan failed for ${n}@${e.release.newVersion}:
|
|
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(`
|
|
23
|
-
`),message:`containerImage is required for versionActions: "container" on ${e}`,packageName:e});return{buildContext:s.buildContext,containerBuildArgs:s.containerBuildArgs,containerImage:s.containerImage,containerPlatforms:s.containerPlatforms,containerSigning:s.containerSigning,containerSkipLatest:s.containerSkipLatest}};class wr extends C{id="container";async readPublishedVersion(e){const s=ns(e.perPackageConfig);if(!s.containerImage)return;const t=e.pkg.version,n=ve(s.containerImage,t);try{return(await S(n,{headers:{Accept:["application/vnd.oci.image.manifest.v1+json","application/vnd.oci.image.index.v1+json","application/vnd.docker.distribution.manifest.v2+json","application/vnd.docker.distribution.manifest.list.v2+json"].join(",")},httpProxy:e.workspaceConfig?.httpProxy,method:"HEAD"})).status===200?t:void 0}catch{return}}async publish(e){const s=fr(e.perPackageConfig,e.pkg.name);if(e.dryRun){const{command:a}=$e(e,s);return{output:`[dry-run / container] would run: ${a.join(" ")}`,published:!0}}try{const a=ve(s.containerImage,e.release.newVersion);if((await S(a,{httpProxy:e.workspaceConfig?.httpProxy,method:"HEAD"})).status===200)return{alreadyPublished:!0,output:`[container] ${s.containerImage}:${e.release.newVersion} already published`,published:!1}}catch{}const{command:t}=$e(e,s),n=await e.pm.runner.run(t[0],t.slice(1),{cwd:e.pkg.dir,silent:!1});if(n.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:["docker buildx build failed. Common causes:"," • Not authenticated to the registry — run `docker login <registry>` first."," For ECR: `aws ecr get-login-password --region <r> | docker login --username AWS --password-stdin <account>.dkr.ecr.<r>.amazonaws.com`"," For GCR/GAR: `gcloud auth configure-docker <region>-docker.pkg.dev`"," For GHCR: `echo $GITHUB_TOKEN | docker login ghcr.io -u <user> --password-stdin`"," • Buildx not installed / configured — `docker buildx create --use` (one-time setup)."," • Multi-arch build needs QEMU registered — `docker run --privileged --rm tonistiigi/binfmt --install all`."].join(`
|
|
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
|
-
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
|
-
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=>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
|
-
`))}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
|
-
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 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
|
-
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
|
-
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
|
-
registry=${ls}
|
|
35
|
-
`)};class qr extends C{id="native-addon";async readPublishedVersion(e){try{x(e.pkg.name);const{execFileSync:s}=await import("node:child_process");return s("npm",["view",e.pkg.name,"version"],{stdio:["ignore","pipe","ignore"]}).toString().trim()||void 0}catch{return}}async publish(e){if(e.dryRun){const c=await _e(e.pkg.dir);return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion} + ${c.length} platform package(s)`,published:!0}}const s=await _e(e.pkg.dir);if(s.length===0){const{NpmVersionActions:c}=await Promise.resolve().then(()=>zr);return new c().publish(e)}const{env:t}=process,n=await Hr(t),a=e.release.newVersion,i=new Map,o=[];try{await Promise.all(s.map(async y=>{const w=f(e.pkg.dir,"npm",y,"package.json"),v=await P(w,"utf8");i.set(w,v);const I=JSON.parse(v);I.version=a,await B(w,`${JSON.stringify(I,null,4)}
|
|
36
|
-
`)}));const{execFileSync:c}=await import("node:child_process"),l=await Promise.all(s.map(async y=>{const w=f(e.pkg.dir,"npm",y),v=f(w,"package.json"),I=await P(v,"utf8"),$=JSON.parse(I);x($.name);const V=await Se($.name,n,t),A=se(f(J(),"vis-release-napi-"));o.push(A);const _=f(A,".npmrc");return Ve(_,V.token),{manifest:$,npmrcPath:_,platform:y,platformDir:w}})),d=e.workspaceConfig?.publish?.guards;if(d&&Object.values(d).some(y=>y!==void 0&&y!==!1&&y!=="off")){const{runPublishGuards:y}=await import("./publish-guards.js");for(const{manifest:w,platformDir:v}of l){const I=c("npm",["pack","--dry-run","--json"],{cwd:v,stdio:["ignore","pipe","ignore"]}).toString();let $=[];try{$=JSON.parse(I)[0]?.files?.map(_=>_.path)??[]}catch{}const V=await y({config:d,manifest:w,packFiles:$,pkgDir:v,runner:e.pm.runner,sourceManifest:w});if(V.blockers.length>0){const A=V.blockers.flatMap(_=>_.findings.map(Z=>` • [${_.gate}] ${Z.message}${Z.hint?`
|
|
37
|
-
→ ${Z.hint}`:""}`)).join(`
|
|
38
|
-
`);throw new g({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${w.name}@${a} (platform package):
|
|
39
|
-
${A}`,packageName:w.name})}}}const p=e.tag??"latest",u=(y,w)=>{const v=["publish",y,"--tag",p,"--access","public","--userconfig",w];return e.provenance&&v.push("--provenance"),v};for(const{manifest:y,npmrcPath:w,platformDir:v}of l)try{c("npm",u(v,w),{env:{...t,NPM_CONFIG_USERCONFIG:w},stdio:"inherit"})}catch(I){const $=I.message;if(!$.includes("EPUBLISHCONFLICT")&&!$.includes("cannot publish over"))throw new g({cause:I,code:"PUBLISH_FAILED",message:`Failed to publish platform package ${y.name}@${a}: ${$}`,packageName:y.name})}const m=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,h={...m},b={...m.optionalDependencies};for(const{manifest:y}of l)Object.hasOwn(b,y.name)&&(b[y.name]=a);h.optionalDependencies=b;const N=de(h,e.catalogs),k=cs(N,e.cleanPackageJsonConfig),O=await P(e.pkg.manifestPath,"utf8");try{await B(e.pkg.manifestPath,`${JSON.stringify(k,null,4)}
|
|
40
|
-
`),x(e.pkg.name);const y=await Se(e.pkg.name,n,t),w=se(f(J(),"vis-release-napi-parent-"));o.push(w);const v=f(w,".npmrc");Ve(v,y.token);const I=c("npm",["pack","--pack-destination",w,"--json"],{cwd:e.pkg.dir,env:t,stdio:["ignore","pipe","ignore"]}).toString();let $;try{const A=JSON.parse(I);A[0]?.filename&&($=f(w,A[0].filename))}catch{}const V=["publish",$??e.pkg.dir,"--tag",p,"--access","public","--userconfig",v];if(e.provenance&&V.push("--provenance"),c("npm",V,{env:{...t,NPM_CONFIG_USERCONFIG:v},stdio:"inherit"}),$){const{hashTarball:A}=await import("./publish-guards.js");return{published:!0,tarball:await A($)}}return{published:!0}}finally{await B(e.pkg.manifestPath,O)}}finally{for(const[c,l]of i)try{await B(c,l)}catch{}for(const c of o)try{await le(c,{force:!0,recursive:!0})}catch{}}}}const Jr=async(r,e)=>{const{extractPackFilesFromRaw:s}=await import("./publish-guards.js"),t=s(e.raw);if(t!==void 0)return t;const n=await r.pm.runner.run("npm",["pack","--dry-run","--json"],{cwd:r.pkg.dir,silent:!0});if(n.exitCode!==0)return[];try{return s(JSON.parse(n.stdout))??[]}catch{return[]}},Oe=1800*1e3,Ee=15*1e3,De=r=>{if(r===!0)return{enabled:!0,pollIntervalMs:Ee,timeoutMs:Oe};if(r&&typeof r=="object"){const e=r;return{enabled:!0,pollIntervalMs:e.pollIntervalMs??Ee,timeoutMs:e.timeoutMs??Oe}}return{enabled:!1,pollIntervalMs:0,timeoutMs:0}};class us extends C{id="npm";async readPublishedVersion(e){try{const s=await e.pm.runner.run("npm",["view",e.pkg.name,"version","--silent"],{cwd:e.pkg.dir,silent:!0});return s.exitCode!==0?void 0:s.stdout.trim()||void 0}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(e.resumeStageId){const l=De(e.workspaceConfig?.publish?.stage);if(!l.enabled)throw new g({code:"CONFIG_INVALID",message:`Cannot resume stage ${e.resumeStageId} for ${e.pkg.name}@${e.release.newVersion}: publish.stage is now disabled. Resolve the stage manually via \`vis release stage approve|reject ${e.resumeStageId}\`.`,packageName:e.pkg.name});return this.resumeStagedPublish(e,l)}const s=e.perPackageConfig&&e.workspaceConfig?re(e.pkg.name,e.perPackageConfig,e.workspaceConfig):{};if(s.buildCommand){const l=te(s.buildCommand,{name:e.pkg.name,version:e.release.newVersion}),d=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",l]:["-c",l],{cwd:e.pkg.dir,silent:!1});if(d.exitCode!==0)throw new Error(`buildCommand failed for ${e.pkg.name}: exit ${d.exitCode}`)}const t=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,n=Xr(t,e.versionedManifestByName),a=de(n,e.catalogs),i=cs(a,e.cleanPackageJsonConfig),o=await import("node:fs/promises"),c=await o.readFile(e.pkg.manifestPath,"utf8");try{if(await o.writeFile(e.pkg.manifestPath,`${JSON.stringify(i,null,4)}
|
|
41
|
-
`),s.publishCommand){const d={name:e.pkg.name,version:e.release.newVersion},p=Array.isArray(s.publishCommand)?s.publishCommand:[s.publishCommand];for(const u of p){const m=te(u,d),h=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",m]:["-c",m],{cwd:e.pkg.dir,silent:!1});if(h.exitCode!==0)throw new Error(`publishCommand failed for ${e.pkg.name}: exit ${h.exitCode}`)}return{output:`[custom] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}const l=se(f(J(),"vis-release-pack-"));try{const d=await e.pm.pack({cwd:e.pkg.dir,destination:l}),p=e.workspaceConfig?.publish?.guards;if(p&&Object.values(p).some(w=>w!==void 0&&w!==!1&&w!=="off")){const{runPublishGuards:w}=await import("./publish-guards.js"),v=await Jr(e,d),I=await w({config:p,manifest:i,packFiles:v,pkgDir:e.pkg.dir,runner:e.pm.runner,sourceManifest:e.pkg.manifest});if(I.blockers.length>0){const{redactTokens:$}=await import("./security.js"),V=I.blockers.flatMap(A=>A.findings.map(_=>` • [${A.gate}] ${$(_.message)}${_.hint?`
|
|
42
|
-
→ ${$(_.hint)}`:""}`)).join(`
|
|
43
|
-
`);throw new g({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${e.pkg.name}@${e.release.newVersion}:
|
|
44
|
-
${V}`,packageName:e.pkg.name})}}const{hashTarball:u}=await import("./publish-guards.js"),m=await u(d.tarball);if((e.workspaceConfig?.publish?.publishStrategy??"npm-publish-tarball")==="native"){const w=e.pm.id;return e.provenance&&w==="bun"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": bun has no --provenance/OIDC support; ${e.pkg.name}@${e.release.newVersion} publishes without provenance.
|
|
45
|
-
`),e.otp&&w==="yarn"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": \`yarn npm publish\` ignores --otp; configure 2FA via .yarnrc.yml for ${e.pkg.name}.
|
|
46
|
-
`),{...await e.pm.publishNative({access:"public",cwd:e.pkg.dir,otp:e.otp,provenance:e.provenance,registry:e.registry,tag:e.tag}),tarball:m}}const h=De(e.workspaceConfig?.publish?.stage);if(h.enabled){const{refuseRestrictedOidc:w}=await import("./stage-publisher.js"),v=e.pkg.manifest.publishConfig?.access;w(v)}const b=await e.pm.publish({access:"public",otp:e.otp,provenance:e.provenance,registry:e.registry,stage:h.enabled,tag:e.tag,tarball:d.tarball});if(!h.enabled||!b.stageId)return{...b,tarball:m};const{waitForStageDecision:N}=await import("./stage-publisher.js"),{stageId:k}=b,O=Date.now();process.stderr.write(`[vis release] ⏳ ${e.pkg.name}@${e.release.newVersion} staged (id ${k}). Waiting up to ${Math.round(h.timeoutMs/6e4)}m for a maintainer to approve via npmjs.com or \`npm stage approve ${k}\`...
|
|
47
|
-
`);const y=await N({cwd:e.pkg.dir,onProgress:w=>{w>0&&w%3e5<h.pollIntervalMs&&process.stderr.write(`[vis release] still waiting for ${e.pkg.name} stage decision (${Math.round(w/6e4)}m elapsed)...
|
|
48
|
-
`)},packageName:e.pkg.name,pollIntervalMs:h.pollIntervalMs,runner:e.pm.runner,stageId:k,timeoutMs:h.timeoutMs,version:e.release.newVersion});return y==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted (${Math.round((Date.now()-O)/1e3)}s).
|
|
49
|
-
`),{...b,stageId:void 0,tarball:m}):y==="rejected"?(process.stdout.write(`::warning::Stage rejected for ${e.pkg.name}@${e.release.newVersion} (id ${k}). Re-stage by re-running the release once the review feedback is addressed.
|
|
50
|
-
`),{alreadyPublished:!1,output:`stage-rejected: ${k}`,published:!1,stageId:k}):(process.stdout.write(`::warning::Stage timeout for ${e.pkg.name}@${e.release.newVersion} (id ${k}) after ${Math.round(h.timeoutMs/6e4)}m. Re-run \`vis release publish\` once a maintainer can approve, or run \`vis release stage approve ${k}\` manually.
|
|
51
|
-
`),{alreadyPublished:!1,output:`stage-timeout: ${k}`,published:!1,stageId:k})}finally{await o.rm(l,{force:!0,recursive:!0})}}finally{await o.writeFile(e.pkg.manifestPath,c)}}async resumeStagedPublish(e,s){const t=e.resumeStageId,n=Date.now();process.stderr.write(`[vis release] ↻ Resuming wait on staged ${e.pkg.name}@${e.release.newVersion} (id ${t}) — tarball already uploaded; not re-publishing.
|
|
52
|
-
`);const{waitForStageDecision:a}=await import("./stage-publisher.js"),i=await a({cwd:e.pkg.dir,onProgress:o=>{o>0&&o%3e5<s.pollIntervalMs&&process.stderr.write(`[vis release] still waiting for ${e.pkg.name} stage decision (resume, ${Math.round(o/6e4)}m elapsed)...
|
|
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
|
-
`),{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
|
-
`),{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},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
|
+
import{createRequire as N}from"node:module";import O from"./index.js";import{VisReleaseError as l}from"../packem_shared/VisReleaseError-DZtgcKf8.js";let _;const A=c=>(_??=N(import.meta.url))(c),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=c=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[e,t]=f.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return f.getBuiltinModule(c)}return A(c)},{readFile:b,rename:L,readdir:C}=x("node:fs/promises"),{isAbsolute:k,join:u,basename:S}=x("node:path");class m{constructor(e){this.runner=e}runner;async publishNative(e){throw new l({code:"CONFIG_INVALID",hint:'Set publish.publishStrategy back to "npm-publish-tarball" (the default), or use a package manager whose adapter implements native publish.',message:`publishStrategy "native" is not supported by the "${this.id}" adapter.`})}async readCatalogYaml(e){}}const w=(c,e)=>{if(c.exitCode===0)return{output:c.stdout,published:!0};const t=`${c.stdout}
|
|
2
|
+
${c.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(t))return{alreadyPublished:!0,output:t,published:!1};throw new l({code:"PUBLISH_FAILED",message:`${e} failed: ${t}`})};class g extends m{id="npm";minVersion="11.5.1";async pack(e){const t=["pack","--json"];e.destination&&t.push("--pack-destination",e.destination);const s=await this.runner.run("npm",t,{cwd:e.cwd,silent:!0});if(s.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`npm pack failed: ${s.stderr||s.stdout}`});const a=JSON.parse(s.stdout),r=a[0]?.filename;if(!r)throw new l({code:"PUBLISH_FAILED",hint:"Upgrade npm to a version that emits --json output, or report this with the raw stdout.",message:`npm pack: could not parse output: ${s.stdout}`});const n=e.destination??e.cwd;let i=k(r)?r:u(n,r);return e.filename&&(await(await import("node:fs/promises")).rename(i,u(n,e.filename)),i=u(n,e.filename)),{raw:a,tarball:i}}async installLockfileOnly(e){const t=await this.runner.run("npm",["install","--package-lock-only"],{cwd:e.cwd,silent:e.silent});if(t.exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`npm install --package-lock-only failed: ${t.stderr||t.stdout}`})}async listWorkspacePackages(e){const t=await this.runner.run("npm",["query",".workspace","--json"],{cwd:e,silent:!0});if(t.exitCode!==0)return[];try{return JSON.parse(t.stdout).filter(a=>typeof a.name=="string").map(a=>({name:a.name,path:a.path??a.location??e,private:a.private??!1,version:a.version??"0.0.0"}))}catch{return[]}}async publish(e){const t=e.stage?["stage","publish",e.tarball]:["publish",e.tarball];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.registry&&t.push("--registry",e.registry),e.otp&&t.push("--otp",e.otp),e.provenance&&t.push("--provenance"),e.stage&&t.push("--json");for(const r of e.extraArgs??[])t.push(r);const s=await this.runner.run("npm",t,{cwd:process.cwd(),silent:!0});if(s.exitCode===0){const r={output:s.stdout,published:!0};if(e.stage)try{const n=JSON.parse(s.stdout);r.stageId=n.id??n.stageId}catch{}return r}const a=`${s.stdout}
|
|
3
|
+
${s.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(a))return{alreadyPublished:!0,output:a,published:!1};throw new l({code:"PUBLISH_FAILED",message:`npm publish failed: ${a}`})}async publishNative(e){const t=["publish"];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.registry&&t.push("--registry",e.registry),e.otp&&t.push("--otp",e.otp),e.provenance&&t.push("--provenance");for(const a of e.extraArgs??[])t.push(a);const s=await this.runner.run("npm",t,{cwd:e.cwd,silent:!0});return w(s,"npm publish")}async detectVersion(e){const t=await this.runner.run("npm",["--version"],{cwd:e,silent:!0});return t.exitCode===0?t.stdout.trim():void 0}}class j extends m{id="bun";minVersion="1.1.36";async pack(e){const t=["pm","pack"];e.destination&&t.push("--destination",e.destination);const s=await this.runner.run("bun",t,{cwd:e.cwd,silent:!0});if(s.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`bun pm pack failed: ${s.stderr||s.stdout}`});const a=/(?:^|["'\s])([^\s"']*\.tgz)/m.exec(s.stdout),r=e.destination??e.cwd;let n;if(a?.[1]){const i=a[1];n=k(i)?i:u(r,i)}else{const i=JSON.parse(await b(u(e.cwd,"package.json"),"utf8")),d=(i.name??"package").replaceAll("/","-").replace(/^@/,"");n=u(r,`${d}-${i.version??"0.0.0"}.tgz`)}if(e.filename&&S(n)!==e.filename){const i=u(r,e.filename);await L(n,i),n=i}return{raw:s.stdout,tarball:n}}async installLockfileOnly(e){const t=await this.runner.run("bun",["install","--lockfile-only"],{cwd:e.cwd,silent:e.silent});if(t.exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`bun install --lockfile-only failed: ${t.stderr||t.stdout}`})}async listWorkspacePackages(e){try{const t=JSON.parse(await b(u(e,"package.json"),"utf8")),s=Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[];if(s.length===0)return[];const a=new Set,r=["."],n=5,i=new Set;for(;r.length>0;){const o=r.shift();if(i.has(o)||(i.add(o),(o==="."?0:o.split("/").length)>n))continue;let p;try{p=await C(u(e,o),{withFileTypes:!0})}catch{continue}for(const h of p){if(!h.isDirectory()||h.name==="node_modules"||h.name.startsWith("."))continue;const y=o==="."?h.name:`${o}/${h.name}`;s.some(I=>O(I,y))&&a.add(y),r.push(y)}}const d=[];for(const o of a){const v=u(e,o,"package.json");try{const p=JSON.parse(await b(v,"utf8"));if(typeof p.name!="string")continue;d.push({name:p.name,path:u(e,o),private:p.private??!1,version:p.version??"0.0.0"})}catch{}}return d}catch{return[]}}async publish(e){return new g(this.runner).publish(e)}async publishNative(e){const t=["publish"];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.registry&&t.push("--registry",e.registry);for(const a of e.extraArgs??[])t.push(a);const s=await this.runner.run("bun",t,{cwd:e.cwd,silent:!0});return w(s,"bun publish")}async detectVersion(e){const t=await this.runner.run("bun",["--version"],{cwd:e,silent:!0});return t.exitCode===0?t.stdout.trim():void 0}}class P extends m{id="pnpm";minVersion="9.5.0";async pack(e){const t=["pack","--json"];e.destination&&t.push("--pack-destination",e.destination);const s=await this.runner.run("pnpm",t,{cwd:e.cwd,silent:!0});if(s.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`pnpm pack failed: ${s.stderr||s.stdout}`});const a=JSON.parse(s.stdout),{filename:r}=a;if(!r)throw new l({code:"PUBLISH_FAILED",message:`pnpm pack: could not parse output: ${s.stdout}`});const n=e.destination??e.cwd;let i=k(r)?r:u(n,r);return e.filename&&(await(await import("node:fs/promises")).rename(i,u(n,e.filename)),i=u(n,e.filename)),{raw:a,tarball:i}}async installLockfileOnly(e){const t=await this.runner.run("pnpm",["install","--lockfile-only"],{cwd:e.cwd,silent:e.silent});if(t.exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`pnpm install --lockfile-only failed: ${t.stderr||t.stdout}`})}async listWorkspacePackages(e){const t=await this.runner.run("pnpm",["-r","ls","--depth","-1","--json"],{cwd:e,silent:!0});if(t.exitCode!==0)return[];try{return JSON.parse(t.stdout).filter(a=>typeof a.name=="string").map(a=>({name:a.name,path:a.path??e,private:a.private??!1,version:a.version??"0.0.0"}))}catch{return[]}}async publish(e){return new g(this.runner).publish(e)}async publishNative(e){const t=["publish","--no-git-checks"];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.registry&&t.push("--registry",e.registry),e.otp&&t.push("--otp",e.otp),e.provenance&&t.push("--provenance");for(const a of e.extraArgs??[])t.push(a);const s=await this.runner.run("pnpm",t,{cwd:e.cwd,silent:!0});return w(s,"pnpm publish")}async detectVersion(e){const t=await this.runner.run("pnpm",["--version"],{cwd:e,silent:!0});return t.exitCode===0?t.stdout.trim():void 0}async readCatalogYaml(e){const t=await import("node:fs/promises");try{return await t.readFile(u(e,"pnpm-workspace.yaml"),"utf8")}catch{return}}}class $ extends m{id="yarn";minVersion="4.0.0";async pack(e){const t=e.destination??e.cwd,s=e.filename??"%s-%v.tgz",a=["pack","--out",u(t,s)],r=await this.runner.run("yarn",a,{cwd:e.cwd,silent:!0});if(r.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`yarn pack failed: ${r.stderr||r.stdout}`});const n=await import("node:fs/promises"),i=await import("node:path"),d=JSON.parse(await n.readFile(i.join(e.cwd,"package.json"),"utf8")),o=s.replaceAll("%s",(d.name??"package").replaceAll("/","-").replace(/^@/,"")).replaceAll("%v",d.version??"0.0.0");return{raw:r.stdout,tarball:u(t,o)}}async installLockfileOnly(e){const t=await this.runner.run("yarn",["install","--mode","update-lockfile"],{cwd:e.cwd,silent:e.silent});if(t.exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`yarn install --mode update-lockfile failed: ${t.stderr||t.stdout}`})}async listWorkspacePackages(e){const t=await this.runner.run("yarn",["workspaces","list","--json"],{cwd:e,silent:!0});if(t.exitCode!==0)return[];const s=[];for(const a of t.stdout.split(/\r?\n/)){const r=a.trim();if(r)try{const n=JSON.parse(r);if(typeof n.name!="string"||n.name==="")continue;s.push({name:n.name,path:n.location?u(e,n.location):e,private:!1,version:"0.0.0"})}catch{}}return s}async publish(e){return new g(this.runner).publish(e)}async publishNative(e){const t=["npm","publish"];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.provenance&&t.push("--provenance");for(const a of e.extraArgs??[])t.push(a);const s=await this.runner.run("yarn",t,{cwd:e.cwd,silent:!0});return w(s,"yarn npm publish")}async detectVersion(e){const t=await this.runner.run("yarn",["--version"],{cwd:e,silent:!0});return t.exitCode===0?t.stdout.trim():void 0}}const B=async(c,e)=>{const t=await import("node:fs/promises"),s=await import("node:path");try{const r=JSON.parse(await t.readFile(s.join(c,"package.json"),"utf8"));if(typeof r.packageManager=="string"){const n=r.packageManager.indexOf("@"),i=n>0?r.packageManager.slice(0,n):r.packageManager;if(i==="pnpm"||i==="yarn"||i==="bun"||i==="npm")return i}}catch{}const a=async r=>{try{return await t.access(s.join(c,r)),!0}catch{return!1}};return await a("bun.lock")||await a("bun.lockb")?"bun":await a("pnpm-lock.yaml")||await a("pnpm-workspace.yaml")?"pnpm":await a("yarn.lock")?"yarn":"npm"},J=(c,e)=>{switch(c){case"bun":return new j(e);case"pnpm":return new P(e);case"yarn":return new $(e);default:return new g(e)}};export{g as N,J as c,B as d};
|
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import{createRequire as Ge}from"node:module";import{VersionActions as C}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{VisReleaseError as l}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import Se from"./index.js";import{c as J}from"./cargo-lock.js";import{s as V,r as We,P as qe}from"./python.js";import{tagExists as ae,renderTagPattern as W,defaultTagFor as _e}from"./git.js";import{a as Xe,s as ne,o as ie,i as te}from"../packem_shared/gradle-build-CHZDHyjI.js";import{rewriteCatalogRefs as Ve}from"./catalog.js";import{c as Oe}from"../packem_shared/clean-package-json-rutwkKl-.js";import{assertValidPackageName as Y,resolveCustomCommands as Q,interpolateCommand as Z}from"./security.js";import{r as Je}from"../packem_shared/apply-release-plan-BalHtK-g.js";let je;const Ue=a=>(je??=Ge(import.meta.url))(a),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,K=a=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[e,r]=F.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return F.getBuiltinModule(a)}return Ue(a)},{readdir:re,readFile:_,rm:se,access:Ne,writeFile:E,mkdtemp:Be}=K("node:fs/promises"),{join:w,sep:Ae,dirname:U,relative:He,resolve:Ke,basename:R}=K("node:path"),{mkdtempSync:z,writeFileSync:Ye}=K("node:fs"),{tmpdir:B}=K("node:os"),ze=async(a,e)=>{let r=[a];for(const s of e.split("/").filter(n=>n!==""&&n!==".")){if(s==="**")throw new l({code:"CONFIG_INVALID",message:`Unsupported [workspace].members pattern "${e}": "**" is not supported. List the crate directories explicitly or use "dir/*".`});const n=/[*?[{]/.test(s),i=[];for(const t of r){if(!n){i.push(w(t,s));continue}const o=await re(t,{withFileTypes:!0}).catch(()=>[]);for(const d of o)d.isDirectory()&&Se(s,d.name)&&i.push(w(t,d.name))}r=i}return r},Qe=(a,e)=>{for(const r of e)if(a===r||a.startsWith(`${r}${Ae}`))return!0;return!1},De=async a=>{let e=U(J(a));for(;;){const r=w(e,"Cargo.toml"),s=await x(r);if(s!==void 0){const t=(await H(s,r)).workspace?.package?.version;if(typeof t=="string")return t}const n=U(e);if(n===e)return;e=n}},x=async a=>{try{return await _(a,"utf8")}catch{return}},H=async(a,e)=>{const{parse:r}=await import("./index4.js");try{return r(a)}catch(s){throw new l({cause:s,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${s.message}`})}},oe=a=>Array.isArray(a)?a.filter(e=>typeof e=="string"):[],q=a=>typeof a=="object"&&a!==null&&a.workspace===!0,Ze=(a,e)=>{const r=q(a.publish)?e.workspace?.package?.publish:a.publish;return r===!1||Array.isArray(r)&&r.length===0},xe=(a,e,r,s)=>{const n=[];for(const[i,t]of Object.entries(a.dependencies??{})){const o=t,d=q(o),u=d?e.workspace?.dependencies?.[i]:o,k=d?s:r;u===void 0||typeof u!="object"||typeof u.path!="string"||n.push({dir:Ke(k,u.path),name:typeof u.package=="string"?u.package:i,requirement:typeof u.version=="string"?u.version:"*"})}return n},er=async a=>{const{claimedDirs:e,cwd:r}=a,s=w(r,"Cargo.toml"),n=await x(s);if(n===void 0)return[];const i=await H(n,s),t=new Set;i.package&&t.add(r);const o=oe(i.workspace?.exclude);for(const g of oe(i.workspace?.members))for(const p of await ze(r,g)){const h=He(r,p).split(Ae).join("/");h.split("/").includes("target")||o.some(c=>Se(c,h))||t.add(p)}const d=new Set([...e].map(g=>J(g))),u=[];for(const g of[...t].sort()){if(Qe(J(g),d))continue;const p=w(g,"Cargo.toml"),h=await x(p);if(h===void 0)continue;const c=await H(h,p);if(!c.package)continue;const{name:b}=c.package;if(typeof b!="string"||b==="")throw new l({code:"CONFIG_INVALID",file:p,message:`${p} has a [package] table without a name.`});const P=c.package.version,v=typeof P=="string"?P:q(P)?i.workspace?.package?.version:void 0;if(typeof v!="string")throw new l({code:"CONFIG_INVALID",file:p,message:`${p} has no resolvable [package].version.`});u.push({dir:g,manifestPath:p,name:b,pathDeps:xe(c,i,g,r),private:Ze(c.package,i),version:v})}const k=new Map(u.map(g=>[g.dir,g]));return u.map(g=>{const p={};for(const c of g.pathDeps){const b=k.get(c.dir);b&&(p[b.name]=c.requirement)}const h={dependencies:p,name:g.name,private:g.private,version:g.version};return{dir:g.dir,ecosystem:"cargo",manifest:h,manifestPath:g.manifestPath,name:g.name,private:g.private,version:g.version}})},ms=Object.defineProperty({__proto__:null,discoverCargoCrates:er,findInheritedWorkspaceVersion:De,inheritsFromWorkspace:q,parseCargoDoc:H},Symbol.toStringTag,{value:"Module"}),rr="https://crates.io/api/v1/crates",sr="Cargo.toml",pe=async a=>{let e;try{e=await _(a,"utf8")}catch(o){throw new l({cause:o,code:"CONFIG_INVALID",file:a,message:`Failed to read Cargo.toml at ${a}: ${o.message}`})}const{parse:r}=await import("./index4.js");let s;try{s=r(e)}catch(o){throw new l({cause:o,code:"CONFIG_INVALID",file:a,message:`Failed to parse Cargo.toml at ${a}: ${o.message}`})}if(!s.package)throw new l({code:"CONFIG_INVALID",file:a,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 ${a} has no [package] table.`});const{name:n}=s.package;if(typeof n!="string"||n.length===0)throw new l({code:"CONFIG_INVALID",file:a,message:`Cargo.toml at ${a} is missing [package].name.`});const i=s.package.version;let t;if(typeof i=="string"?t=i:i&&typeof i=="object"&&i.workspace===!0&&(t=await De(a)??s.workspace?.package?.version),typeof t!="string"||t.length===0)throw new l({code:"CONFIG_INVALID",file:a,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 ${a} has no resolvable [package].version.`});return{name:n,version:t}},le=async(a,e)=>{const r=`${rr}/${encodeURIComponent(a)}`;try{const s=await V(r,{headers:{Accept:"application/json"},httpProxy:e});if(s.status===404||!s.ok)return;const n=await s.json();return n?.crate?.max_stable_version??n?.crate?.max_version??void 0}catch{return}},ar=(a,e)=>We({env:a,staticTokenVar:"CARGO_REGISTRY_TOKEN",workspaceConfig:e})==="oidc",nr=async(a,e)=>{const r=await a.run("cargo",["package","--list","--allow-dirty"],{cwd:e,silent:!0});return r.exitCode!==0?[]:r.stdout.split(/\r?\n/).map(s=>s.trim()).filter(s=>s.length>0)};class ir extends C{id="cargo";async readPublishedVersion(e){const r=ee(e.pkg);try{const{name:s}=await pe(r);return await le(s)}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run / cargo] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const r=ee(e.pkg,e.perPackageConfig),s=tr(e.pkg,e.perPackageConfig),{name:n,version:i}=await pe(r);if(i!==e.release.newVersion)throw new l({code:"CONFIG_INVALID",file:r,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 (${i}) does not match planned release version (${e.release.newVersion}) for ${e.pkg.name}.`,packageName:e.pkg.name});if(await le(n,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[cargo] ${n}@${e.release.newVersion} already on crates.io`,published:!1};const o=ar(process.env,e.workspaceConfig);if(!o&&!process.env.CARGO_REGISTRY_TOKEN)throw new l({code:"AUTH_MISSING",hint:"Set CARGO_REGISTRY_TOKEN, or run from a GH-Actions job with `permissions: id-token: write` for OIDC trusted publishing.",message:`Cannot publish ${n}@${e.release.newVersion}: neither CARGO_REGISTRY_TOKEN nor OIDC trusted publishing is available.`,packageName:e.pkg.name});const d=e.workspaceConfig?.publish?.guards;if(d?.packSecretScan){const g=await nr(e.pm.runner,s);if(g.length>0){const{runPackSecretScan:p}=await import("./publish-guards.js"),h=typeof d.packSecretScan=="object"?d.packSecretScan.ignore:void 0,c=await p({files:g,ignore:h,pkgDir:s});if(!c.passed){const{redactTokens:b}=await import("./security.js"),P=c.findings.map(v=>` • [packSecretScan] ${b(v.message)}${v.hint?`
|
|
2
|
+
→ ${b(v.hint)}`:""}`).join(`
|
|
3
|
+
`);throw new l({code:"PUBLISH_FAILED",message:`Pre-publish secret scan failed for ${n}@${e.release.newVersion}:
|
|
4
|
+
${P}`,packageName:e.pkg.name})}}}const u=["publish","--allow-dirty"];e.registry&&e.registry!=="https://crates.io"&&u.push("--registry",e.registry);const k=await e.pm.runner.run("cargo",u,{cwd:s,silent:!1});if(k.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:"Inspect the cargo output above. Common causes: missing CARGO_REGISTRY_TOKEN, OIDC permission misconfigured, version already published, crates.io rate limit. Re-runs are safe — the published-version probe short-circuits subsequent runs.",message:`cargo publish failed for ${n}@${e.release.newVersion}: exit ${k.exitCode}. stderr: ${k.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[cargo] published ${n}@${e.release.newVersion}${o?" (trusted publishing)":""}`,published:!0}}}const ee=(a,e)=>{const r=e?.cargoTomlPath??sr;return w(a.dir,r)},tr=(a,e)=>U(ee(a,e)),or=(a,e,r)=>W(a?.releaseTagPattern??"v{version}",{name:e,version:r});class pr extends C{id="composer";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=or(e.perPackageConfig,r,s);if(e.dryRun)return{output:`[dry-run / composer] would tag ${n} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Composer tag path is not tested there. Release from a POSIX runner.`,packageName:r});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`${r} needs git on PATH to release its tag, and git --version failed.`,packageName:r});return await ae({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[composer] ${r}@${s} is already tagged ${n}; skipped`,published:!1}:{output:`[composer] ${r}@${s} released by tag ${n}`,published:!0}}}const lr=["linux/amd64","linux/arm64"],dr=a=>{const e=a.indexOf("/");if(e===-1)return{registry:"docker.io",repository:`library/${a}`};const r=a.slice(0,e),s=a.slice(e+1);return r==="localhost"||r.includes(".")||r.includes(":")?{registry:r,repository:s}:s.includes("/")?{registry:"docker.io",repository:a}:{registry:"docker.io",repository:`${r}/${s}`}},de=(a,e)=>{const{registry:r,repository:s}=dr(a);return`https://${r==="docker.io"?"registry-1.docker.io":r}/v2/${s}/manifests/${encodeURIComponent(e)}`},Re=a=>{const e=a??{};return{buildContext:e.buildContext,containerBuildArgs:e.containerBuildArgs,containerImage:e.containerImage,containerPlatforms:e.containerPlatforms,containerSigning:e.containerSigning,containerSkipLatest:e.containerSkipLatest}},ur=(a,e)=>{const r=Re(a);if(typeof r.containerImage!="string"||r.containerImage.length===0)throw new l({code:"CONFIG_INVALID",hint:["Container packages must declare `containerImage` in their per-pkg release config:","",' release.packages["<pkg>"] = container({',' image: "ghcr.io/scope/foo",',' platforms: ["linux/amd64", "linux/arm64"],',' signing: "cosign", // optional'," })","",'Or set `versionActions: "container"` + `containerImage` directly.'].join(`
|
|
5
|
+
`),message:`containerImage is required for versionActions: "container" on ${e}`,packageName:e});return{buildContext:r.buildContext,containerBuildArgs:r.containerBuildArgs,containerImage:r.containerImage,containerPlatforms:r.containerPlatforms,containerSigning:r.containerSigning,containerSkipLatest:r.containerSkipLatest}};class cr extends C{id="container";async readPublishedVersion(e){const r=Re(e.perPackageConfig);if(!r.containerImage)return;const s=e.pkg.version,n=de(r.containerImage,s);try{return(await V(n,{headers:{Accept:["application/vnd.oci.image.manifest.v1+json","application/vnd.oci.image.index.v1+json","application/vnd.docker.distribution.manifest.v2+json","application/vnd.docker.distribution.manifest.list.v2+json"].join(",")},httpProxy:e.workspaceConfig?.httpProxy,method:"HEAD"})).status===200?s:void 0}catch{return}}async publish(e){const r=ur(e.perPackageConfig,e.pkg.name);if(e.dryRun){const{command:i}=ue(e,r);return{output:`[dry-run / container] would run: ${i.join(" ")}`,published:!0}}try{const i=de(r.containerImage,e.release.newVersion);if((await V(i,{httpProxy:e.workspaceConfig?.httpProxy,method:"HEAD"})).status===200)return{alreadyPublished:!0,output:`[container] ${r.containerImage}:${e.release.newVersion} already published`,published:!1}}catch{}const{command:s}=ue(e,r),n=await e.pm.runner.run(s[0],s.slice(1),{cwd:e.pkg.dir,silent:!1});if(n.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:["docker buildx build failed. Common causes:"," • Not authenticated to the registry — run `docker login <registry>` first."," For ECR: `aws ecr get-login-password --region <r> | docker login --username AWS --password-stdin <account>.dkr.ecr.<r>.amazonaws.com`"," For GCR/GAR: `gcloud auth configure-docker <region>-docker.pkg.dev`"," For GHCR: `echo $GITHUB_TOKEN | docker login ghcr.io -u <user> --password-stdin`"," • Buildx not installed / configured — `docker buildx create --use` (one-time setup)."," • Multi-arch build needs QEMU registered — `docker run --privileged --rm tonistiigi/binfmt --install all`."].join(`
|
|
6
|
+
`),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(r.containerSigning==="cosign"){const i=`${r.containerImage}:${e.release.newVersion}`,t=await e.pm.runner.run("cosign",["sign","--yes",i],{cwd:e.pkg.dir,silent:!1});if(t.exitCode!==0)throw new l({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 ${i}: exit ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[container] published ${r.containerImage}:${e.release.newVersion}${r.containerSkipLatest?"":" + :latest"}${r.containerSigning==="cosign"?" (signed via cosign)":""}`,published:!0}}}const ue=(a,e)=>{if(!e.containerImage)throw new Error("buildBuildxCommand requires config.containerImage");const r=(e.containerPlatforms??lr).join(","),s=`${e.containerImage}:${a.release.newVersion}`,n=`${e.containerImage}:latest`,i=e.buildContext??".",t=["docker","buildx","build","--platform",r,"-t",s];e.containerSkipLatest||t.push("-t",n);for(const[o,d]of Object.entries(e.containerBuildArgs??{}))t.push("--build-arg",`${o}=${d}`);return t.push("--label",`org.opencontainers.image.version=${a.release.newVersion}`),t.push("--label",`org.opencontainers.image.title=${a.pkg.name}`),t.push("--push",i),{command:t}},gr=a=>`https://pub.dev/api/packages/${encodeURIComponent(a)}`,mr=async a=>{try{const e=await V(gr(a.pkg.name),{headers:{Accept:"application/vnd.pub.v2+json"},httpProxy:a.workspaceConfig?.httpProxy});if(!e.ok)return!1;const r=JSON.parse(await e.text());return Array.isArray(r.versions)&&r.versions.some(s=>s.version===a.release.newVersion)}catch{return!1}};class hr extends C{id="dart";async readPublishedVersion(e){}async publish(e){const{dir:r,name:s}=e.pkg,n=e.release.newVersion;if(e.dryRun)return{output:`[dry-run / dart] would run dart pub publish --force in ${r} for ${s}@${n}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${s} cannot be published from Windows yet: the Dart path is only verified on POSIX. Publish from a POSIX runner.`,packageName:s});try{const t=await e.pm.runner.run("dart",["--version"],{cwd:r,silent:!0});if(t.exitCode!==0)throw new Error(`exit ${t.exitCode}`)}catch{throw new l({code:"CONFIG_INVALID",message:`${s} needs the Dart SDK to publish, and "dart" is not on PATH. Install the Dart SDK on the runner.`,packageName:s})}if(await mr(e))return{alreadyPublished:!0,output:`[dart] ${s}@${n} is already on pub.dev; skipped`,published:!1};const i=await e.pm.runner.run("dart",["pub","publish","--force"],{cwd:r,silent:!1});if(i.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing command: dart pub publish --force in ${r}
|
|
7
|
+
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 ${s}@${n}: exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:s});return{output:`[dart] published ${s}@${n} to pub.dev`,published:!0}}}const fr="https://rubygems.org",wr=async(a,e,r)=>{const s=`${fr}/api/v1/versions/${encodeURIComponent(a)}.json`;try{const n=await V(s,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!n.ok)return!1;const i=await n.json();return Array.isArray(i)&&i.some(t=>typeof t=="object"&&t!==null&&t.number===e)}catch{return!1}},br=async(a,e)=>{try{return(await a.pm.runner.run("gem",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class kr extends C{id="gem";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=R(e.pkg.manifestPath),i=`${r}-${s}.gem`,t=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / gem] would run gem build ${n} and gem push ${i} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the gem path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});if(!await br(e,t))throw new l({code:"CONFIG_INVALID",message:`${r} needs the gem command on PATH to publish, and "gem --version" failed. Install Ruby (which ships RubyGems) on the runner.`,packageName:r});if(await wr(r,s,e))return{alreadyPublished:!0,output:`[gem] ${r}@${s} is already on RubyGems; skipped`,published:!1};const o=await e.pm.runner.run("gem",["build",n],{cwd:t,silent:!1});if(o.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: gem build ${n} in ${t}
|
|
8
|
+
Fix the gemspec validation error above.`,message:`gem build failed for ${r}@${s}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:r});try{const d=await e.pm.runner.run("gem",["push",i],{cwd:t,silent:!1});if(d.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: gem push ${i}
|
|
9
|
+
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 ${r}@${s}: exit ${d.exitCode}. stderr: ${d.stderr.trim().slice(0,500)}`,packageName:r})}finally{await se(w(t,i),{force:!0})}return{output:`[gem] published ${r}@${s} (${i})`,published:!0}}}const vr=(a,e,r)=>W(a?.releaseTagPattern??"v{version}",{name:e,version:r});class $r extends C{id="go";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=vr(e.perPackageConfig,r,s);if(e.dryRun)return{output:`[dry-run / go] would tag ${n} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Go tag path is not tested there. Release from a POSIX runner.`,packageName:r});if((await e.pm.runner.run("git",["--version"],{cwd:e.pkg.dir,silent:!0})).exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`${r} needs git on PATH to release its tag, and git --version failed.`,packageName:r});return await ae({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[go] ${r}@${s} is already tagged ${n}; skipped`,published:!1}:{output:`[go] ${r}@${s} released by tag ${n}`,published:!0}}}const ce=["build.gradle.kts","build.gradle"],Fe=["settings.gradle.kts","settings.gradle"],D=(a,e)=>new l({code:"CONFIG_INVALID",file:a,message:e}),yr=async(a,e)=>{for(const r of new Set([w(a,"gradle.properties"),w(e,"gradle.properties")])){let s;try{s=await _(r,"utf8")}catch{continue}if(/^\s*version\s*[=:]/m.test(s))return r}},Ir=a=>Ne(a).then(()=>!0,()=>!1),j=async(a,e)=>{for(const r of e){const s=w(a,r);try{return{path:s,raw:await _(s,"utf8")}}catch{}}},T=(a,e,r)=>{if(a.length===0)return;if(a.length>1)throw D(e,`${e} declares ${r} ${a.length} times on the path that reaches a module (lines ${a.map(n=>n.line).join(", ")}). vis cannot tell which one applies.`);const[s]=a;if(s.literal===void 0)throw D(e,`${e} sets ${r} to an expression on line ${s.line}. vis reads only a plain string literal, such as ${r} = "1.0.0".`);return{assignment:s,value:s.literal.value}},Cr=async a=>{const{claimedDirs:e,cwd:r}=a,s=await j(r,ce),n=await j(r,Fe);if(!s&&!n)return[];const i=n?Xe(n.raw):void 0;if(i?.unsupported.length)throw D(n.path,`${n.path} moves a project (${i.unsupported.join(", ")}). vis cannot follow that to a version; remove it or release the module with a shell publish.`);i?.dynamicIncludes&&process.stderr.write(`[vis release] ⚠ ${n.path} builds part of its include list from code; vis only reads literal include("…") entries.
|
|
10
|
+
`);const t=s?ne(s.raw):void 0,o=t?.assignments??[],d=[];s&&d.push({build:s,dir:r,isRoot:!0,path:"",taskPath:""});for(const p of i?.includes??[]){const h=w(r,p),c=await j(h,ce);c&&d.push({build:c,dir:h,isRoot:!1,path:p,taskPath:`:${p.replaceAll("/",":")}`})}const u=[];for(const p of d){if(e.has(p.dir))continue;const h=p.isRoot&&t?t:ne(p.build.raw),c=T(ie(h.assignments,"version"),p.build.path,"version");if(p.isRoot&&c===void 0)continue;const b=c?void 0:T(te(o,"version",p.isRoot),s?.path??p.build.path,"version"),P=c??b;if(!P){const f=await yr(p.dir,r);if(f!==void 0)throw D(f,`${f} sets version, and vis reads only a string literal in a build script. Move it to version = "…" in ${p.build.path}, or remove it.`);continue}const v=T(ie(h.assignments,"group"),p.build.path,"group")??T(te(o,"group",p.isRoot),s?.path??p.build.path,"group");if(v===void 0)throw D(p.build.path,`${p.build.path} has a version but no group. Declare group = "…" in its build script or in the root build script's allprojects block.`);if(h.usesArchiveName||t?.usesArchiveName)throw D(p.build.path,`${p.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=p.isRoot?i?.rootName??R(r):R(p.dir);u.push({kind:c?"literal":"inherited",line:P.assignment.line,module:p,name:`${v.value}:${O}`,owner:c?p.build.path:s.path,scan:h,version:P.value})}const k=new Map;for(const p of u){const h=k.get(p.name);if(h!==void 0)throw D(p.module.build.path,`${p.name} is declared by both ${h} and ${p.module.build.path}. Gradle coordinates must be unique to release them.`);k.set(p.name,p.module.build.path)}const g=new Map(u.map(p=>[p.module.path,p.name]));return u.map(({kind:p,line:h,module:c,name:b,owner:P,scan:v,version:O})=>{const f={};for(const $ of v.projectRefs){const I=g.get($.replace(/^:+/,"").split(":").filter(y=>y!=="").join("/"));I!==void 0&&I!==b&&(f[I]="*")}const m={dependencies:f,name:b,private:!1,version:O};return{kind:p,line:h,name:b,owner:P,package:{dir:c.dir,ecosystem:"gradle",manifest:m,manifestPath:c.build.path,name:b,private:!1,version:O},taskPath:c.taskPath}})},Me=async a=>{let e=a;for(;;){if(await Ir(w(e,"gradlew"))||await j(e,Fe)!==void 0)return e;const r=U(e);if(r===e)return;e=r}},hs=Object.defineProperty({__proto__:null,discoverGradleProjects:Cr,findGradleRoot:Me},Symbol.toStringTag,{value:"Module"}),Pr=/<!--[\s\S]*?-->/g,Nr=/<project\b[^>]*>([\s\S]*)/i,ge=/<version>\s*([^<]+?)\s*<\/version>/i,me=/<groupId>\s*([^<]+?)\s*<\/groupId>/i,he=/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i,Ar=/<modules\b[^>]*>[\s\S]*?<module\b/i,fe=a=>{const e=a.replaceAll(Pr,""),s=Nr.exec(e)?.[1]??e,n=s.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,""),i=ge.exec(n)??ge.exec(s),t=me.exec(n)??me.exec(s),o=he.exec(n)??he.exec(s),d=Ar.test(s);return{artifactId:o?.[1],groupId:t?.[1],hasModules:d,version:i?.[1]}},Sr=a=>{const e=/<latest>\s*([^<]+?)\s*<\/latest>/i.exec(a);if(e?.[1])return e[1];const r=/<versions>([\s\S]*?)<\/versions>/i.exec(a);return r?[...r[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(n=>n[1]).at(-1):void 0},_r=a=>{const e=/<versions>([\s\S]*?)<\/versions>/i.exec(a);return e?[...e[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(r=>r[1]):[]},Le=(a,e)=>{const r=a.split(".").map(n=>encodeURIComponent(n)).join("/"),s=encodeURIComponent(e);return`https://repo1.maven.org/maven2/${r}/${s}/maven-metadata.xml`};class Vr extends C{id="maven";warnedMultiModule=new WeakSet;warnIfMultiModule(e,r){!r.hasModules||this.warnedMultiModule.has(e)||(this.warnedMultiModule.add(e),process.stderr.write(`[vis release] ⚠ ${e.name} (${r.groupId??"?"}:${r.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\`.
|
|
11
|
+
`))}async readPublishedVersion(e){const r=e.perPackageConfig??{},s=w(e.pkg.dir,r.pomPath??"pom.xml");let n;try{n=await _(s,"utf8")}catch{return}const i=fe(n);if(this.warnIfMultiModule(e.pkg,i),!i.groupId||!i.artifactId||r.mavenMetadataUrl==="")return;const t=r.mavenMetadataUrl??Le(i.groupId,i.artifactId);try{const o=await V(t,{headers:{Accept:"text/xml,application/xml;q=0.9,*/*;q=0.8"},httpProxy:e.workspaceConfig?.httpProxy});if(o.status===404||!o.ok)return;const d=await o.text();return Sr(d)}catch{return}}async publish(e){const r=e.perPackageConfig??{},s=w(e.pkg.dir,r.pomPath??"pom.xml");let n;try{const o=await _(s,"utf8");n=fe(o)}catch{n=void 0}const i=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 ${s} deploy for ${e.pkg.name}@${e.release.newVersion} (${i})`,published:!0};if(process.platform==="win32")throw new l({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 t=await e.pm.runner.run("mvn",["-B","-N","-f",s,"deploy"],{cwd:e.pkg.dir,silent:!1});if(t.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing artifact: ${i}
|
|
12
|
+
Pom: ${s}
|
|
13
|
+
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} (${i}): exit ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[maven] deployed ${e.pkg.name}@${e.release.newVersion} (${i})`,published:!0}}}const Or=a=>{const e=a.indexOf(":");return e===-1?void 0:{artifactId:a.slice(e+1),groupId:a.slice(0,e)}},Dr=async a=>{const e=a.perPackageConfig??{},r=Or(a.pkg.name);if(e.mavenMetadataUrl===""||r===void 0)return!1;const s=e.mavenMetadataUrl??Le(r.groupId,r.artifactId);try{const n=await V(s,{headers:{Accept:"text/xml,application/xml;q=0.9,*/*;q=0.8"},httpProxy:a.workspaceConfig?.httpProxy});return n.ok&&_r(await n.text()).includes(a.release.newVersion)}catch{return!1}};class Rr extends C{id="gradle";async readPublishedVersion(e){}async publish(e){const r=await Me(e.pkg.dir);if(r===void 0)throw new l({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 s=e.pkg.dir===r?"":e.pkg.dir.slice(r.length+1).split("\\").join("/"),n=s===""?":publish":`:${s.replaceAll("/",":")}:publish`;if(e.dryRun)return{output:`[dry-run / gradle] would run ${w(r,"gradlew")} ${n} for ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(process.platform==="win32")throw new l({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 i=w(r,"gradlew");try{await Ne(i)}catch{throw new l({code:"CONFIG_INVALID",message:`${e.pkg.name} needs ${i} to publish, and the build root has none. Add the Gradle wrapper (gradle wrapper) at the root.`,packageName:e.pkg.name})}if(await Dr(e))return{alreadyPublished:!0,output:`[gradle] ${e.pkg.name}@${e.release.newVersion} is already on the repository; skipped`,published:!1};const t=await e.pm.runner.run(i,[n],{cwd:r,silent:!1});if(t.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing task: ${n} in ${r}
|
|
14
|
+
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 ${t.exitCode}. stderr: ${t.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[gradle] published ${e.pkg.name}@${e.release.newVersion} (${n})`,published:!0}}}const Fr="https://hex.pm",Mr=async(a,e,r)=>{const s=`${Fr}/api/packages/${encodeURIComponent(a)}`;try{const n=await V(s,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!n.ok)return!1;const i=await n.json(),t=typeof i=="object"&&i!==null?i.releases:void 0;return Array.isArray(t)&&t.some(o=>typeof o=="object"&&o!==null&&o.version===e)}catch{return!1}},Lr=async(a,e)=>{try{return(await a.pm.runner.run("mix",["help"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class Er extends C{id="hex";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / hex] would run mix hex.publish --yes in ${R(n)} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the mix path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});if(!await Lr(e,n))throw new l({code:"CONFIG_INVALID",message:`${r} needs the mix command on PATH to publish, and "mix help" failed. Install Elixir (which ships Mix) on the runner.`,packageName:r});if(await Mr(r,s,e))return{alreadyPublished:!0,output:`[hex] ${r}@${s} is already on hex.pm; skipped`,published:!1};const i=await e.pm.runner.run("mix",["hex.publish","--yes"],{cwd:n,silent:!1});if(i.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: mix hex.publish --yes in ${n}
|
|
15
|
+
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 ${r}@${s}: exit ${i.exitCode}. stderr: ${i.stderr.trim().slice(0,500)}`,packageName:r});return{output:`[hex] published ${r}@${s}`,published:!0}}}const Ee="https://registry.npmjs.org/",Tr="npm:registry.npmjs.org",we=async a=>{const e=w(a,"npm");try{return(await re(e,{withFileTypes:!0})).filter(s=>s.isDirectory()).map(s=>s.name)}catch{return[]}},Gr=async a=>{const e=a.ACTIONS_ID_TOKEN_REQUEST_URL,r=a.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!e||!r)return;const s=`${e}${e.includes("?")?"&":"?"}audience=${encodeURIComponent(Tr)}`,n=await fetch(s,{headers:{Authorization:`Bearer ${r}`}});if(!n.ok)return;const i=await n.json().catch(()=>({}));return typeof i.value=="string"?i.value:void 0},jr=async(a,e)=>{const r=await fetch(`${Ee}-/npm/v1/oidc/token/exchange/package/${encodeURIComponent(a)}`,{headers:{Authorization:`Bearer ${e}`},method:"POST"});if(!r.ok)return;const s=await r.json().catch(()=>({}));return typeof s.token=="string"?s.token:void 0},be=async(a,e,r)=>{if(e){const n=await jr(a,e);if(n)return{source:"oidc",token:n}}const s=r.NPM_TOKEN;if(s)return{source:"NPM_TOKEN",token:s};throw new l({code:"AUTH_MISSING",message:`Cannot publish ${a}: OIDC exchange did not succeed and NPM_TOKEN is not set.`,packageName:a})},ke=(a,e)=>{Ye(a,`//registry.npmjs.org/:_authToken=${e}
|
|
16
|
+
registry=${Ee}
|
|
17
|
+
`)};class Ur extends C{id="native-addon";async readPublishedVersion(e){try{Y(e.pkg.name);const{execFileSync:r}=await import("node:child_process");return r("npm",["view",e.pkg.name,"version"],{stdio:["ignore","pipe","ignore"]}).toString().trim()||void 0}catch{return}}async publish(e){if(e.dryRun){const d=await we(e.pkg.dir);return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion} + ${d.length} platform package(s)`,published:!0}}const r=await we(e.pkg.dir);if(r.length===0){const{NpmVersionActions:d}=await Promise.resolve().then(()=>Wr);return new d().publish(e)}const{env:s}=process,n=await Gr(s),i=e.release.newVersion,t=new Map,o=[];try{await Promise.all(r.map(async f=>{const m=w(e.pkg.dir,"npm",f,"package.json"),$=await _(m,"utf8");t.set(m,$);const I=JSON.parse($);I.version=i,await E(m,`${JSON.stringify(I,null,4)}
|
|
18
|
+
`)}));const{execFileSync:d}=await import("node:child_process"),u=await Promise.all(r.map(async f=>{const m=w(e.pkg.dir,"npm",f),$=w(m,"package.json"),I=await _($,"utf8"),y=JSON.parse(I);Y(y.name);const S=await be(y.name,n,s),N=z(w(B(),"vis-release-napi-"));o.push(N);const A=w(N,".npmrc");return ke(A,S.token),{manifest:y,npmrcPath:A,platform:f,platformDir:m}})),k=e.workspaceConfig?.publish?.guards;if(k&&Object.values(k).some(f=>f!==void 0&&f!==!1&&f!=="off")){const{runPublishGuards:f}=await import("./publish-guards.js");for(const{manifest:m,platformDir:$}of u){const I=d("npm",["pack","--dry-run","--json"],{cwd:$,stdio:["ignore","pipe","ignore"]}).toString();let y=[];try{y=JSON.parse(I)[0]?.files?.map(A=>A.path)??[]}catch{}const S=await f({config:k,manifest:m,packFiles:y,pkgDir:$,runner:e.pm.runner,sourceManifest:m});if(S.blockers.length>0){const N=S.blockers.flatMap(A=>A.findings.map(X=>` • [${A.gate}] ${X.message}${X.hint?`
|
|
19
|
+
→ ${X.hint}`:""}`)).join(`
|
|
20
|
+
`);throw new l({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${m.name}@${i} (platform package):
|
|
21
|
+
${N}`,packageName:m.name})}}}const g=e.tag??"latest",p=(f,m)=>{const $=["publish",f,"--tag",g,"--access","public","--userconfig",m];return e.provenance&&$.push("--provenance"),$};for(const{manifest:f,npmrcPath:m,platformDir:$}of u)try{d("npm",p($,m),{env:{...s,NPM_CONFIG_USERCONFIG:m},stdio:"inherit"})}catch(I){const y=I.message;if(!y.includes("EPUBLISHCONFLICT")&&!y.includes("cannot publish over"))throw new l({cause:I,code:"PUBLISH_FAILED",message:`Failed to publish platform package ${f.name}@${i}: ${y}`,packageName:f.name})}const h=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,c={...h},b={...h.optionalDependencies};for(const{manifest:f}of u)Object.hasOwn(b,f.name)&&(b[f.name]=i);c.optionalDependencies=b;const P=Ve(c,e.catalogs),v=Oe(P,e.cleanPackageJsonConfig),O=await _(e.pkg.manifestPath,"utf8");try{await E(e.pkg.manifestPath,`${JSON.stringify(v,null,4)}
|
|
22
|
+
`),Y(e.pkg.name);const f=await be(e.pkg.name,n,s),m=z(w(B(),"vis-release-napi-parent-"));o.push(m);const $=w(m,".npmrc");ke($,f.token);const I=d("npm",["pack","--pack-destination",m,"--json"],{cwd:e.pkg.dir,env:s,stdio:["ignore","pipe","ignore"]}).toString();let y;try{const N=JSON.parse(I);N[0]?.filename&&(y=w(m,N[0].filename))}catch{}const S=["publish",y??e.pkg.dir,"--tag",g,"--access","public","--userconfig",$];if(e.provenance&&S.push("--provenance"),d("npm",S,{env:{...s,NPM_CONFIG_USERCONFIG:$},stdio:"inherit"}),y){const{hashTarball:N}=await import("./publish-guards.js");return{published:!0,tarball:await N(y)}}return{published:!0}}finally{await E(e.pkg.manifestPath,O)}}finally{for(const[d,u]of t)try{await E(d,u)}catch{}for(const d of o)try{await se(d,{force:!0,recursive:!0})}catch{}}}}const Br=async(a,e)=>{const{extractPackFilesFromRaw:r}=await import("./publish-guards.js"),s=r(e.raw);if(s!==void 0)return s;const n=await a.pm.runner.run("npm",["pack","--dry-run","--json"],{cwd:a.pkg.dir,silent:!0});if(n.exitCode!==0)return[];try{return r(JSON.parse(n.stdout))??[]}catch{return[]}},ve=1800*1e3,$e=15*1e3,ye=a=>{if(a===!0)return{enabled:!0,pollIntervalMs:$e,timeoutMs:ve};if(a&&typeof a=="object"){const e=a;return{enabled:!0,pollIntervalMs:e.pollIntervalMs??$e,timeoutMs:e.timeoutMs??ve}}return{enabled:!1,pollIntervalMs:0,timeoutMs:0}};class Te extends C{id="npm";async readPublishedVersion(e){try{const r=await e.pm.runner.run("npm",["view",e.pkg.name,"version","--silent"],{cwd:e.pkg.dir,silent:!0});return r.exitCode!==0?void 0:r.stdout.trim()||void 0}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};if(e.resumeStageId){const u=ye(e.workspaceConfig?.publish?.stage);if(!u.enabled)throw new l({code:"CONFIG_INVALID",message:`Cannot resume stage ${e.resumeStageId} for ${e.pkg.name}@${e.release.newVersion}: publish.stage is now disabled. Resolve the stage manually via \`vis release stage approve|reject ${e.resumeStageId}\`.`,packageName:e.pkg.name});return this.resumeStagedPublish(e,u)}const r=e.perPackageConfig&&e.workspaceConfig?Q(e.pkg.name,e.perPackageConfig,e.workspaceConfig):{};if(r.buildCommand){const u=Z(r.buildCommand,{name:e.pkg.name,version:e.release.newVersion}),k=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",u]:["-c",u],{cwd:e.pkg.dir,silent:!1});if(k.exitCode!==0)throw new Error(`buildCommand failed for ${e.pkg.name}: exit ${k.exitCode}`)}const s=e.versionedManifestByName.get(e.pkg.name)??e.pkg.manifest,n=Kr(s,e.versionedManifestByName),i=Ve(n,e.catalogs),t=Oe(i,e.cleanPackageJsonConfig),o=await import("node:fs/promises"),d=await o.readFile(e.pkg.manifestPath,"utf8");try{if(await o.writeFile(e.pkg.manifestPath,`${JSON.stringify(t,null,4)}
|
|
23
|
+
`),r.publishCommand){const k={name:e.pkg.name,version:e.release.newVersion},g=Array.isArray(r.publishCommand)?r.publishCommand:[r.publishCommand];for(const p of g){const h=Z(p,k),c=await e.pm.runner.run(process.platform==="win32"?"cmd":"sh",process.platform==="win32"?["/c",h]:["-c",h],{cwd:e.pkg.dir,silent:!1});if(c.exitCode!==0)throw new Error(`publishCommand failed for ${e.pkg.name}: exit ${c.exitCode}`)}return{output:`[custom] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}const u=z(w(B(),"vis-release-pack-"));try{const k=await e.pm.pack({cwd:e.pkg.dir,destination:u}),g=e.workspaceConfig?.publish?.guards;if(g&&Object.values(g).some(m=>m!==void 0&&m!==!1&&m!=="off")){const{runPublishGuards:m}=await import("./publish-guards.js"),$=await Br(e,k),I=await m({config:g,manifest:t,packFiles:$,pkgDir:e.pkg.dir,runner:e.pm.runner,sourceManifest:e.pkg.manifest});if(I.blockers.length>0){const{redactTokens:y}=await import("./security.js"),S=I.blockers.flatMap(N=>N.findings.map(A=>` • [${N.gate}] ${y(A.message)}${A.hint?`
|
|
24
|
+
→ ${y(A.hint)}`:""}`)).join(`
|
|
25
|
+
`);throw new l({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${e.pkg.name}@${e.release.newVersion}:
|
|
26
|
+
${S}`,packageName:e.pkg.name})}}const{hashTarball:p}=await import("./publish-guards.js"),h=await p(k.tarball);if((e.workspaceConfig?.publish?.publishStrategy??"npm-publish-tarball")==="native"){const m=e.pm.id;return e.provenance&&m==="bun"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": bun has no --provenance/OIDC support; ${e.pkg.name}@${e.release.newVersion} publishes without provenance.
|
|
27
|
+
`),e.otp&&m==="yarn"&&process.stderr.write(`[vis release] ⚠ publishStrategy "native": \`yarn npm publish\` ignores --otp; configure 2FA via .yarnrc.yml for ${e.pkg.name}.
|
|
28
|
+
`),{...await e.pm.publishNative({access:"public",cwd:e.pkg.dir,otp:e.otp,provenance:e.provenance,registry:e.registry,tag:e.tag}),tarball:h}}const c=ye(e.workspaceConfig?.publish?.stage);if(c.enabled){const{refuseRestrictedOidc:m}=await import("./stage-publisher.js"),$=e.pkg.manifest.publishConfig?.access;m($)}const b=await e.pm.publish({access:"public",otp:e.otp,provenance:e.provenance,registry:e.registry,stage:c.enabled,tag:e.tag,tarball:k.tarball});if(!c.enabled||!b.stageId)return{...b,tarball:h};const{waitForStageDecision:P}=await import("./stage-publisher.js"),{stageId:v}=b,O=Date.now();process.stderr.write(`[vis release] ⏳ ${e.pkg.name}@${e.release.newVersion} staged (id ${v}). Waiting up to ${Math.round(c.timeoutMs/6e4)}m for a maintainer to approve via npmjs.com or \`npm stage approve ${v}\`...
|
|
29
|
+
`);const f=await P({cwd:e.pkg.dir,onProgress:m=>{m>0&&m%3e5<c.pollIntervalMs&&process.stderr.write(`[vis release] still waiting for ${e.pkg.name} stage decision (${Math.round(m/6e4)}m elapsed)...
|
|
30
|
+
`)},packageName:e.pkg.name,pollIntervalMs:c.pollIntervalMs,runner:e.pm.runner,stageId:v,timeoutMs:c.timeoutMs,version:e.release.newVersion});return f==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted (${Math.round((Date.now()-O)/1e3)}s).
|
|
31
|
+
`),{...b,stageId:void 0,tarball:h}):f==="rejected"?(process.stdout.write(`::warning::Stage rejected for ${e.pkg.name}@${e.release.newVersion} (id ${v}). Re-stage by re-running the release once the review feedback is addressed.
|
|
32
|
+
`),{alreadyPublished:!1,output:`stage-rejected: ${v}`,published:!1,stageId:v}):(process.stdout.write(`::warning::Stage timeout for ${e.pkg.name}@${e.release.newVersion} (id ${v}) after ${Math.round(c.timeoutMs/6e4)}m. Re-run \`vis release publish\` once a maintainer can approve, or run \`vis release stage approve ${v}\` manually.
|
|
33
|
+
`),{alreadyPublished:!1,output:`stage-timeout: ${v}`,published:!1,stageId:v})}finally{await o.rm(u,{force:!0,recursive:!0})}}finally{await o.writeFile(e.pkg.manifestPath,d)}}async resumeStagedPublish(e,r){const s=e.resumeStageId,n=Date.now();process.stderr.write(`[vis release] ↻ Resuming wait on staged ${e.pkg.name}@${e.release.newVersion} (id ${s}) — tarball already uploaded; not re-publishing.
|
|
34
|
+
`);const{waitForStageDecision:i}=await import("./stage-publisher.js"),t=await i({cwd:e.pkg.dir,onProgress:o=>{o>0&&o%3e5<r.pollIntervalMs&&process.stderr.write(`[vis release] still waiting for ${e.pkg.name} stage decision (resume, ${Math.round(o/6e4)}m elapsed)...
|
|
35
|
+
`)},packageName:e.pkg.name,pollIntervalMs:r.pollIntervalMs,runner:e.pm.runner,stageId:s,timeoutMs:r.timeoutMs,version:e.release.newVersion});return t==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted on resume (${Math.round((Date.now()-n)/1e3)}s).
|
|
36
|
+
`),{output:`[resumed] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}):t==="rejected"?(process.stdout.write(`::warning::Stage rejected on resume for ${e.pkg.name}@${e.release.newVersion} (id ${s}).
|
|
37
|
+
`),{alreadyPublished:!1,output:`stage-rejected: ${s}`,published:!1,stageId:s}):(process.stdout.write(`::warning::Stage timeout on resume for ${e.pkg.name}@${e.release.newVersion} (id ${s}) after ${Math.round(r.timeoutMs/6e4)}m.
|
|
38
|
+
`),{alreadyPublished:!1,output:`stage-timeout: ${s}`,published:!1,stageId:s})}}const Hr=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Kr=(a,e)=>{const r={...a};for(const s of Hr){const n=a[s];if(!n||typeof n!="object")continue;const i={...n};for(const[t,o]of Object.entries(n)){if(!o.startsWith("workspace:"))continue;const d=e.get(t);d&&(i[t]=Je(o.slice(10)==="*"?"*":o,d.version),i[t].startsWith("workspace:")&&(i[t]=i[t].slice(10)))}r[s]=i}return r},Wr=Object.defineProperty({__proto__:null,NpmVersionActions:Te},Symbol.toStringTag,{value:"Module"}),Ie="https://api.nuget.org/v3/index.json",qr="https://api.nuget.org/v3-flatcontainer",M="NUGET_API_KEY",L=[10,0,300],Xr=a=>{const e=/^(\d+)\.(\d+)\.(\d+)(-[\w.-]+)?/.exec(a.trim());if(!e)return!1;const r=[Number(e[1]),Number(e[2]),Number(e[3])];for(const[s,n]of r.entries())if(n!==L[s])return n>L[s];return e[4]===void 0},Ce=a=>a.split("+")[0].toLowerCase(),Yr=async(a,e,r)=>{try{const s=await V(`${qr}/${encodeURIComponent(a)}/index.json`,{headers:{Accept:"application/json"},httpProxy:r.workspaceConfig?.httpProxy});if(!s.ok)return!1;const n=await s.json();return(typeof n=="object"&&n!==null&&Array.isArray(n.versions)?n.versions:[]).some(t=>typeof t=="string"&&Ce(t)===Ce(e))}catch{return!1}},Pe=(a,e)=>a.split(e).join("***").trim().slice(0,500);class Jr extends C{id="nuget";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=e.pkg.manifestPath,i=e.pkg.dir;if(e.dryRun)return{output:`[dry-run / nuget] would run dotnet pack ${R(n)} -c Release, then dotnet nuget push the package to ${Ie} for ${r}@${s}`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be published from Windows yet: the NuGet path is only verified on POSIX. Publish from a POSIX runner.`,packageName:r});const t=await e.pm.runner.run("dotnet",["--version"],{cwd:i,silent:!0}).then(u=>u.exitCode===0?u.stdout:void 0).catch(()=>{});if(t===void 0)throw new l({code:"CONFIG_INVALID",message:`${r} needs the dotnet CLI on PATH to publish, and "dotnet --version" failed. Install the .NET SDK on the runner.`,packageName:r});if(!Xr(t))throw new l({code:"CONFIG_INVALID",message:`${r} publishes with the ${M} environment variable, which dotnet nuget push reads from .NET SDK ${L.join(".")} (NuGet 7.6) on. This runner has dotnet ${t.trim()}. Install .NET SDK ${L.join(".")} or later on the runner.`,packageName:r});if(await Yr(r,s,e))return{alreadyPublished:!0,output:`[nuget] ${r}@${s} is already on nuget.org; skipped`,published:!1};const o=process.env[M];if(o===void 0||o==="")throw new l({code:"CONFIG_INVALID",message:`${r} needs the API key in the ${M} environment variable to push to nuget.org. Set it on the runner; vis never logs it.`,packageName:r});const d=await Be(w(B(),"vis-nuget-"));try{const u=await e.pm.runner.run("dotnet",["pack",n,"-c","Release","-o",d],{cwd:i,silent:!1});if(u.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: dotnet pack ${R(n)}
|
|
39
|
+
Fix the build or packaging error above.`,message:`dotnet pack failed for ${r}@${s}: exit ${u.exitCode}. stderr: ${Pe(u.stderr,o)}`,packageName:r});const g=(await re(d)).filter(h=>h.endsWith(".nupkg")&&!h.endsWith(".symbols.nupkg"));if(g.length!==1)throw new l({code:"PUBLISH_FAILED",hint:`dotnet pack wrote ${g.length} packages to a temporary directory. vis pushes exactly one per project.`,message:`expected one .nupkg for ${r}@${s}, found ${g.length}`,packageName:r});const p=await e.pm.runner.run("dotnet",["nuget","push",w(d,g[0]),"--source",Ie],{cwd:i,env:{[M]:o},silent:!1});if(p.exitCode!==0)throw new l({code:"PUBLISH_FAILED",hint:`Failing step: dotnet nuget push
|
|
40
|
+
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 ${L.join(".")} or later.`,message:`dotnet nuget push failed for ${r}@${s}: exit ${p.exitCode}. stderr: ${Pe(p.stderr,o)}`,packageName:r})}finally{await se(d,{force:!0,recursive:!0})}return{output:`[nuget] published ${r}@${s} to nuget.org`,published:!0}}}class zr 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 G=async(a,e,r,s)=>{const n=Z(r,s),i=process.platform==="win32",t=i?"cmd":"sh",o=i?["/c",n]:["-c",n];return a.run(t,o,{cwd:e,silent:!1})};class Qr extends C{id="shell";async readPublishedVersion(e){const r=e.perPackageConfig??{},{workspaceConfig:s}=e;if(!s)return;const n=Q(e.pkg.name,r,s);if(!n.checkPublished)return;const i=await G(e.pm.runner,e.pkg.dir,n.checkPublished,{name:e.pkg.name,version:e.pkg.version});if(i.exitCode!==0)return;const t=i.stdout.trim();return/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(t)?.[0]}async publish(e){if(e.dryRun)return{output:`[dry-run / shell] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const{workspaceConfig:r}=e,s=e.perPackageConfig??{};if(!r)throw new l({code:"CONFIG_INVALID",message:`Shell publish actions for ${e.pkg.name} require a workspace config (release.allowCustomCommands gate).`,packageName:e.pkg.name});const n=Q(e.pkg.name,s,r);if(!n.publishCommand)throw new l({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 i={name:e.pkg.name,registry:e.registry,tag:e.tag,version:e.release.newVersion};if(n.checkPublished){const o=await G(e.pm.runner,e.pkg.dir,n.checkPublished,i);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 G(e.pm.runner,e.pkg.dir,n.buildCommand,i);if(o.exitCode!==0)throw new l({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 t=Array.isArray(n.publishCommand)?n.publishCommand:[n.publishCommand];for(const o of t){const d=await G(e.pm.runner,e.pkg.dir,o,i);if(d.exitCode!==0)throw new l({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 ${d.exitCode}. stderr: ${d.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[shell] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}}const Zr=async(a,e)=>{try{return(await a.pm.runner.run("git",["rev-parse","--quiet","--verify",`refs/tags/${e}`],{cwd:a.pkg.dir,silent:!0})).exitCode===0}catch{return!1}};class xr extends C{id="swift";async readPublishedVersion(e){}async publish(e){const r=e.release.newVersion,s=e.perPackageConfig?.releaseTagPattern??e.workspaceConfig?.releaseTagPattern,n=s===void 0?_e(e.pkg.name,r):W(s,{name:e.pkg.name,version:r});if(e.dryRun)return{output:`[dry-run / swift] would tag ${n} for ${e.pkg.name}@${r}`,published:!0};if(process.platform==="win32")throw new l({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 Zr(e,n)?{alreadyPublished:!0,output:`[swift] tag ${n} already exists; ${e.pkg.name}@${r} skipped`,published:!1}:{output:`[swift] ${e.pkg.name}@${r} is released by tag ${n}, created with the release`,published:!0}}}const es=(a,e,r)=>{const s=r.perPackageConfig?.releaseTagPattern??r.workspaceConfig?.releaseTagPattern;return s?W(s,{channel:r.channel,name:a,version:e}):_e(a,e)};class rs extends C{id="zig";async readPublishedVersion(e){}async publish(e){const{name:r}=e.pkg,s=e.release.newVersion,n=es(r,s,{channel:e.tag,perPackageConfig:e.perPackageConfig,workspaceConfig:e.workspaceConfig});if(e.dryRun)return{output:`[dry-run / zig] would tag ${n} for ${r}@${s}; nothing is uploaded`,published:!0};if(process.platform==="win32")throw new l({code:"CONFIG_INVALID",message:`${r} cannot be released from Windows yet: the Zig path is only verified on POSIX. Release from a POSIX runner.`,packageName:r});return await ae({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[zig] tag ${n} already exists for ${r}@${s}; skipped`,published:!1}:{output:`[zig] ${r}@${s} has no registry; tag ${n} is created by the release`,published:!0}}}const fs=a=>{switch(a){case"cargo":return new ir;case"composer":return new pr;case"container":return new cr;case"dart":return new hr;case"gem":return new kr;case"go":return new $r;case"gradle":return new Rr;case"hex":return new Er;case"maven":return new Vr;case"native-addon":return new Ur;case"nuget":return new Jr;case"private":return new zr;case"python":return new qe;case"shell":return new Qr;case"swift":return new xr;case"zig":return new rs;default:return new Te}};export{Qe as a,ms as b,fs as c,ze as e,hs as g,q as i,H as p};
|