dev-inspector 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 +101 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +14 -0
- package/lib/init.d.ts +24 -0
- package/lib/init.js +51 -0
- package/lib/logger/consoleLogger.d.ts +10 -0
- package/lib/logger/consoleLogger.js +75 -0
- package/lib/logger/networkLogger.d.ts +11 -0
- package/lib/logger/networkLogger.js +210 -0
- package/lib/storage/logStorage.d.ts +19 -0
- package/lib/storage/logStorage.js +61 -0
- package/lib/ui/logList.d.ts +7 -0
- package/lib/ui/logList.js +74 -0
- package/lib/ui/panel.d.ts +15 -0
- package/lib/ui/panel.js +342 -0
- package/lib/ui/panelStyles.d.ts +1 -0
- package/lib/ui/panelStyles.js +282 -0
- package/lib/utils/types.d.ts +23 -0
- package/lib/utils/types.js +2 -0
- package/package.json +55 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PANEL_CSS = void 0;
|
|
4
|
+
exports.PANEL_CSS = `
|
|
5
|
+
.di-root, .di-root * {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.di-toggle {
|
|
10
|
+
position: fixed;
|
|
11
|
+
right: 12px;
|
|
12
|
+
bottom: 12px;
|
|
13
|
+
z-index: 2147483647;
|
|
14
|
+
border: 1px solid rgba(255,255,255,0.18);
|
|
15
|
+
background: rgba(20,20,20,0.92);
|
|
16
|
+
color: #fff;
|
|
17
|
+
font: 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
18
|
+
padding: 8px 10px;
|
|
19
|
+
border-radius: 10px;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
backdrop-filter: blur(8px);
|
|
22
|
+
box-shadow: 0 10px 30px rgba(0,0,0,0.35);
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 10px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.di-toggleTitle {
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.di-toggleMeta {
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 8px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.di-toggleBadge {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 6px;
|
|
42
|
+
padding: 4px 8px;
|
|
43
|
+
border-radius: 999px;
|
|
44
|
+
border: 1px solid rgba(255,255,255,0.16);
|
|
45
|
+
background: rgba(0,0,0,0.28);
|
|
46
|
+
font-size: 11px;
|
|
47
|
+
line-height: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.di-toggleErr {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 4px;
|
|
54
|
+
margin-left: 2px;
|
|
55
|
+
padding: 2px 6px;
|
|
56
|
+
border-radius: 999px;
|
|
57
|
+
background: rgba(239, 68, 68, 0.95);
|
|
58
|
+
color: #fff;
|
|
59
|
+
font-size: 11px;
|
|
60
|
+
line-height: 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.di-toggleErrIcon {
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
transform: translateY(-0.5px);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.di-toggleIcon {
|
|
69
|
+
width: 14px;
|
|
70
|
+
height: 14px;
|
|
71
|
+
display: inline-block;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.di-panel {
|
|
75
|
+
position: fixed;
|
|
76
|
+
right: 12px;
|
|
77
|
+
bottom: 56px;
|
|
78
|
+
width: min(520px, calc(100vw - 24px));
|
|
79
|
+
height: min(380px, calc(100vh - 84px));
|
|
80
|
+
z-index: 2147483647;
|
|
81
|
+
border: 1px solid rgba(255,255,255,0.14);
|
|
82
|
+
background: rgba(16,16,16,0.92);
|
|
83
|
+
color: #eaeaea;
|
|
84
|
+
border-radius: 12px;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
display: grid;
|
|
87
|
+
grid-template-rows: auto 1fr;
|
|
88
|
+
backdrop-filter: blur(8px);
|
|
89
|
+
box-shadow: 0 10px 30px rgba(0,0,0,0.45);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.di-resizeHandle {
|
|
93
|
+
width: 18px;
|
|
94
|
+
height: 18px;
|
|
95
|
+
flex: 0 0 18px;
|
|
96
|
+
border-radius: 8px;
|
|
97
|
+
cursor: nwse-resize;
|
|
98
|
+
touch-action: none;
|
|
99
|
+
opacity: 0.9;
|
|
100
|
+
border: 1px solid rgba(255,255,255,0.14);
|
|
101
|
+
background: rgba(255,255,255,0.06);
|
|
102
|
+
position: relative;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.di-resizeHandle::before {
|
|
106
|
+
content: "";
|
|
107
|
+
position: absolute;
|
|
108
|
+
inset: 4px;
|
|
109
|
+
border-radius: 6px;
|
|
110
|
+
background:
|
|
111
|
+
linear-gradient(135deg, rgba(255,255,255,0.65) 0 2px, transparent 0) 0 0 / 6px 6px,
|
|
112
|
+
linear-gradient(135deg, rgba(255,255,255,0.35) 0 2px, transparent 0) 3px 3px / 6px 6px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.di-resizeHandle:hover {
|
|
116
|
+
opacity: 1;
|
|
117
|
+
border-color: rgba(255,255,255,0.24);
|
|
118
|
+
background: rgba(255,255,255,0.10);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.di-hidden {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.di-header {
|
|
126
|
+
display: grid;
|
|
127
|
+
gap: 8px;
|
|
128
|
+
padding: 10px 12px;
|
|
129
|
+
border-bottom: 1px solid rgba(255,255,255,0.12);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.di-headerRow {
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
justify-content: space-between;
|
|
136
|
+
gap: 8px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.di-title {
|
|
140
|
+
font: 600 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
141
|
+
opacity: 0.95;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.di-actions {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 8px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.di-btn {
|
|
151
|
+
border: 1px solid rgba(255,255,255,0.14);
|
|
152
|
+
background: rgba(255,255,255,0.06);
|
|
153
|
+
color: #fff;
|
|
154
|
+
font: 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
155
|
+
padding: 6px 8px;
|
|
156
|
+
border-radius: 10px;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.di-tabs {
|
|
161
|
+
display: flex;
|
|
162
|
+
gap: 8px;
|
|
163
|
+
flex-wrap: wrap;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.di-tab {
|
|
167
|
+
display: inline-flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
gap: 8px;
|
|
170
|
+
border: 1px solid rgba(255,255,255,0.14);
|
|
171
|
+
background: rgba(255,255,255,0.06);
|
|
172
|
+
color: #fff;
|
|
173
|
+
padding: 6px 10px;
|
|
174
|
+
border-radius: 999px;
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
font: 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
177
|
+
opacity: 0.9;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.di-tab:hover {
|
|
181
|
+
background: rgba(255,255,255,0.10);
|
|
182
|
+
border-color: rgba(255,255,255,0.22);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.di-tabActive {
|
|
186
|
+
opacity: 1;
|
|
187
|
+
background: rgba(255,255,255,0.14);
|
|
188
|
+
border-color: rgba(255,255,255,0.28);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.di-tabIcon {
|
|
192
|
+
width: 14px;
|
|
193
|
+
height: 14px;
|
|
194
|
+
display: inline-block;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.di-badge {
|
|
198
|
+
display: inline-flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
min-width: 18px;
|
|
202
|
+
height: 18px;
|
|
203
|
+
padding: 0 6px;
|
|
204
|
+
border-radius: 999px;
|
|
205
|
+
border: 1px solid rgba(255,255,255,0.16);
|
|
206
|
+
background: rgba(0,0,0,0.28);
|
|
207
|
+
font-size: 11px;
|
|
208
|
+
line-height: 1;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.di-body {
|
|
212
|
+
overflow: auto;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.di-list {
|
|
216
|
+
margin: 0;
|
|
217
|
+
padding: 8px 10px;
|
|
218
|
+
list-style: none;
|
|
219
|
+
display: grid;
|
|
220
|
+
gap: 6px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.di-item {
|
|
224
|
+
padding: 8px 10px;
|
|
225
|
+
border: 1px solid rgba(255,255,255,0.10);
|
|
226
|
+
border-radius: 10px;
|
|
227
|
+
background: rgba(255,255,255,0.04);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.di-itemToneNeutral {
|
|
231
|
+
border-color: rgba(255,255,255,0.10);
|
|
232
|
+
background: rgba(255,255,255,0.04);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.di-itemToneSuccess {
|
|
236
|
+
border-color: rgba(34, 197, 94, 0.35);
|
|
237
|
+
background: rgba(34, 197, 94, 0.10);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.di-itemToneWarning {
|
|
241
|
+
border-color: rgba(245, 158, 11, 0.42);
|
|
242
|
+
background: rgba(245, 158, 11, 0.12);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.di-itemToneError {
|
|
246
|
+
border-color: rgba(239, 68, 68, 0.45);
|
|
247
|
+
background: rgba(239, 68, 68, 0.12);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.di-meta {
|
|
251
|
+
display: flex;
|
|
252
|
+
gap: 10px;
|
|
253
|
+
font: 11px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
254
|
+
opacity: 0.85;
|
|
255
|
+
margin-bottom: 4px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.di-statusChip {
|
|
259
|
+
display: inline-flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
justify-content: center;
|
|
262
|
+
padding: 2px 8px;
|
|
263
|
+
border-radius: 999px;
|
|
264
|
+
font-size: 11px;
|
|
265
|
+
line-height: 1;
|
|
266
|
+
color: #fff;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.di-statusChipSuccess {
|
|
270
|
+
background: rgba(34, 197, 94, 0.95);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.di-statusChipError {
|
|
274
|
+
background: rgba(239, 68, 68, 0.95);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.di-msg {
|
|
278
|
+
white-space: pre-wrap;
|
|
279
|
+
word-break: break-word;
|
|
280
|
+
font: 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
281
|
+
}
|
|
282
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ConsoleLogLevel = "log" | "info" | "warn" | "error" | "debug";
|
|
2
|
+
export type LogSource = "console" | "network";
|
|
3
|
+
export type ConsoleLogEntry = {
|
|
4
|
+
id: string;
|
|
5
|
+
source: "console";
|
|
6
|
+
level: ConsoleLogLevel;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
args: unknown[];
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
export type NetworkLogEntry = {
|
|
12
|
+
id: string;
|
|
13
|
+
source: "network";
|
|
14
|
+
timestamp: number;
|
|
15
|
+
method?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
status?: number;
|
|
18
|
+
durationMs?: number;
|
|
19
|
+
requestBody?: unknown;
|
|
20
|
+
responseBody?: unknown;
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
export type LogEntry = ConsoleLogEntry | NetworkLogEntry;
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dev-inspector",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "In-page devtools-style logger panel for web apps (console + network).",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
+
"prepare": "husky",
|
|
8
|
+
"lint-staged": "lint-staged",
|
|
9
|
+
"demo": "vite demo --open",
|
|
10
|
+
"build": "tsc -p tsconfig.json",
|
|
11
|
+
"lint": "eslint \"src/**/*.{ts,tsx,js}\"",
|
|
12
|
+
"prepublishOnly": "npm run build"
|
|
13
|
+
},
|
|
14
|
+
"lint-staged": {
|
|
15
|
+
"src/**/*.{ts,tsx,js}": [
|
|
16
|
+
"eslint --fix"
|
|
17
|
+
],
|
|
18
|
+
"*.{css,md}": [
|
|
19
|
+
"prettier --write"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"devtools",
|
|
24
|
+
"logger",
|
|
25
|
+
"console",
|
|
26
|
+
"network",
|
|
27
|
+
"fetch",
|
|
28
|
+
"xhr",
|
|
29
|
+
"debug",
|
|
30
|
+
"panel"
|
|
31
|
+
],
|
|
32
|
+
"author": "Ali Buğatekin",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18"
|
|
36
|
+
},
|
|
37
|
+
"main": "./lib/index.js",
|
|
38
|
+
"types": "./lib/index.d.ts",
|
|
39
|
+
"files": [
|
|
40
|
+
"lib/**/*"
|
|
41
|
+
],
|
|
42
|
+
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@eslint/js": "^9.39.2",
|
|
45
|
+
"eslint": "^9.39.2",
|
|
46
|
+
"eslint-config-prettier": "^10.1.8",
|
|
47
|
+
"globals": "^16.5.0",
|
|
48
|
+
"husky": "^9.1.7",
|
|
49
|
+
"jiti": "^2.6.1",
|
|
50
|
+
"lint-staged": "^16.2.7",
|
|
51
|
+
"prettier": "^3.7.4",
|
|
52
|
+
"typescript-eslint": "^8.50.1",
|
|
53
|
+
"vite": "^7.0.0"
|
|
54
|
+
}
|
|
55
|
+
}
|