react-devbelt 0.1.0 → 0.3.0
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 +37 -5
- package/dist/{chunk-UBSHMGMV.js → chunk-GB5T3MS2.js} +28 -14
- package/dist/chunk-GB5T3MS2.js.map +1 -0
- package/dist/cli.js +2174 -0
- package/dist/core.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/install.js +1 -1
- package/dist/plugins.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/{toolbar-entry-XIOWCGBL.js → toolbar-entry-QHIQKNOO.js} +9 -7
- package/dist/toolbar-entry-QHIQKNOO.js.map +1 -0
- package/package.json +6 -1
- package/dist/chunk-UBSHMGMV.js.map +0 -1
- package/dist/toolbar-entry-XIOWCGBL.js.map +0 -1
package/README.md
CHANGED
|
@@ -35,13 +35,36 @@ It floats over your app. It lives in a **shadow root** with its own stylesheet:
|
|
|
35
35
|
|
|
36
36
|
## 📦 Install
|
|
37
37
|
|
|
38
|
+
Needs React 19+. Built on [ui-sdk](https://ui-sdk.dev) and bundles it. Nothing else to install.
|
|
39
|
+
|
|
40
|
+
### 🚀 Get started (npx)
|
|
41
|
+
|
|
42
|
+
From your project's folder:
|
|
43
|
+
|
|
38
44
|
```bash
|
|
39
|
-
|
|
45
|
+
npx react-devbelt init
|
|
40
46
|
```
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
It reads your project (Next.js App or Pages Router, Vite, Create React App), installs `react-devbelt` with the package manager your lockfile uses, and wires up the toolbar. It asks which opt-in tools to add (Storage, Breakpoint, Capture); pick any and it writes a `devbelt.tsx` that holds the plugin list. It shows every file it will touch and asks first. Anything it can't edit safely, it tells you to do by hand.
|
|
49
|
+
|
|
50
|
+
| Flag | What it does |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `-y`, `--yes` | Skip the questions and accept the plan |
|
|
53
|
+
| `--plugins storage,capture` | Choose opt-in tools without the picker (`none` for no extras) |
|
|
54
|
+
| `--skip-install` | Only edit files, don't install the package |
|
|
55
|
+
| `--cwd <dir>` | Run in another folder |
|
|
56
|
+
|
|
57
|
+
Running it again is safe: it only changes what isn't set up yet.
|
|
43
58
|
|
|
44
|
-
|
|
59
|
+
To update later:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx react-devbelt upgrade
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
It moves `react-devbelt`, and `devbelt-plugin-tanstack-query` if you use it, to the latest version with your package manager, keeping each in its section of `package.json`. It shows what will change, links the changelog when a release may break (any minor bump while on `0.x`), and asks first. `-y` and `--cwd` work here too.
|
|
66
|
+
|
|
67
|
+
### 🤖 Agent installation
|
|
45
68
|
|
|
46
69
|
Paste this into Claude Code, Cursor, Codex or any coding agent, from your project's folder. It sets up the default toolbar and leaves the rest alone.
|
|
47
70
|
|
|
@@ -54,12 +77,21 @@ Install react-devbelt, a dev-only toolbar, in this project. Docs: https://github
|
|
|
54
77
|
- Next.js 16.3 or newer: in next.config.ts, wrap the exported config with `withDevBelt` from "react-devbelt/next". In the root layout (app/layout.tsx or src/app/layout.tsx), render `<DevBelt />` from "react-devbelt" once, inside <body> after {children}.
|
|
55
78
|
- Next.js 15 or older: skip withDevBelt. Add `import "react-devbelt/install";` to instrumentation-client.ts (Next 15.3+; create it at the project root, or in src/ if the project uses src/) or to the top of a client entry. Render <DevBelt /> in the root layout as above.
|
|
56
79
|
- Vite, Create React App or any other React app: make `import "react-devbelt/install";` the first import of the entry file (for example src/main.tsx), and render <DevBelt /> next to <App />.
|
|
57
|
-
4.
|
|
58
|
-
5.
|
|
80
|
+
4. Look for other dev tools this toolbar can replace: @tanstack/react-query-devtools, react-grab, react-scan, eruda, vconsole, a React Query or Redux devtools panel, or similar. List what you find with the file where each is mounted, then ask me whether to remove each one or keep it. Do not remove anything until I answer. If I say remove, delete the import, the mounted component and the dependency.
|
|
81
|
+
5. Keep every other setting and file as it is. Do not wrap <DevBelt /> in an environment check: it renders nothing on the server and in production builds by itself.
|
|
82
|
+
6. Run the type check, start the dev server, and open the app. Confirm the toolbar shows at the bottom of the page. Then tell me which files you changed. Do not commit.
|
|
59
83
|
```
|
|
60
84
|
|
|
61
85
|
Want the opt-in tools (`storage()`, `breakpoint()`, `capture()`) later? Ask the agent to follow [Choosing and configuring plugins](#-choosing-and-configuring-plugins).
|
|
62
86
|
|
|
87
|
+
### 🔧 Manual installation
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm install -D react-devbelt
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Then set it up for your framework in the Next.js or React sections below. To pick tools or tune them, see [Choosing and configuring plugins](#-choosing-and-configuring-plugins).
|
|
94
|
+
|
|
63
95
|
## ▲ Next.js (16.3+)
|
|
64
96
|
|
|
65
97
|
```ts
|
|
@@ -1350,9 +1350,20 @@ var STATUS_TEXT = {
|
|
|
1350
1350
|
504: "Gateway Timeout"
|
|
1351
1351
|
};
|
|
1352
1352
|
var MAX_COPY_BODY = 2e4;
|
|
1353
|
+
function entryMatches(entry, needle) {
|
|
1354
|
+
if (!needle) return true;
|
|
1355
|
+
const has = (text3) => text3 != null && text3.toLowerCase().includes(needle);
|
|
1356
|
+
const hasHeader = (headers) => Object.entries(headers).some(
|
|
1357
|
+
([name, value]) => has(name) || has(value) || has(`${name}: ${value}`)
|
|
1358
|
+
);
|
|
1359
|
+
return has(`${entry.method} ${entry.url} ${entry.status ?? ""}`) || has(entry.requestBody) || has(entry.responseBody) || hasHeader(entry.requestHeaders) || hasHeader(entry.responseHeaders);
|
|
1360
|
+
}
|
|
1353
1361
|
function isFailedEntry(entry) {
|
|
1354
1362
|
return entry.status === 0 || (entry.status ?? 0) >= 400;
|
|
1355
1363
|
}
|
|
1364
|
+
function statusReason(status) {
|
|
1365
|
+
return STATUS_TEXT[status];
|
|
1366
|
+
}
|
|
1356
1367
|
function statusText(entry) {
|
|
1357
1368
|
if (entry.status === null) return "pending";
|
|
1358
1369
|
if (entry.status === 0)
|
|
@@ -2092,7 +2103,7 @@ function forwardToTop(name) {
|
|
|
2092
2103
|
|
|
2093
2104
|
// src/ui/more-menu.tsx
|
|
2094
2105
|
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2095
|
-
var menuContentClass = "m-0 max-h-(--available-height) min-w-56 scrollbar-slim overflow-y-auto rounded-xl border border-line bg-surface p-1 text-xs text-fg shadow-2xl";
|
|
2106
|
+
var menuContentClass = "m-0 max-h-(--available-height) min-w-56 scrollbar-slim scroll-fade overflow-y-auto rounded-xl border border-line bg-surface p-1 text-xs text-fg shadow-2xl";
|
|
2096
2107
|
var menuLabelClass = "px-2 pt-1.5 pb-1 text-[10px] tracking-wide text-fg-tertiary uppercase";
|
|
2097
2108
|
var menuItemClass = "relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 outline-none";
|
|
2098
2109
|
var menuIndicatorClass = "inline-flex size-3.5 items-center justify-center data-unchecked:invisible";
|
|
@@ -2513,7 +2524,7 @@ function ConsolePanel() {
|
|
|
2513
2524
|
/* @__PURE__ */ jsx9(
|
|
2514
2525
|
"div",
|
|
2515
2526
|
{
|
|
2516
|
-
className: `min-h-0 scrollbar-slim overflow-auto ${selected ? "max-h-[40%] shrink-0 border-b border-line" : "flex-1"}`,
|
|
2527
|
+
className: `min-h-0 scrollbar-slim scroll-fade overflow-auto ${selected ? "max-h-[40%] shrink-0 border-b border-line" : "flex-1"}`,
|
|
2517
2528
|
children: visible.length === 0 ? /* @__PURE__ */ jsx9("p", { className: "p-3 text-fg-tertiary", children: entries.length === 0 ? "Nothing logged. console.error, console.warn and uncaught errors show up here." : "Nothing at this level." }) : /* @__PURE__ */ jsx9(
|
|
2518
2529
|
Listbox,
|
|
2519
2530
|
{
|
|
@@ -2530,7 +2541,7 @@ function ConsolePanel() {
|
|
|
2530
2541
|
] });
|
|
2531
2542
|
}
|
|
2532
2543
|
function EntryDetail({ entry }) {
|
|
2533
|
-
return /* @__PURE__ */ jsxs5("div", { className: "min-h-0 flex-1 scrollbar-slim overflow-auto p-3", children: [
|
|
2544
|
+
return /* @__PURE__ */ jsxs5("div", { className: "min-h-0 flex-1 scrollbar-slim scroll-fade overflow-auto p-3", children: [
|
|
2534
2545
|
/* @__PURE__ */ jsxs5("div", { className: "mb-2 flex items-start gap-2", children: [
|
|
2535
2546
|
/* @__PURE__ */ jsxs5("p", { className: "min-w-0 flex-1 text-fg-secondary", children: [
|
|
2536
2547
|
entry.viewport,
|
|
@@ -4060,7 +4071,7 @@ function DisplayPanel({
|
|
|
4060
4071
|
const [locale, setLocale] = useState4(
|
|
4061
4072
|
() => localeOptions ? readLocale(localeOptions) : ""
|
|
4062
4073
|
);
|
|
4063
|
-
return /* @__PURE__ */ jsxs7("div", { className: "min-h-0 flex-1 scrollbar-slim overflow-auto p-3", children: [
|
|
4074
|
+
return /* @__PURE__ */ jsxs7("div", { className: "min-h-0 flex-1 scrollbar-slim scroll-fade overflow-auto p-3", children: [
|
|
4064
4075
|
/* @__PURE__ */ jsxs7("label", { className: rowClass, children: [
|
|
4065
4076
|
/* @__PURE__ */ jsxs7("span", { children: [
|
|
4066
4077
|
"Rotate",
|
|
@@ -5780,7 +5791,7 @@ function Body({ value, title }) {
|
|
|
5780
5791
|
),
|
|
5781
5792
|
/* @__PURE__ */ jsx22(DialogClose, { "aria-label": "Close", className: iconButtonClass, children: /* @__PURE__ */ jsx22(XIcon, { className: "size-3.5", "aria-hidden": "true" }) })
|
|
5782
5793
|
] }),
|
|
5783
|
-
/* @__PURE__ */ jsx22("div", { className: "min-h-0 flex-1 scrollbar-slim overflow-auto p-4 [&_pre]:text-[13px]", children: /* @__PURE__ */ jsx22(JsonCode, { code: text3 }) })
|
|
5794
|
+
/* @__PURE__ */ jsx22("div", { className: "min-h-0 flex-1 scrollbar-slim scroll-fade overflow-auto p-4 [&_pre]:text-[13px]", children: /* @__PURE__ */ jsx22(JsonCode, { code: text3 }) })
|
|
5784
5795
|
]
|
|
5785
5796
|
}
|
|
5786
5797
|
)
|
|
@@ -5955,7 +5966,10 @@ function EntryDetail2({ entry }) {
|
|
|
5955
5966
|
" ",
|
|
5956
5967
|
entry.url,
|
|
5957
5968
|
/* @__PURE__ */ jsxs12("span", { className: "block text-fg-tertiary", children: [
|
|
5958
|
-
/* @__PURE__ */
|
|
5969
|
+
/* @__PURE__ */ jsxs12("span", { className: statusClass(entry), children: [
|
|
5970
|
+
statusLabel(entry),
|
|
5971
|
+
entry.status ? ` ${statusReason(entry.status) ?? ""}`.trimEnd() : ""
|
|
5972
|
+
] }),
|
|
5959
5973
|
entry.duration != null ? ` \xB7 ${entry.duration}ms` : "",
|
|
5960
5974
|
` \xB7 ${new Date(entry.startedAt).toLocaleTimeString()}`
|
|
5961
5975
|
] })
|
|
@@ -5976,12 +5990,12 @@ function EntryDetail2({ entry }) {
|
|
|
5976
5990
|
]
|
|
5977
5991
|
}
|
|
5978
5992
|
),
|
|
5979
|
-
/* @__PURE__ */ jsx22(TabsPanel, { value: "request", className: "min-h-0 flex-1 scrollbar-slim overflow-auto p-3", children: /* @__PURE__ */ jsx22(Body, { value: entry.requestBody, title: `Request body \xB7 ${name}` }) }),
|
|
5993
|
+
/* @__PURE__ */ jsx22(TabsPanel, { value: "request", className: "min-h-0 flex-1 scrollbar-slim scroll-fade overflow-auto p-3", children: /* @__PURE__ */ jsx22(Body, { value: entry.requestBody, title: `Request body \xB7 ${name}` }) }),
|
|
5980
5994
|
/* @__PURE__ */ jsx22(
|
|
5981
5995
|
TabsPanel,
|
|
5982
5996
|
{
|
|
5983
5997
|
value: "response",
|
|
5984
|
-
className: "min-h-0 flex-1 scrollbar-slim overflow-auto p-3",
|
|
5998
|
+
className: "min-h-0 flex-1 scrollbar-slim scroll-fade overflow-auto p-3",
|
|
5985
5999
|
children: /* @__PURE__ */ jsx22(Body, { value: entry.responseBody, title: `Response body \xB7 ${name}` })
|
|
5986
6000
|
}
|
|
5987
6001
|
),
|
|
@@ -5989,7 +6003,7 @@ function EntryDetail2({ entry }) {
|
|
|
5989
6003
|
TabsPanel,
|
|
5990
6004
|
{
|
|
5991
6005
|
value: "headers",
|
|
5992
|
-
className: "min-h-0 flex-1 space-y-3 scrollbar-slim overflow-auto p-3",
|
|
6006
|
+
className: "min-h-0 flex-1 space-y-3 scrollbar-slim scroll-fade overflow-auto p-3",
|
|
5993
6007
|
children: [
|
|
5994
6008
|
/* @__PURE__ */ jsx22("h3", { className: "font-medium text-fg-secondary", children: "Request" }),
|
|
5995
6009
|
/* @__PURE__ */ jsx22(HeaderList, { headers: entry.requestHeaders }),
|
|
@@ -6106,7 +6120,7 @@ function NetworkList({
|
|
|
6106
6120
|
/* @__PURE__ */ jsx22(
|
|
6107
6121
|
"div",
|
|
6108
6122
|
{
|
|
6109
|
-
className: `min-h-0 scrollbar-slim overflow-auto ${selectedOpen ? "max-h-[40%] shrink-0 border-b border-line" : "flex-1"}`,
|
|
6123
|
+
className: `min-h-0 scrollbar-slim scroll-fade overflow-auto ${selectedOpen ? "max-h-[40%] shrink-0 border-b border-line" : "flex-1"}`,
|
|
6110
6124
|
children: visible.length === 0 ? /* @__PURE__ */ jsx22("p", { className: "p-3 text-fg-tertiary", children: total === 0 ? "No requests yet. API calls show up here as they happen." : "No requests match the filter." }) : /* @__PURE__ */ jsx22(
|
|
6111
6125
|
Listbox,
|
|
6112
6126
|
{
|
|
@@ -6156,7 +6170,7 @@ function NetworkPanel() {
|
|
|
6156
6170
|
const visible = useMemo4(() => {
|
|
6157
6171
|
const needle = query.trim().toLowerCase();
|
|
6158
6172
|
return entries.filter(
|
|
6159
|
-
(e) => (!errorsOnly || isFailed(e)) && (methods.length === 0 || methods.includes(e.method)) && (
|
|
6173
|
+
(e) => (!errorsOnly || isFailed(e)) && (methods.length === 0 || methods.includes(e.method)) && entryMatches(e, needle)
|
|
6160
6174
|
);
|
|
6161
6175
|
}, [entries, query, errorsOnly, methods]);
|
|
6162
6176
|
const selected = selectedId ? entries.find((e) => String(e.id) === selectedId) ?? null : null;
|
|
@@ -6168,7 +6182,7 @@ function NetworkPanel() {
|
|
|
6168
6182
|
Input,
|
|
6169
6183
|
{
|
|
6170
6184
|
"aria-label": "Filter requests",
|
|
6171
|
-
placeholder: "
|
|
6185
|
+
placeholder: "Search URL, headers or bodies",
|
|
6172
6186
|
value: query,
|
|
6173
6187
|
onValueChange: (value) => setQuery(value),
|
|
6174
6188
|
className: "ms-auto h-7 w-56 min-w-0 rounded-md border border-line bg-hover-subtle px-2 text-xs text-fg placeholder:text-fg-disabled focus-visible:outline-2 focus-visible:outline-focus"
|
|
@@ -7625,7 +7639,7 @@ function StoragePanel({
|
|
|
7625
7639
|
error ? /* @__PURE__ */ jsx27("p", { role: "alert", className: "border-b border-line px-3 py-1 text-danger-fg", children: error }) : null,
|
|
7626
7640
|
store ? /* @__PURE__ */ jsxs16(Tabs, { value: store, onValueChange: selectStore, className: "flex min-h-0 flex-1 flex-col", children: [
|
|
7627
7641
|
/* @__PURE__ */ jsx27(TabsList, { "aria-label": "Stores", className: "flex gap-1 border-b border-line px-2 py-1.5", children: enabled.map((item) => /* @__PURE__ */ jsx27(TabsTab, { value: item, className: tabClass2, children: TITLE[item] }, item)) }),
|
|
7628
|
-
/* @__PURE__ */ jsx27(TabsPanel, { value: store, className: "min-h-0 flex-1 scrollbar-slim overflow-auto p-3", children: (() => {
|
|
7642
|
+
/* @__PURE__ */ jsx27(TabsPanel, { value: store, className: "min-h-0 flex-1 scrollbar-slim scroll-fade overflow-auto p-3", children: (() => {
|
|
7629
7643
|
const all = entries.filter((e) => e.store === store);
|
|
7630
7644
|
const needle = query.trim().toLowerCase();
|
|
7631
7645
|
const list = needle ? all.filter((e) => e.key.toLowerCase().includes(needle)) : all;
|
|
@@ -8013,4 +8027,4 @@ export {
|
|
|
8013
8027
|
storage,
|
|
8014
8028
|
defaultPlugins
|
|
8015
8029
|
};
|
|
8016
|
-
//# sourceMappingURL=chunk-
|
|
8030
|
+
//# sourceMappingURL=chunk-GB5T3MS2.js.map
|