@longzai-intelligence-builder/config 0.2.13 → 0.2.14
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/dist/index.d.ts +36 -30
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ type LogLevel = LogType | 'silent';
|
|
|
21
21
|
* config 包不依赖 core,故在此独立声明结构兼容的接口;
|
|
22
22
|
* core 的 `createLogger` 返回值与此接口结构兼容(TS 结构类型)。
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
type Logger = {
|
|
25
25
|
level: LogLevel;
|
|
26
26
|
options?: LoggerOptions;
|
|
27
27
|
info: (...args: any[]) => void;
|
|
@@ -30,18 +30,18 @@ interface Logger {
|
|
|
30
30
|
error: (...args: any[]) => void;
|
|
31
31
|
success: (...args: any[]) => void;
|
|
32
32
|
clearScreen: (type: LogType) => void;
|
|
33
|
-
}
|
|
33
|
+
};
|
|
34
34
|
/**
|
|
35
35
|
* Logger 选项
|
|
36
36
|
*
|
|
37
37
|
* 对齐 tsdown `LoggerOptions`(`src/utils/logger.ts`)。
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
type LoggerOptions = {
|
|
40
40
|
allowClearScreen?: boolean;
|
|
41
41
|
customLogger?: Logger;
|
|
42
42
|
console?: Console;
|
|
43
43
|
failOnWarn?: boolean | CIOption;
|
|
44
|
-
}
|
|
44
|
+
};
|
|
45
45
|
/**
|
|
46
46
|
* 带 packageJsonPath 的 package.json(对齐 tsdown PackageJsonWithPath)
|
|
47
47
|
*
|
|
@@ -77,14 +77,14 @@ type RolldownChunk = (OutputChunk | OutputAsset) & {
|
|
|
77
77
|
/**
|
|
78
78
|
* 构建上下文(对齐 tsdown BuildContext)
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
type BuildContext = {
|
|
81
81
|
options: BuilderConfig;
|
|
82
82
|
hooks: Hookable<BuilderHooks>;
|
|
83
|
-
}
|
|
83
|
+
};
|
|
84
84
|
/**
|
|
85
85
|
* rolldown 构建上下文(对齐 tsdown RolldownContext)
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
type RolldownContext = {
|
|
88
88
|
buildOptions: BuildOptions;
|
|
89
89
|
/**
|
|
90
90
|
* 是否为 cjs 的第二次独立 dts 构建(emitDtsOnly)
|
|
@@ -94,34 +94,36 @@ interface RolldownContext {
|
|
|
94
94
|
* 是否为双格式构建(es + cjs)
|
|
95
95
|
*/
|
|
96
96
|
isDualFormat?: boolean;
|
|
97
|
-
}
|
|
97
|
+
};
|
|
98
98
|
/**
|
|
99
99
|
* builder 构建生命周期 hooks(对齐 tsdown TsdownHooks)
|
|
100
100
|
*/
|
|
101
|
-
|
|
101
|
+
type BuilderHooks = {
|
|
102
102
|
'build:prepare': (ctx: BuildContext) => void | Promise<void>;
|
|
103
103
|
'build:before': (ctx: BuildContext & RolldownContext) => void | Promise<void>;
|
|
104
104
|
'build:done': (ctx: BuildContext & {
|
|
105
105
|
chunks: RolldownChunk[];
|
|
106
106
|
}) => void | Promise<void>;
|
|
107
|
-
}
|
|
107
|
+
};
|
|
108
108
|
/**
|
|
109
|
-
* Awaitable 类型(对齐 tsdown utils/types.ts)
|
|
109
|
+
* - Awaitable 类型(对齐 tsdown utils/types.ts)
|
|
110
|
+
*
|
|
111
|
+
* @typeParam T - 泛型参数。
|
|
110
112
|
*/
|
|
111
113
|
type Awaitable<T> = T | Promise<T>;
|
|
112
114
|
/**
|
|
113
115
|
* @vitejs/devtools start 选项的最小类型
|
|
114
116
|
*/
|
|
115
|
-
|
|
117
|
+
type DevtoolsStartOptions = {
|
|
116
118
|
host?: string;
|
|
117
119
|
open?: boolean;
|
|
118
|
-
}
|
|
120
|
+
};
|
|
119
121
|
/**
|
|
120
122
|
* Devtools 选项(对齐 tsdown DevtoolsOptions)
|
|
121
123
|
*
|
|
122
124
|
* 扩展 rolldown 的 inputOptions.devtools,新增 ui / clean 字段。
|
|
123
125
|
*/
|
|
124
|
-
|
|
126
|
+
type DevtoolsOptions = {
|
|
125
127
|
/**
|
|
126
128
|
* **[experimental]** Enable devtools integration. `@vitejs/devtools` must be installed as a
|
|
127
129
|
* dependency.
|
|
@@ -135,13 +137,13 @@ interface DevtoolsOptions extends NonNullable<InputOptions['devtools']> {
|
|
|
135
137
|
* @default true
|
|
136
138
|
*/
|
|
137
139
|
clean?: boolean;
|
|
138
|
-
}
|
|
140
|
+
} & NonNullable<InputOptions['devtools']>;
|
|
139
141
|
/**
|
|
140
142
|
* Workspace 配置(对齐 tsdown Workspace)
|
|
141
143
|
*
|
|
142
144
|
* monorepo 多包构建配置。
|
|
143
145
|
*/
|
|
144
|
-
|
|
146
|
+
type Workspace = {
|
|
145
147
|
/**
|
|
146
148
|
* Workspace 目录,支持 glob 模式
|
|
147
149
|
*
|
|
@@ -160,11 +162,11 @@ interface Workspace {
|
|
|
160
162
|
* Workspace 配置文件路径
|
|
161
163
|
*/
|
|
162
164
|
config?: boolean | string;
|
|
163
|
-
}
|
|
165
|
+
};
|
|
164
166
|
/**
|
|
165
167
|
* copy 条目(对齐 tsdown CopyEntry)
|
|
166
168
|
*/
|
|
167
|
-
|
|
169
|
+
type CopyEntry = {
|
|
168
170
|
/**
|
|
169
171
|
* 源路径或 glob 模式
|
|
170
172
|
*/
|
|
@@ -189,7 +191,7 @@ interface CopyEntry {
|
|
|
189
191
|
* 修改目标文件或文件夹名
|
|
190
192
|
*/
|
|
191
193
|
rename?: string | ((name: string, extension: string, fullPath: string) => string);
|
|
192
|
-
}
|
|
194
|
+
};
|
|
193
195
|
/**
|
|
194
196
|
* copy 选项(对齐 tsdown CopyOptions)
|
|
195
197
|
*/
|
|
@@ -263,7 +265,7 @@ type ResolvedClean = {
|
|
|
263
265
|
/**
|
|
264
266
|
* report 选项(对齐 tsdown ReportOptions)
|
|
265
267
|
*/
|
|
266
|
-
|
|
268
|
+
type ReportOptions = {
|
|
267
269
|
/**
|
|
268
270
|
* 是否报告 gzip 压缩大小
|
|
269
271
|
*
|
|
@@ -282,13 +284,13 @@ interface ReportOptions {
|
|
|
282
284
|
* @default 1000000 (1 MB)
|
|
283
285
|
*/
|
|
284
286
|
maxCompressSize?: number;
|
|
285
|
-
}
|
|
287
|
+
};
|
|
286
288
|
/**
|
|
287
289
|
* exports 选项(对齐 tsdown ExportsOptions)
|
|
288
290
|
*
|
|
289
291
|
* package.json exports 字段自动生成配置。
|
|
290
292
|
*/
|
|
291
|
-
|
|
293
|
+
type ExportsOptions = {
|
|
292
294
|
/**
|
|
293
295
|
* 开发模式下 exports 指向源码
|
|
294
296
|
*/
|
|
@@ -329,25 +331,25 @@ interface ExportsOptions {
|
|
|
329
331
|
* bin 字段生成(auto-detect / string / Record / boolean)
|
|
330
332
|
*/
|
|
331
333
|
bin?: boolean | string | Record<string, string>;
|
|
332
|
-
}
|
|
334
|
+
};
|
|
333
335
|
/**
|
|
334
336
|
* publint 选项(对齐 tsdown PublintOptions)
|
|
335
337
|
*
|
|
336
338
|
* 包质量检查。需安装 publint。
|
|
337
339
|
*/
|
|
338
|
-
|
|
340
|
+
type PublintOptions = {
|
|
339
341
|
/**
|
|
340
342
|
* 预加载的 publint 模块
|
|
341
343
|
*/
|
|
342
344
|
module?: unknown;
|
|
343
345
|
[key: string]: unknown;
|
|
344
|
-
}
|
|
346
|
+
};
|
|
345
347
|
/**
|
|
346
348
|
* attw 选项(对齐 tsdown AttwOptions)
|
|
347
349
|
*
|
|
348
350
|
* 类型导出正确性检查。需安装 @arethetypeswrong/core。
|
|
349
351
|
*/
|
|
350
|
-
|
|
352
|
+
type AttwOptions = {
|
|
351
353
|
/**
|
|
352
354
|
* 预加载的 attw 模块
|
|
353
355
|
*/
|
|
@@ -365,7 +367,7 @@ interface AttwOptions {
|
|
|
365
367
|
*/
|
|
366
368
|
ignoreRules?: string[];
|
|
367
369
|
[key: string]: unknown;
|
|
368
|
-
}
|
|
370
|
+
};
|
|
369
371
|
/**
|
|
370
372
|
* CI 条件选项(对齐 tsdown CIOption)
|
|
371
373
|
*
|
|
@@ -381,6 +383,8 @@ type CIOption = 'ci-only' | 'local-only';
|
|
|
381
383
|
* - `undefined`:同 true
|
|
382
384
|
* - `CIOption`:按 CI 环境条件判定
|
|
383
385
|
* - `T & { enabled?: boolean | CIOption }`:对象配置,enabled 控制开关
|
|
386
|
+
*
|
|
387
|
+
* @typeParam T - 泛型参数。
|
|
384
388
|
*/
|
|
385
389
|
type WithEnabled<T> = boolean | undefined | CIOption | (T & {
|
|
386
390
|
enabled?: boolean | CIOption;
|
|
@@ -393,6 +397,8 @@ type BuildFormat = ModuleFormat | 'es' | 'cjs';
|
|
|
393
397
|
* 单值或数组
|
|
394
398
|
*
|
|
395
399
|
* 对齐 tsdown `Arrayable`(`src/utils/types.ts`)。
|
|
400
|
+
*
|
|
401
|
+
* @typeParam T - 泛型参数。
|
|
396
402
|
*/
|
|
397
403
|
type Arrayable<T> = T | T[];
|
|
398
404
|
/**
|
|
@@ -521,12 +527,12 @@ type BuilderConfig = {
|
|
|
521
527
|
* 构建前清理
|
|
522
528
|
*
|
|
523
529
|
* 对齐 tsdown `clean`:
|
|
530
|
+
*
|
|
524
531
|
* - `true`(默认):清理输出目录
|
|
525
532
|
* - `false`:不清理
|
|
526
533
|
* - `string[]`:清理指定路径列表(glob 模式)
|
|
527
|
-
* - 对象形态 `{ atomic, tmpDir }`(issue 0064):原子替换模式,构建写到 tmpDir(默认
|
|
528
|
-
*
|
|
529
|
-
* 适用于构建工具运行时依赖被构建包 dist 的自举场景
|
|
534
|
+
* - 对象形态 `{ atomic, tmpDir }`(issue 0064):原子替换模式,构建写到 tmpDir(默认 `<outDir>.tmp`),成功后原子替换
|
|
535
|
+
* outDir,失败保留旧产物。消除构建期 clean 空窗期, 适用于构建工具运行时依赖被构建包 dist 的自举场景
|
|
530
536
|
*/
|
|
531
537
|
clean?: boolean | string[] | CleanOptions;
|
|
532
538
|
/**
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-builder/config",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
6
9
|
"type": "module",
|
|
7
10
|
"main": "./dist/index.js",
|
|
8
11
|
"types": "./dist/index.d.ts",
|
|
@@ -12,16 +15,13 @@
|
|
|
12
15
|
"import": "./dist/index.js"
|
|
13
16
|
}
|
|
14
17
|
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "lzi-builder",
|
|
20
|
-
"build:prod": "NODE_ENV=production
|
|
20
|
+
"build:prod": "NODE_ENV=production bun run build",
|
|
21
21
|
"prepublishOnly": "bun run build:prod",
|
|
22
22
|
"typecheck": "bun run typecheck:app && bun run typecheck:node",
|
|
23
|
-
"typecheck:app": "tsgo
|
|
24
|
-
"typecheck:node": "tsgo
|
|
23
|
+
"typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
|
|
24
|
+
"typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
|
|
25
25
|
"lint": "oxlint && oxfmt --check",
|
|
26
26
|
"lint:fix": "oxlint --fix && oxfmt",
|
|
27
27
|
"test": "bun test",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"clean": "lzi-dev-cli clean"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@longzai-intelligence-builder/esm": "0.2.14"
|
|
35
|
+
},
|
|
33
36
|
"peerDependencies": {
|
|
34
|
-
"@longzai-intelligence-builder/rolldown-plugin-dts": "0.2.
|
|
37
|
+
"@longzai-intelligence-builder/rolldown-plugin-dts": "0.2.14",
|
|
35
38
|
"hookable": "^6.1.1",
|
|
36
39
|
"rolldown": "^1.0.0"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@longzai-intelligence-builder/esm": "0.2.13"
|
|
40
40
|
}
|
|
41
41
|
}
|