@leadconnector/vibe-tagger 0.1.0 → 0.1.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.
- package/README.md +4 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,55 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Vite Plugin Component Tagger
|
|
2
2
|
|
|
3
|
-
Vite plugin that
|
|
3
|
+
A Vite plugin that automatically tags JSX/TSX components with source location metadata for easier debugging and tracking.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
9
|
-
# or
|
|
10
|
-
bun add -D vibe-tagger
|
|
11
|
-
# or
|
|
12
|
-
yarn add -D vibe-tagger
|
|
8
|
+
npm install @leadconnector/vibe-tagger
|
|
13
9
|
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
// vite.config.ts
|
|
19
|
-
import { defineConfig } from "vite";
|
|
20
|
-
import react from "@vitejs/plugin-react-swc";
|
|
21
|
-
import { componentTagger } from "vibe-tagger";
|
|
22
|
-
|
|
23
|
-
export default defineConfig(({ mode }) => ({
|
|
24
|
-
plugins: [
|
|
25
|
-
react(),
|
|
26
|
-
mode === "development" && componentTagger(),
|
|
27
|
-
].filter(Boolean),
|
|
28
|
-
}));
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## What it does
|
|
32
|
-
|
|
33
|
-
In development mode, the plugin intercepts React's `jsx-dev-runtime` to:
|
|
34
|
-
|
|
35
|
-
1. Attach `Symbol.for("__jsxSource__")` to every DOM element with `{ fileName, lineNumber, columnNumber, displayName }`
|
|
36
|
-
2. Maintain a global `window.sourceElementMap` (`Map<string, Set<WeakRef<Element>>>`) for fast source-to-element lookups
|
|
37
|
-
|
|
38
|
-
This enables visual editing tools to map clicked elements back to their source code location.
|
|
39
|
-
|
|
40
|
-
## API
|
|
41
|
-
|
|
42
|
-
### `componentTagger(options?): Plugin`
|
|
43
|
-
|
|
44
|
-
Returns a Vite plugin. Uses `enforce: "pre"` to run before other plugins.
|
|
45
|
-
|
|
46
|
-
#### Options
|
|
47
|
-
|
|
48
|
-
| Option | Type | Default | Description |
|
|
49
|
-
|--------|------|---------|-------------|
|
|
50
|
-
| `jsxSource` | `boolean` | `true` | Enable JSX source tagging |
|
|
51
|
-
| `debug` | `boolean` | `false` | Enable debug logging |
|
|
52
|
-
|
|
53
|
-
## License
|
|
54
|
-
|
|
55
|
-
MIT
|
package/package.json
CHANGED