@oxog/devinspector 1.2.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/LICENSE +21 -0
  3. package/README.md +279 -0
  4. package/dist/devinspector.cjs.js +5494 -0
  5. package/dist/devinspector.cjs.js.map +1 -0
  6. package/dist/devinspector.esm.js +5482 -0
  7. package/dist/devinspector.esm.js.map +1 -0
  8. package/dist/devinspector.umd.js +5500 -0
  9. package/dist/devinspector.umd.js.map +1 -0
  10. package/dist/devinspector.umd.min.js +2 -0
  11. package/dist/devinspector.umd.min.js.map +1 -0
  12. package/dist/types/clean-inspector.d.ts +52 -0
  13. package/dist/types/core/event-emitter.d.ts +21 -0
  14. package/dist/types/core/inspector.d.ts +121 -0
  15. package/dist/types/core/plugin-system.d.ts +60 -0
  16. package/dist/types/core/storage.d.ts +52 -0
  17. package/dist/types/core/utils.d.ts +34 -0
  18. package/dist/types/enhanced-inspector.d.ts +56 -0
  19. package/dist/types/enhanced-simple.d.ts +46 -0
  20. package/dist/types/index-simple.d.ts +11 -0
  21. package/dist/types/index.d.ts +19 -0
  22. package/dist/types/monitors/console/console-interceptor.d.ts +36 -0
  23. package/dist/types/monitors/console/console-monitor.d.ts +26 -0
  24. package/dist/types/monitors/console/log-formatter.d.ts +8 -0
  25. package/dist/types/monitors/dom/dom-monitor.d.ts +8 -0
  26. package/dist/types/monitors/error/error-monitor.d.ts +28 -0
  27. package/dist/types/monitors/error/error-tracker.d.ts +55 -0
  28. package/dist/types/monitors/error/source-map-support.d.ts +15 -0
  29. package/dist/types/monitors/network/fetch-interceptor.d.ts +45 -0
  30. package/dist/types/monitors/network/network-monitor.d.ts +47 -0
  31. package/dist/types/monitors/network/websocket-monitor.d.ts +44 -0
  32. package/dist/types/monitors/network/xhr-interceptor.d.ts +25 -0
  33. package/dist/types/monitors/performance/fps-monitor.d.ts +24 -0
  34. package/dist/types/monitors/performance/long-task-detector.d.ts +25 -0
  35. package/dist/types/monitors/performance/memory-monitor.d.ts +30 -0
  36. package/dist/types/monitors/performance/metrics-collector.d.ts +45 -0
  37. package/dist/types/monitors/performance/performance-monitor.d.ts +34 -0
  38. package/dist/types/monitors/state/state-monitor.d.ts +8 -0
  39. package/dist/types/monitors/storage/storage-monitor.d.ts +8 -0
  40. package/dist/types/simple-index.d.ts +3 -0
  41. package/dist/types/simple-inspector.d.ts +24 -0
  42. package/dist/types/ui/components/floating-widget.d.ts +21 -0
  43. package/dist/types/ui/components/main-panel.d.ts +38 -0
  44. package/dist/types/ui/inspector-ui.d.ts +29 -0
  45. package/dist/types/ui/styles.d.ts +1 -0
  46. package/package.json +76 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,140 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.2.0] - 2025-07-01
9
+
10
+ ### Added
11
+ - **Enhanced Examples**: Completely recreated all framework examples from scratch
12
+ - **Responsive Layouts**: Added fullwidth and bottom-sidebar positioning options
13
+ - **Layout Controls**: Interactive layout switching in all examples
14
+ - **Framework Demos**: Comprehensive React, Vue, Angular, and Vanilla JS demonstrations
15
+
16
+ ### Enhanced
17
+ - **Simple Example**: Interactive demo with performance metrics and real-time updates
18
+ - **React Example**: Modern hooks, state management, and component lifecycle monitoring
19
+ - **Vue Example**: Composition API, reactivity system, and Vue 3 integration
20
+ - **Angular Example**: Service architecture, dependency injection patterns
21
+ - **Vanilla JS Example**: Advanced ES6+ features, Canvas API demos, and performance testing
22
+
23
+ ### UI/UX Improvements
24
+ - **6 Layout Options**: bottom-right, bottom-sidebar, fullwidth, top-left, top-right, bottom-left
25
+ - **Responsive Design**: CSS transitions and viewport-aware positioning
26
+ - **Interactive Controls**: Live layout switching with visual feedback
27
+ - **Framework-Specific Styling**: Tailored themes for each framework example
28
+
29
+ ### Developer Experience
30
+ - **Production Build**: Optimized bundles with proper error handling
31
+ - **Code Quality**: All ESLint and TypeScript errors resolved
32
+ - **Performance**: Enhanced build system with source maps and minification
33
+
34
+ ## [1.0.0] - 2025-07-01
35
+
36
+ ### Added
37
+ - Initial release of DevInspector
38
+ - Zero-dependency developer debugging tool
39
+ - Framework-agnostic design
40
+ - TypeScript support with full type definitions
41
+
42
+ #### Core Features
43
+ - **Event System**: Type-safe event emitter with max listeners and error handling
44
+ - **Plugin Architecture**: Extensible plugin system with lifecycle management
45
+ - **Storage Management**: Circular and indexed storage with memory-efficient operations
46
+ - **Utility Functions**: Comprehensive utilities for debugging and development
47
+
48
+ #### Network Monitoring
49
+ - **Fetch Interceptor**: Complete interception of Fetch API calls
50
+ - **XHR Interceptor**: XMLHttpRequest monitoring with progress tracking
51
+ - **WebSocket Monitor**: Real-time WebSocket connection and message tracking
52
+ - **Beacon Support**: navigator.sendBeacon interception
53
+ - **Request Analysis**: Timing, size calculation, cache detection
54
+ - **Error Handling**: Network error capture and reporting
55
+
56
+ #### Console Enhancement
57
+ - **Method Interception**: All console methods (log, warn, error, info, debug, trace, table, group, etc.)
58
+ - **Stack Trace Capture**: Automatic stack trace generation for errors and warnings
59
+ - **Object Formatting**: Pretty printing with circular reference handling
60
+ - **Command Execution**: Interactive console with command history
61
+ - **Log Filtering**: Advanced filtering by level, content, and source
62
+ - **Export Support**: JSON and text export formats
63
+
64
+ #### Performance Monitoring
65
+ - **FPS Monitoring**: Real-time frame rate tracking with dropped frame detection
66
+ - **Memory Tracking**: JavaScript heap usage monitoring (Chrome only)
67
+ - **Web Vitals**: FCP, LCP, FID, CLS, TTFB, INP metrics collection
68
+ - **Long Task Detection**: Tasks >50ms with attribution information
69
+ - **Resource Timing**: Automatic resource performance analysis
70
+ - **Custom Metrics**: Manual performance marking and measuring
71
+
72
+ #### Error Tracking
73
+ - **Global Error Handling**: Uncaught exceptions and promise rejections
74
+ - **Error Grouping**: Intelligent error clustering by similarity
75
+ - **Stack Enhancement**: Source map support for production debugging
76
+ - **Ignore Patterns**: Configurable error filtering
77
+ - **Error Analytics**: Statistics and frequency analysis
78
+
79
+ #### User Interface
80
+ - **Floating Widget**: Draggable, dockable widget with error notifications
81
+ - **Main Panel**: Resizable, draggable inspector panel
82
+ - **Tabbed Interface**: Network, Console, Performance, and Errors tabs
83
+ - **Dark/Light Themes**: Automatic theme detection and manual override
84
+ - **Responsive Design**: Mobile-friendly interface
85
+ - **Keyboard Shortcuts**: Customizable hotkeys (Ctrl+Shift+D to toggle)
86
+
87
+ #### Build System
88
+ - **Multiple Formats**: ESM, CommonJS, and UMD builds
89
+ - **TypeScript Compilation**: Full type definitions included
90
+ - **Source Maps**: Available for all builds
91
+ - **Bundle Optimization**: Minified versions with size limits
92
+ - **Tree Shaking**: Dead code elimination support
93
+
94
+ #### Developer Experience
95
+ - **Zero Configuration**: Works out of the box
96
+ - **Production Detection**: Automatically disabled in production
97
+ - **Framework Integration**: Examples for React, Vue, Angular
98
+ - **CDN Support**: Available via jsDelivr and unpkg
99
+ - **Comprehensive Examples**: Multiple usage scenarios
100
+
101
+ ### Technical Specifications
102
+ - **Bundle Size**: <16KB initial bundle (gzipped)
103
+ - **Performance**: <1ms overhead for network interception
104
+ - **Browser Support**: Chrome 80+, Firefox 75+, Safari 13+
105
+ - **Memory Management**: Automatic cleanup and circular buffers
106
+ - **Security**: XSS prevention, CSP compliance, input sanitization
107
+
108
+ ### Documentation
109
+ - Complete API documentation
110
+ - Plugin development guide
111
+ - Framework integration examples
112
+ - Performance optimization tips
113
+ - Troubleshooting guide
114
+
115
+ ### Testing
116
+ - Unit tests for core functionality
117
+ - Integration tests for interceptors
118
+ - End-to-end tests with Playwright
119
+ - Cross-browser testing
120
+ - Performance benchmarks
121
+
122
+ ---
123
+
124
+ ## Future Releases
125
+
126
+ ### Planned Features
127
+ - State management integration (Redux, Vuex, MobX)
128
+ - DOM mutation monitoring
129
+ - Storage inspection (localStorage, IndexedDB, cookies)
130
+ - Session recording
131
+ - Heat map generation
132
+ - A/B test detection
133
+ - Custom chart rendering
134
+ - Remote configuration
135
+ - Team collaboration features
136
+ - AI-powered insights
137
+
138
+ ---
139
+
140
+ For upgrade instructions and breaking changes, see the [Migration Guide](docs/MIGRATION.md).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ersin Koc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,279 @@
1
+ # DevInspector 🔍
2
+
3
+ <p align="center">
4
+ <img src="https://img.shields.io/npm/v/@oxog/devinspector.svg" alt="npm version" />
5
+ <img src="https://img.shields.io/npm/dm/@oxog/devinspector.svg" alt="npm downloads" />
6
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license" />
7
+ <img src="https://img.shields.io/bundlephobia/minzip/@oxog/devinspector" alt="bundle size" />
8
+ </p>
9
+
10
+ A professional developer inspector tool for real-time debugging of web applications. Zero dependencies, framework-agnostic, and production-ready.
11
+
12
+ ## ✨ Features
13
+
14
+ - 🌐 **Network Monitoring** - Intercept and analyze all network requests (fetch, XHR, WebSocket)
15
+ - 📝 **Console Enhancement** - Enhanced console with search, filtering, and export
16
+ - ⚡ **Performance Profiling** - FPS monitoring, memory tracking, and performance metrics
17
+ - 🐛 **Error Tracking** - Catch and analyze errors with source maps support
18
+ - 🔄 **State Management** - Integrate with Redux, Vuex, MobX, and other state managers
19
+ - 🎨 **DOM Analysis** - Inspect DOM mutations and element properties
20
+ - 💾 **Storage Inspector** - Monitor localStorage, cookies, and IndexedDB
21
+ - 🔌 **Plugin System** - Extend functionality with custom plugins
22
+
23
+ ## 📦 Installation
24
+
25
+ ### NPM
26
+ ```bash
27
+ npm install @oxog/devinspector --save-dev
28
+ ```
29
+
30
+ ### Yarn
31
+ ```bash
32
+ yarn add @oxog/devinspector -D
33
+ ```
34
+
35
+ ### CDN
36
+ ```html
37
+ <script src="https://unpkg.com/@oxog/devinspector/dist/devinspector.umd.min.js"></script>
38
+ ```
39
+
40
+ ## 🚀 Quick Start
41
+
42
+ ### ES Modules
43
+ ```javascript
44
+ import DevInspector from '@oxog/devinspector';
45
+
46
+ const inspector = new DevInspector({
47
+ enabled: process.env.NODE_ENV !== 'production'
48
+ });
49
+
50
+ // Show the inspector
51
+ inspector.show();
52
+ ```
53
+
54
+ ### CommonJS
55
+ ```javascript
56
+ const DevInspector = require('@oxog/devinspector').default;
57
+
58
+ const inspector = new DevInspector();
59
+ ```
60
+
61
+ ### Script Tag
62
+ ```html
63
+ <script src="https://unpkg.com/@oxog/devinspector"></script>
64
+ <script>
65
+ const inspector = new DevInspector();
66
+ inspector.show();
67
+ </script>
68
+ ```
69
+
70
+ ## ⚙️ Configuration
71
+
72
+ ```javascript
73
+ const inspector = new DevInspector({
74
+ // Enable/disable the inspector
75
+ enabled: true,
76
+
77
+ // Position on screen
78
+ position: 'bottom-right', // 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
79
+
80
+ // Theme
81
+ theme: 'auto', // 'dark' | 'light' | 'auto'
82
+
83
+ // Keyboard shortcuts
84
+ hotkeys: {
85
+ toggle: 'ctrl+shift+d',
86
+ minimize: 'ctrl+shift+m'
87
+ },
88
+
89
+ // Features to enable
90
+ features: {
91
+ network: true,
92
+ console: true,
93
+ performance: true,
94
+ errors: true,
95
+ state: true,
96
+ dom: true,
97
+ storage: true
98
+ },
99
+
100
+ // Storage limits
101
+ maxNetworkEntries: 1000,
102
+ maxConsoleEntries: 500,
103
+
104
+ // Stack traces
105
+ captureStackTraces: true,
106
+
107
+ // Network filters
108
+ networkFilters: {
109
+ hideAssets: false,
110
+ hideCached: false
111
+ },
112
+
113
+ // Callbacks
114
+ onError: (error) => console.error(error),
115
+ onPerformanceIssue: (issue) => console.warn(issue)
116
+ });
117
+ ```
118
+
119
+ ## 🔧 API
120
+
121
+ ### Core Methods
122
+
123
+ ```javascript
124
+ // Show/hide inspector
125
+ inspector.show();
126
+ inspector.hide();
127
+ inspector.toggle();
128
+ inspector.minimize();
129
+
130
+ // Destroy inspector
131
+ inspector.destroy();
132
+
133
+ // Manual tracking
134
+ inspector.track('custom-metric', { value: 123 });
135
+ inspector.markStart('operation');
136
+ inspector.markEnd('operation');
137
+
138
+ // Export/import data
139
+ const data = inspector.export();
140
+ inspector.import(data);
141
+ ```
142
+
143
+ ### Events
144
+
145
+ ```javascript
146
+ // Listen to events
147
+ inspector.on('network:request', (request) => {
148
+ console.log('Network request:', request);
149
+ });
150
+
151
+ inspector.on('error:uncaught', (error) => {
152
+ console.log('Uncaught error:', error);
153
+ });
154
+
155
+ // Remove listeners
156
+ const unsubscribe = inspector.on('console:log', handler);
157
+ unsubscribe(); // or inspector.off('console:log', handler);
158
+ ```
159
+
160
+ ## 🔌 Plugins
161
+
162
+ ### Using Plugins
163
+
164
+ ```javascript
165
+ import { MyPlugin } from './my-plugin';
166
+
167
+ inspector.use(new MyPlugin());
168
+ ```
169
+
170
+ ### Creating Plugins
171
+
172
+ ```javascript
173
+ import { BasePlugin } from '@oxog/devinspector';
174
+
175
+ export class MyPlugin extends BasePlugin {
176
+ name = 'my-plugin';
177
+ version = '1.0.0';
178
+ description = 'My custom plugin';
179
+
180
+ async onInstall() {
181
+ // Setup plugin
182
+ this.events.on('network:request', this.handleRequest.bind(this));
183
+ }
184
+
185
+ onUninstall() {
186
+ // Cleanup
187
+ }
188
+
189
+ handleRequest(request) {
190
+ console.log('Plugin handling request:', request);
191
+ }
192
+ }
193
+ ```
194
+
195
+ ## 🎯 Framework Integration
196
+
197
+ ### React
198
+ ```jsx
199
+ import { useEffect } from 'react';
200
+ import DevInspector from '@oxog/devinspector';
201
+
202
+ function App() {
203
+ useEffect(() => {
204
+ const inspector = new DevInspector();
205
+ return () => inspector.destroy();
206
+ }, []);
207
+
208
+ return <div>Your App</div>;
209
+ }
210
+ ```
211
+
212
+ ### Vue
213
+ ```javascript
214
+ import DevInspector from '@oxog/devinspector';
215
+
216
+ export default {
217
+ mounted() {
218
+ this.inspector = new DevInspector();
219
+ },
220
+ beforeDestroy() {
221
+ this.inspector.destroy();
222
+ }
223
+ }
224
+ ```
225
+
226
+ ### Angular
227
+ ```typescript
228
+ import { Component, OnInit, OnDestroy } from '@angular/core';
229
+ import DevInspector from '@oxog/devinspector';
230
+
231
+ @Component({...})
232
+ export class AppComponent implements OnInit, OnDestroy {
233
+ private inspector: DevInspector;
234
+
235
+ ngOnInit() {
236
+ this.inspector = new DevInspector();
237
+ }
238
+
239
+ ngOnDestroy() {
240
+ this.inspector.destroy();
241
+ }
242
+ }
243
+ ```
244
+
245
+ ## 🔒 Security
246
+
247
+ - All inputs are sanitized to prevent XSS
248
+ - Sensitive data can be filtered
249
+ - Content Security Policy compliant
250
+ - No eval() or Function() usage
251
+
252
+ ## 🌐 Browser Support
253
+
254
+ - Chrome/Edge 80+
255
+ - Firefox 75+
256
+ - Safari 13+
257
+ - Mobile browsers supported
258
+
259
+ ## 📈 Performance
260
+
261
+ - < 1ms overhead for interceptors
262
+ - < 16KB initial bundle (gzipped)
263
+ - Lazy loading for UI components
264
+ - Automatic memory management
265
+
266
+ ## 🤝 Contributing
267
+
268
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
269
+
270
+ ## 📄 License
271
+
272
+ MIT © [Ersin Koc](https://github.com/ersinkoc)
273
+
274
+ ## 🔗 Links
275
+
276
+ - [Documentation](https://github.com/ersinkoc/devinspector#readme)
277
+ - [NPM Package](https://www.npmjs.com/package/@oxog/devinspector)
278
+ - [GitHub Repository](https://github.com/ersinkoc/devinspector)
279
+ - [Report Issues](https://github.com/ersinkoc/devinspector/issues)