@buoy-gg/highlight-updates 7.0.36 → 7.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +28 -6
  2. package/lib/commonjs/highlight-updates/HighlightUpdatesOverlay.js +1 -281
  3. package/lib/commonjs/highlight-updates/components/HighlightFilterView.js +1 -1474
  4. package/lib/commonjs/highlight-updates/components/HighlightUpdatesModal.js +1 -641
  5. package/lib/commonjs/highlight-updates/components/IdentifierBadge.js +1 -273
  6. package/lib/commonjs/highlight-updates/components/IsolatedRenderList.js +1 -188
  7. package/lib/commonjs/highlight-updates/components/ModalHeaderContent.js +1 -293
  8. package/lib/commonjs/highlight-updates/components/RenderCauseBadge.js +1 -508
  9. package/lib/commonjs/highlight-updates/components/RenderDetailView.js +1 -846
  10. package/lib/commonjs/highlight-updates/components/RenderHistoryViewer.js +1 -915
  11. package/lib/commonjs/highlight-updates/components/RenderListItem.js +1 -235
  12. package/lib/commonjs/highlight-updates/components/RendersCopySettingsView.js +1 -466
  13. package/lib/commonjs/highlight-updates/components/StatsDisplay.js +1 -73
  14. package/lib/commonjs/highlight-updates/types/copySettings.js +1 -107
  15. package/lib/commonjs/highlight-updates/utils/CommitProfiler.js +1 -446
  16. package/lib/commonjs/highlight-updates/utils/HighlightUpdatesController.js +1 -1920
  17. package/lib/commonjs/highlight-updates/utils/PerformanceLogger.js +1 -359
  18. package/lib/commonjs/highlight-updates/utils/ProfilerInterceptor.js +1 -371
  19. package/lib/commonjs/highlight-updates/utils/RenderCauseDetector.js +1 -1840
  20. package/lib/commonjs/highlight-updates/utils/RenderTracker.js +1 -952
  21. package/lib/commonjs/highlight-updates/utils/ViewTypeMapper.js +1 -264
  22. package/lib/commonjs/highlight-updates/utils/copySettingsStorage.js +1 -32
  23. package/lib/commonjs/highlight-updates/utils/devtoolsComponentNames.js +1 -188
  24. package/lib/commonjs/highlight-updates/utils/namedComposite.js +1 -41
  25. package/lib/commonjs/highlight-updates/utils/ownStateChanged.js +1 -103
  26. package/lib/commonjs/highlight-updates/utils/rawEventEmitter.js +1 -50
  27. package/lib/commonjs/highlight-updates/utils/renderExportFormatter.js +1 -58
  28. package/lib/commonjs/highlight-updates/utils/rendersExportFormatter.js +1 -485
  29. package/lib/commonjs/highlight-updates/utils/screenElements.js +1 -1248
  30. package/lib/commonjs/highlight-updates/utils/tapMatch.js +1 -83
  31. package/lib/commonjs/highlight-updates/utils/testIDs.js +1 -68
  32. package/lib/commonjs/highlight-updates/utils/touchCapture.js +1 -277
  33. package/lib/commonjs/index.js +1 -429
  34. package/lib/commonjs/preset.js +1 -278
  35. package/lib/commonjs/sync/highlightUpdatesSyncAdapter.js +1 -235
  36. package/lib/module/highlight-updates/HighlightUpdatesOverlay.js +1 -274
  37. package/lib/module/highlight-updates/components/HighlightFilterView.js +1 -1468
  38. package/lib/module/highlight-updates/components/HighlightUpdatesModal.js +1 -634
  39. package/lib/module/highlight-updates/components/IdentifierBadge.js +1 -265
  40. package/lib/module/highlight-updates/components/IsolatedRenderList.js +1 -183
  41. package/lib/module/highlight-updates/components/ModalHeaderContent.js +1 -288
  42. package/lib/module/highlight-updates/components/RenderCauseBadge.js +1 -499
  43. package/lib/module/highlight-updates/components/RenderDetailView.js +1 -840
  44. package/lib/module/highlight-updates/components/RenderHistoryViewer.js +1 -908
  45. package/lib/module/highlight-updates/components/RenderListItem.js +1 -230
  46. package/lib/module/highlight-updates/components/RendersCopySettingsView.js +1 -462
  47. package/lib/module/highlight-updates/components/StatsDisplay.js +1 -70
  48. package/lib/module/highlight-updates/types/copySettings.js +1 -102
  49. package/lib/module/highlight-updates/utils/CommitProfiler.js +1 -442
  50. package/lib/module/highlight-updates/utils/HighlightUpdatesController.js +1 -1916
  51. package/lib/module/highlight-updates/utils/PerformanceLogger.js +1 -353
  52. package/lib/module/highlight-updates/utils/ProfilerInterceptor.js +1 -358
  53. package/lib/module/highlight-updates/utils/RenderCauseDetector.js +1 -1830
  54. package/lib/module/highlight-updates/utils/RenderTracker.js +1 -949
  55. package/lib/module/highlight-updates/utils/ViewTypeMapper.js +1 -255
  56. package/lib/module/highlight-updates/utils/copySettingsStorage.js +1 -26
  57. package/lib/module/highlight-updates/utils/devtoolsComponentNames.js +1 -178
  58. package/lib/module/highlight-updates/utils/namedComposite.js +1 -36
  59. package/lib/module/highlight-updates/utils/ownStateChanged.js +1 -98
  60. package/lib/module/highlight-updates/utils/rawEventEmitter.js +1 -46
  61. package/lib/module/highlight-updates/utils/renderExportFormatter.js +1 -54
  62. package/lib/module/highlight-updates/utils/rendersExportFormatter.js +1 -478
  63. package/lib/module/highlight-updates/utils/screenElements.js +1 -1242
  64. package/lib/module/highlight-updates/utils/tapMatch.js +1 -76
  65. package/lib/module/highlight-updates/utils/testIDs.js +1 -60
  66. package/lib/module/highlight-updates/utils/touchCapture.js +1 -270
  67. package/lib/module/index.js +1 -130
  68. package/lib/module/preset.js +1 -272
  69. package/lib/module/sync/highlightUpdatesSyncAdapter.js +1 -230
  70. package/package.json +8 -8
  71. package/lib/typescript/highlight-updates/HighlightUpdatesOverlay.d.ts.map +0 -1
  72. package/lib/typescript/highlight-updates/components/HighlightFilterView.d.ts.map +0 -1
  73. package/lib/typescript/highlight-updates/components/HighlightUpdatesModal.d.ts.map +0 -1
  74. package/lib/typescript/highlight-updates/components/IdentifierBadge.d.ts.map +0 -1
  75. package/lib/typescript/highlight-updates/components/IsolatedRenderList.d.ts.map +0 -1
  76. package/lib/typescript/highlight-updates/components/ModalHeaderContent.d.ts.map +0 -1
  77. package/lib/typescript/highlight-updates/components/RenderCauseBadge.d.ts.map +0 -1
  78. package/lib/typescript/highlight-updates/components/RenderDetailView.d.ts.map +0 -1
  79. package/lib/typescript/highlight-updates/components/RenderHistoryViewer.d.ts.map +0 -1
  80. package/lib/typescript/highlight-updates/components/RenderListItem.d.ts.map +0 -1
  81. package/lib/typescript/highlight-updates/components/RendersCopySettingsView.d.ts.map +0 -1
  82. package/lib/typescript/highlight-updates/components/StatsDisplay.d.ts.map +0 -1
  83. package/lib/typescript/highlight-updates/types/copySettings.d.ts.map +0 -1
  84. package/lib/typescript/highlight-updates/utils/CommitProfiler.d.ts.map +0 -1
  85. package/lib/typescript/highlight-updates/utils/HighlightUpdatesController.d.ts.map +0 -1
  86. package/lib/typescript/highlight-updates/utils/PerformanceLogger.d.ts.map +0 -1
  87. package/lib/typescript/highlight-updates/utils/ProfilerInterceptor.d.ts.map +0 -1
  88. package/lib/typescript/highlight-updates/utils/RenderCauseDetector.d.ts.map +0 -1
  89. package/lib/typescript/highlight-updates/utils/RenderTracker.d.ts.map +0 -1
  90. package/lib/typescript/highlight-updates/utils/ViewTypeMapper.d.ts.map +0 -1
  91. package/lib/typescript/highlight-updates/utils/copySettingsStorage.d.ts.map +0 -1
  92. package/lib/typescript/highlight-updates/utils/devtoolsComponentNames.d.ts.map +0 -1
  93. package/lib/typescript/highlight-updates/utils/namedComposite.d.ts.map +0 -1
  94. package/lib/typescript/highlight-updates/utils/ownStateChanged.d.ts.map +0 -1
  95. package/lib/typescript/highlight-updates/utils/rawEventEmitter.d.ts.map +0 -1
  96. package/lib/typescript/highlight-updates/utils/renderExportFormatter.d.ts.map +0 -1
  97. package/lib/typescript/highlight-updates/utils/rendersExportFormatter.d.ts.map +0 -1
  98. package/lib/typescript/highlight-updates/utils/screenElements.d.ts.map +0 -1
  99. package/lib/typescript/highlight-updates/utils/tapMatch.d.ts.map +0 -1
  100. package/lib/typescript/highlight-updates/utils/testIDs.d.ts.map +0 -1
  101. package/lib/typescript/highlight-updates/utils/touchCapture.d.ts.map +0 -1
  102. package/lib/typescript/index.d.ts.map +0 -1
  103. package/lib/typescript/preset.d.ts.map +0 -1
  104. package/lib/typescript/sync/highlightUpdatesSyncAdapter.d.ts.map +0 -1
@@ -1,103 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.hookStateChanged = hookStateChanged;
7
- exports.ownStateChanged = ownStateChanged;
8
- /**
9
- * "Did this component's own state actually change?" — one implementation.
10
- *
11
- * This package classifies render causes twice, on purpose. `RenderCauseDetector`
12
- * serves the overlay and rides React DevTools' `traceUpdates`, which hands it
13
- * fibers at an ambiguous moment — hence its WeakMap fallbacks and fiber-swap
14
- * detection. `CommitProfiler` serves Bench's render capture from inside
15
- * `onCommitFiberRoot`, where `fiber` is current and `fiber.alternate` is
16
- * previous by definition, and where it runs on every composite fiber of every
17
- * commit and so counts allocations. Those are genuinely different problems and
18
- * the two classifiers should stay separate.
19
- *
20
- * This ONE question is not different between them, and it is the question they
21
- * both got wrong:
22
- *
23
- * `prev.memoizedState !== next.memoizedState`
24
- *
25
- * For a function component `memoizedState` is the head of the hook linked list,
26
- * and React rebuilds that list on every update — `updateWorkInProgressHook`
27
- * clones each node — so the head is a fresh object whether or not a single
28
- * hook's value moved. Read as "state changed" it makes "state"/"hooks" the
29
- * answer for every component that uses ANY hook (a lone `useEffect` is enough)
30
- * and leaves "parent" reachable only by the vanishingly rare component that
31
- * uses none.
32
- *
33
- * That is the one distinction in either tool a developer acts on: "parent"
34
- * means memoize it or lift the state, "state" means it genuinely updated and
35
- * should be left alone. Backwards, it sends you to optimise the thing that was
36
- * already fine — and in Bench it also silently shrank `wastedRenders`, the
37
- * number that says whether there is anything to fix at all.
38
- *
39
- * Both tools reached that wrong line independently, which is exactly why the
40
- * answer lives here now rather than in two places that happen to agree.
41
- */
42
-
43
- /** React work tag for a class component — its `memoizedState` IS the state. */
44
- const CLASS_COMPONENT = 1;
45
-
46
- /** Guardrail on the hook-list walk; deep hook lists are pathological. */
47
- const MAX_HOOKS_WALKED = 64;
48
-
49
- /** Does this look like React's hook linked list rather than class state? */
50
- function isHookList(head) {
51
- return !!head && typeof head === "object" && ("next" in head || "queue" in head || "memoizedState" in head);
52
- }
53
-
54
- /**
55
- * True when a STATE hook's value actually moved between two hook-list heads.
56
- *
57
- * `queue` is the marker: `useState` and `useReducer` — and everything built on
58
- * them — own one; effects, memos, callbacks and refs do not. An effect's
59
- * `memoizedState` is a brand-new object on every single render, which is the
60
- * specific thing that broke the identity check.
61
- *
62
- * Note that a `useRef` mutation is deliberately NOT a state change here. It
63
- * cannot cause a render, so a render attributed to one is a render blamed on
64
- * something that did not do it.
65
- *
66
- * Conservative where it cannot tell: a class component, or a `memoizedState`
67
- * that is not a recognisable hook list, falls back to the identity comparison.
68
- * There the identity IS meaningful (or is the best signal available), so the
69
- * old behaviour is the right behaviour.
70
- *
71
- * Takes the HEADS rather than the fibers because only one of the two callers
72
- * has a previous fiber to hand — the overlay may be working from a WeakMap
73
- * snapshot of the previous `memoizedState` instead. Use `ownStateChanged` when
74
- * you do have both fibers.
75
- */
76
- function hookStateChanged(prevHead, nextHead, options) {
77
- if (prevHead === nextHead) return false;
78
- if (options?.isClassComponent) return true;
79
- if (!isHookList(nextHead)) return true;
80
- let p = prevHead;
81
- let n = nextHead;
82
- for (let depth = 0; n != null && depth < MAX_HOOKS_WALKED; depth++) {
83
- if (n.queue != null) {
84
- // A hook the previous render did not have is a real change.
85
- if (p == null) return true;
86
- if (!Object.is(p.memoizedState, n.memoizedState)) return true;
87
- }
88
- n = n.next;
89
- p = p != null ? p.next : null;
90
- }
91
- return false;
92
- }
93
-
94
- /**
95
- * `hookStateChanged` for callers holding both fibers — the common case inside
96
- * `onCommitFiberRoot`, where `fiber.alternate` is the previous fiber by
97
- * definition.
98
- */
99
- function ownStateChanged(prev, next) {
100
- return hookStateChanged(prev?.memoizedState, next?.memoizedState, {
101
- isClassComponent: next?.tag === CLASS_COMPONENT
102
- });
103
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.hookStateChanged=hookStateChanged,exports.ownStateChanged=ownStateChanged;const CLASS_COMPONENT=1,MAX_HOOKS_WALKED=64;function isHookList(e){return!!e&&"object"==typeof e&&("next"in e||"queue"in e||"memoizedState"in e)}function hookStateChanged(e,t,n){if(e===t)return!1;if(n?.isClassComponent)return!0;if(!isHookList(t))return!0;let o=e,i=t;for(let e=0;null!=i&&e<MAX_HOOKS_WALKED;e++){if(null!=i.queue){if(null==o)return!0;if(!Object.is(o.memoizedState,i.memoizedState))return!0}i=i.next,o=null!=o?o.next:null}return!1}function ownStateChanged(e,t){return hookStateChanged(e?.memoizedState,t?.memoizedState,{isClassComponent:t?.tag===CLASS_COMPONENT})}
@@ -1,50 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.resolveRawEventEmitter = resolveRawEventEmitter;
7
- /**
8
- * The one guarded require for React Native's RawEventEmitter.
9
- *
10
- * `RawEventEmitter` mirrors every event React Native dispatches BEFORE React's
11
- * plugins or components see it, which makes it the only way to observe what a
12
- * HUMAN is touching without instrumenting the app: Buoy mounts as a sibling of
13
- * the app tree, not a parent, so there is no root View to put a capture
14
- * responder on.
15
- *
16
- * Two things this file is careful about, both learned the hard way in
17
- * focus-inspector's copy:
18
- *
19
- * 1. It is a DEEP import that RN's export map warns about and could move in any
20
- * release. The failure has to degrade to "capture unavailable" rather than
21
- * taking the host app's bundle down — and Metro only treats a require as
22
- * optional when it sits LEXICALLY inside a try statement, so wrapping it in
23
- * a helper or an arrow makes Metro hard-fail the bundle instead.
24
- * 2. Keeping it in its own module gives the unit suite a seam: Node's `require`
25
- * ignores Vitest's module mocks, so the emitter can only be faked by mocking
26
- * a module reached with a real `import`.
27
- */
28
-
29
- function resolveRawEventEmitter() {
30
- let mod;
31
- try {
32
- mod = require("react-native/Libraries/Core/RawEventEmitter");
33
- } catch (e) {
34
- return {
35
- emitter: null,
36
- reason: e?.message ?? "RawEventEmitter is unavailable"
37
- };
38
- }
39
- const candidate = mod?.default ?? mod;
40
- if (typeof candidate?.addListener !== "function") {
41
- return {
42
- emitter: null,
43
- reason: "RawEventEmitter has no addListener"
44
- };
45
- }
46
- return {
47
- emitter: candidate,
48
- reason: null
49
- };
50
- }
1
+ "use strict";function resolveRawEventEmitter(){let e;try{e=require("react-native/Libraries/Core/RawEventEmitter")}catch(e){return{emitter:null,reason:e?.message??"RawEventEmitter is unavailable"}}const t=e?.default??e;return"function"!=typeof t?.addListener?{emitter:null,reason:"RawEventEmitter has no addListener"}:{emitter:t,reason:null}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveRawEventEmitter=resolveRawEventEmitter;
@@ -1,58 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.generateRendersJson = generateRendersJson;
7
- /**
8
- * Render Export Formatter
9
- *
10
- * Simple JSON export for render tracking data.
11
- */
12
-
13
- /**
14
- * Generate JSON export of all tracked renders
15
- */
16
- function generateRendersJson(renders) {
17
- const exportData = {
18
- exportedAt: new Date().toISOString(),
19
- totalComponents: renders.length,
20
- totalRenders: renders.reduce((sum, r) => sum + r.renderCount, 0),
21
- components: renders.map(render => ({
22
- // Identity
23
- componentName: render.componentName || render.displayName,
24
- viewType: render.viewType,
25
- nativeTag: render.nativeTag,
26
- // Identifiers
27
- testID: render.testID,
28
- nativeID: render.nativeID,
29
- accessibilityLabel: render.accessibilityLabel,
30
- // Render stats
31
- renderCount: render.renderCount,
32
- firstRenderTime: render.firstRenderTime,
33
- lastRenderTime: render.lastRenderTime,
34
- // Last render cause
35
- lastRenderCause: render.lastRenderCause ? {
36
- type: render.lastRenderCause.type,
37
- componentCause: render.lastRenderCause.componentCause,
38
- changedKeys: render.lastRenderCause.changedKeys,
39
- hookChanges: render.lastRenderCause.hookChanges?.map(h => ({
40
- type: h.type,
41
- index: h.index,
42
- description: h.description
43
- }))
44
- } : null,
45
- // Render history (if available)
46
- renderHistory: render.renderHistory?.map(event => ({
47
- renderNumber: event.renderNumber,
48
- timestamp: event.timestamp,
49
- cause: {
50
- type: event.cause.type,
51
- componentCause: event.cause.componentCause,
52
- changedKeys: event.cause.changedKeys
53
- }
54
- }))
55
- }))
56
- };
57
- return JSON.stringify(exportData, null, 2);
58
- }
1
+ "use strict";function generateRendersJson(e){const n={exportedAt:(new Date).toISOString(),totalComponents:e.length,totalRenders:e.reduce((e,n)=>e+n.renderCount,0),components:e.map(e=>({componentName:e.componentName||e.displayName,viewType:e.viewType,nativeTag:e.nativeTag,testID:e.testID,nativeID:e.nativeID,accessibilityLabel:e.accessibilityLabel,renderCount:e.renderCount,firstRenderTime:e.firstRenderTime,lastRenderTime:e.lastRenderTime,lastRenderCause:e.lastRenderCause?{type:e.lastRenderCause.type,componentCause:e.lastRenderCause.componentCause,changedKeys:e.lastRenderCause.changedKeys,hookChanges:e.lastRenderCause.hookChanges?.map(e=>({type:e.type,index:e.index,description:e.description}))}:null,renderHistory:e.renderHistory?.map(e=>({renderNumber:e.renderNumber,timestamp:e.timestamp,cause:{type:e.cause.type,componentCause:e.cause.componentCause,changedKeys:e.cause.changedKeys}}))}))};return JSON.stringify(n,null,2)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateRendersJson=generateRendersJson;