@visulima/vis 1.0.0-alpha.19 → 1.0.0-alpha.20
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 +164 -0
- package/LICENSE.md +187 -779
- package/README.md +1 -1
- package/dist/config/index.d.ts +535 -121
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/bin.js +380 -286
- package/dist/packem_chunks/config.js +15 -14
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/fix.js +9 -9
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -2
- package/dist/packem_chunks/handler11.js +5 -1
- package/dist/packem_chunks/handler12.js +1 -5
- package/dist/packem_chunks/handler13.js +27 -1
- package/dist/packem_chunks/handler14.js +5 -20
- 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 -5
- package/dist/packem_chunks/handler20.js +5 -2
- package/dist/packem_chunks/handler21.js +2 -18
- package/dist/packem_chunks/handler22.js +2 -1
- package/dist/packem_chunks/handler23.js +18 -1
- package/dist/packem_chunks/handler24.js +1 -5
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -3
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +3 -1
- package/dist/packem_chunks/handler29.js +1 -7
- package/dist/packem_chunks/handler3.js +3 -3
- package/dist/packem_chunks/handler30.js +6 -22
- package/dist/packem_chunks/handler31.js +33 -3
- package/dist/packem_chunks/handler32.js +3 -1
- package/dist/packem_chunks/handler33.js +1 -2
- package/dist/packem_chunks/handler34.js +25 -24
- package/dist/packem_chunks/handler35.js +3 -3
- package/dist/packem_chunks/handler36.js +6 -21
- package/dist/packem_chunks/handler37.js +22 -428
- package/dist/packem_chunks/handler38.js +428 -6
- package/dist/packem_chunks/handler39.js +6 -5
- package/dist/packem_chunks/handler4.js +8 -2
- package/dist/packem_chunks/handler40.js +24 -10
- package/dist/packem_chunks/handler41.js +10 -24
- package/dist/packem_chunks/handler42.js +1 -1
- package/dist/packem_chunks/handler43.js +6 -6
- package/dist/packem_chunks/handler44.js +13 -13
- package/dist/packem_chunks/handler45.js +213 -3
- package/dist/packem_chunks/handler46.js +3 -27
- package/dist/packem_chunks/handler47.js +21 -161
- package/dist/packem_chunks/handler48.js +166 -33
- package/dist/packem_chunks/handler49.js +34 -0
- package/dist/packem_chunks/handler5.js +1 -8
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +2 -1
- package/dist/packem_chunks/heal-accept.js +2 -2
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +16 -16
- package/dist/packem_chunks/index.js +6 -6
- package/dist/packem_chunks/keys-refresh.js +4 -0
- package/dist/packem_chunks/list.js +3 -0
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prune.js +3 -0
- package/dist/packem_chunks/run.js +1 -0
- package/dist/packem_chunks/status.js +2 -0
- package/dist/packem_chunks/sync.js +2 -0
- package/dist/packem_chunks/sync2.js +2 -0
- package/dist/packem_chunks/tripwire.js +2 -0
- package/dist/packem_shared/advisories-DsynpacV.js +1 -0
- package/dist/packem_shared/{ai-analysis-C_GpXikx.js → ai-analysis-uYuTIIXi.js} +1 -1
- package/dist/packem_shared/{ai-cache-DrCLD4gc.js → ai-cache-DuwHYx2O.js} +1 -1
- package/dist/packem_shared/{ai-fix-CWOz12Om.js → ai-fix-DzrA-dVz.js} +4 -4
- package/dist/packem_shared/applyDefaults-BOVDw1jD.js +1 -0
- package/dist/packem_shared/build-scripts-DsWMSWDs.js +1 -0
- package/dist/packem_shared/{cache-directory-C_U1qsIw.js → cache-directory-DQak1Vjc.js} +1 -1
- package/dist/packem_shared/cyclonedx-CiHXuG8M.js +4 -0
- package/dist/packem_shared/dependency-scan-DC3nAFHS.js +1 -0
- package/dist/packem_shared/{docker-B4s1fjiN.js → docker-B-CIN_nj.js} +19 -19
- package/dist/packem_shared/{failure-log-CSC6KfcO.js → failure-log-C3LEMmkq.js} +1 -1
- package/dist/packem_shared/{flakiness-DUtrm-wS.js → flakiness-Dq6K4ymq.js} +1 -1
- package/dist/packem_shared/glob-MHJQjR39-CQ2GC0b_.js +1 -0
- package/dist/packem_shared/{lifecycle-CgK8pcfa.js → lifecycle-Dv3nAtoD.js} +2 -2
- package/dist/packem_shared/{lockfile-i-qvq_k8.js → lockfile-C5DYMHVq.js} +1 -1
- package/dist/packem_shared/manifests-B0fMp872.js +1 -0
- package/dist/packem_shared/min-release-age-BFozFonQ.js +34 -0
- package/dist/packem_shared/native-config-sync-Dvi1g2nQ.js +21 -0
- package/dist/packem_shared/registry-keys-CewRFW0e.js +1 -0
- package/dist/packem_shared/resolve-explicit-CC4Kifk5.js +5 -0
- package/dist/packem_shared/{run-summary-utils-CJv75pla.js → run-summary-utils-BaBGP3bo.js} +1 -1
- package/dist/packem_shared/{runtime-check-CBU6W8qG.js → runtime-check-BusAwPb2.js} +1 -1
- package/dist/packem_shared/scan-progress-CMynp3eA.js +2 -0
- package/dist/packem_shared/signatures-5ZdjJ2Pu.js +2 -0
- package/dist/packem_shared/{toolchain-B7dckBQ1.js → toolchain-Cc3cwyLP.js} +3 -3
- package/dist/packem_shared/typosquats-BCeR-sLf.js +1 -0
- package/dist/packem_shared/verify-07kUNTuP.js +1 -0
- package/dist/packem_shared/{vis-update-app-D0uL3eO5.js → vis-update-app-CFrlJ3mW.js} +1 -1
- package/index.d.ts +358 -0
- package/index.js +56 -53
- package/package.json +14 -13
- package/schemas/vis-config.schema.json +595 -100
- package/dist/packem_shared/applyDefaults-DLY94gWA.js +0 -1
- package/dist/packem_shared/dependency-scan-YdgNVvoz.js +0 -2
- package/dist/packem_shared/readTomlSync-1fKo0R52-DtxWULlF.js +0 -109
- package/dist/packem_shared/typosquats-B3A38-qx.js +0 -1
- package/dist/packem_shared/verify-WDStBFvK.js +0 -1
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
${G("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},"logFilteredByTarget"),
|
|
3
|
-
`):n==="minimal"?process.stdout.write(`${
|
|
4
|
-
`):(
|
|
5
|
-
Updated ${
|
|
6
|
-
Fetching changelogs...`);const
|
|
7
|
-
`);try{
|
|
8
|
-
`),
|
|
9
|
-
`);const
|
|
10
|
-
${String(
|
|
11
|
-
${
|
|
12
|
-
`)}`):
|
|
13
|
-
`);for(const
|
|
1
|
+
var Re=Object.defineProperty;var I=(e,t)=>Re(e,"name",{value:t,configurable:!0});import{createRequire as Se}from"node:module";import{am as xe,u as ae,an as Ee,F as N,e as G,ao as Te,d as Ne,G as Me,H as ge,ap as Ue,aq as me,i as se,O as je,R as Fe,J as _e,V as qe,ar as Be,W as Le,as as Oe,s as fe,a as he,U as Pe,at as Ie,au as De,av as We,f as Ge,aw as He}from"./bin.js";import{M as D,i as W,$ as Ve}from"./config.js";import{render as oe,renderToString as X}from"@visulima/tui";import{Text as S}from"@visulima/tui/components/text";import $ from"react";import{H as Ye,e as ze,Z as re}from"../packem_shared/ai-analysis-uYuTIIXi.js";import{r as Ze,b as Je,p as Xe}from"../packem_shared/resolve-explicit-CC4Kifk5.js";import{r as Ke,s as Qe}from"../packem_shared/typosquats-BCeR-sLf.js";import{U as et,C as tt,a as ie}from"../packem_shared/vis-update-app-CFrlJ3mW.js";import{d as nt}from"../packem_shared/utils-DrNg0XTR.js";const Ae=Se(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,de=I(e=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[t,n]=_.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return _.getBuiltinModule(e)}return Ae(e)},"__cjs_getBuiltinModule"),{execFileSync:pe}=de("node:child_process"),{createInterface:Ce}=de("node:readline");var at=Object.defineProperty,x=I((e,t)=>at(e,"name",{value:t,configurable:!0}),"s");const st=x(e=>{const t=[];for(const n of e.filters)t.push("--filter",n);return e.workspaceRoot&&t.push("--filter","."),t.push("update"),e.latest&&t.push("--latest"),e.recursive&&t.push("--recursive"),e.interactive&&t.push("--interactive"),e.dev&&t.push("--dev"),e.prod&&t.push("--prod"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"pnpm"}},"resolvePnpm"),ot=x(e=>{const t=[];return e.filters.length>0&&t.push("workspace",e.filters[0]),t.push("upgrade"),e.latest&&t.push("--latest"),t.push(...e.packages),{args:t,bin:"yarn"}},"resolveYarnV1"),rt=x(e=>{const t=[];if(e.filters.length>0||e.recursive){t.push("workspaces","foreach","--all");for(const n of e.filters)t.push("--include",n)}return t.push("up"),e.interactive&&t.push("--interactive"),t.push(...e.packages),{args:t,bin:"yarn"}},"resolveYarnBerry"),it=x((e,t)=>{const n=["update"];e.latest&&t.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&t.push("npm does not support --interactive mode.");for(const a of e.filters)n.push("--workspace",a);return e.recursive&&n.push("--workspaces"),e.workspaceRoot&&n.push("--include-workspace-root"),e.dev&&n.push("--dev"),e.prod&&n.push("--production"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"npm"}},"resolveNpm"),lt=x(e=>{const t=["update"];e.latest&&t.push("--latest");for(const n of e.filters)t.push("--filter",n);return t.push(...e.packages),{args:t,bin:"bun"}},"resolveBun"),ct=x((e,t)=>{const n=["outdated","--update"];return e.latest&&n.push("--latest"),e.interactive&&n.push("--interactive"),e.filters.length>0&&t.push("deno outdated has no --filter flag; ignoring."),(e.dev||e.prod)&&t.push("deno outdated has no --dev / --prod flags; dev/prod is governed by deno.json."),e.noOptional&&t.push("deno outdated has no --no-optional flag; ignoring."),e.noSave&&t.push("deno outdated has no --no-save flag; ignoring."),n.push(...e.packages),{args:n,bin:"deno"}},"resolveDeno"),ut=x((e,t,n)=>{const a=[];if(n.global&&e!=="aube"&&e!=="deno")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:a};let o;switch(e){case"aube":{const s=xe(n);o={args:s.args,bin:s.bin},a.push(...s.warnings);break}case"bun":{o=lt(n);break}case"deno":{o=ct(n,a);break}case"npm":{o=it(n,a);break}case"pnpm":{o=st(n);break}case"yarn":{o=t.startsWith("1.")?ot(n):rt(n);break}default:{const s=e;throw new Error(`Unsupported package manager: ${String(s)}`)}}return{command:o,warnings:a}},"resolveUpdateCommand");var dt=Object.defineProperty,k=I((e,t)=>dt(e,"name",{value:t,configurable:!0}),"y");const ve=k(e=>{const t=e.trim();if(t==="")return;const n=/^(\d+(?:\.\d+)?)\s*([mhdw])?$/i.exec(t);if(!n)return;const a=Number.parseFloat(n[1]);if(!(!Number.isFinite(a)||a<0))switch((n[2]??"m").toLowerCase()){case"d":return a*60*24;case"h":return a*60;case"m":return a;case"w":return a*60*24*7;default:return}},"parseTimeStringToMinutes"),pt=k(e=>{const t=e.trim();return/^\d+(?:\.\d+)?$/.test(t)?Number.parseFloat(t)*1440:ve(t)},"parseNpmReleaseAgeValue"),Nt=k(e=>!Number.isFinite(e)||e<=0?"0m":e%1440===0?`${String(e/1440)}d`:e%60===0?`${String(e/60)}h`:`${String(e)}m`,"formatMinutesAsTimeString"),gt=k((e,t)=>{try{switch(t){case"bun":{const n=D(e,"bunfig.toml");if(W(n)){const a=Ee(n),o=a?.install?.minimumReleaseAge;return{excludes:Array.isArray(a?.install?.minimumReleaseAgeExcludes)?a.install.minimumReleaseAgeExcludes:void 0,minutes:typeof o=="number"?Math.round(o/60):void 0}}break}case"npm":{const n=D(e,".npmrc");if(W(n)){const a=Ve(n),o=/^\s*min-release-age\s*=\s*([^\s#;]+)/m.exec(a);return{minutes:o?pt(o[1]):void 0}}break}case"pnpm":{const n=D(e,"pnpm-workspace.yaml");if(W(n)){const a=ae(n);return{excludes:Array.isArray(a?.minimumReleaseAgeExclude)?a.minimumReleaseAgeExclude:void 0,minutes:typeof a?.minimumReleaseAge=="number"?a.minimumReleaseAge:void 0}}break}case"yarn":{const n=D(e,".yarnrc.yml");if(W(n)){const a=ae(n)?.npmMinimalAgeGate;if(typeof a=="string")return{minutes:ve(a)};if(typeof a=="number")return{minutes:a}}break}}}catch{}return{}},"readPmNativeMinimumReleaseAge"),mt=k((e,t,n)=>{const a=e.latest?"latest":e.target??t.target??"latest";if(!["latest","minor","patch"].includes(a))throw new Error(`Invalid target "${a}". Use: latest, minor, or patch.`);const o=e.maxConcurrentRequests,s=typeof o=="number"&&o>0?o:t.maxConcurrentRequests,r=typeof e.releaseChannel=="string"?e.releaseChannel.toLowerCase():void 0;if(r!==void 0&&!["any","same","stable"].includes(r))throw new Error(`Invalid --release-channel "${String(e.releaseChannel)}". Use: any, same, or stable.`);const m=r??t.releaseChannel;return{exclude:[...N(e.exclude),...N(t.exclude)],ignore:N(t.ignore),include:[...N(e.include),...N(t.include),...n],includeLocked:e.includeLocked||t.includeLocked||!1,includePrerelease:e.prerelease||t.prerelease||!1,maxConcurrentRequests:s,minimumReleaseAge:t.minimumReleaseAge,minimumReleaseAgeExclude:t.minimumReleaseAgeExclude,packageMode:t.packageMode,releaseChannel:m,security:e.security||e.ai||t.security||!1,target:a}},"buildCatalogCheckOptions"),le=k((e,t)=>{if(e.length!==0){t.info(`
|
|
2
|
+
${G("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},"logFilteredByTarget"),ce=k((e,t,n,a,o)=>{n==="json"?process.stdout.write(`${Te({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
|
|
3
|
+
`):n==="minimal"?process.stdout.write(`${Ne(e)}
|
|
4
|
+
`):(Me(e,a),a.info(ge(e,o)))},"writeFormattedOutput"),ue=k(async(e,t,n,a,o,s,r)=>{const m=Ue(e,n,t,!0,{useEditorconfig:r}),u=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(o.info(`
|
|
5
|
+
Updated ${u}`),m&&o.info(`Backup saved to ${m}`),a.changelog){o.info(`
|
|
6
|
+
Fetching changelogs...`);const p=await me(n,void 0,s);for(const l of p){const f=l.releaseUrl??l.repoUrl??l.npmUrl;o.info(` ${l.packageName}: ${f}`)}}if(a.install??!0){const p=t,l=["install"];o.info(`Running ${p} ${l.join(" ")}...
|
|
7
|
+
`);try{pe(p,l,{cwd:e,env:process.env,stdio:"inherit"})}catch{o.warn(`${p} ${l.join(" ")} failed. You may need to run it manually.`)}}},"applyCatalogAndInstall"),ft=k(async(e,t,n,a,o,s)=>{const r=n.update??{},m=[["global","--global is not supported in catalog mode"],["recursive","--recursive is not needed in catalog mode (catalogs are workspace-level)"],["filter","--filter is not supported in catalog mode (use --include/--exclude instead)"],["no-save","--no-save is not supported in catalog mode"],["workspace-root","--workspace-root is not needed in catalog mode"],["no-optional","--no-optional is not supported in catalog mode"]];for(const[i,d]of m)a[i]&&s.warn(`${G("⚠")} ${d}, ignoring.`);const u=se("minReleaseAge"),{excludes:p,minutes:l}=u?{excludes:void 0,minutes:void 0}:gt(e,t),f=u?void 0:r.minimumReleaseAge??l,q=u?void 0:r.minimumReleaseAgeExclude??p;if(u&&(r.minimumReleaseAge!==void 0||l!==void 0)&&s.info("minimumReleaseAge gate disabled via MARSHALL_DISABLE_MIN_RELEASE_AGE."),!u&&r.minimumReleaseAge!==void 0&&l!==void 0&&r.minimumReleaseAge!==l){const i=t==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";s.warn(`${G("⚠")} minimumReleaseAge mismatch: vis config = ${String(r.minimumReleaseAge)} min, ${i} = ${String(l)} min. Consider keeping them in sync.`)}const b=je(e),K=a["include-internal"],Q=a.peer,M=Fe(e,t,{depFields:r.depFields,dev:a.dev,includeInternal:K,peer:Q,prod:a.prod});if(M.size===0){s.info("No catalogs found.");return}const ke={...r,minimumReleaseAge:f,minimumReleaseAgeExclude:q},E=mt(a,ke,o);let H=0;for(const i of M.values())H+=i.size;const B=!!process.stdout.isTTY&&!fe;let T;const $e=B?(i,d)=>{T?T.rerender($.createElement(ie,{current:i,total:d})):(process.stdout.write(`
|
|
8
|
+
`),T=oe($.createElement(ie,{current:i,total:d}),{interactive:!0,patchConsole:!1}))}:(i,d)=>{s.info(`Checking ${String(i)}/${String(d)} dependencies...`)};B||s.info(`Checking ${String(H)} catalog dependencies...
|
|
9
|
+
`);const L=se("socket")?void 0:_e(n.security?.socket,n.security?.policies?.score?.minimum),{checkedCount:w,failed:y,filteredByTarget:h,ignored:A,outdated:g}=await qe(M,E,b,$e,e,L,n.security?.acceptedRisks);T&&(T.clear(),T.unmount());const O=K?{ignored:[],outdated:[]}:Be(e,{depFields:r.depFields,dev:a.dev,exclude:E.exclude,ignore:E.ignore,include:E.include,packageMode:E.packageMode,peer:Q,prod:a.prod,target:E.target});if(O.outdated.length>0){const i=new Set(g.map(d=>`${d.catalogName}|${d.packageName}`));for(const d of O.outdated)i.has(`${d.catalogName}|${d.packageName}`)||g.push(d)}if(O.ignored.length>0)for(const i of O.ignored)A.includes(i)||A.push(i);const ee=w-g.length-y.length;if(y.length>0&&s.warn(`Failed to fetch: ${y.join(", ")}`),A.length>0&&s.info(`Skipped ${String(A.length)} ignored package${A.length===1?"":"s"}: ${A.join(", ")}`),!B&&w>g.length){const i=[...M.values()].reduce((F,Y)=>F+Y.size,0),d=i>w?` (${String(i)} catalog entries, ${String(i-w)} duplicates)`:"";s.info(`Checked ${String(w)} unique packages${d}: ${String(g.length)} outdated, ${String(ee)} up-to-date${y.length>0?`, ${String(y.length)} failed`:""}${h.length>0?`, ${String(h.length)} skipped by target`:""}`)}if(g.length===0){h.length>0?s.info(`All catalog dependencies are up to date within the current target.
|
|
10
|
+
${String(h.length)} package${h.length===1?" has":"s have"} newer versions available with --target latest:
|
|
11
|
+
${h.map(i=>` ${i.packageName} ${i.currentRange} → ${i.newRange} (${i.updateType})`).join(`
|
|
12
|
+
`)}`):s.info("All catalog dependencies are up to date.");return}const U=a.format??r.format??"table";let R;if(a.ai){const i=Ye(a.aiType??"impact");R=await ze(g,s,n.ai,i)}const V=!!a.dryRun;if(B&&U==="table"){const i=new et(g,R??null);let d;if(a.changelog){s.info("Fetching changelogs...");const c=await me(g,void 0,b);d=new Map;for(const v of c){const C=v.releaseUrl??v.repoUrl??v.npmUrl;C&&d.set(v.packageName,C)}}const F=n.tui?.autoExit??!1,Y=F===!0?3:typeof F=="number"?F:0,te=await oe($.createElement(tt,{autoExitSeconds:Y,changelogUrls:d,checkedCount:w,filteredOutEntries:h,isDryRun:V,store:i,totalCatalogEntries:H}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),z=process.stdout.columns||80;process.stdout.write(`
|
|
13
|
+
`);for(const c of g){const v=c.vulnerabilities?.length||c.socketReport&&c.socketReport.alerts.length>0,C=!!c.acceptedRisk,J=v?C?"✓":"⚠":"✓",ye=C?"gray":c.updateType==="major"?"red":c.updateType==="minor"?"yellow":"green",P=c.socketReport?.score.overall,be=P===void 0?"":` [${String(Math.round(P*100))}%]`,ne=P===void 0?void 0:Le(P);process.stdout.write(`${X($.createElement(S,null," ",$.createElement(S,{color:ye},J),` ${c.packageName} ${c.currentRange} → ${c.newRange}`,$.createElement(S,{dimColor:!0},` ${c.updateType}`),ne?$.createElement(S,{color:ne},be):null),{columns:z})}
|
|
14
14
|
`)}if(process.stdout.write(`
|
|
15
|
-
`),
|
|
16
|
-
`);const
|
|
17
|
-
`);for(const
|
|
18
|
-
`)}const
|
|
19
|
-
Applying ${String(
|
|
20
|
-
`);const
|
|
21
|
-
`)}else
|
|
22
|
-
`),
|
|
23
|
-
`),
|
|
24
|
-
${
|
|
25
|
-
`),process.exitCode=
|
|
15
|
+
`),s.info(ge(g,L?.minimumScore)),w>g.length){const c=[...M.values()].reduce((C,J)=>C+J.size,0),v=c>w?` (${String(c)} catalog entries, ${String(c-w)} duplicates)`:"";s.info(` Checked ${String(w)} unique packages${v}: ${String(ee)} up-to-date${y.length>0?`, ${String(y.length)} failed`:""}`)}if(h.length>0){process.stdout.write(`
|
|
16
|
+
`);const c=`${String(h.length)} package${h.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${X($.createElement(S,{color:"yellow"},` ${c}`),{columns:z})}
|
|
17
|
+
`);for(const v of h)process.stdout.write(`${X($.createElement(S,null," ",$.createElement(S,{dimColor:!0},v.packageName),` ${v.currentRange} → ${v.newRange}`,$.createElement(S,{dimColor:!0},` ${v.updateType}`)),{columns:z})}
|
|
18
|
+
`)}const Z=Array.isArray(te)?te:[];if(Z.length>0&&!V){s.info(`
|
|
19
|
+
Applying ${String(Z.length)} updates...
|
|
20
|
+
`);const c={...a,install:a.install??r.install};await ue(e,t,Z,c,s,b,n.editorconfig??!0)}return}if(V){if(U==="json"){const i={failed:y,filteredByTarget:h,ignored:A,outdated:g};R&&(i.aiAnalysis=R),process.stdout.write(`${JSON.stringify(i,void 0,2)}
|
|
21
|
+
`)}else s.info(`Would update ${String(g.length)} dependencies:
|
|
22
|
+
`),ce(g,y,U,s,L?.minimumScore),R&&(s.info(""),s.info(re(R))),le(h,s);return}R&&U!=="json"&&(s.info(re(R)),s.info(""));let j=g;if(a.interactive&&(j=await Oe(g),j.length===0)){s.info("No updates selected.");return}s.info(`Updating ${String(j.length)} catalog dependencies...
|
|
23
|
+
`),ce(j,[],U,s,L?.minimumScore),le(h,s);const we={...a,install:a.install??r.install};await ue(e,t,j,we,s,b)},"executeCatalogUpdate"),ht=k((e,t,n,a,o,s)=>{const r={dev:a.dev,filters:N(a.filter),global:a.global,interactive:a.interactive,latest:a.latest||a.target==="latest",noOptional:a.optional===!1,noSave:a.save===!1,packages:o,prod:a.prod,recursive:a.recursive,workspaceRoot:a.workspaceRoot},{command:m,warnings:u}=ut(t,n,r);for(const l of u)s.warn(l);const p=`${m.bin} ${m.args.join(" ")}`.trim();if(a.dryRun){s.info(`Would run: ${p}`);return}s.info(`Running: ${p}`);try{pe(m.bin,m.args,{cwd:e,env:process.env,stdio:"inherit"})}catch(l){const f=l.status??1;s.error(`
|
|
24
|
+
${he("✖")} Update failed (exit code ${String(f)})`),s.error(` Command: ${p}`),s.error(` Directory: ${e}
|
|
25
|
+
`),process.exitCode=f}},"executePmWrapper"),vt=k(async(e,t,n)=>{const a=e.latest===!0||e.target==="latest";if(t||!a||e.dryRun===!0||e.yes===!0||e.interactive===!0)return!0;if(!(process.stdout.isTTY&&!fe))return n.error(`${he("✖")} Refusing to run blanket --latest update in a non-interactive context.`),n.error(" Re-run with --yes to confirm, --dry-run to preview, or pass explicit package names."),process.exitCode=1,!1;const o=Ce({input:process.stdin,output:process.stdout});try{const s=(await new Promise(r=>{o.question(`${G("⚠")} About to upgrade ALL dependencies to their latest versions. This may include breaking changes.
|
|
26
|
+
Continue? [y/N] `,r)})).trim().toLowerCase();return s==="y"||s==="yes"?!0:(n.info("Aborted."),!1)}finally{o.close()}},"requireBlanketUpdateConfirmation"),Mt=k(async({argument:e,logger:t,options:n,visConfig:a,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");let s=e;const r=o,{packageManager:m}=Pe(r);if(n.typosquatCheck!==!1){if(s.length>0){const u=s.map(f=>nt(f)),p=a?.security?.typosquatAllowlist,l=await Ke(u.map(f=>f.name),p);if(!l.ok){process.exitCode=1;return}s=u.map((f,q)=>{const b=l.packages[q];return b!==f.name?f.versionSpec?`${b}@${f.versionSpec}`:b??"":s[q]??""})}else if(!await Qe(r,a?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!Ie(r,m)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(De(r,m))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(s.length>0&&n.marshallCheck!==!1){const u=await Ze(s);if(u.length>0){const p=await Je(u,{config:a?.security?.marshalls,workspaceRoot:r});if(!await Xe(p)){process.exitCode=1;return}}}if(await vt(n,s.length>0,t))if(n.catalog!==!1&&We(r,m))await ft(r,m,a??{},n,s,t);else{const u=Ge(r,{configBackend:a?.install?.backend,configCorepack:a?.install?.corepack}),p=u.name==="aube"?"":He(u.name);ht(r,u.name,p,n,s,t)}},"execute");export{Mt as default,Nt as formatMinutesAsTimeString,pt as parseNpmReleaseAgeValue,ve as parseTimeStringToMinutes,gt as readPmNativeMinimumReleaseAge,vt as requireBlanketUpdateConfirmation};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)},"
|
|
3
|
-
`);
|
|
1
|
+
var M=Object.defineProperty;var R=(e,o)=>M(e,"name",{value:o,configurable:!0});import{createRequire as j}from"node:module";import{ay as _,az as v,aA as C,aB as B,aC as A,aD as p,aE as D,aF as V,aG as N,aH as F,aI as P,aJ as K,aK as O,aL as q,aM as Q,aN as G,aO as L,aP as W}from"./bin.js";import{M as J,i as b,Q as Y,$ as E,B as $}from"./config.js";import{v as U}from"../packem_shared/verify-07kUNTuP.js";const T=j(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=R(e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[o,i]=y.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return y.getBuiltinModule(e)}return T(e)},"__cjs_getBuiltinModule"),{stdin:x,stdout:z}=y,{createInterface:H}=I("node:readline/promises");var X=Object.defineProperty,Z=R((e,o)=>X(e,"name",{value:o,configurable:!0}),"n");const S=Z(async e=>{if(!x.isTTY)return!0;const o=H({input:x,output:z});try{const i=(await o.question(`${e} [Y/n] `)).trim().toLowerCase();return i===""||i==="y"||i==="yes"}finally{o.close()}},"confirm");var ee=Object.defineProperty,k=R((e,o)=>ee(e,"name",{value:o,configurable:!0}),"p");const te=[{description:"VisConfig.targetDefaults → VisConfig.tasks",next:"tasks",previous:"targetDefaults"},{description:"VisConfig.taskDefaults → VisConfig.scopedTasks",next:"scopedTasks",previous:"taskDefaults"},{description:"VisConfig.taskRunnerOptions → VisConfig.taskRunner",next:"taskRunner",previous:"taskRunnerOptions"},{description:"ScopedTasksBlock.scope → ScopedTasksBlock.match",next:"match",previous:"scope"},{description:"ScopedTasksBlock.targets → ScopedTasksBlock.tasks",next:"tasks",previous:"targets"}],oe=[{description:"VisTaskConfig.targets → VisTaskConfig.tasks",next:"tasks",previous:"targets"}],ie=k(e=>new RegExp(String.raw`(^|[\s,{(\[])(["']?)${e}\2(\s*:)`,"gmu"),"buildKeyRegex"),re=k((e,o)=>{let i=e;const r=[];for(const t of o){const d=ie(t.previous);d.test(i)&&(d.lastIndex=0,i=i.replace(d,(s,c,a,g)=>`${c}${a}${t.next}${a}${g}`),r.push(t))}return{applied:r,output:i}},"applyRenames"),h=k((e,o)=>re(e,o),"rewriteSource"),ne=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],se=new Set(["vis.task.cjs","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.mts","vis.task.ts"]),ae=k(e=>{for(const o of ne){const i=J(e,o);if(b(i))return i}},"findConfigFile"),ce=k(e=>{const o=[];try{for(const i of _(e,{includeDirs:!1,includeFiles:!0,includeSymlinks:!1,skip:[/node_modules/,/\.git/,/\.vis\b/,/dist\b/,/\.next\b/,/\.nuxt\b/]}))se.has(Y(i.path))&&o.push(i.path)}catch{}return o},"findTaskConfigFiles"),ge=k((e,o,i,r)=>{const t=ae(e);if(t){const s=E(t),{applied:c,output:a}=h(s,te);if(c.length===0)i.info(`${t} already uses the current schema — no rewrite needed.`);else if(o.dryRun)i.info(`── ${t} (preview) ──`),i.info(a),i.info("── end preview ──"),i.info(`Would apply ${String(c.length)} rename(s): ${c.map(g=>g.description).join(", ")}`);else{v(t,r),$(t,a),i.info(`Rewrote ${t} (backup at ${t}.bak). Applied ${String(c.length)} rename(s).`);for(const g of c)r.manualSteps.push(`Renamed ${g.description} in ${t}`)}}else i.warn("No vis.config.ts found at workspace root — nothing to migrate."),r.warnings.push("No vis.config.{ts,mts,cts,js,mjs,cjs} at workspace root.");const d=o.taskConfigPaths??ce(e);for(const s of d){if(!b(s))continue;const c=E(s),a=h(c,oe);if(a.applied.length!==0)if(o.dryRun)i.info(`── ${s} (preview) ──`),i.info(a.output),i.info("── end preview ──"),i.info(`Would apply ${String(a.applied.length)} rename(s): ${a.applied.map(g=>g.description).join(", ")}`);else{v(s,r),$(s,a.output),i.info(`Rewrote ${s} (backup at ${s}.bak). Applied ${String(a.applied.length)} rename(s).`);for(const g of a.applied)r.manualSteps.push(`Renamed ${g.description} in ${s}`)}}},"migrateSelf");var pe=Object.defineProperty,n=R((e,o)=>pe(e,"name",{value:o,configurable:!0}),"r");const f=n(e=>{const o=e.workspaceRoot??process.cwd(),i=e.visConfig??{};return{config:i,dryRun:!!e.options.dryRun,logger:e.logger,packageManager:B(o),report:C(),root:o,useEditorconfig:typeof i.editorconfig=="boolean"?i.editorconfig:!0}},"buildContext"),u=n(async(e,o,i)=>{if(o.yes||o.dryRun)return!0;const r=await S(`This will edit files, scripts, and hooks for "${e}". Backups (.bak) will be created. Continue?`);return r||i.info("Aborted."),r},"maybeConfirm"),l=n(e=>{e.dryRun&&e.logger.info(`Running in dry-run mode — no changes will be made.
|
|
2
|
+
`)},"announceDryRun"),fe=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("deps",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating dependencies and scripts ──"),A(t.root,t.packageManager,t.config,{dryRun:t.dryRun},e,t.report),e.info(""),p(t.report,e)},"migrateDepsExecuteImpl"),ue=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("lint-staged",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating lint-staged ──"),D(t.root,{dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateLintStagedExecuteImpl"),le=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("nano-staged",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating nano-staged ──"),V(t.root,{dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateNanoStagedExecuteImpl"),de=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("turborepo",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating turborepo ──"),N(t.root,{dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateTurborepoExecuteImpl"),me=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("nx",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating nx ──"),F(t.root,{dryRun:t.dryRun,force:!!o.force,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateNxExecuteImpl"),ye=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("moon",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating moon ──"),P(t.root,{copyTemplates:!!o.copyTemplates,dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateMoonExecuteImpl"),ke=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("gitleaks",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating gitleaks ──"),K(t.root,{dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateGitleaksExecuteImpl"),Re=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("kingfisher",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating Kingfisher ──"),O(t.root,{dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateKingfisherExecuteImpl"),we=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("secretlint",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating secretlint ──"),q(t.root,{dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateSecretlintExecuteImpl"),ve=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("syncpack",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating syncpack ──"),Q(t.root,{dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateSyncpackExecuteImpl"),xe=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("sherif",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating sherif ──"),G(t.root,{dryRun:t.dryRun,useEditorconfig:t.useEditorconfig},e,t.report),e.info(""),p(t.report,e)},"migrateSherifExecuteImpl"),Ee=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{if(!await u("self",o,e))return;const t=f({logger:e,options:o,visConfig:i,workspaceRoot:r});l(t),e.info("── Migrating vis.config.ts to current schema ──"),ge(t.root,{dryRun:t.dryRun},e,t.report),e.info(""),p(t.report,e)},"migrateSelfExecuteImpl"),$e=n(({logger:e,workspaceRoot:o})=>{const i=o??process.cwd();U(i,e).length>0&&(process.exitCode=1)},"migrateVerifyExecuteImpl"),he=n(async({logger:e,options:o,visConfig:i,workspaceRoot:r})=>{const t=r??process.cwd(),d=L(t,i??{}),s=W(d);if(s.length===0){e.info("No applicable migrations detected in this workspace.");return}const c=!!o.dryRun;e.info(`Detected ${String(s.length)} migration(s):`);for(const m of s)e.info(` • ${m.title} — ${m.description}`);if(e.info(""),!o.yes&&!c&&!await S("Apply all detected migrations? Backups (.bak) will be created.")){e.info("Aborted.");return}c&&e.info(`Running in dry-run mode — no changes will be made.
|
|
3
|
+
`);const a=C(),g=[];for(const m of s)try{if(e.info(`── Applying ${m.title} ──`),c)for(const w of m.probe(d))e.info(w);else m.apply(d,a,e);e.info("")}catch(w){g.push({error:w,id:m.id}),e.warn(`Failed to apply ${m.title}: ${w.message}`)}p(a,e),g.length>0&&(e.warn(""),e.warn(`${String(g.length)} migration(s) failed — see messages above.`),process.exitCode=1)},"migrateAllExecuteImpl"),Te=fe,Ie=ue,_e=le,Be=de,Ae=me,De=ye,Ve=ke,Ne=Re,Fe=we,Pe=ve,Ke=xe,Oe=Ee,qe=$e,Qe=he;export{Qe as migrateAllExecute,Te as migrateDepsExecute,Ve as migrateGitleaksExecute,Ne as migrateKingfisherExecute,Ie as migrateLintStagedExecute,De as migrateMoonExecute,_e as migrateNanoStagedExecute,Ae as migrateNxExecute,Fe as migrateSecretlintExecute,Oe as migrateSelfExecute,Ke as migrateSherifExecute,Pe as migrateSyncpackExecute,Be as migrateTurborepoExecute,qe as migrateVerifyExecute};
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)
|
|
3
|
-
`)}
|
|
4
|
-
${p(`Enter choice (1-${String(r.length)}):`)} `);if(n===""&&s!==void 0)return s;const i=Number.parseInt(n,10);if(Number.isInteger(i)&&i>=1&&i<=r.length)return r[i-1];const a=r.find(o=>o===n);if(a)return a;process.stderr.write(` ${p("Invalid choice. Try again.")}
|
|
5
|
-
`)}},"selectOne"),_e=v(async(t,e,r,s)=>{process.stderr.write(` ${e} ${p("(comma-separated numbers)")}
|
|
6
|
-
`);for(const[n,i]of r.entries()){const a=b(T(` ${String(n+1)}.`)),o=s.includes(i)?p(" (default)"):"";process.stderr.write(`${a} ${i}${o}
|
|
7
|
-
`)}for(;;){const n=await M(t,`
|
|
8
|
-
${p("Enter choices:")} `);if(n===""&&s.length>0)return s;const i=n.split(",").map(a=>Number.parseInt(a.trim(),10)).filter(a=>Number.isInteger(a)&&a>=1&&a<=r.length);if(i.length>0)return i.map(a=>r[a-1]);process.stderr.write(` ${p("Invalid choice. Try again.")}
|
|
9
|
-
`)}},"selectMany"),Pe=v(t=>` ${p(`${t}:`)} `,"promptText"),De=v((t,e)=>e.prompt??t,"variableLabel"),We=v(t=>Object.entries(t).sort(([e,r],[s,n])=>{const i=r.order??0,a=n.order??0;return i!==a?i-a:e.localeCompare(s)}),"sortVariables"),H=v((t,e)=>{switch(t.type){case"array":return e.split(",").map(r=>r.trim()).filter(Boolean);case"boolean":return e==="true"||e==="1"||e==="yes"||e==="y";case"enum":return t.multiple?e.split(",").map(r=>r.trim()).filter(Boolean):e;case"number":{const r=Number(e);if(Number.isNaN(r))throw new TypeError(`Expected a number, got "${e}"`);return r}default:return e}},"parseValue"),F=v((t,e,r)=>{if(e.type==="enum"){const s=Array.isArray(r)?r:[r];for(const n of s)if(typeof n!="string"||!e.values.includes(n))throw new Error(`Variable "${t}" must be one of: ${e.values.join(", ")} (got "${String(n)}")`)}},"validateValue"),Be=v(async t=>{const{defaults:e,interactive:r,overrides:s,variables:n}=t,i={},a=r?me({input:process.stdin,output:process.stderr}):null;try{for(const[o,c]of We(n)){if(Object.hasOwn(s,o)){const $=H(c,s[o]??"");F(o,c,$),i[o]=$;continue}if(e||!r||c.internal){if(c.default!==void 0){F(o,c,c.default),i[o]=c.default;continue}if(c.required)throw new Error(`Required variable "${o}" not provided. Pass --${o}=<value> or remove --defaults.`);continue}const g=De(o,c);let m;if(c.type==="boolean")m=await ke(a,g,!!(c.default??!1));else if(c.type==="enum")if(c.multiple){const $=Array.isArray(c.default)?c.default:[];m=await _e(a,g,c.values,$)}else{const $=typeof c.default=="string"?c.default:void 0;m=await xe(a,g,c.values,$)}else{const $=c.default===void 0?"":` (${String(c.default)})`,S=await M(a,Pe(`${g}${$}`));if(S===""&&c.default!==void 0)m=c.default;else if(S===""){if(c.required)throw new Error(`Variable "${o}" is required`);continue}else m=H(c,S)}F(o,c,m),i[o]=m}return i}finally{a?.close()}},"collectOptions");var Ie=Object.defineProperty,V=j((t,e)=>Ie(t,"name",{value:e,configurable:!0}),"o");const qe=["git://","npm://","https://","github:","gitlab:","bitbucket:","sourcehut:"],Me=V(t=>qe.some(e=>t.startsWith(e)),"isRemoteSource"),Ce=V(async(t,e={})=>{const r=e.targetDirectory===void 0,s=e.targetDirectory??he(N($e(),"vis-generate-")),n=V(()=>{if(r)try{ge(s,{force:!0,recursive:!0})}catch{}},"cleanup");l.info(`Downloading ${t}…`);try{const i=await we(t,{auth:e.auth||process.env.GIGET_AUTH||process.env.GITHUB_TOKEN||process.env.GH_TOKEN||void 0,dir:s,force:!0,preferOffline:e.preferOffline});return{cleanup:n,directory:i.dir}}catch(i){n();const a=i instanceof Error?i.message:String(i);throw l.warn(`Failed to download template: ${a}`),i}},"fetchRemoteTemplate");var Ae=Object.defineProperty,R=j((t,e)=>Ae(t,"name",{value:e,configurable:!0}),"a");const re=R((t,e="")=>{const r=[];for(const[s,n]of Object.entries(t)){const i=e?`${e}/${s}`:s;typeof n=="string"||Buffer.isBuffer(n)?r.push({content:n,path:i}):n&&typeof n=="object"&&r.push(...re(n,i))}return r},"flattenTree"),Fe=R(t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,"formatSize"),Le=R((t,e)=>{if(L(e))throw new Error(`Refusing to write outside destination: template produced absolute path "${e}".`);const r=N(t,e),s=X(t,r);if(s===".."||s.startsWith(`..${pe}`)||L(s))throw new Error(`Refusing to write outside destination: "${e}" resolves to "${r}" which escapes "${t}".`);return r},"safeJoinDestination"),Ve=R((t,e)=>{Z(Q(t)),fe(t,e)},"writeOne"),Ke=R((t,e,r=!1)=>{const s=typeof t=="string"?[t]:t.commands,n=typeof t=="string"?r:t.silent??r;for(const i of s){n||l.info(`$ ${i}`);const a=ye(i,{cwd:e,shell:!0,stdio:n?"ignore":"inherit"});if(a.status!==0)return l.warn(`Script failed (exit ${String(a.status)}): ${i}`),!1}return!0},"runScript"),ze=R(t=>{const e=new Map;for(const r of t){const s=typeof r=="string"?0:r.phase??0,n=e.get(s);n?n.push(r):e.set(s,[r])}return[...e.entries()].sort(([r],[s])=>r-s)},"groupByPhase"),Ue=R(async(t,e)=>{const r={builtins:{dest_dir:e.destination,dest_rel_dir:X(e.workspaceRoot,e.destination)||".",working_dir:e.cwd,workspace_root:e.workspaceRoot},options:e.options},s=await t.produce(r),n=s.files?re(s.files):[],i=s.filesMeta??{},a=[];for(const o of n){const c=Le(e.destination,o.path);a.push({file:o,meta:i[o.path]??{},target:c})}if(e.dryRun){l.info(`${b(T("Plan"))} ${p("(dry-run, no files written)")}`);for(const o of a){const c=Buffer.isBuffer(o.file.content)?o.file.content.length:Buffer.byteLength(o.file.content,"utf8");process.stderr.write(` ${p("write")} ${o.file.path} ${p(`(${Fe(c)})`)}
|
|
10
|
-
`)}}else{Z(e.destination);let o=0,c=0;for(const g of a){const{file:m,meta:$,target:S}=g,C=_(S),O=e.force||$.force===!0;if(C&&!O){l.warn(`Skipped existing file: ${m.path} (use --force or set frontmatter force: true to overwrite)`),c+=1;continue}Ve(S,m.content),o+=1}l.success(`Wrote ${String(o)} file${o===1?"":"s"}${c>0?`, skipped ${String(c)}`:""}`)}if(!e.dryRun&&!e.skipScripts&&s.scripts&&s.scripts.length>0){const o=ze(s.scripts);l.info(`Running ${String(s.scripts.length)} script${s.scripts.length===1?"":"s"} across ${String(o.length)} phase${o.length===1?"":"s"}…`);for(const[,c]of o)if((await Promise.all(c.map(g=>Promise.resolve(Ke(g,e.destination))))).includes(!1))throw new Error("Script failed — aborting.")}if(s.suggestions&&s.suggestions.length>0){process.stderr.write(`
|
|
11
|
-
`),l.notice("Next steps:");for(const o of s.suggestions)process.stderr.write(` ${p("•")} ${o}
|
|
12
|
-
`)}},"runTemplate");var Ge=Object.defineProperty,w=j((t,e)=>Ge(t,"name",{value:e,configurable:!0}),"u");const Je=w(async t=>{let e;try{e=(await t.load()).about?.description}catch{}return{description:e,name:t.name,path:t.path,source:t.source}},"toListEntry"),He=w((t,e)=>{const r={default:e.default,name:t,order:e.order,prompt:e.prompt,required:e.required,type:e.type};return e.type==="enum"&&(r.multiple=e.multiple,r.values=e.values),r},"summarizeVariable"),Ye=w(async t=>{const e=await t.load(),r=Object.entries(e.options??{}).sort(([s,n],[i,a])=>{const o=n.order??0,c=a.order??0;return o===c?s.localeCompare(i):o-c}).map(([s,n])=>He(s,n));return{description:e.about?.description??"",destination:e.destination,name:t.name,path:t.path,source:t.source,variables:r}},"describeTemplate"),Qe=w(t=>{if(t.length===0){l.info("No templates found."),l.notice("Create one at .vis/templates/<name>.ts (programmatic) or .vis/templates/<name>/ (moon-format with template.yml).");return}l.info("Available templates:");for(const e of t){const r=p(`(${e.source})`);process.stderr.write(` ${b(T(e.name))} ${r}
|
|
13
|
-
`)}},"printList"),Xe=w(t=>{const e={},r=[];for(const s of t){if(!s.startsWith("--")){r.push(s);continue}const n=s.indexOf("=");if(n===-1){const o=s.slice(2);o.startsWith("no-")?e[o.slice(3)]="false":e[o]="true";continue}const i=s.slice(2,n),a=s.slice(n+1);e[i]=a}return{overrides:e,remaining:r}},"parsePassthroughOverrides"),Ze=w(async t=>{const{createInterface:e}=await import("node:readline"),r=e({input:process.stdin,output:process.stderr});try{process.stderr.write(` ${b(T("vis generate"))} ${p("— pick a template")}
|
|
1
|
+
var J=Object.defineProperty;var $=(e,o)=>J(e,"name",{value:o,configurable:!0});import{createRequire as T}from"node:module";import{$ as U,g as q,z as L,M as P,B as K,w as z}from"./config.js";import{o as V}from"../packem_shared/index-DH-5hsrC.js";import{aR as N,y as Y,aS as Q,ad as X}from"./bin.js";import{i as Z}from"../packem_shared/glob-MHJQjR39-CQ2GC0b_.js";import{n as ee}from"../packem_shared/manifests-B0fMp872.js";const W=T(import.meta.url),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,G=$(e=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[o,n]=E.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return E.getBuiltinModule(e)}return W(e)},"__cjs_getBuiltinModule"),{readFileSync:H}=G("node:fs");var oe=Object.defineProperty,j=$((e,o)=>oe(e,"name",{value:o,configurable:!0}),"c");const ne=j((e,o)=>{const n=o.replace(/^\.?\//,"");return n===""||n==="."?`/${e}/`:e===""||e==="."?`/${n}`:`/${e}/${n}`},"toWorkspacePath"),F=j((e,o,n=[])=>{const r=[],t=new Set;for(const[s,i]of Object.entries(o?.globalPaths??{}))r.push({owners:i,path:s,source:"project-json"}),t.add(s);for(const[s,i]of Object.entries(e.projects)){const c=i.owners??[];for(const a of c){const d=ne(i.root??s,a.path);r.push({channel:a.channel,owners:a.owners,path:d,projectId:s,source:"project-json"}),t.add(d)}}for(const s of n)t.has(s.path)||(r.push(s),t.add(s.path));return(o?.orderBy??"file-source")==="project-id"?r.sort((s,i)=>(s.projectId??"").localeCompare(i.projectId??"")||s.path.localeCompare(i.path)):r.sort((s,i)=>s.path.localeCompare(i.path)),r},"buildCodeownersLines"),te="Update each project's project.json `owners` field and re-run the command.",re=j(e=>["# CODEOWNERS — generated by `vis sync codeowners`. Do not edit by hand.",e?`# Re-run with: ${e}`:`# ${te}`,""],"buildHeader"),M=j(e=>{const o=[];for(const n of e){const r=n.owners.join(" "),t=n.channel?` # notify: ${n.channel}`:"";o.push(`${n.path} ${r}${t}`)}return o},"renderEntries"),se=j((e,o={})=>[...re(o.regenerationCommand),...M(e),""].join(`
|
|
2
|
+
`),"renderCodeowners"),_={begin:"# BEGIN vis-codeowners",end:"# END vis-codeowners"},ie=j((e,o=_,n={})=>{const r=n.regenerationCommand?`# Generated by vis sync codeowners — re-run with: ${n.regenerationCommand}`:"# Generated by `vis sync codeowners` — do not edit by hand.";return[o.begin,r,...M(e),o.end].join(`
|
|
3
|
+
`)},"renderCodeownersBlock"),ce=j((e,o,n=_)=>{const r=e.indexOf(n.begin),t=e.indexOf(n.end);if(r!==-1&&t!==-1&&t>r){const i=e.slice(0,r),c=t+n.end.length,a=e.slice(c);return`${i}${o}${a}`}const s=e.replace(/\s+$/u,"");return`${s.length===0?"":`${s}
|
|
14
4
|
|
|
15
|
-
`
|
|
16
|
-
`)}return new
|
|
17
|
-
|
|
18
|
-
`);return}Qe(u);return}if(e.describe){const u=c[0];if(!u)throw new Error("`--describe` requires a template name. Run `vis generate --list` to see available templates.");const f=q({extraDirectories:o?.templates??[],onWarning:w(h=>{l.warn(h)},"onWarning"),workspaceRoot:a}).find(h=>h.name===u);if(!f)throw new Error(`Template "${u}" not found. Run \`vis generate --list\` to see available templates.`);const d=await Ye(f);if(e.json){process.stdout.write(`${JSON.stringify(d,null,2)}
|
|
19
|
-
`);return}if(l.info(`Template: ${b(T(d.name))} ${p(`(${d.source})`)}`),d.description&&l.info(d.description),d.destination&&l.info(`Destination: ${p(d.destination)}`),d.variables.length===0)l.info("No variables.");else{l.info("Variables:");for(const h of d.variables){const B=[h.type];h.required&&B.push("required"),h.default!==void 0&&B.push(`default=${JSON.stringify(h.default)}`),h.values&&B.push(`values=${h.values.join("|")}`),process.stderr.write(` ${b(T(h.name))} ${p(`(${B.join(", ")})`)}
|
|
20
|
-
`)}}return}let g=[...r??[]];if(g.length===0){const u=process.argv.slice(2),f=u.indexOf("--");f!==-1&&(g=u.slice(f+1))}const m=c.indexOf("--"),$=m===-1?[]:c.slice(m+1),S=m===-1?c:c.slice(0,m),{overrides:C}=Xe([...$,...g]);let O,D,W;const k=S[0];let A;if(k&&Me(k)){const u=await Ce(k,{auth:o?.auth,preferOffline:!!e.preferOffline||o?.preferOffline});A=u.cleanup;try{const f=q({extraDirectories:[u.directory],workspaceRoot:a}).find(d=>d.path.startsWith(u.directory));if(!f)throw new Error(`Downloaded template at ${u.directory} contains no template.yml or *.ts entrypoint.`);O=await f.load(),D=f.name,W=O.destination}catch(f){throw A(),f}}else{const u=q({extraDirectories:o?.templates??[],onWarning:w(h=>{l.warn(h)},"onWarning"),workspaceRoot:a});if(u.length===0)throw new Error("No templates found. Create one at .vis/templates/<name>.ts or .vis/templates/<name>/template.yml.");let f;if(k)f=k;else{if(e.interactive===!1||!process.stdin.isTTY)throw new Error("No template specified. Pass a template name (see `vis generate --list`) or run interactively in a terminal.");f=await Ze(u)}const d=u.find(h=>h.name===f);if(!d)throw new Error(`Template "${f}" not found. Run 'vis generate --list' to see available templates.`);O=await d.load(),D=d.name,W=O.destination}const K=e.to,z=!!e.dryRun,se=!!e.force,U=!!e.defaults,oe=!!e.skipScripts,ne=e.interactive!==!1&&!!process.stdin.isTTY&&!U;let E;K?E=K:W?E=W:E=".";const G=L(E)?E:ue(i,E);l.info(`Template: ${b(T(D))}`),l.info(`Target: ${p(G)}`),process.stderr.write(`
|
|
21
|
-
`);const ie=await Be({defaults:U,interactive:ne,overrides:C,variables:O.options??{}});try{await Ue(O,{cwd:i,destination:G,dryRun:z,force:se,options:ie,skipScripts:oe,workspaceRoot:a}),z||(process.stderr.write(`
|
|
22
|
-
`),l.success(`Template '${D}' applied.`))}finally{A?.()}},"execute");export{nt as default};
|
|
5
|
+
`}${o}
|
|
6
|
+
`},"mergeIntoExisting");var ae=Object.defineProperty,O=$((e,o)=>ae(e,"name",{value:o,configurable:!0}),"f$1");const le=["**/CODEOWNERS"],de=["**/node_modules/**","**/dist/**","**/build/**","**/coverage/**","**/.git/**","**/.next/**","**/.nuxt/**"],fe=O(e=>{const o=[];for(const n of e.split(/\r?\n/u)){const r=n.indexOf("#"),t=(r===-1?n:n.slice(0,r)).trim();if(t.length===0)continue;const s=t.split(/\s+/u);if(s.length<2)continue;const[i,...c]=s,a=c.filter(d=>d.length>0);!i||a.length===0||o.push({owners:a,path:i})}return o},"parseCodeownersFile"),ue=O((e,o)=>{const n=o.replace(/^\.\/?/,"").replace(/\/$/,"");return e.startsWith("/")?n===""?e:`/${n}${e}`:n===""?`/${e}`:`/${n}/${e}`},"rewriteNestedPath"),pe=O(async(e,o,n)=>{const r=o&&o.length>0?[...o]:[...le],t=[...de];if(n){const c=n.replace(/^\.\/?/,"").replace(/^\/+/,"");c.length>0&&t.push(c)}const s=await Z(r,{absolute:!0,cwd:e,ignore:t}),i=[];for(const c of s){let a;try{a=U(c)}catch{continue}const d=q(c),h=L(e,d);for(const w of fe(a))i.push({owners:w.owners,path:ue(w.path,h)})}return i},"collectNestedCodeownersLines"),ge=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)/iu,he=O(e=>{if(!e)return;const o=e.match(ge);if(!o?.[1])return;const n=o[1].trim();if(!(n===""||n.includes(" ")))return`@${n.replace(/^@/,"")}`},"extractGitHubHandle"),we=O((e,o)=>{const n=[];for(const[r,t]of Object.entries(e.projects)){if(t.owners&&t.owners.length>0)continue;const s=t.root??r,i=P(o,s,"package.json"),c=N(i);if(!c)continue;const a=ee(c.maintainers);if(!a||a.length===0)continue;const d=[],h=new Set;for(const w of a){const m=he(w.url);m&&!h.has(m)&&(h.add(m),d.push(m))}d.length!==0&&n.push({owners:d,path:s===""||s==="."?"/":`/${s}/`,projectId:r})}return n},"collectMaintainerLines");var me=Object.defineProperty,b=$((e,o)=>me(e,"name",{value:o,configurable:!0}),"s");const ye=["author","bugs","homepage","license","repository","engines"],S=b(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isPlainObject"),x=b((e,o)=>{if(e===o)return!0;if(typeof e!=typeof o||e===null||o===null)return!1;if(Array.isArray(e)){if(!Array.isArray(o)||e.length!==o.length)return!1;for(const[n,r]of e.entries())if(!x(r,o[n]))return!1;return!0}if(typeof e=="object"&&typeof o=="object"){const n=Object.keys(e),r=Object.keys(o);if(n.length!==r.length)return!1;for(const t of n)if(!x(e[t],o[t]))return!1;return!0}return!1},"deepEqual"),A=b(e=>e===void 0?e:structuredClone(e),"cloneJson"),ke=b((e,o,n)=>{if(e==="repository"&&S(o)&&S(n)){const r={};for(const[t,s]of Object.entries(o))t!=="directory"&&(r[t]=A(s));return typeof n.directory=="string"&&(r.directory=n.directory),r}return A(o)},"buildTargetValue"),je=b((e,o,n)=>{const r=[];for(const t of n.fields){if(!Object.hasOwn(e,t))continue;const s=e[t],i=o[t],c=ke(t,s,i);x(c,i)||r.push({after:c,before:i,field:t,packageJsonPath:""})}return r},"computeFieldChanges"),$e=b((e,o)=>{for(const n of o)e[n.field]=n.after},"applyFieldChanges");var be=Object.defineProperty,C=$((e,o)=>be(e,"name",{value:o,configurable:!0}),"u");const B=new Set(["nested-codeowners","package-json-maintainers","project-json"]),D=C((e,o,n)=>{const r=new Set,t=[];for(const s of e??[])for(const i of s.split(",")){const c=i.trim();if(c.length===0)continue;if(n&&!n(c))throw new Error(`Unknown codeowners source: "${c}". Known: ${[...B].join(", ")}.`);const a=c;r.has(a)||(r.add(a),t.push(a))}return t.length>0?t:[...o]},"parseCsvOption"),Ce=C(e=>B.has(e),"isCodeownersSource"),I=["codeowners","package-json-fields"],ve=C((e,o)=>o.some(n=>V(n,e)),"matchesAnyGlob"),Ee=C(async({logger:e,options:o,visConfig:n,workspaceRoot:r})=>{const t=r,{workspace:s}=Y(t,n),i=n?.codeowners,c=D(o.from,i?.sources??["project-json"],Ce),a=o.regenerationCommand??i?.regenerationCommand,d=o.preserveBlock===!0||i?.preserveBlock===!0,h=i?.blockMarker??_,w=o.nestedIncludes??i?.nestedIncludes,m=o.out??"CODEOWNERS",u=[];if(c.includes("nested-codeowners")){const g=await pe(t,w,m);for(const k of g)u.push({...k,source:"nested"})}if(c.includes("package-json-maintainers")){const g=we(s,t);for(const k of g)u.push({...k,source:"maintainers"})}const y=c.includes("project-json")?F(s,i,u):F({projects:{}},i,u);if(y.length===0){e.info("No `owners` entries found in any source. Nothing to sync.");return}const f=P(t,m);let v="";try{v=H(f,"utf8")}catch(g){if(g.code!=="ENOENT")throw g}const l={regenerationCommand:a},p=d?ce(v,ie(y,h,l),h):se(y,l);if(o.check){if(v.trim()!==p.trim()){e.error(`${f} is out of date. Run \`vis sync codeowners\` to update it.`),process.exitCode=1;return}e.info(`${f} is up to date.`);return}K(f,p),e.info(`Wrote ${y.length} entries to ${f}`)},"runCodeowners"),Oe=C(({logger:e,options:o,visConfig:n,workspaceRoot:r})=>{const t=r,s=n?.editorconfig??!0,i=N(P(t,"package.json"));if(!i){e.error("Could not read root package.json. Nothing to sync."),process.exitCode=1;return}const c=D(o.fields,ye),a=o.ignorePackageName??[],d=o.check===!0,h=(o.format??"human").toLowerCase(),w=o.quiet===!0,m=Q(t).filter(l=>l!=="."),u=[];let y=0;for(const l of m){const p=P(t,l,"package.json"),g=N(p);if(!g)continue;const k=typeof g.name=="string"?g.name:void 0;if(k!==void 0&&a.length>0&&ve(k,a))continue;y+=1;const R=je(i,g,{fields:c});R.length!==0&&u.push({filePath:p,packageJsonPath:L(t,p),packageName:k,pkg:g,pkgChanges:R})}if(!d)for(const l of u)$e(l.pkg,l.pkgChanges),z(l.filePath,l.pkg,{indent:X(l.filePath,{useEditorconfig:s}),overwrite:!0});const f=u.flatMap(l=>l.pkgChanges.map(p=>({after:p.after,before:p.before,field:p.field,packageJsonPath:l.packageJsonPath,packageName:l.packageName}))),v={changes:f,fields:c,kind:"package-json-fields",mode:d?"check":"write",totalChanges:f.length,totalPackages:y};if(h==="json")process.stdout.write(`${JSON.stringify(v,null,4)}
|
|
7
|
+
`);else if(f.length===0)e.info(`All ${y} package${y===1?"":"s"} in sync (fields: ${c.join(", ")}).`);else if(d){if(!w)for(const l of f)e.error(`${l.packageJsonPath}: ${l.field} drifts from root`);e.error(`Found ${f.length} field drift${f.length===1?"":"s"} across ${u.length} package${u.length===1?"":"s"}. Run \`vis sync package-json-fields\` to fix.`)}else{if(!w)for(const l of u)e.info(`${l.packageJsonPath}: synced ${l.pkgChanges.map(p=>p.field).join(", ")}`);e.info(`Synced ${f.length} field${f.length===1?"":"s"} across ${u.length} package${u.length===1?"":"s"}.`)}d&&f.length>0&&(process.exitCode=1)},"runPackageJsonFields"),Ae=C(async e=>{const o=e.argument[0];if(!o)throw new Error(`Missing sync kind. Usage: vis sync <kind> (known kinds: ${I.join(", ")})`);if(!e.workspaceRoot)throw new Error("Could not determine workspace root. Run inside a monorepo.");if(o==="codeowners"){await Ee(e);return}if(o==="package-json-fields"){Oe(e);return}throw new Error(`Unknown sync kind: "${o}". Known kinds: ${I.join(", ")}.`)},"execute");export{Ae as default};
|