@4399ywkf/core 5.3.1 → 5.4.1

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,47 +1,47 @@
1
1
  import { Configuration } from '@rspack/core';
2
- import { a as AppConfig, P as ProviderConfig } from './types-ZJhd87ue.js';
2
+ import { P as ProviderConfig, a as AppConfig } from './types-DZ7Nz9bQ.js';
3
3
 
4
4
  /**
5
5
  * 路由项定义
6
6
  */
7
7
  interface RouteItem {
8
- /** 路由路径 */
9
- path: string;
8
+ /** 子路由 */
9
+ children?: RouteItem[];
10
10
  /** 组件文件路径(相对于 src) */
11
11
  component: string;
12
12
  /** 是否为 index 路由 */
13
13
  index?: boolean;
14
14
  /** 是否为布局组件 */
15
15
  isLayout?: boolean;
16
- /** 子路由 */
17
- children?: RouteItem[];
18
16
  /** 路由元信息 */
19
17
  meta?: RouteMeta;
18
+ /** 路由路径 */
19
+ path: string;
20
20
  }
21
21
  /**
22
22
  * 路由元信息
23
23
  */
24
24
  interface RouteMeta {
25
- /** 页面标题 */
26
- title?: string;
27
- /** 是否需要登录 */
28
- auth?: boolean;
29
25
  /** 自定义数据 */
30
26
  [key: string]: unknown;
27
+ /** 是否需要登录 */
28
+ auth?: boolean;
29
+ /** 页面标题 */
30
+ title?: string;
31
31
  }
32
32
 
33
33
  /**
34
34
  * 插件上下文
35
35
  */
36
36
  interface PluginContext {
37
+ /** 用户配置 */
38
+ config: Required<YwkfConfig>;
37
39
  /** 工作目录 */
38
40
  cwd: string;
39
41
  /** 是否开发模式 */
40
42
  isDev: boolean;
41
43
  /** 是否生产模式 */
42
44
  isProd: boolean;
43
- /** 用户配置 */
44
- config: Required<YwkfConfig>;
45
45
  /** 日志工具 */
46
46
  logger: PluginLogger;
47
47
  }
@@ -49,23 +49,15 @@ interface PluginContext {
49
49
  * 插件日志工具
50
50
  */
51
51
  interface PluginLogger {
52
+ debug: (message: string) => void;
53
+ error: (message: string) => void;
52
54
  info: (message: string) => void;
53
55
  warn: (message: string) => void;
54
- error: (message: string) => void;
55
- debug: (message: string) => void;
56
56
  }
57
57
  /**
58
58
  * 构建阶段钩子
59
59
  */
60
60
  interface BuildHooks {
61
- /**
62
- * 修改 Rspack 配置
63
- */
64
- modifyRspackConfig?: (config: Configuration, context: PluginContext) => Configuration | undefined | Promise<Configuration | undefined>;
65
- /**
66
- * 构建开始前
67
- */
68
- beforeBuild?: (context: PluginContext) => void | Promise<void>;
69
61
  /**
70
62
  * 构建完成后
71
63
  */
@@ -73,10 +65,6 @@ interface BuildHooks {
73
65
  success: boolean;
74
66
  errors?: string[];
75
67
  }) => void | Promise<void>;
76
- /**
77
- * 开发服务器启动前
78
- */
79
- beforeDevServer?: (context: PluginContext) => void | Promise<void>;
80
68
  /**
81
69
  * 开发服务器启动后
82
70
  */
@@ -84,104 +72,116 @@ interface BuildHooks {
84
72
  port: number;
85
73
  host: string;
86
74
  }) => void | Promise<void>;
75
+ /**
76
+ * 构建开始前
77
+ */
78
+ beforeBuild?: (context: PluginContext) => void | Promise<void>;
79
+ /**
80
+ * 开发服务器启动前
81
+ */
82
+ beforeDevServer?: (context: PluginContext) => void | Promise<void>;
83
+ /**
84
+ * 修改 Rspack 配置
85
+ */
86
+ modifyRspackConfig?: (config: Configuration, context: PluginContext) => Configuration | undefined | Promise<Configuration | undefined>;
87
87
  }
88
88
  /**
89
89
  * 路由阶段钩子
90
90
  */
91
91
  interface RouterHooks {
92
- /**
93
- * 修改路由配置
94
- */
95
- modifyRoutes?: (routes: RouteItem[], context: PluginContext) => RouteItem[] | undefined | Promise<RouteItem[] | undefined>;
96
92
  /**
97
93
  * 路由生成后
98
94
  */
99
95
  afterRoutesGenerated?: (routes: RouteItem[], context: PluginContext) => void | Promise<void>;
96
+ /**
97
+ * 修改路由配置
98
+ */
99
+ modifyRoutes?: (routes: RouteItem[], context: PluginContext) => RouteItem[] | undefined | Promise<RouteItem[] | undefined>;
100
100
  }
101
101
  /**
102
102
  * 运行时阶段钩子
103
103
  */
104
104
  interface RuntimeHooks {
105
- /**
106
- * 修改运行时配置
107
- */
108
- modifyAppConfig?: (appConfig: AppConfig, context: PluginContext) => AppConfig | undefined;
109
105
  /**
110
106
  * 添加 Provider
111
107
  */
112
108
  addProvider?: (context: PluginContext) => ProviderConfig | ProviderConfig[];
109
+ /**
110
+ * 应用渲染后
111
+ */
112
+ afterRender?: (context: PluginContext) => void;
113
113
  /**
114
114
  * 应用渲染前
115
115
  */
116
116
  beforeRender?: (context: PluginContext) => void;
117
117
  /**
118
- * 应用渲染后
118
+ * 修改运行时配置
119
119
  */
120
- afterRender?: (context: PluginContext) => void;
120
+ modifyAppConfig?: (appConfig: AppConfig, context: PluginContext) => AppConfig | undefined;
121
121
  }
122
122
  /**
123
123
  * 生成的文件
124
124
  */
125
125
  interface GeneratedFile {
126
- /** 文件路径(相对于 .ywkf 目录) */
127
- path: string;
128
126
  /** 文件内容 */
129
127
  content: string;
128
+ /** 文件路径(相对于 .ywkf 目录) */
129
+ path: string;
130
130
  }
131
131
  /**
132
132
  * 代码生成器上下文
133
133
  */
134
134
  interface GeneratorContext {
135
- /** 工作目录 */
136
- cwd: string;
137
- /** 输出目录(.ywkf) */
138
- outputDir: string;
139
135
  /** 用户配置 */
140
136
  config: Required<YwkfConfig>;
137
+ /** 工作目录 */
138
+ cwd: string;
141
139
  /** 是否开发模式 */
142
140
  isDev: boolean;
141
+ /** 输出目录(.ywkf) */
142
+ outputDir: string;
143
143
  }
144
144
  /**
145
145
  * 代码注入点
146
146
  */
147
147
  interface CodeInjection {
148
+ /** 导出语句 */
149
+ exports?: string[];
148
150
  /** 导入语句 */
149
151
  imports?: string[];
150
152
  /** 顶层代码(在函数外部) */
151
153
  topLevel?: string[];
152
- /** 导出语句 */
153
- exports?: string[];
154
154
  }
155
155
  /**
156
156
  * 代码生成阶段钩子
157
157
  */
158
158
  interface GeneratorHooks {
159
159
  /**
160
- * 修改入口文件代码
161
- */
162
- modifyEntryCode?: (code: string, context: GeneratorContext) => string | undefined;
163
- /**
164
- * 修改启动文件代码
160
+ * 代码生成完成后
165
161
  */
166
- modifyBootstrapCode?: (code: string, context: GeneratorContext) => string | undefined;
162
+ afterGenerate?: (context: GeneratorContext) => void | Promise<void>;
167
163
  /**
168
- * 注入入口代码
169
- * 返回需要注入到入口文件的代码片段
164
+ * 生成额外文件
170
165
  */
171
- injectEntry?: (context: GeneratorContext) => CodeInjection | undefined;
166
+ generateFiles?: (context: GeneratorContext) => GeneratedFile[] | undefined;
172
167
  /**
173
168
  * 注入启动代码
174
169
  * 返回需要注入到启动文件的代码片段
175
170
  */
176
171
  injectBootstrap?: (context: GeneratorContext) => CodeInjection | undefined;
177
172
  /**
178
- * 生成额外文件
173
+ * 注入入口代码
174
+ * 返回需要注入到入口文件的代码片段
179
175
  */
180
- generateFiles?: (context: GeneratorContext) => GeneratedFile[] | undefined;
176
+ injectEntry?: (context: GeneratorContext) => CodeInjection | undefined;
181
177
  /**
182
- * 代码生成完成后
178
+ * 修改启动文件代码
183
179
  */
184
- afterGenerate?: (context: GeneratorContext) => void | Promise<void>;
180
+ modifyBootstrapCode?: (code: string, context: GeneratorContext) => string | undefined;
181
+ /**
182
+ * 修改入口文件代码
183
+ */
184
+ modifyEntryCode?: (code: string, context: GeneratorContext) => string | undefined;
185
185
  }
186
186
  /**
187
187
  * 插件钩子集合
@@ -192,17 +192,17 @@ interface PluginHooks extends BuildHooks, RouterHooks, RuntimeHooks, GeneratorHo
192
192
  * 插件定义
193
193
  */
194
194
  interface YwkfPlugin {
195
- /** 插件名称 */
196
- name: string;
197
- /** 插件版本 */
198
- version?: string;
199
195
  /** 插件描述 */
200
196
  description?: string;
197
+ /** 插件名称 */
198
+ name: string;
201
199
  /**
202
200
  * 插件初始化
203
201
  * @returns 插件钩子
204
202
  */
205
203
  setup: (context: PluginContext) => PluginHooks | Promise<PluginHooks>;
204
+ /** 插件版本 */
205
+ version?: string;
206
206
  }
207
207
  /**
208
208
  * 插件配置(用户在 ywkf.config.ts 中使用)
@@ -216,14 +216,14 @@ type DefinePlugin = (options?: Record<string, unknown>) => YwkfPlugin;
216
216
  * 插件 API(传递给插件的 setup 函数)
217
217
  */
218
218
  interface PluginAPI {
219
+ /** 添加 Rspack 插件 */
220
+ addRspackPlugin: (plugin: unknown) => void;
219
221
  /** 获取配置 */
220
222
  getConfig: () => Required<YwkfConfig>;
221
223
  /** 获取工作目录 */
222
224
  getCwd: () => string;
223
225
  /** 是否开发环境 */
224
226
  isDev: () => boolean;
225
- /** 添加 Rspack 插件 */
226
- addRspackPlugin: (plugin: unknown) => void;
227
227
  /** 修改 Rspack 配置 */
228
228
  modifyRspackConfig: (modifier: (config: Configuration) => Configuration | undefined) => void;
229
229
  }
@@ -231,12 +231,12 @@ interface PluginAPI {
231
231
  interface AnalyticsPluginOptions {
232
232
  /** 是否启用构建分析 */
233
233
  buildAnalysis?: boolean;
234
- /** 是否输出构建时间 */
235
- timing?: boolean;
236
234
  /** 是否分析 bundle 大小 */
237
235
  bundleSize?: boolean;
238
236
  /** 大文件警告阈值(KB) */
239
237
  sizeWarningThreshold?: number;
238
+ /** 是否输出构建时间 */
239
+ timing?: boolean;
240
240
  }
241
241
  /**
242
242
  * 构建分析插件
@@ -260,26 +260,26 @@ declare const analyticsPlugin: (options?: AnalyticsPluginOptions | undefined) =>
260
260
 
261
261
  interface BiomePluginOptions {
262
262
  /**
263
- * 是否在项目根目录生成 biome.json(仅在文件不存在时)
264
- * @default true
263
+ * 自定义 formatter 覆盖
265
264
  */
266
- scaffold?: boolean;
265
+ formatter?: Record<string, unknown>;
267
266
  /**
268
267
  * 额外忽略的文件 glob
269
268
  */
270
269
  ignore?: string[];
271
270
  /**
272
- * 自定义 linter 规则覆盖(浅合并到继承的规则上)
271
+ * 自定义 javascript formatter 覆盖
273
272
  */
274
- rules?: Record<string, Record<string, string>>;
273
+ javascript?: Record<string, unknown>;
275
274
  /**
276
- * 自定义 formatter 覆盖
275
+ * 自定义 linter 规则覆盖(浅合并到继承的规则上)
277
276
  */
278
- formatter?: Record<string, unknown>;
277
+ rules?: Record<string, Record<string, string>>;
279
278
  /**
280
- * 自定义 javascript formatter 覆盖
279
+ * 是否在项目根目录生成 biome.json(仅在文件不存在时)
280
+ * @default true
281
281
  */
282
- javascript?: Record<string, unknown>;
282
+ scaffold?: boolean;
283
283
  }
284
284
  /**
285
285
  * Biome 代码规范插件
@@ -327,14 +327,6 @@ interface BrowserCheckPluginOptions {
327
327
  * @example ["Object.hasOwn", "Array.prototype.at", "structuredClone"]
328
328
  */
329
329
  features?: string[];
330
- /**
331
- * 最低浏览器版本要求(基于 UA 解析)
332
- *
333
- * 优先级:`minVersions` > `fromBrowserslist` 解析结果 > 内置默认值
334
- *
335
- * @default { chrome: 93, edge: 93, firefox: 92, safari: 15.4 }
336
- */
337
- minVersions?: BrowserMinVersions;
338
330
  /**
339
331
  * 从 `.browserslistrc` 文件或 `package.json` 的 `browserslist` 字段中
340
332
  * 自动读取最低浏览器版本要求。
@@ -360,21 +352,19 @@ interface BrowserCheckPluginOptions {
360
352
  * ```
361
353
  */
362
354
  fromBrowserslist?: boolean | string;
363
- /**
364
- * 警告页面标题
365
- * @default "浏览器版本过低"
366
- */
367
- title?: string;
368
355
  /**
369
356
  * 警告页面描述信息
370
357
  * @default "您当前的浏览器版本不支持本应用所需的功能。请升级到以下推荐浏览器的最新版本:"
371
358
  */
372
359
  message?: string;
373
360
  /**
374
- * 是否显示推荐浏览器下载链接
375
- * @default true
361
+ * 最低浏览器版本要求(基于 UA 解析)
362
+ *
363
+ * 优先级:`minVersions` > `fromBrowserslist` 解析结果 > 内置默认值
364
+ *
365
+ * @default { chrome: 93, edge: 93, firefox: 92, safari: 15.4 }
376
366
  */
377
- showDownloadLinks?: boolean;
367
+ minVersions?: BrowserMinVersions;
378
368
  /**
379
369
  * 自定义渲染 HTML 的函数。如果提供,将替代默认的警告页面。
380
370
  */
@@ -389,6 +379,16 @@ interface BrowserCheckPluginOptions {
389
379
  * 注意:这段代码会在不支持的浏览器中执行,请使用 ES5 语法。
390
380
  */
391
381
  renderScript?: string;
382
+ /**
383
+ * 是否显示推荐浏览器下载链接
384
+ * @default true
385
+ */
386
+ showDownloadLinks?: boolean;
387
+ /**
388
+ * 警告页面标题
389
+ * @default "浏览器版本过低"
390
+ */
391
+ title?: string;
392
392
  }
393
393
  /**
394
394
  * 浏览器最低版本检查插件
@@ -444,8 +444,6 @@ declare const browserCheckPlugin: (options?: BrowserCheckPluginOptions | undefin
444
444
  interface GarfishPluginOptions {
445
445
  /** 应用名称(微前端标识) */
446
446
  appName?: string;
447
- /** 是否作为主应用 */
448
- master?: boolean;
449
447
  /** 子应用列表(主应用模式) */
450
448
  apps?: {
451
449
  name: string;
@@ -453,6 +451,8 @@ interface GarfishPluginOptions {
453
451
  activeRule: string;
454
452
  basename?: string;
455
453
  }[];
454
+ /** 是否作为主应用 */
455
+ master?: boolean;
456
456
  /** 沙箱配置 */
457
457
  sandbox?: {
458
458
  /** 是否开启 JS 沙箱 */
@@ -502,11 +502,21 @@ interface GarfishPluginOptions {
502
502
  declare const garfishPlugin: (options?: GarfishPluginOptions | undefined) => YwkfPlugin;
503
503
 
504
504
  interface I18nPluginOptions {
505
+ /**
506
+ * 是否自动生成初始脚手架文件
507
+ * @default true
508
+ */
509
+ autoScaffold?: boolean;
505
510
  /**
506
511
  * 默认语言
507
512
  * @default "zh-CN"
508
513
  */
509
514
  defaultLocale?: string;
515
+ /**
516
+ * 默认命名空间
517
+ * @default ["common"]
518
+ */
519
+ defaultNS?: string[];
510
520
  /**
511
521
  * 支持的语言列表
512
522
  * @default ["zh-CN", "en-US"]
@@ -524,16 +534,6 @@ interface I18nPluginOptions {
524
534
  * @default "src/locales/default"
525
535
  */
526
536
  sourceDir?: string;
527
- /**
528
- * 默认命名空间
529
- * @default ["common"]
530
- */
531
- defaultNS?: string[];
532
- /**
533
- * 是否自动生成初始脚手架文件
534
- * @default true
535
- */
536
- autoScaffold?: boolean;
537
537
  }
538
538
  /**
539
539
  * 国际化插件(TS-first 工作流)
@@ -561,12 +561,12 @@ interface I18nPluginOptions {
561
561
  declare const i18nPlugin: (options?: I18nPluginOptions | undefined) => YwkfPlugin;
562
562
 
563
563
  interface MockPluginOptions {
564
- /** Mock 文件目录 */
565
- mockDir?: string;
566
- /** 是否在生产环境启用 */
567
- enableInProd?: boolean;
568
564
  /** 延迟时间(模拟网络延迟) */
569
565
  delay?: number;
566
+ /** 是否在生产环境启用 */
567
+ enableInProd?: boolean;
568
+ /** Mock 文件目录 */
569
+ mockDir?: string;
570
570
  /** 前缀路径 */
571
571
  prefix?: string;
572
572
  }
@@ -604,10 +604,15 @@ declare const mockPlugin: (options?: MockPluginOptions | undefined) => YwkfPlugi
604
604
 
605
605
  interface ReactQueryPluginOptions {
606
606
  /**
607
- * 默认 staleTime(毫秒)
608
- * @default 5 * 60 * 1000 (5 分钟)
607
+ * axios baseURL
608
+ * @default ""
609
609
  */
610
- staleTime?: number;
610
+ baseURL?: string;
611
+ /**
612
+ * 是否开启 React Query DevTools(仅开发模式生效)
613
+ * @default true
614
+ */
615
+ devtools?: boolean;
611
616
  /**
612
617
  * 默认 gcTime(毫秒)
613
618
  * @default 10 * 60 * 1000 (10 分钟)
@@ -619,15 +624,10 @@ interface ReactQueryPluginOptions {
619
624
  */
620
625
  retry?: number | boolean;
621
626
  /**
622
- * 是否开启 React Query DevTools(仅开发模式生效)
623
- * @default true
624
- */
625
- devtools?: boolean;
626
- /**
627
- * axios baseURL
628
- * @default ""
627
+ * 默认 staleTime(毫秒)
628
+ * @default 5 * 60 * 1000 (5 分钟)
629
629
  */
630
- baseURL?: string;
630
+ staleTime?: number;
631
631
  /**
632
632
  * 请求超时时间(毫秒)
633
633
  * @default 15000
@@ -656,16 +656,16 @@ interface ReactQueryPluginOptions {
656
656
  declare const reactQueryPlugin: (options?: ReactQueryPluginOptions | undefined) => YwkfPlugin;
657
657
 
658
658
  interface TailwindPluginOptions {
659
- /**
660
- * 自定义暗色模式选择器
661
- * @default '&:where([data-theme="dark"], [data-theme="dark"] *)'
662
- */
663
- darkModeSelector?: string;
664
659
  /**
665
660
  * 是否生成 postcss.config.js(如果不存在)
666
661
  * @default true
667
662
  */
668
663
  autoConfig?: boolean;
664
+ /**
665
+ * 自定义暗色模式选择器
666
+ * @default '&:where([data-theme="dark"], [data-theme="dark"] *)'
667
+ */
668
+ darkModeSelector?: string;
669
669
  /**
670
670
  * 额外的 CSS 内容(追加到 index.css 之后)
671
671
  */
@@ -693,6 +693,11 @@ interface TailwindPluginOptions {
693
693
  declare const tailwindPlugin: (options?: TailwindPluginOptions | undefined) => YwkfPlugin;
694
694
 
695
695
  interface ThemePluginOptions {
696
+ /**
697
+ * 是否启用 CSS 变量
698
+ * @default true
699
+ */
700
+ cssVar?: boolean;
696
701
  /**
697
702
  * 是否启用暗色模式切换能力
698
703
  * @default true
@@ -702,17 +707,39 @@ interface ThemePluginOptions {
702
707
  * 默认主题模式(运行时可通过 useThemeStore 动态切换)
703
708
  * @default "light"
704
709
  */
705
- defaultAppearance?: "light" | "dark" | "auto";
710
+ defaultAppearance?: 'light' | 'dark' | 'auto';
706
711
  /**
707
- * 主色调(Lobe-UI 命名预设,运行时可通过 useThemeStore 动态切换)
712
+ * 是否启用外部主题注入(微前端场景)
708
713
  *
709
- * 不设置时使用 Lobe-UI 默认 primary 色阶(黑色系),
710
- * 可选值:"blue" | "cyan" | "geekblue" | "gold" | "green" | "lime"
711
- * | "magenta" | "orange" | "purple" | "red" | "volcano" | "yellow"
714
+ * 启用后:
715
+ * - 应用启动时读取 window.__YWKF_THEME__ 作为初始覆盖
716
+ * - 监听 ywkf:theme-change 自定义事件,实现运行时主题同步
712
717
  *
713
- * @default undefined
718
+ * @default false
714
719
  */
715
- primaryColor?: string;
720
+ externalTheme?: boolean;
721
+ /**
722
+ * 是否注入全局样式重置
723
+ * @default true
724
+ */
725
+ globalReset?: boolean;
726
+ /**
727
+ * antd 国际化 locale 配置
728
+ *
729
+ * - `"auto"`(默认):运行时自动检测并动态加载对应的 antd 语言包,兜底 zhCN。
730
+ * 检测优先级:`window.__YWKF_LOCALE__`(微前端注入)> `navigator.language` > `"zh-CN"`
731
+ *
732
+ * auto 模式下 locale 被纳入 ThemeStore,支持:
733
+ * - 用户代码通过 `useThemeStore.getState().setLocale("en-US")` 运行时切换
734
+ * - 微前端主应用通过 `ywkf:locale-change` 自定义事件同步 locale
735
+ * - 便捷 hook `useLocale()` 获取当前 locale(BCP 47 tag)
736
+ *
737
+ * - 指定具体名称(如 `"zhCN"` / `"enUS"`):静态导入该语言包,无运行时开销,
738
+ * locale 仍会写入 ThemeStore 但不会自动检测或监听外部事件
739
+ *
740
+ * @default "auto"
741
+ */
742
+ locale?: 'zhCN' | 'enUS' | 'zhTW' | 'jaJP' | 'koKR' | 'auto';
716
743
  /**
717
744
  * 中性色(Lobe-UI 命名预设)
718
745
  *
@@ -733,42 +760,15 @@ interface ThemePluginOptions {
733
760
  */
734
761
  prefixCls?: string;
735
762
  /**
736
- * 是否启用 CSS 变量
737
- * @default true
738
- */
739
- cssVar?: boolean;
740
- /**
741
- * 是否注入全局样式重置
742
- * @default true
743
- */
744
- globalReset?: boolean;
745
- /**
746
- * 是否启用外部主题注入(微前端场景)
747
- *
748
- * 启用后:
749
- * - 应用启动时读取 window.__YWKF_THEME__ 作为初始覆盖
750
- * - 监听 ywkf:theme-change 自定义事件,实现运行时主题同步
751
- *
752
- * @default false
753
- */
754
- externalTheme?: boolean;
755
- /**
756
- * antd 国际化 locale 配置
757
- *
758
- * - `"auto"`(默认):运行时自动检测并动态加载对应的 antd 语言包,兜底 zhCN。
759
- * 检测优先级:`window.__YWKF_LOCALE__`(微前端注入)> `navigator.language` > `"zh-CN"`
760
- *
761
- * auto 模式下 locale 被纳入 ThemeStore,支持:
762
- * - 用户代码通过 `useThemeStore.getState().setLocale("en-US")` 运行时切换
763
- * - 微前端主应用通过 `ywkf:locale-change` 自定义事件同步 locale
764
- * - 便捷 hook `useLocale()` 获取当前 locale(BCP 47 tag)
763
+ * 主色调(Lobe-UI 命名预设,运行时可通过 useThemeStore 动态切换)
765
764
  *
766
- * - 指定具体名称(如 `"zhCN"` / `"enUS"`):静态导入该语言包,无运行时开销,
767
- * locale 仍会写入 ThemeStore 但不会自动检测或监听外部事件
765
+ * 不设置时使用 Lobe-UI 默认 primary 色阶(黑色系),
766
+ * 可选值:"blue" | "cyan" | "geekblue" | "gold" | "green" | "lime"
767
+ * | "magenta" | "orange" | "purple" | "red" | "volcano" | "yellow"
768
768
  *
769
- * @default "auto"
769
+ * @default undefined
770
770
  */
771
- locale?: "zhCN" | "enUS" | "zhTW" | "jaJP" | "koKR" | "auto";
771
+ primaryColor?: string;
772
772
  /**
773
773
  * 将 Tooltip / Dropdown / Modal 等弹层的挂载节点限定在 ThemeWrapper 容器内
774
774
  *
@@ -849,38 +849,38 @@ declare const zustandPlugin: (options?: ZustandPluginOptions | undefined) => Ywk
849
849
  * 开发服务器配置
850
850
  */
851
851
  interface DevServerConfig {
852
- /** 开发服务器端口 */
853
- port?: number;
854
852
  /** 开发服务器主机 */
855
853
  host?: string;
856
- /** 代理配置 */
857
- proxy?: Record<string, string | object>;
858
854
  /** 是否开启 HTTPS */
859
855
  https?: boolean;
856
+ /** 开发服务器端口 */
857
+ port?: number;
858
+ /** 代理配置 */
859
+ proxy?: Record<string, string | object>;
860
860
  }
861
861
  /**
862
862
  * 输出配置
863
863
  */
864
864
  interface OutputConfig {
865
+ /** 是否清理输出目录 */
866
+ clean?: boolean;
865
867
  /** 输出目录 */
866
868
  path?: string;
867
869
  /** 公共路径 */
868
870
  publicPath?: string;
869
- /** 是否清理输出目录 */
870
- clean?: boolean;
871
871
  }
872
872
  /**
873
873
  * HTML 配置
874
874
  */
875
875
  interface HtmlConfig {
876
- /** 页面标题 */
877
- title?: string;
878
- /** HTML 模板路径 */
879
- template?: string;
880
876
  /** favicon 路径 */
881
877
  favicon?: string;
882
878
  /** 挂载根元素 ID */
883
879
  mountRoot?: string;
880
+ /** HTML 模板路径 */
881
+ template?: string;
882
+ /** 页面标题 */
883
+ title?: string;
884
884
  }
885
885
  /**
886
886
  * 样式配置
@@ -913,8 +913,6 @@ interface RouterConfig {
913
913
  basename?: string;
914
914
  /** 是否启用约定式路由 */
915
915
  conventional?: boolean;
916
- /** 约定式路由扫描目录 */
917
- pagesDir?: string;
918
916
  /** 排除的文件/目录模式 */
919
917
  exclude?: (string | RegExp)[];
920
918
  /**
@@ -934,6 +932,8 @@ interface RouterConfig {
934
932
  loading?: false | {
935
933
  component: string;
936
934
  };
935
+ /** 约定式路由扫描目录 */
936
+ pagesDir?: string;
937
937
  }
938
938
  /**
939
939
  * 微前端配置
@@ -941,21 +941,21 @@ interface RouterConfig {
941
941
  interface MicroFrontendConfig {
942
942
  /** 是否启用微前端模式 */
943
943
  enabled?: boolean;
944
+ /** 微前端框架类型 */
945
+ framework?: 'qiankun' | 'garfish';
944
946
  /** 应用名称(用于 UMD 导出) */
945
947
  name?: string;
946
- /** 微前端框架类型 */
947
- framework?: "qiankun" | "garfish";
948
948
  }
949
949
  /**
950
950
  * 性能配置
951
951
  */
952
952
  interface PerformanceConfig {
953
+ /** 是否移除 console */
954
+ dropConsole?: boolean;
953
955
  /** 是否启用 Rsdoctor 分析 */
954
956
  rsdoctor?: boolean;
955
957
  /** 是否开启代码分割 */
956
958
  splitChunks?: boolean;
957
- /** 是否移除 console */
958
- dropConsole?: boolean;
959
959
  }
960
960
  /**
961
961
  * 工具链配置
@@ -976,8 +976,6 @@ interface ToolsConfig {
976
976
  * 环境变量配置
977
977
  */
978
978
  interface EnvConfig {
979
- /** 公共环境变量文件路径 */
980
- publicEnvFile?: string;
981
979
  /** 环境特定的变量文件目录 */
982
980
  envDir?: string;
983
981
  /**
@@ -995,6 +993,8 @@ interface EnvConfig {
995
993
  * @default ["YWKF_PUBLIC_", "NEXT_PUBLIC_"]
996
994
  */
997
995
  exposePrefixes?: string[];
996
+ /** 公共环境变量文件路径 */
997
+ publicEnvFile?: string;
998
998
  }
999
999
  /**
1000
1000
  * 内置插件快捷配置
@@ -1021,19 +1021,19 @@ interface BuiltinPluginConfig {
1021
1021
  */
1022
1022
  reactQuery?: ReactQueryPluginOptions | false;
1023
1023
  /**
1024
- * Zustand 状态管理(默认启用)
1024
+ * Tailwind CSS(默认启用)
1025
1025
  *
1026
1026
  * 设为 `false` 禁用;传入配置对象自定义参数。
1027
1027
  * @default {} (启用,使用默认配置)
1028
1028
  */
1029
- zustand?: ZustandPluginOptions | false;
1029
+ tailwind?: TailwindPluginOptions | false;
1030
1030
  /**
1031
- * Tailwind CSS(默认启用)
1031
+ * Zustand 状态管理(默认启用)
1032
1032
  *
1033
1033
  * 设为 `false` 禁用;传入配置对象自定义参数。
1034
1034
  * @default {} (启用,使用默认配置)
1035
1035
  */
1036
- tailwind?: TailwindPluginOptions | false;
1036
+ zustand?: ZustandPluginOptions | false;
1037
1037
  }
1038
1038
  /**
1039
1039
  * 可选插件快捷配置
@@ -1051,23 +1051,17 @@ interface BuiltinPluginConfig {
1051
1051
  */
1052
1052
  interface OptionalPluginConfig {
1053
1053
  /**
1054
- * antd-style 主题系统
1055
- *
1056
- * 设为 `true` 使用默认配置启用,或传入 ThemePluginOptions 自定义。
1057
- */
1058
- theme?: ThemePluginOptions | true;
1059
- /**
1060
- * 国际化 (i18next)
1054
+ * 构建分析
1061
1055
  *
1062
- * 设为 `true` 使用默认配置启用,或传入 I18nPluginOptions 自定义。
1056
+ * 设为 `true` 使用默认配置启用,或传入 AnalyticsPluginOptions 自定义。
1063
1057
  */
1064
- i18n?: I18nPluginOptions | true;
1058
+ analytics?: AnalyticsPluginOptions | true;
1065
1059
  /**
1066
- * 微前端 (Garfish)
1060
+ * Biome 代码规范
1067
1061
  *
1068
- * 传入 GarfishPluginOptions 配置。
1062
+ * 设为 `true` 使用默认配置启用,或传入 BiomePluginOptions 自定义。
1069
1063
  */
1070
- garfish?: GarfishPluginOptions;
1064
+ biome?: BiomePluginOptions | true;
1071
1065
  /**
1072
1066
  * 浏览器兼容性检查
1073
1067
  *
@@ -1075,11 +1069,17 @@ interface OptionalPluginConfig {
1075
1069
  */
1076
1070
  browserCheck?: BrowserCheckPluginOptions | true;
1077
1071
  /**
1078
- * Biome 代码规范
1072
+ * 微前端 (Garfish)
1079
1073
  *
1080
- * 设为 `true` 使用默认配置启用,或传入 BiomePluginOptions 自定义。
1074
+ * 传入 GarfishPluginOptions 配置。
1081
1075
  */
1082
- biome?: BiomePluginOptions | true;
1076
+ garfish?: GarfishPluginOptions;
1077
+ /**
1078
+ * 国际化 (i18next)
1079
+ *
1080
+ * 设为 `true` 使用默认配置启用,或传入 I18nPluginOptions 自定义。
1081
+ */
1082
+ i18n?: I18nPluginOptions | true;
1083
1083
  /**
1084
1084
  * Mock 数据服务
1085
1085
  *
@@ -1087,11 +1087,11 @@ interface OptionalPluginConfig {
1087
1087
  */
1088
1088
  mock?: MockPluginOptions | true;
1089
1089
  /**
1090
- * 构建分析
1090
+ * antd-style 主题系统
1091
1091
  *
1092
- * 设为 `true` 使用默认配置启用,或传入 AnalyticsPluginOptions 自定义。
1092
+ * 设为 `true` 使用默认配置启用,或传入 ThemePluginOptions 自定义。
1093
1093
  */
1094
- analytics?: AnalyticsPluginOptions | true;
1094
+ theme?: ThemePluginOptions | true;
1095
1095
  }
1096
1096
  /**
1097
1097
  * 框架内部配置(不含插件快捷键)
@@ -1099,39 +1099,39 @@ interface OptionalPluginConfig {
1099
1099
  * 内部模块使用此类型,通过 `Required<YwkfConfig>` 确保所有字段有值。
1100
1100
  */
1101
1101
  interface YwkfConfig {
1102
- /** 应用名称 */
1103
- appName?: string;
1102
+ /** 路径别名 */
1103
+ alias?: Record<string, string>;
1104
1104
  /** 应用中文名 */
1105
1105
  appCName?: string;
1106
- /** 是否启用 React StrictMode @default true */
1107
- strictMode?: boolean;
1108
- /** 是否启用 SWC 原生 React Compiler(需 rspack ≥2.1、React 19;React 18 用 { target: "18" } 并安装 react-compiler-runtime) @default false */
1109
- reactCompiler?: boolean | {
1110
- compilationMode?: "infer" | "annotation" | "all";
1111
- target?: "17" | "18" | "19";
1112
- };
1106
+ /** 应用名称 */
1107
+ appName?: string;
1113
1108
  /** 开发服务器配置 */
1114
1109
  dev?: DevServerConfig;
1115
- /** 输出配置 */
1116
- output?: OutputConfig;
1110
+ /** 环境变量配置 */
1111
+ env?: EnvConfig;
1117
1112
  /** HTML 配置 */
1118
1113
  html?: HtmlConfig;
1119
- /** 样式配置 */
1120
- style?: StyleConfig;
1121
- /** 路由配置 */
1122
- router?: RouterConfig;
1123
1114
  /** 微前端配置 */
1124
1115
  microFrontend?: MicroFrontendConfig;
1116
+ /** 输出配置 */
1117
+ output?: OutputConfig;
1125
1118
  /** 性能配置 */
1126
1119
  performance?: PerformanceConfig;
1127
- /** 工具链配置 */
1128
- tools?: ToolsConfig;
1129
- /** 环境变量配置 */
1130
- env?: EnvConfig;
1131
- /** 路径别名 */
1132
- alias?: Record<string, string>;
1133
1120
  /** 插件列表 */
1134
1121
  plugins?: PluginConfig[];
1122
+ /** 是否启用 SWC 原生 React Compiler(需 rspack ≥2.1、React 19;React 18 用 { target: "18" } 并安装 react-compiler-runtime) @default false */
1123
+ reactCompiler?: boolean | {
1124
+ compilationMode?: 'infer' | 'annotation' | 'all';
1125
+ target?: '17' | '18' | '19';
1126
+ };
1127
+ /** 路由配置 */
1128
+ router?: RouterConfig;
1129
+ /** 是否启用 React StrictMode @default true */
1130
+ strictMode?: boolean;
1131
+ /** 样式配置 */
1132
+ style?: StyleConfig;
1133
+ /** 工具链配置 */
1134
+ tools?: ToolsConfig;
1135
1135
  }
1136
1136
  /**
1137
1137
  * 用户输入配置(支持插件快捷键)
@@ -1172,4 +1172,4 @@ declare function defineConfig(config: YwkfUserConfig): YwkfConfig;
1172
1172
  */
1173
1173
  declare const defaultConfig: Required<YwkfConfig>;
1174
1174
 
1175
- export { type AnalyticsPluginOptions as A, type BuiltinPluginConfig as B, type CodeInjection as C, type DevServerConfig as D, type EnvConfig as E, type GeneratedFile as F, type GeneratorContext as G, type HtmlConfig as H, type I18nPluginOptions as I, type GeneratorHooks as J, type PluginContext as K, type RouterHooks as L, type MicroFrontendConfig as M, type RuntimeHooks as N, type OptionalPluginConfig as O, type PerformanceConfig as P, type YwkfPlugin as Q, type RouterConfig as R, type StyleConfig as S, type ToolsConfig as T, type RouteItem as U, type DefinePlugin as V, type PluginAPI as W, type PluginLogger as X, type YwkfConfig as Y, type ZustandPluginOptions as Z, defineConfig as a, type OutputConfig as b, type YwkfUserConfig as c, defaultConfig as d, type PluginHooks as e, type PluginConfig as f, analyticsPlugin as g, type BiomePluginOptions as h, biomePlugin as i, type BrowserCheckPluginOptions as j, type BrowserMinVersions as k, browserCheckPlugin as l, type GarfishPluginOptions as m, garfishPlugin as n, getDefaultBiomeConfig as o, i18nPlugin as p, type MockPluginOptions as q, mockPlugin as r, type ReactQueryPluginOptions as s, reactQueryPlugin as t, type TailwindPluginOptions as u, type ThemePluginOptions as v, tailwindPlugin as w, themePlugin as x, type BuildHooks as y, zustandPlugin as z };
1175
+ export { type AnalyticsPluginOptions as A, type BuiltinPluginConfig as B, type CodeInjection as C, type DevServerConfig as D, type EnvConfig as E, type GeneratedFile as F, type GeneratorContext as G, type HtmlConfig as H, type I18nPluginOptions as I, type GeneratorHooks as J, type PluginContext as K, type RouterHooks as L, type MicroFrontendConfig as M, type RuntimeHooks as N, type OptionalPluginConfig as O, type PerformanceConfig as P, type YwkfPlugin as Q, type RouterConfig as R, type StyleConfig as S, type ToolsConfig as T, type RouteItem as U, type DefinePlugin as V, type PluginAPI as W, type PluginLogger as X, type YwkfConfig as Y, type ZustandPluginOptions as Z, defineConfig as a, type OutputConfig as b, type YwkfUserConfig as c, defaultConfig as d, type PluginHooks as e, type PluginConfig as f, analyticsPlugin as g, biomePlugin as h, type BiomePluginOptions as i, browserCheckPlugin as j, type BrowserCheckPluginOptions as k, type BrowserMinVersions as l, garfishPlugin as m, type GarfishPluginOptions as n, getDefaultBiomeConfig as o, i18nPlugin as p, mockPlugin as q, type MockPluginOptions as r, reactQueryPlugin as s, type ReactQueryPluginOptions as t, tailwindPlugin as u, type TailwindPluginOptions as v, themePlugin as w, type ThemePluginOptions as x, type BuildHooks as y, zustandPlugin as z };