@visulima/vis 7.1.0-next.6 → 7.1.0-next.7
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 +59 -0
- package/README.md +1 -1
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +227 -12
- package/dist/packem_chunks/CONFIG_FILES.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -1
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +57 -57
- package/dist/packem_chunks/detect.js +4 -4
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.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/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.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 +2 -2
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +1 -1
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +22 -3
- package/dist/packem_chunks/handler62.js +2 -22
- package/dist/packem_chunks/handler63.js +6 -2
- package/dist/packem_chunks/handler64.js +8 -61
- package/dist/packem_chunks/handler65.js +2 -6
- package/dist/packem_chunks/handler66.js +12 -8
- package/dist/packem_chunks/handler67.js +5 -2
- package/dist/packem_chunks/handler68.js +25 -12
- package/dist/packem_chunks/handler69.js +50 -25
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +153 -50
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +1 -1
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +1 -1
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/handler79.js +64 -64
- 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/index7.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +2 -2
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/workflow-templates.js +29 -32
- package/dist/packem_shared/{advisories-BnFPhsl1.js → advisories-CyXUdibZ.js} +1 -1
- package/dist/packem_shared/{affected-selection-Bd03KJU3.js → affected-selection-CJnDzyIK.js} +1 -1
- package/dist/packem_shared/affected-shas-CJLirD2O.js +1 -0
- package/dist/packem_shared/{ai-analysis-GjV2rF4U.js → ai-analysis-DHlzow2O.js} +1 -1
- package/dist/packem_shared/{ai-cache-DFKUyj11.js → ai-cache-D-BSLcuJ.js} +1 -1
- package/dist/packem_shared/{ai-fix-DpBEXHZT.js → ai-fix-CyExJC_c.js} +1 -1
- package/dist/packem_shared/{augment-BSeqaai8.js → augment-Ub6PCwbh.js} +1 -1
- package/dist/packem_shared/{bin-D1zq7wxi.js → bin-BaReRSyo.js} +1 -1
- package/dist/packem_shared/{build-scripts-mKGcgTzp.js → build-scripts-BeJkep8z.js} +1 -1
- package/dist/packem_shared/ci-commands-4W9d2six.js +1 -0
- package/dist/packem_shared/{command-runtime-DG49t2MT.js → command-runtime-DdnpiUmN.js} +1 -1
- package/dist/packem_shared/{dependency-scan-BGKZYS_i.js → dependency-scan-CyByCwef.js} +1 -1
- package/dist/packem_shared/{detect-CaA92iu_.js → detect-xqoTANJb.js} +1 -1
- package/dist/packem_shared/{docker-Cs174Imq.js → docker-CJXAt5Au.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-DcpvfgEi.js → ecosystem-gate-DEnubRcS.js} +1 -1
- package/dist/packem_shared/{env-sb3SOT-b.js → env-NauRSSEC.js} +1 -1
- package/dist/packem_shared/{env-consistency-nSuzisQe.js → env-consistency-Cl1Rg65z.js} +1 -1
- package/dist/packem_shared/{failure-log-AtaeZOrx.js → failure-log-DwroazKs.js} +1 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-BtN6Zzwg.js +1 -0
- package/dist/packem_shared/{index-CclzWrJ5.js → index-BCEhCrLl.js} +1 -1
- package/dist/packem_shared/{index-C_7lOmB0.js → index-OmE1O0Ys.js} +1 -1
- package/dist/packem_shared/{index-0dnGN3GP.js → index-zq6Ehql6.js} +1 -1
- package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-CBsMZhj-.js → isAccessibleSync-DYKTrrvc-CKahNmLy.js} +1 -1
- package/dist/packem_shared/{lifecycle-BzenugED.js → lifecycle-Cn1mSP5f.js} +1 -1
- package/dist/packem_shared/{lockfile-DEWjBrlY.js → lockfile-Cx2Ny3um.js} +1 -1
- package/dist/packem_shared/{manifests-DPwVdkqB.js → manifests-BEGTH1ZG.js} +1 -1
- package/dist/packem_shared/{min-release-age-BH4JKSXA.js → min-release-age-DLAERxRt.js} +1 -1
- package/dist/packem_shared/{missing-package-json-ByjsDBbk.js → missing-package-json-w74qGfyh.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-Bz9ViPBV.js → multi-eco-lockfiles-SATPXx6-.js} +1 -1
- package/dist/packem_shared/{native-config-sync-DI7_xs-Q.js → native-config-sync-DDFn6Zsf.js} +1 -1
- package/dist/packem_shared/{npmrc-CIvOb61L.js → npmrc-DONprxrc.js} +1 -1
- package/dist/packem_shared/{osv-DaMZpVWl.js → osv-dvIA_vX3.js} +1 -1
- package/dist/packem_shared/{package-version-VdULnxr1.js → package-version-BOK3IncQ.js} +2 -2
- package/dist/packem_shared/{packument-zeKEhTaX.js → packument-B678kHJO.js} +1 -1
- package/dist/packem_shared/{pm-runner-BXRi4ZM9.js → pm-runner-CYsiSHYa.js} +1 -1
- package/dist/packem_shared/{project-name-filter-BklluD5Y.js → project-name-filter-CBEoY08a.js} +1 -1
- package/dist/packem_shared/{provenance-CwyZDw8A.js → provenance-D4ioWGBq.js} +1 -1
- package/dist/packem_shared/reachable-DX8FPErP.js +1 -0
- package/dist/packem_shared/{registry-TXpTtpgS.js → registry-ClmannRw.js} +2 -2
- package/dist/packem_shared/{registry-keys-B4CNE38T.js → registry-keys-CF45rOur.js} +1 -1
- package/dist/packem_shared/{removeSync-g1D5kONg-jOsRSIIv.js → removeSync-g1D5kONg-DcG75b0G.js} +1 -1
- package/dist/packem_shared/{renderToString-DR0zDUjh-CdBv7J9a.js → renderToString-DR0zDUjh-CBDmAXxb.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-Cg3eqSqr.js → resolve-explicit-C5-y-xEU.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-D8rxuo3J.js → resolve-runtime-DBDozrmt.js} +1 -1
- package/dist/packem_shared/{run-file-D1mlOnd8.js → run-file-BKXvoVj2.js} +1 -1
- package/dist/packem_shared/{run-summary-utils-CZ2pIIOZ.js → run-summary-utils-75paIrLB.js} +1 -1
- package/dist/packem_shared/{runtime-check-By5NHR00.js → runtime-check-Yl8-Awkf.js} +1 -1
- package/dist/packem_shared/{s1ngularity-CXTWGOvX.js → s1ngularity-B2bqwE0C.js} +1 -1
- package/dist/packem_shared/{scaffold-files-CC1M9Gje.js → scaffold-files-UiCBBCT5.js} +1 -1
- package/dist/packem_shared/{scan-progress-BaCJp5nr.js → scan-progress-Dws7Gif1.js} +1 -1
- package/dist/packem_shared/{selectors-DdvjAetv.js → selectors-DZ4HDnlD.js} +1 -1
- package/dist/packem_shared/{signatures-Bm-ySKmD.js → signatures-DNqgsRp7.js} +1 -1
- package/dist/packem_shared/{spinner-D8Eugb6Y.js → spinner-BQ9mLz8X.js} +1 -1
- package/dist/packem_shared/{table-Dc3wOjzc.js → table-D1CpySxU.js} +1 -1
- package/dist/packem_shared/{tabs-Ch5hj2ow.js → tabs-BYtpIN5b.js} +1 -1
- package/dist/packem_shared/{target-options-rIthWS4M.js → target-options-CsevVc7U.js} +1 -1
- package/dist/packem_shared/{task-env-Cl4jNMCR.js → task-env-BftNOR00.js} +1 -1
- package/dist/packem_shared/{toolchain-DQIOCPht.js → toolchain-BvluBdrw.js} +1 -1
- package/dist/packem_shared/{typosquats-Dw02Q55Q.js → typosquats-XrArH9TO.js} +1 -1
- package/dist/packem_shared/{use-measured-height-wtekNTLa.js → use-measured-height-hHis1NaB.js} +1 -1
- package/dist/packem_shared/{verify-3WE9U_Bv.js → verify-Dic2G0nQ.js} +1 -1
- package/dist/packem_shared/{vis-update-app-it6zkxW1.js → vis-update-app-BNnbDZ--.js} +1 -1
- package/dist/packem_shared/{vis-user-error-6sSghaC9.js → vis-user-error-DhgW3DzD.js} +2 -2
- package/dist/packem_shared/{watch-C-9-PD2m.js → watch-BLHtUgfb.js} +1 -1
- package/dist/packem_shared/{watch-loop-q7f9ukDX.js → watch-loop-Dh4GHUVS.js} +7 -7
- package/dist/runtime/preload.js +1 -1
- package/index.js +54 -54
- package/package.json +11 -10
- package/schemas/vis-config.schema.json +1419 -80
- package/dist/packem_shared/affected-shas-CycHU3nr.js +0 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-QtJl508G.js +0 -1
|
@@ -1,50 +1,153 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
`)
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`)}
|
|
6
|
-
|
|
7
|
-
`)
|
|
8
|
-
`)}
|
|
9
|
-
`
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
`)
|
|
16
|
-
`
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`)}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
`)}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`)
|
|
44
|
-
|
|
45
|
-
`)
|
|
46
|
-
`),
|
|
47
|
-
`)
|
|
48
|
-
|
|
49
|
-
`)
|
|
50
|
-
|
|
1
|
+
import{createRequire as me}from"node:module";import{G as ye,v as ke,z as je,m as oe,a as L,e as _}from"../packem_shared/index-zq6Ehql6.js";import{L as U}from"../packem_shared/index-BisalDCf.js";import Ce from"./index.js";import{d as ne,q as Ee,u as Se}from"../packem_shared/registry-ClmannRw.js";import{V as v}from"../packem_shared/vis-user-error-DhgW3DzD.js";import{d as Oe}from"../packem_shared/lockfile-Cx2Ny3um.js";import{C as P,G as E,u as _e}from"../packem_shared/ci-commands-4W9d2six.js";import{r as W}from"../packem_shared/reachable-DX8FPErP.js";import{n as Ne}from"../packem_shared/manifests-BEGTH1ZG.js";import{_ as G,Z as Ie}from"./cli-main.js";import{l as Pe}from"../packem_shared/glob-Cyk1H9ZL-BtN6Zzwg.js";import{g as Re}from"../packem_shared/package-version-BOK3IncQ.js";let we;const be=e=>(we??=me(import.meta.url))(e),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$e=e=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[t,o]=I.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return I.getBuiltinModule(e)}return be(e)},{isDeepStrictEqual:ve}=$e("node:util"),q=["lint","typecheck","lint:types","build","test"],se="Generated by `vis sync ci-workflow`. Do not edit by hand: change `ci.workflow` in vis.config.ts and re-run it.",Te=e=>{const t=typeof e=="string"?e:e.target;return t.startsWith("^")?t.slice(1):t},Me=(e,t={})=>{const o=new Map;for(const s of Object.values(e))for(const[n,a]of Object.entries(s.targets??{})){const r=o.get(n)??new Set;for(const i of a.dependsOn??t[n]?.dependsOn??[])r.add(Te(i));o.set(n,r)}return o},Ge=(e,t)=>{const o=new Map([...t].map(([r,i])=>[r,new Set(i)]));if(!e.includes("build"))return{edges:o,ordered:[]};const s=r=>W([r],i=>t.get(i)),n=s("build"),a=e.filter(r=>r!=="build"&&!s(r).has("build")&&!n.has(r));for(const r of a)o.set(r,new Set([...o.get(r)??[],"build"]));return{edges:o,ordered:a}},Ae=(e,t)=>{const o=new Set(e),s=new Map(e.map(c=>[c,[...W([c],u=>t.get(u))].filter(u=>o.has(u)&&u!==c)])),n=new Map,a=new Set,r=c=>{const u=n.get(c);if(u!==void 0)return u;if(a.has(c))throw new v(`ci.workflow.targets: "${c}" depends on itself through dependsOn, so it cannot be ordered.`);a.add(c);const f=Math.max(0,...(s.get(c)??[]).map(g=>r(g)+1));return a.delete(c),n.set(c,f),f},i=[];for(const c of e){const u=r(c),f=i[u]??[];f.push(c),i[u]=f}return i.filter(c=>c.length>0)},De=({cacheDirectory:e,defaultBase:t,ecosystems:o=[],packageManager:s,projects:n,providers:a,rootFiles:r=new Set,settings:i,targetDefaults:c,toolchainPins:u={},visVersion:f})=>{if(i.timeoutMinutes!==void 0&&(!Number.isInteger(i.timeoutMinutes)||i.timeoutMinutes<1))throw new v(`ci.workflow.timeoutMinutes must be a positive integer, got ${JSON.stringify(i.timeoutMinutes)}.`);if(i.targets?.length===0)throw new v("ci.workflow.targets is empty. List the targets to run, or remove it to use the defaults.");const g=new Set(Object.values(n).flatMap(p=>Object.keys(p.targets??{}))),$=(i.targets??[]).map(p=>typeof p=="string"?{env:void 0,name:p}:p),m=i.targets===void 0?q.filter(p=>g.has(p)):$.map(({name:p})=>p),y=new Map($.map(({env:p,name:C})=>[C,p])),w=m.find((p,C)=>m.indexOf(p)!==C);if(w!==void 0)throw new v(`ci.workflow.targets lists "${w}" more than once.`);const h=i.github??{};for(const[p,C]of Object.entries(h.steps??{}))for(const N of C)if(N.run===void 0==(N.uses===void 0))throw new v(`ci.workflow.github.steps.${p}: "${N.name}" needs exactly one of \`run\` or \`uses\`.`);const l=m.filter(p=>!g.has(p));if(l.length>0)throw new v(`ci.workflow.targets: no project defines ${l.map(p=>`"${p}"`).join(", ")}.`);if(m.length===0)throw new v(`No project defines any of ${q.join(", ")}. Set ci.workflow.targets in vis.config.ts.`);const b=i.partitions??{},d=Me(n,c);for(const[p,C]of Object.entries(b)){if(!m.includes(p))throw new v(`ci.workflow.partitions.${p}: "${p}" is not one of the workflow's targets (${m.join(", ")}).`);if(!Number.isInteger(C)||C<1)throw new v(`ci.workflow.partitions.${p} must be a positive integer, got ${JSON.stringify(C)}.`);if(C>1&&W([p],N=>d.get(N)).has(p))throw new v(`ci.workflow.partitions.${p}: ${p} depends on ${p} of other projects (^${p}), directly or through other targets, so its shards would depend on each other. Remove the partition.`)}let k=d,j=[];return(i.buildFirst??!0)&&({edges:k,ordered:j}=Ge(m,k)),{buildFirstOrdered:j,plan:{affected:i.affected??!0,branches:i.branches??[t??"main"],cacheDirectory:e,checkDrift:i.checkDrift??!0,ecosystems:o,github:h,gitlab:i.gitlab??{},layers:Ae(m,k).map(p=>p.map(C=>({env:y.get(C),name:C,shards:b[C]??1}))),nodeVersion:i.nodeVersion??u.node??"22",packageManager:s,providers:[...a].toSorted(),rootFiles:r,runsOn:i.runsOn??"ubuntu-latest",timeoutMinutes:i.timeoutMinutes??60,toolchainPins:u,visVersion:f}}},H=e=>/^[\w.:@/+-]+$/u.test(e)?e:`'${e.replaceAll("'",String.raw`'\''`)}'`,re=e=>e.packageManager===void 0?"vis":`${P[e.packageManager].exec} vis`,ie=e=>`${re(e)} sync ci-workflow --check --provider=${e.providers.join(",")}`,ae=e=>`npm install --global @visulima/vis@${e.visVersion}`,R=(e,t,o)=>{const s=re(e);return[e.affected?`${s} ci ${H(t)} --no-install`:`${s} run ${H(t)}`,...o,"--if-present"].join(" ")},S=e=>JSON.stringify(e),T=e=>/^[\w.-]+$/u.test(e)?e:S(e),J=(e,t)=>typeof e!="string"?String(e):e.includes(`
|
|
2
|
+
`)?`|
|
|
3
|
+
${e.replace(/\n$/u,"").split(`
|
|
4
|
+
`).map(o=>`${t}${o}`).join(`
|
|
5
|
+
`)}`:S(e),ce=e=>typeof e=="boolean"||typeof e=="number"||typeof e=="string",K=(e,t)=>Object.entries(e).flatMap(([o,s])=>ce(s)||typeof s=="object"&&s!==null?O(o,s,t):[]),O=(e,t,o)=>{const s=`${o} `;return typeof t!="object"?[`${o}${T(e)}: ${J(t,s)}`]:Array.isArray(t)?[`${o}${T(e)}:`,...t.flatMap(n=>{if(ce(n))return[`${s}- ${J(n,`${s} `)}`];const[a="",...r]=typeof n=="object"&&n!==null?K(n,`${s} `):[];return[`${s}- ${a.trimStart()}`,...r]})]:[`${o}${T(e)}:`,...K(t,s)]},z=10,ue=(e,t)=>{if("parallel"in e)return`${t}- parallel:
|
|
6
|
+
${e.parallel.map(g=>ue(g,`${t} `)).join("")}`;const o=`${t} `,{comment:s,env:n,name:a,run:r,uses:i,with:c,...u}=e,f=s===void 0?[]:s.split(`
|
|
7
|
+
`).map(g=>`${t}# ${g}`);f.push(`${t}- name: ${S(a)}`),u.if!==void 0&&f.push(...O("if",u.if,o)),typeof i=="string"?f.push(...O("uses",i,o)):i!==void 0&&f.push(`${o}uses: ${S(`${i.name}@${i.sha}`)} # ${i.version}`);for(const[g,$]of[["with",c],["env",n],["working-directory",u["working-directory"]],["shell",u.shell],["run",r],["continue-on-error",u["continue-on-error"]],["timeout-minutes",u["timeout-minutes"]]])$!==void 0&&f.push(...O(g,$,o));return`${f.join(`
|
|
8
|
+
`)}
|
|
9
|
+
`},Le=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")):".",We=(e,{manifests:t,name:o})=>{const s=e.toolchainPins,n=a=>e.rootFiles.has(a);switch(o){case"dart":return{name:"Setup Dart",uses:E.setupDart,with:{sdk:"stable"}};case"dotnet":{const a=n("global.json")?"global.json":t.find(r=>r.endsWith("/global.json"));return{name:"Setup .NET",uses:E.setupDotnet,with:a===void 0?{"dotnet-version":"8.0.x"}:{"global-json-file":a}}}case"elixir":return{name:"Setup Elixir",uses:E.setupBeam,with:n(".tool-versions")?{"version-file":".tool-versions","version-type":"strict"}:{"elixir-version":"1.18","otp-version":"27"}};case"go":{const a=t.find(r=>r.endsWith("go.mod"))??"go.mod";return{name:"Setup Go",uses:E.setupGo,with:{"cache-dependency-path":"**/go.sum",...s.go===void 0?{"go-version-file":a}:{"go-version":s.go}}}}case"gradle":case"maven":return{name:"Setup Java",uses:E.setupJava,with:{cache:o,distribution:"temurin","java-version":"21"}};case"php":return{name:"Setup PHP",uses:E.setupPhp,with:{...n(".php-version")?{"php-version-file":".php-version"}:{"php-version":"8.3"},tools:"composer"}};case"python":{const a=t.filter(i=>/(?:pyproject\.toml|requirements\.txt)$/u.test(i)),r=s.python===void 0?n(".python-version")?{"python-version-file":".python-version"}:{"python-version":"3.x"}:{"python-version":s.python};return{name:"Setup Python",uses:E.setupPython,with:{...r,...a.length>0?{cache:"pip","cache-dependency-path":`${a.join(`
|
|
10
|
+
`)}
|
|
11
|
+
`}:{}}}}case"ruby":{const a=t.find(r=>r.endsWith("Gemfile"));return{name:"Setup Ruby",uses:E.setupRuby,with:{...s.ruby===void 0?n(".ruby-version")||n(".tool-versions")?{}:{"ruby-version":"3.4"}:{"ruby-version":s.ruby},...a===void 0?{}:{"bundler-cache":!0,"working-directory":Le(a)}}}}case"rust":return{name:"Setup Rust",uses:E.setupRust,...s.rust===void 0?{}:{with:{toolchain:s.rust}}};case"zig":return{name:"Setup Zig",uses:E.setupZig};default:return}},xe=e=>{const t=[],o=n=>({name:"Setup Node.js",uses:E.setupNode,with:{"node-version":e.nodeVersion,...n===void 0?{}:{cache:n}}});if(e.packageManager===void 0)t.push(o(void 0),{name:"Install vis",run:ae(e)});else{const n=P[e.packageManager];n.githubAction===void 0?t.push(o(n.githubNodeCache),...n.setup.length>0?[{name:`Setup ${e.packageManager}`,run:`${n.setup.join(`
|
|
12
|
+
`)}
|
|
13
|
+
`}]:[]):t.push({name:`Setup ${e.packageManager}`,uses:n.githubAction},o(n.githubNodeCache)),t.push({name:"Install dependencies",run:n.install})}const s=new Set;for(const n of e.ecosystems){const a=We(e,n);a!==void 0&&!s.has(a.name)&&(s.add(a.name),t.push(a))}return t.push({comment:"The vis task cache, so unchanged tasks are restored instead of re-run.",name:"Restore vis cache",uses:E.cache,with:{key:"vis-${{ runner.os }}-${{ github.sha }}",path:e.cacheDirectory??"node_modules/.cache/vis","restore-keys":"vis-${{ runner.os }}-\n"}}),t.push(...e.github.steps?.afterSetup??[]),e.checkDrift&&t.push({comment:"Fails when vis.config.ts or the workspace changed without regenerating this file.",name:"Check the workflow is up to date",run:ie(e)}),t},Fe=e=>e.layers.map(t=>{const o=t.flatMap(({env:n,name:a,shards:r})=>{const i=["--skip-deps"];return r===1?[{env:n,name:a,run:R(e,a,i)}]:Array.from({length:r},(c,u)=>{const f=`${u+1}/${r}`;return{env:n,name:`${a} (${f})`,run:R(e,a,[...i,`--partition=${f}`])}})});if(o.length>z)throw new v(`The group ${t.map(({name:n})=>n).join(", ")} needs ${o.length} parallel steps, but GitHub runs at most ${z} at once. Lower ci.workflow.partitions.`);const[s]=o;return o.length===1&&s?s:{parallel:o}}),Be=e=>{const t=[{comment:"Full history, so affected detection can diff against the base.",name:"Checkout",uses:E.checkout,with:{"fetch-depth":0,"persist-credentials":!1}},...xe(e),{comment:`Builds what the targets below depend on once, so the parallel steps
|
|
14
|
+
never build or restore the same outputs at the same time.`,name:"Build dependencies",run:`${e.layers.flat().map(({name:r})=>R(e,r,["--deps-only"])).join(`
|
|
15
|
+
`)}
|
|
16
|
+
`},...Fe(e),...e.github.steps?.after??[]],{env:o,permissions:s,services:n}=e.github,a=[...o===void 0?[]:O("env",o," "),...n===void 0?[]:O("services",n," ")];return`# ${se}
|
|
17
|
+
name: "vis ci"
|
|
18
|
+
|
|
19
|
+
on: # yamllint disable-line rule:truthy
|
|
20
|
+
pull_request:
|
|
21
|
+
# Runs the checks for a merge queue too; an event no queue sends never fires.
|
|
22
|
+
merge_group:
|
|
23
|
+
push:
|
|
24
|
+
branches:
|
|
25
|
+
${e.branches.map(r=>` - ${S(r)}`).join(`
|
|
26
|
+
`)}
|
|
27
|
+
|
|
28
|
+
${O("permissions",{contents:"read",...s},"").join(`
|
|
29
|
+
`)}
|
|
30
|
+
|
|
31
|
+
concurrency:
|
|
32
|
+
group: "vis-ci-\${{ github.event_name == 'pull_request' && github.ref || github.sha }}"
|
|
33
|
+
# Supersede outdated pull request runs. Every other event gets a group per commit, because a
|
|
34
|
+
# shared group keeps only one pending run and would drop the middle one of three quick pushes.
|
|
35
|
+
cancel-in-progress: \${{ github.event_name == 'pull_request' }}
|
|
36
|
+
|
|
37
|
+
jobs:
|
|
38
|
+
ci:
|
|
39
|
+
name: "vis ci"
|
|
40
|
+
runs-on: ${S(e.runsOn)}
|
|
41
|
+
timeout-minutes: ${e.timeoutMinutes}
|
|
42
|
+
${a.map(r=>`${r}
|
|
43
|
+
`).join("")} steps:
|
|
44
|
+
${t.map(r=>ue(r," ")).join(`
|
|
45
|
+
`)}`},le=".gitlab/vis-ci.gitlab-ci.yml",V=200,Y=50,M=e=>`vis:${e}`,Ue=e=>`'${e.replaceAll("'","''")}'`,qe=e=>e.includes("*")?`$CI_COMMIT_BRANCH =~ /^${e.split("**").map(o=>o.split("*").map(s=>s.replaceAll(/[$()+.?[\\\]^{|}/]/gu,String.raw`\$&`)).join(String.raw`[^\/]*`)).join(".*")}$/`:`$CI_COMMIT_BRANCH == ${JSON.stringify(e)}`,He=e=>{if(e===void 0)return".vis-cache";const t=ye(e);if(ke(t)||t===".."||t.startsWith("../"))throw new v(`GitLab can only cache paths inside the project; taskRunner.cacheDirectory is "${e}".`);return t.replaceAll(/^\.\/|\/$/gu,"")},Je=e=>e==="go"||e==="python"||e==="ruby"||e==="rust",Ke=new Map([["go",{path:".go-mod",variable:"GOMODCACHE"}],["python",{path:".pip-cache",variable:"PIP_CACHE_DIR"}],["rust",{path:".cargo",variable:"CARGO_HOME"}]]),de=e=>e.gitlab.image===void 0?e.ecosystems.flatMap(({name:t})=>Je(t)&&e.toolchainPins[t]!==void 0?[]:[t]):[],ze=e=>{const t=e.branches.map(h=>` - if: ${Ue(qe(h))}`).join(`
|
|
46
|
+
`),o=He(e.cacheDirectory),s=e.ecosystems.flatMap(({name:h})=>{const l=Ke.get(h);return l===void 0?[]:[l]}),n=[" # Full history, so affected detection can diff against the base.",' GIT_DEPTH: "0"',...e.cacheDirectory===void 0?[" # Outside node_modules, so a clean install (npm ci) keeps the restored task cache.",` VIS_CACHE_DIRECTORY: "$CI_PROJECT_DIR/${o}"`]:[],...s.map(({path:h,variable:l})=>` ${l}: "$CI_PROJECT_DIR/${h}"`),...Object.entries(e.gitlab.variables??{}).flatMap(([h,l])=>O(h,l," "))].join(`
|
|
47
|
+
`),a=[o,...s.map(({path:h})=>h)].map(h=>` - ${S(`${h}/`)}`).join(`
|
|
48
|
+
`),i=[...e.packageManager===void 0?[ae(e)]:[...P[e.packageManager].setup,P[e.packageManager].install],...e.gitlab.beforeScript??[]].map(h=>` - ${S(h)}`).join(`
|
|
49
|
+
`),{afterScript:c,services:u,tags:f}=e.gitlab,g=[...f===void 0?[]:O("tags",f," "),...u===void 0?[]:O("services",u," "),...c===void 0?[]:O("after_script",c," ")],$=de(e),m=$.length===0?"":`#
|
|
50
|
+
# Not on the node image: ${$.join(", ")}. Pin go, python, ruby or rust in
|
|
51
|
+
# toolchain.tools (vis.config.ts) so vis installs them, or set \`image:\` on
|
|
52
|
+
# .vis-ci-base in your .gitlab-ci.yml to one that has them.
|
|
53
|
+
`;let y=e.checkDrift?`
|
|
54
|
+
"vis:workflow":
|
|
55
|
+
extends: ".vis-ci-base"
|
|
56
|
+
needs: []
|
|
57
|
+
script:
|
|
58
|
+
- ${S(ie(e))}
|
|
59
|
+
`:"",w=[];for(const h of e.layers){for(const{env:l,name:b,shards:d}of h){if(d>V)throw new v(`ci.workflow.partitions.${b} is ${d}, but GitLab runs at most ${V} parallel jobs. Lower it.`);if(w.length>Y)throw new v(`The job ${M(b)} would need ${w.length} jobs, but GitLab allows ${Y} in needs. List fewer targets.`);const k=d===1?[]:["--partition=$CI_NODE_INDEX/$CI_NODE_TOTAL"];y+=`
|
|
60
|
+
${S(M(b))}:
|
|
61
|
+
extends: ".vis-ci-base"
|
|
62
|
+
needs: [${w.map(j=>S(j)).join(", ")}]
|
|
63
|
+
${d===1?"":` parallel: ${d}
|
|
64
|
+
`}${l===void 0?"":`${O("variables",l," ").join(`
|
|
65
|
+
`)}
|
|
66
|
+
`} script:
|
|
67
|
+
- ${S(R(e,b,k))}
|
|
68
|
+
`}w=h.map(({name:l})=>M(l))}return`# ${se}
|
|
69
|
+
#
|
|
70
|
+
# Include it from .gitlab-ci.yml:
|
|
71
|
+
# include:
|
|
72
|
+
# - local: "${le}"
|
|
73
|
+
#
|
|
74
|
+
# Every target is its own job, so jobs in a group run on separate machines at
|
|
75
|
+
# the same time; a partitioned target fans out with \`parallel: N\`.
|
|
76
|
+
${m}.vis-ci-base:
|
|
77
|
+
stage: ${S(e.gitlab.stage??"test")}
|
|
78
|
+
image: ${S(e.gitlab.image??`node:${e.nodeVersion}`)}
|
|
79
|
+
timeout: "${e.timeoutMinutes}m"
|
|
80
|
+
variables:
|
|
81
|
+
${n}
|
|
82
|
+
cache:
|
|
83
|
+
# Per job: jobs of one group finish in any order, and a shared key keeps only the last upload.
|
|
84
|
+
key: "vis-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG"
|
|
85
|
+
paths:
|
|
86
|
+
${a}
|
|
87
|
+
rules:
|
|
88
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
89
|
+
${t}
|
|
90
|
+
before_script:
|
|
91
|
+
${i}
|
|
92
|
+
${g.map(h=>`${h}
|
|
93
|
+
`).join("")}${y}`},A={github:{path:".github/workflows/vis-ci.yml",render:Be},gitlab:{path:le,render:ze}},X=e=>Object.hasOwn(A,e),Ve=e=>e.providers.map(t=>({content:A[t].render(e),path:A[t].path})),Ye=[["dart",e=>e==="pubspec.yaml"],["dotnet",e=>/\.(?:cs|fs|vb)proj$|\.sln$/u.test(e)||e==="global.json"],["elixir",e=>e==="mix.exs"],["go",e=>e==="go.mod"],["gradle",e=>/^(?:build|settings)\.gradle(?:\.kts)?$/u.test(e)],["maven",e=>e==="pom.xml"],["php",e=>e==="composer.json"],["python",e=>["Pipfile","pyproject.toml","requirements.txt","setup.py"].includes(e)],["ruby",e=>e==="Gemfile"||e.endsWith(".gemspec")],["rust",e=>e==="Cargo.toml"],["swift",e=>e==="Package.swift"],["zig",e=>e==="build.zig"]],Xe=e=>{const t=new Map;for(const{files:o,path:s}of e)for(const n of o)for(const[a,r]of Ye)r(n)&&t.set(a,[...t.get(a)??[],s==="."||s===""?n:`${s}/${n}`]);return[...t].map(([o,s])=>({manifests:[...new Set(s)].toSorted(),name:o})).toSorted((o,s)=>o.name.localeCompare(s.name))},Ze=async({configured:e,detectRemote:t,exists:o,flag:s,prompt:n})=>{if(s!==void 0)return{providers:s,reason:"--provider"};if(e!==void 0)return{providers:e,reason:"ci.workflow.providers"};const a=[];if(await o(".github/workflows")&&a.push({file:".github/workflows",provider:"github"}),(await o(".gitlab-ci.yml")||await o(".gitlab/vis-ci.gitlab-ci.yml"))&&a.push({file:".gitlab-ci.yml",provider:"gitlab"}),a.length>0)return{providers:a.map(({provider:i})=>i),reason:`found ${a.map(({file:i})=>i).join(" and ")}`};const r=await t();if(r!==void 0)return{providers:[r],reason:`the git remote points at ${r==="github"?"GitHub":"GitLab"}`};if(n===void 0)throw new v("Could not tell which CI provider this repository uses (no .github/workflows, no .gitlab-ci.yml, no GitHub or GitLab remote). Pass --provider=github or --provider=gitlab, or set ci.workflow.providers in vis.config.ts.");return{providers:await n(),reason:"your choice"}},Qe=(e,t)=>{const o=t.replace(/^\.?\//,"");return o===""||o==="."?`/${e}/`:e===""||e==="."?`/${o}`:`/${e}/${o}`},Z=(e,t,o=[])=>{const s=[],n=new Set;for(const[r,i]of Object.entries(t?.globalPaths??{}))s.push({owners:i,path:r,source:"project-json"}),n.add(r);for(const[r,i]of Object.entries(e.projects)){const c=i.owners??[];for(const u of c){const f=Qe(i.root??r,u.path);s.push({channel:u.channel,owners:u.owners,path:f,projectId:r,source:"project-json"}),n.add(f)}}for(const r of o)n.has(r.path)||(s.push(r),n.add(r.path));return(t?.orderBy??"file-source")==="project-id"?s.sort((r,i)=>(r.projectId??"").localeCompare(i.projectId??"")||r.path.localeCompare(i.path)):s.sort((r,i)=>r.path.localeCompare(i.path)),s},et="Update each project's project.json `owners` field and re-run the command.",tt=e=>["# CODEOWNERS — generated by `vis sync codeowners`. Do not edit by hand.",e?`# Re-run with: ${e}`:`# ${et}`,""],pe=e=>{const t=[];for(const o of e){const s=o.owners.join(" "),n=o.channel?` # notify: ${o.channel}`:"";t.push(`${o.path} ${s}${n}`)}return t},ot=(e,t={})=>[...tt(t.regenerationCommand),...pe(e),""].join(`
|
|
94
|
+
`),x={begin:"# BEGIN vis-codeowners",end:"# END vis-codeowners"},nt=(e,t=x,o={})=>{const s=o.regenerationCommand?`# Generated by vis sync codeowners — re-run with: ${o.regenerationCommand}`:"# Generated by `vis sync codeowners` — do not edit by hand.";return[t.begin,s,...pe(e),t.end].join(`
|
|
95
|
+
`)},st=(e,t,o=x)=>{const s=e.indexOf(o.begin),n=e.indexOf(o.end);if(s!==-1&&n!==-1&&n>s){const i=e.slice(0,s),c=n+o.end.length,u=e.slice(c);return`${i}${t}${u}`}const a=e.replace(/\s+$/u,"");return`${a.length===0?"":`${a}
|
|
96
|
+
|
|
97
|
+
`}${t}
|
|
98
|
+
`},rt=["**/CODEOWNERS"],it=["**/node_modules/**","**/dist/**","**/build/**","**/coverage/**","**/.git/**","**/.next/**","**/.nuxt/**"],at=e=>{const t=[];for(const o of e.split(/\r?\n/u)){const s=o.indexOf("#"),n=(s===-1?o:o.slice(0,s)).trim();if(n.length===0)continue;const a=n.split(/\s+/u);if(a.length<2)continue;const[r,...i]=a,c=i.filter(u=>u.length>0);!r||c.length===0||t.push({owners:c,path:r})}return t},ct=(e,t)=>{const o=t.replace(/^\.\/?/,"").replace(/\/$/,"");return e.startsWith("/")?o===""?e:`/${o}${e}`:o===""?`/${e}`:`/${o}/${e}`},ut=async(e,t,o)=>{const s=t&&t.length>0?[...t]:[...rt],n=[...it];if(o){const i=o.replace(/^\.\/?/,"").replace(/^\/+/,"");i.length>0&&n.push(i)}const a=await Pe(s,{absolute:!0,cwd:e,ignore:n}),r=[];for(const i of a){let c;try{c=je(i)}catch{continue}const u=oe(i),f=L(e,u);for(const g of at(c))r.push({owners:g.owners,path:ct(g.path,f)})}return r},lt=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/?#]+)/iu,dt=e=>{if(!e)return;const t=e.match(lt);if(!t?.[1])return;const o=t[1].trim();if(!(o===""||o.includes(" ")))return`@${o.replace(/^@/,"")}`},pt=(e,t)=>{const o=[];for(const[s,n]of Object.entries(e.projects)){if(n.owners&&n.owners.length>0)continue;const a=n.root??s,r=_(t,a,"package.json"),i=G(r);if(!i)continue;const c=Ne(i.maintainers);if(!c||c.length===0)continue;const u=[],f=new Set;for(const g of c){const $=dt(g.url);$&&!f.has($)&&(f.add($),u.push($))}u.length!==0&&o.push({owners:u,path:a===""||a==="."?"/":`/${a}/`,projectId:s})}return o},ft=async(e,t)=>{try{return await e.readFile(t,"utf8")}catch(o){if(o.code==="ENOENT")return"";throw o}},F=async(e,{fs:t,isCurrent:o=(i,c)=>i.trim()===c.trim(),logger:s,mode:n,regenerateCommand:a,root:r})=>{const i=[];for(const c of e){const u=_(r,c.path);if(n==="write"){await t.mkdir(oe(u),{recursive:!0}),await t.writeFile(u,c.content),s.info(`Wrote ${c.path}`);continue}o(await ft(t,u),c.content)||(s.error(`${c.path} is out of date. Run \`${a}\` to update it.`),i.push(c.path))}return{stale:i}},ht=["author","bugs","homepage","license","repository","engines"],Q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),D=(e,t)=>{if(e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(const[o,s]of e.entries())if(!D(s,t[o]))return!1;return!0}if(typeof e=="object"&&typeof t=="object"){const o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(const n of o)if(!D(e[n],t[n]))return!1;return!0}return!1},ee=e=>e===void 0?e:structuredClone(e),gt=(e,t,o)=>{if(e==="repository"&&Q(t)&&Q(o)){const s={};for(const[n,a]of Object.entries(t))n!=="directory"&&(s[n]=ee(a));return typeof o.directory=="string"&&(s.directory=o.directory),s}return ee(t)},mt=(e,t,o)=>{const s=[];for(const n of o.fields){if(!Object.hasOwn(e,n))continue;const a=e[n],r=t[n],i=gt(n,a,r);D(i,r)||s.push({after:i,before:r,field:n,packageJsonPath:""})}return s},wt=(e,t)=>{for(const o of t)e[o.field]=o.after},fe="Generated by `vis sync codeowners --write-guard`. Do not edit by hand.",bt=e=>{const t=e.replace(/^\.?\/+/u,"").replace(/\/+$/u,"");return t===""||t==="."?"**":`${t}/**`},he=e=>{const t=new Set,o=[];for(const s of[...e].sort((n,a)=>n.name.localeCompare(a.name))){const n=bt(s.root);t.has(n)||(t.add(n),o.push(n))}return o},$t=e=>{const t=he(e),o=t.map(n=>` - "${n}"`).join(`
|
|
99
|
+
`),s=t.map(n=>` ${n}`).join(`
|
|
100
|
+
`);return`# ${fe}
|
|
101
|
+
name: Write Guard
|
|
102
|
+
|
|
103
|
+
on:
|
|
104
|
+
pull_request:
|
|
105
|
+
paths:
|
|
106
|
+
${o}
|
|
107
|
+
|
|
108
|
+
permissions:
|
|
109
|
+
contents: read
|
|
110
|
+
pull-requests: read
|
|
111
|
+
|
|
112
|
+
jobs:
|
|
113
|
+
write-guard:
|
|
114
|
+
runs-on: ubuntu-latest
|
|
115
|
+
steps:
|
|
116
|
+
- uses: ${_e(E.checkout)}
|
|
117
|
+
with:
|
|
118
|
+
fetch-depth: 0
|
|
119
|
+
- uses: geritol/write-guard@v1
|
|
120
|
+
with:
|
|
121
|
+
codeowners: CODEOWNERS
|
|
122
|
+
paths: |
|
|
123
|
+
${s}
|
|
124
|
+
`},vt=e=>{const o=he(e).map(s=>` - "${s}/*"`).join(`
|
|
125
|
+
`);return`# ${fe}
|
|
126
|
+
#
|
|
127
|
+
# SOFT GUARD ONLY — this job does NOT block a merge by itself.
|
|
128
|
+
# It verifies the generated CODEOWNERS is in sync and flags that a
|
|
129
|
+
# restricted path changed. GitLab CI cannot portably gate a merge on
|
|
130
|
+
# code-owner *approval* from a job, so REAL ENFORCEMENT REQUIRES the
|
|
131
|
+
# native GitLab setting:
|
|
132
|
+
# Settings -> Repository -> Protected branches ->
|
|
133
|
+
# "Require approval from Code Owners" (GitLab Premium / Ultimate)
|
|
134
|
+
# https://docs.gitlab.com/ee/user/project/codeowners/
|
|
135
|
+
# Without that setting enabled, this job is advisory only.
|
|
136
|
+
write-guard:
|
|
137
|
+
stage: test
|
|
138
|
+
image: node:22-alpine
|
|
139
|
+
rules:
|
|
140
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
141
|
+
changes:
|
|
142
|
+
${o}
|
|
143
|
+
script:
|
|
144
|
+
- corepack enable
|
|
145
|
+
- pnpm install --frozen-lockfile
|
|
146
|
+
- pnpm vis sync codeowners --check
|
|
147
|
+
- >-
|
|
148
|
+
echo "SOFT GUARD: a restricted path changed. This job does NOT enforce
|
|
149
|
+
code-owner approval. Enable 'Require approval from Code Owners' on the
|
|
150
|
+
protected branch (GitLab Premium/Ultimate) for a real merge gate:
|
|
151
|
+
https://docs.gitlab.com/ee/user/project/codeowners/"
|
|
152
|
+
`},yt=e=>e.length===0?[]:[{content:$t(e),path:".github/workflows/write-guard.yml"},{content:vt(e),path:".gitlab/write-guard.gitlab-ci.yml"}],ge=new Set(["nested-codeowners","package-json-maintainers","project-json"]),B=(e,t,o)=>{const s=new Set,n=[];for(const a of e??[])for(const r of a.split(",")){const i=r.trim();if(i.length===0)continue;if(o&&!o(i))throw new Error(`Unknown codeowners source: "${i}". Known: ${[...ge].join(", ")}.`);const c=i;s.has(c)||(s.add(c),n.push(c))}return n.length>0?n:[...t]},kt=e=>ge.has(e),te=["ci-workflow","codeowners","package-json-fields"],jt=(e,t)=>t.some(o=>Ce(o,e)),Ct=async(e,t,o,s,n)=>{const a=Object.entries(s.projects).filter(([,c])=>c.restricted===!0).map(([c,u])=>({name:c,root:u.root??c})),r=yt(a);if(r.length===0){t.info("No projects flagged `restricted: true` in project.json. Skipping Write Guard.");return}const{stale:i}=await F(r,{fs:e,logger:t,mode:n?"check":"write",regenerateCommand:"vis sync codeowners --write-guard",root:o});if(n){i.length>0?process.exitCode=1:t.info(`Write Guard CI is up to date (${r.length} files, ${a.length} restricted projects).`);return}t.info(`Write Guard CI scoped to ${a.length} restricted project${a.length===1?"":"s"}.`)},Et=async({fs:e,logger:t,options:o,visConfig:s,workspaceRoot:n})=>{const a=n,{workspace:r}=ne(a,s),i=s?.codeowners;o.writeGuard&&await Ct(e,t,a,r,o.check);const c=B(o.from,i?.sources??["project-json"],kt),u=o.regenerationCommand??i?.regenerationCommand,f=o.preserveBlock||i?.preserveBlock===!0,g=i?.blockMarker??x,$=o.nestedIncludes??i?.nestedIncludes,m=o.out??"CODEOWNERS",y=[];if(c.includes("nested-codeowners")){const j=await ut(a,$,m);for(const p of j)y.push({...p,source:"nested"})}if(c.includes("package-json-maintainers")){const j=pt(r,a);for(const p of j)y.push({...p,source:"maintainers"})}const w=c.includes("project-json")?Z(r,i,y):Z({projects:{}},i,y);if(w.length===0){t.info("No `owners` entries found in any source. Nothing to sync.");return}const h=_(a,m);let l="";try{l=await e.readFile(h,"utf8")}catch(j){if(j.code!=="ENOENT")throw j}const b={regenerationCommand:u},d=f?st(l,nt(w,g,b),g):ot(w,b),{stale:k}=await F([{content:d,path:L(a,h)}],{fs:e,logger:t,mode:o.check?"check":"write",regenerateCommand:"vis sync codeowners",root:a});k.length>0?process.exitCode=1:o.check?t.info(`${h} is up to date.`):t.info(`Wrote ${w.length} entries to ${h}`)},St=({logger:e,options:t,visConfig:o,workspaceRoot:s})=>{const n=s,a=o?.editorconfig??!0,r=G(_(n,"package.json"));if(!r){e.error("Could not read root package.json. Nothing to sync."),process.exitCode=1;return}const i=B(t.fields,ht),c=t.ignorePackageName??[],u=t.check,f=(t.format??"human").toLowerCase(),{quiet:g}=t,$=Ie(n).filter(l=>l!=="."),m=[];let y=0;for(const l of $){const b=_(n,l,"package.json"),d=G(b);if(!d)continue;const k=typeof d.name=="string"?d.name:void 0;if(k!==void 0&&c.length>0&&jt(k,c))continue;y+=1;const j=mt(r,d,{fields:i});j.length!==0&&m.push({filePath:b,packageJsonPath:L(n,b),packageName:k,pkg:d,pkgChanges:j})}if(!u)for(const l of m)wt(l.pkg,l.pkgChanges),Ee(l.filePath,l.pkg,{indent:Se(l.filePath,{useEditorconfig:a}),overwrite:!0});const w=m.flatMap(l=>l.pkgChanges.map(b=>({after:b.after,before:b.before,field:b.field,packageJsonPath:l.packageJsonPath,packageName:l.packageName}))),h={changes:w,fields:i,kind:"package-json-fields",mode:u?"check":"write",totalChanges:w.length,totalPackages:y};if(f==="json")process.stdout.write(`${JSON.stringify(h,null,4)}
|
|
153
|
+
`);else if(w.length===0)e.info(`All ${y} package${y===1?"":"s"} in sync (fields: ${i.join(", ")}).`);else if(u){if(!g)for(const l of w)e.error(`${l.packageJsonPath}: ${l.field} drifts from root`);e.error(`Found ${w.length} field drift${w.length===1?"":"s"} across ${m.length} package${m.length===1?"":"s"}. Run \`vis sync package-json-fields\` to fix.`)}else{if(!g)for(const l of m)e.info(`${l.packageJsonPath}: synced ${l.pkgChanges.map(b=>b.field).join(", ")}`);e.info(`Synced ${w.length} field${w.length===1?"":"s"} across ${m.length} package${m.length===1?"":"s"}.`)}u&&w.length>0&&(process.exitCode=1)},Ot=(e,t)=>{try{return ve(U(e),U(t))}catch{return!1}},_t=async({fs:e,logger:t,options:o,visConfig:s,workspaceRoot:n})=>{const a=n,{config:r,workspace:i}=ne(a,s),c=r.ci?.workflow??{},u=o.provider===void 0?void 0:B(o.provider,[]),f=[...u??[],...c.providers??[]].filter(d=>!X(d));if(f.length>0)throw new v(`Unknown CI provider: ${f.map(d=>`"${d}"`).join(", ")}. Known: github, gitlab.`);const{providers:g,reason:$}=await Ze({configured:c.providers,detectRemote:async()=>{const[{detectKnownRemoteProvider:d},{createShellRunner:k}]=await Promise.all([import("./detect.js"),import("./shell-runner.js")]);return d(a,k())},exists:async d=>{try{return await e.stat(_(a,d)),!0}catch{return!1}},flag:u?.filter(X),prompt:o.check||!process.stdout.isTTY||process.env.CI==="true"?void 0:async()=>{const{multiSelectPrompt:d}=await import("./prompts.js");return d("Which CI providers should vis generate a workflow for?",[{label:"GitHub Actions",value:"github"},{label:"GitLab CI",value:"gitlab"}])}});if(g.length===0)throw new v("No CI provider selected. Pass --provider=github,gitlab or set ci.workflow.providers.");t.info(`▸ CI providers: ${g.join(", ")} (${$})`);const m=await Promise.all([...new Set([".",...Object.values(i.projects).map(d=>d.root??".")])].toSorted().map(async d=>({files:await e.readdir(_(a,d)).catch(()=>[]),path:d}))),y=new Set(m.find(({path:d})=>d===".")?.files),{buildFirstOrdered:w,plan:h}=De({cacheDirectory:r.taskRunner?.cacheDirectory,defaultBase:r.defaultBase,ecosystems:Xe(m),packageManager:Oe(a)?.manager,projects:i.projects,providers:g,rootFiles:y,settings:c,targetDefaults:r.tasks,toolchainPins:r.toolchain?.tools,visVersion:Re()});h.ecosystems.length>0&&t.info(`▸ Toolchains: ${h.ecosystems.map(({name:d})=>d).join(", ")}`);const l=g.includes("gitlab")?de(h):[];l.length>0&&t.warn(`GitLab jobs run in a node image without ${l.join(", ")}. Pin go, python, ruby or rust in toolchain.tools so vis installs them, or give .vis-ci-base an image that has them.`),w.length>0&&t.info(`▸ Running build before ${w.join(", ")} (ci.workflow.buildFirst; set it to false if dependsOn already says what needs build).`);const{stale:b}=await F(Ve(h),{fs:e,isCurrent:Ot,logger:t,mode:o.check?"check":"write",regenerateCommand:"vis sync ci-workflow",root:a});if(b.length>0){process.exitCode=1;return}t.info(`CI workflow ${o.check?"is up to date":"generated"}: ${h.layers.map(d=>d.map(({name:k})=>k).join(" + ")).join(" → ")}`)},Bt=async e=>{const t=e.argument[0];if(!t)throw new Error(`Missing sync kind. Usage: vis sync <kind> (known kinds: ${te.join(", ")})`);if(!e.workspaceRoot)throw new Error("Could not determine workspace root. Run inside a monorepo.");if(t!=="ci-workflow"&&e.options.provider!==void 0)throw new v(`--provider only applies to \`vis sync ci-workflow\`, not ${t}.`);if(t==="ci-workflow"){await _t(e);return}if(t==="codeowners"){await Et(e);return}if(t==="package-json-fields"){St(e);return}throw new Error(`Unknown sync kind: "${t}". Known kinds: ${te.join(", ")}.`)};export{Bt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as C,z as P,U as pe}from"../packem_shared/index-
|
|
1
|
+
import{e as C,z as P,U as pe}from"../packem_shared/index-zq6Ehql6.js";import{M as ge,N as le,P as de,L as me,C as ye,R as ke,p as m,q as fe}from"./cli-main.js";import{i as ue}from"../packem_shared/index-BjdW45xX.js";import he from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import je from"module-replacements/manifests/native.json"with{type:"json"};import ve from"module-replacements/manifests/preferred.json"with{type:"json"};import{K as be,j as t,X as g,O as c,r as O,R as xe,h as Te,i as W}from"../packem_shared/registry-ClmannRw.js";import{a as ee}from"../packem_shared/index--eV4qIz5.js";import{l as Ie}from"./ts-loader.js";import{y as V}from"../packem_shared/isAccessibleSync-DYKTrrvc-CKahNmLy.js";import{U as D}from"../packem_shared/env-NauRSSEC.js";import{d as we,n as Me}from"../packem_shared/pm-runner-CYsiSHYa.js";import{p as re}from"../packem_shared/package-version-BOK3IncQ.js";import{l as Se}from"../packem_shared/glob-Cyk1H9ZL-BtN6Zzwg.js";const Ce=["dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","bundleDependencies"],Ee=["overrides","pnpm","resolutions"],$e=["engines","files"],Oe=r=>{const e=ee.coerce(r)?.major;return e!==void 0&&e>=10},De=r=>{const e=C(r,"pnpm-workspace.yaml");if(!V(e))return{overrides:{},source:"pnpm-workspace.yaml"};try{return{overrides:Ie(e)?.overrides??{},source:"pnpm-workspace.yaml"}}catch{return{overrides:{},source:"pnpm-workspace.yaml"}}},Pe=(r,e)=>{let s={};return e==="pnpm"?s=r.pnpm?.overrides??{}:e==="yarn"||e==="bun"?s=r.resolutions??{}:s=r.overrides??{},{overrides:s,source:"package.json"}},Ne=(r,e,s)=>s.name==="pnpm"&&Oe(s.version)?De(r):Pe(e,s.name),Y=(r,e)=>{const s=e;for(const o of Ee){const n=r.indexOf(o);if(n!==-1&&o!==s)return s==="overrides"?n:n+1}let i=-1;for(const o of Ce){const n=r.indexOf(o);n>i&&(i=n)}if(i!==-1)return i+1;for(const o of $e){const n=r.indexOf(o);if(n!==-1)return n}return r.length},Ae=(r,e)=>{const s=C(r,"pnpm-workspace.yaml");if(!V(s))throw new Error(`pnpm-workspace.yaml not found at ${s}. Cannot write overrides for pnpm v10+.`);let i=P(s);const n=`overrides:
|
|
2
2
|
${Object.entries(e).map(([p,d])=>` '${p}': '${d}'`).join(`
|
|
3
3
|
`)}
|
|
4
4
|
`;i=/^overrides:\s*$/m.test(i)||/^overrides:\s*\n/m.test(i)?i.replace(/^overrides:\s*\n(?:(?:[ \t].*)?\n)*/m,n):`${i.trimEnd()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as Dt}from"node:module";import{X as xe,F as I,b as ke,q as ut,T as mt}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as V,z as $e,U as Ft}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as Dt}from"node:module";import{X as xe,F as I,b as ke,q as ut,T as mt}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as V,z as $e,U as Ft}from"../packem_shared/index-zq6Ehql6.js";import{i as Me}from"../packem_shared/index-BjdW45xX.js";import{whichBin as zt}from"#native";import{b as Bt,a as Wt,e as Ht}from"../packem_shared/ai-analysis-DHlzow2O.js";import{e as Gt,b as Kt,g as qt,s as Yt}from"../packem_shared/ai-cache-D-BSLcuJ.js";import{l as Fe}from"./ts-loader.js";import{y as X}from"../packem_shared/isAccessibleSync-DYKTrrvc-CKahNmLy.js";import{U as et,e as Jt,i as tt,f as Xt,k as Zt}from"../packem_shared/env-NauRSSEC.js";import{L as Qt,h as en,i as tn,K as nn,a as an,f as on,d as rn,b as sn}from"../packem_shared/registry-ClmannRw.js";import{p as f,c as nt}from"./cli-main.js";import{d as cn,c as ln}from"../packem_shared/pm-runner-CYsiSHYa.js";import{a as T}from"../packem_shared/index--eV4qIz5.js";import{c as ht,s as ye,g as dn,p as pn,e as fn}from"../packem_shared/index-BCEhCrLl.js";import{d as gn}from"../packem_shared/anolilab-text-CAM_E6uK.js";import{S as un,a as M,b as vt,d as be,s as mn,f as hn,g as vn,h as wn}from"../packem_shared/junit-audit-CuJShWCH.js";import{t as yn,b as bn,G as xn}from"../packem_shared/ecosystem-gate-DEnubRcS.js";import{s as Sn}from"../packem_shared/scan-progress-Dws7Gif1.js";import{r as An,b as Nn,c as it,q as at,a as ot}from"../packem_shared/advisories-CyXUdibZ.js";import{p as yt}from"../packem_shared/package-version-BOK3IncQ.js";import{r as Cn,l as En,f as jn,a as Pn}from"../packem_shared/dependency-scan-CyByCwef.js";import{r as Rn}from"../packem_shared/manifests-BEGTH1ZG.js";import{c as oe,h as On,i as In,l as Ln,m as Dn}from"../packem_shared/multi-eco-lockfiles-SATPXx6-.js";import{l as Tn,p as Mn,O as _n}from"../packem_shared/osv-bloom-DU6avR2k.js";import{f as Bn}from"../packem_shared/osv-dvIA_vX3.js";let Tt;const Mt=e=>(Tt??=Dt(import.meta.url))(e),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Z=e=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[t,n]=te.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return te.getBuiltinModule(e)}return Mt(e)},{spawnSync:_t}=Z("node:child_process"),{createInterface:Vt}=Z("node:readline"),{stripVTControlCharacters:Ut}=Z("node:util"),{createHash:kn}=Z("node:crypto"),{relative:wt,join:$n}=Z("node:path"),{readFileSync:Vn,writeFileSync:Fn,renameSync:zn,unlinkSync:Un}=Z("node:fs"),rt=(e,t={})=>{Array.isArray(t.extensions)||(t.extensions=["js","mjs","cjs","ts"]);const n=[];for(const i of Qt(e,t))n.push(i.path);return n},Se=e=>`${e.packageName}@${e.packageVersion}:${e.vulnerability.id}`,Wn=e=>e==null||e===!0||e===""||e==="true"||e.toString().toLowerCase()==="all",Hn=(e,t)=>{if(Wn(t))return e;const n=String(t).trim();if(/^\d+$/.test(n)){const a=Number.parseInt(n,10)-1,o=e[a];return o?[o]:[]}const i=n.toLowerCase();return e.filter(a=>{const{aliases:o,id:r}=a.vulnerability;return r.toLowerCase()===i||(o??[]).some(c=>c.toLowerCase()===i)})},Gn=e=>{const{packageName:t,packageVersion:n,vulnerability:i}=e,a=(i.aliases??[]).join(", ")||"none",o=(i.fixedVersions??[]).join(", ")||"no fixed version published";return`You are a security engineer. Explain this dependency vulnerability for a developer triaging it.
|
|
2
2
|
|
|
3
3
|
Package: ${t}@${n}
|
|
4
4
|
Advisory: ${i.id} (aliases: ${a})
|