@pawover/kit 1.6.0 → 1.7.0-alpha.0

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.en.md CHANGED
@@ -9,9 +9,9 @@
9
9
  [![Docs](https://img.shields.io/badge/docs-pawover--kit--docs-3B82F6.svg)](https://pawover.github.io/pawover-kit/)
10
10
  </div>
11
11
 
12
- > An open-source TypeScript toolkit: type utilities, static utility classes, React / Alova hooks, ESLint rulesets and Zod schemas, ready to use with complete type definitions.
12
+ > An open-source TypeScript toolkit: type utilities, static utility classes, React / Alova hooks, ESLint / Oxlint rulesets, Vite plugins and Zod schemas, ready to use with complete type definitions.
13
13
 
14
- pawover-kit is a pnpm monorepo made of 5 independently publishable packages. The root package `@pawover/kit` re-exports every subpackage, while each subpackage can also be installed and used on its own.
14
+ pawover-kit is a pnpm monorepo made of 7 independently publishable packages. The root package `@pawover/kit` re-exports every subpackage, while each subpackage can also be installed and used on its own.
15
15
 
16
16
  > 📚 **Documentation**: [https://pawover.github.io/pawover-kit/](https://pawover.github.io/pawover-kit/) — full API reference, guides and practical examples live on the docs site; this file keeps only the essentials.
17
17
 
@@ -29,6 +29,8 @@ pawover-kit is a pnpm monorepo made of 5 independently publishable packages. The
29
29
  | `@pawover/kit-utils` | 15+ static utility classes | [![npm version](https://img.shields.io/npm/v/@pawover/kit-utils.svg)](https://www.npmjs.com/package/@pawover/kit-utils) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-utils.svg)](https://www.npmjs.com/package/@pawover/kit-utils) |
30
30
  | `@pawover/kit-hooks` | React + Alova hooks | [![npm version](https://img.shields.io/npm/v/@pawover/kit-hooks.svg)](https://www.npmjs.com/package/@pawover/kit-hooks) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-hooks.svg)](https://www.npmjs.com/package/@pawover/kit-hooks) |
31
31
  | `@pawover/kit-eslint-rules` | ESLint rulesets (flat config) | [![npm version](https://img.shields.io/npm/v/@pawover/kit-eslint-rules.svg)](https://www.npmjs.com/package/@pawover/kit-eslint-rules) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-eslint-rules.svg)](https://www.npmjs.com/package/@pawover/kit-eslint-rules) |
32
+ | `@pawover/kit-oxlint-rules` | Pure-native Oxlint preset (no ESLint JS plugins) | [![npm version](https://img.shields.io/npm/v/@pawover/kit-oxlint-rules.svg)](https://www.npmjs.com/package/@pawover/kit-oxlint-rules) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-oxlint-rules.svg)](https://www.npmjs.com/package/@pawover/kit-oxlint-rules) |
33
+ | `@pawover/kit-vite-plugins` | Vite plugins: layer order injection, asset type generation, Naive UI CSS layering | [![npm version](https://img.shields.io/npm/v/@pawover/kit-vite-plugins.svg)](https://www.npmjs.com/package/@pawover/kit-vite-plugins) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-vite-plugins.svg)](https://www.npmjs.com/package/@pawover/kit-vite-plugins) |
32
34
  | `@pawover/kit-zod` | Zod v4 validators | [![npm version](https://img.shields.io/npm/v/@pawover/kit-zod.svg)](https://www.npmjs.com/package/@pawover/kit-zod) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-zod.svg)](https://www.npmjs.com/package/@pawover/kit-zod) |
33
35
 
34
36
  <blockquote style="background: rgba(9, 105, 218, 0.05); border-left: 4px solid #0969da; border-radius: 6px; padding: 12px 16px;">
@@ -50,6 +52,8 @@ pnpm add @pawover/kit-types
50
52
  pnpm add @pawover/kit-utils
51
53
  pnpm add @pawover/kit-hooks
52
54
  pnpm add @pawover/kit-eslint-rules
55
+ pnpm add @pawover/kit-oxlint-rules
56
+ pnpm add @pawover/kit-vite-plugins
53
57
  pnpm add @pawover/kit-zod
54
58
  ```
55
59
 
@@ -64,7 +68,10 @@ import { TypeUtil } from "@pawover/kit/utils";
64
68
  import { useMount } from "@pawover/kit/hooks/react";
65
69
  import { useAlovaRequest } from "@pawover/kit/hooks/alova";
66
70
  import type { AnyObject } from "@pawover/kit/types";
67
- import pawover from "@pawover/kit/eslint-rules";
71
+ import { pawoverESLint } from "@pawover/kit/eslint-rules";
72
+ import { generateOxlintConfig } from "@pawover/kit/oxlint-rules";
73
+ import { createPluginCssLayerOrder } from "@pawover/kit/vite-plugins";
74
+ import { installNaiveUiCssLayer } from "@pawover/kit/vite-plugins/naive-ui-css-layer";
68
75
  import { id } from "@pawover/kit/zod";
69
76
 
70
77
  // Type utilities
@@ -79,12 +86,23 @@ useMount(() => {
79
86
  });
80
87
 
81
88
  // ESLint flat config preset (self-contained)
82
- export default pawover({ typescript: true });
89
+ export default pawoverESLint({ typescript: true });
90
+
91
+ // Oxlint pure-native preset (generates .oxlintrc.json with $schema)
92
+ generateOxlintConfig({ typescript: true });
93
+
94
+ // Vite plugins: inline the @layer statement into the HTML head
95
+ createPluginCssLayerOrder({ cssFile: "src/styles/index.css", requiredLayers: ["vendor", "utilities"] });
96
+
97
+ // Style layering runtime (browser side, imported from the subpath)
98
+ installNaiveUiCssLayer({ layerName: "vendor" });
83
99
 
84
100
  // Zod schemas
85
101
  id.parse("abc"); // "abc"
86
102
  ```
87
103
 
104
+ > The Oxlint preset differences, unsupported list and `tsrs` notes are documented in [site/api/oxlint-rules.md](site/api/oxlint-rules.md).
105
+
88
106
  ## Requirements
89
107
 
90
108
  - Node.js >= 24.22.2
@@ -102,7 +120,7 @@ Common commands:
102
120
 
103
121
  | Command | Description |
104
122
  | :--- | :--- |
105
- | `pnpm test` | Run all vitest suites (814 tests / 31 files, node + jsdom environments) |
123
+ | `pnpm test` | Run all vitest suites (1340 tests / 43 files, node + jsdom environments) |
106
124
  | `pnpm test:types` | Type-check the test files |
107
125
  | `pnpm test:ci` | Full CI pipeline: type check → tests → build → smoke → pack check |
108
126
  | `pnpm build` | Build every subpackage with turbo (tsdown emits ESM/CJS builds and type declarations) |
package/README.md CHANGED
@@ -9,9 +9,9 @@
9
9
  [![Docs](https://img.shields.io/badge/docs-pawover--kit--docs-3B82F6.svg)](https://pawover.github.io/pawover-kit/)
10
10
  </div>
11
11
 
12
- > 一个基于 TypeScript 的开源工具包合集:类型工具、静态工具类、React / Alova Hooks、ESLint 规则集与 Zod Schema,开箱即用、类型完备。
12
+ > 一个基于 TypeScript 的开源工具包合集:类型工具、静态工具类、React / Alova Hooks、ESLint / Oxlint 规则集、Vite 插件与 Zod Schema,开箱即用、类型完备。
13
13
 
14
- pawover-kit 是一个 pnpm 单体仓库(monorepo),由 5 个独立可发布的子包组成。根包 `@pawover/kit` 聚合重新导出所有子包,也可以按需单独安装使用。
14
+ pawover-kit 是一个 pnpm 单体仓库(monorepo),由 7 个独立可发布的子包组成。根包 `@pawover/kit` 聚合重新导出所有子包,也可以按需单独安装使用。
15
15
 
16
16
  > 📚 **技术文档**:[https://pawover.github.io/pawover-kit/](https://pawover.github.io/pawover-kit/) —— 完整的 API 参考、指南与实战示例见文档站;本文档只保留最简介绍。
17
17
 
@@ -29,6 +29,8 @@ pawover-kit 是一个 pnpm 单体仓库(monorepo),由 5 个独立可发布
29
29
  | `@pawover/kit-utils` | 15+ 个静态工具类 | [![npm version](https://img.shields.io/npm/v/@pawover/kit-utils.svg)](https://www.npmjs.com/package/@pawover/kit-utils) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-utils.svg)](https://www.npmjs.com/package/@pawover/kit-utils) |
30
30
  | `@pawover/kit-hooks` | React + Alova Hooks | [![npm version](https://img.shields.io/npm/v/@pawover/kit-hooks.svg)](https://www.npmjs.com/package/@pawover/kit-hooks) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-hooks.svg)](https://www.npmjs.com/package/@pawover/kit-hooks) |
31
31
  | `@pawover/kit-eslint-rules` | ESLint 规则集(flat config) | [![npm version](https://img.shields.io/npm/v/@pawover/kit-eslint-rules.svg)](https://www.npmjs.com/package/@pawover/kit-eslint-rules) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-eslint-rules.svg)](https://www.npmjs.com/package/@pawover/kit-eslint-rules) |
32
+ | `@pawover/kit-oxlint-rules` | Oxlint 纯原生预设(不加载 ESLint JS 插件) | [![npm version](https://img.shields.io/npm/v/@pawover/kit-oxlint-rules.svg)](https://www.npmjs.com/package/@pawover/kit-oxlint-rules) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-oxlint-rules.svg)](https://www.npmjs.com/package/@pawover/kit-oxlint-rules) |
33
+ | `@pawover/kit-vite-plugins` | Vite 插件:层序注入与资源类型生成、Naive UI 样式分层 | [![npm version](https://img.shields.io/npm/v/@pawover/kit-vite-plugins.svg)](https://www.npmjs.com/package/@pawover/kit-vite-plugins) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-vite-plugins.svg)](https://www.npmjs.com/package/@pawover/kit-vite-plugins) |
32
34
  | `@pawover/kit-zod` | Zod v4 校验器 | [![npm version](https://img.shields.io/npm/v/@pawover/kit-zod.svg)](https://www.npmjs.com/package/@pawover/kit-zod) | [![npm downloads](https://img.shields.io/npm/dm/@pawover/kit-zod.svg)](https://www.npmjs.com/package/@pawover/kit-zod) |
33
35
 
34
36
  <blockquote style="background: rgba(9, 105, 218, 0.05); border-left: 4px solid #0969da; border-radius: 6px; padding: 12px 16px;">
@@ -50,6 +52,8 @@ pnpm add @pawover/kit-types
50
52
  pnpm add @pawover/kit-utils
51
53
  pnpm add @pawover/kit-hooks
52
54
  pnpm add @pawover/kit-eslint-rules
55
+ pnpm add @pawover/kit-oxlint-rules
56
+ pnpm add @pawover/kit-vite-plugins
53
57
  pnpm add @pawover/kit-zod
54
58
  ```
55
59
 
@@ -64,7 +68,10 @@ import { TypeUtil } from "@pawover/kit/utils";
64
68
  import { useMount } from "@pawover/kit/hooks/react";
65
69
  import { useAlovaRequest } from "@pawover/kit/hooks/alova";
66
70
  import type { AnyObject } from "@pawover/kit/types";
67
- import pawover from "@pawover/kit/eslint-rules";
71
+ import { pawoverESLint } from "@pawover/kit/eslint-rules";
72
+ import { generateOxlintConfig } from "@pawover/kit/oxlint-rules";
73
+ import { createPluginCssLayerOrder } from "@pawover/kit/vite-plugins";
74
+ import { installNaiveUiCssLayer } from "@pawover/kit/vite-plugins/naive-ui-css-layer";
68
75
  import { id } from "@pawover/kit/zod";
69
76
 
70
77
  // 类型工具
@@ -79,12 +86,23 @@ useMount(() => {
79
86
  });
80
87
 
81
88
  // ESLint flat config 预设(自包含)
82
- export default pawover({ typescript: true });
89
+ export default pawoverESLint({ typescript: true });
90
+
91
+ // Oxlint 纯原生预设(生成带 $schema 的 .oxlintrc.json)
92
+ generateOxlintConfig({ typescript: true });
93
+
94
+ // Vite 插件:把层序声明内联进 HTML head
95
+ createPluginCssLayerOrder({ cssFile: "src/styles/index.css", requiredLayers: ["vendor", "utilities"] });
96
+
97
+ // 样式分层运行时(浏览器侧,从子路径导入)
98
+ installNaiveUiCssLayer({ layerName: "vendor" });
83
99
 
84
100
  // Zod Schema
85
101
  id.parse("abc"); // "abc"
86
102
  ```
87
103
 
104
+ > Oxlint 预设与 ESLint 预设的差异、未覆盖清单与 `tsrs` 说明见 [site/api/oxlint-rules.md](site/api/oxlint-rules.md)。
105
+
88
106
  ## 环境要求
89
107
 
90
108
  - Node.js >= 24.22.2
@@ -102,7 +120,7 @@ pnpm install
102
120
 
103
121
  | 命令 | 说明 |
104
122
  | :--- | :--- |
105
- | `pnpm test` | vitest 全量运行(814 条测试 / 31 个文件,node + jsdom 双环境) |
123
+ | `pnpm test` | vitest 全量运行(1340 条测试 / 43 个文件,node + jsdom 双环境) |
106
124
  | `pnpm test:types` | 测试文件的类型检查 |
107
125
  | `pnpm test:ci` | 完整 CI 流程:类型检查 → 测试 → 构建 → 冒烟 → pack 检查 |
108
126
  | `pnpm build` | turbo 构建全部子包(tsdown 生成 ESM/CJS 双格式与类型声明) |
@@ -1,2 +1 @@
1
1
  export * from "@pawover/kit-eslint-rules";
2
- export { default } from "@pawover/kit-eslint-rules";
@@ -1,2 +1 @@
1
1
  export * from "@pawover/kit-eslint-rules";
2
- export { default } from "@pawover/kit-eslint-rules";
@@ -0,0 +1 @@
1
+ module.exports = require("@pawover/kit-oxlint-rules");
@@ -0,0 +1 @@
1
+ export type * from './oxlint-rules.d.ts';
@@ -0,0 +1 @@
1
+ export * from "@pawover/kit-oxlint-rules";
@@ -0,0 +1 @@
1
+ export * from "@pawover/kit-oxlint-rules";
@@ -0,0 +1 @@
1
+ module.exports = require("@pawover/kit-vite-plugins/naive-ui-css-layer");
@@ -0,0 +1 @@
1
+ export type * from './vite-plugins-naive-ui-css-layer.d.ts';
@@ -0,0 +1 @@
1
+ export * from "@pawover/kit-vite-plugins/naive-ui-css-layer";
@@ -0,0 +1 @@
1
+ export * from "@pawover/kit-vite-plugins/naive-ui-css-layer";
@@ -0,0 +1 @@
1
+ module.exports = require("@pawover/kit-vite-plugins");
@@ -0,0 +1 @@
1
+ export type * from './vite-plugins.d.ts';
@@ -0,0 +1 @@
1
+ export * from "@pawover/kit-vite-plugins";
@@ -0,0 +1 @@
1
+ export * from "@pawover/kit-vite-plugins";
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/pawover"
7
7
  },
8
8
  "description": "一个基于 TypeScript 的开发工具包",
9
- "version": "1.6.0",
9
+ "version": "1.7.0-alpha.0",
10
10
  "type": "module",
11
11
  "engines": {
12
12
  "node": ">=24.22.2"
@@ -163,16 +163,48 @@
163
163
  "default": "./entry/eslint-rules.cjs"
164
164
  }
165
165
  },
166
+ "./oxlint-rules": {
167
+ "import": {
168
+ "types": "./entry/oxlint-rules.d.ts",
169
+ "default": "./entry/oxlint-rules.js"
170
+ },
171
+ "require": {
172
+ "types": "./entry/oxlint-rules.d.cts",
173
+ "default": "./entry/oxlint-rules.cjs"
174
+ }
175
+ },
176
+ "./vite-plugins": {
177
+ "import": {
178
+ "types": "./entry/vite-plugins.d.ts",
179
+ "default": "./entry/vite-plugins.js"
180
+ },
181
+ "require": {
182
+ "types": "./entry/vite-plugins.d.cts",
183
+ "default": "./entry/vite-plugins.cjs"
184
+ }
185
+ },
186
+ "./vite-plugins/naive-ui-css-layer": {
187
+ "import": {
188
+ "types": "./entry/vite-plugins-naive-ui-css-layer.d.ts",
189
+ "default": "./entry/vite-plugins-naive-ui-css-layer.js"
190
+ },
191
+ "require": {
192
+ "types": "./entry/vite-plugins-naive-ui-css-layer.d.cts",
193
+ "default": "./entry/vite-plugins-naive-ui-css-layer.cjs"
194
+ }
195
+ },
166
196
  "./metadata.json": "./entry/metadata.json"
167
197
  },
168
198
  "publishConfig": {
169
199
  "access": "public"
170
200
  },
171
201
  "dependencies": {
172
- "@pawover/kit-eslint-rules": "0.2.1",
202
+ "@pawover/kit-eslint-rules": "0.3.0-alpha.0",
173
203
  "@pawover/kit-hooks": "0.1.1",
204
+ "@pawover/kit-oxlint-rules": "0.1.0-alpha.0",
174
205
  "@pawover/kit-types": "0.2.0",
175
206
  "@pawover/kit-utils": "1.2.0",
207
+ "@pawover/kit-vite-plugins": "0.1.0-alpha.0",
176
208
  "@pawover/kit-zod": "0.2.0"
177
209
  },
178
210
  "devDependencies": {
@@ -199,6 +231,7 @@
199
231
  "jsdom": "^31.0.1",
200
232
  "lint-staged": "^17.6.3",
201
233
  "mathjs": "^15.3.0",
234
+ "oxlint": "1.96.0",
202
235
  "prettier": "^3.10.1",
203
236
  "react-dom": "19.2.6",
204
237
  "rimraf": "^6.1.4",
@@ -4,7 +4,9 @@ description: >-
4
4
  Use when installing @pawover/kit or choosing between the root package, a
5
5
  standalone subpackage, and a subpath such as @pawover/kit/utils,
6
6
  @pawover/kit/hooks/react, @pawover/kit/types/global,
7
- @pawover/kit/eslint-rules, or @pawover/kit/zod; also use when an import fails
7
+ @pawover/kit/eslint-rules, @pawover/kit/oxlint-rules,
8
+ @pawover/kit/vite-plugins, @pawover/kit/vite-plugins/naive-ui-css-layer,
9
+ or @pawover/kit/zod; also use when an import fails
8
10
  because the root entry only re-exports @pawover/kit-utils, the hooks root
9
11
  export is empty, or an optional peer dependency is missing.
10
12
  metadata:
@@ -24,9 +26,9 @@ sources:
24
26
  # Choose a `@pawover/kit` entry point
25
27
 
26
28
  `@pawover/kit` is a thin re-export package. Its root `.` entry only re-exports
27
- `@pawover/kit-utils`; types, hooks, the ESLint preset, and Zod schemas are
28
- published through subpaths. The five standalone subpackages are also published
29
- separately.
29
+ `@pawover/kit-utils`; types, hooks, the ESLint / Oxlint presets, the Vite plugins,
30
+ and Zod schemas are published through subpaths. The seven standalone subpackages
31
+ are also published separately.
30
32
 
31
33
  ## Setup
32
34
 
@@ -51,6 +53,7 @@ feature you use:
51
53
  | Alova hooks | `alova` + the framework package for your `statesHook` (`react`, `vue`, …) |
52
54
  | Math utilities (`MathUtil`, `CurrencyUtil.toRealValue`) | `mathjs` |
53
55
  | Vite proxy utility (`ViteUtil.toProxy`) | `vite` |
56
+ | Vite plugins (`@pawover/kit/vite-plugins`) | `vite` |
54
57
  | Zod schemas | `zod` |
55
58
 
56
59
  ```sh
@@ -84,7 +87,10 @@ pnpm add zod
84
87
  | `@pawover/kit/types/react/global` | Type-only React ambient entry; configure it in `tsconfig.types` |
85
88
  | `@pawover/kit/hooks/react` | React hooks |
86
89
  | `@pawover/kit/hooks/alova` | Alova hooks |
87
- | `@pawover/kit/eslint-rules` | ESLint flat config preset |
90
+ | `@pawover/kit/eslint-rules` | ESLint flat config preset (named export `pawoverESLint`) |
91
+ | `@pawover/kit/oxlint-rules` | Pure-native Oxlint preset (named exports `pawoverOxlint` / `generateOxlintConfig`) |
92
+ | `@pawover/kit/vite-plugins` | Vite plugins: CSS `@layer` order injection (`createPluginCssLayerOrder`) and asset type generation (`createPluginAutoAssets`) |
93
+ | `@pawover/kit/vite-plugins/naive-ui-css-layer` | naive-ui css-render layering runtime (`installNaiveUiCssLayer` / `createNaiveUiCssLayerPlugin`) |
88
94
  | `@pawover/kit/zod` | Prebuilt Zod v4 schemas |
89
95
 
90
96
  ```ts
@@ -92,7 +98,8 @@ import { TypeUtil, TreeUtil } from "@pawover/kit/utils";
92
98
  import { useMount } from "@pawover/kit/hooks/react";
93
99
  import { useAlovaRequest } from "@pawover/kit/hooks/alova";
94
100
  import type { AnyObject } from "@pawover/kit/types";
95
- import pawover from "@pawover/kit/eslint-rules";
101
+ import { pawoverESLint } from "@pawover/kit/eslint-rules";
102
+ import { pawoverOxlint } from "@pawover/kit/oxlint-rules";
96
103
  import { id } from "@pawover/kit/zod";
97
104
 
98
105
  const value: AnyObject = { enabled: true };
@@ -133,9 +140,11 @@ project.
133
140
 
134
141
  ### ESM and CJS
135
142
 
136
- Most packages publish both ESM and CJS. `@pawover/kit-eslint-rules` is ESM-only;
137
- CommonJS consumers load it through Node's `require(esm)` support. Use `import`
138
- in new code unless the surrounding tool requires `require`.
143
+ Most packages publish both ESM and CJS. `@pawover/kit-eslint-rules` and
144
+ `@pawover/kit-oxlint-rules` are ESM-only; CommonJS consumers load them through
145
+ Node's `require(esm)` support and read the named exports, for example
146
+ `require("@pawover/kit/eslint-rules").pawoverESLint`. Use `import` in new code
147
+ unless the surrounding tool requires `require`.
139
148
 
140
149
  ## Common mistakes
141
150
 
@@ -157,18 +166,18 @@ import { useAlovaRequest } from "@pawover/kit/hooks/alova";
157
166
 
158
167
  ### Expecting the root `.` entry to export everything
159
168
 
160
- The root entry only re-exports `@pawover/kit-utils`. `id`, `pawover`, `useMount`,
161
- and `AnyObject` must come from their subpaths:
169
+ The root entry only re-exports `@pawover/kit-utils`. `id`, `pawoverESLint`,
170
+ `useMount`, and `AnyObject` must come from their subpaths:
162
171
 
163
172
  ```ts no-check
164
- import { id, pawover, useMount } from "@pawover/kit";
173
+ import { id, pawoverESLint, useMount } from "@pawover/kit";
165
174
  ```
166
175
 
167
176
  Use:
168
177
 
169
178
  ```ts
170
179
  import { id } from "@pawover/kit/zod";
171
- import pawover from "@pawover/kit/eslint-rules";
180
+ import { pawoverESLint } from "@pawover/kit/eslint-rules";
172
181
  import { useMount } from "@pawover/kit/hooks/react";
173
182
  ```
174
183