@empjs/cli 3.12.5-beta.3 → 4.0.0-alpha.2

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.
Files changed (61) hide show
  1. package/README.md +2 -2
  2. package/dist/346.js +10 -0
  3. package/dist/627.js +5 -0
  4. package/dist/build.js +1 -0
  5. package/dist/dev.js +2 -0
  6. package/dist/dev.js.LICENSE.txt +1 -0
  7. package/dist/helper/buildPrint.d.ts +41 -0
  8. package/dist/helper/chalk.d.ts +3 -0
  9. package/dist/helper/color.d.ts +31 -0
  10. package/dist/helper/compilerWatcher.d.ts +5 -0
  11. package/dist/helper/empRoot.d.ts +1 -0
  12. package/dist/helper/getPort.d.ts +6 -0
  13. package/dist/helper/hmr/client.d.ts +0 -0
  14. package/dist/helper/hmr/config.d.ts +0 -0
  15. package/dist/helper/hmr/index.d.ts +0 -0
  16. package/dist/helper/hmr/overlay.d.ts +0 -0
  17. package/dist/helper/hmr/process-update.d.ts +0 -0
  18. package/dist/helper/hono.d.ts +0 -0
  19. package/dist/helper/index.d.ts +6 -0
  20. package/dist/helper/ipAddress.d.ts +27 -0
  21. package/dist/helper/loadConfig.d.ts +5 -0
  22. package/dist/helper/logger.d.ts +27 -0
  23. package/dist/helper/nodePolyfill.d.ts +1 -0
  24. package/dist/helper/openBrowser.d.ts +2 -0
  25. package/dist/helper/utils.d.ts +15 -0
  26. package/dist/index.d.ts +16 -841
  27. package/dist/index.js +1 -22
  28. package/dist/script/base.d.ts +6 -0
  29. package/dist/script/build.d.ts +15 -0
  30. package/dist/script/dev.d.ts +30 -0
  31. package/dist/script/index.d.ts +1 -0
  32. package/dist/script/serve.d.ts +7 -0
  33. package/dist/serve.js +1 -0
  34. package/dist/server/connect/dev.d.ts +9 -0
  35. package/dist/server/connect/prod.d.ts +3 -0
  36. package/dist/server/express/dev.d.ts +0 -0
  37. package/dist/server/express/prod.d.ts +0 -0
  38. package/dist/server/hono/dev.d.ts +0 -0
  39. package/dist/server/hono/devServer/devMiddleware.d.ts +0 -0
  40. package/dist/server/hono/prod.d.ts +0 -0
  41. package/dist/server/index.d.ts +3 -0
  42. package/dist/server/types.d.ts +3 -0
  43. package/dist/server.js +1 -0
  44. package/dist/store/chain.d.ts +41 -0
  45. package/dist/store/empConfig.d.ts +75 -0
  46. package/dist/store/index.d.ts +179 -0
  47. package/dist/store/lifeCycle.d.ts +57 -0
  48. package/dist/store/rspack/builtInPlugin.d.ts +16 -0
  49. package/dist/store/rspack/common.d.ts +21 -0
  50. package/dist/store/rspack/css.d.ts +10 -0
  51. package/dist/store/rspack/entries.d.ts +44 -0
  52. package/dist/store/rspack/index.d.ts +7 -0
  53. package/dist/store/rspack/module.d.ts +22 -0
  54. package/dist/store/rspack/plugin.d.ts +19 -0
  55. package/dist/store/server.d.ts +39 -0
  56. package/dist/types/config.d.ts +428 -0
  57. package/dist/types/env.d.ts +3 -0
  58. package/dist/types/plugin.d.ts +6 -0
  59. package/package.json +16 -21
  60. package/dist/index.cjs +0 -22
  61. package/dist/index.d.cts +0 -841
@@ -0,0 +1,57 @@
1
+ export type LifeCycleOptions = Partial<LifeCycle>;
2
+ export declare class LifeCycle {
3
+ op: LifeCycleOptions;
4
+ constructor(op?: LifeCycleOptions);
5
+ /**
6
+ * 获取 empOptions 之后、初始化 empConfig 之前
7
+ */
8
+ afterGetEmpOptions(): Promise<void>;
9
+ /**
10
+ * RspackPlugin 插件执行之前
11
+ */
12
+ beforePlugin(): Promise<void>;
13
+ /**
14
+ * RspackPlugin 插件执行之后
15
+ */
16
+ afterPlugin(): Promise<void>;
17
+ /**
18
+ * RspackModule 插件执行之后
19
+ */
20
+ beforeModule(): Promise<void>;
21
+ /**
22
+ * RspackModule 插件执行之后
23
+ */
24
+ afterModule(): Promise<void>;
25
+ /**
26
+ * empPlugin 插件执行之前
27
+ */
28
+ beforeEmpPlugin(): Promise<void>;
29
+ /**
30
+ * empPlugin 插件执行之后
31
+ */
32
+ afterEmpPlugin(): Promise<void>;
33
+ /**
34
+ * 产物构建完成前
35
+ */
36
+ beforeBuild(): Promise<void>;
37
+ /**
38
+ * 产物构建完成后
39
+ */
40
+ afterBulid(): Promise<void>;
41
+ /**
42
+ * devServer启动前
43
+ */
44
+ beforeDevServe(): Promise<void>;
45
+ /**
46
+ * devServer启动后
47
+ */
48
+ afterDevServe(): Promise<void>;
49
+ /**
50
+ * server启动前
51
+ */
52
+ beforeServe(): Promise<void>;
53
+ /**
54
+ * server启动后
55
+ */
56
+ afterServe(): Promise<void>;
57
+ }
@@ -0,0 +1,16 @@
1
+ import type { Compiler } from '@rspack/core';
2
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
3
+ import type { InjectTagsType } from '../../types/config';
4
+ export { HtmlWebpackPlugin };
5
+ export declare function getPolyfillEntry(): string;
6
+ export declare class EmpPolyfillPlugin {
7
+ constructor();
8
+ apply(compiler: Compiler): void;
9
+ }
10
+ export declare class HtmlEmpInjectPlugin {
11
+ PluginName: string;
12
+ chunk: string;
13
+ files: InjectTagsType;
14
+ constructor(files: InjectTagsType, name?: string, chunk?: string);
15
+ apply(compiler: any): void;
16
+ }
@@ -0,0 +1,21 @@
1
+ import type { CacheOptions } from '@rspack/core';
2
+ import type { GlobalStore } from '..';
3
+ declare class RspackCommon {
4
+ store: GlobalStore;
5
+ setup(store: GlobalStore): Promise<void>;
6
+ /**
7
+ * 适配缓存多样性设置
8
+ */
9
+ get cache(): CacheOptions;
10
+ /**
11
+ * 解决单项目多开的缓存问题
12
+ */
13
+ get name(): string;
14
+ common(): Promise<void>;
15
+ checkTsconfig(): Promise<void>;
16
+ stats(): Promise<void>;
17
+ devServer(): Promise<void>;
18
+ optimization(): Promise<void>;
19
+ }
20
+ declare const _default: RspackCommon;
21
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import type { GlobalStore } from '..';
2
+ export declare class RspackCss {
3
+ store: GlobalStore;
4
+ setup(store: GlobalStore): Promise<void>;
5
+ sass(): Promise<void>;
6
+ less(): Promise<void>;
7
+ css(): Promise<void>;
8
+ }
9
+ declare const _default: RspackCss;
10
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import type { RspackOptions } from '@rspack/core';
2
+ import type { GlobalStore } from '..';
3
+ import type { EmpConfig } from '../empConfig';
4
+ type EntriesConfigType = {
5
+ [chunk: string]: {
6
+ html: EmpConfig['html'];
7
+ entry: RspackOptions['entry'];
8
+ };
9
+ };
10
+ declare class RspackEntries {
11
+ store: GlobalStore;
12
+ entriesConfig: EntriesConfigType;
13
+ setup(store: GlobalStore): Promise<void>;
14
+ private setHtmlConfig;
15
+ private prepareAndSetAsset;
16
+ /**
17
+ * injectPolyfill 插入 polyfill 代码
18
+ */
19
+ private injectPolyfill;
20
+ /**
21
+ * chunk name 格式化 去除 后缀
22
+ * @param filename
23
+ * @returns
24
+ */
25
+ private setChunk;
26
+ private setTemplate;
27
+ private setFavicion;
28
+ /**
29
+ *
30
+ * @param filename 文件名
31
+ * @param op html plugin 配置
32
+ * @param absPath 文件 绝对路径
33
+ */
34
+ private setEntryItem;
35
+ setRspackHtmlPlugin(config: EmpConfig['html'], chunk: string): void;
36
+ setRspackEntry(entry: RspackOptions['entry']): void;
37
+ init(): Promise<void>;
38
+ setAutoPage(): Promise<void>;
39
+ setDefaultEntry(): Promise<void>;
40
+ setEntryByConfig(): void;
41
+ toConfig(): void;
42
+ }
43
+ declare const _default: RspackEntries;
44
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type { GlobalStore } from '..';
2
+ export declare class RspackStore {
3
+ store: GlobalStore;
4
+ setup(store: GlobalStore): Promise<void>;
5
+ }
6
+ declare const _default: RspackStore;
7
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import type { GlobalStore } from '..';
2
+ declare class RspackModule {
3
+ store: GlobalStore;
4
+ private swcJsOptions;
5
+ private swcTsOptions;
6
+ private coreJs;
7
+ setup(store: GlobalStore): Promise<void>;
8
+ run(): Promise<void>;
9
+ private rspackGenerator;
10
+ private rspackParser;
11
+ private get isPolyfill();
12
+ private swcParser;
13
+ private swcJsc;
14
+ private get swcCoreVersion();
15
+ private swcOptions;
16
+ swcInitOptions(): void;
17
+ jsDataUrl(): void;
18
+ scripts(): Promise<void>;
19
+ files(): Promise<void>;
20
+ }
21
+ declare const _default: RspackModule;
22
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import type { GlobalStore } from '..';
2
+ declare class RspackPlugin {
3
+ store: GlobalStore;
4
+ setup(store: GlobalStore): Promise<void>;
5
+ beforeLifeCycle(): void;
6
+ anylayze(): Promise<void>;
7
+ tsCheckerRspackPlugin(): false | undefined;
8
+ define(): Promise<void>;
9
+ copy(): Promise<void>;
10
+ progress(): Promise<void>;
11
+ minify(): void;
12
+ redoctor(): void;
13
+ sourceMapDevToolPlugin(): void;
14
+ circularDependency(): void;
15
+ cssChunkingPlugin(): void;
16
+ esmLibraryPlugin(): void;
17
+ }
18
+ declare const _default: RspackPlugin;
19
+ export default _default;
@@ -0,0 +1,39 @@
1
+ import type { GlobalStore } from './';
2
+ export declare class StoreServer {
3
+ ip: string;
4
+ host: string;
5
+ isAutoDevBase: boolean;
6
+ isHttps: boolean;
7
+ httpsType: 'default' | 'h2' | 'h3';
8
+ protocol: string;
9
+ port: number;
10
+ store: GlobalStore;
11
+ publicPath: any;
12
+ publicHasHttp: boolean;
13
+ isOpenBrower: boolean;
14
+ url: string;
15
+ urls: {
16
+ localUrlForBrowser: string;
17
+ localUrlForTerminal: string;
18
+ lanUrlForTerminal: string;
19
+ lanUrlForConfig: string;
20
+ };
21
+ constructor(store: GlobalStore);
22
+ /**
23
+ * 获取config后重新适配 server 配置信息
24
+ */
25
+ setupOnEmpOptionSync(): Promise<void>;
26
+ /**
27
+ * 获取 server 所有配置信息
28
+ */
29
+ get config(): {};
30
+ /**
31
+ * setupOnEmpOptionSync 之后,store setup 之后
32
+ */
33
+ setupOnStore(): Promise<void>;
34
+ startOpen(): void;
35
+ getcert(): Promise<any>;
36
+ private setHttps;
37
+ private setAutoDevBase;
38
+ private get isHttpBase();
39
+ }
@@ -0,0 +1,428 @@
1
+ import type { InspectOptions } from 'node:util';
2
+ import type { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
3
+ import type { DevServer as devServerConfig, CacheOptions, Externals, HtmlRspackPluginOptions, Output, Resolve, Configuration as RsConfig, RuleSetRule, SourceMapDevToolPluginOptions, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
4
+ import type { HtmlTagObject } from 'html-webpack-plugin';
5
+ import type { Options as SassOptions } from 'sass-embedded';
6
+ import { Chain } from '../store/chain';
7
+ import type { LifeCycleOptions } from '../store/lifeCycle';
8
+ import type { TsCheckerRspackPluginOptions } from 'ts-checker-rspack-plugin/lib/plugin-options';
9
+ import type { EMP3PluginType } from './plugin';
10
+ export type LoggerType = 'debug' | 'info' | 'warn' | 'error';
11
+ export type RsdoctorRspackPluginOptions = ConstructorParameters<typeof RsdoctorRspackPlugin>[0];
12
+ export type CssminOptionsType = any;
13
+ export type DebugType = {
14
+ loggerLevel?: LoggerType;
15
+ clearLog?: boolean;
16
+ progress?: boolean;
17
+ showRsconfig?: boolean | string | InspectOptions;
18
+ /**
19
+ * 已经弃用
20
+ */
21
+ showPerformance?: boolean;
22
+ showScriptDebug?: boolean;
23
+ rsdoctor?: boolean | RsdoctorRspackPluginOptions;
24
+ newTreeshaking?: boolean;
25
+ devShowAllLog?: boolean;
26
+ warnRuleAsWarning?: boolean;
27
+ /**
28
+ * 是否显示执行日志
29
+ * @default false
30
+ */
31
+ infrastructureLogging?: RsConfig['infrastructureLogging'];
32
+ /**
33
+ * 开启并行 code spitting
34
+ * @default true
35
+ */
36
+ /**
37
+ * https://rspack.rs/zh/plugins/rspack/css-chunking-plugin
38
+ * 启用 CssChunkingPlugin 后,SplitChunksPlugin 将不再处理 CSS 模块。 这意味着 optimization.splitChunks 等配置对 CSS 模块将不再生效,所有 CSS 模块的代码分割逻辑完全由 CssChunkingPlugin 处理。
39
+ */
40
+ cssChunkingPlugin?: boolean | Record<string, any>;
41
+ /**
42
+ * 是否启用 Rspack 原生文件监听器。
43
+ * @default true
44
+ */
45
+ nativeWatcher?: boolean;
46
+ };
47
+ export type ServerType = devServerConfig & {
48
+ /**
49
+ * 访问 host
50
+ * @default '0.0.0.0'
51
+ */
52
+ host?: string;
53
+ /**
54
+ * 访问 端口
55
+ * @default 8000
56
+ */
57
+ port?: number;
58
+ /**
59
+ * 自动打开
60
+ * @default false
61
+ */
62
+ open?: devServerConfig['open'];
63
+ /**
64
+ * 热重载
65
+ * @default true
66
+ */
67
+ hot?: devServerConfig['hot'];
68
+ http2?: boolean;
69
+ https?: boolean;
70
+ };
71
+ export type PolyfillType = {
72
+ /**
73
+ * 注入兼容代码
74
+ * module federation 入口 建议使用 entry
75
+ * @default false
76
+ */
77
+ mode?: 'entry' | 'usage';
78
+ /**
79
+ * 当 mode=entry时,注入cdn替代 entry chunk
80
+ */
81
+ entryCdn?: string;
82
+ splitChunks?: boolean;
83
+ /**
84
+ * 手动注入兼容代码,避免usage出现分析纰漏问题
85
+ * @default ['es.object.values', 'es.object.entries', 'es.array.flat']
86
+ */
87
+ include?: string[];
88
+ /**
89
+ * 选择core-js的兼容版本有助于切换适当的代码体积
90
+ * @default stable
91
+ */
92
+ coreJsFeatures?: 'full' | 'actual' | 'stable' | 'es';
93
+ /**
94
+ * @swc/helpers 外置
95
+ * @default false
96
+ */
97
+ externalHelpers?: boolean;
98
+ /**
99
+ * 浏览器 兼容版本
100
+ */
101
+ browserslist?: string[];
102
+ };
103
+ export type SourceMapType = {
104
+ js: RsConfig['devtool'] | false;
105
+ css: boolean;
106
+ devToolPluginOptions?: SourceMapDevToolPluginOptions;
107
+ };
108
+ export type BuildType = {
109
+ /**
110
+ * 生成代码目录
111
+ * @default 'dist'
112
+ */
113
+ outDir?: string;
114
+ /**
115
+ * 生成静态目录
116
+ * @default 'assets'
117
+ */
118
+ assetsDir?: string;
119
+ /**
120
+ * 生成包含 js,css,asset 合集目录
121
+ * @default ''
122
+ */
123
+ staticDir?: string;
124
+ /**
125
+ * 静态文件路径
126
+ * @default 'public'
127
+ */
128
+ publicDir?: string;
129
+ /**
130
+ * named 使用有意义、方便调试的内容当作模块 id。此选项会在开发环境下默认开启。
131
+ * deterministic 使用对模块标识符哈希后的数字当作模块 id,有益于长期缓存。此选项会在生产环境下默认开启。
132
+ */
133
+ moduleIds?: 'named' | 'deterministic';
134
+ /**
135
+ * chunkIds
136
+ * @default named|deterministic
137
+ */
138
+ chunkIds?: false | 'natural' | 'named' | 'deterministic' | 'size' | 'total-size';
139
+ /**
140
+ * 是否生成 source map
141
+ * @default true
142
+ */
143
+ sourcemap?: boolean | SourceMapType;
144
+ /**
145
+ * sourcemap 类型
146
+ * 默认 source-map
147
+ * @deprecated 请使用 build.sourcemap.js 设置
148
+ */
149
+ devtool?: RsConfig['devtool'];
150
+ /**
151
+ * 是否压缩
152
+ * @default true
153
+ */
154
+ minify?: boolean;
155
+ /**
156
+ * 设置内置压缩器配置
157
+ * @default {}
158
+ */
159
+ minOptions?: SwcJsMinimizerRspackPluginOptions;
160
+ cssminOptions?: CssminOptionsType;
161
+ /**
162
+ * Rspack incremental build 配置。
163
+ * @default 'advance-silent'
164
+ */
165
+ incremental?: RsConfig['incremental'];
166
+ /**
167
+ * Rspack lazy compilation 配置。
168
+ * @default development mode true
169
+ */
170
+ lazyCompilation?: RsConfig['lazyCompilation'];
171
+ /**
172
+ * 生成代码 参考 https://swc.rs/docs/configuring-swc#jsctarget
173
+ */
174
+ target?: JscTarget;
175
+ /**
176
+ * 是否用 ESM
177
+ */
178
+ useESM?: boolean;
179
+ /**
180
+ * 注入兼容代码
181
+ * module federation 入口 建议使用 entry
182
+ * @default false
183
+ */
184
+ polyfill?: PolyfillType;
185
+ /**
186
+ * swc 配置
187
+ */
188
+ swcConfig?: {
189
+ transform?: {
190
+ useDefineForClassFields?: boolean;
191
+ };
192
+ preserveAllComments?: boolean;
193
+ };
194
+ };
195
+ export type JscTarget = 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022';
196
+ export interface HtmlType extends HtmlRspackPluginOptions {
197
+ /**
198
+ * 基于项目的根目录 index.html url
199
+ * @default src/index.html
200
+ */
201
+ template?: string;
202
+ /**
203
+ * 基于项目的根目录 favicon url
204
+ * @default src/favicon.ico
205
+ */
206
+ favicon?: string;
207
+ /**
208
+ * 自定义挂载节点的 id,默认为 'emp-root'
209
+ * @default 'emp-root'
210
+ */
211
+ mountId?: string;
212
+ /**
213
+ * 网站语言
214
+ */
215
+ lang?: string;
216
+ /**
217
+ * externals 文件插入到html
218
+ */
219
+ tags?: InjectTagsTypeItem[];
220
+ templateParameters?: any;
221
+ cache?: boolean;
222
+ }
223
+ export type EntriesType = {
224
+ [entryFilename: string]: HtmlType;
225
+ };
226
+ export interface ModuleTransform {
227
+ exclude?: RuleSetRule['exclude'][];
228
+ include?: RuleSetRule['include'][];
229
+ /**
230
+ * 默认exclude /(node_modules|bower_components)/
231
+ * @default false
232
+ */
233
+ defaultExclude?: boolean;
234
+ }
235
+ export type CssSassOptionsType = {
236
+ api?: 'modern' | 'modern-compiler';
237
+ sassOptions?: SassOptions<'async'>;
238
+ mode?: 'default' | 'modern' | 'legacy';
239
+ implementation?: object | string;
240
+ };
241
+ /**
242
+ * Less 配置项
243
+ *
244
+ * 将 less-loader 的常用选项暴露到 empConfig.css.less,并提供 TS 提示。
245
+ */
246
+ export type CssLessOptionsType = {
247
+ /**
248
+ * 传递给 less-loader 的 lessOptions。
249
+ *
250
+ * - `javascriptEnabled`: 允许在 Less 中使用 JS 表达式与函数。
251
+ * 许多第三方 UI 库(如 Ant Design)在主题构建或函数型变量计算中需要开启。
252
+ * 若关闭,可能导致变量计算/函数调用失败(构建报错或样式异常)。
253
+ * 默认值:`true`。
254
+ *
255
+ * - `math`: 控制数学表达式解析策略(Less v4)。
256
+ * - `'always'`: 始终解析数学表达式(兼容旧 Less 裸除法写法,升级更平滑)。
257
+ * - `'parens-division'`: 仅在括号内解析除法,更安全的中间策略。
258
+ * - `'strict'`: 更严格的解析方式,需显式括号。
259
+ * 默认值:`'always'`,用于提升对旧代码及部分生态的兼容性。
260
+ */
261
+ lessOptions?: {
262
+ javascriptEnabled?: boolean;
263
+ math?: 'always' | 'parens-division' | 'strict';
264
+ };
265
+ };
266
+ export type ExternalsItemType = {
267
+ /**
268
+ * 模块名
269
+ * @example react-dom
270
+ */
271
+ module?: string;
272
+ /**
273
+ * 全局变量
274
+ * @example ReactDom
275
+ */
276
+ global?: string;
277
+ /**
278
+ * 入口地址
279
+ * 不填则可以通过 emp-config 里的 html.files.js[url] 传入合并后的请求
280
+ * 如 http://...?react&react-dom&react-router&mobx
281
+ * @example http://
282
+ */
283
+ entry?: string;
284
+ /**
285
+ * 类型入口
286
+ * @default js
287
+ * @enum js | css
288
+ * @example css
289
+ */
290
+ type?: string;
291
+ };
292
+ export type RsTarget = RsConfig['target'];
293
+ export type AutoPagesType = {
294
+ /**
295
+ * 基于src寻找入口目录
296
+ * @default pages
297
+ */
298
+ path?: string;
299
+ };
300
+ export type EmpOptions = {
301
+ /**
302
+ * publicPath 根路径 可参考webpack,业务模式默认为 auto
303
+ * html 部分 publicPath 默认为 undefined,可设置全量域名或子目录适配,也可以单独在html设置 Public
304
+ *
305
+ * @default undefined
306
+ */
307
+ base?: string;
308
+ /**
309
+ * 构建target
310
+ */
311
+ target?: RsConfig['target'];
312
+ /**
313
+ * 启动后 自动设置 base 为当前 Ip+port的路径如 base = http://127.0.0.1:8080/ 并且固定 ws 方便代理调试
314
+ */
315
+ autoDevBase?: boolean;
316
+ /**
317
+ * 启动后 进入自动搜寻入口的方式
318
+ * 可以通过 html 或 entries 设置 模版配置
319
+ */
320
+ autoPages?: boolean | AutoPagesType;
321
+ /**
322
+ * 项目代码路径
323
+ * @default 'src'
324
+ */
325
+ appSrc?: string;
326
+ /**
327
+ * 项目代码入口文件 如 `src/index.js`
328
+ * (*)entries 设置后 该选项失效
329
+ * @default 'index.js'
330
+ */
331
+ appEntry?: string;
332
+ build?: BuildType;
333
+ plugins?: EMP3PluginType[];
334
+ html?: HtmlType;
335
+ entries?: EntriesType;
336
+ server?: ServerType;
337
+ debug?: DebugType;
338
+ chain?: (chain: Chain) => void;
339
+ /**
340
+ * css 相关设置
341
+ * @argument sass default {mode: 'modern'}
342
+ */
343
+ css?: {
344
+ sass?: CssSassOptionsType & {
345
+ webpackImporter?: boolean;
346
+ warnRuleAsWarning?: boolean;
347
+ additionalData?: string;
348
+ };
349
+ /**
350
+ * Less 配置
351
+ *
352
+ * 默认:`{ lessOptions: { javascriptEnabled: true, math: 'always' } }`
353
+ * 如项目严格遵循 Less v4 新语法且不依赖 JS 表达式,可考虑:
354
+ * - 将 `math` 调整为 `'parens-division'` 或 `'strict'`;
355
+ * - 将 `javascriptEnabled` 设为 `false`。
356
+ */
357
+ less?: CssLessOptionsType;
358
+ prifixName?: string;
359
+ };
360
+ /**
361
+ * 模块编译
362
+ * 如 node_modules 模块 是否加入编译
363
+ */
364
+ moduleTransform?: ModuleTransform;
365
+ /**
366
+ * 缓存目录
367
+ * @default 'node_modules/.emp-cache'
368
+ */
369
+ cacheDir?: string;
370
+ /**
371
+ * 启用缓存
372
+ * @default persistent 为 内存缓存 false 关闭 persistent 持久缓存
373
+ */
374
+ cache?: boolean | 'persistent' | CacheOptions;
375
+ /**
376
+ * 全局环境替换
377
+ */
378
+ define?: Record<string, any>;
379
+ /**
380
+ * 是否创建 cjs 的 process.env 或者 esm 的 import.meta.env
381
+ * all 两者创建
382
+ * esm 创建 import.meta.env
383
+ * cjs 创建 process.env
384
+ * none 不创建
385
+ * @default cjs
386
+ */
387
+ defineFix?: 'all' | 'esm' | 'cjs' | 'none';
388
+ /**
389
+ * externals
390
+ */
391
+ externals?: Externals;
392
+ /**
393
+ * resolve
394
+ */
395
+ resolve?: Resolve;
396
+ /**
397
+ * output
398
+ */
399
+ output?: Output;
400
+ /**
401
+ * emp 执行周期
402
+ */
403
+ lifeCycle?: LifeCycleOptions;
404
+ /**
405
+ * ignoreWarnings
406
+ * @default [/Conflicting order/, /Failed to parse source map/]
407
+ */
408
+ ignoreWarnings?: RsConfig['ignoreWarnings'];
409
+ /**
410
+ * 详情 https://github.com/rspack-contrib/ts-checker-rspack-plugin
411
+ */
412
+ tsCheckerRspackPlugin?: TsCheckerRspackPluginOptions | boolean;
413
+ /**
414
+ * 是否显示日志标题
415
+ * @default undefined
416
+ */
417
+ showLogTitle?: (o?: any) => void;
418
+ };
419
+ export type Override<What, With> = Omit<What, keyof With> & With;
420
+ export type InjectTagsType = InjectTagsTypeItem[];
421
+ export type InjectTagsTypeItem = {
422
+ pos?: 'head' | 'body';
423
+ } & Partial<HtmlTagObject>;
424
+ export type StoreRootPaths = {
425
+ tsConfig?: string;
426
+ empConfig?: string;
427
+ pkg?: string;
428
+ };
@@ -0,0 +1,3 @@
1
+ export type EMPModeType = 'development' | 'production';
2
+ export type CliActionType = 'dev' | 'build' | 'serve';
3
+ export type CliOptionsType = any;
@@ -0,0 +1,6 @@
1
+ import type { GlobalStore } from '../store';
2
+ export type EMP3PluginType = {
3
+ name: string;
4
+ rsConfig: (store: GlobalStore) => Promise<void>;
5
+ };
6
+ export type EMP3PluginFnType = (o: any) => EMP3PluginType;