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