How ultroned/xray-react works
X-Ray React is a development-time React layout inspector. A developer enables it through a Vite or Webpack plugin (or manual imports); the browser overlay exposes rendered component hierarchy, and selecting a component sends its path to a server that resolves and opens the source file in an editor. Source excerpts show plugin injection, scanning/mapping, client socket events, and editor resolution; detailed UI behavior and some server wiring are only partially sampled, so those links are included only where supported by excerpts or README statements.
Main entry points: webpack.js Webpack Plugin · vite.js Vite Plugin · ui-utils.js Inspector UI · server.js Standalone Server
Components 15
Bundler Integration
- Webpack Plugin
lib/plugins/webpack.js - Vite Plugin
lib/plugins/vite.js - Standalone Server
server.js
Project Mapping
- Source Scanner
lib/source-utils.js - Component Mapping
lib/source-utils.js
Browser Inspector
- Inspector UI
src/ui-utils.js - UI Partials
src/partials.js - Overlay Styles
src/css.js - UI Constants
src/constants.js - Socket Client
lib/xray-react-client.js
Source Opening
- Editor Launcher
lib/editor-utils.js
Other components
- Developer
- Socket.IO Service
- React Application
- Socket.IO CDN
Connections 26
- Developer → Webpack Plugin: configures
README.md - Developer → Vite Plugin: configures
README.md - Developer → Standalone Server: runs
README.md - Webpack Plugin → Source Scanner: scans sources
lib/plugins/webpack.js - Webpack Plugin → Component Mapping: builds maps
lib/plugins/webpack.js - Vite Plugin → Source Scanner: scans sources
lib/plugins/vite.js - Vite Plugin → Component Mapping: resolves components
lib/plugins/vite.js - Standalone Server → Source Scanner: scans sources
server.js - Standalone Server → Component Mapping: builds maps
server.js - Webpack Plugin → Inspector UI: injects UI
README.md - Vite Plugin → Inspector UI: injects UI
README.md - React Application → Inspector UI: renders with
- Inspector UI → UI Partials: uses markup
src/ui-utils.js - Inspector UI → Overlay Styles: uses styles
src/ui-utils.js - Inspector UI → UI Constants: uses constants
src/ui-utils.js - Webpack Plugin → Socket Client: injects client
lib/plugins/webpack.js - Vite Plugin → Socket Client: injects client
lib/plugins/vite.js - Developer → Socket Client: imports manually
README.md - Socket Client → Socket.IO CDN: loads library
lib/xray-react-client.js - Socket Client → Socket.IO Service: connects and emits
lib/xray-react-client.js - Standalone Server → Socket.IO Service: serves events
server.js - Webpack Plugin → Socket.IO Service: starts server
lib/plugins/webpack.js - Vite Plugin → Socket.IO Service: starts server
lib/plugins/vite.js - Standalone Server → Editor Launcher: opens resolved file
server.js - Webpack Plugin → Editor Launcher: opens resolved file
lib/plugins/webpack.js - Vite Plugin → Editor Launcher: opens resolved file
lib/plugins/vite.js