Favivon - Correção

This commit is contained in:
2026-05-30 19:59:39 -03:00
parent 76ddaa815d
commit d7dfd221f0
32859 changed files with 5459654 additions and 404 deletions
+55
View File
@@ -0,0 +1,55 @@
## kimi-plugin-inspect-react
轻量的 Vite 插件,用于在 React 组件渲染的 DOM 上写入源码位置信息,便于在浏览器里定位到对应的文件和行列。
### 安装
```bash
pnpm add kimi-plugin-inspect-react -D
# 或 npm/yarn 均可
```
### 使用
```ts
import { defineConfig } from 'vite'
import { inspectAttr, inspectDom } from 'kimi-plugin-inspect-react'
export default defineConfig({
plugins: [
// 方式一:直接在 JSX 上插入 code-path 属性
inspectAttr(),
// 方式二:通过 ref 在真实 DOM 上写入 $codePath 属性
// inspectDom(),
],
})
```
默认仅在 `vite serve` 生效(`apply: "serve"`),构建时不会影响产物。
### 导出
- `import { inspectAttr } from 'kimi-plugin-inspect-react'`
- `import { inspectDom } from 'kimi-plugin-inspect-react/inspectDom'`
支持 ESM `.mjs` 与 CJS `.cjs`,并提供类型声明。
### 本地开发与构建
```bash
pnpm install
pnpm run build
```
产物输出到 `dist/`,包括:
- `inspectAttr.mjs` / `inspectAttr.cjs` 及类型声明
- `inspectDom.mjs` / `inspectDom.cjs` 及类型声明
### 版权与许可
本项目基于以下开源项目改进而来(保留原声明):
- @namnode/vite-plugin-inspect-react (MIT License - Copyright (c) 2024 Nam Nguyen)
- vite-plugin-react-inspector (MIT License)
本项目同样以 MIT License 授权。
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+18
View File
@@ -0,0 +1,18 @@
import { Node } from '@babel/core';
import { Plugin } from 'vite';
type Options = {
predicate?: (node: Node) => boolean;
base?: string;
};
/**
* 直接在 JSX 元素上添加 code-path 属性
*
* 示例:
* <div>Hello</div>
* ->
* <div code-path="src/App.tsx:1:1">Hello</div>
*/
declare function inspectAttr(options?: Options): Plugin;
export { inspectAttr };
+18
View File
@@ -0,0 +1,18 @@
import { Node } from '@babel/core';
import { Plugin } from 'vite';
type Options = {
predicate?: (node: Node) => boolean;
base?: string;
};
/**
* 直接在 JSX 元素上添加 code-path 属性
*
* 示例:
* <div>Hello</div>
* ->
* <div code-path="src/App.tsx:1:1">Hello</div>
*/
declare function inspectAttr(options?: Options): Plugin;
export { inspectAttr };
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+10
View File
@@ -0,0 +1,10 @@
import { Node } from '@babel/core';
import { Plugin } from 'vite';
type Options = {
predicate?: (node: Node) => boolean;
base?: string;
};
declare function inspectDom(options?: Options): Plugin;
export { inspectDom };
+10
View File
@@ -0,0 +1,10 @@
import { Node } from '@babel/core';
import { Plugin } from 'vite';
type Options = {
predicate?: (node: Node) => boolean;
base?: string;
};
declare function inspectDom(options?: Options): Plugin;
export { inspectDom };
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+60
View File
@@ -0,0 +1,60 @@
{
"name": "kimi-plugin-inspect-react",
"version": "1.0.3",
"description": "",
"type": "module",
"main": "./dist/inspectAttr.cjs",
"module": "./dist/inspectAttr.mjs",
"types": "./dist/inspectAttr.d.ts",
"exports": {
".": {
"types": "./dist/inspectAttr.d.ts",
"import": "./dist/inspectAttr.mjs",
"require": "./dist/inspectAttr.cjs"
},
"./inspectAttr": {
"types": "./dist/inspectAttr.d.ts",
"import": "./dist/inspectAttr.mjs",
"require": "./dist/inspectAttr.cjs"
},
"./inspectDom": {
"types": "./dist/inspectDom.d.ts",
"import": "./dist/inspectDom.mjs",
"require": "./dist/inspectDom.cjs"
}
},
"files": [
"dist",
"README.md"
],
"scripts": {
"build": "tsup",
"prepublishOnly": "pnpm run build"
},
"publishConfig": {
"registry": "https://dev.msh.team/api/v4/projects/1993/packages/npm/"
},
"keywords": [],
"author": "",
"license": "ISC",
"packageManager": "pnpm@10.8.1",
"dependencies": {
"@babel/core": "^7.23.0",
"@babel/plugin-proposal-decorators": "^7.23.0",
"@babel/preset-env": "^7.23.0",
"@babel/preset-react": "^7.23.0",
"@babel/preset-typescript": "^7.23.0",
"@babel/types": "^7.23.0",
"magic-string": "^0.30.0"
},
"devDependencies": {
"@types/babel__core": "^7.20.5",
"@types/node": "^20.0.0",
"tsup": "^8.0.0",
"typescript": "^5.0.0",
"vite": "^7.2.0"
},
"peerDependencies": {
"vite": "^7.2.0"
}
}