likec4 1.51.0 → 1.52.0

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{s as e}from"../_chunks/rolldown-runtime.mjs";import"../_chunks/libs/birpc.mjs";import{$ as t,C as n,K as r,W as i,Y as a,Z as o,k as s,t as c,w as l}from"../_chunks/libs/remeda.mjs";import"../_chunks/libs/@logtape/logtape.mjs";import"../_chunks/libs/merge-error-cause.mjs";import"../_chunks/libs/is-error-instance.mjs";import"../_chunks/libs/is-plain-obj.mjs";import"../_chunks/libs/safe-stringify.mjs";import{_ as u,b as d,g as f,n as p,u as m,v as h,x as g,y as _}from"../_chunks/filesystem.mjs";import"../_chunks/libs/defu.mjs";import"../_chunks/libs/pathe.mjs";import{t as v}from"../_chunks/libs/tinyrainbow.mjs";import{t as y}from"../_chunks/libs/json5.mjs";import"../_chunks/libs/@hono/mcp.mjs";import"../_chunks/src.mjs";import{B as b,V as x}from"../_chunks/libs/langium.mjs";import"../_chunks/libs/@chevrotain/regexp-to-ast.mjs";import"../_chunks/libs/chevrotain.mjs";import"../_chunks/libs/@chevrotain/cst-dts-gen.mjs";import"../_chunks/libs/@chevrotain/utils.mjs";import"../_chunks/libs/chevrotain-allstar.mjs";import"../_chunks/libs/fast-equals.mjs";import"../_chunks/sequence.mjs";import"../_chunks/libs/@lume/kiwi.mjs";import"../_chunks/libs/ts-graphviz.mjs";import"../_chunks/libs/word-wrap.mjs";import"../_chunks/libs/khroma.mjs";import"../_chunks/libs/p-limit.mjs";import"../_chunks/libs/eventemitter3.mjs";import"../_chunks/libs/p-queue.mjs";import"../_chunks/libs/isexe.mjs";import"../_chunks/libs/which.mjs";import"../_chunks/libs/@modelcontextprotocol/sdk.mjs";import{t as S}from"../_chunks/libs/picomatch.mjs";import{c as ee,l as te,o as ne,r as re,s as ie}from"../_chunks/libs/ufo.mjs";import"../_chunks/libs/parse-ms.mjs";import{t as ae}from"../_chunks/libs/pretty-ms.mjs";import"../_chunks/libs/@hono/node-server.mjs";import"../_chunks/libs/@msgpack/msgpack.mjs";import"../_chunks/libs/@smithy/is-array-buffer.mjs";import"../_chunks/libs/@smithy/util-base64.mjs";import{n as oe}from"../_chunks/libs/strip-indent.mjs";import{a as se,c as ce,d as le,f as C,i as ue,l as de,n as fe,o as pe,r as me,s as he,t as ge,u as _e}from"../_chunks/src2.mjs";import"../_chunks/libs/pako.mjs";import{LikeC4Model as ve}from"../model/index.mjs";import{t as ye}from"../_chunks/libs/esm-env.mjs";import"../_chunks/libs/is-docker.mjs";import{t as w}from"../_chunks/libs/is-inside-container.mjs";import{n as T,t as be}from"../_chunks/LikeC4.mjs";import"../_chunks/libs/ansi-regex.mjs";import{t as xe}from"../_chunks/libs/boxen.mjs";import"../_chunks/libs/ansi-align.mjs";import"../_chunks/libs/ansi-styles.mjs";import"../_chunks/libs/find-up-simple.mjs";import{t as Se}from"../_chunks/libs/package-up.mjs";import{n as Ce,t as we}from"../_chunks/libs/package-manager-detector.mjs";import{n as Te,t as Ee}from"../_chunks/libs/conf.mjs";import"../_chunks/libs/atomically.mjs";import"../_chunks/libs/ajv.mjs";import{t as De}from"../_chunks/libs/ky.mjs";import{n as E,t as Oe}from"../_chunks/libs/get-port.mjs";import{t as ke}from"../_chunks/libs/vscode-languageserver.mjs";import Ae from"node:module";import{isDeploymentElementModel as je,isDeploymentRelationModel as Me,isElementModel as Ne,isLikeC4ViewModel as Pe,isRelationModel as Fe}from"@likec4/core/model";import{invariant as Ie,nonexhaustive as Le}from"@likec4/core";import Re from"nano-spawn";import{tmpdir as D}from"node:os";import{resolve as O}from"path";import{env as ze,isProduction as Be,nodeENV as Ve}from"std-env";import{copyFile as He,mkdir as k,mkdtemp as A,readFile as Ue,readdir as We,realpath as Ge,rm as Ke,stat as j,writeFile as M}from"node:fs/promises";import{basename as N,dirname as P,extname as F,isAbsolute as qe,join as I,relative as L,resolve as R,sep as Je}from"node:path";import{copyFileSync as Ye,existsSync as z,readdirSync as Xe,rmSync as Ze,statSync as Qe}from"node:fs";import{argv as $e,cwd as B,exit as et,hrtime as tt,stdout as nt}from"node:process";import rt from"yargs";import{hideBin as it}from"yargs/helpers";import{fileURLToPath as at}from"node:url";import ot from"@vitejs/plugin-react";import{viteSingleFile as st}from"vite-plugin-singlefile";import{build as V,createServer as ct,preview as lt}from"vite";import{setTimeout as ut}from"node:timers/promises";var dt=`likec4`,H=`1.51.0`;const U=u.getChild(`cli`);function W(e){let t=u.getChild(e);return{info(e){t.info(e)},debug(e,...n){n.length===0?t.debug(e):t.debug(e,{args:n})},warn(e){if(e instanceof Error){t.warn(`${v.red(e.name+` `+e.message)}`,{msg:e});return}if(typeof e==`string`){t.warn(e);return}t.warn`${e}`},warnOnce(e){t.warn(e)},error(e,n){let r=n?.error??e;if(r instanceof Error){if(e===r){t.error(`${v.red(r.name+` `+r.message)}`,{error:r});return}t.error(v.red(e),{error:r});return}if(typeof e==`string`){t.error(v.red(e));return}t.error`${e}`},clearScreen:function(e){},hasErrorLogged:function(e){return!1},hasWarned:!1}}function ft(e){let[t,n]=tt(e),r=t*1e3+n/1e6;return{ms:r,pretty:ae(r)}}function G(e){let t=tt();return{stopAndLog(n=`done in `){n=v.green(`${n}${ft(t).pretty}`),(e||U).info(n)}}}function K(e,t){console.log(xe(e,{padding:1,margin:1,dimBorder:!0,...t}))}const pt=W(`vite`),mt=P(at(import.meta.url)),ht={banner:`/* prettier-ignore-start */
2
+ import{s as e}from"../_chunks/rolldown-runtime.mjs";import"../_chunks/libs/birpc.mjs";import{$ as t,C as n,K as r,W as i,Y as a,Z as o,k as s,t as c,w as l}from"../_chunks/libs/remeda.mjs";import"../_chunks/libs/@logtape/logtape.mjs";import"../_chunks/libs/merge-error-cause.mjs";import"../_chunks/libs/is-error-instance.mjs";import"../_chunks/libs/is-plain-obj.mjs";import"../_chunks/libs/safe-stringify.mjs";import{_ as u,b as d,g as f,n as p,u as m,v as h,x as g,y as _}from"../_chunks/filesystem.mjs";import"../_chunks/libs/defu.mjs";import"../_chunks/libs/pathe.mjs";import{t as v}from"../_chunks/libs/tinyrainbow.mjs";import{t as y}from"../_chunks/libs/json5.mjs";import"../_chunks/libs/@hono/mcp.mjs";import"../_chunks/src.mjs";import{B as b,V as x}from"../_chunks/libs/langium.mjs";import"../_chunks/libs/@chevrotain/regexp-to-ast.mjs";import"../_chunks/libs/chevrotain.mjs";import"../_chunks/libs/@chevrotain/cst-dts-gen.mjs";import"../_chunks/libs/@chevrotain/utils.mjs";import"../_chunks/libs/chevrotain-allstar.mjs";import"../_chunks/sequence.mjs";import"../_chunks/libs/@lume/kiwi.mjs";import"../_chunks/libs/ts-graphviz.mjs";import"../_chunks/libs/word-wrap.mjs";import"../_chunks/libs/khroma.mjs";import"../_chunks/libs/p-limit.mjs";import"../_chunks/libs/eventemitter3.mjs";import"../_chunks/libs/p-queue.mjs";import"../_chunks/libs/isexe.mjs";import"../_chunks/libs/which.mjs";import"../_chunks/libs/@modelcontextprotocol/sdk.mjs";import{t as S}from"../_chunks/libs/picomatch.mjs";import{c as ee,l as te,o as ne,r as re,s as ie}from"../_chunks/libs/ufo.mjs";import"../_chunks/libs/parse-ms.mjs";import{t as ae}from"../_chunks/libs/pretty-ms.mjs";import"../_chunks/libs/@hono/node-server.mjs";import"../_chunks/libs/fast-equals.mjs";import{n as oe}from"../_chunks/libs/strip-indent.mjs";import{a as se,c as ce,d as le,f as C,i as ue,l as de,n as fe,o as pe,r as me,s as he,t as ge,u as _e}from"../_chunks/src2.mjs";import"../_chunks/libs/pako.mjs";import{LikeC4Model as ve}from"../model/index.mjs";import{t as ye}from"../_chunks/libs/esm-env.mjs";import"../_chunks/libs/is-docker.mjs";import{t as w}from"../_chunks/libs/is-inside-container.mjs";import{n as be,t as xe}from"../_chunks/LikeC4.mjs";import"../_chunks/libs/ansi-regex.mjs";import{t as Se}from"../_chunks/libs/boxen.mjs";import"../_chunks/libs/ansi-align.mjs";import"../_chunks/libs/ansi-styles.mjs";import"../_chunks/libs/find-up-simple.mjs";import{t as Ce}from"../_chunks/libs/package-up.mjs";import{n as we,t as Te}from"../_chunks/libs/package-manager-detector.mjs";import{n as Ee,t as De}from"../_chunks/libs/conf.mjs";import"../_chunks/libs/atomically.mjs";import"../_chunks/libs/ajv.mjs";import{t as Oe}from"../_chunks/libs/ky.mjs";import{n as ke,t as Ae}from"../_chunks/libs/get-port.mjs";import{t as je}from"../_chunks/libs/vscode-languageserver.mjs";import Me from"node:module";import{isDeploymentElementModel as Ne,isDeploymentRelationModel as Pe,isElementModel as Fe,isLikeC4ViewModel as Ie,isRelationModel as Le}from"@likec4/core/model";import{invariant as Re,nonexhaustive as ze}from"@likec4/core";import Be from"nano-spawn";import{tmpdir as T}from"node:os";import{resolve as E}from"path";import{env as Ve,isProduction as He,nodeENV as Ue}from"std-env";import{copyFile as We,mkdir as D,mkdtemp as O,readFile as Ge,readdir as Ke,realpath as qe,rm as Je,stat as Ye,writeFile as k}from"node:fs/promises";import{basename as A,dirname as j,extname as M,isAbsolute as Xe,join as N,relative as P,resolve as F,sep as Ze}from"node:path";import{copyFileSync as Qe,existsSync as I,readdirSync as $e,rmSync as et,statSync as tt}from"node:fs";import{argv as nt,cwd as L,exit as rt,hrtime as it,stdout as at}from"node:process";import ot from"yargs";import{hideBin as st}from"yargs/helpers";import{fileURLToPath as R,pathToFileURL as ct}from"node:url";import lt from"@vitejs/plugin-react";import{viteSingleFile as ut}from"vite-plugin-singlefile";import{build as z,createServer as dt,preview as ft}from"vite";import{setTimeout as pt}from"node:timers/promises";var mt=`likec4`,B=`1.52.0`;const V=u.getChild(`cli`);function H(e){let t=u.getChild(e);return{info(e){t.info(e)},debug(e,...n){n.length===0?t.debug(e):t.debug(e,{args:n})},warn(e){if(e instanceof Error){t.warn(`${v.red(e.name+` `+e.message)}`,{msg:e});return}if(typeof e==`string`){t.warn(e);return}t.warn`${e}`},warnOnce(e){t.warn(e)},error(e,n){let r=n?.error??e;if(r instanceof Error){if(e===r){t.error(`${v.red(r.name+` `+r.message)}`,{error:r});return}t.error(v.red(e),{error:r});return}if(typeof e==`string`){t.error(v.red(e));return}t.error`${e}`},clearScreen:function(e){},hasErrorLogged:function(e){return!1},hasWarned:!1}}function ht(e){let[t,n]=it(e),r=t*1e3+n/1e6;return{ms:r,pretty:ae(r)}}function U(e){let t=it();return{stopAndLog(n=`done in `){n=v.green(`${n}${ht(t).pretty}`),(e||V).info(n)}}}function W(e,t){console.log(Se(e,{padding:1,margin:1,dimBorder:!0,...t}))}const gt=H(`vite`),G=j(R(import.meta.url)),_t={banner:`/* prettier-ignore-start */
3
3
  /* eslint-disable */
4
4
 
5
5
  /******************************************************************************
@@ -10,29 +10,29 @@ import{s as e}from"../_chunks/rolldown-runtime.mjs";import"../_chunks/libs/birpc
10
10
  `,footer:`
11
11
 
12
12
  /* prettier-ignore-end */
13
- `};function gt(){let e=Se({cwd:mt});if(!e)throw Error(`likec4 package folder not found`);return P(e)}function _t(){let e=[R(gt(),`__app__`),R(mt,`../__app__`),R(mt,`../../__app__`),R(mt,`../../dist/__app__`)],t=r(e,z);if(!t)throw u.error(`likec4 app root does not exist, tried:\n${e.join(`
14
- `)}`),Error(`likec4 app root does not exist`);return t}async function vt(){let e=await A(I(D(),`.likec4-public-`));return await M(I(e,`likec4-views.js`),`// generated by likec4
15
- `),e}function yt(e){return L(B(),e)}const bt=1e4;function xt(){let e=gt();return{"likec4/icons":`@likec4/icons`,"likec4/react":R(e,`react/index.mjs`),"likec4/model":R(e,`dist/model/index.mjs`),"likec4/vite-plugin/internal":R(e,`dist/vite-plugin/internal.mjs`)}}const St=async({languageServices:e,likec4AssetsDir:t,...n})=>{let r=n.customLogger??pt,i=_t();r.info(`${v.cyan(`likec4 app root`)} ${v.dim(yt(i))}`);let a=n.outputDir??R(e.workspace,`dist`);r.info(v.cyan(`outDir`)+` `+v.dim(yt(a)));let o=`/`;n.base&&(o=te(n.base),!re(o)&&o!==`./`&&(o=ie(o))),o!==`/`&&r.info(`${v.green(`app base url`)} ${v.dim(o)}`);let s=n.webcomponentPrefix??`likec4`,c=n.title??`LikeC4`,l=n.outputSingleFile??!1;return{isDev:!1,likec4AssetsDir:t,webcomponentPrefix:s,title:c,root:i,languageServices:e,clearScreen:!1,base:o,resolve:{conditions:[`production`],dedupe:[`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`],alias:{...xt(),"likec4/previews":t}},configFile:!1,mode:`production`,optimizeDeps:{include:[`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`,`@likec4/core/types`,`@likec4/core/model`,`@likec4/core/styles`,`@likec4/core/utils`,`@likec4/core`,`likec4/vite-plugin/internal`],noDiscovery:!0},esbuild:{tsconfigRaw:{compilerOptions:{target:`ESNext`,jsx:`react-jsx`}}},define:{WEBCOMPONENT_PREFIX:JSON.stringify(s),PAGE_TITLE:JSON.stringify(c),__USE_HASH_HISTORY__:n?.useHashHistory===!0?`true`:`false`,"process.env.NODE_ENV":`"production"`},build:{outDir:a,emptyOutDir:!1,sourcemap:!1,cssMinify:!1,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit:bt,assetsInlineLimit:1e5,rollupOptions:{treeshake:{preset:`recommended`},...!l&&{input:[R(i,`index.html`),R(i,`src`,`main.js`),R(i,`src`,`fonts.css`),R(i,`src`,`style.css`)],output:{manualChunks:e=>{if(!(e.endsWith(`.css`)||e.endsWith(`.html`)||e.includes(`likec4/icons`)||e.includes(`const.js`))){if(e.includes(`__app__`)){let t=e.match(/__app__\/src\/([\w]+)\.js/)?.[1];return t?t[1]:void 0}if(e.includes(`likec4`))return`likec4`;if(e.includes(`node_modules`))return`vendors`}}}}}},customLogger:r,plugins:[ot(),ge({languageServices:e.languageServices}),l?st():void 0]}};async function Ct({languageServices:e,outDir:t,base:n,webcomponentPrefix:r=`likec4`,filename:i=`likec4-views.js`}){let a=W([`vite`,`webcomponent`]),o=_t();return a.info(v.cyan(`outDir`)+` `+v.dim(t)),{root:o,clearScreen:!1,base:n,configFile:!1,publicDir:!1,mode:`production`,resolve:{conditions:[`production`],alias:xt(),dedupe:[`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(r),"process.env.NODE_ENV":`"production"`},esbuild:{...ht,tsconfigRaw:{compilerOptions:{target:`ESNext`,jsx:`react-jsx`}}},build:{outDir:t,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:1024*1024,chunkSizeWarningLimit:bt,lib:{entry:`src/webcomponent.js`,fileName(e,t){return i},formats:[`iife`],name:`LikeC4Views`},rollupOptions:{treeshake:{preset:`recommended`},output:{format:`iife`,hoistTransitiveImports:!1,compact:!0}}},customLogger:a,plugins:[ot(),ge({languageServices:e.languageServices})]}}const wt=[`favicon.ico`,`robots.txt`];async function Tt({buildWebcomponent:e=!0,webcomponentPrefix:t=`likec4`,title:n,languageServices:r,likec4AssetsDir:i,outputSingleFile:a,...o}){i??=await A(I(D(),`.likec4-assets-`));let s=await St({...o,languageServices:r,likec4AssetsDir:i,webcomponentPrefix:t,title:n,outputSingleFile:a}),c=!z(s.build.outDir)||Xe(s.build.outDir).length===0,l=await vt();for(let e of wt){let t=R(s.root,e);z(t)&&Ye(t,R(l,e))}let u=r.languageServices.projects();if(u.length===1){let e=await r.viewsService.computedViews(),t=await r.diagrams();if(t.length===0)throw process.exitCode=1,Error(`no views found`);t.length===e.length?s.customLogger.info(`${v.dim(`workspace:`)} ${v.green(`✓ all views layouted`)}`):s.customLogger.warn(`${v.dim(`workspace:`)} ${v.yellow(`✗ layouted ${t.length} of ${e.length} views`)}`),t.forEach(e=>{(e.hasLayoutDrift||e.drifts&&e.drifts.length>0)&&s.customLogger.warn(v.dim(`view`)+` `+v.red(e.id)+` `+v.yellow(`is out of date, layout drift detected`))})}else for(let e of u){let t=await r.viewsService.computedViews(e.id);t.length===0?s.customLogger.warn(`${v.dim(`project:`)} ${e.id} ${v.yellow(`✗ no views found`)}`):s.customLogger.info(`${v.dim(`project:`)} ${e.id} ${v.green(`${t.length} views`)}`)}if(e&&!a&&await V(await Ct({webcomponentPrefix:t,languageServices:r,outDir:l,base:s.base})),await V({...s,customLogger:s.customLogger,publicDir:l,mode:`production`}),a){if(!c){s.customLogger.warn(v.yellow(`outDir was not empty, skipping cleanup`));return}for(let e of Xe(R(s.build.outDir)).filter(e=>e!==`index.html`))Ze(R(s.build.outDir,e),{recursive:!0})}let d=R(s.build.outDir,`index.html`);z(d)&&Ye(d,R(s.build.outDir,`404.html`))}function Et(e){try{return!!Ae.createRequire(import.meta.url).resolve(e)}catch(e){return U.debug(g(e)),!1}}async function q(){if(Et(`react`)&&Et(`react-dom`)){U.debug(`react already installed`);return}U.warn(`react not installed`);let e=await we();e||(U.error`Package manager not detected, please install dependencies manually: ${`react`} ${`react-dom`}`,process.exit(1));let t=Ce(e.agent,`add`,[`react`,`react-dom`]);t||(U.error`Please install dependencies manually: ${`react`} ${`react-dom`}`,process.exit(1));try{await Re(t.command,t.args,{stdio:`inherit`})}catch(e){U.debug(g(e)),U.error`Please install dependencies manually: ${`react`} ${`react-dom`}`,process.exit(1)}}async function Dt(){if(Et(`playwright`)){U.debug(`playwright already installed`);return}U.warn(`playwright not installed`);let e=await we();e||(U.error`Package manager not detected, please install dependencies manually: ${`playwright`}`,process.exit(1));let t=Ce(e.agent,`add`,[`playwright`]);t||(U.error`Please install dependencies manually: ${`playwright`}`,process.exit(1));try{await Re(t.command,t.args,{preferLocal:!0,stdio:`inherit`})}catch(e){U.debug(g(e)),U.error`Please install dependencies manually: ${`playwright`}`,process.exit(1)}}const J={type:`string`,desc:`<directory> with LikeC4 sources (default is current directory or 'LIKEC4_WORKSPACE' env)`,normalize:!0,default:ze.LIKEC4_WORKSPACE||`.`,coerce:R},Y={alias:`use-dot-bin`,boolean:!0,type:`boolean`,desc:w()?`enabled in container, disable by --no-use-dot`:`use graphviz binaries ("dot" should be on PATH)`,default:w()},Ot={boolean:!0,type:`boolean`,desc:"use `@likec4/core` package in types",default:!1},kt={boolean:!0,type:`boolean`,desc:`use hash history for navigation, e.g. "/#/view" instead of "/view"`},At={alias:`o`,string:!0,desc:`output directory`,normalize:!0,nargs:1,coerce:R},jt={alias:`w`,string:!0,desc:`prefix for Webcomponents, e.g "c4" generates <c4-view ../>`,default:`likec4`,nargs:1},Mt={alias:`t`,string:!0,desc:`base title of the app pages (default is "LikeC4")`,default:`LikeC4`,nargs:1},Nt={alias:[`base-url`],string:!0,desc:`base url the app is being served from, e.g. "/" or "/pages/"`,nargs:1},Pt={boolean:!0,desc:`outputs a single self-contained HTML file with all required resources inlined`},Ft={alias:`l`,string:!0,...w()?{desc:`listen 0.0.0.0 by default in container`,default:`0.0.0.0`}:{desc:`ip address of the network interface to listen on`},nargs:1},It={number:!0,desc:`port number for the dev server (default is 5173, or PORT environment variable)`,nargs:1},X={alias:`p`,string:!0,desc:`select LikeC4 project by name (e.g. "my-project") or by path`,nargs:1},Lt={hidden:!0,nargs:1,choices:[`trace`,`debug`,`info`,`warning`,`error`],conflicts:[`verbose`]},Rt={boolean:!0,desc:`verbose logging`,conflicts:[`log-level`]},zt=ye?`trace`:`debug`;function Z(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function e(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function r(){var i,a=this.e,o=0;function s(){for(;i=n.pop();)try{if(!i.a&&o===1)return o=0,n.push(i),Promise.resolve().then(s);if(i.d){var e=i.d.call(i.v);if(i.a)return o|=2,Promise.resolve(e).then(s,c)}else o|=1}catch(e){return c(e)}if(o===1)return a===t?Promise.resolve():Promise.reject(a);if(a!==t)throw a}function c(n){return a=a===t?n:new e(n,a),s()}return s()}}}const Bt=e=>e.command({command:`build [path]`,aliases:[`bundle`],describe:`Build a static website`,builder:e=>e.positional(`path`,J).option(`output`,{alias:`o`,type:`string`,desc:`output directory for production build`,normalize:!0,coerce:R}).option(`base`,Nt).option(`use-hash-history`,kt).option(`use-dot`,Y).option(`webcomponent-prefix`,jt).option(`title`,Mt).option(`output-single-file`,Pt).example(`${v.green(`$0 build -o ./build ./src`)}`,v.gray(`Search for likec4 files in 'src' and output static site to 'build'`)),handler:async e=>{try{var t=Z();let n={useHashHistory:e[`use-hash-history`]??!1,useDotBin:e[`use-dot`],webcomponentPrefix:e[`webcomponent-prefix`],outputSingleFile:e[`output-single-file`]??!1};await q();let r=W(`c4:build`),i=t.a(await T(e.path,{graphviz:e[`use-dot`]?`binary`:`wasm`,watch:!1})),a=e.output??R(i.workspace,`dist`),o=R(a,`assets`);await Tt({base:e.base,useHashHistory:n.outputSingleFile||n.useHashHistory,customLogger:r,webcomponentPrefix:n.webcomponentPrefix,title:e.title,languageServices:i,likec4AssetsDir:o,outputDir:a,outputSingleFile:n.outputSingleFile})}catch(e){t.e=e}finally{await t.d()}}});var Vt=e(Te(),1);const Ht=new Ee({projectName:dt,serialize:e=>y.stringify(e,null,2),deserialize:e=>y.parse(e)}),Ut=`check-update`;async function Wt(){if(Be||Ve===Ut)return;let e=Ht.get(`lastUpdateCheck`);if(!e){await Gt(!1);return}let t=Ht.get(`latestVersion`);if(s(t)||s(e)||e+864e5<Date.now())try{Re(`likec4`,[`check-update`],{stdio:`ignore`,timeout:5e3,preferLocal:!0,detached:!0,env:{NODE_ENV:Ut}}).catch(()=>{})}catch{}t&&(0,Vt.gt)(t,H)&&K([`Update available: `,v.dim(H),v.reset(` → `),v.green(t)].join(``))}async function Gt(e=!0){try{Ht.set({lastUpdateCheck:Date.now()});let t=await Kt();Ie(t,`No version found in latest npm`),Ht.set({lastUpdateCheck:Date.now(),latestVersion:t}),(0,Vt.gt)(t,H)?K([`Update available: `,v.dim(H),v.reset(` → `),v.green(t)].join(``)):e&&K(v.dim(`Up to date: `)+` `+v.green(H))}catch(e){U.warning(g(e))}}async function Kt(){return(await De(`https://registry.npmjs.org/likec4/latest`,{headers:{accept:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`},timeout:5e3,keepalive:!0}).json()).version}const qt=e=>e.command({command:`check-update`,describe:`Check for updates`,handler:async()=>{await Gt()}});function Jt(e,t){if(!t)return e.languageServices.projectsManager.ensureProjectId();let n=R(t);if(n===e.workspace)return e.languageServices.projectsManager.ensureProjectId();if(z(n)&&Qe(n).isDirectory()){U.debug`Project path exists: ${n}`;let t=x.file(n.endsWith(Je)?n:n+Je),r=e.languageServices.projects().find(e=>e.folder.fsPath===t.fsPath);if(r)return U.debug`Found project ${r.id} at path: ${n}`,r.id;U.debug`No project registered at path: ${n}`}return e.languageServices.projectsManager.ensureProjectId(t)}function Yt(e,t){let n=Jt(e,t),r=e.languageServices.projectsManager.getProject(n);return e.languageServices.projectsManager.defaultProjectId=n,{projectId:n,projectFolder:r.folderUri.fsPath,config:r.config}}const Q=U.getChild(`generator`);async function Xt({name:e,path:t,useDotBin:n,project:r}){try{var i=Z();let a=G(Q),o=i.a(await C(t,{graphviz:n?`binary`:`wasm`,watch:!1})),{projectId:s,config:c}=Yt(o,r);r&&Q.info(`${v.dim(`project`)} ${v.green(s)}`);let l=c.generators?.[e];if(!l)throw Q.error(v.red(`generator ${e} does not exist in project config`)),Error(`generator ${e} does not exist in project config`);Q.info(`${v.dim(`generator`)} ${v.green(e)}`),await Zt({likec4:o,model:await o.layoutedModel(s),generator:l,logger:Q.getChild(e)}),a.stopAndLog()}catch(e){i.e=e}finally{await i.d()}}async function Zt({likec4:e,model:t,generator:n,logger:r}){let i=e.languageServices,a=new Set,o=i.project(t.project.id),s=t.project.id;r.debug(`${v.dim(`running for project:`)} ${v.green(o.id)}`),await Promise.resolve().then(()=>n({likec4model:t,ctx:{workspace:e.languageServices.workspaceUri,project:o,locate:e=>{let t=null;switch(!0){case Ne(e):t=i.locate({element:e.id,projectId:s});break;case Pe(e):t=i.locate({view:e.id,projectId:s});break;case je(e):t=i.locate({deployment:e.id,projectId:s});break;case Fe(e):case Me(e):t=i.locate({relation:e.id,projectId:s});break;default:Le(e)}if(!t)throw r.error(`Cannot locate ${e.id}`,{target:e}),Error(`Cannot locate ${e.id}`);let n=x.parse(t.uri);return{range:t.range,document:n,relativePath:b.relative(o.folder,n),folder:b.dirname(n).fsPath,filename:b.basename(n)}},write:async({path:e,content:t})=>{let n;n=Array.isArray(e)?R(o.folder.fsPath,...e):x.isUri(e)?e.fsPath:R(o.folder.fsPath,`${e}`);let i=P(n);a.has(i)||(z(i)||(r.debug(`${v.dim(`create directory`)} ${i}`),await k(i,{recursive:!0})),a.add(i)),r.debug(`${v.dim(`write`)} ${n}`),await M(n,t)},abort:e=>{throw r.error(e||`Generator aborted`),Error(e||`Generator aborted`)}}}))}async function Qt(e,t,n){t??=R(e.workspace,`likec4.generated.ts`),F(t)!==`.ts`&&(t+=`.ts`),await k(P(t),{recursive:!0});let r=me([...await e.diagrams()]);await M(t,r),n.info(`${v.dim(`generated`)} ${L(process.cwd(),t)}`)}async function $t(e,t,n){await k(t,{recursive:!0}),n.info(`${v.dim(`format`)} ${v.green(`dot`)}`),n.info(`${v.dim(`outdir`)} ${t}`);let r=new Set,i=await e.computedModel(),a=c(i.$data.views),o=0;for(let s of a)try{let a=await e.viewsService.layouter.dot({view:s,styles:i.$styles}),c=`.`;s.sourcePath&&(c=P(s.sourcePath)),c=R(t,c),r.has(c)||(await k(c,{recursive:!0}),r.add(c));let l=R(c,s.id+`.dot`);await M(l,a),n.info(`${v.dim(`generated`)} ${L(process.cwd(),l)}`),o++}catch(e){U.error(`error while generating ${s.id}`,{error:e})}o>0&&n.info(`${v.dim(`total`)} ${o} files`)}async function en(e,t,n,r){await k(n,{recursive:!0}),r.info(`${v.dim(`format`)} ${v.green(t)}`),r.info(`${v.dim(`outdir`)} ${n}`);let i,a;switch(t){case`d2`:i=`.d2`,a=le;break;case`mermaid`:i=`.mmd`,a=pe;break;case`plantuml`:i=`.puml`,a=ue;break;default:Le(t)}let o=new Set,s=await e.layoutedModel(),c=0;for(let e of s.views()){let t=e.$view;try{let s=`.`;t.sourcePath&&(s=P(t.sourcePath)),s=R(n,s),o.has(s)||(await k(s,{recursive:!0}),o.add(s));let l=R(s,t.id+i);await M(l,a(e)),r.info(`${v.dim(`generated`)} ${L(process.cwd(),l)}`),c++}catch(e){r.error(`error while generating ${t.id}`,{error:e})}}c>0&&r.info(`${v.dim(`total`)} ${c} files`)}async function $({path:e,useDotBin:t,...n}){let r=W(`c4:codegen`),i=G(r),a=await C(e,{graphviz:t?`binary`:`wasm`,watch:!1});if(a.ensureSingleProject(),(await a.viewsService.computedViews()).length===0)throw r.warn(`no views found`),process.exitCode=1,Error(`no views found`);switch(n.format){case`views`:await Qt(a,n.outfile,r);break;case`dot`:await $t(a,n.outdir??e,r);break;case`d2`:case`mermaid`:case`plantuml`:await en(a,n.format,n.outdir??e,r);break;default:Le(n)}i.stopAndLog()}async function tn({path:e,useDotBin:t,useCorePackage:n,outfile:r,project:i}){try{var a=Z();let o=W(`c4:codegen`),s=G(o),c=a.a(await C(e,{graphviz:t?`binary`:`wasm`,watch:!1})),{projectId:l,projectFolder:u}=Yt(c,i);i&&o.info(`${v.dim(`project`)} ${v.green(l)}`),o.info(`${v.dim(`format`)} ${v.green(`model`)}`);let d=await c.layoutedModel(l);for(let e of d.views())e.hasLayoutDrifts&&o.warn(v.yellow(`layout drift detected, view:`)+` `+v.red(e.id));let f=R(c.projectsManager.hasMultipleProjects()?u:c.workspace,`likec4-model.ts`);if(r&&(f=qe(r)?r:R(r),z(r)&&(await j(r)).isDirectory()))throw Error(`output file is a directory: ${r}`);let p=N(f);o.info(`${v.dim(`filename`)} ${p}`);let m=F(p).toLocaleLowerCase();if(![`.ts`,`.mts`,`.cts`].includes(m))throw o.error(`output file ${r} has extension "${m}"`),Error(`output file ${r} must be a .ts, .mts or .cts file`);let h=P(f);o.info(`${v.dim(`outdir`)} ${h}`),await k(h,{recursive:!0}),await M(f,se(d,{useCorePackage:n}),{encoding:`utf-8`}),s.stopAndLog(),K(oe(`
13
+ `};function vt(){let e=Ce({cwd:G});if(!e)throw Error(`likec4 package folder not found`);return j(e)}function yt(){let e=[F(vt(),`__app__`),F(G,`../__app__`),F(G,`../../__app__`),F(G,`../../dist/__app__`)],t=r(e,I);if(!t)throw u.error(`likec4 app root does not exist, tried:\n${e.join(`
14
+ `)}`),Error(`likec4 app root does not exist`);return t}async function bt(){let e=await O(N(T(),`.likec4-public-`));return await k(N(e,`likec4-views.js`),`// generated by likec4
15
+ `),e}function K(e){return P(L(),e)}const xt=1e4;function St(){let e=vt();return{"likec4/icons":`@likec4/icons`,"likec4/react":F(e,`react/index.mjs`),"likec4/model":F(e,`dist/model/index.mjs`),"likec4/vite-plugin/internal":F(e,`dist/vite-plugin/internal.mjs`)}}const Ct=async({languageServices:e,likec4AssetsDir:t,...n})=>{let r=n.customLogger??gt,i=yt();r.info(`${v.cyan(`likec4 app root`)} ${v.dim(K(i))}`);let a=n.outputDir??F(e.workspace,`dist`);r.info(v.cyan(`outDir`)+` `+v.dim(K(a)));let o=`/`;n.base&&(o=te(n.base),!re(o)&&o!==`./`&&(o=ie(o))),o!==`/`&&r.info(`${v.green(`app base url`)} ${v.dim(o)}`);let s=n.webcomponentPrefix??`likec4`,c=n.title??`LikeC4`,l=n.outputSingleFile??!1;return{isDev:!1,likec4AssetsDir:t,webcomponentPrefix:s,title:c,root:i,languageServices:e,clearScreen:!1,base:o,resolve:{conditions:[`production`],dedupe:[`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`],alias:{...St(),"likec4/previews":t}},configFile:!1,mode:`production`,optimizeDeps:{include:[`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`,`@likec4/core/types`,`@likec4/core/model`,`@likec4/core/styles`,`@likec4/core/utils`,`@likec4/core`,`likec4/vite-plugin/internal`],noDiscovery:!0},esbuild:{tsconfigRaw:{compilerOptions:{target:`ESNext`,jsx:`react-jsx`}}},define:{WEBCOMPONENT_PREFIX:JSON.stringify(s),PAGE_TITLE:JSON.stringify(c),__USE_HASH_HISTORY__:n?.useHashHistory===!0?`true`:`false`,"process.env.NODE_ENV":`"production"`},build:{outDir:a,emptyOutDir:!1,sourcemap:!1,cssMinify:!1,minify:!0,copyPublicDir:!0,chunkSizeWarningLimit:xt,assetsInlineLimit:1e5,rollupOptions:{treeshake:{preset:`recommended`},...!l&&{input:[F(i,`index.html`),F(i,`src`,`main.js`),F(i,`src`,`fonts.css`),F(i,`src`,`style.css`)],output:{manualChunks:e=>{if(!(e.endsWith(`.css`)||e.endsWith(`.html`)||e.includes(`likec4/icons`)||e.includes(`const.js`))){if(e.includes(`__app__`)){let t=e.match(/__app__\/src\/([\w]+)\.js/)?.[1];return t?t[1]:void 0}if(e.includes(`likec4`))return`likec4`;if(e.includes(`node_modules`))return`vendors`}}}}}},customLogger:r,plugins:[lt(),ge({languageServices:e.languageServices}),l?ut():void 0]}};async function wt({languageServices:e,outDir:t,base:n,webcomponentPrefix:r=`likec4`,filename:i=`likec4-views.js`}){let a=H([`vite`,`webcomponent`]),o=yt();return a.info(v.cyan(`outDir`)+` `+v.dim(t)),{root:o,clearScreen:!1,base:n,configFile:!1,publicDir:!1,mode:`production`,resolve:{conditions:[`production`],alias:St(),dedupe:[`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`]},define:{WEBCOMPONENT_PREFIX:JSON.stringify(r),"process.env.NODE_ENV":`"production"`},esbuild:{..._t,tsconfigRaw:{compilerOptions:{target:`ESNext`,jsx:`react-jsx`}}},build:{outDir:t,emptyOutDir:!1,sourcemap:!1,minify:!0,assetsInlineLimit:1024*1024,chunkSizeWarningLimit:xt,lib:{entry:`src/webcomponent.js`,fileName(e,t){return i},formats:[`iife`],name:`LikeC4Views`},rollupOptions:{treeshake:{preset:`recommended`},output:{format:`iife`,hoistTransitiveImports:!1,compact:!0}}},customLogger:a,plugins:[lt(),ge({languageServices:e.languageServices})]}}const Tt=[`favicon.ico`,`robots.txt`];async function Et({buildWebcomponent:e=!0,webcomponentPrefix:t=`likec4`,title:n,languageServices:r,likec4AssetsDir:i,outputSingleFile:a,...o}){i??=await O(N(T(),`.likec4-assets-`));let s=await Ct({...o,languageServices:r,likec4AssetsDir:i,webcomponentPrefix:t,title:n,outputSingleFile:a}),c=!I(s.build.outDir)||$e(s.build.outDir).length===0,l=await bt();for(let e of Tt){let t=F(s.root,e);I(t)&&Qe(t,F(l,e))}let u=r.languageServices.projects();if(u.length===1){let e=await r.viewsService.computedViews(),t=await r.diagrams();if(t.length===0)throw process.exitCode=1,Error(`no views found`);t.length===e.length?s.customLogger.info(`${v.dim(`workspace:`)} ${v.green(`✓ all views layouted`)}`):s.customLogger.warn(`${v.dim(`workspace:`)} ${v.yellow(`✗ layouted ${t.length} of ${e.length} views`)}`),t.forEach(e=>{(e.hasLayoutDrift||e.drifts&&e.drifts.length>0)&&s.customLogger.warn(v.dim(`view`)+` `+v.red(e.id)+` `+v.yellow(`is out of date, layout drift detected`))})}else for(let e of u){let t=await r.viewsService.computedViews(e.id);t.length===0?s.customLogger.warn(`${v.dim(`project:`)} ${e.id} ${v.yellow(`✗ no views found`)}`):s.customLogger.info(`${v.dim(`project:`)} ${e.id} ${v.green(`${t.length} views`)}`)}if(e&&!a&&await z(await wt({webcomponentPrefix:t,languageServices:r,outDir:l,base:s.base})),await z({...s,customLogger:s.customLogger,publicDir:l,mode:`production`}),a){if(!c){s.customLogger.warn(v.yellow(`outDir was not empty, skipping cleanup`));return}for(let e of $e(F(s.build.outDir)).filter(e=>e!==`index.html`))et(F(s.build.outDir,e),{recursive:!0})}let d=F(s.build.outDir,`index.html`);I(d)&&Qe(d,F(s.build.outDir,`404.html`))}function Dt(e){try{return!!Me.createRequire(import.meta.url).resolve(e)}catch(e){return V.debug(g(e)),!1}}async function q(){if(Dt(`react`)&&Dt(`react-dom`)){V.debug(`react already installed`);return}V.warn(`react not installed`);let e=await Te();e||(V.error`Package manager not detected, please install dependencies manually: ${`react`} ${`react-dom`}`,process.exit(1));let t=we(e.agent,`add`,[`react`,`react-dom`]);t||(V.error`Please install dependencies manually: ${`react`} ${`react-dom`}`,process.exit(1));try{await Be(t.command,t.args,{stdio:`inherit`})}catch(e){V.debug(g(e)),V.error`Please install dependencies manually: ${`react`} ${`react-dom`}`,process.exit(1)}}async function Ot(){if(Dt(`playwright`)){V.debug(`playwright already installed`);return}V.warn(`playwright not installed`);let e=await Te();e||(V.error`Package manager not detected, please install dependencies manually: ${`playwright`}`,process.exit(1));let t=we(e.agent,`add`,[`playwright`]);t||(V.error`Please install dependencies manually: ${`playwright`}`,process.exit(1));try{await Be(t.command,t.args,{preferLocal:!0,stdio:`inherit`})}catch(e){V.debug(g(e)),V.error`Please install dependencies manually: ${`playwright`}`,process.exit(1)}}const J={type:`string`,desc:`<directory> with LikeC4 sources (default is current directory or 'LIKEC4_WORKSPACE' env)`,normalize:!0,default:Ve.LIKEC4_WORKSPACE||`.`,coerce:F},Y={alias:`use-dot-bin`,boolean:!0,type:`boolean`,desc:w()?`enabled in container, disable by --no-use-dot`:`use graphviz binaries ("dot" should be on PATH)`,default:w()},kt={boolean:!0,type:`boolean`,desc:"use `@likec4/core` package in types",default:!1},At={boolean:!0,type:`boolean`,desc:`use hash history for navigation, e.g. "/#/view" instead of "/view"`},jt={alias:[`o`,`output`],string:!0,desc:`output directory`,normalize:!0,nargs:1,coerce:F},Mt={alias:`w`,string:!0,desc:`prefix for Webcomponents, e.g "c4" generates <c4-view ../>`,default:`likec4`,nargs:1},Nt={alias:`t`,string:!0,desc:`base title of the app pages (default is "LikeC4")`,default:`LikeC4`,nargs:1},Pt={alias:[`base-url`],string:!0,desc:`base url the app is being served from, e.g. "/" or "/pages/"`,nargs:1},Ft={boolean:!0,desc:`outputs a single self-contained HTML file with all required resources inlined`},It={alias:`l`,string:!0,...w()?{desc:`listen 0.0.0.0 by default in container`,default:`0.0.0.0`}:{desc:`ip address of the network interface to listen on`},nargs:1},Lt={number:!0,desc:`port number for the dev server (default is 5173, or PORT environment variable)`,nargs:1},X={alias:`p`,string:!0,desc:`select LikeC4 project by name (e.g. "my-project") or by path`,nargs:1},Rt={hidden:!0,nargs:1,choices:[`trace`,`debug`,`info`,`warning`,`error`],conflicts:[`verbose`]},zt={boolean:!0,desc:`verbose logging`,conflicts:[`log-level`]},Bt=ye?`trace`:`debug`;function Z(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function e(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function r(){var i,a=this.e,o=0;function s(){for(;i=n.pop();)try{if(!i.a&&o===1)return o=0,n.push(i),Promise.resolve().then(s);if(i.d){var e=i.d.call(i.v);if(i.a)return o|=2,Promise.resolve(e).then(s,c)}else o|=1}catch(e){return c(e)}if(o===1)return a===t?Promise.resolve():Promise.reject(a);if(a!==t)throw a}function c(n){return a=a===t?n:new e(n,a),s()}return s()}}}const Vt=e=>e.command({command:`build [path]`,aliases:[`bundle`],describe:`Build a static website`,builder:e=>e.positional(`path`,J).option(`output`,{alias:`o`,type:`string`,desc:`output directory for production build`,normalize:!0,coerce:F}).option(`base`,Pt).option(`use-hash-history`,At).option(`use-dot`,Y).option(`webcomponent-prefix`,Mt).option(`title`,Nt).option(`output-single-file`,Ft).example(`${v.green(`$0 build -o ./build ./src`)}`,v.gray(`Search for likec4 files in 'src' and output static site to 'build'`)),handler:async e=>{try{var t=Z();let n={useHashHistory:e[`use-hash-history`]??!1,useDotBin:e[`use-dot`],webcomponentPrefix:e[`webcomponent-prefix`],outputSingleFile:e[`output-single-file`]??!1};await q();let r=H(`c4:build`),i=t.a(await be(e.path,{graphviz:e[`use-dot`]?`binary`:`wasm`,watch:!1})),a=e.output??F(i.workspace,`dist`),o=F(a,`assets`);await Et({base:e.base,useHashHistory:n.outputSingleFile||n.useHashHistory,customLogger:r,webcomponentPrefix:n.webcomponentPrefix,title:e.title,languageServices:i,likec4AssetsDir:o,outputDir:a,outputSingleFile:n.outputSingleFile})}catch(e){t.e=e}finally{await t.d()}}});var Ht=e(Ee(),1);const Ut=new De({projectName:mt,serialize:e=>y.stringify(e,null,2),deserialize:e=>y.parse(e)}),Wt=`check-update`;async function Gt(){if(He||Ue===Wt)return;let e=Ut.get(`lastUpdateCheck`);if(!e){await Kt(!1);return}let t=Ut.get(`latestVersion`);if(s(t)||s(e)||e+864e5<Date.now())try{Be(`likec4`,[`check-update`],{stdio:`ignore`,timeout:5e3,preferLocal:!0,detached:!0,env:{NODE_ENV:Wt}}).catch(()=>{})}catch{}t&&(0,Ht.gt)(t,B)&&W([`Update available: `,v.dim(B),v.reset(` → `),v.green(t)].join(``))}async function Kt(e=!0){try{Ut.set({lastUpdateCheck:Date.now()});let t=await qt();Re(t,`No version found in latest npm`),Ut.set({lastUpdateCheck:Date.now(),latestVersion:t}),(0,Ht.gt)(t,B)?W([`Update available: `,v.dim(B),v.reset(` → `),v.green(t)].join(``)):e&&W(v.dim(`Up to date: `)+` `+v.green(B))}catch(e){V.warning(g(e))}}async function qt(){return(await Oe(`https://registry.npmjs.org/likec4/latest`,{headers:{accept:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`},timeout:5e3,keepalive:!0}).json()).version}const Jt=e=>e.command({command:`check-update`,describe:`Check for updates`,handler:async()=>{await Kt()}});function Yt(e,t){if(!t)return e.languageServices.projectsManager.ensureProjectId();let n=F(t);if(n===e.workspace)return e.languageServices.projectsManager.ensureProjectId();if(I(n)&&tt(n).isDirectory()){V.debug`Project path exists: ${n}`;let t=x.file(n.endsWith(Ze)?n:n+Ze),r=e.languageServices.projects().find(e=>e.folder.fsPath===t.fsPath);if(r)return V.debug`Found project ${r.id} at path: ${n}`,r.id;V.debug`No project registered at path: ${n}`}return e.languageServices.projectsManager.ensureProjectId(t)}function Xt(e,t){let n=Yt(e,t),r=e.languageServices.projectsManager.getProject(n);return e.languageServices.projectsManager.defaultProjectId=n,{projectId:n,projectFolder:r.folderUri.fsPath,config:r.config}}const Q=V.getChild(`generator`);async function Zt({name:e,path:t,useDotBin:n,project:r}){try{var i=Z();let a=U(Q),o=i.a(await C(t,{graphviz:n?`binary`:`wasm`,watch:!1})),{projectId:s,config:c}=Xt(o,r);r&&Q.info(`${v.dim(`project`)} ${v.green(s)}`);let l=c.generators?.[e];if(!l)throw Q.error(v.red(`generator ${e} does not exist in project config`)),Error(`generator ${e} does not exist in project config`);Q.info(`${v.dim(`generator`)} ${v.green(e)}`),await Qt({likec4:o,model:await o.layoutedModel(s),generator:l,logger:Q.getChild(e)}),a.stopAndLog()}catch(e){i.e=e}finally{await i.d()}}async function Qt({likec4:e,model:t,generator:n,logger:r}){let i=e.languageServices,a=new Set,o=i.project(t.project.id),s=t.project.id;r.debug(`${v.dim(`running for project:`)} ${v.green(o.id)}`),await Promise.resolve().then(()=>n({likec4model:t,ctx:{workspace:e.languageServices.workspaceUri,project:o,locate:e=>{let t=null;switch(!0){case Fe(e):t=i.locate({element:e.id,projectId:s});break;case Ie(e):t=i.locate({view:e.id,projectId:s});break;case Ne(e):t=i.locate({deployment:e.id,projectId:s});break;case Le(e):case Pe(e):t=i.locate({relation:e.id,projectId:s});break;default:ze(e)}if(!t)throw r.error(`Cannot locate ${e.id}`,{target:e}),Error(`Cannot locate ${e.id}`);let n=x.parse(t.uri);return{range:t.range,document:n,relativePath:b.relative(o.folder,n),folder:b.dirname(n).fsPath,filename:b.basename(n)}},write:async({path:e,content:t})=>{let n;n=Array.isArray(e)?F(o.folder.fsPath,...e):x.isUri(e)?e.fsPath:F(o.folder.fsPath,`${e}`);let i=j(n);a.has(i)||(I(i)||(r.debug(`${v.dim(`create directory`)} ${i}`),await D(i,{recursive:!0})),a.add(i)),r.debug(`${v.dim(`write`)} ${n}`),await k(n,t)},abort:e=>{throw r.error(e||`Generator aborted`),Error(e||`Generator aborted`)}}}))}async function $t(e,t,n){t??=F(e.workspace,`likec4.generated.ts`),M(t)!==`.ts`&&(t+=`.ts`),await D(j(t),{recursive:!0});let r=me([...await e.diagrams()]);await k(t,r),n.info(`${v.dim(`generated`)} ${P(process.cwd(),t)}`)}async function en(e,t,n){await D(t,{recursive:!0}),n.info(`${v.dim(`format`)} ${v.green(`dot`)}`),n.info(`${v.dim(`outdir`)} ${t}`);let r=new Set,i=await e.computedModel(),a=c(i.$data.views),o=0;for(let s of a)try{let a=await e.viewsService.layouter.dot({view:s,styles:i.$styles}),c=`.`;s.sourcePath&&(c=j(s.sourcePath)),c=F(t,c),r.has(c)||(await D(c,{recursive:!0}),r.add(c));let l=F(c,s.id+`.dot`);await k(l,a),n.info(`${v.dim(`generated`)} ${P(process.cwd(),l)}`),o++}catch(e){V.error(`error while generating ${s.id}`,{error:e})}o>0&&n.info(`${v.dim(`total`)} ${o} files`)}async function tn(e,t,n,r){await D(n,{recursive:!0}),r.info(`${v.dim(`format`)} ${v.green(t)}`),r.info(`${v.dim(`outdir`)} ${n}`);let i,a;switch(t){case`d2`:i=`.d2`,a=le;break;case`mermaid`:i=`.mmd`,a=pe;break;case`plantuml`:i=`.puml`,a=ue;break;default:ze(t)}let o=new Set,s=await e.layoutedModel(),c=0;for(let e of s.views()){let t=e.$view;try{let s=`.`;t.sourcePath&&(s=j(t.sourcePath)),s=F(n,s),o.has(s)||(await D(s,{recursive:!0}),o.add(s));let l=F(s,t.id+i);await k(l,a(e)),r.info(`${v.dim(`generated`)} ${P(process.cwd(),l)}`),c++}catch(e){r.error(`error while generating ${t.id}`,{error:e})}}c>0&&r.info(`${v.dim(`total`)} ${c} files`)}async function $({path:e,useDotBin:t,...n}){let r=H(`c4:codegen`),i=U(r),a=await C(e,{graphviz:t?`binary`:`wasm`,watch:!1});if(a.ensureSingleProject(),(await a.viewsService.computedViews()).length===0)throw r.warn(`no views found`),process.exitCode=1,Error(`no views found`);switch(n.format){case`views`:await $t(a,n.outfile,r);break;case`dot`:await en(a,n.outdir??e,r);break;case`d2`:case`mermaid`:case`plantuml`:await tn(a,n.format,n.outdir??e,r);break;default:ze(n)}i.stopAndLog()}async function nn({path:e,useDotBin:t,useCorePackage:n,outfile:r,project:i}){try{var a=Z();let o=H(`c4:codegen`),s=U(o),c=a.a(await C(e,{graphviz:t?`binary`:`wasm`,watch:!1})),{projectId:l,projectFolder:u}=Xt(c,i);i&&o.info(`${v.dim(`project`)} ${v.green(l)}`),o.info(`${v.dim(`format`)} ${v.green(`model`)}`);let d=await c.layoutedModel(l);for(let e of d.views())e.hasLayoutDrifts&&o.warn(v.yellow(`layout drift detected, view:`)+` `+v.red(e.id));let f=F(c.projectsManager.hasMultipleProjects()?u:c.workspace,`likec4-model.ts`);if(r&&(f=Xe(r)?r:F(r),I(r)&&(await Ye(r)).isDirectory()))throw Error(`output file is a directory: ${r}`);let p=A(f);o.info(`${v.dim(`filename`)} ${p}`);let m=M(p).toLocaleLowerCase();if(![`.ts`,`.mts`,`.cts`].includes(m))throw o.error(`output file ${r} has extension "${m}"`),Error(`output file ${r} must be a .ts, .mts or .cts file`);let h=j(f);o.info(`${v.dim(`outdir`)} ${h}`),await D(h,{recursive:!0}),await k(f,se(d,{useCorePackage:n}),{encoding:`utf-8`}),s.stopAndLog(),W(oe(`
16
16
  ${v.dim(`Source generated:`)}
17
- ${L(B(),f)}
17
+ ${P(L(),f)}
18
18
 
19
19
  ${v.dim(`How to use:`)}
20
20
  ${v.underline(`https://likec4.dev/tooling/code-generation/model/`)}
21
- `).trim(),{padding:1,borderColor:`green`,borderStyle:`round`})}catch(e){a.e=e}finally{await a.d()}}async function nn({languageServices:e,outDir:t,filename:n=`likec4-react.mjs`}){let r=W([`vite`,`react`]),i=_t();return r.info(`${v.cyan(`likec4 app root`)} ${v.dim(yt(i))}`),r.info(v.cyan(`outDir`)+` `+v.dim(yt(t))),{customLogger:r,root:i,configFile:!1,clearScreen:!1,publicDir:!1,mode:`production`,resolve:{conditions:[`production`],alias:xt()},esbuild:{banner:`'use client'
22
- `+ht.banner,footer:ht.footer,jsx:`transform`,jsxDev:!1,jsxSideEffects:!1,minifyIdentifiers:!1,minifySyntax:!1,minifyWhitespace:!1,tsconfigRaw:{compilerOptions:{target:`ES2022`,useDefineForClassFields:!0,verbatimModuleSyntax:!0,jsx:`react-jsx`}}},build:{outDir:t,emptyOutDir:!1,sourcemap:!1,minify:!1,copyPublicDir:!1,chunkSizeWarningLimit:bt,assetsInlineLimit:5e5,lib:{entry:`react/likec4.tsx`,fileName(e,t){return n},formats:[`es`]},rollupOptions:{output:{compact:!1,exports:`named`},external:[`likec4/react`,`likec4/model`,`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`,/@likec4\/core.*/],onwarn(e,t){e.code!==`SOURCEMAP_ERROR`&&t(e)}}},plugins:[ot({}),ge({languageServices:e.languageServices})]}}async function rn({path:e,useDotBin:t,useCorePackage:n,outfile:r,project:i}){try{var a=Z();await q();let o=W(`c4:codegen`),s=G(o),c=a.a(await C(e,{graphviz:t?`binary`:`wasm`,watch:!1})),{projectId:l,projectFolder:u}=Yt(c,i);i&&o.info(`${v.dim(`project`)} ${v.green(l)}`),o.info(`${v.dim(`format`)} ${v.green(`react`)}`);let d=await c.diagrams(l);if(d.length===0)throw process.exitCode=1,Error(`no views found`);d.forEach(e=>{if(e.drifts&&e.drifts.length>0){o.info(v.yellow(`layout drift detected, view:`)+` `+v.red(e.id));return}if(e.hasLayoutDrift){o.warn(v.yellow(`drift detected, manual layout can not be applied, view:`)+` `+v.red(e.id));return}});let f=R(c.projectsManager.hasMultipleProjects()?u:c.workspace,`likec4-views.js`);if(r&&(f=qe(r)?r:R(r),z(r)&&(await j(r)).isDirectory()))throw Error(`output file is a directory: ${r}`);let p=P(f);o.info(`${v.dim(`outdir`)} ${p}`);let m=N(f);o.info(`${v.dim(`filename`)} ${m}`);let h=F(m).toLocaleLowerCase();if(![`.js`,`.mjs`,`.jsx`].includes(h))throw o.error(`output file ${r} has extension "${h}"`),Error(`output file ${r} must be a .js, .jsx or .mjs`);await V({...await nn({languageServices:c,outDir:p,filename:m}),logLevel:`warn`});let g=await c.layoutedModel(l),_=R(p,N(f,h)+(h===`.mjs`?`.d.mts`:`.d.ts`));await M(_,fe(g,{useCorePackage:n})),s.stopAndLog(),K(oe(`
21
+ `).trim(),{padding:1,borderColor:`green`,borderStyle:`round`})}catch(e){a.e=e}finally{await a.d()}}async function rn({languageServices:e,outDir:t,filename:n=`likec4-react.mjs`}){let r=H([`vite`,`react`]),i=yt();return r.info(`${v.cyan(`likec4 app root`)} ${v.dim(K(i))}`),r.info(v.cyan(`outDir`)+` `+v.dim(K(t))),{customLogger:r,root:i,configFile:!1,clearScreen:!1,publicDir:!1,mode:`production`,resolve:{conditions:[`production`],alias:St()},esbuild:{banner:`'use client'
22
+ `+_t.banner,footer:_t.footer,jsx:`transform`,jsxDev:!1,jsxSideEffects:!1,minifyIdentifiers:!1,minifySyntax:!1,minifyWhitespace:!1,tsconfigRaw:{compilerOptions:{target:`ES2022`,useDefineForClassFields:!0,verbatimModuleSyntax:!0,jsx:`react-jsx`}}},build:{outDir:t,emptyOutDir:!1,sourcemap:!1,minify:!1,copyPublicDir:!1,chunkSizeWarningLimit:xt,assetsInlineLimit:5e5,lib:{entry:`react/likec4.tsx`,fileName(e,t){return n},formats:[`es`]},rollupOptions:{output:{compact:!1,exports:`named`},external:[`likec4/react`,`likec4/model`,`react`,`react-dom`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`,/@likec4\/core.*/],onwarn(e,t){e.code!==`SOURCEMAP_ERROR`&&t(e)}}},plugins:[lt({}),ge({languageServices:e.languageServices})]}}async function an({path:e,useDotBin:t,useCorePackage:n,outfile:r,project:i}){try{var a=Z();await q();let o=H(`c4:codegen`),s=U(o),c=a.a(await C(e,{graphviz:t?`binary`:`wasm`,watch:!1})),{projectId:l,projectFolder:u}=Xt(c,i);i&&o.info(`${v.dim(`project`)} ${v.green(l)}`),o.info(`${v.dim(`format`)} ${v.green(`react`)}`);let d=await c.diagrams(l);if(d.length===0)throw process.exitCode=1,Error(`no views found`);d.forEach(e=>{if(e.drifts&&e.drifts.length>0){o.info(v.yellow(`layout drift detected, view:`)+` `+v.red(e.id));return}if(e.hasLayoutDrift){o.warn(v.yellow(`drift detected, manual layout can not be applied, view:`)+` `+v.red(e.id));return}});let f=F(c.projectsManager.hasMultipleProjects()?u:c.workspace,`likec4-views.js`);if(r&&(f=Xe(r)?r:F(r),I(r)&&(await Ye(r)).isDirectory()))throw Error(`output file is a directory: ${r}`);let p=j(f);o.info(`${v.dim(`outdir`)} ${p}`);let m=A(f);o.info(`${v.dim(`filename`)} ${m}`);let h=M(m).toLocaleLowerCase();if(![`.js`,`.mjs`,`.jsx`].includes(h))throw o.error(`output file ${r} has extension "${h}"`),Error(`output file ${r} must be a .js, .jsx or .mjs`);await z({...await rn({languageServices:c,outDir:p,filename:m}),logLevel:`warn`});let g=await c.layoutedModel(l),_=F(p,A(f,h)+(h===`.mjs`?`.d.mts`:`.d.ts`));await k(_,fe(g,{useCorePackage:n})),s.stopAndLog(),W(oe(`
23
23
  ${v.dim(`Sources generated:`)}
24
- ${L(B(),f)}
25
- ${L(B(),_)}
24
+ ${P(L(),f)}
25
+ ${P(L(),_)}
26
26
 
27
27
  ${v.dim(`How to use:`)}
28
28
  ${v.underline(`https://likec4.dev/tooling/code-generation/react/`)}
29
- `),{padding:1,borderColor:`green`,borderStyle:`round`})}catch(e){a.e=e}finally{await a.d()}}async function an({project:e,path:t,useDotBin:n,webcomponentPrefix:r=`likec4`,outfile:i}){try{var o=Z();await q();let s=W(`c4:codegen`),c=G(s),l=o.a(await C(t,{graphviz:n?`binary`:`wasm`,watch:!1})),{projectId:u,projectFolder:d}=Yt(l,e);e&&s.info(`${v.dim(`project`)} ${v.green(u)}`),s.info(`${v.dim(`format`)} ${v.green(`webcomponent`)}`);let f=await l.diagrams(u);if(!a(f,1))throw s.warn(`no views found`),process.exitCode=1,Error(`no views found`);f.forEach(e=>{e.hasLayoutDrift&&s.warn(v.yellow(`drift detected, manual layout can not be applied, view:`)+` `+v.red(e.id))});let p=R(l.projectsManager.hasMultipleProjects()?d:l.workspace,`likec4-views.js`);if(i&&(p=qe(i)?i:R(i),z(i)&&(await j(i)).isDirectory()))throw Error(`output file is a directory: ${i}`);s.debug(`${v.dim(`outfilepath`)} ${p}`);let m=N(p);s.debug(`${v.dim(`filename`)} ${m}`);let h=F(m).toLocaleLowerCase();if(h!==`.js`&&h!==`.mjs`)throw s.warn(`output file ${i} has extension "${h}"`),Error(`output file ${i} must be a .js or .mjs`);let g=await vt();s.debug(`${v.dim(`created temp public`)} ${g}`);let _=await Ct({languageServices:l,outDir:g,filename:m,webcomponentPrefix:r,base:`/`});s.debug(`${v.dim(`vite build webcomponent`)}`),await V({..._,logLevel:`warn`});let y=R(g,m);if(!z(y))throw Error(`output file not found: ${y}`);await k(P(p),{recursive:!0}),await He(y,p),s.info(`${v.dim(`generated`)} ${p}`),s.debug(`${v.dim(`remove temp public`)}`),await Ke(g,{recursive:!0,force:!0}),c.stopAndLog(),K(oe(`
29
+ `),{padding:1,borderColor:`green`,borderStyle:`round`})}catch(e){a.e=e}finally{await a.d()}}async function on({project:e,path:t,useDotBin:n,webcomponentPrefix:r=`likec4`,outfile:i}){try{var o=Z();await q();let s=H(`c4:codegen`),c=U(s),l=o.a(await C(t,{graphviz:n?`binary`:`wasm`,watch:!1})),{projectId:u,projectFolder:d}=Xt(l,e);e&&s.info(`${v.dim(`project`)} ${v.green(u)}`),s.info(`${v.dim(`format`)} ${v.green(`webcomponent`)}`);let f=await l.diagrams(u);if(!a(f,1))throw s.warn(`no views found`),process.exitCode=1,Error(`no views found`);f.forEach(e=>{e.hasLayoutDrift&&s.warn(v.yellow(`drift detected, manual layout can not be applied, view:`)+` `+v.red(e.id))});let p=F(l.projectsManager.hasMultipleProjects()?d:l.workspace,`likec4-views.js`);if(i&&(p=Xe(i)?i:F(i),I(i)&&(await Ye(i)).isDirectory()))throw Error(`output file is a directory: ${i}`);s.debug(`${v.dim(`outfilepath`)} ${p}`);let m=A(p);s.debug(`${v.dim(`filename`)} ${m}`);let h=M(m).toLocaleLowerCase();if(h!==`.js`&&h!==`.mjs`)throw s.warn(`output file ${i} has extension "${h}"`),Error(`output file ${i} must be a .js or .mjs`);let g=await bt();s.debug(`${v.dim(`created temp public`)} ${g}`);let _=await wt({languageServices:l,outDir:g,filename:m,webcomponentPrefix:r,base:`/`});s.debug(`${v.dim(`vite build webcomponent`)}`),await z({..._,logLevel:`warn`});let y=F(g,m);if(!I(y))throw Error(`output file not found: ${y}`);await D(j(p),{recursive:!0}),await We(y,p),s.info(`${v.dim(`generated`)} ${p}`),s.debug(`${v.dim(`remove temp public`)}`),await Je(g,{recursive:!0,force:!0}),c.stopAndLog(),W(oe(`
30
30
  ${v.dim(`Webcomponents generated to:`)}
31
- ${L(B(),p)}
31
+ ${P(L(),p)}
32
32
 
33
33
  ${v.dim(`Setup and usage instructions:`)}
34
34
  ${v.blue(`https://likec4.dev/tooling/code-generation/webcomponent/`)}
35
- `))}catch(e){o.e=e}finally{await o.d()}}const on=e=>e.command({command:`gen <command> [path]`,aliases:[`generate`,`codegen`],describe:`Generate various artifacts from LikeC4 sources`,builder:e=>e.positional(`path`,J).command(`react [path]`,`generate react component to render likec4 view`,e=>e.positional(`path`,J).option(`project`,X).option(`outfile`,{alias:`o`,type:`string`,desc:`<file> path to output file (.jsx, .mjs or .js)`,normalize:!0,coerce:O}).option(`use-dot`,Y).option(`use-core-package`,Ot),async e=>{await rn({project:e.project,useDotBin:e.useDotBin,path:e.path,outfile:e.outfile,useCorePackage:e.useCorePackage})}).command({command:`webcomponent [path]`,aliases:[`wc`,`webcomp`],describe:`generate js with webcomponents`,builder:e=>e.positional(`path`,J).option(`project`,X).option(`outfile`,{alias:`o`,type:`string`,desc:`<file> path to output file (.mjs or .js)`,normalize:!0,coerce:O}).option(`webcomponent-prefix`,jt).option(`use-dot`,Y),handler:async e=>{await an({project:e.project,useDotBin:e.useDotBin,path:e.path,outfile:e.outfile,webcomponentPrefix:e.webcomponentPrefix})}}).command({command:`model [path]`,aliases:[`ts`],describe:`generate LikeC4Model (.ts)`,builder:e=>e.positional(`path`,J).option(`project`,X).option(`outfile`,{alias:`o`,type:`string`,desc:`<file> path to output file (.ts)`,normalize:!0,coerce:O}).option(`use-dot`,Y).option(`use-core-package`,Ot),handler:async e=>{await tn({path:e.path,useDotBin:e.useDotBin,useCorePackage:e.useCorePackage,outfile:e.outfile,project:e.project})}}).command({command:`views-data [path]`,aliases:[`views`],describe:`{deprecated} use codegen model`,deprecated:!0,builder:e=>e.positional(`path`,J).option(`outfile`,{alias:`o`,type:`string`,desc:`<file> output .ts file`,normalize:!0,coerce:O}).option(`use-dot`,Y),handler:async e=>{await $({format:`views`,path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).command({command:`dot [path]`,describe:`generate graphviz files (.dot)`,builder:e=>e.positional(`path`,J).option(`outdir`,At).option(`use-dot`,Y),handler:async e=>{await $({format:`dot`,path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:`d2 [path]`,describe:`generate D2 files (.d2)`,builder:e=>e.positional(`path`,J).option(`outdir`,At).option(`use-dot`,Y),handler:async e=>{await $({format:`d2`,path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:`mermaid [path]`,aliases:[`mmd`],describe:`generate Mermaid files (.mmd)`,builder:e=>e.positional(`path`,J).option(`outdir`,At).option(`use-dot`,Y),handler:async e=>{await $({format:`mermaid`,useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).command({command:`plantuml [path]`,aliases:[`puml`],describe:`generate PlantUML files (.puml)`,builder:e=>e.positional(`path`,J).option(`outdir`,At).option(`use-dot`,Y),handler:async e=>{await $({format:`plantuml`,useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).command({command:`<custom> [path]`,describe:`run custom generator from likec4 config`,builder:e=>e.positional(`path`,J).option(`project`,X).option(`use-dot`,Y),handler:async e=>{await Xt({name:`custom`,path:e.path,project:e.project,useDotBin:e.useDotBin})}}).epilog(`${v.bold(`Examples:`)}
35
+ `))}catch(e){o.e=e}finally{await o.d()}}const sn=e=>e.command({command:`gen <command> [path]`,aliases:[`generate`,`codegen`],describe:`Generate various artifacts from LikeC4 sources`,builder:e=>e.positional(`path`,J).command(`react [path]`,`generate react component to render likec4 view`,e=>e.positional(`path`,J).option(`project`,X).option(`outfile`,{alias:[`o`,`output`],type:`string`,desc:`<file> path to output file (.jsx, .mjs or .js)`,normalize:!0,coerce:E}).option(`use-dot`,Y).option(`use-core-package`,kt),async e=>{await an({project:e.project,useDotBin:e.useDotBin,path:e.path,outfile:e.outfile,useCorePackage:e.useCorePackage})}).command({command:`webcomponent [path]`,aliases:[`wc`,`webcomp`],describe:`generate js with webcomponents`,builder:e=>e.positional(`path`,J).option(`project`,X).option(`outfile`,{alias:[`o`,`output`],type:`string`,desc:`<file> path to output file (.mjs or .js)`,normalize:!0,coerce:E}).option(`webcomponent-prefix`,Mt).option(`use-dot`,Y),handler:async e=>{await on({project:e.project,useDotBin:e.useDotBin,path:e.path,outfile:e.outfile,webcomponentPrefix:e.webcomponentPrefix})}}).command({command:`model [path]`,aliases:[`ts`],describe:`generate LikeC4Model (.ts)`,builder:e=>e.positional(`path`,J).option(`project`,X).option(`outfile`,{alias:[`o`,`output`],type:`string`,desc:`<file> path to output file (.ts)`,normalize:!0,coerce:E}).option(`use-dot`,Y).option(`use-core-package`,kt),handler:async e=>{await nn({path:e.path,useDotBin:e.useDotBin,useCorePackage:e.useCorePackage,outfile:e.outfile,project:e.project})}}).command({command:`views-data [path]`,aliases:[`views`],describe:`{deprecated} use codegen model`,deprecated:!0,builder:e=>e.positional(`path`,J).option(`outfile`,{alias:[`o`,`output`],type:`string`,desc:`<file> output .ts file`,normalize:!0,coerce:E}).option(`use-dot`,Y),handler:async e=>{await $({format:`views`,path:e.path,useDotBin:e.useDotBin,outfile:e.outfile})}}).command({command:`dot [path]`,describe:`generate graphviz files (.dot)`,builder:e=>e.positional(`path`,J).option(`outdir`,jt).option(`use-dot`,Y),handler:async e=>{await $({format:`dot`,path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:`d2 [path]`,describe:`generate D2 files (.d2)`,builder:e=>e.positional(`path`,J).option(`outdir`,jt).option(`use-dot`,Y),handler:async e=>{await $({format:`d2`,path:e.path,useDotBin:e.useDotBin,outdir:e.outdir})}}).command({command:`mermaid [path]`,aliases:[`mmd`],describe:`generate Mermaid files (.mmd)`,builder:e=>e.positional(`path`,J).option(`outdir`,jt).option(`use-dot`,Y),handler:async e=>{await $({format:`mermaid`,useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).command({command:`plantuml [path]`,aliases:[`puml`],describe:`generate PlantUML files (.puml)`,builder:e=>e.positional(`path`,J).option(`outdir`,jt).option(`use-dot`,Y),handler:async e=>{await $({format:`plantuml`,useDotBin:e.useDotBin,path:e.path,outdir:e.outdir})}}).command({command:`<custom> [path]`,describe:`run custom generator from likec4 config`,builder:e=>e.positional(`path`,J).option(`project`,X).option(`use-dot`,Y),handler:async e=>{await Zt({name:`custom`,path:e.path,project:e.project,useDotBin:e.useDotBin})}}).epilog(`${v.bold(`Examples:`)}
36
36
  likec4 gen react -o dist/likec4-views.mjs ./src/likec4
37
37
  likec4 gen model -o likec4-model.ts
38
38
  likec4 gen ts --outfile likec4-model.ts
@@ -40,9 +40,9 @@ import{s as e}from"../_chunks/rolldown-runtime.mjs";import"../_chunks/libs/birpc
40
40
  likec4 gen mmd --outdir assets/
41
41
  likec4 gen plantuml --outdir assets/
42
42
  likec4 gen dot -o out .
43
- `),handler:async e=>{await Xt({name:e.command,path:e.path,project:e.project,useDotBin:e.useDotBin})}}),sn=new Set([`node_modules`,`.git`]);function cn(e){return e.endsWith(`.c4`)||e.endsWith(`.likec4`)}function ln(e,t=`
43
+ `),handler:async e=>{await Zt({name:e.command,path:e.path,project:e.project,useDotBin:e.useDotBin})}}),cn=new Set([`node_modules`,`.git`]);function ln(e){return e.endsWith(`.c4`)||e.endsWith(`.likec4`)}function un(e,t=`
44
44
 
45
- `){return e.filter(e=>e.trim()!==``).join(t)}const un=`No project or empty model`,dn=`No views could be exported`;function fn(){return`${v.bold(`Examples:`)}
45
+ `){return e.filter(e=>e.trim()!==``).join(t)}const dn=`No project or empty model`,fn=`No views could be exported`;function pn(){return`${v.bold(`Examples:`)}
46
46
  ${v.green(`$0 export drawio`)}
47
47
  ${v.gray(`Export each view to a separate .drawio file`)}
48
48
 
@@ -53,19 +53,19 @@ import{s as e}from"../_chunks/rolldown-runtime.mjs";import"../_chunks/libs/birpc
53
53
  ${v.gray(`Re-apply layout/waypoints from comment blocks (e.g. after import from DrawIO)`)}
54
54
 
55
55
  ${v.green(`$0 export drawio --uncompressed -o ./out`)}
56
- ${v.gray(`Export with raw XML (no compression) for draw.io desktop compatibility`)}`}function pn(e){return e instanceof Error?e:Error(g(e))}function mn(e,t,n){let r=pn(n);throw e.error(t,{error:r}),r}async function hn(e,t){let n=[],r=new Set;async function i(e,a){if(a>=50)return;let o=await Ge(e).catch(()=>null);if(o==null||r.has(o))return;r.add(o);let s=await We(e,{withFileTypes:!0}).catch(n=>(t?.debug&&t.debug(`${v.dim(`Roundtrip:`)} readdir failed`,{dir:e,err:n}),[]));for(let r of s){let o=I(e,r.name);switch(!0){case r.isDirectory():sn.has(r.name)||await i(o,a+1);break;case r.isSymbolicLink():if((await j(o).catch(()=>null))?.isFile()&&cn(r.name)){let e=await Ue(o,`utf-8`).catch(e=>(t?.debug&&t.debug(`${v.dim(`Roundtrip:`)} readFile failed`,{file:o,err:e}),``));e&&n.push(e)}break;case r.isFile()&&cn(r.name):{let e=await Ue(o,`utf-8`).catch(e=>(t?.debug&&t.debug(`${v.dim(`Roundtrip:`)} readFile failed`,{file:o,err:e}),``));e&&n.push(e);break}}}}return await i(e,0),ln(n)}async function gn(e,t,n){if(t)return hn(R(e),n)}function _n(e,t,n){return he(e.map(e=>String(e.$view.id)),t,n?{compressed:!1}:void 0)}async function vn(e){let{viewmodels:t,outdir:n,workspacePath:r,roundtrip:i,uncompressed:a,logger:o}=e,s=de(t,_n(t,await gn(r,i,o),a)),c=R(n,_e);await M(c,s),o.info(`${v.dim(`generated`)} ${L(process.cwd(),c)} (${t.length} tab(s))`)}async function yn(e,t,n,r){let i=String(e.$view.id);try{let a=ce(e,t[i]),o=R(n,i+`.drawio`);return await k(P(o),{recursive:!0}),await M(o,a),r.info(`${v.dim(`generated`)} ${L(process.cwd(),o)}`),!0}catch(e){return r.error(`Failed to export view ${i}`,{error:pn(e)}),!1}}async function bn(e){let{viewmodels:t,outdir:n,workspacePath:r,roundtrip:i,uncompressed:a,logger:o}=e,s=_n(t,await gn(r,i,o),a),c=0;for(let e of t)await yn(e,s,n,o)&&c++;return{succeeded:c}}async function xn(e,t){try{var n=Z();let r=G(t),i=n.a(await T(e.path,{graphviz:e.useDot?`binary`:`wasm`,watch:!1}));e.project||i.ensureSingleProject();let a=e.project==null?void 0:i.languageServices.projectsManager.ensureProjectId(e.project),o=await i.layoutedModel(a);if(o===ve.EMPTY)throw t.error(un),Error(un);let s=[...o.views()];if(s.length===0)throw t.error(`No views to export`),Error(dn);await k(e.outdir,{recursive:!0});let c={viewmodels:s,outdir:e.outdir,workspacePath:e.path,roundtrip:e.roundtrip,uncompressed:e.uncompressed,logger:t};if(e.allInOne)try{await vn(c)}catch(e){mn(t,`Failed to export DrawIO`,e)}else{let{succeeded:e}=await bn(c);if(e===0)throw t.error(dn),Error(dn);t.info(`${v.dim(`total`)} ${e} DrawIO file(s)`)}r.stopAndLog(`✓ export drawio in `)}catch(e){n.e=e}finally{await n.d()}}function Sn(e){return e.command({command:`drawio [path]`,describe:`export view(s) to DrawIO (.drawio) for editing in draw.io`,builder:e=>e.positional(`path`,J).option(`outdir`,{alias:`o`,type:`string`,desc:`<dir> output directory for .drawio files`,normalize:!0,coerce:R}).option(`all-in-one`,{type:`boolean`,default:!1,desc:`write one .drawio file with all views as tabs (diagrams)`}).option(`roundtrip`,{type:`boolean`,default:!1,desc:`apply layout/stroke/waypoints from DrawIO round-trip comment blocks in .c4 source`}).option(`uncompressed`,{type:`boolean`,default:!1,desc:`write diagram XML uncompressed inside .drawio (larger file; use if draw.io desktop fails to open compressed export)`}).options({project:X,"use-dot":Y}).epilog(fn()),handler:async e=>{let t=W(`c4:export`);await xn({path:e.path,outdir:e.outdir??e.path,allInOne:!!e.allInOne,roundtrip:!!e.roundtrip,uncompressed:!!e.uncompressed,project:e.project,useDot:!!e[`use-dot`]},t)}})}const Cn=`project not found`,wn=`No projects found`;async function Tn(e,t){try{var n=Z();let r=G(t),i=n.a(await be.fromWorkspace(e.path,{logger:t,graphviz:e.useDot?`binary`:`wasm`,watch:!1})),o=[...i.projectsManager.all];if(e.project){if(o=o.filter(t=>t===e.project),!a(o,1))throw t.error(`${Cn}: ${e.project}`),Error(`${Cn}: ${e.project}`)}else{if(!a(o,1))throw t.error(wn),Error(wn);t.info(`${v.dim(`workspace:`)} Found ${o.length} projects`)}let s=[];for(let n of o){let r;if(e.skipLayout?(t.info(`Generate model for project ${v.green(n)} ${v.dim(`(skip layout)`)}`),r=await i.computedModel(n)):(t.info(`Generating layouted model for project ${v.green(n)}`),r=await i.layoutedModel(n)),r===ve.EMPTY){t.warn(v.yellow(`Project ${n} is empty, skipping`));continue}s.push(r.$data)}if(s.length===0)throw t.warn(`No models generated, aborting export`),Error(`No models generated; all projects are empty or were skipped`);let c=e.outfile;F(c).toLowerCase()!==`.json`&&(c+=`.json`),await k(P(c),{recursive:!0});let l=s.length===1?s[0]:s,u=e.pretty?JSON.stringify(l,void 0,2):JSON.stringify(l);await M(c,u);let d=c.startsWith(e.path)?L(e.path,c):c;t.info(`${v.dim(`generated`)} ${d}`),r.stopAndLog(`✓ export in `)}catch(e){n.e=e}finally{await n.d()}}function En(e){return e.command({command:`json [path]`,describe:`export model(s) to JSON`,builder:e=>e.positional(`path`,J).option(`outfile`,{alias:`o`,type:`string`,desc:`<file> output .json file`,default:`likec4.json`,normalize:!0,coerce:R}).options({project:X,"use-dot":Y,"skip-layout":{type:`boolean`,desc:`skip layouting (only compute model)`},pretty:{type:`boolean`,desc:`indented JSON output`}}).epilog(`${v.bold(`Examples:`)}
56
+ ${v.gray(`Export with raw XML (no compression) for draw.io desktop compatibility`)}`}function mn(e){return e instanceof Error?e:Error(g(e))}function hn(e,t,n){let r=mn(n);throw e.error(t,{error:r}),r}async function gn(e,t){let n=[],r=new Set;async function i(e,a){if(a>=50)return;let o=await qe(e).catch(()=>null);if(o==null||r.has(o))return;r.add(o);let s=await Ke(e,{withFileTypes:!0}).catch(n=>(t?.debug&&t.debug(`${v.dim(`Roundtrip:`)} readdir failed`,{dir:e,err:n}),[]));for(let r of s){let o=N(e,r.name);switch(!0){case r.isDirectory():cn.has(r.name)||await i(o,a+1);break;case r.isSymbolicLink():if((await Ye(o).catch(()=>null))?.isFile()&&ln(r.name)){let e=await Ge(o,`utf-8`).catch(e=>(t?.debug&&t.debug(`${v.dim(`Roundtrip:`)} readFile failed`,{file:o,err:e}),``));e&&n.push(e)}break;case r.isFile()&&ln(r.name):{let e=await Ge(o,`utf-8`).catch(e=>(t?.debug&&t.debug(`${v.dim(`Roundtrip:`)} readFile failed`,{file:o,err:e}),``));e&&n.push(e);break}}}}return await i(e,0),un(n)}async function _n(e,t,n){if(t)return gn(F(e),n)}function vn(e,t,n){return he(e.map(e=>String(e.$view.id)),t,n?{compressed:!1}:void 0)}async function yn(e){let{viewmodels:t,outdir:n,workspacePath:r,roundtrip:i,uncompressed:a,logger:o}=e,s=de(t,vn(t,await _n(r,i,o),a)),c=F(n,_e);await k(c,s),o.info(`${v.dim(`generated`)} ${P(process.cwd(),c)} (${t.length} tab(s))`)}async function bn(e,t,n,r){let i=String(e.$view.id);try{let a=ce(e,t[i]),o=F(n,i+`.drawio`);return await D(j(o),{recursive:!0}),await k(o,a),r.info(`${v.dim(`generated`)} ${P(process.cwd(),o)}`),!0}catch(e){return r.error(`Failed to export view ${i}`,{error:mn(e)}),!1}}async function xn(e){let{viewmodels:t,outdir:n,workspacePath:r,roundtrip:i,uncompressed:a,logger:o}=e,s=vn(t,await _n(r,i,o),a),c=0;for(let e of t)await bn(e,s,n,o)&&c++;return{succeeded:c}}async function Sn(e,t){try{var n=Z();let r=U(t),i=n.a(await be(e.path,{graphviz:e.useDot?`binary`:`wasm`,watch:!1}));e.project||i.ensureSingleProject();let a=e.project==null?void 0:i.languageServices.projectsManager.ensureProjectId(e.project),o=await i.layoutedModel(a);if(o===ve.EMPTY)throw t.error(dn),Error(dn);let s=[...o.views()];if(s.length===0)throw t.error(`No views to export`),Error(fn);await D(e.outdir,{recursive:!0});let c={viewmodels:s,outdir:e.outdir,workspacePath:e.path,roundtrip:e.roundtrip,uncompressed:e.uncompressed,logger:t};if(e.allInOne)try{await yn(c)}catch(e){hn(t,`Failed to export DrawIO`,e)}else{let{succeeded:e}=await xn(c);if(e===0)throw t.error(fn),Error(fn);t.info(`${v.dim(`total`)} ${e} DrawIO file(s)`)}r.stopAndLog(`✓ export drawio in `)}catch(e){n.e=e}finally{await n.d()}}function Cn(e){return e.command({command:`drawio [path]`,describe:`export view(s) to DrawIO (.drawio) for editing in draw.io`,builder:e=>e.positional(`path`,J).option(`outdir`,{alias:`o`,type:`string`,desc:`<dir> output directory for .drawio files`,normalize:!0,coerce:F}).option(`all-in-one`,{type:`boolean`,default:!1,desc:`write one .drawio file with all views as tabs (diagrams)`}).option(`roundtrip`,{type:`boolean`,default:!1,desc:`apply layout/stroke/waypoints from DrawIO round-trip comment blocks in .c4 source`}).option(`uncompressed`,{type:`boolean`,default:!1,desc:`write diagram XML uncompressed inside .drawio (larger file; use if draw.io desktop fails to open compressed export)`}).options({project:X,"use-dot":Y}).epilog(pn()),handler:async e=>{let t=H(`c4:export`);await Sn({path:e.path,outdir:e.outdir??e.path,allInOne:!!e.allInOne,roundtrip:!!e.roundtrip,uncompressed:!!e.uncompressed,project:e.project,useDot:!!e[`use-dot`]},t)}})}const wn=`project not found`,Tn=`No projects found`;async function En(e,t){try{var n=Z();let r=U(t),i=n.a(await xe.fromWorkspace(e.path,{logger:t,graphviz:e.useDot?`binary`:`wasm`,watch:!1})),o=[...i.projectsManager.all];if(e.project){if(o=o.filter(t=>t===e.project),!a(o,1))throw t.error(`${wn}: ${e.project}`),Error(`${wn}: ${e.project}`)}else{if(!a(o,1))throw t.error(Tn),Error(Tn);t.info(`${v.dim(`workspace:`)} Found ${o.length} projects`)}let s=[];for(let n of o){let r;if(e.skipLayout?(t.info(`Generate model for project ${v.green(n)} ${v.dim(`(skip layout)`)}`),r=await i.computedModel(n)):(t.info(`Generating layouted model for project ${v.green(n)}`),r=await i.layoutedModel(n)),r===ve.EMPTY){t.warn(v.yellow(`Project ${n} is empty, skipping`));continue}s.push(r.$data)}if(s.length===0)throw t.warn(`No models generated, aborting export`),Error(`No models generated; all projects are empty or were skipped`);let c=e.outfile;M(c).toLowerCase()!==`.json`&&(c+=`.json`),await D(j(c),{recursive:!0});let l=s.length===1?s[0]:s,u=e.pretty?JSON.stringify(l,void 0,2):JSON.stringify(l);await k(c,u);let d=c.startsWith(e.path)?P(e.path,c):c;t.info(`${v.dim(`generated`)} ${d}`),r.stopAndLog(`✓ export in `)}catch(e){n.e=e}finally{await n.d()}}function Dn(e){return e.command({command:`json [path]`,describe:`export model(s) to JSON`,builder:e=>e.positional(`path`,J).option(`outfile`,{alias:`o`,type:`string`,desc:`<file> output .json file`,default:`likec4.json`,normalize:!0,coerce:F}).options({project:X,"use-dot":Y,"skip-layout":{type:`boolean`,desc:`skip layouting (only compute model)`},pretty:{type:`boolean`,desc:`indented JSON output`}}).epilog(`${v.bold(`Examples:`)}
57
57
  ${v.green(`$0 export json --skip-layout`)}
58
58
  ${v.gray(`Search for likec4 files in current directory and output JSON to likec4.json (no layout)`)}
59
59
 
60
60
  ${v.green(`$0 export json --pretty -o ./generated/likec4.json src/likec4 `)}
61
61
  ${v.gray(`Search for likec4 files in src/likec4 and output JSON to generated/likec4.json`)}
62
- `),handler:async e=>{let t=W(`c4:export`);await Tn({path:e.path,outfile:e.outfile,project:e.project,skipLayout:!!e.skipLayout,pretty:!!e.pretty,useDot:!!e[`use-dot`]},t)}})}var Dn=e(S(),1);function On(e){if(e.resolvedUrls)return i(e.resolvedUrls.network)??i(e.resolvedUrls.local)}function kn(e){if(!e.resolvedUrls)throw Error(`Vite server is not ready, no resolvedUrls`);K([v.green(`LikeC4 served at:`),``,v.dim(`Local: `)+e.resolvedUrls.local.join(`
62
+ `),handler:async e=>{let t=H(`c4:export`);await En({path:e.path,outfile:e.outfile,project:e.project,skipLayout:!!e.skipLayout,pretty:!!e.pretty,useDot:!!e[`use-dot`]},t)}})}var On=e(S(),1);function kn(e){if(e.resolvedUrls)return i(e.resolvedUrls.network)??i(e.resolvedUrls.local)}function An(e){if(!e.resolvedUrls)throw Error(`Vite server is not ready, no resolvedUrls`);W([v.green(`LikeC4 served at:`),``,v.dim(`Local: `)+e.resolvedUrls.local.join(`
63
63
  `+``.padEnd(9,` `)),e.resolvedUrls.network.length?v.dim(`Network: `)+e.resolvedUrls.network.join(`
64
64
  `+``.padEnd(9,` `)):void 0].filter(e=>l(e)).join(`
65
- `))}async function An({buildWebcomponent:e=!0,hmr:t=!0,webcomponentPrefix:n=`likec4`,title:r,languageServices:i,likec4AssetsDir:a,openBrowser:o,listen:s,port:c,...l}){a??=await A(I(D(),`.likec4-assets-`));let{isDev:u,...d}=await St({...l,languageServices:i,likec4AssetsDir:a,webcomponentPrefix:n,title:r}),f=d.customLogger;c??=ze.PORT?parseInt(ze.PORT,10):void 0,c||=await Oe({port:[5173,5174,...E(61e3,61010),...E(62002,62010)]});let p=24678,m=await vt(),h=s??(w()?`0.0.0.0`:`localhost`);t?(p=await Oe({port:E(24678,24690)}),f.info(`Enabling HMR: localhost:${p}`),w()&&f.info(v.yellow(`ensure port ${p} is published from container`))):f.info(`Disabling HMR`);let _=await ct({...d,define:t?{...d.define,"process.env.NODE_ENV":`"development"`}:d.define,mode:t?`development`:d.mode,publicDir:m,server:{host:h,allowedHosts:!0,port:c,hmr:t&&{overlay:!0,port:p},fs:{strict:!1},open:o??(!u&&!w())}});return e?(f.info(`Building webcomponent`),Ct({webcomponentPrefix:n,languageServices:i,outDir:m,base:d.base}).then(e=>V({...e,logLevel:`warn`})).catch(e=>{f.warn(g(e)),f.warn(`webcomponent build failed, ignoring error and continue`)})):f.info(`Skip webcomponent build`),await _.listen(),_}async function jn({browserContext:e,views:r,output:i,logger:a,timeout:o,maxAttempts:s,dynamicVariant:c,outputType:l,theme:u}){let d,f=r.map(e=>({view:e,attempt:1})),p=[],m;for(;m=f.shift();){let{view:r,attempt:h}=m,g=`export/${encodeURIComponent(r.id)}/`;try{if(h>1){d&&=(d.close({runBeforeUnload:!0}).catch(e=>a.error(`failed to close page: ${e}`)),void 0);let e=t(h*200,{min:200,max:1e3});a.info(v.cyan(g)+v.dim(` attempt ${h} of ${s} after ${e}ms`)),await ut(e)}else r.hasLayoutDrift&&a.warn(v.yellow(`Drift detected, manual layout can not be applied, view may be invalid: `)+v.red(r.id));let f=`.`;l===`relative`&&(f=r.sourcePath??`.`,f=f.includes(`/`)?f.slice(0,f.lastIndexOf(`/`)):`.`);let m=R(i,f,`${r.id}.png`);d??=await e.newPage();let _=r.bounds;c===`sequence`&&r._type===`dynamic`&&(_=r.sequenceLayout.bounds),await d.setViewportSize({width:_.width+40+20,height:_.height+40+20}),await d.goto(ee(g,{padding:20,theme:u,dynamic:c})),a.info(v.cyan(g)+v.dim(` -> ${L(i,m)}`)),await d.waitForSelector(`.react-flow.initialized`),r.nodes.some(e=>n(e.icon)&&e.icon.toLowerCase().startsWith(`http`))&&await Mn(d,o),await d.getByTestId(`export-page`).screenshot({animations:`disabled`,path:m,omitBackground:!0}),p.push({view:r,path:m})}catch(e){d?.close({runBeforeUnload:!0}).catch(e=>a.error(`failed to close page: ${e}`)),a.error(v.red(`failed `+g+`
66
- `+e)),h<s&&(f.push({view:r,attempt:h+1}),a.info(v.dim(`retry ${g}`))),d=void 0}}return p}async function Mn(e,t){let n=await e.locator(`//img`).all();if(!n.length)return;let r=n.map(e=>e.evaluate(e=>e.complete||new Promise(t=>{e.onload=t,e.onerror=t}),{timeout:Math.max(15e3,t)}));await Promise.allSettled(r)}async function Nn({logger:e,serverUrl:t,theme:n=`light`,timeoutMs:r=15e3,views:i,output:a,outputType:o=`relative`,maxAttempts:s=3,chromiumSandbox:c=!1,sequence:l=!1}){e.info(`${v.dim(`output`)} ${a}`),e.info(`${v.dim(`base url`)} ${t}\n`);let{chromium:u}=await import(`playwright`),d=u.executablePath();e.info(v.cyan(`Start chromium`)+` `+v.dim(d));let f=await u.launch({chromiumSandbox:c,headless:!0});e.info(v.cyan(`Color scheme: `)+n+`
67
- `);let p=await f.newContext({deviceScaleFactor:2,colorScheme:n,baseURL:t,bypassCSP:!0,ignoreHTTPSErrors:!0,isMobile:!1});p.setDefaultNavigationTimeout(r),p.setDefaultTimeout(r);try{return await jn({browserContext:p,views:i,output:a,outputType:o,logger:e,maxAttempts:s,dynamicVariant:l?`sequence`:`diagram`,timeout:r,theme:n})}finally{e.info(v.cyan(`close chromium`)),await p.close(),await f.close()}}async function Pn(e,t){try{var n=Z();let{path:r,useDotBin:i,project:o,theme:s=`light`,output:c,outputType:l,serverUrl:u,ignore:d=!1,timeoutMs:f=15e3,maxAttempts:p=3,filter:m,sequence:h=!1,chromiumSandbox:g=!1}=e,_=n.a(await be.fromWorkspace(r,{logger:`vite`,graphviz:i?`binary`:`wasm`,watch:!1})),y=c??_.workspace,b,x=u,S=[..._.languageServices.projects()];if(o&&!S.some(e=>e.id===o))throw t.error(`project not found: ${o}`),Error(`project not found: ${o}`);try{if(!x&&(t.info(v.cyan(`start preview server`)),b=await An({languageServices:_,buildWebcomponent:!1,openBrowser:!1,hmr:!1}),x=On(b),!x))throw t.error(`Vite server is not ready, no resolvedUrls`),Error(`Vite server is not ready, no resolvedUrls`);for(let e of S){if(o&&e.id!==o)continue;S.length>1&&(t.info(v.dim(`---------`)),t.info(`${v.dim(`project:`)} ${e.id}`),t.info(`${v.dim(`folder:`)} ${e.folder.fsPath}`));let n=await _.diagrams(e.id);if(m&&a(m,1)&&a(n,1)){let e=(0,Dn.default)(m);t.info(`${v.cyan(`filter`)} ${v.dim(JSON.stringify(m))}`),n=n.filter(n=>e(n.id)?(t.info(`${v.green(`include`)} ${n.id} ✅`),!0):(t.info(`${v.gray(`skip`)} ${v.dim(n.id)}`),!1))}if(!a(n,1)){t.warn(`no views found`);continue}let r=S.length>1?te(ne(x,`project`,e.id)):x,i=S.length>1?ne(y,e.id):y,c=tt(),u=await Nn({logger:t,serverUrl:r,theme:s,timeoutMs:f,views:n,output:i,outputType:l,maxAttempts:p,sequence:h,chromiumSandbox:g}),{pretty:b}=ft(c);if(u.length>0&&t.info(v.green(`exported ${u.length} views in ${b}`)+`
68
- `),u.length!==n.length&&(d&&u.length>0?t.info(v.dim(`ignore`)+` `+v.red(`failed ${n.length-u.length} out of ${n.length} views`)):t.error(v.red(`failed ${n.length-u.length} out of ${n.length} views`))),u.length!==n.length&&(u.length===0||!d))throw Error(`Failed ${n.length-u.length} out of ${n.length} views`)}}finally{b&&(t.info(v.cyan(`stop server`)),await b.close().catch(e=>{t.error(e)}))}}catch(e){n.e=e}finally{await n.d()}}async function Fn(e){await Pn(e,W(`c4:export`))}function In(e){return e.command({command:`png [path]`,describe:`export views to PNG`,builder:e=>e.positional(`path`,J).options({outdir:{alias:[`o`,`output`],type:`string`,desc:`output directory for PNG files; if not specified, images are saved next to sources`,normalize:!0,nargs:1,coerce:R},project:X,theme:{choices:[`light`,`dark`],desc:`color-scheme to use, defaults to light`,conflicts:[`dark`,`light`],nargs:1},dark:{type:`boolean`,desc:`use dark theme, shortcut for --theme=dark`,conflicts:[`theme`,`light`]},light:{type:`boolean`,desc:`use light theme, shortcut for --theme=light`,conflicts:[`theme`,`dark`]},"use-dot":Y,seq:{alias:[`sequence`],type:`boolean`,desc:`use sequence layout for dynamic views`},flat:{alias:[`flatten`],type:`boolean`,desc:`flatten all images in outdir ignoring sources structure`},filter:{alias:`f`,array:!0,string:!0,desc:`include views with ids matching given patterns
65
+ `))}async function jn({buildWebcomponent:e=!0,hmr:t=!0,webcomponentPrefix:n=`likec4`,title:r,languageServices:i,likec4AssetsDir:a,openBrowser:o,listen:s,port:c,...l}){a??=await O(N(T(),`.likec4-assets-`));let{isDev:u,...d}=await Ct({...l,languageServices:i,likec4AssetsDir:a,webcomponentPrefix:n,title:r}),f=d.customLogger;c??=Ve.PORT?parseInt(Ve.PORT,10):void 0,c||=await Ae({port:[5173,5174,...ke(61e3,61010),...ke(62002,62010)]});let p=24678,m=await bt(),h=s??(w()?`0.0.0.0`:`localhost`);t?(p=await Ae({port:ke(24678,24690)}),f.info(`Enabling HMR: localhost:${p}`),w()&&f.info(v.yellow(`ensure port ${p} is published from container`))):f.info(`Disabling HMR`);let _=await dt({...d,define:t?{...d.define,"process.env.NODE_ENV":`"development"`}:d.define,mode:t?`development`:d.mode,publicDir:m,server:{host:h,allowedHosts:!0,port:c,hmr:t&&{overlay:!0,port:p},fs:{strict:!1},open:o??(!u&&!w())}});return e?(f.info(`Building webcomponent`),wt({webcomponentPrefix:n,languageServices:i,outDir:m,base:d.base}).then(e=>z({...e,logLevel:`warn`})).catch(e=>{f.warn(g(e)),f.warn(`webcomponent build failed, ignoring error and continue`)})):f.info(`Skip webcomponent build`),await _.listen(),_}async function Mn({browserContext:e,views:r,output:i,logger:a,timeout:o,maxAttempts:s,dynamicVariant:c,outputType:l,theme:u}){let d,f=r.map(e=>({view:e,attempt:1})),p=[],m;for(;m=f.shift();){let{view:r,attempt:h}=m,g=`export/${encodeURIComponent(r.id)}/`;try{if(h>1){d&&=(d.close({runBeforeUnload:!0}).catch(e=>a.error(`failed to close page: ${e}`)),void 0);let e=t(h*200,{min:200,max:1e3});a.info(v.cyan(g)+v.dim(` attempt ${h} of ${s} after ${e}ms`)),await pt(e)}else r.hasLayoutDrift&&a.warn(v.yellow(`Drift detected, manual layout can not be applied, view may be invalid: `)+v.red(r.id));let f=`.`;l===`relative`&&(f=r.sourcePath??`.`,f=f.includes(`/`)?f.slice(0,f.lastIndexOf(`/`)):`.`);let m=F(i,f,`${r.id}.png`);d??=await e.newPage();let _=r.bounds;c===`sequence`&&r._type===`dynamic`&&(_=r.sequenceLayout.bounds),await d.setViewportSize({width:_.width+40+20,height:_.height+40+20}),await d.goto(ee(g,{padding:20,theme:u,dynamic:c})),a.info(v.cyan(g)+v.dim(` -> ${P(i,m)}`)),await d.waitForSelector(`.react-flow.initialized`),r.nodes.some(e=>n(e.icon)&&e.icon.toLowerCase().startsWith(`http`))&&await Nn(d,o),await d.getByTestId(`export-page`).screenshot({animations:`disabled`,path:m,omitBackground:!0}),p.push({view:r,path:m})}catch(e){d?.close({runBeforeUnload:!0}).catch(e=>a.error(`failed to close page: ${e}`)),a.error(v.red(`failed `+g+`
66
+ `+e)),h<s&&(f.push({view:r,attempt:h+1}),a.info(v.dim(`retry ${g}`))),d=void 0}}return p}async function Nn(e,t){let n=await e.locator(`//img`).all();if(!n.length)return;let r=n.map(e=>e.evaluate(e=>e.complete||new Promise(t=>{e.onload=t,e.onerror=t}),{timeout:Math.max(15e3,t)}));await Promise.allSettled(r)}async function Pn({logger:e,serverUrl:t,theme:n=`light`,timeoutMs:r=15e3,views:i,output:a,outputType:o=`relative`,maxAttempts:s=3,chromiumSandbox:c=!1,sequence:l=!1}){e.info(`${v.dim(`output`)} ${a}`),e.info(`${v.dim(`base url`)} ${t}\n`);let{chromium:u}=await import(`playwright`),d=u.executablePath();e.info(v.cyan(`Start chromium`)+` `+v.dim(d));let f=await u.launch({chromiumSandbox:c,headless:!0});e.info(v.cyan(`Color scheme: `)+n+`
67
+ `);let p=await f.newContext({deviceScaleFactor:2,colorScheme:n,baseURL:t,bypassCSP:!0,ignoreHTTPSErrors:!0,isMobile:!1});p.setDefaultNavigationTimeout(r),p.setDefaultTimeout(r);try{return await Mn({browserContext:p,views:i,output:a,outputType:o,logger:e,maxAttempts:s,dynamicVariant:l?`sequence`:`diagram`,timeout:r,theme:n})}finally{e.info(v.cyan(`close chromium`)),await p.close(),await f.close()}}async function Fn(e,t){try{var n=Z();let{path:r,useDotBin:i,project:o,theme:s=`light`,output:c,outputType:l,serverUrl:u,ignore:d=!1,timeoutMs:f=15e3,maxAttempts:p=3,filter:m,sequence:h=!1,chromiumSandbox:g=!1}=e,_=n.a(await xe.fromWorkspace(r,{logger:`vite`,graphviz:i?`binary`:`wasm`,watch:!1})),y=c??_.workspace,b,x=u,S=[..._.languageServices.projects()];if(o&&!S.some(e=>e.id===o))throw t.error(`project not found: ${o}`),Error(`project not found: ${o}`);try{if(!x&&(t.info(v.cyan(`start preview server`)),b=await jn({languageServices:_,buildWebcomponent:!1,openBrowser:!1,hmr:!1}),x=kn(b),!x))throw t.error(`Vite server is not ready, no resolvedUrls`),Error(`Vite server is not ready, no resolvedUrls`);for(let e of S){if(o&&e.id!==o)continue;S.length>1&&(t.info(v.dim(`---------`)),t.info(`${v.dim(`project:`)} ${e.id}`),t.info(`${v.dim(`folder:`)} ${e.folder.fsPath}`));let n=await _.diagrams(e.id);if(m&&a(m,1)&&a(n,1)){let e=(0,On.default)(m);t.info(`${v.cyan(`filter`)} ${v.dim(JSON.stringify(m))}`),n=n.filter(n=>e(n.id)?(t.info(`${v.green(`include`)} ${n.id} ✅`),!0):(t.info(`${v.gray(`skip`)} ${v.dim(n.id)}`),!1))}if(!a(n,1)){t.warn(`no views found`);continue}let r=S.length>1?te(ne(x,`project`,e.id)):x,i=S.length>1?ne(y,e.id):y,c=it(),u=await Pn({logger:t,serverUrl:r,theme:s,timeoutMs:f,views:n,output:i,outputType:l,maxAttempts:p,sequence:h,chromiumSandbox:g}),{pretty:b}=ht(c);if(u.length>0&&t.info(v.green(`exported ${u.length} views in ${b}`)+`
68
+ `),u.length!==n.length&&(d&&u.length>0?t.info(v.dim(`ignore`)+` `+v.red(`failed ${n.length-u.length} out of ${n.length} views`)):t.error(v.red(`failed ${n.length-u.length} out of ${n.length} views`))),u.length!==n.length&&(u.length===0||!d))throw Error(`Failed ${n.length-u.length} out of ${n.length} views`)}}finally{b&&(t.info(v.cyan(`stop server`)),await b.close().catch(e=>{t.error(e)}))}}catch(e){n.e=e}finally{await n.d()}}async function In(e){await Fn(e,H(`c4:export`))}function Ln(e){return e.command({command:`png [path]`,describe:`export views to PNG`,builder:e=>e.positional(`path`,J).options({outdir:{alias:[`o`,`output`],type:`string`,desc:`output directory for PNG files; if not specified, images are saved next to sources`,normalize:!0,nargs:1,coerce:F},project:X,theme:{choices:[`light`,`dark`],desc:`color-scheme to use, defaults to light`,conflicts:[`dark`,`light`],nargs:1},dark:{type:`boolean`,desc:`use dark theme, shortcut for --theme=dark`,conflicts:[`theme`,`light`]},light:{type:`boolean`,desc:`use light theme, shortcut for --theme=light`,conflicts:[`theme`,`dark`]},"use-dot":Y,seq:{alias:[`sequence`],type:`boolean`,desc:`use sequence layout for dynamic views`},flat:{alias:[`flatten`],type:`boolean`,desc:`flatten all images in outdir ignoring sources structure`},filter:{alias:`f`,array:!0,string:!0,desc:`include views with ids matching given patterns
69
69
  multiple patterns are combined with OR`},ignore:{boolean:!0,alias:`i`,desc:`continue if export fails for some views`},timeout:{type:`number`,alias:`t`,desc:`timeout for playwright (in seconds)`,default:15,nargs:1},"max-attempts":{type:`number`,desc:`max attempts to export failing view, 1 means no retry`,default:3,nargs:1},"server-url":{type:`string`,desc:`use this url instead of starting new likec4 server`,nargs:1},"chromium-sandbox":{boolean:!0,desc:`enable chromium sandbox (see Playwright docs)`,default:!1}}).epilog(`${v.bold(`Examples:`)}
70
70
  ${v.green(`$0 export png`)}
71
71
  ${v.gray(`Search for likec4 files in current directory and output PNG next to sources`)}
@@ -78,7 +78,8 @@ multiple patterns are combined with OR`},ignore:{boolean:!0,alias:`i`,desc:`cont
78
78
 
79
79
  ${v.green(`$0 export png -f "use-case*" --sequence src/likec4`)}
80
80
  ${v.gray(`Export views matching use-case* using sequence layout`)}
81
- `),handler:async e=>{Ie(e.timeout>=1,`timeout must be >= 1`),Ie(e[`max-attempts`]>=1,`max-attempts must be >= 1`),await q(),await Dt();let t=e.theme??(e.dark?`dark`:`light`);await Fn({path:e.path,useDotBin:e[`use-dot`],output:e.outdir,project:e.project,timeoutMs:e.timeout*1e3,maxAttempts:e[`max-attempts`],ignore:e.ignore===!0,outputType:e.flat?`flat`:`relative`,serverUrl:e[`server-url`],theme:t,filter:e.filter,sequence:e.seq,chromiumSandbox:e[`chromium-sandbox`]})}})}const Ln=e=>e.command({command:`export <format> [path]`,describe:`Export to images, JSON, or DrawIO`,builder:e=>o(e.usage(`${v.bold(`Usage:`)} $0 export <format> [path]`),In,En,Sn).updateStrings({"Commands:":v.bold(`Formats:`)}),handler:()=>void 0});var Rn=ke();function zn(e){return e.command({command:`lsp`,aliases:[],describe:`Start LSP server`,builder:e=>e.usage(`${v.bold(`Usage:`)} $0 lsp`).option(`log-level`,Lt).option(`verbose`,Rt).options({"node-ipc":{boolean:!0,description:`use node-ipc transport`,conflicts:[`stdio`,`socket`,`pipe`]},stdio:{boolean:!0,description:`use stdio transport`,conflicts:[`node-ipc`,`socket`,`pipe`]},socket:{number:!0,description:`use socket transport on specified port`,conflicts:[`node-ipc`,`stdio`,`pipe`],nargs:1},pipe:{string:!0,description:`use pipe transport with specified pipe name`,conflicts:[`node-ipc`,`stdio`,`socket`],nargs:1},"manual-layouts":{boolean:!0,description:`enable/disable manual layouts`,default:!0,defaultDescription:`enabled`},watch:{alias:`w`,boolean:!0,description:`enable built-in watcher`,default:!1,defaultDescription:`disabled`},telemetry:{boolean:!0,default:!0,defaultDescription:`IDE setting`,description:`enable/disable telemetry`,hidden:!0}}).option(`use-dot`,Y).showHidden().epilog(`${v.bold(`Examples:`)}
81
+ `),handler:async e=>{Re(e.timeout>=1,`timeout must be >= 1`),Re(e[`max-attempts`]>=1,`max-attempts must be >= 1`),await q(),await Ot();let t=e.theme??(e.dark?`dark`:`light`);await In({path:e.path,useDotBin:e[`use-dot`],output:e.outdir,project:e.project,timeoutMs:e.timeout*1e3,maxAttempts:e[`max-attempts`],ignore:e.ignore===!0,outputType:e.flat?`flat`:`relative`,serverUrl:e[`server-url`],theme:t,filter:e.filter,sequence:e.seq,chromiumSandbox:e[`chromium-sandbox`]})}})}const Rn=e=>e.command({command:`export <format> [path]`,describe:`Export to images, JSON, or DrawIO`,builder:e=>o(e.usage(`${v.bold(`Usage:`)} $0 export <format> [path]`),Ln,Dn,Cn).updateStrings({"Commands:":v.bold(`Formats:`)}),handler:()=>void 0}),zn=e=>e.command({command:`format [path]`,aliases:[`fmt`],describe:`Format LikeC4 source files`,builder:e=>e.positional(`path`,J).options({project:{alias:`p`,type:`string`,array:!0,desc:`select project(s) to format (repeatable)`},files:{type:`string`,array:!0,normalize:!0,coerce:e=>e.map(e=>F(e)),desc:`specific file(s) to format (repeatable)`},check:{type:`boolean`,desc:`Check if files are formatted (exit with 1 if not)`,default:!1}}),handler:async e=>{try{var t=Z();let n=H(`c4:format`),r=U(n),i=e.check,a;try{a=await C(e.path,{watch:!1})}catch(e){n.error(e instanceof Error?e.message:String(e)),process.exitCode=1;return}t.a(a);let o=e.project?.filter(Boolean),s=e.files?.filter(Boolean).map(e=>ct(e).toString());if(n.debug(`workspace: ${e.path}`),o?.length){n.debug(`projects:`);for(let e of o)n.debug(` ${e}`)}if(s?.length){n.debug(`files:`);for(let e of s)n.debug(` ${R(e)}`)}let c;try{c=await a.format({...o?.length&&{projects:o},...s?.length&&{documentUris:s}})}catch(e){n.error(e instanceof Error?e.message:String(e)),process.exitCode=1;return}n.debug(`${c.size} document(s) to process`);let l=process.cwd(),u=e=>{let t=P(l,e);return t.startsWith(`..`)?e:t};if(s){let e=s.filter(e=>!c.has(e));for(let t of e)n.warn(`${v.yellow(`skipped`)} ${u(R(t))} (not found in workspace)`)}let d=0,f=0,p=[];for(let[e,t]of c){let r=R(e),a=u(r),o;try{o=await Ge(r,`utf-8`)}catch(e){n.error(`Failed to read ${a}: ${e}`),f++;continue}if(o===t){n.debug(`${v.dim(`unchanged`)} ${a}`);continue}if(d++,p.push(a),i)n.info(`${v.yellow(`needs formatting`)} ${a}`);else try{await k(r,t,`utf-8`),n.info(`${v.green(`formatted`)} ${a}`)}catch(e){n.error(`Failed to write ${a}: ${e}`),f++}}if(f>0){n.error(`${f} file(s) failed to process`),process.exitCode=1;return}if(i){if(d>0){n.error(`${d} of ${c.size} file(s) need formatting:\n${p.map(e=>` ${e}`).join(`
82
+ `)}`),process.exitCode=1;return}n.info(v.green(`All ${c.size} file(s) are formatted`))}else d>0?n.info(`${v.green(String(d))} of ${c.size} file(s) formatted`):n.info(v.green(`All ${c.size} file(s) already formatted`));r.stopAndLog(`✓ format in `)}catch(e){t.e=e}finally{await t.d()}}});var Bn=je();function Vn(e){return e.command({command:`lsp`,aliases:[],describe:`Start LSP server`,builder:e=>e.usage(`${v.bold(`Usage:`)} $0 lsp`).option(`log-level`,Rt).option(`verbose`,zt).options({"node-ipc":{boolean:!0,description:`use node-ipc transport`,conflicts:[`stdio`,`socket`,`pipe`]},stdio:{boolean:!0,description:`use stdio transport`,conflicts:[`node-ipc`,`socket`,`pipe`]},socket:{number:!0,description:`use socket transport on specified port`,conflicts:[`node-ipc`,`stdio`,`pipe`],nargs:1},pipe:{string:!0,description:`use pipe transport with specified pipe name`,conflicts:[`node-ipc`,`stdio`,`socket`],nargs:1},"manual-layouts":{boolean:!0,description:`enable/disable manual layouts`,default:!0,defaultDescription:`enabled`},watch:{alias:`w`,boolean:!0,description:`enable built-in watcher`,default:!1,defaultDescription:`disabled`},telemetry:{boolean:!0,default:!0,defaultDescription:`IDE setting`,description:`enable/disable telemetry`,hidden:!0}}).option(`use-dot`,Y).showHidden().epilog(`${v.bold(`Examples:`)}
82
83
 
83
84
  ${v.green(`$0 lsp --stdio `)}
84
85
  ${v.gray(`Start LSP with stdio transport`)}
@@ -86,14 +87,14 @@ ${v.gray(`Start LSP with stdio transport`)}
86
87
  ${v.green(`$0 lsp --node-ipc --watch --no-manual-layouts --no-color `)}
87
88
  ${v.gray(`Start LSP with node-ipc transport and watcher, disabled manual layouts and disabled color`)}
88
89
 
89
- `),handler:e=>{let t;if(e.nodeIpc||e.stdio||e.socket||e.pipe)t=(0,Rn.createConnection)(Rn.ProposedFeatures.all);else throw Error(`No transport specified`);m({lspConnection:t,useStdErr:e.stdio===!0,colors:v.isColorSupported,enableTelemetry:e.telemetry,logLevel:e.verbose?zt:e.logLevel}),p({connection:t,enableManualLayouts:e.manualLayouts,enableWatcher:e.watch,graphviz:e.useDot?`binary`:`wasm`,configureLogger:!1})}})}const Bn=e=>e.command({command:`mcp [path]`,aliases:[],describe:`Start MCP server`,builder:e=>e.usage(`${v.bold(`Usage:`)} $0 mcp [path]`).positional(`path`,J).default(`path`,`.`,`current directory`).option(`stdio`,{boolean:!0,description:`use stdio transport`,conflicts:[`http`,`port`]}).option(`http`,{boolean:!0,description:`use streamable http transport (use 33335 port by default)`,conflicts:`stdio`}).option(`port`,{alias:`p`,number:!0,description:`enables http transport and sets the port`,conflicts:`stdio`}).option(`use-dot`,Y).option(`log-level`,Lt).option(`verbose`,Rt).showHidden().epilog(`${v.bold(`Examples:`)}
90
+ `),handler:e=>{let t;if(e.nodeIpc||e.stdio||e.socket||e.pipe)t=(0,Bn.createConnection)(Bn.ProposedFeatures.all);else throw Error(`No transport specified`);m({lspConnection:t,useStdErr:e.stdio===!0,colors:v.isColorSupported,enableTelemetry:e.telemetry,logLevel:e.verbose?Bt:e.logLevel}),p({connection:t,enableManualLayouts:e.manualLayouts,enableWatcher:e.watch,graphviz:e.useDot?`binary`:`wasm`,configureLogger:!1})}})}const Hn=e=>e.command({command:`mcp [path]`,aliases:[],describe:`Start MCP server`,builder:e=>e.usage(`${v.bold(`Usage:`)} $0 mcp [path]`).positional(`path`,J).default(`path`,`.`,`current directory`).option(`stdio`,{boolean:!0,description:`use stdio transport`,conflicts:[`http`,`port`]}).option(`http`,{boolean:!0,description:`use streamable http transport (use 33335 port by default)`,conflicts:`stdio`}).option(`port`,{alias:`p`,number:!0,description:`enables http transport and sets the port`,conflicts:`stdio`}).option(`use-dot`,Y).option(`log-level`,Rt).option(`verbose`,zt).showHidden().epilog(`${v.bold(`Examples:`)}
90
91
  ${v.green(`$0 mcp`)}
91
92
  ${v.gray(`Start MCP with default stdio transport`)}
92
93
  ${v.green(`$0 mcp --http ./src`)}
93
94
  ${v.gray(`Start MCP with streamable http transport on port 33335 at ./src folder`)}
94
95
  ${v.green(`$0 mcp -p 1234`)}
95
96
  ${v.gray(`Start MCP with streamable http transport on port 1234`)}
96
- `),handler:async e=>{e.http||e.port?(m({colors:v.isColorSupported,logLevel:e.verbose?zt:e.logLevel}),await Vn(e.path,e.useDot,e.port)):(m({useStdErr:!0,logLevel:e.verbose?zt:e.logLevel}),await Hn(e.path,e.useDot))}});async function Vn(e,t,n=33335){await T(e,{mcp:{port:n},watch:!0,configureLogger:!1,graphviz:t?`binary`:`wasm`}),K([v.green(`LikeC4 MCP served at:`),`
97
+ `),handler:async e=>{e.http||e.port?(m({colors:v.isColorSupported,logLevel:e.verbose?Bt:e.logLevel}),await Un(e.path,e.useDot,e.port)):(m({useStdErr:!0,logLevel:e.verbose?Bt:e.logLevel}),await Wn(e.path,e.useDot))}});async function Un(e,t,n=33335){await be(e,{mcp:{port:n},watch:!0,configureLogger:!1,graphviz:t?`binary`:`wasm`}),W([v.green(`LikeC4 MCP served at:`),`
97
98
  {
98
99
  "mcpServers": {
99
100
  "likec4": {
@@ -105,6 +106,6 @@ ${v.green(`$0 mcp -p 1234`)}
105
106
  ${v.dim(`Documentation:`)}
106
107
  ${v.underline(`https://likec4.dev/tooling/mcp/#using-extension`)}
107
108
  `].join(`
108
- `))}async function Hn(e,t){await T(e,{mcp:`stdio`,watch:!0,configureLogger:!1,graphviz:t?`binary`:`wasm`})}async function Un(e){let t=await St({...e,likec4AssetsDir:``,webcomponentPrefix:void 0}),n=await Oe({port:E(62001,62010)}),r=e?.open??!1;return await lt({...t,customLogger:t.customLogger,mode:`production`,preview:{host:e.listen??`127.0.0.1`,allowedHosts:!0,port:n,open:r}})}async function Wn({path:e,output:t,base:n,listen:r}){kn(await Un({base:n,languageServices:await C(e,{watch:!1}),outputDir:t,open:!w(),listen:r}))}const Gn=e=>e.command({command:`preview [path]`,describe:`Start local server to preview production build`,builder:e=>e.positional(`path`,{type:`string`,desc:`Directory with LikeC4 source files
109
- if not specified search in current directory`,normalize:!0}).options({output:{alias:`o`,type:`string`,desc:`output directory from production build`,normalize:!0},base:{type:`string`,desc:`base url the app is being served from`},listen:{alias:`l`,type:`string`,desc:`ip address of the network interface to listen on`}}).coerce([`path`,`output`],O).default(`path`,O(`.`),`.`).default(`listen`,`127.0.0.1`,`localhost`),handler:async e=>{await Wn(e)}});async function Kn({path:e,useDotBin:t,webcomponentPrefix:n,title:r,useHashHistory:i,enableWebcomponent:a=!0,enableHMR:o=!0,base:s,listen:c,port:l}){o&&(process.env.NODE_ENV=`development`);let u=await An({buildWebcomponent:a,hmr:o,base:s,webcomponentPrefix:n,title:r,languageServices:await C(e,{graphviz:t?`binary`:`wasm`,watch:o}),useHashHistory:i,likec4AssetsDir:await A(I(D(),`.likec4-assets-`)),listen:c,port:l});u.config.logger.clearScreen(`info`),kn(u)}const qn=e=>e.command({command:`start [path]`,aliases:[`serve`,`dev`],describe:`Start local dev server to preview LikeC4 views`,builder:e=>e.positional(`path`,J).option(`base`,Nt).option(`webcomponent-prefix`,jt).option(`title`,Mt).option(`use-hash-history`,kt).option(`use-dot`,Y).option(`listen`,Ft).option(`port`,It).options({"react-hmr":{type:`boolean`,default:!0,describe:`Enable/Disable React HMR`},"build-webcomponent":{type:`boolean`,default:!0,describe:`Enable/Disable Webcomponent build`}}),handler:async e=>{await q(),await Kn({path:e.path,useDotBin:e[`use-dot`],base:e.base,webcomponentPrefix:e[`webcomponent-prefix`],title:e.title,useHashHistory:e[`use-hash-history`],listen:e.listen,port:e.port,enableHMR:e[`react-hmr`],enableWebcomponent:e[`build-webcomponent`]})}});function Jn(e){return e.getErrors().length===0}async function Yn(e,t,n){let r=await t.diagrams(),i=!1;for(let t of r)t.drifts&&t.drifts.length>0&&(i=!0,n.error(v.red(`Layout drift detected on view '${t.id}' at ${R(e,t.sourcePath??`.`)}`)));return!i}const Xn=e=>e.command({command:`validate [path]`,aliases:[],describe:`Validate model syntax and manual layout`,builder:e=>e.positional(`path`,J).option(`ignore-layout`,{alias:[`skip-layout`],boolean:!0,default:!1,description:`do not validate layout of views`}),handler:async e=>{let t=W(`c4:validate`),n=e[`ignore-layout`],r=await C(e.path,{watch:!1}),i=Jn(r);i&&=n||await Yn(e.path,r,t)}});function Zn(e){let t=e??(ye?`trace`:`info`);f({reset:!0,sinks:{console:h({formatter:v.isColorSupported?_():d()})},loggers:[{category:`likec4`,sinks:[`console`],lowestLevel:t}]})}async function Qn(){!ye&&!w()&&await Wt(),await o(rt(it($e)),qn,Bt,on,Ln,Gn,Xn,Bn,zn,qt,e=>e.command({command:`completion`,describe:`Generate completion script`,handler:()=>{e.showCompletionScript()}})).scriptName(`likec4`).usage(`Usage: $0 <command>`).version(H).alias(`v`,`version`).alias(`h`,`help`).help(`help`).option(`log-level`,{...Lt,global:!1}).option(`verbose`,{...Rt,global:!1}).option(`color`,{boolean:!0,describe:[`force color output, or disable with --no-color`,`respects 'FORCE_COLOR' and 'NO_COLOR' env variables`].join(`
110
- `),skipValidation:!0,global:!0}).demandCommand(1,`Please run with valid command`).recommendCommands().showHelpOnFail(!0).updateStrings({"Options:":v.bold(`Options:`),"Positionals:":v.bold(`Arguments:`),"Commands:":v.bold(`Commands:`),"Examples:":v.bold(`Examples:`)}).wrap(t(nt.columns-10,{min:60,max:180})).middleware(e=>{Zn(e.verbose?zt:e.logLevel)}).parseAsync()}function $n(e,t){console.error(t==null?g(e):`${t} ${g(e)}`),et(1)}Qn().catch($n),process.on(`unhandledRejection`,e=>{$n(e,`Unhandled rejection:`)}),process.on(`uncaughtException`,e=>{console.error(e)});export{};
109
+ `))}async function Wn(e,t){await be(e,{mcp:`stdio`,watch:!0,configureLogger:!1,graphviz:t?`binary`:`wasm`})}async function Gn(e){let t=await Ct({...e,likec4AssetsDir:``,webcomponentPrefix:void 0}),n=await Ae({port:ke(62001,62010)}),r=e?.open??!1;return await ft({...t,customLogger:t.customLogger,mode:`production`,preview:{host:e.listen??`127.0.0.1`,allowedHosts:!0,port:n,open:r}})}async function Kn({path:e,output:t,base:n,listen:r}){An(await Gn({base:n,languageServices:await C(e,{watch:!1}),outputDir:t,open:!w(),listen:r}))}const qn=e=>e.command({command:`preview [path]`,describe:`Start local server to preview production build`,builder:e=>e.positional(`path`,{type:`string`,desc:`Directory with LikeC4 source files
110
+ if not specified search in current directory`,normalize:!0}).options({output:{alias:`o`,type:`string`,desc:`output directory from production build`,normalize:!0},base:{type:`string`,desc:`base url the app is being served from`},listen:{alias:`l`,type:`string`,desc:`ip address of the network interface to listen on`}}).coerce([`path`,`output`],E).default(`path`,E(`.`),`.`).default(`listen`,`127.0.0.1`,`localhost`),handler:async e=>{await Kn(e)}});async function Jn({path:e,useDotBin:t,webcomponentPrefix:n,title:r,useHashHistory:i,enableWebcomponent:a=!0,enableHMR:o=!0,base:s,listen:c,port:l}){o&&(process.env.NODE_ENV=`development`);let u=await jn({buildWebcomponent:a,hmr:o,base:s,webcomponentPrefix:n,title:r,languageServices:await C(e,{graphviz:t?`binary`:`wasm`,watch:o}),useHashHistory:i,likec4AssetsDir:await O(N(T(),`.likec4-assets-`)),listen:c,port:l});u.config.logger.clearScreen(`info`),An(u)}const Yn=e=>e.command({command:`start [path]`,aliases:[`serve`,`dev`],describe:`Start local dev server to preview LikeC4 views`,builder:e=>e.positional(`path`,J).option(`base`,Pt).option(`webcomponent-prefix`,Mt).option(`title`,Nt).option(`use-hash-history`,At).option(`use-dot`,Y).option(`listen`,It).option(`port`,Lt).options({"react-hmr":{type:`boolean`,default:!0,describe:`Enable/Disable React HMR`},"build-webcomponent":{type:`boolean`,default:!0,describe:`Enable/Disable Webcomponent build`}}),handler:async e=>{await q(),await Jn({path:e.path,useDotBin:e[`use-dot`],base:e.base,webcomponentPrefix:e[`webcomponent-prefix`],title:e.title,useHashHistory:e[`use-hash-history`],listen:e.listen,port:e.port,enableHMR:e[`react-hmr`],enableWebcomponent:e[`build-webcomponent`]})}});function Xn(e){return e.getErrors().length===0}async function Zn(e,t,n){let r=await t.diagrams(),i=!1;for(let t of r)t.drifts&&t.drifts.length>0&&(i=!0,n.error(v.red(`Layout drift detected on view '${t.id}' at ${F(e,t.sourcePath??`.`)}`)));return!i}const Qn=e=>e.command({command:`validate [path]`,aliases:[],describe:`Validate model syntax and manual layout`,builder:e=>e.positional(`path`,J).option(`ignore-layout`,{alias:[`skip-layout`],boolean:!0,default:!1,description:`do not validate layout of views`}),handler:async e=>{let t=H(`c4:validate`),n=e[`ignore-layout`],r=await C(e.path,{watch:!1}),i=Xn(r);i&&=n||await Zn(e.path,r,t)}});function $n(e){let t=e??(ye?`trace`:`info`);f({reset:!0,sinks:{console:h({formatter:v.isColorSupported?_():d()})},loggers:[{category:`likec4`,sinks:[`console`],lowestLevel:t}]})}async function er(){!ye&&!w()&&await Gt(),await o(ot(st(nt)),Yn,Vt,sn,Rn,zn,qn,Qn,Hn,Vn,Jt,e=>e.command({command:`completion`,describe:`Generate completion script`,handler:()=>{e.showCompletionScript()}})).scriptName(`likec4`).usage(`Usage: $0 <command>`).version(B).alias(`v`,`version`).alias(`h`,`help`).help(`help`).option(`log-level`,{...Rt,global:!1}).option(`verbose`,{...zt,global:!1}).option(`color`,{boolean:!0,describe:[`force color output, or disable with --no-color`,`respects 'FORCE_COLOR' and 'NO_COLOR' env variables`].join(`
111
+ `),skipValidation:!0,global:!0}).demandCommand(1,`Please run with valid command`).recommendCommands().showHelpOnFail(!0).updateStrings({"Options:":v.bold(`Options:`),"Positionals:":v.bold(`Arguments:`),"Commands:":v.bold(`Commands:`),"Examples:":v.bold(`Examples:`)}).wrap(t(at.columns-10,{min:60,max:180})).middleware(e=>{$n(e.verbose?Bt:e.logLevel)}).parseAsync()}function tr(e,t){console.error(t==null?g(e):`${t} ${g(e)}`),rt(1)}er().catch(tr),process.on(`unhandledRejection`,e=>{tr(e,`Unhandled rejection:`)}),process.on(`uncaughtException`,e=>{console.error(e)});export{};
package/dist/index.d.mts CHANGED
@@ -892,8 +892,39 @@ declare class LikeC4$1 {
892
892
  * @returns a function to dispose the listener
893
893
  */
894
894
  onModelUpdate(listener: () => void): () => void;
895
+ /**
896
+ * Formats documents and returns a map of document URI → formatted source text.
897
+ *
898
+ * Target selection uses union semantics:
899
+ * - Omit both `projects` and `documentUris` to format **all** documents.
900
+ * - Provide `projects` to include all documents from those projects.
901
+ * - Provide `documentUris` to include specific documents.
902
+ * - Provide both to format the **union** (deduplicated).
903
+ */
904
+ format(options?: LikeC4FormatOptions): Promise<Map<string, string>>;
895
905
  dispose(): Promise<void>;
896
906
  [Symbol.asyncDispose](): Promise<void>;
907
+ }
908
+ /**
909
+ * Options for {@link LikeC4.format}.
910
+ *
911
+ * Same as {@link FormatOptions} but uses project name strings instead of {@link ProjectId}.
912
+ */
913
+ interface LikeC4FormatOptions {
914
+ /** Include all documents from these projects (by name). */
915
+ projects?: ReadonlyArray<string>;
916
+ /** Include these specific documents (by URI string). */
917
+ documentUris?: ReadonlyArray<string>;
918
+ /** Size of a tab in spaces (default: 2). */
919
+ tabSize?: number;
920
+ /** Prefer spaces over tabs (default: true). */
921
+ insertSpaces?: boolean;
922
+ /** Trim trailing whitespace on a line. */
923
+ trimTrailingWhitespace?: boolean;
924
+ /** Insert a newline character at the end of the file if one does not exist. */
925
+ insertFinalNewline?: boolean;
926
+ /** Trim all newlines after the final newline at the end of the file. */
927
+ trimFinalNewlines?: boolean;
897
928
  } //#endregion
898
929
  //#region src/common/options.d.ts
899
930
  //#endregion
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import"./_chunks/libs/remeda.mjs";import"./_chunks/libs/@logtape/logtape.mjs";import"./_chunks/libs/merge-error-cause.mjs";import"./_chunks/libs/is-error-instance.mjs";import"./_chunks/libs/is-plain-obj.mjs";import"./_chunks/libs/safe-stringify.mjs";import"./_chunks/filesystem.mjs";import"./_chunks/libs/defu.mjs";import"./_chunks/libs/pathe.mjs";import"./_chunks/libs/tinyrainbow.mjs";import"./_chunks/libs/json5.mjs";import"./_chunks/libs/@hono/mcp.mjs";import"./_chunks/src.mjs";import"./_chunks/libs/langium.mjs";import"./_chunks/libs/@chevrotain/regexp-to-ast.mjs";import"./_chunks/libs/chevrotain.mjs";import"./_chunks/libs/@chevrotain/cst-dts-gen.mjs";import"./_chunks/libs/@chevrotain/utils.mjs";import"./_chunks/libs/chevrotain-allstar.mjs";import"./_chunks/libs/fast-equals.mjs";import"./_chunks/sequence.mjs";import"./_chunks/libs/@lume/kiwi.mjs";import"./_chunks/libs/ts-graphviz.mjs";import"./_chunks/libs/word-wrap.mjs";import"./_chunks/libs/khroma.mjs";import"./_chunks/libs/p-limit.mjs";import"./_chunks/libs/eventemitter3.mjs";import"./_chunks/libs/p-queue.mjs";import"./_chunks/libs/isexe.mjs";import"./_chunks/libs/which.mjs";import"./_chunks/libs/@modelcontextprotocol/sdk.mjs";import"./_chunks/libs/picomatch.mjs";import"./_chunks/libs/ufo.mjs";import"./_chunks/libs/parse-ms.mjs";import"./_chunks/libs/pretty-ms.mjs";import"./_chunks/libs/@hono/node-server.mjs";import"./_chunks/libs/@msgpack/msgpack.mjs";import"./_chunks/libs/@smithy/is-array-buffer.mjs";import"./_chunks/libs/@smithy/util-base64.mjs";import"./_chunks/libs/strip-indent.mjs";import{t as e}from"./_chunks/LikeC4.mjs";export{e as LikeC4};
1
+ import"./_chunks/libs/remeda.mjs";import"./_chunks/libs/@logtape/logtape.mjs";import"./_chunks/libs/merge-error-cause.mjs";import"./_chunks/libs/is-error-instance.mjs";import"./_chunks/libs/is-plain-obj.mjs";import"./_chunks/libs/safe-stringify.mjs";import"./_chunks/filesystem.mjs";import"./_chunks/libs/defu.mjs";import"./_chunks/libs/pathe.mjs";import"./_chunks/libs/tinyrainbow.mjs";import"./_chunks/libs/json5.mjs";import"./_chunks/libs/@hono/mcp.mjs";import"./_chunks/src.mjs";import"./_chunks/libs/langium.mjs";import"./_chunks/libs/@chevrotain/regexp-to-ast.mjs";import"./_chunks/libs/chevrotain.mjs";import"./_chunks/libs/@chevrotain/cst-dts-gen.mjs";import"./_chunks/libs/@chevrotain/utils.mjs";import"./_chunks/libs/chevrotain-allstar.mjs";import"./_chunks/sequence.mjs";import"./_chunks/libs/@lume/kiwi.mjs";import"./_chunks/libs/ts-graphviz.mjs";import"./_chunks/libs/word-wrap.mjs";import"./_chunks/libs/khroma.mjs";import"./_chunks/libs/p-limit.mjs";import"./_chunks/libs/eventemitter3.mjs";import"./_chunks/libs/p-queue.mjs";import"./_chunks/libs/isexe.mjs";import"./_chunks/libs/which.mjs";import"./_chunks/libs/@modelcontextprotocol/sdk.mjs";import"./_chunks/libs/picomatch.mjs";import"./_chunks/libs/ufo.mjs";import"./_chunks/libs/parse-ms.mjs";import"./_chunks/libs/pretty-ms.mjs";import"./_chunks/libs/@hono/node-server.mjs";import"./_chunks/libs/fast-equals.mjs";import"./_chunks/libs/strip-indent.mjs";import{t as e}from"./_chunks/LikeC4.mjs";export{e as LikeC4};
@@ -1 +1 @@
1
- import"../_chunks/libs/birpc.mjs";import"../_chunks/libs/remeda.mjs";import"../_chunks/libs/@logtape/logtape.mjs";import"../_chunks/libs/merge-error-cause.mjs";import"../_chunks/libs/is-error-instance.mjs";import"../_chunks/libs/is-plain-obj.mjs";import"../_chunks/libs/safe-stringify.mjs";import"../_chunks/filesystem.mjs";import"../_chunks/libs/defu.mjs";import"../_chunks/libs/pathe.mjs";import"../_chunks/libs/tinyrainbow.mjs";import"../_chunks/libs/json5.mjs";import"../_chunks/libs/@hono/mcp.mjs";import"../_chunks/src.mjs";import"../_chunks/libs/langium.mjs";import"../_chunks/libs/@chevrotain/regexp-to-ast.mjs";import"../_chunks/libs/chevrotain.mjs";import"../_chunks/libs/@chevrotain/cst-dts-gen.mjs";import"../_chunks/libs/@chevrotain/utils.mjs";import"../_chunks/libs/chevrotain-allstar.mjs";import"../_chunks/libs/fast-equals.mjs";import"../_chunks/sequence.mjs";import"../_chunks/libs/@lume/kiwi.mjs";import"../_chunks/libs/ts-graphviz.mjs";import"../_chunks/libs/word-wrap.mjs";import"../_chunks/libs/khroma.mjs";import"../_chunks/libs/p-limit.mjs";import"../_chunks/libs/eventemitter3.mjs";import"../_chunks/libs/p-queue.mjs";import"../_chunks/libs/isexe.mjs";import"../_chunks/libs/which.mjs";import"../_chunks/libs/@modelcontextprotocol/sdk.mjs";import"../_chunks/libs/picomatch.mjs";import"../_chunks/libs/ufo.mjs";import"../_chunks/libs/parse-ms.mjs";import"../_chunks/libs/pretty-ms.mjs";import"../_chunks/libs/@hono/node-server.mjs";import"../_chunks/libs/@msgpack/msgpack.mjs";import"../_chunks/libs/@smithy/is-array-buffer.mjs";import"../_chunks/libs/@smithy/util-base64.mjs";import"../_chunks/libs/strip-indent.mjs";import{t as e}from"../_chunks/src2.mjs";import"../_chunks/libs/pako.mjs";export{e as LikeC4VitePlugin};
1
+ import"../_chunks/libs/birpc.mjs";import"../_chunks/libs/remeda.mjs";import"../_chunks/libs/@logtape/logtape.mjs";import"../_chunks/libs/merge-error-cause.mjs";import"../_chunks/libs/is-error-instance.mjs";import"../_chunks/libs/is-plain-obj.mjs";import"../_chunks/libs/safe-stringify.mjs";import"../_chunks/filesystem.mjs";import"../_chunks/libs/defu.mjs";import"../_chunks/libs/pathe.mjs";import"../_chunks/libs/tinyrainbow.mjs";import"../_chunks/libs/json5.mjs";import"../_chunks/libs/@hono/mcp.mjs";import"../_chunks/src.mjs";import"../_chunks/libs/langium.mjs";import"../_chunks/libs/@chevrotain/regexp-to-ast.mjs";import"../_chunks/libs/chevrotain.mjs";import"../_chunks/libs/@chevrotain/cst-dts-gen.mjs";import"../_chunks/libs/@chevrotain/utils.mjs";import"../_chunks/libs/chevrotain-allstar.mjs";import"../_chunks/sequence.mjs";import"../_chunks/libs/@lume/kiwi.mjs";import"../_chunks/libs/ts-graphviz.mjs";import"../_chunks/libs/word-wrap.mjs";import"../_chunks/libs/khroma.mjs";import"../_chunks/libs/p-limit.mjs";import"../_chunks/libs/eventemitter3.mjs";import"../_chunks/libs/p-queue.mjs";import"../_chunks/libs/isexe.mjs";import"../_chunks/libs/which.mjs";import"../_chunks/libs/@modelcontextprotocol/sdk.mjs";import"../_chunks/libs/picomatch.mjs";import"../_chunks/libs/ufo.mjs";import"../_chunks/libs/parse-ms.mjs";import"../_chunks/libs/pretty-ms.mjs";import"../_chunks/libs/@hono/node-server.mjs";import"../_chunks/libs/fast-equals.mjs";import"../_chunks/libs/strip-indent.mjs";import{t as e}from"../_chunks/src2.mjs";import"../_chunks/libs/pako.mjs";export{e as LikeC4VitePlugin};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "likec4",
3
3
  "description": "Toolchain for your architecture diagrams",
4
- "version": "1.51.0",
4
+ "version": "1.52.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://likec4.dev",
7
7
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -20,7 +20,7 @@
20
20
  "graph"
21
21
  ],
22
22
  "engines": {
23
- "node": ">=22.22.0"
23
+ "node": ">=22.22.1"
24
24
  },
25
25
  "bugs": "https://github.com/likec4/likec4/issues",
26
26
  "type": "module",
@@ -121,7 +121,7 @@
121
121
  "vite": "^7.3.1",
122
122
  "yargs": "17.7.2",
123
123
  "nano-spawn": "^2.0.0",
124
- "@likec4/core": "1.51.0",
124
+ "@likec4/core": "1.52.0",
125
125
  "@likec4/icons": "1.46.4"
126
126
  },
127
127
  "peerDependencies": {
@@ -148,9 +148,9 @@
148
148
  "@types/yargs": "^17.0.33",
149
149
  "@xstate/react": "6.0.0",
150
150
  "@xstate/store": "3.14.0",
151
- "@xyflow/react": "12.10.0",
152
- "@xyflow/system": "0.0.74",
153
- "autoprefixer": "^10.4.24",
151
+ "@xyflow/react": "12.10.1",
152
+ "@xyflow/system": "0.0.75",
153
+ "autoprefixer": "^10.4.27",
154
154
  "picomatch": "^4.0.3",
155
155
  "birpc": "^4.0.0",
156
156
  "boxen": "^8.0.1",
@@ -167,7 +167,7 @@
167
167
  "ky": "^1.14.3",
168
168
  "merge-error-cause": "^5.0.2",
169
169
  "mkdirp": "^3.0.1",
170
- "motion": "^12.34.2",
170
+ "motion": "^12.34.5",
171
171
  "npm-run-all2": "^8.0.4",
172
172
  "p-limit": "7.3.0",
173
173
  "nanostores": "1.1.0",
@@ -186,7 +186,7 @@
186
186
  "strip-indent": "^4.1.1",
187
187
  "tinyrainbow": "^2.0.0",
188
188
  "tsx": "4.21.0",
189
- "turbo": "2.8.12",
189
+ "turbo": "2.8.13",
190
190
  "typescript": "5.9.3",
191
191
  "ufo": "1.6.3",
192
192
  "obuild": "^0.4.31",
@@ -202,19 +202,19 @@
202
202
  "zod": "^3.25.76",
203
203
  "zx": "8.8.5",
204
204
  "xstate": "5.24.0",
205
- "@likec4/config": "1.51.0",
206
- "@likec4/log": "1.51.0",
207
- "@likec4/language-server": "1.51.0",
208
- "@likec4/language-services": "1.51.0",
205
+ "@likec4/config": "1.52.0",
206
+ "@likec4/language-server": "1.52.0",
207
+ "@likec4/log": "1.52.0",
208
+ "@likec4/language-services": "1.52.0",
209
209
  "@likec4/devops": "1.42.0",
210
- "@likec4/diagram": "1.51.0",
211
- "@likec4/layouts": "1.51.0",
212
- "@likec4/vite-plugin": "1.51.0",
213
- "@likec4/react": "1.51.0",
214
- "@likec4/generators": "1.51.0",
215
- "@likec4/style-preset": "1.51.0",
216
- "@likec4/tsconfig": "1.51.0",
217
- "@likec4/styles": "1.51.0"
210
+ "@likec4/diagram": "1.52.0",
211
+ "@likec4/layouts": "1.52.0",
212
+ "@likec4/vite-plugin": "1.52.0",
213
+ "@likec4/react": "1.52.0",
214
+ "@likec4/generators": "1.52.0",
215
+ "@likec4/style-preset": "1.52.0",
216
+ "@likec4/tsconfig": "1.52.0",
217
+ "@likec4/styles": "1.52.0"
218
218
  },
219
219
  "scripts": {
220
220
  "typecheck": "tsc --build --verbose",