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

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,101 @@
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 片应 extends 的预设名
22
+ *
23
+ * 如 `library`、`react`、`elysia`,对应共享配置包 `presets/<名>.json`
24
+ *
25
+ * @default 不声明时仅校验 extends 合法性,不做包型比对
26
+ */
27
+ appPreset?: string;
28
+ /**
29
+ * 单一 tsconfig 豁免声明
30
+ */
31
+ singleTsconfig?: SingleTsconfigExemption;
32
+ };
33
+ /**
34
+ * lzi-tsconfig 就地配置
35
+ */
36
+ type LziTsconfigConfig = {
37
+ /**
38
+ * 逐包覆写表
39
+ *
40
+ * key 为单元相对仓根路径,如 `packages/core`
41
+ */
42
+ packages?: Record<string, PackageOverride>;
43
+ /**
44
+ * 禁检单元路径表
45
+ *
46
+ * 精确匹配单元相对路径,如 `e2e/fixtures`
47
+ */
48
+ exclude?: string[];
49
+ };
50
+ //#endregion
51
+ //#region src/define-config.config.d.ts
52
+ /**
53
+ * lzi-tsconfig 配置工厂
54
+ *
55
+ * 纯类型透传,运行时无副作用原样返回,为配置文件提供类型推导与形态收口
56
+ *
57
+ * @param config - 使用方就地配置对象
58
+ * @returns 原样返回的配置对象
59
+ */
60
+ declare function defineConfig(config: LziTsconfigConfig): LziTsconfigConfig;
61
+ //#endregion
62
+ //#region src/config-template.utils.d.ts
63
+ /**
64
+ * 构建配置文件模板内容
65
+ *
66
+ * 供 `lzi-tsconfig init` 写盘与 `--dry-run` 预览共用,注释遵循配置文件治理规范
67
+ *
68
+ * @returns 配置文件全文
69
+ */
70
+ declare function buildConfigFileContent(): string;
71
+ //#endregion
72
+ //#region src/config-loader.utils.d.ts
73
+ /**
74
+ * 就地配置文件名
75
+ */
76
+ declare const CONFIG_FILE_NAME = "lzi-tsconfig.config.ts";
77
+ /**
78
+ * 装载结果
79
+ */
80
+ type LoadedConfig = {
81
+ /**
82
+ * 解析后的配置对象
83
+ */
84
+ config: LziTsconfigConfig;
85
+ /**
86
+ * 配置文件绝对路径
87
+ */
88
+ path: string;
89
+ };
90
+ /**
91
+ * 装载就地配置
92
+ *
93
+ * 从目标仓根读取 `lzi-tsconfig.config.ts` 并取默认导出,文件不存在时返回 `null` 由调用方按零配置继续
94
+ *
95
+ * @param rootDir - 目标仓根目录
96
+ * @returns 装载结果,文件不存在时为 `null`
97
+ * @throws {@link Error} 配置文件默认导出缺失或形态不合规时抛出
98
+ */
99
+ declare function loadConfig(rootDir: string): Promise<LoadedConfig | null>;
100
+ //#endregion
101
+ export { CONFIG_FILE_NAME, type LoadedConfig, type LziTsconfigConfig, type PackageOverride, type SingleTsconfigExemption, buildConfigFileContent, defineConfig, loadConfig };
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
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
+ packages: {},
8
+ });
9
+ `}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.1",
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.