@empjs/cli 3.0.0-rc.26 → 3.0.0-rc.28

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 (43) hide show
  1. package/dist/index.cjs +17 -0
  2. package/dist/index.d.cts +691 -0
  3. package/dist/index.d.ts +691 -15
  4. package/dist/index.js +16 -16
  5. package/package.json +8 -19
  6. package/dist/helper/buildPrint.d.ts +0 -15
  7. package/dist/helper/getPort.d.ts +0 -6
  8. package/dist/helper/hmr/client.d.ts +0 -0
  9. package/dist/helper/hmr/config.d.ts +0 -0
  10. package/dist/helper/hmr/index.d.ts +0 -0
  11. package/dist/helper/hmr/overlay.d.ts +0 -0
  12. package/dist/helper/hmr/process-update.d.ts +0 -1
  13. package/dist/helper/index.d.ts +0 -4
  14. package/dist/helper/ipAddress.d.ts +0 -27
  15. package/dist/helper/logger.d.ts +0 -36
  16. package/dist/helper/nodePolyfill.d.ts +0 -7
  17. package/dist/helper/openBrowser.d.ts +0 -2
  18. package/dist/helper/utils.d.ts +0 -17
  19. package/dist/script/base.d.ts +0 -26
  20. package/dist/script/build.d.ts +0 -15
  21. package/dist/script/bundle.d.ts +0 -6
  22. package/dist/script/dev.d.ts +0 -9
  23. package/dist/script/devServer.d.ts +0 -0
  24. package/dist/script/dts.d.ts +0 -27
  25. package/dist/script/httpBase.d.ts +0 -10
  26. package/dist/script/index.d.ts +0 -1
  27. package/dist/script/serve.d.ts +0 -9
  28. package/dist/store/cycle/autoDevBase.d.ts +0 -8
  29. package/dist/store/empConfig.d.ts +0 -65
  30. package/dist/store/empShare/fastMode.d.ts +0 -18
  31. package/dist/store/empShare/index.d.ts +0 -30
  32. package/dist/store/index.d.ts +0 -125
  33. package/dist/store/lifeCycle.d.ts +0 -18
  34. package/dist/store/rspack/common.d.ts +0 -12
  35. package/dist/store/rspack/css.d.ts +0 -10
  36. package/dist/store/rspack/entries.d.ts +0 -39
  37. package/dist/store/rspack/hook.d.ts +0 -24
  38. package/dist/store/rspack/index.d.ts +0 -7
  39. package/dist/store/rspack/module.d.ts +0 -20
  40. package/dist/store/rspack/plugin.d.ts +0 -13
  41. package/dist/types/config.d.ts +0 -356
  42. package/dist/types/env.d.ts +0 -1
  43. package/dist/types/plugin.d.ts +0 -6
@@ -1,356 +0,0 @@
1
- /// <reference types="node" />
2
- import type { InspectOptions } from 'node:util';
3
- import type { Configuration as RsConfig } from '@rspack/core';
4
- import type { Externals, HtmlRspackPluginOptions, Output, Resolve, RuleSetRule, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
5
- import type { Configuration as devServerConfig } from '@rspack/dev-server';
6
- import type { Options as SassOptions } from 'sass-embedded';
7
- import type { ModuleFederationPluginOptions } from '../store/empShare';
8
- import type { LifeCycleOptions } from '../store/lifeCycle';
9
- import type Chain from 'webpack-chain';
10
- import type { EMP3PluginType } from './plugin';
11
- export type LoggerType = 'debug' | 'info' | 'warn' | 'error';
12
- export type DebugType = {
13
- loggerLevel: LoggerType;
14
- clearLog: boolean;
15
- progress: boolean;
16
- showRsconfig: boolean | string | InspectOptions;
17
- showPerformance: boolean;
18
- rspackCache: boolean;
19
- newTreeshaking: boolean;
20
- /**
21
- * 是否显示执行日志
22
- * @default false
23
- */
24
- infrastructureLogging: RsConfig['infrastructureLogging'];
25
- };
26
- export type ServerType = devServerConfig & {
27
- /**
28
- * 访问 host
29
- * @default '0.0.0.0'
30
- */
31
- host: string;
32
- /**
33
- * 访问 端口
34
- * @default 8000
35
- */
36
- port: number;
37
- /**
38
- * 自动打开
39
- * @default false
40
- */
41
- open?: devServerConfig['open'];
42
- /**
43
- * 热重载
44
- * @default true
45
- */
46
- hot?: devServerConfig['hot'];
47
- };
48
- export type BuildType = {
49
- /**
50
- * 生成代码目录
51
- * @default 'dist'
52
- */
53
- outDir?: string;
54
- /**
55
- * 生成静态目录
56
- * @default 'assets'
57
- */
58
- assetsDir?: string;
59
- /**
60
- * 生成包含 js,css,asset 合集目录
61
- * @default ''
62
- */
63
- staticDir?: string;
64
- /**
65
- * 静态文件路径
66
- * @default 'public'
67
- */
68
- publicDir?: string;
69
- /**
70
- * named 使用有意义、方便调试的内容当作模块 id。此选项会在开发环境下默认开启。
71
- * deterministic 使用对模块标识符哈希后的数字当作模块 id,有益于长期缓存。此选项会在生产环境下默认开启。
72
- */
73
- moduleIds?: 'named' | 'deterministic';
74
- /**
75
- * chunkIds
76
- * @default named|deterministic
77
- */
78
- chunkIds?: false | 'natural' | 'named' | 'deterministic' | 'size' | 'total-size';
79
- /**
80
- * 是否生成 source map
81
- * @default true
82
- */
83
- sourcemap?: boolean;
84
- /**
85
- * 是否压缩
86
- * @default true
87
- */
88
- minify?: boolean;
89
- /**
90
- * 设置内置压缩器配置
91
- * @default {}
92
- */
93
- minOptions?: SwcJsMinimizerRspackPluginOptions;
94
- /**
95
- * 生成代码 参考 https://swc.rs/docs/configuring-swc#jsctarget
96
- */
97
- target?: JscTarget;
98
- /**
99
- * 注入兼容代码
100
- * module federation 入口 建议使用 entry
101
- * @default false
102
- */
103
- polyfill?: 'entry' | 'usage' | false;
104
- /**
105
- * 手动注入兼容代码,避免usage出现分析纰漏问题
106
- * @default ['es.object.values', 'es.object.entries', 'es.array.flat']
107
- */
108
- polyfillInclude?: string[];
109
- /**
110
- * 选择core-js的兼容版本有助于切换适当的代码体积
111
- * @default stable
112
- */
113
- coreJsFeatures?: 'full' | 'actual' | 'stable' | 'es';
114
- /**
115
- * @swc/helpers 外置
116
- * @default false
117
- */
118
- externalHelpers?: boolean;
119
- /**
120
- * 浏览器 兼容版本
121
- */
122
- browserslist?: string[];
123
- /**
124
- * swc 配置
125
- */
126
- swcConfig?: {
127
- transform?: {
128
- useDefineForClassFields?: boolean;
129
- };
130
- preserveAllComments?: boolean;
131
- };
132
- };
133
- export type JscTarget = 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022';
134
- export interface HtmlType extends HtmlRspackPluginOptions {
135
- /**
136
- * 基于项目的根目录 index.html url
137
- * @default src/index.html
138
- */
139
- template?: string;
140
- /**
141
- * 基于项目的根目录 favicon url
142
- * @default src/favicon.ico
143
- */
144
- favicon?: string;
145
- /**
146
- * 网站语言
147
- */
148
- lang?: string;
149
- /**
150
- * externals 文件插入到html
151
- */
152
- files?: {
153
- /**
154
- * 插入 css
155
- */
156
- css?: string[];
157
- /**
158
- * 插入 js
159
- */
160
- js?: string[];
161
- };
162
- /**
163
- * 自定义 头部脚步内容 headTags[] bodyTags[]
164
- */
165
- tags?: {
166
- headTags?: any[];
167
- bodyTags?: any[];
168
- };
169
- }
170
- export type EntriesType = {
171
- [entryFilename: string]: HtmlType;
172
- };
173
- export interface ModuleTransform {
174
- exclude?: RuleSetRule['exclude'][];
175
- include?: RuleSetRule['include'][];
176
- /**
177
- * 默认exclude /(node_modules|bower_components)/
178
- * @default false
179
- */
180
- defaultExclude?: boolean;
181
- }
182
- export type CssSassOptionsType = {
183
- api?: 'modern' | 'modern-compiler';
184
- sassOptions?: SassOptions<'async'>;
185
- mode?: 'default' | 'modern';
186
- implementation?: object | string;
187
- };
188
- export type EMPShareFastModeType = {
189
- /**
190
- * 共享库目录 优先读取 runtimeLib
191
- */
192
- runtimeHost?: string;
193
- /**
194
- * 共享库全路径
195
- */
196
- runtimeLib?: string;
197
- /**
198
- * 额外的库添加
199
- */
200
- externals?: any;
201
- /**
202
- * 当为 UMD时 暴露到 window 的全局变量
203
- */
204
- globalVal?: string;
205
- /**
206
- * 默认支持React
207
- */
208
- framework?: 'react';
209
- };
210
- export type EMPShareType = ModuleFederationPluginOptions & {
211
- /**
212
- * emp 基于库共享模块
213
- */
214
- shareLib?: EMPshareLibItemType;
215
- /**
216
- * TODO
217
- * 是否使用 importMap
218
- */
219
- useImportMap?: boolean;
220
- /**
221
- * 快速模式
222
- */
223
- fastMode?: EMPShareFastModeType;
224
- };
225
- export type EMPshareLibItemType = {
226
- [module: string]: {
227
- entry: string;
228
- global?: string;
229
- type?: 'js' | 'css';
230
- } | string | string[];
231
- };
232
- export type ExternalsItemType = {
233
- /**
234
- * 模块名
235
- * @example react-dom
236
- */
237
- module?: string;
238
- /**
239
- * 全局变量
240
- * @example ReactDom
241
- */
242
- global?: string;
243
- /**
244
- * 入口地址
245
- * 不填则可以通过 emp-config 里的 html.files.js[url] 传入合并后的请求
246
- * 如 http://...?react&react-dom&react-router&mobx
247
- * @example http://
248
- */
249
- entry?: string;
250
- /**
251
- * 类型入口
252
- * @default js
253
- * @enum js | css
254
- * @example css
255
- */
256
- type?: string;
257
- };
258
- export type RsTarget = RsConfig['target'];
259
- export type AutoPagesType = {
260
- /**
261
- * 基于src寻找入口目录
262
- * @default pages
263
- */
264
- path?: string;
265
- };
266
- export type EmpOptions = {
267
- /**
268
- * publicPath 根路径 可参考webpack,业务模式默认为 auto
269
- * html 部分 publicPath 默认为 undefined,可设置全量域名或子目录适配,也可以单独在html设置 Public
270
- *
271
- * @default undefined
272
- */
273
- base?: string;
274
- /**
275
- * 构建target
276
- */
277
- target?: RsConfig['target'];
278
- /**
279
- * 启动后 自动设置 base 为当前 Ip+port的路径如 base = http://127.0.0.1:8080/ 并且固定 ws 方便代理调试
280
- */
281
- autoDevBase?: boolean;
282
- /**
283
- * 启动后 进入自动搜寻入口的方式
284
- * 可以通过 html 或 entries 设置 模版配置
285
- */
286
- autoPages?: boolean | AutoPagesType;
287
- /**
288
- * 项目代码路径
289
- * @default 'src'
290
- */
291
- appSrc?: string;
292
- /**
293
- * 项目代码入口文件 如 `src/index.js`
294
- * (*)entries 设置后 该选项失效
295
- * @default 'index.js'
296
- */
297
- appEntry?: string;
298
- build?: BuildType;
299
- plugins?: EMP3PluginType[];
300
- html?: HtmlType;
301
- entries?: EntriesType;
302
- server?: ServerType;
303
- debug?: DebugType;
304
- chain?: (chain: Chain) => void;
305
- empShare?: EMPShareType;
306
- /**
307
- * css 相关设置
308
- */
309
- css?: {
310
- sass?: CssSassOptionsType;
311
- };
312
- /**
313
- * 模块编译
314
- * 如 node_modules 模块 是否加入编译
315
- */
316
- moduleTransform?: ModuleTransform;
317
- /**
318
- * 缓存目录
319
- * @default 'node_modules/.emp-cache'
320
- */
321
- cacheDir?: string;
322
- /**
323
- * 全局环境替换
324
- */
325
- define?: Record<string, any>;
326
- /**
327
- * 是否创建 cjs 的 process.env 或者 esm 的 import.meta.env
328
- * all 两者创建
329
- * esm 创建 import.meta.env
330
- * cjs 创建 process.env
331
- * none 不创建
332
- * @default cjs
333
- */
334
- defineFix?: 'all' | 'esm' | 'cjs' | 'none';
335
- /**
336
- * externals
337
- */
338
- externals?: Externals;
339
- /**
340
- * resolve
341
- */
342
- resolve?: Resolve;
343
- /**
344
- * output
345
- */
346
- output?: Output;
347
- /**
348
- * emp 执行周期
349
- */
350
- lifeCycle?: LifeCycleOptions;
351
- /**
352
- * ignoreWarnings
353
- * @default [/Conflicting order/]
354
- */
355
- ignoreWarnings?: RsConfig['ignoreWarnings'];
356
- };
@@ -1 +0,0 @@
1
- export type EMPModeType = 'development' | 'production';
@@ -1,6 +0,0 @@
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;