likec4 1.52.0 → 1.53.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 (36) hide show
  1. package/__app__/src/likec4.js +34 -48
  2. package/__app__/src/routes/index.js +7 -0
  3. package/__app__/src/routes/single.js +30 -18
  4. package/__app__/src/style.css +1 -1
  5. package/__app__/src/vendors.js +2065 -2809
  6. package/config/schema.json +56 -0
  7. package/dist/THIRD-PARTY-LICENSES.md +10 -2
  8. package/dist/_chunks/filesystem.mjs +70 -68
  9. package/dist/_chunks/index.d.mts +10 -1
  10. package/dist/_chunks/index2.d.mts +76 -4
  11. package/dist/_chunks/libs/@hono/mcp.mjs +1 -1
  12. package/dist/_chunks/libs/@logtape/logtape.d.mts +1021 -0
  13. package/dist/_chunks/libs/@logtape/logtape.mjs +4 -6
  14. package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +1 -1
  15. package/dist/_chunks/libs/@nanostores/react.d.mts +5 -5
  16. package/dist/_chunks/libs/destr.mjs +1 -0
  17. package/dist/_chunks/libs/fast-equals.mjs +1 -1
  18. package/dist/_chunks/libs/langium.mjs +1 -1
  19. package/dist/_chunks/libs/remeda.mjs +2 -2
  20. package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
  21. package/dist/_chunks/libs/unstorage.mjs +1 -0
  22. package/dist/_chunks/node.mjs +1 -0
  23. package/dist/_chunks/sequence.mjs +1 -1
  24. package/dist/_chunks/src.mjs +14 -12
  25. package/dist/_chunks/src2.mjs +46 -46
  26. package/dist/cli/index.mjs +164 -84
  27. package/dist/index.d.mts +16 -819
  28. package/dist/index.mjs +1 -1
  29. package/dist/vite-plugin/index.mjs +1 -1
  30. package/dist/vite-plugin/internal.mjs +1 -1
  31. package/package.json +34 -33
  32. package/react/index.d.mts +24 -20
  33. package/react/index.mjs +969 -1728
  34. package/vite-plugin-modules.d.ts +5 -0
  35. package/dist/_chunks/LikeC4.mjs +0 -1
  36. package/dist/_chunks/libs/boxen.d.mts +0 -1
package/dist/index.d.mts CHANGED
@@ -1,818 +1,14 @@
1
1
  import "./_chunks/libs/@modelcontextprotocol/sdk.mjs";
2
2
  import "./_chunks/index.mjs";
3
+ import { t as Logger } from "./_chunks/libs/@logtape/logtape.mjs";
3
4
  import "./_chunks/libs/langium.mjs";
4
5
  import { a as LikeC4Views, i as LikeC4SharedServices, n as LikeC4ModelBuilder, o as ProjectsManager, r as LikeC4Services, t as LikeC4LanguageServices } from "./_chunks/index2.mjs";
5
6
  import "./_chunks/libs/@chevrotain/types.mjs";
6
7
  import "./_chunks/libs/ts-graphviz.mjs";
7
- import "./_chunks/libs/boxen.mjs";
8
8
  import { LikeC4Model } from "@likec4/core/model";
9
9
  import { LayoutedView, NonEmptyArray, ProjectId } from "@likec4/core/types";
10
10
  export * from "@likec4/core/types";
11
11
 
12
- //#region ../log/dist/_chunks/libs/@logtape/logtape.d.mts
13
- /**
14
- * Runs a callback with the given implicit context. Every single log record
15
- * in the callback will have the given context.
16
- *
17
- * If no `contextLocalStorage` is configured, this function does nothing and
18
- * just returns the return value of the callback. It also logs a warning to
19
- * the `["logtape", "meta"]` logger in this case.
20
- * @param context The context to inject.
21
- * @param callback The callback to run.
22
- * @returns The return value of the callback.
23
- * @since 0.7.0
24
- */
25
- //#endregion
26
- //#region ../../node_modules/.pnpm/@logtape+logtape@1.3.7/node_modules/@logtape/logtape/dist/level.d.ts
27
- //#region src/level.d.ts
28
- declare const logLevels: readonly ["trace", "debug", "info", "warning", "error", "fatal"];
29
- /**
30
- * The severity level of a {@link LogRecord}.
31
- */
32
- type LogLevel = typeof logLevels[number];
33
- /**
34
- * Lists all available log levels with the order of their severity.
35
- * The `"trace"` level goes first, and the `"fatal"` level goes last.
36
- * @returns A new copy of the array of log levels.
37
- * @since 1.0.0
38
- */
39
- //#endregion
40
- //#region ../../node_modules/.pnpm/@logtape+logtape@1.3.7/node_modules/@logtape/logtape/dist/record.d.ts
41
- //#region src/record.d.ts
42
- /**
43
- * A log record.
44
- */
45
- interface LogRecord {
46
- /**
47
- * The category of the logger that produced the log record.
48
- */
49
- readonly category: readonly string[];
50
- /**
51
- * The log level.
52
- */
53
- readonly level: LogLevel;
54
- /**
55
- * The log message. This is the result of substituting the message template
56
- * with the values. The number of elements in this array is always odd,
57
- * with the message template values interleaved between the substitution
58
- * values.
59
- */
60
- readonly message: readonly unknown[];
61
- /**
62
- * The raw log message. This is the original message template without any
63
- * further processing. It can be either:
64
- *
65
- * - A string without any substitutions if the log record was created with
66
- * a method call syntax, e.g., "Hello, {name}!" for
67
- * `logger.info("Hello, {name}!", { name })`.
68
- * - A template string array if the log record was created with a tagged
69
- * template literal syntax, e.g., `["Hello, ", "!"]` for
70
- * ``logger.info`Hello, ${name}!```.
71
- *
72
- * @since 0.6.0
73
- */
74
- readonly rawMessage: string | TemplateStringsArray;
75
- /**
76
- * The timestamp of the log record in milliseconds since the Unix epoch.
77
- */
78
- readonly timestamp: number;
79
- /**
80
- * The extra properties of the log record.
81
- */
82
- readonly properties: Record<string, unknown>;
83
- } //# sourceMappingURL=record.d.ts.map
84
- //#endregion
85
- //#endregion
86
- //#region ../../node_modules/.pnpm/@logtape+logtape@1.3.7/node_modules/@logtape/logtape/dist/filter.d.ts
87
- //#region src/filter.d.ts
88
- /**
89
- * A filter is a function that accepts a log record and returns `true` if the
90
- * record should be passed to the sink.
91
- *
92
- * @param record The log record to filter.
93
- * @returns `true` if the record should be passed to the sink.
94
- */
95
- /**
96
- * Configure the loggers with the specified configuration.
97
- *
98
- * Note that if the given sinks or filters are disposable, they will be
99
- * disposed when the configuration is reset, or when the process exits.
100
- *
101
- * @example
102
- * ```typescript
103
- * await configure({
104
- * sinks: {
105
- * console: getConsoleSink(),
106
- * },
107
- * filters: {
108
- * slow: (log) =>
109
- * "duration" in log.properties &&
110
- * log.properties.duration as number > 1000,
111
- * },
112
- * loggers: [
113
- * {
114
- * category: "my-app",
115
- * sinks: ["console"],
116
- * lowestLevel: "info",
117
- * },
118
- * {
119
- * category: ["my-app", "sql"],
120
- * filters: ["slow"],
121
- * lowestLevel: "debug",
122
- * },
123
- * {
124
- * category: "logtape",
125
- * sinks: ["console"],
126
- * lowestLevel: "error",
127
- * },
128
- * ],
129
- * });
130
- * ```
131
- *
132
- * @param config The configuration.
133
- */
134
- //#endregion
135
- //#region ../../node_modules/.pnpm/@logtape+logtape@1.3.7/node_modules/@logtape/logtape/dist/logger.d.ts
136
- //#region src/logger.d.ts
137
- /**
138
- * A logger interface. It provides methods to log messages at different
139
- * severity levels.
140
- *
141
- * ```typescript
142
- * const logger = getLogger("category");
143
- * logger.trace `A trace message with ${value}`
144
- * logger.debug `A debug message with ${value}.`;
145
- * logger.info `An info message with ${value}.`;
146
- * logger.warn `A warning message with ${value}.`;
147
- * logger.error `An error message with ${value}.`;
148
- * logger.fatal `A fatal error message with ${value}.`;
149
- * ```
150
- */
151
- interface Logger$1 {
152
- /**
153
- * The category of the logger. It is an array of strings.
154
- */
155
- readonly category: readonly string[];
156
- /**
157
- * The logger with the supercategory of the current logger. If the current
158
- * logger is the root logger, this is `null`.
159
- */
160
- readonly parent: Logger$1 | null;
161
- /**
162
- * Get a child logger with the given subcategory.
163
- *
164
- * ```typescript
165
- * const logger = getLogger("category");
166
- * const subLogger = logger.getChild("sub-category");
167
- * ```
168
- *
169
- * The above code is equivalent to:
170
- *
171
- * ```typescript
172
- * const logger = getLogger("category");
173
- * const subLogger = getLogger(["category", "sub-category"]);
174
- * ```
175
- *
176
- * @param subcategory The subcategory.
177
- * @returns The child logger.
178
- */
179
- getChild(subcategory: string | readonly [string] | readonly [string, ...string[]]): Logger$1;
180
- /**
181
- * Get a logger with contextual properties. This is useful for
182
- * log multiple messages with the shared set of properties.
183
- *
184
- * ```typescript
185
- * const logger = getLogger("category");
186
- * const ctx = logger.with({ foo: 123, bar: "abc" });
187
- * ctx.info("A message with {foo} and {bar}.");
188
- * ctx.warn("Another message with {foo}, {bar}, and {baz}.", { baz: true });
189
- * ```
190
- *
191
- * The above code is equivalent to:
192
- *
193
- * ```typescript
194
- * const logger = getLogger("category");
195
- * logger.info("A message with {foo} and {bar}.", { foo: 123, bar: "abc" });
196
- * logger.warn(
197
- * "Another message with {foo}, {bar}, and {baz}.",
198
- * { foo: 123, bar: "abc", baz: true },
199
- * );
200
- * ```
201
- *
202
- * @param properties
203
- * @returns
204
- * @since 0.5.0
205
- */
206
- with(properties: Record<string, unknown>): Logger$1;
207
- /**
208
- * Log a trace message. Use this as a template string prefix.
209
- *
210
- * ```typescript
211
- * logger.trace `A trace message with ${value}.`;
212
- * ```
213
- *
214
- * @param message The message template strings array.
215
- * @param values The message template values.
216
- * @since 0.12.0
217
- */
218
- trace(message: TemplateStringsArray, ...values: readonly unknown[]): void;
219
- /**
220
- * Log a trace message with properties.
221
- *
222
- * ```typescript
223
- * logger.trace('A trace message with {value}.', { value });
224
- * ```
225
- *
226
- * If the properties are expensive to compute, you can pass a callback that
227
- * returns the properties:
228
- *
229
- * ```typescript
230
- * logger.trace(
231
- * 'A trace message with {value}.',
232
- * () => ({ value: expensiveComputation() })
233
- * );
234
- * ```
235
- *
236
- * @param message The message template. Placeholders to be replaced with
237
- * `values` are indicated by keys in curly braces (e.g.,
238
- * `{value}`).
239
- * @param properties The values to replace placeholders with. For lazy
240
- * evaluation, this can be a callback that returns the
241
- * properties.
242
- * @since 0.12.0
243
- */
244
- trace(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
245
- /**
246
- * Log a trace values with no message. This is useful when you
247
- * want to log properties without a message, e.g., when you want to log
248
- * the context of a request or an operation.
249
- *
250
- * ```typescript
251
- * logger.trace({ method: 'GET', url: '/api/v1/resource' });
252
- * ```
253
- *
254
- * Note that this is a shorthand for:
255
- *
256
- * ```typescript
257
- * logger.trace('{*}', { method: 'GET', url: '/api/v1/resource' });
258
- * ```
259
- *
260
- * If the properties are expensive to compute, you cannot use this shorthand
261
- * and should use the following syntax instead:
262
- *
263
- * ```typescript
264
- * logger.trace('{*}', () => ({
265
- * method: expensiveMethod(),
266
- * url: expensiveUrl(),
267
- * }));
268
- * ```
269
- *
270
- * @param properties The values to log. Note that this does not take
271
- * a callback.
272
- * @since 0.12.0
273
- */
274
- trace(properties: Record<string, unknown>): void;
275
- /**
276
- * Lazily log a trace message. Use this when the message values are expensive
277
- * to compute and should only be computed if the message is actually logged.
278
- *
279
- * ```typescript
280
- * logger.trace(l => l`A trace message with ${expensiveValue()}.`);
281
- * ```
282
- *
283
- * @param callback A callback that returns the message template prefix.
284
- * @throws {TypeError} If no log record was made inside the callback.
285
- * @since 0.12.0
286
- */
287
- trace(callback: LogCallback): void;
288
- /**
289
- * Log a debug message. Use this as a template string prefix.
290
- *
291
- * ```typescript
292
- * logger.debug `A debug message with ${value}.`;
293
- * ```
294
- *
295
- * @param message The message template strings array.
296
- * @param values The message template values.
297
- */
298
- debug(message: TemplateStringsArray, ...values: readonly unknown[]): void;
299
- /**
300
- * Log a debug message with properties.
301
- *
302
- * ```typescript
303
- * logger.debug('A debug message with {value}.', { value });
304
- * ```
305
- *
306
- * If the properties are expensive to compute, you can pass a callback that
307
- * returns the properties:
308
- *
309
- * ```typescript
310
- * logger.debug(
311
- * 'A debug message with {value}.',
312
- * () => ({ value: expensiveComputation() })
313
- * );
314
- * ```
315
- *
316
- * @param message The message template. Placeholders to be replaced with
317
- * `values` are indicated by keys in curly braces (e.g.,
318
- * `{value}`).
319
- * @param properties The values to replace placeholders with. For lazy
320
- * evaluation, this can be a callback that returns the
321
- * properties.
322
- */
323
- debug(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
324
- /**
325
- * Log a debug values with no message. This is useful when you
326
- * want to log properties without a message, e.g., when you want to log
327
- * the context of a request or an operation.
328
- *
329
- * ```typescript
330
- * logger.debug({ method: 'GET', url: '/api/v1/resource' });
331
- * ```
332
- *
333
- * Note that this is a shorthand for:
334
- *
335
- * ```typescript
336
- * logger.debug('{*}', { method: 'GET', url: '/api/v1/resource' });
337
- * ```
338
- *
339
- * If the properties are expensive to compute, you cannot use this shorthand
340
- * and should use the following syntax instead:
341
- *
342
- * ```typescript
343
- * logger.debug('{*}', () => ({
344
- * method: expensiveMethod(),
345
- * url: expensiveUrl(),
346
- * }));
347
- * ```
348
- *
349
- * @param properties The values to log. Note that this does not take
350
- * a callback.
351
- * @since 0.11.0
352
- */
353
- debug(properties: Record<string, unknown>): void;
354
- /**
355
- * Lazily log a debug message. Use this when the message values are expensive
356
- * to compute and should only be computed if the message is actually logged.
357
- *
358
- * ```typescript
359
- * logger.debug(l => l`A debug message with ${expensiveValue()}.`);
360
- * ```
361
- *
362
- * @param callback A callback that returns the message template prefix.
363
- * @throws {TypeError} If no log record was made inside the callback.
364
- */
365
- debug(callback: LogCallback): void;
366
- /**
367
- * Log an informational message. Use this as a template string prefix.
368
- *
369
- * ```typescript
370
- * logger.info `An info message with ${value}.`;
371
- * ```
372
- *
373
- * @param message The message template strings array.
374
- * @param values The message template values.
375
- */
376
- info(message: TemplateStringsArray, ...values: readonly unknown[]): void;
377
- /**
378
- * Log an informational message with properties.
379
- *
380
- * ```typescript
381
- * logger.info('An info message with {value}.', { value });
382
- * ```
383
- *
384
- * If the properties are expensive to compute, you can pass a callback that
385
- * returns the properties:
386
- *
387
- * ```typescript
388
- * logger.info(
389
- * 'An info message with {value}.',
390
- * () => ({ value: expensiveComputation() })
391
- * );
392
- * ```
393
- *
394
- * @param message The message template. Placeholders to be replaced with
395
- * `values` are indicated by keys in curly braces (e.g.,
396
- * `{value}`).
397
- * @param properties The values to replace placeholders with. For lazy
398
- * evaluation, this can be a callback that returns the
399
- * properties.
400
- */
401
- info(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
402
- /**
403
- * Log an informational values with no message. This is useful when you
404
- * want to log properties without a message, e.g., when you want to log
405
- * the context of a request or an operation.
406
- *
407
- * ```typescript
408
- * logger.info({ method: 'GET', url: '/api/v1/resource' });
409
- * ```
410
- *
411
- * Note that this is a shorthand for:
412
- *
413
- * ```typescript
414
- * logger.info('{*}', { method: 'GET', url: '/api/v1/resource' });
415
- * ```
416
- *
417
- * If the properties are expensive to compute, you cannot use this shorthand
418
- * and should use the following syntax instead:
419
- *
420
- * ```typescript
421
- * logger.info('{*}', () => ({
422
- * method: expensiveMethod(),
423
- * url: expensiveUrl(),
424
- * }));
425
- * ```
426
- *
427
- * @param properties The values to log. Note that this does not take
428
- * a callback.
429
- * @since 0.11.0
430
- */
431
- info(properties: Record<string, unknown>): void;
432
- /**
433
- * Lazily log an informational message. Use this when the message values are
434
- * expensive to compute and should only be computed if the message is actually
435
- * logged.
436
- *
437
- * ```typescript
438
- * logger.info(l => l`An info message with ${expensiveValue()}.`);
439
- * ```
440
- *
441
- * @param callback A callback that returns the message template prefix.
442
- * @throws {TypeError} If no log record was made inside the callback.
443
- */
444
- info(callback: LogCallback): void;
445
- /**
446
- * Log a warning message. Use this as a template string prefix.
447
- *
448
- * ```typescript
449
- * logger.warn `A warning message with ${value}.`;
450
- * ```
451
- *
452
- * @param message The message template strings array.
453
- * @param values The message template values.
454
- */
455
- warn(message: TemplateStringsArray, ...values: readonly unknown[]): void;
456
- /**
457
- * Log a warning message with properties.
458
- *
459
- * ```typescript
460
- * logger.warn('A warning message with {value}.', { value });
461
- * ```
462
- *
463
- * If the properties are expensive to compute, you can pass a callback that
464
- * returns the properties:
465
- *
466
- * ```typescript
467
- * logger.warn(
468
- * 'A warning message with {value}.',
469
- * () => ({ value: expensiveComputation() })
470
- * );
471
- * ```
472
- *
473
- * @param message The message template. Placeholders to be replaced with
474
- * `values` are indicated by keys in curly braces (e.g.,
475
- * `{value}`).
476
- * @param properties The values to replace placeholders with. For lazy
477
- * evaluation, this can be a callback that returns the
478
- * properties.
479
- */
480
- warn(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
481
- /**
482
- * Log a warning values with no message. This is useful when you
483
- * want to log properties without a message, e.g., when you want to log
484
- * the context of a request or an operation.
485
- *
486
- * ```typescript
487
- * logger.warn({ method: 'GET', url: '/api/v1/resource' });
488
- * ```
489
- *
490
- * Note that this is a shorthand for:
491
- *
492
- * ```typescript
493
- * logger.warn('{*}', { method: 'GET', url: '/api/v1/resource' });
494
- * ```
495
- *
496
- * If the properties are expensive to compute, you cannot use this shorthand
497
- * and should use the following syntax instead:
498
- *
499
- * ```typescript
500
- * logger.warn('{*}', () => ({
501
- * method: expensiveMethod(),
502
- * url: expensiveUrl(),
503
- * }));
504
- * ```
505
- *
506
- * @param properties The values to log. Note that this does not take
507
- * a callback.
508
- * @since 0.11.0
509
- */
510
- warn(properties: Record<string, unknown>): void;
511
- /**
512
- * Lazily log a warning message. Use this when the message values are
513
- * expensive to compute and should only be computed if the message is actually
514
- * logged.
515
- *
516
- * ```typescript
517
- * logger.warn(l => l`A warning message with ${expensiveValue()}.`);
518
- * ```
519
- *
520
- * @param callback A callback that returns the message template prefix.
521
- * @throws {TypeError} If no log record was made inside the callback.
522
- */
523
- warn(callback: LogCallback): void;
524
- /**
525
- * Log a warning message. Use this as a template string prefix.
526
- *
527
- * ```typescript
528
- * logger.warning `A warning message with ${value}.`;
529
- * ```
530
- *
531
- * @param message The message template strings array.
532
- * @param values The message template values.
533
- * @since 0.12.0
534
- */
535
- warning(message: TemplateStringsArray, ...values: readonly unknown[]): void;
536
- /**
537
- * Log a warning message with properties.
538
- *
539
- * ```typescript
540
- * logger.warning('A warning message with {value}.', { value });
541
- * ```
542
- *
543
- * If the properties are expensive to compute, you can pass a callback that
544
- * returns the properties:
545
- *
546
- * ```typescript
547
- * logger.warning(
548
- * 'A warning message with {value}.',
549
- * () => ({ value: expensiveComputation() })
550
- * );
551
- * ```
552
- *
553
- * @param message The message template. Placeholders to be replaced with
554
- * `values` are indicated by keys in curly braces (e.g.,
555
- * `{value}`).
556
- * @param properties The values to replace placeholders with. For lazy
557
- * evaluation, this can be a callback that returns the
558
- * properties.
559
- * @since 0.12.0
560
- */
561
- warning(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
562
- /**
563
- * Log a warning values with no message. This is useful when you
564
- * want to log properties without a message, e.g., when you want to log
565
- * the context of a request or an operation.
566
- *
567
- * ```typescript
568
- * logger.warning({ method: 'GET', url: '/api/v1/resource' });
569
- * ```
570
- *
571
- * Note that this is a shorthand for:
572
- *
573
- * ```typescript
574
- * logger.warning('{*}', { method: 'GET', url: '/api/v1/resource' });
575
- * ```
576
- *
577
- * If the properties are expensive to compute, you cannot use this shorthand
578
- * and should use the following syntax instead:
579
- *
580
- * ```typescript
581
- * logger.warning('{*}', () => ({
582
- * method: expensiveMethod(),
583
- * url: expensiveUrl(),
584
- * }));
585
- * ```
586
- *
587
- * @param properties The values to log. Note that this does not take
588
- * a callback.
589
- * @since 0.12.0
590
- */
591
- warning(properties: Record<string, unknown>): void;
592
- /**
593
- * Lazily log a warning message. Use this when the message values are
594
- * expensive to compute and should only be computed if the message is actually
595
- * logged.
596
- *
597
- * ```typescript
598
- * logger.warning(l => l`A warning message with ${expensiveValue()}.`);
599
- * ```
600
- *
601
- * @param callback A callback that returns the message template prefix.
602
- * @throws {TypeError} If no log record was made inside the callback.
603
- * @since 0.12.0
604
- */
605
- warning(callback: LogCallback): void;
606
- /**
607
- * Log an error message. Use this as a template string prefix.
608
- *
609
- * ```typescript
610
- * logger.error `An error message with ${value}.`;
611
- * ```
612
- *
613
- * @param message The message template strings array.
614
- * @param values The message template values.
615
- */
616
- error(message: TemplateStringsArray, ...values: readonly unknown[]): void;
617
- /**
618
- * Log an error message with properties.
619
- *
620
- * ```typescript
621
- * logger.warn('An error message with {value}.', { value });
622
- * ```
623
- *
624
- * If the properties are expensive to compute, you can pass a callback that
625
- * returns the properties:
626
- *
627
- * ```typescript
628
- * logger.error(
629
- * 'An error message with {value}.',
630
- * () => ({ value: expensiveComputation() })
631
- * );
632
- * ```
633
- *
634
- * @param message The message template. Placeholders to be replaced with
635
- * `values` are indicated by keys in curly braces (e.g.,
636
- * `{value}`).
637
- * @param properties The values to replace placeholders with. For lazy
638
- * evaluation, this can be a callback that returns the
639
- * properties.
640
- */
641
- error(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
642
- /**
643
- * Log an error values with no message. This is useful when you
644
- * want to log properties without a message, e.g., when you want to log
645
- * the context of a request or an operation.
646
- *
647
- * ```typescript
648
- * logger.error({ method: 'GET', url: '/api/v1/resource' });
649
- * ```
650
- *
651
- * Note that this is a shorthand for:
652
- *
653
- * ```typescript
654
- * logger.error('{*}', { method: 'GET', url: '/api/v1/resource' });
655
- * ```
656
- *
657
- * If the properties are expensive to compute, you cannot use this shorthand
658
- * and should use the following syntax instead:
659
- *
660
- * ```typescript
661
- * logger.error('{*}', () => ({
662
- * method: expensiveMethod(),
663
- * url: expensiveUrl(),
664
- * }));
665
- * ```
666
- *
667
- * @param properties The values to log. Note that this does not take
668
- * a callback.
669
- * @since 0.11.0
670
- */
671
- error(properties: Record<string, unknown>): void;
672
- /**
673
- * Lazily log an error message. Use this when the message values are
674
- * expensive to compute and should only be computed if the message is actually
675
- * logged.
676
- *
677
- * ```typescript
678
- * logger.error(l => l`An error message with ${expensiveValue()}.`);
679
- * ```
680
- *
681
- * @param callback A callback that returns the message template prefix.
682
- * @throws {TypeError} If no log record was made inside the callback.
683
- */
684
- error(callback: LogCallback): void;
685
- /**
686
- * Log a fatal error message. Use this as a template string prefix.
687
- *
688
- * ```typescript
689
- * logger.fatal `A fatal error message with ${value}.`;
690
- * ```
691
- *
692
- * @param message The message template strings array.
693
- * @param values The message template values.
694
- */
695
- fatal(message: TemplateStringsArray, ...values: readonly unknown[]): void;
696
- /**
697
- * Log a fatal error message with properties.
698
- *
699
- * ```typescript
700
- * logger.warn('A fatal error message with {value}.', { value });
701
- * ```
702
- *
703
- * If the properties are expensive to compute, you can pass a callback that
704
- * returns the properties:
705
- *
706
- * ```typescript
707
- * logger.fatal(
708
- * 'A fatal error message with {value}.',
709
- * () => ({ value: expensiveComputation() })
710
- * );
711
- * ```
712
- *
713
- * @param message The message template. Placeholders to be replaced with
714
- * `values` are indicated by keys in curly braces (e.g.,
715
- * `{value}`).
716
- * @param properties The values to replace placeholders with. For lazy
717
- * evaluation, this can be a callback that returns the
718
- * properties.
719
- */
720
- fatal(message: string, properties?: Record<string, unknown> | (() => Record<string, unknown>)): void;
721
- /**
722
- * Log a fatal error values with no message. This is useful when you
723
- * want to log properties without a message, e.g., when you want to log
724
- * the context of a request or an operation.
725
- *
726
- * ```typescript
727
- * logger.fatal({ method: 'GET', url: '/api/v1/resource' });
728
- * ```
729
- *
730
- * Note that this is a shorthand for:
731
- *
732
- * ```typescript
733
- * logger.fatal('{*}', { method: 'GET', url: '/api/v1/resource' });
734
- * ```
735
- *
736
- * If the properties are expensive to compute, you cannot use this shorthand
737
- * and should use the following syntax instead:
738
- *
739
- * ```typescript
740
- * logger.fatal('{*}', () => ({
741
- * method: expensiveMethod(),
742
- * url: expensiveUrl(),
743
- * }));
744
- * ```
745
- *
746
- * @param properties The values to log. Note that this does not take
747
- * a callback.
748
- * @since 0.11.0
749
- */
750
- fatal(properties: Record<string, unknown>): void;
751
- /**
752
- * Lazily log a fatal error message. Use this when the message values are
753
- * expensive to compute and should only be computed if the message is actually
754
- * logged.
755
- *
756
- * ```typescript
757
- * logger.fatal(l => l`A fatal error message with ${expensiveValue()}.`);
758
- * ```
759
- *
760
- * @param callback A callback that returns the message template prefix.
761
- * @throws {TypeError} If no log record was made inside the callback.
762
- */
763
- fatal(callback: LogCallback): void;
764
- /**
765
- * Emits a log record with custom fields while using this logger's
766
- * category.
767
- *
768
- * This is a low-level API for integration scenarios where you need full
769
- * control over the log record, particularly for preserving timestamps
770
- * from external systems.
771
- *
772
- * ```typescript
773
- * const logger = getLogger(["my-app", "integration"]);
774
- *
775
- * // Emit a log with a custom timestamp
776
- * logger.emit({
777
- * timestamp: kafkaLog.originalTimestamp,
778
- * level: "info",
779
- * message: [kafkaLog.message],
780
- * rawMessage: kafkaLog.message,
781
- * properties: {
782
- * source: "kafka",
783
- * partition: kafkaLog.partition,
784
- * offset: kafkaLog.offset,
785
- * },
786
- * });
787
- * ```
788
- *
789
- * @param record Log record without category field (category comes from
790
- * the logger instance)
791
- * @since 1.1.0
792
- */
793
- emit(record: Omit<LogRecord, "category">): void;
794
- }
795
- /**
796
- * A logging callback function. It is used to defer the computation of a
797
- * message template until it is actually logged.
798
- * @param prefix The message template prefix.
799
- * @returns The rendered message array.
800
- */
801
- type LogCallback = (prefix: LogTemplatePrefix) => unknown[];
802
- /**
803
- * A logging template prefix function. It is used to log a message in
804
- * a {@link LogCallback} function.
805
- * @param message The message template strings array.
806
- * @param values The message template values.
807
- * @returns The rendered message array.
808
- */
809
- type LogTemplatePrefix = (message: TemplateStringsArray, ...values: unknown[]) => unknown[];
810
- /**
811
- * A function type for logging methods in the {@link Logger} interface.
812
- * @since 1.0.0
813
- */
814
- //#endregion
815
- //#endregion
816
12
  //#region ../language-services/dist/_chunks/options.d.mts
817
13
  //#region src/common/LikeC4.d.ts
818
14
  interface LikeC4Langium {
@@ -821,8 +17,8 @@ interface LikeC4Langium {
821
17
  }
822
18
  declare class LikeC4$1 {
823
19
  protected readonly langium: LikeC4Langium;
824
- protected readonly logger: Logger$1;
825
- constructor(langium: LikeC4Langium, logger?: Logger$1);
20
+ protected readonly logger: Logger;
21
+ constructor(langium: LikeC4Langium, logger?: Logger);
826
22
  /**
827
23
  * File system path to the workspace root
828
24
  */
@@ -888,6 +84,10 @@ declare class LikeC4$1 {
888
84
  * @returns true if there are errors
889
85
  */
890
86
  printErrors(): boolean;
87
+ /**
88
+ * Returns the number of parsed documents in the workspace
89
+ */
90
+ documentCount(): number;
891
91
  /**
892
92
  * @returns a function to dispose the listener
893
93
  */
@@ -928,14 +128,6 @@ interface LikeC4FormatOptions {
928
128
  } //#endregion
929
129
  //#region src/common/options.d.ts
930
130
  //#endregion
931
- //#region src/logger.d.ts
932
- /** Minimal logger interface (info, warn, error only). */
933
- type Logger = {
934
- info(msg: string): void;
935
- warn(msg: unknown): void;
936
- error(err: unknown): void;
937
- };
938
- //#endregion
939
131
  //#region src/LikeC4.d.ts
940
132
  type LikeC4Options = {
941
133
  /**
@@ -954,9 +146,9 @@ type LikeC4Options = {
954
146
  /**
955
147
  * Logger to use for the language service.
956
148
  * false - no output
957
- * @default 'default'
149
+ * @default 'console'
958
150
  */
959
- logger?: Logger | 'vite' | 'default' | false;
151
+ logger?: 'console' | 'stderr' | false;
960
152
  /**
961
153
  * Whether to use the `dot` binary for layouting or the WebAssembly version.
962
154
  * @default 'wasm'
@@ -974,15 +166,20 @@ type LikeC4Options = {
974
166
  * @default false
975
167
  */
976
168
  watch?: boolean;
169
+ /**
170
+ * The log level to use.
171
+ * Applied if {@link logger} is not `false`
172
+ */
173
+ logLevel?: 'trace' | 'debug' | 'info' | 'warning' | 'error' | undefined;
977
174
  };
978
175
  interface LikeC4 extends LikeC4$1 {}
979
176
  declare namespace LikeC4 {
980
- function fromSource(likec4SourceCode: string, opts?: LikeC4Options): Promise<LikeC4>;
177
+ function fromSource(likec4SourceCode: string, _opts?: LikeC4Options): Promise<LikeC4>;
981
178
  /**
982
179
  * Initializes a LikeC4 instance from the specified workspace path.
983
180
  * By default in current folder
984
181
  */
985
- function fromWorkspace(path?: string, opts?: LikeC4Options): Promise<LikeC4>;
182
+ function fromWorkspace(path?: string, _opts?: LikeC4Options): Promise<LikeC4>;
986
183
  }
987
184
  //#endregion
988
185
  export { LikeC4, type LikeC4Options };