@visulima/vis 4.3.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/CHANGELOG.md +598 -0
  2. package/LICENSE.md +151 -88
  3. package/README.md +2 -2
  4. package/dist/bin.js +1 -1
  5. package/dist/binx.js +1 -1
  6. package/dist/config/index.d.ts +42 -19
  7. package/dist/packem_chunks/CONFIG_FILES.js +4 -4
  8. package/dist/packem_chunks/bloom-status.js +1 -1
  9. package/dist/packem_chunks/bloom-sync.js +1 -1
  10. package/dist/packem_chunks/catalog.js +61 -51
  11. package/dist/packem_chunks/cli-exec.js +1 -1
  12. package/dist/packem_chunks/cli-main.js +202 -176
  13. package/dist/packem_chunks/dart-plan.js +1 -1
  14. package/dist/packem_chunks/dart-projects.js +1 -1
  15. package/dist/packem_chunks/dispatch.js +1 -1
  16. package/dist/packem_chunks/doctor-probe.js +1 -1
  17. package/dist/packem_chunks/fix.js +1 -1
  18. package/dist/packem_chunks/handler.js +1 -1
  19. package/dist/packem_chunks/handler10.js +4 -4
  20. package/dist/packem_chunks/handler11.js +1 -1
  21. package/dist/packem_chunks/handler12.js +1 -1
  22. package/dist/packem_chunks/handler13.js +1 -1
  23. package/dist/packem_chunks/handler14.js +1 -1
  24. package/dist/packem_chunks/handler15.js +1 -1
  25. package/dist/packem_chunks/handler16.js +1 -1
  26. package/dist/packem_chunks/handler17.js +1 -1
  27. package/dist/packem_chunks/handler18.js +1 -1
  28. package/dist/packem_chunks/handler19.js +1 -1
  29. package/dist/packem_chunks/handler2.js +1 -1
  30. package/dist/packem_chunks/handler20.js +2 -2
  31. package/dist/packem_chunks/handler21.js +1 -1
  32. package/dist/packem_chunks/handler22.js +2 -2
  33. package/dist/packem_chunks/handler23.js +1 -1
  34. package/dist/packem_chunks/handler24.js +1 -1
  35. package/dist/packem_chunks/handler26.js +5 -5
  36. package/dist/packem_chunks/handler27.js +1 -1
  37. package/dist/packem_chunks/handler28.js +1 -1
  38. package/dist/packem_chunks/handler29.js +1 -1
  39. package/dist/packem_chunks/handler3.js +1 -1
  40. package/dist/packem_chunks/handler30.js +1 -1
  41. package/dist/packem_chunks/handler39.js +6 -6
  42. package/dist/packem_chunks/handler5.js +1 -1
  43. package/dist/packem_chunks/handler50.js +2 -2
  44. package/dist/packem_chunks/handler51.js +1 -1
  45. package/dist/packem_chunks/handler53.js +1 -1
  46. package/dist/packem_chunks/handler54.js +1 -1
  47. package/dist/packem_chunks/handler55.js +1 -1
  48. package/dist/packem_chunks/handler58.js +1 -1
  49. package/dist/packem_chunks/handler59.js +1 -1
  50. package/dist/packem_chunks/handler6.js +1 -1
  51. package/dist/packem_chunks/handler60.js +7 -7
  52. package/dist/packem_chunks/handler61.js +2 -2
  53. package/dist/packem_chunks/handler62.js +10 -10
  54. package/dist/packem_chunks/handler63.js +1 -1
  55. package/dist/packem_chunks/handler64.js +6 -3
  56. package/dist/packem_chunks/handler65.js +8 -6
  57. package/dist/packem_chunks/handler66.js +2 -2
  58. package/dist/packem_chunks/handler67.js +31 -20
  59. package/dist/packem_chunks/handler68.js +1 -1
  60. package/dist/packem_chunks/handler69.js +22 -153
  61. package/dist/packem_chunks/handler7.js +1 -1
  62. package/dist/packem_chunks/handler70.js +9 -9
  63. package/dist/packem_chunks/handler71.js +153 -22
  64. package/dist/packem_chunks/handler72.js +1 -1
  65. package/dist/packem_chunks/handler73.js +1 -1
  66. package/dist/packem_chunks/handler74.js +1 -1
  67. package/dist/packem_chunks/handler75.js +35 -35
  68. package/dist/packem_chunks/handler76.js +1 -1
  69. package/dist/packem_chunks/handler77.js +3 -3
  70. package/dist/packem_chunks/handler78.js +69 -67
  71. package/dist/packem_chunks/handler8.js +1 -1
  72. package/dist/packem_chunks/handler9.js +1 -1
  73. package/dist/packem_chunks/heal-accept.js +1 -1
  74. package/dist/packem_chunks/heal.js +1 -1
  75. package/dist/packem_chunks/help-command.js +40 -7
  76. package/dist/packem_chunks/index2.js +32 -32
  77. package/dist/packem_chunks/index6.js +1 -1
  78. package/dist/packem_chunks/keys-refresh.js +1 -1
  79. package/dist/packem_chunks/lean.js +3 -4
  80. package/dist/packem_chunks/list.js +1 -1
  81. package/dist/packem_chunks/loader.js +1 -1
  82. package/dist/packem_chunks/orchestrator.js +1 -1
  83. package/dist/packem_chunks/prompts.js +1 -1
  84. package/dist/packem_chunks/status.js +1 -1
  85. package/dist/packem_chunks/sync.js +1 -1
  86. package/dist/packem_chunks/sync2.js +1 -1
  87. package/dist/packem_chunks/tar.js +1 -1
  88. package/dist/packem_chunks/tripwire.js +1 -1
  89. package/dist/packem_chunks/ts-loader.js +5 -5
  90. package/dist/packem_chunks/verify-lockfile.js +1 -1
  91. package/dist/packem_shared/{affected-selection-D4giBK2X.js → affected-selection-DDxwjwM4.js} +1 -1
  92. package/dist/packem_shared/affected-shas-BuaWvmsG.js +1 -0
  93. package/dist/packem_shared/{ai-fix-BC6aIRJT.js → ai-fix-C2BhFFhi.js} +5 -5
  94. package/dist/packem_shared/{augment-B9kSZuvW.js → augment-CxUPE8KX.js} +1 -1
  95. package/dist/packem_shared/{bin-C1XKj-O-.js → bin-Be7_QhQK.js} +1 -1
  96. package/dist/packem_shared/{build-scripts-CEDx_nJp.js → build-scripts-DxyVSkgM.js} +1 -1
  97. package/dist/packem_shared/command-runtime-BXvH5EC0.js +1 -0
  98. package/dist/packem_shared/{dart-pubspec-BK_cK2EP.js → dart-pubspec-DvmyleIr.js} +2 -2
  99. package/dist/packem_shared/{dependency-scan-B8jroa1D.js → dependency-scan-DKK3ZEZI.js} +1 -1
  100. package/dist/packem_shared/{docker-DXqV-07f.js → docker-BTuwdXaC.js} +1 -1
  101. package/dist/packem_shared/{ecosystem-gate-ddru_hOg.js → ecosystem-gate-BpQNUJzN.js} +1 -1
  102. package/dist/packem_shared/env-consistency-CUBJHENL.js +1 -0
  103. package/dist/packem_shared/{failure-log-D2x5BT8S.js → failure-log-kp0n2rbD.js} +1 -1
  104. package/dist/packem_shared/{formatBytes-BHAzNIrn-CrusHOew.js → formatBytes-BHAzNIrn-DRcKvqnb.js} +1 -1
  105. package/dist/packem_shared/git-source-DExWbfN0.js +2 -0
  106. package/dist/packem_shared/{index-BzhrR_iC.js → index-BdMIfGVZ.js} +15 -15
  107. package/dist/packem_shared/index-C9ENZqH9.js +39 -0
  108. package/dist/packem_shared/{index-Chje3u9v.js → index-DQfNpt2u.js} +1 -1
  109. package/dist/packem_shared/{index-DQ2GJzmy.js → index-DsSWb5XH.js} +1 -1
  110. package/dist/packem_shared/{index.server-sXNQYpsl.js → index.server-D8BLnYZO.js} +2 -2
  111. package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-C-_5cgwu.js → isAccessibleSync-DYKTrrvc-BwaMhQs0.js} +1 -1
  112. package/dist/packem_shared/{lifecycle-D6PMPor-.js → lifecycle-BAhkhE2L.js} +1 -1
  113. package/dist/packem_shared/{lockfile-CiUtEbnt.js → lockfile-DHmlPGk1.js} +1 -1
  114. package/dist/packem_shared/{manifests-Du4yKlf_.js → manifests-Dd4Hoztt.js} +1 -1
  115. package/dist/packem_shared/{min-release-age-JViyQuBM.js → min-release-age-BJnOQaoF.js} +1 -1
  116. package/dist/packem_shared/{missing-package-json-Cu5YVAot.js → missing-package-json-DfzrGwe1.js} +1 -1
  117. package/dist/packem_shared/{multi-eco-lockfiles-B2X3yhyo.js → multi-eco-lockfiles-BIa6xvJc.js} +1 -1
  118. package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-Dr9XvxOf.js} +1 -1
  119. package/dist/packem_shared/osv-bloom-t40ra5U5.js +2 -0
  120. package/dist/packem_shared/{package-version-Dxirp-UO.js → package-version-CFuNUWDG.js} +2 -2
  121. package/dist/packem_shared/{packument-BQv4je9m.js → packument-C9nRiBJf.js} +1 -1
  122. package/dist/packem_shared/pm-runner-ImwtpnWY.js +1 -0
  123. package/dist/packem_shared/{project-name-filter-D6tXD8gd.js → project-name-filter-C2rkW-Vn.js} +1 -1
  124. package/dist/packem_shared/{provenance-DNyVMxNv.js → provenance-DF-ypZj3.js} +1 -1
  125. package/dist/packem_shared/{readJsonSync-CbryXYxN-EWl7_7KX.js → readJsonSync-CbryXYxN-Bm5i10UW.js} +1 -1
  126. package/dist/packem_shared/{registry-keys-DwB3ZXS_.js → registry-keys-BLuHOyZu.js} +1 -1
  127. package/dist/packem_shared/{resolve-explicit-BPsdmuty.js → resolve-explicit-BDaQRR6o.js} +1 -1
  128. package/dist/packem_shared/resolve-runtime-Cr19Pk6L.js +1 -0
  129. package/dist/packem_shared/{run-file-UBukWaha.js → run-file-XbRCF6Mp.js} +1 -1
  130. package/dist/packem_shared/{runtime-check-1U8HrQd9.js → runtime-check-Bh5q9IrT.js} +1 -1
  131. package/dist/packem_shared/{s1ngularity-QD2LD1sO.js → s1ngularity-UCZN7skW.js} +1 -1
  132. package/dist/packem_shared/{scan-progress-CkumcBG-.js → scan-progress-DcYI76zE.js} +1 -1
  133. package/dist/packem_shared/{selectors-edwcgNl3.js → selectors-DCiEU0iv.js} +2 -2
  134. package/dist/packem_shared/{signatures-t8LbOaqr.js → signatures-CicxPHN4.js} +1 -1
  135. package/dist/packem_shared/target-merge-BClIXg2k.js +14 -0
  136. package/dist/packem_shared/{target-options-DsHFmRZH.js → target-options-PgWIuJnb.js} +1 -1
  137. package/dist/packem_shared/task-env-Dl08aklA.js +2 -0
  138. package/dist/packem_shared/toolchain-DvUxlbDz.js +5 -0
  139. package/dist/packem_shared/{typosquats-8u0drCqQ.js → typosquats-DxPzyK7u.js} +1 -1
  140. package/dist/packem_shared/{verify-B_MblU_Q.js → verify-CadR9PUk.js} +1 -1
  141. package/dist/packem_shared/{vis-update-app-BCIccZfA.js → vis-update-app-DrFWQyPn.js} +1 -1
  142. package/dist/packem_shared/{vis-user-error-75VtCwMv.js → vis-user-error-k7CLTpA4.js} +15 -15
  143. package/dist/packem_shared/{watch-CcTketln.js → watch-Dr_6yz3o.js} +1 -1
  144. package/dist/packem_shared/watch-loop-BId9vT7Q.js +11 -0
  145. package/dist/packem_shared/{writeFileSync-DJoHk3Ks-BPRoepNw.js → writeFileSync-DJoHk3Ks-Dhem3Uof.js} +1 -1
  146. package/dist/release/core/version-actions/index.d.ts +1 -1
  147. package/dist/release/presets.d.ts +1 -55
  148. package/dist/release/presets.js +1 -1
  149. package/dist/release/types.d.ts +1 -18
  150. package/dist/runtime/preload.js +1 -1
  151. package/index.d.ts +204 -204
  152. package/index.js +52 -52
  153. package/package.json +10 -10
  154. package/schemas/project.schema.json +44 -1
  155. package/schemas/vis-config.schema.json +128 -35
  156. package/schemas/vis-release-config.schema.json +1 -12
  157. package/skills/vis/SKILL.md +24 -12
  158. package/dist/packem_shared/Table-BB8xHTU5-BLPS917D.js +0 -11
  159. package/dist/packem_shared/affected-shas-B2V84O0g.js +0 -1
  160. package/dist/packem_shared/command-runtime-p4IXiIf6.js +0 -1
  161. package/dist/packem_shared/giget-D8Kwb0kD.js +0 -2
  162. package/dist/packem_shared/index-BisalDCf.js +0 -39
  163. package/dist/packem_shared/osv-bloom-BCAX5ARR.js +0 -2
  164. package/dist/packem_shared/pm-runner-CMSml1Bj.js +0 -1
  165. package/dist/packem_shared/resolve-runtime-CNiHcVtx.js +0 -1
  166. package/dist/packem_shared/target-merge-DVJl-7Qz.js +0 -4
  167. package/dist/packem_shared/toolchain-BRdpaAC4.js +0 -5
  168. package/dist/packem_shared/watch-loop-qRn0IHPG.js +0 -11
@@ -1,50 +1,50 @@
1
- import{createRequire as ks}from"node:module";import{VersionActions as C}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{VisReleaseError as g}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import Je from"./index.js";import{tagExists as ue,renderTagPattern as z,defaultTagFor as Ke}from"./git.js";import{a as Ns,s as me,o as he,i as fe}from"../packem_shared/gradle-build-CHZDHyjI.js";import{L as _s}from"../packem_shared/index-BisalDCf.js";import{resolveCleanStripList as Ss}from"./DEFAULT_CLEAN_KEEP.js";import{assertValidPackageName as x,resolveCustomCommands as re,interpolateCommand as te}from"./security.js";let vs;const $s=r=>(vs??=ks(import.meta.url))(r),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=r=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[e,s]=F.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return F.getBuiltinModule(r)}return $s(r)},{readFile:P,readdir:ce,rm:le,access:Ue,writeFile:B,mkdtemp:Is}=U("node:fs/promises"),{isAbsolute:G,join:f,dirname:E,resolve:Be,relative:We,sep:He,basename:R}=U("node:path"),{realpathSync:Cs,mkdtempSync:se,writeFileSync:Ps}=U("node:fs"),{fileURLToPath:As}=U("node:url"),{tmpdir:q}=U("node:os"),Vs=["dependencies","devDependencies","peerDependencies","optionalDependencies"],qe=(r,e)=>{if(r.startsWith("catalog:")||r==="*"||r==="workspace:*"||r==="workspace:^"||r==="workspace:~")return r;if(r.startsWith("workspace:")){const t=r.slice(10);return`workspace:${ee(t)}${e}`}if(r.startsWith("npm:")){const t=r.lastIndexOf("@");if(t<=4)return r;const n=r.slice(4,t),a=r.slice(t+1),i=ee(a);return`npm:${n}@${i}${e}`}return`${ee(r)}${e}`},Os=/^([\^~=]|>=?|<=?)/,ee=r=>{const e=Os.exec(r);return e?e[1]??"^":"^"},Pt=async(r,e,s={})=>{const t=s.serializeManifest??Ls,n=s.changelogPath??Ms,a=s.renderChangelogEntry??Ts,i=new Map(r.releases.map(d=>[d.name,d.newVersion])),o=await Promise.all(r.releases.map(async d=>{const p=e.getPackage(d.name);if(!p)return;const u=Es(p.manifest,d.newVersion,i),m=s.readManifest?.(p.manifestPath),h=n(p);return{changelogEntry:await a(d),changelogPath:h,manifestWrite:p.ecosystem===void 0?{content:t(u,m),path:p.manifestPath}:void 0}})),c=[],l=new Map;for(const d of o){if(!d)continue;d.manifestWrite&&c.push(d.manifestWrite);const p=l.get(d.changelogPath);p?p.push(d.changelogEntry):l.set(d.changelogPath,[d.changelogEntry])}for(const[d,p]of l){const u=p.join(`
1
+ import{createRequire as ws}from"node:module";import{VersionActions as C}from"../packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js";import{VisReleaseError as g}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import Ue from"./index.js";import{tagExists as ue,renderTagPattern as z,defaultTagFor as Be}from"./git.js";import{a as Cs,s as ge,o as me,i as he}from"../packem_shared/gradle-build-CHZDHyjI.js";import{y as Ps}from"../packem_shared/index-C9ENZqH9.js";import{resolveCleanStripList as Ns}from"./DEFAULT_CLEAN_KEEP.js";import{assertValidPackageName as x,resolveCustomCommands as re,interpolateCommand as te}from"./security.js";let bs;const ys=r=>(bs??=ws(import.meta.url))(r),L=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=r=>{if(typeof L<"u"&&L.versions&&L.versions.node){const[e,s]=L.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return L.getBuiltinModule(r)}return ys(r)},{readFile:P,readdir:ce,rm:le,access:Le,writeFile:B,mkdtemp:ks}=U("node:fs/promises"),{isAbsolute:G,join:f,dirname:E,resolve:Me,relative:Te,sep:Ge,basename:j}=U("node:path"),{realpathSync:vs,mkdtempSync:se,writeFileSync:$s}=U("node:fs"),{fileURLToPath:Is}=U("node:url"),{tmpdir:J}=U("node:os"),As=["dependencies","devDependencies","peerDependencies","optionalDependencies"],We=(r,e)=>{if(r.startsWith("catalog:")||r==="*"||r==="workspace:*"||r==="workspace:^"||r==="workspace:~")return r;if(r.startsWith("workspace:")){const t=r.slice(10);return`workspace:${ee(t)}${e}`}if(r.startsWith("npm:")){const t=r.lastIndexOf("@");if(t<=4)return r;const n=r.slice(4,t),a=r.slice(t+1),i=ee(a);return`npm:${n}@${i}${e}`}return`${ee(r)}${e}`},_s=/^([\^~=]|>=?|<=?)/,ee=r=>{const e=_s.exec(r);return e?e[1]??"^":"^"},bt=async(r,e,s={})=>{const t=s.serializeManifest??Ds,n=s.changelogPath??Rs,a=s.renderChangelogEntry??Fs,i=new Map(r.releases.map(d=>[d.name,d.newVersion])),o=await Promise.all(r.releases.map(async d=>{const p=e.getPackage(d.name);if(!p)return;const u=Ss(p.manifest,d.newVersion,i),m=s.readManifest?.(p.manifestPath),h=n(p);return{changelogEntry:await a(d),changelogPath:h,manifestWrite:p.ecosystem===void 0?{content:t(u,m),path:p.manifestPath}:void 0}})),c=[],l=new Map;for(const d of o){if(!d)continue;d.manifestWrite&&c.push(d.manifestWrite);const p=l.get(d.changelogPath);p?p.push(d.changelogEntry):l.set(d.changelogPath,[d.changelogEntry])}for(const[d,p]of l){const u=p.join(`
2
2
 
3
- `),m=s.readChangelog?.(d);c.push({content:js(u,m),path:d})}return{deletions:r.consumedChangeFiles.map(d=>d.path),writes:c}},Es=(r,e,s)=>{const t={...r,version:e};for(const n of Vs){const a=r[n];if(!a||typeof a!="object")continue;const i={...a};let o=!1;for(const[c,l]of Object.entries(a)){const d=s.get(c);if(d===void 0)continue;const p=qe(l,d);p!==l&&(i[c]=p,o=!0)}o&&(t[n]=i)}return t},Ds=/^# .+/,Rs=/^## /m,js=(r,e)=>{const s=r.trim();if(!e||e.trim()==="")return`# Changelog
3
+ `),m=s.readChangelog?.(d);c.push({content:Es(u,m),path:d})}return{deletions:r.consumedChangeFiles.map(d=>d.path),writes:c}},Ss=(r,e,s)=>{const t={...r,version:e};for(const n of As){const a=r[n];if(!a||typeof a!="object")continue;const i={...a};let o=!1;for(const[c,l]of Object.entries(a)){const d=s.get(c);if(d===void 0)continue;const p=We(l,d);p!==l&&(i[c]=p,o=!0)}o&&(t[n]=i)}return t},Vs=/^# .+/,Os=/^## /m,Es=(r,e)=>{const s=r.trim();if(!e||e.trim()==="")return`# Changelog
4
4
 
5
5
  ${s}
6
- `;const t=e.split(/\r?\n/);if(t[0]&&Ds.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(`
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
7
  `).replaceAll(/\n{3,}/g,`
8
8
 
9
- `)}return Rs.test(e)?`${s}
9
+ `)}return Os.test(e)?`${s}
10
10
 
11
11
  ${e.trimStart()}`:`${s}
12
12
 
13
- ${e.trimStart()}`},Ls=(r,e)=>{const s=Fs(e);return`${JSON.stringify(r,null,s)}
14
- `},Fs=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},Ms=r=>`${r.dir}/CHANGELOG.md`,Ts=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
- `)},Gs=["dependencies","devDependencies","peerDependencies","optionalDependencies"],we={default:{},named:{}},Us=r=>{if(!r)return we;let e;try{e=_s(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 we;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},Ye=(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 Gs){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=Ye(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},At=Object.defineProperty({__proto__:null,parseCatalogs:Us,resolveCatalogRef:Ye,rewriteCatalogRefs:de},Symbol.toStringTag,{value:"Module"}),Xe={"Cargo.toml":"cargo","tauri.conf.json":"tauri"},pe=Object.keys(Xe),Bs=r=>r.replaceAll("\\","/").split("/").pop()??r,L=r=>Xe[Bs(r)],Ws=new Set(["package","workspace.package"]),Hs=/^\s*\[\[?\s*([^\]]+?)\s*\]\]?\s*(?:#.*)?$/,Js=/^(\s*version\s*=\s*)(["'])[^"']*\2/,ze=(r,e,s=Ws)=>{const t=r.split(`
16
- `);let n="",a=!1;for(let i=0;i<t.length;i++){const o=t[i],c=Hs.exec(o);if(c){n=c[1].replaceAll(/\s+/g,"");continue}if(!s.has(n))continue;const l=Js.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}},Qe=(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)}}}},Ze=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=Ze(s);if(!t)return{delegated:!1,found:!1};const n=Qe(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}},es=async(r,e)=>{const s=L(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=Ze(t);if(!n)return;const a=Qe(e,n);return a?a.value.startsWith(".")||a.value.startsWith("/")?{delegated:!0}:{version:a.value}:void 0}},ss=(r,e)=>{for(const s of e)if(!L(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.`})},Ks=async(r,e,s,t,n=new Map)=>{ss(t,e);const a=[];for(const i of e){const o=L(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"?ze(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}},qs=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(!L(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 es(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"}},Nt=Object.defineProperty({__proto__:null,SUPPORTED_VERSION_FILES:pe,applyVersionFilesForRelease:Ks,assertSupportedVersionFiles:ss,checkVersionFile:qs,readManifestVersion:es,resolveVersionFileKind:L,rewriteCargoVersion:ze,rewriteTauriVersion:xe},Symbol.toStringTag,{value:"Module"}),Ys="[[package]]",rs=(r,e,s)=>{const t=r.split(`
18
- `);let n=!1,a=-1;const i=[];for(const[o,c]of t.entries())c.trim()===Ys&&(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}},j=r=>{const e=Be(r);try{return Cs.native(e)}catch{return e}},ts=async(r,e)=>ns(r,e,"Cargo.lock"),ns=async(r,e,s)=>{const t=j(e);let n=j(r);for(;;){const a=f(n,s);try{return await P(a,"utf8"),a}catch{}if(n===t)return;const i=E(n),o=We(t,i);if(i===n||o.startsWith("..")||G(o))return;n=i}},as=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}`})}},Xs=(r,e)=>{const s=new Set;for(const t of e.versionFiles??[])L(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]},zs=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 as(c,i);if(l===void 0)continue;const d=await ts(E(i),t);if(d===void 0)continue;let p=s.get(d);p===void 0&&(p=await P(d,"utf8"));const u=rs(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}},_t=Object.defineProperty({__proto__:null,canonicalPath:j,cargoManifestPaths:Xs,findCargoLock:ts,findLockfile:ns,readCrateName:as,rewriteCargoLockVersion:rs,syncCargoLocks:zs},Symbol.toStringTag,{value:"Module"}),Qs=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()&&Je(t,c.name)&&a.push(f(i,c.name))}s=a}return s},Zs=(r,e)=>{for(const s of e)if(r===s||r.startsWith(`${s}${He}`))return!0;return!1},is=async r=>{let e=E(j(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}`})}},be=r=>Array.isArray(r)?r.filter(e=>typeof e=="string"):[],Q=r=>typeof r=="object"&&r!==null&&r.workspace===!0,xs=(r,e)=>{const s=Q(r.publish)?e.workspace?.package?.publish:r.publish;return s===!1||Array.isArray(s)&&s.length===0},er=(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:Be(d,l.path),name:typeof l.package=="string"?l.package:a,requirement:typeof l.version=="string"?l.version:"*"})}return n},sr=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=be(a.workspace?.exclude);for(const p of be(a.workspace?.members))for(const u of await Qs(s,p)){const m=We(s,u).split(He).join("/");m.split("/").includes("target")||o.some(h=>Je(h,m))||i.add(u)}const c=new Set([...e].map(p=>j(p))),l=[];for(const p of[...i].sort()){if(Zs(j(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 A=h.package.version,k=typeof A=="string"?A:Q(A)?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:er(h,a,p,s),private:xs(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}})},St=Object.defineProperty({__proto__:null,discoverCargoCrates:sr,findInheritedWorkspaceVersion:is,inheritsFromWorkspace:Q,parseCargoDoc:Y},Symbol.toStringTag,{value:"Module"}),rr="ACTIONS_ID_TOKEN_REQUEST_URL",ge=r=>{const e=!!r.env[rr],s=!!r.env[r.staticTokenVar],t=r.workspaceConfig?.publish?.preferStaticToken===!0;return e&&!(t&&s)?"oidc":s?"token":"missing"};let W;const tr="https://github.com/visulima/visulima",nr=async()=>{try{let e=E(As(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"},ar=async()=>(W!==void 0||(W=`vis-release/${await nr()} (+${tr})`),W),ye=new Map,ir=async r=>{const e=ye.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 ye.set(r,t),t}catch{return}},or=r=>r===301||r===302||r===303||r===307||r===308,cr=(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 ar(),...e.headers};e.headers?.["User-Agent"]&&(n["User-Agent"]=e.headers["User-Agent"]);let a=r,i=0;const o=e.httpProxy?await ir(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(!or(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(!cr(r,d))return{json:async()=>{},ok:!1,status:0,text:async()=>""};a=d,i+=1}},lr="https://crates.io/api/v1/crates",ur="Cargo.toml",ke=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 is(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}},ve=async(r,e)=>{const s=`${lr}/${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}},dr=(r,e)=>ge({env:r,staticTokenVar:"CARGO_REGISTRY_TOKEN",workspaceConfig:e})==="oidc",pr=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 gr extends C{id="cargo";async readPublishedVersion(e){const s=ae(e.pkg);try{const{name:t}=await ke(s);return await ve(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=mr(e.pkg,e.perPackageConfig),{name:n,version:a}=await ke(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 ve(n,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[cargo] ${n}@${e.release.newVersion} already on crates.io`,published:!1};const o=dr(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 pr(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"),A=h.findings.map(k=>` • [packSecretScan] ${b(k.message)}${k.hint?`
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},Rs=r=>`${r.dir}/CHANGELOG.md`,Fs=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
+ `)},Ls=["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 Ls){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,F=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=F(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(!F(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=F(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(!F(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:F,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}},R=r=>{const e=Me(r);try{return vs.native(e)}catch{return e}},xe=async(r,e)=>es(r,e,"Cargo.lock"),es=async(r,e,s)=>{const t=R(e);let n=R(r);for(;;){const a=f(n,s);try{return await P(a,"utf8"),a}catch{}if(n===t)return;const i=E(n),o=Te(t,i);if(i===n||o.startsWith("..")||G(o))return;n=i}},ss=async(r,e)=>{const{parse:s}=await import("./index4.js");try{const t=s(r);return typeof t.package?.name=="string"?t.package.name:void 0}catch(t){throw new g({cause:t,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${t.message}`})}},qs=(r,e)=>{const s=new Set;for(const t of e.versionFiles??[])F(t)==="cargo"&&s.add(G(t)?t:f(r,t));if(e.versionActions==="cargo"){const t=e.cargoTomlPath??"Cargo.toml";s.add(G(t)?t:f(r,t))}return[...s]},Js=async r=>{const{entries:e,pending:s,workspaceRoot:t}=r,n=[],a=[];for(const{manifestPath:i,newVersion:o}of e){let c=s.get(i);if(c===void 0)try{c=await P(i,"utf8")}catch{continue}const l=await ss(c,i);if(l===void 0)continue;const d=await xe(E(i),t);if(d===void 0)continue;let p=s.get(d);p===void 0&&(p=await P(d,"utf8"));const u=Ze(p,l,o);if(!u.found){n.push(`cargo-lock: ${l} has no workspace-member entry in ${d}; run \`cargo generate-lockfile\` or build once to add it.`);continue}if(u.content!==void 0&&u.content!==p){s.set(d,u.content);const m=a.findIndex(b=>b.path===d),h={content:u.content,path:d};m===-1?a.push(h):a[m]=h}}return{warnings:n,writes:a}},vt=Object.defineProperty({__proto__:null,canonicalPath:R,cargoManifestPaths:qs,findCargoLock:xe,findLockfile:es,readCrateName:ss,rewriteCargoLockVersion:Ze,syncCargoLocks:Js},Symbol.toStringTag,{value:"Module"}),Ys=async(r,e)=>{let s=[r];for(const t of e.split("/").filter(n=>n!==""&&n!==".")){if(t==="**")throw new g({code:"CONFIG_INVALID",message:`Unsupported [workspace].members pattern "${e}": "**" is not supported. List the crate directories explicitly or use "dir/*".`});const n=/[*?[{]/.test(t),a=[];for(const i of s){if(!n){a.push(f(i,t));continue}const o=await ce(i,{withFileTypes:!0}).catch(()=>[]);for(const c of o)c.isDirectory()&&Ue(t,c.name)&&a.push(f(i,c.name))}s=a}return s},Xs=(r,e)=>{for(const s of e)if(r===s||r.startsWith(`${s}${Ge}`))return!0;return!1},rs=async r=>{let e=E(R(r));for(;;){const s=f(e,"Cargo.toml"),t=await ne(s);if(t!==void 0){const i=(await Y(t,s)).workspace?.package?.version;if(typeof i=="string")return i}const n=E(e);if(n===e)return;e=n}},ne=async r=>{try{return await P(r,"utf8")}catch{return}},Y=async(r,e)=>{const{parse:s}=await import("./index4.js");try{return s(r)}catch(t){throw new g({cause:t,code:"CONFIG_INVALID",file:e,message:`Failed to parse ${e}: ${t.message}`})}},we=r=>Array.isArray(r)?r.filter(e=>typeof e=="string"):[],Q=r=>typeof r=="object"&&r!==null&&r.workspace===!0,zs=(r,e)=>{const s=Q(r.publish)?e.workspace?.package?.publish:r.publish;return s===!1||Array.isArray(s)&&s.length===0},Qs=(r,e,s,t)=>{const n=[];for(const[a,i]of Object.entries(r.dependencies??{})){const o=i,c=Q(o),l=c?e.workspace?.dependencies?.[a]:o,d=c?t:s;l===void 0||typeof l!="object"||typeof l.path!="string"||n.push({dir:Me(d,l.path),name:typeof l.package=="string"?l.package:a,requirement:typeof l.version=="string"?l.version:"*"})}return n},Zs=async r=>{const{claimedDirs:e,cwd:s}=r,t=f(s,"Cargo.toml"),n=await ne(t);if(n===void 0)return[];const a=await Y(n,t),i=new Set;a.package&&i.add(s);const o=we(a.workspace?.exclude);for(const p of we(a.workspace?.members))for(const u of await Ys(s,p)){const m=Te(s,u).split(Ge).join("/");m.split("/").includes("target")||o.some(h=>Ue(h,m))||i.add(u)}const c=new Set([...e].map(p=>R(p))),l=[];for(const p of[...i].sort()){if(Xs(R(p),c))continue;const u=f(p,"Cargo.toml"),m=await ne(u);if(m===void 0)continue;const h=await Y(m,u);if(!h.package)continue;const{name:b}=h.package;if(typeof b!="string"||b==="")throw new g({code:"CONFIG_INVALID",file:u,message:`${u} has a [package] table without a name.`});const N=h.package.version,k=typeof N=="string"?N:Q(N)?a.workspace?.package?.version:void 0;if(typeof k!="string")throw new g({code:"CONFIG_INVALID",file:u,message:`${u} has no resolvable [package].version.`});l.push({dir:p,manifestPath:u,name:b,pathDeps:Qs(h,a,p,s),private:zs(h.package,a),version:k})}const d=new Map(l.map(p=>[p.dir,p]));return l.map(p=>{const u={};for(const h of p.pathDeps){const b=d.get(h.dir);b&&(u[b.name]=h.requirement)}const m={dependencies:u,name:p.name,private:p.private,version:p.version};return{dir:p.dir,ecosystem:"cargo",manifest:m,manifestPath:p.manifestPath,name:p.name,private:p.private,version:p.version}})},$t=Object.defineProperty({__proto__:null,discoverCargoCrates:Zs,findInheritedWorkspaceVersion:rs,inheritsFromWorkspace:Q,parseCargoDoc:Y},Symbol.toStringTag,{value:"Module"}),xs="ACTIONS_ID_TOKEN_REQUEST_URL",ts=r=>{const e=!!r.env[xs],s=!!r.env[r.staticTokenVar],t=r.workspaceConfig?.publish?.preferStaticToken===!0;return e&&!(t&&s)?"oidc":s?"token":"missing"};let W;const er="https://github.com/visulima/visulima",sr=async()=>{try{let e=E(Is(import.meta.url));for(let s=0;s<6;s+=1){const t=f(e,"package.json");try{const a=await P(t,"utf8"),i=JSON.parse(a);if(i.name==="@visulima/vis"&&typeof i.version=="string")return i.version}catch{}const n=E(e);if(n===e)break;e=n}}catch{}return"unknown"},rr=async()=>(W!==void 0||(W=`vis-release/${await sr()} (+${er})`),W),be=new Map,tr=async r=>{const e=be.get(r);if(e!==void 0)return e;try{const s=await import("./index7.js").then(n=>n.i),t=new s.ProxyAgent(r);return be.set(r,t),t}catch{return}},nr=r=>r===301||r===302||r===303||r===307||r===308,ar=(r,e)=>{try{const s=new URL(r),t=new URL(e);return s.host===t.host&&s.protocol===t.protocol}catch{return!1}},S=async(r,e={})=>{const s=e.maxRedirects??2,n={"User-Agent":await rr(),...e.headers};e.headers?.["User-Agent"]&&(n["User-Agent"]=e.headers["User-Agent"]);let a=r,i=0;const o=e.httpProxy?await tr(e.httpProxy):void 0;for(;;){let c;try{const p=e.fetchImpl??globalThis.fetch,u={headers:n,method:e.method??"GET",redirect:"manual"};o&&(u.dispatcher=o),c=await p(a,u)}catch{return{json:async()=>{},ok:!1,status:0,text:async()=>""}}if(!nr(c.status))return{json:async()=>{try{return await c.json()}catch{return}},ok:c.ok,status:c.status,text:async()=>{try{return await c.text()}catch{return""}}};const l=c.headers.get("location")??c.headers.get("Location");if(!l||i>=s)return{json:async()=>{},ok:!1,status:0,text:async()=>""};let d;try{d=new URL(l,a).toString()}catch{return{json:async()=>{},ok:!1,status:0,text:async()=>""}}if(!ar(r,d))return{json:async()=>{},ok:!1,status:0,text:async()=>""};a=d,i+=1}},ir="https://crates.io/api/v1/crates",or="Cargo.toml",ye=async r=>{let e;try{e=await P(r,"utf8")}catch(o){throw new g({cause:o,code:"CONFIG_INVALID",file:r,message:`Failed to read Cargo.toml at ${r}: ${o.message}`})}const{parse:s}=await import("./index4.js");let t;try{t=s(e)}catch(o){throw new g({cause:o,code:"CONFIG_INVALID",file:r,message:`Failed to parse Cargo.toml at ${r}: ${o.message}`})}if(!t.package)throw new g({code:"CONFIG_INVALID",file:r,hint:"CargoVersionActions only supports publishable crates with a [package] table. For workspace roots, point per-package config at the member crate directory.",message:`Cargo.toml at ${r} has no [package] table.`});const{name:n}=t.package;if(typeof n!="string"||n.length===0)throw new g({code:"CONFIG_INVALID",file:r,message:`Cargo.toml at ${r} is missing [package].name.`});const a=t.package.version;let i;if(typeof a=="string"?i=a:a&&typeof a=="object"&&a.workspace===!0&&(i=await rs(r)??t.workspace?.package?.version),typeof i!="string"||i.length===0)throw new g({code:"CONFIG_INVALID",file:r,hint:"Set [package].version explicitly, or — for workspace-inherited versions — ensure the root Cargo.toml carries [workspace.package].version and point per-package config at it.",message:`Cargo.toml at ${r} has no resolvable [package].version.`});return{name:n,version:i}},ke=async(r,e)=>{const s=`${ir}/${encodeURIComponent(r)}`;try{const t=await S(s,{headers:{Accept:"application/json"},httpProxy:e});if(t.status===404||!t.ok)return;const n=await t.json();return n?.crate?.max_stable_version??n?.crate?.max_version??void 0}catch{return}},cr=(r,e)=>ts({env:r,staticTokenVar:"CARGO_REGISTRY_TOKEN",workspaceConfig:e})==="oidc",lr=async(r,e)=>{const s=await r.run("cargo",["package","--list","--allow-dirty"],{cwd:e,silent:!0});return s.exitCode!==0?[]:s.stdout.split(/\r?\n/).map(t=>t.trim()).filter(t=>t.length>0)};class ur extends C{id="cargo";async readPublishedVersion(e){const s=ae(e.pkg);try{const{name:t}=await ye(s);return await ke(t)}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run / cargo] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const s=ae(e.pkg,e.perPackageConfig),t=dr(e.pkg,e.perPackageConfig),{name:n,version:a}=await ye(s);if(a!==e.release.newVersion)throw new g({code:"CONFIG_INVALID",file:s,hint:`Confirm the cargo() preset's crateDir points at the directory containing this Cargo.toml. Expected ${e.release.newVersion} on disk after the extra-files bump.`,message:`Cargo.toml version (${a}) does not match planned release version (${e.release.newVersion}) for ${e.pkg.name}.`,packageName:e.pkg.name});if(await ke(n,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[cargo] ${n}@${e.release.newVersion} already on crates.io`,published:!1};const o=cr(process.env,e.workspaceConfig);if(!o&&!process.env.CARGO_REGISTRY_TOKEN)throw new g({code:"AUTH_MISSING",hint:"Set CARGO_REGISTRY_TOKEN, or run from a GH-Actions job with `permissions: id-token: write` for OIDC trusted publishing.",message:`Cannot publish ${n}@${e.release.newVersion}: neither CARGO_REGISTRY_TOKEN nor OIDC trusted publishing is available.`,packageName:e.pkg.name});const c=e.workspaceConfig?.publish?.guards;if(c?.packSecretScan){const p=await lr(e.pm.runner,t);if(p.length>0){const{runPackSecretScan:u}=await import("./publish-guards.js"),m=typeof c.packSecretScan=="object"?c.packSecretScan.ignore:void 0,h=await u({files:p,ignore:m,pkgDir:t});if(!h.passed){const{redactTokens:b}=await import("./security.js"),N=h.findings.map(k=>` • [packSecretScan] ${b(k.message)}${k.hint?`
20
20
  → ${b(k.hint)}`:""}`).join(`
21
21
  `);throw new g({code:"PUBLISH_FAILED",message:`Pre-publish secret scan failed for ${n}@${e.release.newVersion}:
22
- ${A}`,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??ur;return f(r.dir,s)},mr=(r,e)=>E(ae(r,e)),hr=(r,e,s)=>z(r?.releaseTagPattern??"v{version}",{name:e,version:s});class fr extends C{id="composer";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=hr(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 wr=["linux/amd64","linux/arm64"],br=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}`}},$e=(r,e)=>{const{registry:s,repository:t}=br(r);return`https://${s==="docker.io"?"registry-1.docker.io":s}/v2/${t}/manifests/${encodeURIComponent(e)}`},os=r=>{const e=r??{};return{buildContext:e.buildContext,containerBuildArgs:e.containerBuildArgs,containerImage:e.containerImage,containerPlatforms:e.containerPlatforms,containerSigning:e.containerSigning,containerSkipLatest:e.containerSkipLatest}},yr=(r,e)=>{const s=os(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 kr extends C{id="container";async readPublishedVersion(e){const s=os(e.perPackageConfig);if(!s.containerImage)return;const t=e.pkg.version,n=$e(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=yr(e.perPackageConfig,e.pkg.name);if(e.dryRun){const{command:a}=Ie(e,s);return{output:`[dry-run / container] would run: ${a.join(" ")}`,published:!0}}try{const a=$e(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}=Ie(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 Ie=(r,e)=>{if(!e.containerImage)throw new Error("buildBuildxCommand requires config.containerImage");const s=(e.containerPlatforms??wr).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}},vr=r=>`https://pub.dev/api/packages/${encodeURIComponent(r)}`,$r=async r=>{try{const e=await S(vr(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 Ir 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 $r(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 Cr="https://rubygems.org",Pr=async(r,e,s)=>{const t=`${Cr}/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}},Ar=async(r,e)=>{try{return(await r.pm.runner.run("gem",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class Nr extends C{id="gem";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=R(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 Ar(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 Pr(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}
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
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 _r=(r,e,s)=>z(r?.releaseTagPattern??"v{version}",{name:e,version:s});class Sr extends C{id="go";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=_r(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 Ce=["build.gradle.kts","build.gradle"],cs=["settings.gradle.kts","settings.gradle"],D=(r,e)=>new g({code:"CONFIG_INVALID",file:r,message:e}),Vr=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}},Or=r=>Ue(r).then(()=>!0,()=>!1),K=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}},Er=async r=>{const{claimedDirs:e,cwd:s}=r,t=await K(s,Ce),n=await K(s,cs);if(!t&&!n)return[];const a=n?Ns(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?me(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 K(m,Ce);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:me(u.build.raw),h=H(he(m.assignments,"version"),u.build.path,"version");if(u.isRoot&&h===void 0)continue;const b=h?void 0:H(fe(o,"version",u.isRoot),t?.path??u.build.path,"version"),A=h??b;if(!A){const y=await Vr(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(he(m.assignments,"group"),u.build.path,"group")??H(fe(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??R(s):R(u.dir);l.push({kind:h?"literal":"inherited",line:A.assignment.line,module:u,name:`${k.value}:${O}`,owner:h?u.build.path:t.path,scan:m,version:A.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:A,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:A,package:{dir:h.dir,ecosystem:"gradle",manifest:w,manifestPath:h.build.path,name:b,private:!1,version:O},taskPath:h.taskPath}})},ls=async r=>{let e=r;for(;;){if(await Or(f(e,"gradlew"))||await K(e,cs)!==void 0)return e;const s=E(e);if(s===e)return;e=s}},Vt=Object.defineProperty({__proto__:null,discoverGradleProjects:Er,findGradleRoot:ls},Symbol.toStringTag,{value:"Module"}),Dr=/<!--[\s\S]*?-->/g,Rr=/<project\b[^>]*>([\s\S]*)/i,Pe=/<version>\s*([^<]+?)\s*<\/version>/i,Ae=/<groupId>\s*([^<]+?)\s*<\/groupId>/i,Ne=/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i,jr=/<modules\b[^>]*>[\s\S]*?<module\b/i,_e=r=>{const e=r.replaceAll(Dr,""),t=Rr.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=Pe.exec(n)??Pe.exec(t),i=Ae.exec(n)??Ae.exec(t),o=Ne.exec(n)??Ne.exec(t),c=jr.test(t);return{artifactId:o?.[1],groupId:i?.[1],hasModules:c,version:a?.[1]}},Lr=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},Fr=r=>{const e=/<versions>([\s\S]*?)<\/versions>/i.exec(r);return e?[...e[1].matchAll(/<version>\s*([^<]+?)\s*<\/version>/gi)].map(s=>s[1]):[]},us=(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 Mr 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=_e(n);if(this.warnIfMultiModule(e.pkg,a),!a.groupId||!a.artifactId||s.mavenMetadataUrl==="")return;const i=s.mavenMetadataUrl??us(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 Lr(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=_e(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}
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=>Le(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 Rr 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
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 Tr=r=>{const e=r.indexOf(":");return e===-1?void 0:{artifactId:r.slice(e+1),groupId:r.slice(0,e)}},Gr=async r=>{const e=r.perPackageConfig??{},s=Tr(r.pkg.name);if(e.mavenMetadataUrl===""||s===void 0)return!1;const t=e.mavenMetadataUrl??us(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&&Fr(await n.text()).includes(r.release.newVersion)}catch{return!1}};class Ur extends C{id="gradle";async readPublishedVersion(e){}async publish(e){const s=await ls(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 Ue(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 Gr(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 Br="https://hex.pm",Wr=async(r,e,s)=>{const t=`${Br}/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}},Hr=async(r,e)=>{try{return(await r.pm.runner.run("mix",["help"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}};class Jr 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 ${R(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 Hr(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 Wr(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 Kr="https://jsr.io",qr=/^@[a-z0-9-]+\/[a-z0-9-]+$/i,Se=async r=>{let e;try{e=await P(r,"utf8")}catch(t){throw new g({cause:t,code:"CONFIG_INVALID",file:r,message:`Failed to read JSR manifest at ${r}: ${t.message}`})}let s;try{s=JSON.parse(e)}catch(t){throw new g({cause:t,code:"CONFIG_INVALID",file:r,message:`Failed to parse JSR manifest at ${r}: ${t.message}`})}if(typeof s.name!="string"||s.name.length===0)throw new g({code:"CONFIG_INVALID",file:r,hint:"JSR manifests must declare a `name` field with the `@scope/name` form.",message:`JSR manifest at ${r} is missing the \`name\` field.`});if(!qr.test(s.name))throw new g({code:"CONFIG_INVALID",file:r,hint:"JSR requires every package to publish under `@scope/name`. Add the `@scope/` prefix and lowercase the name (a-z, 0-9, hyphen).",message:`JSR manifest at ${r} declares an invalid \`name\`: "${s.name}". JSR requires the @scope/name form.`});if(typeof s.version!="string"||s.version.length===0)throw new g({code:"CONFIG_INVALID",file:r,hint:"Add a `version` literal to the JSR manifest, or wire the `jsr()` preset so vis bumps it for you.",message:`JSR manifest at ${r} is missing the \`version\` field.`});return{name:s.name,version:s.version}},Ve=async(r,e)=>{const s=`${Kr}/${r}/meta.json`;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 typeof n?.latest=="string"?n.latest:void 0}catch{return}},Yr=(r,e)=>ge({env:r,staticTokenVar:"JSR_API_KEY",workspaceConfig:e})==="oidc",Oe=(r,e)=>{const s=e?.jsrConfigPath??"jsr.json";return f(r.dir,s)};class Xr extends C{id="jsr";async readPublishedVersion(e){const s=Oe(e.pkg,e.perPackageConfig);try{const{name:t}=await Se(s);return await Ve(t,e.workspaceConfig?.httpProxy)}catch{return}}async publish(e){if(e.dryRun)return{output:`[dry-run / jsr] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const s=Oe(e.pkg,e.perPackageConfig),{name:t,version:n}=await Se(s);if(n!==e.release.newVersion)throw new g({code:"CONFIG_INVALID",file:s,hint:`Confirm the jsr() preset's manifestPath points at the JSR config file the extra-files rule rewrites. Expected ${e.release.newVersion} on disk after the bump.`,message:`JSR manifest version (${n}) does not match planned release version (${e.release.newVersion}) for ${e.pkg.name}.`,packageName:e.pkg.name});if(await Ve(t,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[jsr] ${t}@${e.release.newVersion} already on jsr.io`,published:!1};const i=Yr(process.env,e.workspaceConfig);if(!i&&!process.env.JSR_API_KEY)throw new g({code:"AUTH_MISSING",hint:"Set JSR_API_KEY for static-token auth, or run from a GH-Actions job with `permissions: id-token: write` so ACTIONS_ID_TOKEN_REQUEST_URL is exposed for OIDC trusted publishing.",message:`Cannot publish ${t}@${e.release.newVersion}: neither JSR_API_KEY nor OIDC trusted publishing is available.`,packageName:e.pkg.name});const o=["jsr","publish","--allow-dirty"],c=e.perPackageConfig?.jsrConfigPath;c!==void 0&&c!=="jsr.json"&&o.push("--config",c);for(const d of e.perPackageConfig?.jsrPublishArgs??[])o.push(d);const l=await e.pm.runner.run("npx",o,{cwd:e.pkg.dir,silent:!1});if(l.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:"Inspect the jsr CLI output above. Common causes: invalid JSR_API_KEY, OIDC permission misconfigured, version already published, slow-mode rate limit. Re-runs are safe — the published-version probe short-circuits subsequent runs.",message:`jsr publish failed for ${t}@${e.release.newVersion}: exit ${l.exitCode}. stderr: ${l.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[jsr] published ${t}@${e.release.newVersion}${i?" (trusted publishing)":""}`,published:!0}}}const ds=(r,e)=>{if(e===!1)return{...r};const s=new Set(Ss(e)),t={name:r.name,version:r.version};for(const[n,a]of Object.entries(r))s.has(n)||(t[n]=a);return t},ps="https://registry.npmjs.org/",zr="npm:registry.npmjs.org",Ee=async r=>{const e=f(r,"npm");try{return(await ce(e,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name)}catch{return[]}},Qr=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(zr)}`,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},Zr=async(r,e)=>{const s=await fetch(`${ps}-/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},De=async(r,e,s)=>{if(e){const n=await Zr(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})},Re=(r,e)=>{Ps(r,`//registry.npmjs.org/:_authToken=${e}
34
- registry=${ps}
35
- `)};class xr 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 Ee(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 Ee(e.pkg.dir);if(s.length===0){const{NpmVersionActions:c}=await Promise.resolve().then(()=>tt);return new c().publish(e)}const{env:t}=process,n=await Qr(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 De($.name,n,t),N=se(f(q(),"vis-release-napi-"));o.push(N);const _=f(N,".npmrc");return Re(_,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 N=V.blockers.flatMap(_=>_.findings.map(Z=>` • [${_.gate}] ${Z.message}${Z.hint?`
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 Fr=r=>{const e=r.indexOf(":");return e===-1?void 0:{artifactId:r.slice(e+1),groupId:r.slice(0,e)}},Lr=async r=>{const e=r.perPackageConfig??{},s=Fr(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 Le(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 Lr(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
37
  → ${Z.hint}`:""}`)).join(`
38
38
  `);throw new g({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${w.name}@${a} (platform package):
39
- ${N}`,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 A=de(h,e.catalogs),k=ds(A,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 De(e.pkg.name,n,t),w=se(f(q(),"vis-release-napi-parent-"));o.push(w);const v=f(w,".npmrc");Re(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 N=JSON.parse(I);N[0]?.filename&&($=f(w,N[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:N}=await import("./publish-guards.js");return{published:!0,tarball:await N($)}}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 et=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[]}},je=1800*1e3,Le=15*1e3,Fe=r=>{if(r===!0)return{enabled:!0,pollIntervalMs:Le,timeoutMs:je};if(r&&typeof r=="object"){const e=r;return{enabled:!0,pollIntervalMs:e.pollIntervalMs??Le,timeoutMs:e.timeoutMs??je}}return{enabled:!1,pollIntervalMs:0,timeoutMs:0}};class gs 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=Fe(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=rt(t,e.versionedManifestByName),a=de(n,e.catalogs),i=ds(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(q(),"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 et(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(N=>N.findings.map(_=>` • [${N.gate}] ${$(_.message)}${_.hint?`
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
42
  → ${$(_.hint)}`:""}`)).join(`
43
43
  `);throw new g({code:"PUBLISH_FAILED",message:`Pre-publish guards failed for ${e.pkg.name}@${e.release.newVersion}:
44
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
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=Fe(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:A}=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 A({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)...
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
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
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
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.
@@ -53,6 +53,6 @@ ${V}`,packageName:e.pkg.name})}}const{hashTarball:u}=await import("./publish-gua
53
53
  `)},packageName:e.pkg.name,pollIntervalMs:s.pollIntervalMs,runner:e.pm.runner,stageId:t,timeoutMs:s.timeoutMs,version:e.release.newVersion});return i==="approved"?(process.stderr.write(`[vis release] ✓ ${e.pkg.name}@${e.release.newVersion} approved + promoted on resume (${Math.round((Date.now()-n)/1e3)}s).
54
54
  `),{output:`[resumed] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}):i==="rejected"?(process.stdout.write(`::warning::Stage rejected on resume for ${e.pkg.name}@${e.release.newVersion} (id ${t}).
55
55
  `),{alreadyPublished:!1,output:`stage-rejected: ${t}`,published:!1,stageId:t}):(process.stdout.write(`::warning::Stage timeout on resume for ${e.pkg.name}@${e.release.newVersion} (id ${t}) after ${Math.round(s.timeoutMs/6e4)}m.
56
- `),{alreadyPublished:!1,output:`stage-timeout: ${t}`,published:!1,stageId:t})}}const st=["dependencies","devDependencies","peerDependencies","optionalDependencies"],rt=(r,e)=>{const s={...r};for(const t of st){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]=qe(o.slice(10)==="*"?"*":o,c.version),a[i].startsWith("workspace:")&&(a[i]=a[i].slice(10)))}s[t]=a}return s},tt=Object.defineProperty({__proto__:null,NpmVersionActions:gs},Symbol.toStringTag,{value:"Module"}),Me="https://api.nuget.org/v3/index.json",nt="https://api.nuget.org/v3-flatcontainer",M="NUGET_API_KEY",T=[10,0,300],at=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},Te=r=>r.split("+")[0].toLowerCase(),it=async(r,e,s)=>{try{const t=await S(`${nt}/${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"&&Te(i)===Te(e))}catch{return!1}},Ge=(r,e)=>r.split(e).join("***").trim().slice(0,500);class ot 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 ${R(n)} -c Release, then dotnet nuget push the package to ${Me} 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(!at(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 it(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 Is(f(q(),"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 ${R(n)}
57
- Fix the build or packaging error above.`,message:`dotnet pack failed for ${s}@${t}: exit ${l.exitCode}. stderr: ${Ge(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",Me],{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: ${Ge(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 ct 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 ms=r=>`https://pypi.org/pypi/${encodeURIComponent(r.toLowerCase())}/json`,lt=(r,e)=>e?.uvLockPath?f(r.dir,e.uvLockPath):f(r.dir,"uv.lock"),ut=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}`})}},hs=async(r,e)=>{try{return(await r.run("uv",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}},fs=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"},ws=(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"}},bs=(r,e)=>ge({env:r,staticTokenVar:"TWINE_PASSWORD",workspaceConfig:e}),ie=async(r,e)=>{try{const s=await S(ms(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 ys 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 hs(e.pm.runner,e.pkg.dir),c=fs(n),l=ws(c,o),d=bs(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 Ot=Object.defineProperty({__proto__:null,PYPI_PROJECT_URL:ms,PythonVersionActions:ys,checkUvWorkspaceMembership:ut,detectAuthMode:bs,detectBackend:fs,detectUv:hs,fetchPyPiVersion:ie,readPyProject:X,resolveBuildEnv:ws,resolveProjectDir:oe,resolveUvLockPath:lt},Symbol.toStringTag,{value:"Module"}),J=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 dt 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 J(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 J(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 J(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 J(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 pt=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 gt 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?Ke(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 pt(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 mt=(r,e,s)=>{const t=s.perPackageConfig?.releaseTagPattern??s.workspaceConfig?.releaseTagPattern;return t?z(t,{channel:s.channel,name:r,version:e}):Ke(r,e)};class ht extends C{id="zig";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=mt(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 Et=r=>{switch(r){case"cargo":return new gr;case"composer":return new fr;case"container":return new kr;case"dart":return new Ir;case"gem":return new Nr;case"go":return new Sr;case"gradle":return new Ur;case"hex":return new Jr;case"jsr":return new Xr;case"maven":return new Mr;case"native-addon":return new xr;case"nuget":return new ot;case"private":return new ct;case"python":return new ys;case"shell":return new dt;case"swift":return new gt;case"zig":return new ht;default:return new gs}};export{qe as a,Et as b,ds as c,js as d,Y as e,ze as f,j as g,Qs as h,Q as i,Zs as j,ns as k,Xs as l,Pt as m,At as n,_t as o,Us as p,St as q,de as r,zs as s,Vt as t,Ot as u,Nt as v};
56
+ `),{alreadyPublished:!1,output:`stage-timeout: ${t}`,published:!1,stageId:t})}}const Yr=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Xr=(r,e)=>{const s={...r};for(const t of Yr){const n=r[t];if(!n||typeof n!="object")continue;const a={...n};for(const[i,o]of Object.entries(n)){if(!o.startsWith("workspace:"))continue;const c=e.get(i);c&&(a[i]=We(o.slice(10)==="*"?"*":o,c.version),a[i].startsWith("workspace:")&&(a[i]=a[i].slice(10)))}s[t]=a}return s},zr=Object.defineProperty({__proto__:null,NpmVersionActions:us},Symbol.toStringTag,{value:"Module"}),je="https://api.nuget.org/v3/index.json",Qr="https://api.nuget.org/v3-flatcontainer",M="NUGET_API_KEY",T=[10,0,300],Zr=r=>{const e=/^(\d+)\.(\d+)\.(\d+)(-[\w.-]+)?/.exec(r.trim());if(!e)return!1;const s=[Number(e[1]),Number(e[2]),Number(e[3])];for(const[t,n]of s.entries())if(n!==T[t])return n>T[t];return e[4]===void 0},Re=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"&&Re(i)===Re(e))}catch{return!1}},Fe=(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: ${Fe(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: ${Fe(u.stderr,o)}`,packageName:s})}finally{await le(c,{force:!0,recursive:!0})}return{output:`[nuget] published ${s}@${t} to nuget.org`,published:!0}}}class st extends C{id="private";async readPublishedVersion(e){}async publish(e){return{output:`[private] skipped publish for ${e.pkg.name}@${e.release.newVersion}`,published:!1}}}const ds=r=>`https://pypi.org/pypi/${encodeURIComponent(r.toLowerCase())}/json`,rt=(r,e)=>e?.uvLockPath?f(r.dir,e.uvLockPath):f(r.dir,"uv.lock"),tt=async(r,e)=>{let s;try{s=await X(r)}catch{return"no-root-pyproject"}if(s===void 0)return"no-root-pyproject";const t=s.tool?.uv?.workspace?.members;if(!Array.isArray(t)||t.length===0)return"no-workspace";const n=e.replace(/^\.\//,"").replaceAll("\\","/");for(const a of t){if(typeof a!="string")continue;const i=a.replace(/^\.\//,"").replaceAll("\\","/");if(i===n)return"member";if(i.endsWith("/*")){const o=i.slice(0,-2);if(n.startsWith(`${o}/`)&&!n.slice(o.length+1).includes("/"))return"member"}if(i.endsWith("/**")){const o=i.slice(0,-3);if(n===o||n.startsWith(`${o}/`))return"member"}}return"missing"},X=async r=>{const e=f(r,"pyproject.toml");let s;try{s=await P(e,"utf8")}catch(n){const{code:a}=n;if(a==="ENOENT")return;throw new g({cause:n,code:"BUMP_FILE_INVALID",file:e,message:`Failed to read ${e}: ${n.message}`})}const{parse:t}=await import("./index4.js");try{return t(s)}catch(n){throw new g({cause:n,code:"BUMP_FILE_INVALID",file:e,message:`Failed to parse ${e}: ${n.message}`})}},ps=async(r,e)=>{try{return(await r.run("uv",["--version"],{cwd:e,silent:!0})).exitCode===0}catch{return!1}},gs=r=>{const e=r?.["build-system"]?.["build-backend"];return e?e.startsWith("hatchling")?"hatch":e.startsWith("poetry.core")||e.startsWith("poetry_core")?"poetry":e.startsWith("pdm.backend")||e.startsWith("pdm_backend")?"pdm":e.startsWith("setuptools")?"setuptools":e.startsWith("uv_build")||e.startsWith("uv.build")?"uv":"unknown":"unknown"},ms=(r,e)=>r==="uv"||r==="unknown"&&e?{backend:r,buildCommand:{args:["build"],binary:"uv"},hasUv:e,publishCommand:{args:["publish"],binary:"uv"}}:{backend:r,buildCommand:{args:["-m","build"],binary:"python"},hasUv:e,publishCommand:{args:["upload","dist/*"],binary:"twine"}},hs=(r,e)=>ts({env:r,staticTokenVar:"TWINE_PASSWORD",workspaceConfig:e}),ie=async(r,e)=>{try{const s=await S(ds(r),{headers:{Accept:"application/json"},httpProxy:e});return s.status===404||!s.ok?void 0:(await s.json())?.info?.version}catch{return}},oe=(r,e)=>e?.pythonProjectDir?f(r.dir,e.pythonProjectDir):r.dir;class fs extends C{id="python";async readPublishedVersion(e){const s=oe(e.pkg,e.perPackageConfig),n=(await X(s).catch(()=>{}))?.project?.name??e.pkg.name.replace(/^@[^/]+\//,"");return ie(n)}async publish(e){if(e.dryRun)return{output:`[dry-run / python] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const s=e.perPackageConfig??{},t=oe(e.pkg,s),n=await X(t);if(n?.project?.dynamic?.includes("version"))throw new g({code:"CONFIG_INVALID",file:f(t,"pyproject.toml"),hint:"Dynamic versioning isn't supported by PythonVersionActions yet; use versionActions: 'shell' with your build backend's version-bump tool (e.g. `hatch version` or `poetry version` for non-vcs setups).",message:`${e.pkg.name}: pyproject.toml declares dynamic = ["version", ...]; PythonVersionActions requires a static [project] version.`,packageName:e.pkg.name});if(n?.project?.version&&n.project.version!==e.release.newVersion)throw new g({code:"BUMP_FILE_INVALID",file:f(t,"pyproject.toml"),hint:`Ensure the pyproject() preset is wired up for this package so the version literal in [project] is bumped before publish. Expected ${e.release.newVersion}, found ${n.project.version}.`,message:`${e.pkg.name}: pyproject.toml version ${n.project.version} differs from planned ${e.release.newVersion}.`,packageName:e.pkg.name});const a=n?.project?.name??e.pkg.name.replace(/^@[^/]+\//,"");if(await ie(a,e.workspaceConfig?.httpProxy)===e.release.newVersion)return{alreadyPublished:!0,output:`[python] ${a}@${e.release.newVersion} already on PyPI`,published:!1};const o=await ps(e.pm.runner,e.pkg.dir),c=gs(n),l=ms(c,o),d=hs(process.env,e.workspaceConfig);if(d==="missing")throw new g({code:"AUTH_MISSING",hint:["Set TWINE_PASSWORD to a PyPI API token (`TWINE_USERNAME=__token__` is injected automatically), OR","configure trusted publishing on PyPI and grant the workflow `permissions: id-token: write` so ACTIONS_ID_TOKEN_REQUEST_URL is exposed.","See https://docs.pypi.org/trusted-publishers/"].join(" "),message:`${e.pkg.name}: no PyPI credentials detected (neither TWINE_PASSWORD nor OIDC trusted-publishing env).`,packageName:e.pkg.name});const p=await e.pm.runner.run(l.buildCommand.binary,l.buildCommand.args,{cwd:t,silent:!1});if(p.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Inspect the ${l.buildCommand.binary} ${l.buildCommand.args.join(" ")} output above. Common causes: missing ${l.backend==="uv"?"uv":"build/setuptools/wheel"} dependency, broken pyproject.toml, source files missing from \`include\`.`,message:`${e.pkg.name}: build failed (${l.buildCommand.binary} ${l.buildCommand.args.join(" ")}): exit ${p.exitCode}. stderr: ${p.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});const u={...process.env};d==="token"&&!u.TWINE_USERNAME&&(u.TWINE_USERNAME="__token__");const m=await e.pm.runner.run(l.publishCommand.binary,l.publishCommand.args,{cwd:t,env:u,silent:!1});if(m.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:`Inspect the ${l.publishCommand.binary} output above. Common causes: invalid API token, version already published (this should have been caught by readPublishedVersion — file a vis bug), 2FA required without a token.`,message:`${e.pkg.name}: publish failed (${l.publishCommand.binary} ${l.publishCommand.args.join(" ")}): exit ${m.exitCode}. stderr: ${m.stderr.trim().slice(0,500)}`,packageName:e.pkg.name});return{output:`[python/${l.backend}${l.hasUv?"+uv":""}] published ${a}@${e.release.newVersion}`,published:!0}}}const Ct=Object.defineProperty({__proto__:null,PYPI_PROJECT_URL:ds,PythonVersionActions:fs,checkUvWorkspaceMembership:tt,detectAuthMode:hs,detectBackend:gs,detectUv:ps,fetchPyPiVersion:ie,readPyProject:X,resolveBuildEnv:ms,resolveProjectDir:oe,resolveUvLockPath:rt},Symbol.toStringTag,{value:"Module"}),K=async(r,e,s,t)=>{const n=te(s,t),a=process.platform==="win32",i=a?"cmd":"sh",o=a?["/c",n]:["-c",n];return r.run(i,o,{cwd:e,silent:!1})};class nt extends C{id="shell";async readPublishedVersion(e){const s=e.perPackageConfig??{},{workspaceConfig:t}=e;if(!t)return;const n=re(e.pkg.name,s,t);if(!n.checkPublished)return;const a=await K(e.pm.runner,e.pkg.dir,n.checkPublished,{name:e.pkg.name,version:e.pkg.version});if(a.exitCode!==0)return;const i=a.stdout.trim();return/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(i)?.[0]}async publish(e){if(e.dryRun)return{output:`[dry-run / shell] would publish ${e.pkg.name}@${e.release.newVersion}`,published:!0};const{workspaceConfig:s}=e,t=e.perPackageConfig??{};if(!s)throw new g({code:"CONFIG_INVALID",message:`Shell publish actions for ${e.pkg.name} require a workspace config (release.allowCustomCommands gate).`,packageName:e.pkg.name});const n=re(e.pkg.name,t,s);if(!n.publishCommand)throw new g({code:"CONFIG_INVALID",hint:`Set release.allowCustomCommands (workspace-wide boolean or an allow-list including "${e.pkg.name}") and configure release.packages["${e.pkg.name}"].publishCommand.`,message:`Shell publish actions for ${e.pkg.name} require a publishCommand AND the trust gate to permit it.`,packageName:e.pkg.name});const a={name:e.pkg.name,registry:e.registry,tag:e.tag,version:e.release.newVersion};if(n.checkPublished){const o=await K(e.pm.runner,e.pkg.dir,n.checkPublished,a);if(o.exitCode===0&&/\b\d+\.\d+\.\d+(?:[-+][\w.+-]+)?\b/.exec(o.stdout.trim())?.[0]===e.release.newVersion)return{alreadyPublished:!0,output:`[shell] ${e.pkg.name}@${e.release.newVersion} already on the registry`,published:!1}}if(n.buildCommand){const o=await K(e.pm.runner,e.pkg.dir,n.buildCommand,a);if(o.exitCode!==0)throw new g({code:"PUBLISH_FAILED",message:`buildCommand failed for ${e.pkg.name}: exit ${o.exitCode}. stderr: ${o.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}const i=Array.isArray(n.publishCommand)?n.publishCommand:[n.publishCommand];for(const o of i){const c=await K(e.pm.runner,e.pkg.dir,o,a);if(c.exitCode!==0)throw new g({code:"PUBLISH_FAILED",hint:"Inspect the publishCommand output above. Common causes: missing auth token, registry unreachable, version already published (re-run safe — `checkPublished` short-circuits subsequent runs).",message:`publishCommand failed for ${e.pkg.name}@${e.release.newVersion}: exit ${c.exitCode}. stderr: ${c.stderr.trim().slice(0,500)}`,packageName:e.pkg.name})}return{output:`[shell] published ${e.pkg.name}@${e.release.newVersion}`,published:!0}}}const at=async(r,e)=>{try{return(await r.pm.runner.run("git",["rev-parse","--quiet","--verify",`refs/tags/${e}`],{cwd:r.pkg.dir,silent:!0})).exitCode===0}catch{return!1}};class it extends C{id="swift";async readPublishedVersion(e){}async publish(e){const s=e.release.newVersion,t=e.perPackageConfig?.releaseTagPattern??e.workspaceConfig?.releaseTagPattern,n=t===void 0?Be(e.pkg.name,s):z(t,{name:e.pkg.name,version:s});if(e.dryRun)return{output:`[dry-run / swift] would tag ${n} for ${e.pkg.name}@${s}`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${e.pkg.name} cannot be released from Windows yet: SwiftPM is not run on Windows here. Release from a POSIX runner.`,packageName:e.pkg.name});return await at(e,n)?{alreadyPublished:!0,output:`[swift] tag ${n} already exists; ${e.pkg.name}@${s} skipped`,published:!1}:{output:`[swift] ${e.pkg.name}@${s} is released by tag ${n}, created with the release`,published:!0}}}const ot=(r,e,s)=>{const t=s.perPackageConfig?.releaseTagPattern??s.workspaceConfig?.releaseTagPattern;return t?z(t,{channel:s.channel,name:r,version:e}):Be(r,e)};class ct extends C{id="zig";async readPublishedVersion(e){}async publish(e){const{name:s}=e.pkg,t=e.release.newVersion,n=ot(s,t,{channel:e.tag,perPackageConfig:e.perPackageConfig,workspaceConfig:e.workspaceConfig});if(e.dryRun)return{output:`[dry-run / zig] would tag ${n} for ${s}@${t}; nothing is uploaded`,published:!0};if(process.platform==="win32")throw new g({code:"CONFIG_INVALID",message:`${s} cannot be released from Windows yet: the Zig path is only verified on POSIX. Release from a POSIX runner.`,packageName:s});return await ue({cwd:e.pkg.dir,runner:e.pm.runner},n)?{alreadyPublished:!0,output:`[zig] tag ${n} already exists for ${s}@${t}; skipped`,published:!1}:{output:`[zig] ${s}@${t} has no registry; tag ${n} is created by the release`,published:!0}}}const Pt=r=>{switch(r){case"cargo":return new ur;case"composer":return new gr;case"container":return new wr;case"dart":return new kr;case"gem":return new Cr;case"go":return new Nr;case"gradle":return new Mr;case"hex":return new Br;case"maven":return new Rr;case"native-addon":return new qr;case"nuget":return new et;case"private":return new st;case"python":return new fs;case"shell":return new nt;case"swift":return new it;case"zig":return new ct;default:return new us}};export{We as a,Pt as b,cs as c,Es as d,Y as e,qe as f,R as g,Ys as h,Q as i,Xs as j,es as k,qs as l,bt as m,yt as n,vt as o,Ms as p,$t as q,de as r,Js as s,It as t,Ct as u,kt as v};
@@ -1,4 +1,4 @@
1
- import{a as nt,e as st,z as O}from"../packem_shared/index-BzhrR_iC.js";import{l as At}from"./ts-loader.js";import{L as Et}from"../packem_shared/index-BisalDCf.js";import{p as bt}from"./cli-main.js";import{q as xt,L as Ct,T as S,R as L,B as W,U as E,O as N,K as Q,Z as V,W as jt,r as K,t as kt,F as D,u as Y,x as J,H as Lt,w as Wt,M as Ut,C as St,P as Tt,v as Ot,y as Pt,Y as _t,z as It,J as Rt,A as zt,V as Nt,E as vt,G as Ft,I as Mt,N as Bt}from"../packem_shared/formatBytes-BHAzNIrn-CrusHOew.js";import{a2 as I,L as qt}from"./catalog.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},v=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(v.has(e)){const r=v.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return v.set(e,n),n},Yt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Jt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const F=t=>rt[t],Z=t=>ot[t],M=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Zt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Zt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&F(l),p=h&&h<128&&F(h),d=l&&l<128&&Z(l),c=l&&l<128&&M(l),u=h&&h<128&&M(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&F(y),g=y&&y<128&&M(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&Z(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!N.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!N.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!N.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Jt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>Y.test(p)||J.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||Ut.test(p)||St.test(p)||Tt.test(p)||Ot.test(p)||Pt.test(p)||_t.test(p)||It.test(p)||Rt.test(p)||zt.test(p)||Nt.test(p)||vt.test(p)||Ft.test(p)||Mt.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>Y.test(i)||J.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Ht=(t,e,s)=>{const n=[],r=S.test(t)?t.split(S).filter(Boolean):[t];for(const o of r){const a=o;if(S.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Yt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Ht(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Xt=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,z=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(S.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Xt(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&S.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=z(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),H={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=H[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
1
+ import{b as nt,e as st,a as O}from"../packem_shared/index-BdMIfGVZ.js";import{l as At}from"./ts-loader.js";import{y as Et}from"../packem_shared/index-C9ENZqH9.js";import{p as bt}from"./cli-main.js";import{q as xt,L as Ct,T as S,R as L,B as W,U as E,O as z,K as Q,Z as V,W as jt,r as K,t as kt,F as D,u as Y,x as J,H as Lt,w as Wt,M as Ut,C as St,P as Tt,v as Ot,y as Pt,Y as _t,z as It,J as Rt,A as Nt,V as zt,E as vt,G as Ft,I as Mt,N as Bt}from"../packem_shared/formatBytes-BHAzNIrn-DRcKvqnb.js";import{a3 as I,L as qt}from"./catalog.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},v=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(v.has(e)){const r=v.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return v.set(e,n),n},Yt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Jt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const F=t=>rt[t],Z=t=>ot[t],M=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Zt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Zt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&F(l),p=h&&h<128&&F(h),d=l&&l<128&&Z(l),c=l&&l<128&&M(l),u=h&&h<128&&M(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&F(y),g=y&&y<128&&M(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&Z(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!z.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!z.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!z.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Jt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>Y.test(p)||J.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||Ut.test(p)||St.test(p)||Tt.test(p)||Ot.test(p)||Pt.test(p)||_t.test(p)||It.test(p)||Rt.test(p)||Nt.test(p)||zt.test(p)||vt.test(p)||Ft.test(p)||Mt.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>Y.test(i)||J.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Ht=(t,e,s)=>{const n=[],r=S.test(t)?t.split(S).filter(Boolean):[t];for(const o of r){const a=o;if(S.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Yt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Ht(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Xt=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,N=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(S.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Xt(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&S.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=N(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":N(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),H={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=H[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
2
2
  `)&&!t.startsWith(`${k}\r
3
3
  `))return{body:t};const s=t.indexOf(`
4
4
  ${k}`,k.length);if(s===-1)return{body:t};let n=s+1+k.length;t[n]==="\r"&&(n+=1),t[n]===`
@@ -1,4 +1,4 @@
1
- import{p as s}from"./cli-main.js";import{c as a,f as c}from"../packem_shared/registry-keys-DwB3ZXS_.js";const f=async({options:r})=>{if(r.clear){const t=a();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
1
+ import{p as s}from"./cli-main.js";import{c as a,f as c}from"../packem_shared/registry-keys-BLuHOyZu.js";const f=async({options:r})=>{if(r.clear){const t=a();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
2
2
  `);return}s.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await c({forceRefresh:!0});if(e===void 0){if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
3
3
  `),process.exitCode=1;return}s.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
4
4
  `);return}if(e.fromCache&&e.stale===!0){s.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}s.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)};export{f as default};
@@ -1,4 +1,3 @@
1
- import{v as l,U as a}from"../packem_shared/index-BzhrR_iC.js";import{r as m}from"../packem_shared/resolve-runtime-CNiHcVtx.js";import{r as u}from"../packem_shared/run-file-UBukWaha.js";const p=s=>{let r,n=!1,o;const i=[];for(let e=0;e<s.length;e+=1){const t=s[e];if(o===void 0){if(t==="--node"){n=!0;continue}if(t==="--runtime"){r=s[e+1],e+=1;continue}if(t.startsWith("--runtime=")){r=t.slice(10);continue}o=t;continue}i.push(t)}return i[0]==="--"&&i.shift(),{file:o,node:n,runtimeFlag:r,scriptArguments:i}},h=async s=>{const{file:r,node:n,runtimeFlag:o,scriptArguments:i}=p(s);if(r===void 0){process.stderr.write(`No file specified. Usage: vis x <file> [args...]
2
- `),process.exitCode=1;return}const e=process.cwd(),t=l(r)?r:a(e,r);if(n){const d=await u(t,i,"node",e,{node:!0});d!==0&&(process.exitCode=d);return}let c;try{c=m(e,{flag:o})}catch(d){process.stderr.write(`${d.message}
3
- `),process.exitCode=1;return}c.deferredNotice!==void 0&&process.stderr.write(`${c.deferredNotice}
4
- `);const f=await u(t,i,c.runtime,e);f!==0&&(process.exitCode=f)};export{p as parseLeanXArgs,h as runLeanX};
1
+ import{z as d,U as a}from"../packem_shared/index-BdMIfGVZ.js";import{r as m}from"../packem_shared/resolve-runtime-Cr19Pk6L.js";import{r as l}from"../packem_shared/run-file-XbRCF6Mp.js";const p=s=>{let r,o=!1,n;const i=[];for(let e=0;e<s.length;e+=1){const t=s[e];if(n===void 0){if(t==="--node"){o=!0;continue}if(t==="--runtime"){r=s[e+1],e+=1;continue}if(t.startsWith("--runtime=")){r=t.slice(10);continue}n=t;continue}i.push(t)}return i[0]==="--"&&i.shift(),{file:n,node:o,runtimeFlag:r,scriptArguments:i}},w=async s=>{const{file:r,node:o,runtimeFlag:n,scriptArguments:i}=p(s);if(r===void 0){process.stderr.write(`No file specified. Usage: vis x <file> [args...]
2
+ `),process.exitCode=1;return}const e=process.cwd(),t=d(r)?r:a(e,r);if(o){const c=await l(t,i,"node",e,{node:!0});c!==0&&(process.exitCode=c);return}let u;try{u=m(e,{flag:n})}catch(c){process.stderr.write(`${c.message}
3
+ `),process.exitCode=1;return}const f=await l(t,i,u.runtime,e);f!==0&&(process.exitCode=f)};export{p as parseLeanXArgs,w as runLeanX};
@@ -1,3 +1,3 @@
1
- import{createRequire as _}from"node:module";import{w as x,p as t,x as R}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-CMSml1Bj.js";import{a as M}from"../packem_shared/build-scripts-CEDx_nJp.js";import{e as v}from"../packem_shared/index-BzhrR_iC.js";import{y as w}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as q}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");w(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!w($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=d.includes("/")?d.split("/").pop():d;b(k,d,s)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))b(k,d,s);const g=v(s,"node_modules");w(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),F=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?x(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
1
+ import{createRequire as _}from"node:module";import{w as x,p as t,x as R}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-ImwtpnWY.js";import{a as M}from"../packem_shared/build-scripts-DxyVSkgM.js";import{e as v}from"../packem_shared/index-BdMIfGVZ.js";import{y as w}from"../packem_shared/isAccessibleSync-DYKTrrvc-BwaMhQs0.js";import{p as q}from"../packem_shared/readJsonSync-CbryXYxN-Bm5i10UW.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");w(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!w($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=d.includes("/")?d.split("/").pop():d;b(k,d,s)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))b(k,d,s);const g=v(s,"node_modules");w(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),F=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?x(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
2
2
  `);return}if(t.info(`Build-script status (${p.name}):
3
3
  `),n.installed.length===0&&n.unapproved.length===0&&t.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){t.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)t.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){t.info(""),t.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)t.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);t.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){t.info(""),t.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)t.info(` ! ${e}`);t.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){t.info(""),t.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:s}of n.versionDrift)t.info(` ${e} → ${s}`);t.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(o.length>0){t.info(""),t.warn(` Bin conflicts (${String(o.length)}) — multiple packages expose the same bin name:`);for(const e of o)t.info(` ${e.bin} ← ${e.packages.map(s=>s.name).join(", ")}`);t.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(r?.hasDrift){t.info("");for(const e of R(r))t.warn(e)}};export{F as default};