@impakers/debug 1.4.3 → 1.4.4
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 +74 -24
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +74 -24
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1484,15 +1484,20 @@ function probeComponentSource(fiber) {
|
|
|
1484
1484
|
return result;
|
|
1485
1485
|
}
|
|
1486
1486
|
function probeSourceWalk(fiber, maxDepth = 15) {
|
|
1487
|
+
const results = [];
|
|
1488
|
+
const seenFileNames = /* @__PURE__ */ new Set();
|
|
1487
1489
|
let current = fiber;
|
|
1488
1490
|
let depth = 0;
|
|
1489
1491
|
while (current && depth < maxDepth) {
|
|
1490
1492
|
const source = probeComponentSource(current);
|
|
1491
|
-
if (source
|
|
1493
|
+
if (source && !seenFileNames.has(source.fileName)) {
|
|
1494
|
+
seenFileNames.add(source.fileName);
|
|
1495
|
+
results.push(source);
|
|
1496
|
+
}
|
|
1492
1497
|
current = current.return;
|
|
1493
1498
|
depth++;
|
|
1494
1499
|
}
|
|
1495
|
-
return
|
|
1500
|
+
return results;
|
|
1496
1501
|
}
|
|
1497
1502
|
function getSourceLocation(element) {
|
|
1498
1503
|
const fiber = getFiberFromElement2(element);
|
|
@@ -1521,9 +1526,15 @@ function getSourceLocation(element) {
|
|
|
1521
1526
|
isProduction: false
|
|
1522
1527
|
};
|
|
1523
1528
|
}
|
|
1524
|
-
const
|
|
1525
|
-
if (
|
|
1526
|
-
return {
|
|
1529
|
+
const probedList = probeSourceWalk(fiber);
|
|
1530
|
+
if (probedList.length > 0) {
|
|
1531
|
+
return {
|
|
1532
|
+
found: true,
|
|
1533
|
+
source: probedList[0],
|
|
1534
|
+
sourceCandidates: probedList,
|
|
1535
|
+
isReactApp: true,
|
|
1536
|
+
isProduction: false
|
|
1537
|
+
};
|
|
1527
1538
|
}
|
|
1528
1539
|
return {
|
|
1529
1540
|
found: false,
|
|
@@ -2430,7 +2441,18 @@ function CommentThread({
|
|
|
2430
2441
|
useCORS: true,
|
|
2431
2442
|
allowTaint: true,
|
|
2432
2443
|
scale: Math.min(window.devicePixelRatio, 2),
|
|
2433
|
-
logging: false
|
|
2444
|
+
logging: false,
|
|
2445
|
+
onclone: (clonedDoc) => {
|
|
2446
|
+
const unsupported = /oklab|oklch|color-mix|(?<![a-z])lch|(?<![a-z])lab/i;
|
|
2447
|
+
clonedDoc.querySelectorAll("style").forEach((styleEl) => {
|
|
2448
|
+
if (unsupported.test(styleEl.textContent || "")) {
|
|
2449
|
+
styleEl.textContent = (styleEl.textContent || "").replace(
|
|
2450
|
+
/[^{};\n]+:\s*[^;{}]*(?:oklab|oklch|color-mix|lch|lab)\([^)]*(?:\([^)]*\))*[^)]*\)[^;{}]*/gi,
|
|
2451
|
+
""
|
|
2452
|
+
);
|
|
2453
|
+
}
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2434
2456
|
});
|
|
2435
2457
|
const base64 = canvas.toDataURL("image/jpeg", 0.7);
|
|
2436
2458
|
setPendingImage(base64);
|
|
@@ -3359,6 +3381,17 @@ function detectSourceFile(element) {
|
|
|
3359
3381
|
}
|
|
3360
3382
|
return void 0;
|
|
3361
3383
|
}
|
|
3384
|
+
function detectSourceFileCandidates(element) {
|
|
3385
|
+
const result = getSourceLocation(element);
|
|
3386
|
+
const loc = result.found ? result : findNearestComponentSource(element);
|
|
3387
|
+
if (loc.found && loc.sourceCandidates && loc.sourceCandidates.length > 0) {
|
|
3388
|
+
return loc.sourceCandidates.map((s) => formatSourceLocation(s, "path"));
|
|
3389
|
+
}
|
|
3390
|
+
if (loc.found && loc.source) {
|
|
3391
|
+
return [formatSourceLocation(loc.source, "path")];
|
|
3392
|
+
}
|
|
3393
|
+
return [];
|
|
3394
|
+
}
|
|
3362
3395
|
var STORAGE_PREFIX = "impakers-debug-markers-";
|
|
3363
3396
|
function getRouteKey() {
|
|
3364
3397
|
return STORAGE_PREFIX + window.location.pathname;
|
|
@@ -3631,20 +3664,27 @@ function DebugWidget({ endpoint, getUser, onHide }) {
|
|
|
3631
3664
|
targetElement: elementUnder
|
|
3632
3665
|
});
|
|
3633
3666
|
setHoverInfo(null);
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3667
|
+
const candidates = detectSourceFileCandidates(elementUnder);
|
|
3668
|
+
const chunkCandidates = candidates.filter((c) => c.includes("/chunks/"));
|
|
3669
|
+
if (chunkCandidates.length > 0) {
|
|
3670
|
+
(async () => {
|
|
3671
|
+
for (const candidate of chunkCandidates) {
|
|
3672
|
+
try {
|
|
3673
|
+
const resolved = await resolveSourceString(candidate);
|
|
3674
|
+
if (resolved) {
|
|
3675
|
+
setPendingAnnotation(
|
|
3676
|
+
(prev) => prev ? {
|
|
3677
|
+
...prev,
|
|
3678
|
+
resolvedSource: `${resolved.source}:${resolved.line}`,
|
|
3679
|
+
resolvedName: resolved.name ?? void 0
|
|
3680
|
+
} : prev
|
|
3681
|
+
);
|
|
3682
|
+
break;
|
|
3683
|
+
}
|
|
3684
|
+
} catch {
|
|
3685
|
+
}
|
|
3645
3686
|
}
|
|
3646
|
-
})
|
|
3647
|
-
});
|
|
3687
|
+
})();
|
|
3648
3688
|
}
|
|
3649
3689
|
};
|
|
3650
3690
|
document.addEventListener("click", handleClick, true);
|
|
@@ -3669,19 +3709,29 @@ function DebugWidget({ endpoint, getUser, onHide }) {
|
|
|
3669
3709
|
useCORS: true,
|
|
3670
3710
|
allowTaint: true,
|
|
3671
3711
|
scale: 1,
|
|
3672
|
-
// 1x로 줄여서 용량 절약
|
|
3673
3712
|
logging: false,
|
|
3674
3713
|
width: window.innerWidth,
|
|
3675
|
-
height: window.innerHeight
|
|
3714
|
+
height: window.innerHeight,
|
|
3715
|
+
onclone: (clonedDoc) => {
|
|
3716
|
+
const unsupported = /oklab|oklch|color-mix|(?<![a-z])lch|(?<![a-z])lab/i;
|
|
3717
|
+
clonedDoc.querySelectorAll("style").forEach((styleEl) => {
|
|
3718
|
+
if (unsupported.test(styleEl.textContent || "")) {
|
|
3719
|
+
styleEl.textContent = (styleEl.textContent || "").replace(
|
|
3720
|
+
/[^{};\n]+:\s*[^;{}]*(?:oklab|oklch|color-mix|lch|lab)\([^)]*(?:\([^)]*\))*[^)]*\)[^;{}]*/gi,
|
|
3721
|
+
""
|
|
3722
|
+
);
|
|
3723
|
+
}
|
|
3724
|
+
});
|
|
3725
|
+
}
|
|
3676
3726
|
});
|
|
3677
3727
|
screenshot = canvas.toDataURL("image/jpeg", 0.5);
|
|
3678
3728
|
} catch {
|
|
3679
3729
|
} finally {
|
|
3680
3730
|
debugEls.forEach((el) => el.style.visibility = "");
|
|
3681
3731
|
}
|
|
3682
|
-
let resolvedSource = pendingAnnotation.sourceFile || "";
|
|
3683
|
-
let resolvedName = null;
|
|
3684
|
-
if (pendingAnnotation.sourceFile?.includes("/chunks/")) {
|
|
3732
|
+
let resolvedSource = pendingAnnotation.resolvedSource || pendingAnnotation.sourceFile || "";
|
|
3733
|
+
let resolvedName = pendingAnnotation.resolvedName || null;
|
|
3734
|
+
if (!pendingAnnotation.resolvedSource && pendingAnnotation.sourceFile?.includes("/chunks/")) {
|
|
3685
3735
|
try {
|
|
3686
3736
|
const resolved = await resolveSourceString(pendingAnnotation.sourceFile);
|
|
3687
3737
|
if (resolved) {
|