made-refine 0.2.17 → 0.2.18-beta.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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +254 -355
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +254 -355
- package/dist/index.mjs.map +1 -1
- package/dist/{utils-lksVP2Wq.d.mts → utils-CpmjloNg.d.mts} +0 -8
- package/dist/{utils-lksVP2Wq.d.ts → utils-CpmjloNg.d.ts} +0 -8
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1756 -1754
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +1756 -1754
- package/dist/utils.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { D as DragState, a as DropIndicator, S as SelectElementOptions, b as SelectElementsOptions, c as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, d as BorderPropertyKey, e as BorderProperties, F as FlexPropertyKey, f as SizingPropertyKey, g as SizingValue, h as SizingChangeOptions, i as ColorPropertyKey, j as ColorValue, T as TypographyPropertyKey, A as ActiveTool, k as Theme, l as BorderStyleControlPreference, m as DirectEditState, n as SessionEdit, o as SessionItem, p as CanvasElementKind, q as TypographyProperties, M as MeasurementLine, G as Guideline, r as Comment } from './utils-
|
|
4
|
-
export { s as BorderRadiusProperties, t as BorderStyle, u as ColorProperties, v as CommentReply, w as DomSourceLocation, x as DropTarget, E as ElementInfo, y as ElementLocator, z as FlexProperties, H as MeasurementState, R as ReactComponentFrame, I as SizingChangePhase, J as SizingMode, K as SizingProperties, L as SpacingProperties, U as UndoEditEntry, N as UndoEntry, O as UndoMoveEntry, P as UndoSelectionEntry, Q as buildCommentExport, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, _ as colorToTailwind, $ as elementFromPointWithoutOverlays, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, a2 as formatPropertyValue, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, a6 as getComputedStyles, a7 as getDimensionDisplay, a8 as getElementInfo, a9 as getElementLocator, aa as getFlexDirection, ab as isFlexContainer, ac as isLayoutContainer, ad as parseColorValue, ae as parsePropertyValue, af as stylesToTailwind } from './utils-
|
|
3
|
+
import { D as DragState, a as DropIndicator, S as SelectElementOptions, b as SelectElementsOptions, c as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, d as BorderPropertyKey, e as BorderProperties, F as FlexPropertyKey, f as SizingPropertyKey, g as SizingValue, h as SizingChangeOptions, i as ColorPropertyKey, j as ColorValue, T as TypographyPropertyKey, A as ActiveTool, k as Theme, l as BorderStyleControlPreference, m as DirectEditState, n as SessionEdit, o as SessionItem, p as CanvasElementKind, q as TypographyProperties, M as MeasurementLine, G as Guideline, r as Comment } from './utils-CpmjloNg.mjs';
|
|
4
|
+
export { s as BorderRadiusProperties, t as BorderStyle, u as ColorProperties, v as CommentReply, w as DomSourceLocation, x as DropTarget, E as ElementInfo, y as ElementLocator, z as FlexProperties, H as MeasurementState, R as ReactComponentFrame, I as SizingChangePhase, J as SizingMode, K as SizingProperties, L as SpacingProperties, U as UndoEditEntry, N as UndoEntry, O as UndoMoveEntry, P as UndoSelectionEntry, Q as buildCommentExport, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, _ as colorToTailwind, $ as elementFromPointWithoutOverlays, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, a2 as formatPropertyValue, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, a6 as getComputedStyles, a7 as getDimensionDisplay, a8 as getElementInfo, a9 as getElementLocator, aa as getFlexDirection, ab as isFlexContainer, ac as isLayoutContainer, ad as parseColorValue, ae as parsePropertyValue, af as stylesToTailwind } from './utils-CpmjloNg.mjs';
|
|
5
5
|
|
|
6
6
|
declare function DirectEdit(): react_jsx_runtime.JSX.Element;
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { D as DragState, a as DropIndicator, S as SelectElementOptions, b as SelectElementsOptions, c as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, d as BorderPropertyKey, e as BorderProperties, F as FlexPropertyKey, f as SizingPropertyKey, g as SizingValue, h as SizingChangeOptions, i as ColorPropertyKey, j as ColorValue, T as TypographyPropertyKey, A as ActiveTool, k as Theme, l as BorderStyleControlPreference, m as DirectEditState, n as SessionEdit, o as SessionItem, p as CanvasElementKind, q as TypographyProperties, M as MeasurementLine, G as Guideline, r as Comment } from './utils-
|
|
4
|
-
export { s as BorderRadiusProperties, t as BorderStyle, u as ColorProperties, v as CommentReply, w as DomSourceLocation, x as DropTarget, E as ElementInfo, y as ElementLocator, z as FlexProperties, H as MeasurementState, R as ReactComponentFrame, I as SizingChangePhase, J as SizingMode, K as SizingProperties, L as SpacingProperties, U as UndoEditEntry, N as UndoEntry, O as UndoMoveEntry, P as UndoSelectionEntry, Q as buildCommentExport, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, _ as colorToTailwind, $ as elementFromPointWithoutOverlays, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, a2 as formatPropertyValue, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, a6 as getComputedStyles, a7 as getDimensionDisplay, a8 as getElementInfo, a9 as getElementLocator, aa as getFlexDirection, ab as isFlexContainer, ac as isLayoutContainer, ad as parseColorValue, ae as parsePropertyValue, af as stylesToTailwind } from './utils-
|
|
3
|
+
import { D as DragState, a as DropIndicator, S as SelectElementOptions, b as SelectElementsOptions, c as SpacingPropertyKey, C as CSSPropertyValue, B as BorderRadiusPropertyKey, d as BorderPropertyKey, e as BorderProperties, F as FlexPropertyKey, f as SizingPropertyKey, g as SizingValue, h as SizingChangeOptions, i as ColorPropertyKey, j as ColorValue, T as TypographyPropertyKey, A as ActiveTool, k as Theme, l as BorderStyleControlPreference, m as DirectEditState, n as SessionEdit, o as SessionItem, p as CanvasElementKind, q as TypographyProperties, M as MeasurementLine, G as Guideline, r as Comment } from './utils-CpmjloNg.js';
|
|
4
|
+
export { s as BorderRadiusProperties, t as BorderStyle, u as ColorProperties, v as CommentReply, w as DomSourceLocation, x as DropTarget, E as ElementInfo, y as ElementLocator, z as FlexProperties, H as MeasurementState, R as ReactComponentFrame, I as SizingChangePhase, J as SizingMode, K as SizingProperties, L as SpacingProperties, U as UndoEditEntry, N as UndoEntry, O as UndoMoveEntry, P as UndoSelectionEntry, Q as buildCommentExport, V as buildSessionExport, W as calculateDropPosition, X as calculateElementMeasurements, Y as calculateGuidelineMeasurements, Z as calculateParentMeasurements, _ as colorToTailwind, $ as elementFromPointWithoutOverlays, a0 as findContainerAtPoint, a1 as findLayoutContainerAtPoint, a2 as formatPropertyValue, a3 as getComputedBorderStyles, a4 as getComputedBoxShadow, a5 as getComputedColorStyles, a6 as getComputedStyles, a7 as getDimensionDisplay, a8 as getElementInfo, a9 as getElementLocator, aa as getFlexDirection, ab as isFlexContainer, ac as isLayoutContainer, ad as parseColorValue, ae as parsePropertyValue, af as stylesToTailwind } from './utils-CpmjloNg.js';
|
|
5
5
|
|
|
6
6
|
declare function DirectEdit(): react_jsx_runtime.JSX.Element;
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -197,6 +197,255 @@ function getZoomScale() {
|
|
|
197
197
|
return snap.active ? snap.zoom : 1;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
// src/utils/debug-stack.ts
|
|
201
|
+
var STACK_SOURCE_FILE_EXTENSION_REGEX = /\.(jsx|tsx|ts|js)$/;
|
|
202
|
+
var STACK_BUNDLED_FILE_PATTERN_REGEX = /(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i;
|
|
203
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
204
|
+
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/;
|
|
205
|
+
var SERVER_FRAME_MARKER = "(at Server)";
|
|
206
|
+
var STACK_INTERNAL_SCHEME_PREFIXES = [
|
|
207
|
+
"rsc://",
|
|
208
|
+
"about://React/",
|
|
209
|
+
"React/Server/",
|
|
210
|
+
"file:///",
|
|
211
|
+
"webpack://",
|
|
212
|
+
"webpack-internal://",
|
|
213
|
+
"node:",
|
|
214
|
+
"turbopack://",
|
|
215
|
+
"/app-pages-browser/"
|
|
216
|
+
];
|
|
217
|
+
function formatOwnerDebugStack(stack) {
|
|
218
|
+
if (!stack) return "";
|
|
219
|
+
const lines = stack.split("\n");
|
|
220
|
+
const filtered = [];
|
|
221
|
+
for (const line of lines) {
|
|
222
|
+
const trimmed = line.trim();
|
|
223
|
+
if (!trimmed) continue;
|
|
224
|
+
if (trimmed === "Error: react-stack-top-frame") continue;
|
|
225
|
+
if (trimmed.includes("react_stack_bottom_frame") || trimmed.includes("react-stack-bottom-frame")) {
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
filtered.push(line);
|
|
229
|
+
}
|
|
230
|
+
if (filtered.length > 0 && filtered[0].includes("fakeJSXCallSite")) {
|
|
231
|
+
filtered.shift();
|
|
232
|
+
}
|
|
233
|
+
return filtered.join("\n");
|
|
234
|
+
}
|
|
235
|
+
function extractStackLocation(urlLike) {
|
|
236
|
+
if (!urlLike.includes(":")) return [urlLike, void 0, void 0];
|
|
237
|
+
const isWrappedLocation = urlLike.startsWith("(") && /:\d+\)$/.test(urlLike);
|
|
238
|
+
const sanitizedResult = isWrappedLocation ? urlLike.slice(1, -1) : urlLike;
|
|
239
|
+
const parts = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(sanitizedResult);
|
|
240
|
+
if (!parts) return [sanitizedResult, void 0, void 0];
|
|
241
|
+
return [
|
|
242
|
+
parts[1],
|
|
243
|
+
parts[2] !== void 0 ? Number(parts[2]) : void 0,
|
|
244
|
+
parts[3] !== void 0 ? Number(parts[3]) : void 0
|
|
245
|
+
];
|
|
246
|
+
}
|
|
247
|
+
function parseV8StackLine(line) {
|
|
248
|
+
let currentLine = line;
|
|
249
|
+
if (currentLine.includes("(eval ")) {
|
|
250
|
+
currentLine = currentLine.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
|
|
251
|
+
}
|
|
252
|
+
let sanitizedLine = currentLine.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
|
|
253
|
+
const locationMatch = sanitizedLine.match(/ (\(.+\)$)/);
|
|
254
|
+
if (locationMatch) {
|
|
255
|
+
sanitizedLine = sanitizedLine.replace(locationMatch[0], "");
|
|
256
|
+
}
|
|
257
|
+
const [fileName, lineNumber, columnNumber] = extractStackLocation(
|
|
258
|
+
locationMatch ? locationMatch[1] : sanitizedLine
|
|
259
|
+
);
|
|
260
|
+
const functionName = locationMatch && sanitizedLine ? sanitizedLine : void 0;
|
|
261
|
+
if (fileName === "eval" || fileName === "<anonymous>") {
|
|
262
|
+
return {
|
|
263
|
+
functionName
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
functionName,
|
|
268
|
+
fileName,
|
|
269
|
+
lineNumber,
|
|
270
|
+
columnNumber,
|
|
271
|
+
source: currentLine,
|
|
272
|
+
isServer: currentLine.includes(SERVER_FRAME_MARKER) || fileName.startsWith("rsc://")
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function parseFFOrSafariStackLine(line) {
|
|
276
|
+
let currentLine = line;
|
|
277
|
+
if (currentLine.includes(" > eval")) {
|
|
278
|
+
currentLine = currentLine.replace(
|
|
279
|
+
/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,
|
|
280
|
+
":$1"
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
const trimmed = currentLine.trim();
|
|
284
|
+
if (!trimmed || SAFARI_NATIVE_CODE_REGEXP.test(trimmed)) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
if (!trimmed.includes("@") && !trimmed.includes(":")) {
|
|
288
|
+
return {
|
|
289
|
+
functionName: trimmed,
|
|
290
|
+
source: currentLine,
|
|
291
|
+
isServer: trimmed.includes(SERVER_FRAME_MARKER)
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
const atIndex = trimmed.lastIndexOf("@");
|
|
295
|
+
if (atIndex === -1) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
const maybeFunctionName = trimmed.slice(0, atIndex);
|
|
299
|
+
const location = trimmed.slice(atIndex + 1);
|
|
300
|
+
const [fileName, lineNumber, columnNumber] = extractStackLocation(location);
|
|
301
|
+
return {
|
|
302
|
+
functionName: maybeFunctionName || void 0,
|
|
303
|
+
fileName,
|
|
304
|
+
lineNumber,
|
|
305
|
+
columnNumber,
|
|
306
|
+
source: currentLine,
|
|
307
|
+
isServer: currentLine.includes(SERVER_FRAME_MARKER) || fileName.startsWith("rsc://")
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function parseInStackLine(line) {
|
|
311
|
+
const functionName = line.replace(/^\s*in\s+/, "").replace(/\s*\(at .*\)$/, "").trim();
|
|
312
|
+
if (!functionName) return null;
|
|
313
|
+
return {
|
|
314
|
+
functionName,
|
|
315
|
+
source: line,
|
|
316
|
+
isServer: line.includes(SERVER_FRAME_MARKER)
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function parseDebugStack(stack) {
|
|
320
|
+
const frames = [];
|
|
321
|
+
for (const rawLine of stack.split("\n")) {
|
|
322
|
+
if (FIREFOX_SAFARI_STACK_REGEXP.test(rawLine)) {
|
|
323
|
+
const parsed = parseFFOrSafariStackLine(rawLine);
|
|
324
|
+
if (parsed) frames.push(parsed);
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (/^\s*at\s+/.test(rawLine)) {
|
|
328
|
+
const parsed = parseV8StackLine(rawLine);
|
|
329
|
+
if (parsed) frames.push(parsed);
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
if (/^\s*in\s+/.test(rawLine)) {
|
|
333
|
+
const parsed = parseInStackLine(rawLine);
|
|
334
|
+
if (parsed) frames.push(parsed);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return frames;
|
|
338
|
+
}
|
|
339
|
+
function normalizeStackFileName(fileName) {
|
|
340
|
+
if (!fileName) return "";
|
|
341
|
+
let normalized = fileName;
|
|
342
|
+
const isHttpUrl = normalized.startsWith("http://") || normalized.startsWith("https://");
|
|
343
|
+
if (isHttpUrl) {
|
|
344
|
+
try {
|
|
345
|
+
normalized = new URL(normalized).pathname;
|
|
346
|
+
} catch {
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
let didStripPrefix = true;
|
|
350
|
+
while (didStripPrefix) {
|
|
351
|
+
didStripPrefix = false;
|
|
352
|
+
for (const prefix of STACK_INTERNAL_SCHEME_PREFIXES) {
|
|
353
|
+
if (normalized.startsWith(prefix)) {
|
|
354
|
+
normalized = normalized.slice(prefix.length);
|
|
355
|
+
if (prefix === "file:///") {
|
|
356
|
+
normalized = `/${normalized.replace(/^\/+/, "")}`;
|
|
357
|
+
}
|
|
358
|
+
didStripPrefix = true;
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
normalized = normalized.replace(/^\/\(app-pages-browser\)\//, "/").replace(/^\/\.\//, "/").replace(/^\.\//, "");
|
|
364
|
+
const queryIndex = normalized.indexOf("?");
|
|
365
|
+
if (queryIndex !== -1) {
|
|
366
|
+
normalized = normalized.slice(0, queryIndex);
|
|
367
|
+
}
|
|
368
|
+
return normalized;
|
|
369
|
+
}
|
|
370
|
+
function isSourceStackFile(fileName) {
|
|
371
|
+
const normalizedFileName = normalizeStackFileName(fileName);
|
|
372
|
+
if (!normalizedFileName) return false;
|
|
373
|
+
if (!STACK_SOURCE_FILE_EXTENSION_REGEX.test(normalizedFileName)) return false;
|
|
374
|
+
return !STACK_BUNDLED_FILE_PATTERN_REGEX.test(normalizedFileName);
|
|
375
|
+
}
|
|
376
|
+
function buildFunctionNameToRscFramesMap(fiber) {
|
|
377
|
+
const functionNameToRscFrames = /* @__PURE__ */ new Map();
|
|
378
|
+
const visited = /* @__PURE__ */ new Set();
|
|
379
|
+
let current = fiber;
|
|
380
|
+
while (current && !visited.has(current)) {
|
|
381
|
+
visited.add(current);
|
|
382
|
+
const rawStack = current?._debugStack?.stack;
|
|
383
|
+
const stack = typeof rawStack === "string" ? formatOwnerDebugStack(rawStack) : "";
|
|
384
|
+
if (stack) {
|
|
385
|
+
const frames = parseDebugStack(stack);
|
|
386
|
+
for (const frame of frames) {
|
|
387
|
+
if (!frame.functionName || !frame.fileName) continue;
|
|
388
|
+
if (!frame.fileName.startsWith("rsc://")) continue;
|
|
389
|
+
const normalized = normalizeStackFileName(frame.fileName);
|
|
390
|
+
if (!normalized) continue;
|
|
391
|
+
const existing = functionNameToRscFrames.get(frame.functionName) ?? [];
|
|
392
|
+
const duplicate = existing.some(
|
|
393
|
+
(candidate) => candidate.fileName === normalized && candidate.lineNumber === frame.lineNumber && candidate.columnNumber === frame.columnNumber
|
|
394
|
+
);
|
|
395
|
+
if (!duplicate) {
|
|
396
|
+
existing.push({
|
|
397
|
+
fileName: normalized,
|
|
398
|
+
lineNumber: frame.lineNumber,
|
|
399
|
+
columnNumber: frame.columnNumber
|
|
400
|
+
});
|
|
401
|
+
functionNameToRscFrames.set(frame.functionName, existing);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
current = current._debugOwner ?? current.return ?? null;
|
|
406
|
+
}
|
|
407
|
+
return functionNameToRscFrames;
|
|
408
|
+
}
|
|
409
|
+
function enrichServerFrame(frame, functionNameToRscFrames, functionNameToUsageIndex) {
|
|
410
|
+
if (!frame.functionName) return frame;
|
|
411
|
+
const available = functionNameToRscFrames.get(frame.functionName);
|
|
412
|
+
if (!available) return frame;
|
|
413
|
+
const usageIndex = functionNameToUsageIndex.get(frame.functionName) ?? 0;
|
|
414
|
+
const resolved = available[usageIndex % available.length];
|
|
415
|
+
functionNameToUsageIndex.set(frame.functionName, usageIndex + 1);
|
|
416
|
+
return {
|
|
417
|
+
...frame,
|
|
418
|
+
fileName: resolved.fileName,
|
|
419
|
+
lineNumber: resolved.lineNumber,
|
|
420
|
+
columnNumber: resolved.columnNumber
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function getSourceFromDebugStack(fiber) {
|
|
424
|
+
const rawStack = fiber?._debugStack?.stack;
|
|
425
|
+
if (typeof rawStack !== "string" || rawStack.length === 0) {
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
const formattedStack = formatOwnerDebugStack(rawStack);
|
|
429
|
+
if (!formattedStack) return null;
|
|
430
|
+
const stackFrames = parseDebugStack(formattedStack);
|
|
431
|
+
const functionNameToRscFrames = buildFunctionNameToRscFramesMap(fiber);
|
|
432
|
+
const functionNameToUsageIndex = /* @__PURE__ */ new Map();
|
|
433
|
+
for (const frame of stackFrames) {
|
|
434
|
+
const maybeEnriched = frame.isServer ? enrichServerFrame(frame, functionNameToRscFrames, functionNameToUsageIndex) : frame;
|
|
435
|
+
if (!maybeEnriched.fileName) continue;
|
|
436
|
+
const normalizedFileName = normalizeStackFileName(maybeEnriched.fileName);
|
|
437
|
+
if (!normalizedFileName) continue;
|
|
438
|
+
if (isSourceStackFile(normalizedFileName)) {
|
|
439
|
+
return {
|
|
440
|
+
fileName: normalizedFileName,
|
|
441
|
+
lineNumber: maybeEnriched.lineNumber,
|
|
442
|
+
columnNumber: maybeEnriched.columnNumber
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
|
|
200
449
|
// src/utils/react-fiber.ts
|
|
201
450
|
function getFiberForElement(element) {
|
|
202
451
|
if (typeof window !== "undefined") {
|
|
@@ -224,6 +473,8 @@ function getSourceFromFiber(fiber) {
|
|
|
224
473
|
if (pending?.fileName) return pending;
|
|
225
474
|
const memo = fiber?.memoizedProps?.__source;
|
|
226
475
|
if (memo?.fileName) return memo;
|
|
476
|
+
const fromDebugStack = getSourceFromDebugStack(fiber);
|
|
477
|
+
if (fromDebugStack?.fileName) return fromDebugStack;
|
|
227
478
|
return null;
|
|
228
479
|
}
|
|
229
480
|
function buildFrame(fiber) {
|
|
@@ -1806,358 +2057,6 @@ function calculateDropPosition(container, pointerX, pointerY, draggedElement) {
|
|
|
1806
2057
|
};
|
|
1807
2058
|
return { insertBefore, indicator };
|
|
1808
2059
|
}
|
|
1809
|
-
function getFiberForElement2(element) {
|
|
1810
|
-
if (typeof window !== "undefined") {
|
|
1811
|
-
const devtools = window.__DIRECT_EDIT_DEVTOOLS__;
|
|
1812
|
-
if (devtools?.getFiberForElement) {
|
|
1813
|
-
const fiber = devtools.getFiberForElement(element);
|
|
1814
|
-
if (fiber) return fiber;
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
const fiberKey = Object.keys(element).find(
|
|
1818
|
-
(key) => key.startsWith("__reactFiber$") || key.startsWith("__reactInternalInstance$")
|
|
1819
|
-
);
|
|
1820
|
-
if (!fiberKey) return null;
|
|
1821
|
-
return element[fiberKey] || null;
|
|
1822
|
-
}
|
|
1823
|
-
var STACK_SOURCE_FILE_EXTENSION_REGEX = /\.(jsx|tsx|ts|js)$/;
|
|
1824
|
-
var STACK_BUNDLED_FILE_PATTERN_REGEX = /(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i;
|
|
1825
|
-
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
1826
|
-
var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/;
|
|
1827
|
-
var SERVER_FRAME_MARKER = "(at Server)";
|
|
1828
|
-
var STACK_INTERNAL_SCHEME_PREFIXES = [
|
|
1829
|
-
"rsc://",
|
|
1830
|
-
"about://React/",
|
|
1831
|
-
"React/Server/",
|
|
1832
|
-
"file:///",
|
|
1833
|
-
"webpack://",
|
|
1834
|
-
"webpack-internal://",
|
|
1835
|
-
"node:",
|
|
1836
|
-
"turbopack://",
|
|
1837
|
-
"/app-pages-browser/"
|
|
1838
|
-
];
|
|
1839
|
-
function formatOwnerDebugStack(stack) {
|
|
1840
|
-
if (!stack) return "";
|
|
1841
|
-
const lines = stack.split("\n");
|
|
1842
|
-
const filtered = [];
|
|
1843
|
-
for (const line of lines) {
|
|
1844
|
-
const trimmed = line.trim();
|
|
1845
|
-
if (!trimmed) continue;
|
|
1846
|
-
if (trimmed === "Error: react-stack-top-frame") continue;
|
|
1847
|
-
if (trimmed.includes("react_stack_bottom_frame") || trimmed.includes("react-stack-bottom-frame")) {
|
|
1848
|
-
continue;
|
|
1849
|
-
}
|
|
1850
|
-
filtered.push(line);
|
|
1851
|
-
}
|
|
1852
|
-
if (filtered.length > 0 && filtered[0].includes("fakeJSXCallSite")) {
|
|
1853
|
-
filtered.shift();
|
|
1854
|
-
}
|
|
1855
|
-
return filtered.join("\n");
|
|
1856
|
-
}
|
|
1857
|
-
function extractStackLocation(urlLike) {
|
|
1858
|
-
if (!urlLike.includes(":")) return [urlLike, void 0, void 0];
|
|
1859
|
-
const isWrappedLocation = urlLike.startsWith("(") && /:\d+\)$/.test(urlLike);
|
|
1860
|
-
const sanitizedResult = isWrappedLocation ? urlLike.slice(1, -1) : urlLike;
|
|
1861
|
-
const parts = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(sanitizedResult);
|
|
1862
|
-
if (!parts) return [sanitizedResult, void 0, void 0];
|
|
1863
|
-
return [
|
|
1864
|
-
parts[1],
|
|
1865
|
-
parts[2] !== void 0 ? Number(parts[2]) : void 0,
|
|
1866
|
-
parts[3] !== void 0 ? Number(parts[3]) : void 0
|
|
1867
|
-
];
|
|
1868
|
-
}
|
|
1869
|
-
function parseV8StackLine(line) {
|
|
1870
|
-
let currentLine = line;
|
|
1871
|
-
if (currentLine.includes("(eval ")) {
|
|
1872
|
-
currentLine = currentLine.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
|
|
1873
|
-
}
|
|
1874
|
-
let sanitizedLine = currentLine.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
|
|
1875
|
-
const locationMatch = sanitizedLine.match(/ (\(.+\)$)/);
|
|
1876
|
-
if (locationMatch) {
|
|
1877
|
-
sanitizedLine = sanitizedLine.replace(locationMatch[0], "");
|
|
1878
|
-
}
|
|
1879
|
-
const [fileName, lineNumber, columnNumber] = extractStackLocation(
|
|
1880
|
-
locationMatch ? locationMatch[1] : sanitizedLine
|
|
1881
|
-
);
|
|
1882
|
-
const functionName = locationMatch && sanitizedLine ? sanitizedLine : void 0;
|
|
1883
|
-
if (fileName === "eval" || fileName === "<anonymous>") {
|
|
1884
|
-
return {
|
|
1885
|
-
functionName
|
|
1886
|
-
};
|
|
1887
|
-
}
|
|
1888
|
-
return {
|
|
1889
|
-
functionName,
|
|
1890
|
-
fileName,
|
|
1891
|
-
lineNumber,
|
|
1892
|
-
columnNumber,
|
|
1893
|
-
source: currentLine,
|
|
1894
|
-
isServer: currentLine.includes(SERVER_FRAME_MARKER) || fileName.startsWith("rsc://")
|
|
1895
|
-
};
|
|
1896
|
-
}
|
|
1897
|
-
function parseFFOrSafariStackLine(line) {
|
|
1898
|
-
let currentLine = line;
|
|
1899
|
-
if (currentLine.includes(" > eval")) {
|
|
1900
|
-
currentLine = currentLine.replace(
|
|
1901
|
-
/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,
|
|
1902
|
-
":$1"
|
|
1903
|
-
);
|
|
1904
|
-
}
|
|
1905
|
-
const trimmed = currentLine.trim();
|
|
1906
|
-
if (!trimmed || SAFARI_NATIVE_CODE_REGEXP.test(trimmed)) {
|
|
1907
|
-
return null;
|
|
1908
|
-
}
|
|
1909
|
-
if (!trimmed.includes("@") && !trimmed.includes(":")) {
|
|
1910
|
-
return {
|
|
1911
|
-
functionName: trimmed,
|
|
1912
|
-
source: currentLine,
|
|
1913
|
-
isServer: trimmed.includes(SERVER_FRAME_MARKER)
|
|
1914
|
-
};
|
|
1915
|
-
}
|
|
1916
|
-
const atIndex = trimmed.lastIndexOf("@");
|
|
1917
|
-
if (atIndex === -1) {
|
|
1918
|
-
return null;
|
|
1919
|
-
}
|
|
1920
|
-
const maybeFunctionName = trimmed.slice(0, atIndex);
|
|
1921
|
-
const location = trimmed.slice(atIndex + 1);
|
|
1922
|
-
const [fileName, lineNumber, columnNumber] = extractStackLocation(location);
|
|
1923
|
-
return {
|
|
1924
|
-
functionName: maybeFunctionName || void 0,
|
|
1925
|
-
fileName,
|
|
1926
|
-
lineNumber,
|
|
1927
|
-
columnNumber,
|
|
1928
|
-
source: currentLine,
|
|
1929
|
-
isServer: currentLine.includes(SERVER_FRAME_MARKER) || fileName.startsWith("rsc://")
|
|
1930
|
-
};
|
|
1931
|
-
}
|
|
1932
|
-
function parseInStackLine(line) {
|
|
1933
|
-
const functionName = line.replace(/^\s*in\s+/, "").replace(/\s*\(at .*\)$/, "").trim();
|
|
1934
|
-
if (!functionName) return null;
|
|
1935
|
-
return {
|
|
1936
|
-
functionName,
|
|
1937
|
-
source: line,
|
|
1938
|
-
isServer: line.includes(SERVER_FRAME_MARKER)
|
|
1939
|
-
};
|
|
1940
|
-
}
|
|
1941
|
-
function parseDebugStack(stack) {
|
|
1942
|
-
const frames = [];
|
|
1943
|
-
for (const rawLine of stack.split("\n")) {
|
|
1944
|
-
if (FIREFOX_SAFARI_STACK_REGEXP.test(rawLine)) {
|
|
1945
|
-
const parsed = parseFFOrSafariStackLine(rawLine);
|
|
1946
|
-
if (parsed) frames.push(parsed);
|
|
1947
|
-
continue;
|
|
1948
|
-
}
|
|
1949
|
-
if (/^\s*at\s+/.test(rawLine)) {
|
|
1950
|
-
const parsed = parseV8StackLine(rawLine);
|
|
1951
|
-
if (parsed) frames.push(parsed);
|
|
1952
|
-
continue;
|
|
1953
|
-
}
|
|
1954
|
-
if (/^\s*in\s+/.test(rawLine)) {
|
|
1955
|
-
const parsed = parseInStackLine(rawLine);
|
|
1956
|
-
if (parsed) frames.push(parsed);
|
|
1957
|
-
}
|
|
1958
|
-
}
|
|
1959
|
-
return frames;
|
|
1960
|
-
}
|
|
1961
|
-
function normalizeStackFileName(fileName) {
|
|
1962
|
-
if (!fileName) return "";
|
|
1963
|
-
let normalized = fileName;
|
|
1964
|
-
const isHttpUrl = normalized.startsWith("http://") || normalized.startsWith("https://");
|
|
1965
|
-
if (isHttpUrl) {
|
|
1966
|
-
try {
|
|
1967
|
-
normalized = new URL(normalized).pathname;
|
|
1968
|
-
} catch {
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
let didStripPrefix = true;
|
|
1972
|
-
while (didStripPrefix) {
|
|
1973
|
-
didStripPrefix = false;
|
|
1974
|
-
for (const prefix of STACK_INTERNAL_SCHEME_PREFIXES) {
|
|
1975
|
-
if (normalized.startsWith(prefix)) {
|
|
1976
|
-
normalized = normalized.slice(prefix.length);
|
|
1977
|
-
if (prefix === "file:///") {
|
|
1978
|
-
normalized = `/${normalized.replace(/^\/+/, "")}`;
|
|
1979
|
-
}
|
|
1980
|
-
didStripPrefix = true;
|
|
1981
|
-
break;
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
normalized = normalized.replace(/^\/\(app-pages-browser\)\//, "/").replace(/^\/\.\//, "/").replace(/^\.\//, "");
|
|
1986
|
-
const queryIndex = normalized.indexOf("?");
|
|
1987
|
-
if (queryIndex !== -1) {
|
|
1988
|
-
normalized = normalized.slice(0, queryIndex);
|
|
1989
|
-
}
|
|
1990
|
-
return normalized;
|
|
1991
|
-
}
|
|
1992
|
-
function isSourceStackFile(fileName) {
|
|
1993
|
-
const normalizedFileName = normalizeStackFileName(fileName);
|
|
1994
|
-
if (!normalizedFileName) return false;
|
|
1995
|
-
if (!STACK_SOURCE_FILE_EXTENSION_REGEX.test(normalizedFileName)) return false;
|
|
1996
|
-
return !STACK_BUNDLED_FILE_PATTERN_REGEX.test(normalizedFileName);
|
|
1997
|
-
}
|
|
1998
|
-
function buildFunctionNameToRscFramesMap(fiber) {
|
|
1999
|
-
const functionNameToRscFrames = /* @__PURE__ */ new Map();
|
|
2000
|
-
const visited = /* @__PURE__ */ new Set();
|
|
2001
|
-
let current = fiber;
|
|
2002
|
-
while (current && !visited.has(current)) {
|
|
2003
|
-
visited.add(current);
|
|
2004
|
-
const rawStack = current?._debugStack?.stack;
|
|
2005
|
-
const stack = typeof rawStack === "string" ? formatOwnerDebugStack(rawStack) : "";
|
|
2006
|
-
if (stack) {
|
|
2007
|
-
const frames = parseDebugStack(stack);
|
|
2008
|
-
for (const frame of frames) {
|
|
2009
|
-
if (!frame.functionName || !frame.fileName) continue;
|
|
2010
|
-
if (!frame.fileName.startsWith("rsc://")) continue;
|
|
2011
|
-
const normalized = normalizeStackFileName(frame.fileName);
|
|
2012
|
-
if (!normalized) continue;
|
|
2013
|
-
const existing = functionNameToRscFrames.get(frame.functionName) ?? [];
|
|
2014
|
-
const duplicate = existing.some(
|
|
2015
|
-
(candidate) => candidate.fileName === normalized && candidate.lineNumber === frame.lineNumber && candidate.columnNumber === frame.columnNumber
|
|
2016
|
-
);
|
|
2017
|
-
if (!duplicate) {
|
|
2018
|
-
existing.push({
|
|
2019
|
-
fileName: normalized,
|
|
2020
|
-
lineNumber: frame.lineNumber,
|
|
2021
|
-
columnNumber: frame.columnNumber
|
|
2022
|
-
});
|
|
2023
|
-
functionNameToRscFrames.set(frame.functionName, existing);
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
current = current._debugOwner ?? current.return ?? null;
|
|
2028
|
-
}
|
|
2029
|
-
return functionNameToRscFrames;
|
|
2030
|
-
}
|
|
2031
|
-
function enrichServerFrame(frame, functionNameToRscFrames, functionNameToUsageIndex) {
|
|
2032
|
-
if (!frame.functionName) return frame;
|
|
2033
|
-
const available = functionNameToRscFrames.get(frame.functionName);
|
|
2034
|
-
if (!available) return frame;
|
|
2035
|
-
const usageIndex = functionNameToUsageIndex.get(frame.functionName) ?? 0;
|
|
2036
|
-
const resolved = available[usageIndex % available.length];
|
|
2037
|
-
functionNameToUsageIndex.set(frame.functionName, usageIndex + 1);
|
|
2038
|
-
return {
|
|
2039
|
-
...frame,
|
|
2040
|
-
fileName: resolved.fileName,
|
|
2041
|
-
lineNumber: resolved.lineNumber,
|
|
2042
|
-
columnNumber: resolved.columnNumber
|
|
2043
|
-
};
|
|
2044
|
-
}
|
|
2045
|
-
function getSourceFromDebugStack(fiber) {
|
|
2046
|
-
const rawStack = fiber?._debugStack?.stack;
|
|
2047
|
-
if (typeof rawStack !== "string" || rawStack.length === 0) {
|
|
2048
|
-
return null;
|
|
2049
|
-
}
|
|
2050
|
-
const formattedStack = formatOwnerDebugStack(rawStack);
|
|
2051
|
-
if (!formattedStack) return null;
|
|
2052
|
-
const stackFrames = parseDebugStack(formattedStack);
|
|
2053
|
-
const functionNameToRscFrames = buildFunctionNameToRscFramesMap(fiber);
|
|
2054
|
-
const functionNameToUsageIndex = /* @__PURE__ */ new Map();
|
|
2055
|
-
for (const frame of stackFrames) {
|
|
2056
|
-
const maybeEnriched = frame.isServer ? enrichServerFrame(frame, functionNameToRscFrames, functionNameToUsageIndex) : frame;
|
|
2057
|
-
if (!maybeEnriched.fileName) continue;
|
|
2058
|
-
const normalizedFileName = normalizeStackFileName(maybeEnriched.fileName);
|
|
2059
|
-
if (!normalizedFileName) continue;
|
|
2060
|
-
if (isSourceStackFile(normalizedFileName)) {
|
|
2061
|
-
return {
|
|
2062
|
-
fileName: normalizedFileName,
|
|
2063
|
-
lineNumber: maybeEnriched.lineNumber,
|
|
2064
|
-
columnNumber: maybeEnriched.columnNumber
|
|
2065
|
-
};
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
return null;
|
|
2069
|
-
}
|
|
2070
|
-
function getSourceFromFiber2(fiber) {
|
|
2071
|
-
const debugSource = fiber?._debugSource;
|
|
2072
|
-
if (debugSource?.fileName) return debugSource;
|
|
2073
|
-
const owner = fiber?._debugOwner;
|
|
2074
|
-
const ownerPending = owner?.pendingProps?.__source;
|
|
2075
|
-
if (ownerPending?.fileName) return ownerPending;
|
|
2076
|
-
const ownerMemo = owner?.memoizedProps?.__source;
|
|
2077
|
-
if (ownerMemo?.fileName) return ownerMemo;
|
|
2078
|
-
const pending = fiber?.pendingProps?.__source;
|
|
2079
|
-
if (pending?.fileName) return pending;
|
|
2080
|
-
const memo = fiber?.memoizedProps?.__source;
|
|
2081
|
-
if (memo?.fileName) return memo;
|
|
2082
|
-
const fromDebugStack = getSourceFromDebugStack(fiber);
|
|
2083
|
-
if (fromDebugStack?.fileName) return fromDebugStack;
|
|
2084
|
-
return null;
|
|
2085
|
-
}
|
|
2086
|
-
function buildFrame2(fiber) {
|
|
2087
|
-
const type = fiber?.type;
|
|
2088
|
-
if (typeof type !== "function" && typeof type !== "object") return null;
|
|
2089
|
-
const name = type?.displayName || type?.name || null;
|
|
2090
|
-
if (!name || name === "Fragment") return null;
|
|
2091
|
-
const frame = { name };
|
|
2092
|
-
const source = getSourceFromFiber2(fiber);
|
|
2093
|
-
if (source?.fileName) {
|
|
2094
|
-
frame.file = source.fileName;
|
|
2095
|
-
if (typeof source.lineNumber === "number") {
|
|
2096
|
-
frame.line = source.lineNumber;
|
|
2097
|
-
}
|
|
2098
|
-
if (typeof source.columnNumber === "number") {
|
|
2099
|
-
frame.column = source.columnNumber;
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
2102
|
-
return frame;
|
|
2103
|
-
}
|
|
2104
|
-
function shouldIncludeFrame2(frame, lastFrame) {
|
|
2105
|
-
if (!lastFrame) return true;
|
|
2106
|
-
if (frame.name !== lastFrame.name) return true;
|
|
2107
|
-
if (!lastFrame.file && frame.file) return true;
|
|
2108
|
-
if (lastFrame.file && frame.file && lastFrame.line == null && frame.line != null) return true;
|
|
2109
|
-
if (lastFrame.file && frame.file && lastFrame.line != null && frame.line != null && lastFrame.column == null && frame.column != null) {
|
|
2110
|
-
return true;
|
|
2111
|
-
}
|
|
2112
|
-
return false;
|
|
2113
|
-
}
|
|
2114
|
-
function getOwnerStack2(fiber) {
|
|
2115
|
-
const frames = [];
|
|
2116
|
-
let current = fiber;
|
|
2117
|
-
let lastFrame = null;
|
|
2118
|
-
let nearestComponentFiber = null;
|
|
2119
|
-
while (current) {
|
|
2120
|
-
const frame = buildFrame2(current);
|
|
2121
|
-
if (frame && shouldIncludeFrame2(frame, lastFrame)) {
|
|
2122
|
-
frames.push(frame);
|
|
2123
|
-
lastFrame = frame;
|
|
2124
|
-
if (!nearestComponentFiber) {
|
|
2125
|
-
nearestComponentFiber = current;
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
current = current._debugOwner;
|
|
2129
|
-
}
|
|
2130
|
-
return { frames, nearestComponentFiber };
|
|
2131
|
-
}
|
|
2132
|
-
function getRenderStack2(fiber) {
|
|
2133
|
-
const frames = [];
|
|
2134
|
-
let current = fiber;
|
|
2135
|
-
let lastFrame = null;
|
|
2136
|
-
let nearestComponentFiber = null;
|
|
2137
|
-
while (current) {
|
|
2138
|
-
const frame = buildFrame2(current);
|
|
2139
|
-
if (frame && shouldIncludeFrame2(frame, lastFrame)) {
|
|
2140
|
-
frames.push(frame);
|
|
2141
|
-
lastFrame = frame;
|
|
2142
|
-
if (!nearestComponentFiber) {
|
|
2143
|
-
nearestComponentFiber = current;
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
current = current.return;
|
|
2147
|
-
}
|
|
2148
|
-
return { frames, nearestComponentFiber };
|
|
2149
|
-
}
|
|
2150
|
-
function getReactComponentInfo2(element) {
|
|
2151
|
-
const fiber = getFiberForElement2(element);
|
|
2152
|
-
if (!fiber) return { frames: [], nearestComponentFiber: null };
|
|
2153
|
-
const elementSource = getSourceFromFiber2(fiber);
|
|
2154
|
-
const elementSourceFile = elementSource?.fileName || void 0;
|
|
2155
|
-
const ownerResult = getOwnerStack2(fiber);
|
|
2156
|
-
if (ownerResult.frames.length > 0) {
|
|
2157
|
-
return { ...ownerResult, elementSourceFile };
|
|
2158
|
-
}
|
|
2159
|
-
return { ...getRenderStack2(fiber), elementSourceFile };
|
|
2160
|
-
}
|
|
2161
2060
|
function getElementDisplayName(element) {
|
|
2162
2061
|
const tag = element.tagName.toLowerCase();
|
|
2163
2062
|
if (element.id) return `${tag}#${element.id}`;
|
|
@@ -2476,10 +2375,10 @@ function getElementSource(element) {
|
|
|
2476
2375
|
const domSource = parseDomSource(element);
|
|
2477
2376
|
if (domSource) return domSource;
|
|
2478
2377
|
const seenFibers = /* @__PURE__ */ new Set();
|
|
2479
|
-
let fiber =
|
|
2378
|
+
let fiber = getFiberForElement(element);
|
|
2480
2379
|
while (fiber && !seenFibers.has(fiber)) {
|
|
2481
2380
|
seenFibers.add(fiber);
|
|
2482
|
-
const fiberSource =
|
|
2381
|
+
const fiberSource = getSourceFromFiber(fiber);
|
|
2483
2382
|
if (fiberSource?.fileName) {
|
|
2484
2383
|
return {
|
|
2485
2384
|
file: fiberSource.fileName,
|
|
@@ -2494,7 +2393,7 @@ function getElementSource(element) {
|
|
|
2494
2393
|
function getElementLocator(element) {
|
|
2495
2394
|
const elementInfo = getElementInfo(element);
|
|
2496
2395
|
const domSource = getElementSource(element);
|
|
2497
|
-
const { frames, nearestComponentFiber, elementSourceFile } =
|
|
2396
|
+
const { frames, nearestComponentFiber, elementSourceFile } = getReactComponentInfo(element);
|
|
2498
2397
|
const componentName = nearestComponentFiber?.type?.displayName || nearestComponentFiber?.type?.name || void 0;
|
|
2499
2398
|
const authoredProps = nearestComponentFiber ? getComponentProps(nearestComponentFiber) : void 0;
|
|
2500
2399
|
const classification = classifyComponentFiber(nearestComponentFiber, frames, elementSourceFile);
|