@doracli/type 0.0.3 → 0.0.5
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/README.md +4 -0
- package/package.json +3 -3
- package/src/dora-config-common.ts +31 -4
- package/src/dora-config-multiple.ts +18 -0
- package/src/dora-config-service.ts +12 -1
- package/src/dora-config-webpack.ts +2 -8
- package/src/dora-config.ts +3 -2
- package/src/env-params.ts +4 -0
- package/src/index.ts +3 -0
- package/src/module-type.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doracli/type",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "package by webpack",
|
|
5
5
|
"author": "cclr <18843152354@163.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"test": "vitest",
|
|
22
22
|
"g:test": "vitest run",
|
|
23
|
-
"build": "
|
|
23
|
+
"build": "drr build"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "ac4c6829b2cec621ecf66b6324843773e8b5141f"
|
|
26
26
|
}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import type { TAny, TPlainObject } from './common';
|
|
1
2
|
import type { TModule } from './module-type';
|
|
2
3
|
|
|
3
4
|
export type TMode = 'development' | 'production';
|
|
4
5
|
|
|
6
|
+
/** 配置类型 */
|
|
7
|
+
export type TConfigType = 'library' | 'application' | 'plugin';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 模块配置
|
|
11
|
+
* - 模块格式
|
|
12
|
+
* - 模块的一些其他配置
|
|
13
|
+
*/
|
|
14
|
+
export type TLib = {
|
|
15
|
+
format: TModule;
|
|
16
|
+
[key: string]: TAny;
|
|
17
|
+
};
|
|
18
|
+
|
|
5
19
|
export type TOutput = {
|
|
6
20
|
/** 出口文件地址 */
|
|
7
21
|
file?: string;
|
|
@@ -18,14 +32,27 @@ export type TOutput = {
|
|
|
18
32
|
* @description 路径只要是 ‘/’ 开头都按绝对路径解析,否则按执行目录进行相对路径解析
|
|
19
33
|
*/
|
|
20
34
|
export type TDoraConfigCommon = {
|
|
35
|
+
/**
|
|
36
|
+
* 模块名称
|
|
37
|
+
* 1. 多模块时必填,会作为路径的一部分
|
|
38
|
+
* 2. 作为标志性的名字
|
|
39
|
+
* 3. umd/iife 模块的名字 (低优先级)
|
|
40
|
+
*/
|
|
41
|
+
name: string;
|
|
42
|
+
/** 配置类型 */
|
|
43
|
+
type: TConfigType;
|
|
21
44
|
/** 入口地址 */
|
|
22
45
|
input: string;
|
|
23
46
|
/** 出口配置 */
|
|
24
47
|
output: TOutput;
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
/** 输出单格式 */
|
|
48
|
+
/** 单模块 */
|
|
49
|
+
lib: TLib;
|
|
50
|
+
/** 输出单格式 lib 的简写 */
|
|
28
51
|
format: TModule;
|
|
52
|
+
/** 多模块配置 */
|
|
53
|
+
libList: TLib[];
|
|
54
|
+
/** 输出多格式 libList 的简写 */
|
|
55
|
+
formatList: TModule[];
|
|
29
56
|
/**
|
|
30
57
|
* 是否清除历史产物
|
|
31
58
|
* @default true
|
|
@@ -34,7 +61,7 @@ export type TDoraConfigCommon = {
|
|
|
34
61
|
/** 是否压缩代码 */
|
|
35
62
|
minimize: boolean;
|
|
36
63
|
/** 排除依赖,不打包进产物 */
|
|
37
|
-
externals: string[];
|
|
64
|
+
externals: string[] | TPlainObject[];
|
|
38
65
|
/** 包含依赖,打包进产物 */
|
|
39
66
|
internals: string[];
|
|
40
67
|
/** 路径别名 */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TDoraConfigCommon } from './dora-config-common';
|
|
2
|
+
import type { TDoraConfigDts } from './dora-config-dts';
|
|
3
|
+
import type { TDoraConfigEsbuild } from './dora-config-esbuild';
|
|
4
|
+
import type { TDoraConfigRollup } from './dora-config-rollup';
|
|
5
|
+
import type { TDoraConfigService } from './dora-config-service';
|
|
6
|
+
import type { TDoraConfigWebpack } from './dora-config-webpack';
|
|
7
|
+
|
|
8
|
+
export type TDoraConfigMultiple = Partial<TDoraConfigCommon> & {
|
|
9
|
+
/** 隔离 */
|
|
10
|
+
split?: boolean;
|
|
11
|
+
|
|
12
|
+
webpackConfig?: TDoraConfigWebpack;
|
|
13
|
+
rspackConfig?: TDoraConfigWebpack;
|
|
14
|
+
rollupConfig?: TDoraConfigRollup;
|
|
15
|
+
esbuildConfig?: TDoraConfigEsbuild;
|
|
16
|
+
serviceConfig?: Partial<TDoraConfigService>;
|
|
17
|
+
dtsConfig?: TDoraConfigDts;
|
|
18
|
+
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export type TDoraConfigService = {
|
|
2
|
+
/** 是否自动打开浏览器,分场景 */
|
|
3
|
+
openBrowser: boolean;
|
|
4
|
+
/** 访问路径前缀,静态资源也会加前缀 */
|
|
5
|
+
publicPath: string;
|
|
2
6
|
/** portal */
|
|
3
7
|
https: boolean;
|
|
8
|
+
/** 主机,自动打开浏览器会访问 */
|
|
9
|
+
host: string;
|
|
10
|
+
/** 允许访问的域名列表 */
|
|
11
|
+
allowedHosts: 'all' | string[];
|
|
4
12
|
/** port */
|
|
5
13
|
port: number;
|
|
6
14
|
/** 代理接口 */
|
|
@@ -14,7 +22,10 @@ export type TDoraConfigService = {
|
|
|
14
22
|
/**
|
|
15
23
|
* 静态资源服务
|
|
16
24
|
* 文件夹路径 -> 路由
|
|
17
|
-
* @default
|
|
25
|
+
* @default
|
|
26
|
+
* ```
|
|
27
|
+
* { './static': '/static' }
|
|
28
|
+
* ```
|
|
18
29
|
*/
|
|
19
30
|
static: {
|
|
20
31
|
[dirPath: string]: string;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
export type TDoraConfigWebpack = {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
https?: boolean;
|
|
5
|
-
port?: number;
|
|
6
|
-
open?: boolean;
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
proxy?: Record<string, any>[];
|
|
9
|
-
};
|
|
2
|
+
/** 日志级别,默认 warn */
|
|
3
|
+
logging?: 'none' | 'error' | 'warn' | 'info' | 'log' | 'verbose' | undefined; // 只显示警告及以上日志
|
|
10
4
|
/**
|
|
11
5
|
* eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map
|
|
12
6
|
* 开发环境推荐:eval-cheap-module-source-map
|
package/src/dora-config.ts
CHANGED
|
@@ -2,17 +2,18 @@ import type { PartialRecursive } from './common';
|
|
|
2
2
|
import type { TDoraConfigCommon } from './dora-config-common';
|
|
3
3
|
import type { TDoraConfigDts } from './dora-config-dts';
|
|
4
4
|
import type { TDoraConfigEsbuild } from './dora-config-esbuild';
|
|
5
|
+
import type { TDoraConfigMultiple } from './dora-config-multiple';
|
|
5
6
|
import type { TDoraConfigRollup } from './dora-config-rollup';
|
|
6
7
|
import type { TDoraConfigService } from './dora-config-service';
|
|
7
8
|
import type { TDoraConfigWebpack } from './dora-config-webpack';
|
|
8
9
|
|
|
9
10
|
export type TDoraConfig = TDoraConfigCommon & {
|
|
10
|
-
multiple:
|
|
11
|
+
multiple: TDoraConfigMultiple[] | false;
|
|
11
12
|
webpackConfig?: TDoraConfigWebpack;
|
|
12
13
|
rspackConfig?: TDoraConfigWebpack;
|
|
13
14
|
rollupConfig?: TDoraConfigRollup;
|
|
14
15
|
esbuildConfig?: TDoraConfigEsbuild;
|
|
15
|
-
serviceConfig?: TDoraConfigService
|
|
16
|
+
serviceConfig?: Partial<TDoraConfigService>;
|
|
16
17
|
dtsConfig?: TDoraConfigDts;
|
|
17
18
|
};
|
|
18
19
|
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from './cdn-type';
|
|
2
2
|
export * from './dora-config';
|
|
3
3
|
export * from './dora-config-common';
|
|
4
|
+
export * from './dora-config-multiple';
|
|
4
5
|
export * from './dora-config-rollup';
|
|
6
|
+
export * from './dora-config-service';
|
|
5
7
|
export * from './dora-config-webpack';
|
|
8
|
+
export * from './env-params';
|
|
6
9
|
export * from './module-type';
|
|
7
10
|
export * from './package-config';
|
|
8
11
|
export * from './ts-config-file';
|