@impakers/debug 1.3.9 → 1.3.11
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/react.js +25 -13
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +25 -13
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1388,6 +1388,8 @@ function parseComponentFrame(stack) {
|
|
|
1388
1388
|
/source-location/,
|
|
1389
1389
|
/\/dist\/index\./,
|
|
1390
1390
|
// Our bundled output (dist/index.mjs, dist/index.js)
|
|
1391
|
+
/\/dist\/react\./,
|
|
1392
|
+
// Our React bundled output
|
|
1391
1393
|
/node_modules\//,
|
|
1392
1394
|
// Any package in node_modules (dev mode)
|
|
1393
1395
|
/react-dom/,
|
|
@@ -1402,26 +1404,24 @@ function parseComponentFrame(stack) {
|
|
|
1402
1404
|
];
|
|
1403
1405
|
const v8Re = /^\s*at\s+(?:.*?\s+\()?(.+?):(\d+):(\d+)\)?$/;
|
|
1404
1406
|
const webkitRe = /^[^@]*@(.+?):(\d+):(\d+)$/;
|
|
1405
|
-
let
|
|
1407
|
+
let validCount = 0;
|
|
1406
1408
|
for (const line of lines) {
|
|
1407
1409
|
const trimmed = line.trim();
|
|
1408
1410
|
if (!trimmed) continue;
|
|
1409
|
-
if (skipPatterns.some((p) => p.test(trimmed)))
|
|
1410
|
-
if (/at <anonymous>:/.test(trimmed) && lastValid) {
|
|
1411
|
-
return lastValid;
|
|
1412
|
-
}
|
|
1413
|
-
continue;
|
|
1414
|
-
}
|
|
1411
|
+
if (skipPatterns.some((p) => p.test(trimmed))) continue;
|
|
1415
1412
|
const match = v8Re.exec(trimmed) || webkitRe.exec(trimmed);
|
|
1416
1413
|
if (match) {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1414
|
+
validCount++;
|
|
1415
|
+
if (validCount >= 3) {
|
|
1416
|
+
return {
|
|
1417
|
+
fileName: match[1],
|
|
1418
|
+
line: parseInt(match[2], 10),
|
|
1419
|
+
column: parseInt(match[3], 10)
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
1422
|
}
|
|
1423
1423
|
}
|
|
1424
|
-
return
|
|
1424
|
+
return null;
|
|
1425
1425
|
}
|
|
1426
1426
|
function cleanSourcePath(rawPath) {
|
|
1427
1427
|
let path = rawPath;
|
|
@@ -1446,6 +1446,9 @@ function probeComponentSource(fiber) {
|
|
|
1446
1446
|
}
|
|
1447
1447
|
const dispatcher = getReactDispatcher();
|
|
1448
1448
|
if (!dispatcher) {
|
|
1449
|
+
if (typeof window !== "undefined" && window.__IMPAKERS_DEBUG_LOG) {
|
|
1450
|
+
console.log("[impakers-debug] dispatcher not found, skipping probe");
|
|
1451
|
+
}
|
|
1449
1452
|
sourceProbeCache.set(fn, null);
|
|
1450
1453
|
return null;
|
|
1451
1454
|
}
|
|
@@ -1465,7 +1468,13 @@ function probeComponentSource(fiber) {
|
|
|
1465
1468
|
fn({});
|
|
1466
1469
|
} catch (e) {
|
|
1467
1470
|
if (e instanceof Error && e.stack) {
|
|
1471
|
+
if (typeof window !== "undefined" && window.__IMPAKERS_DEBUG_LOG) {
|
|
1472
|
+
console.log("[impakers-debug] probe stack:", e.stack);
|
|
1473
|
+
}
|
|
1468
1474
|
const frame = parseComponentFrame(e.stack);
|
|
1475
|
+
if (typeof window !== "undefined" && window.__IMPAKERS_DEBUG_LOG) {
|
|
1476
|
+
console.log("[impakers-debug] parsed frame:", frame);
|
|
1477
|
+
}
|
|
1469
1478
|
if (frame) {
|
|
1470
1479
|
const cleaned = cleanSourcePath(frame.fileName);
|
|
1471
1480
|
result = {
|
|
@@ -1522,6 +1531,9 @@ function getSourceLocation(element) {
|
|
|
1522
1531
|
};
|
|
1523
1532
|
}
|
|
1524
1533
|
const probed = probeSourceWalk(fiber);
|
|
1534
|
+
if (typeof window !== "undefined" && window.__IMPAKERS_DEBUG_LOG) {
|
|
1535
|
+
console.log("[impakers-debug] probe result:", probed);
|
|
1536
|
+
}
|
|
1525
1537
|
if (probed) {
|
|
1526
1538
|
return { found: true, source: probed, isReactApp: true, isProduction: false };
|
|
1527
1539
|
}
|