Observed since 21 Oct, 09:08 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0xminds/component-tagger
Vite plugin for tagging React/JSX components with design mode metadata
A Vite plugin that automatically adds metadata attributes to React/JSX components to enable Design Mode functionality in the 0xminds platform.
✅ Automatic Component Tagging: Adds unique IDs to every JSX element ✅ File & Line Tracking: Tracks source file and line number for each component ✅ TypeScript Support: Full TypeScript support with type definitions ✅ Smart Filtering: Excludes node_modules, dist, and UI library components ✅ Development-Only: Automatically disabled in production builds ✅ Zero Runtime Overhead: Pure build-time transformation ✅ Source Maps: Preserves source maps for debugging
npm install @0xminds/component-tagger --save-dev
Add the plugin to your vite.config.ts:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { componentTagger } from '@0xminds/component-tagger';
export default defineConfig({
plugins: [
react(),
componentTagger(), // Add this line
],
});
import { componentTagger } from '@0xminds/component-tagger';
export default defineConfig({
plugins: [
react(),
componentTagger({
enabled: true, // Force enable (default: auto-detect from mode)
debug: true, // Enable debug logging
include: ['**/*.{jsx,tsx}'], // Files to process
exclude: ['**/ui/**'], // Files to exclude
attributeName: 'data-0x-component-id', // Custom attribute name
}),
],
});
function MyComponent() {
return (
<div className="container">
<h1>Hello World</h1>
<Button variant="primary">Click Me</Button>
</div>
);
}
function MyComponent() {
return (
<div
data-0x-component-id="div_MyComponent_3_5"
data-0x-file="src/components/MyComponent.tsx"
data-0x-line="3"
data-0x-column="5"
data-0x-component="div"
data-0x-content="children"
className="container"
>
<h1
data-0x-component-id="h1_MyComponent_4_7"
data-0x-file="src/components/MyComponent.tsx"
data-0x-line="4"
data-0x-column="7"
data-0x-component="h1"
data-0x-content="static"
>
Hello World
</h1>
<Button
data-0x-component-id="Button_MyComponent_5_7"
data-0x-file="src/components/MyComponent.tsx"
data-0x-line="5"
data-0x-column="7"
data-0x-component="Button"
data-0x-content="static"
variant="primary"
>
Click Me
</Button>
</div>
);
}
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | auto | Enable/disable the plugin (auto = dev only) |
include | string[] | ['**/*.{jsx,tsx}'] | File patterns to include |
exclude | string[] | ['node_modules/**', 'dist/**', '**/ui/**'] | File patterns to exclude |
attributeName | string | 'data-0x-component-id' | Main attribute name |
includeFilePath | boolean | true | Add file path attribute |
includeLineNumber | boolean | true | Add line number attribute |
rootDir | string | process.cwd() | Root directory for relative paths |
debug | boolean | false | Enable debug logging |
Each tagged component receives the following attributes:
data-0x-component-id: Unique identifier (format: ComponentName_FileName_Line_Column)data-0x-file: Relative file path from project rootdata-0x-line: Line number in source filedata-0x-column: Column number in source filedata-0x-component: Component/element namedata-0x-content: Content type (static | dynamic | empty | children)| Type | Description | Example |
|---|---|---|
static | Static text content | <h1>Hello World</h1> |
dynamic | Dynamic/variable content | <h1>{title}</h1> |
empty | No text content | <div /> or <img src="..." /> |
children | Contains child elements | <div><span>...</span></div> |
This plugin is designed for:
mode is set to 'development' in Vite configinclude patterns and not in excludedebug: true to see transformation logsMake sure:
node_modules, dist, ui)rm -rf node_modules/.viteInstall type definitions:
npm install --save-dev @types/babel__core @types/babel__traverse
See the examples/ directory for complete working examples:
Contributions welcome! Please read CONTRIBUTING.md first.
MIT © 0xminds
Made with ❤️ by the 0xminds team
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@babel/typesEnvironment{
"local_name": "@babel/types",
"alias": false,
"peer_metadata": null
} | ^7.25.8 | runtime |
magic-stringEnvironment{
"local_name": "magic-string",
"alias": false,
"peer_metadata": null
} | ^0.30.12 | runtime |
@babel/parserEnvironment{
"local_name": "@babel/parser",
"alias": false,
"peer_metadata": null
} | ^7.25.9 | runtime |
@babel/traverseEnvironment{
"local_name": "@babel/traverse",
"alias": false,
"peer_metadata": null
} | ^7.25.9 | runtime |
tsupEnvironment{
"local_name": "tsup",
"alias": false,
"peer_metadata": null
} | ^8.0.0 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^5.5.3 | development |
@types/nodeEnvironment{
"local_name": "@types/node",
"alias": false,
"peer_metadata": null
} | ^22.5.5 | development |
@types/babel__coreEnvironment{
"local_name": "@types/babel__core",
"alias": false,
"peer_metadata": null
} | ^7.20.5 | development |
@types/babel__traverseEnvironment{
"local_name": "@types/babel__traverse",
"alias": false,
"peer_metadata": null
} | ^7.20.6 | development |
viteEnvironment{
"local_name": "vite",
"alias": false,
"peer_metadata": null
} | >=5.0.0 | peer |
Source distribution
{
"shasum": "430b31201f78452208a221274e43d213e355175f",
"tarball": "https://registry.npmjs.org/@0xminds/component-tagger/-/component-tagger-1.0.1.tgz",
"fileCount": 6,
"integrity": "sha512-wOkrgpIGoEFMfqbp8VadbtnwDwuxdzA2HY8aLRrUrc0wU9HKNl6ltTLpN0Tmh9VN7RBWV+76I0lASFMtcoSkdw==",
"signatures": [
{
"sig": "MEUCIQDz74tuwvzEp06zF2FTEzz75f1K3cWwxw0fRV9UchRI6wIgEhafFrpqUiJrd6E32Fwyu0KHHcxa5jiibTcskfkQ9aU=",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
}
],
"unpackedSize": 23943
}Observed since 21 Oct, 09:08 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:f3d486e5cc7a202a68fee6a26b2ef5541ae3f8370b0ca422cb1d2d80a21788a3