@likec4/language-services 1.55.0 → 1.56.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.
@@ -4,6 +4,7 @@ import k from "tinyrainbow";
4
4
  import { LikeC4ProjectConfigOps, isLikeC4JsonConfig } from "@likec4/config";
5
5
  import { extname } from "pathe";
6
6
  import { entries, flatMap, hasAtLeast, join, map, partition, pipe, prop } from "remeda";
7
+ //#region src/common/LikeC4.ts
7
8
  const isErrorDiagnostic = (diagnostic) => {
8
9
  return diagnostic.severity === 1;
9
10
  };
@@ -177,14 +178,17 @@ Please specify a project folder`);
177
178
  await this.dispose();
178
179
  }
179
180
  };
181
+ //#endregion
182
+ //#region src/common/options.ts
180
183
  const DefaultInitOptions = {
181
184
  printErrors: true,
182
185
  throwIfInvalid: false,
183
186
  graphviz: "wasm",
184
- mcp: false,
185
187
  configureLogger: false,
186
188
  logLevel: void 0
187
189
  };
190
+ //#endregion
191
+ //#region src/common/handleInitOptions.ts
188
192
  const validationErrorsToError = (likec4) => /* @__PURE__ */ new Error(`Invalid model:\n${likec4.getErrors().map((e) => ` ${e.sourceFsPath}:${e.line} ${e.message.slice(0, 200)}`).join("\n")}`);
189
193
  async function handleInitOptions(langium, logger = rootLogger, options) {
190
194
  const likec4 = new LikeC4(langium, logger);
@@ -195,6 +199,8 @@ async function handleInitOptions(langium, logger = rootLogger, options) {
195
199
  if ((options?.printErrors ?? DefaultInitOptions.printErrors) && likec4.hasErrors()) likec4.printErrors();
196
200
  return likec4;
197
201
  }
202
+ //#endregion
203
+ //#region src/common/createFromSources.ts
198
204
  /**
199
205
  * Runtime-agnostic factory function to create a LikeC4 instance from sources
200
206
  */
@@ -236,4 +242,5 @@ async function createFromSources(langium, logger, sources, initOptions) {
236
242
  await langium.shared.workspace.DocumentBuilder.build(docs, { validation: true });
237
243
  return handleInitOptions(langium, logger, initOptions);
238
244
  }
245
+ //#endregion
239
246
  export { LikeC4 as i, handleInitOptions as n, DefaultInitOptions as r, createFromSources as t };
@@ -140,16 +140,6 @@ interface InitOptions {
140
140
  * @default 'wasm'
141
141
  */
142
142
  graphviz?: 'wasm' | 'binary';
143
- /**
144
- * Whether to start MCP server
145
- *
146
- * if port is specified, starts HTTP Streamable MCP server
147
- *
148
- * @default false
149
- */
150
- mcp?: false | 'stdio' | {
151
- port: number;
152
- };
153
143
  /**
154
144
  * Whether to configure the logger.
155
145
  *
@@ -179,4 +169,4 @@ type FromWorkspaceOptions = InitOptions & {
179
169
  watch?: boolean;
180
170
  };
181
171
  //#endregion
182
- export { LikeC4Langium as i, InitOptions as n, LikeC4 as r, FromWorkspaceOptions as t };
172
+ export { LikeC4LanguageServices as a, LikeC4Langium as i, InitOptions as n, LikeC4 as r, FromWorkspaceOptions as t };
@@ -1,4 +1,5 @@
1
- import { n as InitOptions, r as LikeC4, t as FromWorkspaceOptions } from "../_chunks/options.mjs";
1
+ import { i as LikeC4Langium, n as InitOptions, r as LikeC4, t as FromWorkspaceOptions } from "../_chunks/options.mjs";
2
+ import { LikeC4LanguageServices } from "@likec4/language-server/browser";
2
3
 
3
4
  //#region src/browser/index.d.ts
4
5
  /**
@@ -38,4 +39,4 @@ declare function fromSources(sources: Record<string, string>): Promise<LikeC4>;
38
39
  */
39
40
  declare function fromSource(source: string): Promise<LikeC4>;
40
41
  //#endregion
41
- export { type FromWorkspaceOptions, type InitOptions, type LikeC4, fromSource, fromSources, fromWorkdir, fromWorkspace };
42
+ export { type FromWorkspaceOptions, type InitOptions, LikeC4, type LikeC4Langium, type LikeC4LanguageServices, fromSource, fromSources, fromWorkdir, fromWorkspace };
@@ -1,6 +1,7 @@
1
- import { t as createFromSources } from "../_chunks/createFromSources.mjs";
1
+ import { i as LikeC4, t as createFromSources } from "../_chunks/createFromSources.mjs";
2
2
  import { configureLogger, getConsoleSink, getTextFormatter, rootLogger } from "@likec4/log";
3
3
  import { createLanguageServices } from "@likec4/language-server/browser";
4
+ //#region src/browser/index.ts
4
5
  /**
5
6
  * Create a LikeC4 instance from a workspace directory
6
7
  * @param _workspace - The workspace directory path
@@ -56,4 +57,5 @@ async function fromSources(sources) {
56
57
  async function fromSource(source) {
57
58
  return fromSources({ "source.c4": source });
58
59
  }
59
- export { fromSource, fromSources, fromWorkdir, fromWorkspace };
60
+ //#endregion
61
+ export { LikeC4, fromSource, fromSources, fromWorkdir, fromWorkspace };
@@ -1,4 +1,4 @@
1
- import { i as LikeC4Langium, n as InitOptions, r as LikeC4, t as FromWorkspaceOptions } from "../_chunks/options.mjs";
1
+ import { a as LikeC4LanguageServices, i as LikeC4Langium, n as InitOptions, r as LikeC4, t as FromWorkspaceOptions } from "../_chunks/options.mjs";
2
2
 
3
3
  //#region src/node/index.d.ts
4
4
  /**
@@ -40,4 +40,4 @@ declare function fromSources(sources: Record<string, string>, options?: InitOpti
40
40
  */
41
41
  declare function fromSource(source: string, options?: InitOptions): Promise<LikeC4>;
42
42
  //#endregion
43
- export { type FromWorkspaceOptions, type InitOptions, LikeC4, type LikeC4Langium, fromSource, fromSources, fromWorkdir, fromWorkspace };
43
+ export { type FromWorkspaceOptions, type InitOptions, LikeC4, type LikeC4Langium, type LikeC4LanguageServices, fromSource, fromSources, fromWorkdir, fromWorkspace };
@@ -11,10 +11,11 @@ import { WithFileSystem, WithLikeC4ManualLayouts } from "@likec4/language-server
11
11
  import { NoFileSystem, NoLikeC4ManualLayouts, WithGraphviz, createLanguageServices } from "@likec4/language-server/module";
12
12
  import { GraphvizWasmAdapter } from "@likec4/layouts";
13
13
  import { GraphvizBinaryAdapter } from "@likec4/layouts/graphviz/binary";
14
+ //#region src/node/configureLogger.ts
14
15
  function configureLogger$1(options) {
15
16
  const opt = options?.configureLogger ?? false;
16
17
  if (opt === false) return;
17
- if (opt === "stderr" || options?.mcp === "stdio") {
18
+ if (opt === "stderr") {
18
19
  configureLanguageServerLogger({
19
20
  useStdErr: true,
20
21
  colors: false,
@@ -27,6 +28,8 @@ function configureLogger$1(options) {
27
28
  logLevel: options?.logLevel
28
29
  });
29
30
  }
31
+ //#endregion
32
+ //#region src/node/createLanguageServices.ts
30
33
  function createLanguageServices$1(opts) {
31
34
  const logger = rootLogger.getChild("lang");
32
35
  const options = defu(opts, {
@@ -48,6 +51,8 @@ function createLanguageServices$1(opts) {
48
51
  ...WithGraphviz(useDotBin ? new GraphvizBinaryAdapter() : new GraphvizWasmAdapter())
49
52
  });
50
53
  }
54
+ //#endregion
55
+ //#region src/node/index.ts
51
56
  /**
52
57
  * Create a LikeC4 instance from a workspace directory
53
58
  *
@@ -79,7 +84,7 @@ async function fromWorkspace(path, options) {
79
84
  rootUri: workspace.uri,
80
85
  workspaceFolders: [workspace]
81
86
  });
82
- await WorkspaceManager.initializeWorkspace([workspace]);
87
+ await WorkspaceManager.initialized({});
83
88
  const userDocuments = langium.shared.workspace.LangiumDocuments.userDocuments.toArray();
84
89
  if (userDocuments.length === 0) {
85
90
  logger.error(`no LikeC4 sources found`);
@@ -131,4 +136,5 @@ async function fromSources(sources, options) {
131
136
  async function fromSource(source, options) {
132
137
  return fromSources({ "source.c4": source }, options);
133
138
  }
139
+ //#endregion
134
140
  export { LikeC4, fromSource, fromSources, fromWorkdir, fromWorkspace };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likec4/language-services",
3
3
  "description": "LikeC4 Language Services",
4
- "version": "1.55.0",
4
+ "version": "1.56.0",
5
5
  "license": "MIT",
6
6
  "bugs": "https://github.com/likec4/likec4/issues",
7
7
  "homepage": "https://likec4.dev",
@@ -64,30 +64,30 @@
64
64
  "defu": "^6.1.7",
65
65
  "remeda": "^2.33.7",
66
66
  "langium": "3.5.0",
67
- "tinyrainbow": "^3.0.3",
67
+ "tinyrainbow": "^3.1.0",
68
68
  "pathe": "^2.0.3",
69
69
  "ufo": "1.6.3",
70
70
  "std-env": "^3.10.0",
71
71
  "type-fest": "^4.41.0",
72
72
  "vscode-languageserver-types": "3.17.5",
73
- "@likec4/config": "1.55.0",
74
- "@likec4/generators": "1.55.0",
73
+ "@likec4/config": "1.56.0",
74
+ "@likec4/generators": "1.56.0",
75
+ "@likec4/language-server": "1.56.0",
76
+ "@likec4/core": "1.56.0",
75
77
  "@likec4/icons": "1.46.4",
76
- "@likec4/language-server": "1.55.0",
77
- "@likec4/layouts": "1.55.0",
78
- "@likec4/core": "1.55.0",
79
- "@likec4/log": "1.55.0"
78
+ "@likec4/layouts": "1.56.0",
79
+ "@likec4/log": "1.56.0"
80
80
  },
81
81
  "devDependencies": {
82
- "@types/node": "~22.19.15",
82
+ "@types/node": "~22.19.17",
83
83
  "obuild": "0.4.31",
84
84
  "oxlint": "1.59.0",
85
85
  "tsx": "4.21.0",
86
- "turbo": "2.9.5",
86
+ "turbo": "2.9.6",
87
87
  "typescript": "5.9.3",
88
88
  "vitest": "4.1.3",
89
89
  "@likec4/devops": "1.42.0",
90
- "@likec4/tsconfig": "1.55.0"
90
+ "@likec4/tsconfig": "1.56.0"
91
91
  },
92
92
  "scripts": {
93
93
  "typecheck": "tsc -b --verbose",