@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,7 +0,0 @@
1
- /// <reference types="node" />
2
- export declare const __filename: string;
3
- export declare const __dirname: string;
4
- export declare const getFileJson: (url: string) => Promise<any>;
5
- export declare const require: NodeRequire;
6
- export declare const importResolve: (scope: string, importMetaUrl?: string) => string;
7
- export declare const empRoot: string;
@@ -1,2 +0,0 @@
1
- export declare const openBrowser: (url: string) => Promise<boolean>;
2
- export default openBrowser;
@@ -1,15 +0,0 @@
1
- export declare const getLanIp: () => string;
2
- export declare const getPkgVersion: (pkgPath: string) => any;
3
- export declare function clearConsole(): void;
4
- export declare function deepAssign<T>(target: any, ...sources: any): T;
5
- export declare const ensureArray: <T>(params: T | T[]) => T[];
6
- /**
7
- * json Filter
8
- * @param d
9
- * @param keys
10
- * @returns
11
- */
12
- export declare const jsonFilter: (d?: any, notIncludeKeys?: string[]) => any;
13
- export declare const vCompare: (preVersion?: string, lastVersion?: string) => number;
14
- export declare const timeFormat: (seconds: number) => string;
15
- export declare const importJsVm: (content: string) => string;
@@ -1,26 +0,0 @@
1
- /// <reference types="node" />
2
- export declare class BaseScript {
3
- sf: {
4
- protocol: string;
5
- host: string;
6
- port: number;
7
- publicPath: string;
8
- publicHasHttp: boolean;
9
- isOpenBrower: boolean;
10
- url: string;
11
- urls: {
12
- localUrlForBrowser: string;
13
- localUrlForTerminal: string;
14
- lanUrlForTerminal: string;
15
- lanUrlForConfig: string;
16
- };
17
- };
18
- adaptServer(): Promise<void>;
19
- startOpen(): void;
20
- setup(cliName: string, o: any): Promise<void>;
21
- run(): Promise<void>;
22
- afterRun(): void;
23
- get isHttps(): boolean;
24
- getcert(): Promise<[Buffer, Buffer]>;
25
- serverPort(): Promise<void>;
26
- }
@@ -1,6 +0,0 @@
1
- import { BaseScript } from '../script/base';
2
- declare class BuildScript extends BaseScript {
3
- run(): Promise<void>;
4
- }
5
- declare const _default: BuildScript;
6
- export default _default;
@@ -1,6 +0,0 @@
1
- import { BaseScript } from './base';
2
- declare class RsBundler extends BaseScript {
3
- run(): Promise<void>;
4
- }
5
- declare const _default: RsBundler;
6
- export default _default;
@@ -1,9 +0,0 @@
1
- import { RspackOptions } from '@rspack/core';
2
- import { BaseScript } from '../script/base';
3
- declare class DevScript extends BaseScript {
4
- get rspackDevConfig(): RspackOptions;
5
- devServerConfig(): Promise<import("@rspack/core").DevServer>;
6
- run(): Promise<void>;
7
- }
8
- declare const _default: DevScript;
9
- export default _default;
File without changes
@@ -1,27 +0,0 @@
1
- declare class DTSBundle {
2
- list: string[];
3
- outDir: string;
4
- aliasName: string;
5
- setup(outDir: string, aliasName: string): Promise<void>;
6
- readDts(): Promise<any[]>;
7
- readFile(src: string): Promise<{
8
- src: string;
9
- code: string;
10
- }>;
11
- replaceAliasPath({ src, code }: {
12
- src: string;
13
- code: string;
14
- }): {
15
- code: string;
16
- src: string;
17
- mod: string;
18
- };
19
- warpDeclareModule(mod: string, code: string): string;
20
- writeCode(bs: {
21
- src: string;
22
- code: string;
23
- mod: string;
24
- }[]): Promise<void>;
25
- }
26
- declare const _default: DTSBundle;
27
- export default _default;
@@ -1,10 +0,0 @@
1
- import { Express } from 'express';
2
- import { BaseScript } from '../script/base';
3
- export declare class HttpServer extends BaseScript {
4
- app: Express;
5
- init(): Promise<void>;
6
- server(): Promise<void>;
7
- onReady(): Promise<void>;
8
- middleware(): Promise<void>;
9
- start(): Promise<void>;
10
- }
@@ -1 +0,0 @@
1
- export default function runScript(): void;
@@ -1,9 +0,0 @@
1
- import { HttpServer } from './httpBase';
2
- declare class ServeScript extends HttpServer {
3
- timing: number;
4
- run(): Promise<void>;
5
- middleware(): Promise<void>;
6
- onReady(): Promise<void>;
7
- }
8
- declare const _default: ServeScript;
9
- export default _default;
@@ -1,8 +0,0 @@
1
- declare class AutoDevBase {
2
- isADB: boolean;
3
- isHttps: boolean;
4
- get isHttpBase(): boolean;
5
- setup(): void;
6
- }
7
- declare const _default: AutoDevBase;
8
- export default _default;
@@ -1,61 +0,0 @@
1
- import { GlobalStore } from '../store';
2
- import { BuildType, DebugType, EMPShareType, HtmlType, RsTarget, ServerType } from '../types/config';
3
- import { Output } from '@rspack/core';
4
- import { EMPShareLib } from '../store/empShareLib';
5
- import { LifeCycle } from '../store/lifeCycle';
6
- export declare class EmpConfig {
7
- private store;
8
- /**
9
- * 项目代码路径
10
- * @default 'src'
11
- */
12
- appSrc: string;
13
- /**
14
- * 项目代码入口文件 如 `src/index.js`
15
- * (*)entries 设置后 该选项失效
16
- * @default 'index.js'
17
- */
18
- appEntry: string;
19
- /**
20
- * publicPath 根路径 可参考webpack,业务模式默认为 auto
21
- * html 部分 publicPath 默认为 undefined,可设置全量域名或子目录适配,也可以单独在html设置 Public
22
- *
23
- * @default undefined
24
- */
25
- base: string;
26
- target: RsTarget;
27
- private assign;
28
- empShareLib: EMPShareLib;
29
- /**
30
- * 是否启动 esm 模块
31
- * @default true
32
- */
33
- isESM: boolean;
34
- autoDevSet(): Promise<void>;
35
- checkIsESM(target: string): boolean;
36
- lifeCycle: LifeCycle;
37
- setup(store: GlobalStore): Promise<void>;
38
- chain(): Promise<void>;
39
- plugins(): Promise<void>;
40
- get debug(): DebugType;
41
- get build(): Required<BuildType>;
42
- get html(): HtmlType;
43
- get entries(): import("../types/config").EntriesType;
44
- get server(): ServerType;
45
- get empShare(): EMPShareType;
46
- get css(): {
47
- postcss: never[];
48
- };
49
- get output(): Output;
50
- get define(): {
51
- [k: string]: string;
52
- };
53
- private setDefine;
54
- get externals(): any;
55
- get resolve(): import("@rspack/core").ResolveOptions;
56
- syncEmpOptions(): Promise<void>;
57
- get moduleTransformRule(): any;
58
- get cacheDir(): string;
59
- }
60
- declare const _default: EmpConfig;
61
- export default _default;
@@ -1,31 +0,0 @@
1
- import { Configuration } from '@rspack/core';
2
- import type { EMPShareType } from '../types/config';
3
- import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
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
- version: EMPShareType['mfVersion'];
21
- isEmpshare: boolean;
22
- setup(): Promise<void>;
23
- /**
24
- * 是否取用 importMap
25
- */
26
- get useImportMap(): boolean | undefined;
27
- get pluginConfig(): ModuleFederationPluginOptions;
28
- prepareEsm(): void;
29
- setShareLib(): Promise<void>;
30
- private setExternalAssets;
31
- }
@@ -1,121 +0,0 @@
1
- import { EMPModeType } from '../types/env';
2
- import WPChain from 'webpack-chain';
3
- import type { Configuration as RsConfig, RspackOptions } from '@rspack/core';
4
- import type { EmpOptions } from '../types/config';
5
- import { EmpConfig } from '../store/empConfig';
6
- import { deepAssign } from '../helper/utils';
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
- setup(mode: string, cliOptions: any): Promise<void>;
83
- /**
84
- * 初始化 基础变量
85
- * @param mode cli名称
86
- * @param cliOptions cli配置
87
- */
88
- initVars(mode: string, cliOptions: any): Promise<void>;
89
- /**
90
- * 初始化 基础路径
91
- */
92
- initPaths(): void;
93
- /**
94
- * 设置 日志等级
95
- */
96
- setLogger(): void;
97
- merge(o: RspackOptions): void;
98
- importResolve(scope: string, importMetaUrl?: string): string;
99
- /**
100
- * windows import() 情况下 ES 的物理路径转换
101
- * pathToFileURL 是为了解决在window下,import文件路径解析异常
102
- * @param scope
103
- * @returns
104
- */
105
- importFileUrl(scope: string): string;
106
- /**
107
- * 同步 chain 配置到 rsConfig
108
- */
109
- toConfig(): void;
110
- /**
111
- * 打印 config
112
- */
113
- logConfig(): void;
114
- get browserslistOptions(): {
115
- default: string[];
116
- h5: string[];
117
- node: string[];
118
- };
119
- }
120
- declare const _default: GlobalStore;
121
- export default _default;
@@ -1,14 +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
- beforeBuild(): Promise<void>;
9
- afterBulid(): Promise<void>;
10
- beforeDevServe(): Promise<void>;
11
- afterDevServe(): Promise<void>;
12
- beforeServe(): Promise<void>;
13
- afterServe(): Promise<void>;
14
- }
@@ -1,11 +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
- stats(): Promise<void>;
7
- devServer(): Promise<void>;
8
- optimization(): Promise<void>;
9
- }
10
- declare const _default: RspackCommon;
11
- 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 { GlobalStore } from '../../store';
2
- import { EmpConfig } from '../empConfig';
3
- import { RspackOptions } from '@rspack/core';
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 { HtmlType } from '../../types/config';
2
- import { EMPShareLib } from '../empShareLib';
3
- import { type Compiler } from '@rspack/core';
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,7 +0,0 @@
1
- import type { GlobalStore } from '../../store';
2
- export declare class RspackStore {
3
- store: GlobalStore;
4
- setup(store: GlobalStore): Promise<void>;
5
- }
6
- declare const _default: RspackStore;
7
- export default _default;
@@ -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;