likec4 1.28.0 → 1.29.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,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.10Nsb-Q7.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.BHE-zBYQ.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.
@@ -29,14 +29,14 @@ el: ",f,l).appendIf(u!=="rectangle","shape: ",u,l).appendIf(o.children.length>0,
29
29
  t.slice(1),Ae=t=>t.split(".").map(Oe).join(""),Je=t=>Ae(t.parent?t.id.slice(t.parent.length+1):t.id),Ve=({shape:t})=>{switch(t){case"queue":case"cylinder":return["[(",")]"];case"person":return["[fa:fa-user ","]"];case"storage":return["([","])"];case"mobile":case"browser":case"rectangle":return["[","]"]}};function q(t){const{nodes:e,edges:i}=t,n=new Map,r=(o,s)=>{const d=Je(o),c=(s?s+".":"")+d;n.set(o.id,c);const f=o.title.replaceAll(`
30
30
  `,"\\n"),u=Ve(o),p=new g;return o.children.length>0?p.append("subgraph ",c,"[",JSON.stringify(o.title),"]",l).indent({indentedChildren:[I(e.filter(h=>h.parent===o.id),h=>r(h,c),{appendNewLineIfNotEmpty:!0})],indentation:2}).append("end",l):p.append(c,u[0],f,u[1]),p},a=o=>new g().append(n.get(o.source)," -.",o.label?' "'+o.label.replaceAll(`
31
31
  `,"\\n")+'" .-':"-","> ",n.get(o.target));return y(new g().appendIf(t.title!==null&&t.title.length>0,"---",l,`title: ${JSON.stringify(t.title)}`,l,"---",l).append("graph ",t.autoLayout.direction,l).indent({indentedChildren:o=>{o.append(I(e.filter(s=>_(s.parent)),s=>r(s),{appendNewLineIfNotEmpty:!0})).appendIf(i.length>0,I(i,s=>a(s),{appendNewLineIfNotEmpty:!0}))},indentation:2}))}function k(t){return{matches:e=>{let{module:i,projectId:n}=e.match(/^likec4:plugin\/(?<projectId>.+)\/(?<module>.+)$/)?.
32
- groups??e.match(/^likec4:(?<module>.+)\/(?<projectId>.+)$/)?.groups??{};return!i||!n?null:(i.endsWith(".js")&&(i=i.slice(0,-3)),i===t?n:null)},virtualId:e=>S("likec4:plugin",e,t)+".js"}}function M(t,e){return{id:`likec4:${t}`,virtualId:`likec4:plugin/${t}.js`,async load({likec4:i,logger:n,projects:r,assetsDir:a}){n.info(m.dim(`generating likec4:${t}`));const o=r.map(({id:s})=>{const d=S(`likec4:${t}`,s);return` case ${JSON.stringify(s)}: return await import(${JSON.stringify(d)})`});return`
33
- export async function ${e}(projectId) {
34
- switch (projectId) {
35
- ${o.join(`
32
+ groups??e.match(/^likec4:(?<module>.+)\/(?<projectId>.+)$/)?.groups??{};return!i||!n?null:(i.endsWith(".js")&&(i=i.slice(0,-3)),i===t?n:null)},virtualId:e=>S("likec4:plugin",e,t)+".js"}}function M(t,e){return{id:`likec4:${t}`,virtualId:`likec4:plugin/${t}.js`,async load({likec4:i,logger:n,projects:r,assetsDir:a}){n.info(m.dim(`generating likec4:${t}`));const o=r.map(({id:s})=>{const d=S(`likec4:${t}`,s);return` case ${JSON.stringify(s)}: return await import(${JSON.stringify(d)})`});return`
33
+ export async function ${e}(projectId) {
34
+ switch (projectId) {
35
+ ${o.join(`
36
36
  `)}
37
- default: throw new Error('Unknown projectId: ' + projectId)
38
- }
39
- }
37
+ default: throw new Error('Unknown projectId: ' + projectId)
38
+ }
39
+ }
40
40
  `}}}const We=t=>{const e=new g;return e.appendTemplate`
41
41
  /******************************************************************************
42
42
  * This file was generated