-
Notifications
You must be signed in to change notification settings - Fork 223
/
emp-config.d.ts
71 lines (71 loc) · 2.83 KB
/
emp-config.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import {Configuration, container} from 'webpack/types'
// import {WebpackDevServerI} from './webpack-dev-server'
import * as webpackChain from 'webpack-chain/types'
type MFOptions = ConstructorParameters<typeof container.ModuleFederationPlugin>[0]
type GeneratorOptType = Partial<Configuration>['module']['generator']
interface EmpConfigIBase {
/** webpack */
// webpack: webpack
/** webpack config */
// webpackConfig: WebpackOptionsNormalized
/** webpack chain */
webpackChain: webpackChain
/** emp dev|start --env : env===empEnv */
empEnv: string
/** webpack build env */
webpackEnv: 'development' | 'production'
}
/**
'-s, --src <src>', '目标文件 默认为 src/index.ts
'-pc, --public <public>', '目标 默认为 public/
'-e, --env <env>', '部署环境 dev、test、prod 默认为 dev
'-h, --hot', '是否使用热更新 默认不启动
'-o, --open <open>', '是否打开调试页面 默认true,false禁止自动打开
'-t, --ts', '生成类型文件 默认为 false
'-ps, --progress', '显示进度 默认为 true
'-wl, --wplogger [filename]', '打印webpack配置 默认为 false,filename 为 输出webpack配置文件
'-rm, --remote', '在执行命令时拉取远程声明文件,远程地址首选package.json里的remoteBaseUrlList
'-d, --dist <dist>', '目标 默认为 dist/
'-dc, --doc <doc>', '目标 默认为 doc/
'-a, --analyze', '生成分析报告 默认为 false
'-n, --createName <createName>', '文件名 默认为 index.d.ts [* 使用默认值方便同步]
'-p, --createPath <createPath>', '相对命令行目录 默认为 dist
*/
interface EmpConfigI {
open?: boolean
progress?: boolean
src?: string
public?: string
hot?: boolean
ts?: boolean
wplogger?: boolean | string
remote?: string
dist?: string
doc?: string
analyze?: boolean
createName?: string
createPath?: string
}
type WebpackConfigI = Configuration
type ModuleFederationFuncType = (o: EmpConfigI & EmpConfigIBase) => MFOptions | Promise<MFOptions>
type ModuleFederationType = MFOptions | ModuleFederationFuncType
//
type ModuleGeneratorFuncType = (o: EmpConfigI & EmpConfigIBase) => string | GeneratorOptType | Promise<GeneratorOptType>
type ModuleGeneratorType = string | GeneratorOptType | ModuleGeneratorFuncType
//
declare interface EMPConfig {
/** webpack & webpack chain config method */
webpack?: (o: EmpConfigI & EmpConfigIBase) => WebpackConfigI | Promise<WebpackConfigI>
webpackChain?: (config: webpackChain, o: EmpConfigI) => void | Promise<any>
/** compile replace babel use swc or esbuild */
compile?: Array<any>
/** react vue svetle and more */
framework?: Array<any>
/** module federation config */
moduleFederation?: ModuleFederationType
/**
* global assets path
* when output.publicPath=auto & use module federation,need setting this option
*/
moduleGenerator?: ModuleGeneratorType
}