@longzai-intelligence-dependencies/config 0.0.0-stage → 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/dist/index.d.ts +169 -0
- package/dist/index.js +1 -0
- package/dist/rolldown-runtime-BqT_7tdF.js +1 -0
- package/package.json +44 -4
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import "./rolldown-runtime-BqT_7tdF.js";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* 定义 lzi-dependencies.config.ts 配置文件的结构
|
|
5
|
+
*
|
|
6
|
+
* 域名去 version 前缀(2026-10-07 双仓分工裁定,与顶层命令 upgrade 对齐):
|
|
7
|
+
* upgrade 域承载依赖升级配置、hoisting 域承载归位门禁配置;
|
|
8
|
+
* legacy lzi-dev.config.ts 的 versionUpgrade / hoisting 字段经加载器
|
|
9
|
+
* 回退映射到本结构,455 仓旧名兼容。
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* 依赖升级配置(控制 `lzi-dependencies upgrade` 与 `upgrade-across` 的检查行为)
|
|
13
|
+
*/
|
|
14
|
+
type UpgradeConfig = {
|
|
15
|
+
/**
|
|
16
|
+
* npm registry 请求超时时间(毫秒)
|
|
17
|
+
*
|
|
18
|
+
* @default 30000
|
|
19
|
+
*/
|
|
20
|
+
timeout?: number;
|
|
21
|
+
/**
|
|
22
|
+
* 请求失败重试次数
|
|
23
|
+
*
|
|
24
|
+
* @default 3
|
|
25
|
+
*/
|
|
26
|
+
retries?: number;
|
|
27
|
+
/**
|
|
28
|
+
* 更新模式
|
|
29
|
+
*
|
|
30
|
+
* @default 'default'
|
|
31
|
+
*/
|
|
32
|
+
mode?: 'default' | 'major' | 'minor' | 'patch' | 'latest' | 'newest';
|
|
33
|
+
/**
|
|
34
|
+
* 是否递归搜索子目录的 package.json
|
|
35
|
+
*
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
recursive?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 排除的依赖列表
|
|
41
|
+
*/
|
|
42
|
+
exclude?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* 包含的依赖列表
|
|
45
|
+
*/
|
|
46
|
+
include?: string[];
|
|
47
|
+
/**
|
|
48
|
+
* 要检查的依赖字段
|
|
49
|
+
*/
|
|
50
|
+
depFields?: Record<string, boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* 忽略的路径模式
|
|
53
|
+
*/
|
|
54
|
+
ignorePaths?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* 并发请求数
|
|
57
|
+
*
|
|
58
|
+
* @default 10
|
|
59
|
+
*/
|
|
60
|
+
concurrency?: number;
|
|
61
|
+
/**
|
|
62
|
+
* 为特定依赖覆盖升级模式
|
|
63
|
+
*/
|
|
64
|
+
packageMode?: {
|
|
65
|
+
[name: string]: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* 依赖归位配置(控制 `lzi-dependencies hoisting check` 的检查行为)
|
|
70
|
+
*
|
|
71
|
+
* 默认扫描全部子包清单并按根声明比对,需要排除的子项目与允许
|
|
72
|
+
* 子包单独声明的依赖通过本配置指定
|
|
73
|
+
*/
|
|
74
|
+
type HoistingConfig = {
|
|
75
|
+
/**
|
|
76
|
+
* 额外忽略的路径 glob(相对仓库根)
|
|
77
|
+
*
|
|
78
|
+
* 合并到默认忽略列表(node_modules / oh_modules / target / dist / build / .turbo)。
|
|
79
|
+
* 用于排除不参与归位检查的子项目,如 vendored 子项目、模板应用等
|
|
80
|
+
*/
|
|
81
|
+
ignorePaths?: string[];
|
|
82
|
+
/**
|
|
83
|
+
* 豁免的依赖名清单
|
|
84
|
+
*
|
|
85
|
+
* ADR 0036 第 4 节允许子包在特定条件下单独声明开发依赖,命中本
|
|
86
|
+
* 清单的依赖名不计违例。声明原因以注释形式写在配置项旁,
|
|
87
|
+
* 作为版本例外的记账载体
|
|
88
|
+
*/
|
|
89
|
+
allowlist?: string[];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* lzi-dependencies.config.ts 配置根类型
|
|
93
|
+
*/
|
|
94
|
+
type LziDependenciesConfig = {
|
|
95
|
+
/**
|
|
96
|
+
* 依赖升级配置(upgrade / upgrade-across)
|
|
97
|
+
*/
|
|
98
|
+
upgrade?: UpgradeConfig;
|
|
99
|
+
/**
|
|
100
|
+
* 依赖归位配置(hoisting check)
|
|
101
|
+
*/
|
|
102
|
+
hoisting?: HoistingConfig;
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/define.config.d.ts
|
|
106
|
+
/**
|
|
107
|
+
* lzi-dependencies 配置工厂(恒等返回,仅提供类型约束)
|
|
108
|
+
*
|
|
109
|
+
* @param config - 配置对象,缺省为空对象(全字段走默认值)
|
|
110
|
+
* @returns 原样返回的配置对象
|
|
111
|
+
*/
|
|
112
|
+
declare const defineConfig: (config?: LziDependenciesConfig) => LziDependenciesConfig;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/load.config.d.ts
|
|
115
|
+
/**
|
|
116
|
+
* 新配置来源(lzi-dependencies.config.ts 或统一 lzi.config.ts 的 dependencies 字段)
|
|
117
|
+
*/
|
|
118
|
+
type DependenciesSourceNew = 'dependencies';
|
|
119
|
+
/**
|
|
120
|
+
* 兼容回退来源(lzi-dev.config.ts 或统一 lzi.config.ts 的 devTools 字段)
|
|
121
|
+
*/
|
|
122
|
+
type DependenciesSourceLegacy = 'legacy-dev-tools';
|
|
123
|
+
/**
|
|
124
|
+
* 配置来源
|
|
125
|
+
*/
|
|
126
|
+
type DependenciesConfigSource = DependenciesSourceNew | DependenciesSourceLegacy;
|
|
127
|
+
/**
|
|
128
|
+
* 配置加载结果
|
|
129
|
+
*/
|
|
130
|
+
type DependenciesConfigResult = {
|
|
131
|
+
/**
|
|
132
|
+
* 加载后的依赖工具域配置对象
|
|
133
|
+
*/
|
|
134
|
+
config: LziDependenciesConfig;
|
|
135
|
+
/**
|
|
136
|
+
* 命中的配置文件绝对路径(用于推导 monorepo 根目录)
|
|
137
|
+
*/
|
|
138
|
+
configPath: string;
|
|
139
|
+
/**
|
|
140
|
+
* 配置来源(legacy 命中时由调用方输出共享读取说明)
|
|
141
|
+
*/
|
|
142
|
+
source: DependenciesConfigSource;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* 查找配置文件路径
|
|
146
|
+
*
|
|
147
|
+
* 优先查找 lzi-dependencies.config.ts,其次 lzi-dev.config.ts(兼容回退),
|
|
148
|
+
* 均未找到时返回 null
|
|
149
|
+
*
|
|
150
|
+
* @returns 配置文件的绝对路径,如果找不到则返回 null
|
|
151
|
+
*/
|
|
152
|
+
declare const findDependenciesConfigFile: () => string | null;
|
|
153
|
+
/**
|
|
154
|
+
* 加载依赖工具域配置
|
|
155
|
+
*
|
|
156
|
+
* 三级优先:
|
|
157
|
+
*
|
|
158
|
+
* - lzi-dependencies.config.ts(standalone)> lzi.config.ts 的 dependencies 字段(统一配置)
|
|
159
|
+
* - 均未命中时兼容回退 lzi-dev.config.ts 的 versionUpgrade / hoisting 字段(或 lzi.config.ts 的 devTools 字段),legacy
|
|
160
|
+
* 命中时由调用方输出共享读取说明
|
|
161
|
+
* - 两轨 standalone 均要求存在其一(与 lzi-dev-cli 时代行为一致)
|
|
162
|
+
*
|
|
163
|
+
* @param cwd - 配置查找起点目录(缺省为进程 cwd;插件等以目标仓根为起点的消费方显式传入)
|
|
164
|
+
* @returns 配置加载结果;任一配置文件都不存在时返回 null
|
|
165
|
+
* @throws {@link Error} 如果配置文件存在但加载失败
|
|
166
|
+
*/
|
|
167
|
+
declare const loadDependenciesConfig: (cwd?: string) => Promise<DependenciesConfigResult | null>;
|
|
168
|
+
//#endregion
|
|
169
|
+
export { type DependenciesConfigResult, type DependenciesConfigSource, type HoistingConfig, type LziDependenciesConfig, type UpgradeConfig, defineConfig, findDependenciesConfigFile, loadDependenciesConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-BqT_7tdF.js";import{loadUnifiedConfig as e,resolveStandaloneConfigPath as t}from"@longzai-intelligence-shared-config/core";const n=(e={})=>e,r=`lzi-dependencies.config.ts`,i=`lzi-dev.config.ts`,a=()=>t(r)??t(i),o=async t=>{let n=a();if(!n)return null;let o=await e({standaloneFile:r,unifiedField:`dependencies`,cwd:t});if(o.success)return{config:o.config,configPath:n,source:`dependencies`};let s=await e({standaloneFile:i,unifiedField:`devTools`,cwd:t});return s.success&&(s.config.versionUpgrade!==void 0||s.config.hoisting!==void 0)&&s.success?{config:{upgrade:s.config.versionUpgrade,hoisting:s.config.hoisting},configPath:n,source:`legacy-dev-tools`}:{config:{},configPath:n,source:`dependencies`}};export{n as defineConfig,a as findDependenciesConfigFile,o as loadDependenciesConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"node:module";export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-dependencies/config",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Longzai Intelligence 依赖工具配置:lzi-dependencies.config.ts 类型定义、defineConfig 工厂与三级配置加载器",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"config",
|
|
8
|
+
"dependencies",
|
|
9
|
+
"longzai-intelligence"
|
|
10
|
+
],
|
|
11
|
+
"license": "UNLICENSED",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "lzi-builder",
|
|
26
|
+
"build:prod": "NODE_ENV=production bun run build",
|
|
27
|
+
"prepublishOnly": "bun run build:prod",
|
|
28
|
+
"typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
|
|
29
|
+
"typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
|
|
30
|
+
"typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
|
|
31
|
+
"typecheck:test": "lzi-tsgo typecheck tsconfig/test.json",
|
|
32
|
+
"lint": "oxlint && oxfmt --check",
|
|
33
|
+
"lint:fix": "oxlint --fix && oxfmt",
|
|
34
|
+
"test": "bun test",
|
|
35
|
+
"test:watch": "bun test --watch",
|
|
36
|
+
"test:coverage": "bun test --coverage",
|
|
37
|
+
"clean": "lzi-dev-cli clean"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@longzai-intelligence-shared-config/core": "^0.0.7"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/bun": "^1.4.0",
|
|
44
|
+
"@types/node": "^26.2.0"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/README.md
DELETED