@visulima/vis 6.0.1 → 6.1.1
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 +54 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +1226 -1216
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/cargo-lock.js +5 -0
- package/dist/packem_chunks/cargo-plan.js +3 -3
- package/dist/packem_chunks/catalog-detector.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -94
- package/dist/packem_chunks/catalog2.js +11 -0
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +156 -174
- package/dist/packem_chunks/context.js +8 -0
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +4 -4
- 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/handler19.js +5 -5
- 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/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 +4 -4
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler32.js +1 -1
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +3 -3
- package/dist/packem_chunks/handler35.js +1 -1
- package/dist/packem_chunks/handler36.js +1 -1
- package/dist/packem_chunks/handler38.js +2 -2
- package/dist/packem_chunks/handler39.js +5 -5
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler40.js +1 -1
- package/dist/packem_chunks/handler41.js +1 -1
- package/dist/packem_chunks/handler42.js +1 -1
- package/dist/packem_chunks/handler43.js +1 -1
- package/dist/packem_chunks/handler44.js +1 -1
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +1 -1
- package/dist/packem_chunks/handler49.js +1 -1
- package/dist/packem_chunks/handler5.js +4 -4
- package/dist/packem_chunks/handler50.js +5 -5
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +3 -3
- package/dist/packem_chunks/handler57.js +4 -4
- package/dist/packem_chunks/handler58.js +4 -4
- package/dist/packem_chunks/handler59.js +2 -2
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +3 -3
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +3 -3
- package/dist/packem_chunks/handler65.js +4 -4
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +5 -5
- package/dist/packem_chunks/handler68.js +12 -25
- package/dist/packem_chunks/handler69.js +25 -22
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +22 -10
- package/dist/packem_chunks/handler71.js +10 -153
- package/dist/packem_chunks/handler72.js +133 -23
- package/dist/packem_chunks/handler73.js +23 -323
- package/dist/packem_chunks/handler74.js +274 -659
- package/dist/packem_chunks/handler75.js +708 -48
- package/dist/packem_chunks/handler76.js +48 -27
- package/dist/packem_chunks/handler77.js +27 -3
- package/dist/packem_chunks/handler78.js +3 -191
- package/dist/packem_chunks/handler79.js +191 -0
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/heal.js +2 -2
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index2.js +3 -58
- package/dist/packem_chunks/index3.js +40 -3
- package/dist/packem_chunks/index6.js +135 -7
- package/dist/packem_chunks/index7.js +7 -135
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/python-plan.js +3 -3
- package/dist/packem_chunks/python-projects.js +1 -1
- package/dist/packem_chunks/python.js +1 -0
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/snapshot.js +2 -2
- package/dist/packem_chunks/state.js +2 -2
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +1 -1
- package/dist/packem_chunks/workspace.js +2 -2
- package/dist/packem_shared/ReleaseClient-CWD9BC5w.js +1 -0
- package/dist/packem_shared/advisories-BodWQ5DQ.js +1 -0
- package/dist/packem_shared/{affected-selection-CrW7fWEd.js → affected-selection-QaMUnFqe.js} +1 -1
- package/dist/packem_shared/{ai-analysis-pldoS_N4.js → ai-analysis-D7jlbJky.js} +3 -3
- package/dist/packem_shared/ai-cache-iSIyY3So.js +1 -0
- package/dist/packem_shared/{ai-fix-D9MxigBQ.js → ai-fix-CgCyO65Q.js} +6 -6
- package/dist/packem_shared/apply-DoeQAAGm.js +6 -0
- package/dist/packem_shared/apply-release-plan-BalHtK-g.js +15 -0
- package/dist/packem_shared/{bin-D3TtXgz6.js → bin-LyW9KY0i.js} +1 -1
- package/dist/packem_shared/clean-package-json-rutwkKl-.js +1 -0
- package/dist/packem_shared/createAdapter-DMK4bBET.js +1 -0
- package/dist/packem_shared/createVersionActions-DXo4z8VN.js +1 -0
- package/dist/packem_shared/dependency-scan-DFnt1mni.js +1 -0
- package/dist/packem_shared/detect-CbMRSXkM.js +1 -0
- package/dist/packem_shared/{ecosystem-gate-ByxWtzPE.js → ecosystem-gate-Bdz-gK_Y.js} +1 -1
- package/dist/packem_shared/env-BSXG3QKH.js +4 -0
- package/dist/packem_shared/env-consistency-B4rU4MQb.js +1 -0
- package/dist/packem_shared/failure-log-DIsKBKaI.js +2 -0
- package/dist/packem_shared/formatBytes-_HvjOy8a-iHCer6uX.js +1 -0
- package/dist/packem_shared/glob-Cyk1H9ZL-DRlUeuow.js +1 -0
- package/dist/packem_shared/{index-BKbMnn8K.js → index-B1ZsG3oa.js} +1 -1
- package/dist/packem_shared/index-CgNfNk12.js +1 -0
- package/dist/packem_shared/lifecycle-CQjeMPY0.js +2 -0
- package/dist/packem_shared/missing-package-json-dtwl6w-S.js +1 -0
- package/dist/packem_shared/multi-eco-lockfiles-CyIfYw4u.js +1 -0
- package/dist/packem_shared/npmrc-CHsOyMvA.js +2 -0
- package/dist/packem_shared/osv-C53WUoSW.js +1 -0
- package/dist/packem_shared/{package-version-QFmE9anh.js → package-version-DqYSd_ia.js} +1 -1
- package/dist/packem_shared/packument-CbTmbHU4.js +1 -0
- package/dist/packem_shared/{project-name-filter-DIqpdsvP.js → project-name-filter-mwTJC1IK.js} +1 -1
- package/dist/packem_shared/{provenance-L1M2FPy_.js → provenance-SX1MxPUZ.js} +1 -1
- package/dist/packem_shared/publish-Dc0XGH3K.js +34 -0
- package/dist/packem_shared/registry-CkoaWkjP.js +81 -0
- package/dist/packem_shared/registry-keys-z038Ecb4.js +1 -0
- package/dist/packem_shared/removeSync-g1D5kONg-LbjATA8v.js +1 -0
- package/dist/packem_shared/renderToString-DR0zDUjh-C7p-L6AO.js +3 -0
- package/dist/packem_shared/{resolve-explicit-CQa37JSq.js → resolve-explicit-D9kdTNvl.js} +1 -1
- package/dist/packem_shared/{run-D-uVGHQ4.js → run-DLvd3RIZ.js} +1 -1
- package/dist/packem_shared/run-summary-utils-CMeURYtS.js +1 -0
- package/dist/packem_shared/runtime-check-D3cRDuoi.js +1 -0
- package/dist/packem_shared/s1ngularity-BuU9Cxpy.js +1 -0
- package/dist/packem_shared/scaffold-files-Bje3_Ixv.js +28 -0
- package/dist/packem_shared/scan-progress-D8ojNcKt.js +2 -0
- package/dist/packem_shared/{signatures-DIqFUOfs.js → signatures-CeL0bOEo.js} +1 -1
- package/dist/packem_shared/spinner-Bqjpz3i4.js +1 -0
- package/dist/packem_shared/table-DDAJalPF.js +1 -0
- package/dist/packem_shared/tabs-CC0GJLww.js +1 -0
- package/dist/packem_shared/{task-env-DzR4RkOj.js → task-env-C2lmxvzA.js} +1 -1
- package/dist/packem_shared/toolchain-CP79HNVy.js +5 -0
- package/dist/packem_shared/typosquats-BFKus_aM.js +1 -0
- package/dist/packem_shared/use-measured-height-_nYuZ-Au.js +1 -0
- package/dist/packem_shared/vis-update-app-Ba5ce8Jd.js +1 -0
- package/dist/packem_shared/{vis-user-error-S0Fesz5y.js → vis-user-error-D_ekz9rF.js} +1 -1
- package/dist/packem_shared/watch-loop-DWr41vHM.js +11 -0
- package/dist/packem_shared/xxh3-BLHlvhgT.js +1 -0
- package/dist/release/core/package-managers/index.js +1 -1
- package/dist/release/core/version-actions/index.js +1 -1
- package/dist/release/index.js +1 -1
- package/index.js +26 -26
- package/package.json +9 -9
- package/dist/packem_chunks/orchestrator.js +0 -46
- package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +0 -1
- package/dist/packem_shared/createAdapter-F7GidOzU.js +0 -1
- package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +0 -1
- package/dist/packem_shared/dependency-scan-B8jroa1D.js +0 -1
- package/dist/packem_shared/env-consistency-Dt_uDbSP.js +0 -1
- package/dist/packem_shared/failure-log-BP-gCUb5.js +0 -2
- package/dist/packem_shared/formatBytes-_HvjOy8a-B_qQr4Hw.js +0 -4
- package/dist/packem_shared/glob-Cyk1H9ZL-Dxlf9Swz.js +0 -1
- package/dist/packem_shared/index-DGdD4w-b.js +0 -1
- package/dist/packem_shared/lifecycle-DvmDIRbb.js +0 -2
- package/dist/packem_shared/missing-package-json-Cu5YVAot.js +0 -1
- package/dist/packem_shared/multi-eco-lockfiles-B2X3yhyo.js +0 -1
- package/dist/packem_shared/packument-zb18Jnlw.js +0 -1
- package/dist/packem_shared/registry-keys-DxdqMzyp.js +0 -1
- package/dist/packem_shared/runtime-check-1U8HrQd9.js +0 -1
- package/dist/packem_shared/s1ngularity-CO5GkkqX.js +0 -1
- package/dist/packem_shared/scan-progress-RwCRxJdX.js +0 -2
- package/dist/packem_shared/spinner-BJjbNl1F.js +0 -1
- package/dist/packem_shared/tabs--uxJGL8N.js +0 -1
- package/dist/packem_shared/toolchain-Bz70UIcp.js +0 -5
- package/dist/packem_shared/typosquats-D4DEHhFy.js +0 -1
- package/dist/packem_shared/use-measured-height-DUZyyias.js +0 -1
- package/dist/packem_shared/vis-update-app-9b2kSk9f.js +0 -1
- package/dist/packem_shared/watch-loop-BEnGuMBn.js +0 -11
|
@@ -1,23 +1,133 @@
|
|
|
1
|
-
import{createRequire as ae}from"node:module";import{e as h,z as O}from"../packem_shared/index-BzhrR_iC.js";import{V as J}from"../packem_shared/vis-user-error-S0Fesz5y.js";import{ab as z,ac as he,ad as X,ae as R,af as me,ag as pe,ah as ke,ai as $e,aj as j,ak as we,al as Y,am as Q,an as Z,ao as ee,ap as te}from"./cli-main.js";import{y as b}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{f as Ee}from"./ts-loader.js";import{L as ye}from"../packem_shared/index-BisalDCf.js";import{P as ve}from"./catalog.js";import{allKnownTags as Se,tagsFromPaths as Re,NATIVE_BINDING_VERSION as G}from"#native";import{h as ne}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";let ce;const fe=e=>(ce??=ae(import.meta.url))(e),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,F=e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[t,n]=x.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return x.getBuiltinModule(e)}return fe(e)},{readdirSync:q,statSync:M,readFileSync:I,existsSync:T,writeFileSync:y,unlinkSync:le,rmSync:ue,chmodSync:de}=F("node:fs"),{cwd:A}=x,{createInterface:ge}=F("node:readline"),{spawnSync:E}=F("node:child_process"),{basename:be}=F("node:path"),_e=/^# ([^:\s]\S*)(?::\s+(.+))?$/,xe=e=>{const t=[],n=e.split(`
|
|
2
|
-
`);
|
|
3
|
-
|
|
4
|
-
`
|
|
5
|
-
`)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`);
|
|
9
|
-
|
|
10
|
-
${
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`,
|
|
14
|
-
`),"utf8")},gt=(e,t)=>{E("prek",["--version"],{cwd:e,encoding:"utf8"}).status===0?E("prek",["uninstall"],{cwd:e,encoding:"utf8"}).status===0?t.info("Detached prek via `prek uninstall`."):t.info("`prek uninstall` did not exit cleanly — continuing. You may need to run it manually."):t.info("prek binary not found on PATH — skipping `prek uninstall`. Run it manually if prek is installed elsewhere.")},re=(e,t,n,s={})=>{const o=B(e),i=s.dryRun===!0;if(!o)return{isError:!0,message:"No prek configuration found (.pre-commit-config.yaml, .pre-commit-config.yml, or prek.toml)"};n.info(`Found prek config at ${o}`);const r=h(e,o),c=O(r),a=lt(r);if(!a)return{isError:!0,message:`Could not parse ${o}`};const{additionalDeps:f,config:g,droppedFilters:u,manualSteps:d,skippedHooks:m}=ct(a),w=Object.keys(g.stages);if(w.length===0&&m.length===0)return{isError:!0,message:`${o} has no hooks to migrate`};if(!i){const $=E("git",["config","--local","core.hooksPath"],{cwd:e,encoding:"utf8"});if($.status===0){const C=$.stdout?.toString().trim();C&&(C.includes(".prek")||C.includes("prek-hooks"))&&E("git",["config","--local","--unset","core.hooksPath"],{cwd:e})}const S=X(t);if(S.isError)return S;S.message&&(S.isWarning?n.warn(S.message):n.info(S.message))}const p=h(e,t);i||ne(p),i?n.info(` (would write) ${t}/${R}`):(me(e,t,g),dt(e,t),n.info(` Wrote ${t}/${R}`));let l=0;for(const $ of w){const S=et($);i?n.info(` (would write) ${t}/${$}`):(y(h(p,$),S,{mode:493}),n.info(` Wrote ${t}/${$}`)),l+=1}const{added:k,skipped:v}=i?{added:f.map($=>$.name),skipped:[]}:ut(e,f,s.useEditorconfig);if(k.length>0){const $=i?"would add":"Added";n.info(`${$} ${k.length} package${k.length===1?"":"s"} to devDependencies: ${k.join(", ")}`),i||n.info("Run your package manager's install (e.g. `pnpm install`) to pick up the new devDependencies.")}v.length>0&&n.info(`Skipped ${v.length} already-declared package${v.length===1?"":"s"}: ${v.join(", ")}`),i||gt(e,n);const L=`${r}.bak`;if(i?n.info(` (would remove) ${o} and back it up to ${o}.bak`):(b(L)||y(L,c,"utf8"),le(r),n.info(`Removed ${o} (backup at ${o}.bak)`)),m.length>0){n.warn(`Skipped ${m.length} hook${m.length===1?"":"s"} that cannot run without prek:`);for(const $ of m)n.warn(` - ${$.repo}::${$.hookId} — ${$.reason}`)}if(u.length>0){n.warn("Partial filter translations:");for(const $ of u)n.warn(` - ${$}`)}if(d.length>0){n.warn("Manual follow-up required:");for(const $ of d)n.warn(` - ${$}`)}return{isError:!1,message:`${i?"would migrate":"Migration complete:"} ${l} stage script${l===1?"":"s"} ${i?"into":"written to"} ${t}/`}},ht=e=>{const t=[];let n=0;for(let s=0;s<e.length;s+=1)e[s]===0&&(s>n&&t.push(e.subarray(n,s).toString("utf8")),n=s+1);return n<e.length&&t.push(e.subarray(n).toString("utf8")),t},P=(e,t,n)=>{const s=E("git",[...e],{cwd:n,encoding:"buffer"});if(s.status!==0){const o=s.stderr?s.stderr.toString():"";throw new Error(`git ${t} failed${o?`: ${o.trim()}`:""}`)}return s.stdout.length===0?[]:ht(s.stdout)},mt=(e,t)=>{switch(e.kind){case"all":return P(["ls-files","-z"],"ls-files",t);case"range":return P(["diff","--name-only","--diff-filter=ACM","-z",e.fromRef,e.toRef],"diff --from-ref/--to-ref",t);case"staged":return P(["diff","--cached","--name-only","--diff-filter=ACM","-z"],"diff --cached",t);default:{const n=e;throw new Error(`unknown discover mode: ${JSON.stringify(n)}`)}}},K=(e,t)=>{try{return new RegExp(e)}catch(n){const s=n instanceof Error?n.message:String(n);throw new Error(`invalid ${t} regex ${JSON.stringify(e)}: ${s}`,{cause:n})}},pt=e=>e.types&&e.types.length>0||e.typesOr&&e.typesOr.length>0||e.excludeTypes&&e.excludeTypes.length>0||!1,kt=(e,t)=>{let n=e;if(t.files){const i=K(t.files,"files");n=n.filter(r=>i.test(r))}if(t.exclude){const i=K(t.exclude,"exclude");n=n.filter(r=>!i.test(r))}if(!pt(t))return[...n];const s=Ne(n),o={excludeTypes:t.excludeTypes,types:t.types,typesOr:t.typesOr};return n.filter(i=>{const r=s.get(i);return r?Me(r,o):!1})},$t=32*1024,wt=(e,t)=>{const n=[],s=Math.max(1024,$t-t);let o=[],i=0;for(const r of e){const c=Buffer.byteLength(r,"utf8")+8;i+c>s&&o.length>0&&(n.push(o),o=[],i=0),o.push(r),i+=c}return o.length>0&&n.push(o),n},Et=e=>({error:t=>{e.error(t)},info:t=>{e.info(t)}}),U=(e,t,n)=>n?n.message:t?`terminated by signal ${t}`:`exited with status ${String(e)}`,yt=(e,t,n,s,o)=>{const i=s?o.extraArgs:[];if(!n||t.length===0){const a=E("sh",["-c",e,"sh",...i],{cwd:o.root,stdio:"inherit"});return a.status===null?(o.logger.error(`hook command failed: ${U(a.status,a.signal,a.error)}`),1):a.status}const r=Buffer.byteLength(e,"utf8")+Buffer.byteLength("sh","utf8")+Buffer.byteLength("-c","utf8")+i.reduce((a,f)=>a+Buffer.byteLength(f,"utf8")+8,0)+64;let c=0;for(const a of wt(t,r)){const f=E("sh",["-c",`${e} "$@"`,"sh",...i,...a],{cwd:o.root,stdio:"inherit"});f.status===null?(o.logger.error(`hook command failed: ${U(f.status,f.signal,f.error)}`),c|=1):c|=f.status}return c},vt=(e,t,n)=>{if(e.fail!==void 0)return n.logger.info(e.fail),1;const s=j.has(n.stage);let o;try{o=kt(t,e)}catch(a){const f=a instanceof Error?a.message:String(a);return n.logger.error(`hook "${e.id}": ${f}`),2}if(o.length===0&&e.alwaysRun!==!0&&!s)return 0;const i=e.passFilenames!==!1;if(e.verbose){const a=e.name??e.id;n.logger.info(`+ ${a}`)}if(e.builtin){const a=ze(e.builtin);if(!a)return n.logger.error(`unknown builtin "${e.builtin}" referenced by hook "${e.id}"`),2;const f={logger:Et(n.logger),root:n.root};try{return a(o,e.args??[],f)}catch(g){const u=g instanceof Error?g.message:String(g);return n.logger.error(`builtin "${e.builtin}" crashed: ${u}`),1}}if(e.entry===void 0)return n.logger.error(`hook "${e.id}" has no \`entry\`, \`builtin\`, or \`fail\` to run`),2;const r=(e.args??[]).map(a=>`'${a.replaceAll("'",String.raw`'\''`)}'`).join(" "),c=r?`${e.entry} ${r}`:e.entry;return yt(c,o,i,s,n)},bt=(e,t,n,s)=>{const o=e.stages[t];if(!o||o.length===0)return 0;let i=0;for(const r of o){const c=vt(r,n,s);if(c!==0&&(i|=c,e.failFast))return i}return i},St="pre-commit",Rt=e=>{if(e.lastCommit&&(e.fromRef||e.toRef))throw new Error("--last-commit cannot be combined with --from-ref or --to-ref");const t=e.lastCommit?"HEAD~1":e.fromRef,n=e.lastCommit?"HEAD":e.toRef;if(t&&!n||n&&!t)throw new Error("--from-ref and --to-ref must be specified together");return t&&n?{fromRef:t,kind:"range",toRef:n}:e.allFiles?{kind:"all"}:{kind:"staged"}},_t=(e,t,n,s)=>{const o=n.stage??St,i=Y(e,t);if(!i)throw new Error(`No hook config found at ${t}/config.json. Install or migrate hooks first.`);const r=i.stages[o];if(!r||r.length===0)return s.info(`No hooks configured for stage "${o}".`),0;const a=j.has(o)?void 0:Rt(n),f=a?.kind==="all"?" (--all-files)":a?.kind==="range"?` (${a.fromRef}..${a.toRef})`:"";s.info(`Running ${o}${f}`);const g=a?mt(a,e):[],u={extraArgs:n.extraArgs??[],logger:s,root:e,stage:o};return bt(i,o,g,u)},xt=(e,t,n)=>{const s=_t(A(),e,t,n);if(s!==0)throw new Error(`Hook stage exited with code ${s}`)},At=(e=Q)=>{const t=E("git",["config","--local","core.hooksPath"],{encoding:"utf8"});if(t.status!==0)return{isError:!1,message:"No custom hooks path configured"};const n=t.stdout.trim()||`${e}/_`,s=Z(n),{status:o,stderr:i}=E("git",["config","--local","--unset","core.hooksPath"]);if(o===null)return{isError:!0,message:"git command not found"};if(o&&o!==5)return{isError:!0,message:String(i)};const r=[];for(const c of s)if(b(c))try{ue(c,{force:!0,recursive:!0})}catch(a){r.push(`${c} (${a instanceof Error?a.message:String(a)})`)}return r.length>0?{isError:!1,isWarning:!0,message:`could not remove ${r.length} dispatcher director(ies): ${r.join(", ")}`}:{isError:!1,message:""}},It=new Set(z),Ot=e=>{const t=E("sh",["-n",e],{encoding:"utf8"});if(t.status===null)return`failed to run "sh -n" (${t.error?.message??"unknown error"})`;if(t.status!==0)return t.stderr.trim()||`sh -n exited with ${t.status}`},Tt=(e,t)=>{const n=[],s=h(e,t),o=E("git",["config","--local","core.hooksPath"],{cwd:e,encoding:"utf8"}),i=`${t}/_`,r=o.status===0?o.stdout.trim():"";r?r!==i&&!r.endsWith(`/${i}`)&&n.push({kind:"warning",message:`core.hooksPath is "${r}" — expected "${i}". Re-run \`vis hook install\` to fix.`}):n.push({kind:"warning",message:"core.hooksPath is not set — run `vis hook install`."});const c=r||i,a=E("git",["rev-parse","--show-toplevel"],{cwd:e,encoding:"utf8"}),f=a.status===0&&a.stdout.trim()?a.stdout.trim():e,g=h(f,c);for(const d of Z(c,f))b(d)||(d===g?n.push({kind:"error",message:`Dispatcher directory ${c} is missing. Run \`vis hook install\`.`}):n.push({kind:"warning",message:`Worktree ${d} is missing — git runs no hooks there. Run \`vis hook install\` in that worktree.`}));if(!b(s))return n.push({kind:"error",message:`Hooks directory ${t}/ is missing.`}),{issues:n,ok:!1};let u=!1;for(const d of q(s)){if(d.startsWith(".")||d==="_"||d===R||d==="README.md")continue;if(!It.has(d)){n.push({kind:"warning",message:`Unknown hook "${d}" — not a standard git hook.`,path:h(t,d)});continue}const m=h(s,d);if(!M(m).isFile())continue;u=!0;const w=M(m).mode&511;(w&64)===0&&n.push({kind:"warning",message:`Script is not owner-executable (mode ${w.toString(8)}).`,path:h(t,d)});const p=Ot(m);p&&n.push({kind:"error",message:`Shell syntax error: ${p}`,path:h(t,d)})}if(u){const d=h(s,R);if(b(d))try{Y(e,t)}catch(m){n.push({kind:"error",message:`${R} is malformed: ${m instanceof Error?m.message:String(m)}`,path:h(t,R)})}else n.push({kind:"error",message:`Stage scripts are present but ${t}/${R} is missing. Re-run \`vis hook migrate\`.`})}return{issues:n,ok:!n.some(d=>d.kind==="error")}},Ft=(e,t)=>{if(e.issues.length===0)return[`Hook directory ${t}/ looks good.`];const n=[];for(const s of e.issues){const o=s.kind==="error"?"ERROR":"WARN ",i=s.path?` (${s.path})`:"";n.push(`${o} ${s.message}${i}`)}return n.push("",e.ok?"No errors — warnings only.":`${e.issues.filter(s=>s.kind==="error").length} error(s).`),n},Ct=(e,t)=>{const n=Tt(A(),e),s=Ft(n,e);for(const o of s)o.startsWith("ERROR")||o.startsWith("WARN")?t.warn(o):t.info(o);if(!n.ok)throw new Error("Hook validation failed")},_=e=>e.hooksDir??Q,V=e=>new Promise(t=>{const n=ge({input:process.stdin,output:process.stdout});n.question(`${e} (y/N) `,s=>{n.close();const o=s.trim().toLowerCase();t(o==="y"||o==="yes")})}),Nt=async(e,t,n={})=>{const s=A(),o=ee(s),i=B(s);if(o&&i)throw new Error(`Found both husky (${o}/) and prek (${i}). Remove or migrate one before running \`vis hook install\`.`);if(o){if(t.info(`Existing husky installation found at ${o}/`),await V("Would you like to migrate your husky hooks to vis?")){const a=te(s,e,t,{useEditorconfig:n.useEditorconfig});if(a.isError)throw new Error(a.message);a.message&&t.info(a.message);return}t.info("Aborting install. Remove husky first or run 'vis hook migrate' to migrate.");return}if(i){if(t.info(`Existing prek configuration found at ${i}`),await V("Would you like to migrate your prek hooks to vis?")){const a=re(s,e,t,{useEditorconfig:n.useEditorconfig});if(a.isError)throw new Error(a.message);a.message&&t.info(a.message);return}t.info("Aborting install. Remove the prek config first or run 'vis hook migrate' to migrate.");return}t.info(`Installing git hooks in ${e}/...`);const r=X(e,{force:n.force});if(r.isError)throw new J(r.message);r.message&&(r.isWarning?t.warn(r.message):t.info(r.message)),r.installed&&(b(h(s,e,"pre-commit"))||y(h(s,e,"pre-commit"),`#!/usr/bin/env sh
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import{createRequire as je}from"node:module";import{j as w,q as $,F as p}from"../packem_shared/index.server-Ca_EEVfw.js";import{U as _,$ as Ce,e as u,a as B,l as he,v as ye}from"../packem_shared/index-BzhrR_iC.js";import{p as n}from"./cli-main.js";import{o as ve,d as Ie,n as Ae}from"../packem_shared/pm-runner-RM72mDZg.js";import{V as P}from"../packem_shared/vis-user-error-D_ekz9rF.js";import{r as Ne,a as De,d as Pe}from"../packem_shared/git-source-DExWbfN0.js";import{g as Ge}from"../packem_shared/_commonjsHelpers-DTfxOvZk.js";import{y as K}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{g as Ue,l as Be}from"../packem_shared/npmrc-CHsOyMvA.js";import{a as Fe,g as He,b as Ve}from"../packem_shared/scaffold-files-Bje3_Ixv.js";import{h as x,U as f}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";let Se;const Te=e=>(Se??=je(import.meta.url))(e),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=e=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[t,r]=D.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return D.getBuiltinModule(e)}return Te(e)},{spawnSync:Ee}=U("node:child_process"),{createInterface:be}=U("node:readline"),{readdirSync:qe,mkdtempSync:Oe,realpathSync:oe,cpSync:Re,lstatSync:ze,rmSync:Me,chmodSync:Le}=U("node:fs"),{tmpdir:We}=U("node:os"),Je={"vis:app":"builtin:app","vis:application":"builtin:app","vis:generator":"builtin:generator","vis:lib":"builtin:library","vis:library":"builtin:library","vis:monorepo":"builtin:monorepo"},Xe=["https://github.com/","https://gitlab.com/","https://bitbucket.org/","https://raw.githubusercontent.com/","https://git.sr.ht/","git@github.com:","git@gitlab.com:","git@bitbucket.org:","git@git.sr.ht:","github:","gh:","gitlab:","gitlab://","bitbucket:","sourcehut:","git:","http://","https://"],Ke=e=>{for(const t of Xe)if(e.startsWith(t))return!0;return/^[\w.-]+@[\w.-]+:/.test(e)?!0:!e.startsWith("@")&&/^[^/#@][^/#]*\/[^/#]+/.test(e)},Ye=new Set(["sv"]),Qe=e=>{if(Ye.has(e)||e.startsWith("create-")||e.startsWith("@")&&e.includes("/create-"))return e;if(e.startsWith("@")){const t=e.indexOf("/");if(t!==-1){const r=e.slice(0,t),i=e.slice(t+1);return`${r}/create-${i}`}return e}return`create-${e}`},Ze=(e,t=[])=>{if(!e)throw new Error("No template specified.");const r=e.toLowerCase(),i=Je[r];return i?{args:t,source:r,type:i}:Ke(e)?{args:t,source:e,type:"remote:git"}:{args:t,source:Qe(e),type:"remote:npm"}},et=e=>{switch(e){case"builtin:app":return"apps";case"builtin:generator":case"builtin:library":return"packages";default:return"."}},se=["ability","able","about","above","abroad","absence","absolute","absolutely","absorb","academic","accept","access","accompany","accomplish","according","account","accurate","achieve","achievement","acid","acknowledge","acquire","across","act","action","active","activist","activity","actor","actress","actual","actually","adapt","add","addition","additional","address","adequate","adjust","adjustment","administration","administrator","admire","admission","admit","adolescent","adopt","adult","advance","advanced","advantage","adventure","advertising","advice","advise","adviser","advocate","affair","affect","afford","after","afternoon","again","against","age","agency","agenda","agent","ago","agree","agreement","agricultural","ahead","aid","aide","aim","air","aircraft","airline","airport","album","alive","all","alliance","allow","ally","almost","alone","along","already","also","alter","alternative","although","always","amazing","among","amount","analysis","analyst","analyze","ancient","and","angle","animal","anniversary","announce","annual","another","answer","anticipate","any","anybody","anymore","anyone","anything","anyway","anywhere","apart","apartment","apparent","apparently","appeal","appear","appearance","apple","application","apply","appoint","appointment","appreciate","approach","appropriate","approval","approve","approximately","architect","area","argue","argument","arise","arm","armed","around","arrange","arrangement","arrival","arrive","art","article","artist","artistic","aside","ask","asleep","aspect","assert","assess","assessment","asset","assign","assignment","assist","assistance","assistant","associate","association","assume","assumption","assure","athlete","athletic","atmosphere","attach","attempt","attend","attention","attitude","attorney","attract","attractive","attribute","audience","author","authority","auto","available","average","avoid","award","aware","awareness","away","awesome","baby","back","background","bag","bake","balance","ball","ban","band","bank","bar","barely","barrel","base","baseball","basic","basically","basis","basket","basketball","bathroom","battery","beach","bean","bear","beat","beautiful","beauty","because","become","bed","bedroom","beer","before","begin","beginning","behavior","behind","being","belief","believe","bell","belong","below","belt","bench","bend","beneath","benefit","beside","besides","best","bet","better","between","beyond","big","bike","bill","billion","bind","biological","bird","birth","birthday","bit","bite","black","blade","blanket","blind","block","blow","blue","board","boat","body","bond","bone","book","boom","boot","border","born","borrow","boss","both","bother","bottle","bottom","boundary","bowl","box","boy","boyfriend","brain","branch","brand","bread","break","breakfast","breast","breath","breathe","brick","bridge","brief","briefly","bright","brilliant","bring","broad","brother","brown","brush","buck","budget","build","building","bullet","bunch","bury","bus","business","busy","but","butter","button","buy","buyer","cabin","cabinet","cable","cake","calculate","call","camera","camp","campaign","campus","can","candidate","cap","capability","capable","capacity","capital","captain","capture","car","carbon","card","care","career","careful","carefully","carrier","carry","case","cash","cast","cat","catch","category","cause","ceiling","celebrate","celebration","celebrity","cell","center","central","century","ceremony","certain","certainly","chain","chair","chairman","challenge","chamber","champion","championship","chance","change","changing","channel","chapter","character","characteristic","characterize","charge","charity","chart","chase","cheap","check","cheek","cheese","chef","chemical","chest","chicken","chief","child","childhood","chip","chocolate","choice","cholesterol","choose","church","cigarette","circle","circumstance","cite","citizen","city","civil","civilian","claim","class","classic","classroom","clean","clear","clearly","client","climate","climb","clinic","clinical","clock","close","closely","closer","clothes","clothing","cloud","club","clue","cluster","coach","coal","coalition","coast","coat","code","coffee","cognitive","cold","colleague","collect","collection","collective","college","colonial","color","column","combination","combine","come","comedy","comfort","comfortable","command","commander","comment","commercial","commission","commit","commitment","committee","common","communicate","communication","community","company","compare","comparison","compete","competition","competitive","competitor","complete","completely","complex","complicated","component","compose","composition","comprehensive","computer","concentrate","concentration","concept","concern","concerned","concert","conclude","conclusion","concrete","condition","conduct","conference","confidence","confident","confirm","confront","confusion","congressional","connect","connection","consciousness","consensus","consequence","conservative","consider","considerable","consideration","consist","consistent","constant","constantly","constitute","constitutional","construct","construction","consultant","consume","consumer","consumption","contact","contain","container","contemporary","content","contest","context","continue","continued","contract","contrast","contribute","contribution","control","convention","conventional","conversation","convert","conviction","convince","cook","cookie","cooking","cool","cooperation","cop","cope","copy","core","corn","corner","corporate","corporation","correct","correspondent","cost","cotton","couch","could","council","counselor","count","counter","country","county","couple","courage","course","court","cousin","cover","coverage","cow","crack","craft","cream","create","creation","creative","creature","credit","crew","criteria","crop","cross","crowd","crucial","cultural","culture","cup","curious","current","currently","curriculum","custom","customer","cut","cycle","dad","daily","dance","dare","dark","darkness","data","date","daughter","day","deal","dealer","dear","debate","decade","decide","decision","deck","declare","decrease","deep","deeply","deer","defend","defendant","defense","defensive","define","definitely","definition","degree","delay","deliver","delivery","demand","democracy","democratic","demonstrate","demonstration","deny","department","depend","dependent","depending","depict","depth","deputy","derive","describe","description","desert","deserve","design","designer","desire","desk","desperate","despite","detail","detailed","detect","determine","develop","developing","development","device","devote","dialogue","diet","differ","difference","different","differently","difficult","difficulty","dig","digital","dimension","dining","dinner","direct","direction","directly","director","disability","disagree","disappear","discipline","discourse","discover","discovery","discuss","discussion","dish","dismiss","display","distance","distant","distinct","distinction","distinguish","distribute","distribution","district","diverse","diversity","divide","division","doctor","document","dog","domestic","dominant","dominate","door","double","down","downtown","dozen","draft","drag","drama","dramatic","dramatically","draw","drawing","dream","dress","drink","drive","driver","drop","dry","due","during","dust","duty","each","eager","ear","early","earn","earnings","earth","ease","easily","east","eastern","easy","eat","economic","economics","economist","economy","edge","edition","editor","educate","education","educational","educator","effect","effective","effectively","efficiency","efficient","effort","egg","eight","either","elderly","elect","election","electric","electricity","electronic","element","elementary","eliminate","elite","else","elsewhere","embrace","emerge","emission","emotion","emotional","emphasis","emphasize","employ","employee","employer","employment","empty","enable","encounter","encourage","end","energy","enforcement","engage","engine","engineer","engineering","enhance","enjoy","enormous","enough","ensure","enter","enterprise","entertainment","entire","entirely","entrance","entry","environment","environmental","episode","equal","equally","equipment","era","escape","especially","essay","essential","essentially","establish","establishment","estate","estimate","etc","ethics","ethnic","evaluate","evaluation","even","evening","event","eventually","ever","every","everybody","everyday","everyone","everything","everywhere","evidence","evolution","evolve","exact","exactly","examination","examine","example","exceed","excellent","except","exception","exchange","exciting","executive","exercise","exhibit","exhibition","exist","existence","existing","expand","expansion","expect","expectation","expense","expensive","experience","experiment","expert","explain","explanation","explore","expose","express","expression","extend","extension","extensive","extent","external","extra","extraordinary","extreme","extremely","eye","fabric","face","facility","fact","factor","factory","faculty","fade","fair","fairly","faith","fall","false","familiar","family","famous","fan","fantasy","far","farm","farmer","fashion","fast","fate","father","favor","favorite","feature","federal","fee","feed","feel","feeling","fellow","female","fence","few","fewer","fiber","fiction","field","fifteen","fifth","fifty","figure","file","fill","film","final","finally","finance","financial","find","finding","fine","finger","finish","firm","first","fish","fishing","fit","fitness","five","fix","flag","flame","flat","flavor","flesh","flight","float","floor","flow","flower","fly","focus","folk","follow","following","food","foot","football","for","force","foreign","forest","forever","forget","form","formal","formation","former","formula","forth","fortune","forward","found","foundation","founder","four","fourth","frame","framework","free","freedom","freeze","frequency","frequent","frequently","fresh","friend","friendly","friendship","from","front","fruit","fuel","full","fully","fun","function","fund","fundamental","funding","funeral","funny","furniture","furthermore","future","gain","galaxy","gallery","game","gap","garage","garden","garlic","gas","gate","gather","gaze","gear","gender","gene","general","generally","generate","generation","genetic","gentleman","gently","gesture","get","ghost","giant","gift","gifted","girl","girlfriend","give","given","glad","glance","glass","global","glove","goal","gold","golden","golf","good","government","governor","grab","grade","gradually","graduate","grain","grand","grandfather","grandmother","grant","grass","grave","gray","great","greatest","green","grocery","ground","group","grow","growing","growth","guarantee","guard","guess","guest","guide","guideline","guy","habit","habitat","hair","half","hall","hand","handful","handle","hang","happen","happy","hard","hardly","hat","have","head","headline","headquarters","health","healthy","hear","hearing","heart","heat","heaven","heavily","heavy","heel","height","helicopter","hello","help","helpful","here","heritage","hero","herself","hey","hide","high","highlight","highly","highway","hill","himself","hip","hire","historian","historic","historical","history","hit","hold","hole","holiday","holy","home","honest","honey","honor","hope","horizon","horse","hospital","host","hot","hotel","hour","house","household","housing","how","however","huge","human","humor","hundred","hungry","hunter","hunting","husband","hypothesis","ice","idea","ideal","identification","identify","identity","ignore","illustrate","image","imagination","imagine","immediate","immediately","immigrant","immigration","impact","implement","implication","imply","importance","important","impose","impossible","impress","impression","impressive","improve","improvement","incentive","incident","include","including","income","incorporate","increase","increased","increasing","increasingly","incredible","indeed","independence","independent","index","indicate","indication","individual","industrial","industry","infant","inflation","influence","inform","information","ingredient","initial","initially","initiative","inner","innocent","inquiry","inside","insight","insist","inspire","install","instance","instead","institution","institutional","instruction","instructor","instrument","insurance","intellectual","intelligence","intend","intense","intensity","intention","interaction","interest","interested","interesting","internal","international","interpret","interpretation","intervention","interview","into","introduce","introduction","invest","investigate","investigation","investigator","investment","investor","invite","involve","involved","involvement","iron","island","issue","item","its","itself","jacket","jet","job","join","joint","joke","journal","journalist","journey","joy","judge","judgment","juice","jump","junior","jury","just","justice","justify","keep","key","kick","kid","kind","king","kiss","kitchen","knee","knife","knock","know","knowledge","lab","label","labor","laboratory","lady","lake","land","landscape","language","lap","large","largely","last","late","later","latter","laugh","launch","law","lawn","lawsuit","lawyer","lay","layer","lead","leader","leadership","leading","leaf","league","lean","learn","learning","least","leather","leave","left","leg","legacy","legal","legend","legislation","legitimate","lemon","length","less","lesson","let","letter","level","liberal","library","license","lie","life","lifestyle","lifetime","lift","light","like","likely","limit","limitation","limited","line","link","lip","list","listen","literally","literary","literature","little","live","living","load","loan","local","locate","location","lock","long","look","loose","lose","lost","lot","lots","loud","love","lovely","lover","low","lower","luck","lucky","lunch","lung","machine","magazine","mail","main","mainly","maintain","maintenance","major","majority","make","maker","makeup","male","mall","man","manage","management","manager","manner","manufacturer","manufacturing","many","map","margin","mark","market","marketing","marriage","married","marry","mask","mass","massive","master","match","material","math","matter","may","maybe","mayor","meal","mean","meaning","meanwhile","measure","measurement","meat","mechanism","media","medical","medication","medicine","medium","meet","meeting","member","membership","memory","mental","mention","menu","mere","merely","message","metal","meter","method","middle","might","military","milk","million","mind","mine","minister","minor","minority","minute","miracle","mirror","miss","missile","mission","mix","mixture","mode","model","moderate","modern","modest","mom","moment","money","monitor","month","mood","moon","moral","more","moreover","morning","mortgage","most","mostly","mother","motion","motivation","motor","mount","mountain","mouse","mouth","move","movement","movie","much","multiple","muscle","museum","music","musical","musician","must","mutual","myself","mystery","myth","naked","name","narrative","narrow","nation","national","native","natural","naturally","nature","near","nearby","nearly","necessarily","necessary","neck","need","negative","negotiate","negotiation","neighbor","neighborhood","neither","nerve","net","network","never","nevertheless","new","newly","news","newspaper","next","nice","night","nine","nobody","nod","nomination","none","nonetheless","nor","normal","normally","north","northern","nose","not","note","nothing","notice","notion","novel","now","nowhere","nuclear","number","numerous","nurse","nut","object","objective","obligation","observation","observe","observer","obtain","obvious","obviously","occasion","occasionally","occupation","occupy","occur","ocean","odd","odds","off","offer","office","officer","official","often","oil","okay","old","once","one","ongoing","onion","online","only","onto","open","opening","operate","operating","operation","operator","opinion","opponent","opportunity","oppose","opposite","opposition","option","orange","order","ordinary","organic","organization","organize","orientation","origin","original","originally","other","others","otherwise","ought","our","ourselves","out","outcome","outside","oven","over","overall","overcome","overlook","owe","own","owner","pace","pack","package","page","paint","painter","painting","pair","pale","palm","pan","panel","pant","paper","parent","park","parking","part","participant","participate","participation","particular","particularly","partly","partner","partnership","party","pass","passage","passenger","passion","past","patch","path","patient","pattern","pause","pay","payment","peace","peak","peer","people","pepper","per","perceive","percentage","perception","perfect","perfectly","perform","performance","perhaps","period","permanent","permission","permit","person","personal","personality","personally","personnel","perspective","persuade","pet","phase","phenomenon","philosophy","phone","photo","photograph","photographer","phrase","physical","physically","physician","piano","pick","picture","pie","piece","pile","pilot","pine","pink","pipe","pitch","place","plan","plane","planet","planning","plant","plastic","plate","platform","play","player","please","pleasure","plenty","plot","plus","pocket","poem","poet","poetry","point","pole","police","policy","political","politically","politician","politics","poll","pool","pop","popular","population","porch","port","portion","portrait","portray","pose","position","positive","possess","possibility","possible","possibly","post","pot","potato","potential","potentially","pound","pour","powder","power","powerful","practical","practice","pray","prayer","precisely","predict","prefer","preference","pregnancy","pregnant","preparation","prepare","prescription","presence","present","presentation","preserve","president","presidential","press","pretend","pretty","prevent","previous","previously","price","pride","priest","primarily","primary","prime","principal","principle","print","prior","priority","privacy","private","probably","procedure","proceed","process","produce","producer","product","production","profession","professional","professor","profile","profit","program","progress","project","prominent","promise","promote","prompt","proof","proper","properly","property","proportion","proposal","propose","proposed","prosecutor","prospect","protect","protection","protein","protest","proud","prove","provide","provider","province","provision","psychological","psychologist","psychology","public","publication","publicly","publish","publisher","pull","purchase","pure","purpose","pursue","push","put","qualify","quality","quarter","quarterback","question","quick","quickly","quiet","quietly","quit","quite","quote","race","racial","radical","radio","rail","rain","raise","range","rank","rapid","rapidly","rare","rarely","rate","rather","rating","ratio","raw","reach","react","reaction","read","reader","reading","ready","real","reality","realize","really","reason","reasonable","recall","receive","recent","recently","recipe","recognition","recognize","recommend","recommendation","record","recording","recover","recovery","recruit","red","reduce","reduction","refer","reference","reflect","reflection","reform","refugee","refuse","regard","regarding","regardless","regime","region","regional","register","regular","regularly","regulate","regulation","reinforce","relate","relation","relationship","relative","relatively","relax","release","relevant","relief","religion","religious","rely","remain","remaining","remarkable","remember","remind","remote","remove","repeat","repeatedly","replace","reply","report","reporter","represent","representation","representative","reputation","request","require","requirement","research","researcher","resemble","reservation","resident","resist","resolution","resolve","resort","resource","respect","respond","respondent","response","responsibility","responsible","rest","restaurant","restore","restriction","result","retain","retire","retirement","return","reveal","revenue","review","revolution","rhythm","rice","rich","rid","ride","rifle","right","ring","rise","river","road","rock","role","roll","romantic","roof","room","root","rope","rose","roughly","round","route","routine","row","rub","rule","run","running","rural","rush","sacred","safe","safety","sake","salad","salary","sale","sales","salt","same","sample","sanction","sand","satellite","satisfaction","satisfy","sauce","save","saving","say","scale","scenario","scene","schedule","scheme","scholar","scholarship","school","science","scientific","scientist","scope","score","screen","script","sea","search","season","seat","second","secret","secretary","section","sector","secure","security","see","seed","seek","seem","segment","seize","select","selection","self","sell","senator","send","senior","sense","sensitive","sentence","separate","sequence","series","serious","seriously","serve","service","session","set","setting","settle","settlement","seven","several","shade","shadow","shake","shall","shape","share","sharp","sheet","shelf","shell","shelter","shift","shine","ship","shirt","shoe","shop","shopping","shore","short","shortly","shot","should","shoulder","shout","show","shower","shrug","shut","side","sigh","sight","sign","signal","significance","significant","significantly","silence","silent","silver","similar","similarly","simple","simply","since","sing","singer","single","sink","sir","sister","sit","site","situation","six","size","ski","skill","skin","sky","sleep","slice","slide","slight","slightly","slip","slow","slowly","small","smart","smell","smile","smooth","snap","snow","soccer","social","society","soft","software","soil","solar","solid","solution","solve","some","somebody","somehow","someone","something","sometimes","somewhat","somewhere","son","song","soon","sophisticated","sorry","sort","soul","sound","soup","source","south","southern","space","speak","speaker","special","specialist","species","specific","specifically","speech","speed","spend","spending","spin","spirit","spiritual","split","spokesman","sport","spot","spread","spring","square","squeeze","stability","stable","staff","stage","stair","stake","stand","standard","standing","star","stare","start","state","statement","station","statistics","status","stay","steady","steal","steel","step","stick","still","stir","stock","stomach","stone","stop","storage","store","storm","story","straight","strange","stranger","strategic","strategy","stream","street","strength","strengthen","stretch","string","strip","strong","strongly","structure","student","studio","study","stuff","style","subject","submit","subsequent","substance","substantial","succeed","success","successful","successfully","such","sudden","suddenly","sue","sufficient","sugar","suggest","suggestion","suit","summer","summit","sun","super","supply","support","supporter","suppose","supposed","sure","surely","surface","surgery","surprise","surprised","surprising","surprisingly","surround","survey","survival","survive","survivor","sustain","swear","sweep","sweet","swim","swing","switch","symbol","system","table","tablespoon","tactic","tail","take","tale","talent","talk","tall","tank","tap","tape","target","task","taste","tax","taxpayer","tea","teach","teacher","teaching","team","tear","teaspoon","technical","technique","technology","teen","teenager","telephone","telescope","television","tell","temperature","temporary","ten","tend","tendency","tennis","tent","term","terms","territory","test","testify","testimony","testing","text","than","thank","thanks","that","the","theater","their","them","theme","themselves","then","theory","therapy","there","therefore","thick","thin","thing","think","thinking","third","thirty","though","thought","thousand","three","throat","through","throughout","throw","ticket","tie","tight","time","tiny","tip","tire","tired","tissue","title","today","toe","together","tomato","tomorrow","tone","tongue","tonight","too","tool","tooth","top","topic","toss","total","totally","touch","tough","tour","tourist","tournament","tower","town","toy","trace","track","trade","tradition","traditional","traffic","trail","train","training","transfer","transform","transformation","transition","translate","transportation","travel","treat","treatment","treaty","tree","tremendous","trend","trial","tribe","trip","troop","truck","true","truly","trust","truth","try","tube","tunnel","turn","twelve","twenty","twice","twin","two","type","typical","typically","ultimate","ultimately","unable","uncle","under","undergo","understand","understanding","unfortunately","uniform","union","unique","unit","universal","universe","university","unknown","unless","unlike","unlikely","until","unusual","upon","upper","urban","urge","use","used","useful","user","usual","usually","utility","vacation","valley","valuable","value","variable","variation","variety","various","vary","vast","vegetable","vehicle","venture","version","versus","very","vessel","veteran","via","victory","video","view","viewer","village","virtually","virtue","visible","vision","visit","visitor","visual","vital","voice","volume","volunteer","vote","voter","wage","wait","wake","walk","wall","wander","want","warm","warn","warning","wash","watch","water","wave","way","wealth","wealthy","wear","weather","wedding","week","weekend","weekly","weigh","weight","welcome","welfare","well","west","western","wet","what","whatever","wheel","when","whenever","where","whereas","whether","which","while","whisper","white","who","whole","whom","whose","why","wide","widely","widespread","wife","wild","will","willing","win","wind","window","wine","wing","winner","winter","wipe","wire","wisdom","wise","wish","with","withdraw","within","without","witness","woman","wonder","wonderful","wood","wooden","word","work","worker","working","works","workshop","world","worried","worth","would","wrap","write","writer","writing","yard","yeah","year","yell","yellow","yes","yesterday","yield","young","your","yours","yourself","youth","zone"],tt=(e,t)=>Math.floor(e+Math.random()*(t-e+1));function le(){return se[tt(0,se.length-1)]}const rt=()=>`${le()}-${le()}`;var V,ce;function it(){return ce||(ce=1,V=["_http_agent","_http_client","_http_common","_http_incoming","_http_outgoing","_http_server","_stream_duplex","_stream_passthrough","_stream_readable","_stream_transform","_stream_wrap","_stream_writable","_tls_common","_tls_wrap","assert","assert/strict","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","dns/promises","domain","events","fs","fs/promises","http","http2","https","inspector","inspector/promises","module","net","os","path","path/posix","path/win32","perf_hooks","process","punycode","querystring","readline","readline/promises","repl","stream","stream/consumers","stream/promises","stream/web","string_decoder","sys","timers","timers/promises","tls","trace_events","tty","url","util","util/types","v8","vm","wasi","worker_threads","zlib","node:sea","node:sqlite","node:test","node:test/reporters"]),V}var W,pe;function at(){if(pe)return W;pe=1;const e=it();var t=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),r=["node_modules","favicon.ico"];function i(a){var l=[],s=[];if(a===null)return s.push("name cannot be null"),o(l,s);if(a===void 0)return s.push("name cannot be undefined"),o(l,s);if(typeof a!="string")return s.push("name must be a string"),o(l,s);if(a.length||s.push("name length must be greater than zero"),a.startsWith(".")&&s.push("name cannot start with a period"),a.startsWith("-")&&s.push("name cannot start with a hyphen"),a.match(/^_/)&&s.push("name cannot start with an underscore"),a.trim()!==a&&s.push("name cannot contain leading or trailing spaces"),r.forEach(function(v){a.toLowerCase()===v&&s.push(v+" is not a valid package name")}),e.includes(a.toLowerCase())&&l.push(a+" is a core module name"),a.length>214&&l.push("name can no longer contain more than 214 characters"),a.toLowerCase()!==a&&l.push("name can no longer contain capital letters"),/[~'!()*]/.test(a.split("/").slice(-1)[0])&&l.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(a)!==a){var c=a.match(t);if(c){var y=c[1],h=c[2];if(h.startsWith(".")&&s.push("name cannot start with a period"),encodeURIComponent(y)===y&&encodeURIComponent(h)===h)return o(l,s)}s.push("name can only contain URL-friendly characters")}return o(l,s)}var o=function(a,l){var s={validForNewPackages:l.length===0&&a.length===0,validForOldPackages:l.length===0,warnings:a,errors:l};return s.warnings.length||delete s.warnings,s.errors.length||delete s.errors,s};return W=i,W}var nt=at();const ot=Ge(nt),we=e=>e?ot(e).validForNewPackages:!1,O=e=>e.toLowerCase().trim().replaceAll(/\s+/g,"-").replaceAll(/[^a-z\d\-~]/g,"-").replace(/^[._-]+/,"").replaceAll(/-{2,}/g,"-").replace(/-$/,""),st=new Set([".DS_Store",".git",".gitkeep","Thumbs.db"]),ke=e=>K(e)?qe(e).every(r=>st.has(r)):!0,lt=(e,t)=>{const r=_(t,e);return{packageName:O(Ce(r)),targetDir:r}},ct=e=>ke(e),q=(e,t)=>new Promise(r=>{e.question(t,i=>{r(i.trim())})}),J=async(e,t,r=!0)=>{const o=await q(e,` ${t} ${p(r?"[Y/n]":"[y/N]")} `);return o===""?r:o.toLowerCase()==="y"||o.toLowerCase()==="yes"},Y=async(e,t,r)=>{process.stderr.write(` ${t}
|
|
2
|
+
`);for(const[i,o]of r.entries()){const a=w($(` ${String(i+1)}.`)),l=o.hint?p(` — ${o.hint}`):"";process.stderr.write(`${a} ${o.label}${l}
|
|
3
|
+
`)}for(;;){const i=await q(e,`
|
|
4
|
+
${p(`Enter choice (1-${String(r.length)}):`)} `),o=Number.parseInt(i,10);if(o>=1&&o<=r.length)return r[o-1].value;const a=r.find(l=>l.value===i||l.label.toLowerCase()===i.toLowerCase());if(a)return a.value;process.stderr.write(` ${p("Invalid choice. Try again.")}
|
|
5
|
+
`)}},pt=async(e,t)=>{const r=be({input:process.stdin,output:process.stdout});try{return await Y(r,e,t)}finally{r.close()}},ut=async e=>{const t=be({input:process.stdin,output:process.stdout});try{process.stderr.write(`
|
|
6
|
+
${w($("vis create"))} ${p("— project scaffolding")}
|
|
7
|
+
|
|
8
|
+
`);let r=e.presetTemplate;if(!r){const R=e.inMonorepo?[{hint:"Scaffold via create-vite",label:"Vis Application",value:"vis:app"},{hint:"Reusable package scaffold",label:"Vis Library",value:"vis:library"},{hint:"Code generator scaffold",label:"Vis Generator",value:"vis:generator"},{hint:"Enter an npm create-* package or GitHub URL",label:"Custom template",value:"__custom__"}]:[{hint:"Full workspace setup",label:"Vis Monorepo",value:"vis:monorepo"},{hint:"Scaffold via create-vite",label:"Vis Application",value:"vis:app"},{hint:"Reusable package scaffold",label:"Vis Library",value:"vis:library"},{hint:"Code generator scaffold",label:"Vis Generator",value:"vis:generator"},{hint:"Enter an npm create-* package or GitHub URL",label:"Custom template",value:"__custom__"}];if(r=await Y(t,"Select a template:",R),r==="__custom__"&&(r=await q(t,`
|
|
9
|
+
${p("Template (npm package, @org, or GitHub URL):")} `),!r))throw new Error("No template specified.")}const i=rt(),a=await q(t,`
|
|
10
|
+
${p(`Project name (${i}):`)} `)||i;if(!we(O(a)))throw new Error(`Invalid project name: "${a}". Must be a valid npm package name.`);const l=O(a),c=await q(t,` ${p(`Target directory (${l}):`)} `)||l;let y=!1;const h=_(e.cwd,c);if(!ke(h)&&(y=await J(t,`Directory "${c}" is not empty. Overwrite?`,!1),!y))throw new Error("Aborted — directory not empty.");let v;e.inMonorepo||(e.defaultPm?(v=e.defaultPm,process.stderr.write(` ${p(`Package manager: ${v} (from config)`)}
|
|
11
|
+
`)):v=await Y(t,"Package manager:",[{label:"pnpm",value:"pnpm"},{label:"npm",value:"npm"},{label:"yarn",value:"yarn"},{label:"bun",value:"bun"}]));let E=!1;e.inMonorepo||(E=await J(t,"Initialize a git repository?",e.defaultGitInit??!1));const j=e.defaultEditor==="vscode",I=await J(t,"Generate VS Code configuration?",j)?"vscode":void 0;return process.stderr.write(`
|
|
12
|
+
`),{editor:I,gitInit:E,overwrite:y,pm:v,projectName:a,targetDir:c,template:r}}finally{t.close()}},L=50,ue=64,de=200,Q=300,dt=256*1024,mt=1e4,me=/^[a-z0-9][a-z0-9._-]*$/,$e=/^@([a-z0-9][a-z0-9._~-]*)(?::([a-z0-9][a-z0-9._-]*))?$/,gt=/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/,ft=/^\w[\w.-]*$/,ht=/^(?:github|gh|gitlab|bitbucket|sourcehut):/,m=e=>new P(`Invalid organization template manifest: ${e}`),T=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),G=e=>$e.test(e),yt=e=>{if(typeof e!="string")throw m("every template needs a string description");const t=e.replaceAll(new RegExp("\\p{Cc}","gu"),"").trim();if(t.length===0||t.length>de)throw m(`descriptions must be 1-${de} characters`);return t},vt=e=>{if(typeof e!="string"||e.length===0||e.length>Q)throw m("bundled source path must be a non-empty string");const t=e.split("/");if(!t.every(r=>ft.test(r)))throw m(`bundled source path "${e}" must be relative and contain only plain segments`);return t.join("/")},bt=e=>{if(!T(e))throw m("every template needs a source object");switch(e.kind){case"bundled":return{kind:"bundled",path:vt(e.path)};case"git":{const{url:t}=e;if(typeof t!="string"||t.length>Q||/\s/.test(t)||t.startsWith("-"))throw m("git source url is malformed");const r=Ne(t);if(!ht.test(r.source)||r.gitlabUrl!==void 0)throw m(`git source "${t}" must use github, gitlab, bitbucket or sourcehut on the default host`);return{kind:"git",url:t}}case"npm":{const{package:t}=e;if(typeof t!="string"||t.length>Q||!gt.test(t))throw m("npm source must be a plain package name (no version, no flags)");return{kind:"npm",package:t}}default:throw m(`unknown source kind "${String(e.kind)}" (expected npm, git or bundled)`)}},wt=e=>{let t;if(Array.isArray(e)){if(e.length>L)throw m(`at most ${L} templates are allowed`);t=e.map(i=>[T(i)?i.name:void 0,i])}else if(T(e)){if(Object.keys(e).length>L)throw m(`at most ${L} templates are allowed`);t=Object.entries(e)}else throw m("templates must be an array or an object");const r=new Set;return t.map(([i,o])=>{if(typeof i!="string"||i.length>ue||!me.test(i))throw m(`template name ${JSON.stringify(i)} must match ${me.source} (max ${ue})`);if(r.has(i))throw m(`duplicate template name "${i}"`);if(r.add(i),!T(o))throw m(`template "${i}" must be an object`);return{description:yt(o.description),name:i,source:bt(o.source)}})},ge=(e,t,r)=>{const{source:i}=e;switch(i.kind){case"bundled":{if(!t.tarball)throw m(`bundled template "${e.name}" needs a https dist.tarball for its package`);return{args:r,source:t.tarball,subdir:i.path,type:"remote:bundled"}}case"git":return{args:r,source:i.url,type:"remote:git"};case"npm":return{args:r,source:i.package,type:"remote:npm"};default:throw m(`unknown source kind for "${e.name}"`)}},kt=async(e,t)=>{const r=`${e}/create`,i=Ue(r,Be(t)),o=new AbortController,a=setTimeout(()=>{o.abort()},mt);let l;try{const h=await fetch(`${i.url.replace(/\/+$/,"")}/${r.replaceAll("/","%2F")}/latest`,{headers:{accept:"application/json",...i.token?{authorization:`Bearer ${i.token}`}:{}},signal:o.signal});if(h.status===404)return;if(!h.ok)throw new Error(`registry responded ${String(h.status)} for ${r}`);l=await h.text()}finally{clearTimeout(a)}if(l.length>dt)throw m("package manifest is too large");const s=JSON.parse(l);if(!T(s)||!T(s.createConfig)||s.createConfig.templates===void 0)return;const c=wt(s.createConfig.templates);return{tarball:T(s.dist)&&typeof s.dist.tarball=="string"&&/^https:\/\//.test(s.dist.tarball)?s.dist.tarball:void 0,templates:c}},fe=(e,t)=>{n.info(""),n.info(` ${e} templates:`);for(const r of t)n.info(` ${w($(`${e}:${r.name}`))} ${p(r.description)}`);n.info("")},X=async(e,t)=>{const r=$e.exec(e);if(!r)throw new P(`"${e}" is not an organization template.`);const i=`@${r[1]}`,o=r[2],a=await kt(i,t.cwd);if(!a){if(t.list){n.info(`${i}/create has no createConfig.templates manifest. "vis create ${i}" runs it as a template.`);return}if(o)throw new P(`${i}/create has no createConfig.templates manifest, so "${i}:${o}" cannot be resolved.`);return{config:{args:t.args,source:`${i}/create`,type:"remote:npm"},name:i.slice(1)}}if(t.list){fe(i,a.templates);return}if(o){const c=a.templates.find(y=>y.name===o);if(!c)throw new P(`${i} has no template "${o}". Available: ${a.templates.map(y=>y.name).join(", ")}`);return{config:ge(c,a,t.args),name:c.name}}if(!t.interactive)throw fe(i,a.templates),new P(`Choose a template in non-interactive mode: vis create ${i}:<name>`);const l=await pt(`${i} templates`,a.templates.map(c=>({hint:c.description,label:c.name,value:c.name}))),s=a.templates.find(c=>c.name===l);return{config:ge(s,a,t.args),name:s.name}},$t=(e,t)=>{n.info("Scaffolding application via create-vite...");const i=[B(t.cwd,t.targetDir)||".",...e.args];return i.includes("--no-immediate")||i.push("--no-immediate"),ve(t.pm,{additionalPackages:[],args:i,package:"create-vite",shellMode:!1,silent:!1},t.cwd,t.logger)},_t=e=>`${JSON.stringify({devDependencies:{typescript:"^5.0.0",vitest:"^3.0.0"},exports:{".":{default:"./dist/index.js",types:"./dist/index.d.ts"}},files:["dist"],main:"./dist/index.js",name:e,scripts:{build:"tsc",dev:"tsc --watch",test:"vitest run","test:watch":"vitest"},type:"module",types:"./dist/index.d.ts",version:"0.0.1"},null,4)}
|
|
13
|
+
`,xt=()=>`${JSON.stringify({compilerOptions:{declaration:!0,declarationMap:!0,esModuleInterop:!0,module:"Node16",moduleResolution:"Node16",outDir:"./dist",rootDir:"./src",skipLibCheck:!0,sourceMap:!0,strict:!0,target:"ES2022"},include:["src/**/*"]},null,4)}
|
|
14
|
+
`,jt=e=>`/**
|
|
15
|
+
* ${e} — library entry point.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const greet = (name: string): string => \`Hello from ${e}, \${name}!\`;
|
|
19
|
+
`,St=e=>`import { describe, expect, it } from "vitest";
|
|
20
|
+
|
|
21
|
+
import { greet } from "../src/index";
|
|
22
|
+
|
|
23
|
+
describe("${e}", () => {
|
|
24
|
+
it("should greet", () => {
|
|
25
|
+
expect(greet("world")).toBe("Hello from ${e}, world!");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
`,Tt=(e,t)=>{const{projectName:r,targetDir:i}=t;return n.info("Scaffolding library package..."),x(i),x(u(i,"src")),x(u(i,"__tests__")),f(u(i,"package.json"),_t(r)),n.success("Created package.json"),f(u(i,"tsconfig.json"),xt()),n.success("Created tsconfig.json"),f(u(i,"src","index.ts"),jt(r)),n.success("Created src/index.ts"),f(u(i,"__tests__","index.test.ts"),St(r)),n.success("Created __tests__/index.test.ts"),f(u(i,".gitignore"),`node_modules/
|
|
29
|
+
dist/
|
|
30
|
+
.env
|
|
31
|
+
.DS_Store
|
|
32
|
+
`),n.success("Created .gitignore"),0},Et=(e,t)=>{switch(e.type){case"builtin:app":return $t(e,t);case"builtin:library":return Tt(e,t);default:throw new Error(`Unknown built-in template type: ${e.type}`)}},Ct=async(e,t)=>{const r=e.subdir??"",i=Oe(u(We(),"vis-bundled-"));try{await De(e.source,{dir:i,force:!0});const o=oe(i),a=oe(_(o,r)),l=B(o,a);if(l===".."||l.startsWith(`..${he}`)||ye(l))throw new Error(`bundled path "${r}" resolves outside the package`);return Re(a,t.targetDir,{filter:s=>!ze(s).isSymbolicLink(),recursive:!0}),n.info(`Copied bundled template "${r}"`),0}catch(o){const a=o instanceof Error?o.message:String(o);return n.warn(`Failed to scaffold bundled template: ${a}`),1}finally{Me(i,{force:!0,recursive:!0})}},It=(e,t)=>`${JSON.stringify({bin:{[e]:"./bin/index.js"},description:t,devDependencies:{typescript:"^5.0.0"},name:e,private:!0,scripts:{build:"tsc",dev:"tsc --watch"},type:"module",version:"0.0.1"},null,4)}
|
|
33
|
+
`,At=e=>`#!/usr/bin/env node
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* ${e} — code generator
|
|
37
|
+
*
|
|
38
|
+
* Usage: npx ${e} [options]
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
console.log("Hello from ${e}!");
|
|
42
|
+
`,Nt=()=>`${JSON.stringify({compilerOptions:{declaration:!0,esModuleInterop:!0,module:"Node16",moduleResolution:"Node16",outDir:"./dist",rootDir:"./src",skipLibCheck:!0,strict:!0,target:"ES2022"},include:["src/**/*","bin/**/*"]},null,4)}
|
|
43
|
+
`,Dt=()=>`/**
|
|
44
|
+
* Generator core logic — export functions used by the CLI entry point.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
export const generate = (): void => {
|
|
48
|
+
// TODO: Implement your generator logic here
|
|
49
|
+
};
|
|
50
|
+
`,Pt=(e,t="")=>{const{projectName:r,targetDir:i}=e;n.info("Scaffolding code generator..."),x(i),x(u(i,"bin")),x(u(i,"src")),f(u(i,"package.json"),It(r,t||`Code generator: ${r}`)),n.success("Created package.json");const o=u(i,"bin","index.js");return f(o,At(r)),Le(o,493),n.success("Created bin/index.js (executable)"),f(u(i,"tsconfig.json"),Nt()),n.success("Created tsconfig.json"),f(u(i,"src","index.ts"),Dt()),n.success("Created src/index.ts"),0},qt=e=>`${JSON.stringify({devDependencies:{"@visulima/vis":"latest"},name:e,packageManager:"pnpm@latest",private:!0,scripts:{build:"vis run build",dev:"vis run dev",lint:"vis run lint",test:"vis run test"},type:"module",version:"0.0.0"},null,4)}
|
|
51
|
+
`,Ot=()=>`packages:
|
|
52
|
+
- "apps/*"
|
|
53
|
+
- "packages/*"
|
|
54
|
+
`,Rt=()=>`# Dependencies
|
|
55
|
+
node_modules/
|
|
56
|
+
|
|
57
|
+
# Build output
|
|
58
|
+
dist/
|
|
59
|
+
.output/
|
|
60
|
+
|
|
61
|
+
# Environment
|
|
62
|
+
.env
|
|
63
|
+
.env.local
|
|
64
|
+
.env.*.local
|
|
65
|
+
|
|
66
|
+
# IDE
|
|
67
|
+
.vscode/*
|
|
68
|
+
!.vscode/settings.json
|
|
69
|
+
!.vscode/extensions.json
|
|
70
|
+
.idea/
|
|
71
|
+
|
|
72
|
+
# OS
|
|
73
|
+
.DS_Store
|
|
74
|
+
Thumbs.db
|
|
75
|
+
|
|
76
|
+
# Logs
|
|
77
|
+
*.log
|
|
78
|
+
npm-debug.log*
|
|
79
|
+
pnpm-debug.log*
|
|
80
|
+
|
|
81
|
+
# Cache
|
|
82
|
+
.turbo/
|
|
83
|
+
.cache/
|
|
84
|
+
`,zt=()=>`root = true
|
|
85
|
+
|
|
86
|
+
[*]
|
|
87
|
+
indent_style = space
|
|
88
|
+
indent_size = 4
|
|
89
|
+
end_of_line = lf
|
|
90
|
+
charset = utf-8
|
|
91
|
+
trim_trailing_whitespace = true
|
|
92
|
+
insert_final_newline = true
|
|
93
|
+
|
|
94
|
+
[*.{yml,yaml}]
|
|
95
|
+
indent_size = 2
|
|
96
|
+
|
|
97
|
+
[*.md]
|
|
98
|
+
trim_trailing_whitespace = false
|
|
99
|
+
`,Mt=e=>`# ${e}
|
|
100
|
+
|
|
101
|
+
A monorepo powered by [vis](https://visulima.com/packages/vis).
|
|
102
|
+
|
|
103
|
+
## Getting Started
|
|
104
|
+
|
|
105
|
+
\`\`\`bash
|
|
106
|
+
# Install dependencies
|
|
107
|
+
pnpm install
|
|
108
|
+
|
|
109
|
+
# Run all apps in development mode
|
|
110
|
+
pnpm dev
|
|
111
|
+
|
|
112
|
+
# Build all packages
|
|
113
|
+
pnpm build
|
|
114
|
+
|
|
115
|
+
# Run tests
|
|
116
|
+
pnpm test
|
|
117
|
+
\`\`\`
|
|
118
|
+
|
|
119
|
+
## Structure
|
|
120
|
+
|
|
121
|
+
\`\`\`
|
|
122
|
+
├── apps/ # Applications
|
|
123
|
+
├── packages/ # Shared packages & libraries
|
|
124
|
+
├── pnpm-workspace.yaml
|
|
125
|
+
└── package.json
|
|
126
|
+
\`\`\`
|
|
127
|
+
`,Lt=e=>{const{projectName:t,targetDir:r}=e;return n.info("Scaffolding monorepo workspace..."),x(r),x(u(r,"apps")),x(u(r,"packages")),f(u(r,"package.json"),qt(t)),n.success("Created package.json"),f(u(r,"pnpm-workspace.yaml"),Ot()),n.success("Created pnpm-workspace.yaml"),f(u(r,".gitignore"),Rt()),n.success("Created .gitignore"),f(u(r,".editorconfig"),zt()),n.success("Created .editorconfig"),f(u(r,"README.md"),Mt(t)),n.success("Created README.md"),f(u(r,"apps",".gitkeep"),""),f(u(r,"packages",".gitkeep"),""),0},Gt={"create-nuxt":{monoArgs:["--no-gitInit"]},"create-vite":{args:["--no-immediate"]},sv:{args:["--no-install"],prependCommand:"create"}},Ut=(e,t,r)=>{const i=Gt[e];if(!i)return t;const o=[...t];if(i.prependCommand&&!o.includes(i.prependCommand)&&o.unshift(i.prependCommand),i.args)for(const a of i.args)o.includes(a)||o.push(a);if(r&&i.monoArgs)for(const a of i.monoArgs)o.includes(a)||o.push(a);return o},Bt=(e,t)=>{const r=B(t.cwd,t.targetDir)||".",i=[...e.args];i.includes(r)||i.unshift(r);const o=Ut(e.source,i,t.inMonorepo);return n.info(`Running ${e.source} via ${t.pm.name} dlx...`),ve(t.pm,{additionalPackages:[],args:o,package:e.source,shellMode:!1,silent:!1},t.cwd,t.logger)},Ft=async(e,t)=>{const{createConfig:r}=t;n.info(`Downloading template from ${e.source}...`);try{const i=await Pe(e.source,{auth:r?.auth,dir:t.targetDir,force:!0,preferOffline:r?.preferOffline,provider:r?.defaultProvider,registry:r?.registry});return n.info(`Downloaded to ${i.dir}`),0}catch(i){const o=i instanceof Error?i.message:String(i);return n.warn(`Failed to download template: ${o}`),/\b(?:401|403|404)\b/.test(o)&&n.warn("Private or self-hosted repository? Set GITHUB_TOKEN, GITLAB_TOKEN or BITBUCKET_TOKEN, or use an SSH source such as git:git@host:group/repo."),1}},Ht=async(e,t)=>{switch(e.type){case"builtin:app":case"builtin:library":return Et(e,t);case"builtin:generator":return Pt(t);case"builtin:monorepo":return Lt(t);case"remote:bundled":return Ct(e,t);case"remote:git":return Ft(e,t);case"remote:npm":return Bt(e,t);default:throw new Error(`Unknown template type: ${e.type}`)}},Vt=e=>{Ee("git",["init"],{cwd:e,stdio:"pipe"}).status===0?n.success("Initialized git repository"):n.warn("Failed to initialize git repository")},Wt=(e,t,r,i=!1)=>(n.info("Installing dependencies..."),Ae(t,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:!1,lockfileOnly:!1,noOptional:!1,offline:i,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},e,r)===0?(n.success("Dependencies installed"),!0):(n.warn("Dependency installation failed (you can run install manually)"),!1)),Jt=e=>{const a=e.split("#")[0].split("?")[0].replace(/\/+$/,"").replace(/\.git$/,"").split("/").filter(Boolean).at(-1)??"",l=a.includes(":")?a.split(":").pop()??a:a;return O(l)||"my-project"},Xt=e=>{if(n.info(""),n.info(" Built-in templates:"),n.info(` ${w($("vis:monorepo"))} ${p("Full pnpm workspace setup")}`),n.info(` ${w($("vis:app"))} ${p("Application scaffold via create-vite")}`),n.info(` ${w($("vis:library"))} ${p("Reusable TypeScript library package")}`),n.info(` ${w($("vis:generator"))} ${p("Code generator scaffold with bin entry")}`),e&&Object.keys(e).length>0){n.info(""),n.info(" Config aliases (vis.config.ts → create.templates):");for(const[t,r]of Object.entries(e))n.info(` ${w($(t))}${" ".repeat(Math.max(1,16-t.length))}${p(r)}`)}n.info(""),n.info(" Remote templates:"),n.info(` ${p("Any npm create-* package:")} vis create vite`),n.info(` ${p("GitHub repository:")} vis create user/repo`),n.info(` ${p("GitLab / Bitbucket:")} vis create gitlab:group/subgroup/repo`),n.info(` ${p("Self-hosted GitLab:")} vis create gitlab://git.example.com/group/repo`),n.info(` ${p("Full URL:")} vis create https://github.com/user/repo`),n.info(` ${p("SSH (private repos):")} vis create git@git.example.com:group/repo`),n.info(""),n.info(` ${p("Template args after --:")} vis create vite -- --template react-ts`),n.info("")},Kt=(e,t,r,i)=>{const o=_(t)===_(e)?"":e;process.stderr.write(`
|
|
128
|
+
`),n.success("Project created successfully!"),process.stderr.write(`
|
|
129
|
+
`),n.notice("Next steps:"),o&&n.info(` cd ${o}`),i||n.info(` ${r} install`),n.info(` ${r} run dev`),process.stderr.write(`
|
|
130
|
+
`)},ur=async({argument:e,logger:t,options:r,rawUnknown:i,visConfig:o,workspaceRoot:a})=>{const l=Array.isArray(e)?e:e?[e]:[],s=o?.create,c=r.cwd||a||process.cwd(),h=!!process.stdin.isTTY&&r.interactive!==!1;if(r.list){if(l[0]&&G(l[0])){await X(l[0],{args:[],cwd:a||c,interactive:!1,list:!0});return}Xt(s?.templates);return}const v=!!a,E=l.length===0&&h,j=s?.defaultTemplate;l.length===0&&j&&!E&&l.push(j);const I=j?s?.templates?.[j]??j:void 0,R=E&&I&&G(I)?await X(I,{args:[],cwd:a||c,interactive:!0}):void 0,Z=Ie(c);let k,b,g,A=s?.defaultEditor,z=s?.gitInit??!1,F=[],N=Z,ee=!1;if(Fe(r.editor),E){const d=await ut({cwd:c,defaultEditor:s?.defaultEditor,defaultGitInit:s?.gitInit,defaultPm:s?.defaultPm,inMonorepo:v,presetTemplate:j});k=d.template,b=d.projectName,g=_(c,d.targetDir),A=d.editor??A,z=d.gitInit,ee=d.overwrite,d.pm&&(N={name:d.pm,version:Z.version})}else{if(l.length===0)throw new Error(`No template specified. Usage: vis create <template> [name] [-- args...]
|
|
131
|
+
Use --list to see available templates, or run interactively in a terminal.`);{let d=[...i??[]];if(d.length===0){const ae=process.argv.slice(2),ne=ae.indexOf("--");ne!==-1&&(d=ae.slice(ne+1))}const S=l.indexOf("--"),xe=S===-1?l:l.slice(0,S);F=[...S===-1?[]:l.slice(S+1),...d],[k,b]=xe,!b&&k&&!G(k)&&(b=Jt(k)),A=r.editor==="vscode"?"vscode":A,z=!!r.gitInit||z}}if(!k)throw new Error("No template specified.");const C=s?.templates?.[k]??k;let M;if(G(C)){const d=R??await X(C,{args:F,cwd:a||c,interactive:h});if(!d)return;M=d.config,b??=d.name}else M=Ze(C,F);if(!g){const d=v?et(M.type):".",S=lt(b??"",_(c,d));g=S.targetDir,b=S.packageName}const te=O(b??"");if(!we(te))throw new Error(`Invalid project name: "${b}". Use lowercase alphanumeric characters and hyphens.`);b=te;const _e=_(g),H=B(_(c),_e);if(H===".."||H.startsWith(`..${he}`)||ye(H))throw new Error(`Target directory "${g}" is outside the working directory. Use a name without "../" path segments.`);if(!ee&&!ct(g))throw new Error(`Target directory "${g}" is not empty.
|
|
132
|
+
Use a different name or clear the directory first.`);C!==k&&n.info(`Alias: ${w($(k))} → ${p(C)}`),n.info(`Template: ${w($(C))}`),n.info(`Project: ${w(b)}`),n.info(`Target: ${p(g)}`),process.stderr.write(`
|
|
133
|
+
`);const re=await Ht(M,{createConfig:s,cwd:c,inMonorepo:v,logger:t,pm:N,projectName:b,targetDir:g});if(re!==0){process.exitCode=re;return}A==="vscode"&&He(g),r.agent&&K(g)&&Ve(g,N.name),z&&!v&&Vt(g);let ie=!1;s?.install!==!1&&K(u(g,"package.json"))&&(ie=Wt(g,N,t,s?.preferOffline)),Kt(g,c,N.name,ie)};export{ur as default};
|