@oxog/devinspector 1.2.0 → 1.3.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 +36 -0
- package/LICENSE +0 -0
- package/README.md +85 -28
- package/dist/chunk-LNBLBFDA.js +92 -0
- package/dist/chunk-LNBLBFDA.js.map +1 -0
- package/dist/chunk-PPIEWSZ7.js +32 -0
- package/dist/chunk-PPIEWSZ7.js.map +1 -0
- package/dist/console-monitor-LBNXAQQ4.js +571 -0
- package/dist/console-monitor-LBNXAQQ4.js.map +1 -0
- package/dist/devinspector.umd.js +1782 -1074
- package/dist/devinspector.umd.js.map +1 -1
- package/dist/devinspector.umd.min.js +6 -1
- package/dist/devinspector.umd.min.js.map +1 -1
- package/dist/dom-monitor-IGQZTXMH.js +19 -0
- package/dist/dom-monitor-IGQZTXMH.js.map +1 -0
- package/dist/error-monitor-XDNRO4KS.js +423 -0
- package/dist/error-monitor-XDNRO4KS.js.map +1 -0
- package/dist/index.cjs +5918 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +582 -0
- package/dist/index.d.ts +582 -0
- package/dist/index.js +1983 -0
- package/dist/index.js.map +1 -0
- package/dist/inspector-ui-AFTUEVWA.js +1240 -0
- package/dist/inspector-ui-AFTUEVWA.js.map +1 -0
- package/dist/network-monitor-HUSRKEXE.js +841 -0
- package/dist/network-monitor-HUSRKEXE.js.map +1 -0
- package/dist/performance-monitor-66DQJGOJ.js +544 -0
- package/dist/performance-monitor-66DQJGOJ.js.map +1 -0
- package/dist/state-monitor-PS5Q7NWY.js +19 -0
- package/dist/state-monitor-PS5Q7NWY.js.map +1 -0
- package/dist/storage-monitor-QW634CEJ.js +19 -0
- package/dist/storage-monitor-QW634CEJ.js.map +1 -0
- package/package.json +51 -38
- package/dist/devinspector.cjs.js +0 -5494
- package/dist/devinspector.cjs.js.map +0 -1
- package/dist/devinspector.esm.js +0 -5482
- package/dist/devinspector.esm.js.map +0 -1
- package/dist/types/clean-inspector.d.ts +0 -52
- package/dist/types/core/event-emitter.d.ts +0 -21
- package/dist/types/core/inspector.d.ts +0 -121
- package/dist/types/core/plugin-system.d.ts +0 -60
- package/dist/types/core/storage.d.ts +0 -52
- package/dist/types/core/utils.d.ts +0 -34
- package/dist/types/enhanced-inspector.d.ts +0 -56
- package/dist/types/enhanced-simple.d.ts +0 -46
- package/dist/types/index-simple.d.ts +0 -11
- package/dist/types/index.d.ts +0 -19
- package/dist/types/monitors/console/console-interceptor.d.ts +0 -36
- package/dist/types/monitors/console/console-monitor.d.ts +0 -26
- package/dist/types/monitors/console/log-formatter.d.ts +0 -8
- package/dist/types/monitors/dom/dom-monitor.d.ts +0 -8
- package/dist/types/monitors/error/error-monitor.d.ts +0 -28
- package/dist/types/monitors/error/error-tracker.d.ts +0 -55
- package/dist/types/monitors/error/source-map-support.d.ts +0 -15
- package/dist/types/monitors/network/fetch-interceptor.d.ts +0 -45
- package/dist/types/monitors/network/network-monitor.d.ts +0 -47
- package/dist/types/monitors/network/websocket-monitor.d.ts +0 -44
- package/dist/types/monitors/network/xhr-interceptor.d.ts +0 -25
- package/dist/types/monitors/performance/fps-monitor.d.ts +0 -24
- package/dist/types/monitors/performance/long-task-detector.d.ts +0 -25
- package/dist/types/monitors/performance/memory-monitor.d.ts +0 -30
- package/dist/types/monitors/performance/metrics-collector.d.ts +0 -45
- package/dist/types/monitors/performance/performance-monitor.d.ts +0 -34
- package/dist/types/monitors/state/state-monitor.d.ts +0 -8
- package/dist/types/monitors/storage/storage-monitor.d.ts +0 -8
- package/dist/types/simple-index.d.ts +0 -3
- package/dist/types/simple-inspector.d.ts +0 -24
- package/dist/types/ui/components/floating-widget.d.ts +0 -21
- package/dist/types/ui/components/main-panel.d.ts +0 -38
- package/dist/types/ui/inspector-ui.d.ts +0 -29
- package/dist/types/ui/styles.d.ts +0 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
type EventListener<T = any> = (data: T) => void;
|
|
2
|
+
type EventUnsubscribe = () => void;
|
|
3
|
+
interface EventEmitterOptions {
|
|
4
|
+
maxListeners?: number;
|
|
5
|
+
captureRejections?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare class EventEmitter<Events extends Record<string, any> = Record<string, any>> {
|
|
8
|
+
private events;
|
|
9
|
+
private maxListeners;
|
|
10
|
+
private captureRejections;
|
|
11
|
+
constructor(options?: EventEmitterOptions);
|
|
12
|
+
on<K extends keyof Events>(event: K, listener: EventListener<Events[K]>): EventUnsubscribe;
|
|
13
|
+
once<K extends keyof Events>(event: K, listener: EventListener<Events[K]>): EventUnsubscribe;
|
|
14
|
+
emit<K extends keyof Events>(event: K, ...args: Events[K] extends void ? [] : [Events[K]]): boolean;
|
|
15
|
+
off<K extends keyof Events>(event: K, listener?: EventListener<Events[K]>): void;
|
|
16
|
+
removeAllListeners(event?: keyof Events): void;
|
|
17
|
+
listenerCount(event: keyof Events): number;
|
|
18
|
+
eventNames(): (keyof Events)[];
|
|
19
|
+
setMaxListeners(n: number): void;
|
|
20
|
+
getMaxListeners(): number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface PluginContext {
|
|
24
|
+
inspector: any;
|
|
25
|
+
storage: any;
|
|
26
|
+
events: EventEmitter<any>;
|
|
27
|
+
config: any;
|
|
28
|
+
}
|
|
29
|
+
interface Plugin {
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
install(context: PluginContext): void | Promise<void>;
|
|
34
|
+
uninstall?(): void | Promise<void>;
|
|
35
|
+
enable?(): void;
|
|
36
|
+
disable?(): void;
|
|
37
|
+
}
|
|
38
|
+
interface PluginMetadata {
|
|
39
|
+
name: string;
|
|
40
|
+
version: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
author?: string;
|
|
43
|
+
homepage?: string;
|
|
44
|
+
dependencies?: Record<string, string>;
|
|
45
|
+
}
|
|
46
|
+
declare class PluginSystem {
|
|
47
|
+
private plugins;
|
|
48
|
+
private activePlugins;
|
|
49
|
+
private context;
|
|
50
|
+
private installingPlugins;
|
|
51
|
+
constructor(context: PluginContext);
|
|
52
|
+
register(plugin: Plugin): Promise<void>;
|
|
53
|
+
unregister(pluginName: string): Promise<void>;
|
|
54
|
+
enable(pluginName: string): void;
|
|
55
|
+
disable(pluginName: string): void;
|
|
56
|
+
get(pluginName: string): Plugin | undefined;
|
|
57
|
+
has(pluginName: string): boolean;
|
|
58
|
+
isActive(pluginName: string): boolean;
|
|
59
|
+
getAll(): Plugin[];
|
|
60
|
+
getActive(): Plugin[];
|
|
61
|
+
getMetadata(pluginName: string): PluginMetadata | undefined;
|
|
62
|
+
getAllMetadata(): PluginMetadata[];
|
|
63
|
+
}
|
|
64
|
+
declare abstract class BasePlugin implements Plugin {
|
|
65
|
+
abstract name: string;
|
|
66
|
+
abstract version: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
protected context?: PluginContext;
|
|
69
|
+
install(context: PluginContext): Promise<void>;
|
|
70
|
+
uninstall(): Promise<void>;
|
|
71
|
+
enable(): void;
|
|
72
|
+
disable(): void;
|
|
73
|
+
protected abstract onInstall(): void | Promise<void>;
|
|
74
|
+
protected onUninstall(): void | Promise<void>;
|
|
75
|
+
protected onEnable(): void;
|
|
76
|
+
protected onDisable(): void;
|
|
77
|
+
protected get inspector(): any;
|
|
78
|
+
protected get events(): EventEmitter;
|
|
79
|
+
protected get storage(): any;
|
|
80
|
+
protected get config(): any;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type InspectorPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
84
|
+
type InspectorTheme = 'dark' | 'light' | 'auto';
|
|
85
|
+
/** A performance problem reported through `onPerformanceIssue`. */
|
|
86
|
+
interface PerformanceIssue {
|
|
87
|
+
/** `'slow-network'` from the default inspector; the legacy inspector also reports e.g. `'low-fps'`, `'long-task'`. */
|
|
88
|
+
type: string;
|
|
89
|
+
message?: string;
|
|
90
|
+
url?: string;
|
|
91
|
+
duration?: number;
|
|
92
|
+
[detail: string]: unknown;
|
|
93
|
+
}
|
|
94
|
+
/** Options accepted by `DevInspector` (and by the legacy `OriginalDevInspector`). */
|
|
95
|
+
interface DevInspectorConfig {
|
|
96
|
+
/**
|
|
97
|
+
* Turn the inspector on or off. When off, nothing is patched and no UI is
|
|
98
|
+
* created. Defaults to `process.env.NODE_ENV !== 'production'`.
|
|
99
|
+
*/
|
|
100
|
+
enabled?: boolean;
|
|
101
|
+
position?: InspectorPosition;
|
|
102
|
+
theme?: InspectorTheme;
|
|
103
|
+
/** Key combinations such as `'ctrl+shift+d'`; an empty string disables one. */
|
|
104
|
+
hotkeys?: {
|
|
105
|
+
toggle?: string;
|
|
106
|
+
minimize?: string;
|
|
107
|
+
};
|
|
108
|
+
features?: {
|
|
109
|
+
network?: boolean;
|
|
110
|
+
console?: boolean;
|
|
111
|
+
performance?: boolean;
|
|
112
|
+
errors?: boolean;
|
|
113
|
+
/** Not implemented yet; accepted for forward compatibility. */
|
|
114
|
+
state?: boolean;
|
|
115
|
+
/** Not implemented yet; accepted for forward compatibility. */
|
|
116
|
+
dom?: boolean;
|
|
117
|
+
/** Not implemented yet; accepted for forward compatibility. */
|
|
118
|
+
storage?: boolean;
|
|
119
|
+
};
|
|
120
|
+
plugins?: Plugin[];
|
|
121
|
+
/** Maximum network entries kept in memory (default 1000). */
|
|
122
|
+
maxNetworkEntries?: number;
|
|
123
|
+
/** Maximum console entries kept in memory (default 500). */
|
|
124
|
+
maxConsoleEntries?: number;
|
|
125
|
+
/** Maximum error entries kept in memory (default 100). */
|
|
126
|
+
maxErrorEntries?: number;
|
|
127
|
+
captureStackTraces?: boolean;
|
|
128
|
+
networkFilters?: {
|
|
129
|
+
/** Hide requests for static assets (scripts, styles, images, fonts) in the list. */
|
|
130
|
+
hideAssets?: boolean;
|
|
131
|
+
/** Accepted but not implemented by the default inspector. */
|
|
132
|
+
hideCached?: boolean;
|
|
133
|
+
};
|
|
134
|
+
/** Requests slower than this many milliseconds are reported as performance issues (default 3000). */
|
|
135
|
+
slowRequestThreshold?: number;
|
|
136
|
+
/** Called with errors captured from the page (uncaught errors and unhandled rejections). */
|
|
137
|
+
onError?: (error: Error) => void;
|
|
138
|
+
onPerformanceIssue?: (issue: PerformanceIssue) => void;
|
|
139
|
+
/** Legacy option, unused. */
|
|
140
|
+
workerUrl?: string;
|
|
141
|
+
/** Legacy option, unused. */
|
|
142
|
+
remoteConfig?: unknown;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* DevInspector - the default inspector: floating widget plus a panel with
|
|
147
|
+
* Network, Console, Performance and Errors tabs.
|
|
148
|
+
*
|
|
149
|
+
* Everything it patches (window.fetch, XMLHttpRequest.prototype.open/send,
|
|
150
|
+
* console methods) is restored by destroy(). Captured data is kept in bounded
|
|
151
|
+
* buffers and every captured value is HTML-escaped before it is rendered.
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
interface InspectorNetworkEntry {
|
|
155
|
+
id: string;
|
|
156
|
+
type: 'fetch' | 'xhr';
|
|
157
|
+
url: string;
|
|
158
|
+
method: string;
|
|
159
|
+
/** HTTP status, `'pending'` while in flight, or `'error'` when the request failed. */
|
|
160
|
+
status: number | 'pending' | 'error';
|
|
161
|
+
/** Epoch milliseconds when the request started. */
|
|
162
|
+
timestamp: number;
|
|
163
|
+
duration?: number;
|
|
164
|
+
error?: string;
|
|
165
|
+
}
|
|
166
|
+
interface InspectorConsoleEntry {
|
|
167
|
+
id: string;
|
|
168
|
+
level: ConsoleMethod;
|
|
169
|
+
message: string;
|
|
170
|
+
timestamp: number;
|
|
171
|
+
}
|
|
172
|
+
interface InspectorErrorEntry {
|
|
173
|
+
id: string;
|
|
174
|
+
type: 'JavaScript Error' | 'Promise Rejection';
|
|
175
|
+
message: string;
|
|
176
|
+
timestamp: number;
|
|
177
|
+
stack?: string;
|
|
178
|
+
filename?: string;
|
|
179
|
+
lineno?: number;
|
|
180
|
+
colno?: number;
|
|
181
|
+
}
|
|
182
|
+
interface InspectorMetricEntry {
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
/** Present for `track()` calls. */
|
|
186
|
+
data?: unknown;
|
|
187
|
+
/** Present for `markStart()`/`markEnd()` measurements. */
|
|
188
|
+
duration?: number;
|
|
189
|
+
timestamp: number;
|
|
190
|
+
}
|
|
191
|
+
interface InspectorExport {
|
|
192
|
+
version: string;
|
|
193
|
+
timestamp: number;
|
|
194
|
+
data: {
|
|
195
|
+
network: InspectorNetworkEntry[];
|
|
196
|
+
console: InspectorConsoleEntry[];
|
|
197
|
+
errors: InspectorErrorEntry[];
|
|
198
|
+
metrics: InspectorMetricEntry[];
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
interface DevInspectorEvents {
|
|
202
|
+
'inspector:ready': void;
|
|
203
|
+
'inspector:show': void;
|
|
204
|
+
'inspector:hide': void;
|
|
205
|
+
'inspector:minimize': boolean;
|
|
206
|
+
'inspector:destroy': void;
|
|
207
|
+
'network:request': InspectorNetworkEntry;
|
|
208
|
+
'network:response': InspectorNetworkEntry;
|
|
209
|
+
'network:error': InspectorNetworkEntry;
|
|
210
|
+
'console:log': InspectorConsoleEntry;
|
|
211
|
+
'error:uncaught': InspectorErrorEntry;
|
|
212
|
+
'performance:metric': InspectorMetricEntry;
|
|
213
|
+
'performance:mark': InspectorMetricEntry;
|
|
214
|
+
'performance:issue': PerformanceIssue;
|
|
215
|
+
'plugin:registered': {
|
|
216
|
+
name: string;
|
|
217
|
+
version: string;
|
|
218
|
+
};
|
|
219
|
+
'plugin:unregistered': {
|
|
220
|
+
name: string;
|
|
221
|
+
};
|
|
222
|
+
'plugin:enabled': {
|
|
223
|
+
name: string;
|
|
224
|
+
};
|
|
225
|
+
'plugin:disabled': {
|
|
226
|
+
name: string;
|
|
227
|
+
};
|
|
228
|
+
[event: string]: unknown;
|
|
229
|
+
}
|
|
230
|
+
type ConsoleMethod = 'log' | 'info' | 'warn' | 'error' | 'debug';
|
|
231
|
+
declare class EnhancedDevInspector {
|
|
232
|
+
private static instances;
|
|
233
|
+
private readonly config;
|
|
234
|
+
private readonly events;
|
|
235
|
+
private readonly pluginSystem;
|
|
236
|
+
private readonly active;
|
|
237
|
+
private network;
|
|
238
|
+
private consoleEntries;
|
|
239
|
+
private errors;
|
|
240
|
+
private metrics;
|
|
241
|
+
private performanceStats;
|
|
242
|
+
private isRecording;
|
|
243
|
+
private isVisible;
|
|
244
|
+
private isMinimized;
|
|
245
|
+
private destroyed;
|
|
246
|
+
private capturing;
|
|
247
|
+
private renderQueued;
|
|
248
|
+
private activeTab;
|
|
249
|
+
private selectedRequestId;
|
|
250
|
+
private widget;
|
|
251
|
+
private panel;
|
|
252
|
+
private patches;
|
|
253
|
+
private cleanups;
|
|
254
|
+
private rafId;
|
|
255
|
+
private readonly marks;
|
|
256
|
+
private readonly xhrState;
|
|
257
|
+
constructor(config?: DevInspectorConfig);
|
|
258
|
+
/** The most recently created inspector that is still alive, if any. */
|
|
259
|
+
static getInstance(): EnhancedDevInspector | null;
|
|
260
|
+
private static resolveConfig;
|
|
261
|
+
/** True when the inspector is running (enabled, in a browser, not destroyed). */
|
|
262
|
+
get isEnabled(): boolean;
|
|
263
|
+
show(): void;
|
|
264
|
+
hide(): void;
|
|
265
|
+
toggle(): void;
|
|
266
|
+
/** Collapses the panel to its header (or expands it again). */
|
|
267
|
+
minimize(): void;
|
|
268
|
+
clear(type?: 'network' | 'console' | 'errors' | 'metrics' | 'all'): void;
|
|
269
|
+
/** Pauses or resumes capturing. Patched APIs keep working either way. */
|
|
270
|
+
toggleRecording(): boolean;
|
|
271
|
+
get recording(): boolean;
|
|
272
|
+
/** Returns a copy of the captured entries, newest first. */
|
|
273
|
+
getEntries(type: 'network'): InspectorNetworkEntry[];
|
|
274
|
+
getEntries(type: 'console'): InspectorConsoleEntry[];
|
|
275
|
+
getEntries(type: 'errors'): InspectorErrorEntry[];
|
|
276
|
+
getEntries(type: 'metrics'): InspectorMetricEntry[];
|
|
277
|
+
/** Records a custom metric and emits `performance:metric`. */
|
|
278
|
+
track(name: string, data?: unknown): void;
|
|
279
|
+
markStart(name: string): void;
|
|
280
|
+
/** Ends a measurement started with markStart() and returns its duration in ms. */
|
|
281
|
+
markEnd(name: string): number | undefined;
|
|
282
|
+
/** Installs a plugin. Resolves once the plugin's install() has finished. */
|
|
283
|
+
use(plugin: Plugin): Promise<void>;
|
|
284
|
+
on<K extends keyof DevInspectorEvents & string>(event: K, listener: (data: DevInspectorEvents[K]) => void): () => void;
|
|
285
|
+
once<K extends keyof DevInspectorEvents & string>(event: K, listener: (data: DevInspectorEvents[K]) => void): () => void;
|
|
286
|
+
off<K extends keyof DevInspectorEvents & string>(event: K, listener?: (data: DevInspectorEvents[K]) => void): void;
|
|
287
|
+
/** Serialisable snapshot of everything captured so far. */
|
|
288
|
+
export(): InspectorExport;
|
|
289
|
+
/**
|
|
290
|
+
* Loads a snapshot produced by export(), replacing the current data. Entries
|
|
291
|
+
* are validated field by field and trimmed to the configured limits.
|
|
292
|
+
*/
|
|
293
|
+
import(snapshot: unknown): void;
|
|
294
|
+
/**
|
|
295
|
+
* Removes the UI, restores every patched API, detaches listeners, stops the
|
|
296
|
+
* frame loop and uninstalls plugins. Safe to call more than once.
|
|
297
|
+
*/
|
|
298
|
+
destroy(): void;
|
|
299
|
+
private get capturingAllowed();
|
|
300
|
+
/** Runs capture code with re-entrancy protection; capture failures never reach the page. */
|
|
301
|
+
private capture;
|
|
302
|
+
private emitSafely;
|
|
303
|
+
private pushBounded;
|
|
304
|
+
private patch;
|
|
305
|
+
private listen;
|
|
306
|
+
private addNetworkEntry;
|
|
307
|
+
private finishNetworkEntry;
|
|
308
|
+
private interceptFetch;
|
|
309
|
+
private interceptXHR;
|
|
310
|
+
private trackXhr;
|
|
311
|
+
private interceptConsole;
|
|
312
|
+
private interceptErrors;
|
|
313
|
+
private setupHotkeys;
|
|
314
|
+
/** Calls a user callback; a throwing callback is reported but never breaks capture. */
|
|
315
|
+
private callUser;
|
|
316
|
+
private reportInternal;
|
|
317
|
+
private startPerformanceLoop;
|
|
318
|
+
private stopPerformanceLoop;
|
|
319
|
+
private mountWhenReady;
|
|
320
|
+
private get colors();
|
|
321
|
+
private placement;
|
|
322
|
+
private mount;
|
|
323
|
+
private handlePanelClick;
|
|
324
|
+
/** Coalesces renders triggered by bursts of captured events into one microtask. */
|
|
325
|
+
private scheduleRender;
|
|
326
|
+
private render;
|
|
327
|
+
private toolbar;
|
|
328
|
+
private empty;
|
|
329
|
+
private renderNetwork;
|
|
330
|
+
private renderConsole;
|
|
331
|
+
private renderPerformance;
|
|
332
|
+
private renderErrors;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** Package version, kept in sync with package.json (checked by tests). */
|
|
336
|
+
declare const VERSION = "1.3.0";
|
|
337
|
+
|
|
338
|
+
interface StorageEntry<T> {
|
|
339
|
+
id: string;
|
|
340
|
+
timestamp: number;
|
|
341
|
+
data: T;
|
|
342
|
+
}
|
|
343
|
+
interface StorageOptions {
|
|
344
|
+
maxSize: number;
|
|
345
|
+
ttl?: number;
|
|
346
|
+
onEvict?: (entry: StorageEntry<any>) => void;
|
|
347
|
+
}
|
|
348
|
+
declare class CircularStorage<T> {
|
|
349
|
+
private buffer;
|
|
350
|
+
private head;
|
|
351
|
+
private tail;
|
|
352
|
+
private size;
|
|
353
|
+
private maxSize;
|
|
354
|
+
private ttl?;
|
|
355
|
+
private onEvict?;
|
|
356
|
+
private idCounter;
|
|
357
|
+
constructor(options: StorageOptions);
|
|
358
|
+
push(data: T): string;
|
|
359
|
+
get(id: string): T | undefined;
|
|
360
|
+
getAll(): T[];
|
|
361
|
+
getAllEntries(): StorageEntry<T>[];
|
|
362
|
+
find(predicate: (data: T) => boolean): T | undefined;
|
|
363
|
+
filter(predicate: (data: T) => boolean): T[];
|
|
364
|
+
clear(): void;
|
|
365
|
+
getSize(): number;
|
|
366
|
+
isFull(): boolean;
|
|
367
|
+
private findEntry;
|
|
368
|
+
private isExpired;
|
|
369
|
+
removeExpired(): number;
|
|
370
|
+
}
|
|
371
|
+
declare class IndexedStorage<T> {
|
|
372
|
+
private storage;
|
|
373
|
+
private maxSize;
|
|
374
|
+
private ttl?;
|
|
375
|
+
private onEvict?;
|
|
376
|
+
private accessOrder;
|
|
377
|
+
constructor(options: StorageOptions);
|
|
378
|
+
set(key: string, data: T): void;
|
|
379
|
+
get(key: string): T | undefined;
|
|
380
|
+
has(key: string): boolean;
|
|
381
|
+
delete(key: string): boolean;
|
|
382
|
+
clear(): void;
|
|
383
|
+
getSize(): number;
|
|
384
|
+
getAllKeys(): string[];
|
|
385
|
+
getAllValues(): T[];
|
|
386
|
+
private updateAccessOrder;
|
|
387
|
+
private isExpired;
|
|
388
|
+
removeExpired(): number;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
interface InspectorEvents {
|
|
392
|
+
'inspector:ready': void;
|
|
393
|
+
'inspector:show': void;
|
|
394
|
+
'inspector:hide': void;
|
|
395
|
+
'inspector:minimize': void;
|
|
396
|
+
'inspector:destroy': void;
|
|
397
|
+
'network:request': any;
|
|
398
|
+
'network:response': any;
|
|
399
|
+
'network:error': any;
|
|
400
|
+
'network:progress': any;
|
|
401
|
+
'network:websocket:connection': any;
|
|
402
|
+
'network:websocket:message': any;
|
|
403
|
+
'network:websocket:status': any;
|
|
404
|
+
'network:websocket:error': any;
|
|
405
|
+
'network:evict': any;
|
|
406
|
+
'console:log': any;
|
|
407
|
+
'console:clear': void;
|
|
408
|
+
'console:execute': string;
|
|
409
|
+
'console:evict': any;
|
|
410
|
+
'performance:metric': any;
|
|
411
|
+
'performance:data': any;
|
|
412
|
+
'performance:metrics': any;
|
|
413
|
+
'performance:longtask': any;
|
|
414
|
+
'performance:navigation': any;
|
|
415
|
+
'performance:mark': any;
|
|
416
|
+
'error:caught': any;
|
|
417
|
+
'error:uncaught': any;
|
|
418
|
+
'error:evict': any;
|
|
419
|
+
'state:change': any;
|
|
420
|
+
'dom:mutation': any;
|
|
421
|
+
'storage:change': any;
|
|
422
|
+
'plugin:registered': {
|
|
423
|
+
name: string;
|
|
424
|
+
version: string;
|
|
425
|
+
};
|
|
426
|
+
'plugin:unregistered': {
|
|
427
|
+
name: string;
|
|
428
|
+
};
|
|
429
|
+
'plugin:enabled': {
|
|
430
|
+
name: string;
|
|
431
|
+
};
|
|
432
|
+
'plugin:disabled': {
|
|
433
|
+
name: string;
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* @deprecated The original, asynchronously initialised inspector. It is kept for
|
|
438
|
+
* backwards compatibility; use the default export (`DevInspector`) instead.
|
|
439
|
+
*/
|
|
440
|
+
declare class DevInspector {
|
|
441
|
+
private static instance;
|
|
442
|
+
private config;
|
|
443
|
+
private events;
|
|
444
|
+
private pluginSystem;
|
|
445
|
+
private networkStorage;
|
|
446
|
+
private consoleStorage;
|
|
447
|
+
private performanceStorage;
|
|
448
|
+
private errorStorage;
|
|
449
|
+
private isVisible;
|
|
450
|
+
private isMinimized;
|
|
451
|
+
private monitors;
|
|
452
|
+
private ui;
|
|
453
|
+
private initialized;
|
|
454
|
+
private cleanupFunctions;
|
|
455
|
+
private initPromise;
|
|
456
|
+
private destroyed;
|
|
457
|
+
constructor(config?: DevInspectorConfig);
|
|
458
|
+
private mergeConfig;
|
|
459
|
+
private init;
|
|
460
|
+
private runInit;
|
|
461
|
+
private loadMonitors;
|
|
462
|
+
private loadUI;
|
|
463
|
+
private registerPlugins;
|
|
464
|
+
private setupHotkeys;
|
|
465
|
+
private setupErrorHandlers;
|
|
466
|
+
private getKeyCombo;
|
|
467
|
+
show(): void;
|
|
468
|
+
hide(): void;
|
|
469
|
+
minimize(): void;
|
|
470
|
+
toggle(): void;
|
|
471
|
+
private teardown;
|
|
472
|
+
destroy(): void;
|
|
473
|
+
track(name: string, data: any): void;
|
|
474
|
+
markStart(name: string): void;
|
|
475
|
+
markEnd(name: string): void;
|
|
476
|
+
use(plugin: any): Promise<void>;
|
|
477
|
+
export(): any;
|
|
478
|
+
import(data: any): void;
|
|
479
|
+
on<K extends keyof InspectorEvents>(event: K, listener: (data: InspectorEvents[K]) => void): () => void;
|
|
480
|
+
off<K extends keyof InspectorEvents>(event: K, listener?: (data: InspectorEvents[K]) => void): void;
|
|
481
|
+
getEvents(): EventEmitter<InspectorEvents>;
|
|
482
|
+
getStorage(type: 'network' | 'console' | 'performance' | 'error'): any;
|
|
483
|
+
getConfig(): Required<DevInspectorConfig>;
|
|
484
|
+
getPluginSystem(): PluginSystem;
|
|
485
|
+
getMonitor(name: string): any;
|
|
486
|
+
static getInstance(): DevInspector | null;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
interface SimpleConfig {
|
|
490
|
+
enabled?: boolean;
|
|
491
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
492
|
+
theme?: 'dark' | 'light';
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* @deprecated A static demo panel that does not monitor anything. Use the
|
|
496
|
+
* default export (`DevInspector`) instead.
|
|
497
|
+
*/
|
|
498
|
+
declare class SimpleDevInspector {
|
|
499
|
+
private config;
|
|
500
|
+
private widget;
|
|
501
|
+
private panel;
|
|
502
|
+
private isVisible;
|
|
503
|
+
private readonly onKeydown;
|
|
504
|
+
constructor(config?: SimpleConfig);
|
|
505
|
+
private init;
|
|
506
|
+
private createWidget;
|
|
507
|
+
private createPanel;
|
|
508
|
+
private setupEventListeners;
|
|
509
|
+
show(): void;
|
|
510
|
+
hide(): void;
|
|
511
|
+
toggle(): void;
|
|
512
|
+
destroy(): void;
|
|
513
|
+
track(name: string, data: any): void;
|
|
514
|
+
markStart(name: string): void;
|
|
515
|
+
markEnd(name: string): void;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
interface NetworkRequest {
|
|
519
|
+
id: string;
|
|
520
|
+
method: string;
|
|
521
|
+
url: string;
|
|
522
|
+
headers: Record<string, string>;
|
|
523
|
+
body?: any;
|
|
524
|
+
timestamp: number;
|
|
525
|
+
type: 'fetch' | 'xhr' | 'beacon' | 'websocket';
|
|
526
|
+
}
|
|
527
|
+
interface NetworkResponse {
|
|
528
|
+
id: string;
|
|
529
|
+
status: number;
|
|
530
|
+
statusText: string;
|
|
531
|
+
headers: Record<string, string>;
|
|
532
|
+
body?: any;
|
|
533
|
+
size: number;
|
|
534
|
+
duration: number;
|
|
535
|
+
timestamp: number;
|
|
536
|
+
fromCache?: boolean;
|
|
537
|
+
}
|
|
538
|
+
interface NetworkError {
|
|
539
|
+
id: string;
|
|
540
|
+
message: string;
|
|
541
|
+
stack?: string;
|
|
542
|
+
timestamp: number;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
type ConsoleLevel = 'log' | 'info' | 'warn' | 'error' | 'debug' | 'trace' | 'table' | 'group' | 'groupCollapsed' | 'groupEnd' | 'clear' | 'count' | 'countReset' | 'time' | 'timeEnd' | 'timeLog' | 'assert' | 'dir' | 'dirxml' | 'profile' | 'profileEnd';
|
|
546
|
+
interface ConsoleEntry {
|
|
547
|
+
id: string;
|
|
548
|
+
level: ConsoleLevel;
|
|
549
|
+
args: any[];
|
|
550
|
+
formattedArgs: any[];
|
|
551
|
+
timestamp: number;
|
|
552
|
+
stack?: string[];
|
|
553
|
+
groupLevel: number;
|
|
554
|
+
source?: {
|
|
555
|
+
file?: string;
|
|
556
|
+
line?: number;
|
|
557
|
+
column?: number;
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
interface WebSocketConnection {
|
|
562
|
+
id: string;
|
|
563
|
+
url: string;
|
|
564
|
+
protocols?: string | string[];
|
|
565
|
+
timestamp: number;
|
|
566
|
+
readyState: number;
|
|
567
|
+
status: 'connecting' | 'open' | 'closing' | 'closed';
|
|
568
|
+
}
|
|
569
|
+
interface WebSocketMessage {
|
|
570
|
+
id: string;
|
|
571
|
+
connectionId: string;
|
|
572
|
+
type: 'sent' | 'received';
|
|
573
|
+
data: any;
|
|
574
|
+
timestamp: number;
|
|
575
|
+
size: number;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* DevInspector - developer debugging panel for web applications.
|
|
580
|
+
*/
|
|
581
|
+
|
|
582
|
+
export { BasePlugin, CircularStorage, type ConsoleEntry, type ConsoleLevel, EnhancedDevInspector as DevInspector, type DevInspectorConfig, type DevInspectorEvents, EnhancedDevInspector, EventEmitter, IndexedStorage, type InspectorConsoleEntry, type InspectorErrorEntry, type InspectorExport, type InspectorMetricEntry, type InspectorNetworkEntry, type InspectorPosition, type InspectorTheme, type NetworkError, type NetworkRequest, type NetworkResponse, DevInspector as OriginalDevInspector, type PerformanceIssue, type Plugin, type PluginContext, SimpleDevInspector, VERSION, type WebSocketConnection, type WebSocketMessage, EnhancedDevInspector as default };
|