@visulima/vis 1.0.0-alpha.28 → 1.0.0-alpha.29
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 +35 -0
- package/LICENSE.md +24 -24
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/bin.js +297 -297
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/config.js +12 -12
- package/dist/packem_chunks/doctor-probe.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 -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 -27
- package/dist/packem_chunks/handler15.js +1 -5
- 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 +5 -1
- package/dist/packem_chunks/handler21.js +2 -5
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -2
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +5 -1
- package/dist/packem_chunks/handler26.js +1 -5
- package/dist/packem_chunks/handler27.js +3 -1
- package/dist/packem_chunks/handler28.js +1 -3
- package/dist/packem_chunks/handler29.js +7 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +32 -6
- package/dist/packem_chunks/handler31.js +3 -33
- package/dist/packem_chunks/handler32.js +8 -3
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +2 -2
- package/dist/packem_chunks/handler35.js +11 -3
- package/dist/packem_chunks/handler36.js +3 -22
- package/dist/packem_chunks/handler37.js +21 -60
- package/dist/packem_chunks/handler38.js +61 -3
- package/dist/packem_chunks/handler39.js +3 -6
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +6 -24
- package/dist/packem_chunks/handler41.js +24 -153
- package/dist/packem_chunks/handler42.js +153 -25
- package/dist/packem_chunks/handler43.js +25 -10
- package/dist/packem_chunks/handler44.js +10 -708
- package/dist/packem_chunks/handler45.js +708 -24
- package/dist/packem_chunks/handler46.js +24 -322
- package/dist/packem_chunks/handler47.js +322 -48
- package/dist/packem_chunks/handler48.js +48 -3
- package/dist/packem_chunks/handler49.js +3 -27
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler50.js +21 -189
- package/dist/packem_chunks/handler51.js +194 -33
- package/dist/packem_chunks/handler52.js +34 -0
- 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 +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 +4 -4
- package/dist/packem_chunks/index.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/run.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 +2 -2
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +12 -0
- package/dist/packem_shared/{advisories-BxXiKFbL.js → advisories-DpgSuWDH.js} +1 -1
- package/dist/packem_shared/{affected-shas-Dm7eqcI8.js → affected-shas-BkXXecyi.js} +1 -1
- package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
- package/dist/packem_shared/{ai-fix-BGbnrWCz.js → ai-fix-CfFWatGY.js} +7 -7
- package/dist/packem_shared/{applyDefaults-KxZkvlp3.js → applyDefaults-DLvOqXGX.js} +1 -1
- package/dist/packem_shared/{build-scripts-3E2pmscY.js → build-scripts-D-ysm_bS.js} +1 -1
- package/dist/packem_shared/{cyclonedx-C2k2HmvI.js → cyclonedx-B04lIvwu.js} +3 -3
- package/dist/packem_shared/{dependency-scan-Bki15Yi-.js → dependency-scan-B9wTcLxf.js} +1 -1
- package/dist/packem_shared/{docker-k-Sl8b-w.js → docker-DxA80dRx.js} +1 -1
- package/dist/packem_shared/{failure-log-C3bG1bCA.js → failure-log-n3j_-w8s.js} +1 -1
- package/dist/packem_shared/index-BDF8gawl.js +29 -0
- package/dist/packem_shared/{index-DBq4TVu5.js → index-BfG9_znI.js} +1 -1
- package/dist/packem_shared/{lifecycle-B91p_ra8.js → lifecycle-NHIKDiCh.js} +1 -1
- package/dist/packem_shared/lockfile-CoeFxWAv.js +1 -0
- package/dist/packem_shared/lockfile-DAuTDwow.js +1 -0
- package/dist/packem_shared/{manifests-Z3spBpxv.js → manifests-B7wUR3Rk.js} +1 -1
- package/dist/packem_shared/{min-release-age-B1Jm1_JY.js → min-release-age-YyNI7gqV.js} +1 -1
- package/dist/packem_shared/{native-config-sync-Cnpj2xcn.js → native-config-sync-CgRIIRZV.js} +7 -7
- package/dist/packem_shared/{osv-bloom-ep8GlDGT.js → osv-bloom-BQSIHt5h.js} +2 -2
- package/dist/packem_shared/{pm-runner-COoPLGKi.js → pm-runner-Ta_yz2uP.js} +1 -1
- package/dist/packem_shared/{provenance-DbkJRDqt.js → provenance-DoEp2uOo.js} +1 -1
- package/dist/packem_shared/{readFileSync-CGmzMUF2-D6rUjGDn.js → readFileSync-4c_c6Qey-6SWMDNdw.js} +1 -1
- package/dist/packem_shared/{registry-keys-SylX07bs.js → registry-keys-CD1xHavV.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CJ_5wYSu.js → resolve-explicit-DpSc7RN2.js} +1 -1
- package/dist/packem_shared/{runtime-check-DgXsKCsv.js → runtime-check-Cbtb_Utb.js} +1 -1
- package/dist/packem_shared/{s1ngularity-DlS-4a6K.js → s1ngularity-CIX7UcT5.js} +1 -1
- package/dist/packem_shared/scan-progress-CTVVf9WW.js +2 -0
- package/dist/packem_shared/{selectors-BE2BCnTR.js → selectors-BU8aTRQm.js} +1 -1
- package/dist/packem_shared/{signatures-B-1u4t-c.js → signatures-BHM7cnqB.js} +1 -1
- package/dist/packem_shared/{spinner-B9ZPv1iT.js → spinner-C8xs6QZv.js} +1 -1
- package/dist/packem_shared/{tabs-C-qFIoUv.js → tabs-xZkm6Y_J.js} +1 -1
- package/dist/packem_shared/{toolchain-Jx2lkAYy.js → toolchain-juKl-WgV.js} +1 -1
- package/dist/packem_shared/typosquats-DRKU6d2S.js +1 -0
- package/dist/packem_shared/{use-measured-height-kIDCuc76.js → use-measured-height-Lea6TCVD.js} +1 -1
- package/dist/packem_shared/{verify-C8EAHql6.js → verify-DA80ja1b.js} +1 -1
- package/dist/packem_shared/{vis-update-app-COYmjGKv.js → vis-update-app-BCKzlqj8.js} +1 -1
- package/dist/packem_shared/{watch-BSVsZ_1I.js → watch-DdR-pFzX.js} +1 -1
- package/dist/packem_shared/{watch-loop-CP318TfG.js → watch-loop-C8csFvRU.js} +1 -1
- package/index.d.ts +201 -201
- package/index.js +567 -751
- package/package.json +13 -13
- package/dist/packem_shared/Table-CwC2kW07-EjFLNV0q.js +0 -12
- package/dist/packem_shared/ai-analysis-BnmDFqc8.js +0 -68
- package/dist/packem_shared/index-2r730kXY.js +0 -29
- package/dist/packem_shared/lockfile-DmDfgKaT.js +0 -1
- package/dist/packem_shared/scan-progress-CU4ttEHQ.js +0 -2
- package/dist/packem_shared/typosquats-BxCOUvTJ.js +0 -1
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var R=Object.defineProperty;var k=(n,t)=>R(n,"name",{value:t,configurable:!0});import{createRequire as O}from"node:module";import{i as V,$ as q}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{j as B,q as v}from"./config.js";import{p as e}from"./bin.js";import{A as E}from"../packem_shared/pm-runner-Ta_yz2uP.js";import{x as M}from"../packem_shared/build-scripts-D-ysm_bS.js";import{N as F}from"../packem_shared/native-config-sync-CgRIIRZV.js";const T=O(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=k(n=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[t,i]=$.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return $.getBuiltinModule(n)}return T(n)},"__cjs_getBuiltinModule"),{spawnSync:D}=A("node:child_process");var W=Object.defineProperty,x=k((n,t)=>W(n,"name",{value:t,configurable:!0}),"$$1");const z=/(defineConfig\s*\(\s*\{)/,J=/(export\s+default\s+\{)/,w=x((n,t)=>`${t}${JSON.stringify(n)}: true,`,"renderEntry"),G=x((n,t)=>{if(t.length===0)return{added:[],skipped:[],status:"noop"};const i=B(n);if(!i)return{added:[],skipped:t,status:"no-config"};if(!V(i))return{added:[],skipped:t,status:"no-config"};const s=q(i),h=s.search(/installScripts\s*:\s*\{/);let p=null,c=0;if(h!==-1){const a=s.slice(h),d=/(allow\s*:\s*\{)([^}]*)(\})/.exec(a);d?.index!==void 0&&(p=d,c=h+d.index)}if(p){const a=p[2]??"",d=new Set;for(const g of a.matchAll(/["']([^"']+)["']\s*:/g))d.add(g[1]);for(const g of a.matchAll(/(?:^|,|\{)\s*([a-z_$][\w-]*)\s*:/gi))d.add(g[1]);const f=[],S=[];for(const g of t)d.has(g)?S.push(g):f.push(g);if(f.length===0)return{added:[],configPath:i,skipped:S,status:"noop"};const _=/\n([ \t]+)\S/.exec(a)?.[1]??" ",P=`
|
|
2
|
+
${f.map(g=>w(g,_)).join(`
|
|
3
|
+
`)}`,y=a.replace(/\s+$/,""),b=a.slice(y.length),N=`${y}${y.endsWith(",")||y===""?"":","}${P}${b.length>0?b:`
|
|
4
|
+
`}`,C=`${s.slice(0,c)}${p[1]}${N}${p[3]}${s.slice(c+p[0].length)}`;return v(i,C),{added:f,configPath:i,skipped:S,status:"updated"}}const o=/(installScripts\s*:\s*\{)/;if(o.test(s)){const a=`
|
|
5
|
+
allow: {
|
|
6
|
+
${t.map(f=>w(f," ")).join(`
|
|
3
7
|
`)}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
},`,d=s.replace(o,`$1${a}`);return v(i,d),{added:t,configPath:i,skipped:[],status:"updated"}}const r=/(policies\s*:\s*\{)/;if(r.test(s)){const a=`
|
|
9
|
+
installScripts: {
|
|
10
|
+
allow: {
|
|
11
|
+
${t.map(f=>w(f," ")).join(`
|
|
12
|
+
`)}
|
|
13
|
+
},
|
|
14
|
+
},`,d=s.replace(r,`$1${a}`);return v(i,d),{added:t,configPath:i,skipped:[],status:"updated"}}const u=/(security\s*:\s*\{)/;if(u.test(s)){const a=`
|
|
15
|
+
policies: {
|
|
16
|
+
installScripts: {
|
|
17
|
+
allow: {
|
|
18
|
+
${t.map(f=>w(f," ")).join(`
|
|
19
|
+
`)}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},`,d=s.replace(u,`$1${a}`);return v(i,d),{added:t,configPath:i,skipped:[],status:"updated"}}const l=z.exec(s)??J.exec(s);if(!l)return{added:[],configPath:i,skipped:t,status:"missing-anchor"};const m=`
|
|
23
|
+
security: {
|
|
24
|
+
policies: {
|
|
25
|
+
installScripts: {
|
|
26
|
+
allow: {
|
|
27
|
+
${t.map(a=>w(a," ")).join(`
|
|
28
|
+
`)}
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},`,j=`${s.slice(0,l.index+l[0].length)}${m}${s.slice(l.index+l[0].length)}`;return v(i,j),{added:t,configPath:i,skipped:[],status:"updated"}},"writeApprovedBuildsToVisConfig");var H=Object.defineProperty,I=k((n,t)=>H(n,"name",{value:t,configurable:!0}),"d");const te=I(async({options:n,visConfig:t,workspaceRoot:i})=>{const s=i??process.cwd(),h=E(s);if(h.name==="pnpm"&&!n.scan){e.info("Delegating to pnpm approve-builds...");const p=["approve-builds"];n.all&&p.push("--all");const c=D("pnpm",p,{cwd:s,stdio:"inherit"});if(c.error)throw new Error(`Failed to run pnpm approve-builds: ${c.error.message}`);if(c.status!==0&&c.status!==null&&(e.error(`pnpm approve-builds exited with code ${c.status}`),process.exitCode=c.status),!n.syncNative){e.notice(""),e.notice("Tip: vis.config.ts security.policies.installScripts.allow may now be out of sync with pnpm-workspace.yaml."),e.notice("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const p=t?.security?.policies?.installScripts?.allow??{},c=t?.security?.pinVersions===!0,o=M(s,p,{pinVersions:c});if(o.unapproved.length===0)e.success("No unapproved build scripts found."),n.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${o.unapproved.length} package${o.unapproved.length===1?"":"s"} with unapproved build scripts:
|
|
33
|
+
`);for(const r of o.unapproved)e.info(` ${r.name} (${r.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const r of o.unapproved){const u=c&&r.version?`${r.name}@${r.version}`:r.name;e.notice(` "${u}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),n.write){const r=t?.security?.pinVersions===!0,u=o.unapproved.map(m=>r&&m.version?`${m.name}@${m.version}`:m.name),l=G(s,u);switch(e.info(""),l.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(l.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(u.length)} entr${u.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(l.added.length)} entr${l.added.length===1?"y":"ies"} to ${String(l.configPath)}.`),l.skipped.length>0&&e.info(`Skipped ${String(l.skipped.length)} already-present entr${l.skipped.length===1?"y":"ies"}.`)}}}if(o.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(o.excess.length)} pattern${o.excess.length===1?"":"s"} no longer match any installed package:`);for(const r of o.excess)e.info(` ${r}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(o.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(o.versionDrift.length)} entr${o.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:r,to:u}of o.versionDrift)e.info(` ${r} → ${u}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(n.syncNative){const p=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(p).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const c=F(h.name,s,p);e.info("");for(const o of c)e.success(o)}}},"execute");export{te as default};
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
`)}
|
|
4
|
-
`}`,C=`${i.slice(0,c)}${p[1]}${N}${p[3]}${i.slice(c+p[0].length)}`;return v(s,C),{added:f,configPath:s,skipped:S,status:"updated"}}const o=/(installScripts\s*:\s*\{)/;if(o.test(i)){const a=`
|
|
5
|
-
allow: {
|
|
6
|
-
${t.map(f=>w(f," ")).join(`
|
|
7
|
-
`)}
|
|
8
|
-
},`,d=i.replace(o,`$1${a}`);return v(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const r=/(policies\s*:\s*\{)/;if(r.test(i)){const a=`
|
|
9
|
-
installScripts: {
|
|
10
|
-
allow: {
|
|
11
|
-
${t.map(f=>w(f," ")).join(`
|
|
12
|
-
`)}
|
|
13
|
-
},
|
|
14
|
-
},`,d=i.replace(r,`$1${a}`);return v(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const u=/(security\s*:\s*\{)/;if(u.test(i)){const a=`
|
|
15
|
-
policies: {
|
|
16
|
-
installScripts: {
|
|
17
|
-
allow: {
|
|
18
|
-
${t.map(f=>w(f," ")).join(`
|
|
19
|
-
`)}
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},`,d=i.replace(u,`$1${a}`);return v(s,d),{added:t,configPath:s,skipped:[],status:"updated"}}const l=z.exec(i)??J.exec(i);if(!l)return{added:[],configPath:s,skipped:t,status:"missing-anchor"};const m=`
|
|
23
|
-
security: {
|
|
24
|
-
policies: {
|
|
25
|
-
installScripts: {
|
|
26
|
-
allow: {
|
|
27
|
-
${t.map(a=>w(a," ")).join(`
|
|
28
|
-
`)}
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},`,j=`${i.slice(0,l.index+l[0].length)}${m}${i.slice(l.index+l[0].length)}`;return v(s,j),{added:t,configPath:s,skipped:[],status:"updated"}},"writeApprovedBuildsToVisConfig");var H=Object.defineProperty,I=k((n,t)=>H(n,"name",{value:t,configurable:!0}),"d");const te=I(async({options:n,visConfig:t,workspaceRoot:s})=>{const i=s??process.cwd(),h=E(i);if(h.name==="pnpm"&&!n.scan){e.info("Delegating to pnpm approve-builds...");const p=["approve-builds"];n.all&&p.push("--all");const c=A("pnpm",p,{cwd:i,stdio:"inherit"});if(c.error)throw new Error(`Failed to run pnpm approve-builds: ${c.error.message}`);if(c.status!==0&&c.status!==null&&(e.error(`pnpm approve-builds exited with code ${c.status}`),process.exitCode=c.status),!n.syncNative){e.notice(""),e.notice("Tip: vis.config.ts security.policies.installScripts.allow may now be out of sync with pnpm-workspace.yaml."),e.notice("Run 'vis check --security-config' to compare, or copy the new entries into vis.config.ts.");return}}else{const p=t?.security?.policies?.installScripts?.allow??{},c=t?.security?.pinVersions===!0,o=M(i,p,{pinVersions:c});if(o.unapproved.length===0)e.success("No unapproved build scripts found."),n.write&&(e.info(""),e.info("Nothing to write — there are no unapproved build scripts."));else{e.warn(`Found ${o.unapproved.length} package${o.unapproved.length===1?"":"s"} with unapproved build scripts:
|
|
33
|
-
`);for(const r of o.unapproved)e.info(` ${r.name} (${r.hooks.join(", ")})`);e.notice(""),e.notice("To approve these packages, add them to vis.config.ts:"),e.notice(""),e.notice(" security: {"),e.notice(" policies: {"),e.notice(" installScripts: {"),e.notice(" allow: {");for(const r of o.unapproved){const u=c&&r.version?`${r.name}@${r.version}`:r.name;e.notice(` "${u}": true,`)}if(e.notice(" },"),e.notice(" },"),e.notice(" },"),e.notice(" },"),h.name==="pnpm"&&(e.notice(""),e.notice("Or run 'pnpm approve-builds' to update pnpm-workspace.yaml directly.")),n.write){const r=t?.security?.pinVersions===!0,u=o.unapproved.map(m=>r&&m.version?`${m.name}@${m.version}`:m.name),l=G(i,u);switch(e.info(""),l.status){case"missing-anchor":{e.warn(`Could not locate 'defineConfig({' or 'export default {' in ${String(l.configPath)} — please add entries manually.`);break}case"no-config":{e.warn("No vis.config.ts found. Run 'vis init' first, then re-run with --write.");break}case"noop":{e.info(`All ${String(u.length)} entr${u.length===1?"y":"ies"} were already present in vis.config.ts security.policies.installScripts.allow.`);break}default:e.success(`Wrote ${String(l.added.length)} entr${l.added.length===1?"y":"ies"} to ${String(l.configPath)}.`),l.skipped.length>0&&e.info(`Skipped ${String(l.skipped.length)} already-present entr${l.skipped.length===1?"y":"ies"}.`)}}}if(o.excess.length>0){e.notice(""),e.warn(`Stale installScripts.allow entries — ${String(o.excess.length)} pattern${o.excess.length===1?"":"s"} no longer match any installed package:`);for(const r of o.excess)e.info(` ${r}`);e.notice("Consider removing these entries from vis.config.ts security.policies.installScripts.allow.")}if(o.versionDrift.length>0){e.notice(""),e.warn(`Version drift — ${String(o.versionDrift.length)} entr${o.versionDrift.length===1?"y":"ies"} pinned to an outdated version:`);for(const{from:r,to:u}of o.versionDrift)e.info(` ${r} → ${u}`);e.notice("Rename the keys in vis.config.ts security.policies.installScripts.allow to migrate.")}}if(n.syncNative){const p=t?.security?.policies?.installScripts?.allow??{};if(Object.keys(p).length===0)e.warn("No security.policies.installScripts.allow configured in vis.config.ts. Nothing to sync.");else{const c=F(h.name,i,p);e.info("");for(const o of c)e.success(o)}}},"execute");export{te as default};
|
|
1
|
+
var I=Object.defineProperty;var w=(e,t)=>I(e,"name",{value:t,configurable:!0});import{createRequire as D}from"node:module";import{getAffectedProjects as G}from"@visulima/task-runner";import{C as q,S as L}from"./bin.js";const T=D(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,C=w(e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,r]=h.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return h.getBuiltinModule(e)}return T(e)},"__cjs_getBuiltinModule"),{execFile:N}=C("node:child_process"),{promisify:U}=C("node:util");var V=Object.defineProperty,i=w((e,t)=>V(e,"name",{value:t,configurable:!0}),"t");const A=U(N),J=["[skip ci]","[ci skip]","[no ci]","[vis skip]","[nx skip]"],z=["[vis deploy]","[nx deploy]"],W=["vis","nx"],Z=["CACHED_COMMIT_REF","VERCEL_GIT_PREVIOUS_SHA","GITHUB_BASE_REF","CI_COMMIT_BEFORE_SHA"],K=/^[\w./~^@{}][\w.\-/~^@{}]*$/,Q=i((e=process.env)=>{for(const t of Z){const r=e[t];if(r&&r.trim().length>0)return r.trim()}},"resolveCiBaseSha"),S=i(e=>{if(!K.test(e))throw new Error(`Invalid git ref: "${e}". Refs must start with an alphanumeric character or one of _ . / ~ ^ @ { } and may only contain letters, digits, dots, dashes, underscores, slashes, tildes, carets, @, and braces.`)},"validateGitRef"),X=i(async(e,t)=>{try{return await A("git",["rev-parse","--verify",`${t}^{commit}`],{cwd:e}),!0}catch{return!1}},"isRefReachable"),Y=i(async e=>{try{const{stdout:t}=await A("git",["log","-1","--pretty=%B"],{cwd:e});return t}catch{return""}},"readLastCommitMessage"),M=i((e,t,r)=>W.some(a=>e.includes(`[${a} ${t} ${r}]`)),"matchesPerProjectToken"),ee=i((e,t)=>J.some(r=>e.includes(r))||M(e,"skip",t),"commitHasSkipMessage"),te=i((e,t)=>z.some(r=>e.includes(r))||M(e,"deploy",t),"commitHasForceDeployMessage"),l=i((e,t,r,a)=>({action:"build",message:r,project:e,reason:t,...a}),"decideBuild"),k=i((e,t,r,a)=>({action:"skip",message:r,project:e,reason:t,...a}),"decideSkip"),re=i(e=>`${e.action==="skip"?"🛑":"✅"} ${e.message}`,"formatDecisionLine"),oe=i((e,t)=>e.action==="skip"||t?0:1,"exitCodeFor");var se=Object.defineProperty,_=w((e,t)=>se(e,"name",{value:t,configurable:!0}),"u");const R=new Set(["deep","direct","none"]),de=_(async({argument:e,logger:t,options:r,visConfig:a,workspaceRoot:p})=>{const o=e[0]??"",E=!!r.json,B=!!r.verbose,O=!!(r["exit-zero-on-build"]??r.exitZeroOnBuild),u=_(s=>{B&&!E&&t.info(`❱ ${s}`)},"debug"),n=_(s=>{E?process.stdout.write(`${JSON.stringify(s)}
|
|
2
|
+
`):t.info(re(s)),process.exit(oe(s,O))},"emit");if(!o)return n(l("","missing-project-argument","Missing project argument. Usage: vis ci ignore <project>"));if(!p)return n(l(o,"workspace-error","Could not determine workspace root — building defensively"));const g=await Y(p),y=g.trim().split(`
|
|
3
|
+
`)[0]??"";if(u(`commit: ${y}`),g&&te(g,o))return n(l(o,"commit-force-deploy",`Force-deploy keyword in commit: "${y}"`));if(g&&ee(g,o))return n(k(o,"commit-skip",`Skip keyword in commit: "${y}"`));let $,P;try{({packageJsons:P,workspace:$}=q(p,a))}catch(s){const d=s instanceof Error?s.message:String(s);return n(l(o,"workspace-error",`Workspace discovery failed (${d}) — building defensively`))}if(!Object.hasOwn($.projects,o))return n(l(o,"project-unknown",`Project "${o}" not found in workspace — building defensively`));try{const s=r.base?.trim(),d=Q();let c=s||d||"HEAD~1";const m=r.head?.trim()||"HEAD";S(c),S(m),u(`resolved base ref: ${c} (source: ${s?"flag":d?"ci-env":"default"})`);const x=X(p,c),F=L(p,$,P);await x||(u(`base ref ${c} not reachable — falling back to HEAD~1`),c="HEAD~1"),u(`comparing ${c}...${m}`);const j=r.downstream??"deep",b=r.upstream??"none";if(!R.has(j))throw new Error(`Invalid --downstream value: "${j}". Must be "none", "direct", or "deep".`);if(!R.has(b))throw new Error(`Invalid --upstream value: "${b}". Must be "none", "direct", or "deep".`);const H={base:c,downstream:j,head:m,projectGraph:F,projects:$.projects,upstream:b,workspaceRoot:p},f=await G(H);u(`changed files: ${f.changedFiles.length}`),u(`affected projects: ${f.affectedProjects.join(", ")||"(none)"}`);const v={base:c,head:m};return f.changedFiles.length===0?n(k(o,"no-changes",`No files changed between ${c}...${m}`,{...v,affectedProjects:[]})):f.affectedProjects.includes(o)?n(l(o,"project-affected",`Build ${o}: affected by ${f.changedFiles.length} changed file(s)`,{...v,affectedProjects:f.affectedProjects})):n(k(o,"project-not-affected",`Skip ${o}: not affected by changes between ${c}...${m}`,{...v,affectedProjects:f.affectedProjects}))}catch(s){const d=s instanceof Error?s.message:String(s);return t.error(`Affected detection failed: ${d}`),n(l(o,"workspace-error",`Affected detection failed (${d}) — building defensively`))}},"execute");export{de as default};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)
|
|
3
|
-
|
|
1
|
+
var m=Object.defineProperty;var g=(e,t)=>m(e,"name",{value:t,configurable:!0});import{E as v}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{M as w}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";var $=Object.defineProperty,u=g((e,t)=>$(e,"name",{value:t,configurable:!0}),"c");const h={docker:".dockerignore",npm:".npmignore",slug:".slugignore",vercel:".vercelignore"},E=[".git",".gitattributes",".gitignore",".editorconfig",".vscode/",".idea/",".DS_Store","*.md","LICENSE*","LICENCE*","CHANGELOG*","CONTRIBUTING*","AUTHORS*","docs/","doc/","examples/","example/",".github/",".gitlab-ci.yml",".circleci/","appveyor.yml",".eslintrc*","eslint.config.*",".prettierrc*","prettier.config.*","*.log","npm-debug.log*","*.d.ts","*.map","*.flow","tsconfig*.json","__tests__/","__mocks__/","test/","tests/","*.test.*","*.spec.*","coverage/",".nyc_output/"],_={docker:["node_modules",".vis/","Dockerfile*",".dockerignore"],npm:[],slug:["node_modules"],vercel:["node_modules",".vercel/"]},y=u(e=>{const t=new Set,o=[];for(const r of[...E,..._[e]])t.has(r)||(t.add(r),o.push(r));return o},"buildIgnorePatterns"),I=u(e=>e.trim(),"normalizeLine"),b="# Added by vis ignore",k=u((e,t)=>{const o=new Set;for(const n of e.split(/\r?\n/u)){const c=I(n);c!==""&&!c.startsWith("#")&&o.add(c)}const r=[];for(const n of t)o.has(n)||(o.add(n),r.push(n));if(r.length===0)return{added:r,content:e};const s=e.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,d=[b,...r].join(s);if(e.trim()==="")return{added:r,content:`${d}${s}`};const i=e.endsWith(`
|
|
5
|
+
`)?s:`${s}${s}`;return{added:r,content:`${e}${i}${d}${s}`}},"mergeIgnore");var N=Object.defineProperty,p=g((e,t)=>N(e,"name",{value:t,configurable:!0}),"s");const S=p(e=>e==="docker"||e==="npm"||e==="slug"||e==="vercel","isIgnoreTarget"),O=p(async(e,t)=>{try{return await e.readFile(t,"utf8")}catch{return""}},"readExisting"),C=p(async({fs:e,logger:t,options:o,process:r,workspaceRoot:s})=>{const d=s??r.cwd,i=o.target??"docker";if(!S(i))throw new Error(`Invalid --target "${i}". Expected one of: docker, vercel, npm, slug.`);const n=h[i],c=w(d,n),f=await O(e,c),{added:a,content:l}=k(f,y(i));if(o.json){process.stdout.write(`${JSON.stringify({added:a,file:n,target:i},null,2)}
|
|
6
|
+
`);return}if(o.write){if(a.length===0){t.info(`${n} is already up to date (no new patterns).`);return}await e.writeFile(c,l),t.info(`Added ${a.length} pattern(s) to ${n}.`);return}process.stdout.write(l.endsWith(`
|
|
7
|
+
`)?l:`${l}
|
|
8
|
+
`),t.info(v(`(${a.length} new pattern(s); re-run with --write to save ${n})`))},"execute");export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var J=Object.defineProperty;var T=(e,t)=>J(e,"name",{value:t,configurable:!0});import{z as S}from"../packem_shared/readFileSync-
|
|
1
|
+
var J=Object.defineProperty;var T=(e,t)=>J(e,"name",{value:t,configurable:!0});import{z as S}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{ag as q,C as b}from"./bin.js";import{f as $}from"../packem_shared/selectors-BU8aTRQm.js";import{o as L}from"../packem_shared/index-DH-5hsrC.js";var M=Object.defineProperty,I=T((e,t)=>M(e,"name",{value:t,configurable:!0}),"p");const D=I((e,t)=>{for(const f of t)if(L(f,e))return!0;return!1},"matchesAny"),z=I((e,t={})=>{const{depTypes:f,excludePatterns:l,externalOnly:y,includePatterns:d,internalOnly:j}=t;if(j&&y)return[];const u=f&&f.length>0?new Set(f):void 0,N=d&&d.length>0?d:void 0,O=l&&l.length>0?l:void 0,w=[];for(const m of e)j&&!m.isInternal||y&&m.isInternal||u&&!u.has(m.depType)||N&&(!m.packageName||!D(m.packageName,N))||O&&m.packageName&&D(m.packageName,O)||w.push(m);return w},"filterDepInstances");var B=Object.defineProperty,v=T((e,t)=>B(e,"name",{value:t,configurable:!0}),"y");const F=new Set(["json","ndjson","table"]),R=v(e=>{if(e===void 0)return"table";const t=e.toLowerCase();if(!F.has(t))throw new Error(`--format must be one of: table, json, ndjson (got "${e}")`);return t},"resolveFormat"),x=v((e,t)=>({depName:e.depName,depType:e.depType,isInternal:e.isInternal,packageDir:e.packageDir,packageJsonPath:S(t,e.packageJsonPath),packageName:e.packageName,specifier:e.specifier}),"toDepRecord"),P=new Set(["dependencies","devDependencies","optionalDependencies","overrides","peerDependencies","pnpm.overrides","resolutions"]),V=v(e=>{if(!e||e.length===0)return;const t=[],f=[];for(const l of e)for(const y of l.split(",")){const d=y.trim();d&&(P.has(d)?t.push(d):f.push(d))}if(f.length>0)throw new Error(`Unknown --dep-type value(s): ${f.join(", ")}. Valid: ${[...P].join(", ")}`);return t.length>0?t:void 0},"parseDepTypes"),H=v(async({logger:e,options:t,visConfig:f,workspaceRoot:l})=>{if(!l)throw new Error("Could not determine workspace root.");const y=R(t.format);if(t.deps===!0){if(t.internalOnly&&t.externalOnly)throw new Error("--internal-only and --external-only are mutually exclusive");const c=V(t.depType),i=q(l);let n=z(i,{depTypes:c,excludePatterns:t.exclude,externalOnly:t.externalOnly,includePatterns:t.include,internalOnly:t.internalOnly});if(t.query){const{workspace:r}=b(l,f),p=new Set($(Object.keys(r.projects),r,t.query));n=n.filter(k=>k.packageName!==void 0&&p.has(k.packageName))}const g=[...n].sort((r,p)=>{const k=`${r.packageName??r.packageDir} ${r.depType} ${r.depName}`,E=`${p.packageName??p.packageDir} ${p.depType} ${p.depName}`;return k.localeCompare(E)});if(y==="ndjson"){for(const r of g)e.info(JSON.stringify(x(r,l)));return}if(y==="json"){const r=g.map(p=>x(p,l));e.info(JSON.stringify(r,null,t.pretty===!0?2:void 0));return}if(g.length===0){e.info("No matching dep-instances.");return}const a=["Package","Block","Dep","Specifier","Internal","Path"],o=g.map(r=>[r.packageName??r.packageDir,r.depType,r.depName,r.specifier,r.isInternal?"yes":"no",S(l,r.packageJsonPath)]),s=a.map((r,p)=>Math.max(r.length,...o.map(k=>(k[p]??"").length))),h=v((r,p)=>r.padEnd(p),"pad");e.info(a.map((r,p)=>h(r,s[p])).join(" ")),e.info(s.map(r=>"─".repeat(r)).join("──"));for(const r of o)e.info(r.map((p,k)=>h(p,s[k])).join(" "));e.info(""),e.info(`${String(g.length)} dep-instance(s)`);return}if(y==="ndjson")throw new Error("--format=ndjson is only supported with --deps");const{projectOptions:d,workspace:j}=b(l,f);let u=Object.keys(j.projects).sort();if(t.query&&(u=$(u,j,t.query)),u.length===0){e.info("No projects found.");return}const N=t.inferred===!0,O=t.targets===!0||N;if(y==="json"){const c=u.map(i=>{const n=j.projects[i],g=d.get(i)??{},a=Object.entries(n.targets??{}).map(([o])=>{const s=g[o],h=s?.inferred===!0;return{aliases:s?.aliases??[],command:s?.command,description:s?.description,...h?{inferred:!0}:{},name:o,type:s?.type}}).filter(o=>!N||o.inferred===!0);return{language:n.language,layer:n.layer,name:i,root:n.root,stack:n.stack,tags:n.tags??[],targets:a,type:n.projectType??"library"}});e.info(JSON.stringify(c,null,2));return}const w=v((c,i)=>{const n=c.map((a,o)=>{let s=0;for(const h of i)s=Math.max(s,(h[o]??"").length);return Math.max(a.length,s)}),g=v((a,o)=>a.padEnd(o),"pad");e.info(c.map((a,o)=>g(a,n[o])).join(" ")),e.info(n.map(a=>"─".repeat(a)).join("──"));for(const a of i)e.info(a.map((o,s)=>g(o,n[s])).join(" "))},"renderTable");if(O){const c=[];for(const i of u){const n=j.projects[i],g=d.get(i)??{};for(const a of Object.keys(n.targets??{}).sort()){const o=g[a],s=o?.inferred===!0;if(N&&!s)continue;const h=n.targets?.[a],r=h?.cache===!1?"no":h?.cache===!0?"yes":"default";c.push([i,a,o?.type??"—",r,s?"yes":"no",o?.description??"—"])}}if(c.length===0){e.info(N?"No inferred targets found.":"No targets found.");return}w(["Project","Target","Type","Cache","Inferred","Description"],c),e.info(""),e.info(`${String(c.length)} target(s) across ${String(u.length)} project(s)`);return}const m=["Project","Type","Layer","Tags","Targets"],C=u.map(c=>{const i=j.projects[c],n=Object.keys(i.targets??{});return[c,i.projectType??"library",i.layer??"—",(i.tags??[]).join(", ")||"—",n.length>4?`${n.slice(0,4).join(", ")}… (${String(n.length)})`:n.join(", ")||"—"]});w(m,C),e.info(""),e.info(`${String(u.length)} project(s)`)},"execute");export{H as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var F=Object.defineProperty;var R=(e,t)=>F(e,"name",{value:t,configurable:!0});import{createRequire as J}from"node:module";import{
|
|
1
|
+
var F=Object.defineProperty;var R=(e,t)=>F(e,"name",{value:t,configurable:!0});import{createRequire as J}from"node:module";import{r as L,an as Q,ao as I,ap as B,aq as K,ar as Y,as as g,at as H,au as U,av as X,aw as Z,ax as ee,ay as te,az as oe,aA as ne,aB as se,aC as ie,aD as re,aE as ae}from"./bin.js";import{i as $,$ as T,M as d,Q as pe}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{e as fe,q as A}from"./config.js";import{v as le}from"../packem_shared/verify-DA80ja1b.js";const G=J(import.meta.url),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,z=R(e=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[t,n]=E.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return E.getBuiltinModule(e)}return G(e)},"__cjs_getBuiltinModule"),{readdirSync:ce,statSync:ue}=z("node:fs"),{stdin:_,stdout:ge}=E,{createInterface:de}=z("node:readline/promises");var me=Object.defineProperty,p=R((e,t)=>me(e,"name",{value:t,configurable:!0}),"u");const x="__global__",b=p(e=>[...new Set(e)].sort((t,n)=>t.localeCompare(n)),"sortStrings"),ve=p(e=>`{${Object.keys(e).sort().map(t=>`${t}=${JSON.stringify(e[t])}`).join(",")}}`,"canonicalizeObjectToken"),h=p(e=>{if(!Array.isArray(e))return[];const t=[];for(const n of e)typeof n=="string"?t.push(n):n&&typeof n=="object"&&t.push(ve(n));return b(t)},"normalizeTokenList"),w=p(e=>({cache:void 0,dependsOn:[],env:[],id:e,inputs:[],outputs:[]}),"emptyNode"),k=p((e,t,n)=>n?`^${t}`:e&&e!=="self"&&e!=="~"?`${e}#${t}`:t,"canonicalEdge"),ye=p((e,t)=>{const n=e.trim();if(t==="moon"){if(n.startsWith("^:"))return k(void 0,n.slice(2),!0);if(n.startsWith("~:"))return k(void 0,n.slice(2),!1);if(n.includes(":")){const[s,o]=n.split(":");return k(s,o??"",!1)}return n}if(n.startsWith("^"))return k(void 0,n.slice(1),!0);if(n.includes("#")){const[s,o]=n.split("#");return k(s,o??"",!1)}return n},"normalizeStringEdge"),M=p((e,t)=>{if(!Array.isArray(e))return[];const n=[];for(const s of e){if(typeof s=="string"){n.push(ye(s,t));continue}if(!s||typeof s!="object")continue;const o=s,{target:i}=o;if(!i)continue;if(o.dependencies===!0){n.push(k(void 0,i,!0));continue}if(o.projects===void 0){n.push(k(void 0,i,!1));continue}const r=Array.isArray(o.projects)?o.projects:[o.projects];for(const c of r)n.push(c==="^"?k(void 0,i,!0):k(c,i,!1))}return b(n)},"normalizeDependsOn"),O=p(e=>{if($(e))try{return JSON.parse(T(e))}catch{return}},"readJson"),he=p(e=>{const t=new Map,n=O(d(e,"turbo.json"));if(!n)return t;const s=n.tasks??n.pipeline??{};for(const[i,r]of Object.entries(s)){const c=i.includes("#")?i:`*#${i}`,a=w(c);a.dependsOn=M(r.dependsOn,"turbo"),a.inputs=h(r.inputs),a.outputs=h(r.outputs),a.env=b([...r.env??[],...r.passThroughEnv??[]]),a.cache=r.cache===!1?!1:void 0,t.set(c,a)}const o=w(x);return o.inputs=h(n.globalDependencies),o.env=b([...n.globalEnv??[],...n.globalPassThroughEnv??[]]),(o.inputs.length>0||o.env.length>0)&&t.set(x,o),t},"parseTurboModel"),ke=new Set([".git",".nx",".turbo",".vis","build","coverage","dist","node_modules"]),N=p((e,t,n=8)=>{const s=[],o=p((i,r)=>{if(r>n)return;let c;try{c=ce(i)}catch{return}for(const a of c.toSorted()){if(a===t){s.push(d(i,a));continue}if(a.startsWith(".")&&a!==".moon"||ke.has(a))continue;const u=d(i,a);try{ue(u).isDirectory()&&o(u,r+1)}catch{}}},"walk");return o(e,0),s},"findFiles"),q=p((e,t)=>{e.dependsOn=M(t.dependsOn,"nx"),e.inputs=h(t.inputs),e.outputs=h(t.outputs),e.cache=typeof t.cache=="boolean"?t.cache:void 0},"applyNxTarget"),we=p(e=>{const t=new Map,n=O(d(e,"nx.json"));for(const[s,o]of Object.entries(n?.targetDefaults??{})){const i=`*#${s}`,r=w(i);q(r,o),t.set(i,r)}for(const s of N(e,"project.json")){const o=O(s);if(!(!o?.name||!o.targets))for(const[i,r]of Object.entries(o.targets)){const c=`${o.name}#${i}`,a=w(c);q(a,r),t.set(c,a)}}return t},"parseNxModel"),D=p((e,t)=>{e.dependsOn=M(t.deps,"moon"),e.inputs=h(t.inputs),e.outputs=h(t.outputs),e.cache=typeof t.options?.cache=="boolean"?t.options.cache:void 0},"applyMoonTask"),V=p(e=>{if($(e))try{return L(e)}catch{return}},"readMoonYaml"),$e=p(e=>{const t=new Map,n=d(e,".moon"),s=[d(n,"tasks.yml"),d(n,"tasks.yaml")];for(const o of s){const i=V(o);if(i){for(const[r,c]of Object.entries(i.tasks??{})){const a=`*#${r}`,u=w(a);D(u,c),t.set(a,u)}if(i.implicitInputs&&i.implicitInputs.length>0){const r=w(x);r.inputs=h(i.implicitInputs),t.set(x,r)}}}for(const o of[...N(e,"moon.yml"),...N(e,"moon.yaml")]){const i=V(o);if(!i?.tasks)continue;const r=o.split(/[/\\]/).at(-2)??"*";for(const[c,a]of Object.entries(i.tasks)){const u=`${r}#${c}`,y=w(u);D(y,a),t.set(u,y)}}return t},"parseMoonModel"),xe=p((e,t)=>{e.dependsOn=M(t.dependsOn,"vis"),e.inputs=h(t.inputs),e.outputs=h(t.outputs),e.env=b([...t.env??[],...t.passThroughEnv??[],...t.options?.passThroughEnv??[]]),e.cache=t.cache===!1?!1:typeof t.cache=="boolean"?t.cache:void 0},"applyVisTask"),be=p(async e=>{const t=new Map,n=await fe(e);for(const[i,r]of Object.entries(n.tasks??{})){const c=`*#${i}`,a=w(c);xe(a,r??{}),t.set(c,a)}const s=n.taskRunner??{},o=w(x);return o.inputs=h(s.globalInputs),o.env=b([...s.globalEnv??[],...s.globalPassThroughEnv??[]]),(o.inputs.length>0||o.env.length>0)&&t.set(x,o),t},"buildVisModel"),Re=p((e,t)=>{switch(t){case"moon":return $e(e);case"nx":return we(e);default:return he(e)}},"buildSourceModel"),Ee=p(e=>{const t=[];return $(d(e,"turbo.json"))&&t.push("turbo"),$(d(e,"nx.json"))&&t.push("nx"),($(d(e,".moon","tasks.yml"))||$(d(e,".moon","tasks.yaml")))&&t.push("moon"),t.length===1?t[0]:void 0},"detectSourceTool"),j=p((e,t,n,s,o)=>{const i=s.filter(a=>!o.includes(a)),r=o.filter(a=>!s.includes(a));if(i.length===0&&r.length===0)return;const c=[];i.length>0&&c.push(`dropped [${i.join(", ")}]`),r.length>0&&c.push(`added [${r.join(", ")}]`),e.push({axis:n,detail:`${n} diverged: ${c.join("; ")}`,node:t,severity:i.length>0?"error":"warning"})},"diffArrayAxis"),Ce=p((e,t,n)=>{const s=[],o=b([...e.keys(),...t.keys()]);for(const i of o){const r=e.get(i),c=t.get(i);if(r&&!c){const a=n==="turbo"&&i.includes("#")&&!i.startsWith("*#")&&i!==x;s.push({axis:"target-set",detail:a?`source target \`${i}\` was skipped by design (turbo project#task is migrated into per-project project.json — move it there and re-verify)`:`source target \`${i}\` has no equivalent in the migrated vis config`,node:i,severity:a?"warning":"error"});continue}if(!r&&c){s.push({axis:"target-set",detail:`migrated vis config defines \`${i}\` with no source equivalent (extra target — not a regression, but review)`,node:i,severity:"warning"});continue}!r||!c||(j(s,i,"dependsOn",r.dependsOn,c.dependsOn),j(s,i,"inputs",r.inputs,c.inputs),j(s,i,"outputs",r.outputs,c.outputs),j(s,i,"env",r.env,c.env),r.cache!==void 0&&c.cache!==void 0&&r.cache!==c.cache&&s.push({axis:"cache",detail:`cache flag diverged: source=${String(r.cache)} vis=${String(c.cache)} (changes what invalidates the cache)`,node:i,severity:"error"}))}return s.sort((i,r)=>i.node.localeCompare(r.node)||i.axis.localeCompare(r.axis)),{findings:s,source:n,sourceNodeCount:e.size,visNodeCount:t.size}},"diffModels"),Se=new Set(["json","ndjson","table"]),je=p(e=>({equivalent:e.findings.every(t=>t.severity!=="error"),findings:e.findings,source:e.source,sourceNodeCount:e.sourceNodeCount,visNodeCount:e.visNodeCount}),"toJsonPayload"),Me=p((e,t,n)=>{if(t==="json"){process.stdout.write(`${JSON.stringify(je(e),void 0,2)}
|
|
2
2
|
`);return}if(t==="ndjson"){for(const s of e.findings)process.stdout.write(`${JSON.stringify(s)}
|
|
3
|
-
`);return}if(n.info(`Migration equivalence: ${e.source} → vis`),n.info(` source nodes: ${String(e.sourceNodeCount)} vis nodes: ${String(e.visNodeCount)}`),e.findings.length===0){n.info(" ✓ task graph + cache-key surface preserved (no divergence).");return}for(const s of e.findings){const o=` [${s.severity}] ${s.node} (${s.axis}) — ${s.detail}`;s.severity==="error"?n.warn(o):n.info(o)}},"formatEquivalenceReport"),Te=p((e,t)=>e.findings.some(n=>t==="warning"?!0:n.severity==="error")?1:0,"equivalenceExitCode");var Oe=Object.defineProperty,Ne=R((e,t)=>Oe(e,"name",{value:t,configurable:!0}),"n");const W=Ne(async e=>{if(!_.isTTY)return!0;const t=de({input:_,output:ge});try{const n=(await t.question(`${e} [Y/n] `)).trim().toLowerCase();return n===""||n==="y"||n==="yes"}finally{t.close()}},"confirm");var Ie=Object.defineProperty,C=R((e,t)=>Ie(e,"name",{value:t,configurable:!0}),"p");const Ae=[{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"}],_e=[{description:"VisTaskConfig.targets → VisTaskConfig.tasks",next:"tasks",previous:"targets"}],
|
|
3
|
+
`);return}if(n.info(`Migration equivalence: ${e.source} → vis`),n.info(` source nodes: ${String(e.sourceNodeCount)} vis nodes: ${String(e.visNodeCount)}`),e.findings.length===0){n.info(" ✓ task graph + cache-key surface preserved (no divergence).");return}for(const s of e.findings){const o=` [${s.severity}] ${s.node} (${s.axis}) — ${s.detail}`;s.severity==="error"?n.warn(o):n.info(o)}},"formatEquivalenceReport"),Te=p((e,t)=>e.findings.some(n=>t==="warning"?!0:n.severity==="error")?1:0,"equivalenceExitCode");var Oe=Object.defineProperty,Ne=R((e,t)=>Oe(e,"name",{value:t,configurable:!0}),"n");const W=Ne(async e=>{if(!_.isTTY)return!0;const t=de({input:_,output:ge});try{const n=(await t.question(`${e} [Y/n] `)).trim().toLowerCase();return n===""||n==="y"||n==="yes"}finally{t.close()}},"confirm");var Ie=Object.defineProperty,C=R((e,t)=>Ie(e,"name",{value:t,configurable:!0}),"p");const Ae=[{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"}],_e=[{description:"VisTaskConfig.targets → VisTaskConfig.tasks",next:"tasks",previous:"targets"}],qe=C(e=>new RegExp(String.raw`(^|[\s,{(\[])(["']?)${e}\2(\s*:)`,"gmu"),"buildKeyRegex"),De=C((e,t)=>{let n=e;const s=[];for(const o of t){const i=qe(o.previous);i.test(n)&&(i.lastIndex=0,n=n.replace(i,(r,c,a,u)=>`${c}${a}${o.next}${a}${u}`),s.push(o))}return{applied:s,output:n}},"applyRenames"),P=C((e,t)=>De(e,t),"rewriteSource"),Ve=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],Pe=new Set(["vis.task.cjs","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.mts","vis.task.ts"]),ze=C(e=>{for(const t of Ve){const n=d(e,t);if($(n))return n}},"findConfigFile"),Be=C(e=>{const t=[];try{for(const n of Q(e,{includeDirs:!1,includeFiles:!0,includeSymlinks:!1,skip:[/node_modules/,/\.git/,/\.vis\b/,/dist\b/,/\.next\b/,/\.nuxt\b/]}))Pe.has(pe(n.path))&&t.push(n.path)}catch{}return t},"findTaskConfigFiles"),We=C((e,t,n,s)=>{const o=ze(e);if(o){const r=T(o),{applied:c,output:a}=P(r,Ae);if(c.length===0)n.info(`${o} already uses the current schema — no rewrite needed.`);else if(t.dryRun)n.info(`── ${o} (preview) ──`),n.info(a),n.info("── end preview ──"),n.info(`Would apply ${String(c.length)} rename(s): ${c.map(u=>u.description).join(", ")}`);else{I(o,s),A(o,a),n.info(`Rewrote ${o} (backup at ${o}.bak). Applied ${String(c.length)} rename(s).`);for(const u of c)s.manualSteps.push(`Renamed ${u.description} in ${o}`)}}else n.warn("No vis.config.ts found at workspace root — nothing to migrate."),s.warnings.push("No vis.config.{ts,mts,cts,js,mjs,cjs} at workspace root.");const i=t.taskConfigPaths??Be(e);for(const r of i){if(!$(r))continue;const c=T(r),a=P(c,_e);if(a.applied.length!==0)if(t.dryRun)n.info(`── ${r} (preview) ──`),n.info(a.output),n.info("── end preview ──"),n.info(`Would apply ${String(a.applied.length)} rename(s): ${a.applied.map(u=>u.description).join(", ")}`);else{I(r,s),A(r,a.output),n.info(`Rewrote ${r} (backup at ${r}.bak). Applied ${String(a.applied.length)} rename(s).`);for(const u of a.applied)s.manualSteps.push(`Renamed ${u.description} in ${r}`)}}},"migrateSelf");var Fe=Object.defineProperty,f=R((e,t)=>Fe(e,"name",{value:t,configurable:!0}),"r");const l=f(e=>{const t=e.workspaceRoot??process.cwd(),n=e.visConfig??{};return{config:n,dryRun:!!e.options.dryRun,logger:e.logger,packageManager:K(t),report:B(),root:t,useEditorconfig:typeof n.editorconfig=="boolean"?n.editorconfig:!0}},"buildContext"),m=f(async(e,t,n)=>{if(t.yes||t.dryRun)return!0;const s=await W(`This will edit files, scripts, and hooks for "${e}". Backups (.bak) will be created. Continue?`);return s||n.info("Aborted."),s},"maybeConfirm"),v=f(e=>{e.dryRun&&e.logger.info(`Running in dry-run mode — no changes will be made.
|
|
4
4
|
`)},"announceDryRun"),Je=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("deps",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating dependencies and scripts ──"),Y(o.root,o.packageManager,o.config,{dryRun:o.dryRun},e,o.report),e.info(""),g(o.report,e)},"migrateDepsExecuteImpl"),Ge=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("lint-staged",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating lint-staged ──"),H(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateLintStagedExecuteImpl"),Le=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("nano-staged",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating nano-staged ──"),U(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateNanoStagedExecuteImpl"),Qe=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("turborepo",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating turborepo ──"),X(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateTurborepoExecuteImpl"),Ke=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("nx",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating nx ──");const i=!!t.aggressive;Z(o.root,{aggressive:i,dryRun:o.dryRun,force:i||!!t.force,rewriteSyncGenerators:i||!!t.rewriteSyncGenerators,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateNxExecuteImpl"),Ye=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("moon",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating moon ──"),ee(o.root,{copyTemplates:!!t.copyTemplates,dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateMoonExecuteImpl"),He=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("gitleaks",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating gitleaks ──"),te(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateGitleaksExecuteImpl"),Ue=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("kingfisher",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating Kingfisher ──"),oe(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateKingfisherExecuteImpl"),Xe=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("secretlint",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating secretlint ──"),ne(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSecretlintExecuteImpl"),Ze=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("syncpack",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating syncpack ──"),se(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSyncpackExecuteImpl"),et=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("sherif",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating sherif ──"),ie(o.root,{dryRun:o.dryRun,useEditorconfig:o.useEditorconfig},e,o.report),e.info(""),g(o.report,e)},"migrateSherifExecuteImpl"),tt=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{if(!await m("self",t,e))return;const o=l({logger:e,options:t,visConfig:n,workspaceRoot:s});v(o),e.info("── Migrating vis.config.ts to current schema ──"),We(o.root,{dryRun:o.dryRun},e,o.report),e.info(""),g(o.report,e)},"migrateSelfExecuteImpl"),ot=f(({logger:e,workspaceRoot:t})=>{const n=t??process.cwd();le(n,e).length>0&&(process.exitCode=1)},"migrateVerifyExecuteImpl"),nt=f(async({logger:e,options:t,workspaceRoot:n})=>{const s=n??process.cwd(),o=t.format??"table";if(!Se.has(o)){e.warn(`Invalid --format: ${String(t.format)}. Expected table | json | ndjson.`),process.exitCode=1;return}const i=t.failOn==="warning"?"warning":"error";let r;if(t.from){if(t.from!=="turbo"&&t.from!=="nx"&&t.from!=="moon"){e.warn(`Invalid --from: ${t.from}. Expected turbo | nx | moon.`),process.exitCode=1;return}r=t.from}else if(r=Ee(s),!r){e.warn("Could not auto-detect the source tool (need exactly one of turbo.json / nx.json / .moon/tasks.yml). Pass --from <turbo|nx|moon>."),process.exitCode=1;return}const c=Re(s,r);if(c.size===0){e.warn(`No ${r} task graph found at ${s} — nothing to verify.`),process.exitCode=1;return}const a=await be(s);if(a.size===0){e.warn("No migrated vis task graph found (vis.config.ts has no tasks). Run the migrator first."),process.exitCode=1;return}const u=Ce(c,a,r);Me(u,o,e),process.exitCode=Te(u,i)},"migrateVerifyGraphExecuteImpl"),st=f(async({logger:e,options:t,visConfig:n,workspaceRoot:s})=>{const o=s??process.cwd(),i=re(o,n??{}),r=ae(i);if(r.length===0){e.info("No applicable migrations detected in this workspace.");return}const c=!!t.dryRun;e.info(`Detected ${String(r.length)} migration(s):`);for(const y of r)e.info(` • ${y.title} — ${y.description}`);if(e.info(""),!t.yes&&!c&&!await W("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.
|
|
5
5
|
`);const a=B(),u=[];for(const y of r)try{if(e.info(`── Applying ${y.title} ──`),c)for(const S of y.probe(i))e.info(S);else y.apply(i,a,e);e.info("")}catch(S){u.push({error:S,id:y.id}),e.warn(`Failed to apply ${y.title}: ${S.message}`)}g(a,e),u.length>0&&(e.warn(""),e.warn(`${String(u.length)} migration(s) failed — see messages above.`),process.exitCode=1)},"migrateAllExecuteImpl"),ft=Je,gt=Ge,dt=Le,lt=Qe,mt=Ke,vt=Ye,yt=He,ht=Ue,kt=Xe,wt=Ze,$t=et,xt=tt,bt=ot,Rt=nt,Et=st;export{Et as migrateAllExecute,ft as migrateDepsExecute,yt as migrateGitleaksExecute,ht as migrateKingfisherExecute,gt as migrateLintStagedExecute,vt as migrateMoonExecute,dt as migrateNanoStagedExecute,mt as migrateNxExecute,kt as migrateSecretlintExecute,xt as migrateSelfExecute,$t as migrateSherifExecute,wt as migrateSyncpackExecute,lt as migrateTurborepoExecute,bt as migrateVerifyExecute,Rt as migrateVerifyGraphExecute};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)
|
|
3
|
-
`)
|
|
1
|
+
var X=Object.defineProperty;var w=(e,o)=>X(e,"name",{value:o,configurable:!0});import{createRequire as Q}from"node:module";import{q as S,E as m,j as R,e as F,T as H,I as E}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{M as b,a as M,i as ee}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{m as B,s as oe,C as q,S as te}from"./bin.js";import{d as ne}from"../packem_shared/lockfile-DAuTDwow.js";import{s as re,p as se}from"../packem_shared/docker-DxA80dRx.js";import{b as ue}from"./config.js";const Z=Q(import.meta.url),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=w(e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[o,t]=x.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return x.getBuiltinModule(e)}return Z(e)},"__cjs_getBuiltinModule"),{createInterface:L}=N("node:readline"),{spawn:ie}=N("node:child_process"),{createHash:ae}=N("node:crypto"),{existsSync:V,writeFileSync:le,chmodSync:ce}=N("node:fs");var de=Object.defineProperty,$=w((e,o)=>de(e,"name",{value:o,configurable:!0}),"n$1");const C={aube:{base:["RUN corepack enable"],build:$(e=>e?`RUN aube run --filter ${e} build`:"RUN aube run build","build"),install:"RUN aube install --frozen-lockfile"},bun:{base:["RUN npm install -g bun"],build:$(e=>e?`RUN bun run --filter ${e} build`:"RUN bun run build","build"),install:"RUN --mount=type=cache,target=/root/.bun/install/cache bun install --frozen-lockfile"},npm:{base:[],build:$(e=>e?`RUN npm run build --workspace ${e}`:"RUN npm run build","build"),install:"RUN --mount=type=cache,target=/root/.npm npm ci"},pnpm:{base:["ENV PNPM_HOME=/pnpm","ENV PATH=$PNPM_HOME:$PATH","RUN corepack enable"],build:$(e=>e?`RUN pnpm --filter ${e} build`:"RUN pnpm build","build"),install:"RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile"},yarn:{base:["RUN corepack enable"],build:$(e=>e?`RUN yarn workspace ${e} build`:"RUN yarn build","build"),install:"RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install --immutable"}},fe=$(e=>{const{focus:o,manager:t,nodeVersion:r}=e,n=C[t]??C.npm;return["# syntax=docker/dockerfile:1","","# Generated by 'vis docker init'. Before building, scaffold the context:",`# vis docker scaffold${o?` --focus=${o}`:""} --include-sources`,"# then build with BuildKit enabled (DOCKER_BUILDKIT=1).","",`FROM node:${r}-slim AS base`,"WORKDIR /app",...n.base,"","# --- install dependencies from the scaffolded manifests only ---","FROM base AS deps","COPY .vis/docker/workspace/ ./",n.install,"","# --- build the focus project, then drop unfocused workspace projects ---","FROM deps AS build","COPY .vis/docker/sources/ ./",n.build(o),"RUN npx vis docker prune --context=.vis/docker","","# --- minimal runtime image ---",`FROM node:${r}-slim AS runtime`,"WORKDIR /app","ENV NODE_ENV=production","COPY --from=build /app ./","USER node","# TODO: point this at your app's entrypoint",'CMD ["node", "index.js"]',""].join(`
|
|
2
|
+
`)},"generateDockerfile");var pe=Object.defineProperty,g=w((e,o)=>pe(e,"name",{value:o,configurable:!0}),"i$1");const D="v2.14.0",U=`https://github.com/hadolint/hadolint/releases/download/${D}`,me=g((e=process.platform,o=process.arch)=>{const t=e==="darwin"?"macos":e==="linux"?"linux":e==="win32"?"windows":void 0;if(t===void 0)return;const r=o==="arm64"?"arm64":o==="x64"?"x86_64":void 0;if(t==="windows")return"hadolint-windows-x86_64.exe";if(r!==void 0)return`hadolint-${t}-${r}`},"resolveHadolintAsset"),K=g(e=>b(B(),"hadolint",D,e.endsWith(".exe")?"hadolint.exe":"hadolint"),"cachedBinaryPath"),ge=g(()=>{const e=process.platform==="win32"?"hadolint.exe":"hadolint",o=(process.env.PATH??"").split(process.platform==="win32"?";":":");for(const t of o)if(t!==""&&V(b(t,e)))return e},"findOnPath"),he=g(e=>e.trim().split(/\s+/u)[0]??"","parseSha256Sidecar"),A=g(async e=>{const o=await fetch(e,{redirect:"follow"});if(!o.ok)throw new Error(`download failed (${String(o.status)} ${o.statusText}) for ${e}`);return Buffer.from(await o.arrayBuffer())},"fetchBuffer"),we=g(async e=>{const o=K(e),[t,r]=await Promise.all([A(`${U}/${e}`),A(`${U}/${e}.sha256`)]),n=he(r.toString("utf8")).toLowerCase(),s=ae("sha256").update(t).digest("hex");if(n==="")throw new Error("hadolint checksum sidecar was empty or unparseable. Refusing to use the download.");if(n!==s)throw new Error(`hadolint checksum mismatch (expected ${n}, got ${s}). Refusing to use the download.`);return ue(b(B(),"hadolint",D)),le(o,t),process.platform!=="win32"&&ce(o,493),o},"downloadHadolint"),be=g(async()=>{const e=L({input:process.stdin,output:process.stderr}),o=await new Promise(t=>{e.question(` Download hadolint ${S(D)} now? ${m("[y/N]")} `,r=>{t(r.trim().toLowerCase())})});return e.close(),o==="y"||o==="yes"},"confirmInstall"),$e=g(async e=>{const{autoInstall:o=!1,log:t}=e,r=ge();if(r!==void 0)return r;const n=me();if(n===void 0){t(`hadolint has no prebuilt binary for ${process.platform}/${process.arch}. Install it manually: https://github.com/hadolint/hadolint`);return}const s=K(n);if(V(s))return s;if(!o){if(!(process.stdin.isTTY&&!oe)){t(`hadolint is not installed. Re-run with ${R("--install")} (or install hadolint on PATH) to enable Dockerfile linting.`);return}if(t(`${R("hadolint")} is required to lint Dockerfiles but was not found on your PATH.`),!await be()){t(`Skipped. Install it yourself or re-run with ${R("--install")}.`);return}}t(`Downloading hadolint ${D} (${n})…`);try{const i=await we(n);return t(`Installed hadolint to ${m(i)}`),i}catch(i){t(`Failed to download hadolint: ${i.message}`);return}},"ensureHadolint"),_=g(async(e,o,t)=>{if(o.length===0)return[];const r=["--format","json","--no-fail",...t!==void 0&&t!==""?["--config",t]:[],...o],n=await new Promise((i,c)=>{const a=ie(e,r,{shell:process.platform==="win32",stdio:["ignore","pipe","pipe"],windowsHide:!0});let u="",d="";a.stdout?.on("data",l=>{u+=l.toString("utf8")}),a.stderr?.on("data",l=>{d+=l.toString("utf8")}),a.on("error",c),a.on("close",()=>{if(u.trim()===""&&d.trim()!==""){c(new Error(d.trim()));return}i(u)})});if(n.trim()==="")return[];let s;try{s=JSON.parse(n)}catch{throw new Error("Could not parse hadolint JSON output.")}return Array.isArray(s)?s:[]},"runHadolint");var ye=Object.defineProperty,y=w((e,o)=>ye(e,"name",{value:o,configurable:!0}),"n");const T=y((e,o,t)=>{if(!(!/\bapt-get\b/u.test(e)||!/\binstall\b/u.test(e)||t.test(e)))return e.replace(/\binstall\b/u,`install ${o}`)},"addAptGetInstallFlag"),j={DL3014:y(e=>T(e,"-y",/(?:^|\s)(?:-y|--yes|--assume-yes|-qq?)\b/u),"DL3014"),DL3015:y(e=>T(e,"--no-install-recommends",/--no-install-recommends\b/u),"DL3015"),DL3020:y(e=>/^\s*ADD\b/u.test(e)?e.replace(/^(\s*)ADD\b/u,"$1COPY"):void 0,"DL3020"),DL3027:y(e=>/(?:^|\s)apt\s/u.test(e)&&!/\bapt-get\b/u.test(e)?e.replace(/(^|\s)apt(\s)/u,"$1apt-get$2"):void 0,"DL3027")},Y=new Set(Object.keys(j)),ke=y((e,o)=>{const t=e.includes(`\r
|
|
3
|
+
`)?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,r=e.split(/\r?\n/u),n=new Set;let s=0;const i=new Map;for(const c of o){if(!j[c.code])continue;const a=i.get(c.line)??[];a.push(c),i.set(c.line,a)}for(const[c,a]of i){const u=c-1;if(!(u<0||u>=r.length))for(const d of a){const l=j[d.code],f=l?.(r[u]??"");f!==void 0&&f!==r[u]&&(r[u]=f,n.add(d.code),s+=1)}}return{content:s>0?r.join(t):e,fixedCodes:[...n],fixedCount:s}},"applyFixers");var ve=Object.defineProperty,k=w((e,o)=>ve(e,"name",{value:o,configurable:!0}),"a");const I={error:0,info:2,style:3,warning:1},xe=k((e,o)=>{switch(e){case"error":return H(o);case"info":return S(o);case"warning":return F(o);default:return m(o)}},"colorForLevel"),Re=k((e,o)=>(e.length>0?e:["Dockerfile"]).map(t=>M(t)?t:b(o,t)).filter(t=>ee(t)),"resolveFiles"),De=k((e,o)=>{const t=[...e].sort((n,s)=>n.file.localeCompare(s.file)||n.line-s.line||n.column-s.column||I[n.level]-I[s.level]);let r="";for(const n of t){n.file!==r&&(r=n.file,o.info(`
|
|
6
|
+
${R(r)}`));const s=m(`${String(n.line)}:${String(n.column)}`),i=xe(n.level,n.level.padEnd(7)),c=Y.has(n.code)?m(" (fixable)"):"";o.info(` ${s} ${i} ${S(n.code)} ${n.message}${c}`)}},"renderFindings"),Ne=k(e=>{const o={error:0,info:0,style:0,warning:0};for(const t of e)o[t.level]+=1;return o},"summarize"),Se=k(async e=>{const{autoInstall:o,configPath:t,cwd:r,files:n,fix:s,fs:i,json:c,logger:a}=e,u=Re(n,r);if(u.length===0)return a.error(`No Dockerfile found${n.length>0?` at: ${n.join(", ")}`:` in ${r}`}. Pass a path: vis docker lint <path>`),1;const d=await $e({autoInstall:o,log:k(p=>{a.info(p)},"log")});if(d===void 0)return 0;let l=await _(d,u,t),f=0;if(s&&l.length>0){for(const p of u){const W=l.filter(G=>G.file===p),J=await i.readFile(p,"utf8"),O=ke(J,W);O.fixedCount>0&&(await i.writeFile(p,O.content),f+=O.fixedCount)}f>0&&(l=await _(d,u,t))}if(c)return process.stdout.write(`${JSON.stringify({findings:l,fixed:f},null,2)}
|
|
7
|
+
`),l.some(p=>p.level==="error")?1:0;if(s&&f>0&&a.info(E(`✔ Auto-fixed ${String(f)} issue${f===1?"":"s"}.`)),l.length===0)return a.info(E("✔ No Dockerfile issues found.")),0;De(l,a);const v=Ne(l),P=l.filter(p=>Y.has(p.code)).length;return a.info(`
|
|
8
|
+
${R(String(l.length))} issue${l.length===1?"":"s"}: ${H(`${String(v.error)} error`)}, ${F(`${String(v.warning)} warning`)}, ${S(`${String(v.info)} info`)}, ${m(`${String(v.style)} style`)}`),!s&&P>0&&a.info(m(`Run 'vis docker lint --fix' to auto-fix ${String(P)} of them.`)),v.error>0?1:0},"runDockerLint");var Oe=Object.defineProperty,h=w((e,o)=>Oe(e,"name",{value:o,configurable:!0}),"i");const z=h(e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},"requireWorkspaceRoot"),Fe=h(async({logger:e,options:o,visConfig:t,workspaceRoot:r})=>{const n=z(r),{packageJsons:s,workspace:i}=q(n,t),c=te(n,i,s),a=(o.focus??"").split(",").map(l=>l.trim()).filter(Boolean);if(a.length===0)throw new Error("Missing --focus. Pass one or more project names, comma-separated.");const u=b(n,o.out??".vis/docker"),{projects:d}=re({focus:a,includeSources:!!o.includeSources,log:h(l=>{e.info(l)},"log"),outDir:u,projectGraph:c,pruneLockfile:o.pruneLockfile!==!1,workspace:i,workspaceRoot:n});e.info(`Scaffolded ${d.length} project(s) into ${u}`),e.info(`Focus closure: ${d.toSorted().join(", ")}`)},"scaffoldExecute"),He=h(async({logger:e,options:o,visConfig:t,workspaceRoot:r})=>{const n=z(r),{workspace:s}=q(n,t),i=b(n,o.context??".vis/docker"),{removed:c}=se({contextRoot:i,workspace:s,workspaceRoot:n});e.info(`Pruned ${c.length} unfocused project(s)`),c.length>0&&e.debug?.(c.join(`
|
|
9
|
+
`))},"pruneExecute"),Me=h(async({argument:e,fs:o,logger:t,options:r,process:n,workspaceRoot:s})=>{const i=await Se({autoInstall:!!r.install,configPath:r.config,cwd:s??n.cwd,files:e.filter(Boolean),fix:!!r.fix,fs:o,json:!!r.json,logger:t});i!==0&&(process.exitCode=i)},"lintExecute"),je=h(async(e,o)=>{try{return await e.access(o),!0}catch{return!1}},"canAccess"),Pe=h(async e=>{const o=L({input:process.stdin,output:process.stderr}),t=await new Promise(r=>{o.question(` ${e} already exists. Overwrite? ${m("[y/N]")} `,n=>{r(n.trim().toLowerCase())})});return o.close(),t==="y"||t==="yes"},"confirmOverwrite"),Be=h(async({argument:e,fs:o,logger:t,options:r,process:n,workspaceRoot:s})=>{const i=s??n.cwd,c=e[0]??"Dockerfile",a=M(c)?c:b(i,c),u=ne(i)?.manager??"npm",d=(r.focus??"").split(",").map(f=>f.trim()).find(Boolean),l=fe({focus:d,manager:u,nodeVersion:r.node??"22"});if(r.dryRun){process.stdout.write(l.endsWith(`
|
|
10
|
+
`)?l:`${l}
|
|
11
|
+
`);return}if(await je(o,a)&&!r.force){if(!process.stdin.isTTY){t.error(`${a} already exists. Re-run with --force to overwrite.`),process.exitCode=1;return}if(!await Pe(a)){t.info("Aborted — existing Dockerfile left untouched.");return}}await o.writeFile(a,l),t.info(`Created ${a} (package manager: ${u}).`),t.info(m(`Next: vis docker scaffold${d?` --focus=${d}`:""} --include-sources, then DOCKER_BUILDKIT=1 docker build .`))},"initExecute");export{Be as initExecute,Me as lintExecute,He as pruneExecute,Fe as scaffoldExecute};
|
|
@@ -1,22 +1,3 @@
|
|
|
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?de({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 qe=Object.defineProperty,V=j((t,e)=>qe(t,"name",{value:e,configurable:!0}),"o");const Ie=["git://","npm://","https://","github:","gitlab:","bitbucket:","sourcehut:"],Me=V(t=>Ie.some(e=>t.startsWith(e)),"isRemoteSource"),Ce=V(async(t,e={})=>{const r=e.targetDirectory===void 0,s=e.targetDirectory??me(N(ge(),"vis-generate-")),n=V(()=>{if(r)try{he(s,{force:!0,recursive:!0})}catch{}},"cleanup");l.info(`Downloading ${t}…`);try{const i=await $e(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=Q(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(Y(t)),ye(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=we(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:Q(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")}
|
|
14
|
-
|
|
15
|
-
`);for(const[s,n]of t.entries()){const i=b(T(` ${String(s+1)}.`));process.stderr.write(`${i} ${n.name} ${p(`(${n.source})`)}
|
|
16
|
-
`)}return new Promise((s,n)=>{r.question(`
|
|
17
|
-
${p(`Enter choice (1-${String(t.length)}):`)} `,i=>{const a=Number.parseInt(i.trim(),10);Number.isInteger(a)&&a>=1&&a<=t.length?s(t[a-1].name):n(new Error("Invalid choice."))})})}finally{r.close()}},"pickInteractive"),at=w(async({argument:t,options:e,rawUnknown:r,visConfig:s,workspaceRoot:n})=>{const i=e.cwd||n||process.cwd(),a=n??i,o=s?.generator,c=Array.isArray(t)?t:t?[t]:[];if(e.list){const u=I({extraDirectories:o?.templates??[],onWarning:w(f=>{l.warn(f)},"onWarning"),workspaceRoot:a});if(e.json){const f=await Promise.all(u.map(d=>Je(d)));process.stdout.write(`${JSON.stringify(f,null,2)}
|
|
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=I({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=I({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=I({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:fe(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{at as default};
|
|
1
|
+
var Q=Object.defineProperty;var p=(t,e)=>Q(t,"name",{value:e,configurable:!0});import{createRequire as X}from"node:module";import{I as _,q as ee,j as N,E as T}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{z as G}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{aL as y,aM as te}from"./bin.js";import{d as M,f as P,r as re,b as se,a as ie,c as ne,e as ae,g as oe,s as ce,h as de,i as fe,j as le,k as ue,l as pe,m as ge,n as me,o as he,p as xe,q as be,t as ve}from"../packem_shared/watch-loop-C8csFvRU.js";const Y=X(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Z=p(t=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[e,r]=j.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return j.getBuiltinModule(t)}return Y(t)},"__cjs_getBuiltinModule"),{createHash:O}=Z("node:crypto");var ke=Object.defineProperty,I=p((t,e)=>ke(t,"name",{value:e,configurable:!0}),"o");const ye=I(t=>t.startsWith("/")||/^[a-z]:[\\/]/i.test(t),"isAbsolutePath"),R=I((t,e)=>ye(e)?e:`${t}/${e}`,"resolveFile");var we=Object.defineProperty,g=p((t,e)=>we(t,"name",{value:e,configurable:!0}),"n$1");const je={argsCheck:g((t,e)=>z(t,e,"check"),"argsCheck"),argsFix:g((t,e)=>z(t,e,"fix"),"argsFix"),bin:g(()=>["pnpm","exec","dprint"],"bin"),cacheKey:g((t,e)=>{const r=["dprint",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return O("sha256").update(r.join("|")).digest("hex").slice(0,16)},"cacheKey"),detect:g((t,e)=>{const r=M(e,y.dprint.packageNames[0]),s=P(t,y.dprint.configFiles);if(!(!r&&!s))return{adapter:"dprint",configFile:s,declared:!!r,declaredVersion:r,root:t}},"detect"),extensions:["cjs","css","cts","dockerfile","html","js","json","jsonc","jsx","md","mdx","mjs","mts","toml","ts","tsx","yaml","yml"],id:"dprint",kind:"fmt",parse:g((t,e)=>{if(t.exitCode===0)return[];const r=[];for(const s of t.stdout.split(/\r?\n/)){const i=s.trim();!i||i.startsWith("[")||i.startsWith("Checked ")||i.startsWith("Error:")||r.push({adapter:"dprint",file:R(e.root,i),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"})}return r},"parse")},z=g((t,e,r)=>{const s=r==="fix"?["fmt"]:["check","--list-different"];return e.extraArgs?.length&&s.push(...e.extraArgs),s.push(...t),s},"buildArgs");var Fe=Object.defineProperty,m=p((t,e)=>Fe(t,"name",{value:e,configurable:!0}),"n");const Ae={argsCheck:m((t,e)=>H(t,e,"check"),"argsCheck"),argsFix:m((t,e)=>H(t,e,"fix"),"argsFix"),bin:m(()=>["pnpm","exec","oxfmt"],"bin"),cacheKey:m((t,e)=>{const r=["oxfmt",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return O("sha256").update(r.join("|")).digest("hex").slice(0,16)},"cacheKey"),detect:m((t,e)=>{const r=M(e,y.oxfmt.packageNames[0]),s=P(t,y.oxfmt.configFiles);if(!(!r&&!s))return{adapter:"oxfmt",configFile:s,declared:!!r,declaredVersion:r,root:t}},"detect"),extensions:["cjs","cts","js","json","jsonc","jsx","mjs","mts","ts","tsx"],id:"oxfmt",kind:"fmt",parse:m((t,e)=>{if(t.exitCode===0)return[];const r=[];for(const s of t.stdout.split(/\r?\n/)){const i=s.trim();!i||i.startsWith("[")||r.push({adapter:"oxfmt",file:R(e.root,i),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"})}return r},"parse")},H=m((t,e,r)=>{const s=r==="fix"?["--write"]:["--list-different"];return e.extraArgs?.length&&s.push(...e.extraArgs),s.push(...t),s},"buildArgs");var Ce=Object.defineProperty,h=p((t,e)=>Ce(t,"name",{value:e,configurable:!0}),"s");const $e={argsCheck:h((t,e)=>L(t,e,"check"),"argsCheck"),argsFix:h((t,e)=>L(t,e,"fix"),"argsFix"),bin:h(()=>["pnpm","exec","prettier"],"bin"),cacheKey:h((t,e)=>{const r=["prettier",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return O("sha256").update(r.join("|")).digest("hex").slice(0,16)},"cacheKey"),detect:h((t,e)=>{const r=M(e,y.prettier.packageNames[0]),s=P(t,y.prettier.configFiles);if(!(!r&&!s))return{adapter:"prettier",configFile:s,declared:!!r,declaredVersion:r,root:t}},"detect"),extensions:["cjs","css","cts","html","js","json","jsx","less","md","mdx","mjs","mts","scss","ts","tsx","vue","yaml","yml"],id:"prettier",kind:"fmt",parse:h((t,e)=>{if(t.exitCode===0)return[];const r=[];for(const s of t.stdout.split(/\r?\n/)){const i=s.trim();i&&(i.startsWith("[")||r.push({adapter:"prettier",file:R(e.root,i),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return r},"parse")},L=h((t,e,r)=>{const s=r==="fix"?["--write"]:["--list-different"];return e.quiet&&s.push("--log-level","warn"),e.extraArgs?.length&&s.push(...e.extraArgs),s.push(...t),s},"buildArgs");var qe=Object.defineProperty,x=p((t,e)=>qe(t,"name",{value:e,configurable:!0}),"c");const _e=[Ae,se,je,$e,ie,ne],Be=x(async({logger:t,options:e,visConfig:r,workspaceRoot:s})=>{const i=s??process.cwd(),b=r?.fmt,F=re(_e,b?.order),J=ae(i,F),w=oe(J,F,"fmt").filter(({adapter:l})=>b?.adapters?.[l.id]?.enabled!==!1);if(w.length===0){t.warn("vis fmt: no formatter detected in this workspace (looked for: oxfmt, biome, dprint, prettier, ruff, deno-fmt).");return}const S=x(l=>{const a=b?.adapters?.[l]?.extraArgs;return a&&a.length>0?[...a]:void 0},"baseExtraArgs"),$={quiet:e.quiet??!1},W=Me(e),A=e.check?"check":"fix";let c;if(e.staged){if(c=ce(i),c===void 0)t.warn("vis fmt: could not resolve --staged (not a git repo or git unavailable). Falling back to a workspace-wide run.");else if(c.length===0){t.info(_("✓ fmt: no staged files"));return}}else if(typeof e.since=="string"&&e.since.length>0){if(c=de(i,e.since),c===void 0)t.warn(`vis fmt: could not resolve --since ${e.since} (not a git repo or unknown ref). Falling back to a workspace-wide run.`);else if(c.length===0){t.info(_(`✓ fmt: no files changed since ${e.since}`));return}}const U=te(i,void 0,void 0,!0),q=e.format??"human";q==="human"&&e.output!==void 0&&t.warn("vis fmt: --output is ignored for the human format; pass --format json|minimal|sarif|junit|github to redirect findings to a file.");const E=x(async l=>{const a=W.length>0?W:l,v=[];if(a){const n=fe(a,w,b?.extensionOverrides);for(const{adapter:o,presence:d}of w){const f=n.get(o.id);if(!f||f.length===0)continue;const V=S(o.id),B={adapter:o,files:f,presence:d};V&&(B.options={...$,extraArgs:V}),v.push(B)}}else for(const{adapter:n,presence:o}of w){const d=S(n.id),f={adapter:n,files:["."],presence:o};d&&(f.options={...$,extraArgs:d}),v.push(f)}if(v.length===0)return;const D=await le(v,$,A,{cacheRoot:U}),C=v.map((n,o)=>{const d=D[o],f=n.adapter.parse(d,n.presence);return{adapter:n.adapter,durationMs:d.durationMs,exitCode:d.exitCode,findings:f}}),u=ue(C.map(n=>({adapter:n.adapter.id,durationMs:n.durationMs,exitCode:n.exitCode,findingCount:n.findings.length,findings:n.findings}))),k=q==="human"?void 0:pe({cwd:i,target:e.output});try{switch(q){case"github":{k.write(he({runs:C.map(n=>({findings:n.findings})),workspaceRoot:i}));break}case"json":{k.write(`${JSON.stringify({findings:u.findings,mode:A,runs:u.runs},null,2)}
|
|
2
|
+
`);break}case"junit":{k.write(me({runs:C.map(n=>({adapter:n.adapter.id,durationMs:n.durationMs,findings:n.findings})),workspaceRoot:i}));break}case"minimal":{Oe(u.findings,i,k);break}case"sarif":{k.write(ge({runs:C.map(n=>({adapter:n.adapter.id,findings:n.findings,presence:v.find(o=>o.adapter.id===n.adapter.id)?.presence})),workspaceRoot:i}));break}default:Pe(u.findings,i,A,t)}}finally{k?.close()}const K=A==="fix"?u.hadProcessFailure?1:0:xe({...u,maxSeverity:u.findings.length>0?"error":void 0});K!==0&&(process.exitCode=K)},"runCycle");if(e.watch){const l=[...new Set(w.flatMap(({adapter:a})=>a.extensions))];await be({extensions:l,initialFiles:c,label:"fmt",log:x(a=>{t.info(a)},"log"),runCycle:E,workspaceRoot:i});return}await E(c)},"execute"),Me=x(t=>{const e=t;return[...e._??e.args??[]]},"collectPositional"),Pe=x((t,e,r,s)=>{if(t.length===0){s.info(_(r==="fix"?"✓ fmt: nothing to change":"✓ fmt: all files already formatted"));return}const i=ve(t),b=r==="fix"?ee(N("Formatted:")):N("Would change:");s.info(b);for(const F of i.keys())s.info(` ${T("·")} ${G(e,F)}`);r==="check"&&(s.info(""),s.info(T(`Run \`vis fmt\` to apply changes (${String(i.size)} file${i.size===1?"":"s"}).`)))},"printHuman"),Oe=x((t,e,r)=>{for(const s of t)r.write(`${s.adapter} ${G(e,s.file)}
|
|
3
|
+
`)},"printMinimal");export{Be as default};
|