@dsai-io/tools 0.0.1 → 1.1.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/README.md +438 -186
- package/bin/dsai-tools.mjs +13 -13
- package/dist/cli/index.cjs +8192 -2757
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +4 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +8190 -2757
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.cjs +264 -63
- package/dist/config/index.cjs.map +1 -1
- package/dist/config/index.d.cts +537 -1759
- package/dist/config/index.d.ts +537 -1759
- package/dist/config/index.js +259 -63
- package/dist/config/index.js.map +1 -1
- package/dist/icons/index.cjs +1 -1
- package/dist/icons/index.cjs.map +1 -1
- package/dist/icons/index.d.cts +1 -1
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.cjs +8093 -3024
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +214 -5
- package/dist/index.d.ts +214 -5
- package/dist/index.js +8033 -3012
- package/dist/index.js.map +1 -1
- package/dist/tokens/index.cjs +4457 -737
- package/dist/tokens/index.cjs.map +1 -1
- package/dist/tokens/index.d.cts +1258 -17
- package/dist/tokens/index.d.ts +1258 -17
- package/dist/tokens/index.js +4368 -683
- package/dist/tokens/index.js.map +1 -1
- package/dist/{types-Idj08nad.d.cts → types-CtE9f0G0.d.cts} +293 -3
- package/dist/{types-Idj08nad.d.ts → types-CtE9f0G0.d.ts} +293 -3
- package/dist/utils/circuit-breaker.cjs +173 -0
- package/dist/utils/circuit-breaker.cjs.map +1 -0
- package/dist/utils/circuit-breaker.d.cts +123 -0
- package/dist/utils/circuit-breaker.d.ts +123 -0
- package/dist/utils/circuit-breaker.js +169 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/package.json +102 -97
- package/templates/.dsairc.json +37 -37
- package/templates/dsai-config.schema.json +618 -554
- package/templates/dsai.config.mjs +281 -221
package/dist/config/index.js
CHANGED
|
@@ -36,37 +36,50 @@ var customTransformSchema = z.object({
|
|
|
36
36
|
name: z.string().min(1, "Transform name is required"),
|
|
37
37
|
description: z.string().optional(),
|
|
38
38
|
type: z.enum(["value", "attribute", "name"]).optional().default("value"),
|
|
39
|
-
transform: z.function().
|
|
40
|
-
filter: z.function().
|
|
41
|
-
matcher: z.function().
|
|
39
|
+
transform: z.function().optional(),
|
|
40
|
+
filter: z.function().optional(),
|
|
41
|
+
matcher: z.function().optional()
|
|
42
42
|
});
|
|
43
43
|
var customFormatSchema = z.object({
|
|
44
44
|
name: z.string().min(1, "Format name is required"),
|
|
45
45
|
description: z.string().optional(),
|
|
46
|
-
formatter: z.function().
|
|
46
|
+
formatter: z.function().optional(),
|
|
47
47
|
extension: z.string().min(1).optional()
|
|
48
48
|
});
|
|
49
|
-
var
|
|
49
|
+
var outputFormatEnum = z.enum(["css", "scss", "js", "ts", "json", "android", "ios"]);
|
|
50
|
+
var themeDefinitionSchema = z.object({
|
|
51
|
+
isDefault: z.boolean().optional().default(false),
|
|
52
|
+
suffix: z.string().nullable().optional(),
|
|
50
53
|
selector: z.string().min(1, "Theme selector is required"),
|
|
51
54
|
mediaQuery: z.string().optional(),
|
|
52
55
|
dataAttribute: z.string().optional(),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
outputFiles: z.record(outputFormatEnum, z.string()).optional()
|
|
57
|
+
});
|
|
58
|
+
var themeSelectorPatternSchema = z.object({
|
|
59
|
+
default: z.string().optional().default(":root"),
|
|
60
|
+
others: z.string().optional().default('[data-dsai-theme="{mode}"]')
|
|
56
61
|
});
|
|
57
62
|
var themesConfigSchema = z.object({
|
|
58
63
|
enabled: z.boolean().optional().default(true),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
autoDetect: z.boolean().optional().default(true),
|
|
65
|
+
default: z.string().optional().default("light"),
|
|
66
|
+
ignoreModes: z.array(z.string()).optional().default([]),
|
|
67
|
+
selectorPattern: themeSelectorPatternSchema.optional(),
|
|
68
|
+
definitions: z.record(z.string(), themeDefinitionSchema).optional(),
|
|
69
|
+
// Legacy fields (for backward compatibility)
|
|
70
|
+
defaultMode: z.enum(["light", "dark", "system"]).optional(),
|
|
71
|
+
modes: z.record(
|
|
72
|
+
z.string(),
|
|
73
|
+
z.object({
|
|
74
|
+
selector: z.string().min(1),
|
|
75
|
+
mediaQuery: z.string().optional(),
|
|
76
|
+
dataAttribute: z.string().optional(),
|
|
77
|
+
cssVariables: z.boolean().optional(),
|
|
78
|
+
generateSeparateFiles: z.boolean().optional(),
|
|
79
|
+
prefix: z.string().optional()
|
|
80
|
+
})
|
|
81
|
+
).optional(),
|
|
82
|
+
outputFileName: z.string().optional(),
|
|
70
83
|
colorScheme: z.object({
|
|
71
84
|
light: z.string().optional(),
|
|
72
85
|
dark: z.string().optional()
|
|
@@ -109,10 +122,44 @@ var tokenBuildConfigSchema = z.object({
|
|
|
109
122
|
selector: z.string().optional(),
|
|
110
123
|
transforms: z.array(z.string()).optional(),
|
|
111
124
|
customTransforms: z.array(customTransformSchema).optional(),
|
|
112
|
-
filter: z.function().
|
|
125
|
+
filter: z.function().optional(),
|
|
113
126
|
header: z.string().optional(),
|
|
114
127
|
footer: z.string().optional()
|
|
115
128
|
});
|
|
129
|
+
var postprocessConfigSchema = z.object({
|
|
130
|
+
enabled: z.boolean().optional(),
|
|
131
|
+
cssDir: z.string().optional(),
|
|
132
|
+
files: z.array(z.string()).optional(),
|
|
133
|
+
replacements: z.array(
|
|
134
|
+
z.object({
|
|
135
|
+
description: z.string().optional(),
|
|
136
|
+
from: z.union([z.string(), z.instanceof(RegExp)]),
|
|
137
|
+
to: z.string()
|
|
138
|
+
})
|
|
139
|
+
).optional()
|
|
140
|
+
});
|
|
141
|
+
var scssConfigSchema = z.object({
|
|
142
|
+
/** Output styles to generate: 'expanded' (readable) or 'compressed' (minified) */
|
|
143
|
+
outputStyles: z.array(z.enum(["expanded", "compressed"])).optional(),
|
|
144
|
+
/** Generate source maps for SCSS compilation */
|
|
145
|
+
generateSourceMaps: z.boolean().optional(),
|
|
146
|
+
/** Suffix for minified files (e.g., '.min') */
|
|
147
|
+
minifiedSuffix: z.string().optional(),
|
|
148
|
+
/** Theme entry point SCSS file */
|
|
149
|
+
themeEntry: z.string().optional(),
|
|
150
|
+
/** Utilities entry point SCSS file */
|
|
151
|
+
utilitiesEntry: z.string().optional(),
|
|
152
|
+
/** Output directory for compiled CSS files */
|
|
153
|
+
cssOutputDir: z.string().optional(),
|
|
154
|
+
/** Additional Sass load paths */
|
|
155
|
+
loadPaths: z.array(z.string()).optional(),
|
|
156
|
+
/** Target CSS framework for variable name mapping */
|
|
157
|
+
framework: z.enum(["bootstrap", "tailwind", "material", "custom"]).optional(),
|
|
158
|
+
/** Custom token to variable name mappings */
|
|
159
|
+
nameMapping: z.record(z.string(), z.string()).optional(),
|
|
160
|
+
/** Output path for Bootstrap-compatible SCSS variables */
|
|
161
|
+
variablesOutput: z.string().optional()
|
|
162
|
+
});
|
|
116
163
|
var tokenCacheConfigSchema = z.object({
|
|
117
164
|
enabled: z.boolean().optional().default(true),
|
|
118
165
|
directory: z.string().optional().default(".cache"),
|
|
@@ -126,14 +173,16 @@ var tokenWatchConfigSchema = z.object({
|
|
|
126
173
|
ignorePatterns: z.array(z.string()).optional().default([])
|
|
127
174
|
});
|
|
128
175
|
var tokensHooksSchema = z.object({
|
|
129
|
-
onBuildStart: z.function().
|
|
130
|
-
onFormatComplete: z.function().
|
|
131
|
-
onAllFormatsComplete: z.function().
|
|
132
|
-
onBuildComplete: z.function().
|
|
133
|
-
onError: z.function().
|
|
176
|
+
onBuildStart: z.function().optional(),
|
|
177
|
+
onFormatComplete: z.function().optional(),
|
|
178
|
+
onAllFormatsComplete: z.function().optional(),
|
|
179
|
+
onBuildComplete: z.function().optional(),
|
|
180
|
+
onError: z.function().optional()
|
|
134
181
|
});
|
|
135
182
|
var buildPipelineStepSchema = z.enum([
|
|
136
183
|
"validate",
|
|
184
|
+
"snapshot",
|
|
185
|
+
"preprocess",
|
|
137
186
|
"transform",
|
|
138
187
|
"style-dictionary",
|
|
139
188
|
"sync",
|
|
@@ -151,41 +200,30 @@ var tokensBuildPipelineSchema = z.object({
|
|
|
151
200
|
* Default includes all steps for full @dsai-io/tokens build.
|
|
152
201
|
* Simpler packages can use subset like ['validate', 'transform', 'style-dictionary']
|
|
153
202
|
*/
|
|
154
|
-
steps: z.array(buildPipelineStepSchema).optional()
|
|
155
|
-
"validate",
|
|
156
|
-
"transform",
|
|
157
|
-
"style-dictionary",
|
|
158
|
-
"sync",
|
|
159
|
-
"sass-theme",
|
|
160
|
-
"sass-theme-minified",
|
|
161
|
-
"postprocess",
|
|
162
|
-
"sass-utilities",
|
|
163
|
-
"sass-utilities-minified",
|
|
164
|
-
"bundle"
|
|
165
|
-
]),
|
|
203
|
+
steps: z.array(buildPipelineStepSchema).optional(),
|
|
166
204
|
/**
|
|
167
205
|
* Paths configuration for build steps
|
|
168
206
|
*/
|
|
169
207
|
paths: z.object({
|
|
170
208
|
/** Source file for sync step (Style Dictionary JS output) */
|
|
171
|
-
syncSource: z.string().optional()
|
|
209
|
+
syncSource: z.string().optional(),
|
|
172
210
|
/** Target file for sync step */
|
|
173
|
-
syncTarget: z.string().optional()
|
|
211
|
+
syncTarget: z.string().optional(),
|
|
174
212
|
/** SCSS theme input file */
|
|
175
|
-
sassThemeInput: z.string().optional()
|
|
213
|
+
sassThemeInput: z.string().optional(),
|
|
176
214
|
/** CSS theme output file */
|
|
177
|
-
sassThemeOutput: z.string().optional()
|
|
215
|
+
sassThemeOutput: z.string().optional(),
|
|
178
216
|
/** CSS theme minified output file */
|
|
179
|
-
sassThemeMinifiedOutput: z.string().optional()
|
|
217
|
+
sassThemeMinifiedOutput: z.string().optional(),
|
|
180
218
|
/** SCSS utilities input file */
|
|
181
|
-
sassUtilitiesInput: z.string().optional()
|
|
219
|
+
sassUtilitiesInput: z.string().optional(),
|
|
182
220
|
/** CSS utilities output file */
|
|
183
|
-
sassUtilitiesOutput: z.string().optional()
|
|
221
|
+
sassUtilitiesOutput: z.string().optional(),
|
|
184
222
|
/** CSS utilities minified output file */
|
|
185
|
-
sassUtilitiesMinifiedOutput: z.string().optional()
|
|
223
|
+
sassUtilitiesMinifiedOutput: z.string().optional()
|
|
186
224
|
}).optional(),
|
|
187
225
|
/** Style Dictionary config file name */
|
|
188
|
-
styleDictionaryConfig: z.string().optional()
|
|
226
|
+
styleDictionaryConfig: z.string().optional()
|
|
189
227
|
});
|
|
190
228
|
var tokensConfigSchema = z.object({
|
|
191
229
|
enabled: z.boolean().optional().default(true),
|
|
@@ -218,8 +256,12 @@ var tokensConfigSchema = z.object({
|
|
|
218
256
|
cache: tokenCacheConfigSchema.optional(),
|
|
219
257
|
watch: tokenWatchConfigSchema.optional(),
|
|
220
258
|
verbose: z.boolean().optional().default(false),
|
|
259
|
+
/** SCSS/CSS output configuration */
|
|
260
|
+
scss: scssConfigSchema.optional(),
|
|
221
261
|
/** Build pipeline configuration */
|
|
222
|
-
pipeline: tokensBuildPipelineSchema.optional()
|
|
262
|
+
pipeline: tokensBuildPipelineSchema.optional(),
|
|
263
|
+
/** Postprocess configuration */
|
|
264
|
+
postprocess: postprocessConfigSchema.optional()
|
|
223
265
|
});
|
|
224
266
|
var buildConfigSchema = z.object({
|
|
225
267
|
outDir: z.string().optional().default("dist"),
|
|
@@ -239,16 +281,32 @@ var globalConfigSchema = z.object({
|
|
|
239
281
|
framework: frameworkSchema.optional(),
|
|
240
282
|
build: buildConfigSchema.optional()
|
|
241
283
|
});
|
|
284
|
+
var aliasesConfigSchema = z.object({
|
|
285
|
+
importAlias: z.string().optional().default("@/"),
|
|
286
|
+
ui: z.string().optional().default("src/components/ui"),
|
|
287
|
+
hooks: z.string().optional().default("src/hooks"),
|
|
288
|
+
utils: z.string().optional().default("src/lib/utils"),
|
|
289
|
+
components: z.string().optional().default("src/components"),
|
|
290
|
+
lib: z.string().optional().default("src/lib")
|
|
291
|
+
});
|
|
292
|
+
var componentsConfigSchema = z.object({
|
|
293
|
+
enabled: z.boolean().optional().default(true),
|
|
294
|
+
registryUrl: z.string().optional().default("https://registry.dsai.dev"),
|
|
295
|
+
tsx: z.boolean().optional().default(true),
|
|
296
|
+
overwrite: z.boolean().optional().default(false)
|
|
297
|
+
});
|
|
242
298
|
var dsaiConfigSchema = z.object({
|
|
243
299
|
$schema: z.string().optional(),
|
|
244
300
|
extends: z.union([z.string(), z.array(z.string())]).optional(),
|
|
245
301
|
global: globalConfigSchema.optional(),
|
|
246
302
|
tokens: tokensConfigSchema.optional(),
|
|
247
303
|
themes: themesConfigSchema.optional(),
|
|
248
|
-
icons: iconsConfigSchema.optional()
|
|
304
|
+
icons: iconsConfigSchema.optional(),
|
|
305
|
+
aliases: aliasesConfigSchema.optional(),
|
|
306
|
+
components: componentsConfigSchema.optional()
|
|
249
307
|
});
|
|
250
308
|
function formatValidationErrors(zodError) {
|
|
251
|
-
return zodError.
|
|
309
|
+
return zodError.issues.map((err) => ({
|
|
252
310
|
path: err.path.join(".") || "root",
|
|
253
311
|
message: err.message,
|
|
254
312
|
code: err.code,
|
|
@@ -283,7 +341,9 @@ function validateConfigSection(section, config) {
|
|
|
283
341
|
global: globalConfigSchema,
|
|
284
342
|
tokens: tokensConfigSchema,
|
|
285
343
|
themes: themesConfigSchema,
|
|
286
|
-
icons: iconsConfigSchema
|
|
344
|
+
icons: iconsConfigSchema,
|
|
345
|
+
aliases: aliasesConfigSchema,
|
|
346
|
+
components: componentsConfigSchema
|
|
287
347
|
};
|
|
288
348
|
const schema = sectionSchemas[section];
|
|
289
349
|
if (!schema) {
|
|
@@ -347,11 +407,44 @@ var defaultSelectorPattern = {
|
|
|
347
407
|
default: ":root",
|
|
348
408
|
others: '[data-dsai-theme="{mode}"]'
|
|
349
409
|
};
|
|
410
|
+
var defaultThemeDefinitions = {
|
|
411
|
+
light: {
|
|
412
|
+
isDefault: true,
|
|
413
|
+
suffix: null,
|
|
414
|
+
selector: ":root",
|
|
415
|
+
outputFiles: {
|
|
416
|
+
css: "tokens.css",
|
|
417
|
+
scss: "_tokens.scss",
|
|
418
|
+
js: "tokens.js",
|
|
419
|
+
ts: "tokens.ts",
|
|
420
|
+
json: "tokens.json",
|
|
421
|
+
android: "tokens.xml",
|
|
422
|
+
ios: "tokens.h"
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
dark: {
|
|
426
|
+
isDefault: false,
|
|
427
|
+
suffix: "-dark",
|
|
428
|
+
selector: '[data-dsai-theme="dark"]',
|
|
429
|
+
mediaQuery: "(prefers-color-scheme: dark)",
|
|
430
|
+
outputFiles: {
|
|
431
|
+
css: "tokens-dark.css",
|
|
432
|
+
scss: "_tokens-dark.scss",
|
|
433
|
+
js: "tokens-dark.js",
|
|
434
|
+
ts: "tokens-dark.ts",
|
|
435
|
+
json: "tokens-dark.json",
|
|
436
|
+
android: "tokens-dark.xml",
|
|
437
|
+
ios: "tokens-dark.h"
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
};
|
|
350
441
|
var defaultThemesConfig = {
|
|
442
|
+
enabled: true,
|
|
351
443
|
autoDetect: true,
|
|
352
|
-
default: "
|
|
444
|
+
default: "light",
|
|
353
445
|
ignoreModes: [],
|
|
354
|
-
selectorPattern: defaultSelectorPattern
|
|
446
|
+
selectorPattern: defaultSelectorPattern,
|
|
447
|
+
definitions: defaultThemeDefinitions
|
|
355
448
|
};
|
|
356
449
|
var defaultIconFramework = "react";
|
|
357
450
|
var defaultIconsConfig = {
|
|
@@ -362,6 +455,20 @@ var defaultIconsConfig = {
|
|
|
362
455
|
optimize: true,
|
|
363
456
|
prefix: "Icon"
|
|
364
457
|
};
|
|
458
|
+
var defaultAliasesConfig = {
|
|
459
|
+
importAlias: "@/",
|
|
460
|
+
ui: "src/components/ui",
|
|
461
|
+
hooks: "src/hooks",
|
|
462
|
+
utils: "src/lib/utils",
|
|
463
|
+
components: "src/components",
|
|
464
|
+
lib: "src/lib"
|
|
465
|
+
};
|
|
466
|
+
var defaultComponentsConfig = {
|
|
467
|
+
enabled: true,
|
|
468
|
+
registryUrl: "https://registry.dsai.dev",
|
|
469
|
+
tsx: true,
|
|
470
|
+
overwrite: false
|
|
471
|
+
};
|
|
365
472
|
var defaultTokensConfig = {
|
|
366
473
|
source: "theme",
|
|
367
474
|
sourceDir: DEFAULT_SOURCE_DIR,
|
|
@@ -396,6 +503,8 @@ var defaultGlobalConfig = {
|
|
|
396
503
|
var defaultConfig = {
|
|
397
504
|
tokens: defaultTokensConfig,
|
|
398
505
|
icons: defaultIconsConfig,
|
|
506
|
+
aliases: defaultAliasesConfig,
|
|
507
|
+
components: defaultComponentsConfig,
|
|
399
508
|
global: defaultGlobalConfig,
|
|
400
509
|
configDir: process.cwd()
|
|
401
510
|
};
|
|
@@ -518,16 +627,75 @@ function resolveGlobalConfig(config, options) {
|
|
|
518
627
|
logLevel: config?.logLevel ?? base.logLevel
|
|
519
628
|
};
|
|
520
629
|
}
|
|
630
|
+
function resolveThemeDefinition(themeName, definition, selectorPattern, _outputFileNames, isDefaultTheme) {
|
|
631
|
+
const generateOutputFiles = () => {
|
|
632
|
+
const suffix = isDefaultTheme ? "" : `-${themeName}`;
|
|
633
|
+
return {
|
|
634
|
+
css: `tokens${suffix}.css`,
|
|
635
|
+
scss: `_tokens${suffix}.scss`,
|
|
636
|
+
js: `tokens${suffix}.js`,
|
|
637
|
+
ts: `tokens${suffix}.ts`,
|
|
638
|
+
json: `tokens${suffix}.json`,
|
|
639
|
+
android: `tokens${suffix}.xml`,
|
|
640
|
+
ios: `tokens${suffix}.h`
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
const generateSelector = () => {
|
|
644
|
+
if (isDefaultTheme) {
|
|
645
|
+
return selectorPattern.default;
|
|
646
|
+
}
|
|
647
|
+
return selectorPattern.others.replace("{mode}", themeName);
|
|
648
|
+
};
|
|
649
|
+
const defaultOutputFiles = generateOutputFiles();
|
|
650
|
+
return {
|
|
651
|
+
isDefault: definition?.isDefault ?? isDefaultTheme,
|
|
652
|
+
suffix: definition?.suffix ?? (isDefaultTheme ? null : `-${themeName}`),
|
|
653
|
+
selector: definition?.selector ?? generateSelector(),
|
|
654
|
+
mediaQuery: definition?.mediaQuery,
|
|
655
|
+
dataAttribute: definition?.dataAttribute,
|
|
656
|
+
outputFiles: {
|
|
657
|
+
...defaultOutputFiles,
|
|
658
|
+
...definition?.outputFiles
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
}
|
|
521
662
|
function resolveThemesConfig(config) {
|
|
522
663
|
const base = defaultThemesConfig;
|
|
664
|
+
const selectorPattern = {
|
|
665
|
+
default: config?.selectorPattern?.default ?? base.selectorPattern.default,
|
|
666
|
+
others: config?.selectorPattern?.others ?? base.selectorPattern.others
|
|
667
|
+
};
|
|
668
|
+
const defaultThemeName = config?.default?.toLowerCase() ?? base.default;
|
|
669
|
+
let definitions;
|
|
670
|
+
if (config?.definitions && Object.keys(config.definitions).length > 0) {
|
|
671
|
+
definitions = {};
|
|
672
|
+
for (const [themeName, definition] of Object.entries(config.definitions)) {
|
|
673
|
+
const normalizedName = themeName.toLowerCase();
|
|
674
|
+
const isDefaultTheme = definition.isDefault ?? normalizedName === defaultThemeName;
|
|
675
|
+
const resolvedDef = resolveThemeDefinition(
|
|
676
|
+
normalizedName,
|
|
677
|
+
definition,
|
|
678
|
+
selectorPattern,
|
|
679
|
+
defaultOutputFileNames,
|
|
680
|
+
isDefaultTheme
|
|
681
|
+
);
|
|
682
|
+
Object.defineProperty(definitions, normalizedName, {
|
|
683
|
+
value: resolvedDef,
|
|
684
|
+
writable: true,
|
|
685
|
+
enumerable: true,
|
|
686
|
+
configurable: true
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
} else {
|
|
690
|
+
definitions = { ...defaultThemeDefinitions };
|
|
691
|
+
}
|
|
523
692
|
return {
|
|
693
|
+
enabled: config?.enabled ?? base.enabled,
|
|
524
694
|
autoDetect: config?.autoDetect ?? base.autoDetect,
|
|
525
|
-
default:
|
|
695
|
+
default: defaultThemeName,
|
|
526
696
|
ignoreModes: config?.ignoreModes ?? [...base.ignoreModes],
|
|
527
|
-
selectorPattern
|
|
528
|
-
|
|
529
|
-
others: config?.selectorPattern?.others ?? base.selectorPattern.others
|
|
530
|
-
}
|
|
697
|
+
selectorPattern,
|
|
698
|
+
definitions
|
|
531
699
|
};
|
|
532
700
|
}
|
|
533
701
|
function resolveIconsConfig(config, options) {
|
|
@@ -595,13 +763,37 @@ function resolveTokensConfig(config, options) {
|
|
|
595
763
|
separateThemeFiles: config?.separateThemeFiles ?? base.separateThemeFiles,
|
|
596
764
|
watch: config?.watch ?? base.watch,
|
|
597
765
|
watchDirectories,
|
|
598
|
-
pipeline: config?.pipeline
|
|
766
|
+
pipeline: config?.pipeline,
|
|
767
|
+
scss: config?.scss,
|
|
768
|
+
postprocess: config?.postprocess
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
function resolveAliasesConfig(config) {
|
|
772
|
+
const base = defaultAliasesConfig;
|
|
773
|
+
return {
|
|
774
|
+
importAlias: config?.importAlias ?? base.importAlias,
|
|
775
|
+
ui: config?.ui ?? base.ui,
|
|
776
|
+
hooks: config?.hooks ?? base.hooks,
|
|
777
|
+
utils: config?.utils ?? base.utils,
|
|
778
|
+
components: config?.components ?? base.components,
|
|
779
|
+
lib: config?.lib ?? base.lib
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
function resolveComponentsConfig(config) {
|
|
783
|
+
const base = defaultComponentsConfig;
|
|
784
|
+
return {
|
|
785
|
+
enabled: config?.enabled ?? base.enabled,
|
|
786
|
+
registryUrl: config?.registryUrl ?? base.registryUrl,
|
|
787
|
+
tsx: config?.tsx ?? base.tsx,
|
|
788
|
+
overwrite: config?.overwrite ?? base.overwrite
|
|
599
789
|
};
|
|
600
790
|
}
|
|
601
791
|
function applyOverrides(config, overrides) {
|
|
602
792
|
return {
|
|
603
793
|
tokens: overrides.tokens ? { ...config.tokens, ...overrides.tokens } : config.tokens,
|
|
604
794
|
icons: overrides.icons ? { ...config.icons, ...overrides.icons } : config.icons,
|
|
795
|
+
aliases: overrides.aliases ? { ...config.aliases, ...overrides.aliases } : config.aliases,
|
|
796
|
+
components: overrides.components ? { ...config.components, ...overrides.components } : config.components,
|
|
605
797
|
global: overrides.global ? { ...config.global, ...overrides.global } : config.global
|
|
606
798
|
};
|
|
607
799
|
}
|
|
@@ -612,6 +804,8 @@ function resolveConfig(config = {}, options = {}) {
|
|
|
612
804
|
global: resolveGlobalConfig(mergedConfig.global, options),
|
|
613
805
|
tokens: resolveTokensConfig(mergedConfig.tokens, options),
|
|
614
806
|
icons: resolveIconsConfig(mergedConfig.icons, options),
|
|
807
|
+
aliases: resolveAliasesConfig(mergedConfig.aliases),
|
|
808
|
+
components: resolveComponentsConfig(mergedConfig.components),
|
|
615
809
|
configDir
|
|
616
810
|
};
|
|
617
811
|
}
|
|
@@ -627,6 +821,8 @@ function createResolvedConfig(partial = {}) {
|
|
|
627
821
|
global: partial.global ?? defaultConfig.global,
|
|
628
822
|
tokens: partial.tokens ?? defaultConfig.tokens,
|
|
629
823
|
icons: partial.icons ?? defaultConfig.icons,
|
|
824
|
+
aliases: partial.aliases ?? defaultConfig.aliases,
|
|
825
|
+
components: partial.components ?? defaultConfig.components,
|
|
630
826
|
configDir: partial.configDir ?? process.cwd(),
|
|
631
827
|
configPath: partial.configPath
|
|
632
828
|
};
|
|
@@ -810,7 +1006,7 @@ function setNestedValue(obj, path3, value) {
|
|
|
810
1006
|
configurable: true
|
|
811
1007
|
});
|
|
812
1008
|
}
|
|
813
|
-
const nested = obj
|
|
1009
|
+
const nested = Reflect.get(obj, first);
|
|
814
1010
|
Object.defineProperty(nested, second, {
|
|
815
1011
|
value,
|
|
816
1012
|
writable: true,
|
|
@@ -831,7 +1027,7 @@ function setNestedValue(obj, path3, value) {
|
|
|
831
1027
|
configurable: true
|
|
832
1028
|
});
|
|
833
1029
|
}
|
|
834
|
-
const nested1 = obj
|
|
1030
|
+
const nested1 = Reflect.get(obj, first);
|
|
835
1031
|
if (!(second in nested1)) {
|
|
836
1032
|
Object.defineProperty(nested1, second, {
|
|
837
1033
|
value: {},
|
|
@@ -840,7 +1036,7 @@ function setNestedValue(obj, path3, value) {
|
|
|
840
1036
|
configurable: true
|
|
841
1037
|
});
|
|
842
1038
|
}
|
|
843
|
-
const nested2 = nested1
|
|
1039
|
+
const nested2 = Reflect.get(nested1, second);
|
|
844
1040
|
Object.defineProperty(nested2, third, {
|
|
845
1041
|
value,
|
|
846
1042
|
writable: true,
|
|
@@ -858,7 +1054,7 @@ function getConfigFromEnv(options = {}) {
|
|
|
858
1054
|
if (!envKey.startsWith(prefix)) {
|
|
859
1055
|
continue;
|
|
860
1056
|
}
|
|
861
|
-
const envValue = env
|
|
1057
|
+
const envValue = Reflect.get(env, envKey);
|
|
862
1058
|
if (envValue === void 0) {
|
|
863
1059
|
continue;
|
|
864
1060
|
}
|
|
@@ -1034,6 +1230,6 @@ export default defineConfig(${configJson.replace(/"([^"]+)":/g, "$1:")});
|
|
|
1034
1230
|
`;
|
|
1035
1231
|
}
|
|
1036
1232
|
|
|
1037
|
-
export { CONFIG_FILE_NAMES, DEFAULT_COLLECTIONS_DIR, DEFAULT_ICONS_OUTPUT_DIR, DEFAULT_ICONS_SOURCE_DIR, DEFAULT_LOG_LEVEL, DEFAULT_OUTPUT_DIR, DEFAULT_PREFIX, DEFAULT_SOURCE_DIR, buildConfigSchema, checkDeprecatedOptions, checkMigrationNeeded, clearConfigCache, createResolvedConfig, customFormatSchema, customTransformSchema, defaultConfig, defaultFormats, defaultGlobalConfig, defaultIconFramework, defaultIconsConfig, defaultOutputFileNames, defaultSelectorPattern, defaultSourcePatterns, defaultThemesConfig, defaultTokensConfig, defineConfig, defineConfigAsync, dsaiConfigSchema, envArrayKeys, envBooleanKeys, envMappings, envNumberKeys, filePathSchema, formatErrorMessage, formatValidationErrors, frameworkSchema, generateMigrationScript, getConfigFromEnv, getDefaultExtension, getDefaultOutputDir, getEnvOverrides, getLogLevelFromEnv, getOutputFileName, globPatternSchema, globalConfigSchema, hashTypeSchema, iconOptimizationSchema, iconSpriteSchema, iconsConfigSchema, isCI, loadConfig, loadConfigSync, logLevelSchema, mergeConfigs, migrateConfig, migrateLegacyTokensConfig, outputFormatSchema, resolveConfig, searchConfigFile, shouldDisableColors,
|
|
1233
|
+
export { CONFIG_FILE_NAMES, DEFAULT_COLLECTIONS_DIR, DEFAULT_ICONS_OUTPUT_DIR, DEFAULT_ICONS_SOURCE_DIR, DEFAULT_LOG_LEVEL, DEFAULT_OUTPUT_DIR, DEFAULT_PREFIX, DEFAULT_SOURCE_DIR, aliasesConfigSchema, buildConfigSchema, checkDeprecatedOptions, checkMigrationNeeded, clearConfigCache, componentsConfigSchema, createResolvedConfig, customFormatSchema, customTransformSchema, defaultAliasesConfig, defaultComponentsConfig, defaultConfig, defaultFormats, defaultGlobalConfig, defaultIconFramework, defaultIconsConfig, defaultOutputFileNames, defaultSelectorPattern, defaultSourcePatterns, defaultThemesConfig, defaultTokensConfig, defineConfig, defineConfigAsync, dsaiConfigSchema, envArrayKeys, envBooleanKeys, envMappings, envNumberKeys, filePathSchema, formatErrorMessage, formatValidationErrors, frameworkSchema, generateMigrationScript, getConfigFromEnv, getDefaultExtension, getDefaultOutputDir, getEnvOverrides, getLogLevelFromEnv, getOutputFileName, globPatternSchema, globalConfigSchema, hashTypeSchema, iconOptimizationSchema, iconSpriteSchema, iconsConfigSchema, isCI, loadConfig, loadConfigSync, logLevelSchema, mergeConfigs, migrateConfig, migrateLegacyTokensConfig, outputFormatSchema, resolveConfig, searchConfigFile, shouldDisableColors, themeDefinitionSchema, themeSelectorPatternSchema, themesConfigSchema, tokenBuildConfigSchema, tokenCacheConfigSchema, tokenWatchConfigSchema, tokensConfigSchema, tokensHooksSchema, validateConfig, validateConfigOrThrow, validateConfigSection, versionSchema };
|
|
1038
1234
|
//# sourceMappingURL=index.js.map
|
|
1039
1235
|
//# sourceMappingURL=index.js.map
|