Skip to content

Commit b51ebaf

Browse files
AlexStrNikclaude
andcommitted
feat: improve React/Angular source detection with full path resolution
- Fix source map path resolution to show full paths instead of filenames - Remove leading slashes from resolved paths - Restore React detection to use native debug info with fallback - Clean up debug console.error statements - Bump version to 0.0.10 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cddb6f1 commit b51ebaf

File tree

7 files changed

+326
-221
lines changed

7 files changed

+326
-221
lines changed

chrome-devtools-extension/injected.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
getReactInfo(element) {
1616
const fiberKey = Object.keys(element).find((key) =>
17-
key.startsWith("__reactFiber"),
17+
key.startsWith("__reactFiber")
1818
);
1919

2020
if (!fiberKey) return null;
@@ -23,7 +23,10 @@
2323
if (!fiber?._debugOwner?.elementType) return null;
2424

2525
const componentType = fiber._debugOwner.elementType;
26-
const name = componentType.name || componentType.displayName;
26+
const name =
27+
componentType.name ||
28+
componentType.displayName ||
29+
fiber._debugOwner.type?.name;
2730

2831
if (!name || this.isReactInternal(name)) return null;
2932

@@ -53,6 +56,8 @@
5356
}
5457
}
5558
}
59+
} else {
60+
fileName = "not available";
5661
}
5762

5863
return {
@@ -61,7 +66,9 @@
6166
file:
6267
fileName && lineNumber
6368
? `${fileName}:${lineNumber}`
64-
: "not available",
69+
: fileName,
70+
needsSourceDetection: !fileName || !lineNumber,
71+
elementId: element.getAttribute("data-claude-devtools-id"),
6572
};
6673
}
6774

@@ -89,7 +96,8 @@
8996
? component.constructor.name.substring(1)
9097
: component.constructor.name,
9198
props: Object.keys(props).length > 0 ? props : null,
92-
file: "detecting...",
99+
file: "not available",
100+
needsSourceDetection: true,
93101
elementId: element.getAttribute("data-claude-devtools-id"),
94102
};
95103
}
@@ -119,7 +127,7 @@
119127
if (event.data?.type === "CLAUDE_DEVTOOLS_GET_COMPONENT_INFO") {
120128
const elementId = event.data.elementId;
121129
const element = document.querySelector(
122-
`[data-claude-devtools-id="${elementId}"]`,
130+
`[data-claude-devtools-id="${elementId}"]`
123131
);
124132
const componentInfo = element ? detector.getComponentInfo(element) : null;
125133

@@ -129,6 +137,7 @@
129137
framework: componentInfo.framework,
130138
file: componentInfo.file,
131139
props: sanitizeProps(componentInfo.props),
140+
needsSourceDetection: componentInfo.needsSourceDetection,
132141
}
133142
: null;
134143

@@ -138,7 +147,7 @@
138147
id: event.data.id,
139148
componentInfo: sanitizedInfo,
140149
},
141-
"*",
150+
"*"
142151
);
143152
}
144153
});

chrome-devtools-extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Claude DevTools",
4-
"version": "0.0.9",
4+
"version": "0.0.10",
55
"description": "Pick elements and send them to Claude with React/Angular/Vue component detection",
66
"permissions": ["activeTab", "storage", "tabs", "debugger", "scripting"],
77
"host_permissions": ["<all_urls>"],

chrome-devtools-extension/panel.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
font-weight: normal;
6969
margin-right: 4px;
7070
}
71+
.header-version {
72+
color: var(--text-muted);
73+
font-size: 10px;
74+
margin-left: 4px;
75+
}
7176
.connection-status {
7277
display: flex;
7378
align-items: center;
@@ -286,6 +291,7 @@
286291
<div class="header">
287292
<img src="claude.png" class="header-icon" alt="Claude" />
288293
<span class="header-title">Claude DevTools</span>
294+
<span class="header-version" id="extensionVersion"></span>
289295
<div class="connection-status">
290296
<div class="status-dot" id="statusDot"></div>
291297
<span id="connectionStatus">connected</span>

0 commit comments

Comments
 (0)