@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
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
-
|
|
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";
|
|
2
|
+
// src/inertia/core/features.ts
|
|
3
3
|
function s(e) {
|
|
4
4
|
return typeof e == "object" && !!e && Object.keys(e).length > 0;
|
|
5
5
|
}
|
|
@@ -7,59 +7,35 @@ function c(e) {
|
|
|
7
7
|
let t = [], n = null;
|
|
8
8
|
return s(e.deferredProps) ? n = e.deferredProps : s(e.initialDeferredProps) && (n = e.initialDeferredProps), n && t.push({
|
|
9
9
|
type: "deferred",
|
|
10
|
-
label: "DEFERRED",
|
|
11
10
|
details: { groups: n }
|
|
12
11
|
}), e.mergeProps?.length && t.push({
|
|
13
12
|
type: "merge",
|
|
14
|
-
label: "MERGE",
|
|
15
13
|
details: { props: e.mergeProps }
|
|
16
14
|
}), e.prependProps?.length && t.push({
|
|
17
15
|
type: "prepend",
|
|
18
|
-
label: "PREPEND",
|
|
19
16
|
details: { props: e.prependProps }
|
|
20
17
|
}), e.deepMergeProps?.length && t.push({
|
|
21
18
|
type: "deep-merge",
|
|
22
|
-
label: "DEEP MERGE",
|
|
23
19
|
details: { props: e.deepMergeProps }
|
|
24
20
|
}), s(e.scrollProps) && t.push({
|
|
25
21
|
type: "scroll",
|
|
26
|
-
label: "SCROLL",
|
|
27
22
|
details: { props: e.scrollProps }
|
|
28
23
|
}), s(e.onceProps) && t.push({
|
|
29
24
|
type: "once",
|
|
30
|
-
label: "ONCE",
|
|
31
25
|
details: { props: e.onceProps }
|
|
32
|
-
}), e.encryptHistory && t.push({
|
|
33
|
-
type: "encrypted",
|
|
34
|
-
label: "ENCRYPTED"
|
|
35
|
-
}), e.clearHistory && t.push({
|
|
36
|
-
type: "clear-history",
|
|
37
|
-
label: "CLEAR HISTORY"
|
|
38
|
-
}), s(e.flash) && t.push({
|
|
26
|
+
}), e.encryptHistory && t.push({ type: "encrypted" }), e.clearHistory && t.push({ type: "clear-history" }), s(e.flash) && t.push({
|
|
39
27
|
type: "flash",
|
|
40
|
-
label: "FLASH",
|
|
41
28
|
details: { flash: e.flash }
|
|
42
29
|
}), s(e.rememberedState) && t.push({
|
|
43
30
|
type: "remember",
|
|
44
|
-
label: "REMEMBER",
|
|
45
31
|
details: { keys: Object.keys(e.rememberedState) }
|
|
46
32
|
}), t;
|
|
47
33
|
}
|
|
48
34
|
function l(e, t) {
|
|
49
35
|
let n = [];
|
|
50
|
-
return e.type === "partial" && n.push({
|
|
51
|
-
type: "partial",
|
|
52
|
-
label: "PARTIAL"
|
|
53
|
-
}), n.push(...c(t)), e.type === "prefetch" && n.push({
|
|
54
|
-
type: "prefetch",
|
|
55
|
-
label: "PREFETCH"
|
|
56
|
-
}), !e.events.some((e) => e.name === "inertia:start") && e.startedAt > 0 && e.type !== "client" && n.push({
|
|
57
|
-
type: "cached",
|
|
58
|
-
label: "CACHED"
|
|
59
|
-
}), 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;
|
|
60
37
|
}
|
|
61
|
-
|
|
62
|
-
//#region src/inertia/core/url.ts
|
|
38
|
+
// src/inertia/core/url.ts
|
|
63
39
|
function u(e) {
|
|
64
40
|
try {
|
|
65
41
|
let t = new URL(e, "http://localhost");
|
|
@@ -68,8 +44,7 @@ function u(e) {
|
|
|
68
44
|
return e;
|
|
69
45
|
}
|
|
70
46
|
}
|
|
71
|
-
|
|
72
|
-
//#region src/inertia/core/diagnostics.ts
|
|
47
|
+
// src/inertia/core/diagnostics.ts
|
|
73
48
|
function d(e) {
|
|
74
49
|
return e.type === "redirect" && e.status === 409 ? {
|
|
75
50
|
id: "version-mismatch",
|
|
@@ -156,9 +131,8 @@ function v(e) {
|
|
|
156
131
|
}
|
|
157
132
|
return t;
|
|
158
133
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
var y = 10, b = 2e3, x = class {
|
|
134
|
+
// src/inertia/core/correlator.ts
|
|
135
|
+
var y = 10, b = 2e3, x = 100, S = class {
|
|
162
136
|
nextVisitId = 1;
|
|
163
137
|
records = /* @__PURE__ */ new Map();
|
|
164
138
|
sortedRecords = [];
|
|
@@ -284,12 +258,12 @@ var y = 10, b = 2e3, x = class {
|
|
|
284
258
|
return this.pendingPrefetch = null, this.createPrefetchRecord(n, t.event, e, t.timestamp);
|
|
285
259
|
}
|
|
286
260
|
let r = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
|
|
287
|
-
return r &&
|
|
261
|
+
return r && this.pushEvent(r, e), r;
|
|
288
262
|
}
|
|
289
263
|
handleFinish(e, t, n) {
|
|
290
264
|
let r = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
|
|
291
265
|
if (!r) return null;
|
|
292
|
-
|
|
266
|
+
this.pushEvent(r, e), r.finishedAt = n, r.duration = n - r.startedAt;
|
|
293
267
|
let i = this.extractVisit(t);
|
|
294
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)) {
|
|
295
269
|
let e = this.records.get(r.parentVisitId);
|
|
@@ -299,12 +273,12 @@ var y = 10, b = 2e3, x = class {
|
|
|
299
273
|
}
|
|
300
274
|
handleCancel(e) {
|
|
301
275
|
let t = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
|
|
302
|
-
return t ? (
|
|
276
|
+
return t ? (this.pushEvent(t, e), t.cancelled = !0, t) : null;
|
|
303
277
|
}
|
|
304
278
|
handleNavigate(e, t) {
|
|
305
279
|
let n = t.page;
|
|
306
280
|
n && (this.lastPage = n);
|
|
307
|
-
let r = this.resolveByActiveId();
|
|
281
|
+
let r = this.resolveByActiveId(t);
|
|
308
282
|
if (!r && n) {
|
|
309
283
|
let t = this.nextVisitId++;
|
|
310
284
|
r = {
|
|
@@ -325,12 +299,12 @@ var y = 10, b = 2e3, x = class {
|
|
|
325
299
|
}, this.insertRecord(r), this.activeVisitId = t;
|
|
326
300
|
for (let e of this.records.values()) e.type === "deferred" && e.parentVisitId === void 0 && (e.parentVisitId = t, e.previousPage = n);
|
|
327
301
|
}
|
|
328
|
-
return r ? (
|
|
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;
|
|
329
303
|
}
|
|
330
304
|
handleBeforeUpdate(e, t) {
|
|
331
305
|
let n = this.resolveByActiveId();
|
|
332
306
|
if (!n) return null;
|
|
333
|
-
|
|
307
|
+
this.pushEvent(n, e);
|
|
334
308
|
let r = t.page;
|
|
335
309
|
if (r) {
|
|
336
310
|
if (this.lastPage) for (let e of this.records.values()) e.type === "deferred" && !e.page && (e.previousPage = this.lastPage);
|
|
@@ -339,9 +313,9 @@ var y = 10, b = 2e3, x = class {
|
|
|
339
313
|
return n;
|
|
340
314
|
}
|
|
341
315
|
handleGenericEvent(e, t) {
|
|
342
|
-
let n = this.resolveByFingerprint(e) ?? this.resolveByActiveId();
|
|
316
|
+
let n = this.resolveByFingerprint(e) ?? this.resolveByActiveId(t);
|
|
343
317
|
if (!n) return null;
|
|
344
|
-
if (
|
|
318
|
+
if (this.pushEvent(n, e), e.name === "inertia:error") n.error = t.errors;
|
|
345
319
|
else if (e.name === "inertia:httpException") {
|
|
346
320
|
let e = t.response;
|
|
347
321
|
if (e && (n.status = e.status, n.status === 409)) {
|
|
@@ -362,10 +336,7 @@ var y = 10, b = 2e3, x = class {
|
|
|
362
336
|
except: e.except?.length ? e.except : void 0,
|
|
363
337
|
startedAt: r,
|
|
364
338
|
events: [t, n],
|
|
365
|
-
features: [{
|
|
366
|
-
type: "prefetch",
|
|
367
|
-
label: "PREFETCH"
|
|
368
|
-
}],
|
|
339
|
+
features: [{ type: "prefetch" }],
|
|
369
340
|
diagnostics: [],
|
|
370
341
|
cancelled: !1,
|
|
371
342
|
interrupted: !1,
|
|
@@ -400,9 +371,20 @@ var y = 10, b = 2e3, x = class {
|
|
|
400
371
|
}
|
|
401
372
|
return this.records.get(r[0]) ?? null;
|
|
402
373
|
}
|
|
403
|
-
resolveByActiveId() {
|
|
374
|
+
resolveByActiveId(e) {
|
|
375
|
+
let t = e?.visitId;
|
|
376
|
+
if (typeof t == "string") {
|
|
377
|
+
let e = this.recordByInertiaVisitId.get(t);
|
|
378
|
+
if (e) return e;
|
|
379
|
+
}
|
|
404
380
|
return this.activeVisitId === null ? null : this.records.get(this.activeVisitId) ?? null;
|
|
405
381
|
}
|
|
382
|
+
pushEvent(e, t) {
|
|
383
|
+
if (e.events.push(t), e.events.length > x) {
|
|
384
|
+
let t = e.events.findIndex((e) => e.name === "inertia:progress");
|
|
385
|
+
t !== -1 && e.events.splice(t, 1);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
406
388
|
insertRecord(e) {
|
|
407
389
|
this.records.set(e.visitId, e);
|
|
408
390
|
let t = this.sortedRecords.length - 1;
|
|
@@ -435,7 +417,7 @@ var y = 10, b = 2e3, x = class {
|
|
|
435
417
|
"interrupted",
|
|
436
418
|
"prefetch"
|
|
437
419
|
]), n = {};
|
|
438
|
-
for (let [r, i] of Object.entries(e)) t.has(r) || i !== !1 && i != null && (Array.isArray(i) && i.length === 0 || (typeof i != "object" ||
|
|
420
|
+
for (let [r, i] of Object.entries(e)) t.has(r) || i !== !1 && i != null && (Array.isArray(i) && i.length === 0 || (typeof i != "object" || Array.isArray(i) || Object.keys(i).length !== 0) && (n[r] = i));
|
|
439
421
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
440
422
|
}
|
|
441
423
|
classifyVisitType(e) {
|
|
@@ -454,8 +436,8 @@ var y = 10, b = 2e3, x = class {
|
|
|
454
436
|
findNestingParentVisitId(e) {
|
|
455
437
|
return this.sortedRecords.findLast((t) => (e === void 0 || t.url === e) && t.type !== "deferred" && t.type !== "prefetch")?.visitId;
|
|
456
438
|
}
|
|
457
|
-
},
|
|
458
|
-
function
|
|
439
|
+
}, C = t("inertia-devtools-session");
|
|
440
|
+
function w(e) {
|
|
459
441
|
return {
|
|
460
442
|
visitId: e.visitId,
|
|
461
443
|
type: e.type,
|
|
@@ -464,21 +446,20 @@ function C(e) {
|
|
|
464
446
|
status: e.status
|
|
465
447
|
};
|
|
466
448
|
}
|
|
467
|
-
function
|
|
468
|
-
|
|
449
|
+
function T(e) {
|
|
450
|
+
C.save({
|
|
469
451
|
savedAt: Date.now(),
|
|
470
|
-
requests: e.map(
|
|
452
|
+
requests: e.map(w)
|
|
471
453
|
});
|
|
472
454
|
}
|
|
473
|
-
function T() {
|
|
474
|
-
return S.load();
|
|
475
|
-
}
|
|
476
455
|
function E() {
|
|
477
|
-
|
|
456
|
+
return C.load();
|
|
457
|
+
}
|
|
458
|
+
function D() {
|
|
459
|
+
C.clear();
|
|
478
460
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
var D = class {
|
|
461
|
+
// src/inertia/core/store.ts
|
|
462
|
+
var O = { redactKey: n }, k = class {
|
|
482
463
|
correlator;
|
|
483
464
|
subscribers = /* @__PURE__ */ new Set();
|
|
484
465
|
nextEventId = 1;
|
|
@@ -487,7 +468,7 @@ var D = class {
|
|
|
487
468
|
previousSession = null;
|
|
488
469
|
saveTimer;
|
|
489
470
|
constructor() {
|
|
490
|
-
this.correlator = new
|
|
471
|
+
this.correlator = new S(), this.previousSession = E();
|
|
491
472
|
}
|
|
492
473
|
get requests() {
|
|
493
474
|
return this.correlator.getRequests().slice();
|
|
@@ -521,25 +502,30 @@ var D = class {
|
|
|
521
502
|
}
|
|
522
503
|
captureEvent(e, t) {
|
|
523
504
|
if (this._paused || !(t instanceof CustomEvent)) return;
|
|
524
|
-
let n = a(t.detail), r =
|
|
505
|
+
let n = a(t.detail, O), r = t.detail?.errors;
|
|
506
|
+
e === "inertia:error" && r !== void 0 && (n.errors = i(r));
|
|
507
|
+
let o = {
|
|
525
508
|
id: this.nextEventId++,
|
|
526
509
|
name: e,
|
|
527
510
|
timestamp: performance.now(),
|
|
528
511
|
detail: n
|
|
529
512
|
};
|
|
530
|
-
this.correlator.processEvent(
|
|
513
|
+
this.correlator.processEvent(o), this.notify();
|
|
531
514
|
}
|
|
532
515
|
captureNetworkTiming(e) {
|
|
533
516
|
this._paused || (this.correlator.linkNetworkTiming(e), this.notify());
|
|
534
517
|
}
|
|
535
|
-
captureInterceptedRequest(
|
|
536
|
-
this._paused || (this.correlator.attachRequestHeaders(
|
|
518
|
+
captureInterceptedRequest(t, n) {
|
|
519
|
+
this._paused || (this.correlator.attachRequestHeaders(t, e(n)), this.notify());
|
|
537
520
|
}
|
|
538
|
-
captureInterceptedResponse(
|
|
539
|
-
this._paused || (this.correlator.attachResponseData(
|
|
521
|
+
captureInterceptedResponse(t, n) {
|
|
522
|
+
this._paused || (this.correlator.attachResponseData(t, {
|
|
523
|
+
headers: e(n.headers),
|
|
524
|
+
props: n.props ? i(n.props, O) : void 0
|
|
525
|
+
}), this.notify());
|
|
540
526
|
}
|
|
541
527
|
captureClientVisit(e, t, n) {
|
|
542
|
-
this._paused || (this.correlator.processClientVisit(e, t, n), this.notify());
|
|
528
|
+
this._paused || (this.correlator.processClientVisit(e, i(t, O), n), this.notify());
|
|
543
529
|
}
|
|
544
530
|
subscribe(e) {
|
|
545
531
|
return this.subscribers.add(e), () => {
|
|
@@ -550,7 +536,7 @@ var D = class {
|
|
|
550
536
|
this._paused = e, this.notify();
|
|
551
537
|
}
|
|
552
538
|
clear() {
|
|
553
|
-
this.correlator.clear(), this.nextEventId = 1,
|
|
539
|
+
this.correlator.clear(), this.nextEventId = 1, D(), this.previousSession = null, this.notify();
|
|
554
540
|
}
|
|
555
541
|
notify() {
|
|
556
542
|
this.tick++;
|
|
@@ -560,9 +546,9 @@ var D = class {
|
|
|
560
546
|
} catch (e) {
|
|
561
547
|
console.warn("[storefront-devtools] Subscriber error:", e);
|
|
562
548
|
}
|
|
563
|
-
clearTimeout(this.saveTimer), this.saveTimer = setTimeout(() =>
|
|
549
|
+
clearTimeout(this.saveTimer), this.saveTimer = setTimeout(() => T(this.requests), 1e3);
|
|
564
550
|
}
|
|
565
|
-
},
|
|
551
|
+
}, A = [
|
|
566
552
|
"inertia:before",
|
|
567
553
|
"inertia:start",
|
|
568
554
|
"inertia:progress",
|
|
@@ -578,11 +564,10 @@ var D = class {
|
|
|
578
564
|
"inertia:prefetching",
|
|
579
565
|
"inertia:prefetched"
|
|
580
566
|
];
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
function k(e) {
|
|
567
|
+
// src/inertia/core/capture.ts
|
|
568
|
+
function j(e) {
|
|
584
569
|
let t = [];
|
|
585
|
-
for (let n of
|
|
570
|
+
for (let n of A) {
|
|
586
571
|
let r = (t) => {
|
|
587
572
|
try {
|
|
588
573
|
e.captureEvent(n, t);
|
|
@@ -596,15 +581,14 @@ function k(e) {
|
|
|
596
581
|
t.forEach((e) => e());
|
|
597
582
|
};
|
|
598
583
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
function A(e) {
|
|
584
|
+
// src/inertia/core/diff.ts
|
|
585
|
+
function M(e) {
|
|
602
586
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
603
587
|
}
|
|
604
|
-
function
|
|
605
|
-
return
|
|
588
|
+
function N(e, t) {
|
|
589
|
+
return P(e, t, /* @__PURE__ */ new WeakSet());
|
|
606
590
|
}
|
|
607
|
-
function
|
|
591
|
+
function P(e, t, n) {
|
|
608
592
|
if (e === t) return !0;
|
|
609
593
|
if (e === null || t === null || typeof e != typeof t) return !1;
|
|
610
594
|
if (typeof e == "object") {
|
|
@@ -612,19 +596,18 @@ function M(e, t, n) {
|
|
|
612
596
|
n.add(e), n.add(t);
|
|
613
597
|
}
|
|
614
598
|
try {
|
|
615
|
-
if (Array.isArray(e) && Array.isArray(t)) return e.length === t.length && e.every((e, r) =>
|
|
616
|
-
if (
|
|
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)) {
|
|
617
601
|
let r = Object.keys(e), i = Object.keys(t);
|
|
618
|
-
return r.length === i.length && r.every((r) =>
|
|
602
|
+
return r.length === i.length && r.every((r) => P(e[r], t[r], n));
|
|
619
603
|
}
|
|
620
604
|
return !1;
|
|
621
605
|
} finally {
|
|
622
606
|
typeof e == "object" && (n.delete(e), n.delete(t));
|
|
623
607
|
}
|
|
624
608
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
function N(e) {
|
|
609
|
+
// src/inertia/core/history-capture.ts
|
|
610
|
+
function F(e) {
|
|
628
611
|
if (typeof e != "object" || !e) return null;
|
|
629
612
|
let t = e;
|
|
630
613
|
if (!("page" in t)) return null;
|
|
@@ -633,63 +616,59 @@ function N(e) {
|
|
|
633
616
|
let n = t.page;
|
|
634
617
|
return typeof n.component != "string" || typeof n.props != "object" ? null : t.page;
|
|
635
618
|
}
|
|
636
|
-
function
|
|
637
|
-
return e.url !== t.url || e.component !== t.component || !
|
|
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);
|
|
638
621
|
}
|
|
639
|
-
function
|
|
622
|
+
function L(e) {
|
|
640
623
|
if (typeof window > "u") return () => {};
|
|
641
|
-
let t = history.pushState.bind(history),
|
|
642
|
-
e.detail?.visit?.prefetch || r++;
|
|
643
|
-
}, a = (e) => {
|
|
624
|
+
let t = history.pushState.bind(history), r = history.replaceState.bind(history), a = /* @__PURE__ */ new Set(), o = (e) => {
|
|
644
625
|
let t = e.detail?.visit;
|
|
645
|
-
|
|
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
|
+
});
|
|
631
|
+
}, s = (e) => {
|
|
632
|
+
let t = e.detail?.visit;
|
|
633
|
+
t?.prefetch || typeof t?.id != "string" || a.delete(t.id);
|
|
646
634
|
};
|
|
647
|
-
document.addEventListener("inertia:before",
|
|
648
|
-
function
|
|
635
|
+
document.addEventListener("inertia:before", o), document.addEventListener("inertia:finish", s);
|
|
636
|
+
function c(t, n, r) {
|
|
649
637
|
try {
|
|
650
638
|
e.captureClientVisit(t === "pushState" ? "push" : "replace", n, r);
|
|
651
639
|
} catch (e) {
|
|
652
640
|
console.error("[storefront-devtools] Error in history capture", e);
|
|
653
641
|
}
|
|
654
642
|
}
|
|
655
|
-
function
|
|
643
|
+
function l(t, n) {
|
|
644
|
+
let r = a.size > 0;
|
|
656
645
|
setTimeout(() => {
|
|
657
|
-
let
|
|
658
|
-
|
|
646
|
+
let i = e.currentPage;
|
|
647
|
+
i && I(n, i) && (r || c(t, i, n));
|
|
659
648
|
}, 0);
|
|
660
649
|
}
|
|
661
|
-
function
|
|
662
|
-
let
|
|
663
|
-
if (!
|
|
664
|
-
let
|
|
665
|
-
if (
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
s(t, a);
|
|
672
|
-
} else {
|
|
673
|
-
if (r > 0) {
|
|
674
|
-
r--;
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
if (!P(a, i)) return;
|
|
678
|
-
o(t, i, a);
|
|
679
|
-
}
|
|
650
|
+
function u(t, r) {
|
|
651
|
+
let o = F(r);
|
|
652
|
+
if (!o) return;
|
|
653
|
+
let s = e.currentPage;
|
|
654
|
+
if (!s) return;
|
|
655
|
+
if (o === "encrypted") {
|
|
656
|
+
l(t, s);
|
|
657
|
+
return;
|
|
680
658
|
}
|
|
659
|
+
let u = i(o, { redactKey: n });
|
|
660
|
+
I(s, u) && (a.size > 0 || c(t, u, s));
|
|
681
661
|
}
|
|
682
662
|
return history.pushState = function(e, n, r) {
|
|
683
|
-
t(e, n, r),
|
|
684
|
-
}, history.replaceState = function(e, t,
|
|
685
|
-
|
|
663
|
+
t(e, n, r), u("pushState", e);
|
|
664
|
+
}, history.replaceState = function(e, t, n) {
|
|
665
|
+
r(e, t, n), u("replaceState", e);
|
|
686
666
|
}, () => {
|
|
687
|
-
history.pushState = t, history.replaceState =
|
|
667
|
+
history.pushState = t, history.replaceState = r, document.removeEventListener("inertia:before", o), document.removeEventListener("inertia:finish", s);
|
|
688
668
|
};
|
|
689
669
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
function I(e, t) {
|
|
670
|
+
// src/inertia/core/network.ts
|
|
671
|
+
function R(e, t) {
|
|
693
672
|
if (typeof PerformanceObserver > "u") return () => {};
|
|
694
673
|
let n = new PerformanceObserver((n) => {
|
|
695
674
|
for (let r of n.getEntries()) {
|
|
@@ -712,15 +691,14 @@ function I(e, t) {
|
|
|
712
691
|
buffered: !1
|
|
713
692
|
}), () => n.disconnect();
|
|
714
693
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
function L(e) {
|
|
694
|
+
// src/inertia/core/interceptors.ts
|
|
695
|
+
function z(e) {
|
|
718
696
|
if (!e) return {};
|
|
719
697
|
let t = {};
|
|
720
698
|
for (let [n, r] of Object.entries(e)) t[n.toLowerCase()] = String(r);
|
|
721
699
|
return t;
|
|
722
700
|
}
|
|
723
|
-
function
|
|
701
|
+
function B(e) {
|
|
724
702
|
let t = typeof e == "string" ? (() => {
|
|
725
703
|
try {
|
|
726
704
|
return JSON.parse(e);
|
|
@@ -730,48 +708,46 @@ function R(e) {
|
|
|
730
708
|
})() : e;
|
|
731
709
|
if (typeof t == "object" && t && "props" in t && typeof t.props == "object" && t.props !== null) return t.props;
|
|
732
710
|
}
|
|
733
|
-
var
|
|
734
|
-
function
|
|
735
|
-
let
|
|
711
|
+
var V = 100, H = 1e4;
|
|
712
|
+
function U(e, t) {
|
|
713
|
+
let n = e.onVisitRequest((e, n) => {
|
|
736
714
|
try {
|
|
737
|
-
let
|
|
738
|
-
|
|
715
|
+
let r = z(n.headers);
|
|
716
|
+
t.captureInterceptedRequest(e.id, r);
|
|
739
717
|
} catch (e) {
|
|
740
718
|
console.error("[storefront-devtools] Error capturing intercepted request", e);
|
|
741
719
|
}
|
|
742
720
|
return n;
|
|
743
|
-
}),
|
|
721
|
+
}), r = e.onVisitResponse((e, n) => {
|
|
744
722
|
try {
|
|
745
|
-
let
|
|
746
|
-
|
|
747
|
-
headers:
|
|
748
|
-
props:
|
|
723
|
+
let r = z(n.headers);
|
|
724
|
+
t.captureInterceptedResponse(e.id, {
|
|
725
|
+
headers: r,
|
|
726
|
+
props: B(n.data)
|
|
749
727
|
});
|
|
750
728
|
} catch (e) {
|
|
751
729
|
console.error("[storefront-devtools] Error capturing intercepted response", e);
|
|
752
730
|
}
|
|
753
|
-
return
|
|
731
|
+
return n;
|
|
754
732
|
});
|
|
755
733
|
return () => {
|
|
756
|
-
|
|
734
|
+
n(), r();
|
|
757
735
|
};
|
|
758
736
|
}
|
|
759
|
-
function
|
|
737
|
+
function W(e) {
|
|
760
738
|
if (typeof window > "u") return () => {};
|
|
761
|
-
if (window.__inertia_interceptors__) return
|
|
739
|
+
if (window.__inertia_interceptors__) return U(window.__inertia_interceptors__, e);
|
|
762
740
|
let t, n = Date.now(), r = setInterval(() => {
|
|
763
|
-
window.__inertia_interceptors__ ? (clearInterval(r), t =
|
|
764
|
-
},
|
|
741
|
+
window.__inertia_interceptors__ ? (clearInterval(r), t = U(window.__inertia_interceptors__, e)) : Date.now() - n > H && clearInterval(r);
|
|
742
|
+
}, V);
|
|
765
743
|
return () => {
|
|
766
744
|
clearInterval(r), t?.();
|
|
767
745
|
};
|
|
768
746
|
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
//#region src/inertia/client/publish.ts
|
|
774
|
-
function G(e) {
|
|
747
|
+
// src/inertia/channel.ts
|
|
748
|
+
var G = "storefront-devtools:inertia", K = "storefront-devtools:storefront";
|
|
749
|
+
// src/inertia/client/publish.ts
|
|
750
|
+
function q(e) {
|
|
775
751
|
let { requests: t, currentPage: n, evictedCount: r, paused: i } = e.getState();
|
|
776
752
|
return {
|
|
777
753
|
requests: t,
|
|
@@ -781,12 +757,12 @@ function G(e) {
|
|
|
781
757
|
previousSession: e.previousSessionRequests
|
|
782
758
|
};
|
|
783
759
|
}
|
|
784
|
-
function
|
|
760
|
+
function J(e, t = {}) {
|
|
785
761
|
let n = r({
|
|
786
762
|
...t,
|
|
787
|
-
name:
|
|
763
|
+
name: G,
|
|
788
764
|
functions: {
|
|
789
|
-
getState: { handler: () =>
|
|
765
|
+
getState: { handler: () => q(e) },
|
|
790
766
|
clear: {
|
|
791
767
|
type: "action",
|
|
792
768
|
handler: () => e.clear()
|
|
@@ -799,29 +775,27 @@ function K(e, t = {}) {
|
|
|
799
775
|
events: {}
|
|
800
776
|
}), i = () => ({ currentPage: e.currentPage }), a = r({
|
|
801
777
|
...t,
|
|
802
|
-
name:
|
|
778
|
+
name: K,
|
|
803
779
|
functions: { getState: { handler: i } },
|
|
804
780
|
events: {}
|
|
805
781
|
});
|
|
806
782
|
n.events.on("panel:connected", () => {
|
|
807
|
-
n.emit("state",
|
|
783
|
+
n.emit("state", q(e));
|
|
808
784
|
}), a.events.on("panel:connected", () => {
|
|
809
785
|
a.emit("state", i());
|
|
810
786
|
});
|
|
811
787
|
let s = e.currentPage;
|
|
812
788
|
return e.subscribe(o(() => {
|
|
813
|
-
n.emit("state",
|
|
789
|
+
n.emit("state", q(e)), e.currentPage !== s && (s = e.currentPage, a.emit("state", i()));
|
|
814
790
|
}, 16)), {
|
|
815
791
|
inertia: n,
|
|
816
792
|
storefront: a
|
|
817
793
|
};
|
|
818
794
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
k(e), F(e), I((t) => e.isInertiaRequestUrl(t), (t) => e.captureNetworkTiming(t)), H(e), K(e);
|
|
795
|
+
// 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);
|
|
826
801
|
}
|
|
827
|
-
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/capture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/capture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAkB/D"}
|
|
@@ -70,7 +70,16 @@ export declare class Correlator {
|
|
|
70
70
|
private pushFingerprint;
|
|
71
71
|
private removeFromFingerprintMap;
|
|
72
72
|
private resolveByFingerprint;
|
|
73
|
+
/**
|
|
74
|
+
* Finds the record an event belongs to when the event carries no `visit`.
|
|
75
|
+
*
|
|
76
|
+
* `inertia:navigate`, `inertia:success`, and `inertia:error` carry the id of
|
|
77
|
+
* the visit that produced them, which stays correct when visits overlap.
|
|
78
|
+
* Without it (`beforeUpdate`, `progress`, `flash`), the most recently
|
|
79
|
+
* started visit is the best available guess.
|
|
80
|
+
*/
|
|
73
81
|
private resolveByActiveId;
|
|
82
|
+
private pushEvent;
|
|
74
83
|
private insertRecord;
|
|
75
84
|
private evictOldest;
|
|
76
85
|
private removeFromInertiaVisitIdMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlator.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/correlator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EAGd,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"correlator.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/correlator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EAGd,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAS9C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa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B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,QAAQ,EAAE,CA6CZ;
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/diff.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;AAE/E,mFAAmF;AACnF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,QAAQ,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,QAAQ,EAAE,CA6CZ;AAuDD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAEzD"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { ActiveFeature } from './types';
|
|
2
|
+
/** Badge label, description and documentation link for an Inertia feature. */
|
|
2
3
|
export interface FeatureInfo {
|
|
4
|
+
/** Display label for the feature badge. */
|
|
5
|
+
label: string;
|
|
3
6
|
description: string;
|
|
4
7
|
docsUrl: string;
|
|
5
8
|
}
|
|
9
|
+
export declare const FEATURE_INFO: Record<ActiveFeature['type'], FeatureInfo>;
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
11
|
+
* Retrieves the badge label, description and documentation link for an Inertia feature type.
|
|
8
12
|
* Used by the feature badges and the markdown exporter.
|
|
9
13
|
*
|
|
10
|
-
* @param type - The
|
|
11
|
-
* @returns The matching {@link FeatureInfo}
|
|
14
|
+
* @param type - The feature type, for example `partial`.
|
|
15
|
+
* @returns The matching {@link FeatureInfo}.
|
|
12
16
|
*/
|
|
13
|
-
export declare function getFeatureInfo(type:
|
|
17
|
+
export declare function getFeatureInfo(type: ActiveFeature['type']): FeatureInfo;
|
|
14
18
|
//# sourceMappingURL=feature-info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-info.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/feature-info.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"feature-info.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/feature-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;CAChB;AAID,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,WAAW,CAkEnE,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,WAAW,CAEvE"}
|