react-render-detective 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +299 -0
- package/README.md +2 -2
- package/dist/babel.cjs +2 -2
- package/dist/babel.d.cts +11 -0
- package/dist/babel.d.ts +11 -0
- package/dist/babel.js +1 -1
- package/dist/{chunk-QOGTEVBP.js → chunk-3TZNM7JO.js} +103 -4
- package/dist/chunk-3TZNM7JO.js.map +1 -0
- package/dist/{chunk-HOTY7J3X.js → chunk-D7M4UC3Y.js} +26 -2
- package/dist/chunk-D7M4UC3Y.js.map +1 -0
- package/dist/{chunk-PHYYA67T.cjs → chunk-EXDRRUUQ.cjs} +69 -2
- package/dist/chunk-EXDRRUUQ.cjs.map +1 -0
- package/dist/{chunk-DZ3BZ654.cjs → chunk-LCGXVRJR.cjs} +103 -4
- package/dist/chunk-LCGXVRJR.cjs.map +1 -0
- package/dist/{chunk-MCIQMYNR.js → chunk-QVHAC7AD.js} +69 -2
- package/dist/chunk-QVHAC7AD.js.map +1 -0
- package/dist/{chunk-JD4IJ4MN.cjs → chunk-RGT44QQI.cjs} +26 -2
- package/dist/chunk-RGT44QQI.cjs.map +1 -0
- package/dist/core.cjs +18 -18
- package/dist/core.d.cts +27 -3
- package/dist/core.d.ts +27 -3
- package/dist/core.js +1 -1
- package/dist/index.cjs +197 -295
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -115
- package/dist/index.d.ts +35 -115
- package/dist/index.js +166 -258
- package/dist/index.js.map +1 -1
- package/dist/interactions.cjs +252 -0
- package/dist/interactions.cjs.map +1 -0
- package/dist/interactions.d.cts +110 -0
- package/dist/interactions.d.ts +110 -0
- package/dist/interactions.js +241 -0
- package/dist/interactions.js.map +1 -0
- package/dist/overlay.cjs +5 -5
- package/dist/overlay.js +2 -2
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{types-gl13xwmN.d.cts → types-CRET8EhB.d.cts} +20 -2
- package/dist/{types-gl13xwmN.d.ts → types-CRET8EhB.d.ts} +20 -2
- package/dist/vite.cjs +2 -2
- package/dist/vite.js +1 -1
- package/package.json +14 -4
- package/dist/chunk-DZ3BZ654.cjs.map +0 -1
- package/dist/chunk-HOTY7J3X.js.map +0 -1
- package/dist/chunk-JD4IJ4MN.cjs.map +0 -1
- package/dist/chunk-MCIQMYNR.js.map +0 -1
- package/dist/chunk-PHYYA67T.cjs.map +0 -1
- package/dist/chunk-QOGTEVBP.js.map +0 -1
|
@@ -326,6 +326,20 @@ function diagnose(input, thresholds) {
|
|
|
326
326
|
function classify(input) {
|
|
327
327
|
const { changedProps, contextChanges, parentRendered, parentUnknown, parentName } = input;
|
|
328
328
|
if (input.phase === "mount") {
|
|
329
|
+
if (input.remounts >= 2 && input.treeReloadSuspected && !input.inlineDefinitionSuspected) {
|
|
330
|
+
return make(
|
|
331
|
+
"mount",
|
|
332
|
+
"low",
|
|
333
|
+
`${input.componentName} was rebuilt along with several other components \u2014 most likely a hot reload or a route change.`,
|
|
334
|
+
[
|
|
335
|
+
`${input.componentName} has been remounted ${input.remounts}\xD7 in total.`,
|
|
336
|
+
"Several unrelated components remounted at the same moment, which is what a whole-tree rebuild looks like \u2014 React Fast Refresh replacing a module, or a route unmounting.",
|
|
337
|
+
"A per-component remount problem affects one component, not many at once."
|
|
338
|
+
],
|
|
339
|
+
false,
|
|
340
|
+
"Nothing to fix if this followed an edit or a navigation. Reload the page and repeat the interaction to measure without it."
|
|
341
|
+
);
|
|
342
|
+
}
|
|
329
343
|
if (input.remounts >= 2) {
|
|
330
344
|
const inline = input.inlineDefinitionSuspected;
|
|
331
345
|
return make(
|
|
@@ -343,6 +357,35 @@ function classify(input) {
|
|
|
343
357
|
}
|
|
344
358
|
return make("mount", "high", `${input.componentName} mounted.`, ["First render of this instance."], false);
|
|
345
359
|
}
|
|
360
|
+
if (input.selectorChanges.length > 0) {
|
|
361
|
+
const changes = input.selectorChanges;
|
|
362
|
+
const unstable = changes.filter((c) => c.referenceOnly);
|
|
363
|
+
const names = changes.map((c) => c.name);
|
|
364
|
+
const evidence = changes.map(
|
|
365
|
+
(c) => `\`${c.name}\`${c.source ? ` (${c.source})` : ""}: ${formatInspected(c.previous)} \u2192 ${formatInspected(c.current)}` + (c.referenceOnly ? " \u2014 new reference, identical contents" : "")
|
|
366
|
+
);
|
|
367
|
+
if (unstable.length > 0) {
|
|
368
|
+
const worst = unstable[0];
|
|
369
|
+
evidence.push(
|
|
370
|
+
"useSelector compares with Object.is, so a selector that builds a new value each call re-renders the component on every store update \u2014 not only when its data changes."
|
|
371
|
+
);
|
|
372
|
+
return make(
|
|
373
|
+
"store",
|
|
374
|
+
"high",
|
|
375
|
+
`${input.componentName} rendered because ${unstable.map((c) => `\`${c.name}\``).join(", ")} returned a new reference with identical contents.`,
|
|
376
|
+
evidence,
|
|
377
|
+
true,
|
|
378
|
+
`Make \`${worst.name}\`${worst.source ? ` at ${worst.source}` : ""} return a stable value: select the raw slice and derive outside the selector, memoize it with createSelector, or pass an equality function such as shallowEqual.`
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
return make(
|
|
382
|
+
"store",
|
|
383
|
+
"high",
|
|
384
|
+
`${input.componentName} rendered because ${names.join(", ")} changed in the store.`,
|
|
385
|
+
[...evidence, "The values genuinely changed, so this render is doing real work."],
|
|
386
|
+
false
|
|
387
|
+
);
|
|
388
|
+
}
|
|
346
389
|
if (input.trackedState.length > 0) {
|
|
347
390
|
const names = input.trackedState.map((s) => s.name);
|
|
348
391
|
const evidence = input.trackedState.map(
|
|
@@ -425,7 +468,7 @@ function classify(input) {
|
|
|
425
468
|
[
|
|
426
469
|
"No new props came from above: the wrapper did not re-render.",
|
|
427
470
|
input.selfRenderProven ? "An instrumented child re-rendered from above in this commit, which proves this component produced it." : "No instrumented descendant rendered in this commit, so an uninstrumented descendant could in principle be the origin instead.",
|
|
428
|
-
"React does not expose hook state without private internals, so the exact source is not observable. Use useTrackedState to name
|
|
471
|
+
"React does not expose hook state without private internals, so the exact source is not observable. Use useTrackedState to name local state, and the build plugin's store tracking to name selectors."
|
|
429
472
|
],
|
|
430
473
|
false
|
|
431
474
|
);
|
|
@@ -587,15 +630,19 @@ var RingBuffer = class {
|
|
|
587
630
|
|
|
588
631
|
// src/core/store.ts
|
|
589
632
|
var now = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
633
|
+
var RELOAD_COMPONENT_THRESHOLD = 3;
|
|
634
|
+
var RELOAD_WINDOW_MS = 1500;
|
|
590
635
|
var INLINE_DEFINITION_WINDOW_MS = 5e3;
|
|
591
636
|
var timestamp = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
592
637
|
var EMPTY_STATE = [];
|
|
638
|
+
var EMPTY_SELECTORS = [];
|
|
593
639
|
var DURATION_SAMPLE = 200;
|
|
594
640
|
var SWEEP_DELAY_MS = 250;
|
|
595
641
|
var emptyReasons = () => ({
|
|
596
642
|
mount: 0,
|
|
597
643
|
props: 0,
|
|
598
644
|
state: 0,
|
|
645
|
+
store: 0,
|
|
599
646
|
parent: 0,
|
|
600
647
|
context: 0,
|
|
601
648
|
"state-or-external": 0,
|
|
@@ -606,6 +653,9 @@ var Detective = class {
|
|
|
606
653
|
this.config = { ...defaultConfig };
|
|
607
654
|
this.nodes = /* @__PURE__ */ new Map();
|
|
608
655
|
this.listeners = /* @__PURE__ */ new Set();
|
|
656
|
+
/** Registered by optional entry points so they follow clear()/reset() without being imported here. */
|
|
657
|
+
this.clearHooks = /* @__PURE__ */ new Set();
|
|
658
|
+
this.resetHooks = /* @__PURE__ */ new Set();
|
|
609
659
|
this.pending = [];
|
|
610
660
|
this.contextChanges = [];
|
|
611
661
|
/** Orders renders and context updates so they can be matched without timers. */
|
|
@@ -645,6 +695,12 @@ var Detective = class {
|
|
|
645
695
|
get enabled() {
|
|
646
696
|
return this.config.enabled;
|
|
647
697
|
}
|
|
698
|
+
registerClearHook(hook) {
|
|
699
|
+
this.clearHooks.add(hook);
|
|
700
|
+
}
|
|
701
|
+
registerResetHook(hook) {
|
|
702
|
+
this.resetHooks.add(hook);
|
|
703
|
+
}
|
|
648
704
|
subscribe(listener) {
|
|
649
705
|
this.listeners.add(listener);
|
|
650
706
|
return () => {
|
|
@@ -669,6 +725,7 @@ var Detective = class {
|
|
|
669
725
|
sampled,
|
|
670
726
|
attempts: 0,
|
|
671
727
|
pendingState: [],
|
|
728
|
+
pendingSelectors: [],
|
|
672
729
|
seenCommit: false,
|
|
673
730
|
renderNumber: 0,
|
|
674
731
|
lastCommitTime: -1,
|
|
@@ -699,7 +756,10 @@ var Detective = class {
|
|
|
699
756
|
node.everAttached = true;
|
|
700
757
|
const life = this.lifecycleFor(node.name);
|
|
701
758
|
life.mounts++;
|
|
702
|
-
if (life.unmounts > 0)
|
|
759
|
+
if (life.unmounts > 0) {
|
|
760
|
+
life.remounts++;
|
|
761
|
+
life.lastRemountAt = timestamp();
|
|
762
|
+
}
|
|
703
763
|
}
|
|
704
764
|
detach(node) {
|
|
705
765
|
this.nodes.delete(node.id);
|
|
@@ -750,6 +810,22 @@ var Detective = class {
|
|
|
750
810
|
lifecycleOf(name) {
|
|
751
811
|
return this.lifecycles.get(name) ?? { mounts: 0, unmounts: 0, remounts: 0 };
|
|
752
812
|
}
|
|
813
|
+
/**
|
|
814
|
+
* Did a whole-tree rebuild just happen?
|
|
815
|
+
*
|
|
816
|
+
* Hot reload is the most common cause of remounts in development, and this
|
|
817
|
+
* tool only ever runs in development — so without this it would confidently
|
|
818
|
+
* blame a `key` every time React Fast Refresh replaced a module. A real key
|
|
819
|
+
* or inline-definition problem affects one component; a reload affects many
|
|
820
|
+
* at once.
|
|
821
|
+
*/
|
|
822
|
+
reloadSuspectedAt(at) {
|
|
823
|
+
let names = 0;
|
|
824
|
+
for (const life of this.lifecycles.values()) {
|
|
825
|
+
if (life.lastRemountAt !== void 0 && Math.abs(at - life.lastRemountAt) <= RELOAD_WINDOW_MS) names++;
|
|
826
|
+
}
|
|
827
|
+
return names >= RELOAD_COMPONENT_THRESHOLD;
|
|
828
|
+
}
|
|
753
829
|
/** Hot path. Must stay allocation-free and O(1). */
|
|
754
830
|
recordAttempt(node, props) {
|
|
755
831
|
node.attempts++;
|
|
@@ -758,6 +834,9 @@ var Detective = class {
|
|
|
758
834
|
recordStateChange(node, change) {
|
|
759
835
|
if (node.pendingState.length < 16) node.pendingState.push(change);
|
|
760
836
|
}
|
|
837
|
+
recordSelectorChange(node, change) {
|
|
838
|
+
if (node.pendingSelectors.length < 16) node.pendingSelectors.push(change);
|
|
839
|
+
}
|
|
761
840
|
/**
|
|
762
841
|
* Hot path. Called from Profiler#onRender; only enqueues.
|
|
763
842
|
*
|
|
@@ -772,12 +851,14 @@ var Detective = class {
|
|
|
772
851
|
attempts: node.attempts,
|
|
773
852
|
props: node.pendingProps,
|
|
774
853
|
state: node.pendingState.length > 0 ? node.pendingState : EMPTY_STATE,
|
|
854
|
+
selectors: node.pendingSelectors.length > 0 ? node.pendingSelectors : EMPTY_SELECTORS,
|
|
775
855
|
seq: ++this.seq
|
|
776
856
|
});
|
|
777
857
|
node.seenCommit = true;
|
|
778
858
|
node.attempts = 0;
|
|
779
859
|
node.pendingProps = void 0;
|
|
780
860
|
if (node.pendingState.length > 0) node.pendingState = [];
|
|
861
|
+
if (node.pendingSelectors.length > 0) node.pendingSelectors = [];
|
|
781
862
|
node.lastCommitTime = commit.commitTime;
|
|
782
863
|
this.scheduleFlush();
|
|
783
864
|
}
|
|
@@ -889,6 +970,7 @@ var Detective = class {
|
|
|
889
970
|
const selfDuration = Math.max(0, rec.subtreeDuration - accounted);
|
|
890
971
|
const relevantContexts = contexts.filter((c) => c.commitTime === rec.commitTime);
|
|
891
972
|
const trackedState = rec.state;
|
|
973
|
+
const selectorChanges = rec.selectors;
|
|
892
974
|
node.renderNumber++;
|
|
893
975
|
const diagnosis = diagnose(
|
|
894
976
|
{
|
|
@@ -905,8 +987,10 @@ var Detective = class {
|
|
|
905
987
|
attempts: rec.attempts,
|
|
906
988
|
committed: true,
|
|
907
989
|
trackedState,
|
|
990
|
+
selectorChanges,
|
|
908
991
|
remounts: this.lifecycleOf(node.name).remounts,
|
|
909
992
|
inlineDefinitionSuspected: this.inlineDefinitionSuspected(node.name),
|
|
993
|
+
treeReloadSuspected: rec.phase === "mount" && this.reloadSuspectedAt(timestamp()),
|
|
910
994
|
priorAvoidableRenders: node.stats.potentiallyAvoidableRenders
|
|
911
995
|
},
|
|
912
996
|
this.config.thresholds
|
|
@@ -939,6 +1023,7 @@ var Detective = class {
|
|
|
939
1023
|
selfOriginated: propsReevaluated === false,
|
|
940
1024
|
contextChanges: relevantContexts,
|
|
941
1025
|
trackedState,
|
|
1026
|
+
selectorChanges,
|
|
942
1027
|
committed: true,
|
|
943
1028
|
attempts: Math.max(1, rec.attempts),
|
|
944
1029
|
devReplay: rec.attempts > 1,
|
|
@@ -1013,6 +1098,12 @@ var Detective = class {
|
|
|
1013
1098
|
};
|
|
1014
1099
|
}
|
|
1015
1100
|
clear() {
|
|
1101
|
+
for (const hook of this.clearHooks) {
|
|
1102
|
+
try {
|
|
1103
|
+
hook();
|
|
1104
|
+
} catch {
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1016
1107
|
this.events.clear();
|
|
1017
1108
|
this.pending.length = 0;
|
|
1018
1109
|
this.contextChanges.length = 0;
|
|
@@ -1034,7 +1125,15 @@ var Detective = class {
|
|
|
1034
1125
|
}
|
|
1035
1126
|
/** Full teardown — used by tests and by HMR disposal. */
|
|
1036
1127
|
reset() {
|
|
1128
|
+
for (const hook of this.resetHooks) {
|
|
1129
|
+
try {
|
|
1130
|
+
hook();
|
|
1131
|
+
} catch {
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
this.resetHooks.clear();
|
|
1037
1135
|
this.clear();
|
|
1136
|
+
this.clearHooks.clear();
|
|
1038
1137
|
this.nodes.clear();
|
|
1039
1138
|
this.lifecycles.clear();
|
|
1040
1139
|
this.definitions.clear();
|
|
@@ -1123,5 +1222,5 @@ exports.severityFor = severityFor;
|
|
|
1123
1222
|
exports.shallowEqual = shallowEqual;
|
|
1124
1223
|
exports.shouldInstrument = shouldInstrument;
|
|
1125
1224
|
exports.valueType = valueType;
|
|
1126
|
-
//# sourceMappingURL=chunk-
|
|
1127
|
-
//# sourceMappingURL=chunk-
|
|
1225
|
+
//# sourceMappingURL=chunk-LCGXVRJR.cjs.map
|
|
1226
|
+
//# sourceMappingURL=chunk-LCGXVRJR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/inspect.ts","../src/core/config.ts","../src/core/compare.ts","../src/core/diagnose.ts","../src/core/ringBuffer.ts","../src/core/store.ts"],"names":["take","keys","evidence","now"],"mappings":";;;AAEA,IAAM,aAAA,mBAAgB,MAAA,CAAO,GAAA,CAAI,eAAe,CAAA;AAChD,IAAM,0BAAA,mBAA6B,MAAA,CAAO,GAAA,CAAI,4BAA4B,CAAA;AAEnE,SAAS,eAAe,KAAA,EAAyB;AACtD,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,MAAM,OAAO,KAAA;AACxD,EAAA,MAAM,IAAK,KAAA,CAAgC,QAAA;AAC3C,EAAA,OAAO,CAAA,KAAM,iBAAiB,CAAA,KAAM,0BAAA;AACtC;AAEO,SAAS,cAAc,KAAA,EAAkD;AAC9E,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,MAAM,OAAO,KAAA;AACxD,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAO,KAAA;AACjC,EAAA,IAAI,cAAA,CAAe,KAAK,CAAA,EAAG,OAAO,KAAA;AAClC,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,cAAA,CAAe,KAAK,CAAA;AACzC,EAAA,OAAO,KAAA,KAAU,MAAA,CAAO,SAAA,IAAa,KAAA,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A;AACV,EAAA,IAAI,CAAC,EAAE,GAAG,CAAA,IAAK,GAAG,CAAA,GAAI,IAAI,SAAA,EAAU;AACpC,EAAA,OAAO,EAAE,GAAG,CAAA;AACd","file":"chunk-LCGXVRJR.cjs","sourcesContent":["import type { Inspected, InspectionLimits, PropValueType } from \"./types.js\";\n\nconst REACT_ELEMENT = Symbol.for(\"react.element\");\nconst REACT_TRANSITIONAL_ELEMENT = Symbol.for(\"react.transitional.element\");\n\nexport function isReactElement(value: unknown): boolean {\n if (typeof value !== \"object\" || value === null) return false;\n const t = (value as { $$typeof?: symbol }).$$typeof;\n return t === REACT_ELEMENT || t === REACT_TRANSITIONAL_ELEMENT;\n}\n\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null) return false;\n if (Array.isArray(value)) return false;\n if (isReactElement(value)) return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\nexport function valueType(value: unknown): PropValueType {\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"array\";\n if (isReactElement(value)) return \"element\";\n const t = typeof value;\n if (t === \"object\") return \"object\";\n if (t === \"function\") return \"function\";\n return t as PropValueType;\n}\n\nfunction elementName(value: unknown): string {\n const type = (value as { type?: unknown }).type;\n if (typeof type === \"string\") return type;\n if (typeof type === \"function\") return (type as { displayName?: string; name?: string }).displayName ?? (type as { name?: string }).name ?? \"Anonymous\";\n return \"Element\";\n}\n\n/**\n * Bounded, cycle-safe, non-retaining snapshot.\n *\n * Deliberately not `JSON.stringify`: that throws on cycles and BigInt, drops\n * `undefined`/functions/symbols, and has no size ceiling.\n */\nexport function inspect(value: unknown, limits: InspectionLimits): Inspected {\n const budget = { nodes: limits.maxSerializedNodes };\n try {\n return walk(value, limits, budget, limits.depth, new WeakSet<object>());\n } catch {\n return { t: \"truncated\", hint: \"inspection failed\" };\n }\n}\n\nfunction walk(\n value: unknown,\n limits: InspectionLimits,\n budget: { nodes: number },\n depth: number,\n seen: WeakSet<object>,\n): Inspected {\n if (budget.nodes-- <= 0) return { t: \"truncated\", hint: \"size limit\" };\n\n if (value === undefined) return { t: \"undefined\" };\n if (value === null) return { t: \"primitive\", v: null };\n\n const type = typeof value;\n if (type === \"number\") return Number.isNaN(value) ? { t: \"nan\" } : { t: \"primitive\", v: value as number };\n if (type === \"boolean\") return { t: \"primitive\", v: value as boolean };\n if (type === \"string\") {\n const s = value as string;\n return {\n t: \"primitive\",\n v: s.length > limits.maxStringLength ? `${s.slice(0, limits.maxStringLength)}…(+${s.length - limits.maxStringLength})` : s,\n };\n }\n if (type === \"symbol\") return { t: \"symbol\", v: String(value) };\n if (type === \"bigint\") return { t: \"bigint\", v: `${String(value)}n` };\n if (type === \"function\") {\n const fn = value as { displayName?: string; name?: string };\n return { t: \"function\", name: fn.displayName ?? fn.name ?? \"anonymous\" };\n }\n\n const obj = value as object;\n if (seen.has(obj)) return { t: \"circular\" };\n seen.add(obj);\n\n if (isReactElement(obj)) return { t: \"element\", name: elementName(obj) };\n\n if (Array.isArray(obj)) {\n const length = obj.length;\n if (depth <= 0) return { t: \"array\", length };\n const take = Math.min(length, limits.maxArrayLength);\n const items: Inspected[] = [];\n for (let i = 0; i < take; i++) items.push(walk(obj[i], limits, budget, depth - 1, seen));\n return { t: \"array\", length, items, truncated: take < length };\n }\n\n const ctor = objectTag(obj);\n let keys: string[];\n try {\n keys = Object.keys(obj as Record<string, unknown>);\n } catch {\n return { t: \"object\", ctor };\n }\n if (depth <= 0) {\n return { t: \"object\", ctor, keys: keys.slice(0, limits.maxObjectKeys), truncated: keys.length > limits.maxObjectKeys };\n }\n const take = Math.min(keys.length, limits.maxObjectKeys);\n const entries: Record<string, Inspected> = {};\n for (let i = 0; i < take; i++) {\n const k = keys[i] as string;\n let v: unknown;\n try {\n v = (obj as Record<string, unknown>)[k];\n } catch {\n // A throwing getter must never take down the app being debugged.\n entries[k] = { t: \"truncated\", hint: \"getter threw\" };\n continue;\n }\n entries[k] = walk(v, limits, budget, depth - 1, seen);\n }\n return { t: \"object\", ctor, entries, truncated: take < keys.length };\n}\n\nfunction objectTag(obj: object): string | undefined {\n const proto = Object.getPrototypeOf(obj);\n if (proto === Object.prototype || proto === null) return undefined;\n const name = proto?.constructor?.name;\n return typeof name === \"string\" && name !== \"Object\" ? name : undefined;\n}\n\n/** Single-line rendering for console output. */\nexport function formatInspected(node: Inspected | undefined): string {\n if (!node) return \"…\";\n switch (node.t) {\n case \"primitive\":\n return typeof node.v === \"string\" ? JSON.stringify(node.v) : String(node.v);\n case \"undefined\":\n return \"undefined\";\n case \"nan\":\n return \"NaN\";\n case \"symbol\":\n case \"bigint\":\n return node.v;\n case \"function\":\n return `ƒ ${node.name}()`;\n case \"element\":\n return `<${node.name} />`;\n case \"circular\":\n return \"[Circular]\";\n case \"truncated\":\n return `[… ${node.hint}]`;\n case \"array\": {\n if (!node.items) return `Array(${node.length})`;\n const body = node.items.map(formatInspected).join(\", \");\n return `[${body}${node.truncated ? \", …\" : \"\"}]`;\n }\n case \"object\": {\n const prefix = node.ctor ? `${node.ctor} ` : \"\";\n if (node.entries) {\n const body = Object.entries(node.entries)\n .map(([k, v]) => `${k}: ${formatInspected(v)}`)\n .join(\", \");\n return `${prefix}{ ${body}${node.truncated ? \", …\" : \"\"} }`;\n }\n if (node.keys) return `${prefix}{ ${node.keys.join(\", \")}${node.truncated ? \", …\" : \"\"} }`;\n return `${prefix}{…}`;\n }\n }\n}\n","import type { DetectiveConfig, DetectiveOptions } from \"./types.js\";\n\ndeclare const process: { env?: Record<string, string | undefined> } | undefined;\n\n/**\n * Positive production detection.\n *\n * Deliberately asymmetric: this returns `true` only when it can actually *see*\n * `NODE_ENV === \"production\"`. Anything else — including environments where\n * `process` does not exist at all, such as a Vite dev server in the browser —\n * is \"not known to be production\".\n *\n * The earlier version asked the opposite question (\"is this dev?\") and answered\n * `false` when it could not tell, which meant the documented Vite quick-start\n * turned the tool on and then silently recorded nothing.\n */\nexport function detectProduction(): boolean {\n try {\n const env = typeof process !== \"undefined\" ? process?.env : undefined;\n if (env && env.NODE_ENV) return env.NODE_ENV === \"production\";\n } catch {\n /* ignore */\n }\n return false;\n}\n\n/** @deprecated Use `detectProduction()`. Kept so existing imports keep working. */\nexport function detectDev(): boolean {\n return !detectProduction();\n}\n\nexport const defaultConfig: DetectiveConfig = {\n // Off until `init()` is called, so importing the package costs nothing.\n enabled: false,\n mode: \"console\",\n include: [],\n exclude: [],\n samplingRate: 1,\n maxEvents: 1000,\n slowRenderThreshold: 16,\n thresholds: { monitor: 5, slow: 16, verySlow: 50, critical: 100 },\n inspection: {\n depth: 1,\n maxObjectKeys: 20,\n maxArrayLength: 20,\n maxStringLength: 120,\n maxSerializedNodes: 200,\n },\n compareFunctionSource: false,\n};\n\nexport function mergeConfig(base: DetectiveConfig, options: DetectiveOptions = {}): DetectiveConfig {\n const { thresholds, inspection, ...rest } = options;\n const next: DetectiveConfig = {\n ...base,\n ...(rest as Partial<DetectiveConfig>),\n thresholds: { ...base.thresholds, ...thresholds },\n inspection: { ...base.inspection, ...inspection },\n };\n next.samplingRate = clamp(next.samplingRate, 0, 1);\n next.maxEvents = Math.max(1, Math.floor(next.maxEvents));\n next.inspection.depth = clamp(Math.floor(next.inspection.depth), 0, 6);\n return next;\n}\n\nfunction clamp(n: number, lo: number, hi: number): number {\n if (typeof n !== \"number\" || Number.isNaN(n)) return lo;\n return Math.min(hi, Math.max(lo, n));\n}\n\nexport function matches(name: string, patterns: Array<string | RegExp>): boolean {\n for (const p of patterns) {\n if (typeof p === \"string\" ? p === name : p.test(name)) return true;\n }\n return false;\n}\n\n/** Filter policy: exclude wins over include; empty include means \"everything\". */\nexport function shouldInstrument(name: string, config: DetectiveConfig): boolean {\n if (matches(name, config.exclude)) return false;\n if (config.include.length > 0 && !matches(name, config.include)) return false;\n return true;\n}\n","import { inspect, isPlainObject, isReactElement, valueType } from \"./inspect.js\";\nimport type { DetectiveConfig, Inspected, PropChange } from \"./types.js\";\n\nexport interface PropsDiff {\n changed: PropChange[];\n unchanged: string[];\n}\n\n/** Result of a bounded contents comparison. `undefined` = could not determine. */\ntype ShallowResult = boolean | undefined;\n\nconst EMPTY: Record<string, unknown> = {};\n\nexport function diffProps(\n previous: Record<string, unknown> | undefined,\n current: Record<string, unknown> | undefined,\n config: DetectiveConfig,\n): PropsDiff {\n const prev = previous ?? EMPTY;\n const next = current ?? EMPTY;\n const changed: PropChange[] = [];\n const unchanged: string[] = [];\n\n const keys = new Set<string>();\n for (const k in prev) keys.add(k);\n for (const k in next) keys.add(k);\n\n for (const key of keys) {\n const hadPrev = key in prev;\n const hasNext = key in next;\n const a = prev[key];\n const b = next[key];\n\n if (hadPrev && hasNext && Object.is(a, b)) {\n unchanged.push(key);\n continue;\n }\n if (!hadPrev) {\n changed.push({ key, kind: \"added\", valueType: valueType(b), current: snap(b, config) });\n continue;\n }\n if (!hasNext) {\n changed.push({ key, kind: \"removed\", valueType: valueType(a), previous: snap(a, config) });\n continue;\n }\n changed.push(describeChange(key, a, b, config));\n }\n\n return { changed, unchanged };\n}\n\nfunction describeChange(key: string, a: unknown, b: unknown, config: DetectiveConfig): PropChange {\n const type = valueType(b);\n const base: PropChange = {\n key,\n kind: \"value\",\n valueType: type,\n previous: snap(a, config),\n current: snap(b, config),\n };\n\n if (typeof a === \"function\" && typeof b === \"function\") {\n base.kind = \"reference\";\n if (config.compareFunctionSource) {\n base.sourceEqual = safeSource(a) === safeSource(b);\n }\n return base;\n }\n\n const shallow = shallowEqual(a, b, config);\n if (shallow === true) {\n base.kind = \"reference\";\n base.shallowEqual = true;\n } else if (shallow === false) {\n base.kind = \"value\";\n base.shallowEqual = false;\n }\n return base;\n}\n\n/**\n * Bounded shallow comparison. Returns `undefined` rather than guessing when the\n * values are too large or of a shape we cannot compare cheaply — the diagnostic\n * engine treats that as \"unknown\", never as \"equal\".\n */\nexport function shallowEqual(a: unknown, b: unknown, config: DetectiveConfig): ShallowResult {\n if (Object.is(a, b)) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) return false;\n\n const { maxObjectKeys, maxArrayLength } = config.inspection;\n\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b)) return false;\n if (a.length !== b.length) return false;\n if (a.length > maxArrayLength) return undefined;\n for (let i = 0; i < a.length; i++) if (!Object.is(a[i], b[i])) return false;\n return true;\n }\n\n if (a instanceof Date || b instanceof Date) {\n return a instanceof Date && b instanceof Date ? a.getTime() === b.getTime() : false;\n }\n\n if (isReactElement(a) && isReactElement(b)) {\n const ea = a as { type: unknown; key: unknown; props: unknown };\n const eb = b as { type: unknown; key: unknown; props: unknown };\n if (ea.type !== eb.type || ea.key !== eb.key) return false;\n return shallowEqual(ea.props, eb.props, config);\n }\n\n if (!isPlainObject(a) || !isPlainObject(b)) return undefined;\n\n const ka = Object.keys(a);\n const kb = Object.keys(b);\n if (ka.length !== kb.length) return false;\n if (ka.length > maxObjectKeys) return undefined;\n for (const k of ka) {\n if (!Object.prototype.hasOwnProperty.call(b, k)) return false;\n if (!Object.is(a[k], b[k])) return false;\n }\n return true;\n}\n\nfunction snap(value: unknown, config: DetectiveConfig): Inspected {\n return inspect(value, config.inspection);\n}\n\nfunction safeSource(fn: unknown): string {\n try {\n return Function.prototype.toString.call(fn);\n } catch {\n return \"\";\n }\n}\n","import { formatInspected } from \"./inspect.js\";\nimport type {\n Confidence,\n ContextChange,\n SelectorChange,\n TrackedStateChange,\n Diagnosis,\n PropChange,\n RenderPhase,\n Thresholds,\n} from \"./types.js\";\n\nexport interface DiagnosisInput {\n componentName: string;\n phase: RenderPhase;\n parentName?: string;\n /** Nearest instrumented ancestor re-rendered in this same commit. */\n parentRendered: boolean;\n /** True when we have no instrumented ancestor, so `parentRendered` is unknown. */\n parentUnknown: boolean;\n /**\n * Did something above re-evaluate this component's props?\n * `true` — the wrapper re-rendered, so the render came from above.\n * `false` — it did not, so the render started here or below.\n * `undefined` — hook mode, where the two cannot be told apart.\n */\n propsReevaluated: boolean | undefined;\n /** An instrumented child re-rendered from above, proving this component rendered. */\n selfRenderProven: boolean;\n changedProps: PropChange[];\n contextChanges: ContextChange[];\n /** Named state updates from `useTrackedState`. Empty unless opted in. */\n trackedState: TrackedStateChange[];\n /** External-store selector values that changed. Empty unless selectors are tracked. */\n selectorChanges: SelectorChange[];\n /** How many times this component has been rebuilt rather than re-rendered. */\n remounts: number;\n /** The component looks like it is declared inside another component's render body. */\n inlineDefinitionSuspected: boolean;\n /** Many components remounted at once — a hot reload or a route change. */\n treeReloadSuspected: boolean;\n selfDuration: number;\n attempts: number;\n committed: boolean;\n /** How many times this component already produced a \"no observable change\" render. */\n priorAvoidableRenders: number;\n}\n\nexport function severityFor(duration: number, t: Thresholds): Diagnosis[\"severity\"] {\n if (duration >= t.critical) return \"critical\";\n if (duration >= t.verySlow) return \"very-slow\";\n if (duration >= t.slow) return \"slow\";\n if (duration >= t.monitor) return \"monitor\";\n return \"normal\";\n}\n\n/**\n * Pure. No React, no globals, no I/O — so diagnostic correctness can be tested\n * directly (§70).\n */\nexport function diagnose(input: DiagnosisInput, thresholds: Thresholds): Diagnosis {\n const severity = severityFor(input.selfDuration, thresholds);\n const d = classify(input);\n d.severity = severity;\n\n if (!input.committed) {\n d.evidence.unshift(\n \"This render attempt was not committed — React discarded it (concurrent interruption or a development replay). It is excluded from statistics.\",\n );\n } else if (input.attempts > 1) {\n d.evidence.push(\n `Render function ran ${input.attempts}× for one commit — a development replay (StrictMode double-invoke or a discarded attempt). Not production behaviour.`,\n );\n }\n\n if (severity === \"critical\" || severity === \"very-slow\") {\n d.evidence.push(`Render cost ${fmt(input.selfDuration)} — above the ${thresholds.verySlow}ms threshold.`);\n }\n return d;\n}\n\nfunction classify(input: DiagnosisInput): Diagnosis {\n const { changedProps, contextChanges, parentRendered, parentUnknown, parentName } = input;\n\n if (input.phase === \"mount\") {\n /*\n * A remount is not a render: React threw the previous instance away, along\n * with its DOM and all of its state, and built a new one. It costs far more\n * than any re-render, so it is worth saying loudly — but only when it has\n * actually happened repeatedly, since mounting is also just what happens\n * when a list grows or a route changes.\n */\n /*\n * Hot reload rebuilds the tree, and this tool only runs in development, so\n * this is the most frequent cause of remounts it will ever see. Blaming a\n * `key` for it would be confidently wrong several times an hour.\n */\n if (input.remounts >= 2 && input.treeReloadSuspected && !input.inlineDefinitionSuspected) {\n return make(\n \"mount\",\n \"low\",\n `${input.componentName} was rebuilt along with several other components — most likely a hot reload or a route change.`,\n [\n `${input.componentName} has been remounted ${input.remounts}× in total.`,\n \"Several unrelated components remounted at the same moment, which is what a whole-tree rebuild looks like — React Fast Refresh replacing a module, or a route unmounting.\",\n \"A per-component remount problem affects one component, not many at once.\",\n ],\n false,\n \"Nothing to fix if this followed an edit or a navigation. Reload the page and repeat the interaction to measure without it.\",\n );\n }\n\n if (input.remounts >= 2) {\n const inline = input.inlineDefinitionSuspected;\n return make(\n \"mount\",\n inline ? \"high\" : \"medium\",\n `${input.componentName} was rebuilt, not re-rendered — this is remount ${input.remounts + 1}.`,\n [\n `This component has been unmounted and mounted again ${input.remounts}× — its DOM and all of its state were discarded each time.`,\n inline\n ? \"Its definition is being re-created repeatedly in a short window, which means it is declared *inside* another component's render body. React sees a new component type on every parent render and cannot reuse anything.\"\n : \"Its definition is stable, so the remounts come from the element identity changing — usually a changing `key`, or the component moving between branches of a conditional.\",\n \"A remount is much more expensive than a re-render, and it resets state.\",\n ],\n true,\n inline\n ? `Move ${input.componentName} out of its parent's render body to module scope. Defining a component inside another component makes React discard and rebuild the whole subtree on every parent render.`\n : `Check the \\`key\\` given to ${input.componentName}, and whether it is being rendered from a different branch each time.`,\n );\n }\n return make(\"mount\", \"high\", `${input.componentName} mounted.`, [\"First render of this instance.\"], false);\n }\n\n /*\n * A tracked selector is direct evidence, so it outranks everything except a\n * named local state update. Before this existed, a Redux-driven render could\n * only ever be reported as \"state or an external store\" — which is where the\n * tool stopped being useful on a real application, since that covers the\n * majority of renders in most React codebases.\n */\n if (input.selectorChanges.length > 0) {\n const changes = input.selectorChanges;\n const unstable = changes.filter((c) => c.referenceOnly);\n const names = changes.map((c) => c.name);\n\n const evidence = changes.map(\n (c) =>\n `\\`${c.name}\\`${c.source ? ` (${c.source})` : \"\"}: ${formatInspected(c.previous)} → ${formatInspected(c.current)}` +\n (c.referenceOnly ? \" — new reference, identical contents\" : \"\"),\n );\n\n if (unstable.length > 0) {\n /*\n * The classic Redux performance bug: a selector that builds a new object\n * or array on every call. `useSelector` compares with `Object.is`, so the\n * component re-renders on *every* store update, whatever changed.\n */\n const worst = unstable[0] as SelectorChange;\n evidence.push(\n \"useSelector compares with Object.is, so a selector that builds a new value each call re-renders the component on every store update — not only when its data changes.\",\n );\n return make(\n \"store\",\n \"high\",\n `${input.componentName} rendered because ${unstable.map((c) => `\\`${c.name}\\``).join(\", \")} returned a new reference with identical contents.`,\n evidence,\n true,\n `Make \\`${worst.name}\\`${worst.source ? ` at ${worst.source}` : \"\"} return a stable value: select the raw slice and derive outside the selector, memoize it with createSelector, or pass an equality function such as shallowEqual.`,\n );\n }\n\n return make(\n \"store\",\n \"high\",\n `${input.componentName} rendered because ${names.join(\", \")} changed in the store.`,\n [...evidence, \"The values genuinely changed, so this render is doing real work.\"],\n false,\n );\n }\n\n if (input.trackedState.length > 0) {\n const names = input.trackedState.map((s) => s.name);\n const evidence = input.trackedState.map(\n (s) => `\\`${s.name}\\`: ${formatInspected(s.previous)} → ${formatInspected(s.current)}`,\n );\n if (changedProps.length > 0) {\n evidence.push(`Props also changed: ${changedProps.map((c) => c.key).join(\", \")}.`);\n }\n return make(\n \"state\",\n \"high\",\n `${input.componentName} rendered because its own state changed: ${names.join(\", \")}.`,\n evidence,\n false,\n );\n }\n\n if (changedProps.length > 0) {\n const meaningful = changedProps.filter((c) => c.kind !== \"reference\");\n const referenceOnly = changedProps.filter((c) => c.kind === \"reference\");\n\n if (meaningful.length > 0) {\n const keys = meaningful.map((c) => c.key);\n const evidence = [\n `Props changed with new values: ${keys.join(\", \")}.`,\n ...meaningful.map(describe),\n ];\n if (referenceOnly.length > 0) {\n evidence.push(\n `Also changed by reference only (contents identical): ${referenceOnly.map((c) => c.key).join(\", \")}.`,\n );\n }\n return make(\n \"props\",\n \"high\",\n `${input.componentName} rendered because ${plural(keys.length, \"prop\")} changed: ${keys.join(\", \")}.`,\n evidence,\n false,\n referenceOnly.length > 0 ? stabiliseSuggestion(referenceOnly, parentName) : undefined,\n );\n }\n\n // Every changed prop is a reference change with equal (or unknown) contents.\n const keys = referenceOnly.map((c) => c.key);\n const evidence = [\n `${plural(keys.length, \"prop\")} changed by reference only: ${keys.join(\", \")}.`,\n ...referenceOnly.map(describe),\n ];\n if (parentRendered && parentName) {\n evidence.push(`${parentName} re-rendered in the same commit and recreated ${keys.length > 1 ? \"these values\" : `\\`${keys[0]}\\``}.`);\n }\n const confidence: Confidence = referenceOnly.some((c) => c.shallowEqual === true || c.valueType === \"function\")\n ? \"medium\"\n : \"low\";\n return make(\n \"props\",\n confidence,\n `${input.componentName} rendered because ${keys.join(\", \")} changed by reference — the contents did not.`,\n evidence,\n true,\n stabiliseSuggestion(referenceOnly, parentName),\n );\n }\n\n // Nothing about the props changed.\n if (input.propsReevaluated === false) {\n // The wrapper never re-ran: no new props came from above, so the render\n // began at this component or below it.\n if (contextChanges.length > 0) {\n const c = contextChanges[0] as ContextChange;\n const detail = c.changedKeys.length > 0 ? ` Changed: ${c.changedKeys.join(\", \")}.` : \"\";\n return make(\n \"context\",\n \"medium\",\n `${input.componentName} rendered after ${c.contextName} updated in the same commit.${detail}`,\n [\n \"No new props came from above — the render started at this component.\",\n `Tracked context ${c.contextName} changed in this commit.`,\n c.referenceOnly\n ? `${c.contextName}'s value changed by reference only — its contents are identical.`\n : `${c.contextName}'s contents changed.`,\n \"React does not expose which contexts a component subscribes to, so this is correlation within one commit, not a recorded subscription.\",\n ],\n c.referenceOnly,\n c.referenceOnly\n ? `${c.contextName}'s provider recreates its value every render. Stabilise it with useMemo if consumers are doing real work.`\n : undefined,\n );\n }\n return make(\n \"state-or-external\",\n input.selfRenderProven ? \"high\" : \"medium\",\n `${input.componentName} rendered from inside itself — local state, a store subscription, or a forced update.`,\n [\n \"No new props came from above: the wrapper did not re-render.\",\n input.selfRenderProven\n ? \"An instrumented child re-rendered from above in this commit, which proves this component produced it.\"\n : \"No instrumented descendant rendered in this commit, so an uninstrumented descendant could in principle be the origin instead.\",\n \"React does not expose hook state without private internals, so the exact source is not observable. Use useTrackedState to name local state, and the build plugin's store tracking to name selectors.\",\n ],\n false,\n );\n }\n\n if (input.propsReevaluated === true) {\n // The wrapper re-rendered with identical props — pure propagation.\n const known = parentRendered && parentName;\n return make(\n \"parent\",\n known && contextChanges.length === 0 ? \"high\" : \"medium\",\n `${input.componentName} rendered because its parent rendered — its own inputs did not change.`,\n [\n known\n ? `${parentName} re-rendered in this commit.`\n : \"Something above re-rendered this component, but the nearest instrumented ancestor did not — an uninstrumented component sits in between.\",\n \"Every prop is identical by reference.\",\n contextChanges.length === 0\n ? \"No tracked context changed in this commit.\"\n : `A tracked context also changed (${contextChanges.map((c) => c.contextName).join(\", \")}) — but new props arrived from above, so propagation is the direct cause.`,\n ],\n true,\n memoSuggestion(input),\n );\n }\n\n // Hook mode: props and self-originated renders cannot be told apart.\n if (parentRendered) {\n const evidence = [\n `${parentName ?? \"The nearest instrumented ancestor\"} re-rendered in this commit.`,\n \"Every prop is identical by reference.\",\n contextChanges.length === 0\n ? \"No tracked context changed in this commit.\"\n : `A tracked context also changed (${contextChanges.map((c) => c.contextName).join(\", \")}) — if this component consumes it, that is an alternative cause.`,\n ];\n return make(\n \"parent\",\n contextChanges.length === 0 ? \"high\" : \"medium\",\n `${input.componentName} rendered because its parent rendered — its own inputs did not change.`,\n evidence,\n true,\n memoSuggestion(input),\n );\n }\n\n if (contextChanges.length > 0) {\n const c = contextChanges[0] as ContextChange;\n const detail = c.changedKeys.length > 0 ? ` Changed: ${c.changedKeys.join(\", \")}.` : \"\";\n return make(\n \"context\",\n \"medium\",\n `${input.componentName} rendered after ${c.contextName} updated in the same commit.${detail}`,\n [\n `Props are identical and the parent did not re-render.`,\n `Tracked context ${c.contextName} changed in this commit.`,\n c.referenceOnly\n ? `${c.contextName}'s value changed by reference only — its contents are identical.`\n : `${c.contextName}'s contents changed.`,\n \"React does not expose which contexts a component subscribes to, so this is correlation within one commit, not a recorded subscription.\",\n ],\n c.referenceOnly,\n c.referenceOnly\n ? `${c.contextName}'s provider recreates its value every render. Stabilise it with useMemo if consumers are doing real work.`\n : undefined,\n );\n }\n\n if (parentUnknown) {\n return make(\n \"unknown\",\n \"low\",\n `Cause could not be determined reliably for ${input.componentName}.`,\n [\n \"Props are identical and no tracked context changed.\",\n \"This component has no instrumented ancestor, so a parent-propagated render cannot be ruled out.\",\n \"Instrument the parent, or track the context it consumes, to narrow this down.\",\n ],\n false,\n );\n }\n\n return make(\n \"state-or-external\",\n \"medium\",\n `${input.componentName} rendered from inside itself — local state, a store subscription, or a forced update.`,\n [\n \"Props are identical by reference.\",\n \"The nearest instrumented ancestor did not re-render in this commit.\",\n \"No tracked context changed in this commit.\",\n \"React does not expose hook state without private internals, so the exact source is not observable. Use useTrackedState to name it.\",\n ],\n false,\n );\n}\n\n/**\n * Memoization is a trade, not a default. Only recommend measuring it when the\n * render actually costs something or the pattern has repeated (§50, §52).\n */\nfunction memoSuggestion(input: DiagnosisInput): string {\n const worth = input.selfDuration >= 1 || input.priorAvoidableRenders >= 5;\n return worth\n ? `Check whether ${input.componentName} benefits from React.memo(). It has re-rendered with identical props ${input.priorAvoidableRenders + 1}× at ${fmt(input.selfDuration)} each — measure before and after.`\n : `Props are identical, but this render costs ${fmt(input.selfDuration)}. Memoizing is unlikely to pay for itself yet.`;\n}\n\nfunction stabiliseSuggestion(changes: PropChange[], parentName?: string): string {\n const fns = changes.filter((c) => c.valueType === \"function\").map((c) => c.key);\n const objs = changes.filter((c) => c.valueType === \"object\" || c.valueType === \"array\").map((c) => c.key);\n const where = parentName ? ` in ${parentName}` : \"\";\n const parts: string[] = [];\n if (fns.length > 0) parts.push(`${list(fns)} ${plural(fns.length, \"is\", \"are\")} recreated on every render${where} — useCallback, or hoist it, if a memoized child depends on it`);\n if (objs.length > 0) parts.push(`${list(objs)} ${plural(objs.length, \"is\", \"are\")} a new object each render${where} — useMemo it, or pass the primitive fields you actually use`);\n if (parts.length === 0) return `Find where ${list(changes.map((c) => c.key))} is created${where} and stabilise it.`;\n return `${capitalize(parts.join(\"; \"))}.`;\n}\n\nfunction describe(c: PropChange): string {\n switch (c.kind) {\n case \"added\":\n return `\\`${c.key}\\` was added.`;\n case \"removed\":\n return `\\`${c.key}\\` was removed.`;\n case \"reference\":\n if (c.valueType === \"function\") {\n return c.sourceEqual\n ? `\\`${c.key}\\` is a new function with identical source — an inline closure recreated by the parent.`\n : `\\`${c.key}\\` is a new function reference.`;\n }\n if (c.shallowEqual === true) return `\\`${c.key}\\` is a new ${c.valueType} whose shallow contents are identical.`;\n return `\\`${c.key}\\` changed reference; contents were too large or too exotic to compare cheaply.`;\n case \"value\":\n return `\\`${c.key}\\` changed value.`;\n }\n}\n\nfunction make(\n reason: Diagnosis[\"reason\"],\n confidence: Confidence,\n summary: string,\n evidence: string[],\n potentiallyAvoidable: boolean,\n suggestion?: string,\n): Diagnosis {\n return { reason, confidence, summary, evidence, potentiallyAvoidable, suggestion, severity: \"normal\" };\n}\n\nconst fmt = (ms: number): string => `${ms.toFixed(1)}ms`;\nconst list = (xs: string[]): string => xs.map((x) => `\\`${x}\\``).join(\", \");\nconst capitalize = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1);\nfunction plural(n: number, one: string, many?: string): string {\n if (one === \"is\") return n === 1 ? \"is\" : (many as string);\n return n === 1 ? `${one}` : `${one}s`;\n}\n","/** Fixed-capacity ring buffer. Bounded memory is a hard requirement (§26). */\nexport class RingBuffer<T> {\n private items: Array<T | undefined>;\n private head = 0;\n private count = 0;\n\n constructor(capacity: number) {\n this.items = new Array<T | undefined>(Math.max(1, capacity));\n }\n\n push(item: T): void {\n this.items[this.head] = item;\n this.head = (this.head + 1) % this.items.length;\n if (this.count < this.items.length) this.count++;\n }\n\n get size(): number {\n return this.count;\n }\n\n /** Oldest → newest. */\n toArray(): T[] {\n const out: T[] = [];\n const len = this.items.length;\n const start = (this.head - this.count + len) % len;\n for (let i = 0; i < this.count; i++) {\n const v = this.items[(start + i) % len];\n if (v !== undefined) out.push(v);\n }\n return out;\n }\n\n clear(): void {\n this.items = new Array<T | undefined>(this.items.length);\n this.head = 0;\n this.count = 0;\n }\n\n resize(capacity: number): void {\n const existing = this.toArray();\n this.items = new Array<T | undefined>(Math.max(1, capacity));\n this.head = 0;\n this.count = 0;\n const keep = existing.slice(Math.max(0, existing.length - this.items.length));\n for (const item of keep) this.push(item);\n }\n}\n","import { defaultConfig, detectProduction, mergeConfig, shouldInstrument } from \"./config.js\";\nimport { diffProps } from \"./compare.js\";\nimport { diagnose } from \"./diagnose.js\";\nimport { RingBuffer } from \"./ringBuffer.js\";\nimport type {\n AppStats,\n SelectorChange,\n TrackedStateChange,\n ComponentInfo,\n ComponentStats,\n ContextChange,\n DetectiveConfig,\n DetectiveOptions,\n RenderEvent,\n RenderPhase,\n RenderReason,\n} from \"./types.js\";\n\nconst now = (): number =>\n typeof performance !== \"undefined\" && typeof performance.now === \"function\" ? performance.now() : Date.now();\n\n/** What an instrumentation site reports at commit time. */\nexport interface CommitInput {\n phase: RenderPhase;\n subtreeDuration: number;\n baseDuration: number;\n startTime: number;\n /** `-1` when there is no Profiler; the flush pass resolves it. */\n commitTime: number;\n}\n\nexport interface Lifecycle {\n mounts: number;\n unmounts: number;\n /** Mounts that followed an unmount of the same component. */\n remounts: number;\n /** When the most recent remount was observed. */\n lastRemountAt?: number;\n}\n\n/**\n * Remounts of this many distinct components inside `RELOAD_WINDOW_MS` are a\n * whole-tree rebuild — hot reload, or a route change — not a per-component bug.\n */\nconst RELOAD_COMPONENT_THRESHOLD = 3;\nconst RELOAD_WINDOW_MS = 1500;\n\ninterface DefinitionRecord {\n name: string;\n count: number;\n firstSeen: number;\n lastSeen: number;\n /** Reported by the build plugin, which knows this statically. */\n declaredInRender: boolean;\n}\n\n/** Repeated definitions inside this window mean a render loop, not hot reload. */\nconst INLINE_DEFINITION_WINDOW_MS = 5000;\n\nconst timestamp = (): number =>\n typeof performance !== \"undefined\" && typeof performance.now === \"function\" ? performance.now() : Date.now();\n\nconst EMPTY_STATE: TrackedStateChange[] = [];\nconst EMPTY_SELECTORS: SelectorChange[] = [];\nconst DURATION_SAMPLE = 200;\nconst SWEEP_DELAY_MS = 250;\n\ninterface NodeRecord {\n id: string;\n name: string;\n /** `File.tsx:12:2` when the build plugin instrumented this component. */\n source?: string;\n /** Nearest instrumented ancestor, held directly so diagnosis never needs the registry. */\n parent?: NodeRecord;\n depth: number;\n sampled: boolean;\n /** Retained so the next render can be diffed. One props object per component. */\n prevProps?: Record<string, unknown>;\n pendingProps?: Record<string, unknown>;\n /** Render-function invocations not yet matched to a commit. */\n attempts: number;\n /** Named state updates reported by `useTrackedState`, consumed at the next commit. */\n pendingState: TrackedStateChange[];\n /** Selector value changes reported by tracked `useSelector`, consumed at the next commit. */\n pendingSelectors: SelectorChange[];\n /** Set as soon as a commit is queued, so mount detection never waits on flush. */\n seenCommit: boolean;\n /** Has this instance ever been attached? Distinguishes a real mount from a StrictMode replay. */\n everAttached?: boolean;\n /** Currently detached. Cleared if the same node re-attaches (StrictMode does exactly that). */\n detached?: boolean;\n /**\n * `useId` of the first component to call `useTrackedState` under this node.\n * Later callers (descendants) cannot claim state attribution from it.\n */\n stateOwner?: string;\n renderNumber: number;\n lastCommitTime: number;\n durations: number[];\n stats: MutableStats;\n}\n\ninterface MutableStats {\n renderCount: number;\n mountCount: number;\n uncommittedAttempts: number;\n devReplays: number;\n totalSelfDuration: number;\n maxSelfDuration: number;\n slowRenders: number;\n potentiallyAvoidableRenders: number;\n reasons: Record<RenderReason, number>;\n}\n\ninterface PendingCommit {\n node: NodeRecord;\n phase: RenderPhase;\n subtreeDuration: number;\n baseDuration: number;\n startTime: number;\n commitTime: number;\n attempts: number;\n /**\n * Props and state are snapshotted **at commit time**, not at flush time.\n * Several commits can land before the deferred pass runs, and reading them\n * later would diff the wrong pair.\n */\n props: Record<string, unknown> | undefined;\n state: TrackedStateChange[];\n selectors: SelectorChange[];\n seq: number;\n}\n\nconst emptyReasons = (): Record<RenderReason, number> => ({\n mount: 0,\n props: 0,\n state: 0,\n store: 0,\n parent: 0,\n context: 0,\n \"state-or-external\": 0,\n unknown: 0,\n});\n\nexport class Detective {\n config: DetectiveConfig = { ...defaultConfig };\n private nodes = new Map<string, NodeRecord>();\n private events: RingBuffer<RenderEvent>;\n private listeners = new Set<(event: RenderEvent) => void>();\n /** Registered by optional entry points so they follow clear()/reset() without being imported here. */\n private clearHooks = new Set<() => void>();\n private resetHooks = new Set<() => void>();\n private pending: PendingCommit[] = [];\n private contextChanges: Array<{ change: ContextChange; seq: number }> = [];\n /** Orders renders and context updates so they can be matched without timers. */\n private seq = 0;\n private flushScheduled = false;\n private sweepHandle: ReturnType<typeof setTimeout> | undefined;\n private nextId = 0;\n /** Mount/unmount history per component name, for remount detection. */\n private lifecycles = new Map<string, Lifecycle>();\n /** How often each component *definition* has been wrapped. */\n private definitions = new Map<string, DefinitionRecord>();\n /** Nodes created by `useRenderDiagnostics`, where props/state cannot be separated. */\n readonly hookModeNodes = new WeakSet<NodeRecord>();\n private initialized = false;\n\n constructor() {\n this.events = new RingBuffer<RenderEvent>(this.config.maxEvents);\n }\n\n /**\n * Idempotent: repeated calls reconfigure, they never duplicate anything (§47).\n *\n * Calling `init()` *is* the intent to turn diagnostics on, so `enabled`\n * defaults to true unless a production build is positively detected. Guard\n * the call itself for production safety — that is what the docs show, and it\n * is what lets a bundler drop the whole thing.\n */\n init(options: DetectiveOptions = {}): Detective {\n this.configure({ enabled: !detectProduction(), ...options });\n this.initialized = true;\n return this;\n }\n\n configure(options: DetectiveOptions = {}): void {\n const previousMax = this.config.maxEvents;\n this.config = mergeConfig(this.config, options);\n if (this.config.maxEvents !== previousMax) this.events.resize(this.config.maxEvents);\n }\n\n get isInitialized(): boolean {\n return this.initialized;\n }\n\n get enabled(): boolean {\n return this.config.enabled;\n }\n\n registerClearHook(hook: () => void): void {\n this.clearHooks.add(hook);\n }\n\n registerResetHook(hook: () => void): void {\n this.resetHooks.add(hook);\n }\n\n subscribe(listener: (event: RenderEvent) => void): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n // ---------------------------------------------------------------- registry\n\n /**\n * Creates a node without publishing it. StrictMode's double mount renders\n * discards one of the two, and only the surviving fiber's effect attaches —\n * so discarded nodes are simply garbage collected.\n */\n createNode(name: string, parent: NodeRecord | undefined, source?: string): NodeRecord | undefined {\n if (!shouldInstrument(name, this.config)) return undefined;\n const sampled = this.config.samplingRate >= 1 || Math.random() < this.config.samplingRate;\n const node: NodeRecord = {\n id: `rrd_${++this.nextId}`,\n name,\n source,\n parent,\n depth: parent ? parent.depth + 1 : 0,\n sampled,\n attempts: 0,\n pendingState: [],\n pendingSelectors: [],\n seenCommit: false,\n renderNumber: 0,\n lastCommitTime: -1,\n durations: [],\n stats: {\n renderCount: 0,\n mountCount: 0,\n uncommittedAttempts: 0,\n devReplays: 0,\n totalSelfDuration: 0,\n maxSelfDuration: 0,\n slowRenders: 0,\n potentiallyAvoidableRenders: 0,\n reasons: emptyReasons(),\n },\n };\n return node;\n }\n\n attach(node: NodeRecord): void {\n this.nodes.set(node.id, node);\n\n /*\n * StrictMode simulates an unmount by running effect cleanups and then the\n * effects again on the *same* fiber, so the same node detaches and\n * re-attaches. That is not a remount, and counting it would flag every\n * component in a StrictMode app. A real remount always produces a new node,\n * because `useState` runs afresh.\n */\n if (node.detached) {\n node.detached = false;\n const existing = this.lifecycles.get(node.name);\n if (existing) existing.unmounts--;\n return;\n }\n if (node.everAttached) return;\n node.everAttached = true;\n\n const life = this.lifecycleFor(node.name);\n life.mounts++;\n if (life.unmounts > 0) {\n life.remounts++;\n life.lastRemountAt = timestamp();\n }\n }\n\n detach(node: NodeRecord): void {\n /*\n * Registry removal only — deliberately NOT clearing `prevProps`. Wiping\n * them here made the first real update after mount diff against `{}` and\n * report every prop as newly added, because StrictMode runs cleanups on\n * components that are still mounted. Memory is bounded by dropping the node\n * from the registry: after a genuine unmount nothing references it.\n */\n this.nodes.delete(node.id);\n if (node.everAttached && !node.detached) {\n node.detached = true;\n this.lifecycleFor(node.name).unmounts++;\n }\n }\n\n private lifecycleFor(name: string): Lifecycle {\n let life = this.lifecycles.get(name);\n if (!life) this.lifecycles.set(name, (life = { mounts: 0, unmounts: 0, remounts: 0 }));\n return life;\n }\n\n /**\n * Called once per `withRenderDetective` call. A component declared at module\n * scope is wrapped once; one declared *inside* a render body is wrapped again\n * on every render of its parent — which also forces React to throw away and\n * rebuild its entire subtree. That is the signal.\n */\n noteDefinition(name: string, source: string | undefined, declaredInRender = false): void {\n const key = source ?? name;\n const now = timestamp();\n const record = this.definitions.get(key);\n if (!record) {\n this.definitions.set(key, { name, count: 1, firstSeen: now, lastSeen: now, declaredInRender });\n return;\n }\n record.count++;\n record.lastSeen = now;\n if (declaredInRender) record.declaredInRender = true;\n }\n\n /**\n * Is this component declared inside another component's render body?\n *\n * The build plugin answers this statically and exactly. Without it we fall\n * back to a rate heuristic — repeated definitions of the same component in a\n * short window — which is weaker: hot reload also re-defines components, and\n * a user clicking slowly stretches the window. Hence the plugin's answer wins.\n */\n inlineDefinitionSuspected(name: string): boolean {\n for (const record of this.definitions.values()) {\n if (record.name !== name) continue;\n if (record.declaredInRender) return true;\n if (record.count >= 3 && record.lastSeen - record.firstSeen < INLINE_DEFINITION_WINDOW_MS) return true;\n }\n return false;\n }\n\n lifecycleOf(name: string): Lifecycle {\n return this.lifecycles.get(name) ?? { mounts: 0, unmounts: 0, remounts: 0 };\n }\n\n /**\n * Did a whole-tree rebuild just happen?\n *\n * Hot reload is the most common cause of remounts in development, and this\n * tool only ever runs in development — so without this it would confidently\n * blame a `key` every time React Fast Refresh replaced a module. A real key\n * or inline-definition problem affects one component; a reload affects many\n * at once.\n */\n private reloadSuspectedAt(at: number): boolean {\n let names = 0;\n for (const life of this.lifecycles.values()) {\n if (life.lastRemountAt !== undefined && Math.abs(at - life.lastRemountAt) <= RELOAD_WINDOW_MS) names++;\n }\n return names >= RELOAD_COMPONENT_THRESHOLD;\n }\n\n /** Hot path. Must stay allocation-free and O(1). */\n recordAttempt(node: NodeRecord, props: Record<string, unknown>): void {\n node.attempts++;\n node.pendingProps = props;\n }\n\n recordStateChange(node: NodeRecord, change: TrackedStateChange): void {\n if (node.pendingState.length < 16) node.pendingState.push(change);\n }\n\n recordSelectorChange(node: NodeRecord, change: SelectorChange): void {\n if (node.pendingSelectors.length < 16) node.pendingSelectors.push(change);\n }\n\n /**\n * Hot path. Called from Profiler#onRender; only enqueues.\n *\n * `attempts` is the number of times the *wrapper* rendered, i.e. how often\n * this component's props were re-evaluated from above. Zero means the render\n * originated at or below this component — the flush pass works out which.\n */\n recordCommit(node: NodeRecord, commit: CommitInput): void {\n this.pending.push({\n ...commit,\n node,\n attempts: node.attempts,\n props: node.pendingProps,\n state: node.pendingState.length > 0 ? node.pendingState : EMPTY_STATE,\n selectors: node.pendingSelectors.length > 0 ? node.pendingSelectors : EMPTY_SELECTORS,\n seq: ++this.seq,\n });\n node.seenCommit = true;\n node.attempts = 0;\n node.pendingProps = undefined;\n if (node.pendingState.length > 0) node.pendingState = [];\n if (node.pendingSelectors.length > 0) node.pendingSelectors = [];\n node.lastCommitTime = commit.commitTime;\n this.scheduleFlush();\n }\n\n recordContextChange(change: ContextChange): void {\n this.contextChanges.push({ change, seq: ++this.seq });\n this.scheduleFlush();\n }\n\n // ------------------------------------------------------------ deferred work\n\n private scheduleFlush(): void {\n if (this.flushScheduled) return;\n this.flushScheduled = true;\n queueMicrotask(() => {\n this.flushScheduled = false;\n try {\n this.flush();\n } catch {\n /* diagnostics must never break the app (§46) */\n }\n });\n this.scheduleSweep();\n }\n\n private scheduleSweep(): void {\n if (this.sweepHandle !== undefined) return;\n this.sweepHandle = setTimeout(() => {\n this.sweepHandle = undefined;\n try {\n this.sweep();\n } catch {\n /* ignore */\n }\n }, SWEEP_DELAY_MS);\n // Never keep a Node process alive for diagnostics.\n (this.sweepHandle as { unref?: () => void }).unref?.();\n }\n\n /** Attempts that never reached a commit were abandoned or replayed. */\n private sweep(): void {\n for (const node of this.nodes.values()) {\n if (node.attempts > 0) {\n node.stats.uncommittedAttempts += node.attempts;\n node.attempts = 0;\n }\n }\n }\n\n /** Runs after the commit, off the render path. Whole batch is available here. */\n flush(): void {\n if (this.pending.length === 0) {\n this.contextChanges.length = 0;\n return;\n }\n const batch = this.pending;\n this.pending = [];\n const pendingContexts = this.contextChanges;\n this.contextChanges = [];\n const hookMode = this.hookModeNodes;\n\n /*\n * Hook-mode records and context updates are recorded *during* render, so\n * they belong to the next commit that lands after them. Matching on\n * sequence rather than wall-clock keeps that correct even when several\n * commits queue up before this deferred pass runs.\n */\n let nextReal = -1;\n for (let i = batch.length - 1; i >= 0; i--) {\n const rec = batch[i] as PendingCommit;\n if (rec.commitTime >= 0) nextReal = rec.commitTime;\n else if (nextReal >= 0) rec.commitTime = nextReal;\n else rec.commitTime = now();\n }\n const contexts: ContextChange[] = pendingContexts.map(({ change, seq }) => {\n if (change.commitTime >= 0) return change;\n const following = batch.find((r) => r.seq > seq);\n return { ...change, commitTime: following ? following.commitTime : (batch[batch.length - 1]?.commitTime ?? now()) };\n });\n\n // Which nodes rendered in each commit, and how much of a node's subtree\n // time belongs to instrumented descendants.\n const commitMembers = new Map<number, Set<NodeRecord>>();\n const descendantTime = new Map<NodeRecord, number>();\n for (const rec of batch) {\n let set = commitMembers.get(rec.commitTime);\n if (!set) commitMembers.set(rec.commitTime, (set = new Set()));\n set.add(rec.node);\n }\n for (const rec of batch) {\n const parent = rec.node.parent;\n if (!parent) continue;\n if (!commitMembers.get(rec.commitTime)?.has(parent)) continue;\n descendantTime.set(parent, (descendantTime.get(parent) ?? 0) + rec.subtreeDuration);\n }\n\n /*\n * A Profiler fires for every ancestor of the work, so a raw callback is not\n * proof that *this* component rendered. Two facts separate them:\n *\n * attempts > 0 the wrapper re-rendered, so something above re-rendered it.\n * attempts = 0 the work started at or below this component.\n *\n * For the second case, an instrumented child that itself re-rendered from\n * above is proof this component rendered (it produced that child). If some\n * deeper instrumented node fired instead, the origin is down there and this\n * callback is only propagation — counting it would inflate every ancestor.\n */\n const provenSelfRender = new Set<NodeRecord>();\n const hasInstrumentedDescendant = new Set<NodeRecord>();\n for (const rec of batch) {\n const members = commitMembers.get(rec.commitTime);\n if (rec.attempts > 0 && rec.node.parent && members?.has(rec.node.parent)) {\n provenSelfRender.add(rec.node.parent);\n }\n for (let a = rec.node.parent; a; a = a.parent) {\n if (members?.has(a)) hasInstrumentedDescendant.add(a);\n }\n }\n\n for (const rec of batch) {\n if (!rec.node.sampled) continue;\n const counted =\n rec.attempts > 0 ||\n rec.phase === \"mount\" ||\n provenSelfRender.has(rec.node) ||\n !hasInstrumentedDescendant.has(rec.node);\n if (!counted) continue;\n try {\n this.emit(\n this.buildEvent(rec.node, rec, commitMembers, descendantTime, contexts, provenSelfRender, hookMode.has(rec.node)),\n );\n } catch {\n /* one bad event must not lose the batch */\n }\n }\n }\n\n private buildEvent(\n node: NodeRecord,\n rec: PendingCommit,\n commitMembers: Map<number, Set<NodeRecord>>,\n descendantTime: Map<NodeRecord, number>,\n contexts: ContextChange[],\n provenSelfRender: Set<NodeRecord>,\n isHookMode: boolean,\n ): RenderEvent {\n const parent = node.parent;\n const parentRendered = parent ? commitMembers.get(rec.commitTime)?.has(parent) === true : false;\n\n // attempts === 0 means the wrapper never re-ran, so the props object is by\n // definition the same one as last time — there is nothing to diff.\n const propsReevaluated = isHookMode ? undefined : rec.attempts > 0;\n const isMount = rec.phase === \"mount\";\n const props = rec.props ?? node.prevProps ?? {};\n const { changed, unchanged } =\n isMount || propsReevaluated === false\n ? { changed: [], unchanged: Object.keys(props) }\n : diffProps(node.prevProps, props, this.config);\n node.prevProps = props;\n\n const accounted = descendantTime.get(node) ?? 0;\n const selfDuration = Math.max(0, rec.subtreeDuration - accounted);\n const relevantContexts = contexts.filter((c) => c.commitTime === rec.commitTime);\n const trackedState = rec.state;\n const selectorChanges = rec.selectors;\n\n node.renderNumber++;\n const diagnosis = diagnose(\n {\n componentName: node.name,\n phase: rec.phase,\n parentName: parent?.name,\n parentRendered,\n parentUnknown: !parent,\n propsReevaluated,\n selfRenderProven: provenSelfRender.has(node),\n changedProps: changed,\n contextChanges: relevantContexts,\n selfDuration,\n attempts: rec.attempts,\n committed: true,\n trackedState,\n selectorChanges,\n remounts: this.lifecycleOf(node.name).remounts,\n inlineDefinitionSuspected: this.inlineDefinitionSuspected(node.name),\n treeReloadSuspected: rec.phase === \"mount\" && this.reloadSuspectedAt(timestamp()),\n priorAvoidableRenders: node.stats.potentiallyAvoidableRenders,\n },\n this.config.thresholds,\n );\n\n const componentInfo: ComponentInfo = {\n id: node.id,\n name: node.name,\n source: node.source,\n parentId: parent?.id,\n depth: node.depth,\n };\n\n const event: RenderEvent = {\n id: `${node.id}#${node.renderNumber}`,\n component: componentInfo,\n timestamp: rec.startTime,\n renderNumber: node.renderNumber,\n phase: rec.phase,\n timings: {\n subtreeDuration: rec.subtreeDuration,\n baseDuration: rec.baseDuration,\n selfDuration,\n accountedDescendantDuration: accounted,\n commitTime: rec.commitTime,\n startTime: rec.startTime,\n },\n changedProps: changed,\n unchangedProps: unchanged,\n parent: parent\n ? { id: parent.id, name: parent.name, source: parent.source, parentId: parent.parent?.id, depth: parent.depth }\n : undefined,\n parentRendered,\n selfOriginated: propsReevaluated === false,\n contextChanges: relevantContexts,\n trackedState,\n selectorChanges,\n committed: true,\n attempts: Math.max(1, rec.attempts),\n devReplay: rec.attempts > 1,\n diagnosis,\n };\n\n this.updateStats(node, event);\n return event;\n }\n\n private updateStats(node: NodeRecord, event: RenderEvent): void {\n const s = node.stats;\n s.renderCount++;\n if (event.phase === \"mount\") s.mountCount++;\n if (event.devReplay) s.devReplays++;\n const d = event.timings.selfDuration;\n s.totalSelfDuration += d;\n if (d > s.maxSelfDuration) s.maxSelfDuration = d;\n if (d >= this.config.slowRenderThreshold) s.slowRenders++;\n if (event.diagnosis.potentiallyAvoidable) s.potentiallyAvoidableRenders++;\n s.reasons[event.diagnosis.reason]++;\n node.durations.push(d);\n if (node.durations.length > DURATION_SAMPLE) node.durations.shift();\n }\n\n private emit(event: RenderEvent): void {\n this.events.push(event);\n const { onEvent } = this.config;\n if (onEvent) {\n try {\n onEvent(event);\n } catch {\n /* ignore */\n }\n }\n for (const listener of this.listeners) {\n try {\n listener(event);\n } catch {\n /* ignore */\n }\n }\n }\n\n // -------------------------------------------------------------------- query\n\n getEvents(): RenderEvent[] {\n this.flush();\n return this.events.toArray();\n }\n\n getComponentStats(name?: string): ComponentStats[] {\n this.flush();\n const out: ComponentStats[] = [];\n for (const node of this.nodes.values()) {\n if (name && node.name !== name) continue;\n if (node.stats.renderCount === 0 && node.stats.uncommittedAttempts === 0) continue;\n out.push(toStats(node, this.lifecycleOf(node.name)));\n }\n return out;\n }\n\n getStats(): AppStats {\n const all = this.getComponentStats();\n const byName = new Map<string, ComponentStats>();\n for (const s of all) {\n const existing = byName.get(s.name);\n byName.set(s.name, existing ? mergeStats(existing, s) : s);\n }\n const merged = [...byName.values()];\n return {\n components: merged.length,\n totalRenders: merged.reduce((a, s) => a + s.renderCount, 0),\n totalRenderTime: merged.reduce((a, s) => a + s.totalSelfDuration, 0),\n slowRenders: merged.reduce((a, s) => a + s.slowRenders, 0),\n potentiallyAvoidableRenders: merged.reduce((a, s) => a + s.potentiallyAvoidableRenders, 0),\n devReplays: merged.reduce((a, s) => a + s.devReplays, 0),\n slowest: [...merged].sort((a, b) => b.maxSelfDuration - a.maxSelfDuration).slice(0, 10),\n mostRendered: [...merged].sort((a, b) => b.renderCount - a.renderCount).slice(0, 10),\n mostExpensive: [...merged].sort((a, b) => b.totalSelfDuration - a.totalSelfDuration).slice(0, 10),\n };\n }\n\n clear(): void {\n for (const hook of this.clearHooks) {\n try {\n hook();\n } catch {\n /* ignore */\n }\n }\n this.events.clear();\n this.pending.length = 0;\n this.contextChanges.length = 0;\n for (const node of this.nodes.values()) {\n node.stats = {\n renderCount: 0,\n mountCount: 0,\n uncommittedAttempts: 0,\n devReplays: 0,\n totalSelfDuration: 0,\n maxSelfDuration: 0,\n slowRenders: 0,\n potentiallyAvoidableRenders: 0,\n reasons: emptyReasons(),\n };\n node.durations.length = 0;\n node.renderNumber = 0;\n }\n }\n\n /** Full teardown — used by tests and by HMR disposal. */\n reset(): void {\n for (const hook of this.resetHooks) {\n try {\n hook();\n } catch {\n /* ignore */\n }\n }\n this.resetHooks.clear();\n this.clear();\n this.clearHooks.clear();\n this.nodes.clear();\n this.lifecycles.clear();\n this.definitions.clear();\n this.listeners.clear();\n if (this.sweepHandle !== undefined) clearTimeout(this.sweepHandle);\n this.sweepHandle = undefined;\n this.config = { ...defaultConfig };\n this.events.resize(this.config.maxEvents);\n this.initialized = false;\n }\n}\n\nfunction percentile(sorted: number[], p: number): number {\n if (sorted.length === 0) return 0;\n const idx = Math.min(sorted.length - 1, Math.max(0, Math.ceil((p / 100) * sorted.length) - 1));\n return sorted[idx] as number;\n}\n\nfunction toStats(node: NodeRecord, lifecycle: Lifecycle): ComponentStats {\n const sorted = [...node.durations].sort((a, b) => a - b);\n const s = node.stats;\n return {\n id: node.id,\n name: node.name,\n source: node.source,\n renderCount: s.renderCount,\n mountCount: s.mountCount,\n remountCount: lifecycle.remounts,\n uncommittedAttempts: s.uncommittedAttempts,\n devReplays: s.devReplays,\n totalSelfDuration: s.totalSelfDuration,\n averageSelfDuration: s.renderCount ? s.totalSelfDuration / s.renderCount : 0,\n medianSelfDuration: percentile(sorted, 50),\n p95SelfDuration: percentile(sorted, 95),\n p99SelfDuration: percentile(sorted, 99),\n maxSelfDuration: s.maxSelfDuration,\n slowRenders: s.slowRenders,\n potentiallyAvoidableRenders: s.potentiallyAvoidableRenders,\n reasons: { ...s.reasons },\n };\n}\n\nfunction mergeStats(a: ComponentStats, b: ComponentStats): ComponentStats {\n const renderCount = a.renderCount + b.renderCount;\n const total = a.totalSelfDuration + b.totalSelfDuration;\n const reasons = { ...a.reasons };\n for (const key of Object.keys(b.reasons) as RenderReason[]) reasons[key] += b.reasons[key];\n return {\n id: a.id,\n name: a.name,\n source: a.source ?? b.source,\n renderCount,\n mountCount: a.mountCount + b.mountCount,\n remountCount: Math.max(a.remountCount, b.remountCount),\n uncommittedAttempts: a.uncommittedAttempts + b.uncommittedAttempts,\n devReplays: a.devReplays + b.devReplays,\n totalSelfDuration: total,\n averageSelfDuration: renderCount ? total / renderCount : 0,\n medianSelfDuration: Math.max(a.medianSelfDuration, b.medianSelfDuration),\n p95SelfDuration: Math.max(a.p95SelfDuration, b.p95SelfDuration),\n p99SelfDuration: Math.max(a.p99SelfDuration, b.p99SelfDuration),\n maxSelfDuration: Math.max(a.maxSelfDuration, b.maxSelfDuration),\n slowRenders: a.slowRenders + b.slowRenders,\n potentiallyAvoidableRenders: a.potentiallyAvoidableRenders + b.potentiallyAvoidableRenders,\n reasons,\n };\n}\n\nexport type { NodeRecord };\n\n/**\n * Singleton pinned to globalThis so Fast Refresh / duplicate module instances\n * share one detective instead of stacking three copies of the debugger (§47).\n */\nconst KEY = Symbol.for(\"react-render-detective.instance\");\ntype Global = typeof globalThis & { [KEY]?: Detective };\n\nexport function getDetective(): Detective {\n const g = globalThis as Global;\n if (!g[KEY]) g[KEY] = new Detective();\n return g[KEY] as Detective;\n}\n"]}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
var DEFAULT_IMPORT_SOURCE = "react-render-detective";
|
|
3
3
|
var SELF_PATTERN = /[/\\]react-render-detective[/\\](src|dist)[/\\]/;
|
|
4
4
|
var HOC_NAMES = /* @__PURE__ */ new Set(["memo", "forwardRef"]);
|
|
5
|
+
var DEFAULT_STORE_HOOKS = {
|
|
6
|
+
"react-redux": ["useSelector"]
|
|
7
|
+
};
|
|
5
8
|
function renderDetectiveBabelPlugin(api) {
|
|
6
9
|
const t = api.types;
|
|
7
10
|
const processed = /* @__PURE__ */ new WeakSet();
|
|
@@ -47,6 +50,33 @@ function renderDetectiveBabelPlugin(api) {
|
|
|
47
50
|
state.rrdLocal = local;
|
|
48
51
|
return local;
|
|
49
52
|
}
|
|
53
|
+
function ensureSelectorImport(path, state) {
|
|
54
|
+
if (state.rrdTrackSelectorLocal) return state.rrdTrackSelectorLocal;
|
|
55
|
+
const program = path.findParent((p) => p.isProgram());
|
|
56
|
+
const local = program.scope.generateUidIdentifier("rrdTrackSelector");
|
|
57
|
+
const source = state.opts.importSource ?? DEFAULT_IMPORT_SOURCE;
|
|
58
|
+
program.unshiftContainer(
|
|
59
|
+
"body",
|
|
60
|
+
t.importDeclaration([t.importSpecifier(local, t.identifier("trackSelector"))], t.stringLiteral(source))
|
|
61
|
+
);
|
|
62
|
+
state.rrdTrackSelectorLocal = local;
|
|
63
|
+
return local;
|
|
64
|
+
}
|
|
65
|
+
function labelForSelector(argument) {
|
|
66
|
+
if (!argument) return void 0;
|
|
67
|
+
if (!t.isArrowFunctionExpression(argument) && !t.isFunctionExpression(argument)) return void 0;
|
|
68
|
+
const body = t.isBlockStatement(argument.body) ? void 0 : argument.body;
|
|
69
|
+
if (!body || !t.isMemberExpression(body)) return void 0;
|
|
70
|
+
const parts = [];
|
|
71
|
+
let current = body;
|
|
72
|
+
while (t.isMemberExpression(current)) {
|
|
73
|
+
if (t.isIdentifier(current.property)) parts.unshift(current.property.name);
|
|
74
|
+
else if (t.isStringLiteral(current.property)) parts.unshift(current.property.value);
|
|
75
|
+
else return void 0;
|
|
76
|
+
current = current.object;
|
|
77
|
+
}
|
|
78
|
+
return t.isIdentifier(current) && parts.length > 0 ? parts.join(".") : void 0;
|
|
79
|
+
}
|
|
50
80
|
function locationOf(node, state) {
|
|
51
81
|
const line = node.loc?.start.line;
|
|
52
82
|
if (line === void 0 || !state.rrdRelativePath) return void 0;
|
|
@@ -89,6 +119,43 @@ function renderDetectiveBabelPlugin(api) {
|
|
|
89
119
|
if (skip) path.skip();
|
|
90
120
|
}
|
|
91
121
|
},
|
|
122
|
+
/** Records which local names are bound to a tracked store hook. */
|
|
123
|
+
ImportDeclaration(path, state) {
|
|
124
|
+
if (state.opts.trackStores === false) return;
|
|
125
|
+
const hooks = state.opts.storeHooks ?? DEFAULT_STORE_HOOKS;
|
|
126
|
+
const wanted = hooks[path.node.source.value];
|
|
127
|
+
if (!wanted) return;
|
|
128
|
+
for (const specifier of path.node.specifiers) {
|
|
129
|
+
if (!t.isImportSpecifier(specifier)) continue;
|
|
130
|
+
const imported = t.isIdentifier(specifier.imported) ? specifier.imported.name : specifier.imported.value;
|
|
131
|
+
if (wanted.includes(imported)) (state.rrdStoreHooks ?? (state.rrdStoreHooks = /* @__PURE__ */ new Set())).add(specifier.local.name);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* `useSelector(fn)` → `_rrdTrackSelector(useSelector(fn), { name, source })`
|
|
136
|
+
*
|
|
137
|
+
* The call is wrapped rather than the import replaced, so every argument —
|
|
138
|
+
* including react-redux's equality function — reaches the real hook
|
|
139
|
+
* untouched. Changing those would change the app's behaviour.
|
|
140
|
+
*/
|
|
141
|
+
CallExpression(path, state) {
|
|
142
|
+
if (state.opts.trackStores === false) return;
|
|
143
|
+
if (!state.rrdStoreHooks || state.rrdStoreHooks.size === 0) return;
|
|
144
|
+
if (processed.has(path.node)) return;
|
|
145
|
+
const callee = path.node.callee;
|
|
146
|
+
if (!t.isIdentifier(callee) || !state.rrdStoreHooks.has(callee.name)) return;
|
|
147
|
+
if (!path.getFunctionParent()) return;
|
|
148
|
+
processed.add(path.node);
|
|
149
|
+
const source = locationOf(path.node, state);
|
|
150
|
+
const label = labelForSelector(path.node.arguments[0]);
|
|
151
|
+
const options = [];
|
|
152
|
+
if (label) options.push(t.objectProperty(t.identifier("name"), t.stringLiteral(label)));
|
|
153
|
+
if (source) options.push(t.objectProperty(t.identifier("source"), t.stringLiteral(source)));
|
|
154
|
+
state.rrdTouched = true;
|
|
155
|
+
path.replaceWith(
|
|
156
|
+
t.callExpression(ensureSelectorImport(path, state), [path.node, t.objectExpression(options)])
|
|
157
|
+
);
|
|
158
|
+
},
|
|
92
159
|
/** `function Foo() { return <div /> }` */
|
|
93
160
|
FunctionDeclaration(path, state) {
|
|
94
161
|
const id = path.node.id;
|
|
@@ -163,5 +230,5 @@ function componentNameFromFile(path) {
|
|
|
163
230
|
}
|
|
164
231
|
|
|
165
232
|
export { renderDetectiveBabelPlugin };
|
|
166
|
-
//# sourceMappingURL=chunk-
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
233
|
+
//# sourceMappingURL=chunk-QVHAC7AD.js.map
|
|
234
|
+
//# sourceMappingURL=chunk-QVHAC7AD.js.map
|