@likec4/config 1.55.1 → 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.
- package/dist/_chunks/libs/defu.mjs +2 -0
- package/dist/_chunks/libs/remeda.mjs +12 -0
- package/dist/index.mjs +12 -0
- package/dist/node/index.mjs +17 -2
- package/package.json +6 -6
- package/src/node/load-config.ts +3 -2
|
@@ -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);
|
|
@@ -36,4 +37,5 @@ createDefu((object, key, currentValue) => {
|
|
|
36
37
|
return true;
|
|
37
38
|
}
|
|
38
39
|
});
|
|
40
|
+
//#endregion
|
|
39
41
|
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 };
|
package/dist/node/index.mjs
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.56.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.
|
|
60
|
-
"@likec4/log": "1.
|
|
59
|
+
"@likec4/core": "1.56.0",
|
|
60
|
+
"@likec4/log": "1.56.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"bundle-require": "^5.1.0",
|
|
@@ -72,17 +72,17 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@types/node": "~22.19.
|
|
75
|
+
"@types/node": "~22.19.17",
|
|
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.
|
|
80
|
+
"turbo": "2.9.6",
|
|
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.
|
|
85
|
+
"@likec4/tsconfig": "1.56.0",
|
|
86
86
|
"@likec4/devops": "1.42.0"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
package/src/node/load-config.ts
CHANGED
|
@@ -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'
|
|
@@ -70,7 +71,7 @@ const loadJsonConfigs = async (filepath: string, stack: string[]): Promise<[...J
|
|
|
70
71
|
*/
|
|
71
72
|
export async function loadConfig(filepath: VscodeURI | string): Promise<LikeC4ProjectConfig> {
|
|
72
73
|
filepath = typeof filepath === 'string' ? filepath : filepath.fsPath
|
|
73
|
-
logger.getChild('config').debug`Loading config: ${filepath}`
|
|
74
|
+
logger.getChild('config').debug`Loading config: ${relative(cwd(), filepath)}`
|
|
74
75
|
|
|
75
76
|
const folder = dirname(filepath)
|
|
76
77
|
const filename = basename(filepath)
|