@rozenite/performance-monitor-plugin 1.0.0-alpha.11
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 +20 -0
- package/README.md +130 -0
- package/dist/App.html +31 -0
- package/dist/assets/App-C1ubeKf9.js +119 -0
- package/dist/assets/App-DRvEE1L4.css +1 -0
- package/dist/react-native.cjs +1 -0
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +5 -0
- package/dist/rozenite.config.d.ts +7 -0
- package/dist/rozenite.json +1 -0
- package/dist/src/react-native/asserts.d.ts +4 -0
- package/dist/src/react-native/helpers.d.ts +1 -0
- package/dist/src/react-native/performance-monitor.d.ts +8 -0
- package/dist/src/react-native/usePerformanceMonitorDevTools.d.ts +1 -0
- package/dist/src/shared/types.d.ts +39 -0
- package/dist/src/ui/App.d.ts +1 -0
- package/dist/src/ui/components/DataTable.d.ts +8 -0
- package/dist/src/ui/components/DetailsDisplay.d.ts +4 -0
- package/dist/src/ui/components/DetailsSidebar.d.ts +6 -0
- package/dist/src/ui/components/ExportModal.d.ts +9 -0
- package/dist/src/ui/components/JsonTree.d.ts +4 -0
- package/dist/src/ui/components/MarkDetails.d.ts +5 -0
- package/dist/src/ui/components/MarksTable.d.ts +6 -0
- package/dist/src/ui/components/MeasureDetails.d.ts +5 -0
- package/dist/src/ui/components/MeasuresTable.d.ts +6 -0
- package/dist/src/ui/components/MetricDetails.d.ts +5 -0
- package/dist/src/ui/components/MetricsTable.d.ts +6 -0
- package/dist/src/ui/components/SessionDuration.d.ts +5 -0
- package/dist/src/ui/utils.d.ts +2 -0
- package/dist/usePerformanceMonitorDevTools.cjs +1 -0
- package/dist/usePerformanceMonitorDevTools.js +118 -0
- package/package.json +41 -0
- package/project.json +12 -0
- package/react-native.ts +8 -0
- package/rozenite.config.ts +8 -0
- package/src/react-native/asserts.ts +29 -0
- package/src/react-native/helpers.ts +4 -0
- package/src/react-native/performance-monitor.ts +171 -0
- package/src/react-native/usePerformanceMonitorDevTools.ts +31 -0
- package/src/shared/types.ts +50 -0
- package/src/ui/App.css +97 -0
- package/src/ui/App.tsx +286 -0
- package/src/ui/components/DataTable.tsx +117 -0
- package/src/ui/components/DetailsDisplay.tsx +26 -0
- package/src/ui/components/DetailsSidebar.tsx +87 -0
- package/src/ui/components/ExportModal.tsx +278 -0
- package/src/ui/components/JsonTree.tsx +35 -0
- package/src/ui/components/MarkDetails.tsx +45 -0
- package/src/ui/components/MarksTable.tsx +42 -0
- package/src/ui/components/MeasureDetails.tsx +74 -0
- package/src/ui/components/MeasuresTable.tsx +72 -0
- package/src/ui/components/MetricDetails.tsx +56 -0
- package/src/ui/components/MetricsTable.tsx +54 -0
- package/src/ui/components/SessionDuration.tsx +54 -0
- package/src/ui/utils.ts +17 -0
- package/tsconfig.json +32 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Szymon Chmal
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
### A Rozenite plugin that provides real-time React Native performance monitoring and metrics visualization in DevTools.
|
|
4
|
+
|
|
5
|
+
[![mit licence][license-badge]][license] [![npm downloads][npm-downloads-badge]][npm-downloads] [![Chat][chat-badge]][chat] [![PRs Welcome][prs-welcome-badge]][prs-welcome]
|
|
6
|
+
|
|
7
|
+
The Rozenite Performance Monitor Plugin offers comprehensive real-time monitoring of React Native performance metrics within your DevTools environment. It tracks performance marks, measures, and metrics to help you identify bottlenecks and optimize your app's performance.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Real-time Performance Monitoring**: Live tracking of performance marks, measures, and metrics
|
|
12
|
+
- **Session Management**: Start/stop monitoring sessions with real-time duration tracking
|
|
13
|
+
- **Performance Measures**: Track custom performance measurements with details
|
|
14
|
+
- **Performance Marks**: Monitor key performance milestones and events
|
|
15
|
+
- **Performance Metrics**: Real-time metrics with values and details
|
|
16
|
+
- **Data Export**: Export performance data for analysis
|
|
17
|
+
- **Bidirectional Communication**: Real-time sync between device and DevTools
|
|
18
|
+
- **Production Safety**: Automatically disabled in production builds
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Install the Performance Monitor plugin as a dependency:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @rozenite/performance-monitor-plugin
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
### 1. Install the Plugin
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @rozenite/performance-monitor-plugin
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. Integrate with Your React Native App
|
|
37
|
+
|
|
38
|
+
Add the DevTools hook to your React Native app:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// App.tsx
|
|
42
|
+
import { usePerformanceMonitorDevTools } from '@rozenite/performance-monitor-plugin';
|
|
43
|
+
|
|
44
|
+
function App() {
|
|
45
|
+
// Enable Performance Monitor DevTools in development
|
|
46
|
+
usePerformanceMonitorDevTools();
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
// Your app components
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Access DevTools
|
|
55
|
+
|
|
56
|
+
Start your development server and open React Native DevTools. You'll find the "Performance Monitor" panel in the DevTools interface.
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
### Basic Integration
|
|
61
|
+
|
|
62
|
+
The plugin automatically integrates with your existing React Native setup:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { usePerformanceMonitorDevTools } from '@rozenite/performance-monitor-plugin';
|
|
66
|
+
|
|
67
|
+
function App() {
|
|
68
|
+
// DevTools are automatically enabled in development
|
|
69
|
+
usePerformanceMonitorDevTools();
|
|
70
|
+
|
|
71
|
+
return <YourApp />;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Using Performance API
|
|
76
|
+
|
|
77
|
+
The plugin works with React Native's Performance API. You can add custom performance marks and measures:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import performance from 'react-native-performance';
|
|
81
|
+
|
|
82
|
+
// Add performance marks
|
|
83
|
+
performance.mark('app-start');
|
|
84
|
+
performance.mark('data-loaded');
|
|
85
|
+
|
|
86
|
+
// Measure performance between marks
|
|
87
|
+
performance.measure('app-initialization', 'app-start', 'data-loaded');
|
|
88
|
+
|
|
89
|
+
// Add custom metrics
|
|
90
|
+
performance.metric('custom-metric', 42, { detail: 'Additional info' });
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Performance Data Types
|
|
94
|
+
|
|
95
|
+
### Performance Marks
|
|
96
|
+
|
|
97
|
+
- **Purpose**: Mark specific points in time for performance analysis
|
|
98
|
+
- **Use Cases**: App startup, data loading, user interactions
|
|
99
|
+
- **Example**: `performance.mark('user-login-complete')`
|
|
100
|
+
|
|
101
|
+
### Performance Measures
|
|
102
|
+
|
|
103
|
+
- **Purpose**: Measure duration between two marks or specific time periods
|
|
104
|
+
- **Details**: Can include additional context information
|
|
105
|
+
- **Example**: `performance.measure('login-duration', 'login-start', 'login-end')`
|
|
106
|
+
|
|
107
|
+
### Performance Metrics
|
|
108
|
+
|
|
109
|
+
- **Purpose**: Track specific performance indicators
|
|
110
|
+
- **Values**: Can be strings or numbers
|
|
111
|
+
- **Details**: Can include additional context information
|
|
112
|
+
- **Example**: `performance.metric('memory-usage', 1024, { unit: 'MB' })`
|
|
113
|
+
|
|
114
|
+
## Made with ❤️ at Callstack
|
|
115
|
+
|
|
116
|
+
`rozenite` is an open source project and will always remain free to use. If you think it's cool, please star it 🌟.
|
|
117
|
+
|
|
118
|
+
[Callstack][callstack-readme-with-love] is a group of React and React Native geeks, contact us at [hello@callstack.com](mailto:hello@callstack.com) if you need any help with these or just want to say hi!
|
|
119
|
+
|
|
120
|
+
Like the project? ⚛️ [Join the team](https://callstack.com/careers/?utm_campaign=Senior_RN&utm_source=github&utm_medium=readme) who does amazing stuff for clients and drives React Native Open Source! 🔥
|
|
121
|
+
|
|
122
|
+
[callstack-readme-with-love]: https://callstack.com/?utm_source=github.com&utm_medium=referral&utm_campaign=rozenite&utm_term=readme-with-love
|
|
123
|
+
[license-badge]: https://img.shields.io/npm/l/rozenite?style=for-the-badge
|
|
124
|
+
[license]: https://github.com/callstackincubator/rozenite/blob/main/LICENSE
|
|
125
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dm/rozenite?style=for-the-badge
|
|
126
|
+
[npm-downloads]: https://www.npmjs.com/package/@rozenite/performance-monitor-plugin
|
|
127
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
|
|
128
|
+
[prs-welcome]: https://github.com/callstackincubator/rozenite/blob/main/CONTRIBUTING.md
|
|
129
|
+
[chat-badge]: https://img.shields.io/discord/426714625279524876.svg?style=for-the-badge
|
|
130
|
+
[chat]: https://discord.gg/xgGt7KAjxv
|
package/dist/App.html
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>App Panel</title>
|
|
7
|
+
<style>
|
|
8
|
+
html,
|
|
9
|
+
body {
|
|
10
|
+
height: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#root {
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
</style>
|
|
22
|
+
<script>
|
|
23
|
+
var __ROZENITE_PANEL__ = true;
|
|
24
|
+
</script>
|
|
25
|
+
<script type="module" crossorigin src="./assets/App-C1ubeKf9.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="./assets/App-DRvEE1L4.css">
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<div id="root"></div>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|