Cleanup React Devtools port attempt
No files matched your search
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 288 B |
|
Before Width: | Height: | Size: 313 B |
|
Before Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 288 B |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 561 B |
|
Before Width: | Height: | Size: 561 B |
|
Before Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 550 B |
|
Before Width: | Height: | Size: 474 B |
|
Before Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 561 B |
|
Before Width: | Height: | Size: 826 B |
|
Before Width: | Height: | Size: 826 B |
|
Before Width: | Height: | Size: 730 B |
|
Before Width: | Height: | Size: 787 B |
|
Before Width: | Height: | Size: 714 B |
|
Before Width: | Height: | Size: 730 B |
|
Before Width: | Height: | Size: 826 B |
@@ -1 +0,0 @@
|
||||
<svg id="Development" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><defs><style>.cls-1{fill:#d94a38;}.cls-2{fill:#fff;}.cls-3{fill:#231f20;}.cls-4{font-size:12px;font-family:MyriadPro-Regular, Myriad Pro;}</style></defs><title>development</title><g id="Background"><rect class="cls-1" width="1024" height="1024" rx="96" ry="96"/></g><g id="Rings"><g id="Ring-2" data-name="Ring"><path class="cls-2" d="M959,509c0-62-74-117-189-150,27-115,17-207-37-238s-139,6-224,88c-86-81-171-118-224-87s-64,123-36,239C135,394,61,449,61,511s74,117,189,150c-27,115-17,207,37,238s139-6,224-88c86,81,171,118,224,87s64-123,36-239C885,626,959,571,959,509ZM713,157c40,23,45,97,21,193a900,900,0,0,0-121-19,900,900,0,0,0-78-94C606,166,673,133,713,157ZM635,583c-14,24-28,47-43,69-27,2-54,3-83,3l-81-3c-15-22-30-46-44-70s-27-48-38-72c12-24,24-49,39-73s28-47,43-69c27-2,54-3,83-3l81,3c15,22,30,46,44,70s27,48,38,72C662,534,649,558,635,583Zm60-27c11,26,21,52,29,77-25,6-52,10-81,14l26-44ZM511,757c-17-19-35-40-52-63H563C546,716,528,738,511,757ZM378,647c-29-3-56-8-81-13,8-25,17-50,28-77l25,45ZM325,464c-11-26-21-52-29-77,25-6,52-10,81-14l-26,44ZM509,263c17,19,35,40,52,63H457C474,304,492,282,509,263ZM670,418l-28-45c29,3,56,8,81,13-8,25-17,50-28,77ZM305,158c40-23,106,9,177,78a900,900,0,0,0-77,95,900,900,0,0,0-120,20C260,255,265,181,305,158ZM102,511c0-46,61-88,156-114a900,900,0,0,0,44,114,900,900,0,0,0-43,114C164,599,102,558,102,511ZM307,863c-40-23-45-97-21-193a900,900,0,0,0,121,19,900,900,0,0,0,78,94C414,854,347,887,307,863Zm408-1c-40,23-106-9-177-78a900,900,0,0,0,77-95,900,900,0,0,0,120-20C760,765,755,839,715,862Zm46-239a900,900,0,0,0-44-114,900,900,0,0,0,43-114c96,26,157,67,157,114S856,597,761,623Z"/></g></g><g id="Ring_Blockers" data-name="Ring Blockers"><circle class="cls-1" cx="417" cy="672" r="45"/><circle class="cls-1" cx="699" cy="513" r="45"/><circle class="cls-1" cx="797" cy="634" r="45"/><circle class="cls-1" cx="479" cy="818" r="45"/><g id="Layer_14" data-name="Layer 14"><rect class="cls-1" x="420" y="621" width="377" height="188"/><rect class="cls-1" x="500" y="530" width="312" height="405"/></g></g><g id="Bug"><g id="Legs"><path class="cls-3" d="M702,496a17,17,0,0,0-21,13l-19,78,34,8,19-78A17,17,0,0,0,702,496Z"/><text class="cls-4" transform="translate(512 512)">780</text><text class="cls-4" transform="translate(512 512)">780</text><path class="cls-3" d="M813,626a17,17,0,0,0-23-9l-73,32,14,32,73-32A17,17,0,0,0,813,626Z"/><path class="cls-3" d="M834,756l-77-20-9,34,77,20a18,18,0,0,0,9-34Z"/><path class="cls-3" d="M425,656a17,17,0,1,0-10,33l76,23,10-33Z"/><path class="cls-3" d="M532,756l-64,48a18,18,0,1,0,21,28l64-48Z"/><path class="cls-3" d="M584,836l-21,77a17,17,0,1,0,34,9l21-77Z"/></g><g id="Body"><path class="cls-3" d="M762,690h0l-51-92h0A125,125,0,0,0,492,721h0l51,92h0A125,125,0,0,0,762,690Z"/></g><g id="Line"><path class="cls-1" d="M613,649h0a17,17,0,0,0-30,18h0L711,887l30-18Z"/></g><g id="Head_Ring" data-name="Head Ring"><circle class="cls-1" cx="511" cy="509" r="113"/></g><g id="Head"><circle class="cls-3" cx="512" cy="512" r="80"/></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 3.0 KiB |
@@ -1 +0,0 @@
|
||||
<svg id="Development" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><defs><style>.cls-1{fill:#d94a38;}.cls-2{fill:#fff;}.cls-3{fill:#231f20;}.cls-4{font-size:12px;font-family:MyriadPro-Regular, Myriad Pro;}</style></defs><title>development</title><g id="Background"><rect class="cls-1" width="1024" height="1024" rx="96" ry="96"/></g><g id="Rings"><g id="Ring-2" data-name="Ring"><path class="cls-2" d="M959,509c0-62-74-117-189-150,27-115,17-207-37-238s-139,6-224,88c-86-81-171-118-224-87s-64,123-36,239C135,394,61,449,61,511s74,117,189,150c-27,115-17,207,37,238s139-6,224-88c86,81,171,118,224,87s64-123,36-239C885,626,959,571,959,509ZM713,157c40,23,45,97,21,193a900,900,0,0,0-121-19,900,900,0,0,0-78-94C606,166,673,133,713,157ZM635,583c-14,24-28,47-43,69-27,2-54,3-83,3l-81-3c-15-22-30-46-44-70s-27-48-38-72c12-24,24-49,39-73s28-47,43-69c27-2,54-3,83-3l81,3c15,22,30,46,44,70s27,48,38,72C662,534,649,558,635,583Zm60-27c11,26,21,52,29,77-25,6-52,10-81,14l26-44ZM511,757c-17-19-35-40-52-63H563C546,716,528,738,511,757ZM378,647c-29-3-56-8-81-13,8-25,17-50,28-77l25,45ZM325,464c-11-26-21-52-29-77,25-6,52-10,81-14l-26,44ZM509,263c17,19,35,40,52,63H457C474,304,492,282,509,263ZM670,418l-28-45c29,3,56,8,81,13-8,25-17,50-28,77ZM305,158c40-23,106,9,177,78a900,900,0,0,0-77,95,900,900,0,0,0-120,20C260,255,265,181,305,158ZM102,511c0-46,61-88,156-114a900,900,0,0,0,44,114,900,900,0,0,0-43,114C164,599,102,558,102,511ZM307,863c-40-23-45-97-21-193a900,900,0,0,0,121,19,900,900,0,0,0,78,94C414,854,347,887,307,863Zm408-1c-40,23-106-9-177-78a900,900,0,0,0,77-95,900,900,0,0,0,120-20C760,765,755,839,715,862Zm46-239a900,900,0,0,0-44-114,900,900,0,0,0,43-114c96,26,157,67,157,114S856,597,761,623Z"/></g></g><g id="Ring_Blockers" data-name="Ring Blockers"><circle class="cls-1" cx="417" cy="672" r="45"/><circle class="cls-1" cx="699" cy="513" r="45"/><circle class="cls-1" cx="797" cy="634" r="45"/><circle class="cls-1" cx="479" cy="818" r="45"/><g id="Layer_14" data-name="Layer 14"><rect class="cls-1" x="420" y="621" width="377" height="188"/><rect class="cls-1" x="500" y="530" width="312" height="405"/></g></g><g id="Bug"><g id="Legs"><path class="cls-3" d="M702,496a17,17,0,0,0-21,13l-19,78,34,8,19-78A17,17,0,0,0,702,496Z"/><text class="cls-4" transform="translate(512 512)">780</text><text class="cls-4" transform="translate(512 512)">780</text><path class="cls-3" d="M813,626a17,17,0,0,0-23-9l-73,32,14,32,73-32A17,17,0,0,0,813,626Z"/><path class="cls-3" d="M834,756l-77-20-9,34,77,20a18,18,0,0,0,9-34Z"/><path class="cls-3" d="M425,656a17,17,0,1,0-10,33l76,23,10-33Z"/><path class="cls-3" d="M532,756l-64,48a18,18,0,1,0,21,28l64-48Z"/><path class="cls-3" d="M584,836l-21,77a17,17,0,1,0,34,9l21-77Z"/></g><g id="Body"><path class="cls-3" d="M762,690h0l-51-92h0A125,125,0,0,0,492,721h0l51,92h0A125,125,0,0,0,762,690Z"/></g><g id="Line"><path class="cls-1" d="M613,649h0a17,17,0,0,0-30,18h0L711,887l30-18Z"/></g><g id="Head_Ring" data-name="Head Ring"><circle class="cls-1" cx="511" cy="509" r="113"/></g><g id="Head"><circle class="cls-3" cx="512" cy="512" r="80"/></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 3.0 KiB |
@@ -1 +0,0 @@
|
||||
<svg id="Disabled" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><defs><style>.cls-1{fill:#aaa;}.cls-2{fill:#fff;}</style></defs><title>disabled</title><g id="Background"><rect class="cls-1" width="1024" height="1024" rx="96" ry="96"/></g><g id="Rings"><path class="cls-2" d="M959,509c0-62-74-117-189-150,27-115,17-207-37-238s-139,6-224,88c-86-81-171-118-224-87s-64,123-36,239C135,394,61,449,61,511s74,117,189,150c-27,115-17,207,37,238s139-6,224-88c86,81,171,118,224,87s64-123,36-239C885,626,959,571,959,509ZM713,157c40,23,45,97,21,193a900,900,0,0,0-121-19,900,900,0,0,0-78-94C606,166,673,133,713,157ZM635,583c-14,24-28,47-43,69-27,2-54,3-83,3l-81-3c-15-22-30-46-44-70s-27-48-38-72c12-24,24-49,39-73s28-47,43-69c27-2,54-3,83-3l81,3c15,22,30,46,44,70s27,48,38,72C662,534,649,558,635,583Zm60-27c11,26,21,52,29,77-25,6-52,10-81,14l26-44ZM511,757c-17-19-35-40-52-63H563C546,716,528,738,511,757ZM378,647c-29-3-56-8-81-13,8-25,17-50,28-77l25,45ZM325,464c-11-26-21-52-29-77,25-6,52-10,81-14l-26,44ZM509,263c17,19,35,40,52,63H457C474,304,492,282,509,263ZM670,418l-28-45c29,3,56,8,81,13-8,25-17,50-28,77ZM305,158c40-23,106,9,177,78a900,900,0,0,0-77,95,900,900,0,0,0-120,20C260,255,265,181,305,158ZM102,511c0-46,61-88,156-114a900,900,0,0,0,44,114,900,900,0,0,0-43,114C164,599,102,558,102,511ZM307,863c-40-23-45-97-21-193a900,900,0,0,0,121,19,900,900,0,0,0,78,94C414,854,347,887,307,863Zm408-1c-40,23-106-9-177-78a900,900,0,0,0,77-95,900,900,0,0,0,120-20C760,765,755,839,715,862Zm46-239a900,900,0,0,0-44-114,900,900,0,0,0,43-114c96,26,157,67,157,114S856,597,761,623Z"/></g><g id="Circle"><circle class="cls-2" cx="510" cy="510" r="80"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1 +0,0 @@
|
||||
<svg id="Outdated" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><defs><style>.cls-1{fill:#202020;}.cls-2{fill:#fff;}.cls-3{fill:#f9f453;}</style></defs><title>outdated</title><g id="Background"><rect class="cls-1" width="1024" height="1024" rx="96" ry="96"/></g><g id="Rings"><path class="cls-2" d="M510,325C261,325,60,408,60,510S261,695,510,695s450-83,450-185S759,325,510,325Zm0,330c-225,0-407-65-407-145S285,365,510,365s408,65,408,145S735,655,510,655Z"/><path class="cls-2" d="M670,417C546,202,373,69,285,120s-59,267,65,482S647,951,735,900,794,633,670,417ZM384,583C272,388,237,197,306,157s217,86,329,280,148,385,78,425S497,777,384,583Z"/><g id="BLOCKER"><rect class="cls-1" x="564" y="572" width="315" height="397.12" transform="translate(652 -283) rotate(39)"/><rect class="cls-1" x="685" y="369" width="283" height="360.81" transform="translate(255 -262) rotate(21)"/></g><path class="cls-2" d="M670,603c124-215,153-431,65-482S474,202,350,417,197,849,285,900,546,818,670,603ZM384,437C497,243,644,117,714,157s34,231-78,425S376,903,306,863,272,632,384,437Z"/></g><g id="Circle"><circle class="cls-2" cx="512" cy="512" r="80"/></g><g id="Shield"><path class="cls-3" d="M960,887a24,24,0,0,0-5-15h0L807,605h0v-2h0a25,25,0,0,0-43,3h0L613,876h0a24,24,0,0,0-3,11,25,25,0,0,0,24,25H936A25,25,0,0,0,960,887ZM810,848a15,15,0,0,1-15,15H775a15,15,0,0,1-15-15V828a15,15,0,0,1,15-15h20a15,15,0,0,1,15,15Zm0-74a15,15,0,0,1-15,15H775a15,15,0,0,1-15-15V705a15,15,0,0,1,15-15h20a15,15,0,0,1,15,15Z"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -1 +0,0 @@
|
||||
<svg id="Production" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><defs><style>.cls-1{fill:#202020;}.cls-2{fill:#59c9f1;}</style></defs><title>production</title><g id="Background"><rect class="cls-1" width="1024" height="1024" rx="96" ry="96"/></g><g id="Rings"><path class="cls-2" d="M959,509c0-62-74-117-189-150,27-115,17-207-37-238s-139,6-224,88c-86-81-171-118-224-87s-64,123-36,239C135,394,61,449,61,511s74,117,189,150c-27,115-17,207,37,238s139-6,224-88c86,81,171,118,224,87s64-123,36-239C885,626,959,571,959,509ZM713,157c40,23,45,97,21,193a900,900,0,0,0-121-19,900,900,0,0,0-78-94C606,166,673,133,713,157ZM635,583c-14,24-28,47-43,69-27,2-54,3-83,3l-81-3c-15-22-30-46-44-70s-27-48-38-72c12-24,24-49,39-73s28-47,43-69c27-2,54-3,83-3l81,3c15,22,30,46,44,70s27,48,38,72C662,534,649,558,635,583Zm60-27c11,26,21,52,29,77-25,6-52,10-81,14l26-44ZM511,757c-17-19-35-40-52-63H563C546,716,528,738,511,757ZM378,647c-29-3-56-8-81-13,8-25,17-50,28-77l25,45ZM325,464c-11-26-21-52-29-77,25-6,52-10,81-14l-26,44ZM509,263c17,19,35,40,52,63H457C474,304,492,282,509,263ZM670,418l-28-45c29,3,56,8,81,13-8,25-17,50-28,77ZM305,158c40-23,106,9,177,78a900,900,0,0,0-77,95,900,900,0,0,0-120,20C260,255,265,181,305,158ZM102,511c0-46,61-88,156-114a900,900,0,0,0,44,114,900,900,0,0,0-43,114C164,599,102,558,102,511ZM307,863c-40-23-45-97-21-193a900,900,0,0,0,121,19,900,900,0,0,0,78,94C414,854,347,887,307,863Zm408-1c-40,23-106-9-177-78a900,900,0,0,0,77-95,900,900,0,0,0,120-20C760,765,755,839,715,862Zm46-239a900,900,0,0,0-44-114,900,900,0,0,0,43-114c96,26,157,67,157,114S856,597,761,623Z"/></g><g id="Circle"><circle class="cls-2" cx="510" cy="510" r="80"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1 +0,0 @@
|
||||
<svg id="Disabled" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><defs><style>.cls-1{fill:#aaa;}.cls-2{fill:#fff;}</style></defs><title>disabled</title><g id="Background"><rect class="cls-1" width="1024" height="1024" rx="96" ry="96"/></g><g id="Rings"><path class="cls-2" d="M959,509c0-62-74-117-189-150,27-115,17-207-37-238s-139,6-224,88c-86-81-171-118-224-87s-64,123-36,239C135,394,61,449,61,511s74,117,189,150c-27,115-17,207,37,238s139-6,224-88c86,81,171,118,224,87s64-123,36-239C885,626,959,571,959,509ZM713,157c40,23,45,97,21,193a900,900,0,0,0-121-19,900,900,0,0,0-78-94C606,166,673,133,713,157ZM635,583c-14,24-28,47-43,69-27,2-54,3-83,3l-81-3c-15-22-30-46-44-70s-27-48-38-72c12-24,24-49,39-73s28-47,43-69c27-2,54-3,83-3l81,3c15,22,30,46,44,70s27,48,38,72C662,534,649,558,635,583Zm60-27c11,26,21,52,29,77-25,6-52,10-81,14l26-44ZM511,757c-17-19-35-40-52-63H563C546,716,528,738,511,757ZM378,647c-29-3-56-8-81-13,8-25,17-50,28-77l25,45ZM325,464c-11-26-21-52-29-77,25-6,52-10,81-14l-26,44ZM509,263c17,19,35,40,52,63H457C474,304,492,282,509,263ZM670,418l-28-45c29,3,56,8,81,13-8,25-17,50-28,77ZM305,158c40-23,106,9,177,78a900,900,0,0,0-77,95,900,900,0,0,0-120,20C260,255,265,181,305,158ZM102,511c0-46,61-88,156-114a900,900,0,0,0,44,114,900,900,0,0,0-43,114C164,599,102,558,102,511ZM307,863c-40-23-45-97-21-193a900,900,0,0,0,121,19,900,900,0,0,0,78,94C414,854,347,887,307,863Zm408-1c-40,23-106-9-177-78a900,900,0,0,0,77-95,900,900,0,0,0,120-20C760,765,755,839,715,862Zm46-239a900,900,0,0,0-44-114,900,900,0,0,0,43-114c96,26,157,67,157,114S856,597,761,623Z"/></g><g id="Circle"><circle class="cls-2" cx="510" cy="510" r="80"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1,9 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script src="./build/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,65 +0,0 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "React Developer Tools",
|
||||
"description": "Adds React debugging tools to the Chrome Developer Tools.\n\nCreated from revision b9cfa0d308 on 5/5/2025.",
|
||||
"version": "6.1.1",
|
||||
"version_name": "6.1.1 (5/5/2025)",
|
||||
"minimum_chrome_version": "102",
|
||||
"icons": {
|
||||
"16": "icons/16-production.png",
|
||||
"32": "icons/32-production.png",
|
||||
"48": "icons/48-production.png",
|
||||
"128": "icons/128-production.png"
|
||||
},
|
||||
"action": {
|
||||
"default_icon": {
|
||||
"16": "icons/16-disabled.png",
|
||||
"32": "icons/32-disabled.png",
|
||||
"48": "icons/48-disabled.png",
|
||||
"128": "icons/128-disabled.png"
|
||||
},
|
||||
"default_popup": "popups/disabled.html"
|
||||
},
|
||||
"devtools_page": "main.html",
|
||||
"content_security_policy": {
|
||||
"extension_pages": "script-src 'self'; object-src 'self'"
|
||||
},
|
||||
"web_accessible_resources": [
|
||||
{
|
||||
"resources": [
|
||||
"main.html",
|
||||
"panel.html",
|
||||
"build/*.js"
|
||||
],
|
||||
"matches": [
|
||||
"<all_urls>"
|
||||
],
|
||||
"extension_ids": []
|
||||
}
|
||||
],
|
||||
"background": {
|
||||
"service_worker": "build/background.js"
|
||||
},
|
||||
"permissions": [
|
||||
"scripting",
|
||||
"storage",
|
||||
"tabs"
|
||||
],
|
||||
"optional_permissions": [
|
||||
"clipboardWrite"
|
||||
],
|
||||
"host_permissions": [
|
||||
"<all_urls>"
|
||||
],
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"<all_urls>"
|
||||
],
|
||||
"js": [
|
||||
"build/prepareInjection.js"
|
||||
],
|
||||
"run_at": "document_start"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
<!doctype html>
|
||||
<html style="display: flex">
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<style>
|
||||
html {
|
||||
display: flex;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
}
|
||||
#container {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.no-react-disclaimer {
|
||||
margin: 16px;
|
||||
font-family: Courier, monospace, serif;
|
||||
font-size: 16px;
|
||||
animation: fadeIn .5s ease-in-out forwards;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
@supports (-moz-appearance:none) {
|
||||
:root {
|
||||
background: black;
|
||||
}
|
||||
|
||||
body {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- main react mount point -->
|
||||
<div id="container">
|
||||
<h1 class="no-react-disclaimer">Looks like this page doesn't have React, or it hasn't been loaded yet.</h1>
|
||||
</div>
|
||||
<script src="./build/panel.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<script src="shared.js"></script>
|
||||
<link rel="stylesheet" href="shared.css" />
|
||||
<style>
|
||||
html, body {
|
||||
min-width: 460px;
|
||||
min-height: 133px;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
<b>This page includes an extra development build of React. 🚧</b>
|
||||
</p>
|
||||
<p>
|
||||
The React build on this page includes both development and production versions because dead code elimination has not been applied correctly.
|
||||
<br />
|
||||
<br />
|
||||
This makes its size larger, and causes React to run slower.
|
||||
<br />
|
||||
<br />
|
||||
Make sure to <a href="https://reactjs.org/docs/optimizing-performance.html#use-the-production-build">set up dead code elimination</a> before deployment.
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
Open the developer tools, and "Components" and "Profiler" tabs will appear to the right.
|
||||
</p>
|
||||
@@ -1,24 +0,0 @@
|
||||
<script src="shared.js"></script>
|
||||
<link rel="stylesheet" href="shared.css" />
|
||||
<style>
|
||||
html, body {
|
||||
min-width: 460px;
|
||||
min-height: 101px;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
<b>This page is using the development build of React. 🚧</b>
|
||||
</p>
|
||||
<p>
|
||||
Note that the development build is not suitable for production.
|
||||
<br />
|
||||
Make sure to <a href="https://reactjs.org/docs/optimizing-performance.html#use-the-production-build">use the production build</a> before deployment.
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
Open the developer tools, and "Components" and "Profiler" tabs will appear to the right.
|
||||
</p>
|
||||
@@ -1,17 +0,0 @@
|
||||
<script src="shared.js"></script>
|
||||
<link rel="stylesheet" href="shared.css" />
|
||||
<style>
|
||||
html, body {
|
||||
min-width: 410px;
|
||||
min-height: 33px;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
<b>This page doesn’t appear to be using React.</b>
|
||||
<br />
|
||||
If this seems wrong, follow the <a href="https://github.com/facebook/react/tree/main/packages/react-devtools#the-react-tab-doesnt-show-up">troubleshooting instructions</a>.
|
||||
</p>
|
||||
@@ -1,25 +0,0 @@
|
||||
<script src="shared.js"></script>
|
||||
<link rel="stylesheet" href="shared.css" />
|
||||
<style>
|
||||
html, body {
|
||||
min-width: 460px;
|
||||
min-height: 117px;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
<b>This page is using an outdated version of React. ⌛</b>
|
||||
</p>
|
||||
<p>
|
||||
We recommend updating React to ensure that you receive important bugfixes and performance improvements.
|
||||
<br />
|
||||
<br />
|
||||
You can find the upgrade instructions on the <a href="https://reactjs.org/blog/">React blog</a>.
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
Open the developer tools, and "Components" and "Profiler" tabs will appear to the right.
|
||||
</p>
|
||||
@@ -1,17 +0,0 @@
|
||||
<script src="shared.js"></script>
|
||||
<link rel="stylesheet" href="shared.css" />
|
||||
<style>
|
||||
html, body {
|
||||
min-width: 460px;
|
||||
min-height: 39px;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
<b>This page is using the production build of React. ✅</b>
|
||||
<br />
|
||||
Open the developer tools, and "Components" and "Profiler" tabs will appear to the right.
|
||||
</p>
|
||||
@@ -1,14 +0,0 @@
|
||||
<script src="shared.js"></script>
|
||||
<link rel="stylesheet" href="shared.css" />
|
||||
<style>
|
||||
html, body {
|
||||
min-width: 286px;
|
||||
min-height: 33px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<p>
|
||||
<b>This is a restricted browser page.</b>
|
||||
<br />
|
||||
React devtools cannot access this page.
|
||||
</p>
|
||||
@@ -1,23 +0,0 @@
|
||||
html, body {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
@supports (-moz-appearance:none) {
|
||||
:root {
|
||||
background: black;
|
||||
}
|
||||
|
||||
body {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/* globals chrome */
|
||||
|
||||
'use strict';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Make links work
|
||||
const links = document.getElementsByTagName('a');
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
(function () {
|
||||
const ln = links[i];
|
||||
const location = ln.href;
|
||||
ln.onclick = function () {
|
||||
chrome.tabs.create({active: true, url: location});
|
||||
return false;
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
// Work around https://bugs.chromium.org/p/chromium/issues/detail?id=428044
|
||||
document.body.style.opacity = 0;
|
||||
document.body.style.transition = 'opacity ease-out .4s';
|
||||
requestAnimationFrame(function () {
|
||||
document.body.style.opacity = 1;
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
<script src="shared.js"></script>
|
||||
<style>
|
||||
html, body {
|
||||
font-size: 14px;
|
||||
min-width: 460px;
|
||||
min-height: 133px;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<p>
|
||||
<b>This page is using an unminified build of React. 🚧</b>
|
||||
</p>
|
||||
<p>
|
||||
The React build on this page appears to be unminified.
|
||||
<br />
|
||||
This makes its size larger, and causes React to run slower.
|
||||
<br />
|
||||
<br />
|
||||
Make sure to <a href="https://reactjs.org/docs/optimizing-performance.html#use-the-production-build">set up minification</a> before deployment.
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
Open the developer tools, and "Components" and "Profiler" tabs will appear to the right.
|
||||
</p>
|
||||
@@ -1,318 +0,0 @@
|
||||
import {generateComponentTree} from './reactDevTools';
|
||||
import {Fiber} from './reactDevToolsTypes';
|
||||
|
||||
/**
|
||||
* Interface representing a node in the component tree
|
||||
*/
|
||||
export interface ComponentTreeNode {
|
||||
id: number;
|
||||
name: string;
|
||||
type: string | number;
|
||||
key: string | null;
|
||||
children: ComponentTreeNode[];
|
||||
props?: Record<string, any> | undefined;
|
||||
state?: Record<string, any> | undefined;
|
||||
fiber?: Fiber | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the component tree from the React DevTools implementation
|
||||
* @param renderer The React renderer
|
||||
* @param fiber The root fiber to start from
|
||||
* @returns The component tree as a structured object
|
||||
*/
|
||||
export function extractComponentTree(
|
||||
renderer: any,
|
||||
fiber: Fiber,
|
||||
): ComponentTreeNode | null {
|
||||
const result = generateComponentTree(renderer, fiber, false);
|
||||
|
||||
const idToDevToolsInstanceMap = (result as any).idToDevToolsInstanceMap;
|
||||
const currentRoot = (result as any).currentRoot;
|
||||
|
||||
if (!currentRoot || !idToDevToolsInstanceMap) {
|
||||
console.error(
|
||||
'Failed to extract component tree - internal structures not available',
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return convertDevToolsInstanceToTreeNode(currentRoot);
|
||||
|
||||
/**
|
||||
* Helper function to convert a DevTools instance to our tree node format
|
||||
*/
|
||||
function convertDevToolsInstanceToTreeNode(instance: any): ComponentTreeNode {
|
||||
// Extract name based on instance kind
|
||||
let name = 'Unknown';
|
||||
let type: string | number = 'Unknown';
|
||||
let key: string | null = null;
|
||||
let props: Record<string, any> | undefined = undefined;
|
||||
let state: Record<string, any> | undefined = undefined;
|
||||
let fiberData: Fiber | undefined = undefined;
|
||||
|
||||
if (instance.kind === 0) {
|
||||
// FIBER_INSTANCE
|
||||
const fiber = instance.data;
|
||||
fiberData = fiber;
|
||||
|
||||
// @ts-ignore - Accessing private function
|
||||
const getDisplayNameForFiber = (result as any).getDisplayNameForFiber;
|
||||
if (typeof getDisplayNameForFiber === 'function') {
|
||||
name = getDisplayNameForFiber(fiber) || 'Unknown';
|
||||
} else {
|
||||
// Fallback to type name if available
|
||||
name =
|
||||
fiber.type?.displayName ||
|
||||
fiber.type?.name ||
|
||||
(typeof fiber.type === 'string' ? fiber.type : 'Unknown');
|
||||
}
|
||||
|
||||
// Get element type
|
||||
// @ts-ignore - Accessing private function
|
||||
const getElementTypeForFiber = (result as any).getElementTypeForFiber;
|
||||
if (typeof getElementTypeForFiber === 'function') {
|
||||
type = getElementTypeForFiber(fiber);
|
||||
}
|
||||
|
||||
// Get key
|
||||
key = fiber.key !== null ? String(fiber.key) : null;
|
||||
|
||||
// Get props and state if available
|
||||
if (fiber.memoizedProps) {
|
||||
props = {...fiber.memoizedProps};
|
||||
}
|
||||
|
||||
if (fiber.memoizedState) {
|
||||
// For hooks, this might be complex, so we'll just indicate it exists
|
||||
state =
|
||||
typeof fiber.memoizedState === 'object'
|
||||
? {...fiber.memoizedState}
|
||||
: {value: fiber.memoizedState};
|
||||
}
|
||||
} else if (instance.kind === 1) {
|
||||
// VIRTUAL_INSTANCE
|
||||
name = instance.data.name || 'Virtual';
|
||||
type = 'Virtual';
|
||||
key = instance.data.key != null ? String(instance.data.key) : null;
|
||||
|
||||
// Add environment if it exists
|
||||
if (instance.data.env) {
|
||||
props = {env: instance.data.env};
|
||||
}
|
||||
} else if (instance.kind === 2) {
|
||||
// FILTERED_FIBER_INSTANCE
|
||||
name = 'Filtered';
|
||||
type = 'Filtered';
|
||||
}
|
||||
|
||||
// Create the node
|
||||
const node: ComponentTreeNode = {
|
||||
id: instance.id,
|
||||
name,
|
||||
type,
|
||||
key,
|
||||
children: [],
|
||||
props,
|
||||
state: state,
|
||||
fiber: fiberData,
|
||||
};
|
||||
|
||||
// Add children recursively
|
||||
let child = instance.firstChild;
|
||||
while (child) {
|
||||
node.children.push(convertDevToolsInstanceToTreeNode(child));
|
||||
child = child.nextSibling;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the component tree as a string
|
||||
* @param tree The component tree to format
|
||||
* @param options Options for formatting
|
||||
* @returns A formatted string representation of the component tree
|
||||
*/
|
||||
export function formatComponentTree(
|
||||
tree: ComponentTreeNode | null,
|
||||
options: {
|
||||
maxDepth?: number;
|
||||
showIds?: boolean;
|
||||
showProps?: boolean;
|
||||
showState?: boolean;
|
||||
} = {},
|
||||
): string {
|
||||
if (!tree) {
|
||||
return 'No component tree available';
|
||||
}
|
||||
|
||||
const {
|
||||
maxDepth = Infinity,
|
||||
showIds = true,
|
||||
showProps = false,
|
||||
showState = false,
|
||||
} = options;
|
||||
|
||||
const lines: string[] = ['React Component Tree:'];
|
||||
|
||||
function formatNode(node: ComponentTreeNode, depth: number = 0) {
|
||||
if (depth > maxDepth) return;
|
||||
|
||||
const indent = ' '.repeat(depth);
|
||||
let output = `${indent}${node.name}`;
|
||||
|
||||
if (node.key) {
|
||||
output += ` key="${node.key}"`;
|
||||
}
|
||||
|
||||
if (showIds) {
|
||||
output += ` (id: ${node.id})`;
|
||||
}
|
||||
|
||||
lines.push(output);
|
||||
|
||||
// Format props if requested
|
||||
if (showProps && node.props) {
|
||||
const propsStr = JSON.stringify(node.props, null, 2)
|
||||
.split('\n')
|
||||
.map(line => `${indent} ${line}`)
|
||||
.join('\n');
|
||||
lines.push(`${indent} Props: ${propsStr}`);
|
||||
}
|
||||
|
||||
// Format state if requested
|
||||
if (showState && node.state) {
|
||||
const stateStr = JSON.stringify(node.state, null, 2)
|
||||
.split('\n')
|
||||
.map(line => `${indent} ${line}`)
|
||||
.join('\n');
|
||||
lines.push(`${indent} State: ${stateStr}`);
|
||||
}
|
||||
|
||||
// Format children recursively
|
||||
for (const child of node.children) {
|
||||
formatNode(child, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
formatNode(tree);
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the component tree to the console
|
||||
* @param tree The component tree to print
|
||||
* @param options Options for printing
|
||||
*/
|
||||
export function printExtractedComponentTree(
|
||||
tree: ComponentTreeNode | null,
|
||||
options: {
|
||||
maxDepth?: number;
|
||||
showIds?: boolean;
|
||||
showProps?: boolean;
|
||||
showState?: boolean;
|
||||
} = {},
|
||||
) {
|
||||
const formattedTree = formatComponentTree(tree, options);
|
||||
console.log(formattedTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to extract and format the component tree in one step
|
||||
* @param renderer The React renderer
|
||||
* @param fiber The root fiber
|
||||
* @param options Options for formatting
|
||||
* @returns An object containing the tree and its formatted string representation
|
||||
*/
|
||||
export function extractAndFormatComponentTree(
|
||||
renderer: any,
|
||||
fiber: Fiber,
|
||||
options: {
|
||||
maxDepth?: number;
|
||||
showIds?: boolean;
|
||||
showProps?: boolean;
|
||||
showState?: boolean;
|
||||
} = {},
|
||||
) {
|
||||
const tree = extractComponentTree(renderer, fiber);
|
||||
const formattedTree = formatComponentTree(tree, options);
|
||||
return {
|
||||
tree,
|
||||
formattedTree,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to extract and print the component tree in one step
|
||||
* @param renderer The React renderer
|
||||
* @param fiber The root fiber
|
||||
* @param options Options for printing
|
||||
* @returns The extracted component tree
|
||||
*/
|
||||
export function extractAndPrintComponentTree(
|
||||
renderer: any,
|
||||
fiber: Fiber,
|
||||
options: {
|
||||
maxDepth?: number;
|
||||
showIds?: boolean;
|
||||
showProps?: boolean;
|
||||
showState?: boolean;
|
||||
} = {},
|
||||
) {
|
||||
const {tree, formattedTree} = extractAndFormatComponentTree(
|
||||
renderer,
|
||||
fiber,
|
||||
options,
|
||||
);
|
||||
console.log(formattedTree);
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to extract the component tree from the React DevTools hook
|
||||
* @param options Options for formatting
|
||||
* @returns An object containing the tree and its formatted string representation, or null if extraction fails
|
||||
*/
|
||||
export default function extractComponentTreeFromDevTools(
|
||||
hook: any,
|
||||
renderers: Map<number, any>,
|
||||
fiberRoots: Map<number, any>,
|
||||
) {
|
||||
if (!hook) {
|
||||
console.error(
|
||||
'React DevTools hook is not available. Make sure React DevTools extension is installed.',
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
console.log('test');
|
||||
console.log(renderers.size);
|
||||
|
||||
if (renderers.size === 0) {
|
||||
console.error('No React renderers found.');
|
||||
return null;
|
||||
}
|
||||
|
||||
for (const [rendererID, renderer] of renderers) {
|
||||
const fiberRoots: any = Array.from(hook.getFiberRoots(rendererID));
|
||||
if (fiberRoots.length === 0) {
|
||||
console.error('No fiber roots found.');
|
||||
return null;
|
||||
}
|
||||
|
||||
const currentFiber = fiberRoots[0].current;
|
||||
|
||||
const options: any = {
|
||||
maxDepth: 3,
|
||||
showIds: true,
|
||||
showProps: true,
|
||||
showState: true,
|
||||
};
|
||||
|
||||
return extractAndFormatComponentTree(renderer, currentFiber, options);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Flip this flag to true to enable verbose console debug logging.
|
||||
export const __DEBUG__ = false;
|
||||
|
||||
// Tree operation constants
|
||||
export const TREE_OPERATION_ADD = 1;
|
||||
export const TREE_OPERATION_REMOVE = 2;
|
||||
export const TREE_OPERATION_REORDER_CHILDREN = 3;
|
||||
export const TREE_OPERATION_UPDATE_TREE_BASE_DURATION = 4;
|
||||
export const TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS = 5;
|
||||
export const TREE_OPERATION_REMOVE_ROOT = 6;
|
||||
export const TREE_OPERATION_SET_SUBTREE_MODE = 7;
|
||||
|
||||
// Profiling constants
|
||||
export const PROFILING_FLAG_BASIC_SUPPORT = 0b01;
|
||||
export const PROFILING_FLAG_TIMELINE_SUPPORT = 0b10;
|
||||
@@ -1,32 +0,0 @@
|
||||
export const MEMO_NUMBER = 0xead3;
|
||||
export const MEMO_SYMBOL_STRING = 'Symbol(react.memo)';
|
||||
export const FORWARD_REF_NUMBER = 0xead0;
|
||||
export const FORWARD_REF_SYMBOL_STRING = 'Symbol(react.forward_ref)';
|
||||
|
||||
export const REACT_MEMO_CACHE_SENTINEL: symbol = Symbol.for(
|
||||
'react.memo_cache_sentinel',
|
||||
);
|
||||
|
||||
export const CONCURRENT_MODE_NUMBER = 0xeacf;
|
||||
export const CONCURRENT_MODE_SYMBOL_STRING = 'Symbol(react.concurrent_mode)';
|
||||
|
||||
export const CONTEXT_NUMBER = 0xeace;
|
||||
export const CONTEXT_SYMBOL_STRING = 'Symbol(react.context)';
|
||||
|
||||
export const SERVER_CONTEXT_SYMBOL_STRING = 'Symbol(react.server_context)';
|
||||
|
||||
export const DEPRECATED_ASYNC_MODE_SYMBOL_STRING = 'Symbol(react.async_mode)';
|
||||
|
||||
export const PROVIDER_NUMBER = 0xeacd;
|
||||
export const PROVIDER_SYMBOL_STRING = 'Symbol(react.provider)';
|
||||
|
||||
export const CONSUMER_SYMBOL_STRING = 'Symbol(react.consumer)';
|
||||
|
||||
export const STRICT_MODE_NUMBER = 0xeacc;
|
||||
export const STRICT_MODE_SYMBOL_STRING = 'Symbol(react.strict_mode)';
|
||||
|
||||
export const PROFILER_NUMBER = 0xead2;
|
||||
export const PROFILER_SYMBOL_STRING = 'Symbol(react.profiler)';
|
||||
|
||||
export const SCOPE_NUMBER = 0xead7;
|
||||
export const SCOPE_SYMBOL_STRING = 'Symbol(react.scope)';
|
||||
@@ -1,305 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Types migrated from shared/ReactTypes.js
|
||||
export type ReactCallSite = [
|
||||
string, // function name
|
||||
string, // file name
|
||||
number, // line number
|
||||
number, // column number
|
||||
];
|
||||
|
||||
export type ReactStackTrace = Array<ReactCallSite>;
|
||||
|
||||
export type ReactComponentInfo = {
|
||||
name: string;
|
||||
env?: string;
|
||||
key?: null | string;
|
||||
owner?: null | ReactComponentInfo;
|
||||
stack?: null | ReactStackTrace;
|
||||
props?: null | {[name: string]: any};
|
||||
// Stashed Data for the Specific Execution Environment. Not part of the transport protocol
|
||||
debugStack?: null | Error;
|
||||
debugTask?: null | any;
|
||||
};
|
||||
|
||||
export type ReactDebugInfo = Array<
|
||||
ReactComponentInfo | any // Simplified from the original which included other types
|
||||
>;
|
||||
|
||||
// Types migrated from react-reconciler/src/ReactInternalTypes.js
|
||||
export type WorkTag = number;
|
||||
export type Lanes = number;
|
||||
export type Lane = number;
|
||||
export type TypeOfMode = number;
|
||||
export type Flags = number;
|
||||
|
||||
// Migrated from react-devtools-shared/src/backend/types.js
|
||||
export type WorkTagMap = {
|
||||
CacheComponent: WorkTag;
|
||||
ClassComponent: WorkTag;
|
||||
ContextConsumer: WorkTag;
|
||||
ContextProvider: WorkTag;
|
||||
CoroutineComponent: WorkTag;
|
||||
CoroutineHandlerPhase: WorkTag;
|
||||
DehydratedSuspenseComponent: WorkTag;
|
||||
ForwardRef: WorkTag;
|
||||
Fragment: WorkTag;
|
||||
FunctionComponent: WorkTag;
|
||||
HostComponent: WorkTag;
|
||||
HostPortal: WorkTag;
|
||||
HostRoot: WorkTag;
|
||||
HostHoistable: WorkTag;
|
||||
HostSingleton: WorkTag;
|
||||
HostText: WorkTag;
|
||||
IncompleteClassComponent: WorkTag;
|
||||
IncompleteFunctionComponent: WorkTag;
|
||||
IndeterminateComponent: WorkTag;
|
||||
LazyComponent: WorkTag;
|
||||
LegacyHiddenComponent: WorkTag;
|
||||
MemoComponent: WorkTag;
|
||||
Mode: WorkTag;
|
||||
OffscreenComponent: WorkTag;
|
||||
Profiler: WorkTag;
|
||||
ScopeComponent: WorkTag;
|
||||
SimpleMemoComponent: WorkTag;
|
||||
SuspenseComponent: WorkTag;
|
||||
SuspenseListComponent: WorkTag;
|
||||
TracingMarkerComponent: WorkTag;
|
||||
YieldComponent: WorkTag;
|
||||
Throw: WorkTag;
|
||||
ViewTransitionComponent: WorkTag;
|
||||
ActivityComponent: WorkTag;
|
||||
};
|
||||
|
||||
// Dependencies for Fiber
|
||||
export type Dependencies = {
|
||||
lanes: Lanes;
|
||||
firstContext: any | null;
|
||||
};
|
||||
|
||||
// A simplified version of the Fiber type from react-reconciler/src/ReactInternalTypes.js
|
||||
export type Fiber = {
|
||||
// Tag identifying the type of fiber.
|
||||
tag: WorkTag;
|
||||
// Unique identifier of this child.
|
||||
key: null | string;
|
||||
// The value of element.type which is used to preserve the identity during
|
||||
// reconciliation of this child.
|
||||
elementType: any;
|
||||
// The resolved function/class/ associated with this fiber.
|
||||
type: any;
|
||||
// The local state associated with this fiber.
|
||||
stateNode: any;
|
||||
// Remaining fields belong to Fiber
|
||||
// The Fiber to return to after finishing processing this one.
|
||||
return: Fiber | null;
|
||||
// Singly Linked List Tree Structure.
|
||||
child: Fiber | null;
|
||||
sibling: Fiber | null;
|
||||
index: number;
|
||||
// The ref last used to attach this node.
|
||||
ref: any;
|
||||
refCleanup: null | (() => void);
|
||||
// Input is the data coming into process this fiber. Arguments. Props.
|
||||
pendingProps: any;
|
||||
memoizedProps: any;
|
||||
// A queue of state updates and callbacks.
|
||||
updateQueue: any;
|
||||
// The state used to create the output
|
||||
memoizedState: any;
|
||||
// Dependencies (contexts, events) for this fiber, if it has any
|
||||
dependencies: Dependencies | null;
|
||||
// Bitfield that describes properties about the fiber and its subtree.
|
||||
mode: TypeOfMode;
|
||||
// Effect
|
||||
flags: Flags;
|
||||
subtreeFlags: Flags;
|
||||
deletions: Array<Fiber> | null;
|
||||
lanes: Lanes;
|
||||
childLanes: Lanes;
|
||||
// This is a pooled version of a Fiber. Every fiber that gets updated will
|
||||
// eventually have a pair. There are cases when we can clean up pairs to save
|
||||
// memory if we need to.
|
||||
alternate: Fiber | null;
|
||||
// Time spent rendering this Fiber and its descendants for the current update.
|
||||
actualDuration?: number;
|
||||
// If the Fiber is currently active in the "render" phase,
|
||||
// This marks the time at which the work began.
|
||||
actualStartTime?: number;
|
||||
// Duration of the most recent render time for this Fiber.
|
||||
selfBaseDuration?: number;
|
||||
// Sum of base times for all descendants of this Fiber.
|
||||
treeBaseDuration?: number;
|
||||
// DEV only fields
|
||||
_debugInfo?: ReactDebugInfo | null;
|
||||
_debugOwner?: ReactComponentInfo | Fiber | null;
|
||||
_debugStack?: string | Error | null;
|
||||
_debugTask?: any | null;
|
||||
_debugNeedsRemount?: boolean;
|
||||
_debugHookTypes?: Array<string> | null;
|
||||
};
|
||||
|
||||
// A simplified version of the FiberRoot type from react-reconciler/src/ReactInternalTypes.js
|
||||
export type FiberRoot = {
|
||||
// The type of root (legacy, batched, concurrent, etc.)
|
||||
tag: number;
|
||||
// Any additional information from the host associated with this root.
|
||||
containerInfo: any;
|
||||
// Used only by persistent updates.
|
||||
pendingChildren: any;
|
||||
// The currently active root fiber. This is the mutable root of the tree.
|
||||
current: Fiber;
|
||||
// A linked list of all roots that have pending work scheduled on them.
|
||||
next: FiberRoot | null;
|
||||
// Other fields omitted for simplicity
|
||||
};
|
||||
|
||||
// Types migrated from react-devtools-shared/src/backend/types.js
|
||||
export type BundleType = 0 | 1; // 0 = PROD, 1 = DEV
|
||||
|
||||
export type HostInstance = any;
|
||||
|
||||
export type Source = {
|
||||
fileName: string;
|
||||
lineNumber: number;
|
||||
columnNumber?: number;
|
||||
};
|
||||
|
||||
export type ReactRenderer = {
|
||||
version: string;
|
||||
rendererPackageName: string;
|
||||
bundleType: BundleType;
|
||||
// 16.0+ - To be removed in future versions.
|
||||
findFiberByHostInstance?: (hostInstance: HostInstance) => any | null;
|
||||
// 16.9+
|
||||
overrideHookState?: (
|
||||
fiber: any,
|
||||
id: number,
|
||||
path: Array<string | number>,
|
||||
value: any,
|
||||
) => void;
|
||||
// 17+
|
||||
overrideHookStateDeletePath?: (
|
||||
fiber: any,
|
||||
id: number,
|
||||
path: Array<string | number>,
|
||||
) => void;
|
||||
// 17+
|
||||
overrideHookStateRenamePath?: (
|
||||
fiber: any,
|
||||
id: number,
|
||||
oldPath: Array<string | number>,
|
||||
newPath: Array<string | number>,
|
||||
) => void;
|
||||
// 16.7+
|
||||
overrideProps?: (
|
||||
fiber: any,
|
||||
path: Array<string | number>,
|
||||
value: any,
|
||||
) => void;
|
||||
// 17+
|
||||
overridePropsDeletePath?: (fiber: any, path: Array<string | number>) => void;
|
||||
// 17+
|
||||
overridePropsRenamePath?: (
|
||||
fiber: any,
|
||||
oldPath: Array<string | number>,
|
||||
newPath: Array<string | number>,
|
||||
) => void;
|
||||
// 16.9+
|
||||
scheduleUpdate?: (fiber: any) => void;
|
||||
setSuspenseHandler?: (shouldSuspend: (fiber: any) => boolean) => void;
|
||||
// Only injected by React v16.8+ in order to support hooks inspection.
|
||||
currentDispatcherRef?: any;
|
||||
// Only injected by React v16.9+ in DEV mode.
|
||||
// Enables DevTools to append owners-only component stack to error messages.
|
||||
getCurrentFiber?: (() => any | null) | null;
|
||||
// Only injected by React Flight Clients in DEV mode.
|
||||
// Enables DevTools to append owners-only component stack to error messages from Server Components.
|
||||
getCurrentComponentInfo?: () => any | null;
|
||||
// 17.0.2+
|
||||
reconcilerVersion?: string;
|
||||
// Uniquely identifies React DOM v15.
|
||||
ComponentTree?: any;
|
||||
// Present for React DOM v12 (possibly earlier) through v15.
|
||||
Mount?: any;
|
||||
// Only injected by React v17.0.3+ in DEV mode
|
||||
setErrorHandler?: (shouldError: (fiber: any) => boolean | undefined) => void;
|
||||
// Intentionally opaque type to avoid coupling DevTools to different Fast Refresh versions.
|
||||
scheduleRefresh?: Function;
|
||||
// 18.0+
|
||||
injectProfilingHooks?: (profilingHooks: any) => void;
|
||||
getLaneLabelMap?: () => Map<number, string> | null;
|
||||
};
|
||||
|
||||
export type ChangeDescription = {
|
||||
context: Array<string> | boolean | null;
|
||||
didHooksChange: boolean;
|
||||
isFirstMount: boolean;
|
||||
props: Array<string> | null;
|
||||
state: Array<string> | null;
|
||||
hooks?: Array<number> | null;
|
||||
};
|
||||
|
||||
export type PathFrame = {
|
||||
key: string | null;
|
||||
index: number;
|
||||
displayName: string | null;
|
||||
};
|
||||
|
||||
export type SerializedElement = {
|
||||
displayName: string | null;
|
||||
id: number;
|
||||
key: number | string | null;
|
||||
type: ElementType;
|
||||
};
|
||||
|
||||
// WARNING
|
||||
// The values below are referenced by ComponentFilters (which are saved via localStorage).
|
||||
// Do not change them or it will break previously saved user customizations.
|
||||
// If new element types are added, use new numbers rather than re-ordering existing ones.
|
||||
//
|
||||
// Changing these types is also a backwards breaking change for the standalone shell,
|
||||
// since the frontend and backend must share the same values-
|
||||
// and the backend is embedded in certain environments (like React Native).
|
||||
export const ElementTypeClass = 1;
|
||||
export const ElementTypeContext = 2;
|
||||
export const ElementTypeFunction = 5;
|
||||
export const ElementTypeForwardRef = 6;
|
||||
export const ElementTypeHostComponent = 7;
|
||||
export const ElementTypeMemo = 8;
|
||||
export const ElementTypeOtherOrUnknown = 9;
|
||||
export const ElementTypeProfiler = 10;
|
||||
export const ElementTypeRoot = 11;
|
||||
export const ElementTypeSuspense = 12;
|
||||
export const ElementTypeSuspenseList = 13;
|
||||
export const ElementTypeTracingMarker = 14;
|
||||
export const ElementTypeVirtual = 15;
|
||||
export const ElementTypeViewTransition = 16;
|
||||
export const ElementTypeActivity = 17;
|
||||
|
||||
// Different types of elements displayed in the Elements tree.
|
||||
// These types may be used to visually distinguish types,
|
||||
// or to enable/disable certain functionality.
|
||||
export type ElementType =
|
||||
| 1
|
||||
| 2
|
||||
| 5
|
||||
| 6
|
||||
| 7
|
||||
| 8
|
||||
| 9
|
||||
| 10
|
||||
| 11
|
||||
| 12
|
||||
| 13
|
||||
| 14
|
||||
| 15
|
||||
| 16
|
||||
| 17;
|
||||
|
||||
export const StrictMode = 1;
|
||||
@@ -1,608 +0,0 @@
|
||||
import {WorkTagMap} from './reactDevToolsTypes';
|
||||
import {compareVersions} from 'compare-versions';
|
||||
import {ReactComponentInfo} from './reactDevToolsTypes';
|
||||
|
||||
// Migrated from react-devtools-shared/src/backend/utils/index.js
|
||||
export function gt(a: string = '', b: string = ''): boolean {
|
||||
return compareVersions(a, b) === 1;
|
||||
}
|
||||
|
||||
export function gte(a: string = '', b: string = ''): boolean {
|
||||
return compareVersions(a, b) > -1;
|
||||
}
|
||||
|
||||
// Migrated from react-devtools-shared/src/utils.js
|
||||
const cachedDisplayNames: WeakMap<Function, string> = new WeakMap();
|
||||
|
||||
export function getWrappedDisplayName(
|
||||
outerType: any,
|
||||
innerType: any,
|
||||
wrapperName: string,
|
||||
fallbackName: string = 'Anonymous',
|
||||
): string {
|
||||
const displayName = outerType?.displayName;
|
||||
return (
|
||||
displayName || `${wrapperName}(${getDisplayName(innerType, fallbackName)})`
|
||||
);
|
||||
}
|
||||
|
||||
export function getDisplayName(
|
||||
type: any,
|
||||
fallbackName: string = 'Anonymous',
|
||||
): string {
|
||||
const nameFromCache = cachedDisplayNames.get(type);
|
||||
if (nameFromCache != null) {
|
||||
return nameFromCache;
|
||||
}
|
||||
|
||||
let displayName = fallbackName;
|
||||
|
||||
// The displayName property is not guaranteed to be a string.
|
||||
// It's only safe to use for our purposes if it's a string.
|
||||
if (typeof type.displayName === 'string') {
|
||||
displayName = type.displayName;
|
||||
} else if (typeof type.name === 'string' && type.name !== '') {
|
||||
displayName = type.name;
|
||||
}
|
||||
|
||||
cachedDisplayNames.set(type, displayName);
|
||||
return displayName;
|
||||
}
|
||||
|
||||
// Migrated from react-devtools-shared/src/backend/shared/DevToolsServerComponentLogs.js
|
||||
type ComponentLogs = {
|
||||
errors: Map<string, number>;
|
||||
errorsCount: number;
|
||||
warnings: Map<string, number>;
|
||||
warningsCount: number;
|
||||
};
|
||||
|
||||
// This keeps it around as long as the ComponentInfo is alive which
|
||||
// lets the Fiber get reparented/remounted and still observe the previous errors/warnings.
|
||||
// Unless we explicitly clear the logs from a Fiber.
|
||||
export const componentInfoToComponentLogsMap: WeakMap<
|
||||
ReactComponentInfo,
|
||||
ComponentLogs
|
||||
> = new WeakMap();
|
||||
|
||||
// Migrated from shared/objectIs.js
|
||||
/**
|
||||
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
||||
*/
|
||||
function isPolyfill(x: any, y: any) {
|
||||
return (
|
||||
(x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare
|
||||
);
|
||||
}
|
||||
|
||||
export const is: (x: any, y: any) => boolean =
|
||||
typeof Object.is === 'function' ? Object.is : isPolyfill;
|
||||
|
||||
// Migrated from shared/hasOwnProperty.js
|
||||
export const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
import {
|
||||
MEMO_NUMBER,
|
||||
MEMO_SYMBOL_STRING,
|
||||
FORWARD_REF_NUMBER,
|
||||
FORWARD_REF_SYMBOL_STRING,
|
||||
REACT_MEMO_CACHE_SENTINEL,
|
||||
CONCURRENT_MODE_NUMBER,
|
||||
CONCURRENT_MODE_SYMBOL_STRING,
|
||||
DEPRECATED_ASYNC_MODE_SYMBOL_STRING,
|
||||
PROVIDER_NUMBER,
|
||||
PROVIDER_SYMBOL_STRING,
|
||||
CONTEXT_NUMBER,
|
||||
CONTEXT_SYMBOL_STRING,
|
||||
SERVER_CONTEXT_SYMBOL_STRING,
|
||||
CONSUMER_SYMBOL_STRING,
|
||||
STRICT_MODE_NUMBER,
|
||||
STRICT_MODE_SYMBOL_STRING,
|
||||
PROFILER_NUMBER,
|
||||
PROFILER_SYMBOL_STRING,
|
||||
SCOPE_NUMBER,
|
||||
SCOPE_SYMBOL_STRING,
|
||||
} from './reactDevToolsSymbols';
|
||||
import {Fiber} from './reactDevToolsTypes';
|
||||
|
||||
// Migrated from react-devtools-shared/src/utils.js
|
||||
let uidCounter: number = 0;
|
||||
|
||||
export function getUID(): number {
|
||||
return ++uidCounter;
|
||||
}
|
||||
|
||||
export function utfEncodeString(string: string): Array<number> {
|
||||
const encoded = [];
|
||||
let i = 0;
|
||||
let charCode;
|
||||
while (i < string.length) {
|
||||
charCode = string.charCodeAt(i);
|
||||
// Handle multibyte unicode characters (like emoji).
|
||||
if ((charCode & 0xf800) === 0xd800) {
|
||||
encoded.push(surrogatePairToCodePoint(charCode, string.charCodeAt(++i)));
|
||||
} else {
|
||||
encoded.push(charCode);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return encoded;
|
||||
}
|
||||
|
||||
function surrogatePairToCodePoint(
|
||||
charCode1: number,
|
||||
charCode2: number,
|
||||
): number {
|
||||
return ((charCode1 & 0x3ff) << 10) + (charCode2 & 0x3ff) + 0x10000;
|
||||
}
|
||||
|
||||
// Migrated from react-reconciler/src/ReactFiberDevToolsHook.js
|
||||
export function injectProfilingHooks(profilingHooks: any): void {
|
||||
// This is a simplified version of the function from ReactFiberDevToolsHook.js
|
||||
// We're only implementing the bare minimum needed for the current use case
|
||||
}
|
||||
|
||||
type getDisplayNameForFiberType = (fiber: Fiber) => string | null;
|
||||
type getTypeSymbolType = (type: any) => symbol | string | number;
|
||||
|
||||
type ReactPriorityLevelsType = {
|
||||
ImmediatePriority: number;
|
||||
UserBlockingPriority: number;
|
||||
NormalPriority: number;
|
||||
LowPriority: number;
|
||||
IdlePriority: number;
|
||||
NoPriority: number;
|
||||
};
|
||||
|
||||
export function getInternalReactConstants(version: string): {
|
||||
getDisplayNameForFiber: getDisplayNameForFiberType;
|
||||
getTypeSymbol: getTypeSymbolType;
|
||||
ReactPriorityLevels: ReactPriorityLevelsType;
|
||||
ReactTypeOfWork: WorkTagMap;
|
||||
StrictModeBits: number;
|
||||
} {
|
||||
// **********************************************************
|
||||
// The section below is copied from files in React repo.
|
||||
// Keep it in sync, and add version guards if it changes.
|
||||
//
|
||||
// Technically these priority levels are invalid for versions before 16.9,
|
||||
// but 16.9 is the first version to report priority level to DevTools,
|
||||
// so we can avoid checking for earlier versions and support pre-16.9 canary releases in the process.
|
||||
let ReactPriorityLevels: ReactPriorityLevelsType = {
|
||||
ImmediatePriority: 99,
|
||||
UserBlockingPriority: 98,
|
||||
NormalPriority: 97,
|
||||
LowPriority: 96,
|
||||
IdlePriority: 95,
|
||||
NoPriority: 90,
|
||||
};
|
||||
|
||||
if (gt(version, '17.0.2')) {
|
||||
ReactPriorityLevels = {
|
||||
ImmediatePriority: 1,
|
||||
UserBlockingPriority: 2,
|
||||
NormalPriority: 3,
|
||||
LowPriority: 4,
|
||||
IdlePriority: 5,
|
||||
NoPriority: 0,
|
||||
};
|
||||
}
|
||||
|
||||
let StrictModeBits = 0;
|
||||
if (gte(version, '18.0.0-alpha')) {
|
||||
// 18+
|
||||
StrictModeBits = 0b011000;
|
||||
} else if (gte(version, '16.9.0')) {
|
||||
// 16.9 - 17
|
||||
StrictModeBits = 0b1;
|
||||
} else if (gte(version, '16.3.0')) {
|
||||
// 16.3 - 16.8
|
||||
StrictModeBits = 0b10;
|
||||
}
|
||||
|
||||
let ReactTypeOfWork: WorkTagMap = {} as WorkTagMap;
|
||||
|
||||
// **********************************************************
|
||||
// The section below is copied from files in React repo.
|
||||
// Keep it in sync, and add version guards if it changes.
|
||||
//
|
||||
// TODO Update the gt() check below to be gte() whichever the next version number is.
|
||||
// Currently the version in Git is 17.0.2 (but that version has not been/may not end up being released).
|
||||
if (gt(version, '17.0.1')) {
|
||||
ReactTypeOfWork = {
|
||||
CacheComponent: 24, // Experimental
|
||||
ClassComponent: 1,
|
||||
ContextConsumer: 9,
|
||||
ContextProvider: 10,
|
||||
CoroutineComponent: -1, // Removed
|
||||
CoroutineHandlerPhase: -1, // Removed
|
||||
DehydratedSuspenseComponent: 18, // Behind a flag
|
||||
ForwardRef: 11,
|
||||
Fragment: 7,
|
||||
FunctionComponent: 0,
|
||||
HostComponent: 5,
|
||||
HostPortal: 4,
|
||||
HostRoot: 3,
|
||||
HostHoistable: 26, // In reality, 18.2+. But doesn't hurt to include it here
|
||||
HostSingleton: 27, // Same as above
|
||||
HostText: 6,
|
||||
IncompleteClassComponent: 17,
|
||||
IncompleteFunctionComponent: 28,
|
||||
IndeterminateComponent: 2, // removed in 19.0.0
|
||||
LazyComponent: 16,
|
||||
LegacyHiddenComponent: 23,
|
||||
MemoComponent: 14,
|
||||
Mode: 8,
|
||||
OffscreenComponent: 22, // Experimental
|
||||
Profiler: 12,
|
||||
ScopeComponent: 21, // Experimental
|
||||
SimpleMemoComponent: 15,
|
||||
SuspenseComponent: 13,
|
||||
SuspenseListComponent: 19, // Experimental
|
||||
TracingMarkerComponent: 25, // Experimental - This is technically in 18 but we don't
|
||||
// want to fork again so we're adding it here instead
|
||||
YieldComponent: -1, // Removed
|
||||
Throw: 29,
|
||||
ViewTransitionComponent: 30, // Experimental
|
||||
ActivityComponent: 31,
|
||||
};
|
||||
} else if (gte(version, '17.0.0-alpha')) {
|
||||
ReactTypeOfWork = {
|
||||
CacheComponent: -1, // Doesn't exist yet
|
||||
ClassComponent: 1,
|
||||
ContextConsumer: 9,
|
||||
ContextProvider: 10,
|
||||
CoroutineComponent: -1, // Removed
|
||||
CoroutineHandlerPhase: -1, // Removed
|
||||
DehydratedSuspenseComponent: 18, // Behind a flag
|
||||
ForwardRef: 11,
|
||||
Fragment: 7,
|
||||
FunctionComponent: 0,
|
||||
HostComponent: 5,
|
||||
HostPortal: 4,
|
||||
HostRoot: 3,
|
||||
HostHoistable: -1, // Doesn't exist yet
|
||||
HostSingleton: -1, // Doesn't exist yet
|
||||
HostText: 6,
|
||||
IncompleteClassComponent: 17,
|
||||
IncompleteFunctionComponent: -1, // Doesn't exist yet
|
||||
IndeterminateComponent: 2,
|
||||
LazyComponent: 16,
|
||||
LegacyHiddenComponent: 24,
|
||||
MemoComponent: 14,
|
||||
Mode: 8,
|
||||
OffscreenComponent: 23, // Experimental
|
||||
Profiler: 12,
|
||||
ScopeComponent: 21, // Experimental
|
||||
SimpleMemoComponent: 15,
|
||||
SuspenseComponent: 13,
|
||||
SuspenseListComponent: 19, // Experimental
|
||||
TracingMarkerComponent: -1, // Doesn't exist yet
|
||||
YieldComponent: -1, // Removed
|
||||
Throw: -1, // Doesn't exist yet
|
||||
ViewTransitionComponent: -1, // Doesn't exist yet
|
||||
ActivityComponent: -1, // Doesn't exist yet
|
||||
};
|
||||
} else if (gte(version, '16.6.0-beta.0')) {
|
||||
ReactTypeOfWork = {
|
||||
CacheComponent: -1, // Doesn't exist yet
|
||||
ClassComponent: 1,
|
||||
ContextConsumer: 9,
|
||||
ContextProvider: 10,
|
||||
CoroutineComponent: -1, // Removed
|
||||
CoroutineHandlerPhase: -1, // Removed
|
||||
DehydratedSuspenseComponent: 18, // Behind a flag
|
||||
ForwardRef: 11,
|
||||
Fragment: 7,
|
||||
FunctionComponent: 0,
|
||||
HostComponent: 5,
|
||||
HostPortal: 4,
|
||||
HostRoot: 3,
|
||||
HostHoistable: -1, // Doesn't exist yet
|
||||
HostSingleton: -1, // Doesn't exist yet
|
||||
HostText: 6,
|
||||
IncompleteClassComponent: 17,
|
||||
IncompleteFunctionComponent: -1, // Doesn't exist yet
|
||||
IndeterminateComponent: 2,
|
||||
LazyComponent: 16,
|
||||
LegacyHiddenComponent: -1,
|
||||
MemoComponent: 14,
|
||||
Mode: 8,
|
||||
OffscreenComponent: -1, // Experimental
|
||||
Profiler: 12,
|
||||
ScopeComponent: -1, // Experimental
|
||||
SimpleMemoComponent: 15,
|
||||
SuspenseComponent: 13,
|
||||
SuspenseListComponent: 19, // Experimental
|
||||
TracingMarkerComponent: -1, // Doesn't exist yet
|
||||
YieldComponent: -1, // Removed
|
||||
Throw: -1, // Doesn't exist yet
|
||||
ViewTransitionComponent: -1, // Doesn't exist yet
|
||||
ActivityComponent: -1, // Doesn't exist yet
|
||||
};
|
||||
} else if (gte(version, '16.4.3-alpha')) {
|
||||
ReactTypeOfWork = {
|
||||
CacheComponent: -1, // Doesn't exist yet
|
||||
ClassComponent: 2,
|
||||
ContextConsumer: 11,
|
||||
ContextProvider: 12,
|
||||
CoroutineComponent: -1, // Removed
|
||||
CoroutineHandlerPhase: -1, // Removed
|
||||
DehydratedSuspenseComponent: -1, // Doesn't exist yet
|
||||
ForwardRef: 13,
|
||||
Fragment: 9,
|
||||
FunctionComponent: 0,
|
||||
HostComponent: 7,
|
||||
HostPortal: 6,
|
||||
HostRoot: 5,
|
||||
HostHoistable: -1, // Doesn't exist yet
|
||||
HostSingleton: -1, // Doesn't exist yet
|
||||
HostText: 8,
|
||||
IncompleteClassComponent: -1, // Doesn't exist yet
|
||||
IncompleteFunctionComponent: -1, // Doesn't exist yet
|
||||
IndeterminateComponent: 4,
|
||||
LazyComponent: -1, // Doesn't exist yet
|
||||
LegacyHiddenComponent: -1,
|
||||
MemoComponent: -1, // Doesn't exist yet
|
||||
Mode: 10,
|
||||
OffscreenComponent: -1, // Experimental
|
||||
Profiler: 15,
|
||||
ScopeComponent: -1, // Experimental
|
||||
SimpleMemoComponent: -1, // Doesn't exist yet
|
||||
SuspenseComponent: 16,
|
||||
SuspenseListComponent: -1, // Doesn't exist yet
|
||||
TracingMarkerComponent: -1, // Doesn't exist yet
|
||||
YieldComponent: -1, // Removed
|
||||
Throw: -1, // Doesn't exist yet
|
||||
ViewTransitionComponent: -1, // Doesn't exist yet
|
||||
ActivityComponent: -1, // Doesn't exist yet
|
||||
};
|
||||
} else {
|
||||
ReactTypeOfWork = {
|
||||
CacheComponent: -1, // Doesn't exist yet
|
||||
ClassComponent: 2,
|
||||
ContextConsumer: 12,
|
||||
ContextProvider: 13,
|
||||
CoroutineComponent: 7,
|
||||
CoroutineHandlerPhase: 8,
|
||||
DehydratedSuspenseComponent: -1, // Doesn't exist yet
|
||||
ForwardRef: 14,
|
||||
Fragment: 10,
|
||||
FunctionComponent: 1,
|
||||
HostComponent: 5,
|
||||
HostPortal: 4,
|
||||
HostRoot: 3,
|
||||
HostHoistable: -1, // Doesn't exist yet
|
||||
HostSingleton: -1, // Doesn't exist yet
|
||||
HostText: 6,
|
||||
IncompleteClassComponent: -1, // Doesn't exist yet
|
||||
IncompleteFunctionComponent: -1, // Doesn't exist yet
|
||||
IndeterminateComponent: 0,
|
||||
LazyComponent: -1, // Doesn't exist yet
|
||||
LegacyHiddenComponent: -1,
|
||||
MemoComponent: -1, // Doesn't exist yet
|
||||
Mode: 11,
|
||||
OffscreenComponent: -1, // Experimental
|
||||
Profiler: 15,
|
||||
ScopeComponent: -1, // Experimental
|
||||
SimpleMemoComponent: -1, // Doesn't exist yet
|
||||
SuspenseComponent: 16,
|
||||
SuspenseListComponent: -1, // Doesn't exist yet
|
||||
TracingMarkerComponent: -1, // Doesn't exist yet
|
||||
YieldComponent: 9,
|
||||
Throw: -1, // Doesn't exist yet
|
||||
ViewTransitionComponent: -1, // Doesn't exist yet
|
||||
ActivityComponent: -1, // Doesn't exist yet
|
||||
};
|
||||
}
|
||||
// **********************************************************
|
||||
// End of copied code.
|
||||
// **********************************************************
|
||||
|
||||
function getTypeSymbol(type: any): symbol | string | number {
|
||||
const symbolOrNumber =
|
||||
typeof type === 'object' && type !== null ? type.$$typeof : type;
|
||||
|
||||
return typeof symbolOrNumber === 'symbol'
|
||||
? symbolOrNumber.toString()
|
||||
: symbolOrNumber;
|
||||
}
|
||||
|
||||
const {
|
||||
CacheComponent,
|
||||
ClassComponent,
|
||||
IncompleteClassComponent,
|
||||
IncompleteFunctionComponent,
|
||||
FunctionComponent,
|
||||
IndeterminateComponent,
|
||||
ForwardRef,
|
||||
HostRoot,
|
||||
HostHoistable,
|
||||
HostSingleton,
|
||||
HostComponent,
|
||||
HostPortal,
|
||||
HostText,
|
||||
Fragment,
|
||||
LazyComponent,
|
||||
LegacyHiddenComponent,
|
||||
MemoComponent,
|
||||
OffscreenComponent,
|
||||
Profiler,
|
||||
ScopeComponent,
|
||||
SimpleMemoComponent,
|
||||
SuspenseComponent,
|
||||
SuspenseListComponent,
|
||||
TracingMarkerComponent,
|
||||
Throw,
|
||||
ViewTransitionComponent,
|
||||
ActivityComponent,
|
||||
} = ReactTypeOfWork;
|
||||
|
||||
// TODO: any return type might be wrong
|
||||
function resolveFiberType(type: any): any {
|
||||
const typeSymbol = getTypeSymbol(type);
|
||||
switch (typeSymbol) {
|
||||
case MEMO_NUMBER:
|
||||
case MEMO_SYMBOL_STRING:
|
||||
// recursively resolving memo type in case of memo(forwardRef(Component))
|
||||
return resolveFiberType(type.type);
|
||||
case FORWARD_REF_NUMBER:
|
||||
case FORWARD_REF_SYMBOL_STRING:
|
||||
return type.render;
|
||||
default:
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTICE Keep in sync with shouldFilterFiber() and other get*ForFiber methods
|
||||
function getDisplayNameForFiber(
|
||||
fiber: Fiber,
|
||||
shouldSkipForgetCheck: boolean = false,
|
||||
): string | null {
|
||||
const {elementType, type, tag} = fiber;
|
||||
|
||||
let resolvedType = type;
|
||||
if (typeof type === 'object' && type !== null) {
|
||||
resolvedType = resolveFiberType(type);
|
||||
}
|
||||
|
||||
let resolvedContext: any = null;
|
||||
if (
|
||||
!shouldSkipForgetCheck &&
|
||||
// $FlowFixMe[incompatible-type] fiber.updateQueue is mixed
|
||||
(fiber.updateQueue?.memoCache != null ||
|
||||
(Array.isArray(fiber.memoizedState?.memoizedState) &&
|
||||
fiber.memoizedState.memoizedState[0]?.[REACT_MEMO_CACHE_SENTINEL]) ||
|
||||
fiber.memoizedState?.memoizedState?.[REACT_MEMO_CACHE_SENTINEL])
|
||||
) {
|
||||
const displayNameWithoutForgetWrapper = getDisplayNameForFiber(
|
||||
fiber,
|
||||
true,
|
||||
);
|
||||
if (displayNameWithoutForgetWrapper == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return `Forget(${displayNameWithoutForgetWrapper})`;
|
||||
}
|
||||
|
||||
switch (tag) {
|
||||
case ActivityComponent:
|
||||
return 'Activity';
|
||||
case CacheComponent:
|
||||
return 'Cache';
|
||||
case ClassComponent:
|
||||
case IncompleteClassComponent:
|
||||
case IncompleteFunctionComponent:
|
||||
case FunctionComponent:
|
||||
case IndeterminateComponent:
|
||||
return getDisplayName(resolvedType);
|
||||
case ForwardRef:
|
||||
return getWrappedDisplayName(
|
||||
elementType,
|
||||
resolvedType,
|
||||
'ForwardRef',
|
||||
'Anonymous',
|
||||
);
|
||||
case HostRoot:
|
||||
const fiberRoot = fiber.stateNode;
|
||||
if (fiberRoot != null && fiberRoot._debugRootType !== null) {
|
||||
return fiberRoot._debugRootType;
|
||||
}
|
||||
return null;
|
||||
case HostComponent:
|
||||
case HostSingleton:
|
||||
case HostHoistable:
|
||||
return type;
|
||||
case HostPortal:
|
||||
case HostText:
|
||||
return null;
|
||||
case Fragment:
|
||||
return 'Fragment';
|
||||
case LazyComponent:
|
||||
// This display name will not be user visible.
|
||||
// Once a Lazy component loads its inner component, React replaces the tag and type.
|
||||
// This display name will only show up in console logs when DevTools DEBUG mode is on.
|
||||
return 'Lazy';
|
||||
case MemoComponent:
|
||||
case SimpleMemoComponent:
|
||||
// Display name in React does not use `Memo` as a wrapper but fallback name.
|
||||
return getWrappedDisplayName(
|
||||
elementType,
|
||||
resolvedType,
|
||||
'Memo',
|
||||
'Anonymous',
|
||||
);
|
||||
case LegacyHiddenComponent:
|
||||
return 'LegacyHidden';
|
||||
case OffscreenComponent:
|
||||
return 'Offscreen';
|
||||
case ScopeComponent:
|
||||
return 'Scope';
|
||||
case SuspenseComponent:
|
||||
return 'Suspense';
|
||||
case SuspenseListComponent:
|
||||
return 'SuspenseList';
|
||||
case TracingMarkerComponent:
|
||||
return 'TracingMarker';
|
||||
case ViewTransitionComponent:
|
||||
return 'ViewTransition';
|
||||
case Throw:
|
||||
return 'Throw';
|
||||
default:
|
||||
const typeSymbol = getTypeSymbol(type);
|
||||
|
||||
switch (typeSymbol) {
|
||||
case CONCURRENT_MODE_NUMBER:
|
||||
case CONCURRENT_MODE_SYMBOL_STRING:
|
||||
case DEPRECATED_ASYNC_MODE_SYMBOL_STRING:
|
||||
return 'ConcurrentMode';
|
||||
case PROVIDER_NUMBER:
|
||||
case PROVIDER_SYMBOL_STRING:
|
||||
// Grab the displayName from the type if it's available.
|
||||
// If it doesn't have a displayName, we'll fall back to the generic "Context.Provider" name.
|
||||
if (resolvedContext == null) {
|
||||
resolvedContext = type._context || type;
|
||||
}
|
||||
return `${resolvedContext.displayName || 'Context'}.Provider`;
|
||||
case CONTEXT_NUMBER:
|
||||
case CONTEXT_SYMBOL_STRING:
|
||||
case SERVER_CONTEXT_SYMBOL_STRING:
|
||||
// Grab the displayName from the type if it's available.
|
||||
// If it doesn't have a displayName, we'll fall back to the generic "Context.Consumer" name.
|
||||
if (resolvedContext == null) {
|
||||
resolvedContext = type._context || type;
|
||||
}
|
||||
return `${resolvedContext.displayName || 'Context'}.Consumer`;
|
||||
case CONSUMER_SYMBOL_STRING:
|
||||
// Grab the displayName from the type if it's available.
|
||||
// If it doesn't have a displayName, we'll fall back to the generic "Context.Consumer" name.
|
||||
if (resolvedContext == null) {
|
||||
resolvedContext = type;
|
||||
}
|
||||
return `${resolvedContext.displayName || 'Context'}.Consumer`;
|
||||
case STRICT_MODE_NUMBER:
|
||||
case STRICT_MODE_SYMBOL_STRING:
|
||||
return 'StrictMode';
|
||||
case PROFILER_NUMBER:
|
||||
case PROFILER_SYMBOL_STRING:
|
||||
return `Profiler`;
|
||||
case SCOPE_NUMBER:
|
||||
case SCOPE_SYMBOL_STRING:
|
||||
return 'Scope';
|
||||
default:
|
||||
// Unknown element type.
|
||||
// This may mean a new element type that has not yet been added to DevTools.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
getDisplayNameForFiber,
|
||||
getTypeSymbol,
|
||||
ReactPriorityLevels,
|
||||
ReactTypeOfWork,
|
||||
StrictModeBits,
|
||||
};
|
||||
}
|
||||