@empjs/cli 3.0.0-rc.3 → 3.0.0-rc.31

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 (48) hide show
  1. package/client.d.ts +1 -4
  2. package/dist/index.cjs +18 -0
  3. package/dist/index.d.cts +683 -0
  4. package/dist/index.d.ts +683 -12
  5. package/dist/index.js +17 -15
  6. package/emp-tsconfig.json +4 -13
  7. package/package.json +100 -110
  8. package/template/favicon-128.ico +0 -0
  9. package/template/favicon-256.ico +0 -0
  10. package/template/favicon-64.ico +0 -0
  11. package/template/favicon.ico +0 -0
  12. package/template/index.html +3 -0
  13. package/dist/helper/buildPrint.d.ts +0 -15
  14. package/dist/helper/getPort.d.ts +0 -6
  15. package/dist/helper/hmr/client.d.ts +0 -0
  16. package/dist/helper/hmr/config.d.ts +0 -0
  17. package/dist/helper/hmr/index.d.ts +0 -0
  18. package/dist/helper/hmr/overlay.d.ts +0 -0
  19. package/dist/helper/hmr/process-update.d.ts +0 -1
  20. package/dist/helper/ipAddress.d.ts +0 -27
  21. package/dist/helper/logger.d.ts +0 -21
  22. package/dist/helper/nodePolyfill.d.ts +0 -7
  23. package/dist/helper/openBrowser.d.ts +0 -2
  24. package/dist/helper/utils.d.ts +0 -15
  25. package/dist/script/base.d.ts +0 -26
  26. package/dist/script/build.d.ts +0 -6
  27. package/dist/script/bundle.d.ts +0 -6
  28. package/dist/script/dev.d.ts +0 -9
  29. package/dist/script/devServer.d.ts +0 -0
  30. package/dist/script/dts.d.ts +0 -27
  31. package/dist/script/httpBase.d.ts +0 -10
  32. package/dist/script/index.d.ts +0 -1
  33. package/dist/script/serve.d.ts +0 -9
  34. package/dist/store/cycle/autoDevBase.d.ts +0 -8
  35. package/dist/store/empConfig.d.ts +0 -61
  36. package/dist/store/empShareLib.d.ts +0 -31
  37. package/dist/store/index.d.ts +0 -121
  38. package/dist/store/lifeCycle.d.ts +0 -14
  39. package/dist/store/rspack/common.d.ts +0 -11
  40. package/dist/store/rspack/css.d.ts +0 -10
  41. package/dist/store/rspack/entries.d.ts +0 -25
  42. package/dist/store/rspack/hook.d.ts +0 -24
  43. package/dist/store/rspack/index.d.ts +0 -7
  44. package/dist/store/rspack/module.d.ts +0 -20
  45. package/dist/store/rspack/plugin.d.ts +0 -13
  46. package/dist/types/config.d.ts +0 -307
  47. package/dist/types/env.d.ts +0 -1
  48. package/dist/types/plugin.d.ts +0 -6
@@ -1,307 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Configuration as RsConfig } from '@rspack/core';
3
- import { Configuration as devServerConfig } from '@rspack/dev-server';
4
- import Chain from 'webpack-chain';
5
- import { Externals, HtmlRspackPluginOptions, Output, Resolve, RuleSetRule, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
6
- import { EMP3PluginType } from './plugin';
7
- import { InspectOptions } from 'node:util';
8
- import type { LifeCycle } from '../store/lifeCycle';
9
- import type { ModuleFederationPluginOptions } from '../store/empShareLib';
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
- * 选择core-js的兼容版本有助于切换适当的代码体积
105
- * @default stable
106
- */
107
- coreJsFeatures?: 'full' | 'actual' | 'stable' | 'es';
108
- /**
109
- * @swc/helpers 外置
110
- * @default false
111
- */
112
- externalHelpers: boolean;
113
- /**
114
- * 浏览器 兼容版本
115
- */
116
- browserslist: string[];
117
- /**
118
- * swc 配置
119
- */
120
- swcConfig: {
121
- transform?: {
122
- useDefineForClassFields?: boolean;
123
- };
124
- preserveAllComments?: boolean;
125
- };
126
- };
127
- export type JscTarget = 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022';
128
- export interface HtmlType extends HtmlRspackPluginOptions {
129
- /**
130
- * 基于项目的根目录 index.html url
131
- * @default src/index.html
132
- */
133
- template?: string;
134
- /**
135
- * 基于项目的根目录 favicon url
136
- * @default src/favicon.ico
137
- */
138
- favicon?: string;
139
- /**
140
- * 网站语言
141
- */
142
- lang?: string;
143
- /**
144
- * externals 文件插入到html
145
- */
146
- files?: {
147
- /**
148
- * 插入 css
149
- */
150
- css?: string[];
151
- /**
152
- * 插入 js
153
- */
154
- js?: string[];
155
- };
156
- /**
157
- * 自定义 头部脚步内容 headTags[] bodyTags[]
158
- */
159
- tags?: {
160
- headTags?: any[];
161
- bodyTags?: any[];
162
- };
163
- }
164
- export type EntriesType = {
165
- [entryFilename: string]: HtmlType;
166
- };
167
- export type CSSOptions = {
168
- postcss?: [string, any][];
169
- };
170
- export interface ModuleTransform {
171
- exclude?: RuleSetRule['exclude'][];
172
- include?: RuleSetRule['include'][];
173
- /**
174
- * 默认exclude /(node_modules|bower_components)/
175
- * @default false
176
- */
177
- defaultExclude?: boolean;
178
- }
179
- export type EMPShareType = ModuleFederationPluginOptions & {
180
- /**
181
- * emp 基于库共享模块
182
- */
183
- shareLib?: EMPshareLibItemType;
184
- /**
185
- * TODO
186
- * 是否使用 importMap
187
- */
188
- useImportMap?: boolean;
189
- /**
190
- * module federation 版本
191
- * @default 1
192
- */
193
- mfVersion?: 1 | 1.5;
194
- };
195
- export type EMPshareLibItemType = {
196
- [module: string]: {
197
- entry: string;
198
- global?: string;
199
- type?: 'js' | 'css';
200
- } | string | string[];
201
- };
202
- export type ExternalsItemType = {
203
- /**
204
- * 模块名
205
- * @example react-dom
206
- */
207
- module?: string;
208
- /**
209
- * 全局变量
210
- * @example ReactDom
211
- */
212
- global?: string;
213
- /**
214
- * 入口地址
215
- * 不填则可以通过 emp-config 里的 html.files.js[url] 传入合并后的请求
216
- * 如 http://...?react&react-dom&react-router&mobx
217
- * @example http://
218
- */
219
- entry?: string;
220
- /**
221
- * 类型入口
222
- * @default js
223
- * @enum js | css
224
- * @example css
225
- */
226
- type?: string;
227
- };
228
- export type RsTarget = RsConfig['target'];
229
- export type EmpOptions = {
230
- /**
231
- * publicPath 根路径 可参考webpack,业务模式默认为 auto
232
- * html 部分 publicPath 默认为 undefined,可设置全量域名或子目录适配,也可以单独在html设置 Public
233
- *
234
- * @default undefined
235
- */
236
- base?: string;
237
- /**
238
- * 构建target
239
- */
240
- target?: RsConfig['target'];
241
- /**
242
- * 启动后 自动设置 base 为当前 Ip+port的路径如 base = http://127.0.0.1:8080/ 并且固定 ws 方便代理调试
243
- */
244
- autoDevBase?: boolean;
245
- /**
246
- * 项目代码路径
247
- * @default 'src'
248
- */
249
- appSrc?: string;
250
- /**
251
- * 项目代码入口文件 如 `src/index.js`
252
- * (*)entries 设置后 该选项失效
253
- * @default 'index.js'
254
- */
255
- appEntry?: string;
256
- build?: BuildType;
257
- plugins?: EMP3PluginType[];
258
- html?: HtmlType;
259
- entries?: EntriesType;
260
- server?: ServerType;
261
- debug?: DebugType;
262
- chain?: (chain: Chain) => void;
263
- empShare?: EMPShareType;
264
- /**
265
- * css 相关设置
266
- */
267
- css?: CSSOptions;
268
- /**
269
- * 模块编译
270
- * 如 node_modules 模块 是否加入编译
271
- */
272
- moduleTransform?: ModuleTransform;
273
- /**
274
- * 缓存目录
275
- * @default 'node_modules/.emp-cache'
276
- */
277
- cacheDir?: string;
278
- /**
279
- * 全局环境替换
280
- */
281
- define?: Record<string, any>;
282
- /**
283
- * 是否创建 cjs 的 process.env 或者 esm 的 import.meta.env
284
- * all 两者创建
285
- * esm 创建 import.meta.env
286
- * cjs 创建 process.env
287
- * none 不创建
288
- * @default cjs
289
- */
290
- defineFix?: 'all' | 'esm' | 'cjs' | 'none';
291
- /**
292
- * externals
293
- */
294
- externals?: Externals;
295
- /**
296
- * resolve
297
- */
298
- resolve?: Resolve;
299
- /**
300
- * output
301
- */
302
- output?: Output;
303
- /**
304
- * emp 执行周期
305
- */
306
- lifeCycle?: LifeCycle;
307
- };
@@ -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;