likec4 1.31.0 → 1.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/__app__/react/likec4.tsx +2 -2
- package/__app__/src/const.js +2 -1
- package/__app__/src/main.js +2566 -1888
- package/__app__/src/style.css +1 -1
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +747 -735
- package/dist/index.d.mts +10 -5
- package/dist/index.mjs +2 -2
- package/dist/model/builder.d.mts +1 -0
- package/dist/model/builder.mjs +1 -0
- package/dist/model/index.d.mts +6 -4
- package/dist/model/index.mjs +2 -2
- package/dist/shared/likec4.B20Ey-3l.mjs +239 -0
- package/dist/shared/{likec4.BaUvDeNQ.d.mts → likec4.CVzYPnDX.d.mts} +1785 -120
- package/dist/shared/likec4.CbTFhAsc.mjs +2386 -0
- package/dist/vite-plugin/index.d.mts +2 -1
- package/dist/vite-plugin/index.mjs +2 -2
- package/package.json +37 -29
- package/react/index.d.mts +393 -914
- package/react/index.mjs +85 -76
- package/vite-plugin-modules.d.ts +47 -34
- package/dist/shared/likec4.CJIOuLMn.mjs +0 -2479
- package/dist/shared/likec4.Dj4xsbiA.mjs +0 -227
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LikeC4Model } from '@likec4/core/model';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
export { AbstractRelation, AutoLayoutDirection, BBox, Color, ComputedDeploymentView, ComputedDynamicView, ComputedEdge, ComputedElementView, ComputedLikeC4ModelData, ComputedNode, ComputedView, DeployedInstance, DeploymentElement, DeploymentNode, DeploymentNodeKind, DeploymentRelation, DeploymentView, DiagramEdge, DiagramNode, DiagramView, DynamicView, EdgeId, Element, ElementKind, ElementView, Fqn, HexColorLiteral, LayoutedLikeC4ModelData, LikeC4View, NodeId, ParsedLikeC4ModelData, Point, RelationExpr, RelationId, StepEdgeId, Tag, ThemeColor, ViewId, XYPoint } from '@likec4/core/types';
|
|
5
|
-
import { W as WorkspaceFolder, a as LikeC4Services, G as GraphvizLayouter, L as LikeC4LanguageServices, b as LikeC4Views, R as Range } from './shared/likec4.BaUvDeNQ.mjs';
|
|
2
|
+
import { UnknownLayouted } from './model/index.mjs';
|
|
3
|
+
import { W as WorkspaceFolder, a as LikeC4Services, G as GraphvizLayouter, L as LikeC4LanguageServices, b as LikeC4Views, R as Range } from './shared/likec4.CVzYPnDX.mjs';
|
|
6
4
|
import { ProjectId, NonEmptyArray } from '@likec4/core';
|
|
5
|
+
import { DiagramView } from '@likec4/core/types';
|
|
6
|
+
export * from '@likec4/core/types';
|
|
7
7
|
import 'type-fest';
|
|
8
8
|
import '/home/runner/work/likec4/likec4/node_modules/.pnpm/@types+picomatch@4.0.0/node_modules/@types/picomatch/posix.d.ts';
|
|
9
9
|
import '@likec4/core/utils';
|
|
@@ -140,4 +140,9 @@ declare class LikeC4 {
|
|
|
140
140
|
dispose(): void;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Used by vite plugin to generate `virtual:likec4/model`
|
|
145
|
+
*/
|
|
146
|
+
declare function createLikeC4Model(model: any): LikeC4Model<UnknownLayouted>;
|
|
147
|
+
|
|
148
|
+
export { LikeC4, type LikeC4Options, createLikeC4Model };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import"
|
|
1
|
+
import{LikeC4Model as o}from"@likec4/core/model";export{L as LikeC4}from"./shared/likec4.CbTFhAsc.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";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
|
+
import"node:events";import"node:fs/promises";import"node:stream/promises";import"node:readline/promises";import"node:os";import"fs/promises";function t(r){return o.create(r)}export{t as createLikeC4Model};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@likec4/core/builder';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"@likec4/core/builder";
|
package/dist/model/index.d.mts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { LikeC4Model } from '@likec4/core/model';
|
|
2
|
-
export {
|
|
3
|
-
|
|
2
|
+
export { Connection, ConnectionModel, DeployedInstanceModel, DeploymentConnectionModel, DeploymentElementModel, DeploymentNodeModel, DeploymentRelationModel, EdgeModel, ElementModel, LikeC4DeploymentModel, LikeC4Model, LikeC4ViewModel, NodeModel, RelationshipModel, deploymentConnection, differenceConnections, findAscendingConnections, findDeepestNestedConnection, findDescendantConnections, hasSameSource, hasSameSourceTarget, hasSameTarget, isAnyInOut, isDeployedInstanceModel, isDeploymentElementModel, isDeploymentNodeModel, isDeploymentRelationModel, isEdgeModel, isElementModel, isIncoming, isLikeC4ViewModel, isNestedConnection, isNestedElementOfDeployedInstanceModel, isNodeModel, isOutgoing, isRelationModel, mergeConnections, modelConnection, sortConnectionsByBoundaryHierarchy, sortDeepestFirst } from '@likec4/core/model';
|
|
3
|
+
import { Aux, SpecAux } from '@likec4/core/types';
|
|
4
|
+
export * from '@likec4/core/types';
|
|
4
5
|
|
|
6
|
+
type UnknownLayouted = Aux<'layouted', string, string, string, string, SpecAux<string, string, string, string, string>>;
|
|
5
7
|
/**
|
|
6
8
|
* Used by vite plugin to generate `virtual:likec4/model`
|
|
7
9
|
*/
|
|
8
|
-
declare function createLikeC4Model(model: any): LikeC4Model
|
|
10
|
+
declare function createLikeC4Model(model: any): LikeC4Model<UnknownLayouted>;
|
|
9
11
|
|
|
10
|
-
export { createLikeC4Model };
|
|
12
|
+
export { type UnknownLayouted, createLikeC4Model };
|
package/dist/model/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LikeC4Model as o}from"@likec4/core/model";export{Connection,ConnectionModel,DeployedInstanceModel,DeploymentConnectionModel,DeploymentNodeModel,DeploymentRelationModel,EdgeModel,ElementModel,LikeC4DeploymentModel,LikeC4Model,LikeC4ViewModel,NodeModel,RelationshipModel,deploymentConnection,differenceConnections,findAscendingConnections,findDeepestNestedConnection,findDescendantConnections,hasSameSource,hasSameSourceTarget,hasSameTarget,isAnyInOut,
|
|
2
|
-
isNestedConnection,isOutgoing,mergeConnections,modelConnection,sortConnectionsByBoundaryHierarchy,sortDeepestFirst}from"@likec4/core/model";
|
|
1
|
+
import{LikeC4Model as o}from"@likec4/core/model";export{Connection,ConnectionModel,DeployedInstanceModel,DeploymentConnectionModel,DeploymentNodeModel,DeploymentRelationModel,EdgeModel,ElementModel,LikeC4DeploymentModel,LikeC4Model,LikeC4ViewModel,NodeModel,RelationshipModel,deploymentConnection,differenceConnections,findAscendingConnections,findDeepestNestedConnection,findDescendantConnections,hasSameSource,hasSameSourceTarget,hasSameTarget,isAnyInOut,isDeployedInstanceModel,isDeploymentElementModel,
|
|
2
|
+
isDeploymentNodeModel,isDeploymentRelationModel,isEdgeModel,isElementModel,isIncoming,isLikeC4ViewModel,isNestedConnection,isNestedElementOfDeployedInstanceModel,isNodeModel,isOutgoing,isRelationModel,mergeConnections,modelConnection,sortConnectionsByBoundaryHierarchy,sortDeepestFirst}from"@likec4/core/model";function n(e){return o.create(e)}export{n as createLikeC4Model};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import{relative as de}from"node:path";import{f as ce,g as F,T as le,N as J,i as pe,n as b,j as x,u as N,l as ue,C as fe,m as ge,a as he,b as me,c as we,d as V,e as Ie,p as Ne,h as W,L as ye}from"./likec4.CbTFhAsc.mjs";import{compareNatural as ve}from"@likec4/core/utils";function ke(n){var e,i;if(n){if("astNode"in n)return je(n);if(Array.isArray(n))return n.reduce(G,void 0);{const t=n,r=Le(t)?$e((i=(e=t?.root)===null||e===void 0?void 0:e.astNode)!==null&&i!==void 0?i:t?.astNode):void 0;return C(t,
|
|
2
|
+
r)}}else return}function Le(n){return typeof n<"u"&&"element"in n&&"text"in n}function $e(n){try{return F(n).uri.toString()}catch{return}}function je(n){var e,i;const{astNode:t,property:r,index:a}=n??{},s=(e=t?.$cstNode)!==null&&e!==void 0?e:t?.$textRegion;if(!(t===void 0||s===void 0)){if(r===void 0)return C(s,P(t));{const o=c=>a!==void 0&&a>-1&&Array.isArray(t[r])?a<c.length?c[a]:void 0:c.reduce(G,void 0);if(!((i=s.assignments)===null||i===void 0)&&i[r]){const c=o(s.assignments[r]);return c&&C(
|
|
3
|
+
c,P(t))}else if(t.$cstNode){const c=o(ce(t.$cstNode,r));return c&&C(c,P(t))}else return}}}function P(n){var e,i,t,r;return n.$cstNode?(i=(e=F(n))===null||e===void 0?void 0:e.uri)===null||i===void 0?void 0:i.toString():n.$textRegion?n.$textRegion.documentURI||((r=(t=new le(n,a=>a.$container?[a.$container]:[]).find(a=>{var s;return(s=a.$textRegion)===null||s===void 0?void 0:s.documentURI}))===null||t===void 0?void 0:t.$textRegion)===null||r===void 0?void 0:r.documentURI):void 0}function C(n,e){var i,
|
|
4
|
+
t;const r={offset:n.offset,end:(i=n.end)!==null&&i!==void 0?i:n.offset+n.length,length:(t=n.length)!==null&&t!==void 0?t:n.end-n.offset};return n.range&&(r.range=n.range),e??(e=n.fileURI),e&&(r.fileURI=e),r}function G(n,e){var i,t;if(n){if(!e)return n&&C(n)}else return e&&C(e);const r=(i=n.end)!==null&&i!==void 0?i:n.offset+n.length,a=(t=e.end)!==null&&t!==void 0?t:e.offset+e.length,s=Math.min(n.offset,e.offset),o=Math.max(r,a),c=o-s,p={offset:s,end:o,length:c};if(n.range&&e.range&&(p.range={start:e.
|
|
5
|
+
range.start.line<n.range.start.line||e.range.start.line===n.range.start.line&&e.range.start.character<n.range.start.character?e.range.start:n.range.start,end:e.range.end.line>n.range.end.line||e.range.end.line===n.range.end.line&&e.range.end.character>n.range.end.character?e.range.end:n.range.end}),n.fileURI||e.fileURI){const u=n.fileURI,h=e.fileURI,f=u&&h&&u!==h?`<unmergable text regions of ${u}, ${h}>`:u??h;p.fileURI=f}return p}class Se{constructor(e){this.defaultIndentation=" ",this.pendingIndent=
|
|
6
|
+
!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],this.length=0,typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}get currentPosition(){return{offset:this.contentLength,line:this.
|
|
7
|
+
currentLineNumber,character:this.currentLineContent.length}}append(e,i){if(e.length>0){const t=i&&this.currentPosition;this.lines[this.currentLineNumber].push(e),this.length+=e.length,t&&this.indentPendingTraceRegions(t)}}indentPendingTraceRegions(e){for(let i=this.traceData.length-1;i>=0;i--){const t=this.traceData[i];t.targetStart&&t.targetStart.offset===e.offset&&(t.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.
|
|
8
|
+
push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join("").length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}addNewLine(){this.lines.push([]),this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}pushTraceRegion(e){const i=Ce(e,this.currentPosition,t=>{var r,a;return(a=
|
|
9
|
+
(r=this.traceData[this.traceData.length-1])===null||r===void 0?void 0:r.children)===null||a===void 0?void 0:a.push(t)});return this.traceData.push(i),i}popTraceRegion(e){const i=this.traceData.pop();return this.assertTrue(i===e,"Trace region mismatch!"),i}getParentTraceSourceFileURI(){var e;for(let i=this.traceData.length-1;i>-1;i--){const t=(e=this.traceData[i].sourceRegion)===null||e===void 0?void 0:e.fileURI;if(t)return t}}assertTrue(e,i){if(!e)throw new Error(i)}}function Ce(n,e,i){const t={
|
|
10
|
+
sourceRegion:n,targetRegion:void 0,children:[],targetStart:e,complete:r=>{var a,s;return t.targetRegion={offset:t.targetStart.offset,end:r.offset,length:r.offset-t.targetStart.offset,range:{start:{line:t.targetStart.line,character:t.targetStart.character},end:{line:r.line,character:r.character}}},delete t.targetStart,((a=t.children)===null||a===void 0?void 0:a.length)===0&&delete t.children,!((s=t.targetRegion)===null||s===void 0)&&s.length&&i(t),delete t.complete,t}};return t}function Re(n,e){const i=new Se(
|
|
11
|
+
e),t=i.pushTraceRegion(void 0);z(n,i),i.popTraceRegion(t),t.complete&&t.complete(i.currentPosition);const r=t.children&&t.children.length===1?t.children[0]:void 0,a=r?.targetRegion,s=t.targetRegion;return a&&r.sourceRegion&&a.offset===s.offset&&a.length===s.length?{text:i.content,trace:r}:{text:i.content,trace:t}}function z(n,e){typeof n=="string"?Te(n,e):n instanceof A?Ee(n,e):n instanceof g?q(n,e):n instanceof M&&Me(n,e)}function B(n,e){return typeof n=="string"?n.length!==0:n instanceof g?n.contents.
|
|
12
|
+
some(i=>B(i,e)):n instanceof M?!(n.ifNotEmpty&&e.currentLineContent.length===0):!1}function Te(n,e){n&&(Y(e,!1),e.append(n))}function Y(n,e){var i;if(n.pendingIndent){let t="";for(const r of n.relevantIndents.filter(a=>a.indentEmptyLines||!e))t+=(i=r.indentation)!==null&&i!==void 0?i:n.defaultIndentation;n.append(t,!0),n.pendingIndent=!1}}function q(n,e){let i;const t=ke(n.tracedSource);t&&(i=e.pushTraceRegion(t));for(const r of n.contents)z(r,e);if(i){e.popTraceRegion(i);const r=e.getParentTraceSourceFileURI();
|
|
13
|
+
r&&t?.fileURI===r&&delete t.fileURI,i.complete&&i.complete(e.currentPosition)}}function Ee(n,e){var i;if(B(n,e)){n.indentImmediately&&!e.pendingIndent&&e.append((i=n.indentation)!==null&&i!==void 0?i:e.defaultIndentation,!0);try{e.increaseIndent(n),q(n,e)}finally{e.decreaseIndent()}}}function Me(n,e){n.ifNotEmpty&&!be(e.currentLineContent)?e.resetCurrentLine():(Y(e,!0),e.append(n.lineDelimiter),e.addNewLine())}function be(n){return n.trimStart()!==""}Object.freeze("__\xABSKIP^NEW^LINE^IF^EMPTY\xBB__");
|
|
14
|
+
const xe=/\S|$/;function Ue(n){const e=n.filter(t=>t.length>0).map(t=>t.search(xe)),i=e.length===0?0:Math.min(...e);return Math.max(0,i)}function $(n,...e){const i=_e(n),t=Pe(n,e,i);return Ae(t)}function De(n,e,i){return(t,...r)=>Je(n,e,i)($(t,...r))}function _e(n){const e=n.join("_").split(J),i=e.length>1&&e[0].trim().length===0,t=i&&e.length>1&&e[e.length-1].trim().length===0;if(e.length===1||e.length!==0&&e[0].trim().length!==0||e.length===2&&e[1].trim().length===0)return{indentation:0,omitFirstLine:i,
|
|
15
|
+
omitLastLine:t,trimLastLine:e.length!==1&&e[e.length-1].trim().length===0};{let r=i?e.slice(1):e;r=t?r.slice(0,r.length-1):r,r=r.filter(s=>s.length!==0);const a=Ue(r);return{indentation:a,omitFirstLine:i,omitLastLine:t&&(e[e.length-1].length<a||!e[e.length-1].startsWith(r[0].substring(0,a)))}}}function Pe(n,e,{indentation:i,omitFirstLine:t,omitLastLine:r,trimLastLine:a}){const s=[];n.forEach((p,u)=>{s.push(...p.split(J).map((h,f)=>f===0||h.length<i?h:h.substring(i)).reduce(u===0?(h,f,m)=>m===0?t?
|
|
16
|
+
[]:[f]:m===1&&h.length===0?[f]:h.concat(U,f):(h,f,m)=>m===0?[f]:h.concat(U,f),[]).filter(h=>!(typeof h=="string"&&h.length===0)).concat(E(e[u])?e[u]:e[u]!==void 0?{content:String(e[u])}:u<e.length?H:[]))});const o=s.length,c=o!==0?s[o-1]:void 0;return(r||a)&&typeof c=="string"&&c.trim().length===0?t&&o!==1&&s[o-2]===U?s.slice(0,o-2):s.slice(0,o-1):s}const U={isNewLine:!0},H={isUndefinedSegment:!0},K=n=>n===U,O=n=>n===H,Oe=n=>n.content!==void 0;function Ae(n){return n.reduce((i,t,r)=>O(t)?i:K(t)?
|
|
17
|
+
{node:r!==0&&(O(n[r-1])||E(n[r-1]))||r>1&&typeof n[r-1]=="string"&&(O(n[r-2])||E(n[r-2]))?i.node.appendNewLineIfNotEmpty():i.node.appendNewLine()}:(()=>{var a;const s=(r===0||K(n[r-1]))&&typeof t=="string"&&t.length!==0?"".padStart(t.length-t.trimStart().length):"",o=Oe(t)?t.content:t;let c;return{node:i.indented?i.node:s.length!==0?i.node.indent({indentation:s,indentImmediately:!1,indentedChildren:p=>c=p.append(o)}):i.node.append(o),indented:c??((a=i.indented)===null||a===void 0?void 0:a.append(
|
|
18
|
+
o))}})(),{node:new g}).node}const Fe=typeof process>"u"?`
|
|
19
|
+
`:process.platform==="win32"?`\r
|
|
20
|
+
`:`
|
|
21
|
+
`;function E(n){return n instanceof g||n instanceof A||n instanceof M}function j(n,e){return E(n)?Re(n,e).text:String(n)}class g{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,i,t){if(pe(e)){if(this.tracedSource={astNode:e,property:i,index:t},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw new Error("Generation support: 'property' argument must not be 'undefined' if a non-negative valu\
|
|
22
|
+
e is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.")}else this.tracedSource=e;return this}append(...e){for(const i of e)typeof i=="function"?i(this):i&&this.contents.push(i);return this}appendIf(e,...i){return e?this.append(...i):this}appendNewLine(){return this.append(d)}appendNewLineIf(e){return e?this.append(d):this}appendNewLineIfNotEmpty(){return this.append(Ve)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...i){return this.append(
|
|
23
|
+
$(e,...i))}appendTemplateIf(e){return e?(i,...t)=>this.appendTemplate(i,...t):()=>this}indent(e){const{indentedChildren:i,indentation:t,indentEmptyLines:r,indentImmediately:a}=Array.isArray(e)||typeof e=="function"?{indentedChildren:e}:typeof e=="object"?e:{},s=new A(t,a,r);return this.contents.push(s),Array.isArray(i)?s.append(...i):i&&s.append(i),this}appendTraced(e,i,t){return r=>this.append(new g().trace(e,i,t).append(r))}appendTracedIf(e,i,t,r){return e?this.appendTraced(typeof i=="function"?
|
|
24
|
+
i():i,t,r):()=>this}appendTracedTemplate(e,i,t){return(r,...a)=>this.append(De(e,i,t)(r,...a))}appendTracedTemplateIf(e,i,t,r){return e?this.appendTracedTemplate(typeof i=="function"?i():i,t,r):()=>this}}function Je(n,e,i){return t=>t instanceof g&&t.tracedSource===void 0?t.trace(n,e,i):new g().trace(n,e,i).append(t)}class A extends g{constructor(e,i=!0,t=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".
|
|
25
|
+
padStart(e)),this.indentImmediately=i,this.indentEmptyLines=t}}class M{constructor(e,i=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??Fe,this.ifNotEmpty=i}}const d=new M,Ve=new M(void 0,!0),X=n=>n===void 0||typeof n=="string"||E(n)?n:String(n);function y(n,e=X,i={}){const t=typeof e=="function"?e:X,{filter:r,prefix:a,suffix:s,separator:o,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:p}=typeof e=="object"?e:i,u=typeof a=="function"?a:()=>a,h=typeof s=="function"?s:()=>s;return We(n,(f,m,v,l)=>{
|
|
26
|
+
if(r&&!r(m,v,l))return f;const w=t(m,v,l);return w===void 0?f:(f??(f=new g)).append(u(m,v,l)).append(w).append(h(m,v,l)).appendIf(!l,o).appendNewLineIfNotEmptyIf(!f.isEmpty()&&!!c&&(!l||!p))})}function We(n,e,i){const t=n[Symbol.iterator]();let r=t.next(),a=0,s=i;for(;!r.done;){const o=t.next();s=e(s,r.value,a,!!o.done),r=o,a++}return s}const Ge=n=>n.charAt(0).toLocaleUpperCase()+n.slice(1),ze=n=>n.split(".").map(Ge).join(""),Be=n=>ze(n.parent?n.id.slice(n.parent.length+1):n.id),Ye=({autoLayout:n})=>{
|
|
27
|
+
switch(n.direction){case"TB":return"down";case"BT":return"up";case"LR":return"right";case"RL":return"left"}},qe=({shape:n})=>{switch(n){case"queue":case"cylinder":case"rectangle":case"person":return n;case"storage":return"stored_data";case"mobile":case"browser":return"rectangle"}};function Q(n){const e=n.$view,{nodes:i,edges:t}=e,r=new Map,a=(o,c)=>{const p=Be(o),u=(c?c+".":"")+p;r.set(o.id,u);const h=JSON.stringify(o.title),f=qe(o);return new g().append(p,": {",d).indent({indentedChildren:m=>m.
|
|
28
|
+
append("label: ",h,d).appendIf(f!=="rectangle","shape: ",f,d).appendIf(o.children.length>0,d,y(i.filter(v=>v.parent===o.id),v=>a(v,u))),indentation:2}).append("}",d)},s=o=>new g().append(r.get(o.source)," -> ",r.get(o.target)).append(c=>o.label&&c.append(": ",JSON.stringify(o.label)));return j(new g().append("direction: ",Ye(e),d,d).append(y(i.filter(o=>b(o.parent)),o=>a(o),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,d,y(t,o=>s(o),{appendNewLineIfNotEmpty:!0})))}const He=n=>n.charAt(0).toLocaleUpperCase()+
|
|
29
|
+
n.slice(1),Ke=n=>n.split(".").map(He).join(""),Xe=n=>Ke(n.parent?n.id.slice(n.parent.length+1):n.id),Qe=({shape:n})=>{switch(n){case"queue":case"cylinder":return["[(",")]"];case"person":return["[fa:fa-user ","]"];case"storage":return["([","])"];case"mobile":case"browser":case"rectangle":return["[","]"]}};function Z(n){const e=n.$view,{nodes:i,edges:t}=e,r=new Map,a=(o,c)=>{const p=Xe(o),u=(c?c+".":"")+p;r.set(o.id,u);const h=o.title.replaceAll(`
|
|
30
|
+
`,"\\n"),f=Qe(o),m=new g;return o.children.length>0?m.append("subgraph ",u,"[",JSON.stringify(o.title),"]",d).indent({indentedChildren:[y(i.filter(v=>v.parent===o.id),v=>a(v,u),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",d):m.append(u,f[0],h,f[1]),m},s=o=>new g().append(r.get(o.source)," -.",o.label?' "'+o.label.replaceAll(`
|
|
31
|
+
`,"\\n")+'" .-':"-","> ",r.get(o.target));return j(new g().appendIf(e.title!==null&&e.title.length>0,"---",d,`title: ${JSON.stringify(e.title)}`,d,"---",d).append("graph ",e.autoLayout.direction,d).indent({indentedChildren:o=>{o.append(y(i.filter(c=>b(c.parent)),c=>a(c),{appendNewLineIfNotEmpty:!0})).appendIf(t.length>0,y(t,c=>s(c),{appendNewLineIfNotEmpty:!0}))},indentation:2}))}const Ze=n=>n.charAt(0).toLocaleUpperCase()+n.slice(1),D=n=>n.split(".").map(Ze).join(""),ee=n=>D(n.parent?n.id.slice(
|
|
32
|
+
n.parent.length+1):n.id),R=(n,e,i="#3b82f6")=>{switch(n){case"blue":case"primary":return"#3b82f6";case"amber":return"#a35829";case"gray":return"#737373";case"green":return"#428a4f";case"indigo":return"#6366f1";case"slate":case"muted":return"#64748b";case"red":return"#ac4d39";case"sky":case"secondary":return"#0284c7";case null:case void 0:return i;default:return e(n)||n}},en=({autoLayout:n})=>{switch(n.direction){case"TB":return"top to bottom";case"BT":return console.warn("Bottom to top direction\
|
|
33
|
+
is not supported. Defaulting to top to bottom."),"top to bottom";case"LR":return"left to right";case"RL":return console.warn("Right to left direction is not supported. Defaulting to left to right."),"left to right"}},ne=({shape:n})=>{switch(n){case"queue":case"rectangle":case"person":return n;case"storage":case"cylinder":return"database";case"mobile":case"browser":return"rectangle"}},T=n=>b(n)?null:JSON.stringify(n).slice(1,-1);function te(n){const e=n.$view,i=n.$model.specification.customColors??
|
|
34
|
+
{},{nodes:t,edges:r}=e,a=new Map(Object.entries(i)),s=l=>w=>a.get(w)?.elements[l],o=l=>w=>a.get(w)?.relationships[l],c=new Map,p=()=>new g().append('title "',e.title||e.id,'"',d).append(en(e)," direction",d),u=()=>new g().append("hide stereotype",d).append("skinparam ranksep ","60",d).append("skinparam nodesep ","30",d).append("skinparam {",d).indent({indentedChildren:l=>l.append("arrowFontSize ","10",d).append("defaultTextAlignment ","center",d).append("wrapWidth ","200",d).append("maxMessageSi\
|
|
35
|
+
ze ","100",d).append("shadowing ","false",d),indentation:2}).append("}",d),h=l=>{const w=ne(l),I=D(l.id);return new g().append("skinparam ",w,"<<",I,">>","{",d).indent({indentedChildren:L=>L.append("BackgroundColor ",R(l.color,s("fill")),d).append("FontColor ",a.has(l.color)?R(l.color,s("hiContrast")):"#FFFFFF",d).append("BorderColor ",R(l.color,s("stroke")),d),indentation:2}).append("}",d)},f=l=>{const w=ne(l),I=D(l.id),L=T(l.title)||ee(l),k=T(l.technology);return c.set(l.id,I),new g().append(w,
|
|
36
|
+
" ").append('"').append("==",L).appendIf(!!k,"\\n","<size:10>[",k,"]</size>").appendIf(!!l.description,"\\n\\n",T(l.description)).append('"'," <<",I,">> ","as ",I,d)},m=l=>{const w=T(l.title)||ee(l),I=D(l.id);return c.set(l.id,I),new g().append('rectangle "',w,'" <<',I,">> as ",I," {",d).indent({indentedChildren:L=>L.append("skinparam ","RectangleBorderColor<<",I,">> ",R(l.color,s("fill")),d).append("skinparam ","RectangleFontColor<<",I,">> ",R(l.color,s("fill")),d).append("skinparam ","Rectangl\
|
|
37
|
+
eBorderStyle<<",I,">> ","dashed",d,d).append(y(t.filter(k=>k.parent===l.id),k=>k.children.length>0?m(k):f(k))),indentation:2}).append("}",d)},v=l=>{const w=T(l.technology)||"",I=T(l.label)||"",L=R(l.color,o("lineColor"),"#777777"),k=se=>`<color:${se}>`;return new g().append(c.get(l.source)," .[",L,",thickness=2].> ",c.get(l.target)).appendIf(!!(I||w),' : "',k(L)).appendIf(!!I,I,k(L)).appendIf(!!(I&&w),"\\n").appendIf(!!w,k(L),"<size:8>[",w,"]</size>").appendIf(!!(I||w),'"').append(d)};return j(new g().
|
|
38
|
+
append("@startuml",d).append(p(),d).append(u(),d).append(y(t.filter(l=>l.children.length==0),l=>h(l),{appendNewLineIfNotEmpty:!0})).append(y(t.filter(l=>b(l.parent)),l=>l.children.length>0?m(l):f(l),{appendNewLineIfNotEmpty:!0})).appendIf(r.length>0,d,y(r,l=>v(l),{appendNewLineIfNotEmpty:!0})).append("@enduml",d))}function S(n){return{matches:e=>{let{module:i,projectId:t}=e.match(/^likec4:plugin\/(?<projectId>.+)\/(?<module>.+)$/)?.groups??e.match(/^likec4:(?<module>.+)\/(?<projectId>.+)$/)?.groups??
|
|
39
|
+
{};return!i||!t?null:(i.endsWith(".js")&&(i=i.slice(0,-3)),i===n?t:null)},virtualId:e=>x("likec4:plugin",e,n)+".js"}}function _(n,e){return{id:`likec4:${n}`,virtualId:`likec4:plugin/${n}.js`,async load({likec4:i,logger:t,projects:r,assetsDir:a}){t.info(N.dim(`generating likec4:${n}`));const s=r.map(({id:o})=>{const c=x(`likec4:${n}`,o);return` case ${JSON.stringify(o)}: return await import(${JSON.stringify(c)})`});return`
|
|
40
|
+
export async function ${e}(projectId) {
|
|
41
|
+
switch (projectId) {
|
|
42
|
+
${s.join(`
|
|
43
|
+
`)}
|
|
44
|
+
default: throw new Error('Unknown projectId: ' + projectId)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`}}}function nn(n){const e=new g;return e.appendTemplate`
|
|
48
|
+
/******************************************************************************
|
|
49
|
+
* This file was generated
|
|
50
|
+
* DO NOT EDIT MANUALLY!
|
|
51
|
+
******************************************************************************/
|
|
52
|
+
/* eslint-disable */
|
|
53
|
+
|
|
54
|
+
export function d2Source(viewId) {
|
|
55
|
+
switch (viewId) {
|
|
56
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(i){i.append(y([...n.views()],t=>$`
|
|
57
|
+
case ${JSON.stringify(t.id)}: {
|
|
58
|
+
return ${JSON.stringify(Q(t))}
|
|
59
|
+
}
|
|
60
|
+
`,{appendNewLineIfNotEmpty:!0})).appendTemplate`
|
|
61
|
+
default: {
|
|
62
|
+
throw new Error('Unknown viewId: ' + viewId)
|
|
63
|
+
}
|
|
64
|
+
`}}).append(d," }",d).appendTemplate`
|
|
65
|
+
}
|
|
66
|
+
`.append(d,d),j(e)}const tn={...S("d2"),async load({likec4:n,projectId:e,logger:i}){i.info(N.dim(`generating likec4:d2/${e}`));const t=await n.computedModel(e);return nn(t)}},rn=_("d2","loadD2Sources");function on(n){const e=new g;return e.appendTemplate`
|
|
67
|
+
/******************************************************************************
|
|
68
|
+
* This file was generated
|
|
69
|
+
* DO NOT EDIT MANUALLY!
|
|
70
|
+
******************************************************************************/
|
|
71
|
+
/* eslint-disable */
|
|
72
|
+
|
|
73
|
+
export function dotSource(viewId) {
|
|
74
|
+
switch (viewId) {
|
|
75
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(i){i.append(y(Object.keys(n),t=>$`
|
|
76
|
+
case ${JSON.stringify(t)}: {
|
|
77
|
+
return ${JSON.stringify(n[t].dot)}
|
|
78
|
+
}
|
|
79
|
+
`,{appendNewLineIfNotEmpty:!0})).appendTemplate`
|
|
80
|
+
default: {
|
|
81
|
+
throw new Error('Unknown viewId: ' + viewId)
|
|
82
|
+
}
|
|
83
|
+
`}}).append(d," }",d).appendTemplate`
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function svgSource(viewId) {
|
|
87
|
+
switch (viewId) {
|
|
88
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(i){i.append(y(Object.keys(n),t=>$`
|
|
89
|
+
case ${JSON.stringify(t)}: {
|
|
90
|
+
return ${JSON.stringify(n[t].svg)}
|
|
91
|
+
}
|
|
92
|
+
`,{appendNewLineIfNotEmpty:!0})).appendTemplate`
|
|
93
|
+
default: {
|
|
94
|
+
throw new Error('Unknown viewId: ' + viewId)
|
|
95
|
+
}
|
|
96
|
+
`}}).append(d," }",d,"}",d,d),j(e)}const an={...S("dot"),async load({likec4:n,projectId:e,logger:i}){i.info(N.dim(`generating likec4:dot/${e}`));const t=await n.views.viewsAsGraphvizOut(e),r=ue(t,({id:a,svg:s,dot:o})=>[a,{dot:o,svg:s}]);return on(r)}},sn=_("dot","loadDotSources");function dn(n){const e=fe(n.flatMap(r=>r.nodes.map(a=>a.icon)),me(r=>we(r)&&!(r.toLowerCase().startsWith("http:")||r.toLowerCase().startsWith("https:"))),he(),ge(ve)),{imports:i,cases:t}=e.reduce((r,a,s)=>{const o=a.
|
|
97
|
+
startsWith("file:"),c="Icon"+s.toString().padStart(2,"0");if(o)return r.imports.push(`import ${c} from '${a}?inline'`),r.cases.push(` '${a}': () => jsx('img', { src: ${c} })`),r;const[p,u]=a.split(":");return r.imports.push(`import ${c} from 'likec4/icons/${p}/${u}'`),r.cases.push(` '${p}:${u}': ${c}`),r},{imports:[],cases:[]});return`
|
|
98
|
+
import { jsx } from 'react/jsx-runtime'
|
|
99
|
+
${i.join(`
|
|
100
|
+
`)}
|
|
101
|
+
|
|
102
|
+
const Icons = {
|
|
103
|
+
${t.join(`,
|
|
104
|
+
`)}
|
|
105
|
+
}
|
|
106
|
+
export function IconRenderer({ node }) {
|
|
107
|
+
const IconComponent = Icons[node.icon ?? '']
|
|
108
|
+
if (!IconComponent) {
|
|
109
|
+
return null
|
|
110
|
+
}
|
|
111
|
+
return jsx(IconComponent, {node})
|
|
112
|
+
}
|
|
113
|
+
`}const cn={...S("icons"),async load({likec4:n,projectId:e,logger:i}){i.info(N.dim(`generating likec4:icons/${e}`));const t=await n.views.computedViews(e);return dn(t)}},ln={id:"likec4:icons",virtualId:"likec4:plugin/icons.jsx",async load({likec4:n,projects:e,logger:i}){i.info(N.dim("generating likec4:icons"));const{imports:t,cases:r}=e.reduce((a,{id:s},o)=>{const c="Icons"+o.toString().padStart(2,"0"),p=x("likec4:icons",s);return a.imports.push(`import { IconRenderer as ${c} } from ${JSON.stringify(
|
|
114
|
+
p)}`),a.cases.push(` case ${JSON.stringify(s)}: return ${c}`),a},{imports:[],cases:[]});return`
|
|
115
|
+
${t.join(`
|
|
116
|
+
`)}
|
|
117
|
+
|
|
118
|
+
export function ProjectIcons(projectId) {
|
|
119
|
+
switch (projectId) {
|
|
120
|
+
${r.join(`
|
|
121
|
+
`)}
|
|
122
|
+
default:
|
|
123
|
+
throw new Error('Unknown projectId: ' + projectId)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`}};function pn(n){const e=new g;return e.appendTemplate`
|
|
127
|
+
/******************************************************************************
|
|
128
|
+
* This file was generated
|
|
129
|
+
* DO NOT EDIT MANUALLY!
|
|
130
|
+
******************************************************************************/
|
|
131
|
+
/* eslint-disable */
|
|
132
|
+
|
|
133
|
+
export function mmdSource(viewId) {
|
|
134
|
+
switch (viewId) {
|
|
135
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(i){i.append(y([...n.views()],t=>$`
|
|
136
|
+
case ${JSON.stringify(t.id)}: {
|
|
137
|
+
return ${JSON.stringify(Z(t))}
|
|
138
|
+
}
|
|
139
|
+
`,{appendNewLineIfNotEmpty:!0})).appendTemplate`
|
|
140
|
+
default: {
|
|
141
|
+
throw new Error('Unknown viewId: ' + viewId)
|
|
142
|
+
}
|
|
143
|
+
`}}).append(d," }",d).appendTemplate`
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
`.append(d,d),j(e)}const un={...S("mmd"),async load({likec4:n,projectId:e,logger:i}){i.info(N.dim(`generating virtual:likec4/mmd/${e}`));const t=await n.computedModel(e);return pn(t)}},fn=_("mmd","loadMmdSources"),gn=n=>`
|
|
147
|
+
import { nano, createHooksForModel } from 'likec4/react'
|
|
148
|
+
|
|
149
|
+
export const $likec4data = nano.atom(${V.stringify(n.$data)})
|
|
150
|
+
|
|
151
|
+
export const {
|
|
152
|
+
updateModel,
|
|
153
|
+
$likec4model,
|
|
154
|
+
useLikeC4Model,
|
|
155
|
+
useLikeC4Views,
|
|
156
|
+
useLikeC4View
|
|
157
|
+
}= /* @__PURE__ */ createHooksForModel($likec4data)
|
|
158
|
+
|
|
159
|
+
if (import.meta.hot) {
|
|
160
|
+
import.meta.hot.accept(md => {
|
|
161
|
+
if (!import.meta.hot.data.$update) {
|
|
162
|
+
import.meta.hot.data.$update = updateModel
|
|
163
|
+
}
|
|
164
|
+
const update = md.$likec4data?.value
|
|
165
|
+
if (update) {
|
|
166
|
+
import.meta.hot.data.$update(update)
|
|
167
|
+
} else {
|
|
168
|
+
import.meta.hot.invalidate()
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
`,hn={...S("model"),async load({likec4:n,projectId:e,logger:i,assetsDir:t}){i.info(N.dim(`generating likec4:model/${e}`));const r=await n.layoutedModel(e);return gn(r)}},mn={id:"likec4:model",virtualId:"likec4:plugin/model.js",async load({likec4:n,logger:e,projects:i,assetsDir:t}){return e.info(N.dim("generating likec4:model")),`
|
|
173
|
+
export async function loadModel(projectId) {
|
|
174
|
+
switch (projectId) {
|
|
175
|
+
${i.map(({id:r})=>{const a=x("likec4:model",r);return` case ${JSON.stringify(r)}: return await import(${JSON.stringify(a)})`}).join(`
|
|
176
|
+
`)}
|
|
177
|
+
default: throw new Error('Unknown projectId: ' + projectId)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
`}},wn=n=>`
|
|
181
|
+
export const isSingleProject = ${n.length===1};
|
|
182
|
+
export const projects = ${V.stringify(n,null,2)};
|
|
183
|
+
`,In={id:"likec4:projects",virtualId:"likec4:plugin/projects.js",async load({likec4:n,logger:e,projects:i,assetsDir:t}){return e.info(N.dim("generating likec4:projects")),wn(Ie(i,Ne("id")))}};function Nn(n){const e=new g;return e.appendTemplate`
|
|
184
|
+
/******************************************************************************
|
|
185
|
+
* This file was generated
|
|
186
|
+
* DO NOT EDIT MANUALLY!
|
|
187
|
+
******************************************************************************/
|
|
188
|
+
/* eslint-disable */
|
|
189
|
+
|
|
190
|
+
export function pumlSource(viewId) {
|
|
191
|
+
switch (viewId) {
|
|
192
|
+
`.appendNewLine().indent({indentation:4,indentedChildren(i){i.append(y([...n.views()],t=>$`
|
|
193
|
+
case ${JSON.stringify(t.id)}: {
|
|
194
|
+
return ${JSON.stringify(te(t))}
|
|
195
|
+
}
|
|
196
|
+
`,{appendNewLineIfNotEmpty:!0})).appendTemplate`
|
|
197
|
+
default: {
|
|
198
|
+
throw new Error('Unknown viewId: ' + viewId)
|
|
199
|
+
}
|
|
200
|
+
`}}).append(d," }",d).appendTemplate`
|
|
201
|
+
}
|
|
202
|
+
`.append(d,d),j(e)}const yn={...S("puml"),async load({likec4:n,projectId:e,logger:i}){i.info(N.dim(`generating likec4:puml/${e}`));const t=await n.computedModel(e);return Nn(t)}},vn=_("puml","loadPumlSources"),ie=n=>`
|
|
203
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
204
|
+
import { LikeC4ModelProvider as Provider, LikeC4View as GenericView, ReactLikeC4 as GenericReactLikeC4 } from 'likec4/react';
|
|
205
|
+
import { IconRenderer } from 'likec4:icons/${n}'
|
|
206
|
+
|
|
207
|
+
import { useLikeC4Model, useLikeC4Views, useLikeC4View } from 'likec4:model/${n}'
|
|
208
|
+
|
|
209
|
+
export function LikeC4ModelProvider({ children }) {
|
|
210
|
+
const likeC4Model = useLikeC4Model()
|
|
211
|
+
return (_jsx(Provider, { likec4model: likeC4Model, children: children }));
|
|
212
|
+
}
|
|
213
|
+
export function LikeC4View(props) {
|
|
214
|
+
return (_jsx(LikeC4ModelProvider, { children: _jsx(GenericView, { renderIcon: IconRenderer, ...props }) }));
|
|
215
|
+
}
|
|
216
|
+
export function ReactLikeC4(props) {
|
|
217
|
+
return (_jsx(LikeC4ModelProvider, { children: _jsx(GenericReactLikeC4, { renderIcon: IconRenderer, ...props }) }));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
useLikeC4Model,
|
|
222
|
+
useLikeC4View,
|
|
223
|
+
useLikeC4Views
|
|
224
|
+
}
|
|
225
|
+
`,kn={...S("react"),async load({projectId:n,logger:e}){return e.info(N.dim(`generating likec4:react/${n}`)),ie(n)}},Ln={id:"likec4:react",virtualId:"likec4:plugin/react.js",async load({logger:n,projects:e}){const i=W(e);return n.info(N.dim("generating likec4:react for")+" "+i.id),ie(i.id)}},$n=n=>`
|
|
226
|
+
export { IconRenderer } from 'likec4:icons/${n}'
|
|
227
|
+
export {
|
|
228
|
+
$likec4data,
|
|
229
|
+
$likec4model,
|
|
230
|
+
useLikeC4Model,
|
|
231
|
+
useLikeC4Views,
|
|
232
|
+
useLikeC4View
|
|
233
|
+
} from 'likec4:model/${n}'
|
|
234
|
+
export const projectId = ${JSON.stringify(n)}
|
|
235
|
+
`,jn={id:"likec4:single-project",virtualId:"likec4:plugin/single-project.js",async load({likec4:n,logger:e,projects:i,assetsDir:t}){const r=W(i);return e.info(N.dim("generating likec4:single-project for")+" "+r.id),$n(r.id)}},re=[hn,cn,tn,an,un,yn],oe=[...re,kn],ae=[In,mn,jn,Ln,rn,sn,fn,vn,ln],Sn=n=>{const e=n.toLowerCase();return e.endsWith(".c4")||e.endsWith(".likec4")||e.endsWith(".like-c4")};function Cn({useOverviewGraph:n=!1,...e}){let i,t,r,a;return{name:"vite-plugin-likec4",async configResolved(s){
|
|
236
|
+
if(i=s.root,t=s.logger,n===!0){const o=s.resolve.alias.find(c=>c.find==="likec4/previews")?.replacement;o?(a=o,t.info(N.dim("likec4/previews alias")+" "+N.dim(a))):t.warn("likec4/previews alias not found")}e.languageServices?r=e.languageServices:r=(await ye.fromWorkspace(e.workspace??s.root,{logger:t,graphviz:e.graphviz??"wasm",printErrors:e.printErrors??!0,throwIfInvalid:e.throwIfInvalid??!1})).languageServices,a=r.workspaceUri.fsPath},resolveId(s){for(const o of oe){const c=o.matches(s);if(c)return o.
|
|
237
|
+
virtualId(c)}for(const o of ae)if(o.id===s)return o.virtualId;return null},async load(s){for(const o of oe){const c=o.matches(s);if(c)return await o.load({logger:t,likec4:r,projectId:c,assetsDir:a,useOverviewGraph:n})}for(const o of ae)if(o.virtualId===s){const c=await r.projects();return await o.load({logger:t,likec4:r,projects:c,assetsDir:a,useOverviewGraph:n})}return null},configureServer(s){const o=r.projects().map(({folder:p})=>p.fsPath);for(const p of o)t.info(`${N.dim("watch")} ${p}`);const c=p=>u=>{
|
|
238
|
+
Sn(u)&&r.notifyUpdate({[p]:u})};s.watcher.add(o).on("add",c("changed")).on("change",c("changed")).on("unlink",c("removed")),r.builder.onModelParsed(async()=>{const[p]=r.getErrors();if(p){s.ws.send({type:"error",err:{name:"LikeC4ValidationError",message:`Validation failed
|
|
239
|
+
`+p.message.slice(0,500),stack:"",plugin:"vite-plugin-likec4",loc:{file:de(i,p.sourceFsPath),line:p.range.start.line+1,column:p.range.start.character+1}}});return}for(const u of r.projects())for(const h of re){const f=s.moduleGraph.getModuleById(h.virtualId(u.id));if(f&&f.importers.size>0){t.info(`${N.green("reload")} ${N.dim(f.id??f.url)}`);try{await s.reloadModule(f)}catch(m){t.error(m)}}}})}}}export{g as C,Cn as L,d as N,Z as a,Q as b,$ as e,te as g,y as j,j as t};
|