@visulima/vis 1.0.0-alpha.36 → 1.0.0-alpha.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/LICENSE.md +1 -503
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +7 -0
- package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -0
- package/dist/packem_chunks/bin.js +302 -515
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog-detector.js +1 -0
- package/dist/packem_chunks/detect.js +3 -0
- package/dist/packem_chunks/detect2.js +8 -0
- package/dist/packem_chunks/discord.js +4 -0
- package/dist/packem_chunks/dynamic-import.js +1 -0
- package/dist/packem_chunks/extra-files.js +3 -0
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/git.js +3 -0
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +2 -7
- package/dist/packem_chunks/handler31.js +2 -33
- package/dist/packem_chunks/handler32.js +2 -3
- package/dist/packem_chunks/handler33.js +3 -8
- package/dist/packem_chunks/handler34.js +6 -4
- package/dist/packem_chunks/handler35.js +1 -1
- package/dist/packem_chunks/handler36.js +42 -5
- package/dist/packem_chunks/handler37.js +8 -11
- package/dist/packem_chunks/handler38.js +9 -3
- package/dist/packem_chunks/handler39.js +74 -21
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +5 -61
- package/dist/packem_chunks/handler41.js +4 -3
- package/dist/packem_chunks/handler42.js +3 -6
- package/dist/packem_chunks/handler43.js +2 -24
- package/dist/packem_chunks/handler44.js +1 -25
- package/dist/packem_chunks/handler45.js +1 -153
- package/dist/packem_chunks/handler46.js +1 -10
- package/dist/packem_chunks/handler47.js +3 -24
- package/dist/packem_chunks/handler48.js +1 -322
- package/dist/packem_chunks/handler49.js +7 -708
- package/dist/packem_chunks/handler5.js +6 -6
- package/dist/packem_chunks/handler50.js +33 -48
- package/dist/packem_chunks/handler51.js +3 -27
- package/dist/packem_chunks/handler52.js +8 -3
- package/dist/packem_chunks/handler53.js +4 -200
- package/dist/packem_chunks/handler54.js +1 -38
- package/dist/packem_chunks/handler55.js +12 -0
- package/dist/packem_chunks/handler56.js +7 -0
- package/dist/packem_chunks/handler57.js +5 -0
- package/dist/packem_chunks/handler58.js +11 -0
- package/dist/packem_chunks/handler59.js +3 -0
- package/dist/packem_chunks/handler60.js +22 -0
- package/dist/packem_chunks/handler61.js +61 -0
- package/dist/packem_chunks/handler62.js +3 -0
- package/dist/packem_chunks/handler63.js +6 -0
- package/dist/packem_chunks/handler64.js +708 -0
- package/dist/packem_chunks/handler65.js +24 -0
- package/dist/packem_chunks/handler66.js +25 -0
- package/dist/packem_chunks/handler67.js +153 -0
- package/dist/packem_chunks/handler68.js +10 -0
- package/dist/packem_chunks/handler69.js +24 -0
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +322 -0
- package/dist/packem_chunks/handler71.js +48 -0
- package/dist/packem_chunks/handler72.js +27 -0
- package/dist/packem_chunks/handler73.js +3 -0
- package/dist/packem_chunks/handler74.js +190 -0
- package/dist/packem_chunks/handler75.js +38 -0
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index.js +1 -7
- package/dist/packem_chunks/index2.js +7 -0
- package/dist/packem_chunks/interface.js +2 -0
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +39 -0
- package/dist/packem_chunks/pre-mode.js +2 -0
- package/dist/packem_chunks/print-config.js +2 -0
- package/dist/packem_chunks/prompts.js +7 -0
- package/dist/packem_chunks/publish-guards.js +1 -0
- package/dist/packem_chunks/registry.js +48 -0
- package/dist/packem_chunks/resolveFormatter.js +9 -0
- package/dist/packem_chunks/security.js +1 -0
- package/dist/packem_chunks/shell-runner.js +1 -0
- package/dist/packem_chunks/slack.js +2 -0
- package/dist/packem_chunks/snapshot.js +2 -0
- package/dist/packem_chunks/stage-publisher.js +1 -0
- package/dist/packem_chunks/staged-registry.js +2 -0
- package/dist/packem_chunks/state.js +3 -0
- package/dist/packem_chunks/success-walk.js +8 -0
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_chunks/version-resolver.js +2 -0
- package/dist/packem_chunks/webhook.js +1 -0
- package/dist/packem_chunks/workflow-templates.js +167 -0
- package/dist/packem_chunks/workspace.js +2 -0
- package/dist/packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js +1 -0
- package/dist/packem_shared/ReleaseClient-YHzBIxYS.js +1 -0
- package/dist/packem_shared/VisReleaseError-DMGRBTNO.js +1 -0
- package/dist/packem_shared/{ai-analysis-DT3bU-_M.js → ai-analysis-K-DKU3ZA.js} +1 -1
- package/dist/packem_shared/{ai-fix-BkNqd5nP.js → ai-fix-BPrYoCk8.js} +1 -1
- package/dist/packem_shared/api.d-BPftyU9r.d.ts +27 -0
- package/dist/packem_shared/createAdapter-bU4DIP3F.js +1 -0
- package/dist/packem_shared/createVersionActions-BK43SNDH.js +1 -0
- package/dist/packem_shared/{cyclonedx-86-DbHtf.js → cyclonedx-kYozDyxp.js} +3 -3
- package/dist/packem_shared/defineFormatter-D5dCp6Kv.js +1 -0
- package/dist/packem_shared/dependency-scan-anTuZB1t.js +1 -0
- package/dist/packem_shared/{docker-tNrDU3oK.js → docker-BMLrNtWm.js} +1 -1
- package/dist/packem_shared/{failure-log-Dwqt6_Ga.js → failure-log-CEWP3bP0.js} +1 -1
- package/dist/packem_shared/index-BJbpNthk.js +1 -0
- package/dist/packem_shared/index-CgcF6_wo.js +1 -0
- package/dist/packem_shared/{index-C0Vj3XF8.js → index-D1_fbGbj.js} +1 -1
- package/dist/packem_shared/interface.d-B7VK2rcH.d.ts +148 -0
- package/dist/packem_shared/interface.d-Cezzifoh.d.ts +106 -0
- package/dist/packem_shared/{missing-package-json-41VUWFBY.js → missing-package-json-BfWUxTGv.js} +1 -1
- package/dist/packem_shared/{native-config-sync-BKAZ0NIs.js → native-config-sync-BEkJW7g3.js} +8 -8
- package/dist/packem_shared/pm-runner-OGResYrA.js +1 -0
- package/dist/packem_shared/provenance-_CJjMKwu.js +1 -0
- package/dist/packem_shared/public-api-WqUCiyIe.js +131 -0
- package/dist/packem_shared/{registry-keys-Bf2zzlcZ.js → registry-keys-BfFto6vI.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-jH0RKyMJ.js → resolve-explicit-CMDl55Nz.js} +2 -2
- package/dist/packem_shared/s1ngularity-Dhr3bPk0.js +1 -0
- package/dist/packem_shared/{scan-progress-JBbd9QeT.js → scan-progress-DG7_JmTV.js} +1 -1
- package/dist/packem_shared/{signatures-D1H6h6GH.js → signatures-C730vkyK.js} +2 -2
- package/dist/packem_shared/slug-DoueYuLo.js +1 -0
- package/dist/packem_shared/spinner-CV3WVJLv.js +1 -0
- package/dist/packem_shared/sticky-comment-D6_7-w8T.js +1 -0
- package/dist/packem_shared/{tabs-BqUepRaD.js → tabs-BuTy5gPV.js} +1 -1
- package/dist/packem_shared/{typosquats-C8qg1neE.js → typosquats-DN78xx1x.js} +1 -1
- package/dist/packem_shared/use-measured-height-_eVGWtWt.js +1 -0
- package/dist/packem_shared/verify-6WCmFmy8.js +1 -0
- package/dist/packem_shared/{vis-update-app-CTwRkNgj.js → vis-update-app-k3fDxech.js} +1 -1
- package/dist/release/core/changelog/index.d.ts +5 -0
- package/dist/release/core/changelog/index.js +1 -0
- package/dist/release/core/package-managers/index.d.ts +6 -0
- package/dist/release/core/package-managers/index.js +1 -0
- package/dist/release/core/version-actions/index.d.ts +14 -0
- package/dist/release/core/version-actions/index.js +1 -0
- package/dist/release/index.d.ts +196 -0
- package/dist/release/index.js +1 -0
- package/dist/release/plugin-sdk.d.ts +127 -0
- package/dist/release/plugin-sdk.js +1 -0
- package/dist/release/presets.d.ts +225 -0
- package/dist/release/presets.js +1 -0
- package/dist/release/types.d.ts +1377 -0
- package/dist/release/types.js +1 -0
- package/index.d.ts +201 -201
- package/index.js +578 -752
- package/package.json +53 -11
- package/schemas/vis-config.schema.json +1394 -6
- package/schemas/vis-release-config.schema.json +1390 -0
- package/dist/packem_shared/dependency-scan-BDTH898x.js +0 -1
- package/dist/packem_shared/index-CB4p298r.js +0 -1
- package/dist/packem_shared/index-DMefdF51.js +0 -1
- package/dist/packem_shared/pm-runner-pVihAfxV.js +0 -1
- package/dist/packem_shared/provenance-DMuEftgc.js +0 -1
- package/dist/packem_shared/s1ngularity-BkfgC6NO.js +0 -1
- package/dist/packem_shared/spinner-BXSl864p.js +0 -1
- package/dist/packem_shared/use-measured-height-BBJ9intr.js +0 -1
- package/dist/packem_shared/verify-Du7xZ2BJ.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{E as m}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{p as i}from"./bin.js";import{s as p}from"../packem_shared/scan-progress-
|
|
1
|
+
import{E as m}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{p as i}from"./bin.js";import{s as p}from"../packem_shared/scan-progress-DG7_JmTV.js";import{s as d,D}from"../packem_shared/osv-bloom-B03tUWf3.js";const b=o=>o?.security?.audit?.advisories?.bloom??{},u=o=>o>=1e3?`${(o/1e3).toFixed(1)}s`:`${Math.round(o)}ms`,y=o=>o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`,h=async({options:o,visConfig:f,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const n=o.format==="json",c=b(f),l=o.source??c.source??D,s=p([{id:"bloom",label:"Sync osv-bloom prefilter"}],{live:!n});let e,t;try{s.start("bloom");const r=Date.now();e=await d({allowedHosts:c.allowedHosts,cacheDir:o.cacheDir,force:!!o.force,source:l,workspaceRoot:a}),e.upToDate?s.finish("bloom","ok",`up to date · ${u(Date.now()-r)}`):s.finish("bloom","ok",`${e.manifest.entryCount.toLocaleString()} entries · ${y(e.bytesOnDisk)} · ${u(e.durationMs)}`)}catch(r){t=r instanceof Error?r.message:String(r),s.finish("bloom","error",t)}finally{s.stop()}n?process.stdout.write(`${JSON.stringify({bytesOnDisk:e?.bytesOnDisk??0,cacheDir:e?.cacheDir??null,durationMs:e?.durationMs??0,error:t??null,manifest:e?.manifest??null,source:l,upToDate:e?.upToDate??!1},void 0,2)}
|
|
2
2
|
`):e&&(i.info(m(`Cache: ${e.cacheDir}`)),i.info(m(`Built: ${e.manifest.builtAtRfc3339}`)),t||i.success(e.upToDate?"osv-bloom prefilter up to date.":"osv-bloom prefilter synced.")),t&&(process.exitCode=1)},O=h;export{O as advisoriesBloomSyncExecute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as d}from"./registry.js";const u=a=>{const n=d(a),t=new Map;Object.keys(n.default).length>0&&t.set("",{...n.default});for(const[s,e]of Object.entries(n.named))t.set(s,{...e});return t},g=["dependencies","devDependencies","peerDependencies","optionalDependencies"],l=a=>{const n=[];for(const t of g){const s=a.manifest[t];if(!(!s||typeof s!="object"))for(const[e,o]of Object.entries(s)){if(typeof o!="string"||!o.startsWith("catalog:"))continue;const c=o.slice(8);n.push({catalog:c,dep:e,kind:t,packageName:a.name})}}return n},m=(a,n)=>{const t=new Map;for(const s of n.keys())t.set(s,new Map);for(const s of a)for(const e of l(s)){if(!n.has(e.catalog))continue;let o=t.get(e.catalog);o||(o=new Map,t.set(e.catalog,o));const c=o.get(e.dep);c?c.push({kind:e.kind,packageName:e.packageName}):o.set(e.dep,[{kind:e.kind,packageName:e.packageName}])}return t},h=(a,n)=>{if(a.size===0&&n.size===0)return[];const t=[],s=new Set;for(const[e,o]of n){s.add(e);const c=a.get(e)??{},r=[...new Set([...Object.keys(c),...Object.keys(o)])].sort();for(const i of r){const f=c[i],p=o[i];f!==p&&t.push({catalog:e,dep:i,newVersion:p,oldVersion:f})}}for(const[e,o]of a){if(s.has(e))continue;const c=Object.keys(o).sort();for(const r of c)t.push({catalog:e,dep:r,newVersion:void 0,oldVersion:o[r]})}return t};export{h as detectCatalogChanges,l as extractCatalogRefs,m as findCatalogConsumers,u as parseCatalogs};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire as I}from"node:module";import C from"./index.js";import{VisReleaseError as u}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const N=I(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=c=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,s]=h.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return h.getBuiltinModule(c)}return N(c)},{readFile:b,rename:A,readdir:x}=k("node:fs/promises"),{join:o,basename:L}=k("node:path");class m{constructor(t){this.runner=t}runner;async publishNative(t){throw new u({code:"CONFIG_INVALID",hint:'Set publish.publishStrategy back to "npm-publish-tarball" (the default), or use a package manager whose adapter implements native publish.',message:`publishStrategy "native" is not supported by the "${this.id}" adapter.`})}async readCatalogYaml(t){}}const f=(c,t)=>{if(c.exitCode===0)return{output:c.stdout,published:!0};const s=`${c.stdout}
|
|
2
|
+
${c.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(s))return{alreadyPublished:!0,output:s,published:!1};throw new u({code:"PUBLISH_FAILED",message:`${t} failed: ${s}`})};class g extends m{id="npm";minVersion="11.5.1";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`npm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),n=a[0]?.filename;if(!n)throw new u({code:"PUBLISH_FAILED",hint:"Upgrade npm to a version that emits --json output, or report this with the raw stdout.",message:`npm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("npm",["install","--package-lock-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`npm install --package-lock-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("npm",["query",".workspace","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??e.location??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){const s=t.stage?["stage","publish",t.tarball]:["publish",t.tarball];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance"),t.stage&&s.push("--json");for(const n of t.extraArgs??[])s.push(n);const e=await this.runner.run("npm",s,{cwd:process.cwd(),silent:!0});if(e.exitCode===0){const n={output:e.stdout,published:!0};if(t.stage)try{const r=JSON.parse(e.stdout);n.stageId=r.id??r.stageId}catch{}return n}const a=`${e.stdout}
|
|
3
|
+
${e.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(a))return{alreadyPublished:!0,output:a,published:!1};throw new u({code:"PUBLISH_FAILED",message:`npm publish failed: ${a}`})}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});return f(e,"npm publish")}async detectVersion(t){const s=await this.runner.run("npm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class S extends m{id="bun";minVersion="1.1.36";async pack(t){const s=["pm","pack"];t.destination&&s.push("--destination",t.destination);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`bun pm pack failed: ${e.stderr||e.stdout}`});const a=/(?:^|["'\s])([^\s"']*\.tgz)/m.exec(e.stdout),n=t.destination??t.cwd;let r;if(a?.[1]){const i=a[1];r=i.startsWith("/")?i:o(n,i)}else{const i=JSON.parse(await b(o(t.cwd,"package.json"),"utf8")),d=(i.name??"package").replaceAll("/","-").replace(/^@/,"");r=o(n,`${d}-${i.version??"0.0.0"}.tgz`)}if(t.filename&&L(r)!==t.filename){const i=o(n,t.filename);await A(r,i),r=i}return{raw:e.stdout,tarball:r}}async installLockfileOnly(t){const s=await this.runner.run("bun",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`bun install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){try{const s=JSON.parse(await b(o(t,"package.json"),"utf8")),e=Array.isArray(s.workspaces)?s.workspaces:s.workspaces?.packages??[];if(e.length===0)return[];const a=new Set,n=["."],r=5,i=new Set;for(;n.length>0;){const p=n.shift();if(i.has(p)||(i.add(p),(p==="."?0:p.split("/").length)>r))continue;let w;try{w=await x(o(t,p),{withFileTypes:!0})}catch{continue}for(const l of w){if(!l.isDirectory()||l.name==="node_modules"||l.name.startsWith("."))continue;const y=p==="."?l.name:`${p}/${l.name}`;e.some(v=>C(v,y))&&a.add(y),n.push(y)}}const d=[];for(const p of a){const w=o(t,p,"package.json");try{const l=JSON.parse(await b(w,"utf8"));if(typeof l.name!="string")continue;d.push({name:l.name,path:o(t,p),private:l.private??!1,version:l.version??"0.0.0"})}catch{}}return d}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry);for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});return f(e,"bun publish")}async detectVersion(t){const s=await this.runner.run("bun",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class _ extends m{id="pnpm";minVersion="9.5.0";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),{filename:n}=a;if(!n)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=n.startsWith("/")?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("pnpm",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`pnpm install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("pnpm",["-r","ls","--depth","-1","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish","--no-git-checks"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});return f(e,"pnpm publish")}async detectVersion(t){const s=await this.runner.run("pnpm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}async readCatalogYaml(t){const s=await import("node:fs/promises");try{return await s.readFile(o(t,"pnpm-workspace.yaml"),"utf8")}catch{return}}}class O extends m{id="yarn";minVersion="4.0.0";async pack(t){const s=t.destination??t.cwd,e=t.filename??"%s-%v.tgz",a=["pack","--out",o(s,e)],n=await this.runner.run("yarn",a,{cwd:t.cwd,silent:!0});if(n.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`yarn pack failed: ${n.stderr||n.stdout}`});const r=await import("node:fs/promises"),i=await import("node:path"),d=JSON.parse(await r.readFile(i.join(t.cwd,"package.json"),"utf8")),p=e.replaceAll("%s",(d.name??"package").replaceAll("/","-").replace(/^@/,"")).replaceAll("%v",d.version??"0.0.0");return{raw:n.stdout,tarball:o(s,p)}}async installLockfileOnly(t){const s=await this.runner.run("yarn",["install","--mode","update-lockfile"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`yarn install --mode update-lockfile failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("yarn",["workspaces","list","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];const e=[];for(const a of s.stdout.split(/\r?\n/)){const n=a.trim();if(n)try{const r=JSON.parse(n);if(typeof r.name!="string"||r.name==="")continue;e.push({name:r.name,path:r.location?o(t,r.location):t,private:!1,version:"0.0.0"})}catch{}}return e}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["npm","publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("yarn",s,{cwd:t.cwd,silent:!0});return f(e,"yarn npm publish")}async detectVersion(t){const s=await this.runner.run("yarn",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}const F=async(c,t)=>{const s=await import("node:fs/promises"),e=await import("node:path");try{const n=JSON.parse(await s.readFile(e.join(c,"package.json"),"utf8"));if(typeof n.packageManager=="string"){const r=n.packageManager.indexOf("@"),i=r>0?n.packageManager.slice(0,r):n.packageManager;if(i==="pnpm"||i==="yarn"||i==="bun"||i==="npm")return i}}catch{}const a=async n=>{try{return await s.access(e.join(c,n)),!0}catch{return!1}};return await a("bun.lock")||await a("bun.lockb")?"bun":await a("pnpm-lock.yaml")?"pnpm":await a("yarn.lock")?"yarn":"npm"},D=(c,t)=>{switch(c){case"bun":return new S(t);case"pnpm":return new _(t);case"yarn":return new O(t);default:return new g(t)}};export{g as N,D as c,F as d};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{createRequire as f}from"node:module";const y=f(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=o=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[e,t]=d.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return d.getBuiltinModule(o)}return y(o)},{basename:$}=w("node:path"),O=o=>{const e=[],t=[];for(const s of o??[]){if(typeof s=="string"){e.push(s);continue}if(s.path){const r=s.label??s.name;e.push(r?`${s.path}#${r}`:s.path)}else if(s.linkUrl){const r=s.label??s.name??s.linkUrl;t.push(`- [${r}](${s.linkUrl})`)}}return{linkAppendix:t.length>0?`
|
|
2
|
+
|
|
3
|
+
### Additional links
|
|
4
|
+
|
|
5
|
+
${t.join(`
|
|
6
|
+
`)}`:"",paths:e}},x=(o,e)=>{if(o!==0)return[];try{return JSON.parse(e).filter(t=>typeof t.body=="string").map(t=>({body:t.body??"",id:t.id}))}catch{return[]}};class C{id="github";host;httpProxy;constructor(e={}){this.host=e.host,this.httpProxy=e.httpProxy}runOpts(e){if(!this.host&&!this.httpProxy)return{cwd:e,silent:!0};const t={...process.env};return this.host&&(t.GH_HOST=this.host),this.httpProxy&&(t.HTTPS_PROXY=this.httpProxy,t.HTTP_PROXY=this.httpProxy),{cwd:e,env:t,silent:!0}}async listRecentReleases(e,t){const s=Math.max(1,t.limit),r=t.tagPrefix?Math.min(100,s*4):s,n=await e.run("gh",["release","list","--repo",t.repo,"--limit",String(r),"--json","tagName,url,name"],this.runOpts(t.cwd));if(n.exitCode!==0)return[];let i;try{i=JSON.parse(n.stdout)}catch{return[]}const a=[];for(const u of i)if(!(typeof u.tagName!="string"||typeof u.url!="string")&&!(t.tagPrefix&&!u.tagName.startsWith(t.tagPrefix))&&!(t.excludeTag&&u.tagName===t.excludeTag)&&(a.push({name:u.name??u.tagName,tag:u.tagName,url:u.url}),a.length>=s))break;return a}async detectRepoSlug(e,t){const s=await t.run("gh",["repo","view","--json","nameWithOwner","-q",".nameWithOwner"],this.runOpts(e));if(s.exitCode===0)return s.stdout.trim()||void 0}detectPullRequestNumber(e){const t=e.GITHUB_REF;if(t){const r=/^refs\/pull\/(\d+)\/(?:merge|head)$/.exec(t);if(r?.[1])return Number.parseInt(r[1],10)}const s=e.PR_NUMBER??e.VIS_PR_NUMBER;if(s){const r=Number.parseInt(s,10);return Number.isNaN(r)?void 0:r}}async upsertStickyComment(e,t){const s=await e.run("gh",["api",`repos/${t.repo}/issues/${t.issueNumber}/comments`,"--paginate"],this.runOpts(t.cwd)),r=x(s.exitCode,s.stdout).find(a=>a.body.includes(t.marker)),n=t.body.includes(t.marker)?t.body:`${t.marker}
|
|
7
|
+
${t.body}`;if(r)return(await e.run("gh",["api","-X","PATCH",`repos/${t.repo}/issues/comments/${r.id}`,"-f",`body=${n}`],this.runOpts(t.cwd))).exitCode===0?{created:!1,id:r.id}:void 0;const i=await e.run("gh",["api","-X","POST",`repos/${t.repo}/issues/${t.issueNumber}/comments`,"-f",`body=${n}`],this.runOpts(t.cwd));if(i.exitCode===0)try{return{created:!0,id:JSON.parse(i.stdout).id}}catch{return}}async createRelease(e,t){const{linkAppendix:s,paths:r}=O(t.assets),n=s?`${t.body}${s}`:t.body,i=["release","create",t.tag,"--repo",t.repo,"--title",t.title,"--notes",n];t.draft&&i.push("--draft"),t.prerelease&&i.push("--prerelease"),t.discussionCategory&&i.push("--discussion-category",t.discussionCategory),r.length>0&&i.push(...r);const a=await e.run("gh",i,this.runOpts(t.cwd));if(a.exitCode===0)return{url:a.stdout.trim()||void 0}}async addLabels(e,t){if(t.labels.length===0)return!0;const s=["api","-X","POST",`repos/${t.repo}/issues/${t.issueNumber}/labels`];for(const r of t.labels)s.push("-f",`labels[]=${r}`);return(await e.run("gh",s,this.runOpts(t.cwd))).exitCode===0}async upsertIssue(e,t){const s=await e.run("gh",["issue","list","--repo",t.repo,"--state","open","--search",t.marker,"--json","number,title,url","--limit","20"],this.runOpts(t.cwd));if(s.exitCode===0&&s.stdout.trim()&&s.stdout.trim()!=="[]")try{const u=JSON.parse(s.stdout).find(c=>c.title.includes(t.marker));if(u){const c=["issue","edit",String(u.number),"--repo",t.repo,"--title",t.title,"--body",t.body];return t.labels&&t.labels.length>0&&c.push("--add-label",t.labels.join(",")),t.assignees&&t.assignees.length>0&&c.push("--add-assignee",t.assignees.join(",")),(await e.run("gh",c,this.runOpts(t.cwd))).exitCode===0?{created:!1,number:u.number,url:u.url}:void 0}}catch{}const r=["issue","create","--repo",t.repo,"--title",t.title,"--body",t.body];t.labels&&t.labels.length>0&&r.push("--label",t.labels.join(",")),t.assignees&&t.assignees.length>0&&r.push("--assignee",t.assignees.join(","));const n=await e.run("gh",r,this.runOpts(t.cwd));if(n.exitCode!==0)return;const i=n.stdout.trim(),a=/\/issues\/(\d+)/.exec(i);return a?{created:!0,number:Number.parseInt(a[1]??"0",10),url:i}:void 0}async closeIssue(e,t){return t.closingComment&&await e.run("gh",["issue","comment",String(t.issueNumber),"--repo",t.repo,"--body",t.closingComment],this.runOpts(t.cwd)),(await e.run("gh",["issue","close",String(t.issueNumber),"--repo",t.repo],this.runOpts(t.cwd))).exitCode===0}async upsertPullRequest(e,t){const s=await e.run("gh",["pr","list","--repo",t.repo,"--head",t.head,"--state","open","--json","number,url"],this.runOpts(t.cwd));if(s.exitCode===0&&s.stdout.trim()&&s.stdout.trim()!=="[]")try{const i=JSON.parse(s.stdout);if(i[0])return await e.run("gh",["pr","edit",String(i[0].number),"--repo",t.repo,"--title",t.title,"--body",t.body],this.runOpts(t.cwd)),{existing:!0,number:i[0].number,url:i[0].url}}catch{}const r=await e.run("gh",["pr","create","--repo",t.repo,"--head",t.head,"--base",t.base,"--title",t.title,"--body",t.body],this.runOpts(t.cwd));if(r.exitCode!==0)return;const n=/\/pull\/(\d+)/.exec(r.stdout);return n?{existing:!1,number:Number.parseInt(n[1]??"0",10),url:r.stdout.trim()}:void 0}}const p=o=>encodeURIComponent(o),P=o=>o.replace(/^v(?=\d)/,""),N=o=>{const e=[],t=[],s=[];for(const r of o??[]){if(typeof r=="string"){e.push(r);continue}r.path?r.target==="generic_package"?s.push({label:r.label,linkType:r.type,name:r.name,packageName:r.packageName,packageVersion:r.packageVersion,path:r.path}):e.push(r.path):r.linkUrl&&t.push({linkType:r.type,name:r.label??r.name??r.linkUrl,url:r.linkUrl})}return{genericPackages:s,links:t,uploads:e}};class b{id="gitlab";static recentReleasesWarned=!1;async listRecentReleases(e,t){return b.recentReleasesWarned||(b.recentReleasesWarned=!0,console.warn("[vis release] addReleases is not yet supported on GitLab — skipping the Related releases block.")),[]}host;httpProxy;constructor(e={}){this.host=e.host,this.httpProxy=e.httpProxy}runOpts(e){if(!this.host&&!this.httpProxy)return{cwd:e,silent:!0};const t={...process.env};return this.host&&(t.GITLAB_HOST=this.host),this.httpProxy&&(t.HTTPS_PROXY=this.httpProxy,t.HTTP_PROXY=this.httpProxy),{cwd:e,env:t,silent:!0}}async listMrNotes(e,t,s,r){const n=await e.run("glab",["api",`projects/${p(s)}/merge_requests/${r}/notes`,"--paginate"],this.runOpts(t));if(n.exitCode!==0)return[];try{return JSON.parse(n.stdout).filter(i=>typeof i.body=="string"&&i.system!==!0).map(i=>({body:i.body??"",id:i.id}))}catch{return[]}}async uploadGenericPackage(e,t,s,r,n){const i=p(s),a=$(n.path),u=n.packageName??s.split("/").pop()??"release",c=n.packageVersion??P(r),l=`projects/${i}/packages/generic/${encodeURIComponent(u)}/${encodeURIComponent(c)}/${encodeURIComponent(a)}`;if((await e.run("glab",["api","-X","PUT",l,"--input",n.path],this.runOpts(t))).exitCode!==0)return;const h=this.host?.replace(/^https?:\/\//i,"").replace(/\/+$/,""),g=`${h?`https://${h}`:"https://gitlab.com"}/api/v4/${l}`,m=["api","-X","POST",`projects/${i}/releases/${encodeURIComponent(r)}/assets/links`,"-f",`name=${n.label??n.name??a}`,"-f",`url=${g}`];n.linkType&&m.push("-f",`link_type=${n.linkType}`),await e.run("glab",m,this.runOpts(t))}async detectRepoSlug(e,t){const s=process.env.CI_PROJECT_PATH;if(s)return s;const r=await t.run("git",["config","--get","remote.origin.url"],{cwd:e,silent:!0});if(r.exitCode!==0)return;const n=r.stdout.trim();return/gitlab\.[\w.-]+[/:]([^/].*?)(?:\.git)?$/.exec(n)?.[1]}detectPullRequestNumber(e){const t=e.CI_MERGE_REQUEST_IID??e.VIS_MR_NUMBER;if(!t)return;const s=Number.parseInt(t,10);return Number.isNaN(s)?void 0:s}async upsertStickyComment(e,t){const s=(await this.listMrNotes(e,t.cwd,t.repo,t.issueNumber)).find(a=>a.body.includes(t.marker)),r=t.body.includes(t.marker)?t.body:`${t.marker}
|
|
8
|
+
${t.body}`,n=p(t.repo);if(s)return(await e.run("glab",["api","-X","PUT",`projects/${n}/merge_requests/${t.issueNumber}/notes/${s.id}`,"-f",`body=${r}`],this.runOpts(t.cwd))).exitCode===0?{created:!1,id:s.id}:void 0;const i=await e.run("glab",["api","-X","POST",`projects/${n}/merge_requests/${t.issueNumber}/notes`,"-f",`body=${r}`],this.runOpts(t.cwd));if(i.exitCode===0)try{return{created:!0,id:JSON.parse(i.stdout).id}}catch{return}}async createRelease(e,t){const{genericPackages:s,links:r,uploads:n}=N(t.assets),i=["release","create",t.tag,"--repo",t.repo,"--name",t.title,"--notes",t.body];if(t.milestones&&t.milestones.length>0)for(const c of t.milestones)i.push("--milestone",c);if((await e.run("glab",i,this.runOpts(t.cwd))).exitCode!==0)return;n.length>0&&await e.run("glab",["release","upload",t.tag,"--repo",t.repo,...n],this.runOpts(t.cwd));const a=p(t.repo);for(const c of r){const l=["api","-X","POST",`projects/${a}/releases/${encodeURIComponent(t.tag)}/assets/links`,"-f",`name=${c.name}`,"-f",`url=${c.url}`];c.linkType&&l.push("-f",`link_type=${c.linkType}`),await e.run("glab",l,this.runOpts(t.cwd))}for(const c of s)await this.uploadGenericPackage(e,t.cwd,t.repo,t.tag,c);const u=await e.run("glab",["api",`projects/${a}/releases/${encodeURIComponent(t.tag)}`],this.runOpts(t.cwd));try{return{url:JSON.parse(u.stdout)._links?.self}}catch{return{url:void 0}}}async addLabels(e,t){if(t.labels.length===0)return!0;const s=p(t.repo);return(await e.run("glab",["api","-X","PUT",`projects/${s}/issues/${t.issueNumber}`,"-f",`add_labels=${t.labels.join(",")}`],this.runOpts(t.cwd))).exitCode===0}async upsertIssue(e,t){const s=p(t.repo),r=await e.run("glab",["api",`projects/${s}/issues?state=opened&search=${encodeURIComponent(t.marker)}&in=title`],this.runOpts(t.cwd));if(r.exitCode===0)try{const c=JSON.parse(r.stdout).find(l=>l.title.includes(t.marker));if(c){const l=["api","-X","PUT",`projects/${s}/issues/${c.iid}`,"-f",`title=${t.title}`,"-f",`description=${t.body}`];if(t.labels&&t.labels.length>0&&l.push("-f",`add_labels=${t.labels.join(",")}`),t.assignees?.[0]){const h=await e.run("glab",["api",`users?username=${encodeURIComponent(t.assignees[0])}`],this.runOpts(t.cwd));try{const g=JSON.parse(h.stdout);g[0]&&l.push("-f",`assignee_id=${g[0].id}`)}catch{}}return(await e.run("glab",l,this.runOpts(t.cwd))).exitCode===0?{created:!1,number:c.iid,url:c.web_url}:void 0}}catch{}const n=["issue","create","--repo",t.repo,"--title",t.title,"--description",t.body,"--yes"];t.labels&&t.labels.length>0&&n.push("--label",t.labels.join(",")),t.assignees?.[0]&&n.push("--assignee",t.assignees[0]);const i=await e.run("glab",n,this.runOpts(t.cwd));if(i.exitCode!==0)return;const a=i.stdout.trim(),u=/\/issues\/(\d+)/.exec(a);return u?{created:!0,number:Number.parseInt(u[1]??"0",10),url:a}:void 0}async closeIssue(e,t){if(t.closingComment){const s=p(t.repo);await e.run("glab",["api","-X","POST",`projects/${s}/issues/${t.issueNumber}/notes`,"-f",`body=${t.closingComment}`],this.runOpts(t.cwd))}return(await e.run("glab",["issue","close",String(t.issueNumber),"--repo",t.repo],this.runOpts(t.cwd))).exitCode===0}async upsertPullRequest(e,t){const s=p(t.repo),r=await e.run("glab",["api",`projects/${s}/merge_requests?state=opened&source_branch=${encodeURIComponent(t.head)}&target_branch=${encodeURIComponent(t.base)}`],this.runOpts(t.cwd));if(r.exitCode===0)try{const u=JSON.parse(r.stdout);if(u[0])return(await e.run("glab",["api","-X","PUT",`projects/${s}/merge_requests/${u[0].iid}`,"-f",`title=${t.title}`,"-f",`description=${t.body}`],this.runOpts(t.cwd))).exitCode===0?{existing:!0,number:u[0].iid,url:u[0].web_url}:void 0}catch{}const n=await e.run("glab",["mr","create","--repo",t.repo,"--source-branch",t.head,"--target-branch",t.base,"--title",t.title,"--description",t.body,"--yes"],this.runOpts(t.cwd));if(n.exitCode!==0)return;const i=n.stdout.trim(),a=/\/merge_requests\/(\d+)/.exec(i);return a?{existing:!1,number:Number.parseInt(a[1]??"0",10),url:i}:void 0}}const R=o=>{if(o.GITHUB_ACTIONS==="true"||o.GITHUB_REPOSITORY)return"github";if(o.GITLAB_CI==="true"||o.CI_PROJECT_PATH)return"gitlab"},k=o=>{const e=o.trim();if(e!==""){if(!e.includes("://")){const t=e.indexOf(":"),s=e.indexOf("/");if(t>0&&(s===-1||t<s)){const r=e.slice(0,t),n=r.lastIndexOf("@");return(n===-1?r:r.slice(n+1)).toLowerCase()||void 0}return}try{return new URL(e).hostname.toLowerCase()||void 0}catch{return}}},_=async(o,e)=>{const t=await e.run("git",["config","--get","remote.origin.url"],{cwd:o,silent:!0});if(t.exitCode!==0)return;const s=k(t.stdout);if(s){if(s==="github.com"||s.endsWith(".github.com"))return"github";if(s==="gitlab.com"||s.startsWith("gitlab."))return"gitlab"}},I=async(o,e,t,s=process.env)=>R(s)??await _(o,e)??"github",S=(o,e={})=>o==="gitlab"?new b({host:e.gitlabHost,httpProxy:e.httpProxy}):new C({host:e.githubHost,httpProxy:e.httpProxy});export{S as createRemoteClient,I as detectRemoteProvider};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{expandNotificationTemplate as h}from"./interface.js";const p=4096,l=3800,d=i=>i.url?`• [\`${i.name}@${i.version}\`](${i.url})`:`• \`${i.name}@${i.version}\``,f=i=>{const t=i.published.map(n=>d(n));let s=t.join(`
|
|
2
|
+
`);if(s.length>l){let n=0;const e=[];for(const r of t){if(n+r.length+1>l){e.push(`*… +${t.length-e.length} more*`);break}e.push(r),n+=r.length+1}s=e.join(`
|
|
3
|
+
`)}return s.slice(0,p)};class g{constructor(t){this.config=t,this.id=t.id?`discord:${t.id}`:"discord"}config;id;async send(t){const s=this.config.title?h(this.config.title,t):`🚀 Released ${t.published.length} package${t.published.length===1?"":"s"}`,n={color:this.config.color??3900150,description:f(t),fields:[],timestamp:t.completedAt,title:s},e=[];if(t.channel&&e.push({inline:!0,name:"Channel",value:`\`${t.channel}\``}),t.repo&&e.push({inline:!0,name:"Repository",value:`[${t.repo}](https://github.com/${t.repo})`}),t.skipped.length>0&&this.config.includeSkipped!==!1){const o=t.skipped.map(c=>`\`${c.name}\` — ${c.reason}`).join(`
|
|
4
|
+
`).slice(0,1024);e.push({inline:!1,name:`Skipped (${t.skipped.length})`,value:o})}e.length>0&&(n.fields=e);const r={...this.config.username?{username:this.config.username}:{},...this.config.avatarUrl?{avatar_url:this.config.avatarUrl}:{},embeds:[n]};let a;try{a=await fetch(this.config.webhook,{body:JSON.stringify(r),headers:{"Content-Type":"application/json"},method:"POST"})}catch(o){const c=o instanceof Error?o.name:"NetworkError";throw new Error(`Discord webhook fetch failed (${c})`,{cause:o})}if(!a.ok){const o=await a.text().catch(()=>"");throw new Error(`Discord webhook returned ${a.status} ${a.statusText}${o?`: ${o.slice(0,200)}`:""}`)}}}export{g as DiscordNotificationChannel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=async m=>import(m);export{o as dynamicEsmImport};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire as N}from"node:module";import{VisReleaseError as b}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const A=N(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[o,s]=d.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return d.getBuiltinModule(e)}return A(e)},{readFile:I}=y("node:fs/promises"),{isAbsolute:x,join:w}=y("node:path"),R="x-release-please-version",_=e=>e.type==="annotation",O=e=>!_(e),j=(e,o)=>{if(!O(e))throw new b({code:"CONFIG_INVALID",message:`extra-files rule at ${o} has type="${e.type}" — compileRule is regex-only.`});try{return new RegExp(e.search,e.flags??"g")}catch(s){throw new b({cause:s,code:"CONFIG_INVALID",message:`Invalid extra-files regex at ${o}.search: ${s.message}`})}},E=(e,o,s)=>e.replaceAll("{version}",o).replaceAll("{name}",s).replaceAll("{packageName}",s),F=/\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?/,v=(e,o)=>{let s=0;if(o!==void 0){const h=e.indexOf(o);if(h===-1)return;s=h+o.length}const u=e.slice(s),r=F.exec(u);if(r)return{index:s+r.index,match:r[0]}},T=(e,o,s,u,r)=>{const h=e.marker??R,i=[],c=o.split(`
|
|
2
|
+
`);let n=!1,a=!1;for(let t=0;t<c.length;t++){const l=c[t];if(l.includes(h))if(n=!0,l.slice(0,l.indexOf(h)).replace(/^\s*(?:#|\/\/|\/\*|--|<!--)\s*$/,"").trim()===""){const p=t+1,f=c[p];if(f===void 0){i.push(`extra-files: ${u}[${e.path}] annotation marker on the last line of ${r} (no following line to update).`);continue}const g=v(f,e.anchor);if(!g){i.push(e.anchor===void 0?`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but no semver-shaped substring on the following line.`:`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but anchor "${e.anchor}" / no semver-shaped substring after it on the following line.`);continue}c[p]=f.slice(0,g.index)+s+f.slice(g.index+g.match.length),a=!0}else{const p=v(l,e.anchor);if(!p){i.push(e.anchor===void 0?`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but no semver-shaped substring on the marked line.`:`extra-files: ${u}[${e.path}] annotation marker at ${r}:${t+1} but anchor "${e.anchor}" / no semver-shaped substring after it on the marked line.`);continue}c[t]=l.slice(0,p.index)+s+l.slice(p.index+p.match.length),a=!0}}return n?a?{content:c.join(`
|
|
3
|
+
`),warnings:i}:{warnings:i}:(i.push(`extra-files: ${u}[${e.path}] annotation marker "${h}" not found in ${r}; rule may be stale.`),{warnings:i})},M=async(e,o,s,u,r)=>{let h;try{h=await I(e,"utf8")}catch(n){return n.code==="ENOENT"?{warnings:[`extra-files: ${r} → ${e} does not exist; skipping ${o.length} rule(s).`]}:{warnings:[`extra-files: ${r} → could not read ${e}: ${n.message}`]}}let i=h;const c=[];for(const n of o){if(_(n)){const f=T(n,i,s,r,e);c.push(...f.warnings),f.content!==void 0&&(i=f.content);continue}const a=j(n,`${r}[${n.path}]`),t=n.replace===void 0?s:E(n.replace,s,u);let l=!1;const p=i.replace(a,(f,...g)=>(l=!0,n.replace===void 0?t:t.replaceAll(/\$([&$1-9])/g,(q,$)=>{if($==="&")return f;if($==="$")return"$";const k=Number.parseInt($,10)-1,m=g[k];return typeof m=="string"?m:""})));if(!l){c.push(`extra-files: ${r}[${n.path}] regex /${n.search}/${n.flags??"g"} matched nothing in ${e}; rule may be stale.`);continue}i=p}return i===h?{warnings:c}:{content:i,warnings:c}},V=async(e,o,s,u,r=[],h=[])=>{const i=[],c=[],n=new Map;for(const a of r){const t=x(a.path)?a.path:w(e,a.path),l=n.get(t)??{label:"workspace",rules:[]};l.rules.push(a),n.set(t,l)}for(const a of h){const t=x(a.path)?a.path:w(o,a.path),l=n.get(t)??{label:"per-package",rules:[]};l.rules.push(a),n.set(t,l)}for(const[a,t]of n){const l=t.rules[0],p=await M(a,t.rules,s,u,t.label);c.push(...p.warnings),p.content!==void 0&&i.push({content:p.content,path:a,rule:l})}return{warnings:c,writes:i}};export{R as DEFAULT_ANNOTATION_MARKER,V as applyExtraFilesForRelease,j as compileRule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as F}from"node:module";import{j as w,E as k,s as b,q as T,V as I,I as j}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{y as R}from"../packem_shared/index-BDmTbWX1.js";import{a as J,r as D,b as m,c as E}from"../packem_shared/ai-fix-
|
|
1
|
+
import{createRequire as F}from"node:module";import{j as w,E as k,s as b,q as T,V as I,I as j}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{y as R}from"../packem_shared/index-BDmTbWX1.js";import{a as J,r as D,b as m,c as E}from"../packem_shared/ai-fix-BPrYoCk8.js";import{p}from"./bin.js";import{l as N}from"../packem_shared/failure-log-CEWP3bP0.js";const A=F(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=o=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,r]=h.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return h.getBuiltinModule(o)}return A(o)},{createInterface:q}=O("node:readline"),B={"ambiguous-match":"ambiguous match",applied:"applied",error:"error","missing-file":"missing file","no-match":"no match","outside-workspace":"outside workspace"},S=(o,t,r)=>{const e=E(o,t,r),s=R(o,e);return s===""||s.startsWith("..")?e:s},L=(o,t,r)=>{const e=[w(`Fix proposal (${o.provider}, confidence: ${o.confidence})`),"",o.explanation||k("<no explanation>")];if(o.cannotFix)return e.push(""),e.push(b(`Cannot fix automatically: ${o.cannotFix}`)),e.join(`
|
|
2
2
|
`);if(o.patches.length===0)return e.push(""),e.push(b("No patches were proposed.")),e.join(`
|
|
3
3
|
`);e.push(""),e.push(w(`Patches (${String(o.patches.length)}):`));for(const[s,i]of o.patches.entries()){const a=S(t,r,i.file);e.push(""),e.push(T(`[${String(s+1)}] ${a}`)),i.reason&&e.push(k(` reason: ${i.reason}`));for(const u of i.oldString.split(`
|
|
4
4
|
`))e.push(I(` - ${u}`));for(const u of i.newString.split(`
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{VisReleaseError as d}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const u=async(t,e,i=!0)=>t.runner.run("git",e,{cwd:t.cwd,silent:i}),h=async t=>{const e=await u(t,["rev-parse","--abbrev-ref","HEAD"]);if(e.exitCode!==0)return;const i=e.stdout.trim();return i==="HEAD"||i===""?void 0:i},w=async t=>{const e=await u(t,["rev-parse","HEAD"]);return e.exitCode===0?e.stdout.trim():void 0},E=async t=>{const e=await u(t,["rev-parse","--short","HEAD"]);return e.exitCode===0?e.stdout.trim():void 0},_=async t=>{const e=await u(t,["status","--porcelain"]);return e.exitCode===0&&e.stdout.trim()!==""},f=async(t,e)=>(await u(t,["rev-parse","--verify","--quiet",`refs/tags/${e}`])).exitCode===0,p=async(t,e,i="origin")=>{const s=await u(t,["ls-remote","--tags",i,e]);return s.exitCode===0&&s.stdout.trim()!==""},C=async(t,e,i,s={})=>{if(e.length===0&&!s.allowEmpty)throw new d({code:"CONFIG_INVALID",message:"stageAndCommit called with no files (and allowEmpty=false)."});if(e.length>0){const o=await t.runner.run("git",["add","--",...e],{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git add failed: ${o.stderr||o.stdout}`})}const a={...process.env};s.author&&(a.GIT_AUTHOR_NAME=s.author.name,a.GIT_AUTHOR_EMAIL=s.author.email,a.GIT_COMMITTER_NAME=s.author.name,a.GIT_COMMITTER_EMAIL=s.author.email);const r=["commit","-m",i];s.allowEmpty&&r.push("--allow-empty");const n=await t.runner.run("git",r,{cwd:t.cwd,env:a,silent:!0});if(n.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git commit failed: ${n.stderr||n.stdout}`});const c=await w(t);if(!c)throw new d({code:"GIT_OPERATION_FAILED",message:"git commit succeeded but HEAD is not resolvable."});return c},A=6e4;let g;const l=async t=>{const e=Date.now();if(g!==void 0&&e-g.cachedAtMs<A)return g.value;const i=await t.runner.run("gitsign",["--version"],{cwd:t.cwd,silent:!0});return g={cachedAtMs:e,value:i.exitCode===0},g.value},$=async(t,e,i,s={})=>{if(await f(t,e))throw new d({code:"TAG_COLLISION",message:`Tag "${e}" already exists locally. Resolve manually before re-running.`});if(!s.skipRemoteCheck&&await p(t,e,s.remote??"origin"))throw new d({code:"TAG_COLLISION",message:`Tag "${e}" already exists on remote "${s.remote??"origin"}". A previous run may have pushed tags but failed mid-publish — inspect the remote and either re-use the existing tag or delete it before re-running.`});const{signing:a}=s;if(a?.mode==="sigstore"){if(await l(t)){const c=["tag","-a",e];i&&c.push("-m",i);const o=await t.runner.run("gitsign",c,{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`gitsign tag ${e} failed: ${o.stderr||o.stdout}`});return}process.stderr.write(`[vis release] Warning: signing.mode is "sigstore" but \`gitsign\` is not on PATH; falling back to GPG signing for tag ${e}.
|
|
2
|
+
`)}const r=["tag"];a&&(a.key&&a.mode==="gpg"?r.push("-u",a.key):r.push("-s")),i?r.push("-a",e,"-m",i):r.push(e);const n=await u(t,r);if(n.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git tag ${e} failed: ${n.stderr||n.stdout}`})},O=async(t,e={})=>{const i=["push",e.remote??"origin","--tags"];e.atomic&&i.splice(1,0,"--atomic");const s=await u(t,i,!1);if(s.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --tags failed: ${s.stderr||s.stdout}`})},v=async(t,e,i={})=>{const{signing:s}=i;if(s?.mode==="sigstore"){if(await l(t)){const c=["tag","-f","-a","-m",`Floating tag ${e}`,e],o=await t.runner.run("gitsign",c,{cwd:t.cwd,silent:!0});if(o.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`gitsign tag -f ${e} failed: ${o.stderr||o.stdout}`});if(i.push===!1)return;const m=await u(t,["push",i.remote??"origin","--force",`refs/tags/${e}:refs/tags/${e}`],!1);if(m.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --force refs/tags/${e} failed: ${m.stderr||m.stdout}`});return}process.stderr.write(`[vis release] Warning: signing.mode is "sigstore" but \`gitsign\` is not on PATH; falling back to GPG signing for floating tag ${e}.
|
|
3
|
+
`)}const a=["tag","-f"];s&&(s.key&&s.mode==="gpg"?a.push("-u",s.key):a.push("-s")),a.push(e);const r=await u(t,a);if(r.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git tag -f ${e} failed: ${r.stderr||r.stdout}`});if(i.push===!1)return;const n=await u(t,["push",i.remote??"origin","--force",`refs/tags/${e}:refs/tags/${e}`],!1);if(n.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",hint:"After resolving, re-run with --resume to retry the push.",message:`git push --force refs/tags/${e} failed: ${n.stderr||n.stdout}`})},y=async(t,e,i,s={})=>{const a=await t.runner.run("git",["add","-A","--",e],{cwd:t.cwd,silent:!0});if(a.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git add ${e} failed: ${a.stderr||a.stdout}`});if((await t.runner.run("git",["diff","--cached","--quiet","--",e],{cwd:t.cwd,silent:!0})).exitCode===0)return{committed:!1,pushed:!1};const r={...process.env};s.author&&(r.GIT_AUTHOR_NAME=s.author.name,r.GIT_AUTHOR_EMAIL=s.author.email,r.GIT_COMMITTER_NAME=s.author.name,r.GIT_COMMITTER_EMAIL=s.author.email);const n=["commit","-m",i];s.sign&&n.push("-S");const c=await t.runner.run("git",n,{cwd:t.cwd,env:r,silent:!0});if(c.exitCode!==0)throw new d({code:"GIT_OPERATION_FAILED",message:`git commit failed: ${c.stderr||c.stdout}`});if(!s.push)return{committed:!0,pushed:!1};const o=s.branch??await h(t);return o?{committed:!0,pushed:(await t.runner.run("git",["push",s.remote??"origin",`HEAD:${o}`],{cwd:t.cwd,silent:!1})).exitCode===0}:{committed:!0,pushed:!1}},G=async(t,e,i={})=>{const s=["push",i.remote??"origin",`HEAD:${e}`];i.force&&s.push("--force-with-lease");const a=await u(t,s,!1);if(a.exitCode!==0)throw new d({code:"TAG_PUSH_FAILED",message:`git push ${e} failed: ${a.stderr||a.stdout}`})},x=(t,e)=>`${t}@${e}`,I=/\{(name|unscopedName|version|major|minor|patch|date|channel)\}/g,D=(t,e)=>{const i=e.version??"",[s="",a="",r=""]=i.split(/[-+]/,1)[0].split("."),n={channel:e.channel??"",date:e.date??new Date().toISOString().slice(0,10),major:s,minor:a,name:e.name??"",patch:r,unscopedName:e.name?e.name.replace(/^@[^/]+\//,""):"",version:i};return t.replaceAll(I,(c,o)=>n[o]??"")};export{v as createOrUpdateFloatingTag,$ as createTag,x as defaultTagFor,h as getCurrentBranch,w as getCurrentSha,E as getShortSha,l as gitsignAvailable,_ as hasUncommittedChanges,G as pushBranch,O as pushTags,D as renderTagPattern,C as stageAndCommit,y as stageAndCommitFile,f as tagExists,p as tagExistsRemote};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as p,W as m}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as p,W as m}from"../packem_shared/pm-runner-OGResYrA.js";import{i as d}from"../packem_shared/utils-Cxree603.js";const v=async({argument:c,logger:l,options:e,visConfig:s,workspaceRoot:n})=>{const o=c;if(!o||o.length===0)throw new Error("No command specified. Usage: vis exec <command> [args...]");const[i,...t]=o,r=n??process.cwd(),f=p(r,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),a=m(f,{args:t,command:i,filter:d(e.filter),parallel:e.parallel||!1,recursive:e.recursive||!1,reverse:e.reverse||!1,shellMode:e.shellMode||!1,workspaceRoot:e.workspaceRoot||!1},r,l);a!==0&&(process.exitCode=a)};export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as g,P as l}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as g,P as l}from"../packem_shared/pm-runner-OGResYrA.js";const k=async({argument:e,logger:c,options:n,process:i,visConfig:a,workspaceRoot:r})=>{if(!e||e.length===0)throw new Error("No package specified. Usage: vis info <package> [field...]");const[p,...t]=e,s=r??i.cwd,f=g(s,{configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),o=l(f,{fields:t,json:n.json||!1,package:p},s,c);o!==0&&o!==1&&(process.exitCode=o)};export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as A}from"node:module";import{m,y as N,f as $,T as S}from"../packem_shared/index-BDmTbWX1.js";import{b as F,q as h}from"./config.js";import{p as e}from"./bin.js";import{w as I}from"../packem_shared/pm-runner-
|
|
1
|
+
import{createRequire as A}from"node:module";import{m,y as N,f as $,T as S}from"../packem_shared/index-BDmTbWX1.js";import{b as F,q as h}from"./config.js";import{p as e}from"./bin.js";import{w as I}from"../packem_shared/pm-runner-OGResYrA.js";import{w as P}from"../packem_shared/build-scripts-CCCi8U66.js";import{O as R}from"../packem_shared/native-config-sync-BEkJW7g3.js";import{S as T}from"../packem_shared/min-release-age-D1alDE3K.js";const B=A(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=t=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[s,o]=g.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return g.getBuiltinModule(t)}return B(t)},{execFileSync:E}=x("node:child_process"),{createInterface:M}=x("node:readline"),q=t=>{const s=[];return $(m(t,"turbo.json"))&&s.push("turborepo"),$(m(t,"nx.json"))&&s.push("nx"),$(m(t,".moon"))&&s.push("moon"),s},C=(t,s)=>new Promise(o=>{t.question(s,i=>{o(i.trim())})}),u=async(t,s,o=!0)=>{const i=await C(t,`${s} ${o?"[Y/n]":"[y/N]"} `);return i===""?o:i.toLowerCase()==="y"||i.toLowerCase()==="yes"},w=(t,s)=>{const o=[],i=Object.entries(s.allowBuilds).filter(([,l])=>l).map(([l])=>` "${l}": true,`).join(`
|
|
2
2
|
`),a=[` installScripts: {
|
|
3
3
|
allow: ${i?`{
|
|
4
4
|
${i}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as $,E as u,V as k,s as y}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{p}from"./bin.js";import{r as N,M,a as R,b as S,c as x,d as A,e as V,f as b,g as C,h as E}from"../packem_shared/s1ngularity-
|
|
1
|
+
import{I as $,E as u,V as k,s as y}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{p}from"./bin.js";import{r as N,M,a as R,b as S,c as x,d as A,e as V,f as b,g as C,h as E}from"../packem_shared/s1ngularity-Dhr3bPk0.js";import{g as P,a as j,r as B}from"../packem_shared/provenance-_CJjMKwu.js";import{r as D}from"../packem_shared/signatures-C730vkyK.js";const v=new Set(["archivedRepo","author","downloads","expiredDomains","metadata","newBin","provenance","s1ngularity","signatures"]),I=r=>{const s=r.trim();if(s==="")return;if(s.startsWith("@")){const o=s.indexOf("@",1);return o===-1?{name:s,spec:void 0}:{name:s.slice(0,o),spec:s.slice(o+1)||void 0}}const i=s.indexOf("@");return i===-1?{name:s,spec:void 0}:{name:s.slice(0,i),spec:s.slice(i+1)||void 0}},O=r=>{if(r===void 0||r.trim()==="")return;const s=new Set;for(const i of r.split(",")){const o=i.trim();if(!v.has(o))throw new Error(`Unknown marshall in --only: ${o}. Known: ${[...v].sort().join(", ")}.`);s.add(o)}return s},m=(r,s)=>r===void 0||r.has(s),F=r=>r?.has("signatures")??!1,H=async({argument:r,options:s,workspaceRoot:i})=>{if(!r||r.length===0)throw new Error("No package specified. Usage: vis inspect <package>[@<spec>]");const o=I(r[0]);if(o===void 0)throw new Error(`Invalid package argument: "${String(r[0])}". Usage: vis inspect <package>[@<spec>]`);const t=O(s.only),f=await P(o.name,{workspaceRoot:i});if(f===void 0){p.error(`Package ${o.name} not found in the registry.`),process.exitCode=2;return}const g=j(f,o.spec);if(g===void 0){p.error(`Could not resolve ${o.name}@${o.spec??"latest"} to a published version.`),process.exitCode=2;return}const c=[{name:o.name,version:g}],n=new M;if(m(t,"author")){const e=await N(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"author",message:a.message,packageName:a.packageName,severity:a.severity})}if(m(t,"provenance")){const e=await B(c);for(const a of e)n.add({marshall:"provenance",message:`Prior version ${a.priorVersionWithProvenance} had provenance but ${a.version} does not.`,packageName:a.packageName,severity:"error"})}if(m(t,"s1ngularity")){const e=await R(c,{workspaceRoot:i});for(const a of e){const d=a.hookChanges.map(w=>`${w.hook} (${w.kind})`).join(", "),l=a.hookChanges.length===1;n.add({marshall:"s1ngularity",message:`${a.version} ${l?"has an":"has"} install-script ${l?"change":"changes"} [${d}] AND dropped the provenance attestation that ${a.priorVersion} carried — this is the s1ngularity compromised-publish shape.`,packageName:a.packageName,severity:"error"})}}if(m(t,"newBin")){const e=await S(c);for(const a of e){const d=a.newBins.map(l=>l.command).join(", ");n.add({marshall:"newBin",message:`${a.toVersion} adds new bin script${a.newBins.length===1?"":"s"}: ${d} (prior: ${a.fromVersion}).`,packageName:a.packageName,severity:"warning"})}}if(m(t,"metadata")){const e=await x(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"metadata",message:`Missing/invalid metadata: ${a.issues.join(", ")}.`,packageName:a.packageName,severity:"warning"})}if(m(t,"downloads")){const e=await A([o.name]);for(const a of e){const d=a.downloadsLastMonth===void 0?"unknown":String(a.downloadsLastMonth);n.add({marshall:"downloads",message:a.kind==="no-data"?"npm stats API returned no monthly download data.":`Only ${d} downloads in the past month.`,packageName:a.packageName,severity:a.severity})}}if(m(t,"expiredDomains")){const e=await V(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"expiredDomains",message:a.kind==="expired"?`Maintainer email domain ${a.domain} (${a.maintainer}) is unregistered — potential hijack risk.`:`Could not verify maintainer email domain ${a.domain} (${a.maintainer}).`,packageName:a.packageName,severity:a.severity})}if(F(t)){const e=await D(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"signatures",message:a.message,packageName:a.packageName,severity:a.severity})}if(m(t,"archivedRepo")){const e=await b(c,{workspaceRoot:i});for(const a of e)n.add({marshall:"archivedRepo",message:a.kind==="archived"?`Source repo ${a.owner}/${a.repo} is archived${a.archivedAt===void 0?"":` (since ${a.archivedAt})`}.`:`Source repo ${a.owner}/${a.repo} returned 404 from GitHub.`,packageName:a.packageName,severity:"warning"})}const h=n.all();if(s.json===!0)process.stdout.write(`${JSON.stringify(C(h),void 0,2)}
|
|
2
2
|
`);else{const e=`${o.name}@${g}`;if(h.length===0)p.info(`${$("✓")} ${e} — no findings.`);else{p.info(`${u("Inspecting")} ${e}`);for(const l of E(h))process.stdout.write(`${l}
|
|
3
3
|
`);const a=n.errors().length,d=n.warnings().length;process.stdout.write(`
|
|
4
4
|
${u("Summary:")} ${k(`${String(a)} error${a===1?"":"s"}`)}, ${y(`${String(d)} warning${d===1?"":"s"}`)}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as v,f as D,H,j as L}from"../packem_shared/index-BDmTbWX1.js";import{p as t}from"./bin.js";import{w as _,I as A,p as B,h as F}from"../packem_shared/pm-runner-
|
|
1
|
+
import{m as v,f as D,H,j as L}from"../packem_shared/index-BDmTbWX1.js";import{p as t}from"./bin.js";import{w as _,I as A,p as B,h as F}from"../packem_shared/pm-runner-OGResYrA.js";import{s as T}from"../packem_shared/typosquats-DN78xx1x.js";import{h as G,P as J}from"../packem_shared/peer-warnings-BXAzXqY3.js";import{i as M}from"../packem_shared/utils-Cxree603.js";const N=["pnpm-lock.yaml","yarn.lock","package-lock.json","npm-shrinkwrap.json","bun.lock","bun.lockb"],W=a=>{let r=a;for(;;){for(const i of N)if(D(v(r,i)))return!0;const n=H(r);if(n===r||L(r).root===r)return!1;r=n}},h=new Set(["aube","auto","bun","npm","pnpm","yarn"]),Z=async a=>{const{argument:r,fs:n,logger:i,options:e,visConfig:c,workspaceRoot:w}=a,s=w??process.cwd();if(r&&r.length>0){const o=e,{default:S}=await import("./handler16.js"),R=o.marshallCheck===!1||o["no-marshall-check"]===!0?!1:void 0,q=o.socketCheck===!1||o["no-socket-check"]===!0?!1:void 0,z=o.typosquatCheck===!1||o["no-typosquat-check"]===!0?!1:void 0,E=o.runScripts===!0||o["run-scripts"]===!0,I=o.workspaceRoot===!0||o["workspace-root"]===!0,P=o.saveOptional===!0||o["save-optional"]===!0,$=e.dev===!0,j={autoInstallPeers:!1,exact:o.exact===!0,filter:e.filter,global:!1,marshallCheck:R,runScripts:E,saveDev:$,saveOptional:P,savePeer:!1,socketCheck:q,to:void 0,typosquatCheck:z,workspace:!1,workspaceRoot:I};await S({...a,argument:r,options:j});return}if(e.typosquatCheck!==!1&&!await T(s,c?.security?.typosquatAllowlist)){process.exitCode=1;return}const l=e.installer;if(l&&!h.has(l)){t.error(`Invalid --installer value: "${l}". Expected one of: ${[...h].join(", ")}.`),process.exitCode=1;return}const g=l,y=e.aube===!1;let f;try{f=y?_(s):A(s,{backend:g,configBackend:c?.install?.backend,configCorepack:c?.install?.corepack})}catch(o){t.error(o instanceof Error?o.message:String(o)),process.exitCode=1;return}const k=B(s,f);k&&t.warn(k);const C=M(e.filter),p=e.ci||!1,d=e.frozenLockfile||p,b=e.frozenLockfile===!1||e.force||e.lockfileOnly,x=W(s),m=d||!b&&x;if(!d&&m&&!e.silent&&t.info("Defaulting to frozen lockfile (pass --no-frozen-lockfile to allow lockfile updates)."),p){t.info("Clean install: removing node_modules...");try{await n.rm(v(s,"node_modules"),{force:!0,recursive:!0})}catch(o){t.error(`Failed to remove node_modules: ${o instanceof Error?o.message:String(o)}`),process.exitCode=1;return}}const{code:u,output:O}=await F(f,{dev:e.dev||!1,filter:C,force:e.force||!1,frozenLockfile:m,ignoreScripts:!e.runScripts,lockfileOnly:e.lockfileOnly||!1,noOptional:e.optional===!1,offline:e.offline||!1,prod:e.prod||!1,recursive:e.recursive||!1,silent:e.silent||!1,workspaceRoot:e.workspaceRoot||!1},s,i,{ciMode:p,preferOffline:e.preferOffline||!1});u!==0&&(process.exitCode=u),u===0&&!e.silent&&G(O)&&t.info(J)};export{Z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as E}from"node:module";import{I as x,E as j,V as T,s as A}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as L,O as N}from"../packem_shared/index-BDmTbWX1.js";import{
|
|
1
|
+
import{createRequire as E}from"node:module";import{I as x,E as j,V as T,s as A}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{m as L,O as N}from"../packem_shared/index-BDmTbWX1.js";import{l as b,c as B,p as f,f as F,b as z,P as U,R as V,Y,Z as H,_ as C,a0 as J,a1 as W,a2 as $,B as Z,a3 as G}from"./bin.js";import"../packem_shared/public-api-WqUCiyIe.js";import{I as K,M as Q,R as X}from"../packem_shared/pm-runner-OGResYrA.js";import{r as P,a as ee,p as se,b as oe}from"../packem_shared/resolve-explicit-CMDl55Nz.js";import{r as te}from"../packem_shared/typosquats-DN78xx1x.js";import{f as _,i as R}from"../packem_shared/utils-Cxree603.js";import{a as ne}from"./config.js";const q=E(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=o=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[c,e]=w.versions.node.split(".").map(Number);if(c>22||c===22&&e>=3||c===20&&e>=16)return w.getBuiltinModule(o)}return q(o)},{createInterface:O}=I("node:readline"),S=o=>o==="default"?"catalog:":`catalog:${o}`,v=o=>o==="default"?"default catalog":`catalog "${o}"`,ae=(o,c)=>{const e=[];for(const[s,n]of c)s.includes(":")||n.has(o)&&e.push(s);if(e.length===0)return;if(e.length===1){const[s]=e;return{source:v(s),spec:S(s)}}const a=e.find(s=>s==="default")??e[0],i=e.filter(s=>s!==a);return{candidates:[...e],conflict:!0,source:`${v(a)} (also in: ${i.map(s=>v(s)).join(", ")})`,spec:S(a)}},ie=(o,c)=>{const e=new Map;for(const[r,l]of c){if(!r.includes(":"))continue;const d=l.get(o);d!==void 0&&e.set(d,(e.get(d)??0)+1)}if(e.size===0)return;const a=[...e.entries()],i=a.reduce((r,[,l])=>r+l,0);if(a.length===1){const[[r]]=a;return{source:`siblings (${String(i)} pkg${i===1?"":"s"} on ${r})`,spec:r}}const s=[...a].sort((r,l)=>l[1]-r[1]),[n,t]=s[0],p=s.slice(1).map(([r,l])=>`${r} (×${String(l)})`);return{candidates:s.map(([r])=>r),conflict:!0,source:`siblings (most common: ${n} ×${String(t)}; conflicts: ${p.join(", ")})`,spec:n}},re=(o,c)=>ae(o,c)||ie(o,c),ce=(o,c,e)=>{const a=[];for(const i of o.values()){const{overall:s}=i.score,n=Z(s),t=`${String(Math.round(s*100))}%`,p=i.alerts.length,r=$(i),l=H(r,i.version,e),d=n==="red"?T:n==="yellow"?A:x;if(l?f.info(` ${d(t)} ${C(i)} ${j(`[accepted: ${l.reason}]`)}`):f.info(` ${d(t)} ${C(i)}`),p>0){const u=i.alerts.filter(g=>g.severity==="critical"||g.severity==="high").length;u>0&&f.warn(` ${String(u)} critical/high alert${u===1?"":"s"}`)}s<c&&!l&&a.push(i)}return a},le=async(o,c)=>{const e=O({input:process.stdin,output:process.stdout}),a=t=>new Promise(p=>{e.question(t,r=>{p(r.trim())})}),i=String(Math.round(c*100));f.warn(""),f.warn(`${String(o.length)} package${o.length===1?"":"s"} scored below the minimum threshold (${i}%):`);for(const t of o){const p=$(t),r=`${String(Math.round(t.score.overall*100))}%`;f.warn(` • ${p}@${t.version} — score: ${r} (${J(t.score.overall)})`)}f.warn("");const s=await a("Continue adding these packages? [y/N] ");if(s.toLowerCase()!=="y"&&s.toLowerCase()!=="yes")return e.close(),!1;const n=await a("Remember this decision? (prints config snippet) [y/N] ");if(e.close(),n.toLowerCase()==="y"||n.toLowerCase()==="yes"){f.notice(""),f.notice("Add the following to security.acceptedRisks in vis.config.ts:"),f.notice("");for(const t of o){const p=$(t),r=W(p,t.version,t.score.overall,"Reviewed and accepted");f.notice(r)}f.notice("")}return!0},pe=async(o,c,e,a)=>{const i=await P(o);if(i.length===0)return!0;f.info(""),f.info(`${c.map(t=>t.displayName).join(" + ")} security check:`);const s=await F(c,i);if(s.size===0)return f.info(" Could not fetch security data. Proceeding."),!0;const n=ce(s,e,a);return n.length===0?(f.info(""),!0):process.stdin.isTTY?le(n,e):(f.warn(`Aborting: ${String(n.length)} package${n.length===1?"":"s"} below minimum score. Use --no-socket-check to skip.`),!1)},fe=["dependencies","devDependencies","peerDependencies","optionalDependencies"],de=o=>o.savePeer?"peerDependencies":o.saveOptional?"optionalDependencies":o.saveDev?"devDependencies":"dependencies",D=(o,c)=>o.startsWith("catalog:")||!c?o:o.replace(/^[\^~]/,""),ue=async(o,c)=>{const e=[];for(const s of o){const{name:n,versionSpec:t}=_(s);if(!n)continue;if(t!==void 0){e.push({explicit:t,name:n});continue}const p=re(n,c);if(p){p.conflict&&f.warn(`${n}: ambiguous constraint — picking ${p.spec} (${p.source}). Pass ${n}@<version> to override.`),e.push({entry:{name:n,source:p.source,spec:p.spec},kind:"resolved",name:n});continue}e.push({kind:"missing",name:n})}const a=e.filter(s=>"kind"in s&&s.kind==="missing").map(s=>s.name),i=a.length>0?await oe(a):new Map;return e.map(s=>{if("explicit"in s)return{name:s.name,source:"explicit",spec:s.explicit};if(s.kind==="resolved")return s.entry;const n=i.get(s.name);if(n===void 0)throw new Error(`--to: cannot resolve a version for "${s.name}" (not in any catalog or sibling, and registry lookup failed). Pass ${s.name}@<version> explicitly.`);const t=`^${n}`;return f.info(`${s.name}: no existing constraint — using registry latest (${t}). Add to a catalog to share this version across workspace packages.`),{name:s.name,source:"registry latest",spec:t}})},ge=(o,c,e,a)=>{for(const{name:i,spec:s}of c){const n=D(s,a);for(const p of fe){if(p===e)continue;const r=o[p];r?.[i]!==void 0&&(delete r[i],Object.keys(r).length===0&&delete o[p])}let t=o[e];t===void 0&&(t={},o[e]=t),t[i]=n}},me=async({ignoreScripts:o,logger:c,options:e,packages:a,pm:i,target:s,visConfig:n,workspaceRoot:t})=>{const{workspace:p}=z(t,n??{}),r=p.projects[s];if(!r){const m=Object.keys(p.projects).sort();throw new Error(`--to: workspace package "${s}" not found. Available: ${m.length>0?m.slice(0,10).join(", "):"(none)"}${m.length>10?`, ... (${String(m.length-10)} more)`:""}.`)}const l=L(t,r.root,"package.json"),{packageManager:d}=U(t),u=V(t,d),g=de(e),h=e.exact??!1,k=await ue(a,u);if(k.length===0)return 0;const y=ne(l);ge(y,k,g,h),N(l,y,{indent:Y(l,{useEditorconfig:n?.editorconfig??!0}),overwrite:!0});for(const m of k){const M=D(m.spec,h);f.info(`${x("+")} ${m.name}@${M} → ${s}/${g} (${j(m.source)})`)}return X(i,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:o,lockfileOnly:!1,noOptional:!1,offline:!1,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},t,c)},xe=async({argument:o,logger:c,options:e,visConfig:a,workspaceRoot:i})=>{let s=o;if(!s||s.length===0)throw new Error("No packages specified. Usage: vis add <packages...>");if(e.typosquatCheck!==!1){const l=s.map(u=>_(u)),d=await te(l.map(u=>u.name),a?.security?.typosquatAllowlist);if(!d.ok){process.exitCode=1;return}s=l.map((u,g)=>{const h=d.packages[g];return h!==u.name?u.versionSpec?`${h}@${u.versionSpec}`:h??"":s[g]??""})}if(e.marshallCheck!==!1){const l=await P(s);if(l.length>0){const d=await ee(l,{config:a?.security?.marshalls,workspaceRoot:i});if(!await se(d)){process.exitCode=1;return}}}if(e.socketCheck!==!1){const l=new Set;b("socket")&&l.add("socket"),b("depsDev")&&l.add("deps-dev");const d=B(a?.security,{disabled:l,minimumScore:a?.security?.policies?.score?.minimum});if(d.length>0){const u=a?.security?.policies?.score?.minimum??G;if(!await pe(s,d,u,a?.security?.acceptedRisks)){process.exitCode=1;return}}}const n=process.cwd(),t=K(i??n,{configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),p=!e.runScripts;if(e.to){if(e.global||e.workspaceRoot)throw new Error("--to is incompatible with --global / --workspace-root.");if(e.filter&&R(e.filter).length>0)throw new Error("--to and --filter are mutually exclusive — --to already targets one package.");if(!i)throw new Error("--to requires a monorepo workspace. Run from inside a pnpm/bun/yarn/npm workspace.");const l=await me({ignoreScripts:p,logger:c,options:e,packages:s,pm:t,target:e.to,visConfig:a,workspaceRoot:i});l!==0&&(process.exitCode=l);return}const r=Q(t,{exact:e.exact||!1,filter:R(e.filter),global:e.global||!1,optional:e.saveOptional||!1,packages:s,peer:e.savePeer||!1,saveDev:e.saveDev||!1,workspace:e.workspace||!1,workspaceRoot:e.workspaceRoot||!1},n,c,{autoInstallPeers:e.autoInstallPeers||!1,ignoreScripts:p});r!==0&&(process.exitCode=r)};export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as l,j as i}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as l,j as i}from"../packem_shared/pm-runner-OGResYrA.js";const g=async({argument:e,logger:s,visConfig:o,workspaceRoot:a})=>{const r=e?.[0]??null,c=a??process.cwd(),t=l(c,{configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),n=i(t,r,c,s);n!==0&&(process.exitCode=n)};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as p,B as g}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as p,B as g}from"../packem_shared/pm-runner-OGResYrA.js";const u=async({argument:c,logger:i,visConfig:e,workspaceRoot:s})=>{const o=c;if(!o||o.length===0)throw new Error("No subcommand specified. Available: cache, publish, audit, list, view, config, whoami, login, logout, pack, owner, dist-tag, search, fund, ping, token, deprecate, rebuild, prune, plugin");const[t,...r]=o,n=s??process.cwd(),l=p(n,{configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),a=g(l,t,r,n,i);a!==0&&(process.exitCode=a)};export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as n,D as f}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as n,D as f}from"../packem_shared/pm-runner-OGResYrA.js";import{i as p}from"../packem_shared/utils-Cxree603.js";const v=async({argument:c,logger:i,options:e,visConfig:s,workspaceRoot:t})=>{const o=c;if(!o||o.length===0)throw new Error("No packages specified. Usage: vis remove <packages...>");const a=process.cwd(),l=n(t??a,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),r=f(l,{filter:p(e.filter),global:e.global||!1,packages:o,recursive:e.recursive||!1,saveDev:e.saveDev||!1,workspaceRoot:e.workspaceRoot||!1},a,i);r!==0&&(process.exitCode=r)};export{v as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as k,a as B,H as g}from"../packem_shared/index-BDmTbWX1.js";import{b as h,O as j,p as m}from"./bin.js";import{b as v,s as y}from"../packem_shared/cyclonedx-
|
|
1
|
+
import{B as k,a as B,H as g}from"../packem_shared/index-BDmTbWX1.js";import{b as h,O as j,p as m}from"./bin.js";import{b as v,s as y}from"../packem_shared/cyclonedx-kYozDyxp.js";const l=["json","xml"],C=n=>l.includes(n),R=async({fs:n,options:e,visConfig:d,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{packageJsons:f,workspace:i}=h(o,d),u=j(o,i,f),c=e.focus,w=c?c.split(",").map(b=>b.trim()).filter(Boolean):void 0,s=(e.format??"json").toLowerCase();if(!C(s))throw new Error(`Unknown --format: "${s}". Expected one of: ${l.join(", ")}.`);const t=v({focus:w,includeDev:!!e.includeDev,projectGraph:u,workspace:i,workspaceRoot:o}),a=s==="xml"?y(t):`${JSON.stringify(t,void 0,2)}
|
|
2
2
|
`,p=e.output??(s==="xml"?"sbom.cdx.xml":"sbom.cdx.json");if(p==="-"){process.stdout.write(a);return}const r=k(o,p);B(g(r)),await n.writeFile(r,a,"utf8");const x=t.components?.length??0,$=t.dependencies?.length??0;m.success(`SBOM written to ${r}`),m.notice(`${x} components, ${$} dependency edges`)};export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as p,S as l}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as p,S as l}from"../packem_shared/pm-runner-OGResYrA.js";const g=async({argument:c,logger:a,options:n,visConfig:o,workspaceRoot:r})=>{const i=c||[],e=r??process.cwd(),t=p(e,{configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),s=l(t,i,n.recursive||!1,e,a);s!==0&&(process.exitCode=s)};export{g as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as u}from"node:module";import{c as p}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as u}from"node:module";import{c as p}from"../packem_shared/index-D1_fbGbj.js";const f=u(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,a=s=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,i]=r.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return r.getBuiltinModule(s)}return f(s)},{execSync:d,spawnSync:l}=a("node:child_process"),v=async({argument:s,logger:e,options:i})=>{const t=s?.[0];e.info("info: checking for updates...");const n=p.version;let o;try{const c=d("npm view @visulima/vis version",{encoding:"utf8"}).trim();o=t??c}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(n===o&&!i.force){e.info(`
|
|
2
2
|
✓ Already up to date (${n})`);return}if(i.check){n===o?e.info(`✓ Already up to date (${n})`):e.info(`info: found @visulima/vis@${o} (current: ${n})`);return}if(e.info(`info: found @visulima/vis@${o} (current: ${n})`),e.info("info: installing..."),l("npm",["install","-g",`@visulima/vis@${o}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
|
|
3
3
|
✓ Updated @visulima/vis from ${n} → ${o}`)};export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as c,E as f}from"../packem_shared/pm-runner-
|
|
1
|
+
import{I as c,E as f}from"../packem_shared/pm-runner-OGResYrA.js";import{i as d}from"../packem_shared/utils-Cxree603.js";const v=async({argument:r,logger:n,options:o,process:i,visConfig:s,workspaceRoot:p})=>{const a=r;if(!a||a.length===0)throw new Error("No packages specified. Usage: vis why <package...>");const l=p??i.cwd,t=c(l,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),e=f(t,{depth:o.depth===void 0?void 0:Number(o.depth),dev:o.dev||!1,filter:d(o.filter),global:o.global||!1,json:o.json||!1,long:o.long||!1,noOptional:o.optional===!1,packages:a,parseable:o.parseable||!1,prod:o.prod||!1,recursive:o.recursive||!1},l,n);e!==0&&e!==1&&(process.exitCode=e)};export{v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as N,R as C,T as P,E as h,N as T,
|
|
2
|
-
`);const t=await P(e);if(!t.latest)throw new Error(`Could not determine latest version for "${e}".`);r=t.latest}const d=h(o),w=h(r);if(!d||!w)throw new Error(`Could not parse versions: current="${o}", target="${r}".`);const k=q(d,w);if(k==="none"){n.info(`${e} is already at ${r}. Nothing to analyze.`);return}const E=x(o),g={catalogName:
|
|
3
|
-
`);const t=o.replace(M,""),
|
|
4
|
-
`):n.info(F($))};export{
|
|
1
|
+
import{P as N,R as C,T as P,E as h,N as T,c as I,f as j,q,I as x}from"./bin.js";import"../packem_shared/index-BDmTbWX1.js";import"../packem_shared/public-api-WqUCiyIe.js";import{K as z,Z as A,W as F}from"../packem_shared/ai-analysis-K-DKU3ZA.js";const M=/^[\^~>=<]+/,U=async({argument:v,logger:n,options:c,visConfig:l,workspaceRoot:f})=>{if(!f)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const m=v,e=m[0];if(!e)throw new Error("Package name is required. Usage: vis analyze <package> [version]");const p=m[1],{packageManager:R}=N(f);let o,u="default";const b=C(f,R);for(const[t,i]of b){const a=i.get(e);if(a){o=a,u=t;break}}if(!o)throw new Error(`Package "${e}" not found in any catalog or package.json. Make sure it exists in your workspace dependencies.`);let r;if(p)r=p;else{n.info(`Fetching latest version for ${e}...
|
|
2
|
+
`);const t=await P(e);if(!t.latest)throw new Error(`Could not determine latest version for "${e}".`);r=t.latest}const d=h(o),w=h(r);if(!d||!w)throw new Error(`Could not parse versions: current="${o}", target="${r}".`);const k=q(d,w);if(k==="none"){n.info(`${e} is already at ${r}. Nothing to analyze.`);return}const E=x(o),g={catalogName:u,currentRange:o,newRange:`${E}${r}`,packageName:e,targetVersion:r,updateType:k},y=z(c.aiType??"impact");if(y==="security"||c.security){n.info(`Checking for known vulnerabilities...
|
|
3
|
+
`);const t=o.replace(M,""),i=(await T([{name:e,version:t}])).get(e);i&&i.length>0&&(g.vulnerabilities=i);const a=I(l?.security,{minimumScore:l?.security?.policies?.score?.minimum});if(a.length>0){const s=(await j(a,[{name:e,version:t}])).get(`${e}@${t}`);s&&(g.socketReport={alerts:s.alerts,license:s.license,score:s.score})}}const $=await A([g],n,l?.ai,y);(c.format??"table")==="json"?process.stdout.write(`${JSON.stringify($,void 0,2)}
|
|
4
|
+
`):n.info(F($))};export{U as default};
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
|
|
3
|
-
`)}
|
|
4
|
-
`},h=async()=>{const{default:e}=await import("./bin.js").then(t=>t.bC);return e.filter(t=>t.name!=="ai")},O=async()=>{const e=await h();process.stderr.write(P(e))},B=async()=>{const e=await h();process.stdout.write(C(e))},k=async({logger:e,visConfig:t})=>{const i=t?.ai,n=l(i);if(!n){e.error("No AI provider available to test."),process.exitCode=1;return}e.info(`Testing ${n.name}...`);try{const o=await b(n,"Reply with exactly: OK",{timeoutMs:3e4});e.info(`Provider ${n.name} responded: ${o.stdout.trim().slice(0,200)}`)}catch(o){const r=o instanceof Error?o.message:String(o);e.error(`Provider ${n.name} failed: ${r}`),process.exitCode=1}},F=({logger:e,options:t,visConfig:i})=>{const n=t.format??"table",o=i?.ai,r=y(),s=l(o);if(n==="json"){const a=r.map(m=>({available:m.available,method:m.detectionMethod,name:m.name,path:m.path,priority:d[m.name]??0,selected:m.name===s?.name,version:m.version}));process.stdout.write(`${JSON.stringify(a,void 0,2)}
|
|
5
|
-
`);return}const c=r.map(a=>({method:a.detectionMethod??"-",path:a.path??"-",priority:String(d[a.name]??0),provider:a.name,selected:a.name===s?.name?">>>":"",status:a.available?"available":"not found",version:a.version??"-"})),g=process.stdout.columns||80,v=x(_.createElement(w,{data:c}),{columns:g});e.info(v),s?e.info(`
|
|
6
|
-
Selected provider: ${s.name} (priority ${String(d[s.name]??0)})`):e.info(`
|
|
7
|
-
No AI provider available. Install one of the supported AI CLI tools.`)},V=async e=>{const{aiFix:t}=await import("./fix.js");await t(e)};export{B as aiDiscoverHelpExecute,V as aiFixExecute,F as aiProvidersExecute,O as aiRootExecute,k as aiTestExecute};
|
|
1
|
+
import{createRequire as R}from"node:module";import{DEFAULT_CHANGES_DIR as C}from"./DEFAULT_CLEAN_KEEP.js";import{b as E,f as B}from"./orchestrator.js";import{r as T}from"../packem_shared/slug-DoueYuLo.js";import{VisReleaseError as w}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const S=R(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[o,n]=u.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return u.getBuiltinModule(e)}return S(e)},{mkdir:V,writeFile:O}=$("node:fs/promises"),{resolve:b,sep:k,join:P}=$("node:path");let y;const W=e=>{y=e},_=async()=>y||(await import("./shell-runner.js")).createShellRunner(),v=e=>!e||!/^[\dv]/i.test(e)?!1:/^[\d.+\-a-z]+$/i.test(e),D=e=>{const o=e.trim(),n=/^(?:[a-z]+(?:\([^)]+\))?:\s+)?[Bb]ump\s+(?<dep>\S+)\s+from\s+(?<fromVersion>\S+)\s+to\s+(?<toVersion>\S+)(?:\s+in\s+\S+)?$/.exec(o);if(n?.groups){const t=n.groups.toVersion;return v(t)?{dep:n.groups.dep,fromVersion:n.groups.fromVersion,toVersion:t}:void 0}const s=/^(?:[a-z]+(?:\([^)]+\))?:\s+)?[Uu]pdate\s+(?:dependency|module)\s+(?<dep>\S+)\s+to\s+(?<toVersion>\S+)(?:\s+\S.*)?$/.exec(o);if(s?.groups){const t=s.groups.toVersion;return v(t)?{dep:s.groups.dep,fromVersion:"",toVersion:t}:void 0}},A=async e=>{const o=process.env.PR_NUMBER;if(o&&/^\d+$/.test(o))return Number.parseInt(o,10);const n=process.env.GITHUB_REF;if(n){const s=/^refs\/pull\/(\d+)\//.exec(n);if(s)return Number.parseInt(s[1],10)}try{const s=await(await _()).run("gh",["pr","view","--json","number"],{cwd:e,silent:!0});if(s.exitCode===0){const t=JSON.parse(s.stdout.trim());if(typeof t.number=="number")return t.number}}catch{}},L=async(e,o)=>{try{const n=await(await _()).run("gh",["pr","view",String(o),"--json","title,body,author"],{cwd:e,silent:!0});return n.exitCode!==0?void 0:JSON.parse(n.stdout.trim())}catch{return}},U=(e,o)=>{const n=[];for(const s of o){const{manifest:t}=s;(Object.hasOwn(t.dependencies??{},e)||Object.hasOwn(t.devDependencies??{},e)||Object.hasOwn(t.peerDependencies??{},e)||Object.hasOwn(t.optionalDependencies??{},e))&&n.push(s.name)}return n},F=e=>{const o={};for(const n of e.split(",")){const s=n.trim();if(!s)continue;const t=s.lastIndexOf(":");if(t<1)throw new w({code:"BUMP_FILE_INVALID",message:`Invalid --packages entry: ${JSON.stringify(s)}. Expected "package:level".`});const i=s.slice(0,t).trim(),r=s.slice(t+1).trim();if(r!=="major"&&r!=="minor"&&r!=="patch"&&r!=="none")throw new w({code:"BUMP_FILE_INVALID",message:`Invalid bump level: ${JSON.stringify(r)}. Expected major|minor|patch|none.`});o[i]=r}return o},M=async e=>{const{multiSelectPrompt:o,selectPrompt:n,textPrompt:s}=await import("./prompts.js"),t=await o("Which packages to bump?",e.map(p=>({label:p,value:p}))),i={};for(const p of t){const f=await n(`Bump level for ${p}?`,[{label:"patch — bug fixes only",value:"patch"},{label:"minor — new feature, backward-compatible",value:"minor"},{label:"major — breaking change",value:"major"},{label:"none — acknowledged, no direct bump",value:"none"}]);i[p]=f}const r=await s("Changelog entry (markdown):","");return{bumps:i,message:r}},Y=async({logger:e,options:o,workspaceRoot:n})=>{const s=n??process.cwd(),t=await E({cwd:s,skipRegistryLookup:!0});let i={},r=o.message??"";if(o.fromBotPr){const c=await A(s);if(c===void 0){e.error("No PR found. Set PR_NUMBER, run inside a GitHub Actions PR workflow, or check `gh pr view` works on this branch."),process.exitCode=1;return}const a=await L(s,c);if(!a||typeof a.title!="string"){e.error(`Could not fetch PR #${c} via \`gh pr view\`. Ensure gh is on PATH and authenticated.`),process.exitCode=1;return}const d=D(a.title);if(!d){e.info(`PR #${c} title is not a recognised Dependabot / Renovate pattern; skipping.`),e.info(`Title: ${a.title}`),process.exitCode=0;return}const h=U(d.dep,t.packages),N=d.fromVersion?`from ${d.fromVersion} to ${d.toVersion}`:`to ${d.toVersion}`;if(r=r||`Updated ${d.dep} ${N}`,h.length===0){const g=t.packages[0]?.name;if(!g){e.error("Workspace has no packages — cannot author an acknowledging change file."),process.exitCode=1;return}i={[g]:"none"},r=`${r} (no workspace package depends on ${d.dep})`}else for(const g of h)i[g]="patch"}else if(o.empty)i={},r=r||"Empty change file (no release).";else if(o.packages){i=F(o.packages);const c=new Set(t.packages.map(a=>a.name));for(const a of Object.keys(i))if(!c.has(a))throw new w({code:"BUMP_FILE_INVALID",message:`Unknown workspace package in --packages: ${JSON.stringify(a)}.`,packageName:a})}else{if(!process.stdout.isTTY){e.error("--packages is required when stdin is not a TTY."),e.error("Example: vis release add --packages '@scope/cerebro:minor' --message 'Add X'"),process.exitCode=1;return}const c=await M(t.packages.map(a=>a.name));i=c.bumps,r=r||c.message}if(Object.keys(i).length===0){e.error("No bumps specified."),process.exitCode=1;return}const p=t.config.changesDir??C,f=(o.name??T()).replaceAll(/[^a-z0-9-]/gi,"-"),l=b(s),x=l.endsWith(k)?l:`${l}${k}`,m=b(s,p);if(m!==l&&!m.startsWith(x))throw new w({code:"CONFIG_INVALID",message:`changesDir resolves outside the workspace: ${m} (workspace: ${l}).`});const j=P(m,`${f}.md`),I=B({bumps:i},r);await V(m,{recursive:!0}),await O(j,I,{flag:"wx"}),e.info(`Created ${p}/${f}.md`),e.info("");for(const[c,a]of Object.entries(i))e.info(` ${c}: ${a}`);r&&(e.info(""),e.info(` Body: ${r.split(`
|
|
2
|
+
`)[0]?.slice(0,80)??""}`))};export{W as __setBotPrRunnerForTests,Y as default,D as parseBotPrTitle};
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
`)}`,y=c.replace(/\s+$/,""),S=c.slice(y.length),j=`${y}${y.endsWith(",")||y===""?"":","}${_}${S.length>0?S:`
|
|
4
|
-
`}`,P=`${i.slice(0,r)}${a[1]}${j}${a[3]}${i.slice(r+a[0].length)}`;return w(s,P),{added:u,configPath:s,skipped:k,status:"updated"}}const n=/(installScripts\s*:\s*\{)/;if(n.test(i)){const c=`
|
|
5
|
-
allow: {
|
|
6
|
-
${t.map(u=>v(u," ")).join(`
|
|
7
|
-
`)}
|
|
8
|
-
},`,d=i.replace(n,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const o=/(policies\s*:\s*\{)/;if(o.test(i)){const c=`
|
|
9
|
-
installScripts: {
|
|
10
|
-
allow: {
|
|
11
|
-
${t.map(u=>v(u," ")).join(`
|
|
12
|
-
`)}
|
|
13
|
-
},
|
|
14
|
-
},`,d=i.replace(o,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const f=/(security\s*:\s*\{)/;if(f.test(i)){const c=`
|
|
15
|
-
policies: {
|
|
16
|
-
installScripts: {
|
|
17
|
-
allow: {
|
|
18
|
-
${t.map(u=>v(u," ")).join(`
|
|
19
|
-
`)}
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},`,d=i.replace(f,`$1${c}`);return w(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const p=M.exec(i)??W.exec(i);if(!p)return{added:[],configPath:s,skipped:t,status:"missing-anchor"};const m=`
|
|
23
|
-
security: {
|
|
24
|
-
policies: {
|
|
25
|
-
installScripts: {
|
|
26
|
-
allow: {
|
|
27
|
-
${t.map(c=>v(c," ")).join(`
|
|
28
|
-
`)}
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},`,b=`${i.slice(0,p.index+p[0].length)}${m}${i.slice(p.index+p[0].length)}`;return w(s,b),{added:t,configPath:s,skipped:[],status:"updated"}},L=async({options:l,visConfig:t,workspaceRoot:s})=>{const i=s??process.cwd(),h=q(i);if(h.name==="pnpm"&&!l.scan){e.info("Delegating to pnpm approve-builds...");const a=["approve-builds"];l.all&&a.push("--all");const r=T("pnpm",a,{cwd:i,stdio:"inherit"});if(r.error)throw new Error(`Failed to run pnpm approve-builds: ${r.error.message}`);if(r.status!==0&&r.status!==null&&(e.error(`pnpm approve-builds exited with code ${r.status}`),process.exitCode=r.status),!l.syncNative){e.notice(""),e.notice("Tip: vis.config.ts security.policies.installScripts.allow may now be out of sync with pnpm-workspace.yaml."),e.notice("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const a=t?.security?.policies?.installScripts?.allow??{},r=t?.security?.pinVersions===!0,n=A(i,a,{pinVersions:r});if(n.unapproved.length===0)e.success("No unapproved build scripts found."),l.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${n.unapproved.length} package${n.unapproved.length===1?"":"s"} with unapproved build scripts:
|
|
33
|
-
`);for(const o of n.unapproved)e.info(` ${o.name} (${o.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const o of n.unapproved){const f=r&&o.version?`${o.name}@${o.version}`:o.name;e.notice(` "${f}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),l.write){const o=t?.security?.pinVersions===!0,f=n.unapproved.map(m=>o&&m.version?`${m.name}@${m.version}`:m.name),p=B(i,f);switch(e.info(""),p.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(p.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(f.length)} entr${f.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(p.added.length)} entr${p.added.length===1?"y":"ies"} to ${String(p.configPath)}.`),p.skipped.length>0&&e.info(`Skipped ${String(p.skipped.length)} already-present entr${p.skipped.length===1?"y":"ies"}.`)}}}if(n.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(n.excess.length)} pattern${n.excess.length===1?"":"s"} no longer match any installed package:`);for(const o of n.excess)e.info(` ${o}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:o,to:f}of n.versionDrift)e.info(` ${o} → ${f}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(l.syncNative){const a=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(a).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const r=F(h.name,i,a);e.info("");for(const n of r)e.success(n)}}};export{L as default};
|
|
1
|
+
import{releaseChangelog as l}from"../packem_shared/ReleaseClient-YHzBIxYS.js";const c=async({logger:o,options:t,workspaceRoot:r})=>{const s=r??process.cwd(),i=t.filter?t.filter.split(",").map(e=>e.trim()).filter(Boolean):void 0,n=await l({channel:t.channel,cwd:s,projects:i});if(t.json){process.stdout.write(`${JSON.stringify(n,null,2)}
|
|
2
|
+
`),n.projectChangelogs.length===0&&(process.exitCode=1);return}if(n.projectChangelogs.length===0){o.info("No pending releases — no changelog entries to render."),process.exitCode=1;return}for(const e of n.projectChangelogs)o.info(`# ${e.package} → ${e.file}`),o.info(""),o.info(e.content),o.info("")};export{c as default};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)
|
|
3
|
-
`)[0]??"";if(p(`commit: ${$}`),m&&K(m,o))return n(f(o,"commit-force-deploy",`Force-deploy keyword in commit: "${$}"`));if(m&&Z(m,o))return n(b(o,"commit-skip",`Skip keyword in commit: "${$}"`));let h,v;try{({packageJsons:v,workspace:h}=H(l,c))}catch(s){const a=s instanceof Error?s.message:String(s);return n(f(o,"workspace-error",`Workspace discovery failed (${a}) — building defensively`))}if(!Object.hasOwn(h.projects,o))return n(f(o,"project-unknown",`Project "${o}" not found in workspace — building defensively`));try{const s=r.base?.trim(),a=z();let i=s||a||"HEAD~1";const u=r.head?.trim()||"HEAD";_(i),_(u),p(`resolved base ref: ${i} (source: ${s?"flag":a?"ci-env":"default"})`);const S=L(l,i),x=T(l,h,v);await S||(p(`base ref ${i} not reachable — falling back to HEAD~1`),i="HEAD~1"),p(`comparing ${i}...${u}`);const w=r.downstream??"deep",y=r.upstream??"none";if(!E.has(w))throw new Error(`Invalid --downstream value: "${w}". Must be "none", "direct", or "deep".`);if(!E.has(y))throw new Error(`Invalid --upstream value: "${y}". Must be "none", "direct", or "deep".`);const M={base:i,downstream:w,head:u,projectGraph:x,projects:h.projects,upstream:y,workspaceRoot:l},d=await F(M);p(`changed files: ${d.changedFiles.length}`),p(`affected projects: ${d.affectedProjects.join(", ")||"(none)"}`);const j={base:i,head:u};return d.changedFiles.length===0?n(b(o,"no-changes",`No files changed between ${i}...${u}`,{...j,affectedProjects:[]})):d.affectedProjects.includes(o)?n(f(o,"project-affected",`Build ${o}: affected by ${d.changedFiles.length} changed file(s)`,{...j,affectedProjects:d.affectedProjects})):n(b(o,"project-not-affected",`Skip ${o}: not affected by changes between ${i}...${u}`,{...j,affectedProjects:d.affectedProjects}))}catch(s){const a=s instanceof Error?s.message:String(s);return t.error(`Affected detection failed: ${a}`),n(f(o,"workspace-error",`Affected detection failed (${a}) — building defensively`))}};export{re as default};
|
|
1
|
+
import{DEFAULT_CHANGES_DIR as R}from"./DEFAULT_CLEAN_KEEP.js";import{b as D,r as F,c as b}from"./orchestrator.js";import{createShellRunner as E}from"./shell-runner.js";const y=async({logger:r,options:d,workspaceRoot:$})=>{const s=$??process.cwd(),p=d.noFail===!0,u=d.strict===!0,t=await D({cwd:s}),{printConfigIfRequested:x}=await import("./print-config.js");if(x(d,t,r))return;const{files:i}=await F({changesDir:t.config.changesDir,cwd:s});if(i.length===0){u?(r.error("No change files present and --strict is set."),r.error(`Run \`vis release add\` to author one in ${t.config.changesDir??R}.`),process.exitCode=p?0:1):(r.warn("No change files present. PR will not produce a release."),process.exitCode=0);return}if(!u){r.info(`${i.length} change file(s) present. ✓`),process.exitCode=0;return}const m=t.config.baseBranch??"main",g=await E().run("git",["diff","--name-only",`${m}...HEAD`],{cwd:s,silent:!0});if(g.exitCode!==0){r.warn(`Could not run git diff vs ${m}: ${g.stderr}`),process.exitCode=0;return}const f=g.stdout.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(Boolean);if(f.length===0){r.info("No source files changed. ✓"),process.exitCode=0;return}const{default:w}=await import("./index.js"),k=t.config.changedFilePatterns??["**"],v=(e,n,l)=>{if(!e.startsWith(`${n}/`))return!1;const h=e.slice(n.length+1);return l.some(o=>w(o,h))},C=new Set(b(i).keys()),c=new Set;for(const e of f){const n=t.packages.find(o=>{const a=o.dir.startsWith(s)?o.dir.slice(s.length).replace(/^[/\\]/,""):o.dir;return e===`${a}/package.json`||e.startsWith(`${a}/`)});for(const o of t.packages){const a=t.perPackageConfig.get(o.name)?.additionalPaths;!a||a.length===0||a.some(P=>w(P,e))&&!C.has(o.name)&&c.add(o.name)}if(!n)continue;const l=n.dir.startsWith(s)?n.dir.slice(s.length).replace(/^[/\\]/,""):n.dir,h=t.perPackageConfig.get(n.name)?.changedFilePatterns??k;e!==`${l}/package.json`&&!v(e,l,h)||C.has(n.name)||c.add(n.name)}if(c.size>0){r.error("The following packages have changes but no covering change file:");for(const e of c)r.error(` - ${e}`);r.error("Run `vis release add` to author one."),process.exitCode=p?0:1;return}r.info(`${i.length} change file(s); ${f.length} changed file(s) all covered. ✓`),process.exitCode=0};export{y as default};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)
|
|
3
|
-
|
|
4
|
-
`,d=[_,...t].join(s);if(e.trim()==="")return{added:t,content:`${d}${s}`};const i=e.endsWith(`
|
|
5
|
-
`)?s:`${s}${s}`;return{added:t,content:`${e}${i}${d}${s}`}},E=e=>e==="docker"||e==="npm"||e==="slug"||e==="vercel",k=async(e,r)=>{try{return await e.readFile(r,"utf8")}catch{return""}},N=async({fs:e,logger:r,options:n,process:t,workspaceRoot:s})=>{const d=s??t.cwd,i=n.target??"docker";if(!E(i))throw new Error(`Invalid --target "${i}". Expected one of: docker, vercel, npm, slug.`);const o=f[i],c=p(d,o),g=await k(e,c),{added:a,content:l}=v(g,$(i));if(n.json){process.stdout.write(`${JSON.stringify({added:a,file:o,target:i},null,2)}
|
|
6
|
-
`);return}if(n.write){if(a.length===0){r.info(`${o} is already up to date (no new patterns).`);return}await e.writeFile(c,l),r.info(`Added ${a.length} pattern(s) to ${o}.`);return}process.stdout.write(l.endsWith(`
|
|
7
|
-
`)?l:`${l}
|
|
8
|
-
`),r.info(u(`(${a.length} new pattern(s); re-run with --write to save ${o})`))};export{N as default};
|
|
1
|
+
import{b as h}from"./orchestrator.js";import{escapeMarkdown as f}from"./security.js";import{createShellRunner as g}from"./shell-runner.js";import{d as w,a as R,u as $}from"../packem_shared/sticky-comment-D6_7-w8T.js";const k=(o,a)=>{const e=["### 🚀 Release Plan",""];if(a&&(e.push(`Channel: \`${a}\``),e.push("")),o.releases.length===0)return e.push("_No pending releases._ (Add a change file via `vis release add` to mark this PR as releasing.)"),e.join(`
|
|
2
|
+
`);const n={major:[],minor:[],patch:[]};for(const s of o.releases)n[s.type].push(s);for(const s of["major","minor","patch"])if(n[s].length!==0){e.push(`#### ${s.charAt(0).toUpperCase()}${s.slice(1)}`),e.push("");for(const r of n[s]){const t=[];r.isCascadeBump&&t.push("cascade"),r.isGroupBump&&t.push("group"),r.isDependencyBump&&!r.isCascadeBump&&t.push("dep-bump");const i=t.length>0?` _(${t.join(", ")})_`:"";e.push(`- \`${r.name}\`: ${r.oldVersion} → **${r.newVersion}**${i}`)}e.push("")}if(o.warnings.length>0){e.push("#### ⚠️ Warnings"),e.push("");for(const s of o.warnings)e.push(`- ${f(s)}`)}return e.join(`
|
|
3
|
+
`)},v=async({logger:o,options:a,workspaceRoot:e})=>{const n=e??process.cwd(),s=a.noFail===!0,r=a.strict===!0,t=g(),i=await w(t,n),c=R(process.env);(!i||!c)&&o.warn("Not running in a PR context (GITHUB_REF / PR_NUMBER missing or `gh repo view` failed). Falling back to local print.");const p=await h({cwd:n,skipRegistryLookup:!0}),{printConfigIfRequested:d}=await import("./print-config.js");if(d(a,p,o))return;const m=p.config.versionPr?.commentMarker??"<!-- vis-release-comment -->",l=k(p.plan,p.channel?.tag);if(i&&c){const u=await $({body:l,cwd:n,issueNumber:c,marker:m,repo:i,runner:t});if(u)o.info(`${u.created?"Posted":"Updated"} release-plan comment on PR #${c} (id: ${u.id}).`);else{o.error("Failed to post / update PR comment."),process.exitCode=s?0:1;return}}else o.info(l);r&&p.plan.releases.length===0&&(o.error("--strict and no pending releases."),process.exitCode=s?0:1)};export{v as default};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import{createRequire as _}from"node:module";import{b as y}from"./orchestrator.js";const m=_(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=n=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,i]=r.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return r.getBuiltinModule(n)}return m(n)},{appendFileSync:f}=g("node:fs"),B=async({logger:n,options:o,workspaceRoot:i})=>{const l=i??process.cwd(),s=await y({cwd:l,skipRegistryLookup:!0}),{printConfigIfRequested:u}=await import("./print-config.js");if(u(o,s,n))return;const t=s.plan.releases.length===0?"nothing":s.channel?.mode==="version-pr"?"version-pr":"publish",a=s.plan.releases.map(e=>e.name),p={channel:s.channel?.tag,mode:t,packages:a,plan:s.plan.releases.map(e=>({isCascadeBump:e.isCascadeBump,isDependencyBump:e.isDependencyBump,isGroupBump:e.isGroupBump,name:e.name,newVersion:e.newVersion,oldVersion:e.oldVersion,type:e.type})),prerelease:s.channel?.prerelease,warnings:s.plan.warnings};process.stdout.write(`${JSON.stringify(p,null,2)}
|
|
2
|
+
`);const c=process.env.GITHUB_OUTPUT;if(c){const e=[`mode=${t}`,`packages=${a.join(",")}`,`json<<__VIS_RELEASE_EOF__
|
|
3
|
+
${JSON.stringify(p)}
|
|
4
|
+
__VIS_RELEASE_EOF__`];try{f(c,`${e.join(`
|
|
5
|
+
`)}
|
|
6
|
+
`)}catch(d){n.warn(`Could not write $GITHUB_OUTPUT: ${d.message}`)}}};export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as f}from"./orchestrator.js";import{createShellRunner as g}from"./shell-runner.js";const p=async({logger:r,options:n,workspaceRoot:l})=>{const t=l??process.cwd(),i=g(),s=await f({cwd:t}),e=n.branch??s.config.versionPr?.branch??"vis-release/version-packages",o=n.base??s.config.baseBranch??"main";r.info(`Rebasing ${e} onto ${o}...`);const a=await i.run("git",["fetch","origin",`${e}:${e}`,o],{cwd:t,silent:!0});if(a.exitCode!==0){r.info(`No remote branch ${e} to rebase (${a.stderr.trim()||"fetch failed"}). Skipping.`);return}const c=await i.run("git",["switch",e],{cwd:t,silent:!0});if(c.exitCode!==0){r.error(`Could not switch to ${e}: ${c.stderr.trim()}`),process.exitCode=1;return}if((await i.run("git",["rebase",`origin/${o}`],{cwd:t,silent:!0})).exitCode!==0){await i.run("git",["rebase","--abort"],{cwd:t,silent:!0}),r.error("Rebase produced conflicts; aborting. Resolve manually, or let the next `vis release ci release` recompute the version PR from scratch."),process.exitCode=1;return}const u=await i.run("git",["rev-list","--count",`origin/${e}..${e}`],{cwd:t,silent:!0});if(u.exitCode===0&&u.stdout.trim()==="0"){r.info(`${e} is already up to date with ${o}. Nothing to push.`);return}const d=await i.run("git",["push","--force-with-lease","origin",`${e}:${e}`],{cwd:t,silent:!0});if(d.exitCode!==0){r.error(`Failed to force-push ${e}: ${d.stderr.trim()}`),process.exitCode=1;return}r.info(`Force-pushed ${e} after rebasing onto ${o}.`)};export{p as default};
|