@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.
Files changed (48) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +152 -110
  3. package/dist/_chunks/{coalesce-D-Q8NzYg.mjs → coalesce-MEMOF7Fy.mjs} +37 -54
  4. package/dist/index.mjs +7 -14
  5. package/dist/inertia/client/index.mjs +139 -165
  6. package/dist/inertia/core/capture.d.ts.map +1 -1
  7. package/dist/inertia/core/correlator.d.ts +9 -0
  8. package/dist/inertia/core/correlator.d.ts.map +1 -1
  9. package/dist/inertia/core/diff.d.ts.map +1 -1
  10. package/dist/inertia/core/feature-info.d.ts +9 -5
  11. package/dist/inertia/core/feature-info.d.ts.map +1 -1
  12. package/dist/inertia/core/features.d.ts.map +1 -1
  13. package/dist/inertia/core/history-capture.d.ts.map +1 -1
  14. package/dist/inertia/core/interceptors.d.ts.map +1 -1
  15. package/dist/inertia/core/markdown.d.ts.map +1 -1
  16. package/dist/inertia/core/store.d.ts.map +1 -1
  17. package/dist/inertia/core/types.d.ts +0 -1
  18. package/dist/inertia/core/types.d.ts.map +1 -1
  19. package/dist/orpc/client/index.mjs +98 -99
  20. package/dist/shared/redact.d.ts +4 -2
  21. package/dist/shared/redact.d.ts.map +1 -1
  22. package/dist/shared/safe-clone.d.ts +2 -1
  23. package/dist/shared/safe-clone.d.ts.map +1 -1
  24. package/dist/ui/assets/App-25PW_NzC.css +1 -0
  25. package/dist/ui/assets/App-BHsYAu8T.js +4 -0
  26. package/dist/ui/assets/{App-jiQKInbo.css → App-BqkxhJv0.css} +1 -1
  27. package/dist/ui/assets/App-CQ-b0jtB.js +5 -0
  28. package/dist/ui/assets/{App-Ctfis9Sq.js → App-DAtQapox.js} +1 -1
  29. package/dist/ui/assets/clipboard-Df0gl3GP.js +1 -0
  30. package/dist/ui/assets/{clipboard-BnEeWyfh.css → clipboard-sKCUppVL.css} +1 -1
  31. package/dist/ui/assets/panel-channel-BUrhmfqu.js +2 -0
  32. package/dist/ui/assets/panels-8x4hQPoN.css +1 -0
  33. package/dist/ui/assets/panels-C4yKz6cQ.js +2 -0
  34. package/dist/ui/assets/preload-helper-DLPYjEaE.js +2 -0
  35. package/dist/ui/assets/vue-CEnfmNPK.js +155 -0
  36. package/dist/ui/panels/index.html +3 -3
  37. package/dist/ui/vue/index.html +2 -2
  38. package/dist/vue-devtools/client/index.mjs +7 -42
  39. package/package.json +15 -14
  40. package/dist/ui/assets/App-BMyWBnLQ.js +0 -4
  41. package/dist/ui/assets/App-C5-JscO0.css +0 -1
  42. package/dist/ui/assets/App-CCUPtzNx.js +0 -5
  43. package/dist/ui/assets/clipboard-BY7CN-yK.js +0 -1
  44. package/dist/ui/assets/panel-channel-qxy-vGGq.js +0 -2
  45. package/dist/ui/assets/panels-B4LTsmli.css +0 -1
  46. package/dist/ui/assets/panels-BcOW2Xog.js +0 -2
  47. package/dist/ui/assets/preload-helper-CSlQMSTd.js +0 -2
  48. 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, **SCAYLE Storefront** and **Vue**:
21
+ `@scayle/storefront-devtools` is a dev-only Vite plugin. It hosts the Vite DevTools dock and registers two dock groups:
22
22
 
23
- - The Inertia.js panel lists every visit your app makes, one request per navigation. It shows the response body and headers, the Inertia protocol details (partial reload keys, asset version, redirects), and a lifecycle timeline, and it flags common mistakes such as a missing partial-reload prop. The [Inertia.js panel](#inertiajs-panel) section covers it in depth.
24
- - The oRPC panel lists every call to your `/api` endpoint and decodes each call's `{ json, meta }` envelope back to typed input and output. It groups calls by procedure, classifies failures, and tracks timing per procedure. The [oRPC panel](#orpc-panel) section covers it in depth.
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 plugin only runs on the dev server and drops out of production builds without an environment flag. [Production safety](#production-safety) explains why.
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 browser's Network tab for raw HTTP. These panels cover what it can't show.
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
- - Many Inertia visits never hit the network. The initial page load embeds the page object in the HTML, so no XHR fires. Client-side history navigations, prefetch cache hits, and `preserveState` updates send no request at all, and the Network tab has no row for them. The Inertia.js panel picks them up from Inertia's DOM events and from history.
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
- Where the two overlap, in the HTTP view of a single oRPC request, the panels don't try to replace the Network tab. Use the Network tab for the raw transaction and the panels for what it means to Inertia and oRPC.
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 package ships with Storefront Application V3 by default. To add it yourself:
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 Inertia and oRPC page scripts into the app's client entry, so the rest of your app code stays as it is.
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 includes the Vue DevTools panel, so you don't need `vite-plugin-vue-devtools` on top.
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
- Vite serves the dock and its assets under `/__devtools/` and `/__storefront-devtools/`. The Storefront Application V3 serves pages through a Hono dev server with a country-prefix redirect, which would catch those paths and rewrite them. `@scayle/storefront-build` already excludes the DevTools paths from the Hono dev server, so with both packages installed you need no extra configuration.
91
+ ### Dev server paths
82
92
 
83
- `storefrontDevtools()` takes no options. It always registers the Inertia.js, oRPC, Storefront context, and Vue panels, and it always injects into the Storefront Application V3's own client entry (`src/client/main.ts`).
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
- Run the Storefront Application V3 dev server (`pnpm dev`) and open the app. A floating launcher appears on the page. Open it, then open the **SCAYLE Storefront** group for the **Inertia.js**, **oRPC**, and **Storefront** entries, or the **Vue** group for the component tree and timeline.
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 injects the launcher into 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. Every panel's page script arrives through the same injection.
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
- ## Security and browser authorization
101
+ ## Panels
92
102
 
93
- The dock in the browser talks to the Vite dev server over a WebSocket RPC channel (`@devframes/hub`, with `crossws` as its transport layer). Our panels aren't the only thing on that channel. `@vitejs/devtools` ships its own RPC functions with real 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` itself and a consumer can't remove them. Two independent checks protect the channel.
103
+ ### Inertia.js panel
94
104
 
95
- ### Origin allowlist
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
- `@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.
107
+ It has a **Requests** tab and a **Page** tab. **Pause** and **Clear** sit in the top bar.
98
108
 
99
- ### One-time client authorization
109
+ #### Requests tab
100
110
 
101
- 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, and that's expected.
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
- ### Turning off the authorization check
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
- Setting `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)."_ Only turn it off where every request comes from a trusted developer. Never do it with `server.host` bound to a LAN or WAN interface, or in a shared environment or anything close to production.
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
- ### Production safety
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
- `storefrontDevtools()` registers its plugins in every build, with no `import.meta.env.PROD` check of its own. The safety comes from `@vitejs/devtools`. Its plugin opens the WebSocket RPC server from Vite's `configureServer` hook, and Vite calls that hook during `vite dev` and `vite serve`, never during `vite build`. A production build and its runtime output carry no RPC server, no WebSocket endpoint, and none of the injected page scripts or launcher code.
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
- ## Page scripts and panel apps
124
+ #### Feature badges
112
125
 
113
- 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.
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
- ### Capture in the app page
130
+ Diagnostics flag common mistakes:
129
131
 
130
- On load, the Inertia page script builds a `DevToolsStore` and feeds it from three sources, none of which change how Inertia behaves:
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
- - Inertia 3.x's `inertia:*` DOM events, through `document.addEventListener`. The script copies each event's detail with a depth limit, drops functions and abort signals, and hands it to the store. It doesn't patch `router.on()`.
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
- Every handler runs inside a guard, so a devtools error can't crash the app.
141
+ #### Page tab
137
142
 
138
- ### Correlation
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
- A correlator groups the raw events into one `RequestRecord` per visit. It matches events by a visit fingerprint plus a pointer to the active visit, and it handles deferred prop reloads, prefetch cache hits, POST→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`, so the requests from before a reload stay visible.
145
+ #### Pausing and clearing
141
146
 
142
- ### oRPC capture
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
- The oRPC panel follows the same shape with its own store and page script. The page script patches `window.fetch` once on load. For each request whose path starts with `/api`, it records one `OrpcCall`: 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, classifies each failure as validation, server, or network, and saves a previous-session summary the way the Inertia store does. It keeps each input, output, and error in two forms: decoded to typed values, and as the raw `{ json, meta }` envelope, which the Data tab can show too.
149
+ ### oRPC panel
145
150
 
146
- ### Publishing to the panels
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
- Each page script opens its own channel (`storefront-devtools:inertia`, `storefront-devtools:orpc`) and pushes a snapshot of its store to the connected panels whenever the store changes. It sends at most one snapshot per 16 ms, so a burst of Inertia events costs one message instead of twenty. A timer paces this rather than `requestAnimationFrame`, because the browser pauses animation frames in a hidden tab, and the dock can sit in a Picture-in-Picture window while the app's tab is in the background. A panel that opens later asks for the current snapshot with `getState`. **Pause** and **Clear** reach the store the same way, as channel calls.
153
+ It has a **Calls** tab and a **Stats** tab. **Pause** and **Clear** sit in the top bar.
149
154
 
150
- Snapshots cross the channel through structured clone, which rejects functions, so the page scripts run captured values through `safeClone` before they store them. The channel stays inside one browser tab, so two open tabs never see each other's requests.
155
+ #### Calls tab
151
156
 
152
- ### Storefront context
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
- Unlike the Inertia and oRPC panels, the Storefront context panel has no page script of its own. The Inertia page script serves it on a second channel, `storefront-devtools:storefront`, which carries only the current Inertia page and sends a new snapshot only when that page changes. The panel shows what the Inertia store has already captured, nothing more.
159
+ Select a call to see its overview and two tabs:
155
160
 
156
- ### Panel apps
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
- The dock loads every panel as an `iframe` entry. The package builds one small Vue app for the three storefront panels and serves it, together with the Vue DevTools UI, from `/__storefront-devtools/` on the dev server. The `?view=` query picks the panel the app mounts. Each iframe is its own document, so the panel styles never touch the app, and the panel's own Vue instance stays out of the app's Vue DevTools. The dock keeps a hidden panel's iframe alive while you use another entry, and that panel keeps receiving snapshots.
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
- ## Panels
166
+ #### Stats tab
161
167
 
162
- ### Inertia.js panel
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
- Inertia drives navigation over XHR and swaps page props without a full reload, so the browser Network tab shows you raw JSON and nothing about the visit itself. This panel reads the Inertia lifecycle and shows you the visit. It's the main reason the package exists.
172
+ A read-only view of what the app resolved for the current page:
165
173
 
166
- It opens on the **Requests** tab and has a second **Page** tab. A top bar holds **Pause** and **Clear**.
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
- #### Requests tab
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
- The left side lists each visit as it happens: method, URL, visit type, timing, and a badge for any diagnostics. Filter by type (full, partial, deferred, prefetch, redirect, client), or type into the URL box to narrow the list. Deferred reloads nest under the visit that triggered them, so you can see which page started which background load. Once the list passes 200 visits, a footer tells you how many older ones dropped off. After a reload, a collapsible **Previous session** block keeps the visits from before it, because a full reload would otherwise empty the list. This tab answers "did that click fire a visit, and what kind?"
180
+ ### Vue panels
171
181
 
172
- Select a visit and the right side shows its detail in four tabs:
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
- - **Response** shows the props captured for that visit, each tagged with how it arrived (full, partial, deferred, merged, prepended, or deep-merged). It notes any prop you asked for with `only` that the response left out, and counts the props carried over unchanged from the previous page. The **Show changes since last page** toggle switches to a before/after diff that marks added keys, removed keys, and changed values. Use it to confirm a partial or deferred reload returned the prop you asked for, or to spot a prop that changed when it shouldn't have.
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
- The detail header also has **Copy as Markdown**, which copies the visit (header, features, error, and the raw page JSON) for pasting into an issue or an AI chat.
186
+ ## Captured data
180
187
 
181
- Above the tabs, the detail shows an overview (method, URL, type, status, component, duration, and the redirect URL on a 409), the active feature badges, and any diagnostics.
188
+ ### Redaction
182
189
 
183
- #### Feature badges
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
- Feature badges mark the Inertia features 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. Click a badge to see its description and a link to the matching Inertia docs, so you don't have to remember what each one means.
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
- #### Diagnostics
194
+ Two details to know:
188
195
 
189
- Diagnostics flag common mistakes on a visit: an asset-version mismatch that forced a 409 reload, a canceled or interrupted visit, a partial-reload prop you requested that the response left out, validation errors lost because an `only` option didn't include `errors`, deferred props that failed to load, and a history replace to the same URL. Each one links to the relevant docs.
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
- #### Page tab
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
- The Page tab shows the current page props as a collapsible tree, with the page-level feature badges. Use it to inspect the props your component renders right now, apart from any single visit.
201
+ ### Limits and persistence
194
202
 
195
- #### Pausing and clearing
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
- Pause stops capture, so a busy page doesn't flood the list while you read a visit. Resume picks up new visits from that point. Clear empties the list. The panel keeps your active tab and list filter when you reopen it, but not the URL search.
212
+ Each browser tab keeps its own capture. Two open tabs never see each other's requests.
198
213
 
199
- ### oRPC panel
214
+ ## Security and browser authorization
200
215
 
201
- The Storefront Application V3 changes state through oRPC calls to `/api`: add to basket, toggle wishlist, apply a promotion code, run a search. In the browser Network tab they show up as POST requests with a JSON envelope for a body, mixed in with everything else the page loads. This panel shows them as oRPC calls, labeled by procedure.
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
- It opens on the **Calls** tab and has a second **Stats** tab. A top bar holds **Pause** and **Clear**.
218
+ ### Origin allowlist
204
219
 
205
- #### Calls tab
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
- The left side lists each oRPC call as it fires: 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`, `wishlist`, or `search`), or type into the box to match a procedure. A collapsible **Previous session** block keeps the calls from before a reload.
222
+ ### One-time client authorization
208
223
 
209
- Select a call and the right side shows its detail in two tabs:
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
- - **Data** shows the request input and the success output as collapsible trees. For a failed call it shows the **Error** instead, with its oRPC code, status, message, and data. A streaming response shows a note in place of a buffered body.
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
- The overview above the tabs shows the procedure, method, URL, status, duration, and the error kind for a failed call.
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
- The detail header has **Copy as curl**, which copies the call as a runnable `curl` command with its JSON body, for replaying it in a terminal or pasting it into an issue.
230
+ ### Production safety
217
231
 
218
- #### Stats tab
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
- The Stats tab lists every procedure with its call count, average duration, and last duration. Sort by count to find the chatty procedure a page fires ten times, or by average to find the slow one.
234
+ ## How it works
221
235
 
222
- #### Pausing and clearing
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
- Pause stops capture while you read a call. Clear empties the list.
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
- ### Storefront context panel
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
- A read-only view of the resolved shop, country, locale, and session for the current page, plus the config public fields the SDK sends to the client. It shows only what the Inertia page props already contain, so it never renders secrets or the full session token. Use it to check which shop, country, and locale the app resolved for a request without digging through page props.
260
+ Every handler runs inside a guard, so a devtools error can't crash the app.
229
261
 
230
- ### Vue
262
+ ### Correlation
231
263
 
232
- The Vue DevTools component tree and timeline, in a **Vue** dock group next to the SCAYLE Storefront group. It replaces a separate `vite-plugin-vue-devtools` install. Every panel in this package runs as an iframe app. The Vue panels load the `@vue/devtools-applet` UI, which reaches the app page over a `BroadcastChannel` RPC bridge. The storefront panels use the package's own panel app.
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
- Click-to-inspect, where you click a rendered element to jump to its component in the tree, isn't included. It needs `vite-plugin-vue-inspector` in the app's own Vite config, and this package doesn't add it.
266
+ ### oRPC capture
235
267
 
236
- ## Architecture notes
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 panel that captures live app state (Inertia, oRPC) splits into three parts. `src/<feature>/core/` is plain TypeScript with no Vue import, and handles capture, classification, diffing, diagnostics, and persistence. `src/<feature>/client/` is the page script: it runs the core in the app page and publishes the store over `devframe/in-page-channel`. `src/<feature>/panel/` holds the Vue components that render it. Both features share panel UI (`TreeView`, the clipboard helper, panel styles) and generic building blocks (snapshot pacing, snapshot mirroring, `sessionStorage` persistence) from `src/shared/`.
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 storefront panels load from `/__storefront-devtools/panels/`, one iframe per view, and the Vue DevTools UI loads from `/__storefront-devtools/vue/`. The panel styles are dark-mode only. Each panel runs in its own iframe document, so its styles never leak into the host application.
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 still `0.x` releases, so any minor version can ship a breaking change without a deprecation period. `@devframes/hub` and `@devframes/hub-ui` reached 1.0.0 in September 2026. If you upgrade any of them:
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 peer range `@vitejs/devtools` declares against the Vite version this repository pins. `@vitejs/devtools` 0.6.x and 0.7.x have at times shipped outside the range `vite` itself declares for it, so a newer devtools version doesn't always work with the pinned Vite.
247
- - `@devframes/hub` and `@devframes/hub-ui` are transitive dependencies of `@vitejs/devtools`. A routine `pnpm update`, or a fresh install after a range widens, can move them without any `@vitejs/devtools` bump.
248
- - After any bump, run `pnpm exec vitest run`, `pnpm run build`, and `pnpm run verify-packaging` again, then open every panel in the dock. The unit tests cover this package's capture and classification logic, not the dock's runtime.
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