Skip to content

Commit f6c72ce

Browse files
committed
prep
1 parent 40ef6f3 commit f6c72ce

30 files changed

Lines changed: 626 additions & 131 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ jobs:
1515
node-version: 22
1616
cache: npm
1717
- run: npm install
18+
- run: npm run lint
1819
- run: npm run typecheck
1920
- run: npm run build

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"titleBar.inactiveBackground": "#5B1212",
77
"titleBar.inactiveForeground": "#FEFAFA"
88
}
9-
}
9+
}

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A modern, low-level React 19 inspector for Vite/Rolldown dev servers.
44

55
This repo contains:
66

7-
- `packages/react19-dev-inspector`the npm package (`vite-react-inspector`)
7+
- `packages/vite-react-inspector`source for the `vite-react-inspector` npm package
88
- `examples/basic-react19` — a Vite + React 19 example app
99

1010
The package is intentionally dev-only. It injects a tiny browser runtime into Vite dev pages, lets you toggle an inspector with a shortcut, highlights React-owned DOM nodes, resolves the selected component/source location through React 19 dev fiber stacks and Vite source maps, and opens your editor from a local dev-server endpoint.
@@ -30,27 +30,44 @@ npm run dev:example
3030

3131
Open the example app, press the shortcut, hover an element, and click a component/source candidate to open it in your editor.
3232

33-
## Install in another project (from GitHub)
33+
## Install
3434

35-
The published package name is `vite-react-inspector`, but the library lives under `packages/react19-dev-inspector` in this monorepo. Use a **path** on the git URL so the package manager installs that folder.
35+
From npm:
3636

37-
Repository: [github.com/ddcech/vite-react-inspector](https://github.com/ddcech/vite-react-inspector)
37+
```bash
38+
npm install -D vite-react-inspector
39+
```
40+
41+
From GitHub (monorepo; use **`path:`** so installs resolve `packages/vite-react-inspector`):
3842

3943
**pnpm** ([git install docs](https://pnpm.io/cli/add#install-from-git-repository)):
4044

4145
```bash
42-
pnpm add -D vite-react-inspector@github:ddcech/vite-react-inspector#path:packages/react19-dev-inspector
46+
pnpm add -D vite-react-inspector@github:ddcech/vite-react-inspector#path:packages/vite-react-inspector
4347
```
4448

4549
**npm** (7+; subdirectory support varies — if this fails, use pnpm or publish to npm):
4650

4751
```bash
48-
npm install -D vite-react-inspector@git+https://github.com/ddcech/vite-react-inspector.git#path:packages/react19-dev-inspector
52+
npm install -D vite-react-inspector@git+https://github.com/ddcech/vite-react-inspector.git#path:packages/vite-react-inspector
4953
```
5054

51-
Pin a branch or tag by putting it before `path:`, e.g. `#main:path:packages/react19-dev-inspector`.
55+
Pin a branch or tag by putting it before `path:`, e.g. `#main:path:packages/vite-react-inspector`.
56+
57+
Repository: [github.com/ddcech/vite-react-inspector](https://github.com/ddcech/vite-react-inspector).
58+
59+
Registry installs include built `dist/`. Git installs run `prepare` to build because `dist` is not in git.
60+
61+
After install, use the same `vite-react-inspector/vite` import as below.
62+
63+
**pnpm v10+:** If install fails with `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED`, allow the package to run scripts. In `pnpm-workspace.yaml` at the project (or monorepo) root:
64+
65+
```yaml
66+
onlyBuiltDependencies:
67+
- vite-react-inspector
68+
```
5269
53-
After install, use the same `vite-react-inspector/vite` import as below. The package `prepare` script builds `dist/` on install because `dist` is not committed.
70+
([docs](https://pnpm.io/settings#onlybuiltdependencies).)
5471
5572
## Package usage
5673

biome.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.4.13/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"includes": ["**", "!**/dist"]
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "space",
15+
"indentWidth": 2
16+
},
17+
"linter": {
18+
"enabled": true,
19+
"rules": {
20+
"recommended": true,
21+
"suspicious": {
22+
"noExplicitAny": "off"
23+
}
24+
}
25+
},
26+
"javascript": {
27+
"formatter": {
28+
"quoteStyle": "single",
29+
"semicolons": "asNeeded"
30+
}
31+
},
32+
"assist": {
33+
"enabled": true,
34+
"actions": {
35+
"source": {
36+
"organizeImports": "on"
37+
}
38+
}
39+
}
40+
}

examples/basic-react19/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
"@vitejs/plugin-react": "^5.0.0",
1212
"vite-react-inspector": "workspace:*",
1313
"vite": "^8.0.0",
14-
"typescript": "^5.9.0",
14+
"typescript": "^6.0.3",
1515
"react": "^19.2.0",
1616
"react-dom": "^19.2.0"
1717
},
18-
"devDependencies": {}
18+
"devDependencies": {
19+
"@types/react": "^19.2.0",
20+
"@types/react-dom": "^19.2.0"
21+
}
1922
}

examples/basic-react19/src/App.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ type Card = {
99
const cards: Card[] = [
1010
{
1111
title: 'React 19 stack path',
12-
description: 'The default path resolves component frames from React dev fiber stacks.',
12+
description:
13+
'The default path resolves component frames from React dev fiber stacks.',
1314
value: 'no Babel',
1415
},
1516
{
1617
title: 'Strict DOM source',
17-
description: 'Optional host element annotation gives exact TSX element locations.',
18+
description:
19+
'Optional host element annotation gives exact TSX element locations.',
1820
value: 'fast JSX scan',
1921
},
2022
{
2123
title: 'Vite server open',
22-
description: 'A local endpoint resolves source maps and opens your editor safely.',
24+
description:
25+
'A local endpoint resolves source maps and opens your editor safely.',
2326
value: 'dev only',
2427
},
2528
]
@@ -30,7 +33,11 @@ export function App() {
3033

3134
return (
3235
<main className="shell">
33-
<Hero count={count} doubled={doubled} onIncrement={() => setCount((value) => value + 1)} />
36+
<Hero
37+
count={count}
38+
doubled={doubled}
39+
onIncrement={() => setCount((value) => value + 1)}
40+
/>
3441
<section className="grid">
3542
{cards.map((card) => (
3643
<InfoCard key={card.title} card={card} />
@@ -40,16 +47,23 @@ export function App() {
4047
)
4148
}
4249

43-
function Hero(props: { count: number; doubled: number; onIncrement: () => void }) {
50+
function Hero(props: {
51+
count: number
52+
doubled: number
53+
onIncrement: () => void
54+
}) {
4455
return (
4556
<section className="hero">
4657
<p className="eyebrow">React 19 Dev Inspector</p>
4758
<h1>Press the shortcut, hover anything, and click through to source.</h1>
4859
<p className="lede">
49-
macOS: Ctrl + Shift + Command + C. Windows/Linux: Ctrl + Shift + Alt + C.
60+
macOS: Ctrl + Shift + Command + C. Windows/Linux: Ctrl + Shift + Alt +
61+
C.
5062
</p>
5163
<div className="actions">
52-
<button onClick={props.onIncrement}>Increment example state</button>
64+
<button type="button" onClick={props.onIncrement}>
65+
Increment example state
66+
</button>
5367
<span>
5468
count={props.count}, doubled={props.doubled}
5569
</span>

examples/basic-react19/src/main.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { createRoot } from 'react-dom/client'
33
import { App } from './App'
44
import './styles.css'
55

6-
createRoot(document.getElementById('root')!).render(
6+
const container = document.getElementById('root')
7+
if (!container) throw new Error('#root element not found')
8+
9+
createRoot(container).render(
710
<StrictMode>
811
<App />
912
</StrictMode>,

examples/basic-react19/src/styles.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
:root {
22
color: #111827;
33
background: #f8fafc;
4-
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
4+
font-family:
5+
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
6+
"Segoe UI", sans-serif;
57
}
68

79
* {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
"build": "npm -w vite-react-inspector run build",
1111
"dev:example": "npm -w basic-react19-inspector-example run dev",
1212
"typecheck": "npm -w vite-react-inspector run typecheck && npm -w basic-react19-inspector-example run typecheck",
13-
"verify": "node packages/react19-dev-inspector/scripts/verify-layout.mjs"
13+
"verify": "node packages/vite-react-inspector/scripts/verify-layout.mjs",
14+
"lint": "biome check .",
15+
"lint:fix": "biome check --write .",
16+
"format": "biome format --write ."
1417
},
1518
"devDependencies": {
19+
"@biomejs/biome": "^2.4.13",
1620
"@types/node": "^22.10.0",
17-
"typescript": "^5.9.0"
21+
"typescript": "^6.0.3"
1822
}
1923
}

0 commit comments

Comments
 (0)