@likec4/language-server 1.48.0 → 1.49.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.
Files changed (78) hide show
  1. package/browser/package.json +2 -2
  2. package/browser-worker/package.json +2 -2
  3. package/dist/THIRD-PARTY-LICENSES.md +178 -0
  4. package/dist/_chunks/ConfigurableLayouter.mjs +1 -1956
  5. package/dist/_chunks/LikeC4FileSystem.mjs +3 -0
  6. package/dist/_chunks/LikeC4Views.mjs +34 -0
  7. package/dist/_chunks/ProjectsManager.mjs +1 -0
  8. package/dist/_chunks/WithMCPServer.mjs +481 -0
  9. package/dist/_chunks/icons.mjs +2 -5211
  10. package/dist/_chunks/{LikeC4LanguageServices.d.mts → index.d.mts} +1836 -707
  11. package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -805
  12. package/dist/_chunks/libs/eventemitter3.mjs +1 -243
  13. package/dist/_chunks/libs/fast-equals.mjs +1 -446
  14. package/dist/_chunks/libs/p-queue.mjs +1 -449
  15. package/dist/_chunks/libs/parse-ms.mjs +1 -36
  16. package/dist/_chunks/libs/picomatch.mjs +1 -1673
  17. package/dist/_chunks/libs/pretty-ms.mjs +1 -80
  18. package/dist/_chunks/libs/remeda.mjs +1 -482
  19. package/dist/_chunks/libs/strip-indent.mjs +1 -15
  20. package/dist/_chunks/libs/ufo.mjs +1 -166
  21. package/dist/_chunks/logger.mjs +1 -0
  22. package/dist/_chunks/rolldown-runtime.mjs +1 -42
  23. package/dist/_chunks/utils.mjs +1 -0
  24. package/dist/browser/index.d.mts +10 -0
  25. package/dist/browser/index.mjs +1 -0
  26. package/dist/browser/worker.mjs +1 -0
  27. package/dist/bundled.d.mts +2 -3
  28. package/dist/bundled.mjs +1 -51
  29. package/dist/filesystem/index.d.mts +2 -4
  30. package/dist/filesystem/index.mjs +1 -3
  31. package/dist/index.d.mts +38 -3
  32. package/dist/index.mjs +1 -48
  33. package/dist/likec4lib.d.mts +10 -3
  34. package/dist/likec4lib.mjs +1 -4
  35. package/dist/mcp/index.d.mts +2 -4
  36. package/dist/mcp/index.mjs +1 -3
  37. package/dist/module.d.mts +126 -4
  38. package/dist/module.mjs +1 -3
  39. package/dist/protocol.d.mts +314 -1
  40. package/dist/protocol.mjs +1 -3
  41. package/filesystem/package.json +4 -0
  42. package/mcp/package.json +4 -0
  43. package/module/package.json +4 -0
  44. package/package.json +79 -56
  45. package/LICENSE +0 -21
  46. package/dist/LikeC4LanguageServices.d.mts +0 -4
  47. package/dist/LikeC4LanguageServices.mjs +0 -3
  48. package/dist/_chunks/LikeC4LanguageServices.mjs +0 -725
  49. package/dist/_chunks/ast.d.mts +0 -1444
  50. package/dist/_chunks/ast.mjs +0 -2375
  51. package/dist/_chunks/ast2.mjs +0 -176
  52. package/dist/_chunks/common-exports.mjs +0 -0
  53. package/dist/_chunks/filesystem.mjs +0 -58
  54. package/dist/_chunks/grammar.mjs +0 -8
  55. package/dist/_chunks/libs/@hono/node-server.mjs +0 -436
  56. package/dist/_chunks/libs/hono.mjs +0 -1829
  57. package/dist/_chunks/likec4lib.mjs +0 -9
  58. package/dist/_chunks/mcp.mjs +0 -33
  59. package/dist/_chunks/module.mjs +0 -28
  60. package/dist/_chunks/module2.mjs +0 -6576
  61. package/dist/_chunks/protocol.d.mts +0 -311
  62. package/dist/_chunks/protocol.mjs +0 -78
  63. package/dist/ast.d.mts +0 -4
  64. package/dist/ast.mjs +0 -4
  65. package/dist/browser-worker.mjs +0 -6
  66. package/dist/browser.d.mts +0 -11
  67. package/dist/browser.mjs +0 -27
  68. package/dist/common-exports.d.mts +0 -4
  69. package/dist/common-exports.mjs +0 -5
  70. package/dist/generated/ast.d.mts +0 -2
  71. package/dist/generated/ast.mjs +0 -3
  72. package/dist/generated/grammar.d.mts +0 -6
  73. package/dist/generated/grammar.mjs +0 -3
  74. package/dist/generated/module.d.mts +0 -14
  75. package/dist/generated/module.mjs +0 -3
  76. package/dist/generated-lib/icons.d.mts +0 -4
  77. package/dist/generated-lib/icons.mjs +0 -3
  78. /package/dist/{browser-worker.d.mts → browser/worker.d.mts} +0 -0
@@ -1,166 +1 @@
1
- //#region ../../node_modules/.pnpm/ufo@1.6.3/node_modules/ufo/dist/index.mjs
2
- const r = String.fromCharCode;
3
- const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
4
- const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
5
- const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
6
- const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
7
- const JOIN_LEADING_SLASH_RE = /^\.?\//;
8
- function isRelative(inputString) {
9
- return ["./", "../"].some((string_) => inputString.startsWith(string_));
10
- }
11
- function hasProtocol(inputString, opts = {}) {
12
- if (typeof opts === "boolean") opts = { acceptRelative: opts };
13
- if (opts.strict) return PROTOCOL_STRICT_REGEX.test(inputString);
14
- return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
15
- }
16
- function hasTrailingSlash(input = "", respectQueryAndFragment) {
17
- if (!respectQueryAndFragment) return input.endsWith("/");
18
- return TRAILING_SLASH_RE.test(input);
19
- }
20
- function withoutTrailingSlash(input = "", respectQueryAndFragment) {
21
- if (!respectQueryAndFragment) return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
22
- if (!hasTrailingSlash(input, true)) return input || "/";
23
- let path = input;
24
- let fragment = "";
25
- const fragmentIndex = input.indexOf("#");
26
- if (fragmentIndex !== -1) {
27
- path = input.slice(0, fragmentIndex);
28
- fragment = input.slice(fragmentIndex);
29
- }
30
- const [s0, ...s] = path.split("?");
31
- return ((s0.endsWith("/") ? s0.slice(0, -1) : s0) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
32
- }
33
- function withTrailingSlash(input = "", respectQueryAndFragment) {
34
- if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
35
- if (hasTrailingSlash(input, true)) return input || "/";
36
- let path = input;
37
- let fragment = "";
38
- const fragmentIndex = input.indexOf("#");
39
- if (fragmentIndex !== -1) {
40
- path = input.slice(0, fragmentIndex);
41
- fragment = input.slice(fragmentIndex);
42
- if (!path) return fragment;
43
- }
44
- const [s0, ...s] = path.split("?");
45
- return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
46
- }
47
- function hasLeadingSlash(input = "") {
48
- return input.startsWith("/");
49
- }
50
- function withoutLeadingSlash(input = "") {
51
- return (hasLeadingSlash(input) ? input.slice(1) : input) || "/";
52
- }
53
- function cleanDoubleSlashes(input = "") {
54
- return input.split("://").map((string_) => string_.replace(/\/{2,}/g, "/")).join("://");
55
- }
56
- function withoutBase(input, base) {
57
- if (isEmptyURL(base)) return input;
58
- const _base = withoutTrailingSlash(base);
59
- if (!input.startsWith(_base)) return input;
60
- const nextChar = input[_base.length];
61
- if (nextChar && nextChar !== "/" && nextChar !== "?") return input;
62
- const trimmed = input.slice(_base.length);
63
- return trimmed[0] === "/" ? trimmed : "/" + trimmed;
64
- }
65
- function isEmptyURL(url) {
66
- return !url || url === "/";
67
- }
68
- function isNonEmptyURL(url) {
69
- return url && url !== "/";
70
- }
71
- function joinURL(base, ...input) {
72
- let url = base || "";
73
- for (const segment of input.filter((url2) => isNonEmptyURL(url2))) if (url) {
74
- const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
75
- url = withTrailingSlash(url) + _segment;
76
- } else url = segment;
77
- return url;
78
- }
79
- function joinRelativeURL(..._input) {
80
- const JOIN_SEGMENT_SPLIT_RE = /\/(?!\/)/;
81
- const input = _input.filter(Boolean);
82
- const segments = [];
83
- let segmentsDepth = 0;
84
- for (const i of input) {
85
- if (!i || i === "/") continue;
86
- for (const [sindex, s] of i.split(JOIN_SEGMENT_SPLIT_RE).entries()) {
87
- if (!s || s === ".") continue;
88
- if (s === "..") {
89
- if (segments.length === 1 && hasProtocol(segments[0])) continue;
90
- segments.pop();
91
- segmentsDepth--;
92
- continue;
93
- }
94
- if (sindex === 1 && segments[segments.length - 1]?.endsWith(":/")) {
95
- segments[segments.length - 1] += "/" + s;
96
- continue;
97
- }
98
- segments.push(s);
99
- segmentsDepth++;
100
- }
101
- }
102
- let url = segments.join("/");
103
- if (segmentsDepth >= 0) {
104
- if (input[0]?.startsWith("/") && !url.startsWith("/")) url = "/" + url;
105
- else if (input[0]?.startsWith("./") && !url.startsWith("./")) url = "./" + url;
106
- } else url = "../".repeat(-1 * segmentsDepth) + url;
107
- if (input[input.length - 1]?.endsWith("/") && !url.endsWith("/")) url += "/";
108
- return url;
109
- }
110
- function withoutProtocol(input) {
111
- return withProtocol(input, "");
112
- }
113
- function withProtocol(input, protocol) {
114
- let match = input.match(PROTOCOL_REGEX);
115
- if (!match) match = input.match(/^\/{2,}/);
116
- if (!match) return protocol + input;
117
- return protocol + input.slice(match[0].length);
118
- }
119
- const protocolRelative = Symbol.for("ufo:protocolRelative");
120
- function parseURL(input = "", defaultProto) {
121
- const _specialProtoMatch = input.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);
122
- if (_specialProtoMatch) {
123
- const [, _proto, _pathname = ""] = _specialProtoMatch;
124
- return {
125
- protocol: _proto.toLowerCase(),
126
- pathname: _pathname,
127
- href: _proto + _pathname,
128
- auth: "",
129
- host: "",
130
- search: "",
131
- hash: ""
132
- };
133
- }
134
- if (!hasProtocol(input, { acceptRelative: true })) return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
135
- const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
136
- let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
137
- if (protocol === "file:") path = path.replace(/\/(?=[A-Za-z]:)/, "");
138
- const { pathname, search, hash } = parsePath(path);
139
- return {
140
- protocol: protocol.toLowerCase(),
141
- auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
142
- host,
143
- pathname,
144
- search,
145
- hash,
146
- [protocolRelative]: !protocol
147
- };
148
- }
149
- function parsePath(input = "") {
150
- const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
151
- return {
152
- pathname,
153
- search,
154
- hash
155
- };
156
- }
157
- const FILENAME_STRICT_REGEX = /\/([^/]+\.[^/]+)$/;
158
- const FILENAME_REGEX = /\/([^/]+)$/;
159
- function parseFilename(input = "", opts) {
160
- const { pathname } = parseURL(input);
161
- const matches = opts?.strict ? pathname.match(FILENAME_STRICT_REGEX) : pathname.match(FILENAME_REGEX);
162
- return matches ? matches[1] : void 0;
163
- }
164
-
165
- //#endregion
166
- export { joinRelativeURL as a, withTrailingSlash as c, withoutProtocol as d, withoutTrailingSlash as f, isRelative as i, withoutBase as l, hasLeadingSlash as n, joinURL as o, hasProtocol as r, parseFilename as s, cleanDoubleSlashes as t, withoutLeadingSlash as u };
1
+ String.fromCharCode;const PROTOCOL_STRICT_REGEX=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,PROTOCOL_REGEX=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,PROTOCOL_RELATIVE_REGEX=/^([/\\]\s*){2,}[^/\\]/,TRAILING_SLASH_RE=/\/$|\/\?|\/#/,JOIN_LEADING_SLASH_RE=/^\.?\//;function isRelative(e){return[`./`,`../`].some(t=>e.startsWith(t))}function hasProtocol(r,i={}){return typeof i==`boolean`&&(i={acceptRelative:i}),i.strict?PROTOCOL_STRICT_REGEX.test(r):PROTOCOL_REGEX.test(r)||(i.acceptRelative?PROTOCOL_RELATIVE_REGEX.test(r):!1)}function hasTrailingSlash(e=``,t){return t?TRAILING_SLASH_RE.test(e):e.endsWith(`/`)}function withoutTrailingSlash(e=``,t){if(!t)return(hasTrailingSlash(e)?e.slice(0,-1):e)||`/`;if(!hasTrailingSlash(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);i!==-1&&(n=e.slice(0,i),r=e.slice(i));let[a,...o]=n.split(`?`);return((a.endsWith(`/`)?a.slice(0,-1):a)||`/`)+(o.length>0?`?${o.join(`?`)}`:``)+r}function withTrailingSlash(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(hasTrailingSlash(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function hasLeadingSlash(e=``){return e.startsWith(`/`)}function withoutLeadingSlash(e=``){return(hasLeadingSlash(e)?e.slice(1):e)||`/`}function cleanDoubleSlashes(e=``){return e.split(`://`).map(e=>e.replace(/\/{2,}/g,`/`)).join(`://`)}function withoutBase(e,t){if(isEmptyURL(t))return e;let n=withoutTrailingSlash(t);if(!e.startsWith(n))return e;let r=e[n.length];if(r&&r!==`/`&&r!==`?`)return e;let i=e.slice(n.length);return i[0]===`/`?i:`/`+i}function isEmptyURL(e){return!e||e===`/`}function isNonEmptyURL(e){return e&&e!==`/`}function joinURL(e,...t){let n=e||``;for(let e of t.filter(e=>isNonEmptyURL(e)))if(n){let t=e.replace(JOIN_LEADING_SLASH_RE,``);n=withTrailingSlash(n)+t}else n=e;return n}function joinRelativeURL(...e){let t=/\/(?!\/)/,n=e.filter(Boolean),r=[],i=0;for(let e of n)if(!(!e||e===`/`)){for(let[n,a]of e.split(t).entries())if(!(!a||a===`.`)){if(a===`..`){if(r.length===1&&hasProtocol(r[0]))continue;r.pop(),i--;continue}if(n===1&&r[r.length-1]?.endsWith(`:/`)){r[r.length-1]+=`/`+a;continue}r.push(a),i++}}let a=r.join(`/`);return i>=0?n[0]?.startsWith(`/`)&&!a.startsWith(`/`)?a=`/`+a:n[0]?.startsWith(`./`)&&!a.startsWith(`./`)&&(a=`./`+a):a=`../`.repeat(-1*i)+a,n[n.length-1]?.endsWith(`/`)&&!a.endsWith(`/`)&&(a+=`/`),a}function withoutProtocol(e){return withProtocol(e,``)}function withProtocol(e,n){let r=e.match(PROTOCOL_REGEX);return r||=e.match(/^\/{2,}/),r?n+e.slice(r[0].length):n+e}export{joinRelativeURL as a,withoutBase as c,withoutTrailingSlash as d,isRelative as i,withoutLeadingSlash as l,hasLeadingSlash as n,joinURL as o,hasProtocol as r,withTrailingSlash as s,cleanDoubleSlashes as t,withoutProtocol as u};
@@ -0,0 +1 @@
1
+ import{nonexhaustive}from"@likec4/core/utils";import{errorFromLogRecord,getMessageOnlyFormatter,getTextFormatter,loggable,logger}from"@likec4/log";const logger$1=logger.getChild(`server`);function logWarnError(e){logger$1.warn(loggable(e))}function getLspConnectionSink(t,n){let i=n?.formatter??getTextFormatter({format:({category:e,message:t})=>`${e} ${t}`});return n=>{try{switch(n.level){case`trace`:case`debug`:t.console.debug(i(n));break;case`info`:t.console.info(i(n));break;case`warning`:t.console.warn(i(n));break;case`error`:case`fatal`:t.console.error(i(n));break;default:nonexhaustive(n.level)}}catch(e){console.error(`Error while logging to LSP connection:`,e)}}}function getTelemetrySink(e){let r=getMessageOnlyFormatter();return n=>{try{switch(n.level){case`error`:case`fatal`:{let i=n.category.join(`.`);if(i===`likec4.config`)break;let a=errorFromLogRecord(n);a?e.telemetry.logEvent({eventName:`error`,message:`${a.name}: ${a.message}`,category:i,...a.stack&&{stack:a.stack}}):e.telemetry.logEvent({eventName:`error`,message:r(n),category:i});break}}}catch(e){console.error(`Error while logging to LSP connection:`,e)}}}export{logger$1 as i,getTelemetrySink as n,logWarnError as r,getLspConnectionSink as t};
@@ -1,42 +1 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
- var __exportAll = (all, symbols) => {
10
- let target = {};
11
- for (var name in all) {
12
- __defProp(target, name, {
13
- get: all[name],
14
- enumerable: true
15
- });
16
- }
17
- if (symbols) {
18
- __defProp(target, Symbol.toStringTag, { value: "Module" });
19
- }
20
- return target;
21
- };
22
- var __copyProps = (to, from, except, desc) => {
23
- if (from && typeof from === "object" || typeof from === "function") {
24
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
25
- key = keys[i];
26
- if (!__hasOwnProp.call(to, key) && key !== except) {
27
- __defProp(to, key, {
28
- get: ((k) => from[k]).bind(null, key),
29
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
- });
31
- }
32
- }
33
- }
34
- return to;
35
- };
36
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
37
- value: mod,
38
- enumerable: true
39
- }) : target, mod));
40
-
41
- //#endregion
42
- export { __exportAll as n, __toESM as r, __commonJSMin as t };
1
+ var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),__copyProps=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=__getOwnPropNames(i),l=0,u=c.length,d;l<u;l++)d=c[l],!__hasOwnProp.call(e,d)&&d!==o&&__defProp(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=__getOwnPropDesc(i,d))||s.enumerable});return e},__toESM=(n,r,a)=>(a=n==null?{}:__create(__getProtoOf(n)),__copyProps(r||!n||!n.__esModule?__defProp(a,`default`,{value:n,enumerable:!0}):a,n));export{__toESM as n,__commonJSMin as t};