@coherent.js/devtools 1.0.0-rc.2 → 1.0.0-rc.4
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/dist/component-visualizer.js +374 -0
- package/dist/component-visualizer.js.map +7 -0
- package/dist/enhanced-errors.js +467 -0
- package/dist/enhanced-errors.js.map +7 -0
- package/dist/hybrid-integration-tools.js +460 -0
- package/dist/hybrid-integration-tools.js.map +7 -0
- package/dist/index.js +1 -2
- package/dist/index.js.map +2 -2
- package/package.json +15 -38
- package/types/index.d.ts +0 -34
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
// src/enhanced-errors.js
|
|
2
|
+
import { isCoherentObject, hasChildren } from "@coherent.js/core";
|
|
3
|
+
var EnhancedErrorHandler = class {
|
|
4
|
+
constructor(options = {}) {
|
|
5
|
+
this.options = {
|
|
6
|
+
maxContextDepth: options.maxContextDepth || 5,
|
|
7
|
+
includeStackTrace: options.includeStackTrace !== false,
|
|
8
|
+
showSuggestions: options.showSuggestions !== false,
|
|
9
|
+
colorOutput: options.colorOutput !== false,
|
|
10
|
+
...options
|
|
11
|
+
};
|
|
12
|
+
this.errorHistory = [];
|
|
13
|
+
this.commonPatterns = this.initializeCommonPatterns();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Handle and enhance an error with component context
|
|
17
|
+
*/
|
|
18
|
+
handleError(error, component = null, context = {}) {
|
|
19
|
+
const enhancedError = {
|
|
20
|
+
originalError: error,
|
|
21
|
+
message: error.message,
|
|
22
|
+
stack: error.stack,
|
|
23
|
+
timestamp: Date.now(),
|
|
24
|
+
component: component ? this.analyzeComponent(component) : null,
|
|
25
|
+
context,
|
|
26
|
+
suggestions: [],
|
|
27
|
+
severity: this.determineSeverity(error),
|
|
28
|
+
category: this.categorizeError(error)
|
|
29
|
+
};
|
|
30
|
+
if (component) {
|
|
31
|
+
enhancedError.componentContext = this.getComponentContext(component, context.path || []);
|
|
32
|
+
enhancedError.propValidation = this.validateProps(component);
|
|
33
|
+
}
|
|
34
|
+
if (this.options.showSuggestions) {
|
|
35
|
+
enhancedError.suggestions = this.generateSuggestions(enhancedError);
|
|
36
|
+
}
|
|
37
|
+
this.errorHistory.push(enhancedError);
|
|
38
|
+
if (this.errorHistory.length > 100) {
|
|
39
|
+
this.errorHistory = this.errorHistory.slice(-100);
|
|
40
|
+
}
|
|
41
|
+
return enhancedError;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Analyze component structure
|
|
45
|
+
*/
|
|
46
|
+
analyzeComponent(component) {
|
|
47
|
+
const analysis = {
|
|
48
|
+
type: this.getComponentType(component),
|
|
49
|
+
isValid: this.isValidComponent(component),
|
|
50
|
+
complexity: this.assessComplexity(component),
|
|
51
|
+
hasDynamicContent: this.hasDynamicContent(component),
|
|
52
|
+
estimatedSize: this.estimateSize(component)
|
|
53
|
+
};
|
|
54
|
+
if (isCoherentObject(component)) {
|
|
55
|
+
const entries = Object.entries(component);
|
|
56
|
+
if (entries.length === 1) {
|
|
57
|
+
const [_tagName, props] = entries;
|
|
58
|
+
analysis.tagName = _tagName;
|
|
59
|
+
analysis.propCount = Object.keys(props).length;
|
|
60
|
+
analysis.hasChildren = hasChildren(props);
|
|
61
|
+
analysis.eventHandlers = this.extractEventHandlers(props);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return analysis;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get component context tree
|
|
68
|
+
*/
|
|
69
|
+
getComponentContext(component, path = []) {
|
|
70
|
+
const context = {
|
|
71
|
+
path: path.join("."),
|
|
72
|
+
depth: path.length,
|
|
73
|
+
component: this.summarizeComponent(component),
|
|
74
|
+
children: []
|
|
75
|
+
};
|
|
76
|
+
if (isCoherentObject(component) && context.depth < this.options.maxContextDepth) {
|
|
77
|
+
const entries = Object.entries(component);
|
|
78
|
+
if (entries.length === 1) {
|
|
79
|
+
const [tagName, props] = entries;
|
|
80
|
+
if (hasChildren(props)) {
|
|
81
|
+
const children = Array.isArray(props.children) ? props.children : [props.children];
|
|
82
|
+
children.forEach((child, index) => {
|
|
83
|
+
if (child && typeof child === "object") {
|
|
84
|
+
const childContext = this.getComponentContext(child, [...path, `${tagName}[${index}]`]);
|
|
85
|
+
context.children.push(childContext);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return context;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validate component props
|
|
95
|
+
*/
|
|
96
|
+
validateProps(component) {
|
|
97
|
+
if (!isCoherentObject(component)) return { valid: true, issues: [] };
|
|
98
|
+
const entries = Object.entries(component);
|
|
99
|
+
if (entries.length !== 1) return { valid: false, issues: ["Component must have exactly one root element"] };
|
|
100
|
+
const [tagName, props] = entries;
|
|
101
|
+
const issues = [];
|
|
102
|
+
const warnings = [];
|
|
103
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
104
|
+
if (value === void 0) {
|
|
105
|
+
issues.push(`Prop '${key}' is undefined`);
|
|
106
|
+
}
|
|
107
|
+
if (value === null && key !== "children" && key !== "text") {
|
|
108
|
+
warnings.push(`Prop '${key}' is null`);
|
|
109
|
+
}
|
|
110
|
+
if (typeof value === "function" && !/^on[A-Z]/.test(key)) {
|
|
111
|
+
warnings.push(`Function prop '${key}' doesn't follow event handler naming convention (onXxx)`);
|
|
112
|
+
}
|
|
113
|
+
if (typeof value === "object" && value !== null) {
|
|
114
|
+
const size = JSON.stringify(value).length;
|
|
115
|
+
if (size > 1e4) {
|
|
116
|
+
warnings.push(`Prop '${key}' is large (${size} bytes) - consider optimizing`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
if (tagName === "img" && !props.src && !props["data-src"]) {
|
|
121
|
+
issues.push("Image element missing required src or data-src prop");
|
|
122
|
+
}
|
|
123
|
+
if (tagName === "a" && !props.href && !props.onclick) {
|
|
124
|
+
warnings.push("Link element missing href or onclick prop");
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
valid: issues.length === 0,
|
|
128
|
+
issues,
|
|
129
|
+
warnings,
|
|
130
|
+
propCount: Object.keys(props).length
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Generate fix suggestions based on error and context
|
|
135
|
+
*/
|
|
136
|
+
generateSuggestions(enhancedError) {
|
|
137
|
+
const suggestions = [];
|
|
138
|
+
const { originalError, component, category } = enhancedError;
|
|
139
|
+
if (component && component.type === "element") {
|
|
140
|
+
if (component.hasDynamicContent && category === "performance") {
|
|
141
|
+
suggestions.push({
|
|
142
|
+
type: "optimization",
|
|
143
|
+
message: "Consider making this component static for better caching",
|
|
144
|
+
code: "Remove functions from props to enable static optimization"
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (component.complexity > 10) {
|
|
148
|
+
suggestions.push({
|
|
149
|
+
type: "structure",
|
|
150
|
+
message: "Component is complex - consider breaking it into smaller components",
|
|
151
|
+
code: "Split complex components into reusable functional components"
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (originalError && originalError.message && originalError.message.includes("undefined")) {
|
|
156
|
+
suggestions.push({
|
|
157
|
+
type: "fix",
|
|
158
|
+
message: "Check for undefined props or missing data",
|
|
159
|
+
code: "Add prop validation: if (!props.required) return null;"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
if (originalError && originalError.message && originalError.message.includes("Maximum render depth")) {
|
|
163
|
+
suggestions.push({
|
|
164
|
+
type: "fix",
|
|
165
|
+
message: "Possible infinite recursion detected",
|
|
166
|
+
code: "Check for circular references in component props"
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
this.commonPatterns.forEach((pattern) => {
|
|
170
|
+
if (originalError && originalError.message && pattern.matcher.test(originalError.message)) {
|
|
171
|
+
suggestions.push(pattern.suggestion);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
return suggestions;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Format enhanced error for display
|
|
178
|
+
*/
|
|
179
|
+
formatError(enhancedError) {
|
|
180
|
+
const lines = [];
|
|
181
|
+
if (this.options.colorOutput) {
|
|
182
|
+
lines.push(this.colorize("\u274C Coherent.js Error", "red"));
|
|
183
|
+
lines.push(this.colorize("\u2500".repeat(40), "red"));
|
|
184
|
+
} else {
|
|
185
|
+
lines.push("\u274C Coherent.js Error");
|
|
186
|
+
lines.push("\u2500".repeat(40));
|
|
187
|
+
}
|
|
188
|
+
lines.push(`Message: ${enhancedError.message}`);
|
|
189
|
+
lines.push(`Category: ${enhancedError.category} (${enhancedError.severity})`);
|
|
190
|
+
lines.push(`Time: ${new Date(enhancedError.timestamp).toLocaleTimeString()}`);
|
|
191
|
+
lines.push("");
|
|
192
|
+
if (enhancedError.componentContext) {
|
|
193
|
+
lines.push("\u{1F3D7}\uFE0F Component Context");
|
|
194
|
+
lines.push("\u2500".repeat(20));
|
|
195
|
+
lines.push(`Path: ${enhancedError.componentContext.path}`);
|
|
196
|
+
lines.push(`Type: ${enhancedError.component.type}`);
|
|
197
|
+
lines.push(`Depth: ${enhancedError.componentContext.depth}`);
|
|
198
|
+
if (enhancedError.componentContext.component) {
|
|
199
|
+
lines.push(`Summary: ${enhancedError.componentContext.component}`);
|
|
200
|
+
}
|
|
201
|
+
lines.push("");
|
|
202
|
+
}
|
|
203
|
+
if (enhancedError.propValidation) {
|
|
204
|
+
const validation = enhancedError.propValidation;
|
|
205
|
+
lines.push("\u{1F4DD} Prop Validation");
|
|
206
|
+
lines.push("\u2500".repeat(18));
|
|
207
|
+
lines.push(`Valid: ${validation.valid ? "\u2705" : "\u274C"}`);
|
|
208
|
+
lines.push(`Props: ${validation.propCount}`);
|
|
209
|
+
if (validation.issues.length > 0) {
|
|
210
|
+
lines.push("Issues:");
|
|
211
|
+
validation.issues.forEach((issue) => {
|
|
212
|
+
lines.push(` \u274C ${issue}`);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (validation.warnings.length > 0) {
|
|
216
|
+
lines.push("Warnings:");
|
|
217
|
+
validation.warnings.forEach((warning) => {
|
|
218
|
+
lines.push(` \u26A0\uFE0F ${warning}`);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
lines.push("");
|
|
222
|
+
}
|
|
223
|
+
if (enhancedError.suggestions.length > 0) {
|
|
224
|
+
lines.push("\u{1F4A1} Suggestions");
|
|
225
|
+
lines.push("\u2500".repeat(13));
|
|
226
|
+
enhancedError.suggestions.forEach((suggestion, index) => {
|
|
227
|
+
const icon = suggestion.type === "fix" ? "\u{1F527}" : suggestion.type === "optimization" ? "\u26A1" : suggestion.type === "structure" ? "\u{1F3D7}\uFE0F" : "\u{1F4A1}";
|
|
228
|
+
lines.push(`${index + 1}. ${icon} ${suggestion.message}`);
|
|
229
|
+
if (suggestion.code) {
|
|
230
|
+
lines.push(` Code: ${suggestion.code}`);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
lines.push("");
|
|
234
|
+
}
|
|
235
|
+
if (this.options.includeStackTrace && enhancedError.stack) {
|
|
236
|
+
lines.push("\u{1F4DA} Stack Trace");
|
|
237
|
+
lines.push("\u2500".repeat(15));
|
|
238
|
+
lines.push(enhancedError.stack.split("\n").slice(0, 10).join("\n"));
|
|
239
|
+
if (enhancedError.stack.split("\n").length > 10) {
|
|
240
|
+
lines.push("... (truncated)");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return lines.join("\n");
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get component type
|
|
247
|
+
*/
|
|
248
|
+
getComponentType(component) {
|
|
249
|
+
if (component === null || component === void 0) return "empty";
|
|
250
|
+
if (typeof component === "string") return "text";
|
|
251
|
+
if (typeof component === "number") return "number";
|
|
252
|
+
if (typeof component === "boolean") return "boolean";
|
|
253
|
+
if (typeof component === "function") return "function";
|
|
254
|
+
if (Array.isArray(component)) return "array";
|
|
255
|
+
if (isCoherentObject(component)) return "element";
|
|
256
|
+
return "object";
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Check if component is valid
|
|
260
|
+
*/
|
|
261
|
+
isValidComponent(component) {
|
|
262
|
+
try {
|
|
263
|
+
if (component === null || component === void 0) return true;
|
|
264
|
+
if (typeof component === "string" || typeof component === "number") return true;
|
|
265
|
+
if (typeof component === "function") return true;
|
|
266
|
+
if (Array.isArray(component)) return component.every((child) => this.isValidComponent(child));
|
|
267
|
+
if (isCoherentObject(component)) {
|
|
268
|
+
const entries = Object.entries(component);
|
|
269
|
+
return entries.length === 1;
|
|
270
|
+
}
|
|
271
|
+
return false;
|
|
272
|
+
} catch {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Assess component complexity
|
|
278
|
+
*/
|
|
279
|
+
assessComplexity(component) {
|
|
280
|
+
let complexity = 0;
|
|
281
|
+
if (typeof component === "object" && component !== null) {
|
|
282
|
+
if (isCoherentObject(component)) {
|
|
283
|
+
const entries = Object.entries(component);
|
|
284
|
+
if (entries.length === 1) {
|
|
285
|
+
const [_tagName, props] = entries;
|
|
286
|
+
complexity += Object.keys(props).length;
|
|
287
|
+
if (hasChildren(props)) {
|
|
288
|
+
const children = Array.isArray(props.children) ? props.children : [props.children];
|
|
289
|
+
children.forEach((child) => {
|
|
290
|
+
complexity += this.assessComplexity(child);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
} else {
|
|
295
|
+
complexity += Object.keys(component).length;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return complexity;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Check if component has dynamic content
|
|
302
|
+
*/
|
|
303
|
+
hasDynamicContent(component) {
|
|
304
|
+
if (typeof component === "function") return true;
|
|
305
|
+
if (typeof component === "object" && component !== null) {
|
|
306
|
+
for (const value of Object.values(component)) {
|
|
307
|
+
if (typeof value === "function") return true;
|
|
308
|
+
if (typeof value === "object" && this.hasDynamicContent(value)) return true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Estimate component size
|
|
315
|
+
*/
|
|
316
|
+
estimateSize(component) {
|
|
317
|
+
try {
|
|
318
|
+
return JSON.stringify(component).length;
|
|
319
|
+
} catch {
|
|
320
|
+
return 0;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Summarize component for context
|
|
325
|
+
*/
|
|
326
|
+
summarizeComponent(component) {
|
|
327
|
+
const type = this.getComponentType(component);
|
|
328
|
+
if (type === "element" && isCoherentObject(component)) {
|
|
329
|
+
const entries = Object.entries(component);
|
|
330
|
+
if (entries.length === 1) {
|
|
331
|
+
const [tagName, props] = entries;
|
|
332
|
+
const propCount = Object.keys(props).length;
|
|
333
|
+
const hasChildren2 = hasChildren2(props);
|
|
334
|
+
return `<${tagName}> (${propCount} props, ${hasChildren2 ? "has" : "no"} children)`;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (type === "text") {
|
|
338
|
+
const preview = String(component).substring(0, 30);
|
|
339
|
+
return `Text: "${preview}${component.length > 30 ? "..." : ""}"`;
|
|
340
|
+
}
|
|
341
|
+
if (type === "function") {
|
|
342
|
+
return `Function: ${component.name || "anonymous"}`;
|
|
343
|
+
}
|
|
344
|
+
return `${type} (${this.estimateSize(component)} bytes)`;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Extract event handlers from props
|
|
348
|
+
*/
|
|
349
|
+
extractEventHandlers(props) {
|
|
350
|
+
return Object.keys(props).filter((key) => /^on[A-Z]/.test(key));
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Determine error severity
|
|
354
|
+
*/
|
|
355
|
+
determineSeverity(error) {
|
|
356
|
+
if (error.name === "TypeError" || error.name === "ReferenceError") return "critical";
|
|
357
|
+
if (error.message.includes("Maximum render depth")) return "critical";
|
|
358
|
+
if (error.message.includes("undefined")) return "high";
|
|
359
|
+
if (error.message.includes("performance")) return "medium";
|
|
360
|
+
return "low";
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Categorize error
|
|
364
|
+
*/
|
|
365
|
+
categorizeError(error) {
|
|
366
|
+
if (error.message.includes("render") || error.message.includes("component")) return "rendering";
|
|
367
|
+
if (error.message.includes("props") || error.message.includes("prop")) return "props";
|
|
368
|
+
if (error.message.includes("cache") || error.message.includes("performance")) return "performance";
|
|
369
|
+
if (error.message.includes("route") || error.message.includes("router")) return "routing";
|
|
370
|
+
return "general";
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Initialize common error patterns and suggestions
|
|
374
|
+
*/
|
|
375
|
+
initializeCommonPatterns() {
|
|
376
|
+
return [
|
|
377
|
+
{
|
|
378
|
+
matcher: /undefined.*property/gi,
|
|
379
|
+
suggestion: {
|
|
380
|
+
type: "fix",
|
|
381
|
+
message: "Check for undefined properties in component props",
|
|
382
|
+
code: 'Add default props: const { required = "default" } = props;'
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
matcher: /maximum.*depth/gi,
|
|
387
|
+
suggestion: {
|
|
388
|
+
type: "fix",
|
|
389
|
+
message: "Infinite recursion detected in component tree",
|
|
390
|
+
code: "Check for circular references in component children"
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
matcher: /cannot.*read.*property/gi,
|
|
395
|
+
suggestion: {
|
|
396
|
+
type: "fix",
|
|
397
|
+
message: "Property access error - check object structure",
|
|
398
|
+
code: "Use optional chaining: obj?.prop?.nested"
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
matcher: /performance/gi,
|
|
403
|
+
suggestion: {
|
|
404
|
+
type: "optimization",
|
|
405
|
+
message: "Consider optimizing component for better performance",
|
|
406
|
+
code: "Use memoization or static components where possible"
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
];
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Add color to text
|
|
413
|
+
*/
|
|
414
|
+
colorize(text, color) {
|
|
415
|
+
if (!this.options.colorOutput) return text;
|
|
416
|
+
const colors = {
|
|
417
|
+
black: "\x1B[30m",
|
|
418
|
+
red: "\x1B[31m",
|
|
419
|
+
green: "\x1B[32m",
|
|
420
|
+
yellow: "\x1B[33m",
|
|
421
|
+
blue: "\x1B[34m",
|
|
422
|
+
magenta: "\x1B[35m",
|
|
423
|
+
cyan: "\x1B[36m",
|
|
424
|
+
white: "\x1B[37m",
|
|
425
|
+
gray: "\x1B[90m"
|
|
426
|
+
};
|
|
427
|
+
const reset = "\x1B[0m";
|
|
428
|
+
return `${colors[color] || ""}${text}${reset}`;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Get error statistics
|
|
432
|
+
*/
|
|
433
|
+
getErrorStats() {
|
|
434
|
+
const stats = {
|
|
435
|
+
total: this.errorHistory.length,
|
|
436
|
+
byCategory: {},
|
|
437
|
+
bySeverity: {},
|
|
438
|
+
recent: this.errorHistory.slice(-10)
|
|
439
|
+
};
|
|
440
|
+
this.errorHistory.forEach((error) => {
|
|
441
|
+
stats.byCategory[error.category] = (stats.byCategory[error.category] || 0) + 1;
|
|
442
|
+
stats.bySeverity[error.severity] = (stats.bySeverity[error.severity] || 0) + 1;
|
|
443
|
+
});
|
|
444
|
+
return stats;
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
function createEnhancedErrorHandler(options = {}) {
|
|
448
|
+
return new EnhancedErrorHandler(options);
|
|
449
|
+
}
|
|
450
|
+
function handleEnhancedError(error, component = null, context = {}) {
|
|
451
|
+
const handler = createEnhancedErrorHandler();
|
|
452
|
+
const enhancedError = handler.handleError(error, component, context);
|
|
453
|
+
console.error(handler.formatError(enhancedError));
|
|
454
|
+
return enhancedError;
|
|
455
|
+
}
|
|
456
|
+
var enhanced_errors_default = {
|
|
457
|
+
EnhancedErrorHandler,
|
|
458
|
+
createEnhancedErrorHandler,
|
|
459
|
+
handleEnhancedError
|
|
460
|
+
};
|
|
461
|
+
export {
|
|
462
|
+
EnhancedErrorHandler,
|
|
463
|
+
createEnhancedErrorHandler,
|
|
464
|
+
enhanced_errors_default as default,
|
|
465
|
+
handleEnhancedError
|
|
466
|
+
};
|
|
467
|
+
//# sourceMappingURL=enhanced-errors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/enhanced-errors.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Enhanced Error Context for Coherent.js\n *\n * Provides detailed, actionable error messages for functional component debugging:\n * - Component tree context when errors occur\n * - Prop validation with helpful suggestions\n * - Performance-related error insights\n * - Fix suggestions based on common patterns\n *\n * @module EnhancedErrors\n */\n\nimport { isCoherentObject, hasChildren } from '@coherent.js/core';\n\nexport class EnhancedErrorHandler {\n constructor(options = {}) {\n this.options = {\n maxContextDepth: options.maxContextDepth || 5,\n includeStackTrace: options.includeStackTrace !== false,\n showSuggestions: options.showSuggestions !== false,\n colorOutput: options.colorOutput !== false,\n ...options\n };\n\n this.errorHistory = [];\n this.commonPatterns = this.initializeCommonPatterns();\n }\n\n /**\n * Handle and enhance an error with component context\n */\n handleError(error, component = null, context = {}) {\n const enhancedError = {\n originalError: error,\n message: error.message,\n stack: error.stack,\n timestamp: Date.now(),\n component: component ? this.analyzeComponent(component) : null,\n context,\n suggestions: [],\n severity: this.determineSeverity(error),\n category: this.categorizeError(error)\n };\n\n // Add component context\n if (component) {\n enhancedError.componentContext = this.getComponentContext(component, context.path || []);\n enhancedError.propValidation = this.validateProps(component);\n }\n\n // Generate suggestions\n if (this.options.showSuggestions) {\n enhancedError.suggestions = this.generateSuggestions(enhancedError);\n }\n\n // Add to history\n this.errorHistory.push(enhancedError);\n if (this.errorHistory.length > 100) {\n this.errorHistory = this.errorHistory.slice(-100);\n }\n\n return enhancedError;\n }\n\n /**\n * Analyze component structure\n */\n analyzeComponent(component) {\n const analysis = {\n type: this.getComponentType(component),\n isValid: this.isValidComponent(component),\n complexity: this.assessComplexity(component),\n hasDynamicContent: this.hasDynamicContent(component),\n estimatedSize: this.estimateSize(component)\n };\n\n if (isCoherentObject(component)) {\n const entries = Object.entries(component);\n if (entries.length === 1) {\n const [_tagName, props] = entries;\n analysis.tagName = _tagName;\n analysis.propCount = Object.keys(props).length;\n analysis.hasChildren = hasChildren(props);\n analysis.eventHandlers = this.extractEventHandlers(props);\n }\n }\n\n return analysis;\n }\n\n /**\n * Get component context tree\n */\n getComponentContext(component, path = []) {\n const context = {\n path: path.join('.'),\n depth: path.length,\n component: this.summarizeComponent(component),\n children: []\n };\n\n if (isCoherentObject(component) && context.depth < this.options.maxContextDepth) {\n const entries = Object.entries(component);\n if (entries.length === 1) {\n const [tagName, props] = entries;\n\n if (hasChildren(props)) {\n const children = Array.isArray(props.children) ? props.children : [props.children];\n children.forEach((child, index) => {\n if (child && typeof child === 'object') {\n const childContext = this.getComponentContext(child, [...path, `${tagName}[${index}]`]);\n context.children.push(childContext);\n }\n });\n }\n }\n }\n\n return context;\n }\n\n /**\n * Validate component props\n */\n validateProps(component) {\n if (!isCoherentObject(component)) return { valid: true, issues: [] };\n\n const entries = Object.entries(component);\n if (entries.length !== 1) return { valid: false, issues: ['Component must have exactly one root element'] };\n\n const [tagName, props] = entries;\n const issues = [];\n const warnings = [];\n\n // Check for common prop issues\n Object.entries(props).forEach(([key, value]) => {\n // Check for undefined props\n if (value === undefined) {\n issues.push(`Prop '${key}' is undefined`);\n }\n\n // Check for null props that might cause issues\n if (value === null && key !== 'children' && key !== 'text') {\n warnings.push(`Prop '${key}' is null`);\n }\n\n // Check for event handlers\n if (typeof value === 'function' && !/^on[A-Z]/.test(key)) {\n warnings.push(`Function prop '${key}' doesn't follow event handler naming convention (onXxx)`);\n }\n\n // Check for potentially large objects\n if (typeof value === 'object' && value !== null) {\n const size = JSON.stringify(value).length;\n if (size > 10000) {\n warnings.push(`Prop '${key}' is large (${size} bytes) - consider optimizing`);\n }\n }\n });\n\n // Check for missing required props\n if (tagName === 'img' && !props.src && !props['data-src']) {\n issues.push('Image element missing required src or data-src prop');\n }\n\n if (tagName === 'a' && !props.href && !props.onclick) {\n warnings.push('Link element missing href or onclick prop');\n }\n\n return {\n valid: issues.length === 0,\n issues,\n warnings,\n propCount: Object.keys(props).length\n };\n }\n\n /**\n * Generate fix suggestions based on error and context\n */\n generateSuggestions(enhancedError) {\n const suggestions = [];\n const { originalError, component, category } = enhancedError;\n\n // Component-specific suggestions\n if (component && component.type === 'element') {\n if (component.hasDynamicContent && category === 'performance') {\n suggestions.push({\n type: 'optimization',\n message: 'Consider making this component static for better caching',\n code: 'Remove functions from props to enable static optimization'\n });\n }\n\n if (component.complexity > 10) {\n suggestions.push({\n type: 'structure',\n message: 'Component is complex - consider breaking it into smaller components',\n code: 'Split complex components into reusable functional components'\n });\n }\n }\n\n // Error-specific suggestions\n if (originalError && originalError.message && originalError.message.includes('undefined')) {\n suggestions.push({\n type: 'fix',\n message: 'Check for undefined props or missing data',\n code: 'Add prop validation: if (!props.required) return null;'\n });\n }\n\n if (originalError && originalError.message && originalError.message.includes('Maximum render depth')) {\n suggestions.push({\n type: 'fix',\n message: 'Possible infinite recursion detected',\n code: 'Check for circular references in component props'\n });\n }\n\n // Pattern-based suggestions\n this.commonPatterns.forEach(pattern => {\n if (originalError && originalError.message && pattern.matcher.test(originalError.message)) {\n suggestions.push(pattern.suggestion);\n }\n });\n\n return suggestions;\n }\n\n /**\n * Format enhanced error for display\n */\n formatError(enhancedError) {\n const lines = [];\n\n // Header\n if (this.options.colorOutput) {\n lines.push(this.colorize('\u274C Coherent.js Error', 'red'));\n lines.push(this.colorize('\u2500'.repeat(40), 'red'));\n } else {\n lines.push('\u274C Coherent.js Error');\n lines.push('\u2500'.repeat(40));\n }\n\n // Error message\n lines.push(`Message: ${enhancedError.message}`);\n lines.push(`Category: ${enhancedError.category} (${enhancedError.severity})`);\n lines.push(`Time: ${new Date(enhancedError.timestamp).toLocaleTimeString()}`);\n lines.push('');\n\n // Component context\n if (enhancedError.componentContext) {\n lines.push('\uD83C\uDFD7\uFE0F Component Context');\n lines.push('\u2500'.repeat(20));\n lines.push(`Path: ${enhancedError.componentContext.path}`);\n lines.push(`Type: ${enhancedError.component.type}`);\n lines.push(`Depth: ${enhancedError.componentContext.depth}`);\n\n if (enhancedError.componentContext.component) {\n lines.push(`Summary: ${enhancedError.componentContext.component}`);\n }\n\n lines.push('');\n }\n\n // Prop validation\n if (enhancedError.propValidation) {\n const validation = enhancedError.propValidation;\n lines.push('\uD83D\uDCDD Prop Validation');\n lines.push('\u2500'.repeat(18));\n lines.push(`Valid: ${validation.valid ? '\u2705' : '\u274C'}`);\n lines.push(`Props: ${validation.propCount}`);\n\n if (validation.issues.length > 0) {\n lines.push('Issues:');\n validation.issues.forEach(issue => {\n lines.push(` \u274C ${issue}`);\n });\n }\n\n if (validation.warnings.length > 0) {\n lines.push('Warnings:');\n validation.warnings.forEach(warning => {\n lines.push(` \u26A0\uFE0F ${warning}`);\n });\n }\n\n lines.push('');\n }\n\n // Suggestions\n if (enhancedError.suggestions.length > 0) {\n lines.push('\uD83D\uDCA1 Suggestions');\n lines.push('\u2500'.repeat(13));\n enhancedError.suggestions.forEach((suggestion, index) => {\n const icon = suggestion.type === 'fix' ? '\uD83D\uDD27' :\n suggestion.type === 'optimization' ? '\u26A1' :\n suggestion.type === 'structure' ? '\uD83C\uDFD7\uFE0F' : '\uD83D\uDCA1';\n lines.push(`${index + 1}. ${icon} ${suggestion.message}`);\n if (suggestion.code) {\n lines.push(` Code: ${suggestion.code}`);\n }\n });\n lines.push('');\n }\n\n // Stack trace (optional)\n if (this.options.includeStackTrace && enhancedError.stack) {\n lines.push('\uD83D\uDCDA Stack Trace');\n lines.push('\u2500'.repeat(15));\n lines.push(enhancedError.stack.split('\\n').slice(0, 10).join('\\n'));\n if (enhancedError.stack.split('\\n').length > 10) {\n lines.push('... (truncated)');\n }\n }\n\n return lines.join('\\n');\n }\n\n /**\n * Get component type\n */\n getComponentType(component) {\n if (component === null || component === undefined) return 'empty';\n if (typeof component === 'string') return 'text';\n if (typeof component === 'number') return 'number';\n if (typeof component === 'boolean') return 'boolean';\n if (typeof component === 'function') return 'function';\n if (Array.isArray(component)) return 'array';\n if (isCoherentObject(component)) return 'element';\n return 'object';\n }\n\n /**\n * Check if component is valid\n */\n isValidComponent(component) {\n try {\n // Basic validation\n if (component === null || component === undefined) return true;\n if (typeof component === 'string' || typeof component === 'number') return true;\n if (typeof component === 'function') return true;\n if (Array.isArray(component)) return component.every(child => this.isValidComponent(child));\n if (isCoherentObject(component)) {\n const entries = Object.entries(component);\n return entries.length === 1;\n }\n return false;\n } catch {\n return false;\n }\n }\n\n /**\n * Assess component complexity\n */\n assessComplexity(component) {\n let complexity = 0;\n\n if (typeof component === 'object' && component !== null) {\n if (isCoherentObject(component)) {\n const entries = Object.entries(component);\n if (entries.length === 1) {\n const [_tagName, props] = entries;\n complexity += Object.keys(props).length;\n\n if (hasChildren(props)) {\n const children = Array.isArray(props.children) ? props.children : [props.children];\n children.forEach(child => {\n complexity += this.assessComplexity(child);\n });\n }\n }\n } else {\n complexity += Object.keys(component).length;\n }\n }\n\n return complexity;\n }\n\n /**\n * Check if component has dynamic content\n */\n hasDynamicContent(component) {\n if (typeof component === 'function') return true;\n if (typeof component === 'object' && component !== null) {\n for (const value of Object.values(component)) {\n if (typeof value === 'function') return true;\n if (typeof value === 'object' && this.hasDynamicContent(value)) return true;\n }\n }\n return false;\n }\n\n /**\n * Estimate component size\n */\n estimateSize(component) {\n try {\n return JSON.stringify(component).length;\n } catch {\n return 0;\n }\n }\n\n /**\n * Summarize component for context\n */\n summarizeComponent(component) {\n const type = this.getComponentType(component);\n\n if (type === 'element' && isCoherentObject(component)) {\n const entries = Object.entries(component);\n if (entries.length === 1) {\n const [tagName, props] = entries;\n const propCount = Object.keys(props).length;\n const hasChildren = hasChildren(props);\n return `<${tagName}> (${propCount} props, ${hasChildren ? 'has' : 'no'} children)`;\n }\n }\n\n if (type === 'text') {\n const preview = String(component).substring(0, 30);\n return `Text: \"${preview}${component.length > 30 ? '...' : ''}\"`;\n }\n\n if (type === 'function') {\n return `Function: ${component.name || 'anonymous'}`;\n }\n\n return `${type} (${this.estimateSize(component)} bytes)`;\n }\n\n /**\n * Extract event handlers from props\n */\n extractEventHandlers(props) {\n return Object.keys(props).filter(key => /^on[A-Z]/.test(key));\n }\n\n /**\n * Determine error severity\n */\n determineSeverity(error) {\n if (error.name === 'TypeError' || error.name === 'ReferenceError') return 'critical';\n if (error.message.includes('Maximum render depth')) return 'critical';\n if (error.message.includes('undefined')) return 'high';\n if (error.message.includes('performance')) return 'medium';\n return 'low';\n }\n\n /**\n * Categorize error\n */\n categorizeError(error) {\n if (error.message.includes('render') || error.message.includes('component')) return 'rendering';\n if (error.message.includes('props') || error.message.includes('prop')) return 'props';\n if (error.message.includes('cache') || error.message.includes('performance')) return 'performance';\n if (error.message.includes('route') || error.message.includes('router')) return 'routing';\n return 'general';\n }\n\n /**\n * Initialize common error patterns and suggestions\n */\n initializeCommonPatterns() {\n return [\n {\n matcher: /undefined.*property/gi,\n suggestion: {\n type: 'fix',\n message: 'Check for undefined properties in component props',\n code: 'Add default props: const { required = \"default\" } = props;'\n }\n },\n {\n matcher: /maximum.*depth/gi,\n suggestion: {\n type: 'fix',\n message: 'Infinite recursion detected in component tree',\n code: 'Check for circular references in component children'\n }\n },\n {\n matcher: /cannot.*read.*property/gi,\n suggestion: {\n type: 'fix',\n message: 'Property access error - check object structure',\n code: 'Use optional chaining: obj?.prop?.nested'\n }\n },\n {\n matcher: /performance/gi,\n suggestion: {\n type: 'optimization',\n message: 'Consider optimizing component for better performance',\n code: 'Use memoization or static components where possible'\n }\n }\n ];\n }\n\n /**\n * Add color to text\n */\n colorize(text, color) {\n if (!this.options.colorOutput) return text;\n\n const colors = {\n black: '\\x1b[30m',\n red: '\\x1b[31m',\n green: '\\x1b[32m',\n yellow: '\\x1b[33m',\n blue: '\\x1b[34m',\n magenta: '\\x1b[35m',\n cyan: '\\x1b[36m',\n white: '\\x1b[37m',\n gray: '\\x1b[90m'\n };\n\n const reset = '\\x1b[0m';\n return `${colors[color] || ''}${text}${reset}`;\n }\n\n /**\n * Get error statistics\n */\n getErrorStats() {\n const stats = {\n total: this.errorHistory.length,\n byCategory: {},\n bySeverity: {},\n recent: this.errorHistory.slice(-10)\n };\n\n this.errorHistory.forEach(error => {\n stats.byCategory[error.category] = (stats.byCategory[error.category] || 0) + 1;\n stats.bySeverity[error.severity] = (stats.bySeverity[error.severity] || 0) + 1;\n });\n\n return stats;\n }\n}\n\n/**\n * Create enhanced error handler\n */\nexport function createEnhancedErrorHandler(options = {}) {\n return new EnhancedErrorHandler(options);\n}\n\n/**\n * Handle error and log enhanced version\n */\nexport function handleEnhancedError(error, component = null, context = {}) {\n const handler = createEnhancedErrorHandler();\n const enhancedError = handler.handleError(error, component, context);\n console.error(handler.formatError(enhancedError));\n return enhancedError;\n}\n\nexport default {\n EnhancedErrorHandler,\n createEnhancedErrorHandler,\n handleEnhancedError\n};\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,kBAAkB,mBAAmB;AAEvC,IAAM,uBAAN,MAA2B;AAAA,EAChC,YAAY,UAAU,CAAC,GAAG;AACxB,SAAK,UAAU;AAAA,MACb,iBAAiB,QAAQ,mBAAmB;AAAA,MAC5C,mBAAmB,QAAQ,sBAAsB;AAAA,MACjD,iBAAiB,QAAQ,oBAAoB;AAAA,MAC7C,aAAa,QAAQ,gBAAgB;AAAA,MACrC,GAAG;AAAA,IACL;AAEA,SAAK,eAAe,CAAC;AACrB,SAAK,iBAAiB,KAAK,yBAAyB;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY,OAAO,YAAY,MAAM,UAAU,CAAC,GAAG;AACjD,UAAM,gBAAgB;AAAA,MACpB,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