@longzai-intelligence-oxlint/config 0.0.0-stage → 0.2.21

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 CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # @longzai-intelligence-oxlint/config
2
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.
3
+ Longzai Intelligence oxlint 预设判定基础包。
4
+
5
+ ## 简介
6
+
7
+ 单一职责:判定单元 oxlint 配置所用预设,即告知是什么 preset。预设的规则判据清单属各执法域自身业务,不经本包承载。
8
+
9
+ ## 能力
10
+
11
+ - `resolvePresetFromConfigText`——从 oxlint 配置文本解析预设键,presets 直连与 oxlint-config 包装层两前缀同名归一
12
+ - `resolveUnitPreset`——判定单元所用预设,只认 `oxlint.config.ts` 标准形态
13
+ - `PRESET_KEYS`——预设键全集
@@ -0,0 +1,24 @@
1
+ import "./rolldown-runtime-BqT_7tdF.js";
2
+ /**
3
+ * 预设键全集的字面量联合类型
4
+ */
5
+ type PresetKey = 'base' | 'node' | 'react' | 'react-native' | 'expo' | 'next' | 'taro' | 'fumadocs' | 'elysia' | 'nest' | 'hono' | 'mcp' | 'electron' | 'library' | 'sdk' | 'e2e' | 'root';
6
+ /**
7
+ * 预设键全集
8
+ */
9
+ declare const PRESET_KEYS: readonly PresetKey[];
10
+ /**
11
+ * 从 oxlint 配置文本解析所用预设
12
+ *
13
+ * @param text - `oxlint.config.ts` 全文
14
+ * @returns 命中的预设键,无 defineConfig 预设导入或条目不在全集时返回 null
15
+ */
16
+ declare function resolvePresetFromConfigText(text: string): PresetKey | null;
17
+ /**
18
+ * 判定单元所用预设
19
+ *
20
+ * @param unitDir - 单元目录绝对路径
21
+ * @returns 命中的预设键,单元无 `oxlint.config.ts` 或无法解析时返回 null
22
+ */
23
+ declare function resolveUnitPreset(unitDir: string): PresetKey | null;
24
+ export { PRESET_KEYS, type PresetKey, resolvePresetFromConfigText, resolveUnitPreset };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-BqT_7tdF.js";import{existsSync as e,readFileSync as t}from"node:fs";import{join as n}from"node:path";const r=[`base`,`node`,`react`,`react-native`,`expo`,`next`,`taro`,`fumadocs`,`elysia`,`nest`,`hono`,`mcp`,`electron`,`library`,`sdk`,`e2e`,`root`],i=/import\s*\{[^}]*\bdefineConfig\b[^}]*\}\s*from\s*['"]@longzai-intelligence-oxlint\/(?:oxlint-config\/)?presets\/([a-z0-9-]+)['"]/,a=new Set(r);function o(e){return a.has(e)}function s(e){let t=i.exec(e);if(t===null)return null;let n=t[1];return n===void 0?null:o(n)?n:null}function c(r){let i=n(r,`oxlint.config.ts`);if(!e(i))return null;try{return s(t(i,`utf8`))}catch{return null}}export{r as PRESET_KEYS,s as resolvePresetFromConfigText,c as resolveUnitPreset};
@@ -0,0 +1 @@
1
+ import"node:module";export{};
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-oxlint/config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.21",
4
+ "description": "Longzai Intelligence oxlint 预设判定与按预设判据共享基础包",
5
+ "keywords": [
6
+ "config",
7
+ "longzai-intelligence",
8
+ "oxlint",
9
+ "preset",
10
+ "resolver"
11
+ ],
12
+ "license": "UNLICENSED",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "type": "module",
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "lzi-builder",
27
+ "build:prod": "NODE_ENV=production bun run build",
28
+ "prepublishOnly": "bun run build:prod",
29
+ "dev": "lzi-builder --watch",
30
+ "clean": "lzi-dev-cli clean",
31
+ "test": "vitest run",
32
+ "test:watch": "vitest",
33
+ "test:coverage": "vitest run --coverage",
34
+ "lint": "oxlint && oxfmt --check",
35
+ "lint:fix": "oxlint --fix && oxfmt",
36
+ "typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
37
+ "typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
38
+ "typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
39
+ "typecheck:test": "lzi-tsgo typecheck tsconfig/test.json"
40
+ },
41
+ "devDependencies": {
42
+ "@vitest/coverage-v8": "^4.1.10"
43
+ }
44
+ }