@likec4/config 1.55.1 → 1.57.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,3 +1,4 @@
1
+ //#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
1
2
  function isPlainObject(value) {
2
3
  if (value === null || typeof value !== "object") return false;
3
4
  const prototype = Object.getPrototypeOf(value);
@@ -24,16 +25,5 @@ function createDefu(merger) {
24
25
  return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
25
26
  }
26
27
  const defu = createDefu();
27
- createDefu((object, key, currentValue) => {
28
- if (object[key] !== void 0 && typeof currentValue === "function") {
29
- object[key] = currentValue(object[key]);
30
- return true;
31
- }
32
- });
33
- createDefu((object, key, currentValue) => {
34
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
35
- object[key] = currentValue(object[key]);
36
- return true;
37
- }
38
- });
28
+ //#endregion
39
29
  export { defu as t };
@@ -1,3 +1,4 @@
1
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
1
2
  function e$2(e, t, n) {
2
3
  let r = (n) => e(n, ...t);
3
4
  return n === void 0 ? r : Object.assign(r, {
@@ -5,23 +6,33 @@ function e$2(e, t, n) {
5
6
  lazyArgs: t
6
7
  });
7
8
  }
9
+ //#endregion
10
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/purry.js
8
11
  function t$3(t, n, r) {
9
12
  let i = t.length - n.length;
10
13
  if (i === 0) return t(...n);
11
14
  if (i === 1) return e$2(t, n, r);
12
15
  throw Error(`Wrong number of arguments`);
13
16
  }
17
+ //#endregion
18
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/hasAtLeast.js
14
19
  function t$2(...t) {
15
20
  return t$3(n$2, t);
16
21
  }
17
22
  const n$2 = (e, t) => e.length >= t;
23
+ //#endregion
24
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isNonNullish.js
18
25
  function e$1(e) {
19
26
  return e != null;
20
27
  }
28
+ //#endregion
29
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/last.js
21
30
  function t$1(...t) {
22
31
  return t$3(n$1, t);
23
32
  }
24
33
  const n$1 = (e) => e.at(-1);
34
+ //#endregion
35
+ //#region ../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/omit.js
25
36
  function n(...t) {
26
37
  return t$3(r, t);
27
38
  }
@@ -41,4 +52,5 @@ new Set([
41
52
  ...` .
42
53
  .\v.\f.\r. .….\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)
43
54
  ]);
55
+ //#endregion
44
56
  export { t$2 as i, t$1 as n, e$1 as r, n as t };
package/dist/index.mjs CHANGED
@@ -2,6 +2,7 @@ import JSON5 from "json5";
2
2
  import z from "zod/v4";
3
3
  import { BorderStyles, ElementShapes, IconPositions, RelationshipArrowTypes, Sizes, ThemeColors, computeColorValues } from "@likec4/core/styles";
4
4
  import { exact } from "@likec4/core/types";
5
+ //#region src/schema.image-alias.ts
5
6
  const IMAGE_ALIAS_KEY_REGEX = /^@[A-Za-z0-9_-]*$/;
6
7
  const IMAGE_ALIAS_VALUE_REGEX = /^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/;
7
8
  const ImageAliasKey = z.string().min(1, "Image alias key cannot be empty").regex(IMAGE_ALIAS_KEY_REGEX, "Image alias key must match /^@\\w+$/");
@@ -10,6 +11,8 @@ const ImageAliasesSchema = z.record(ImageAliasKey, ImageAliasValue).meta({
10
11
  id: "ImageAliases",
11
12
  description: "Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash)."
12
13
  });
14
+ //#endregion
15
+ //#region src/schema.include.ts
13
16
  const IncludePathValue = z.string().min(1, "Include path cannot be empty").regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/, "Include path must be a relative path (no leading slash, drive letter, or protocol)");
14
17
  const IncludeSchema = z.strictObject({
15
18
  paths: z.array(IncludePathValue).meta({ description: [
@@ -31,6 +34,8 @@ const IncludeSchema = z.strictObject({
31
34
  id: "include-config",
32
35
  description: ["Configuration for including additional LikeC4 source files from other directories.", "Example: { \"paths\": [\"../shared\", \"../common/specs\"], \"maxDepth\": 5, \"fileThreshold\": 50 }"].join("\n")
33
36
  });
37
+ //#endregion
38
+ //#region src/schema.theme.ts
34
39
  const opacity = z.int().min(0, "Opacity must be between 0 and 100").max(100, "Opacity must be between 0 and 100").meta({
35
40
  id: "Opacity",
36
41
  description: "Opacity 0-100%"
@@ -142,6 +147,8 @@ function normalizeStylesheets(stylesheets) {
142
147
  content: ""
143
148
  };
144
149
  }
150
+ //#endregion
151
+ //#region src/schema.ts
145
152
  const ManualLayoutsConfigSchema = z.strictObject({ outDir: z.string().default(".likec4").meta({ description: [
146
153
  "Path to the directory where manual layouts will be stored,",
147
154
  "relative to the folder containing the project config. ",
@@ -241,6 +248,8 @@ const LikeC4ProjectConfigOps = {
241
248
  };
242
249
  }
243
250
  };
251
+ //#endregion
252
+ //#region src/filenames.ts
244
253
  /** Trim trailing slashes and backslashes (no regex, avoids S5852 ReDoS). */
245
254
  function trimTrailingSlashes(s) {
246
255
  let end = s.length;
@@ -290,6 +299,8 @@ function isLikeC4NonJsonConfig(filename) {
290
299
  function isLikeC4Config(filename) {
291
300
  return isLikeC4JsonConfig(filename) || isLikeC4NonJsonConfig(filename);
292
301
  }
302
+ //#endregion
303
+ //#region src/define-config.ts
293
304
  /**
294
305
  * Defines LikeC4 Project, allows custom generators that can be executed using CLI:
295
306
  *
@@ -406,4 +417,5 @@ function defineTheme(theme) {
406
417
  function defineStyle(styles) {
407
418
  return LikeC4StylesConfigSchema.parse(styles);
408
419
  }
420
+ //#endregion
409
421
  export { ConfigFilenames, LikeC4ProjectConfigOps, LikeC4StylesConfigSchema, defineConfig, defineGenerators, defineStyle, defineTheme, defineThemeColor, isLikeC4Config, isLikeC4JsonConfig, isLikeC4NonJsonConfig };
@@ -9,7 +9,9 @@ import { logger, wrapError } from "@likec4/log";
9
9
  import { bundleRequire } from "bundle-require";
10
10
  import { formatMessagesSync } from "esbuild";
11
11
  import * as fs from "node:fs/promises";
12
- import { basename, dirname, resolve } from "node:path";
12
+ import { basename, dirname, relative, resolve } from "node:path";
13
+ import { cwd } from "node:process";
14
+ //#region src/schema.image-alias.ts
13
15
  const IMAGE_ALIAS_KEY_REGEX = /^@[A-Za-z0-9_-]*$/;
14
16
  const IMAGE_ALIAS_VALUE_REGEX = /^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/;
15
17
  const ImageAliasKey = z.string().min(1, "Image alias key cannot be empty").regex(IMAGE_ALIAS_KEY_REGEX, "Image alias key must match /^@\\w+$/");
@@ -18,6 +20,8 @@ const ImageAliasesSchema = z.record(ImageAliasKey, ImageAliasValue).meta({
18
20
  id: "ImageAliases",
19
21
  description: "Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash)."
20
22
  });
23
+ //#endregion
24
+ //#region src/schema.include.ts
21
25
  const IncludePathValue = z.string().min(1, "Include path cannot be empty").regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/, "Include path must be a relative path (no leading slash, drive letter, or protocol)");
22
26
  const IncludeSchema = z.strictObject({
23
27
  paths: z.array(IncludePathValue).meta({ description: [
@@ -39,6 +43,8 @@ const IncludeSchema = z.strictObject({
39
43
  id: "include-config",
40
44
  description: ["Configuration for including additional LikeC4 source files from other directories.", "Example: { \"paths\": [\"../shared\", \"../common/specs\"], \"maxDepth\": 5, \"fileThreshold\": 50 }"].join("\n")
41
45
  });
46
+ //#endregion
47
+ //#region src/schema.theme.ts
42
48
  const opacity = z.int().min(0, "Opacity must be between 0 and 100").max(100, "Opacity must be between 0 and 100").meta({
43
49
  id: "Opacity",
44
50
  description: "Opacity 0-100%"
@@ -150,6 +156,8 @@ function normalizeStylesheets(stylesheets) {
150
156
  content: ""
151
157
  };
152
158
  }
159
+ //#endregion
160
+ //#region src/schema.ts
153
161
  const ManualLayoutsConfigSchema = z.strictObject({ outDir: z.string().default(".likec4").meta({ description: [
154
162
  "Path to the directory where manual layouts will be stored,",
155
163
  "relative to the folder containing the project config. ",
@@ -249,6 +257,8 @@ const LikeC4ProjectConfigOps = {
249
257
  };
250
258
  }
251
259
  };
260
+ //#endregion
261
+ //#region src/filenames.ts
252
262
  /** Trim trailing slashes and backslashes (no regex, avoids S5852 ReDoS). */
253
263
  function trimTrailingSlashes(s) {
254
264
  let end = s.length;
@@ -298,6 +308,8 @@ function isLikeC4NonJsonConfig(filename) {
298
308
  function isLikeC4Config(filename) {
299
309
  return isLikeC4JsonConfig(filename) || isLikeC4NonJsonConfig(filename);
300
310
  }
311
+ //#endregion
312
+ //#region src/define-config.ts
301
313
  /**
302
314
  * Defines LikeC4 Project, allows custom generators that can be executed using CLI:
303
315
  *
@@ -414,6 +426,8 @@ function defineTheme(theme) {
414
426
  function defineStyle(styles) {
415
427
  return LikeC4StylesConfigSchema.parse(styles);
416
428
  }
429
+ //#endregion
430
+ //#region src/node/load-config.ts
417
431
  const JsonConfigInputSchema = LikeC4ProjectJsonConfigSchema.pick({
418
432
  extends: true,
419
433
  styles: true
@@ -457,7 +471,7 @@ const loadJsonConfigs = async (filepath, stack) => {
457
471
  */
458
472
  async function loadConfig(filepath) {
459
473
  filepath = typeof filepath === "string" ? filepath : filepath.fsPath;
460
- logger.getChild("config").debug`Loading config: ${filepath}`;
474
+ logger.getChild("config").debug`Loading config: ${relative(cwd(), filepath)}`;
461
475
  const folder = dirname(filepath);
462
476
  const filename = basename(filepath);
463
477
  const implicitcfg = { name: basename(folder) };
@@ -527,4 +541,5 @@ export {
527
541
  });
528
542
  return validateProjectConfig(Object.assign(implicitcfg, mod?.default ?? mod));
529
543
  }
544
+ //#endregion
530
545
  export { ConfigFilenames, LikeC4ProjectConfigOps, LikeC4StylesConfigSchema, defineConfig, defineGenerators, defineStyle, defineTheme, defineThemeColor, isLikeC4Config, isLikeC4JsonConfig, isLikeC4NonJsonConfig, loadConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/config",
3
- "version": "1.55.1",
3
+ "version": "1.57.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://likec4.dev",
6
6
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -56,8 +56,8 @@
56
56
  "json5": "^2.2.3",
57
57
  "zod": "^4.3.6",
58
58
  "type-fest": "^4.41.0",
59
- "@likec4/core": "1.55.1",
60
- "@likec4/log": "1.55.1"
59
+ "@likec4/core": "1.57.0",
60
+ "@likec4/log": "1.57.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "bundle-require": "^5.1.0",
@@ -72,18 +72,18 @@
72
72
  }
73
73
  },
74
74
  "devDependencies": {
75
- "@types/node": "~22.19.15",
75
+ "@types/node": "~22.19.19",
76
76
  "remeda": "^2.33.7",
77
77
  "defu": "^6.1.7",
78
78
  "ufo": "1.6.3",
79
79
  "tsx": "4.21.0",
80
- "turbo": "2.9.5",
80
+ "turbo": "2.9.14",
81
81
  "typescript": "5.9.3",
82
82
  "obuild": "0.4.31",
83
83
  "nano-spawn": "^2.0.0",
84
84
  "vitest": "4.1.3",
85
- "@likec4/tsconfig": "1.55.1",
86
- "@likec4/devops": "1.42.0"
85
+ "@likec4/tsconfig": "1.57.0",
86
+ "@likec4/devops": "1.57.0"
87
87
  },
88
88
  "scripts": {
89
89
  "generate": "tsx --conditions=sources scripts/generate.mts",
package/schema.json CHANGED
@@ -92,7 +92,6 @@
92
92
  "required": [
93
93
  "name"
94
94
  ],
95
- "id": "LikeC4ProjectConfig",
96
95
  "description": "LikeC4 Project Configuration",
97
96
  "$defs": {
98
97
  "ThemeCustomization": {
@@ -120,7 +119,6 @@
120
119
  }
121
120
  },
122
121
  "additionalProperties": false,
123
- "id": "ThemeCustomization",
124
122
  "description": "Customize theme colors and sizes"
125
123
  },
126
124
  "ThemeColorName": {
@@ -137,14 +135,10 @@
137
135
  "red",
138
136
  "secondary",
139
137
  "sky"
140
- ],
141
- "id": "ThemeColorName"
142
- },
143
- "CustomColorName": {
144
- "id": "CustomColorName"
138
+ ]
145
139
  },
140
+ "CustomColorName": {},
146
141
  "ColorName": {
147
- "id": "ColorName",
148
142
  "anyOf": [
149
143
  {
150
144
  "$ref": "#/$defs/ThemeColorName"
@@ -155,7 +149,6 @@
155
149
  ]
156
150
  },
157
151
  "ThemeColorValues": {
158
- "id": "ThemeColorValues",
159
152
  "description": "Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values",
160
153
  "anyOf": [
161
154
  {
@@ -167,7 +160,6 @@
167
160
  ]
168
161
  },
169
162
  "StrictThemeColorValues": {
170
- "id": "StrictThemeColorValues",
171
163
  "description": "Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color value",
172
164
  "type": "object",
173
165
  "properties": {
@@ -226,13 +218,11 @@
226
218
  "hiContrast",
227
219
  "loContrast"
228
220
  ],
229
- "additionalProperties": false,
230
- "id": "ElementColorValues"
221
+ "additionalProperties": false
231
222
  },
232
223
  "ColorLiteral": {
233
224
  "type": "string",
234
- "minLength": 1,
235
- "id": "ColorLiteral"
225
+ "minLength": 1
236
226
  },
237
227
  "RelationshipColorValues": {
238
228
  "type": "object",
@@ -255,8 +245,7 @@
255
245
  "line",
256
246
  "label"
257
247
  ],
258
- "additionalProperties": false,
259
- "id": "RelationshipColorValues"
248
+ "additionalProperties": false
260
249
  },
261
250
  "ElementSize": {
262
251
  "type": "string",
@@ -266,8 +255,7 @@
266
255
  "md",
267
256
  "lg",
268
257
  "xl"
269
- ],
270
- "id": "ElementSize"
258
+ ]
271
259
  },
272
260
  "Dimensions": {
273
261
  "type": "object",
@@ -286,7 +274,6 @@
286
274
  "height"
287
275
  ],
288
276
  "additionalProperties": false,
289
- "id": "Dimensions",
290
277
  "description": "Defines dimensions for theme size"
291
278
  },
292
279
  "DefaultStyleValues": {
@@ -324,14 +311,12 @@
324
311
  "$ref": "#/$defs/RelationshipDefaultStyleValues"
325
312
  }
326
313
  },
327
- "additionalProperties": false,
328
- "id": "DefaultStyleValues"
314
+ "additionalProperties": false
329
315
  },
330
316
  "Opacity": {
331
317
  "type": "integer",
332
318
  "minimum": 0,
333
319
  "maximum": 100,
334
- "id": "Opacity",
335
320
  "description": "Opacity 0-100%"
336
321
  },
337
322
  "BorderStyle": {
@@ -341,8 +326,7 @@
341
326
  "dashed",
342
327
  "dotted",
343
328
  "none"
344
- ],
345
- "id": "BorderStyle"
329
+ ]
346
330
  },
347
331
  "ElementShape": {
348
332
  "type": "string",
@@ -357,8 +341,7 @@
357
341
  "bucket",
358
342
  "document",
359
343
  "component"
360
- ],
361
- "id": "ElementShape"
344
+ ]
362
345
  },
363
346
  "IconPosition": {
364
347
  "type": "string",
@@ -367,8 +350,7 @@
367
350
  "right",
368
351
  "top",
369
352
  "bottom"
370
- ],
371
- "id": "IconPosition"
353
+ ]
372
354
  },
373
355
  "GroupDefaultStyleValues": {
374
356
  "type": "object",
@@ -386,8 +368,7 @@
386
368
  "$ref": "#/$defs/BorderStyle"
387
369
  }
388
370
  },
389
- "additionalProperties": false,
390
- "id": "GroupDefaultStyleValues"
371
+ "additionalProperties": false
391
372
  },
392
373
  "RelationshipDefaultStyleValues": {
393
374
  "type": "object",
@@ -406,7 +387,6 @@
406
387
  }
407
388
  },
408
389
  "additionalProperties": false,
409
- "id": "RelationshipDefaultStyleValues",
410
390
  "description": "Override default values for relationship style properties\nThese values will be used if such property is not defined"
411
391
  },
412
392
  "LineType": {
@@ -415,8 +395,7 @@
415
395
  "dashed",
416
396
  "solid",
417
397
  "dotted"
418
- ],
419
- "id": "LineType"
398
+ ]
420
399
  },
421
400
  "ArrowType": {
422
401
  "type": "string",
@@ -431,8 +410,7 @@
431
410
  "crow",
432
411
  "open",
433
412
  "vee"
434
- ],
435
- "id": "ArrowType"
413
+ ]
436
414
  },
437
415
  "CustomStylesheets": {
438
416
  "anyOf": [
@@ -447,8 +425,7 @@
447
425
  "minLength": 1
448
426
  }
449
427
  }
450
- ],
451
- "id": "CustomStylesheets"
428
+ ]
452
429
  },
453
430
  "ImageAliases": {
454
431
  "type": "object",
@@ -462,7 +439,6 @@
462
439
  "minLength": 1,
463
440
  "pattern": "^(?!\\/|[A-Za-z]:[\\\\\\/])(?!.*:\\/\\/).*$"
464
441
  },
465
- "id": "ImageAliases",
466
442
  "description": "Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash)."
467
443
  },
468
444
  "include-config": {
@@ -496,7 +472,6 @@
496
472
  "paths"
497
473
  ],
498
474
  "additionalProperties": false,
499
- "id": "include-config",
500
475
  "description": "Configuration for including additional LikeC4 source files from other directories.\nExample: { \"paths\": [\"../shared\", \"../common/specs\"], \"maxDepth\": 5, \"fileThreshold\": 50 }"
501
476
  },
502
477
  "ManualLayoutsConfig": {
@@ -509,7 +484,6 @@
509
484
  }
510
485
  },
511
486
  "additionalProperties": false,
512
- "id": "ManualLayoutsConfig",
513
487
  "description": "Configuration for manual layouts"
514
488
  },
515
489
  "LandingPageConfig": {
@@ -562,7 +536,6 @@
562
536
  "additionalProperties": false
563
537
  }
564
538
  ],
565
- "id": "LandingPageConfig",
566
539
  "description": "Configure the landing page. Use redirect to go to the index view, or include/exclude to filter the view grid."
567
540
  }
568
541
  }
@@ -5,7 +5,8 @@ import { defu } from 'defu'
5
5
  import { formatMessagesSync } from 'esbuild'
6
6
  import JSON5 from 'json5'
7
7
  import * as fs from 'node:fs/promises'
8
- import { basename, dirname, resolve } from 'node:path'
8
+ import { basename, dirname, relative, resolve } from 'node:path'
9
+ import { cwd } from 'node:process'
9
10
  import { hasAtLeast, isNonNullish, last, omit } from 'remeda'
10
11
  import z from 'zod/v4'
11
12
  import { isLikeC4JsonConfig, isLikeC4NonJsonConfig } from '../filenames'
@@ -18,7 +19,6 @@ const JsonConfigInputSchema = LikeC4ProjectJsonConfigSchema.pick({
18
19
  }).loose()
19
20
 
20
21
  type JsonConfigInput = z.infer<typeof JsonConfigInputSchema>
21
- type JsonConfigStyles = NonNullable<JsonConfigInput['styles']>
22
22
 
23
23
  const normalizeExtends = (value: JsonConfigInput['extends']): string[] => {
24
24
  if (!value) {
@@ -70,7 +70,7 @@ const loadJsonConfigs = async (filepath: string, stack: string[]): Promise<[...J
70
70
  */
71
71
  export async function loadConfig(filepath: VscodeURI | string): Promise<LikeC4ProjectConfig> {
72
72
  filepath = typeof filepath === 'string' ? filepath : filepath.fsPath
73
- logger.getChild('config').debug`Loading config: ${filepath}`
73
+ logger.getChild('config').debug`Loading config: ${relative(cwd(), filepath)}`
74
74
 
75
75
  const folder = dirname(filepath)
76
76
  const filename = basename(filepath)