@longzai-intelligence-tsconfig/config 0.0.0-stage → 0.0.2

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.
@@ -0,0 +1,99 @@
1
+ import "./rolldown-runtime-BqT_7tdF.js";
2
+ //#region src/types.d.ts
3
+ /**
4
+ * 单一 tsconfig 豁免声明
5
+ *
6
+ * 对应 ADR 0050 场景——docs 类特殊站允许单一 tsconfig,豁免四件套与 references 判据
7
+ */
8
+ type SingleTsconfigExemption = {
9
+ /**
10
+ * 豁免依据
11
+ *
12
+ * 须引用 ADR 或用户裁定出处,如 `ADR 0050`
13
+ */
14
+ reason: string;
15
+ };
16
+ /**
17
+ * 单包覆写声明
18
+ */
19
+ type PackageOverride = {
20
+ /**
21
+ * app 片包型覆写
22
+ *
23
+ * 包型默认按依赖自动推断(如 `react`、`elysia`、`next`,无框架依赖默认 `library`),仅推断误判或特异预设(如 decorator 变体)时覆写
24
+ */
25
+ appPreset?: string;
26
+ /**
27
+ * 单一 tsconfig 豁免声明
28
+ */
29
+ singleTsconfig?: SingleTsconfigExemption;
30
+ };
31
+ /**
32
+ * lzi-tsconfig 就地配置
33
+ */
34
+ type LziTsconfigConfig = {
35
+ /**
36
+ * 逐包覆写表
37
+ *
38
+ * key 为单元相对仓根路径,如 `packages/core`
39
+ */
40
+ packages?: Record<string, PackageOverride>;
41
+ /**
42
+ * 禁检单元路径表
43
+ *
44
+ * 精确匹配单元相对路径,如 `e2e/fixtures`
45
+ */
46
+ exclude?: string[];
47
+ };
48
+ //#endregion
49
+ //#region src/define-config.config.d.ts
50
+ /**
51
+ * lzi-tsconfig 配置工厂
52
+ *
53
+ * 参数可选、零参返回空默认配置——消费仓无仓库特有事实时 `defineConfig()` 一行即接入,开箱即用;有参时纯类型透传原样返回,为配置文件提供类型推导与形态收口
54
+ *
55
+ * @param config - 使用方就地配置对象,省略时取空配置
56
+ * @returns 配置对象,省略入参时为空对象
57
+ */
58
+ declare function defineConfig(config?: LziTsconfigConfig): LziTsconfigConfig;
59
+ //#endregion
60
+ //#region src/config-template.utils.d.ts
61
+ /**
62
+ * 构建配置文件模板内容
63
+ *
64
+ * 供 `lzi-tsconfig init` 写盘与 `--dry-run` 预览共用,零参开箱即用形态,注释遵循配置文件治理规范
65
+ *
66
+ * @returns 配置文件全文
67
+ */
68
+ declare function buildConfigFileContent(): string;
69
+ //#endregion
70
+ //#region src/config-loader.utils.d.ts
71
+ /**
72
+ * 就地配置文件名
73
+ */
74
+ declare const CONFIG_FILE_NAME = "lzi-tsconfig.config.ts";
75
+ /**
76
+ * 装载结果
77
+ */
78
+ type LoadedConfig = {
79
+ /**
80
+ * 解析后的配置对象
81
+ */
82
+ config: LziTsconfigConfig;
83
+ /**
84
+ * 配置文件绝对路径
85
+ */
86
+ path: string;
87
+ };
88
+ /**
89
+ * 装载就地配置
90
+ *
91
+ * 从目标仓根读取 `lzi-tsconfig.config.ts` 并取默认导出,文件不存在时返回 `null` 由调用方按零配置继续
92
+ *
93
+ * @param rootDir - 目标仓根目录
94
+ * @returns 装载结果,文件不存在时为 `null`
95
+ * @throws {@link Error} 配置文件默认导出缺失或形态不合规时抛出
96
+ */
97
+ declare function loadConfig(rootDir: string): Promise<LoadedConfig | null>;
98
+ //#endregion
99
+ export { CONFIG_FILE_NAME, type LoadedConfig, type LziTsconfigConfig, type PackageOverride, type SingleTsconfigExemption, buildConfigFileContent, defineConfig, loadConfig };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{createJiti as e}from"jiti";import{existsSync as t}from"node:fs";import{join as n}from"node:path";function r(e){return e??{}}function i(){return`import { defineConfig } from '@longzai-intelligence-tsconfig/config';
2
+
3
+ /**
4
+ * lzi-tsconfig 配置
5
+ */
6
+ export default defineConfig();
7
+ `}const a=`lzi-tsconfig.config.ts`;function o(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function s(e){if(!o(e))return!1;if(e.packages!==void 0){if(!o(e.packages))return!1;for(let t of Object.values(e.packages)){if(!o(t))return!1;let e=t.appPreset;if(e!==void 0&&typeof e!=`string`)return!1;let n=t.singleTsconfig;if(n!==void 0){if(!o(n))return!1;let e=n.reason;if(typeof e!=`string`||e.length===0)return!1}}}return e.exclude===void 0||!!Array.isArray(e.exclude)&&!e.exclude.some(e=>typeof e!=`string`)}async function c(r){let i=n(r,a);if(!t(i))return null;let c=await e(import.meta.url).import(i);if(!o(c))throw Error(`配置模块导出缺失`);let l=c.default;if(!s(l))throw Error(`配置默认导出形态不合规`);return{config:l,path:i}}export{a as CONFIG_FILE_NAME,i as buildConfigFileContent,r as defineConfig,c as loadConfig};
@@ -0,0 +1 @@
1
+ import"node:module";export{};
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-tsconfig/config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.2",
4
+ "private": false,
5
+ "description": "Longzai Intelligence tsconfig 形态门禁配置契约",
6
+ "license": "UNLICENSED",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "build": "lzi-builder",
21
+ "build:prod": "NODE_ENV=production bun run build",
22
+ "prepublishOnly": "bun run build:prod",
23
+ "typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
24
+ "typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
25
+ "typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
26
+ "typecheck:test": "lzi-tsgo typecheck tsconfig/test.json",
27
+ "lint": "oxlint && oxfmt --check",
28
+ "lint:fix": "oxlint --fix && oxfmt",
29
+ "test": "bun test",
30
+ "test:watch": "bun test --watch",
31
+ "test:coverage": "bun test --coverage",
32
+ "clean": "lzi-dev-cli clean"
33
+ },
34
+ "dependencies": {
35
+ "jiti": "^2.6.0"
36
+ }
37
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.