@oxog/react-check 1.0.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/LICENSE +21 -0
- package/README.md +343 -0
- package/dist/browser-inject.global.js +182 -0
- package/dist/chain.cjs +537 -0
- package/dist/chain.cjs.map +1 -0
- package/dist/chain.d.cts +145 -0
- package/dist/chain.d.ts +145 -0
- package/dist/chain.js +535 -0
- package/dist/chain.js.map +1 -0
- package/dist/cli.js +5591 -0
- package/dist/cli.js.map +1 -0
- package/dist/detect.cjs +331 -0
- package/dist/detect.cjs.map +1 -0
- package/dist/detect.d.cts +68 -0
- package/dist/detect.d.ts +68 -0
- package/dist/detect.js +326 -0
- package/dist/detect.js.map +1 -0
- package/dist/event-emitter-CxKUDo9q.d.cts +119 -0
- package/dist/event-emitter-CxKUDo9q.d.ts +119 -0
- package/dist/fix.cjs +723 -0
- package/dist/fix.cjs.map +1 -0
- package/dist/fix.d.cts +93 -0
- package/dist/fix.d.ts +93 -0
- package/dist/fix.js +721 -0
- package/dist/fix.js.map +1 -0
- package/dist/index.cjs +5647 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1444 -0
- package/dist/index.d.ts +1444 -0
- package/dist/index.js +5579 -0
- package/dist/index.js.map +1 -0
- package/dist/scanner-BsBnFki5.d.cts +383 -0
- package/dist/scanner-bpT7eMcv.d.ts +383 -0
- package/dist/scanner.cjs +1660 -0
- package/dist/scanner.cjs.map +1 -0
- package/dist/scanner.d.cts +3 -0
- package/dist/scanner.d.ts +3 -0
- package/dist/scanner.js +1658 -0
- package/dist/scanner.js.map +1 -0
- package/dist/types-CVcIoqzs.d.cts +474 -0
- package/dist/types-CVcIoqzs.d.ts +474 -0
- package/package.json +127 -0
package/dist/chain.d.cts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { d as RenderChainInfo, R as RenderInfo } from './types-CVcIoqzs.cjs';
|
|
2
|
+
import { E as EventEmitter } from './event-emitter-CxKUDo9q.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Render chain analyzer - traces cascading renders to find root causes
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Events emitted by ChainAnalyzer
|
|
11
|
+
*/
|
|
12
|
+
interface ChainEvents {
|
|
13
|
+
/** Index signature for EventMap compatibility */
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
/** Emitted when a render chain is detected */
|
|
16
|
+
chain: RenderChainInfo;
|
|
17
|
+
/** Emitted when a context-triggered chain is detected */
|
|
18
|
+
contextChain: RenderChainInfo;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Analyzes render patterns to detect and trace render chains
|
|
22
|
+
*/
|
|
23
|
+
declare class ChainAnalyzer extends EventEmitter<ChainEvents> {
|
|
24
|
+
/** Time window size in ms (one frame at 60fps) */
|
|
25
|
+
private readonly windowSize;
|
|
26
|
+
/** Current render windows being tracked */
|
|
27
|
+
private windows;
|
|
28
|
+
/** Component parent relationships */
|
|
29
|
+
private parentMap;
|
|
30
|
+
/** Recently detected chains to avoid duplicates */
|
|
31
|
+
private recentChains;
|
|
32
|
+
/** Minimum chain depth to report */
|
|
33
|
+
private readonly minChainDepth;
|
|
34
|
+
/** Maximum time to keep recent chains */
|
|
35
|
+
private readonly recentChainTtl;
|
|
36
|
+
/**
|
|
37
|
+
* Create a new ChainAnalyzer
|
|
38
|
+
* @param options - Configuration options
|
|
39
|
+
*/
|
|
40
|
+
constructor(options?: {
|
|
41
|
+
windowSize?: number;
|
|
42
|
+
minChainDepth?: number;
|
|
43
|
+
recentChainTtl?: number;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Add a render event for analysis
|
|
47
|
+
* @param render - Render information
|
|
48
|
+
* @param parent - Optional parent component name
|
|
49
|
+
*/
|
|
50
|
+
addRender(render: RenderInfo, parent?: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Set parent relationship for a component
|
|
53
|
+
* @param child - Child component name
|
|
54
|
+
* @param parent - Parent component name
|
|
55
|
+
*/
|
|
56
|
+
setParent(child: string, parent: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get window key for a timestamp
|
|
59
|
+
* @param timestamp - Timestamp in ms
|
|
60
|
+
* @returns Window key
|
|
61
|
+
*/
|
|
62
|
+
private getWindowKey;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a render was likely triggered by context
|
|
65
|
+
* @param render - Render information
|
|
66
|
+
* @returns true if context-triggered
|
|
67
|
+
*/
|
|
68
|
+
private isContextTriggered;
|
|
69
|
+
/**
|
|
70
|
+
* Analyze a render window for chains
|
|
71
|
+
* @param windowKey - Window key to analyze
|
|
72
|
+
*/
|
|
73
|
+
private analyzeWindow;
|
|
74
|
+
/**
|
|
75
|
+
* Build chains from a sorted render sequence
|
|
76
|
+
* @param renders - Sorted render events
|
|
77
|
+
* @returns Detected chains
|
|
78
|
+
*/
|
|
79
|
+
private buildChains;
|
|
80
|
+
/**
|
|
81
|
+
* Trace a chain starting from a component
|
|
82
|
+
* @param startComponent - Starting component
|
|
83
|
+
* @param renders - All renders in window
|
|
84
|
+
* @param visited - Already visited components
|
|
85
|
+
* @returns Chain of component names
|
|
86
|
+
*/
|
|
87
|
+
private traceChain;
|
|
88
|
+
/**
|
|
89
|
+
* Find the root cause component in a chain
|
|
90
|
+
* @param chain - Component chain
|
|
91
|
+
* @param renders - All renders
|
|
92
|
+
* @returns Root cause component name
|
|
93
|
+
*/
|
|
94
|
+
private findRootCause;
|
|
95
|
+
/**
|
|
96
|
+
* Determine what triggered a chain
|
|
97
|
+
* @param rootCause - Root cause component
|
|
98
|
+
* @param renders - All renders
|
|
99
|
+
* @returns Trigger description
|
|
100
|
+
*/
|
|
101
|
+
private determineTrigger;
|
|
102
|
+
/**
|
|
103
|
+
* Generate a unique key for a chain to detect duplicates
|
|
104
|
+
* @param chain - Chain info
|
|
105
|
+
* @returns Unique key
|
|
106
|
+
*/
|
|
107
|
+
private getChainKey;
|
|
108
|
+
/**
|
|
109
|
+
* Clean up old render windows
|
|
110
|
+
* @param currentTime - Current timestamp
|
|
111
|
+
*/
|
|
112
|
+
private cleanupWindows;
|
|
113
|
+
/**
|
|
114
|
+
* Get the parent of a component
|
|
115
|
+
* @param componentName - Component name
|
|
116
|
+
* @returns Parent name or undefined
|
|
117
|
+
*/
|
|
118
|
+
getParent(componentName: string): string | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Get all known parent relationships
|
|
121
|
+
* @returns Map of child to parent
|
|
122
|
+
*/
|
|
123
|
+
getParentMap(): Map<string, string>;
|
|
124
|
+
/**
|
|
125
|
+
* Build a full chain for a component (tracing up to root)
|
|
126
|
+
* @param componentName - Starting component
|
|
127
|
+
* @returns Chain from root to component
|
|
128
|
+
*/
|
|
129
|
+
getComponentChain(componentName: string): string[];
|
|
130
|
+
/**
|
|
131
|
+
* Clear all tracked data
|
|
132
|
+
*/
|
|
133
|
+
reset(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Get statistics about current tracking
|
|
136
|
+
* @returns Tracking statistics
|
|
137
|
+
*/
|
|
138
|
+
getStats(): {
|
|
139
|
+
windowCount: number;
|
|
140
|
+
parentRelationships: number;
|
|
141
|
+
recentChains: number;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { ChainAnalyzer, type ChainEvents };
|
package/dist/chain.d.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { d as RenderChainInfo, R as RenderInfo } from './types-CVcIoqzs.js';
|
|
2
|
+
import { E as EventEmitter } from './event-emitter-CxKUDo9q.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Render chain analyzer - traces cascading renders to find root causes
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Events emitted by ChainAnalyzer
|
|
11
|
+
*/
|
|
12
|
+
interface ChainEvents {
|
|
13
|
+
/** Index signature for EventMap compatibility */
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
/** Emitted when a render chain is detected */
|
|
16
|
+
chain: RenderChainInfo;
|
|
17
|
+
/** Emitted when a context-triggered chain is detected */
|
|
18
|
+
contextChain: RenderChainInfo;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Analyzes render patterns to detect and trace render chains
|
|
22
|
+
*/
|
|
23
|
+
declare class ChainAnalyzer extends EventEmitter<ChainEvents> {
|
|
24
|
+
/** Time window size in ms (one frame at 60fps) */
|
|
25
|
+
private readonly windowSize;
|
|
26
|
+
/** Current render windows being tracked */
|
|
27
|
+
private windows;
|
|
28
|
+
/** Component parent relationships */
|
|
29
|
+
private parentMap;
|
|
30
|
+
/** Recently detected chains to avoid duplicates */
|
|
31
|
+
private recentChains;
|
|
32
|
+
/** Minimum chain depth to report */
|
|
33
|
+
private readonly minChainDepth;
|
|
34
|
+
/** Maximum time to keep recent chains */
|
|
35
|
+
private readonly recentChainTtl;
|
|
36
|
+
/**
|
|
37
|
+
* Create a new ChainAnalyzer
|
|
38
|
+
* @param options - Configuration options
|
|
39
|
+
*/
|
|
40
|
+
constructor(options?: {
|
|
41
|
+
windowSize?: number;
|
|
42
|
+
minChainDepth?: number;
|
|
43
|
+
recentChainTtl?: number;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Add a render event for analysis
|
|
47
|
+
* @param render - Render information
|
|
48
|
+
* @param parent - Optional parent component name
|
|
49
|
+
*/
|
|
50
|
+
addRender(render: RenderInfo, parent?: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Set parent relationship for a component
|
|
53
|
+
* @param child - Child component name
|
|
54
|
+
* @param parent - Parent component name
|
|
55
|
+
*/
|
|
56
|
+
setParent(child: string, parent: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get window key for a timestamp
|
|
59
|
+
* @param timestamp - Timestamp in ms
|
|
60
|
+
* @returns Window key
|
|
61
|
+
*/
|
|
62
|
+
private getWindowKey;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a render was likely triggered by context
|
|
65
|
+
* @param render - Render information
|
|
66
|
+
* @returns true if context-triggered
|
|
67
|
+
*/
|
|
68
|
+
private isContextTriggered;
|
|
69
|
+
/**
|
|
70
|
+
* Analyze a render window for chains
|
|
71
|
+
* @param windowKey - Window key to analyze
|
|
72
|
+
*/
|
|
73
|
+
private analyzeWindow;
|
|
74
|
+
/**
|
|
75
|
+
* Build chains from a sorted render sequence
|
|
76
|
+
* @param renders - Sorted render events
|
|
77
|
+
* @returns Detected chains
|
|
78
|
+
*/
|
|
79
|
+
private buildChains;
|
|
80
|
+
/**
|
|
81
|
+
* Trace a chain starting from a component
|
|
82
|
+
* @param startComponent - Starting component
|
|
83
|
+
* @param renders - All renders in window
|
|
84
|
+
* @param visited - Already visited components
|
|
85
|
+
* @returns Chain of component names
|
|
86
|
+
*/
|
|
87
|
+
private traceChain;
|
|
88
|
+
/**
|
|
89
|
+
* Find the root cause component in a chain
|
|
90
|
+
* @param chain - Component chain
|
|
91
|
+
* @param renders - All renders
|
|
92
|
+
* @returns Root cause component name
|
|
93
|
+
*/
|
|
94
|
+
private findRootCause;
|
|
95
|
+
/**
|
|
96
|
+
* Determine what triggered a chain
|
|
97
|
+
* @param rootCause - Root cause component
|
|
98
|
+
* @param renders - All renders
|
|
99
|
+
* @returns Trigger description
|
|
100
|
+
*/
|
|
101
|
+
private determineTrigger;
|
|
102
|
+
/**
|
|
103
|
+
* Generate a unique key for a chain to detect duplicates
|
|
104
|
+
* @param chain - Chain info
|
|
105
|
+
* @returns Unique key
|
|
106
|
+
*/
|
|
107
|
+
private getChainKey;
|
|
108
|
+
/**
|
|
109
|
+
* Clean up old render windows
|
|
110
|
+
* @param currentTime - Current timestamp
|
|
111
|
+
*/
|
|
112
|
+
private cleanupWindows;
|
|
113
|
+
/**
|
|
114
|
+
* Get the parent of a component
|
|
115
|
+
* @param componentName - Component name
|
|
116
|
+
* @returns Parent name or undefined
|
|
117
|
+
*/
|
|
118
|
+
getParent(componentName: string): string | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Get all known parent relationships
|
|
121
|
+
* @returns Map of child to parent
|
|
122
|
+
*/
|
|
123
|
+
getParentMap(): Map<string, string>;
|
|
124
|
+
/**
|
|
125
|
+
* Build a full chain for a component (tracing up to root)
|
|
126
|
+
* @param componentName - Starting component
|
|
127
|
+
* @returns Chain from root to component
|
|
128
|
+
*/
|
|
129
|
+
getComponentChain(componentName: string): string[];
|
|
130
|
+
/**
|
|
131
|
+
* Clear all tracked data
|
|
132
|
+
*/
|
|
133
|
+
reset(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Get statistics about current tracking
|
|
136
|
+
* @returns Tracking statistics
|
|
137
|
+
*/
|
|
138
|
+
getStats(): {
|
|
139
|
+
windowCount: number;
|
|
140
|
+
parentRelationships: number;
|
|
141
|
+
recentChains: number;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { ChainAnalyzer, type ChainEvents };
|