@empjs/cli 3.0.0-rc.9 → 3.0.1
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.
- package/client.d.ts +1 -4
- package/dist/index.cjs +18 -0
- package/dist/index.d.cts +691 -0
- package/dist/index.d.ts +691 -12
- package/dist/index.js +17 -15
- package/package.json +38 -30
- package/template/index.html +3 -0
- package/dist/helper/buildPrint.d.ts +0 -15
- package/dist/helper/getPort.d.ts +0 -6
- package/dist/helper/hmr/client.d.ts +0 -0
- package/dist/helper/hmr/config.d.ts +0 -0
- package/dist/helper/hmr/index.d.ts +0 -0
- package/dist/helper/hmr/overlay.d.ts +0 -0
- package/dist/helper/hmr/process-update.d.ts +0 -1
- package/dist/helper/ipAddress.d.ts +0 -27
- package/dist/helper/logger.d.ts +0 -21
- package/dist/helper/nodePolyfill.d.ts +0 -7
- package/dist/helper/openBrowser.d.ts +0 -2
- package/dist/helper/utils.d.ts +0 -15
- package/dist/script/base.d.ts +0 -26
- package/dist/script/build.d.ts +0 -6
- package/dist/script/bundle.d.ts +0 -6
- package/dist/script/dev.d.ts +0 -9
- package/dist/script/devServer.d.ts +0 -0
- package/dist/script/dts.d.ts +0 -27
- package/dist/script/httpBase.d.ts +0 -10
- package/dist/script/index.d.ts +0 -1
- package/dist/script/serve.d.ts +0 -9
- package/dist/store/cycle/autoDevBase.d.ts +0 -8
- package/dist/store/empConfig.d.ts +0 -64
- package/dist/store/empShare/fastMode.d.ts +0 -18
- package/dist/store/empShare/index.d.ts +0 -30
- package/dist/store/index.d.ts +0 -125
- package/dist/store/lifeCycle.d.ts +0 -18
- package/dist/store/rspack/common.d.ts +0 -12
- package/dist/store/rspack/css.d.ts +0 -10
- package/dist/store/rspack/entries.d.ts +0 -25
- package/dist/store/rspack/hook.d.ts +0 -24
- package/dist/store/rspack/index.d.ts +0 -7
- package/dist/store/rspack/module.d.ts +0 -20
- package/dist/store/rspack/plugin.d.ts +0 -13
- package/dist/types/config.d.ts +0 -338
- package/dist/types/env.d.ts +0 -1
- package/dist/types/plugin.d.ts +0 -6
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { GlobalStore } from '../store';
|
|
2
|
-
import type { BuildType, DebugType, EMPShareType, HtmlType, RsTarget, ServerType } from '../types/config';
|
|
3
|
-
import type { Output } from '@rspack/core';
|
|
4
|
-
import { EMPShareLib } from '../store/empShare';
|
|
5
|
-
import { EmpShareFastMode } from '../store/empShare/fastMode';
|
|
6
|
-
import { LifeCycle } from '../store/lifeCycle';
|
|
7
|
-
export declare class EmpConfig {
|
|
8
|
-
private store;
|
|
9
|
-
/**
|
|
10
|
-
* 项目代码路径
|
|
11
|
-
* @default 'src'
|
|
12
|
-
*/
|
|
13
|
-
appSrc: string;
|
|
14
|
-
/**
|
|
15
|
-
* 项目代码入口文件 如 `src/index.js`
|
|
16
|
-
* (*)entries 设置后 该选项失效
|
|
17
|
-
* @default 'index.js'
|
|
18
|
-
*/
|
|
19
|
-
appEntry: string;
|
|
20
|
-
/**
|
|
21
|
-
* publicPath 根路径 可参考webpack,业务模式默认为 auto
|
|
22
|
-
* html 部分 publicPath 默认为 undefined,可设置全量域名或子目录适配,也可以单独在html设置 Public
|
|
23
|
-
*
|
|
24
|
-
* @default undefined
|
|
25
|
-
*/
|
|
26
|
-
base: string;
|
|
27
|
-
target: RsTarget;
|
|
28
|
-
private assign;
|
|
29
|
-
empShareFastMode: EmpShareFastMode;
|
|
30
|
-
empShareLib: EMPShareLib;
|
|
31
|
-
/**
|
|
32
|
-
* 是否启动 esm 模块
|
|
33
|
-
* @default true
|
|
34
|
-
*/
|
|
35
|
-
isESM: boolean;
|
|
36
|
-
autoDevSet(): Promise<void>;
|
|
37
|
-
checkIsESM(target: string): boolean;
|
|
38
|
-
lifeCycle: LifeCycle;
|
|
39
|
-
setup(store: GlobalStore): Promise<void>;
|
|
40
|
-
chain(): Promise<void>;
|
|
41
|
-
plugins(): Promise<void>;
|
|
42
|
-
get debug(): DebugType;
|
|
43
|
-
get build(): Required<BuildType>;
|
|
44
|
-
get html(): HtmlType;
|
|
45
|
-
get entries(): import("../types/config").EntriesType;
|
|
46
|
-
get server(): ServerType;
|
|
47
|
-
get empShare(): EMPShareType;
|
|
48
|
-
get css(): {
|
|
49
|
-
postcss: never[];
|
|
50
|
-
};
|
|
51
|
-
get output(): Output;
|
|
52
|
-
get define(): {
|
|
53
|
-
[k: string]: string;
|
|
54
|
-
};
|
|
55
|
-
private setDefine;
|
|
56
|
-
get externals(): any;
|
|
57
|
-
get resolve(): import("@rspack/core").ResolveOptions;
|
|
58
|
-
syncEmpOptions(): Promise<void>;
|
|
59
|
-
get moduleTransformRule(): any;
|
|
60
|
-
get cacheDir(): string;
|
|
61
|
-
get ignoreWarnings(): (RegExp | ((args_0: Error, args_1: import("@rspack/core").Compilation, ...args_2: unknown[]) => boolean))[];
|
|
62
|
-
}
|
|
63
|
-
declare const _default: EmpConfig;
|
|
64
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { EMPShareFastModeType } from '../../types/config';
|
|
2
|
-
export declare class EmpShareFastMode {
|
|
3
|
-
fastMode: Required<EMPShareFastModeType>;
|
|
4
|
-
externalMF: {
|
|
5
|
-
'@module-federation/runtime': string;
|
|
6
|
-
'@module-federation/sdk': string;
|
|
7
|
-
};
|
|
8
|
-
externalReact: {
|
|
9
|
-
react: string;
|
|
10
|
-
'react-dom': string;
|
|
11
|
-
'react-router-dom': string;
|
|
12
|
-
};
|
|
13
|
-
externals: any;
|
|
14
|
-
getRuntimeLib(runtimeHost: string): string;
|
|
15
|
-
setup(): void;
|
|
16
|
-
injectLib(): void;
|
|
17
|
-
setExternals(): void;
|
|
18
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
|
|
2
|
-
import type { Configuration } from '@rspack/core';
|
|
3
|
-
import type { EMPShareType } from '../../types/config';
|
|
4
|
-
export type externalAssetsType = {
|
|
5
|
-
js: string[];
|
|
6
|
-
css: string[];
|
|
7
|
-
};
|
|
8
|
-
export type ModuleFederationPluginOptions = ConstructorParameters<typeof ModuleFederationPlugin>[0];
|
|
9
|
-
export type ImportMapType = {
|
|
10
|
-
imports: {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export declare class EMPShareLib {
|
|
15
|
-
externals: Configuration['externals'] | any;
|
|
16
|
-
externalAssets: externalAssetsType;
|
|
17
|
-
private exp;
|
|
18
|
-
config: EMPShareType;
|
|
19
|
-
importMap: ImportMapType;
|
|
20
|
-
isEmpshare: boolean;
|
|
21
|
-
setup(): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* 是否取用 importMap
|
|
24
|
-
*/
|
|
25
|
-
get useImportMap(): boolean | undefined;
|
|
26
|
-
get pluginConfig(): ModuleFederationPluginOptions;
|
|
27
|
-
prepareEsm(): void;
|
|
28
|
-
setShareLib(): Promise<void>;
|
|
29
|
-
private setExternalAssets;
|
|
30
|
-
}
|
package/dist/store/index.d.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import type { Configuration as RsConfig, RspackOptions } from '@rspack/core';
|
|
2
|
-
import { deepAssign } from '../helper/utils';
|
|
3
|
-
import { type EmpConfig } from '../store/empConfig';
|
|
4
|
-
import type { EmpOptions } from '../types/config';
|
|
5
|
-
import type { EMPModeType } from '../types/env';
|
|
6
|
-
import WPChain from 'webpack-chain';
|
|
7
|
-
export declare class GlobalStore {
|
|
8
|
-
/**
|
|
9
|
-
* EMP Version
|
|
10
|
-
* @default package version
|
|
11
|
-
*/
|
|
12
|
-
empPkg: any;
|
|
13
|
-
/**
|
|
14
|
-
* 项目pkg信息
|
|
15
|
-
*/
|
|
16
|
-
pkg: any;
|
|
17
|
-
/**
|
|
18
|
-
* 项目根目录绝对路径
|
|
19
|
-
* @default process.cwd()
|
|
20
|
-
*/
|
|
21
|
-
root: string;
|
|
22
|
-
/**
|
|
23
|
-
* emp 内部根路径
|
|
24
|
-
* @default path.resolve(__dirname, '../../')
|
|
25
|
-
*/
|
|
26
|
-
empRoot: string;
|
|
27
|
-
/**
|
|
28
|
-
* emp 执行代码路径
|
|
29
|
-
*/
|
|
30
|
-
empSource: string;
|
|
31
|
-
/**
|
|
32
|
-
* 获取项目 根目录绝对路径
|
|
33
|
-
* (*) relativePath 可以是绝对路径
|
|
34
|
-
* @param relativePath
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
resolve: (relativePath: string) => string;
|
|
38
|
-
/**
|
|
39
|
-
* 获取项目 emp内部根目录绝对路径
|
|
40
|
-
* @param relativePath
|
|
41
|
-
* @returns
|
|
42
|
-
*/
|
|
43
|
-
empResolve: (relativePath: string) => string;
|
|
44
|
-
/**
|
|
45
|
-
* 源码地址 绝对路径
|
|
46
|
-
*/
|
|
47
|
-
appSrc: string;
|
|
48
|
-
/**
|
|
49
|
-
* 源码生成目录 绝对路径
|
|
50
|
-
*/
|
|
51
|
-
outDir: string;
|
|
52
|
-
/**
|
|
53
|
-
* 静态文件目录 绝对路径
|
|
54
|
-
*/
|
|
55
|
-
publicDir: string;
|
|
56
|
-
/**
|
|
57
|
-
* 静态资源
|
|
58
|
-
*/
|
|
59
|
-
resource: {
|
|
60
|
-
dir: string;
|
|
61
|
-
key: string;
|
|
62
|
-
cert: string;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* 缓存目录 绝对路径
|
|
66
|
-
*/
|
|
67
|
-
cacheDir: string;
|
|
68
|
-
mode: EMPModeType;
|
|
69
|
-
cliMode: 'dev' | 'prod';
|
|
70
|
-
isDev: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* 项目配置
|
|
73
|
-
*/
|
|
74
|
-
cliOptions: any;
|
|
75
|
-
chain: WPChain;
|
|
76
|
-
rsConfig: RsConfig;
|
|
77
|
-
empOptions: EmpOptions;
|
|
78
|
-
empConfig: EmpConfig;
|
|
79
|
-
vCompare: (preVersion?: string, lastVersion?: string) => number;
|
|
80
|
-
deepAssign: typeof deepAssign;
|
|
81
|
-
getLanIp: () => string;
|
|
82
|
-
entries: {
|
|
83
|
-
[chunkName: string]: RspackOptions['entry'];
|
|
84
|
-
};
|
|
85
|
-
debug: EmpConfig['debug'];
|
|
86
|
-
setup(mode: string, cliOptions: any): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* 初始化 基础变量
|
|
89
|
-
* @param mode cli名称
|
|
90
|
-
* @param cliOptions cli配置
|
|
91
|
-
*/
|
|
92
|
-
initVars(mode: string, cliOptions: any): Promise<void>;
|
|
93
|
-
/**
|
|
94
|
-
* 初始化 基础路径
|
|
95
|
-
*/
|
|
96
|
-
initPaths(): void;
|
|
97
|
-
/**
|
|
98
|
-
* 设置 日志等级
|
|
99
|
-
*/
|
|
100
|
-
setLogger(): void;
|
|
101
|
-
merge(o: RspackOptions): void;
|
|
102
|
-
importResolve(scope: string, importMetaUrl?: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* windows import() 情况下 ES 的物理路径转换
|
|
105
|
-
* pathToFileURL 是为了解决在window下,import文件路径解析异常
|
|
106
|
-
* @param scope
|
|
107
|
-
* @returns
|
|
108
|
-
*/
|
|
109
|
-
importFileUrl(scope: string): string;
|
|
110
|
-
/**
|
|
111
|
-
* 同步 chain 配置到 rsConfig
|
|
112
|
-
*/
|
|
113
|
-
toConfig(): void;
|
|
114
|
-
/**
|
|
115
|
-
* 打印 config
|
|
116
|
-
*/
|
|
117
|
-
logConfig(): void;
|
|
118
|
-
get browserslistOptions(): {
|
|
119
|
-
default: string[];
|
|
120
|
-
h5: string[];
|
|
121
|
-
node: string[];
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
declare const _default: GlobalStore;
|
|
125
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type LifeCycleType = Partial<LifeCycle>;
|
|
2
|
-
export declare class LifeCycle {
|
|
3
|
-
op: LifeCycleType;
|
|
4
|
-
constructor(op?: LifeCycleType);
|
|
5
|
-
afterGetEmpOptions(): Promise<void>;
|
|
6
|
-
beforePlugin(): Promise<void>;
|
|
7
|
-
afterPlugin(): Promise<void>;
|
|
8
|
-
beforeModule(): Promise<void>;
|
|
9
|
-
afterModule(): Promise<void>;
|
|
10
|
-
beforeEmpPlugin(): Promise<void>;
|
|
11
|
-
afterEmpPlugin(): Promise<void>;
|
|
12
|
-
beforeBuild(): Promise<void>;
|
|
13
|
-
afterBulid(): Promise<void>;
|
|
14
|
-
beforeDevServe(): Promise<void>;
|
|
15
|
-
afterDevServe(): Promise<void>;
|
|
16
|
-
beforeServe(): Promise<void>;
|
|
17
|
-
afterServe(): Promise<void>;
|
|
18
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { GlobalStore } from '../../store';
|
|
2
|
-
declare class RspackCommon {
|
|
3
|
-
store: GlobalStore;
|
|
4
|
-
setup(store: GlobalStore): Promise<void>;
|
|
5
|
-
common(): Promise<void>;
|
|
6
|
-
checkTsconfig(): Promise<void>;
|
|
7
|
-
stats(): Promise<void>;
|
|
8
|
-
devServer(): Promise<void>;
|
|
9
|
-
optimization(): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
declare const _default: RspackCommon;
|
|
12
|
-
export default _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { GlobalStore } from '../../store';
|
|
2
|
-
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;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { RspackOptions } from '@rspack/core';
|
|
2
|
-
import type { GlobalStore } from '../../store';
|
|
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 setChunk;
|
|
16
|
-
private setTemplate;
|
|
17
|
-
private setFavicion;
|
|
18
|
-
private setEntryItem;
|
|
19
|
-
setRspackHtmlPlugin(config: EmpConfig['html'], chunk: string): void;
|
|
20
|
-
setRspackEntry(entry: RspackOptions['entry']): void;
|
|
21
|
-
init(): Promise<void>;
|
|
22
|
-
toConfig(): void;
|
|
23
|
-
}
|
|
24
|
-
declare const _default: RspackEntries;
|
|
25
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from '@rspack/core';
|
|
2
|
-
import type { EMPShareLib } from '../../store/empShare';
|
|
3
|
-
import type { HtmlType } from '../../types/config';
|
|
4
|
-
export declare const HtmlImportMapPluginName = "HtmlImportMapPlugin";
|
|
5
|
-
export declare class HtmlImportMapPlugin {
|
|
6
|
-
importMap: EMPShareLib['importMap'];
|
|
7
|
-
chunk: string;
|
|
8
|
-
constructor(importMap: EMPShareLib['importMap'], chunk: string);
|
|
9
|
-
apply(compiler: any): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const HtmlEmpShareLibPluginName = "HtmlEmpShareLibPlugin";
|
|
12
|
-
export declare class HtmlEmpShareLibPlugin {
|
|
13
|
-
chunk: string;
|
|
14
|
-
files: {
|
|
15
|
-
css: string[];
|
|
16
|
-
js: string[];
|
|
17
|
-
};
|
|
18
|
-
constructor(files: HtmlType['files'], chunk: string);
|
|
19
|
-
apply(compiler: any): void;
|
|
20
|
-
}
|
|
21
|
-
export declare class EmpPolyfillPlugin {
|
|
22
|
-
constructor();
|
|
23
|
-
apply(compiler: Compiler): void;
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { GlobalStore } from '../../store';
|
|
2
|
-
declare class RspackModule {
|
|
3
|
-
store: GlobalStore;
|
|
4
|
-
private swcJsOptions;
|
|
5
|
-
private swcTsOptions;
|
|
6
|
-
private coreJs;
|
|
7
|
-
setup(store: GlobalStore): Promise<void>;
|
|
8
|
-
private rspackGenerator;
|
|
9
|
-
private rspackParser;
|
|
10
|
-
private get isPolyfill();
|
|
11
|
-
private swcParser;
|
|
12
|
-
private swcJsc;
|
|
13
|
-
private get swcCoreVersion();
|
|
14
|
-
private swcOptions;
|
|
15
|
-
swcInitOptions(): void;
|
|
16
|
-
scripts(): Promise<void>;
|
|
17
|
-
files(): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
declare const _default: RspackModule;
|
|
20
|
-
export default _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { GlobalStore } from '../../store';
|
|
2
|
-
declare class RspackPlugin {
|
|
3
|
-
store: GlobalStore;
|
|
4
|
-
setup(store: GlobalStore): Promise<void>;
|
|
5
|
-
anylayze(): Promise<void>;
|
|
6
|
-
define(): Promise<void>;
|
|
7
|
-
copy(): Promise<void>;
|
|
8
|
-
progress(): Promise<void>;
|
|
9
|
-
empShare(): Promise<void>;
|
|
10
|
-
minify(): void;
|
|
11
|
-
}
|
|
12
|
-
declare const _default: RspackPlugin;
|
|
13
|
-
export default _default;
|