likec4 1.27.2 → 1.27.3

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import{h as tt,k as gh,o as at,q as ws,d as zt,u as ee,w as yh,r as _h,s as $h,v as St,t as vh,e as ea,x as ta,c as wh,L as rt,y as bh,z as nt,A as Eh,B as Sh,n as Rh,D as Ah,E as Gt,F as ra,G as Oh,H as or,I as bs,J as na,K as Ch,Y as Ph}from"../shared/likec4.D_S6au6n.mjs";import Re,{hrtime as Ih,cwd as Es,exit as sa,stdout as Th,argv as Nh}from"node:process";import{strictEqual as jh,notStrictEqual as Lh}from"assert";import Ss,{resolve as Ue,dirname as Rs,normalize as Dh,relative as kh,extname as Mh,
2
+ import{h as tt,k as gh,o as at,q as ws,d as zt,u as ee,w as yh,r as _h,s as $h,v as St,t as vh,e as ea,x as ta,c as wh,L as rt,y as bh,z as nt,A as Eh,B as Sh,n as Rh,D as Ah,E as Gt,F as ra,G as Oh,H as or,I as bs,J as na,K as Ch,Y as Ph}from"../shared/likec4.CY1x3B5z.mjs";import Re,{hrtime as Ih,cwd as Es,exit as sa,stdout as Th,argv as Nh}from"node:process";import{strictEqual as jh,notStrictEqual as Lh}from"assert";import Ss,{resolve as Ue,dirname as Rs,normalize as Dh,relative as kh,extname as Mh,
3
3
  basename as xh}from"path";import{statSync as ia,readdirSync as qh,readFileSync as As,writeFile as Hh}from"fs";import oa,{format as aa,inspect as Uh}from"util";import{fileURLToPath as Fh}from"url";import $e,{resolve as ge,dirname as Rt,join as ar,relative as At,extname as cr,isAbsolute as Os,basename as Lr}from"node:path";import pe,{existsSync as Ot,copyFileSync as ca,readdirSync as Vh,rmSync as Cs}from"node:fs";import{mkdtemp as Dr,writeFile as Ct,mkdir as ct,stat as Ps,copyFile as zh,rm as Gh}from"node:fs/promises";
4
- import ur,{tmpdir as kr}from"node:os";import{fileURLToPath as ua}from"node:url";import Is from"@vitejs/plugin-react";import{C as la,t as Ts,j as fa,e as da,N as Bt,L as Ns,g as Bh,a as Wh}from"../shared/likec4.CfxVv3pJ.mjs";import{build as lr,createServer as Kh,preview as Yh}from"vite";import{sortNaturalByFqn as ha,compareNatural as Xh,hasAtLeast as Jh,invariant as js,nonexhaustive as pa,delay as ma}from"@likec4/core";import{chromium as ga}from"playwright";import Qh from"node:net";import{setTimeout as Zh}from"node:timers/promises";
4
+ import ur,{tmpdir as kr}from"node:os";import{fileURLToPath as ua}from"node:url";import Is from"@vitejs/plugin-react";import{C as la,t as Ts,j as fa,e as da,N as Bt,L as Ns,g as Bh,a as Wh}from"../shared/likec4.sbYSTpRI.mjs";import{build as lr,createServer as Kh,preview as Yh}from"vite";import{sortNaturalByFqn as ha,compareNatural as Xh,hasAtLeast as Jh,invariant as js,nonexhaustive as pa,delay as ma}from"@likec4/core";import{chromium as ga}from"playwright";import Qh from"node:net";import{setTimeout as Zh}from"node:timers/promises";
5
5
  import{promisify as Ie,isDeepStrictEqual as ep}from"node:util";import fr from"node:crypto";import tp from"node:assert";import"tty";import"os";import"crypto";import"net";import"child_process";import"@likec4/core/types";import"events";import"buffer";import"@hpcc-js/wasm-graphviz";import"@likec4/core/compute-view";import"@likec4/core/utils";import"boxen";import"node:child_process";import"node:events";import"node:stream/promises";import"fs/promises";import"@likec4/core/model";const rp={right:cp,center:up},
6
6
  np=0,Mr=1,sp=2,xr=3;class ip{constructor(e){var r;this.width=e.width,this.wrap=(r=e.wrap)!==null&&r!==void 0?r:!0,this.rows=[]}span(...e){const r=this.div(...e);r.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);const r=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(r),r}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.
7
7
  test(e[0])}applyLayoutDSL(e){const r=e.split(`
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import"@likec4/core";export{LikeC4DeploymentModel,LikeC4Model,LikeC4ViewModel}from"@likec4/core/model";export{L as LikeC4}from"./shared/likec4.D_S6au6n.mjs";import"node:fs";import"node:path";import"node:url";import"tty";import"node:util";import"util";import"path";import"os";import"crypto";import"net";import"url";import"fs";import"child_process";import"@likec4/core/types";import"events";import"buffer";import"@hpcc-js/wasm-graphviz";import"@likec4/core/compute-view";import"@likec4/core/utils";import"node:process";
1
+ import"@likec4/core";export{LikeC4DeploymentModel,LikeC4Model,LikeC4ViewModel}from"@likec4/core/model";export{L as LikeC4}from"./shared/likec4.CY1x3B5z.mjs";import"node:fs";import"node:path";import"node:url";import"tty";import"node:util";import"util";import"path";import"os";import"crypto";import"net";import"url";import"fs";import"child_process";import"@likec4/core/types";import"events";import"buffer";import"@hpcc-js/wasm-graphviz";import"@likec4/core/compute-view";import"@likec4/core/utils";import"node:process";
2
2
  import"boxen";import"node:child_process";import"node:events";import"node:fs/promises";import"node:stream/promises";import"node:os";import"fs/promises";
@@ -2176,7 +2176,7 @@ class dV{dotpath;unflattenpath;constructor(e){this.dotpath=e||ZS.sync("dot"),thi
2176
2176
  exitCode}): "${i.stderr}"`,r=i.stdout)}return r&&(e=r.replaceAll(/\t\[/g," [").replaceAll(/\t/g," ")),e})}async layoutJson(e){return await Xw(async()=>{const n=vn.getChild("graphviz-binary");let r;try{const i=await Ld(this.dotpath,["-Tjson","-y"],{timeout:1e4,stdin:{string:e}});r=i.stdout,jt(i.stderr)||n.warn`Command ${i.command} has stderr:\n${i.stderr}`}catch(i){if(n.error("FAILED GraphvizBinaryAdapter.layoutJson",{error:i}),n.warn(`FAILED DOT:
2177
2177
  ${e}`),i instanceof Ro&&!jt(i.stdout))n.warn(`Command: '${i.command}' returned result but also failed (exitcode ${i.exitCode}): "${i.stderr}"`),r=i.stdout;else throw i}return r})}async acyclic(e){return Promise.reject(new Error("Method not implemented."))}async svg(e){return await Xw(async()=>{const n=vn.getChild("graphviz-binary");let r;try{const i=await Ld(this.dotpath,["-Tsvg","-y"],{timeout:1e4,stdin:{string:e}});r=i.stdout,jt(i.stderr)||n.warn`Command ${i.command} has stderr:\n${i.stderr}`}catch(i){
2178
2178
  if(n.error("FAILED GraphvizBinaryAdapter.svg",{error:i}),n.warn(`FAILED DOT:
2179
- ${e}`),i instanceof Ro&&!jt(i.stdout))n.warn`Command: '${i.command}' returned result but also failed (exitcode ${i.exitCode}): "${i.stderr}"`,r=i.stdout;else throw i}return r})}}const fV="likec4",e_="1.27.2",Yw=vn.getChild("cli");Gt.bold(Gt.bgRed(Gt.white("ERROR"))),Gt.bold(Gt.yellow("WARN")),Gt.bold(Gt.green("INFO"));function t_(t){const e=vn.getChild(t);return{info(n){e.info(n)},warn(n){if(n instanceof Error){e.warn(`${Gt.red(n.name+" "+n.message)}`,{msg:n});return}if(typeof n=="string"){e.warn(
2179
+ ${e}`),i instanceof Ro&&!jt(i.stdout))n.warn`Command: '${i.command}' returned result but also failed (exitcode ${i.exitCode}): "${i.stderr}"`,r=i.stdout;else throw i}return r})}}const fV="likec4",e_="1.27.3",Yw=vn.getChild("cli");Gt.bold(Gt.bgRed(Gt.white("ERROR"))),Gt.bold(Gt.yellow("WARN")),Gt.bold(Gt.green("INFO"));function t_(t){const e=vn.getChild(t);return{info(n){e.info(n)},warn(n){if(n instanceof Error){e.warn(`${Gt.red(n.name+" "+n.message)}`,{msg:n});return}if(typeof n=="string"){e.warn(
2180
2180
  n);return}e.warn`${n}`},warnOnce(n){e.warn(n)},error(n,r){let i=r?.error??n;if(i instanceof Error){if(n===i){e.error(`${Gt.red(i.name+" "+i.message)}`,{error:i});return}e.error(`${n}`,{error:i});return}if(typeof n=="string"){e.error(`${Gt.red(n)}`);return}e.error`${n}`},clearScreen:function(n){},hasErrorLogged:function(n){throw new Error("Function not implemented.")},hasWarned:!1}}const Jw=()=>{},pV={info:Jw,warn:Jw,error:Jw},hV=1e6;function n_(t){const[e,n]=y0(t),r=e*1e3+n/hV;return{ms:r,pretty:rm(
2181
2181
  r)}}function mV(t){const e=y0();return{stopAndLog(n="done in "){n=Gt.green(`${n}${n_(e).pretty}`),(t||Yw).info(n)}}}function gV(t,e){console.log(G_(t,{padding:1,margin:1,dimBorder:!0,...e}))}class yV{constructor(e){this.services=e}isInitialized=!1;async initWorkspace(e){if(this.isInitialized)throw new Error("Workspace already initialized");const n=this.services.logger,r=this.services.shared.workspace.WorkspaceManager;n.info(`${Gt.dim("workspace:")} ${e.uri}`),r.initialize({capabilities:{},processId:null,
2182
2182
  rootUri:null,workspaceFolders:[e]}),await r.initializeWorkspace([e])}async init(){if(this.isInitialized)throw new Error("Workspace already initialized");this.isInitialized=!0;const e=this.services.logger;this.services.likec4.ModelBuilder;const n=this.services.shared.workspace.LangiumDocuments,r=this.services.shared.workspace.DocumentBuilder,i=n.all.toArray(),s=i.filter(o=>!vd(o.uri));if(s.length===0)throw e.error("no LikeC4 sources found"),new Error("no LikeC4 sources found");e.info(`${Gt.dim("w\
@@ -1,4 +1,4 @@
1
- import{relative as Z}from"node:path";import{f as ee,g as x,T as te,N as U,i as ne,n as _,j as S,u as m,l as ie,C as re,a as oe,b as D,c as ae,t as se,d as P,m as de,p as ce,e as O,L as le}from"./likec4.D_S6au6n.mjs";function pe(t){var e,i;if(t){if("astNode"in t)return ge(t);if(Array.isArray(t))return t.reduce(A,void 0);{const n=t,r=ue(n)?fe((i=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&i!==void 0?i:n?.astNode):void 0;return v(n,r)}}else return}function ue(t){return typeof t<"u"&&"e\
1
+ import{relative as Z}from"node:path";import{f as ee,g as x,T as te,N as U,i as ne,n as _,j as S,u as m,l as ie,C as re,a as oe,b as D,c as ae,t as se,d as P,m as de,p as ce,e as O,L as le}from"./likec4.CY1x3B5z.mjs";function pe(t){var e,i;if(t){if("astNode"in t)return ge(t);if(Array.isArray(t))return t.reduce(A,void 0);{const n=t,r=ue(n)?fe((i=(e=n?.root)===null||e===void 0?void 0:e.astNode)!==null&&i!==void 0?i:n?.astNode):void 0;return v(n,r)}}else return}function ue(t){return typeof t<"u"&&"e\
2
2
  lement"in t&&"text"in t}function fe(t){try{return x(t).uri.toString()}catch{return}}function ge(t){var e,i;const{astNode:n,property:r,index:a}=t??{},o=(e=n?.$cstNode)!==null&&e!==void 0?e:n?.$textRegion;if(!(n===void 0||o===void 0)){if(r===void 0)return v(o,T(n));{const s=d=>a!==void 0&&a>-1&&Array.isArray(n[r])?a<d.length?d[a]:void 0:d.reduce(A,void 0);if(!((i=o.assignments)===null||i===void 0)&&i[r]){const d=s(o.assignments[r]);return d&&v(d,T(n))}else if(n.$cstNode){const d=s(ee(n.$cstNode,r));
3
3
  return d&&v(d,T(n))}else return}}}function T(t){var e,i,n,r;return t.$cstNode?(i=(e=x(t))===null||e===void 0?void 0:e.uri)===null||i===void 0?void 0:i.toString():t.$textRegion?t.$textRegion.documentURI||((r=(n=new te(t,a=>a.$container?[a.$container]:[]).find(a=>{var o;return(o=a.$textRegion)===null||o===void 0?void 0:o.documentURI}))===null||n===void 0?void 0:n.$textRegion)===null||r===void 0?void 0:r.documentURI):void 0}function v(t,e){var i,n;const r={offset:t.offset,end:(i=t.end)!==null&&i!==
4
4
  void 0?i:t.offset+t.length,length:(n=t.length)!==null&&n!==void 0?n:t.end-t.offset};return t.range&&(r.range=t.range),e??(e=t.fileURI),e&&(r.fileURI=e),r}function A(t,e){var i,n;if(t){if(!e)return t&&v(t)}else return e&&v(e);const r=(i=t.end)!==null&&i!==void 0?i:t.offset+t.length,a=(n=e.end)!==null&&n!==void 0?n:e.offset+e.length,o=Math.min(t.offset,e.offset),s=Math.max(r,a),d=s-o,c={offset:o,end:s,length:d};if(t.range&&e.range&&(c.range={start:e.range.start.line<t.range.start.line||e.range.start.
@@ -1,2 +1,2 @@
1
- export{L as LikeC4VitePlugin}from"../shared/likec4.CfxVv3pJ.mjs";import"node:path";import"../shared/likec4.D_S6au6n.mjs";import"node:fs";import"node:url";import"tty";import"node:util";import"util";import"path";import"os";import"crypto";import"net";import"url";import"fs";import"child_process";import"@likec4/core";import"@likec4/core/types";import"events";import"buffer";import"@hpcc-js/wasm-graphviz";import"@likec4/core/compute-view";import"@likec4/core/utils";import"node:process";import"boxen";import"node:child_process";
1
+ export{L as LikeC4VitePlugin}from"../shared/likec4.sbYSTpRI.mjs";import"node:path";import"../shared/likec4.CY1x3B5z.mjs";import"node:fs";import"node:url";import"tty";import"node:util";import"util";import"path";import"os";import"crypto";import"net";import"url";import"fs";import"child_process";import"@likec4/core";import"@likec4/core/types";import"events";import"buffer";import"@hpcc-js/wasm-graphviz";import"@likec4/core/compute-view";import"@likec4/core/utils";import"node:process";import"boxen";import"node:child_process";
2
2
  import"node:events";import"node:fs/promises";import"node:stream/promises";import"node:os";import"fs/promises";import"@likec4/core/model";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "likec4",
3
- "version": "1.27.2",
3
+ "version": "1.27.3",
4
4
  "license": "MIT",
5
5
  "homepage": "https://likec4.dev",
6
6
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -80,7 +80,7 @@
80
80
  "rollup": "^4.38.0",
81
81
  "type-fest": "^4.38.0",
82
82
  "vite": "^6.2.4",
83
- "@likec4/core": "1.27.2"
83
+ "@likec4/core": "1.27.3"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@pandacss/dev": "^0.53.3",
@@ -156,15 +156,15 @@
156
156
  "wireit": "^0.14.11",
157
157
  "which": "^5.0.0",
158
158
  "yargs": "17.7.2",
159
- "@likec4/style-preset": "1.27.2",
160
- "@likec4/styles": "1.27.2",
161
- "@likec4/diagram": "1.27.2",
162
- "@likec4/icons": "1.27.2",
163
- "@likec4/language-server": "1.27.2",
164
- "@likec4/layouts": "1.27.2",
165
- "@likec4/generators": "1.27.2",
166
- "@likec4/log": "1.27.2",
167
- "@likec4/tsconfig": "1.27.2"
159
+ "@likec4/style-preset": "1.27.3",
160
+ "@likec4/styles": "1.27.3",
161
+ "@likec4/diagram": "1.27.3",
162
+ "@likec4/icons": "1.27.3",
163
+ "@likec4/generators": "1.27.3",
164
+ "@likec4/language-server": "1.27.3",
165
+ "@likec4/log": "1.27.3",
166
+ "@likec4/tsconfig": "1.27.3",
167
+ "@likec4/layouts": "1.27.3"
168
168
  },
169
169
  "scripts": {
170
170
  "typecheck": "tsc --build --verbose",
package/react/index.d.mts CHANGED
@@ -655,12 +655,12 @@ interface DiagramNode extends ComputedNode {
655
655
  labelBBox: BBox;
656
656
  }
657
657
  declare namespace DiagramNode {
658
- function modelRef(node: DiagramNode): Fqn | null;
659
- function deploymentRef(node: DiagramNode): Fqn | null;
658
+ function modelRef(node: Pick<DiagramNode, "id" | "modelRef">): Fqn | null;
659
+ function deploymentRef(node: Pick<DiagramNode, "id" | "deploymentRef">): Fqn | null;
660
660
  /**
661
661
  * Nodes group is a special kind of node, exisiting only in view
662
662
  */
663
- function isNodesGroup(node: DiagramNode): boolean;
663
+ function isNodesGroup(node: Pick<DiagramNode, "kind">): boolean;
664
664
  }
665
665
  interface DiagramEdge extends ComputedEdge {
666
666
  points: NonEmptyArray<Point>;