react-spot 0.0.5 → 0.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-spot",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Dev-only DOM to React source opener for React 19, Next.js, and Turbopack.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -252,13 +252,17 @@ export function getStackFrame(fiber: Fiber): string | undefined {
252
252
  function isSelfFrame(frameLine: string, componentName: string): boolean {
253
253
  // 提取帧中的函数名:匹配 "at FuncName (" 或 "FuncName@" 格式
254
254
  const atMatch = frameLine.match(/^at\s+([^\s(]+)/);
255
- if (atMatch) {
256
- return atMatch[1] === componentName;
257
- }
258
- const firefoxMatch = frameLine.match(/^([^@]+)@/);
259
- if (firefoxMatch) {
260
- return firefoxMatch[1] === componentName;
261
- }
255
+ const frameName = atMatch?.[1] ?? frameLine.match(/^([^@]+)@/)?.[1];
256
+ if (!frameName) return false;
257
+
258
+ // 直接匹配
259
+ if (frameName === componentName) return true;
260
+
261
+ // Memo(InnerName) / ForwardRef(InnerName) 包装:
262
+ // getComponentName 返回 "Memo(Foo)" 但 React 19 自身帧用的是内部函数名 "Foo"
263
+ const innerMatch = componentName.match(/^(?:Memo|ForwardRef)\((.+)\)$/);
264
+ if (innerMatch && frameName === innerMatch[1]) return true;
265
+
262
266
  return false;
263
267
  }
264
268