@scayle/storefront-devtools 0.2.0-alpha.5 → 0.2.0-alpha.7

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 (121) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/LICENSE +21 -0
  3. package/README.md +107 -33
  4. package/dist/_chunks/{coalesce-MEMOF7Fy.mjs → coalesce-Ch1sV7RN.mjs} +361 -360
  5. package/dist/_chunks/frame-nav-DctWjxeG.mjs +3 -0
  6. package/dist/group.d.ts +14 -26
  7. package/dist/group.d.ts.map +1 -1
  8. package/dist/index.d.ts +29 -10
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.mjs +77 -106
  11. package/dist/inertia/channel.d.ts +18 -5
  12. package/dist/inertia/channel.d.ts.map +1 -1
  13. package/dist/inertia/client/index.mjs +156 -98
  14. package/dist/inertia/client/messages.d.ts +28 -0
  15. package/dist/inertia/client/messages.d.ts.map +1 -0
  16. package/dist/inertia/client/publish.d.ts +4 -2
  17. package/dist/inertia/client/publish.d.ts.map +1 -1
  18. package/dist/inertia/core/correlator.d.ts +7 -0
  19. package/dist/inertia/core/correlator.d.ts.map +1 -1
  20. package/dist/inertia/core/diagnostics.d.ts.map +1 -1
  21. package/dist/inertia/core/diff.d.ts +2 -1
  22. package/dist/inertia/core/diff.d.ts.map +1 -1
  23. package/dist/inertia/core/history-capture.d.ts.map +1 -1
  24. package/dist/inertia/core/interceptors.d.ts +1 -0
  25. package/dist/inertia/core/interceptors.d.ts.map +1 -1
  26. package/dist/inertia/core/protocol.d.ts +1 -1
  27. package/dist/inertia/core/protocol.d.ts.map +1 -1
  28. package/dist/inertia/core/request-filters.d.ts +19 -0
  29. package/dist/inertia/core/request-filters.d.ts.map +1 -0
  30. package/dist/inertia/core/request-tree.d.ts +6 -3
  31. package/dist/inertia/core/request-tree.d.ts.map +1 -1
  32. package/dist/inertia/core/response.d.ts +3 -2
  33. package/dist/inertia/core/response.d.ts.map +1 -1
  34. package/dist/inertia/core/store.d.ts +1 -0
  35. package/dist/inertia/core/store.d.ts.map +1 -1
  36. package/dist/inertia/core/types.d.ts +2 -1
  37. package/dist/inertia/core/types.d.ts.map +1 -1
  38. package/dist/inertia/core/url.d.ts +12 -0
  39. package/dist/inertia/core/url.d.ts.map +1 -1
  40. package/dist/inject.d.ts +3 -4
  41. package/dist/inject.d.ts.map +1 -1
  42. package/dist/og.d.ts +12 -0
  43. package/dist/og.d.ts.map +1 -0
  44. package/dist/orpc/channel.d.ts +9 -1
  45. package/dist/orpc/channel.d.ts.map +1 -1
  46. package/dist/orpc/client/index.mjs +30 -13
  47. package/dist/orpc/client/publish.d.ts +3 -1
  48. package/dist/orpc/client/publish.d.ts.map +1 -1
  49. package/dist/orpc/core/session.d.ts +1 -8
  50. package/dist/orpc/core/session.d.ts.map +1 -1
  51. package/dist/orpc/core/stats.d.ts +1 -1
  52. package/dist/orpc/core/stats.d.ts.map +1 -1
  53. package/dist/orpc/core/store.d.ts +1 -0
  54. package/dist/orpc/core/store.d.ts.map +1 -1
  55. package/dist/shared/clipboard.d.ts +23 -3
  56. package/dist/shared/clipboard.d.ts.map +1 -1
  57. package/dist/shared/panel-channel.d.ts +27 -1
  58. package/dist/shared/panel-channel.d.ts.map +1 -1
  59. package/dist/shared/prefs.d.ts +49 -0
  60. package/dist/shared/prefs.d.ts.map +1 -0
  61. package/dist/shared/redact.d.ts +2 -1
  62. package/dist/shared/redact.d.ts.map +1 -1
  63. package/dist/ui/assets/App-6RVVFLEC.js +4 -0
  64. package/dist/ui/assets/App-B2ZZO0Ti.js +1 -0
  65. package/dist/ui/assets/App-CBJXphAE.css +1 -0
  66. package/dist/ui/assets/App-DZWzqK2B.css +1 -0
  67. package/dist/ui/assets/App-DpdlSV8K.css +1 -0
  68. package/dist/ui/assets/App-eWdxlybE.js +5 -0
  69. package/dist/ui/assets/HeadersTab-BQDnjNCw.js +1 -0
  70. package/dist/ui/assets/HeadersTab-BUPAYMYI.css +1 -0
  71. package/dist/ui/assets/_plugin-vue_export-helper-DnlXueOW.js +2 -0
  72. package/dist/ui/assets/panels-XWiax2rN.css +1 -0
  73. package/dist/ui/assets/panels-oi-DKWXr.js +3 -0
  74. package/dist/ui/assets/store-CCDY0y91.js +1 -0
  75. package/dist/ui/panels/index.html +2 -3
  76. package/package.json +22 -26
  77. package/dist/inertia/plugin.d.ts +0 -13
  78. package/dist/inertia/plugin.d.ts.map +0 -1
  79. package/dist/orpc/plugin.d.ts +0 -13
  80. package/dist/orpc/plugin.d.ts.map +0 -1
  81. package/dist/storefront/plugin.d.ts +0 -11
  82. package/dist/storefront/plugin.d.ts.map +0 -1
  83. package/dist/ui/assets/App-25PW_NzC.css +0 -1
  84. package/dist/ui/assets/App-BHsYAu8T.js +0 -4
  85. package/dist/ui/assets/App-BqkxhJv0.css +0 -1
  86. package/dist/ui/assets/App-CQ-b0jtB.js +0 -5
  87. package/dist/ui/assets/App-Ct7Za--B.css +0 -1
  88. package/dist/ui/assets/App-DAtQapox.js +0 -1
  89. package/dist/ui/assets/_plugin-vue_export-helper-BDNMzG2s.js +0 -1
  90. package/dist/ui/assets/channel-D7V7aU79.js +0 -1
  91. package/dist/ui/assets/clipboard-Df0gl3GP.js +0 -1
  92. package/dist/ui/assets/clipboard-sKCUppVL.css +0 -1
  93. package/dist/ui/assets/css-8QJvnqUH.js +0 -1
  94. package/dist/ui/assets/css-lJZLS6R3.js +0 -1
  95. package/dist/ui/assets/diff-woXpYk--.js +0 -1
  96. package/dist/ui/assets/html-GueGcY0x.js +0 -1
  97. package/dist/ui/assets/html-WzJrCOnD.js +0 -1
  98. package/dist/ui/assets/javascript-BzbQS41l.js +0 -1
  99. package/dist/ui/assets/javascript-CpIGwZ_Y.js +0 -1
  100. package/dist/ui/assets/json-B88Oqtu5.js +0 -1
  101. package/dist/ui/assets/json-C3WlssX3.js +0 -1
  102. package/dist/ui/assets/panel-channel-BUrhmfqu.js +0 -2
  103. package/dist/ui/assets/panels-8x4hQPoN.css +0 -1
  104. package/dist/ui/assets/panels-C4yKz6cQ.js +0 -2
  105. package/dist/ui/assets/preload-helper-DLPYjEaE.js +0 -2
  106. package/dist/ui/assets/shellscript-CLZ0U2zV.js +0 -1
  107. package/dist/ui/assets/typescript-Bb1J8qyy.js +0 -1
  108. package/dist/ui/assets/typescript-j_1H8WHN.js +0 -1
  109. package/dist/ui/assets/vitesse-dark-BZCL-v6S.js +0 -1
  110. package/dist/ui/assets/vitesse-light-VbXTXTou.js +0 -1
  111. package/dist/ui/assets/vue-B1Tf5CHw.js +0 -1
  112. package/dist/ui/assets/vue-CEnfmNPK.js +0 -155
  113. package/dist/ui/assets/vue-Kq4tvBbL.css +0 -1
  114. package/dist/ui/assets/vue-html-CGMs_6qn.js +0 -1
  115. package/dist/ui/assets/yaml-rwi0_p6S.js +0 -1
  116. package/dist/ui/vue/index.html +0 -15
  117. package/dist/vue-devtools/client/index.mjs +0 -4864
  118. package/dist/vue-devtools/client.d.ts +0 -2
  119. package/dist/vue-devtools/client.d.ts.map +0 -1
  120. package/dist/vue-devtools/plugin.d.ts +0 -15
  121. package/dist/vue-devtools/plugin.d.ts.map +0 -1
@@ -1,11 +1,12 @@
1
- import { a as e, c as t, i as n, n as r, o as i, s as a, t as o } from "../../_chunks/coalesce-MEMOF7Fy.mjs";
1
+ import { a as e, c as t, i as n, n as r, o as i, s as a, t as o } from "../../_chunks/coalesce-Ch1sV7RN.mjs";
2
+ import { n as s, t as c } from "../../_chunks/frame-nav-DctWjxeG.mjs";
2
3
  // src/inertia/core/features.ts
3
- function s(e) {
4
+ function l(e) {
4
5
  return typeof e == "object" && !!e && Object.keys(e).length > 0;
5
6
  }
6
- function c(e) {
7
+ function u(e) {
7
8
  let t = [], n = null;
8
- return s(e.deferredProps) ? n = e.deferredProps : s(e.initialDeferredProps) && (n = e.initialDeferredProps), n && t.push({
9
+ return l(e.deferredProps) ? n = e.deferredProps : l(e.initialDeferredProps) && (n = e.initialDeferredProps), n && t.push({
9
10
  type: "deferred",
10
11
  details: { groups: n }
11
12
  }), e.mergeProps?.length && t.push({
@@ -17,26 +18,26 @@ function c(e) {
17
18
  }), e.deepMergeProps?.length && t.push({
18
19
  type: "deep-merge",
19
20
  details: { props: e.deepMergeProps }
20
- }), s(e.scrollProps) && t.push({
21
+ }), l(e.scrollProps) && t.push({
21
22
  type: "scroll",
22
23
  details: { props: e.scrollProps }
23
- }), s(e.onceProps) && t.push({
24
+ }), l(e.onceProps) && t.push({
24
25
  type: "once",
25
26
  details: { props: e.onceProps }
26
- }), e.encryptHistory && t.push({ type: "encrypted" }), e.clearHistory && t.push({ type: "clear-history" }), s(e.flash) && t.push({
27
+ }), e.encryptHistory && t.push({ type: "encrypted" }), e.clearHistory && t.push({ type: "clear-history" }), l(e.flash) && t.push({
27
28
  type: "flash",
28
29
  details: { flash: e.flash }
29
- }), s(e.rememberedState) && t.push({
30
+ }), l(e.rememberedState) && t.push({
30
31
  type: "remember",
31
32
  details: { keys: Object.keys(e.rememberedState) }
32
33
  }), t;
33
34
  }
34
- function l(e, t) {
35
+ function d(e, t) {
35
36
  let n = [];
36
- return e.type === "partial" && n.push({ type: "partial" }), n.push(...c(t)), e.type === "prefetch" && n.push({ type: "prefetch" }), !e.events.some((e) => e.name === "inertia:start") && e.startedAt > 0 && e.type !== "client" && n.push({ type: "cached" }), n;
37
+ return e.type === "partial" && n.push({ type: "partial" }), n.push(...u(t)), e.type === "prefetch" && n.push({ type: "prefetch" }), !e.events.some((e) => e.name === "inertia:start") && e.startedAt > 0 && e.type !== "client" && n.push({ type: "cached" }), n;
37
38
  }
38
39
  // src/inertia/core/url.ts
39
- function u(e) {
40
+ function f(e) {
40
41
  try {
41
42
  let t = new URL(e, "http://localhost");
42
43
  return t.pathname + t.search;
@@ -45,15 +46,15 @@ function u(e) {
45
46
  }
46
47
  }
47
48
  // src/inertia/core/diagnostics.ts
48
- function d(e) {
49
- return e.type === "redirect" && e.status === 409 ? {
49
+ function p(e) {
50
+ return e.events.find((e) => e.name === "inertia:location")?.detail.versionChange === !0 ? {
50
51
  id: "version-mismatch",
51
52
  severity: "warning",
52
53
  message: "Asset version mismatch, full page reload",
53
54
  docsUrl: "https://inertiajs.com/the-protocol#asset-versioning"
54
55
  } : null;
55
56
  }
56
- function f(e) {
57
+ function m(e) {
57
58
  return e.interrupted ? {
58
59
  id: "visit-interrupted",
59
60
  severity: "info",
@@ -64,7 +65,7 @@ function f(e) {
64
65
  message: "Visit was cancelled"
65
66
  } : null;
66
67
  }
67
- function p(e) {
68
+ function h(e) {
68
69
  if (e.only?.length && e.page?.props) {
69
70
  let t = Object.keys(e.page.props), n = e.only.filter((e) => !t.includes(e));
70
71
  if (n.length) return {
@@ -76,7 +77,7 @@ function p(e) {
76
77
  }
77
78
  return null;
78
79
  }
79
- function m(e) {
80
+ function g(e) {
80
81
  return e.only && e.only.length > 0 && !e.only.includes("errors") && (e.status === 422 || e.events.some((e) => e.name === "inertia:error")) ? {
81
82
  id: "errors-filtered",
82
83
  severity: "warning",
@@ -84,7 +85,7 @@ function m(e) {
84
85
  docsUrl: "https://inertiajs.com/partial-reloads"
85
86
  } : null;
86
87
  }
87
- function h(e) {
88
+ function _(e) {
88
89
  return e.type === "deferred" && e.error ? {
89
90
  id: "deferred-failed",
90
91
  severity: "error",
@@ -92,7 +93,7 @@ function h(e) {
92
93
  docsUrl: "https://inertiajs.com/deferred-props"
93
94
  } : null;
94
95
  }
95
- function g(e) {
96
+ function ee(e) {
96
97
  if (e.type === "client" && e.method === "REPLACE") return {
97
98
  id: "history-replace",
98
99
  severity: "info",
@@ -101,7 +102,7 @@ function g(e) {
101
102
  };
102
103
  if (e.visitOptions?.replace === !0) {
103
104
  let t = e.previousPage?.url;
104
- return t && u(t) === u(e.url) ? {
105
+ return t && f(t) === f(e.url) ? {
105
106
  id: "history-replace-same-url",
106
107
  severity: "info",
107
108
  message: "History replaced (same URL)",
@@ -115,24 +116,24 @@ function g(e) {
115
116
  }
116
117
  return null;
117
118
  }
118
- var _ = [
119
- d,
120
- f,
119
+ var v = [
121
120
  p,
122
121
  m,
123
122
  h,
124
- g
123
+ g,
124
+ _,
125
+ ee
125
126
  ];
126
- function v(e) {
127
+ function y(e) {
127
128
  let t = [];
128
- for (let n of _) {
129
+ for (let n of v) {
129
130
  let r = n(e);
130
131
  r && t.push(r);
131
132
  }
132
133
  return t;
133
134
  }
134
135
  // src/inertia/core/correlator.ts
135
- var y = 10, b = 2e3, x = 100, S = class {
136
+ var b = 10, x = 2e3, S = 100, C = class {
136
137
  nextVisitId = 1;
137
138
  records = /* @__PURE__ */ new Map();
138
139
  sortedRecords = [];
@@ -156,6 +157,7 @@ var y = 10, b = 2e3, x = 100, S = class {
156
157
  case "inertia:cancel": return this.handleCancel(e);
157
158
  case "inertia:navigate": return this.handleNavigate(e, n);
158
159
  case "inertia:beforeUpdate": return this.handleBeforeUpdate(e, n);
160
+ case "inertia:location": return this.handleLocation(e, n);
159
161
  default: return this.handleGenericEvent(e, n);
160
162
  }
161
163
  }
@@ -172,8 +174,8 @@ var y = 10, b = 2e3, x = 100, S = class {
172
174
  return this._evictedCount;
173
175
  }
174
176
  hasRequestWithUrl(e) {
175
- let t = u(e);
176
- return this.sortedRecords.some((e) => u(e.url) === t);
177
+ let t = f(e);
178
+ return this.sortedRecords.some((e) => f(e.url) === t);
177
179
  }
178
180
  processClientVisit(e, t, n) {
179
181
  let r = this.nextVisitId++, i = performance.now(), a = {
@@ -185,7 +187,7 @@ var y = 10, b = 2e3, x = 100, S = class {
185
187
  finishedAt: i,
186
188
  duration: 0,
187
189
  events: [],
188
- features: c(t),
190
+ features: u(t),
189
191
  diagnostics: [],
190
192
  cancelled: !1,
191
193
  interrupted: !1,
@@ -200,7 +202,7 @@ var y = 10, b = 2e3, x = 100, S = class {
200
202
  }
201
203
  linkNetworkTiming(e) {
202
204
  let t = this.findNetworkMatch(e);
203
- return t ? (t.network = e, t) : (this.pendingNetwork.push(e), this.pendingNetwork.length > y && this.pendingNetwork.shift(), null);
205
+ return t ? (t.network = e, t) : (this.pendingNetwork.push(e), this.pendingNetwork.length > b && this.pendingNetwork.shift(), null);
204
206
  }
205
207
  attachRequestHeaders(e, t) {
206
208
  let n = this.recordByInertiaVisitId.get(e);
@@ -208,7 +210,7 @@ var y = 10, b = 2e3, x = 100, S = class {
208
210
  }
209
211
  attachResponseData(e, t) {
210
212
  let n = this.recordByInertiaVisitId.get(e);
211
- return n ? (n.responseHeaders = t.headers, n.responseProps = t.props, n) : null;
213
+ return n ? (t.status !== void 0 && (n.status = t.status), n.responseHeaders = t.headers, n.responseProps = t.props, n) : null;
212
214
  }
213
215
  drainPendingNetwork(e) {
214
216
  let t = this.pendingNetwork.findLastIndex((t) => this.networkMatchesVisit(t, e));
@@ -218,7 +220,7 @@ var y = 10, b = 2e3, x = 100, S = class {
218
220
  return this.sortedRecords.findLast((t) => !t.network && this.networkMatchesVisit(e, t)) ?? null;
219
221
  }
220
222
  networkMatchesVisit(e, t) {
221
- return !(u(e.url) !== u(t.url) || e.startedAt < t.startedAt - b || t.finishedAt && e.startedAt > t.finishedAt + b);
223
+ return !(f(e.url) !== f(t.url) || e.startedAt < t.startedAt - x || t.finishedAt && e.startedAt > t.finishedAt + x);
222
224
  }
223
225
  handleBefore(e, t, n) {
224
226
  let r = this.extractVisit(t), i = this.visitFingerprint(r);
@@ -265,11 +267,11 @@ var y = 10, b = 2e3, x = 100, S = class {
265
267
  if (!r) return null;
266
268
  this.pushEvent(r, e), r.finishedAt = n, r.duration = n - r.startedAt;
267
269
  let i = this.extractVisit(t);
268
- if (i && (r.completed = !!i.completed, r.cancelled = !!i.cancelled, r.interrupted = !!i.interrupted), r.network || this.drainPendingNetwork(r), r.type === "deferred" && (!r.page && this.lastPage && (r.page = this.lastPage, r.features = l(r, this.lastPage)), !r.previousPage && r.parentVisitId)) {
270
+ if (i && (r.completed = !!i.completed, r.cancelled = !!i.cancelled, r.interrupted = !!i.interrupted), r.network || this.drainPendingNetwork(r), r.type === "deferred" && (!r.page && this.lastPage && (r.page = this.lastPage, r.features = d(r, this.lastPage)), !r.previousPage && r.parentVisitId)) {
269
271
  let e = this.records.get(r.parentVisitId);
270
272
  e?.page && (r.previousPage = e.page);
271
273
  }
272
- return r.diagnostics = v(r), r;
274
+ return r.diagnostics = y(r), r;
273
275
  }
274
276
  handleCancel(e) {
275
277
  let t = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
@@ -277,7 +279,7 @@ var y = 10, b = 2e3, x = 100, S = class {
277
279
  }
278
280
  handleNavigate(e, t) {
279
281
  let n = t.page;
280
- n && (this.lastPage = n);
282
+ if (n && (this.lastPage = n), t.type === "history" && t.visitId === void 0) return null;
281
283
  let r = this.resolveByActiveId(t);
282
284
  if (!r && n) {
283
285
  let t = this.nextVisitId++;
@@ -299,7 +301,7 @@ var y = 10, b = 2e3, x = 100, S = class {
299
301
  }, this.insertRecord(r), this.activeVisitId = t;
300
302
  for (let e of this.records.values()) e.type === "deferred" && e.parentVisitId === void 0 && (e.parentVisitId = t, e.previousPage = n);
301
303
  }
302
- return r ? (this.pushEvent(r, e), n && (r.page = n, r.features = l(r, n)), r.finishedAt || (r.finishedAt = e.timestamp, r.duration = e.timestamp - r.startedAt, r.completed = !0), r.diagnostics = v(r), r) : null;
304
+ return r ? (this.pushEvent(r, e), n && (r.page = n, r.features = d(r, n)), r.finishedAt || (r.finishedAt = e.timestamp, r.duration = e.timestamp - r.startedAt, r.completed = !0), r.diagnostics = y(r), r) : null;
303
305
  }
304
306
  handleBeforeUpdate(e, t) {
305
307
  let n = this.resolveByActiveId();
@@ -308,23 +310,23 @@ var y = 10, b = 2e3, x = 100, S = class {
308
310
  let r = t.page;
309
311
  if (r) {
310
312
  if (this.lastPage) for (let e of this.records.values()) e.type === "deferred" && !e.page && (e.previousPage = this.lastPage);
311
- this.lastPage = r, n.page || (n.page = r, n.features = l(n, r));
313
+ this.lastPage = r, n.page || (n.page = r, n.features = d(n, r));
312
314
  }
313
315
  return n;
314
316
  }
317
+ handleLocation(e, t) {
318
+ let n = this.resolveByActiveId();
319
+ return n ? (this.pushEvent(n, e), n.type = "redirect", n.status = 409, typeof t.url == "string" && (n.redirectUrl = t.url), n.diagnostics = y(n), n) : null;
320
+ }
315
321
  handleGenericEvent(e, t) {
316
322
  let n = this.resolveByFingerprint(e) ?? this.resolveByActiveId(t);
317
323
  if (!n) return null;
318
324
  if (this.pushEvent(n, e), e.name === "inertia:error") n.error = t.errors;
319
325
  else if (e.name === "inertia:httpException") {
320
326
  let e = t.response;
321
- if (e && (n.status = e.status, n.status === 409)) {
322
- n.type = "redirect";
323
- let t = e.headers;
324
- t && (n.redirectUrl = t["x-inertia-location"] ?? t["x-inertia-redirect"]);
325
- }
327
+ e && (n.status = e.status);
326
328
  } else e.name === "inertia:networkError" && (n.error = t.error);
327
- return n.diagnostics = v(n), n;
329
+ return n.diagnostics = y(n), n;
328
330
  }
329
331
  createPrefetchRecord(e, t, n, r) {
330
332
  let i = this.nextVisitId++, a = {
@@ -380,7 +382,7 @@ var y = 10, b = 2e3, x = 100, S = class {
380
382
  return this.activeVisitId === null ? null : this.records.get(this.activeVisitId) ?? null;
381
383
  }
382
384
  pushEvent(e, t) {
383
- if (e.events.push(t), e.events.length > x) {
385
+ if (e.events.push(t), e.events.length > S) {
384
386
  let t = e.events.findIndex((e) => e.name === "inertia:progress");
385
387
  t !== -1 && e.events.splice(t, 1);
386
388
  }
@@ -436,8 +438,8 @@ var y = 10, b = 2e3, x = 100, S = class {
436
438
  findNestingParentVisitId(e) {
437
439
  return this.sortedRecords.findLast((t) => (e === void 0 || t.url === e) && t.type !== "deferred" && t.type !== "prefetch")?.visitId;
438
440
  }
439
- }, C = t("inertia-devtools-session");
440
- function w(e) {
441
+ }, w = t("inertia-devtools-session");
442
+ function T(e) {
441
443
  return {
442
444
  visitId: e.visitId,
443
445
  type: e.type,
@@ -446,20 +448,20 @@ function w(e) {
446
448
  status: e.status
447
449
  };
448
450
  }
449
- function T(e) {
450
- C.save({
451
+ function E(e) {
452
+ w.save({
451
453
  savedAt: Date.now(),
452
- requests: e.map(w)
454
+ requests: e.map(T)
453
455
  });
454
456
  }
455
- function E() {
456
- return C.load();
457
+ function te() {
458
+ return w.load();
457
459
  }
458
- function D() {
459
- C.clear();
460
+ function ne() {
461
+ w.clear();
460
462
  }
461
463
  // src/inertia/core/store.ts
462
- var O = { redactKey: n }, k = class {
464
+ var D = { redactKey: n }, O = class {
463
465
  correlator;
464
466
  subscribers = /* @__PURE__ */ new Set();
465
467
  nextEventId = 1;
@@ -468,7 +470,7 @@ var O = { redactKey: n }, k = class {
468
470
  previousSession = null;
469
471
  saveTimer;
470
472
  constructor() {
471
- this.correlator = new S(), this.previousSession = E();
473
+ this.correlator = new C(), this.previousSession = te();
472
474
  }
473
475
  get requests() {
474
476
  return this.correlator.getRequests().slice();
@@ -502,7 +504,7 @@ var O = { redactKey: n }, k = class {
502
504
  }
503
505
  captureEvent(e, t) {
504
506
  if (this._paused || !(t instanceof CustomEvent)) return;
505
- let n = a(t.detail, O), r = t.detail?.errors;
507
+ let n = a(t.detail, D), r = t.detail?.errors;
506
508
  e === "inertia:error" && r !== void 0 && (n.errors = i(r));
507
509
  let o = {
508
510
  id: this.nextEventId++,
@@ -520,12 +522,13 @@ var O = { redactKey: n }, k = class {
520
522
  }
521
523
  captureInterceptedResponse(t, n) {
522
524
  this._paused || (this.correlator.attachResponseData(t, {
525
+ status: n.status,
523
526
  headers: e(n.headers),
524
- props: n.props ? i(n.props, O) : void 0
527
+ props: n.props ? i(n.props, D) : void 0
525
528
  }), this.notify());
526
529
  }
527
530
  captureClientVisit(e, t, n) {
528
- this._paused || (this.correlator.processClientVisit(e, i(t, O), n), this.notify());
531
+ this._paused || (this.correlator.processClientVisit(e, i(t, D), n), this.notify());
529
532
  }
530
533
  subscribe(e) {
531
534
  return this.subscribers.add(e), () => {
@@ -536,7 +539,7 @@ var O = { redactKey: n }, k = class {
536
539
  this._paused = e, this.notify();
537
540
  }
538
541
  clear() {
539
- this.correlator.clear(), this.nextEventId = 1, D(), this.previousSession = null, this.notify();
542
+ this.correlator.clear(), this.nextEventId = 1, ne(), this.previousSession = null, this.notify();
540
543
  }
541
544
  notify() {
542
545
  this.tick++;
@@ -546,9 +549,9 @@ var O = { redactKey: n }, k = class {
546
549
  } catch (e) {
547
550
  console.warn("[storefront-devtools] Subscriber error:", e);
548
551
  }
549
- clearTimeout(this.saveTimer), this.saveTimer = setTimeout(() => T(this.requests), 1e3);
552
+ clearTimeout(this.saveTimer), this.saveTimer = setTimeout(() => E(this.requests), 1e3);
550
553
  }
551
- }, A = [
554
+ }, k = [
552
555
  "inertia:before",
553
556
  "inertia:start",
554
557
  "inertia:progress",
@@ -561,13 +564,14 @@ var O = { redactKey: n }, k = class {
561
564
  "inertia:beforeUpdate",
562
565
  "inertia:navigate",
563
566
  "inertia:flash",
567
+ "inertia:location",
564
568
  "inertia:prefetching",
565
569
  "inertia:prefetched"
566
570
  ];
567
571
  // src/inertia/core/capture.ts
568
- function j(e) {
572
+ function A(e) {
569
573
  let t = [];
570
- for (let n of A) {
574
+ for (let n of k) {
571
575
  let r = (t) => {
572
576
  try {
573
577
  e.captureEvent(n, t);
@@ -582,13 +586,13 @@ function j(e) {
582
586
  };
583
587
  }
584
588
  // src/inertia/core/diff.ts
585
- function M(e) {
589
+ function j(e) {
586
590
  return typeof e == "object" && !!e && !Array.isArray(e);
587
591
  }
588
- function N(e, t) {
589
- return P(e, t, /* @__PURE__ */ new WeakSet());
592
+ function M(e, t) {
593
+ return N(e, t, /* @__PURE__ */ new WeakSet());
590
594
  }
591
- function P(e, t, n) {
595
+ function N(e, t, n) {
592
596
  if (e === t) return !0;
593
597
  if (e === null || t === null || typeof e != typeof t) return !1;
594
598
  if (typeof e == "object") {
@@ -596,10 +600,10 @@ function P(e, t, n) {
596
600
  n.add(e), n.add(t);
597
601
  }
598
602
  try {
599
- if (Array.isArray(e) && Array.isArray(t)) return e.length === t.length && e.every((e, r) => P(e, t[r], n));
600
- if (M(e) && M(t)) {
603
+ if (Array.isArray(e) && Array.isArray(t)) return e.length === t.length && e.every((e, r) => N(e, t[r], n));
604
+ if (j(e) && j(t)) {
601
605
  let r = Object.keys(e), i = Object.keys(t);
602
- return r.length === i.length && r.every((r) => P(e[r], t[r], n));
606
+ return r.length === i.length && r.every((r) => N(e[r], t[r], n));
603
607
  }
604
608
  return !1;
605
609
  } finally {
@@ -607,7 +611,7 @@ function P(e, t, n) {
607
611
  }
608
612
  }
609
613
  // src/inertia/core/history-capture.ts
610
- function F(e) {
614
+ function P(e) {
611
615
  if (typeof e != "object" || !e) return null;
612
616
  let t = e;
613
617
  if (!("page" in t)) return null;
@@ -616,21 +620,23 @@ function F(e) {
616
620
  let n = t.page;
617
621
  return typeof n.component != "string" || typeof n.props != "object" ? null : t.page;
618
622
  }
619
- function I(e, t) {
620
- return e.url !== t.url || e.component !== t.component || !N(e.props, t.props) || !N(e.flash, t.flash);
623
+ function F(e, t) {
624
+ return e.url !== t.url || e.component !== t.component || !M(e.props, t.props) || !M(e.flash, t.flash);
625
+ }
626
+ function I(e) {
627
+ let t = e.detail?.visit;
628
+ return t?.prefetch || typeof t?.id != "string" ? void 0 : t.id;
621
629
  }
622
630
  function L(e) {
623
631
  if (typeof window > "u") return () => {};
624
632
  let t = history.pushState.bind(history), r = history.replaceState.bind(history), a = /* @__PURE__ */ new Set(), o = (e) => {
625
- let t = e.detail?.visit;
626
- if (t?.prefetch || typeof t?.id != "string") return;
627
- let { id: n } = t;
628
- a.add(n), queueMicrotask(() => {
629
- e.defaultPrevented && a.delete(n);
630
- });
633
+ let t = I(e);
634
+ t !== void 0 && (a.add(t), queueMicrotask(() => {
635
+ e.defaultPrevented && a.delete(t);
636
+ }));
631
637
  }, s = (e) => {
632
- let t = e.detail?.visit;
633
- t?.prefetch || typeof t?.id != "string" || a.delete(t.id);
638
+ let t = I(e);
639
+ t !== void 0 && a.delete(t);
634
640
  };
635
641
  document.addEventListener("inertia:before", o), document.addEventListener("inertia:finish", s);
636
642
  function c(t, n, r) {
@@ -644,11 +650,11 @@ function L(e) {
644
650
  let r = a.size > 0;
645
651
  setTimeout(() => {
646
652
  let i = e.currentPage;
647
- i && I(n, i) && (r || c(t, i, n));
653
+ i && F(n, i) && (r || c(t, i, n));
648
654
  }, 0);
649
655
  }
650
656
  function u(t, r) {
651
- let o = F(r);
657
+ let o = P(r);
652
658
  if (!o) return;
653
659
  let s = e.currentPage;
654
660
  if (!s) return;
@@ -657,7 +663,7 @@ function L(e) {
657
663
  return;
658
664
  }
659
665
  let u = i(o, { redactKey: n });
660
- I(s, u) && (a.size > 0 || c(t, u, s));
666
+ F(s, u) && (a.size > 0 || c(t, u, s));
661
667
  }
662
668
  return history.pushState = function(e, n, r) {
663
669
  t(e, n, r), u("pushState", e);
@@ -722,6 +728,7 @@ function U(e, t) {
722
728
  try {
723
729
  let r = z(n.headers);
724
730
  t.captureInterceptedResponse(e.id, {
731
+ status: n.status,
725
732
  headers: r,
726
733
  props: B(n.data)
727
734
  });
@@ -748,21 +755,34 @@ function W(e) {
748
755
  var G = "storefront-devtools:inertia", K = "storefront-devtools:storefront";
749
756
  // src/inertia/client/publish.ts
750
757
  function q(e) {
751
- let { requests: t, currentPage: n, evictedCount: r, paused: i } = e.getState();
752
758
  return {
753
- requests: t,
754
- currentPage: n,
755
- evictedCount: r,
756
- paused: i,
759
+ visitId: e.visitId,
760
+ parentVisitId: e.parentVisitId,
761
+ type: e.type,
762
+ method: e.method,
763
+ url: e.url,
764
+ finishedAt: e.finishedAt,
765
+ duration: e.duration,
766
+ status: e.status,
767
+ diagnosticCount: e.diagnostics.length
768
+ };
769
+ }
770
+ function J(e) {
771
+ let { requests: t, evictedCount: n, paused: r } = e.getState();
772
+ return {
773
+ requests: t.map(q),
774
+ evictedCount: n,
775
+ paused: r,
757
776
  previousSession: e.previousSessionRequests
758
777
  };
759
778
  }
760
- function J(e, t = {}) {
779
+ function Y(e, t = {}) {
761
780
  let n = r({
762
781
  ...t,
763
782
  name: G,
764
783
  functions: {
765
- getState: { handler: () => q(e) },
784
+ getState: { handler: () => J(e) },
785
+ getRequest: { handler: (t) => e.getRequest(t) ?? null },
766
786
  clear: {
767
787
  type: "action",
768
788
  handler: () => e.clear()
@@ -780,22 +800,60 @@ function J(e, t = {}) {
780
800
  events: {}
781
801
  });
782
802
  n.events.on("panel:connected", () => {
783
- n.emit("state", q(e));
803
+ n.emit("state", J(e));
784
804
  }), a.events.on("panel:connected", () => {
785
805
  a.emit("state", i());
786
806
  });
787
807
  let s = e.currentPage;
788
808
  return e.subscribe(o(() => {
789
- n.emit("state", q(e)), e.currentPage !== s && (s = e.currentPage, a.emit("state", i()));
809
+ n.panels.length > 0 && n.emit("state", J(e)), e.currentPage !== s && (s = e.currentPage, a.emit("state", i()));
790
810
  }, 16)), {
791
811
  inertia: n,
792
812
  storefront: a
793
813
  };
794
814
  }
815
+ // src/inertia/client/messages.ts
816
+ var X = "__DEVFRAME_HUB_CLIENT_CONTEXT__", Z = `${s}:${c}`;
817
+ function re() {
818
+ let e = globalThis[X];
819
+ if (!e?.rpc.isTrusted) return;
820
+ let t = e.docks.entries.some((e) => e.id === Z);
821
+ return {
822
+ rpc: e.rpc,
823
+ inertiaDockId: t ? Z : s
824
+ };
825
+ }
826
+ function ie(e, t, n) {
827
+ let r = new URL(e.url, "http://localhost").pathname, i = t.docsUrl ? `\n${t.docsUrl}` : "";
828
+ return {
829
+ message: "Inertia.js",
830
+ description: `${t.message}\n${e.method} ${r}\nRule: ${t.id}${i}`,
831
+ level: t.severity === "error" ? "error" : "warn",
832
+ category: "inertia",
833
+ labels: [t.id],
834
+ notify: !0,
835
+ actions: [{
836
+ id: "open-inertia",
837
+ label: "Open Inertia Panel",
838
+ kind: "activate",
839
+ activate: { dockId: n }
840
+ }]
841
+ };
842
+ }
843
+ function ae(e) {
844
+ let t = /* @__PURE__ */ new Set();
845
+ return e.subscribe(o(() => {
846
+ let n = re();
847
+ if (n) for (let r of e.getState().requests) for (let e of r.diagnostics) {
848
+ let i = `${r.startedAt}:${r.visitId}:${e.id}`;
849
+ e.severity === "info" || t.has(i) || (t.add(i), n.rpc.call("hub:messages:add", ie(r, e, n.inertiaDockId)).catch(() => {}));
850
+ }
851
+ }, 16));
852
+ }
795
853
  // src/inertia/client/index.ts
796
- var Y = Symbol.for("@scayle/storefront-devtools/inertia"), X = globalThis;
797
- if (typeof window < "u" && typeof document < "u" && !X[Y]) {
798
- X[Y] = !0;
799
- let e = new k();
800
- j(e), L(e), R((t) => e.isInertiaRequestUrl(t), (t) => e.captureNetworkTiming(t)), W(e), J(e);
854
+ var Q = Symbol.for("@scayle/storefront-devtools/inertia"), $ = globalThis;
855
+ if (typeof window < "u" && typeof document < "u" && !$[Q]) {
856
+ $[Q] = !0;
857
+ let e = new O();
858
+ A(e), L(e), R((t) => e.isInertiaRequestUrl(t), (t) => e.captureNetworkTiming(t)), W(e), Y(e), ae(e);
801
859
  }
@@ -0,0 +1,28 @@
1
+ import { DevToolsMessageEntryInput } from '@vitejs/devtools-kit';
2
+ import { DevToolsStore } from '../core/store';
3
+ import { Diagnostic, RequestRecord } from '../core/types';
4
+ /**
5
+ * Builds the dock message for one diagnostic of one Inertia visit. The text
6
+ * names the rule and the request path. The query string and hash are dropped,
7
+ * because redaction matches key names only and a credential in a URL value
8
+ * would otherwise leave the page for the dev server's message feed.
9
+ *
10
+ * @param record - The visit the diagnostic belongs to, as the store keeps it.
11
+ * @param diagnostic - A `warning` or `error` diagnostic of that visit.
12
+ * @param inertiaDockId - The dock id the Open Inertia Panel action switches to.
13
+ * @returns The message entry, with a toast and an action that opens the Inertia.js panel.
14
+ */
15
+ export declare function toMessageEntry(record: RequestRecord, diagnostic: Diagnostic, inertiaDockId: string): DevToolsMessageEntryInput;
16
+ /**
17
+ * Sends every `warning` and `error` diagnostic of the Inertia capture to the
18
+ * Vite DevTools message feed, which shows each one as a toast. Each rule hit
19
+ * on a visit goes out once. `info` diagnostics stay in the panel. The Inertia
20
+ * page script calls it once at startup. Without a connected, authorized dock,
21
+ * or on a hub without the messages RPC, nothing is sent and the panels work
22
+ * as before.
23
+ *
24
+ * @param store - The Inertia capture store to watch.
25
+ * @returns A function that stops reporting.
26
+ */
27
+ export declare function reportDiagnostics(store: DevToolsStore): () => void;
28
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/inertia/client/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAQrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAwC9D;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,MAAM,GACpB,yBAAyB,CAqB3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,IAAI,CA2BlE"}
@@ -13,8 +13,10 @@ export interface InertiaChannels {
13
13
  * Serves the Inertia capture to the Inertia and Storefront context panels over
14
14
  * in-page channels. The Inertia page script calls it once at startup. Each
15
15
  * panel gets the current snapshot when it connects. After that, store updates
16
- * go out as coalesced `state` snapshots, and the Storefront channel only sends
17
- * when the current page changes.
16
+ * go out as coalesced `state` snapshots while a panel is connected, and the
17
+ * Storefront channel only sends when the current page changes. A snapshot
18
+ * lists requests by their list fields only, and the panel loads the selected
19
+ * request's full record with `getRequest`.
18
20
  *
19
21
  * @param store - The Inertia capture store to publish.
20
22
  * @param options - Endpoint options, used by tests to skip the window handshake.
@@ -1 +1 @@
1
- {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../src/inertia/client/publish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAGjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,KAAK,EACV,sBAAsB,EAEtB,yBAAyB,EAE1B,MAAM,YAAY,CAAA;AAEnB,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,CAAA;IAClD,2CAA2C;IAC3C,UAAU,EAAE,iBAAiB,CAAC,yBAAyB,CAAC,CAAA;CACzD;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,OAAO,GAAE,cAAmB,GAC3B,eAAe,CAiDjB"}
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../src/inertia/client/publish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAGjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAGlD,OAAO,KAAK,EACV,sBAAsB,EAGtB,yBAAyB,EAE1B,MAAM,YAAY,CAAA;AAEnB,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,CAAA;IAClD,2CAA2C;IAC3C,UAAU,EAAE,iBAAiB,CAAC,yBAAyB,CAAC,CAAA;CACzD;AA0BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,OAAO,GAAE,cAAmB,GAC3B,eAAe,CAuDjB"}
@@ -52,6 +52,7 @@ export declare class Correlator {
52
52
  * `inertiaVisitId` exists yet or it has already been evicted.
53
53
  */
54
54
  attachResponseData(inertiaVisitId: string, response: {
55
+ status?: number;
55
56
  headers: Record<string, string>;
56
57
  props?: Record<string, unknown>;
57
58
  }): RequestRecord | null;
@@ -64,6 +65,12 @@ export declare class Correlator {
64
65
  private handleCancel;
65
66
  private handleNavigate;
66
67
  private handleBeforeUpdate;
68
+ /**
69
+ * Marks the visit as a redirect when Inertia answers a 409 with an
70
+ * `X-Inertia-Location` header. That path never fires `inertia:httpException`,
71
+ * so this event is the only signal the response carried.
72
+ */
73
+ private handleLocation;
67
74
  private handleGenericEvent;
68
75
  private createPrefetchRecord;
69
76
  private visitFingerprint;