@scayle/storefront-devtools 0.2.0-alpha.4 → 0.2.0-alpha.5
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/CHANGELOG.md +17 -0
- package/README.md +152 -110
- package/dist/_chunks/{coalesce-D-Q8NzYg.mjs → coalesce-MEMOF7Fy.mjs} +37 -54
- package/dist/index.mjs +7 -14
- package/dist/inertia/client/index.mjs +139 -165
- package/dist/inertia/core/capture.d.ts.map +1 -1
- package/dist/inertia/core/correlator.d.ts +9 -0
- package/dist/inertia/core/correlator.d.ts.map +1 -1
- package/dist/inertia/core/diff.d.ts.map +1 -1
- package/dist/inertia/core/feature-info.d.ts +9 -5
- package/dist/inertia/core/feature-info.d.ts.map +1 -1
- package/dist/inertia/core/features.d.ts.map +1 -1
- package/dist/inertia/core/history-capture.d.ts.map +1 -1
- package/dist/inertia/core/interceptors.d.ts.map +1 -1
- package/dist/inertia/core/markdown.d.ts.map +1 -1
- package/dist/inertia/core/store.d.ts.map +1 -1
- package/dist/inertia/core/types.d.ts +0 -1
- package/dist/inertia/core/types.d.ts.map +1 -1
- package/dist/orpc/client/index.mjs +98 -99
- package/dist/shared/redact.d.ts +4 -2
- package/dist/shared/redact.d.ts.map +1 -1
- package/dist/shared/safe-clone.d.ts +2 -1
- package/dist/shared/safe-clone.d.ts.map +1 -1
- package/dist/ui/assets/App-25PW_NzC.css +1 -0
- package/dist/ui/assets/App-BHsYAu8T.js +4 -0
- package/dist/ui/assets/{App-jiQKInbo.css → App-BqkxhJv0.css} +1 -1
- package/dist/ui/assets/App-CQ-b0jtB.js +5 -0
- package/dist/ui/assets/{App-Ctfis9Sq.js → App-DAtQapox.js} +1 -1
- package/dist/ui/assets/clipboard-Df0gl3GP.js +1 -0
- package/dist/ui/assets/{clipboard-BnEeWyfh.css → clipboard-sKCUppVL.css} +1 -1
- package/dist/ui/assets/panel-channel-BUrhmfqu.js +2 -0
- package/dist/ui/assets/panels-8x4hQPoN.css +1 -0
- package/dist/ui/assets/panels-C4yKz6cQ.js +2 -0
- package/dist/ui/assets/preload-helper-DLPYjEaE.js +2 -0
- package/dist/ui/assets/vue-CEnfmNPK.js +155 -0
- package/dist/ui/panels/index.html +3 -3
- package/dist/ui/vue/index.html +2 -2
- package/dist/vue-devtools/client/index.mjs +7 -42
- package/package.json +15 -14
- package/dist/ui/assets/App-BMyWBnLQ.js +0 -4
- package/dist/ui/assets/App-C5-JscO0.css +0 -1
- package/dist/ui/assets/App-CCUPtzNx.js +0 -5
- package/dist/ui/assets/clipboard-BY7CN-yK.js +0 -1
- package/dist/ui/assets/panel-channel-qxy-vGGq.js +0 -2
- package/dist/ui/assets/panels-B4LTsmli.css +0 -1
- package/dist/ui/assets/panels-BcOW2Xog.js +0 -2
- package/dist/ui/assets/preload-helper-CSlQMSTd.js +0 -2
- package/dist/ui/assets/vue-C0gCEhF7.js +0 -155
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @scayle/storefront-devtools
|
|
2
2
|
|
|
3
|
+
## 0.2.0-alpha.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The Inertia panel's feature badges take their display text from the shared feature description table instead of a duplicated `label` field on each detected feature.
|
|
8
|
+
- The documentation link in a feature badge tooltip of the Inertia panel can be reached with the keyboard.
|
|
9
|
+
- Credentials no longer show up in captured Inertia data. Page props, flash data, form data and request headers are now redacted the same way as in the oRPC panel, including in "Copy as Markdown" and in the saved previous session. Keys such as `password`, `token`, `apiKey` and `cookie` appear as `[redacted]`, and header names follow the same rule, in both panels. Validation error messages keep their text in the `inertia:error` event, even for a field called `password`. The error bag in the page props of a response is still redacted by key.
|
|
10
|
+
- The detail view of a request in the Inertia panel and of a call in the oRPC panel resets, including "Show changes since last page" and expanded rows, when you select another one.
|
|
11
|
+
- Diagnostics in the Inertia panel now link to their documentation.
|
|
12
|
+
- The Inertia panel now assigns page and error events to the visit that produced them. Before, overlapping visits to different URLs could end up on the wrong request.
|
|
13
|
+
- The Inertia panel keeps at most 100 captured events per request, and the oldest upload progress events drop first. Long uploads no longer grow a request without limit or lose its start event.
|
|
14
|
+
- A visit that ends without writing browser history, such as a `409` location redirect or a network error, no longer hides the next client-side visit in the Inertia panel. Overlapping visits and concurrent deferred reloads keep their own history writes apart, and `router.remember()` no longer uses up the history write of a visit that is still running.
|
|
15
|
+
- The tabs of the Inertia and oRPC panels follow the WAI-ARIA tabs pattern. The arrow keys, Home and End move between tabs, and only the selected tab is in the tab order. Pause and Clear no longer sit inside the tablist.
|
|
16
|
+
- The oRPC and Inertia panels now share one Headers tab. The tab looks the same, except that its empty message reads "No headers captured." in both panels instead of naming a call or a request.
|
|
17
|
+
- Updates `@vitejs/devtools` and `@vitejs/devtools-kit` to 0.8.0. Vite lists 0.8 as a supported `@vitejs/devtools` version from 8.3.5 on, so use Vite 8.3.5 or newer with the dock. The package also moves to `devframe` 1.2.6, which `@vitejs/devtools` 0.8.0 expects.
|
|
18
|
+
- Clean up findings from the type-aware lint rules. Removes type assertions and non-null assertions the compiler no longer needs, drops a few redundant `null` checks, and replaces `String.prototype.match` with `RegExp.prototype.exec` for non-global patterns. No change in behavior.
|
|
19
|
+
|
|
3
20
|
## 0.2.0-alpha.4
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -18,29 +18,41 @@
|
|
|
18
18
|
|
|
19
19
|
## Overview
|
|
20
20
|
|
|
21
|
-
`@scayle/storefront-devtools` is a dev-only Vite plugin. It hosts the Vite DevTools dock and registers two dock groups
|
|
21
|
+
`@scayle/storefront-devtools` is a dev-only Vite plugin. It hosts the Vite DevTools dock and registers two dock groups:
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- The Storefront context panel is a read-only view of the resolved shop, country, locale, and session for the page you're looking at, taken from the Inertia page the SDK ships. The [Storefront context panel](#storefront-context-panel) section covers it.
|
|
26
|
-
- The Vue panel gives you the component tree and timeline in the same dock, so you don't need a separate `vite-plugin-vue-devtools` install.
|
|
23
|
+
- **SCAYLE Storefront** with the Inertia.js, oRPC, and Storefront entries.
|
|
24
|
+
- **Vue** with the Components and Timeline entries.
|
|
27
25
|
|
|
28
|
-
The
|
|
26
|
+
The panels cover these jobs:
|
|
27
|
+
|
|
28
|
+
- The [Inertia.js panel](#inertiajs-panel) lists every visit your app makes. It shows the response props, the headers, the Inertia protocol details, a lifecycle timeline, and the changes since the last page. It also flags common mistakes, such as a prop you asked for with `only` that the response left out.
|
|
29
|
+
- The [oRPC panel](#orpc-panel) lists every call to your `/api` endpoint. It decodes each `{ json, meta }` envelope back to the typed input and output, groups calls by procedure, and classifies failures.
|
|
30
|
+
- The [Storefront context panel](#storefront-context-panel) shows the shop, country, locale, and session the app resolved for the current page.
|
|
31
|
+
- The [Vue panels](#vue-panels) give you the component tree and the timeline, so you don't need a separate `vite-plugin-vue-devtools`.
|
|
32
|
+
|
|
33
|
+
The plugin runs on the dev server only. [Production safety](#production-safety) explains why a build carries none of it.
|
|
29
34
|
|
|
30
35
|
## Beyond the browser Network tab
|
|
31
36
|
|
|
32
|
-
Use the
|
|
37
|
+
Use the Network tab for raw HTTP. The panels cover what it can't show.
|
|
38
|
+
|
|
39
|
+
- Many Inertia visits never touch the network. The initial page load embeds the page object in the HTML, and client-side history navigations and prefetch cache hits send no request. The Inertia.js panel reads them from Inertia's DOM events and from the history API.
|
|
40
|
+
- The Network tab shows one request at a time. The Inertia.js panel compares visits. It diffs the props of consecutive visits, nests a deferred-prop reload under the visit that triggered it, and draws the lifecycle events on a timeline.
|
|
41
|
+
- An oRPC request body isn't the argument your code passed. Every oRPC call is a `POST` under `/api` with a `{ json, meta }` envelope, and JSON can't represent the `Date`, `Map`, `Set`, or `BigInt` values it encodes. The oRPC panel decodes the envelope back to the value your handler received.
|
|
42
|
+
- oRPC calls get lost between the images, scripts, and page visits a storefront loads. The oRPC panel lists only those calls, adds up the timing per procedure, and labels each failure as a validation, server, or network error.
|
|
33
43
|
|
|
34
|
-
|
|
35
|
-
- The Inertia.js panel compares visits. It diffs the props of consecutive visits, links a deferred-prop reload to the visit that triggered it, and draws the lifecycle event timeline. The Network tab shows one request at a time and forgets the one before.
|
|
36
|
-
- An oRPC request body isn't the argument your code passed. Every oRPC call is a `POST` under `/api` with a `{ json, meta }` envelope. The Network tab shows that envelope as raw JSON and can't rebuild the `Date`, `Map`, `Set`, or `BigInt` values it encodes, because JSON has no way to represent them. The oRPC panel decodes the envelope back to the typed value your handler received.
|
|
37
|
-
- oRPC calls get lost in the Network tab, between the images, scripts, and page visits a storefront loads. The oRPC panel lists only oRPC calls, groups them by procedure, adds up the timing per procedure, and classifies each failure as validation, server, or network.
|
|
44
|
+
For the raw transaction of a single request, the Network tab stays the better tool.
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
## Requirements
|
|
47
|
+
|
|
48
|
+
- Node.js 24 or newer
|
|
49
|
+
- Vite 8.3.5 or newer. Vite 8.3.5 is the first release that lists `@vitejs/devtools` 0.8 as a supported peer. Earlier 8.x releases install, but your package manager can report a peer mismatch.
|
|
50
|
+
- Vue 3.5 or newer
|
|
51
|
+
- `@inertiajs/core` 3 and `@orpc/client` 1
|
|
40
52
|
|
|
41
53
|
## Installation
|
|
42
54
|
|
|
43
|
-
The
|
|
55
|
+
The Storefront Application V3 ships with the package. To add it to another project:
|
|
44
56
|
|
|
45
57
|
```bash
|
|
46
58
|
pnpm add -D @scayle/storefront-devtools
|
|
@@ -48,7 +60,7 @@ pnpm add -D @scayle/storefront-devtools
|
|
|
48
60
|
|
|
49
61
|
## Integration
|
|
50
62
|
|
|
51
|
-
The only file you change is the Storefront Application V3 `vite.config.ts`. The plugin injects the dock client and the
|
|
63
|
+
The only file you change is the Storefront Application V3 `vite.config.ts`. The plugin injects the dock client and the page scripts into the app's client entry (`src/client/main.ts`), so your app code stays as it is.
|
|
52
64
|
|
|
53
65
|
Import the default export and spread it into the `plugins` array, after `@vitejs/plugin-vue`:
|
|
54
66
|
|
|
@@ -62,7 +74,7 @@ import storefrontBuild from '@scayle/storefront-build'
|
|
|
62
74
|
export default defineConfig({
|
|
63
75
|
plugins: [
|
|
64
76
|
vue(),
|
|
65
|
-
// The Vite DevTools dock with the SCAYLE Storefront panels.
|
|
77
|
+
// The Vite DevTools dock with the SCAYLE Storefront and Vue panels.
|
|
66
78
|
...storefrontDevtools(),
|
|
67
79
|
storefrontBuild({
|
|
68
80
|
serverEntry: './src/server/index.ts',
|
|
@@ -74,178 +86,208 @@ export default defineConfig({
|
|
|
74
86
|
})
|
|
75
87
|
```
|
|
76
88
|
|
|
77
|
-
`storefrontDevtools()` returns an array of Vite plugins, so you have to spread it. It
|
|
78
|
-
|
|
79
|
-
### Dev server path exclusion
|
|
89
|
+
`storefrontDevtools()` returns an array of Vite plugins, so you have to spread it. It takes no options and always registers all four panels.
|
|
80
90
|
|
|
81
|
-
|
|
91
|
+
### Dev server paths
|
|
82
92
|
|
|
83
|
-
|
|
93
|
+
Vite serves the dock under `/__devtools/` and the panel apps under `/__storefront-devtools/`. The Storefront Application V3 renders pages through a Hono dev server with a country-prefix redirect, which would catch those paths and rewrite them. `@scayle/storefront-build` already excludes both paths, so with both packages installed you need no extra configuration.
|
|
84
94
|
|
|
85
95
|
## Opening the dock
|
|
86
96
|
|
|
87
|
-
|
|
97
|
+
Start the dev server with `pnpm dev` and open the app. A launcher appears at the bottom of the page. Open it, then pick an entry from the **SCAYLE Storefront** group (Storefront, oRPC, Inertia.js) or the **Vue** group (Components, Timeline).
|
|
88
98
|
|
|
89
|
-
The plugin
|
|
99
|
+
The plugin appends the launcher to the client entry instead of the HTML. The Storefront Application V3 builds its HTML in the SSR renderer, so Vite's `transformIndexHtml` hook never fires.
|
|
90
100
|
|
|
91
|
-
##
|
|
101
|
+
## Panels
|
|
92
102
|
|
|
93
|
-
|
|
103
|
+
### Inertia.js panel
|
|
94
104
|
|
|
95
|
-
|
|
105
|
+
Inertia drives navigation over XHR and swaps page props without a reload. The browser shows you raw JSON and nothing about the visit. The Inertia.js panel reads the Inertia lifecycle and shows the visit.
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
It has a **Requests** tab and a **Page** tab. **Pause** and **Clear** sit in the top bar.
|
|
98
108
|
|
|
99
|
-
|
|
109
|
+
#### Requests tab
|
|
100
110
|
|
|
101
|
-
|
|
111
|
+
The list shows each visit as it happens, with its method, URL, visit type, duration, and a count of diagnostics. Filter by type (full, partial, deferred, prefetch, redirect, client) or type into the URL box. Deferred reloads nest under the visit that triggered them. Once the list passes 200 visits, a footer tells you how many older ones dropped off. After a full reload, a collapsible **Previous session** block keeps a summary of the earlier visits. It holds the method, URL, type, and status for five minutes.
|
|
102
112
|
|
|
103
|
-
|
|
113
|
+
Select a visit to see its detail. The header shows the method, URL, type, status, component, duration, and the redirect target of a 409 response. Below it you find the feature badges, the diagnostics, and four tabs:
|
|
104
114
|
|
|
105
|
-
|
|
115
|
+
- **Response** lists the response props, each tagged with how it arrived: full, partial, deferred, merged, prepended, or deep-merged. It names the props you requested with `only` that the response left out, and counts the props carried over from the previous page. **Show changes since last page** swaps the list for a diff that marks added, removed, and changed values.
|
|
116
|
+
- **Headers** shows the request and response headers as tables.
|
|
117
|
+
- **Network** shows the protocol side of the request: visit type, asset version, the `only` and `except` keys, the error bag, and the reset keys. It also shows the duration, transfer size, and start and finish times when the browser recorded them.
|
|
118
|
+
- **Events** shows a lifecycle timeline (`before`, `start`, `success`, `finish`, and the rest) with each step's offset from the first event, colored by outcome. Below it, every captured event appears as a collapsible tree.
|
|
106
119
|
|
|
107
|
-
|
|
120
|
+
**Copy as Markdown** in the detail header copies the visit, its features, its error, and the page JSON, ready to paste into an issue or an AI chat. The copy contains the same redacted values the panel shows.
|
|
108
121
|
|
|
109
|
-
|
|
122
|
+
The initial page load arrives inside the HTML, so it has no response body and no headers. The Headers tab and the Response tab fill in for visits that go through XHR.
|
|
110
123
|
|
|
111
|
-
|
|
124
|
+
#### Feature badges
|
|
112
125
|
|
|
113
|
-
|
|
126
|
+
A badge marks each Inertia feature active on a visit: partial reload, deferred props, the merge, deep-merge, and prepend strategies, scroll regions, once props, prefetch, cached (a prefetch hit that skipped the network), flash data, remembered state, encrypted history, and clear history. Hover or focus a badge to read its description and a link to the matching Inertia docs.
|
|
114
127
|
|
|
115
|
-
|
|
116
|
-
app page (browser) dock iframe
|
|
117
|
-
page script (injected into the client entry) panel app (/__storefront-devtools/panels/)
|
|
118
|
-
DOM-event capture (inertia:*) ?view=inertia | orpc | storefront
|
|
119
|
-
-> Correlator -> RequestRecords
|
|
120
|
-
history-capture (pushState/replaceState)
|
|
121
|
-
network timing (PerformanceObserver)
|
|
122
|
-
-> DevToolsStore
|
|
123
|
-
createPageScriptChannel() ── state snapshots ──▶ connectPanelChannel()
|
|
124
|
-
◀── getState, clear, mirrors the latest
|
|
125
|
-
setPaused ─────── snapshot into a Vue ref
|
|
126
|
-
```
|
|
128
|
+
#### Diagnostics
|
|
127
129
|
|
|
128
|
-
|
|
130
|
+
Diagnostics flag common mistakes:
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
- an asset version mismatch that forced a 409 reload
|
|
133
|
+
- a canceled or interrupted visit
|
|
134
|
+
- a prop you requested with `only` that the response left out
|
|
135
|
+
- validation errors lost because `only` didn't include `errors`
|
|
136
|
+
- deferred props that failed to load
|
|
137
|
+
- a history replace to the same URL
|
|
131
138
|
|
|
132
|
-
|
|
133
|
-
- A `PerformanceObserver` over resource-timing entries, matched to in-flight requests by URL.
|
|
134
|
-
- A `history.pushState` / `replaceState` patch that catches client visits (`router.push` / `router.replace`) that skip the normal Inertia event lifecycle.
|
|
139
|
+
Each diagnostic links to the relevant documentation.
|
|
135
140
|
|
|
136
|
-
|
|
141
|
+
#### Page tab
|
|
137
142
|
|
|
138
|
-
|
|
143
|
+
The Page tab shows the current page props as a collapsible tree, with the page-level feature badges. Use it to inspect what your component renders right now, apart from any single visit.
|
|
139
144
|
|
|
140
|
-
|
|
145
|
+
#### Pausing and clearing
|
|
141
146
|
|
|
142
|
-
|
|
147
|
+
Pause stops capture so a busy page doesn't flood the list while you read a visit. Resume continues from that point. Clear empties the list. The panel remembers the active top-level tab and the type filter, but not the URL search.
|
|
143
148
|
|
|
144
|
-
|
|
149
|
+
### oRPC panel
|
|
145
150
|
|
|
146
|
-
|
|
151
|
+
The Storefront Application V3 changes state through oRPC calls to `/api`: add to basket, toggle the wishlist, apply a promotion code, run a search. The oRPC panel shows them as calls, labeled by procedure.
|
|
147
152
|
|
|
148
|
-
|
|
153
|
+
It has a **Calls** tab and a **Stats** tab. **Pause** and **Clear** sit in the top bar.
|
|
149
154
|
|
|
150
|
-
|
|
155
|
+
#### Calls tab
|
|
151
156
|
|
|
152
|
-
|
|
157
|
+
The list shows each call as it fires, with its method, procedure (`basket/add`, `wishlist/remove`, and so on), a status badge, and the duration. The badge is green for success, amber for a validation error, and red for a server or network error. Filter by domain (the first path segment, such as `basket` or `search`) or type into the box to match a procedure. A collapsible **Previous session** block keeps the calls from before a reload.
|
|
153
158
|
|
|
154
|
-
|
|
159
|
+
Select a call to see its overview and two tabs:
|
|
155
160
|
|
|
156
|
-
|
|
161
|
+
- **Data** shows the input and the output as collapsible trees. A failed call shows its error instead, with the oRPC code, status, message, and data. When the decoded value differs from the wire format, for example because it holds a `Date` or a `Map`, a toggle switches an input or output to the raw `{ json, meta }` envelope. A streaming response shows a note in place of a body.
|
|
162
|
+
- **Headers** shows the request and response headers as tables.
|
|
157
163
|
|
|
158
|
-
|
|
164
|
+
**Copy as curl** copies a runnable `curl` command with the JSON body. **Copy as markdown** copies the call for an issue or an AI chat.
|
|
159
165
|
|
|
160
|
-
|
|
166
|
+
#### Stats tab
|
|
161
167
|
|
|
162
|
-
|
|
168
|
+
The Stats tab lists every procedure with its call count, error count, average duration, and last duration. Sort by count to find the procedure a page fires ten times, or by average to find the slow one.
|
|
169
|
+
|
|
170
|
+
### Storefront context panel
|
|
163
171
|
|
|
164
|
-
|
|
172
|
+
A read-only view of what the app resolved for the current page:
|
|
165
173
|
|
|
166
|
-
|
|
174
|
+
- Shop and locale: tenant space, shop key, domain, country, locale, currency, shop-country ID, default country, country selector, available countries and languages, whether consent is required, and the OAuth client ID.
|
|
175
|
+
- Session: whether the customer is logged in, whether the session is a guest session, and the customer groups.
|
|
176
|
+
- Page: the current URL, the page version, and the public fields the SDK sends to the client for the config and for the country.
|
|
167
177
|
|
|
168
|
-
|
|
178
|
+
The panel reads the Inertia page the SDK ships, so it shows no secrets and no session token. Use it to check which shop, country, and locale a request resolved to without digging through page props.
|
|
169
179
|
|
|
170
|
-
|
|
180
|
+
### Vue panels
|
|
171
181
|
|
|
172
|
-
|
|
182
|
+
The **Vue** dock group holds the Vue DevTools Components and Timeline views. They replace a separate `vite-plugin-vue-devtools` install. Both load the `@vue/devtools-applet` UI in an iframe and reach the app page over a `BroadcastChannel` RPC bridge.
|
|
173
183
|
|
|
174
|
-
-
|
|
175
|
-
- **Headers** shows the request and response headers of that visit as a table. The store redacts credential headers (`authorization`, `cookie`, and similar) before it saves anything.
|
|
176
|
-
- **Network** shows the Inertia protocol side of the request: asset version, the `only` / `except` partial-reload keys, the `errorBag` name, reset keys, and resource timing and transfer size when the browser recorded them. Use it to check that a partial reload sent the right `only` set, or to see how long a visit spent on the network.
|
|
177
|
-
- **Events** shows a lifecycle timeline (`before`, `start`, `success`, `finish`, and the rest) with each step's offset in milliseconds from the first event, colored by outcome. Below the timeline sits every captured event with its full payload as a collapsible tree. Come here to debug a visit that hung, got canceled, or fired events in an order you didn't expect.
|
|
184
|
+
Click-to-inspect, where you click a rendered element to jump to its component, isn't included. It needs `vite-plugin-vue-inspector` in your own Vite config, and this package doesn't add it.
|
|
178
185
|
|
|
179
|
-
|
|
186
|
+
## Captured data
|
|
180
187
|
|
|
181
|
-
|
|
188
|
+
### Redaction
|
|
182
189
|
|
|
183
|
-
|
|
190
|
+
The panels never show credentials. Every capture path in the store replaces the value of a key whose name contains `password`, `passphrase`, `secret`, `token`, `credential`, `authorization`, `cookie`, or `api-key` (also `api_key` and `apikey`, case-insensitive) with `[redacted]`. This covers page props, flash data, form data, response props, headers, and oRPC input and output. The oRPC panel also redacts `code` for `auth.exchangeAuthCode`, where it carries an OAuth code.
|
|
184
191
|
|
|
185
|
-
|
|
192
|
+
Request and response headers follow the same rule. A header such as `authorization`, `cookie`, `x-api-key`, or `x-auth-token` is dropped from the captured headers, and shows as `[redacted]` inside an event's `visit.headers`.
|
|
186
193
|
|
|
187
|
-
|
|
194
|
+
Two details to know:
|
|
188
195
|
|
|
189
|
-
|
|
196
|
+
- Matching works on key names only. A credential inside a value, such as a token in a URL query string, isn't detected.
|
|
197
|
+
- Validation messages stay readable. The `inertia:error` event keeps its error bag as is, so `errors.password: "Must be 8 characters"` shows in the Events tab. The error bag in a response's page props is still redacted by key.
|
|
190
198
|
|
|
191
|
-
|
|
199
|
+
A prop whose name matches, such as `token` or `cookieConsent`, shows as `[redacted]` even when it holds harmless data. Rename the prop if you need to read it in the panel.
|
|
192
200
|
|
|
193
|
-
|
|
201
|
+
### Limits and persistence
|
|
194
202
|
|
|
195
|
-
|
|
203
|
+
| What | Limit |
|
|
204
|
+
| ----------------------------- | ------------------------------------------------------ |
|
|
205
|
+
| Inertia requests kept | 200, the oldest drop first |
|
|
206
|
+
| oRPC calls kept | 200, the oldest drop first |
|
|
207
|
+
| Events per Inertia request | 100, upload `progress` events drop first |
|
|
208
|
+
| Depth of a captured value | 10 levels, deeper values show as `[too deep]` |
|
|
209
|
+
| Previous session after reload | Summaries only, kept in `sessionStorage` for 5 minutes |
|
|
210
|
+
| Snapshot rate to the panels | One per 16 ms |
|
|
196
211
|
|
|
197
|
-
|
|
212
|
+
Each browser tab keeps its own capture. Two open tabs never see each other's requests.
|
|
198
213
|
|
|
199
|
-
|
|
214
|
+
## Security and browser authorization
|
|
200
215
|
|
|
201
|
-
The
|
|
216
|
+
The dock in the browser talks to the Vite dev server over a WebSocket RPC channel (`@devframes/hub`, with `crossws` as its transport layer). Your panels share that channel with RPC functions from `@vitejs/devtools` that reach into your machine, for example `vite:core:open-in-editor`, which opens any file path in your editor, and a terminals feed. This package sets `builtinDevTools: false`, which drops the upstream Terminals, Messages, and Inspector docks and their UI. The RPC declarations behind them stay, because they belong to `@vitejs/devtools` and a consumer can't remove them. Two independent checks protect the channel.
|
|
202
217
|
|
|
203
|
-
|
|
218
|
+
### Origin allowlist
|
|
204
219
|
|
|
205
|
-
|
|
220
|
+
`@vitejs/devtools` accepts a WebSocket connection only when its `Origin` header matches a built-in loopback allowlist (`localhost`, `127.0.0.1`, and similar). The check compares strings. It doesn't resolve DNS or read your hosts file, so a custom dev hostname that points at loopback through `/etc/hosts` or a local DNS override (for example `dev-my-app.example.com`) gets rejected by default. If your setup needs another hostname, such as a reverse proxy, a tunnel, or a custom `/etc/hosts` entry, add it with `devtools: { allowedOrigins: ['https://dev-my-app.example.com'] }` in the app's Vite config.
|
|
206
221
|
|
|
207
|
-
|
|
222
|
+
### One-time client authorization
|
|
208
223
|
|
|
209
|
-
|
|
224
|
+
On top of the origin check, `@vitejs/devtools` puts the RPC connection behind a one-time code by default (`clientAuth: true`). The first time a new browser connects, the `pnpm dev` terminal prints `devframe auth code <code>` and a magic-link URL (`...#devframe_otp=<code>`). Enter the code in the dock's prompt, or open the printed URL, to authorize that browser. The dock stays unauthorized until you do.
|
|
210
225
|
|
|
211
|
-
|
|
212
|
-
- **Headers** shows the request and response headers of that call as a table. The store redacts credential headers and sensitive input fields (passwords, tokens, and similar) before it saves anything.
|
|
226
|
+
### Turning off the authorization check
|
|
213
227
|
|
|
214
|
-
|
|
228
|
+
`devtools: { clientAuth: false }` (or the `VITE_DEVTOOLS_DISABLE_CLIENT_AUTH=true` environment variable) skips the one-time code. The `@vitejs/devtools` documentation warns about this: _"if you disable client authentication, any browsers can connect to the devtools and access to your server and filesystem (including other devices, if you open server `host` option to LAN or WAN)."_ Turn it off only where every request comes from a trusted developer. Never do it with `server.host` bound to a LAN or WAN interface, in a shared environment, or anywhere close to production.
|
|
215
229
|
|
|
216
|
-
|
|
230
|
+
### Production safety
|
|
217
231
|
|
|
218
|
-
|
|
232
|
+
The plugin that adds imports to your client entry and the Vue DevTools plugin set `apply: 'serve'`, so Vite skips them in `vite build`. The dock host opens its WebSocket RPC server from the `configureServer` hook, which Vite calls for `vite dev` and never for `vite build`. The upstream build-time injection options (`devtools.build.withApp` and `devtools.build.injection`) default to off, and this package doesn't turn them on. A production build and its runtime output carry no RPC server, no WebSocket endpoint, and none of the injected page scripts or launcher code.
|
|
219
233
|
|
|
220
|
-
|
|
234
|
+
## How it works
|
|
221
235
|
|
|
222
|
-
|
|
236
|
+
The package has two halves. Page scripts run in the app's own page and capture what happens there. Panel apps run in iframes inside the dock and render what the page scripts publish. The two talk over `devframe/in-page-channel`, a `postMessage` channel between the page and the iframes the dock hosts for it.
|
|
223
237
|
|
|
224
|
-
|
|
238
|
+
```
|
|
239
|
+
app page (browser) dock iframe
|
|
240
|
+
page script (injected into the client entry) panel app (/__storefront-devtools/panels/)
|
|
241
|
+
inertia:* DOM events ?view=inertia | orpc | storefront
|
|
242
|
+
interceptors (headers, response props)
|
|
243
|
+
history capture (pushState/replaceState)
|
|
244
|
+
network timing (PerformanceObserver)
|
|
245
|
+
-> Correlator -> RequestRecords -> DevToolsStore
|
|
246
|
+
createPageScriptChannel() ── state snapshots ──▶ connectPanelChannel()
|
|
247
|
+
◀── getState, clear, mirrors the latest
|
|
248
|
+
setPaused ─────── snapshot into a Vue ref
|
|
249
|
+
```
|
|
225
250
|
|
|
226
|
-
###
|
|
251
|
+
### Inertia capture
|
|
252
|
+
|
|
253
|
+
The Inertia page script builds a `DevToolsStore` and feeds it from four sources. None of them change how Inertia behaves.
|
|
254
|
+
|
|
255
|
+
- Inertia 3's `inertia:*` DOM events, through `document.addEventListener`. The script doesn't patch `router.on()`. It copies each event's detail with a depth limit, drops functions and abort signals, and redacts credentials before the store sees the data.
|
|
256
|
+
- Inertia's interceptor registry, `window.__inertia_interceptors__`, for the request headers and the response props. `createInertiaApp` exposes the registry in dev mode, and the script polls for it every 100 ms for up to 10 seconds. Without the registry, the Headers tab and the response props stay empty.
|
|
257
|
+
- A `history.pushState` and `replaceState` patch that catches client visits (`router.push`, `router.replace`) that skip the Inertia event lifecycle. It tracks the server visits still in flight by their Inertia visit id and treats a changed page as one of their writes, so a visit that ends without a history write (a 409 redirect, a network error, or a `before` listener that cancels the visit) doesn't hide the next client visit. Writes that leave the page unchanged, such as `router.remember()`, never count as visits.
|
|
258
|
+
- A `PerformanceObserver` over resource timing entries, matched to in-flight requests by URL.
|
|
227
259
|
|
|
228
|
-
|
|
260
|
+
Every handler runs inside a guard, so a devtools error can't crash the app.
|
|
229
261
|
|
|
230
|
-
###
|
|
262
|
+
### Correlation
|
|
231
263
|
|
|
232
|
-
|
|
264
|
+
A correlator groups the raw events into one `RequestRecord` per visit. It matches an event by the visit fingerprint, then by the visit id that `navigate`, `success`, and `error` events carry, and falls back to the most recently started visit for events without one. It handles deferred prop reloads, prefetch cache hits, POST to redirect flows, 409 asset version mismatches, and the initial page load. The store keeps the latest 200 records and saves a compact summary to `sessionStorage`.
|
|
233
265
|
|
|
234
|
-
|
|
266
|
+
### oRPC capture
|
|
235
267
|
|
|
236
|
-
|
|
268
|
+
The oRPC page script patches `window.fetch` once on load. For each request whose path starts with `/api`, it records one call: the procedure name (the path after `/api`), the input from the request body, and, once the response arrives, the output, status, duration, and any error. Every other fetch passes through untouched, and the app always gets the original response or rejection, so the patch can't break a real request. The store keeps the latest 200 calls and classifies each failure as a validation error (a 422 or an `INPUT_VALIDATION_FAILED` body), a network error (a thrown fetch), or a server error. It keeps each input, output, and error in two forms: decoded to typed values, and as the raw `{ json, meta }` envelope.
|
|
269
|
+
|
|
270
|
+
### Publishing to the panels
|
|
237
271
|
|
|
238
|
-
Each
|
|
272
|
+
Each page script opens its own channel (`storefront-devtools:inertia`, `storefront-devtools:orpc`) and pushes a snapshot of its store to the connected panels, at most one per 16 ms. A panel that opens later asks for the current snapshot with `getState`, and Pause and Clear reach the store as channel calls. Snapshots cross the channel through structured clone, so the page scripts copy every captured value with `safeClone` first. The Storefront context panel has no page script of its own. The Inertia page script serves it on a second channel, `storefront-devtools:storefront`.
|
|
239
273
|
|
|
240
|
-
The
|
|
274
|
+
The package builds one small Vue app for the three storefront panels and serves it, together with the Vue DevTools UI, from `/__storefront-devtools/`. The `?view=` query picks the panel. Each panel runs in its own iframe, so its styles never touch your app, and the dock keeps a hidden panel's iframe alive and receiving snapshots. The panel styles are dark mode only.
|
|
275
|
+
|
|
276
|
+
The tabs follow the WAI-ARIA tabs pattern: the arrow keys, Home, and End move between tabs, and only the selected tab is in the tab order. In the request and call lists, the up and down arrow keys move the selection.
|
|
277
|
+
|
|
278
|
+
## Development
|
|
279
|
+
|
|
280
|
+
The layout, the rules that keep the panels correct, and the test setup are in [CLAUDE.md](./CLAUDE.md). After a change to the injection, the build, or a panel, run the Storefront Application V3 with `pnpm dev` and open every panel, because unit tests and builds don't exercise the dock itself.
|
|
241
281
|
|
|
242
282
|
## Upstream stability
|
|
243
283
|
|
|
244
|
-
`@vitejs/devtools` and `@vitejs/devtools-kit` are
|
|
284
|
+
`@vitejs/devtools` and `@vitejs/devtools-kit` are `0.x` releases, so any minor version can ship a breaking change without a deprecation period. This package pins both to the same version in the workspace catalog and currently uses 0.8.0. `@devframes/hub` and `@devframes/hub-ui` reached 1.0 in September 2026 and arrive as transitive dependencies of `@vitejs/devtools`. A routine `pnpm update` can move them without any `@vitejs/devtools` bump. They resolve to 1.2.6 today, next to `devframe` 1.2.6, the library behind the page-script channel.
|
|
285
|
+
|
|
286
|
+
When you upgrade any of these packages:
|
|
245
287
|
|
|
246
|
-
- Check the
|
|
247
|
-
-
|
|
248
|
-
- After
|
|
288
|
+
- Check the `@vitejs/devtools` peer range that `vite` declares. Vite 8.3.5 accepts `^0.7.1 || ^0.8.0`, and earlier 8.3 releases accept only `^0.7.1`, so `vite` and `@vitejs/devtools` move together.
|
|
289
|
+
- Read the release notes of `@vitejs/devtools` for changes to the dock host, the RPC functions, or the `DevTools()` options. This package passes `builtinDevTools` and `branding`.
|
|
290
|
+
- After the bump, run the commands from the Development section, then open every panel in the dock.
|
|
249
291
|
|
|
250
292
|
## License
|
|
251
293
|
|