@likec4/config 1.46.4 → 1.48.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/LICENSE +1 -1
- package/dist/_chunks/libs/remeda.mjs +31 -0
- package/dist/index.d.mts +324 -2217
- package/dist/index.mjs +407 -1
- package/dist/node/index.d.mts +504 -12
- package/dist/node/index.mjs +472 -51
- package/package.json +20 -22
- package/schema.json +88 -84
- package/src/define-config.ts +4 -9
- package/src/filenames.ts +2 -0
- package/src/node/index.ts +39 -1
- package/src/node/load-config.ts +7 -6
- package/src/schema.image-alias.ts +1 -1
- package/src/schema.include.ts +4 -4
- package/src/schema.theme.ts +98 -51
- package/src/schema.ts +16 -7
- package/dist/shared/config.CUC_rqhf.mjs +0 -376
- package/src/logger.ts +0 -3
package/src/schema.ts
CHANGED
|
@@ -12,14 +12,23 @@ import type {
|
|
|
12
12
|
} from '@likec4/core/types'
|
|
13
13
|
import JSON5 from 'json5'
|
|
14
14
|
import type { SimplifyDeep } from 'type-fest'
|
|
15
|
-
import
|
|
16
|
-
import * as z from 'zod'
|
|
15
|
+
import z from 'zod/v4'
|
|
17
16
|
import { ImageAliasesSchema, validateImageAliases } from './schema.image-alias'
|
|
18
17
|
import { IncludeSchema, validateIncludePaths } from './schema.include'
|
|
19
18
|
import { LikeC4StylesConfigSchema } from './schema.theme'
|
|
20
19
|
|
|
20
|
+
export interface VscodeURI {
|
|
21
|
+
readonly scheme: string
|
|
22
|
+
readonly authority: string
|
|
23
|
+
readonly path: string
|
|
24
|
+
readonly fsPath: string
|
|
25
|
+
readonly query: string
|
|
26
|
+
readonly fragment: string
|
|
27
|
+
toString(): string
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
export const ManualLayoutsConfigSchema = z
|
|
22
|
-
.
|
|
31
|
+
.strictObject({
|
|
23
32
|
outDir: z.string()
|
|
24
33
|
.default('.likec4')
|
|
25
34
|
.meta({
|
|
@@ -101,7 +110,7 @@ export type LocateResult = {
|
|
|
101
110
|
/**
|
|
102
111
|
* Full path to the source file
|
|
103
112
|
*/
|
|
104
|
-
document:
|
|
113
|
+
document: VscodeURI
|
|
105
114
|
/**
|
|
106
115
|
* Document path relative to the project folder
|
|
107
116
|
*/
|
|
@@ -120,7 +129,7 @@ export interface GeneratorFnContext {
|
|
|
120
129
|
/**
|
|
121
130
|
* Workspace root directory
|
|
122
131
|
*/
|
|
123
|
-
readonly workspace:
|
|
132
|
+
readonly workspace: VscodeURI
|
|
124
133
|
|
|
125
134
|
/**
|
|
126
135
|
* Current project
|
|
@@ -136,7 +145,7 @@ export interface GeneratorFnContext {
|
|
|
136
145
|
/**
|
|
137
146
|
* Project folder
|
|
138
147
|
*/
|
|
139
|
-
readonly folder:
|
|
148
|
+
readonly folder: VscodeURI
|
|
140
149
|
}
|
|
141
150
|
|
|
142
151
|
/**
|
|
@@ -158,7 +167,7 @@ export interface GeneratorFnContext {
|
|
|
158
167
|
* @param content - Content of the file
|
|
159
168
|
*/
|
|
160
169
|
write(file: {
|
|
161
|
-
path: string | string[] |
|
|
170
|
+
path: string | string[] | VscodeURI
|
|
162
171
|
content:
|
|
163
172
|
| string
|
|
164
173
|
| NodeJS.ArrayBufferView
|
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
import JSON5 from 'json5';
|
|
2
|
-
import * as z from 'zod';
|
|
3
|
-
import { computeColorValues, ElementShapes, Sizes, BorderStyles, RelationshipArrowTypes, ThemeColors } from '@likec4/core/styles';
|
|
4
|
-
import { exact } from '@likec4/core/types';
|
|
5
|
-
|
|
6
|
-
const IMAGE_ALIAS_KEY_REGEX = /^@[A-Za-z0-9_-]*$/;
|
|
7
|
-
const IMAGE_ALIAS_VALUE_REGEX = /^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/;
|
|
8
|
-
const ImageAliasValue = z.string().min(1, "Image alias value cannot be empty").regex(
|
|
9
|
-
IMAGE_ALIAS_VALUE_REGEX,
|
|
10
|
-
"Image alias value must be a relative path (no leading slash or protocol)"
|
|
11
|
-
);
|
|
12
|
-
const ImageAliasesSchema = z.record(
|
|
13
|
-
z.string(),
|
|
14
|
-
// PLAIN key schema - zod JSON schema export-safe.
|
|
15
|
-
ImageAliasValue
|
|
16
|
-
).meta({
|
|
17
|
-
description: "Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash)."
|
|
18
|
-
});
|
|
19
|
-
function validateImageAliases(imageAliases) {
|
|
20
|
-
const invalidKeys = [];
|
|
21
|
-
const invalidValues = [];
|
|
22
|
-
if (imageAliases) {
|
|
23
|
-
for (const [key, value] of Object.entries(imageAliases)) {
|
|
24
|
-
if (!IMAGE_ALIAS_KEY_REGEX.test(key)) {
|
|
25
|
-
invalidKeys.push(key);
|
|
26
|
-
}
|
|
27
|
-
if (!IMAGE_ALIAS_VALUE_REGEX.test(value)) {
|
|
28
|
-
invalidValues.push(`${key} -> ${value}`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (invalidKeys.length || invalidValues.length) {
|
|
33
|
-
const parts = [];
|
|
34
|
-
if (invalidKeys.length) {
|
|
35
|
-
parts.push(
|
|
36
|
-
`Invalid image alias key(s): ${invalidKeys.map((k) => JSON.stringify(k)).join(", ")} (must match ${IMAGE_ALIAS_KEY_REGEX})`
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
if (invalidValues.length) {
|
|
40
|
-
parts.push(
|
|
41
|
-
`Invalid image alias value(s): ${invalidValues.map((kv) => JSON.stringify(kv)).join(", ")} (must match ${IMAGE_ALIAS_VALUE_REGEX})`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
throw new Error(parts.join(" | "));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const RELATIVE_PATH_REGEX = /^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/;
|
|
49
|
-
const IncludePathValue = z.string().min(1, "Include path cannot be empty").regex(
|
|
50
|
-
RELATIVE_PATH_REGEX,
|
|
51
|
-
"Include path must be a relative path (no leading slash, drive letter, or protocol)"
|
|
52
|
-
);
|
|
53
|
-
const IncludeConfigSchema = z.object({
|
|
54
|
-
paths: z.array(IncludePathValue).min(1, "Include paths cannot be empty").meta({
|
|
55
|
-
description: [
|
|
56
|
-
"Additional relative directory paths to include LikeC4 source files from, searched recursively.",
|
|
57
|
-
"Paths are relative to the project folder (the folder containing this config file).",
|
|
58
|
-
'Example: ["../shared", "../common/specs"]'
|
|
59
|
-
].join("\n")
|
|
60
|
-
}),
|
|
61
|
-
maxDepth: z.number().int().min(1).max(20).default(3).meta({
|
|
62
|
-
description: [
|
|
63
|
-
"Maximum directory depth to scan when searching for .c4 files in include paths.",
|
|
64
|
-
"Prevents excessive scanning of deeply nested directories.",
|
|
65
|
-
"Default: 3"
|
|
66
|
-
].join("\n")
|
|
67
|
-
}),
|
|
68
|
-
fileThreshold: z.number().int().min(1).default(30).meta({
|
|
69
|
-
description: [
|
|
70
|
-
"Maximum number of files to load from include paths before warning.",
|
|
71
|
-
"Helps identify performance issues from accidentally including large directories.",
|
|
72
|
-
"Default: 30"
|
|
73
|
-
].join("\n")
|
|
74
|
-
})
|
|
75
|
-
}).meta({
|
|
76
|
-
id: "include-config",
|
|
77
|
-
description: "Configuration for including additional LikeC4 source files"
|
|
78
|
-
});
|
|
79
|
-
const IncludeSchema = IncludeConfigSchema.optional().meta({
|
|
80
|
-
description: [
|
|
81
|
-
"Configuration for including additional LikeC4 source files from other directories.",
|
|
82
|
-
'Example: { "paths": ["../shared", "../common/specs"], "maxDepth": 5, "fileThreshold": 50 }'
|
|
83
|
-
].join("\n")
|
|
84
|
-
});
|
|
85
|
-
function normalizeIncludeConfig(include) {
|
|
86
|
-
if (!include) {
|
|
87
|
-
return { paths: [], maxDepth: 3, fileThreshold: 30 };
|
|
88
|
-
}
|
|
89
|
-
return include;
|
|
90
|
-
}
|
|
91
|
-
function validateIncludePaths(include) {
|
|
92
|
-
if (!include?.paths) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const invalidPaths = [];
|
|
96
|
-
for (const path of include.paths) {
|
|
97
|
-
if (!RELATIVE_PATH_REGEX.test(path)) {
|
|
98
|
-
invalidPaths.push(path);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (invalidPaths.length) {
|
|
102
|
-
throw new Error(
|
|
103
|
-
`Invalid include path(s): ${invalidPaths.map((p) => JSON.stringify(p)).join(", ")} (must be relative paths without leading slash, drive letter, or protocol)`
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}
|
|
109
|
-
|
|
110
|
-
function t$1(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}
|
|
111
|
-
|
|
112
|
-
function t(...t){return t$1(n,t)}function n(e,t){let n={};for(let[r,i]of e.entries())n[i]=t(i,r,e);return n}
|
|
113
|
-
|
|
114
|
-
const opacity = z.int().min(0, "Opacity must be between 0 and 100").max(100, "Opacity must be between 0 and 100").meta({
|
|
115
|
-
id: "Opacity",
|
|
116
|
-
description: "Opacity 0-100%"
|
|
117
|
-
});
|
|
118
|
-
const shape = z.literal(ElementShapes).meta({ id: "ElementShape" });
|
|
119
|
-
const border = z.literal(BorderStyles).meta({ id: "BorderStyle" });
|
|
120
|
-
const size = z.literal(Sizes).meta({ id: "ElementSize" });
|
|
121
|
-
const arrow = z.literal(RelationshipArrowTypes).meta({ id: "ArrowType" });
|
|
122
|
-
const line = z.literal(["dashed", "solid", "dotted"]).meta({ id: "LineType" });
|
|
123
|
-
const themeColor = z.literal(ThemeColors).meta({ id: "ThemeColor" });
|
|
124
|
-
const color = z.union([
|
|
125
|
-
themeColor,
|
|
126
|
-
z.string().min(1, "Color name cannot be empty")
|
|
127
|
-
]).transform((value) => value).meta({ id: "ColorName" });
|
|
128
|
-
const colorValue = z.string().min(1, "Color value cannot be empty").transform((value) => value).meta({
|
|
129
|
-
id: "ColorLiteral",
|
|
130
|
-
description: "Color value in any valid CSS format: hex, rgb, rgba, hsl, hsla ..."
|
|
131
|
-
});
|
|
132
|
-
const colorSchema = colorValue;
|
|
133
|
-
const ElementColorValuesSchema = z.strictObject({
|
|
134
|
-
fill: colorSchema.meta({ description: "Background color" }),
|
|
135
|
-
stroke: colorSchema.meta({ description: "Stroke color (border, paths above background)" }),
|
|
136
|
-
hiContrast: colorSchema.meta({ description: "High contrast text color (title)" }),
|
|
137
|
-
loContrast: colorSchema.meta({ description: "Low contrast text color (description)" })
|
|
138
|
-
}).meta({ id: "ElementColorValues" }).transform((value) => value);
|
|
139
|
-
const RelationshipColorValuesSchema = z.strictObject({
|
|
140
|
-
line: colorSchema.meta({ description: "Line color" }),
|
|
141
|
-
label: colorSchema.meta({ description: "Label text color" }),
|
|
142
|
-
labelBg: colorSchema.optional().default("rgba(0, 0, 0, 0)").meta({ description: "Label background color" })
|
|
143
|
-
}).meta({ id: "RelationshipColorValues" }).transform((value) => value);
|
|
144
|
-
const ThemeColorValuesSchema = z.union([
|
|
145
|
-
colorSchema,
|
|
146
|
-
z.strictObject({
|
|
147
|
-
elements: z.union([colorSchema, ElementColorValuesSchema]).meta({ description: "Element color value (or a breakdown of specific color values)" }).transform((value) => {
|
|
148
|
-
if (typeof value === "string") {
|
|
149
|
-
return computeColorValues(value).elements;
|
|
150
|
-
}
|
|
151
|
-
return value;
|
|
152
|
-
}),
|
|
153
|
-
relationships: z.union([colorSchema, RelationshipColorValuesSchema]).meta({ description: "Relationship color value (or a breakdown of specific color values)" }).transform((value) => {
|
|
154
|
-
if (typeof value === "string") {
|
|
155
|
-
return computeColorValues(value).relationships;
|
|
156
|
-
}
|
|
157
|
-
return value;
|
|
158
|
-
})
|
|
159
|
-
})
|
|
160
|
-
]).meta({
|
|
161
|
-
id: "ThemeColorValues",
|
|
162
|
-
description: "Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values"
|
|
163
|
-
}).transform((value) => {
|
|
164
|
-
if (typeof value === "string") {
|
|
165
|
-
return computeColorValues(value);
|
|
166
|
-
}
|
|
167
|
-
return value;
|
|
168
|
-
});
|
|
169
|
-
const ThemeColorsSchema = z.union([
|
|
170
|
-
z.record(
|
|
171
|
-
color,
|
|
172
|
-
ThemeColorValuesSchema
|
|
173
|
-
),
|
|
174
|
-
z.object(
|
|
175
|
-
t(ThemeColors, () => ThemeColorValuesSchema.optional())
|
|
176
|
-
)
|
|
177
|
-
]).meta({
|
|
178
|
-
id: "ThemeColors",
|
|
179
|
-
description: "Override theme colors"
|
|
180
|
-
});
|
|
181
|
-
const DimensionsSchema = z.strictObject({
|
|
182
|
-
width: z.number().min(50),
|
|
183
|
-
height: z.number().min(50)
|
|
184
|
-
}).meta({
|
|
185
|
-
id: "Dimensions",
|
|
186
|
-
description: "Dimensions"
|
|
187
|
-
});
|
|
188
|
-
const LikeC4Config_Styles_Theme_Sizes = z.strictObject(
|
|
189
|
-
t(Sizes, () => DimensionsSchema.optional())
|
|
190
|
-
).meta({
|
|
191
|
-
id: "ThemeSizes",
|
|
192
|
-
description: "Override theme sizes"
|
|
193
|
-
});
|
|
194
|
-
const LikeC4Config_Styles_Theme = z.strictObject({
|
|
195
|
-
colors: ThemeColorsSchema.optional(),
|
|
196
|
-
sizes: LikeC4Config_Styles_Theme_Sizes.optional()
|
|
197
|
-
}).meta({
|
|
198
|
-
id: "ThemeCustomization",
|
|
199
|
-
description: "Theme customization"
|
|
200
|
-
}).transform(({ colors, sizes }) => {
|
|
201
|
-
return exact({
|
|
202
|
-
colors: colors ? exact(colors) : void 0,
|
|
203
|
-
sizes: sizes ? exact(sizes) : void 0
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
const LikeC4Config_Styles_Defaults_Group = z.strictObject({
|
|
207
|
-
color: color.optional().meta({
|
|
208
|
-
description: "Default color for groups\n(must be a valid color name from the theme)"
|
|
209
|
-
}),
|
|
210
|
-
opacity: opacity.optional().meta({ description: "Default opacity for groups" }),
|
|
211
|
-
border: border.optional().meta({ description: "Default border for groups" })
|
|
212
|
-
}).meta({
|
|
213
|
-
id: "GroupDefaultStyleValues",
|
|
214
|
-
description: "Override default values for group style properties\nThese values will be used if such property is not defined"
|
|
215
|
-
});
|
|
216
|
-
const LikeC4Config_Styles_Defaults_Relationship = z.strictObject({
|
|
217
|
-
color: color.optional().meta({
|
|
218
|
-
description: "Default color for relationships\n(must be a valid color name from the theme)"
|
|
219
|
-
}),
|
|
220
|
-
line: line.optional().meta({ description: "Default line style for relationships" }),
|
|
221
|
-
arrow: arrow.optional().meta({ description: "Default arrow style for relationships" })
|
|
222
|
-
}).meta({
|
|
223
|
-
id: "RelationshipDefaultStyleValues",
|
|
224
|
-
description: "Override default values for relationship style properties\nThese values will be used if such property is not defined"
|
|
225
|
-
});
|
|
226
|
-
const LikeC4Config_Styles_Defaults = z.strictObject({
|
|
227
|
-
color: color.optional().meta({
|
|
228
|
-
description: "Default color for elements\n(must be a valid color name from the theme)"
|
|
229
|
-
}),
|
|
230
|
-
opacity: opacity.optional().meta({
|
|
231
|
-
description: "Default opacity (0-100%) for elements when displayed as a group (like a container)"
|
|
232
|
-
}),
|
|
233
|
-
border: border.optional().meta({
|
|
234
|
-
description: "Default border style for elements when displayed as a group (like a container)"
|
|
235
|
-
}),
|
|
236
|
-
size: size.optional().meta({ description: "Default size for elements" }),
|
|
237
|
-
shape: shape.optional().meta({ description: "Default shape for elements" }),
|
|
238
|
-
group: LikeC4Config_Styles_Defaults_Group.optional().meta({ description: "Default style values for groups" }),
|
|
239
|
-
relationship: LikeC4Config_Styles_Defaults_Relationship.optional().meta({
|
|
240
|
-
description: "Default style values for relationships"
|
|
241
|
-
})
|
|
242
|
-
}).meta({
|
|
243
|
-
id: "DefaultStyleValues",
|
|
244
|
-
description: "Override default values for style properties\nThese values will be used if such property is not defined"
|
|
245
|
-
});
|
|
246
|
-
const LikeC4StylesConfigSchema = z.strictObject({
|
|
247
|
-
theme: LikeC4Config_Styles_Theme.optional(),
|
|
248
|
-
defaults: LikeC4Config_Styles_Defaults.optional()
|
|
249
|
-
// customCss: z
|
|
250
|
-
// .array(z.string())
|
|
251
|
-
// .meta({ description: 'List of custom CSS files' }),
|
|
252
|
-
}).meta({
|
|
253
|
-
id: "StylesConfiguration",
|
|
254
|
-
description: "Project styles customization"
|
|
255
|
-
}).transform(
|
|
256
|
-
({ theme, defaults }) => exact({
|
|
257
|
-
defaults: normalizeDefaults(defaults),
|
|
258
|
-
theme
|
|
259
|
-
})
|
|
260
|
-
);
|
|
261
|
-
function normalizeDefaults(defaults) {
|
|
262
|
-
if (!defaults) {
|
|
263
|
-
return void 0;
|
|
264
|
-
}
|
|
265
|
-
const { relationship, group, ...rest } = defaults;
|
|
266
|
-
return exact({
|
|
267
|
-
...rest,
|
|
268
|
-
relationship: relationship && exact(relationship),
|
|
269
|
-
group: group && exact(group)
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const ManualLayoutsConfigSchema = z.object({
|
|
274
|
-
outDir: z.string().default(".likec4").meta({
|
|
275
|
-
description: [
|
|
276
|
-
"Path to the directory where manual layouts will be stored,",
|
|
277
|
-
"relative to the folder containing the project config. ",
|
|
278
|
-
"",
|
|
279
|
-
"Defaults to '.likec4'."
|
|
280
|
-
].join("\n")
|
|
281
|
-
})
|
|
282
|
-
}).meta({
|
|
283
|
-
id: "manual-layouts-config",
|
|
284
|
-
description: "Configuration for manual layouts"
|
|
285
|
-
});
|
|
286
|
-
const LikeC4ProjectJsonConfigSchema = z.object({
|
|
287
|
-
name: z.string().nonempty("Project name cannot be empty").refine((value) => value !== "default", {
|
|
288
|
-
abort: true,
|
|
289
|
-
error: 'Project name cannot be "default"'
|
|
290
|
-
}).refine((value) => !value.includes(".") && !value.includes("@") && !value.includes("#"), {
|
|
291
|
-
abort: true,
|
|
292
|
-
error: 'Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -'
|
|
293
|
-
}).meta({ description: "Project name, must be unique in the workspace" }),
|
|
294
|
-
title: z.string().nonempty("Project title cannot be empty if specified").optional().meta({ description: "A human readable title for the project" }),
|
|
295
|
-
contactPerson: z.string().nonempty("Contact person cannot be empty if specified").optional().meta({ description: "A person who has been involved in creating or maintaining this project" }),
|
|
296
|
-
imageAliases: ImageAliasesSchema.optional(),
|
|
297
|
-
include: IncludeSchema,
|
|
298
|
-
styles: LikeC4StylesConfigSchema.optional(),
|
|
299
|
-
exclude: z.array(z.string()).optional().meta({ description: 'List of file patterns to exclude from the project, default is ["**/node_modules/**"]' }),
|
|
300
|
-
manualLayouts: ManualLayoutsConfigSchema.optional()
|
|
301
|
-
}).meta({
|
|
302
|
-
description: "LikeC4 project configuration"
|
|
303
|
-
});
|
|
304
|
-
const FunctionType = z.instanceof(Function);
|
|
305
|
-
const GeneratorsSchema = z.record(z.string(), FunctionType);
|
|
306
|
-
const LikeC4ProjectConfigSchema = LikeC4ProjectJsonConfigSchema.extend({
|
|
307
|
-
generators: GeneratorsSchema.optional()
|
|
308
|
-
});
|
|
309
|
-
function validateProjectConfig(config) {
|
|
310
|
-
const parsed = LikeC4ProjectConfigSchema.safeParse(
|
|
311
|
-
typeof config === "string" ? JSON5.parse(config) : config
|
|
312
|
-
);
|
|
313
|
-
if (!parsed.success) {
|
|
314
|
-
throw new Error("Config validation failed:\n" + z.prettifyError(parsed.error));
|
|
315
|
-
}
|
|
316
|
-
if (parsed.data.imageAliases) {
|
|
317
|
-
validateImageAliases(parsed.data.imageAliases);
|
|
318
|
-
}
|
|
319
|
-
if (parsed.data.include) {
|
|
320
|
-
validateIncludePaths(parsed.data.include);
|
|
321
|
-
}
|
|
322
|
-
return parsed.data;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const configJsonFilenames = [
|
|
326
|
-
".likec4rc",
|
|
327
|
-
".likec4.config.json",
|
|
328
|
-
"likec4.config.json"
|
|
329
|
-
];
|
|
330
|
-
const configNonJsonFilenames = [
|
|
331
|
-
"likec4.config.js",
|
|
332
|
-
"likec4.config.mjs",
|
|
333
|
-
"likec4.config.ts",
|
|
334
|
-
"likec4.config.mts"
|
|
335
|
-
];
|
|
336
|
-
const ConfigFilenames = [
|
|
337
|
-
...configJsonFilenames,
|
|
338
|
-
...configNonJsonFilenames
|
|
339
|
-
];
|
|
340
|
-
function isLikeC4JsonConfig(filename) {
|
|
341
|
-
for (const ext of configJsonFilenames) {
|
|
342
|
-
if (filename.endsWith(ext)) {
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
function isLikeC4NonJsonConfig(filename) {
|
|
349
|
-
for (const ext of configNonJsonFilenames) {
|
|
350
|
-
if (filename.endsWith(ext)) {
|
|
351
|
-
return true;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
return false;
|
|
355
|
-
}
|
|
356
|
-
function isLikeC4Config(filename) {
|
|
357
|
-
return isLikeC4JsonConfig(filename) || isLikeC4NonJsonConfig(filename);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function defineConfig(config) {
|
|
361
|
-
return LikeC4ProjectConfigSchema.parse(config);
|
|
362
|
-
}
|
|
363
|
-
function defineGenerators(generators) {
|
|
364
|
-
return GeneratorsSchema.parse(generators);
|
|
365
|
-
}
|
|
366
|
-
function defineThemeColor(colors) {
|
|
367
|
-
return ThemeColorValuesSchema.parse(colors);
|
|
368
|
-
}
|
|
369
|
-
function defineTheme(theme) {
|
|
370
|
-
return LikeC4Config_Styles_Theme.parse(theme);
|
|
371
|
-
}
|
|
372
|
-
function defineStyle(styles) {
|
|
373
|
-
return LikeC4StylesConfigSchema.parse(styles);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
export { ConfigFilenames as C, validateIncludePaths as a, isLikeC4JsonConfig as b, isLikeC4NonJsonConfig as c, defineConfig as d, defineGenerators as e, defineStyle as f, defineTheme as g, defineThemeColor as h, isLikeC4Config as i, normalizeIncludeConfig as n, validateProjectConfig as v };
|
package/src/logger.ts
DELETED