fixdog 0.1.13 → 0.1.14

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.
@@ -4159,6 +4159,24 @@ const resolveFromStack = async (fiber) => {
4159
4159
  debugLog("Could not resolve source from stack");
4160
4160
  return null;
4161
4161
  };
4162
+ // Find the nearest user-defined component fiber (FunctionComponent/ClassComponent)
4163
+ // walking up from a given fiber. Skips HostComponents (tag 5), HostText (tag 6), etc.
4164
+ const findNearestComponentFiber = (fiber) => {
4165
+ let current = fiber?.return;
4166
+ while (current) {
4167
+ // tag 0 = FunctionComponent, tag 1 = ClassComponent, tag 11 = ForwardRef,
4168
+ // tag 14 = MemoComponent, tag 15 = SimpleMemoComponent
4169
+ if (current.tag === 0 ||
4170
+ current.tag === 1 ||
4171
+ current.tag === 11 ||
4172
+ current.tag === 14 ||
4173
+ current.tag === 15) {
4174
+ return current;
4175
+ }
4176
+ current = current.return;
4177
+ }
4178
+ return null;
4179
+ };
4162
4180
  const resolveFromFiber = async (fiber, element) => {
4163
4181
  if (!fiber)
4164
4182
  return Promise.resolve(null);
@@ -4190,6 +4208,38 @@ const resolveFromFiber = async (fiber, element) => {
4190
4208
  element,
4191
4209
  };
4192
4210
  }
4211
+ // For HostComponents (native elements like <div>, <label>), walk up to
4212
+ // the nearest user-defined component and resolve source from there.
4213
+ // This is the component that rendered this native element.
4214
+ if (fiber.tag === 5 || fiber.tag === 6) {
4215
+ const parentComponent = findNearestComponentFiber(fiber);
4216
+ if (parentComponent) {
4217
+ const parentName = getComponentName(parentComponent);
4218
+ debugLog("HostComponent, trying parent component:", parentName);
4219
+ const parentDebugSource = findDebugSource(parentComponent);
4220
+ if (parentDebugSource) {
4221
+ return {
4222
+ componentName: parentName,
4223
+ fileName: parentDebugSource.fileName,
4224
+ lineNumber: parentDebugSource.lineNumber,
4225
+ columnNumber: parentDebugSource.columnNumber,
4226
+ fiber: parentComponent,
4227
+ element,
4228
+ };
4229
+ }
4230
+ const parentStackSource = await resolveFromStack(parentComponent);
4231
+ if (parentStackSource) {
4232
+ return {
4233
+ componentName: parentName,
4234
+ fileName: parentStackSource.fileName,
4235
+ lineNumber: parentStackSource.lineNumber,
4236
+ columnNumber: parentStackSource.columnNumber,
4237
+ fiber: parentComponent,
4238
+ element,
4239
+ };
4240
+ }
4241
+ }
4242
+ }
4193
4243
  // If we have a function name from the component, we can still return useful info
4194
4244
  if (isDebugEnabled()) {
4195
4245
  console.warn("[fixdog-sdk:debug] No source found for:", componentName, {