diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/Example.js.map b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/Example.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..59ee55f9a653d9bf36d712ee768e4746cc29e09f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/Example.js.map
@@ -0,0 +1 @@
+{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["Example.js"],"names":["Component","count","setCount"],"mappings":";;;;;;;AASA;;;;;;;;AAEO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AAEA,sBACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAgBD,KAAhB,WADF,eAEE;AAAQ,IAAA,OAAO,EAAE,MAAMC,QAAQ,CAACD,KAAK,GAAG,CAAT,CAA/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,CADF;AAMD","sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nimport React, {useState} from 'react';\n\nexport function Component() {\n const [count, setCount] = useState(0);\n\n return (\n
\n
You clicked {count} times
\n
setCount(count + 1)}>Click me \n
\n );\n}\n"],"x_react_sources":[[{"names":["","count"],"mappings":"CAAD;a4BCA,AWDA"}]]}}]}
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire.js
new file mode 100644
index 0000000000000000000000000000000000000000..5c6a1c636b0e683ceeec7ceefdcff6e1d193eaf8
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+/**
+ * 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.
+ *
+ *
+ */
+function Component() {
+ const [count] = require('react').useState(0);
+
+ return count;
+}
+//# sourceMappingURL=InlineRequire.js.map?foo=bar¶m=some_value
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire.js.map b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..4b54e6ade72a2324f6725fa77c2153a5394ae7ed
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire.js.map
@@ -0,0 +1 @@
+{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["InlineRequire.js"],"names":["Component","count","require","useState"],"mappings":";;;;;;;AAAA;;;;;;;;AASO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,IAAUC,OAAO,CAAC,OAAD,CAAP,CAAiBC,QAAjB,CAA0B,CAA1B,CAAhB;;AAEA,SAAOF,KAAP;AACD","sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nexport function Component() {\n const [count] = require('react').useState(0);\n\n return count;\n}\n"],"x_react_sources":[[{"names":[""],"mappings":"CAAD"}]]}}]}
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ToDoList.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ToDoList.js
new file mode 100644
index 0000000000000000000000000000000000000000..1d8c1f25b60016f21de9c24053b7d4cd1b103631
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ToDoList.js
@@ -0,0 +1,160 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ListItem = ListItem;
+exports.List = List;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ListItem({
+ item,
+ removeItem,
+ toggleItem
+}) {
+ const handleDelete = (0, React.useCallback)(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+ const handleToggle = (0, React.useCallback)(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+ return /*#__PURE__*/React.createElement("li", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 23,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("button", {
+ onClick: handleDelete,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 24,
+ columnNumber: 7
+ }
+ }, "Delete"), /*#__PURE__*/React.createElement("label", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("input", {
+ checked: item.isComplete,
+ onChange: handleToggle,
+ type: "checkbox",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 9
+ }
+ }), ' ', item.text));
+}
+
+function List(props) {
+ const [newItemText, setNewItemText] = (0, React.useState)('');
+ const [items, setItems] = (0, React.useState)([{
+ id: 1,
+ isComplete: true,
+ text: 'First'
+ }, {
+ id: 2,
+ isComplete: true,
+ text: 'Second'
+ }, {
+ id: 3,
+ isComplete: false,
+ text: 'Third'
+ }]);
+ const [uid, setUID] = (0, React.useState)(4);
+ const handleClick = (0, React.useCallback)(() => {
+ if (newItemText !== '') {
+ setItems([...items, {
+ id: uid,
+ isComplete: false,
+ text: newItemText
+ }]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+ const handleKeyPress = (0, React.useCallback)(event => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ }, [handleClick]);
+ const handleChange = (0, React.useCallback)(event => {
+ setNewItemText(event.currentTarget.value);
+ }, [setNewItemText]);
+ const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
+ const toggleItem = (0, React.useCallback)(itemToToggle => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+ setItems(items.slice(0, index).concat({ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete
+ }).concat(items.slice(index + 1)));
+ }, [items]);
+ return /*#__PURE__*/React.createElement(React.Fragment, {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 102,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("h1", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 103,
+ columnNumber: 7
+ }
+ }, "List"), /*#__PURE__*/React.createElement("input", {
+ type: "text",
+ placeholder: "New list item...",
+ value: newItemText,
+ onChange: handleChange,
+ onKeyPress: handleKeyPress,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 104,
+ columnNumber: 7
+ }
+ }), /*#__PURE__*/React.createElement("button", {
+ disabled: newItemText === '',
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 111,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("span", {
+ role: "img",
+ "aria-label": "Add item",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 112,
+ columnNumber: 9
+ }
+ }, "Add")), /*#__PURE__*/React.createElement("ul", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 116,
+ columnNumber: 7
+ }
+ }, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
+ key: item.id,
+ item: item,
+ removeItem: removeItem,
+ toggleItem: toggleItem,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 118,
+ columnNumber: 11
+ }
+ }))));
+}
+//# sourceMappingURL=ToDoList.js.map?foo=bar¶m=some_value
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ToDoList.js.map b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ToDoList.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..4c55cbd6ac3fc241db3be1ac6ef5165ac8426f24
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ToDoList.js.map
@@ -0,0 +1 @@
+{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ToDoList.js"],"names":["ListItem","item","removeItem","toggleItem","handleDelete","handleToggle","isComplete","text","List","props","newItemText","setNewItemText","items","setItems","id","uid","setUID","handleClick","handleKeyPress","event","key","handleChange","currentTarget","value","itemToRemove","filter","itemToToggle","index","findIndex","slice","concat","map"],"mappings":";;;;;;;;AASA;;;;;;;;AAGO,SAASA,QAAT,CAAkB;AAACC,EAAAA,IAAD;AAAOC,EAAAA,UAAP;AAAmBC,EAAAA;AAAnB,CAAlB,EAAkD;AACvD,QAAMC,YAAY,GAAG,uBAAY,MAAM;AACrCF,IAAAA,UAAU,CAACD,IAAD,CAAV;AACD,GAFoB,EAElB,CAACA,IAAD,EAAOC,UAAP,CAFkB,CAArB;AAIA,QAAMG,YAAY,GAAG,uBAAY,MAAM;AACrCF,IAAAA,UAAU,CAACF,IAAD,CAAV;AACD,GAFoB,EAElB,CAACA,IAAD,EAAOE,UAAP,CAFkB,CAArB;AAIA,sBACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBACE;AAAQ,IAAA,OAAO,EAAEC,YAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBACE;AACE,IAAA,OAAO,EAAEH,IAAI,CAACK,UADhB;AAEE,IAAA,QAAQ,EAAED,YAFZ;AAGE,IAAA,IAAI,EAAC,UAHP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IADF,EAKK,GALL,EAMGJ,IAAI,CAACM,IANR,CAFF,CADF;AAaD;;AAEM,SAASC,IAAT,CAAcC,KAAd,EAAqB;AAC1B,QAAM,CAACC,WAAD,EAAcC,cAAd,IAAgC,oBAAS,EAAT,CAAtC;AACA,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,oBAAS,CACjC;AAACC,IAAAA,EAAE,EAAE,CAAL;AAAQR,IAAAA,UAAU,EAAE,IAApB;AAA0BC,IAAAA,IAAI,EAAE;AAAhC,GADiC,EAEjC;AAACO,IAAAA,EAAE,EAAE,CAAL;AAAQR,IAAAA,UAAU,EAAE,IAApB;AAA0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Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nimport * as React from 'react';\nimport {Fragment, useCallback, useState} from 'react';\n\nexport function ListItem({item, removeItem, toggleItem}) {\n const handleDelete = useCallback(() => {\n removeItem(item);\n }, [item, removeItem]);\n\n const handleToggle = useCallback(() => {\n toggleItem(item);\n }, [item, toggleItem]);\n\n return (\n \n Delete \n \n {' '}\n {item.text}\n \n \n );\n}\n\nexport function List(props) {\n const [newItemText, setNewItemText] = useState('');\n const [items, setItems] = useState([\n {id: 1, isComplete: true, text: 'First'},\n {id: 2, isComplete: true, text: 'Second'},\n {id: 3, isComplete: false, text: 'Third'},\n ]);\n const [uid, setUID] = useState(4);\n\n const handleClick = useCallback(() => {\n if (newItemText !== '') {\n setItems([\n ...items,\n {\n id: uid,\n isComplete: false,\n text: newItemText,\n },\n ]);\n setUID(uid + 1);\n setNewItemText('');\n }\n }, [newItemText, items, uid]);\n\n const handleKeyPress = useCallback(\n event => {\n if (event.key === 'Enter') {\n handleClick();\n }\n },\n [handleClick],\n );\n\n const handleChange = useCallback(\n event => {\n setNewItemText(event.currentTarget.value);\n },\n [setNewItemText],\n );\n\n const removeItem = useCallback(\n itemToRemove => setItems(items.filter(item => item !== itemToRemove)),\n [items],\n );\n\n const toggleItem = useCallback(\n itemToToggle => {\n // Dont use indexOf()\n // because editing props in DevTools creates a new Object.\n const index = items.findIndex(item => item.id === itemToToggle.id);\n\n setItems(\n items\n .slice(0, index)\n .concat({\n ...itemToToggle,\n isComplete: !itemToToggle.isComplete,\n })\n .concat(items.slice(index + 1)),\n );\n },\n [items],\n );\n\n return (\n \n List \n \n \n \n Add\n \n \n \n {items.map(item => (\n \n ))}\n \n \n );\n}\n"],"x_react_sources":[[{"names":["","handleDelete","handleToggle","newItemText","items","uid","handleClick","handleKeyPress","handleChange","removeItem","toggleItem"],"mappings":"CAAD;cuBCA;gBCDA;kBDEA;oBCFA;sCgBGA,AYHA;uCxBIA;2CxBJA;4CoBKA,AWLA;8CbMA;2DSNA;6DNOA;oEtBPA;sEoBQA;2EpBRA;6EkBSA;gFlBTA;kFkBUA;mGlBVA"}]]}}]}
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..d2e5621699875c4f92fa4f2345c09d335d53230a
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingURL=index.js.map?foo=bar¶m=some_value
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/index.js.map b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/index.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..08cef731f7e58eee72a86fab26b5480a14090b49
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/index.js.map
@@ -0,0 +1 @@
+{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA","sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nexport {Component as ComponentUsingHooksIndirectly} from './ComponentUsingHooksIndirectly';\nexport {Component as ComponentWithCustomHook} from './ComponentWithCustomHook';\nexport {Component as ComponentWithExternalCustomHooks} from './ComponentWithExternalCustomHooks';\nexport {Component as ComponentWithMultipleHooksPerLine} from './ComponentWithMultipleHooksPerLine';\nexport {Component as ComponentWithNestedHooks} from './ComponentWithNestedHooks';\nexport {Component as ContainingStringSourceMappingURL} from './ContainingStringSourceMappingURL';\nexport {Component as Example} from './Example';\nexport {Component as InlineRequire} from './InlineRequire';\nimport * as ToDoList from './ToDoList';\nexport {ToDoList};\nexport {default as useTheme} from './useTheme';\n"],"x_react_sources":[[{"names":[""],"mappings":"CAAD"}]]}}]}
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..30f972062626e72820ecd087ba3ecf4fc511dd65
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=useTheme.js.map?foo=bar¶m=some_value
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/useTheme.js.map b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/useTheme.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..39d07709387909598c7e01acbec754470a040b6e
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/useTheme.js.map
@@ -0,0 +1 @@
+{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["useTheme.js"],"names":["ThemeContext","useTheme","theme"],"mappings":";;;;;;;;AASA;;AATA;;;;;;;;AAWO,MAAMA,YAAY,gBAAG,0BAAc,QAAd,CAArB;;;AAEQ,SAASC,QAAT,GAAoB;AACjC,QAAMC,KAAK,GAAG,uBAAWF,YAAX,CAAd;AACA,4BAAcE,KAAd;AACA,SAAOA,KAAP;AACD","sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nimport {createContext, useContext, useDebugValue} from 'react';\n\nexport const ThemeContext = createContext('bright');\n\nexport default function useTheme() {\n const theme = useContext(ThemeContext);\n useDebugValue(theme);\n return theme;\n}\n"],"x_react_sources":[[{"names":["","theme"],"mappings":"CAAD;egBCA,AwBDA"}]]}}]}
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..d2e5621699875c4f92fa4f2345c09d335d53230a
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingURL=index.js.map?foo=bar¶m=some_value
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index.js.map b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..94e3d67242430d3ae8eec204f9790b8f1066bd9d
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/index.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA","sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nexport {Component as ComponentUsingHooksIndirectly} from './ComponentUsingHooksIndirectly';\nexport {Component as ComponentWithCustomHook} from './ComponentWithCustomHook';\nexport {Component as ComponentWithExternalCustomHooks} from './ComponentWithExternalCustomHooks';\nexport {Component as ComponentWithMultipleHooksPerLine} from './ComponentWithMultipleHooksPerLine';\nexport {Component as ComponentWithNestedHooks} from './ComponentWithNestedHooks';\nexport {Component as ContainingStringSourceMappingURL} from './ContainingStringSourceMappingURL';\nexport {Component as Example} from './Example';\nexport {Component as InlineRequire} from './InlineRequire';\nimport * as ToDoList from './ToDoList';\nexport {ToDoList};\nexport {default as useTheme} from './useTheme';\n"],"x_react_sources":[[{"names":[""],"mappings":"CAAD"}]]}
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..30f972062626e72820ecd087ba3ecf4fc511dd65
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=useTheme.js.map?foo=bar¶m=some_value
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/useTheme.js.map b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/useTheme.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..55a676df1499370589a9b6f0cd7710b77e229d54
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/react-sources-extended/useTheme.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["useTheme.js"],"names":["ThemeContext","useTheme","theme"],"mappings":";;;;;;;;AASA;;AATA;;;;;;;;AAWO,MAAMA,YAAY,gBAAG,0BAAc,QAAd,CAArB;;;AAEQ,SAASC,QAAT,GAAoB;AACjC,QAAMC,KAAK,GAAG,uBAAWF,YAAX,CAAd;AACA,4BAAcE,KAAd;AACA,SAAOA,KAAP;AACD","sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nimport {createContext, useContext, useDebugValue} from 'react';\n\nexport const ThemeContext = createContext('bright');\n\nexport default function useTheme() {\n const theme = useContext(ThemeContext);\n useDebugValue(theme);\n return theme;\n}\n"],"x_react_sources":[[{"names":["","theme"],"mappings":"CAAD;egBCA,AwBDA"}]]}
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..30f972062626e72820ecd087ba3ecf4fc511dd65
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=useTheme.js.map?foo=bar¶m=some_value
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/useTheme.js.map b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/useTheme.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..972e14744605b225984bd00b402ecb4493648c17
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/external/useTheme.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["useTheme.js"],"names":["ThemeContext","useTheme","theme"],"mappings":";;;;;;;;AASA;;AATA;;;;;;;;AAWO,MAAMA,YAAY,gBAAG,0BAAc,QAAd,CAArB;;;AAEQ,SAASC,QAAT,GAAoB;AACjC,QAAMC,KAAK,GAAG,uBAAWF,YAAX,CAAd;AACA,4BAAcE,KAAd;AACA,SAAOA,KAAP;AACD","sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nimport {createContext, useContext, useDebugValue} from 'react';\n\nexport const ThemeContext = createContext('bright');\n\nexport default function useTheme() {\n const theme = useContext(ThemeContext);\n useDebugValue(theme);\n return theme;\n}\n"]}
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentUsingHooksIndirectly.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentUsingHooksIndirectly.js
new file mode 100644
index 0000000000000000000000000000000000000000..926a6dabdac71cf6536b9d65634cf3a29471c00f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentUsingHooksIndirectly.js
@@ -0,0 +1,56 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const countState = (0, _react.useState)(0);
+ const count = countState[0];
+ const setCount = countState[1];
+ const darkMode = useIsDarkMode();
+ const [isDarkMode] = darkMode;
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 29,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 30,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const darkModeState = (0, _react.useState)(false);
+ const [isDarkMode] = darkModeState;
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return [isDarkMode, () => {}];
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50U3RhdGUiLCJjb3VudCIsInNldENvdW50IiwiZGFya01vZGUiLCJ1c2VJc0RhcmtNb2RlIiwiaXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwiZGFya01vZGVTdGF0ZSIsInVzZUVmZmVjdENyZWF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsVUFBVSxHQUFHLHFCQUFTLENBQVQsQ0FBbkI7QUFDQSxRQUFNQyxLQUFLLEdBQUdELFVBQVUsQ0FBQyxDQUFELENBQXhCO0FBQ0EsUUFBTUUsUUFBUSxHQUFHRixVQUFVLENBQUMsQ0FBRC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dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithCustomHook.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithCustomHook.js
new file mode 100644
index 0000000000000000000000000000000000000000..0c80e4790cfe6243803a1c9cfadbd00e88f2d5b1
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithCustomHook.js
@@ -0,0 +1,68 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ const isDarkMode = useIsDarkMode();
+ const {
+ foo
+ } = useFoo();
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 27,
+ columnNumber: 7
+ }
+ }, "Foo: ", foo), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const [isDarkMode] = (0, _react.useState)(false);
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return isDarkMode;
+}
+
+function useFoo() {
+ (0, _react.useDebugValue)('foo');
+ return {
+ foo: true
+ };
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhDdXN0b21Ib29rLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiLCJpc0RhcmtNb2RlIiwidXNlSXNEYXJrTW9kZSIsImZvbyIsInVzZUZvbyIsImhhbmRsZUNsaWNrIiwidXNlRWZmZWN0Q3JlYXRlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7Ozs7Ozs7O0FBRU8sU0FBU0EsU0FBVCxHQUFxQjtBQUMxQixRQUFNLENBQUNDLEtBQUQsRUFBUUMsUUFBUixJQUFvQixxQkFBUyxDQUFULENBQTFCO0FBQ0EsUUFBTUMsVUFBVSxHQUFHQyxhQUFhLEVBQWhDO0FBQ0EsUUFBTTtBQUFDQyxJQUFBQTtBQUFELE1BQVFDLE1BQU0sRUFBcEI7QUFFQSx3QkFBVSxNQUFNLENBQ2Q7QUFDRCxHQUZELEVBRUcsRUFGSDs7QUFJQSxRQUFNQyxXQUFXLEdBQUcsTUFBTUwsUUFBUSxDQUFD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m9tICdyZWFjdCc7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IFtjb3VudCwgc2V0Q291bnRdID0gdXNlU3RhdGUoMCk7XG4gIGNvbnN0IGlzRGFya01vZGUgPSB1c2VJc0RhcmtNb2RlKCk7XG4gIGNvbnN0IHtmb299ID0gdXNlRm9vKCk7XG5cbiAgdXNlRWZmZWN0KCgpID0+IHtcbiAgICAvLyAuLi5cbiAgfSwgW10pO1xuXG4gIGNvbnN0IGhhbmRsZUNsaWNrID0gKCkgPT4gc2V0Q291bnQoY291bnQgKyAxKTtcblxuICByZXR1cm4gKFxuICAgIDw+XG4gICAgICA8ZGl2PkRhcmsgbW9kZT8ge2lzRGFya01vZGV9PC9kaXY+XG4gICAgICA8ZGl2PkNvdW50OiB7Y291bnR9PC9kaXY+XG4gICAgICA8ZGl2PkZvbzoge2Zvb308L2Rpdj5cbiAgICAgIDxidXR0b24gb25DbGljaz17aGFuZGxlQ2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSB1c2VTdGF0ZShmYWxzZSk7XG5cbiAgdXNlRWZmZWN0KGZ1bmN0aW9uIHVzZUVmZmVjdENyZWF0ZSgpIHtcbiAgICAvLyBIZXJlIGlzIHdoZXJlIHdlIG1heSBsaXN0ZW4gdG8gYSBcInRoZW1lXCIgZXZlbnQuLi5cbiAgfSwgW10pO1xuXG4gIHJldHVybiBpc0RhcmtNb2RlO1xufVxuXG5mdW5jdGlvbiB1c2VGb28oKSB7XG4gIHVzZURlYnVnVmFsdWUoJ2ZvbycpO1xuICByZXR1cm4ge2ZvbzogdHJ1ZX07XG59XG4iXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithExternalCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithExternalCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..32c9bee838571bbe49d9af6962aaa2eb37802335
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithExternalCustomHooks.js
@@ -0,0 +1,26 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireDefault(require("react"));
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+var _jsxFileName = "";
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function Component() {
+ const theme = (0, _useTheme.default)();
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 10
+ }
+ }, "theme: ", theme);
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsS0FBSyxHQUFHLHdCQUFkO0FBRUEsc0JBQU87QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsZ0JBQWFBLEtBQWIsQ0FBUDtBQUNEIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlVGhlbWUgZnJvbSAnLi91c2VUaGVtZSc7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlVGhlbWUoKTtcblxuICByZXR1cm4gPGRpdj50aGVtZToge3RoZW1lfTwvZGl2Pjtcbn1cbiJdfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithMultipleHooksPerLine.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithMultipleHooksPerLine.js
new file mode 100644
index 0000000000000000000000000000000000000000..b657d494ceb39900745e12541778ce25f669753f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithMultipleHooksPerLine.js
@@ -0,0 +1,30 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const A = /*#__PURE__*/(0, _react.createContext)(1);
+const B = /*#__PURE__*/(0, _react.createContext)(2);
+
+function Component() {
+ const a = (0, _react.useContext)(A);
+ const b = (0, _react.useContext)(B); // prettier-ignore
+
+ const c = (0, _react.useContext)(A),
+ d = (0, _react.useContext)(B); // eslint-disable-line one-var
+
+ return a + b + c + d;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbX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ik7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IGEgPSB1c2VDb250ZXh0KEEpO1xuICBjb25zdCBiID0gdXNlQ29udGV4dChCKTtcblxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgY29uc3QgYyA9IHVzZUNvbnRleHQoQSksIGQgPSB1c2VDb250ZXh0KEIpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG9uZS12YXJcblxuICByZXR1cm4gYSArIGIgKyBjICsgZDtcbn1cbiJdfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithNestedHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithNestedHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..215810159341e282042a4e26e4b099739deecfc6
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ComponentWithNestedHooks.js
@@ -0,0 +1,28 @@
+"use strict";
+
+/**
+ * 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.
+ *
+ *
+ */
+const {
+ useMemo,
+ useState
+} = require('react');
+
+function Component(props) {
+ const InnerComponent = useMemo(() => () => {
+ const [state] = useState(0);
+ return state;
+ });
+ props.callback(InnerComponent);
+ return null;
+}
+
+module.exports = {
+ Component
+};
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhOZXN0ZWRIb29rcy5qcyJdLCJuYW1lcyI6WyJ1c2VNZW1vIiwidXNlU3RhdGUiLCJyZXF1aXJlIiwiQ29tcG9uZW50IiwicHJvcHMiLCJJbm5lckNvbXBvbmVudCIsInN0YXRlIiwiY2FsbGJhY2siLCJtb2R1bGUiLCJleHBvcnRzIl0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MuY2FsbGJhY2soSW5uZXJDb21wb25lbnQpO1xuXG4gIHJldHVybiBudWxsO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtDb21wb25lbnR9O1xuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ContainingStringSourceMappingURL.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ContainingStringSourceMappingURL.js
new file mode 100644
index 0000000000000000000000000000000000000000..a30090ae4891959d9091f191f7f59079c278b90b
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ContainingStringSourceMappingURL.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+// ?sourceMappingURL=([^\s'"]+)/gm
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 19,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 20,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7Ozs7Ozs7QUFFQTtBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUVBLHNCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGtCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLHFCQUFnQkQsS0FBaEIsV0FERixlQUVFO0FBQVEsSUFBQSxPQUFPLEVBQUUsTUFBTUMsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUEvQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFGRixDQURGO0FBTUQiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IFJlYWN0LCB7dXNlU3RhdGV9IGZyb20gJ3JlYWN0JztcblxuLy8gP3NvdXJjZU1hcHBpbmdVUkw9KFteXFxzJ1wiXSspL2dtXG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IFtjb3VudCwgc2V0Q291bnRdID0gdXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2PlxuICAgICAgPHA+WW91IGNsaWNrZWQge2NvdW50fSB0aW1lczwvcD5cbiAgICAgIDxidXR0b24gb25DbGljaz17KCkgPT4gc2V0Q291bnQoY291bnQgKyAxKX0+Q2xpY2sgbWU8L2J1dHRvbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn1cbiJdfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/Example.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/Example.js
new file mode 100644
index 0000000000000000000000000000000000000000..9a0d3bb203f721c98c3be470612672b069b56518
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/Example.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 17,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJzZXRDb3VudCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUVBLHNCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGtCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLHFCQUFnQkQsS0FBaEIsV0FERixlQUVFO0FBQVEsSUFBQSxPQUFPLEVBQUUsTUFBTUMsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUEvQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFGRixDQURGO0FBTUQiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IFJlYWN0LCB7dXNlU3RhdGV9IGZyb20gJ3JlYWN0JztcblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50LCBzZXRDb3VudF0gPSB1c2VTdGF0ZSgwKTtcblxuICByZXR1cm4gKFxuICAgIDxkaXY+XG4gICAgICA8cD5Zb3UgY2xpY2tlZCB7Y291bnR9IHRpbWVzPC9wPlxuICAgICAgPGJ1dHRvbiBvbkNsaWNrPXsoKSA9PiBzZXRDb3VudChjb3VudCArIDEpfT5DbGljayBtZTwvYnV0dG9uPlxuICAgIDwvZGl2PlxuICApO1xufVxuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/InlineRequire.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/InlineRequire.js
new file mode 100644
index 0000000000000000000000000000000000000000..095a865b557af3e59d5634c6125010a424fbff36
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/InlineRequire.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+/**
+ * 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.
+ *
+ *
+ */
+function Component() {
+ const [count] = require('react').useState(0);
+
+ return count;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ToDoList.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ToDoList.js
new file mode 100644
index 0000000000000000000000000000000000000000..f8bb60fac02efda0d6a4ee58cf6f750d252ddecb
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/ToDoList.js
@@ -0,0 +1,160 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ListItem = ListItem;
+exports.List = List;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ListItem({
+ item,
+ removeItem,
+ toggleItem
+}) {
+ const handleDelete = (0, React.useCallback)(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+ const handleToggle = (0, React.useCallback)(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+ return /*#__PURE__*/React.createElement("li", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 23,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("button", {
+ onClick: handleDelete,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 24,
+ columnNumber: 7
+ }
+ }, "Delete"), /*#__PURE__*/React.createElement("label", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("input", {
+ checked: item.isComplete,
+ onChange: handleToggle,
+ type: "checkbox",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 9
+ }
+ }), ' ', item.text));
+}
+
+function List(props) {
+ const [newItemText, setNewItemText] = (0, React.useState)('');
+ const [items, setItems] = (0, React.useState)([{
+ id: 1,
+ isComplete: true,
+ text: 'First'
+ }, {
+ id: 2,
+ isComplete: true,
+ text: 'Second'
+ }, {
+ id: 3,
+ isComplete: false,
+ text: 'Third'
+ }]);
+ const [uid, setUID] = (0, React.useState)(4);
+ const handleClick = (0, React.useCallback)(() => {
+ if (newItemText !== '') {
+ setItems([...items, {
+ id: uid,
+ isComplete: false,
+ text: newItemText
+ }]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+ const handleKeyPress = (0, React.useCallback)(event => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ }, [handleClick]);
+ const handleChange = (0, React.useCallback)(event => {
+ setNewItemText(event.currentTarget.value);
+ }, [setNewItemText]);
+ const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
+ const toggleItem = (0, React.useCallback)(itemToToggle => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+ setItems(items.slice(0, index).concat({ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete
+ }).concat(items.slice(index + 1)));
+ }, [items]);
+ return /*#__PURE__*/React.createElement(React.Fragment, {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 102,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("h1", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 103,
+ columnNumber: 7
+ }
+ }, "List"), /*#__PURE__*/React.createElement("input", {
+ type: "text",
+ placeholder: "New list item...",
+ value: newItemText,
+ onChange: handleChange,
+ onKeyPress: handleKeyPress,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 104,
+ columnNumber: 7
+ }
+ }), /*#__PURE__*/React.createElement("button", {
+ disabled: newItemText === '',
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 111,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("span", {
+ role: "img",
+ "aria-label": "Add item",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 112,
+ columnNumber: 9
+ }
+ }, "Add")), /*#__PURE__*/React.createElement("ul", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 116,
+ columnNumber: 7
+ }
+ }, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
+ key: item.id,
+ item: item,
+ removeItem: removeItem,
+ toggleItem: toggleItem,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 118,
+ columnNumber: 11
+ }
+ }))));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRvRG9MaXN0LmpzIl0sIm5hbWVzIjpbIkxpc3RJdGVtIiwiaXRlbSIsInJlbW92ZUl0ZW0iLCJ0b2dnbGVJdGVtIiwiaGFuZGxlRGVsZXRlIiwiaGFuZGxlVG9nZ2xlIiwiaXNDb21wbGV0ZSIsInRleHQiLCJMaXN0IiwicHJvcHMiLCJuZXdJdGVtVGV4dCIsInNldE5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJzZXRJdGVtcyIsImlkIiwidWlkIiwic2V0VUlEIiwiaGFuZGxlQ2xpY2siLCJoYW5kbGVLZXlQcmVzcyIsImV2ZW50Iiwia2V5IiwiaGFuZGxlQ2hhbmdlIiwiY3VycmVudFRhcmdldCIsInZhbHVlIiwiaXRlbVRvUmVtb3ZlIiwiZmlsdGVyIiwiaXRlbVRvVG9nZ2xlIiwiaW5kZXgiLCJmaW5kSW5kZXgiLCJzbGljZSIsImNvbmNhdCIsIm1hcCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFTQTs7Ozs7Ozs7QUFHTyxTQUFTQSxRQUFULENBQWtCO0FBQUNDLEVBQUFBLElBQUQ7QUFBT0MsRUFBQUEsVUFBUDtBQUFtQkMsRUFBQUE7QUFBbkIsQ0FBbEIsRUF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lc3M9e2hhbmRsZUtleVByZXNzfVxuICAgICAgLz5cbiAgICAgIDxidXR0b24gZGlzYWJsZWQ9e25ld0l0ZW1UZXh0ID09PSAnJ30gb25DbGljaz17aGFuZGxlQ2xpY2t9PlxuICAgICAgICA8c3BhbiByb2xlPVwiaW1nXCIgYXJpYS1sYWJlbD1cIkFkZCBpdGVtXCI+XG4gICAgICAgICAgQWRkXG4gICAgICAgIDwvc3Bhbj5cbiAgICAgIDwvYnV0dG9uPlxuICAgICAgPHVsPlxuICAgICAgICB7aXRlbXMubWFwKGl0ZW0gPT4gKFxuICAgICAgICAgIDxMaXN0SXRlbVxuICAgICAgICAgICAga2V5PXtpdGVtLmlkfVxuICAgICAgICAgICAgaXRlbT17aXRlbX1cbiAgICAgICAgICAgIHJlbW92ZUl0ZW09e3JlbW92ZUl0ZW19XG4gICAgICAgICAgICB0b2dnbGVJdGVtPXt0b2dnbGVJdGVtfVxuICAgICAgICAgIC8+XG4gICAgICAgICkpfVxuICAgICAgPC91bD5cbiAgICA8L0ZyYWdtZW50PlxuICApO1xufVxuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentUsingHooksIndirectly.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentUsingHooksIndirectly.js
new file mode 100644
index 0000000000000000000000000000000000000000..e3b87798f3b61b994c7427ff47614ad3eadf5f17
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentUsingHooksIndirectly.js
@@ -0,0 +1,56 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const countState = (0, _react.useState)(0);
+ const count = countState[0];
+ const setCount = countState[1];
+ const darkMode = useIsDarkMode();
+ const [isDarkMode] = darkMode;
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 29,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 30,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const darkModeState = (0, _react.useState)(false);
+ const [isDarkMode] = darkModeState;
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return [isDarkMode, () => {}];
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm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Q2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBkYXJrTW9kZVN0YXRlID0gdXNlU3RhdGUoZmFsc2UpO1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSBkYXJrTW9kZVN0YXRlO1xuXG4gIHVzZUVmZmVjdChmdW5jdGlvbiB1c2VFZmZlY3RDcmVhdGUoKSB7XG4gICAgLy8gSGVyZSBpcyB3aGVyZSB3ZSBtYXkgbGlzdGVuIHRvIGEgXCJ0aGVtZVwiIGV2ZW50Li4uXG4gIH0sIFtdKTtcblxuICByZXR1cm4gW2lzRGFya01vZGUsICgpID0+IHt9XTtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCIsImRhcmtNb2RlIiwiaXNEYXJrTW9kZSJdLCJtYXBwaW5ncyI6IkNBQUQ7YXFCQ0EsQVdEQTtpQmJFQSxBZUZBO29DVkdBLEFlSEEifV1dXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithCustomHook.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithCustomHook.js
new file mode 100644
index 0000000000000000000000000000000000000000..68e05ca77a3cca30714f9c23c8bed271fba7b760
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithCustomHook.js
@@ -0,0 +1,68 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ const isDarkMode = useIsDarkMode();
+ const {
+ foo
+ } = useFoo();
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 27,
+ columnNumber: 7
+ }
+ }, "Foo: ", foo), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const [isDarkMode] = (0, _react.useState)(false);
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return isDarkMode;
+}
+
+function useFoo() {
+ (0, _react.useDebugValue)('foo');
+ return {
+ foo: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OiB7Y291bnR9PC9kaXY+XG4gICAgICA8ZGl2PkZvbzoge2Zvb308L2Rpdj5cbiAgICAgIDxidXR0b24gb25DbGljaz17aGFuZGxlQ2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSB1c2VTdGF0ZShmYWxzZSk7XG5cbiAgdXNlRWZmZWN0KGZ1bmN0aW9uIHVzZUVmZmVjdENyZWF0ZSgpIHtcbiAgICAvLyBIZXJlIGlzIHdoZXJlIHdlIG1heSBsaXN0ZW4gdG8gYSBcInRoZW1lXCIgZXZlbnQuLi5cbiAgfSwgW10pO1xuXG4gIHJldHVybiBpc0RhcmtNb2RlO1xufVxuXG5mdW5jdGlvbiB1c2VGb28oKSB7XG4gIHVzZURlYnVnVmFsdWUoJ2ZvbycpO1xuICByZXR1cm4ge2ZvbzogdHJ1ZX07XG59XG4iXSwieF9mYWNlYm9va19zb3VyY2VzIjpbW251bGwsW3sibmFtZXMiOlsiPG5vLWhvb2s+IiwiY291bnQiLCJpc0RhcmtNb2RlIl0sIm1hcHBpbmdzIjoiQ0FBRDthNEJDQSxBV0RBO2NsQkVBLEFlRkE7a0NiRUEifV1dXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithExternalCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithExternalCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..01dc8d114ac2dacb2fa0137cde7e068aac8f1cd1
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithExternalCustomHooks.js
@@ -0,0 +1,26 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireDefault(require("react"));
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+var _jsxFileName = "";
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function Component() {
+ const theme = (0, _useTheme.default)();
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 10
+ }
+ }, "theme: ", theme);
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsS0FBSyxHQUFHLHdCQUFkO0FBRUEsc0JBQU87QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsZ0JBQWFBLEtBQWIsQ0FBUDtBQUNEIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlVGhlbWUgZnJvbSAnLi91c2VUaGVtZSc7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlVGhlbWUoKTtcblxuICByZXR1cm4gPGRpdj50aGVtZToge3RoZW1lfTwvZGl2Pjtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJ0aGVtZSJdLCJtYXBwaW5ncyI6IkNBQUQ7Y2dCQ0EsQVVEQSJ9XV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithMultipleHooksPerLine.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithMultipleHooksPerLine.js
new file mode 100644
index 0000000000000000000000000000000000000000..4e2650eca63d8d605fc1462a7a139d29a70c91d6
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithMultipleHooksPerLine.js
@@ -0,0 +1,30 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const A = /*#__PURE__*/(0, _react.createContext)(1);
+const B = /*#__PURE__*/(0, _react.createContext)(2);
+
+function Component() {
+ const a = (0, _react.useContext)(A);
+ const b = (0, _react.useContext)(B); // prettier-ignore
+
+ const c = (0, _react.useContext)(A),
+ d = (0, _react.useContext)(B); // eslint-disable-line one-var
+
+ return a + b + c + d;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZS5qcyJdLCJuYW1lcyI6WyJBIiwiQiIsI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250ZXh0KEEpO1xuICBjb25zdCBiID0gdXNlQ29udGV4dChCKTtcblxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgY29uc3QgYyA9IHVzZUNvbnRleHQoQSksIGQgPSB1c2VDb250ZXh0KEIpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG9uZS12YXJcblxuICByZXR1cm4gYSArIGIgKyBjICsgZDtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJhIiwiYiIsImMiLCJkIl0sIm1hcHBpbmdzIjoiQ0FBRDtnQllDQSxBYURBO2lCYkVBLEFhRkE7b0JiR0EsQWFIQSxBTUlBLEFhSkEifV1dXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithNestedHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithNestedHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..07ee7cd65cbd97f200d7325fc545a387e0786a74
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ComponentWithNestedHooks.js
@@ -0,0 +1,28 @@
+"use strict";
+
+/**
+ * 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.
+ *
+ *
+ */
+const {
+ useMemo,
+ useState
+} = require('react');
+
+function Component(props) {
+ const InnerComponent = useMemo(() => () => {
+ const [state] = useState(0);
+ return state;
+ });
+ props.callback(InnerComponent);
+ return null;
+}
+
+module.exports = {
+ Component
+};
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhOZXN0ZWRIb29rcy5qcyJdLCJuYW1lcyI6W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ubmVyQ29tcG9uZW50ID0gdXNlTWVtbygoKSA9PiAoKSA9PiB7XG4gICAgY29uc3QgW3N0YXRlXSA9IHVzZVN0YXRlKDApO1xuXG4gICAgcmV0dXJuIHN0YXRlO1xuICB9KTtcbiAgcHJvcHMuY2FsbGJhY2soSW5uZXJDb21wb25lbnQpO1xuXG4gIHJldHVybiBudWxsO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtDb21wb25lbnR9O1xuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsIklubmVyQ29tcG9uZW50Iiwic3RhdGUiXSwibWFwcGluZ3MiOiJDQUFEO1l5QkNBO2FMQ0EsQVdEQTtnQjNCREEifV1dXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ContainingStringSourceMappingURL.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ContainingStringSourceMappingURL.js
new file mode 100644
index 0000000000000000000000000000000000000000..60f6de6004873eeffd9c68076fb4f87c029ff466
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ContainingStringSourceMappingURL.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+// ?sourceMappingURL=([^\s'"]+)/gm
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 19,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 20,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7Ozs7Ozs7QUFFQTtBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUVBLHNCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGtCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLHFCQUFnQkQsS0FBaEIsV0FERixlQUVFO0FBQVEsSUFBQSxPQUFPLEVBQUUsTUFBTUMsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUEvQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFGRixDQURGO0FBTUQiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IFJlYWN0LCB7dXNlU3RhdGV9IGZyb20gJ3JlYWN0JztcblxuLy8gP3NvdXJjZU1hcHBpbmdVUkw9KFteXFxzJ1wiXSspL2dtXG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IFtjb3VudCwgc2V0Q291bnRdID0gdXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2PlxuICAgICAgPHA+WW91IGNsaWNrZWQge2NvdW50fSB0aW1lczwvcD5cbiAgICAgIDxidXR0b24gb25DbGljaz17KCkgPT4gc2V0Q291bnQoY291bnQgKyAxKX0+Q2xpY2sgbWU8L2J1dHRvbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCJdLCJtYXBwaW5ncyI6IkNBQUQ7ZTRCQ0EsQVdEQSJ9XV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/Example.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/Example.js
new file mode 100644
index 0000000000000000000000000000000000000000..24fd5f2146b1f3ae79c3702a2d0c07cfd541d109
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/Example.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 17,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ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fT5DbGljayBtZTwvYnV0dG9uPlxuICAgIDwvZGl2PlxuICApO1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsImNvdW50Il0sIm1hcHBpbmdzIjoiQ0FBRDthNEJDQSxBV0RBIn1dXV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/InlineRequire.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/InlineRequire.js
new file mode 100644
index 0000000000000000000000000000000000000000..0f7bc884c09566a58a3c68487909e2d75573672b
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/InlineRequire.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+/**
+ * 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.
+ *
+ *
+ */
+function Component() {
+ const [count] = require('react').useState(0);
+
+ return count;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ToDoList.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ToDoList.js
new file mode 100644
index 0000000000000000000000000000000000000000..60355e08aa306b0e4a18ce1214a93b28790897ad
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/ToDoList.js
@@ -0,0 +1,160 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ListItem = ListItem;
+exports.List = List;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ListItem({
+ item,
+ removeItem,
+ toggleItem
+}) {
+ const handleDelete = (0, React.useCallback)(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+ const handleToggle = (0, React.useCallback)(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+ return /*#__PURE__*/React.createElement("li", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 23,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("button", {
+ onClick: handleDelete,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 24,
+ columnNumber: 7
+ }
+ }, "Delete"), /*#__PURE__*/React.createElement("label", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("input", {
+ checked: item.isComplete,
+ onChange: handleToggle,
+ type: "checkbox",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 9
+ }
+ }), ' ', item.text));
+}
+
+function List(props) {
+ const [newItemText, setNewItemText] = (0, React.useState)('');
+ const [items, setItems] = (0, React.useState)([{
+ id: 1,
+ isComplete: true,
+ text: 'First'
+ }, {
+ id: 2,
+ isComplete: true,
+ text: 'Second'
+ }, {
+ id: 3,
+ isComplete: false,
+ text: 'Third'
+ }]);
+ const [uid, setUID] = (0, React.useState)(4);
+ const handleClick = (0, React.useCallback)(() => {
+ if (newItemText !== '') {
+ setItems([...items, {
+ id: uid,
+ isComplete: false,
+ text: newItemText
+ }]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+ const handleKeyPress = (0, React.useCallback)(event => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ }, [handleClick]);
+ const handleChange = (0, React.useCallback)(event => {
+ setNewItemText(event.currentTarget.value);
+ }, [setNewItemText]);
+ const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
+ const toggleItem = (0, React.useCallback)(itemToToggle => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+ setItems(items.slice(0, index).concat({ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete
+ }).concat(items.slice(index + 1)));
+ }, [items]);
+ return /*#__PURE__*/React.createElement(React.Fragment, {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 102,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("h1", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 103,
+ columnNumber: 7
+ }
+ }, "List"), /*#__PURE__*/React.createElement("input", {
+ type: "text",
+ placeholder: "New list item...",
+ value: newItemText,
+ onChange: handleChange,
+ onKeyPress: handleKeyPress,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 104,
+ columnNumber: 7
+ }
+ }), /*#__PURE__*/React.createElement("button", {
+ disabled: newItemText === '',
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 111,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("span", {
+ role: "img",
+ "aria-label": "Add item",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 112,
+ columnNumber: 9
+ }
+ }, "Add")), /*#__PURE__*/React.createElement("ul", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 116,
+ columnNumber: 7
+ }
+ }, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
+ key: item.id,
+ item: item,
+ removeItem: removeItem,
+ toggleItem: toggleItem,
+ __source: {
+ fileName: _jsxFileName,
+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KGl0ZW0gPT4gKFxuICAgICAgICAgIDxMaXN0SXRlbVxuICAgICAgICAgICAga2V5PXtpdGVtLmlkfVxuICAgICAgICAgICAgaXRlbT17aXRlbX1cbiAgICAgICAgICAgIHJlbW92ZUl0ZW09e3JlbW92ZUl0ZW19XG4gICAgICAgICAgICB0b2dnbGVJdGVtPXt0b2dnbGVJdGVtfVxuICAgICAgICAgIC8+XG4gICAgICAgICkpfVxuICAgICAgPC91bD5cbiAgICA8L0ZyYWdtZW50PlxuICApO1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsImhhbmRsZURlbGV0ZSIsImhhbmRsZVRvZ2dsZSIsIm5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJ1aWQiLCJoYW5kbGVDbGljayIsImhhbmRsZUtleVByZXNzIiwiaGFuZGxlQ2hhbmdlIiwicmVtb3ZlSXRlbSIsInRvZ2dsZUl0ZW0iXSwibWFwcGluZ3MiOiJDQUFEO2N1QkNBO2dCQ0RBO2tCREVBO29CQ0ZBO3NDZ0JHQSxBWUhBO3VDeEJJQTsyQ3hCSkE7NENvQktBLEFXTEE7OENiTUE7MkRTTkE7NkROT0E7b0V0QlBBO3NFb0JRQTsyRXBCUkE7NkVrQlNBO2dGbEJUQTtrRmtCVUE7bUdsQlZBIn1dXV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentUsingHooksIndirectly.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentUsingHooksIndirectly.js
new file mode 100644
index 0000000000000000000000000000000000000000..017f18fabb22d50d6a1481c6d9d7c35655d3916b
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentUsingHooksIndirectly.js
@@ -0,0 +1,56 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const countState = (0, _react.useState)(0);
+ const count = countState[0];
+ const setCount = countState[1];
+ const darkMode = useIsDarkMode();
+ const [isDarkMode] = darkMode;
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 29,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 30,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const darkModeState = (0, _react.useState)(false);
+ const [isDarkMode] = darkModeState;
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return [isDarkMode, () => {}];
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50U3RhdGUiLCJjb3VudCIsInNldENvdW50IiwiZGFya01vZGUiLCJ1c2VJc0RhcmtNb2RlIiwiaXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwiZGFya01vZGVTdGF0ZSIsInVzZUVmZmVjdENyZWF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsVUFBVSxHQUFHLHFCQUFTLENBQVQsQ0FBbkI7QUFDQSxRQUFNQyxLQUFLLEdBQUdELFVBQVUsQ0FBQyxDQUFELENBQXhCO0FBQ0EsUUFBTUUsUUFBUSxHQUFHRixVQUFVLENBQUMsQ0FBRCxDQUEzQjtBQUVBLFFBQU1HLFFBQVEsR0FBR0MsYUFBYSxFQUE5QjtBQUNBLFFBQU0sQ0FBQ0MsVUFBRCxJQUFlRixRQUFyQjtBQUVBLHdCQUFVLE1BQU0sQ0FDZDtBQUNELEdBRkQsRUFFRyxFQUZIOztBQUlBLFFBQU1HLFdBQVcsR0FBRyxNQUFNSixRQUFRLENBQUNELEtBQUssR0FBRyxDQUFULENBQWxDOztBQUVBLHNCQUNFLHlFQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLG9CQUFpQkksVUFBakIsQ0FERixlQUVFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGdCQUFhSixLQUFiLENBR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IC8vIC4uLlxuICB9LCBbXSk7XG5cbiAgY29uc3QgaGFuZGxlQ2xpY2sgPSAoKSA9PiBzZXRDb3VudChjb3VudCArIDEpO1xuXG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxkaXY+RGFyayBtb2RlPyB7aXNEYXJrTW9kZX08L2Rpdj5cbiAgICAgIDxkaXY+Q291bnQ6IHtjb3VudH08L2Rpdj5cbiAgICAgIDxidXR0b24gb25DbGljaz17aGFuZGxlQ2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBkYXJrTW9kZVN0YXRlID0gdXNlU3RhdGUoZmFsc2UpO1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSBkYXJrTW9kZVN0YXRlO1xuXG4gIHVzZUVmZmVjdChmdW5jdGlvbiB1c2VFZmZlY3RDcmVhdGUoKSB7XG4gICAgLy8gSGVyZSBpcyB3aGVyZSB3ZSBtYXkgbGlzdGVuIHRvIGEgXCJ0aGVtZVwiIGV2ZW50Li4uXG4gIH0sIFtdKTtcblxuICByZXR1cm4gW2lzRGFya01vZGUsICgpID0+IHt9XTtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCIsImRhcmtNb2RlIiwiaXNEYXJrTW9kZSJdLCJtYXBwaW5ncyI6IkNBQUQ7YXFCQ0EsQVdEQTtpQmJFQSxBZUZBO29DVkdBLEFlSEEifV1dXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithCustomHook.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithCustomHook.js
new file mode 100644
index 0000000000000000000000000000000000000000..d17c19c4b8320d0871c53e519b9cc8899ed9a779
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithCustomHook.js
@@ -0,0 +1,68 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ const isDarkMode = useIsDarkMode();
+ const {
+ foo
+ } = useFoo();
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 27,
+ columnNumber: 7
+ }
+ }, "Foo: ", foo), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const [isDarkMode] = (0, _react.useState)(false);
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return isDarkMode;
+}
+
+function useFoo() {
+ (0, _react.useDebugValue)('foo');
+ return {
+ foo: true
+ };
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhDdXN0b21Ib29rLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiLCJpc0RhcmtNb2RlIiwidXNlSXNEYXJrTW9kZSIsImZvbyIsInVzZUZvbyIsImhhbmRsZUNsaWNrIiwidXNlRWZmZWN0Q3JlYXRlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7Ozs7Ozs7O0FBRU8sU0FBU0EsU0FBVCxHQUFxQjtBQUMxQixRQUFNLENBQUNDLEtBQUQsRUFBUUMsUUFBUixJQUFvQixxQkFBUyxDQUFULENBQTFCO0FBQ0EsUUFBTUMsVUFBVSxHQUFHQyxhQUFhLEVBQWhDO0FBQ0EsUUFBTTtBQUFDQyxJQUFBQTtBQUFELE1BQVFDLE1BQU0sRUFBcEI7QUFFQSx3QkFBVSxNQUFNLENBQ2Q7QUFDRCxHQUZELEVBRUcsRUFGSDs7QUFJQSxRQUFNQyxXQUFXLEdBQUcsTUFBTUwsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUFsQzs7QUFFQSxzQkFDRSx5RUFDRTtBQUFBO0FBQUE7Q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V1dXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithExternalCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithExternalCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..e45008a1590c1e53da76d958795d38f71e5b0b48
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithExternalCustomHooks.js
@@ -0,0 +1,26 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireDefault(require("react"));
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+var _jsxFileName = "";
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function Component() {
+ const theme = (0, _useTheme.default)();
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 10
+ }
+ }, "theme: ", theme);
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsS0FBSyxHQUFHLHdCQUFkO0FBRUEsc0JBQU87QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsZ0JBQWFBLEtBQWIsQ0FBUDtBQUNEIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlVGhlbWUgZnJvbSAnLi91c2VUaGVtZSc7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlVGhlbWUoKTtcblxuICByZXR1cm4gPGRpdj50aGVtZToge3RoZW1lfTwvZGl2Pjtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJ0aGVtZSJdLCJtYXBwaW5ncyI6IkNBQUQ7Y2dCQ0EsQVVEQSJ9XV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js
new file mode 100644
index 0000000000000000000000000000000000000000..656c2b79fd733eb4b1496c2ef3b0bd00311d247f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js
@@ -0,0 +1,30 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const A = /*#__PURE__*/(0, _react.createContext)(1);
+const B = /*#__PURE__*/(0, _react.createContext)(2);
+
+function Component() {
+ const a = (0, _react.useContext)(A);
+ const b = (0, _react.useContext)(B); // prettier-ignore
+
+ const c = (0, _react.useContext)(A),
+ d = (0, _react.useContext)(B); // eslint-disable-line one-var
+
+ return a + b + c + d;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZS5qcyJdLCJuYW1lcyI6WyJBIiwiQiIsIkNvbXBvbmVudCIsImEiLCJiIiwiYyIsImQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7QUFUQTs7Ozs7Ozs7QUFXQSxNQUFNQSxDQUFDLGdCQUFHLDBCQUFjLENBQWQsQ0FBVjtBQUNBLE1BQU1DLENBQUMsZ0JBQUcsMEJBQWMsQ0FBZCxDQUFWOztBQUVPLFNBQVNDLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsQ0FBQyxHQUFHLHVCQUFXSCxDQUFYLENBQVY7QUFDQSxRQUFNSSxDQUFDLEdBQUcsdUJBQVdILENBQVgsQ0FBVixDQUYwQixDQUkxQjs7QUFDQSxRQUFNSSxDQUFDLEdBQUcsdUJBQVdMLENBQVgsQ0FBVjtBQUFBLFFBQXlCTSxDQUFDLEdBQUcsdUJBQVdMLENBQVgsQ0FBN0IsQ0FMMEIsQ0FLa0I7O0FBRTVDLFNBQU9FLENBQUMsR0FBR0MsQ0FBSixHQUFRQyxDQUFSLEdBQVlDLENBQW5CO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0fSBmcm9tICdyZWFjdCc7XG5cbmNvbnN0IEEgPSBjcmVhdGVDb250ZXh0KDEpO1xuY29uc3QgQiA9IGNyZWF0ZUNvbnRleHQoMik7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IGEgPSB1c2VDb250ZXh0KEEpO1xuICBjb25zdCBiID0gdXNlQ29udGV4dChCKTtcblxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgY29uc3QgYyA9IHVzZUNvbnRleHQoQSksIGQgPSB1c2VDb250ZXh0KEIpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG9uZS12YXJcblxuICByZXR1cm4gYSArIGIgKyBjICsgZDtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJhIiwiYiIsImMiLCJkIl0sIm1hcHBpbmdzIjoiQ0FBRDtnQllDQSxBYURBO2lCYkVBLEFhRkE7b0JiR0EsQWFIQSxBTUlBLEFhSkEifV1dXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithNestedHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithNestedHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..b1dfd5ec893751a84f9fd96c57c9a37ac12dcd3e
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithNestedHooks.js
@@ -0,0 +1,28 @@
+"use strict";
+
+/**
+ * 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.
+ *
+ *
+ */
+const {
+ useMemo,
+ useState
+} = require('react');
+
+function Component(props) {
+ const InnerComponent = useMemo(() => () => {
+ const [state] = useState(0);
+ return state;
+ });
+ props.callback(InnerComponent);
+ return null;
+}
+
+module.exports = {
+ Component
+};
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhOZXN0ZWRIb29rcy5qcyJdLCJuYW1lcyI6WyJ1c2VNZW1vIiwidXNlU3RhdGUiLCJyZXF1aXJlIiwiQ29tcG9uZW50IiwicHJvcHMiLCJJbm5lckNvbXBvbmVudCIsInN0YXRlIiwiY2FsbGJhY2siLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7OztBQVFBLE1BQU07QUFBQ0EsRUFBQUEsT0FBRDtBQUFVQyxFQUFBQTtBQUFWLElBQXNCQyxPQUFPLENBQUMsT0FBRCxDQUFuQzs7QUFFQSxTQUFTQyxTQUFULENBQW1CQyxLQUFuQixFQUEwQjtBQUN4QixRQUFNQyxjQUFjLEdBQUdMLE9BQU8sQ0FBQyxNQUFNLE1BQU07QUFDekMsVUF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QTtnQjNCREEifV1dXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ContainingStringSourceMappingURL.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ContainingStringSourceMappingURL.js
new file mode 100644
index 0000000000000000000000000000000000000000..a8769ab709e5067b680d94ed54e8bcf9e05917ab
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ContainingStringSourceMappingURL.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+// ?sourceMappingURL=([^\s'"]+)/gm
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 19,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 20,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7Ozs7Ozs7QUFFQTtBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUVBLHNCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGtCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLHFCQUFnQkQsS0FBaEIsV0FERixlQUVFO0FBQVEsSUFBQSxPQUFPLEVBQUUsTUFBTUMsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUEvQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFGRixDQURGO0FBTUQiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IFJlYWN0LCB7dXNlU3RhdGV9IGZyb20gJ3JlYWN0JztcblxuLy8gP3NvdXJjZU1hcHBpbmdVUkw9KFteXFxzJ1wiXSspL2dtXG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IFtjb3VudCwgc2V0Q291bnRdID0gdXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2PlxuICAgICAgPHA+WW91IGNsaWNrZWQge2NvdW50fSB0aW1lczwvcD5cbiAgICAgIDxidXR0b24gb25DbGljaz17KCkgPT4gc2V0Q291bnQoY291bnQgKyAxKX0+Q2xpY2sgbWU8L2J1dHRvbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCJdLCJtYXBwaW5ncyI6IkNBQUQ7ZTRCQ0EsQVdEQSJ9XV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/Example.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/Example.js
new file mode 100644
index 0000000000000000000000000000000000000000..488613b24b93dab747e64d2905ab091d2444343f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/Example.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 17,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJzZXRDb3VudCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQj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end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/InlineRequire.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/InlineRequire.js
new file mode 100644
index 0000000000000000000000000000000000000000..386cf7dd940389a515ddd18074e8aa2563838c15
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/InlineRequire.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+/**
+ * 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.
+ *
+ *
+ */
+function Component() {
+ const [count] = require('react').useState(0);
+
+ return count;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ToDoList.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ToDoList.js
new file mode 100644
index 0000000000000000000000000000000000000000..dc124978bdba24308f59ccfa6b17a9e9aef41f81
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ToDoList.js
@@ -0,0 +1,160 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ListItem = ListItem;
+exports.List = List;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ListItem({
+ item,
+ removeItem,
+ toggleItem
+}) {
+ const handleDelete = (0, React.useCallback)(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+ const handleToggle = (0, React.useCallback)(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+ return /*#__PURE__*/React.createElement("li", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 23,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("button", {
+ onClick: handleDelete,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 24,
+ columnNumber: 7
+ }
+ }, "Delete"), /*#__PURE__*/React.createElement("label", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("input", {
+ checked: item.isComplete,
+ onChange: handleToggle,
+ type: "checkbox",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 9
+ }
+ }), ' ', item.text));
+}
+
+function List(props) {
+ const [newItemText, setNewItemText] = (0, React.useState)('');
+ const [items, setItems] = (0, React.useState)([{
+ id: 1,
+ isComplete: true,
+ text: 'First'
+ }, {
+ id: 2,
+ isComplete: true,
+ text: 'Second'
+ }, {
+ id: 3,
+ isComplete: false,
+ text: 'Third'
+ }]);
+ const [uid, setUID] = (0, React.useState)(4);
+ const handleClick = (0, React.useCallback)(() => {
+ if (newItemText !== '') {
+ setItems([...items, {
+ id: uid,
+ isComplete: false,
+ text: newItemText
+ }]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+ const handleKeyPress = (0, React.useCallback)(event => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ }, [handleClick]);
+ const handleChange = (0, React.useCallback)(event => {
+ setNewItemText(event.currentTarget.value);
+ }, [setNewItemText]);
+ const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
+ const toggleItem = (0, React.useCallback)(itemToToggle => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+ setItems(items.slice(0, index).concat({ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete
+ }).concat(items.slice(index + 1)));
+ }, [items]);
+ return /*#__PURE__*/React.createElement(React.Fragment, {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 102,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("h1", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 103,
+ columnNumber: 7
+ }
+ }, "List"), /*#__PURE__*/React.createElement("input", {
+ type: "text",
+ placeholder: "New list item...",
+ value: newItemText,
+ onChange: handleChange,
+ onKeyPress: handleKeyPress,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 104,
+ columnNumber: 7
+ }
+ }), /*#__PURE__*/React.createElement("button", {
+ disabled: newItemText === '',
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 111,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("span", {
+ role: "img",
+ "aria-label": "Add item",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 112,
+ columnNumber: 9
+ }
+ }, "Add")), /*#__PURE__*/React.createElement("ul", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 116,
+ columnNumber: 7
+ }
+ }, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
+ key: item.id,
+ item: item,
+ removeItem: removeItem,
+ toggleItem: toggleItem,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 118,
+ columnNumber: 11
+ }
+ }))));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base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lxuICAgICAgICB7aXRlbXMubWFwKGl0ZW0gPT4gKFxuICAgICAgICAgIDxMaXN0SXRlbVxuICAgICAgICAgICAga2V5PXtpdGVtLmlkfVxuICAgICAgICAgICAgaXRlbT17aXRlbX1cbiAgICAgICAgICAgIHJlbW92ZUl0ZW09e3JlbW92ZUl0ZW19XG4gICAgICAgICAgICB0b2dnbGVJdGVtPXt0b2dnbGVJdGVtfVxuICAgICAgICAgIC8+XG4gICAgICAgICkpfVxuICAgICAgPC91bD5cbiAgICA8L0ZyYWdtZW50PlxuICApO1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsImhhbmRsZURlbGV0ZSIsImhhbmRsZVRvZ2dsZSIsIm5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJ1aWQiLCJoYW5kbGVDbGljayIsImhhbmRsZUtleVByZXNzIiwiaGFuZGxlQ2hhbmdlIiwicmVtb3ZlSXRlbSIsInRvZ2dsZUl0ZW0iXSwibWFwcGluZ3MiOiJDQUFEO2N1QkNBO2dCQ0RBO2tCREVBO29CQ0ZBO3NDZ0JHQSxBWUhBO3VDeEJJQTsyQ3hCSkE7NENvQktBLEFXTEE7OENiTUE7MkRTTkE7NkROT0E7b0V0QlBBO3NFb0JRQTsyRXBCUkE7NkVrQlNBO2dGbEJUQTtrRmtCVUE7bUdsQlZBIn1dXV19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..59d6d5140c804a97976e56e6935bd12ef2cba526
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFTQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7OztBQUVBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3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TGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5ebc402409afe6a5618e0de142dc65be71057eb
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsInRoZW1lIl0sIm1hcHBpbmdzIjoiQ0FBRDtlZ0JDQSxBd0JEQSJ9XV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..0f753fd3ebd28b5d8f88e68f558a8eff18e931ee
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFTQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7OztBQUVBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGF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yZX0gZnJvbSAnLi9JbmxpbmVSZXF1aXJlJztcbmltcG9ydCAqIGFzIFRvRG9MaXN0IGZyb20gJy4vVG9Eb0xpc3QnO1xuZXhwb3J0IHtUb0RvTGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..12ef34c24f715e384a35318c62c2872cfa08fa32
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/fb-sources-extended/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsInRoZW1lIl0sIm1hcHBpbmdzIjoiQ0FBRDtlZ0JDQSxBd0JEQSJ9XV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentUsingHooksIndirectly.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentUsingHooksIndirectly.js
new file mode 100644
index 0000000000000000000000000000000000000000..a398aa004003223f2280f646958923b72f7c448f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentUsingHooksIndirectly.js
@@ -0,0 +1,56 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const countState = (0, _react.useState)(0);
+ const count = countState[0];
+ const setCount = countState[1];
+ const darkMode = useIsDarkMode();
+ const [isDarkMode] = darkMode;
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 29,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 30,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const darkModeState = (0, _react.useState)(false);
+ const [isDarkMode] = darkModeState;
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return [isDarkMode, () => {}];
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50U3RhdGUiLCJjb3VudCIsInNldENvdW50IiwiZGFya01vZGUiLCJ1c2VJc0RhcmtNb2RlIiwiaXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwiZGFya01vZGVTdGF0ZSIsInVzZUVmZmVjdENyZWF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsVUFBVSxHQUFHLHFCQUFTLENBQVQsQ0FBbkI7QUFDQSxRQUFNQyxLQUFLLEdBQUdELFVBQVUsQ0FBQyxDQUFELENBQXhCO0FBQ0EsUUFBTUUsUUFBUSxHQUFHRixVQUFVLENBQUMsQ0FBRCxDQUEzQjtBQUVBLFFBQU1HLFFBQVEsR0FBR0MsYUFBYSxFQUE5QjtBQUNBLFFBQU0sQ0FBQ0MsVUFBRCxJQUFlRixRQUFyQjtBQUVBLHdCQUFVLE1BQU0sQ0FDZDtBQUNELEdBRkQsRUFFRyxFQUZIOztBQUlBLFFBQU1HLFdBQVcsR0FBR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W50ID0gY291bnRTdGF0ZVswXTtcbiAgY29uc3Qgc2V0Q291bnQgPSBjb3VudFN0YXRlWzFdO1xuXG4gIGNvbnN0IGRhcmtNb2RlID0gdXNlSXNEYXJrTW9kZSgpO1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSBkYXJrTW9kZTtcblxuICB1c2VFZmZlY3QoKCkgPT4ge1xuICAgIC8vIC4uLlxuICB9LCBbXSk7XG5cbiAgY29uc3QgaGFuZGxlQ2xpY2sgPSAoKSA9PiBzZXRDb3VudChjb3VudCArIDEpO1xuXG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxkaXY+RGFyayBtb2RlPyB7aXNEYXJrTW9kZX08L2Rpdj5cbiAgICAgIDxkaXY+Q291bnQ6IHtjb3VudH08L2Rpdj5cbiAgICAgIDxidXR0b24gb25DbGljaz17aGFuZGxlQ2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBkYXJrTW9kZVN0YXRlID0gdXNlU3RhdGUoZmFsc2UpO1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSBkYXJrTW9kZVN0YXRlO1xuXG4gIHVzZUVmZmVjdChmdW5jdGlvbiB1c2VFZmZlY3RDcmVhdGUoKSB7XG4gICAgLy8gSGVyZSBpcyB3aGVyZSB3ZSBtYXkgbGlzdGVuIHRvIGEgXCJ0aGVtZVwiIGV2ZW50Li4uXG4gIH0sIFtdKTtcblxuICByZXR1cm4gW2lzRGFya01vZGUsICgpID0+IHt9XTtcbn1cbiJdfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithCustomHook.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithCustomHook.js
new file mode 100644
index 0000000000000000000000000000000000000000..33a51f99599949ef78d10d2fa9cdaf31da47669e
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithCustomHook.js
@@ -0,0 +1,68 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ const isDarkMode = useIsDarkMode();
+ const {
+ foo
+ } = useFoo();
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 27,
+ columnNumber: 7
+ }
+ }, "Foo: ", foo), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const [isDarkMode] = (0, _react.useState)(false);
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return isDarkMode;
+}
+
+function useFoo() {
+ (0, _react.useDebugValue)('foo');
+ return {
+ foo: true
+ };
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhDdXN0b21Ib29rLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiLCJpc0RhcmtNb2RlIiwidXNlSXNEYXJrTW9kZSIsImZvbyIsInVzZUZvbyIsImhhbmRsZUNsaWNrIiwidXNlRWZmZWN0Q3JlYXRlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7Ozs7Ozs7O0FBRU8sU0FBU0EsU0FBVCxHQUFxQjtBQUMxQixRQUFNLENBQUNDLEtBQUQsRUFBUUMsUUFBUixJQUFvQixxQkFBUyxDQUFULENBQTFCO0FBQ0EsUUFBTUMsVUFBVSxHQUFHQyxhQUFhLEVBQWhDO0FBQ0EsUUFBTTtBQUFDQyxJQUFBQTtBQUFELE1BQVFDLE1BQU0sRUFBcEI7QUFFQSx3QkFBVSxNQUFNLENBQ2Q7QUFDRCxHQUZELEVBRUcsRUFGSDs7QUFJQSxRQUFNQyxXQUFXLEdBQUcsTUFBTUwsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUFsQzs7QUFFQSxzQkFDRSx5RUFDRTtBQUFBO0FBQUE7QUFBQTtBQUFBO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0Q291bnRdID0gdXNlU3RhdGUoMCk7XG4gIGNvbnN0IGlzRGFya01vZGUgPSB1c2VJc0RhcmtNb2RlKCk7XG4gIGNvbnN0IHtmb299ID0gdXNlRm9vKCk7XG5cbiAgdXNlRWZmZWN0KCgpID0+IHtcbiAgICAvLyAuLi5cbiAgfSwgW10pO1xuXG4gIGNvbnN0IGhhbmRsZUNsaWNrID0gKCkgPT4gc2V0Q291bnQoY291bnQgKyAxKTtcblxuICByZXR1cm4gKFxuICAgIDw+XG4gICAgICA8ZGl2PkRhcmsgbW9kZT8ge2lzRGFya01vZGV9PC9kaXY+XG4gICAgICA8ZGl2PkNvdW50OiB7Y291bnR9PC9kaXY+XG4gICAgICA8ZGl2PkZvbzoge2Zvb308L2Rpdj5cbiAgICAgIDxidXR0b24gb25DbGljaz17aGFuZGxlQ2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSB1c2VTdGF0ZShmYWxzZSk7XG5cbiAgdXNlRWZmZWN0KGZ1bmN0aW9uIHVzZUVmZmVjdENyZWF0ZSgpIHtcbiAgICAvLyBIZXJlIGlzIHdoZXJlIHdlIG1heSBsaXN0ZW4gdG8gYSBcInRoZW1lXCIgZXZlbnQuLi5cbiAgfSwgW10pO1xuXG4gIHJldHVybiBpc0RhcmtNb2RlO1xufVxuXG5mdW5jdGlvbiB1c2VGb28oKSB7XG4gIHVzZURlYnVnVmFsdWUoJ2ZvbycpO1xuICByZXR1cm4ge2ZvbzogdHJ1ZX07XG59XG4iXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithExternalCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithExternalCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..78b83cfae95c98ca44f89e444b1e7d93d80ea3e2
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithExternalCustomHooks.js
@@ -0,0 +1,26 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireDefault(require("react"));
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+var _jsxFileName = "";
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function Component() {
+ const theme = (0, _useTheme.default)();
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 10
+ }
+ }, "theme: ", theme);
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsS0FBSyxHQUFHLHdCQUFkO0FBRUEsc0JBQU87QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsZ0JBQWFBLEtBQWIsQ0FBUDtBQUNEIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlVGhlbWUgZnJvbSAnLi91c2VUaGVtZSc7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlVGhlbWUoKTtcblxuICByZXR1cm4gPGRpdj50aGVtZToge3RoZW1lfTwvZGl2Pjtcbn1cbiJdfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithMultipleHooksPerLine.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithMultipleHooksPerLine.js
new file mode 100644
index 0000000000000000000000000000000000000000..064a5d11b70953dc94ed0cf293af6d9661a5189a
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithMultipleHooksPerLine.js
@@ -0,0 +1,30 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const A = /*#__PURE__*/(0, _react.createContext)(1);
+const B = /*#__PURE__*/(0, _react.createContext)(2);
+
+function Component() {
+ const a = (0, _react.useContext)(A);
+ const b = (0, _react.useContext)(B); // prettier-ignore
+
+ const c = (0, _react.useContext)(A),
+ d = (0, _react.useContext)(B); // eslint-disable-line one-var
+
+ return a + b + c + d;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8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IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0fSBmcm9tICdyZWFjdCc7XG5cbmNvbnN0IEEgPSBjcmVhdGVDb250ZXh0KDEpO1xuY29uc3QgQiA9IGNyZWF0ZUNvbnRleHQoMik7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IGEgPSB1c2VDb250ZXh0KEEpO1xuICBjb25zdCBiID0gdXNlQ29udGV4dChCKTtcblxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgY29uc3QgYyA9IHVzZUNvbnRleHQoQSksIGQgPSB1c2VDb250ZXh0KEIpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG9uZS12YXJcblxuICByZXR1cm4gYSArIGIgKyBjICsgZDtcbn1cbiJdfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithNestedHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithNestedHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..6c8435d90a54c7ff3f8d4289679ac510860c9c23
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ComponentWithNestedHooks.js
@@ -0,0 +1,28 @@
+"use strict";
+
+/**
+ * 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.
+ *
+ *
+ */
+const {
+ useMemo,
+ useState
+} = require('react');
+
+function Component(props) {
+ const InnerComponent = useMemo(() => () => {
+ const [state] = useState(0);
+ return state;
+ });
+ props.callback(InnerComponent);
+ return null;
+}
+
+module.exports = {
+ Component
+};
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtb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XNlTWVtbywgdXNlU3RhdGV9ID0gcmVxdWlyZSgncmVhY3QnKTtcblxuZnVuY3Rpb24gQ29tcG9uZW50KHByb3BzKSB7XG4gIGNvbnN0IElubmVyQ29tcG9uZW50ID0gdXNlTWVtbygoKSA9PiAoKSA9PiB7XG4gICAgY29uc3QgW3N0YXRlXSA9IHVzZVN0YXRlKDApO1xuXG4gICAgcmV0dXJuIHN0YXRlO1xuICB9KTtcbiAgcHJvcHMuY2FsbGJhY2soSW5uZXJDb21wb25lbnQpO1xuXG4gIHJldHVybiBudWxsO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtDb21wb25lbnR9O1xuIl19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ContainingStringSourceMappingURL.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ContainingStringSourceMappingURL.js
new file mode 100644
index 0000000000000000000000000000000000000000..6dde56f8b4c6933ff85657e304ae833bac4da74e
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ContainingStringSourceMappingURL.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+// ?sourceMappingURL=([^\s'"]+)/gm
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 19,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 20,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7Ozs7Ozs7QUFFQTtBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUVBLHNCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGtCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLHFCQUFnQkQsS0FBaEIsV0FERixlQUVFO0FBQVEsSUFBQSxPQUFPLEVBQUUsTUFBTUMsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUEvQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFGRixDQURGO0FBTUQiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IFJlYWN0LCB7dXNlU3RhdGV9IGZyb20gJ3JlYWN0JztcblxuLy8gP3NvdXJjZU1hcHBpbmdVUkw9KFteXFxzJ1wiXSspL2dtXG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IFtjb3VudCwgc2V0Q291bnRdID0gdXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2PlxuICAgICAgPHA+WW91IGNsaWNrZWQge2NvdW50fSB0aW1lczwvcD5cbiAgICAgIDxidXR0b24gb25DbGljaz17KCkgPT4gc2V0Q291bnQoY291bnQgKyAxKX0+Q2xpY2sgbWU8L2J1dHRvbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn1cbiJdfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/Example.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/Example.js
new file mode 100644
index 0000000000000000000000000000000000000000..e0ef94e8f7d8246f759e8e141c9cb708e6cca51b
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/Example.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 17,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJzZXRDb3VudC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vZGl2PlxuICApO1xufVxuIl19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/InlineRequire.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/InlineRequire.js
new file mode 100644
index 0000000000000000000000000000000000000000..352e48c656577175ebe50a242b579ea041f873b9
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/InlineRequire.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+/**
+ * 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.
+ *
+ *
+ */
+function Component() {
+ const [count] = require('react').useState(0);
+
+ return count;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ToDoList.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ToDoList.js
new file mode 100644
index 0000000000000000000000000000000000000000..f0aabdd955fd14190b8f2f6c8b601f0b4f077591
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/ToDoList.js
@@ -0,0 +1,160 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ListItem = ListItem;
+exports.List = List;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ListItem({
+ item,
+ removeItem,
+ toggleItem
+}) {
+ const handleDelete = (0, React.useCallback)(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+ const handleToggle = (0, React.useCallback)(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+ return /*#__PURE__*/React.createElement("li", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 23,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("button", {
+ onClick: handleDelete,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 24,
+ columnNumber: 7
+ }
+ }, "Delete"), /*#__PURE__*/React.createElement("label", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("input", {
+ checked: item.isComplete,
+ onChange: handleToggle,
+ type: "checkbox",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 9
+ }
+ }), ' ', item.text));
+}
+
+function List(props) {
+ const [newItemText, setNewItemText] = (0, React.useState)('');
+ const [items, setItems] = (0, React.useState)([{
+ id: 1,
+ isComplete: true,
+ text: 'First'
+ }, {
+ id: 2,
+ isComplete: true,
+ text: 'Second'
+ }, {
+ id: 3,
+ isComplete: false,
+ text: 'Third'
+ }]);
+ const [uid, setUID] = (0, React.useState)(4);
+ const handleClick = (0, React.useCallback)(() => {
+ if (newItemText !== '') {
+ setItems([...items, {
+ id: uid,
+ isComplete: false,
+ text: newItemText
+ }]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+ const handleKeyPress = (0, React.useCallback)(event => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ }, [handleClick]);
+ const handleChange = (0, React.useCallback)(event => {
+ setNewItemText(event.currentTarget.value);
+ }, [setNewItemText]);
+ const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
+ const toggleItem = (0, React.useCallback)(itemToToggle => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+ setItems(items.slice(0, index).concat({ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete
+ }).concat(items.slice(index + 1)));
+ }, [items]);
+ return /*#__PURE__*/React.createElement(React.Fragment, {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 102,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("h1", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 103,
+ columnNumber: 7
+ }
+ }, "List"), /*#__PURE__*/React.createElement("input", {
+ type: "text",
+ placeholder: "New list item...",
+ value: newItemText,
+ onChange: handleChange,
+ onKeyPress: handleKeyPress,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 104,
+ columnNumber: 7
+ }
+ }), /*#__PURE__*/React.createElement("button", {
+ disabled: newItemText === '',
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 111,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("span", {
+ role: "img",
+ "aria-label": "Add item",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 112,
+ columnNumber: 9
+ }
+ }, "Add")), /*#__PURE__*/React.createElement("ul", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 116,
+ columnNumber: 7
+ }
+ }, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
+ key: item.id,
+ item: item,
+ removeItem: removeItem,
+ toggleItem: toggleItem,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 118,
+ columnNumber: 11
+ }
+ }))));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIj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lbX1cbiAgICAgICAgICAgIHJlbW92ZUl0ZW09e3JlbW92ZUl0ZW19XG4gICAgICAgICAgICB0b2dnbGVJdGVtPXt0b2dnbGVJdGVtfVxuICAgICAgICAgIC8+XG4gICAgICAgICkpfVxuICAgICAgPC91bD5cbiAgICA8L0ZyYWdtZW50PlxuICApO1xufVxuIl19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..4f1023a79fd6e5bdc2af336276477ba53afca38c
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sI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BlckxpbmUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgQ29tcG9uZW50V2l0aE5lc3RlZEhvb2tzfSBmcm9tICcuL0NvbXBvbmVudFdpdGhOZXN0ZWRIb29rcyc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBDb250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTH0gZnJvbSAnLi9Db250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTCc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBFeGFtcGxlfSBmcm9tICcuL0V4YW1wbGUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgSW5saW5lUmVxdWlyZX0gZnJvbSAnLi9JbmxpbmVSZXF1aXJlJztcbmltcG9ydCAqIGFzIFRvRG9MaXN0IGZyb20gJy4vVG9Eb0xpc3QnO1xuZXhwb3J0IHtUb0RvTGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5afc603f43c065943283f6e9cf4917ed4edecdf
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index-map/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..781552cbc211a60395e0434d4b5b7c798a569a97
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7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wcGluZ1VSTH0gZnJvbSAnLi9Db250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTCc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBFeGFtcGxlfSBmcm9tICcuL0V4YW1wbGUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgSW5saW5lUmVxdWlyZX0gZnJvbSAnLi9JbmxpbmVSZXF1aXJlJztcbmltcG9ydCAqIGFzIFRvRG9MaXN0IGZyb20gJy4vVG9Eb0xpc3QnO1xuZXhwb3J0IHtUb0RvTGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentUsingHooksIndirectly.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentUsingHooksIndirectly.js
new file mode 100644
index 0000000000000000000000000000000000000000..1b8fd83c6936a80f95ca568200f348b4731bbeb7
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentUsingHooksIndirectly.js
@@ -0,0 +1,56 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const countState = (0, _react.useState)(0);
+ const count = countState[0];
+ const setCount = countState[1];
+ const darkMode = useIsDarkMode();
+ const [isDarkMode] = darkMode;
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 29,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 30,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const darkModeState = (0, _react.useState)(false);
+ const [isDarkMode] = darkModeState;
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return [isDarkMode, () => {}];
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50U3RhdGUiLCJjb3VudCIsInNldENvdW50IiwiZGFya01vZGUiLCJ1c2VJc0RhcmtNb2RlIiwiaXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwiZGFya01vZGVTdGF0ZSIsInVzZUVmZmVjdENyZWF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOz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VzZUVmZmVjdChmdW5jdGlvbiB1c2VFZmZlY3RDcmVhdGUoKSB7XG4gICAgLy8gSGVyZSBpcyB3aGVyZSB3ZSBtYXkgbGlzdGVuIHRvIGEgXCJ0aGVtZVwiIGV2ZW50Li4uXG4gIH0sIFtdKTtcblxuICByZXR1cm4gW2lzRGFya01vZGUsICgpID0+IHt9XTtcbn1cbiJdLCJ4X3JlYWN0X3NvdXJjZXMiOltbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCIsImRhcmtNb2RlIiwiaXNEYXJrTW9kZSJdLCJtYXBwaW5ncyI6IkNBQUQ7YXFCQ0EsQVdEQTtpQmJFQSxBZUZBO29DVkdBLEFlSEEifV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithCustomHook.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithCustomHook.js
new file mode 100644
index 0000000000000000000000000000000000000000..d8c13a720a3ad797f3c635f5dfcfb56ede905e38
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithCustomHook.js
@@ -0,0 +1,68 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ const isDarkMode = useIsDarkMode();
+ const {
+ foo
+ } = useFoo();
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 27,
+ columnNumber: 7
+ }
+ }, "Foo: ", foo), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const [isDarkMode] = (0, _react.useState)(false);
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return isDarkMode;
+}
+
+function useFoo() {
+ (0, _react.useDebugValue)('foo');
+ return {
+ foo: true
+ };
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhDdXN0b21Ib29rLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiLCJpc0RhcmtNb2RlIiwidXNlSXNEYXJrTW9kZSIsImZvbyIsInVzZUZvbyIsImhhbmRsZ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2VTdGF0ZShmYWxzZSk7XG5cbiAgdXNlRWZmZWN0KGZ1bmN0aW9uIHVzZUVmZmVjdENyZWF0ZSgpIHtcbiAgICAvLyBIZXJlIGlzIHdoZXJlIHdlIG1heSBsaXN0ZW4gdG8gYSBcInRoZW1lXCIgZXZlbnQuLi5cbiAgfSwgW10pO1xuXG4gIHJldHVybiBpc0RhcmtNb2RlO1xufVxuXG5mdW5jdGlvbiB1c2VGb28oKSB7XG4gIHVzZURlYnVnVmFsdWUoJ2ZvbycpO1xuICByZXR1cm4ge2ZvbzogdHJ1ZX07XG59XG4iXSwieF9yZWFjdF9zb3VyY2VzIjpbW3sibmFtZXMiOlsiPG5vLWhvb2s+IiwiY291bnQiLCJpc0RhcmtNb2RlIl0sIm1hcHBpbmdzIjoiQ0FBRDthNEJDQSxBV0RBO2NsQkVBLEFlRkE7a0NiRUEifV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithExternalCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithExternalCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..4c291c467019ec86641654d7360bfca0a09bd384
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithExternalCustomHooks.js
@@ -0,0 +1,26 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireDefault(require("react"));
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+var _jsxFileName = "";
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function Component() {
+ const theme = (0, _useTheme.default)();
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 10
+ }
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__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithMultipleHooksPerLine.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithMultipleHooksPerLine.js
new file mode 100644
index 0000000000000000000000000000000000000000..217ccab272977cb87cde930ba739f50c24de3149
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithMultipleHooksPerLine.js
@@ -0,0 +1,30 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const A = /*#__PURE__*/(0, _react.createContext)(1);
+const B = /*#__PURE__*/(0, _react.createContext)(2);
+
+function Component() {
+ const a = (0, _react.useContext)(A);
+ const b = (0, _react.useContext)(B); // prettier-ignore
+
+ const c = (0, _react.useContext)(A),
+ d = (0, _react.useContext)(B); // eslint-disable-line one-var
+
+ return a + b + c + d;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZS5qcyJdLCJuYW1lcyI6WyJBIiwiQiIsIkNvbXBvbmVudCIsImEiLCJiIiwiYyIsImQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7QUFUQTs7Ozs7Ozs7QUFXQSxNQUFNQSxDQUFDLGdCQUFHLDBCQUFjLENBQWQsQ0FBVjtBQUNBLE1BQU1DLENBQUMsZ0JBQUcsMEJBQWMsQ0FBZCxDQUFWOztBQUVPLFNBQVNDLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsQ0FBQyxHQUFHLHVCQUFXSCxDQUFYL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LCJhIiwiYiIsImMiLCJkIl0sIm1hcHBpbmdzIjoiQ0FBRDtnQllDQSxBYURBO2lCYkVBLEFhRkE7b0JiR0EsQWFIQSxBTUlBLEFhSkEifV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithNestedHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithNestedHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..f84093d27ba35e3eeb3ead386b5d8462257e68bb
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ComponentWithNestedHooks.js
@@ -0,0 +1,28 @@
+"use strict";
+
+/**
+ * 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.
+ *
+ *
+ */
+const {
+ useMemo,
+ useState
+} = require('react');
+
+function Component(props) {
+ const InnerComponent = useMemo(() => () => {
+ const [state] = useState(0);
+ return state;
+ });
+ props.callback(InnerComponent);
+ return null;
+}
+
+module.exports = {
+ Component
+};
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhOZXN0ZWRIb29rcy5qcyJdLCJuYW1lcyI6WyJ1c2VNZW1vIiwidXNlU3RhdGUiLCJyZXF1aXJlIiwiQ29tcG9uZW50IiwicHJvcHMiLCJJbm5lckNvbXBvbmVudCIsInN0YXRlIiwiY2FsbGJhY2siLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7OztBQVFBLE1BQU07QUFBQ0EsRUFBQUEsT0FBRDtBQUFVQyxFQUFBQTtBQUFWLElBQXNCQyxPQUFPLENBQUMsT0FBRCxDQUFuQzs7QUFFQSxTQUFTQy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jxuby1ob29rPiIsIklubmVyQ29tcG9uZW50Iiwic3RhdGUiXSwibWFwcGluZ3MiOiJDQUFEO1l5QkNBO2FMQ0EsQVdEQTtnQjNCREEifV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ContainingStringSourceMappingURL.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ContainingStringSourceMappingURL.js
new file mode 100644
index 0000000000000000000000000000000000000000..4221ec179c6913aa6d98ce469795db320d3e4fc7
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ContainingStringSourceMappingURL.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+// ?sourceMappingURL=([^\s'"]+)/gm
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 19,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 20,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7Ozs7Ozs7QUFFQTtBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUVBLHNCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGtCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLHFCQUFnQkQsS0FBaEIsV0FERixlQUVFO0FBQVEsSUFBQSxPQUFPLEVBQUUsTUFBTUMsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUEvQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFGRixDQURGO0FBTUQiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IFJlYWN0LCB7dXNlU3RhdGV9IGZyb20gJ3JlYWN0JztcblxuLy8gP3NvdXJjZU1hcHBpbmdVUkw9KFteXFxzJ1wiXSspL2dtXG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IFtjb3VudCwgc2V0Q291bnRdID0gdXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2PlxuICAgICAgPHA+WW91IGNsaWNrZWQge2NvdW50fSB0aW1lczwvcD5cbiAgICAgIDxidXR0b24gb25DbGljaz17KCkgPT4gc2V0Q291bnQoY291bnQgKyAxKX0+Q2xpY2sgbWU8L2J1dHRvbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn1cbiJdLCJ4X3JlYWN0X3NvdXJjZXMiOltbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCJdLCJtYXBwaW5ncyI6IkNBQUQ7ZTRCQ0EsQVdEQSJ9XV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/Example.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/Example.js
new file mode 100644
index 0000000000000000000000000000000000000000..124b710ac22eba4ef04493a29a3ad60ff57a9491
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/Example.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 17,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJzZXRDb3VudCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUVBLHNCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGtCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLHFCQUFnQkQsS0FBaEIsV0FERixlQUVFO0FBQVEsSUFBQSxPQUFPLEVBQUUsTUFBTUMsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUEvQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFGRixDQURGO0FBTUQiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IFJlYWN0LCB7dXNlU3RhdGV9IGZyb20gJ3JlYWN0JztcblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50LCBzZXRDb3VudF0gPSB1c2VTdGF0ZSgwKTtcblxuICByZXR1cm4gKFxuICAgIDxkaXY+XG4gICAgICA8cD5Zb3UgY2xpY2tlZCB7Y291bnR9IHRpbWVzPC9wPlxuICAgICAgPGJ1dHRvbiBvbkNsaWNrPXsoKSA9PiBzZXRDb3VudChjb3VudCArIDEpfT5DbGljayBtZTwvYnV0dG9uPlxuICAgIDwvZGl2PlxuICApO1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsImNvdW50Il0sIm1hcHBpbmdzIjoiQ0FBRDthNEJDQSxBV0RBIn1dXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/InlineRequire.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/InlineRequire.js
new file mode 100644
index 0000000000000000000000000000000000000000..15bc20de0b747c43d1d0806307312c90c6e6b52f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/InlineRequire.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+/**
+ * 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.
+ *
+ *
+ */
+function Component() {
+ const [count] = require('react').useState(0);
+
+ return count;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ToDoList.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ToDoList.js
new file mode 100644
index 0000000000000000000000000000000000000000..c07d8d03d08b70096a57b0530153a61bcc821359
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/ToDoList.js
@@ -0,0 +1,160 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ListItem = ListItem;
+exports.List = List;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ListItem({
+ item,
+ removeItem,
+ toggleItem
+}) {
+ const handleDelete = (0, React.useCallback)(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+ const handleToggle = (0, React.useCallback)(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+ return /*#__PURE__*/React.createElement("li", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 23,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("button", {
+ onClick: handleDelete,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 24,
+ columnNumber: 7
+ }
+ }, "Delete"), /*#__PURE__*/React.createElement("label", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("input", {
+ checked: item.isComplete,
+ onChange: handleToggle,
+ type: "checkbox",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 9
+ }
+ }), ' ', item.text));
+}
+
+function List(props) {
+ const [newItemText, setNewItemText] = (0, React.useState)('');
+ const [items, setItems] = (0, React.useState)([{
+ id: 1,
+ isComplete: true,
+ text: 'First'
+ }, {
+ id: 2,
+ isComplete: true,
+ text: 'Second'
+ }, {
+ id: 3,
+ isComplete: false,
+ text: 'Third'
+ }]);
+ const [uid, setUID] = (0, React.useState)(4);
+ const handleClick = (0, React.useCallback)(() => {
+ if (newItemText !== '') {
+ setItems([...items, {
+ id: uid,
+ isComplete: false,
+ text: newItemText
+ }]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+ const handleKeyPress = (0, React.useCallback)(event => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ }, [handleClick]);
+ const handleChange = (0, React.useCallback)(event => {
+ setNewItemText(event.currentTarget.value);
+ }, [setNewItemText]);
+ const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
+ const toggleItem = (0, React.useCallback)(itemToToggle => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+ setItems(items.slice(0, index).concat({ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete
+ }).concat(items.slice(index + 1)));
+ }, [items]);
+ return /*#__PURE__*/React.createElement(React.Fragment, {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 102,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("h1", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 103,
+ columnNumber: 7
+ }
+ }, "List"), /*#__PURE__*/React.createElement("input", {
+ type: "text",
+ placeholder: "New list item...",
+ value: newItemText,
+ onChange: handleChange,
+ onKeyPress: handleKeyPress,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 104,
+ columnNumber: 7
+ }
+ }), /*#__PURE__*/React.createElement("button", {
+ disabled: newItemText === '',
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 111,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("span", {
+ role: "img",
+ "aria-label": "Add item",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 112,
+ columnNumber: 9
+ }
+ }, "Add")), /*#__PURE__*/React.createElement("ul", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 116,
+ columnNumber: 7
+ }
+ }, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
+ key: item.id,
+ item: item,
+ removeItem: removeItem,
+ toggleItem: toggleItem,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 118,
+ columnNumber: 11
+ }
+ }))));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRvRG9MaXN0LmpzIl0sIm5hbWVzIjpbIkxpc3RJdGVtIiwiaXRlbSIsInJlbW92ZUl0ZW0iLCJ0b2dnbGVJdGVtIiwiaGFuZGxlRGVsZXRlIiwiaGFuZGxlVG9nZ2xlIiwiaXNDb21wbGV0ZSIsInRleHQiLCJMaXN0IiwicHJvcHMiLCJuZXdJdGVtVGV4dCIsInNldE5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJzZXRJdGVtcyI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ZSIsImhhbmRsZVRvZ2dsZSIsIm5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJ1aWQiLCJoYW5kbGVDbGljayIsImhhbmRsZUtleVByZXNzIiwiaGFuZGxlQ2hhbmdlIiwicmVtb3ZlSXRlbSIsInRvZ2dsZUl0ZW0iXSwibWFwcGluZ3MiOiJDQUFEO2N1QkNBO2dCQ0RBO2tCREVBO29CQ0ZBO3NDZ0JHQSxBWUhBO3VDeEJJQTsyQ3hCSkE7NENvQktBLEFXTEE7OENiTUE7MkRTTkE7NkROT0E7b0V0QlBBO3NFb0JRQTsyRXBCUkE7NkVrQlNBO2dGbEJUQTtrRmtCVUE7bUdsQlZBIn1dXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentUsingHooksIndirectly.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentUsingHooksIndirectly.js
new file mode 100644
index 0000000000000000000000000000000000000000..8cee7130df057c94d950b75fe8f4a6dc0f082988
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentUsingHooksIndirectly.js
@@ -0,0 +1,56 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const countState = (0, _react.useState)(0);
+ const count = countState[0];
+ const setCount = countState[1];
+ const darkMode = useIsDarkMode();
+ const [isDarkMode] = darkMode;
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 29,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 30,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const darkModeState = (0, _react.useState)(false);
+ const [isDarkMode] = darkModeState;
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return [isDarkMode, () => {}];
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50U3RhdGUiLCJjb3VudCIsInNldENvdW50IiwiZGFya01vZGUiLCJ1c2VJc0RhcmtNb2RlIiwiaXNEYXJr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zdCBkYXJrTW9kZVN0YXRlID0gdXNlU3RhdGUoZmFsc2UpO1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSBkYXJrTW9kZVN0YXRlO1xuXG4gIHVzZUVmZmVjdChmdW5jdGlvbiB1c2VFZmZlY3RDcmVhdGUoKSB7XG4gICAgLy8gSGVyZSBpcyB3aGVyZSB3ZSBtYXkgbGlzdGVuIHRvIGEgXCJ0aGVtZVwiIGV2ZW50Li4uXG4gIH0sIFtdKTtcblxuICByZXR1cm4gW2lzRGFya01vZGUsICgpID0+IHt9XTtcbn1cbiJdLCJ4X3JlYWN0X3NvdXJjZXMiOltbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCIsImRhcmtNb2RlIiwiaXNEYXJrTW9kZSJdLCJtYXBwaW5ncyI6IkNBQUQ7YXFCQ0EsQVdEQTtpQmJFQSxBZUZBO29DVkdBLEFlSEEifV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithCustomHook.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithCustomHook.js
new file mode 100644
index 0000000000000000000000000000000000000000..d0f15fc054f490607fc2da186dba473a604be807
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithCustomHook.js
@@ -0,0 +1,68 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ const isDarkMode = useIsDarkMode();
+ const {
+ foo
+ } = useFoo();
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 27,
+ columnNumber: 7
+ }
+ }, "Foo: ", foo), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const [isDarkMode] = (0, _react.useState)(false);
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return isDarkMode;
+}
+
+function useFoo() {
+ (0, _react.useDebugValue)('foo');
+ return {
+ foo: true
+ };
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtb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ICAgICA8ZGl2PkZvbzoge2Zvb308L2Rpdj5cbiAgICAgIDxidXR0b24gb25DbGljaz17aGFuZGxlQ2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSB1c2VTdGF0ZShmYWxzZSk7XG5cbiAgdXNlRWZmZWN0KGZ1bmN0aW9uIHVzZUVmZmVjdENyZWF0ZSgpIHtcbiAgICAvLyBIZXJlIGlzIHdoZXJlIHdlIG1heSBsaXN0ZW4gdG8gYSBcInRoZW1lXCIgZXZlbnQuLi5cbiAgfSwgW10pO1xuXG4gIHJldHVybiBpc0RhcmtNb2RlO1xufVxuXG5mdW5jdGlvbiB1c2VGb28oKSB7XG4gIHVzZURlYnVnVmFsdWUoJ2ZvbycpO1xuICByZXR1cm4ge2ZvbzogdHJ1ZX07XG59XG4iXSwieF9yZWFjdF9zb3VyY2VzIjpbW3sibmFtZXMiOlsiPG5vLWhvb2s+IiwiY291bnQiLCJpc0RhcmtNb2RlIl0sIm1hcHBpbmdzIjoiQ0FBRDthNEJDQSxBV0RBO2NsQkVBLEFlRkE7a0NiRUEifV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithExternalCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithExternalCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..aa954bd50ae96b2fa2e30c725eaf227a6b7e83da
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithExternalCustomHooks.js
@@ -0,0 +1,26 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireDefault(require("react"));
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+var _jsxFileName = "";
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function Component() {
+ const theme = (0, _useTheme.default)();
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 10
+ }
+ }, "theme: ", theme);
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsS0FBSyxHQUFHLHdCQUFkO0FBRUEsc0JBQU87QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsZ0JBQWFBLEtBQWIsQ0FBUDtBQUNEIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlVGhlbWUgZnJvbSAnLi91c2VUaGVtZSc7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlVGhlbWUoKTtcblxuICByZXR1cm4gPGRpdj50aGVtZToge3RoZW1lfTwvZGl2Pjtcbn1cbiJdLCJ4X3JlYWN0X3NvdXJjZXMiOltbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJ0aGVtZSJdLCJtYXBwaW5ncyI6IkNBQUQ7Y2dCQ0EsQVVEQSJ9XV19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js
new file mode 100644
index 0000000000000000000000000000000000000000..33b7055c8097a395627e738184b025b5f1fbe2f5
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js
@@ -0,0 +1,30 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const A = /*#__PURE__*/(0, _react.createContext)(1);
+const B = /*#__PURE__*/(0, _react.createContext)(2);
+
+function Component() {
+ const a = (0, _react.useContext)(A);
+ const b = (0, _react.useContext)(B); // prettier-ignore
+
+ const c = (0, _react.useContext)(A),
+ d = (0, _react.useContext)(B); // eslint-disable-line one-var
+
+ return a + b + c + d;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp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XG5cbmNvbnN0IEEgPSBjcmVhdGVDb250ZXh0KDEpO1xuY29uc3QgQiA9IGNyZWF0ZUNvbnRleHQoMik7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IGEgPSB1c2VDb250ZXh0KEEpO1xuICBjb25zdCBiID0gdXNlQ29udGV4dChCKTtcblxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgY29uc3QgYyA9IHVzZUNvbnRleHQoQSksIGQgPSB1c2VDb250ZXh0KEIpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG9uZS12YXJcblxuICByZXR1cm4gYSArIGIgKyBjICsgZDtcbn1cbiJdLCJ4X3JlYWN0X3NvdXJjZXMiOltbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJhIiwiYiIsImMiLCJkIl0sIm1hcHBpbmdzIjoiQ0FBRDtnQllDQSxBYURBO2lCYkVBLEFhRkE7b0JiR0EsQWFIQSxBTUlBLEFhSkEifV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithNestedHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithNestedHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..302df16647c2f20f1adbf1132dc9c3ffff8550a2
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithNestedHooks.js
@@ -0,0 +1,28 @@
+"use strict";
+
+/**
+ * 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.
+ *
+ *
+ */
+const {
+ useMemo,
+ useState
+} = require('react');
+
+function Component(props) {
+ const InnerComponent = useMemo(() => () => {
+ const [state] = useState(0);
+ return state;
+ });
+ props.callback(Inner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b3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5jb25zdCB7dXNlTWVtbywgdXNlU3RhdGV9ID0gcmVxdWlyZSgncmVhY3QnKTtcblxuZnVuY3Rpb24gQ29tcG9uZW50KHByb3BzKSB7XG4gIGNvbnN0IElubmVyQ29tcG9uZW50ID0gdXNlTWVtbygoKSA9PiAoKSA9PiB7XG4gICAgY29uc3QgW3N0YXRlXSA9IHVzZVN0YXRlKDApO1xuXG4gICAgcmV0dXJuIHN0YXRlO1xuICB9KTtcbiAgcHJvcHMuY2FsbGJhY2soSW5uZXJDb21wb25lbnQpO1xuXG4gIHJldHVybiBudWxsO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtDb21wb25lbnR9O1xuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsIklubmVyQ29tcG9uZW50Iiwic3RhdGUiXSwibWFwcGluZ3MiOiJDQUFEO1l5QkNBO2FMQ0EsQVdEQTtnQjNCREEifV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ContainingStringSourceMappingURL.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ContainingStringSourceMappingURL.js
new file mode 100644
index 0000000000000000000000000000000000000000..027609f63dcbac113d2bca0ad7381e57cf333e43
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ContainingStringSourceMappingURL.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+// ?sourceMappingURL=([^\s'"]+)/gm
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 19,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 20,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7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J1dHRvbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn1cbiJdLCJ4X3JlYWN0X3NvdXJjZXMiOltbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCJdLCJtYXBwaW5ncyI6IkNBQUQ7ZTRCQ0EsQVdEQSJ9XV19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/Example.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/Example.js
new file mode 100644
index 0000000000000000000000000000000000000000..0b362bd3719747a8dc8972bcec01f5c5a8104e75
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/Example.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 17,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJzZXRDb3VudCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUVBLHNCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGtCQUNFO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLHFCQUFnQkQsS0FBaEIsV0FERixlQUVFO0FBQVEsSUFBQSxPQUFPLEVBQUUsTUFBTUMsUUFBUSxDQUFDRCxLQUFLLEdBQUcsQ0FBVCxDQUEvQjtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFGRixDQURGO0FBTUQiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IFJlYWN0LCB7dXNlU3RhdGV9IGZyb20gJ3JlYWN0JztcblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50LCBzZXRDb3VudF0gPSB1c2VTdGF0ZSgwKTtcblxuICByZXR1cm4gKFxuICAgIDxkaXY+XG4gICAgICA8cD5Zb3UgY2xpY2tlZCB7Y291bnR9IHRpbWVzPC9wPlxuICAgICAgPGJ1dHRvbiBvbkNsaWNrPXsoKSA9PiBzZXRDb3VudChjb3VudCArIDEpfT5DbGljayBtZTwvYnV0dG9uPlxuICAgIDwvZGl2PlxuICApO1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsImNvdW50Il0sIm1hcHBpbmdzIjoiQ0FBRDthNEJDQSxBV0RBIn1dXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/InlineRequire.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/InlineRequire.js
new file mode 100644
index 0000000000000000000000000000000000000000..c8284c7ad8c2bed6e8cb5a504eb85f4813b90f42
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/InlineRequire.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+/**
+ * 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.
+ *
+ *
+ */
+function Component() {
+ const [count] = require('react').useState(0);
+
+ return count;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ToDoList.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ToDoList.js
new file mode 100644
index 0000000000000000000000000000000000000000..196adbf6017679b7694f8b13d2fcc2d17d143e99
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ToDoList.js
@@ -0,0 +1,160 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ListItem = ListItem;
+exports.List = List;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ListItem({
+ item,
+ removeItem,
+ toggleItem
+}) {
+ const handleDelete = (0, React.useCallback)(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+ const handleToggle = (0, React.useCallback)(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+ return /*#__PURE__*/React.createElement("li", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 23,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("button", {
+ onClick: handleDelete,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 24,
+ columnNumber: 7
+ }
+ }, "Delete"), /*#__PURE__*/React.createElement("label", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("input", {
+ checked: item.isComplete,
+ onChange: handleToggle,
+ type: "checkbox",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 9
+ }
+ }), ' ', item.text));
+}
+
+function List(props) {
+ const [newItemText, setNewItemText] = (0, React.useState)('');
+ const [items, setItems] = (0, React.useState)([{
+ id: 1,
+ isComplete: true,
+ text: 'First'
+ }, {
+ id: 2,
+ isComplete: true,
+ text: 'Second'
+ }, {
+ id: 3,
+ isComplete: false,
+ text: 'Third'
+ }]);
+ const [uid, setUID] = (0, React.useState)(4);
+ const handleClick = (0, React.useCallback)(() => {
+ if (newItemText !== '') {
+ setItems([...items, {
+ id: uid,
+ isComplete: false,
+ text: newItemText
+ }]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+ const handleKeyPress = (0, React.useCallback)(event => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ }, [handleClick]);
+ const handleChange = (0, React.useCallback)(event => {
+ setNewItemText(event.currentTarget.value);
+ }, [setNewItemText]);
+ const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
+ const toggleItem = (0, React.useCallback)(itemToToggle => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+ setItems(items.slice(0, index).concat({ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete
+ }).concat(items.slice(index + 1)));
+ }, [items]);
+ return /*#__PURE__*/React.createElement(React.Fragment, {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 102,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("h1", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 103,
+ columnNumber: 7
+ }
+ }, "List"), /*#__PURE__*/React.createElement("input", {
+ type: "text",
+ placeholder: "New list item...",
+ value: newItemText,
+ onChange: handleChange,
+ onKeyPress: handleKeyPress,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 104,
+ columnNumber: 7
+ }
+ }), /*#__PURE__*/React.createElement("button", {
+ disabled: newItemText === '',
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 111,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("span", {
+ role: "img",
+ "aria-label": "Add item",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 112,
+ columnNumber: 9
+ }
+ }, "Add")), /*#__PURE__*/React.createElement("ul", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 116,
+ columnNumber: 7
+ }
+ }, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
+ key: item.id,
+ item: item,
+ removeItem: removeItem,
+ toggleItem: toggleItem,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 118,
+ columnNumber: 11
+ }
+ }))));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRvRG9MaXN0LmpzIl0sIm5hbWVzIjpbIkxpc3RJdGVtIiwiaXRlbSIsInJlbW92ZUl0ZW0iLCJ0b2dnbGVJdGVtIiwiaGFuZGxlRGVsZXRlIiwiaGFuZGxlVG9nZ2xlIiwiaXNDb21wbGV0ZSIsInRleHQiLCJMaXN0IiwicHJvcHMiLCJuZXdJdGVtVGV4dCIsInNldE5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJzZXRJdGVtcyIsImlkIiwidWlkIiwic2V0VUlEIiwiaGFuZGxlQ2xpY2siLCJoYW5kbGVLZXlQcmVzcyIsImV2ZW50Iiwia2V5IiwiaGFuZGxlQ2hhbmdlIiwi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ZGxlQ2hhbmdlIiwicmVtb3ZlSXRlbSIsInRvZ2dsZUl0ZW0iXSwibWFwcGluZ3MiOiJDQUFEO2N1QkNBO2dCQ0RBO2tCREVBO29CQ0ZBO3NDZ0JHQSxBWUhBO3VDeEJJQTsyQ3hCSkE7NENvQktBLEFXTEE7OENiTUE7MkRTTkE7NkROT0E7b0V0QlBBO3NFb0JRQTsyRXBCUkE7NkVrQlNBO2dGbEJUQTtrRmtCVUE7bUdsQlZBIn1dXX19XX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e1b808404583ad28b65fa70de72fa572b8452042
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingUR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9uZW50IGFzIENvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZX0gZnJvbSAnLi9Db21wb25lbnRXaXRoTXVsdGlwbGVIb29rc1BlckxpbmUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgQ29tcG9uZW50V2l0aE5lc3RlZEhvb2tzfSBmcm9tICcuL0NvbXBvbmVudFdpdGhOZXN0ZWRIb29rcyc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBDb250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTH0gZnJvbSAnLi9Db250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTCc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBFeGFtcGxlfSBmcm9tICcuL0V4YW1wbGUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgSW5saW5lUmVxdWlyZX0gZnJvbSAnLi9JbmxpbmVSZXF1aXJlJztcbmltcG9ydCAqIGFzIFRvRG9MaXN0IGZyb20gJy4vVG9Eb0xpc3QnO1xuZXhwb3J0IHtUb0RvTGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dfX1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..7866cfbb90fe3bbdbb306f04a44354349c837112
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsInRoZW1lIl0sIm1hcHBpbmdzIjoiQ0FBRDtlZ0JDQSxBd0JEQSJ9XV19fV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..d0e793c8f72b3015c5641d22f2551d0e76a1b4ca
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFTQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7OztBQUVBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5fSBmcm9tICcuL0NvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5JztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhDdXN0b21Ib29rfSBmcm9tICcuL0NvbXBvbmVudFdpdGhDdXN0b21Ib29rJztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzfSBmcm9tICcuL0NvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzJztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZX0gZnJvbSAnLi9Db21wb25lbnRXaXRoTXVsdGlwbGVIb29rc1BlckxpbmUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgQ29tcG9uZW50V2l0aE5lc3RlZEhvb2tzfSBmcm9tICcuL0NvbXBvbmVudFdpdGhOZXN0ZWRIb29rcyc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBDb250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTH0gZnJvbSAnLi9Db250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTCc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBFeGFtcGxlfSBmcm9tICcuL0V4YW1wbGUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgSW5saW5lUmVxdWlyZX0gZnJvbSAnLi9JbmxpbmVSZXF1aXJlJztcbmltcG9ydCAqIGFzIFRvRG9MaXN0IGZyb20gJy4vVG9Eb0xpc3QnO1xuZXhwb3J0IHtUb0RvTGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..afc84c3a9aadf1939e9dda7f41c83ca1c869ed51
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/react-sources-extended/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsInRoZW1lIl0sIm1hcHBpbmdzIjoiQ0FBRDtlZ0JDQSxBd0JEQSJ9XV19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..53bfb2b60956b912f1cfb34481c12afa55f89085
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/inline/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentUsingHooksIndirectly.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentUsingHooksIndirectly.js
new file mode 100644
index 0000000000000000000000000000000000000000..3b1a5ad57417a1a3b75cae09ac3dbe20e67f1f48
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentUsingHooksIndirectly.js
@@ -0,0 +1,56 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const countState = (0, _react.useState)(0);
+ const count = countState[0];
+ const setCount = countState[1];
+ const darkMode = useIsDarkMode();
+ const [isDarkMode] = darkMode;
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 29,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 30,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const darkModeState = (0, _react.useState)(false);
+ const [isDarkMode] = darkModeState;
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return [isDarkMode, () => {}];
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50U3RhdGUiLCJjb3VudCIsInNldENvdW50IiwiZGFya01vZGUiLCJ1c2VJc0RhcmtNb2RlIiwiaXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwiZGFya01vZGVTdGF0ZSIsInVzZUVmZmVjdENyZWF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVBLFNBQUFBLFNBQUEsR0FBQTtBQUNBLFFBQUFDLFVBQUEsR0FBQSxxQkFBQSxDQUFBLENBQUE7QUFDQSxRQUFBQyxLQUFBLEdBQUFELFVBQUEsQ0FBQSxDQUFBLENBQUE7QUFDQSxRQUFBRSxRQUFBLEdBQUFGLFVBQUEsQ0FBQSxDQUFBLENBQUE7QUFFQSxRQUFBRyxRQUFBLEdBQUFDLGFBQUEsRUFBQTtBQUNBLFFBQUEsQ0FBQUMsVUFBQSxJQUFBRixRQUFBO0FBRUEsd0JBQUEsTUFBQSxDQUNBO0FBQ0EsR0FGQSxFQUVBLEVBRkE7O0FBSUEsUUFBQUcsV0FBQSxHQUFBLE1BQUFKLFFBQUEsQ0FBQUQsS0FBQSxHQUFBLENBQUEsQ0FBQTs7QUFFQSxzQkFDQSx5RUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxvQk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b25zdCBbaXNEYXJrTW9kZV0gPSBkYXJrTW9kZTtcblxuICB1c2VFZmZlY3QoKCkgPT4ge1xuICAgIC8vIC4uLlxuICB9LCBbXSk7XG5cbiAgY29uc3QgaGFuZGxlQ2xpY2sgPSAoKSA9PiBzZXRDb3VudChjb3VudCArIDEpO1xuXG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIDxkaXY+RGFyayBtb2RlPyB7aXNEYXJrTW9kZX08L2Rpdj5cbiAgICAgIDxkaXY+Q291bnQ6IHtjb3VudH08L2Rpdj5cbiAgICAgIDxidXR0b24gb25DbGljaz17aGFuZGxlQ2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBkYXJrTW9kZVN0YXRlID0gdXNlU3RhdGUoZmFsc2UpO1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSBkYXJrTW9kZVN0YXRlO1xuXG4gIHVzZUVmZmVjdChmdW5jdGlvbiB1c2VFZmZlY3RDcmVhdGUoKSB7XG4gICAgLy8gSGVyZSBpcyB3aGVyZSB3ZSBtYXkgbGlzdGVuIHRvIGEgXCJ0aGVtZVwiIGV2ZW50Li4uXG4gIH0sIFtdKTtcblxuICByZXR1cm4gW2lzRGFya01vZGUsICgpID0+IHt9XTtcbn1cbiJdfQ==
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithCustomHook.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithCustomHook.js
new file mode 100644
index 0000000000000000000000000000000000000000..055244b33a7baeddf76b7335e304146fed87ad18
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithCustomHook.js
@@ -0,0 +1,68 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ const isDarkMode = useIsDarkMode();
+ const {
+ foo
+ } = useFoo();
+ (0, _react.useEffect)(() => {// ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 7
+ }
+ }, "Count: ", count), /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 27,
+ columnNumber: 7
+ }
+ }, "Foo: ", foo), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 28,
+ columnNumber: 7
+ }
+ }, "Update count"));
+}
+
+function useIsDarkMode() {
+ const [isDarkMode] = (0, _react.useState)(false);
+ (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
+ }, []);
+ return isDarkMode;
+}
+
+function useFoo() {
+ (0, _react.useDebugValue)('foo');
+ return {
+ foo: true
+ };
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhDdXN0b21Ib29rLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiLCJpc0RhcmtNb2RlIiwidXNlSXNEYXJrTW9kZSIsImZvbyIsInVzZUZvbyIsImhhbmRsZUNsaWNrIiwidXNlRWZmZWN0Q3JlYXRlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7Ozs7Ozs7O0FBRUEsU0FBQUEsU0FBQSxHQUFBO0FBQ0EsUUFBQSxDQUFBQyxLQUFBLEVBQUFDLFFBQUEsSUFBQSxxQkFBQSxDQUFBLENBQUE7QUFDQSxRQUFBQyxVQUFBLEdBQUFDLGFBQUEsRUFBQTtBQUNBLFFBQUE7QUFBQUMsSUFBQUE7QUFBQSxNQUFBQyxNQUFBLEVBQUE7QUFFQSx3QkFBQSxNQUFBLENBQ0E7QUFDQSxHQUZBLEVBRUEsRUFGQTs7QUFJQSxRQUFBQyxXQUFBLEdBQUEsTUFBQUwsUUFBQSxDQUFBRCxLQUFBLEdBQUEsQ0FBQSxDQUFBOztBQUVBLHNCQUNBLHlFQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLG9CQUFBRSxVQUFBLENBREEsZUFFQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxnQkFBQUYsS0FBQSxDQUZBLGVBR0E7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsY0FBQUksR0FBQSxDQUhBLGVBSUE7QUFBQSxJQUFBLE9BQUEsRUFBQUUsV0FBQTtBQUFBO0FBQUE7QU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iAgICA8PlxuICAgICAgPGRpdj5EYXJrIG1vZGU/IHtpc0RhcmtNb2RlfTwvZGl2PlxuICAgICAgPGRpdj5Db3VudDoge2NvdW50fTwvZGl2PlxuICAgICAgPGRpdj5Gb286IHtmb299PC9kaXY+XG4gICAgICA8YnV0dG9uIG9uQ2xpY2s9e2hhbmRsZUNsaWNrfT5VcGRhdGUgY291bnQ8L2J1dHRvbj5cbiAgICA8Lz5cbiAgKTtcbn1cblxuZnVuY3Rpb24gdXNlSXNEYXJrTW9kZSgpIHtcbiAgY29uc3QgW2lzRGFya01vZGVdID0gdXNlU3RhdGUoZmFsc2UpO1xuXG4gIHVzZUVmZmVjdChmdW5jdGlvbiB1c2VFZmZlY3RDcmVhdGUoKSB7XG4gICAgLy8gSGVyZSBpcyB3aGVyZSB3ZSBtYXkgbGlzdGVuIHRvIGEgXCJ0aGVtZVwiIGV2ZW50Li4uXG4gIH0sIFtdKTtcblxuICByZXR1cm4gaXNEYXJrTW9kZTtcbn1cblxuZnVuY3Rpb24gdXNlRm9vKCkge1xuICB1c2VEZWJ1Z1ZhbHVlKCdmb28nKTtcbiAgcmV0dXJuIHtmb286IHRydWV9O1xufVxuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithExternalCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithExternalCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..7f0b1b1104f80ec882e563ed2c8642a1bd6b44c0
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithExternalCustomHooks.js
@@ -0,0 +1,26 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireDefault(require("react"));
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+var _jsxFileName = "";
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function Component() {
+ const theme = (0, _useTheme.default)();
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 10
+ }
+ }, "theme: ", theme);
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7OztBQUVBLFNBQUFBLFNBQUEsR0FBQTtBQUNBLFFBQUFDLEtBQUEsR0FBQSx3QkFBQTtBQUVBLHNCQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGdCQUFBQSxLQUFBLENBQUE7QUFDQSIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSBGYWNlYm9vaywgSW5jLiBhbmQgaXRzIGFmZmlsaWF0ZXMuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UgZm91bmQgaW4gdGhlXG4gKiBMSUNFTlNFIGZpbGUgaW4gdGhlIHJvb3QgZGlyZWN0b3J5IG9mIHRoaXMgc291cmNlIHRyZWUuXG4gKlxuICogQGZsb3dcbiAqL1xuXG5pbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IHVzZVRoZW1lIGZyb20gJy4vdXNlVGhlbWUnO1xuXG5leHBvcnQgZnVuY3Rpb24gQ29tcG9uZW50KCkge1xuICBjb25zdCB0aGVtZSA9IHVzZVRoZW1lKCk7XG5cbiAgcmV0dXJuIDxkaXY+dGhlbWU6IHt0aGVtZX08L2Rpdj47XG59XG4iXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithMultipleHooksPerLine.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithMultipleHooksPerLine.js
new file mode 100644
index 0000000000000000000000000000000000000000..da7eb15f2efec4fc9353e87acd845d7580994b64
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithMultipleHooksPerLine.js
@@ -0,0 +1,30 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const A = /*#__PURE__*/(0, _react.createContext)(1);
+const B = /*#__PURE__*/(0, _react.createContext)(2);
+
+function Component() {
+ const a = (0, _react.useContext)(A);
+ const b = (0, _react.useContext)(B); // prettier-ignore
+
+ const c = (0, _react.useContext)(A),
+ d = (0, _react.useContext)(B); // eslint-disable-line one-var
+
+ return a + b + c + d;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZS5qcyJdLCJuYW1lcyI6WyJBIiwiQiIsIkNvbXBvbmVudCIsImEiLCJiIiwiYyIsImQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7QUFUQTs7Ozs7Ozs7QUFXQSxNQUFBQSxDQUFBLGdCQUFBLDBCQUFBLENBQUEsQ0FBQTtBQUNBLE1BQUFDLENBQUEsZ0JBQUEsMEJBQUEsQ0FBQSxDQUFBOztBQUVBLFNBQUFDLFNBQUEsR0FBQTtBQUNBLFFBQUFDLENBQUEsR0FBQSx1QkFBQUgsQ0FBQSxDQUFBO0FBQ0EsUUFBQUksQ0FBQSxHQUFBLHVCQUFBSCxDQUFBLENBQUEsQ0FGQSxDQUlBOztBQUNBLFFBQUFJLENBQUEsR0FBQSx1QkFBQUwsQ0FBQSxDQUFBO0FBQUEsUUFBQU0sQ0FBQSxHQUFBLHVCQUFBTCxDQUFBLENBQUEsQ0FMQSxDQUtBOztBQUVBLFNBQUFFLENBQUEsR0FBQUMsQ0FBQSxHQUFBQyxDQUFBLEdBQUFDLENBQUE7QUFDQSIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSBGYWNlYm9vaywgSW5jLiBhbmQgaXRzIGFmZmlsaWF0ZXMuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UgZm91bmQgaW4gdGhlXG4gKiBMSUNFTlNFIGZpbGUgaW4gdGhlIHJvb3QgZGlyZWN0b3J5IG9mIHRoaXMgc291cmNlIHRyZWUuXG4gKlxuICogQGZsb3dcbiAqL1xuXG5pbXBvcnQge2NyZWF0ZUNvbnRleHQsIHVzZUNvbnRleHR9IGZyb20gJ3JlYWN0JztcblxuY29uc3QgQSA9IGNyZWF0ZUNvbnRleHQoMSk7XG5jb25zdCBCID0gY3JlYXRlQ29udGV4dCgyKTtcblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgYSA9IHVzZUNvbnRleHQoQSk7XG4gIGNvbnN0IGIgPSB1c2VDb250ZXh0KEIpO1xuXG4gIC8vIHByZXR0aWVyLWlnbm9yZVxuICBjb25zdCBjID0gdXNlQ29udGV4dChBKSwgZCA9IHVzZUNvbnRleHQoQik7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgb25lLXZhclxuXG4gIHJldHVybiBhICsgYiArIGMgKyBkO1xufVxuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithNestedHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithNestedHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..8b7f8607b96de1b681f6245702b7a3267f6a8922
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ComponentWithNestedHooks.js
@@ -0,0 +1,28 @@
+"use strict";
+
+/**
+ * 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.
+ *
+ *
+ */
+const {
+ useMemo,
+ useState
+} = require('react');
+
+function Component(props) {
+ const InnerComponent = useMemo(() => () => {
+ const [state] = useState(0);
+ return state;
+ });
+ props.callback(InnerComponent);
+ return null;
+}
+
+module.exports = {
+ Component
+};
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhOZXN0ZWRIb29rcy5qcyJdLCJuYW1lcyI6WyJ1c2VNZW1vIiwidXNlU3RhdGUiLCJyZXF1aXJlIiwiQ29tcG9uZW50IiwicHJvcHMiLCJJbm5lckNvbXBvbmVudCIsInN0YXRlIiwiY2FsbGJhY2siLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7OztBQVFBLE1BQUE7QUFBQUEsRUFBQUEsT0FBQTtBQUFBQyxFQUFBQTtBQUFBLElBQUFDLE9BQUEsQ0FBQSxPQUFBLENBQUE7O0FBRUEsU0FBQUMsU0FBQSxDQUFBQyxLQUFBLEVBQUE7QUFDQSxRQUFBQyxjQUFBLEdBQUFMLE9BQUEsQ0FBQSxNQUFBLE1BQUE7QUFDQSxVQUFBLENBQUFNLEtBQUEsSUFBQUwsUUFBQSxDQUFBLENBQUEsQ0FBQTtBQUVBLFdBQUFLLEtBQUE7QUFDQSxHQUpBLENBQUE7QUFLQUYsRUFBQUEsS0FBQSxDQUFBRyxRQUFBLENBQUFGLGNBQUE7QUFFQSxTQUFBLElBQUE7QUFDQTs7QUFFQUcsTUFBQSxDQUFBQyxPQUFBLEdBQUE7QUFBQU4sRUFBQUE7QUFBQSxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5jb25zdCB7dXNlTWVtbywgdXNlU3RhdGV9ID0gcmVxdWlyZSgncmVhY3QnKTtcblxuZnVuY3Rpb24gQ29tcG9uZW50KHByb3BzKSB7XG4gIGNvbnN0IElubmVyQ29tcG9uZW50ID0gdXNlTWVtbygoKSA9PiAoKSA9PiB7XG4gICAgY29uc3QgW3N0YXRlXSA9IHVzZVN0YXRlKDApO1xuXG4gICAgcmV0dXJuIHN0YXRlO1xuICB9KTtcbiAgcHJvcHMuY2FsbGJhY2soSW5uZXJDb21wb25lbnQpO1xuXG4gIHJldHVybiBudWxsO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtDb21wb25lbnR9O1xuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ContainingStringSourceMappingURL.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ContainingStringSourceMappingURL.js
new file mode 100644
index 0000000000000000000000000000000000000000..50d73d23db2e53235921eb399838af59e399266f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ContainingStringSourceMappingURL.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+// ?sourceMappingURL=([^\s'"]+)/gm
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 19,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 20,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsIm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1dHRvbiBvbkNsaWNrPXsoKSA9PiBzZXRDb3VudChjb3VudCArIDEpfT5DbGljayBtZTwvYnV0dG9uPlxuICAgIDwvZGl2PlxuICApO1xufVxuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/Example.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/Example.js
new file mode 100644
index 0000000000000000000000000000000000000000..aca089340fb2f1d5c40a82911b97703056e98d9c
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/Example.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function Component() {
+ const [count, setCount] = (0, _react.useState)(0);
+ return /*#__PURE__*/_react.default.createElement("div", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 16,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/_react.default.createElement("p", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 17,
+ columnNumber: 7
+ }
+ }, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
+ onClick: () => setCount(count + 1),
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 18,
+ columnNumber: 7
+ }
+ }, "Click me"));
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJzZXRDb3VudCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7OztBQUVBLFNBQUFBLFNBQUEsR0FBQTtBQUNBLFFBQUEsQ0FBQUMsS0FBQSxFQUFBQyxRQUFBLElBQUEscUJBQUEsQ0FBQSxDQUFBO0FBRUEsc0JBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsa0JBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUEscUJBQUFELEtBQUEsV0FEQSxlQUVBO0FBQUEsSUFBQSxPQUFBLEVBQUEsTUFBQUMsUUFBQSxDQUFBRCxLQUFBLEdBQUEsQ0FBQSxDQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLGdCQUZBLENBREE7QUFNQSIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSBGYWNlYm9vaywgSW5jLiBhbmQgaXRzIGFmZmlsaWF0ZXMuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UgZm91bmQgaW4gdGhlXG4gKiBMSUNFTlNFIGZpbGUgaW4gdGhlIHJvb3QgZGlyZWN0b3J5IG9mIHRoaXMgc291cmNlIHRyZWUuXG4gKlxuICogQGZsb3dcbiAqL1xuXG5pbXBvcnQgUmVhY3QsIHt1c2VTdGF0ZX0gZnJvbSAncmVhY3QnO1xuXG5leHBvcnQgZnVuY3Rpb24gQ29tcG9uZW50KCkge1xuICBjb25zdCBbY291bnQsIHNldENvdW50XSA9IHVzZVN0YXRlKDApO1xuXG4gIHJldHVybiAoXG4gICAgPGRpdj5cbiAgICAgIDxwPllvdSBjbGlja2VkIHtjb3VudH0gdGltZXM8L3A+XG4gICAgICA8YnV0dG9uIG9uQ2xpY2s9eygpID0+IHNldENvdW50KGNvdW50ICsgMSl9PkNsaWNrIG1lPC9idXR0b24+XG4gICAgPC9kaXY+XG4gICk7XG59XG4iXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/InlineRequire.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/InlineRequire.js
new file mode 100644
index 0000000000000000000000000000000000000000..0cc865be3e85b4a7fdc09982e64e45b8a2bed2f2
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/InlineRequire.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Component = Component;
+
+/**
+ * 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.
+ *
+ *
+ */
+function Component() {
+ const [count] = require('react').useState(0);
+
+ return count;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTQSxTQUFBQSxTQUFBLEdBQUE7QUFDQSxRQUFBLENBQUFDLEtBQUEsSUFBQUMsT0FBQSxDQUFBLE9BQUEsQ0FBQSxDQUFBQyxRQUFBLENBQUEsQ0FBQSxDQUFBOztBQUVBLFNBQUFGLEtBQUE7QUFDQSIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSBGYWNlYm9vaywgSW5jLiBhbmQgaXRzIGFmZmlsaWF0ZXMuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UgZm91bmQgaW4gdGhlXG4gKiBMSUNFTlNFIGZpbGUgaW4gdGhlIHJvb3QgZGlyZWN0b3J5IG9mIHRoaXMgc291cmNlIHRyZWUuXG4gKlxuICogQGZsb3dcbiAqL1xuXG5leHBvcnQgZnVuY3Rpb24gQ29tcG9uZW50KCkge1xuICBjb25zdCBbY291bnRdID0gcmVxdWlyZSgncmVhY3QnKS51c2VTdGF0ZSgwKTtcblxuICByZXR1cm4gY291bnQ7XG59XG4iXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ToDoList.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ToDoList.js
new file mode 100644
index 0000000000000000000000000000000000000000..c3efb4e4861e49de48492d7dbbcdb9de382fa845
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/ToDoList.js
@@ -0,0 +1,160 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ListItem = ListItem;
+exports.List = List;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _jsxFileName = "";
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ListItem({
+ item,
+ removeItem,
+ toggleItem
+}) {
+ const handleDelete = (0, React.useCallback)(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+ const handleToggle = (0, React.useCallback)(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+ return /*#__PURE__*/React.createElement("li", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 23,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("button", {
+ onClick: handleDelete,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 24,
+ columnNumber: 7
+ }
+ }, "Delete"), /*#__PURE__*/React.createElement("label", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 25,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("input", {
+ checked: item.isComplete,
+ onChange: handleToggle,
+ type: "checkbox",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 26,
+ columnNumber: 9
+ }
+ }), ' ', item.text));
+}
+
+function List(props) {
+ const [newItemText, setNewItemText] = (0, React.useState)('');
+ const [items, setItems] = (0, React.useState)([{
+ id: 1,
+ isComplete: true,
+ text: 'First'
+ }, {
+ id: 2,
+ isComplete: true,
+ text: 'Second'
+ }, {
+ id: 3,
+ isComplete: false,
+ text: 'Third'
+ }]);
+ const [uid, setUID] = (0, React.useState)(4);
+ const handleClick = (0, React.useCallback)(() => {
+ if (newItemText !== '') {
+ setItems([...items, {
+ id: uid,
+ isComplete: false,
+ text: newItemText
+ }]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+ const handleKeyPress = (0, React.useCallback)(event => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ }, [handleClick]);
+ const handleChange = (0, React.useCallback)(event => {
+ setNewItemText(event.currentTarget.value);
+ }, [setNewItemText]);
+ const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
+ const toggleItem = (0, React.useCallback)(itemToToggle => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+ setItems(items.slice(0, index).concat({ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete
+ }).concat(items.slice(index + 1)));
+ }, [items]);
+ return /*#__PURE__*/React.createElement(React.Fragment, {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 102,
+ columnNumber: 5
+ }
+ }, /*#__PURE__*/React.createElement("h1", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 103,
+ columnNumber: 7
+ }
+ }, "List"), /*#__PURE__*/React.createElement("input", {
+ type: "text",
+ placeholder: "New list item...",
+ value: newItemText,
+ onChange: handleChange,
+ onKeyPress: handleKeyPress,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 104,
+ columnNumber: 7
+ }
+ }), /*#__PURE__*/React.createElement("button", {
+ disabled: newItemText === '',
+ onClick: handleClick,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 111,
+ columnNumber: 7
+ }
+ }, /*#__PURE__*/React.createElement("span", {
+ role: "img",
+ "aria-label": "Add item",
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 112,
+ columnNumber: 9
+ }
+ }, "Add")), /*#__PURE__*/React.createElement("ul", {
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 116,
+ columnNumber: 7
+ }
+ }, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
+ key: item.id,
+ item: item,
+ removeItem: removeItem,
+ toggleItem: toggleItem,
+ __source: {
+ fileName: _jsxFileName,
+ lineNumber: 118,
+ columnNumber: 11
+ }
+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ZlSXRlbT17cmVtb3ZlSXRlbX1cbiAgICAgICAgICAgIHRvZ2dsZUl0ZW09e3RvZ2dsZUl0ZW19XG4gICAgICAgICAgLz5cbiAgICAgICAgKSl9XG4gICAgICA8L3VsPlxuICAgIDwvRnJhZ21lbnQ+XG4gICk7XG59XG4iXX0=
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..781552cbc211a60395e0434d4b5b7c798a569a97
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/index.js
@@ -0,0 +1,89 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
+ enumerable: true,
+ get: function () {
+ return _ComponentUsingHooksIndirectly.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithCustomHook", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithCustomHook.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithExternalCustomHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithMultipleHooksPerLine.Component;
+ }
+});
+Object.defineProperty(exports, "ComponentWithNestedHooks", {
+ enumerable: true,
+ get: function () {
+ return _ComponentWithNestedHooks.Component;
+ }
+});
+Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
+ enumerable: true,
+ get: function () {
+ return _ContainingStringSourceMappingURL.Component;
+ }
+});
+Object.defineProperty(exports, "Example", {
+ enumerable: true,
+ get: function () {
+ return _Example.Component;
+ }
+});
+Object.defineProperty(exports, "InlineRequire", {
+ enumerable: true,
+ get: function () {
+ return _InlineRequire.Component;
+ }
+});
+Object.defineProperty(exports, "useTheme", {
+ enumerable: true,
+ get: function () {
+ return _useTheme.default;
+ }
+});
+exports.ToDoList = void 0;
+
+var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
+
+var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
+
+var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
+
+var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
+
+var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
+
+var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
+
+var _Example = require("./Example");
+
+var _InlineRequire = require("./InlineRequire");
+
+var ToDoList = _interopRequireWildcard(require("./ToDoList"));
+
+exports.ToDoList = ToDoList;
+
+var _useTheme = _interopRequireDefault(require("./useTheme"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7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rcyc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBDb250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTH0gZnJvbSAnLi9Db250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTCc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBFeGFtcGxlfSBmcm9tICcuL0V4YW1wbGUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgSW5saW5lUmVxdWlyZX0gZnJvbSAnLi9JbmxpbmVSZXF1aXJlJztcbmltcG9ydCAqIGFzIFRvRG9MaXN0IGZyb20gJy4vVG9Eb0xpc3QnO1xuZXhwb3J0IHtUb0RvTGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..5eb0148532e5f46f01509ded03e81a2d8126b7d2
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/no-columns/useTheme.js
@@ -0,0 +1,27 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = useTheme;
+exports.ThemeContext = void 0;
+
+var _react = require("react");
+
+/**
+ * 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.
+ *
+ *
+ */
+const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
+exports.ThemeContext = ThemeContext;
+
+function useTheme() {
+ const theme = (0, _react.useContext)(ThemeContext);
+ (0, _react.useDebugValue)(theme);
+ return theme;
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV0EsTUFBQUEsWUFBQSxnQkFBQSwwQkFBQSxRQUFBLENBQUE7OztBQUVBLFNBQUFDLFFBQUEsR0FBQTtBQUNBLFFBQUFDLEtBQUEsR0FBQSx1QkFBQUYsWUFBQSxDQUFBO0FBQ0EsNEJBQUFFLEtBQUE7QUFDQSxTQUFBQSxLQUFBO0FBQ0EiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl19
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentUsingHooksIndirectly.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentUsingHooksIndirectly.js
new file mode 100644
index 0000000000000000000000000000000000000000..314e02c49a56eb1d3c53ac6d56324fb7c517198e
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentUsingHooksIndirectly.js
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const React = require('react');
+const {useEffect, useState} = require('react');
+
+function Component() {
+ const countState = useState(0);
+ const count = countState[0];
+ const setCount = countState[1];
+
+ const darkMode = useIsDarkMode();
+ const [isDarkMode, setDarkMode] = darkMode;
+
+ useEffect(() => {
+ // ...
+ }, []);
+
+ const handleClick = () => setCount(count + 1);
+
+ return null;
+}
+
+function useIsDarkMode() {
+ const darkModeState = useState(false);
+ const [isDarkMode] = darkModeState;
+
+ useEffect(function useEffectCreate() {
+ // Here is where we may listen to a "theme" event...
+ }, []);
+
+ return [isDarkMode, () => {}];
+}
+
+module.exports = {Component};
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithExternalUseEffect.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithExternalUseEffect.js
new file mode 100644
index 0000000000000000000000000000000000000000..5bfe561e91825bb7bb15f5af4c99f4714ee37a92
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithExternalUseEffect.js
@@ -0,0 +1,19 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const {useState} = require('react');
+const {useCustom} = require('./useCustom');
+
+function Component(props) {
+ const [count] = useState(0);
+ useCustom();
+ return count;
+}
+
+module.exports = {Component};
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithNamedCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithNamedCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..bb246d02dcbc00598428276c89854d66c1afc26a
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithNamedCustomHooks.js
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const {useDebugValue, useState} = require('react');
+
+function Component(props) {
+ const foo = useCustomHookOne();
+ // This cae is ignored;
+ // the meaning of a tuple assignment for a custom hook is unclear.
+ const [bar] = useCustomHookTwo();
+ return `${foo}-${bar}`;
+}
+
+function useCustomHookOne() {
+ // DebugValue hook should not appear in log.
+ useDebugValue('example');
+ return true;
+}
+
+function useCustomHookTwo() {
+ const [baz, setBaz] = useState(true);
+ return [baz, setBaz];
+}
+
+module.exports = {Component};
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithNestedHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithNestedHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..57d9bf5e77ff2687a9b19282db2ebae421e8f792
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithNestedHooks.js
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+const {useMemo, useState} = require('react');
+
+function Component(props) {
+ const InnerComponent = useMemo(() => () => {
+ const [state] = useState(0);
+
+ return state;
+ });
+ props.callback(InnerComponent);
+
+ return null;
+};
+
+module.exports = {Component};
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUnnamedCustomHooks.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUnnamedCustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..afc48b64d2c84d667dcbf4e0294723cf11a4fd7e
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUnnamedCustomHooks.js
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const {useDebugValue} = require('react');
+
+function Component(props) {
+ useCustomHookOne();
+ const [bar] = useCustomHookTwo();
+ const {foo} = useCustomHookThree();
+ return `${bar}-${foo}`;
+}
+
+function useCustomHookOne() {
+ // DebugValue hook should not appear in log.
+ useDebugValue('example1');
+}
+
+function useCustomHookTwo() {
+ // DebugValue hook should not appear in log.
+ useDebugValue('example2');
+ return [true];
+}
+
+function useCustomHookThree() {
+ useDebugValue('example3');
+ return {foo: true};
+}
+
+module.exports = {Component};
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseEffect.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseEffect.js
new file mode 100644
index 0000000000000000000000000000000000000000..bf64191e34133e8fa317603c671f9df5c89c1797
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseEffect.js
@@ -0,0 +1,19 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const React = require('react');
+const {useEffect} = React;
+
+function Component(props) {
+ useEffect(() => {});
+ React.useLayoutEffect(() => () => {});
+ return null;
+}
+
+module.exports = {Component};
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseReducer.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseReducer.js
new file mode 100644
index 0000000000000000000000000000000000000000..16a998b41c88452e362b84232b93ca793436e555
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseReducer.js
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const React = require('react');
+const {useReducer} = React;
+
+function Component(props) {
+ const [foo] = useReducer(true);
+ const [bar] = useReducer(true);
+ const [baz] = React.useReducer(true);
+ return `${foo}-${bar}-${baz}`;
+}
+
+module.exports = {Component};
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseState.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseState.js
new file mode 100644
index 0000000000000000000000000000000000000000..376fbb606a0af5c62c92eada7962befee31ecfa9
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/ComponentWithUseState.js
@@ -0,0 +1,21 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const React = require('react');
+const {useState} = React;
+
+function Component(props) {
+ const [foo] = useState(true);
+ const bar = useState(true);
+ const [baz] = React.useState(true);
+ const [, forceUpdate] = useState();
+ return `${foo}-${bar}-${baz}`;
+}
+
+module.exports = {Component};
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/README.md b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..1c88f7fa638cd1a70046c5ee7f3228faeef84f93
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/README.md
@@ -0,0 +1 @@
+The JavaScript source files in this directory are not linted or pre-processed in any way. This is intentional, since they are used by the `parseHookNames-test` to test the behavior of "uncompiled" JavaScript (without source maps).
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/useCustom.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/useCustom.js
new file mode 100644
index 0000000000000000000000000000000000000000..011c34c2fc955576ddc0e8bee2f6e19a2d9f363b
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/useCustom.js
@@ -0,0 +1,18 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const {useEffect} = require('react');
+
+function useCustom() {
+ useEffect(() => {
+ // ...
+ }, []);
+}
+
+module.exports = {useCustom};
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..b688d0fbcd8a6979fcae4ec161279f873c718fed
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/index.js
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+export {Component as ComponentUsingHooksIndirectly} from './ComponentUsingHooksIndirectly';
+export {Component as ComponentWithCustomHook} from './ComponentWithCustomHook';
+export {Component as ComponentWithExternalCustomHooks} from './ComponentWithExternalCustomHooks';
+export {Component as ComponentWithMultipleHooksPerLine} from './ComponentWithMultipleHooksPerLine';
+export {Component as ComponentWithNestedHooks} from './ComponentWithNestedHooks';
+export {Component as ContainingStringSourceMappingURL} from './ContainingStringSourceMappingURL';
+export {Component as Example} from './Example';
+export {Component as InlineRequire} from './InlineRequire';
+import * as ToDoList from './ToDoList';
+export {ToDoList};
+export {default as useTheme} from './useTheme';
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/useTheme.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/useTheme.js
new file mode 100644
index 0000000000000000000000000000000000000000..90efe6ba1578334c0375f36a1f2180f1ddc99a5d
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/__source__/useTheme.js
@@ -0,0 +1,18 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import {createContext, useContext, useDebugValue} from 'react';
+
+export const ThemeContext = createContext('bright');
+
+export default function useTheme() {
+ const theme = useContext(ThemeContext);
+ useDebugValue(theme);
+ return theme;
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/generateHookMap-test.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/generateHookMap-test.js
new file mode 100644
index 0000000000000000000000000000000000000000..b1170814e526e3031a46c10c2ccdc133a6371ea8
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/generateHookMap-test.js
@@ -0,0 +1,212 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import {parse} from '@babel/parser';
+import {generateEncodedHookMap, generateHookMap} from '../generateHookMap';
+
+function expectHookMapToEqual(actual, expected) {
+ expect(actual.names).toEqual(expected.names);
+
+ const formattedMappings = [];
+ actual.mappings.forEach(lines => {
+ lines.forEach(segment => {
+ const name = actual.names[segment[2]];
+ if (name == null) {
+ throw new Error(`Expected to find name at position ${segment[2]}`);
+ }
+ formattedMappings.push(`${name} from ${segment[0]}:${segment[1]}`);
+ });
+ });
+ expect(formattedMappings).toEqual(expected.mappings);
+}
+
+describe('generateHookMap', () => {
+ it('should parse names for built-in hooks', () => {
+ const code = `
+import {useState, useContext, useMemo, useReducer} from 'react';
+
+export function Component() {
+ const a = useMemo(() => A);
+ const [b, setB] = useState(0);
+
+ // prettier-ignore
+ const c = useContext(A), d = useContext(B); // eslint-disable-line one-var
+
+ const [e, dispatch] = useReducer(reducer, initialState);
+ const f = useRef(null)
+
+ return a + b + c + d + e + f.current;
+}`;
+
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const hookMap = generateHookMap(parsed);
+ expectHookMapToEqual(hookMap, {
+ names: ['', 'a', 'b', 'c', 'd', 'e', 'f'],
+ mappings: [
+ ' from 1:0',
+ 'a from 5:12',
+ ' from 5:28',
+ 'b from 6:20',
+ ' from 6:31',
+ 'c from 9:12',
+ ' from 9:25',
+ 'd from 9:31',
+ ' from 9:44',
+ 'e from 11:24',
+ ' from 11:57',
+ 'f from 12:12',
+ ' from 12:24',
+ ],
+ });
+
+ const encodedHookMap = generateEncodedHookMap(parsed);
+ expect(encodedHookMap).toMatchInlineSnapshot(`
+ {
+ "mappings": "CAAD;KYCA,AgBDA;MREA,AWFA;SnBGA,AaHA,AMIA,AaJA;WpBKA,AiCLA;Y7CMA,AYNA",
+ "names": [
+ "",
+ "a",
+ "b",
+ "c",
+ "d",
+ "e",
+ "f",
+ ],
+ }
+ `);
+ });
+
+ it('should parse names for custom hooks', () => {
+ const code = `
+import useTheme from 'useTheme';
+import useValue from 'useValue';
+
+export function Component() {
+ const theme = useTheme();
+ const [val, setVal] = useValue();
+
+ return theme;
+}`;
+
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const hookMap = generateHookMap(parsed);
+ expectHookMapToEqual(hookMap, {
+ names: ['', 'theme', 'val'],
+ mappings: [
+ ' from 1:0',
+ 'theme from 6:16',
+ ' from 6:26',
+ 'val from 7:24',
+ ' from 7:34',
+ ],
+ });
+
+ const encodedHookMap = generateEncodedHookMap(parsed);
+ expect(encodedHookMap).toMatchInlineSnapshot(`
+ {
+ "mappings": "CAAD;MgBCA,AUDA;OFEA,AUFA",
+ "names": [
+ "",
+ "theme",
+ "val",
+ ],
+ }
+ `);
+ });
+
+ it('should parse names for nested hook calls', () => {
+ const code = `
+import {useMemo, useState} from 'react';
+
+export function Component() {
+ const InnerComponent = useMemo(() => () => {
+ const [state, setState] = useState(0);
+
+ return state;
+ });
+
+ return null;
+}`;
+
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const hookMap = generateHookMap(parsed);
+ expectHookMapToEqual(hookMap, {
+ names: ['', 'InnerComponent', 'state'],
+ mappings: [
+ ' from 1:0',
+ 'InnerComponent from 5:25',
+ 'state from 6:30',
+ 'InnerComponent from 6:41',
+ ' from 9:4',
+ ],
+ });
+
+ const encodedHookMap = generateEncodedHookMap(parsed);
+ expect(encodedHookMap).toMatchInlineSnapshot(`
+ {
+ "mappings": "CAAD;KyBCA;MKCA,AWDA;SrCDA",
+ "names": [
+ "",
+ "InnerComponent",
+ "state",
+ ],
+ }
+ `);
+ });
+
+ it('should skip names for non-nameable hooks', () => {
+ const code = `
+import useTheme from 'useTheme';
+import useValue from 'useValue';
+
+export function Component() {
+ const [val, setVal] = useState(0);
+
+ useEffect(() => {
+ // ...
+ });
+
+ useLayoutEffect(() => {
+ // ...
+ });
+
+ return val;
+}`;
+
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const hookMap = generateHookMap(parsed);
+ expectHookMapToEqual(hookMap, {
+ names: ['', 'val'],
+ mappings: [' from 1:0', 'val from 6:24', ' from 6:35'],
+ });
+
+ const encodedHookMap = generateEncodedHookMap(parsed);
+ expect(encodedHookMap).toMatchInlineSnapshot(`
+ {
+ "mappings": "CAAD;MwBCA,AWDA",
+ "names": [
+ "",
+ "val",
+ ],
+ }
+ `);
+ });
+});
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/getHookNameForLocation-test.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/getHookNameForLocation-test.js
new file mode 100644
index 0000000000000000000000000000000000000000..b96ee01eb005b12cb7c3e16f40b3d18c1dea4ed3
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/getHookNameForLocation-test.js
@@ -0,0 +1,264 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import {parse} from '@babel/parser';
+import {generateHookMap} from '../generateHookMap';
+import {getHookNameForLocation} from '../getHookNameForLocation';
+
+function expectHookMapToEqual(actual, expected) {
+ expect(actual.names).toEqual(expected.names);
+
+ const formattedMappings = [];
+ actual.mappings.forEach(lines => {
+ lines.forEach(segment => {
+ const name = actual.names[segment[2]];
+ if (name == null) {
+ throw new Error(`Expected to find name at position ${segment[2]}`);
+ }
+ formattedMappings.push(`${name} from ${segment[0]}:${segment[1]}`);
+ });
+ });
+ expect(formattedMappings).toEqual(expected.mappings);
+}
+
+describe('generateHookMap', () => {
+ it('should parse names for built-in hooks', () => {
+ const code = `
+import {useState, useContext, useMemo, useReducer} from 'react';
+
+export function Component() {
+ const a = useMemo(() => A);
+ const [b, setB] = useState(0);
+
+ // prettier-ignore
+ const c = useContext(A), d = useContext(B); // eslint-disable-line one-var
+
+ const [e, dispatch] = useReducer(reducer, initialState);
+ const f = useRef(null)
+
+ return a + b + c + d + e + f.current;
+}`;
+
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const hookMap = generateHookMap(parsed);
+ expectHookMapToEqual(hookMap, {
+ names: ['', 'a', 'b', 'c', 'd', 'e', 'f'],
+ mappings: [
+ ' from 1:0',
+ 'a from 5:12',
+ ' from 5:28',
+ 'b from 6:20',
+ ' from 6:31',
+ 'c from 9:12',
+ ' from 9:25',
+ 'd from 9:31',
+ ' from 9:44',
+ 'e from 11:24',
+ ' from 11:57',
+ 'f from 12:12',
+ ' from 12:24',
+ ],
+ });
+
+ expect(getHookNameForLocation({line: 1, column: 0}, hookMap)).toEqual(null);
+ expect(getHookNameForLocation({line: 2, column: 25}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 5, column: 12}, hookMap)).toEqual('a');
+ expect(getHookNameForLocation({line: 5, column: 13}, hookMap)).toEqual('a');
+ expect(getHookNameForLocation({line: 5, column: 28}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 5, column: 29}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 6, column: 20}, hookMap)).toEqual('b');
+ expect(getHookNameForLocation({line: 6, column: 30}, hookMap)).toEqual('b');
+ expect(getHookNameForLocation({line: 6, column: 31}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 7, column: 31}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 8, column: 20}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 9, column: 12}, hookMap)).toEqual('c');
+ expect(getHookNameForLocation({line: 9, column: 13}, hookMap)).toEqual('c');
+ expect(getHookNameForLocation({line: 9, column: 25}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 9, column: 26}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 9, column: 31}, hookMap)).toEqual('d');
+ expect(getHookNameForLocation({line: 9, column: 32}, hookMap)).toEqual('d');
+ expect(getHookNameForLocation({line: 9, column: 44}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 9, column: 45}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 11, column: 24}, hookMap)).toEqual(
+ 'e',
+ );
+ expect(getHookNameForLocation({line: 11, column: 56}, hookMap)).toEqual(
+ 'e',
+ );
+ expect(getHookNameForLocation({line: 11, column: 57}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 11, column: 58}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 12, column: 12}, hookMap)).toEqual(
+ 'f',
+ );
+ expect(getHookNameForLocation({line: 12, column: 23}, hookMap)).toEqual(
+ 'f',
+ );
+ expect(getHookNameForLocation({line: 12, column: 24}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 100, column: 50}, hookMap)).toEqual(
+ null,
+ );
+ });
+
+ it('should parse names for custom hooks', () => {
+ const code = `
+import useTheme from 'useTheme';
+import useValue from 'useValue';
+
+export function Component() {
+ const theme = useTheme();
+ const [val, setVal] = useValue();
+
+ return theme;
+}`;
+
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const hookMap = generateHookMap(parsed);
+ expectHookMapToEqual(hookMap, {
+ names: ['', 'theme', 'val'],
+ mappings: [
+ ' from 1:0',
+ 'theme from 6:16',
+ ' from 6:26',
+ 'val from 7:24',
+ ' from 7:34',
+ ],
+ });
+
+ expect(getHookNameForLocation({line: 1, column: 0}, hookMap)).toEqual(null);
+ expect(getHookNameForLocation({line: 6, column: 16}, hookMap)).toEqual(
+ 'theme',
+ );
+ expect(getHookNameForLocation({line: 6, column: 26}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 7, column: 24}, hookMap)).toEqual(
+ 'val',
+ );
+ expect(getHookNameForLocation({line: 7, column: 34}, hookMap)).toEqual(
+ null,
+ );
+ });
+
+ it('should parse names for nested hook calls', () => {
+ const code = `
+import {useMemo, useState} from 'react';
+
+export function Component() {
+ const InnerComponent = useMemo(() => () => {
+ const [state, setState] = useState(0);
+
+ return state;
+ });
+
+ return null;
+}`;
+
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const hookMap = generateHookMap(parsed);
+ expectHookMapToEqual(hookMap, {
+ names: ['', 'InnerComponent', 'state'],
+ mappings: [
+ ' from 1:0',
+ 'InnerComponent from 5:25',
+ 'state from 6:30',
+ 'InnerComponent from 6:41',
+ ' from 9:4',
+ ],
+ });
+
+ expect(getHookNameForLocation({line: 1, column: 0}, hookMap)).toEqual(null);
+ expect(getHookNameForLocation({line: 5, column: 25}, hookMap)).toEqual(
+ 'InnerComponent',
+ );
+ expect(getHookNameForLocation({line: 6, column: 30}, hookMap)).toEqual(
+ 'state',
+ );
+ expect(getHookNameForLocation({line: 6, column: 40}, hookMap)).toEqual(
+ 'state',
+ );
+ expect(getHookNameForLocation({line: 6, column: 41}, hookMap)).toEqual(
+ 'InnerComponent',
+ );
+ expect(getHookNameForLocation({line: 9, column: 4}, hookMap)).toEqual(null);
+ });
+
+ it('should skip names for non-nameable hooks', () => {
+ const code = `
+import useTheme from 'useTheme';
+import useValue from 'useValue';
+
+export function Component() {
+ const [val, setVal] = useState(0);
+
+ useEffect(() => {
+ // ...
+ });
+
+ useLayoutEffect(() => {
+ // ...
+ });
+
+ return val;
+}`;
+
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const hookMap = generateHookMap(parsed);
+ expectHookMapToEqual(hookMap, {
+ names: ['', 'val'],
+ mappings: [' from 1:0', 'val from 6:24', ' from 6:35'],
+ });
+
+ expect(getHookNameForLocation({line: 1, column: 0}, hookMap)).toEqual(null);
+ expect(getHookNameForLocation({line: 6, column: 24}, hookMap)).toEqual(
+ 'val',
+ );
+ expect(getHookNameForLocation({line: 6, column: 35}, hookMap)).toEqual(
+ null,
+ );
+ expect(getHookNameForLocation({line: 8, column: 2}, hookMap)).toEqual(null);
+ });
+});
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f197a25fa5d825a5efe927d4f35922e8fa409761
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js
@@ -0,0 +1,962 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+// Note that this test uses React components declared in the "__source__" directory.
+// This is done to control if and how the code is transformed at runtime.
+// Do not declare test components within this test file as it is very fragile.
+
+function expectHookNamesToEqual(map, expectedNamesArray) {
+ // Slightly hacky since it relies on the iterable order of values()
+ expect(Array.from(map.values())).toEqual(expectedNamesArray);
+}
+
+function requireText(path, encoding) {
+ const {existsSync, readFileSync} = require('fs');
+ if (existsSync(path)) {
+ return Promise.resolve(readFileSync(path, encoding));
+ } else {
+ return Promise.reject(`File not found "${path}"`);
+ }
+}
+
+function initFetchMock() {
+ const fetchMock = require('jest-fetch-mock');
+ fetchMock.enableMocks();
+ fetchMock.mockIf(/.+$/, request => {
+ const url = request.url;
+ const isLoadingExternalSourceMap = /external\/.*\.map/.test(url);
+ if (isLoadingExternalSourceMap) {
+ // Assert that url contains correct query params
+ expect(url.includes('?foo=bar¶m=some_value')).toBe(true);
+ const fileSystemPath = url.split('?')[0];
+ return requireText(fileSystemPath, 'utf8');
+ }
+ return requireText(url, 'utf8');
+ });
+ return fetchMock;
+}
+
+describe('parseHookNames', () => {
+ let fetchMock;
+ let inspectHooks;
+ let parseHookNames;
+
+ beforeEach(() => {
+ jest.resetModules();
+
+ jest.mock('source-map-support', () => {
+ console.trace('source-map-support');
+ });
+
+ fetchMock = initFetchMock();
+
+ inspectHooks =
+ require('react-debug-tools/src/ReactDebugHooks').inspectHooks;
+
+ // Jest can't run the workerized version of this module.
+ const {
+ flattenHooksList,
+ loadSourceAndMetadata,
+ } = require('../parseHookNames/loadSourceAndMetadata');
+ const parseSourceAndMetadata =
+ require('../parseHookNames/parseSourceAndMetadata').parseSourceAndMetadata;
+ parseHookNames = async hooksTree => {
+ const hooksList = flattenHooksList(hooksTree);
+
+ // Runs in the UI thread so it can share Network cache:
+ const locationKeyToHookSourceAndMetadata =
+ await loadSourceAndMetadata(hooksList);
+
+ // Runs in a Worker because it's CPU intensive:
+ return parseSourceAndMetadata(
+ hooksList,
+ locationKeyToHookSourceAndMetadata,
+ );
+ };
+
+ // Jest (jest-runner?) configures Errors to automatically account for source maps.
+ // This changes behavior between our tests and the browser.
+ // Ideally we would clear the prepareStackTrace() method on the Error object,
+ // but Node falls back to looking for it on the main context's Error constructor,
+ // which may still be patched.
+ // To ensure we get the default behavior, override prepareStackTrace ourselves.
+ // NOTE: prepareStackTrace is called from the error.stack getter, but the getter
+ // has a recursion breaker which falls back to the default behavior.
+ Error.prepareStackTrace = (error, trace) => {
+ return error.stack;
+ };
+ });
+
+ afterEach(() => {
+ fetch.resetMocks();
+ });
+
+ async function getHookNamesForComponent(Component, props = {}) {
+ const hooksTree = inspectHooks(Component, props, undefined);
+ const hookNames = await parseHookNames(hooksTree);
+ return hookNames;
+ }
+
+ it('should parse names for useState()', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentWithUseState').Component;
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, ['foo', 'bar', 'baz', null]);
+ });
+
+ it('should parse names for useReducer()', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentWithUseReducer').Component;
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, ['foo', 'bar', 'baz']);
+ });
+
+ it('should skip loading source files for unnamed hooks like useEffect', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentWithUseEffect').Component;
+
+ // Since this component contains only unnamed hooks, the source code should not even be loaded.
+ fetchMock.mockIf(/.+$/, request => {
+ throw Error(`Unexpected file request for "${request.url}"`);
+ });
+
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, []); // No hooks with names
+ });
+
+ it('should skip loading source files for unnamed hooks like useEffect (alternate)', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentWithExternalUseEffect').Component;
+
+ fetchMock.mockIf(/.+$/, request => {
+ // Since the custom hook contains only unnamed hooks, the source code should not be loaded.
+ if (request.url.endsWith('useCustom.js')) {
+ throw Error(`Unexpected file request for "${request.url}"`);
+ }
+ return requireText(request.url, 'utf8');
+ });
+
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, ['count', null]); // No hooks with names
+ });
+
+ it('should parse names for custom hooks', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentWithNamedCustomHooks').Component;
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'foo',
+ null, // Custom hooks can have names, but not when using destructuring.
+ 'baz',
+ ]);
+ });
+
+ it('should parse names for code using hooks indirectly', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentUsingHooksIndirectly').Component;
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, ['count', 'darkMode', 'isDarkMode']);
+ });
+
+ it('should parse names for code using nested hooks', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentWithNestedHooks').Component;
+ let InnerComponent;
+ const hookNames = await getHookNamesForComponent(Component, {
+ callback: innerComponent => {
+ InnerComponent = innerComponent;
+ },
+ });
+ const innerHookNames = await getHookNamesForComponent(InnerComponent);
+ expectHookNamesToEqual(hookNames, ['InnerComponent']);
+ expectHookNamesToEqual(innerHookNames, ['state']);
+ });
+
+ it('should return null for custom hooks without explicit names', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentWithUnnamedCustomHooks').Component;
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ null, // Custom hooks can have names, but this one does not even return a value.
+ null, // Custom hooks can have names, but not when using destructuring.
+ null, // Custom hooks can have names, but not when using destructuring.
+ ]);
+ });
+
+ // TODO Test that cache purge works
+
+ // TODO Test that cached metadata is purged when Fast Refresh scheduled
+
+ describe('inline, external and bundle source maps', () => {
+ it('should work for simple components', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState
+ ]);
+ }
+
+ await testFor('./__source__/Example'); // original source (uncompiled)
+ await testFor('./__source__/__compiled__/inline/Example'); // inline source map
+ await testFor('./__source__/__compiled__/external/Example'); // external source map
+ await testFor('./__source__/__compiled__/inline/index-map/Example'); // inline index map source map
+ await testFor('./__source__/__compiled__/external/index-map/Example'); // external index map source map
+ await testFor('./__source__/__compiled__/bundle/index', 'Example'); // bundle source map
+ await testFor('./__source__/__compiled__/no-columns/Example'); // simulated Webpack 'cheap-module-source-map'
+ });
+
+ it('should work with more complex files and components', async () => {
+ async function testFor(path, name = undefined) {
+ const components = name != null ? require(path)[name] : require(path);
+
+ let hookNames = await getHookNamesForComponent(components.List);
+ expectHookNamesToEqual(hookNames, [
+ 'newItemText', // useState
+ 'items', // useState
+ 'uid', // useState
+ 'handleClick', // useCallback
+ 'handleKeyPress', // useCallback
+ 'handleChange', // useCallback
+ 'removeItem', // useCallback
+ 'toggleItem', // useCallback
+ ]);
+
+ hookNames = await getHookNamesForComponent(components.ListItem, {
+ item: {},
+ });
+ expectHookNamesToEqual(hookNames, [
+ 'handleDelete', // useCallback
+ 'handleToggle', // useCallback
+ ]);
+ }
+
+ await testFor('./__source__/ToDoList'); // original source (uncompiled)
+ await testFor('./__source__/__compiled__/inline/ToDoList'); // inline source map
+ await testFor('./__source__/__compiled__/external/ToDoList'); // external source map
+ await testFor('./__source__/__compiled__/inline/index-map/ToDoList'); // inline index map source map
+ await testFor('./__source__/__compiled__/external/index-map/ToDoList'); // external index map source map
+ await testFor('./__source__/__compiled__/bundle', 'ToDoList'); // bundle source map
+ await testFor('./__source__/__compiled__/no-columns/ToDoList'); // simulated Webpack 'cheap-module-source-map'
+ });
+
+ it('should work for custom hook', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState()
+ 'isDarkMode', // useIsDarkMode()
+ 'isDarkMode', // useIsDarkMode -> useState()
+ null, // useFoo()
+ ]);
+ }
+
+ await testFor('./__source__/ComponentWithCustomHook'); // original source (uncompiled)
+ await testFor('./__source__/__compiled__/inline/ComponentWithCustomHook'); // inline source map
+ await testFor(
+ './__source__/__compiled__/external/ComponentWithCustomHook',
+ ); // external source map
+ await testFor(
+ './__source__/__compiled__/inline/index-map/ComponentWithCustomHook',
+ ); // inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/index-map/ComponentWithCustomHook',
+ ); // external index map source map
+ await testFor(
+ './__source__/__compiled__/bundle',
+ 'ComponentWithCustomHook',
+ ); // bundle source map
+ await testFor(
+ './__source__/__compiled__/no-columns/ComponentWithCustomHook',
+ ); // simulated Webpack 'cheap-module-source-map'
+ });
+
+ it('should work when code is using hooks indirectly', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState()
+ 'darkMode', // useDarkMode()
+ 'isDarkMode', // useState()
+ ]);
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/ComponentUsingHooksIndirectly',
+ ); // inline source map
+ await testFor(
+ './__source__/__compiled__/external/ComponentUsingHooksIndirectly',
+ ); // external source map
+ await testFor(
+ './__source__/__compiled__/inline/index-map/ComponentUsingHooksIndirectly',
+ ); // inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/index-map/ComponentUsingHooksIndirectly',
+ ); // external index map source map
+ await testFor(
+ './__source__/__compiled__/bundle',
+ 'ComponentUsingHooksIndirectly',
+ ); // bundle source map
+ await testFor(
+ './__source__/__compiled__/no-columns/ComponentUsingHooksIndirectly',
+ ); // simulated Webpack 'cheap-module-source-map'
+ });
+
+ it('should work when code is using nested hooks', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ let InnerComponent;
+ const hookNames = await getHookNamesForComponent(Component, {
+ callback: innerComponent => {
+ InnerComponent = innerComponent;
+ },
+ });
+ const innerHookNames = await getHookNamesForComponent(InnerComponent);
+ expectHookNamesToEqual(hookNames, [
+ 'InnerComponent', // useMemo()
+ ]);
+ expectHookNamesToEqual(innerHookNames, [
+ 'state', // useState()
+ ]);
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/ComponentWithNestedHooks',
+ ); // inline source map
+ await testFor(
+ './__source__/__compiled__/external/ComponentWithNestedHooks',
+ ); // external source map
+ await testFor(
+ './__source__/__compiled__/inline/index-map/ComponentWithNestedHooks',
+ ); // inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/index-map/ComponentWithNestedHooks',
+ ); // external index map source map
+ await testFor(
+ './__source__/__compiled__/bundle',
+ 'ComponentWithNestedHooks',
+ ); // bundle source map
+ await testFor(
+ './__source__/__compiled__/no-columns/ComponentWithNestedHooks',
+ ); // simulated Webpack 'cheap-module-source-map'
+ });
+
+ it('should work for external hooks', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'theme', // useTheme()
+ 'theme', // useContext()
+ ]);
+ }
+
+ // We can't test the uncompiled source here, because it either needs to get transformed,
+ // which would break the source mapping, or the import statements will fail.
+
+ await testFor(
+ './__source__/__compiled__/inline/ComponentWithExternalCustomHooks',
+ ); // inline source map
+ await testFor(
+ './__source__/__compiled__/external/ComponentWithExternalCustomHooks',
+ ); // external source map
+ await testFor(
+ './__source__/__compiled__/inline/index-map/ComponentWithExternalCustomHooks',
+ ); // inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/index-map/ComponentWithExternalCustomHooks',
+ ); // external index map source map
+ await testFor(
+ './__source__/__compiled__/bundle',
+ 'ComponentWithExternalCustomHooks',
+ ); // bundle source map
+ await testFor(
+ './__source__/__compiled__/no-columns/ComponentWithExternalCustomHooks',
+ ); // simulated Webpack 'cheap-module-source-map'
+ });
+
+ it('should work when multiple hooks are on a line', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'a', // useContext()
+ 'b', // useContext()
+ 'c', // useContext()
+ 'd', // useContext()
+ ]);
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/ComponentWithMultipleHooksPerLine',
+ ); // inline source map
+ await testFor(
+ './__source__/__compiled__/external/ComponentWithMultipleHooksPerLine',
+ ); // external source map
+ await testFor(
+ './__source__/__compiled__/inline/index-map/ComponentWithMultipleHooksPerLine',
+ ); // inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/index-map/ComponentWithMultipleHooksPerLine',
+ ); // external index map source map
+ await testFor(
+ './__source__/__compiled__/bundle',
+ 'ComponentWithMultipleHooksPerLine',
+ ); // bundle source map
+
+ async function noColumntest(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'a', // useContext()
+ 'b', // useContext()
+ null, // useContext()
+ null, // useContext()
+ ]);
+ }
+
+ // Note that this test is expected to only match the first two hooks
+ // because the 3rd and 4th hook are on the same line,
+ // and this type of source map doesn't have column numbers.
+ await noColumntest(
+ './__source__/__compiled__/no-columns/ComponentWithMultipleHooksPerLine',
+ ); // simulated Webpack 'cheap-module-source-map'
+ });
+
+ // TODO Inline require (e.g. require("react").useState()) isn't supported yet.
+ // Maybe this isn't an important use case to support,
+ // since inline requires are most likely to exist in compiled source (if at all).
+ // eslint-disable-next-line jest/no-disabled-tests
+ it.skip('should work for inline requires', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState()
+ ]);
+ }
+
+ await testFor('./__source__/InlineRequire'); // original source (uncompiled)
+ await testFor('./__source__/__compiled__/inline/InlineRequire'); // inline source map
+ await testFor('./__source__/__compiled__/external/InlineRequire'); // external source map
+ await testFor('./__source__/__compiled__/inline/index-map/InlineRequire'); // inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/index-map/InlineRequire',
+ ); // external index map source map
+ await testFor('./__source__/__compiled__/bundle', 'InlineRequire'); // bundle source map
+ await testFor('./__source__/__compiled__/no-columns/InlineRequire'); // simulated Webpack 'cheap-module-source-map'
+ });
+
+ it('should support sources that contain the string "sourceMappingURL="', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState()
+ ]);
+ }
+
+ // We expect the inline sourceMappingURL to be invalid in this case; mute the warning.
+ console.warn = () => {};
+
+ await testFor('./__source__/ContainingStringSourceMappingURL'); // original source (uncompiled)
+ await testFor(
+ './__source__/__compiled__/inline/ContainingStringSourceMappingURL',
+ ); // inline source map
+ await testFor(
+ './__source__/__compiled__/external/ContainingStringSourceMappingURL',
+ ); // external source map
+ await testFor(
+ './__source__/__compiled__/inline/index-map/ContainingStringSourceMappingURL',
+ ); // inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/index-map/ContainingStringSourceMappingURL',
+ ); // external index map source map
+ await testFor(
+ './__source__/__compiled__/bundle',
+ 'ContainingStringSourceMappingURL',
+ ); // bundle source map
+ await testFor(
+ './__source__/__compiled__/no-columns/ContainingStringSourceMappingURL',
+ ); // simulated Webpack 'cheap-module-source-map'
+ });
+ });
+
+ describe('extended source maps', () => {
+ beforeEach(() => {
+ const babelParser = require('@babel/parser');
+ const generateHookMapModule = require('../generateHookMap');
+ jest.spyOn(babelParser, 'parse');
+ jest.spyOn(generateHookMapModule, 'decodeHookMap');
+ });
+
+ it('should work for simple components', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState
+ ]);
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/Example',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/Example',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/Example',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/Example',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/Example',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/Example',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/Example',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/Example',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+
+ it('should work with more complex files and components', async () => {
+ async function testFor(path, name = undefined) {
+ const components = name != null ? require(path)[name] : require(path);
+
+ let hookNames = await getHookNamesForComponent(components.List);
+ expectHookNamesToEqual(hookNames, [
+ 'newItemText', // useState
+ 'items', // useState
+ 'uid', // useState
+ 'handleClick', // useCallback
+ 'handleKeyPress', // useCallback
+ 'handleChange', // useCallback
+ 'removeItem', // useCallback
+ 'toggleItem', // useCallback
+ ]);
+
+ hookNames = await getHookNamesForComponent(components.ListItem, {
+ item: {},
+ });
+ expectHookNamesToEqual(hookNames, [
+ 'handleDelete', // useCallback
+ 'handleToggle', // useCallback
+ ]);
+
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/ToDoList',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/ToDoList',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/ToDoList',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/ToDoList',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/ToDoList',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/ToDoList',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/ToDoList',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/ToDoList',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+
+ it('should work for custom hook', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState()
+ 'isDarkMode', // useIsDarkMode()
+ 'isDarkMode', // useIsDarkMode -> useState()
+ null, // isFoo()
+ ]);
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/ComponentWithCustomHook',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/ComponentWithCustomHook',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/ComponentWithCustomHook',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/ComponentWithCustomHook',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithCustomHook',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithCustomHook',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithCustomHook',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithCustomHook',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+
+ it('should work when code is using hooks indirectly', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState()
+ 'darkMode', // useDarkMode()
+ 'isDarkMode', // useState()
+ ]);
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/ComponentUsingHooksIndirectly',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/ComponentUsingHooksIndirectly',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/ComponentUsingHooksIndirectly',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/ComponentUsingHooksIndirectly',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentUsingHooksIndirectly',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentUsingHooksIndirectly',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentUsingHooksIndirectly',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/ComponentUsingHooksIndirectly',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+
+ it('should work when code is using nested hooks', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ let InnerComponent;
+ const hookNames = await getHookNamesForComponent(Component, {
+ callback: innerComponent => {
+ InnerComponent = innerComponent;
+ },
+ });
+ const innerHookNames = await getHookNamesForComponent(InnerComponent);
+ expectHookNamesToEqual(hookNames, [
+ 'InnerComponent', // useMemo()
+ ]);
+ expectHookNamesToEqual(innerHookNames, [
+ 'state', // useState()
+ ]);
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/ComponentWithNestedHooks',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/ComponentWithNestedHooks',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/ComponentWithNestedHooks',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/ComponentWithNestedHooks',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithNestedHooks',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithNestedHooks',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithNestedHooks',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithNestedHooks',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+
+ it('should work for external hooks', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'theme', // useTheme()
+ 'theme', // useContext()
+ ]);
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ // We can't test the uncompiled source here, because it either needs to get transformed,
+ // which would break the source mapping, or the import statements will fail.
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/ComponentWithExternalCustomHooks',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/ComponentWithExternalCustomHooks',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/ComponentWithExternalCustomHooks',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/ComponentWithExternalCustomHooks',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithExternalCustomHooks',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithExternalCustomHooks',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithExternalCustomHooks',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithExternalCustomHooks',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+
+ it('should work when multiple hooks are on a line', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'a', // useContext()
+ 'b', // useContext()
+ 'c', // useContext()
+ 'd', // useContext()
+ ]);
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/ComponentWithMultipleHooksPerLine',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/ComponentWithMultipleHooksPerLine',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/ComponentWithMultipleHooksPerLine',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/ComponentWithMultipleHooksPerLine',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+
+ // TODO Inline require (e.g. require("react").useState()) isn't supported yet.
+ // Maybe this isn't an important use case to support,
+ // since inline requires are most likely to exist in compiled source (if at all).
+ // eslint-disable-next-line jest/no-disabled-tests
+ it.skip('should work for inline requires', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState()
+ ]);
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/InlineRequire',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/InlineRequire',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/InlineRequire',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/InlineRequire',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/InlineRequire',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/InlineRequire',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/InlineRequire',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+
+ it('should support sources that contain the string "sourceMappingURL="', async () => {
+ async function testFor(path, name = 'Component') {
+ const Component = require(path)[name];
+ const hookNames = await getHookNamesForComponent(Component);
+ expectHookNamesToEqual(hookNames, [
+ 'count', // useState()
+ ]);
+ expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
+ expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
+ }
+
+ // We expect the inline sourceMappingURL to be invalid in this case; mute the warning.
+ console.warn = () => {};
+
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/ContainingStringSourceMappingURL',
+ ); // x_facebook_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/ContainingStringSourceMappingURL',
+ ); // x_facebook_sources extended external source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/ContainingStringSourceMappingURL',
+ ); // x_react_sources extended inline source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/ContainingStringSourceMappingURL',
+ ); // x_react_sources extended external source map
+
+ // Using index map format for source maps
+ await testFor(
+ './__source__/__compiled__/inline/fb-sources-extended/index-map/ContainingStringSourceMappingURL',
+ ); // x_facebook_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/fb-sources-extended/index-map/ContainingStringSourceMappingURL',
+ ); // x_facebook_sources extended external index map source map
+ await testFor(
+ './__source__/__compiled__/inline/react-sources-extended/index-map/ContainingStringSourceMappingURL',
+ ); // x_react_sources extended inline index map source map
+ await testFor(
+ './__source__/__compiled__/external/react-sources-extended/index-map/ContainingStringSourceMappingURL',
+ ); // x_react_sources extended external index map source map
+
+ // TODO test no-columns and bundle cases with extended source maps
+ });
+ });
+});
+
+describe('parseHookNames worker', () => {
+ let inspectHooks;
+ let parseHookNames;
+ let workerizedParseSourceAndMetadataMock;
+
+ beforeEach(() => {
+ window.Worker = undefined;
+
+ workerizedParseSourceAndMetadataMock = jest.fn();
+
+ initFetchMock();
+
+ jest.mock('../parseHookNames/parseSourceAndMetadata.worker.js', () => {
+ return {
+ __esModule: true,
+ default: () => ({
+ parseSourceAndMetadata: workerizedParseSourceAndMetadataMock,
+ }),
+ };
+ });
+
+ inspectHooks =
+ require('react-debug-tools/src/ReactDebugHooks').inspectHooks;
+ parseHookNames = require('../parseHookNames').parseHookNames;
+ });
+
+ async function getHookNamesForComponent(Component, props = {}) {
+ const hooksTree = inspectHooks(Component, props, undefined);
+ const hookNames = await parseHookNames(hooksTree);
+ return hookNames;
+ }
+
+ it('should use worker', async () => {
+ const Component =
+ require('./__source__/__untransformed__/ComponentWithUseState').Component;
+
+ window.Worker = true;
+
+ // Reset module so mocked worker instance can be updated.
+ jest.resetModules();
+ parseHookNames = require('../parseHookNames').parseHookNames;
+
+ await getHookNamesForComponent(Component);
+ expect(workerizedParseSourceAndMetadataMock).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/updateMockSourceMaps.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/updateMockSourceMaps.js
new file mode 100644
index 0000000000000000000000000000000000000000..bdcfe03964bb6272a22d8fd3426a4cf98527ac8c
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/__tests__/updateMockSourceMaps.js
@@ -0,0 +1,353 @@
+const {transformSync} = require('@babel/core');
+const {btoa} = require('base64');
+const {
+ lstatSync,
+ mkdirSync,
+ readdirSync,
+ readFileSync,
+ writeFileSync,
+} = require('fs');
+const {emptyDirSync} = require('fs-extra');
+const {resolve} = require('path');
+const rollup = require('rollup');
+const babel = require('@rollup/plugin-babel').babel;
+const commonjs = require('@rollup/plugin-commonjs');
+const jsx = require('acorn-jsx');
+const rollupResolve = require('@rollup/plugin-node-resolve').nodeResolve;
+const {encode, decode} = require('@jridgewell/sourcemap-codec');
+const {generateEncodedHookMap} = require('../generateHookMap');
+const {parse} = require('@babel/parser');
+
+const sourceDir = resolve(__dirname, '__source__');
+const buildRoot = resolve(sourceDir, '__compiled__');
+const externalDir = resolve(buildRoot, 'external');
+const inlineDir = resolve(buildRoot, 'inline');
+const bundleDir = resolve(buildRoot, 'bundle');
+const noColumnsDir = resolve(buildRoot, 'no-columns');
+const inlineIndexMapDir = resolve(inlineDir, 'index-map');
+const externalIndexMapDir = resolve(externalDir, 'index-map');
+const inlineFbSourcesExtendedDir = resolve(inlineDir, 'fb-sources-extended');
+const externalFbSourcesExtendedDir = resolve(
+ externalDir,
+ 'fb-sources-extended',
+);
+const inlineFbSourcesIndexMapExtendedDir = resolve(
+ inlineFbSourcesExtendedDir,
+ 'index-map',
+);
+const externalFbSourcesIndexMapExtendedDir = resolve(
+ externalFbSourcesExtendedDir,
+ 'index-map',
+);
+const inlineReactSourcesExtendedDir = resolve(
+ inlineDir,
+ 'react-sources-extended',
+);
+const externalReactSourcesExtendedDir = resolve(
+ externalDir,
+ 'react-sources-extended',
+);
+const inlineReactSourcesIndexMapExtendedDir = resolve(
+ inlineReactSourcesExtendedDir,
+ 'index-map',
+);
+const externalReactSourcesIndexMapExtendedDir = resolve(
+ externalReactSourcesExtendedDir,
+ 'index-map',
+);
+
+// Remove previous builds
+emptyDirSync(buildRoot);
+mkdirSync(externalDir);
+mkdirSync(inlineDir);
+mkdirSync(bundleDir);
+mkdirSync(noColumnsDir);
+mkdirSync(inlineIndexMapDir);
+mkdirSync(externalIndexMapDir);
+mkdirSync(inlineFbSourcesExtendedDir);
+mkdirSync(externalFbSourcesExtendedDir);
+mkdirSync(inlineReactSourcesExtendedDir);
+mkdirSync(externalReactSourcesExtendedDir);
+mkdirSync(inlineFbSourcesIndexMapExtendedDir);
+mkdirSync(externalFbSourcesIndexMapExtendedDir);
+mkdirSync(inlineReactSourcesIndexMapExtendedDir);
+mkdirSync(externalReactSourcesIndexMapExtendedDir);
+
+function compile(fileName) {
+ const code = readFileSync(resolve(sourceDir, fileName), 'utf8');
+
+ const transformed = transformSync(code, {
+ plugins: ['@babel/plugin-transform-modules-commonjs'],
+ presets: [
+ // 'minify',
+ [
+ '@babel/react',
+ // {
+ // runtime: 'automatic',
+ // development: false,
+ // },
+ ],
+ ],
+ sourceMap: true,
+ });
+
+ const sourceMap = transformed.map;
+ sourceMap.sources = [fileName];
+
+ // Generate compiled output with external source maps
+ writeFileSync(
+ resolve(externalDir, fileName),
+ transformed.code +
+ `\n//# sourceMappingURL=${fileName}.map?foo=bar¶m=some_value`,
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalDir, `${fileName}.map`),
+ JSON.stringify(sourceMap),
+ 'utf8',
+ );
+
+ // Generate compiled output with inline base64 source maps
+ writeFileSync(
+ resolve(inlineDir, fileName),
+ transformed.code +
+ '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
+ btoa(JSON.stringify(sourceMap)),
+ 'utf8',
+ );
+
+ // Strip column numbers from source map to mimic Webpack 'cheap-module-source-map'
+ // The mappings field represents a list of integer arrays.
+ // Each array defines a pair of corresponding file locations, one in the generated code and one in the original.
+ // Each array has also been encoded first as VLQs (variable-length quantities)
+ // and then as base64 because this makes them more compact overall.
+ // https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/view#
+ const decodedMappings = decode(sourceMap.mappings).map(entries =>
+ entries.map(entry => {
+ if (entry.length === 0) {
+ return entry;
+ }
+
+ // Each non-empty segment has the following components:
+ // generated code column, source index, source code line, source code column, and (optional) name index
+ return [...entry.slice(0, 3), 0, ...entry.slice(4)];
+ }),
+ );
+ const encodedMappings = encode(decodedMappings);
+
+ // Generate compiled output with inline base64 source maps without column numbers
+ writeFileSync(
+ resolve(noColumnsDir, fileName),
+ transformed.code +
+ '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
+ btoa(
+ JSON.stringify({
+ ...sourceMap,
+ mappings: encodedMappings,
+ }),
+ ),
+ 'utf8',
+ );
+
+ // Artificially construct a source map that uses the index map format
+ // (https://sourcemaps.info/spec.html#h.535es3xeprgt)
+ const indexMap = {
+ version: sourceMap.version,
+ file: sourceMap.file,
+ sections: [
+ {
+ offset: {
+ line: 0,
+ column: 0,
+ },
+ map: {...sourceMap},
+ },
+ ],
+ };
+
+ // Generate compiled output using external source maps using index map format
+ writeFileSync(
+ resolve(externalIndexMapDir, fileName),
+ transformed.code +
+ `\n//# sourceMappingURL=${fileName}.map?foo=bar¶m=some_value`,
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalIndexMapDir, `${fileName}.map`),
+ JSON.stringify(indexMap),
+ 'utf8',
+ );
+
+ // Generate compiled output with inline base64 source maps using index map format
+ writeFileSync(
+ resolve(inlineIndexMapDir, fileName),
+ transformed.code +
+ '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
+ btoa(JSON.stringify(indexMap)),
+ 'utf8',
+ );
+
+ // Generate compiled output with an extended sourcemap that includes a map of hook names.
+ const parsed = parse(code, {
+ sourceType: 'module',
+ plugins: ['jsx', 'flow'],
+ });
+ const encodedHookMap = generateEncodedHookMap(parsed);
+ const fbSourcesExtendedSourceMap = {
+ ...sourceMap,
+ // When using the x_facebook_sources extension field, the first item
+ // for a given source is reserved for the Function Map, and the
+ // React sources metadata (which includes the Hook Map) is added as
+ // the second item.
+ x_facebook_sources: [[null, [encodedHookMap]]],
+ };
+ const fbSourcesExtendedIndexMap = {
+ version: fbSourcesExtendedSourceMap.version,
+ file: fbSourcesExtendedSourceMap.file,
+ sections: [
+ {
+ offset: {
+ line: 0,
+ column: 0,
+ },
+ map: {...fbSourcesExtendedSourceMap},
+ },
+ ],
+ };
+ const reactSourcesExtendedSourceMap = {
+ ...sourceMap,
+ // When using the x_react_sources extension field, the first item
+ // for a given source is reserved for the Hook Map.
+ x_react_sources: [[encodedHookMap]],
+ };
+ const reactSourcesExtendedIndexMap = {
+ version: reactSourcesExtendedSourceMap.version,
+ file: reactSourcesExtendedSourceMap.file,
+ sections: [
+ {
+ offset: {
+ line: 0,
+ column: 0,
+ },
+ map: {...reactSourcesExtendedSourceMap},
+ },
+ ],
+ };
+
+ // Using the x_facebook_sources field
+ writeFileSync(
+ resolve(inlineFbSourcesExtendedDir, fileName),
+ transformed.code +
+ '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
+ btoa(JSON.stringify(fbSourcesExtendedSourceMap)),
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalFbSourcesExtendedDir, fileName),
+ transformed.code +
+ `\n//# sourceMappingURL=${fileName}.map?foo=bar¶m=some_value`,
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalFbSourcesExtendedDir, `${fileName}.map`),
+ JSON.stringify(fbSourcesExtendedSourceMap),
+ 'utf8',
+ );
+ // Using the x_facebook_sources field on an index map format
+ writeFileSync(
+ resolve(inlineFbSourcesIndexMapExtendedDir, fileName),
+ transformed.code +
+ '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
+ btoa(JSON.stringify(fbSourcesExtendedIndexMap)),
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalFbSourcesIndexMapExtendedDir, fileName),
+ transformed.code +
+ `\n//# sourceMappingURL=${fileName}.map?foo=bar¶m=some_value`,
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalFbSourcesIndexMapExtendedDir, `${fileName}.map`),
+ JSON.stringify(fbSourcesExtendedIndexMap),
+ 'utf8',
+ );
+
+ // Using the x_react_sources field
+ writeFileSync(
+ resolve(inlineReactSourcesExtendedDir, fileName),
+ transformed.code +
+ '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
+ btoa(JSON.stringify(reactSourcesExtendedSourceMap)),
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalReactSourcesExtendedDir, fileName),
+ transformed.code +
+ `\n//# sourceMappingURL=${fileName}.map?foo=bar¶m=some_value`,
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalReactSourcesExtendedDir, `${fileName}.map`),
+ JSON.stringify(reactSourcesExtendedSourceMap),
+ 'utf8',
+ );
+ // Using the x_react_sources field on an index map format
+ writeFileSync(
+ resolve(inlineReactSourcesIndexMapExtendedDir, fileName),
+ transformed.code +
+ '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
+ btoa(JSON.stringify(reactSourcesExtendedIndexMap)),
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalReactSourcesIndexMapExtendedDir, fileName),
+ transformed.code +
+ `\n//# sourceMappingURL=${fileName}.map?foo=bar¶m=some_value`,
+ 'utf8',
+ );
+ writeFileSync(
+ resolve(externalReactSourcesIndexMapExtendedDir, `${fileName}.map`),
+ JSON.stringify(reactSourcesExtendedIndexMap),
+ 'utf8',
+ );
+}
+
+async function bundle() {
+ const entryFileName = resolve(sourceDir, 'index.js');
+
+ // Bundle all modules with rollup
+ const result = await rollup.rollup({
+ input: entryFileName,
+ acornInjectPlugins: [jsx()],
+ plugins: [
+ rollupResolve(),
+ commonjs(),
+ babel({
+ babelHelpers: 'bundled',
+ presets: ['@babel/preset-react'],
+ sourceMap: true,
+ }),
+ ],
+ external: ['react'],
+ });
+ await result.write({
+ file: resolve(bundleDir, 'index.js'),
+ format: 'cjs',
+ sourcemap: true,
+ });
+}
+
+// Compile all files in the current directory
+const entries = readdirSync(sourceDir);
+entries.forEach(entry => {
+ const stat = lstatSync(resolve(sourceDir, entry));
+ if (!stat.isDirectory() && entry.endsWith('.js')) {
+ compile(entry);
+ }
+});
+
+bundle().catch(e => {
+ console.error(e);
+ process.exit(1);
+});
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/astUtils.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/astUtils.js
new file mode 100644
index 0000000000000000000000000000000000000000..13adcc0e3663944347b831a5c0f9eeccd3d3a974
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/astUtils.js
@@ -0,0 +1,637 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import {withSyncPerfMeasurements} from 'react-devtools-shared/src/PerformanceLoggingUtils';
+import traverse from '@babel/traverse';
+
+import type {HooksNode} from 'react-debug-tools/src/ReactDebugHooks';
+
+// Missing types in @babel/traverse
+type NodePath = any;
+type Node = any;
+// Missing types in @babel/types
+type File = any;
+
+export type Position = {
+ line: number,
+ column: number,
+};
+
+export type SourceFileASTWithHookDetails = {
+ sourceFileAST: File,
+ line: number,
+ source: string,
+};
+
+export const NO_HOOK_NAME = '';
+
+const AST_NODE_TYPES = Object.freeze({
+ PROGRAM: 'Program',
+ CALL_EXPRESSION: 'CallExpression',
+ MEMBER_EXPRESSION: 'MemberExpression',
+ ARRAY_PATTERN: 'ArrayPattern',
+ IDENTIFIER: 'Identifier',
+ NUMERIC_LITERAL: 'NumericLiteral',
+ VARIABLE_DECLARATOR: 'VariableDeclarator',
+});
+
+// Check if line number obtained from source map and the line number in hook node match
+function checkNodeLocation(
+ path: NodePath,
+ line: number,
+ column?: number | null = null,
+): boolean {
+ const {start, end} = path.node.loc;
+
+ if (line !== start.line) {
+ return false;
+ }
+
+ if (column !== null) {
+ // Column numbers are represented differently between tools/engines.
+ // Error.prototype.stack columns are 1-based (like most IDEs) but ASTs are 0-based.
+ //
+ // In practice this will probably never matter,
+ // because this code matches the 1-based Error stack location for the hook Identifier (e.g. useState)
+ // with the larger 0-based VariableDeclarator (e.g. [foo, setFoo] = useState())
+ // so the ranges should always overlap.
+ //
+ // For more info see https://github.com/facebook/react/pull/21833#discussion_r666831276
+ column -= 1;
+ if (
+ (line === start.line && column < start.column) ||
+ (line === end.line && column > end.column)
+ ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// Checks whether hookNode is a member of targetHookNode
+function filterMemberNodesOfTargetHook(
+ targetHookNode: NodePath,
+ hookNode: NodePath,
+): boolean {
+ const targetHookName = targetHookNode.node.id.name;
+ return (
+ targetHookName != null &&
+ (targetHookName ===
+ (hookNode.node.init.object && hookNode.node.init.object.name) ||
+ targetHookName === hookNode.node.init.name)
+ );
+}
+
+// Checks whether hook is the first member node of a state variable declaration node
+function filterMemberWithHookVariableName(hook: NodePath): boolean {
+ return (
+ hook.node.init.property.type === AST_NODE_TYPES.NUMERIC_LITERAL &&
+ hook.node.init.property.value === 0
+ );
+}
+
+// Returns all AST Nodes associated with 'potentialReactHookASTNode'
+function getFilteredHookASTNodes(
+ potentialReactHookASTNode: NodePath,
+ potentialHooksFound: Array,
+ source: string,
+): Array {
+ let nodesAssociatedWithReactHookASTNode: NodePath[] = [];
+ if (nodeContainsHookVariableName(potentialReactHookASTNode)) {
+ // made custom hooks to enter this, always
+ // Case 1.
+ // Directly usable Node -> const ref = useRef(null);
+ // -> const [tick, setTick] = useState(1);
+ // Case 2.
+ // Custom Hooks -> const someVariable = useSomeCustomHook();
+ // -> const [someVariable, someFunction] = useAnotherCustomHook();
+ nodesAssociatedWithReactHookASTNode.unshift(potentialReactHookASTNode);
+ } else {
+ // Case 3.
+ // Indirectly usable Node -> const tickState = useState(1);
+ // [tick, setTick] = tickState;
+ // -> const tickState = useState(1);
+ // const tick = tickState[0];
+ // const setTick = tickState[1];
+ nodesAssociatedWithReactHookASTNode = potentialHooksFound.filter(hookNode =>
+ filterMemberNodesOfTargetHook(potentialReactHookASTNode, hookNode),
+ );
+ }
+ return nodesAssociatedWithReactHookASTNode;
+}
+
+// Returns Hook name
+export function getHookName(
+ hook: HooksNode,
+ originalSourceAST: mixed,
+ originalSourceCode: string,
+ originalSourceLineNumber: number,
+ originalSourceColumnNumber: number,
+): string | null {
+ const hooksFromAST = withSyncPerfMeasurements(
+ 'getPotentialHookDeclarationsFromAST(originalSourceAST)',
+ () => getPotentialHookDeclarationsFromAST(originalSourceAST),
+ );
+
+ let potentialReactHookASTNode = null;
+ if (originalSourceColumnNumber === 0) {
+ // This most likely indicates a source map type like 'cheap-module-source-map'
+ // that intentionally drops column numbers for compilation speed in DEV builds.
+ // In this case, we can assume there's probably only one hook per line (true in most cases)
+ // and just fail if we find more than one match.
+ const matchingNodes = hooksFromAST.filter(node => {
+ const nodeLocationCheck = checkNodeLocation(
+ node,
+ originalSourceLineNumber,
+ );
+
+ const hookDeclarationCheck = isConfirmedHookDeclaration(node);
+ return nodeLocationCheck && hookDeclarationCheck;
+ });
+
+ if (matchingNodes.length === 1) {
+ potentialReactHookASTNode = matchingNodes[0];
+ }
+ } else {
+ potentialReactHookASTNode = hooksFromAST.find(node => {
+ const nodeLocationCheck = checkNodeLocation(
+ node,
+ originalSourceLineNumber,
+ originalSourceColumnNumber,
+ );
+
+ const hookDeclarationCheck = isConfirmedHookDeclaration(node);
+ return nodeLocationCheck && hookDeclarationCheck;
+ });
+ }
+
+ if (!potentialReactHookASTNode) {
+ return null;
+ }
+
+ // nodesAssociatedWithReactHookASTNode could directly be used to obtain the hook variable name
+ // depending on the type of potentialReactHookASTNode
+ try {
+ const nodesAssociatedWithReactHookASTNode = withSyncPerfMeasurements(
+ 'getFilteredHookASTNodes()',
+ () =>
+ getFilteredHookASTNodes(
+ potentialReactHookASTNode,
+ hooksFromAST,
+ originalSourceCode,
+ ),
+ );
+
+ const name = withSyncPerfMeasurements('getHookNameFromNode()', () =>
+ getHookNameFromNode(
+ hook,
+ nodesAssociatedWithReactHookASTNode,
+ potentialReactHookASTNode,
+ ),
+ );
+
+ return name;
+ } catch (error) {
+ console.error(error);
+ return null;
+ }
+}
+
+function getHookNameFromNode(
+ originalHook: HooksNode,
+ nodesAssociatedWithReactHookASTNode: NodePath[],
+ potentialReactHookASTNode: NodePath,
+): string | null {
+ let hookVariableName: string | null;
+ const isCustomHook = originalHook.id === null;
+
+ switch (nodesAssociatedWithReactHookASTNode.length) {
+ case 1:
+ // CASE 1A (nodesAssociatedWithReactHookASTNode[0] !== potentialReactHookASTNode):
+ // const flagState = useState(true); -> later referenced as
+ // const [flag, setFlag] = flagState;
+ //
+ // CASE 1B (nodesAssociatedWithReactHookASTNode[0] === potentialReactHookASTNode):
+ // const [flag, setFlag] = useState(true); -> we have access to the hook variable straight away
+ //
+ // CASE 1C (isCustomHook && nodesAssociatedWithReactHookASTNode[0] === potentialReactHookASTNode):
+ // const someVariable = useSomeCustomHook(); -> we have access to hook variable straight away
+ // const [someVariable, someFunction] = useAnotherCustomHook(); -> we ignore variable names in this case
+ // as it is unclear what variable name to show
+ if (
+ isCustomHook &&
+ nodesAssociatedWithReactHookASTNode[0] === potentialReactHookASTNode
+ ) {
+ hookVariableName = getHookVariableName(
+ potentialReactHookASTNode,
+ isCustomHook,
+ );
+ break;
+ }
+ hookVariableName = getHookVariableName(
+ nodesAssociatedWithReactHookASTNode[0],
+ );
+ break;
+
+ case 2:
+ // const flagState = useState(true); -> later referenced as
+ // const flag = flagState[0];
+ // const setFlag = flagState[1];
+ nodesAssociatedWithReactHookASTNode =
+ nodesAssociatedWithReactHookASTNode.filter(hookPath =>
+ filterMemberWithHookVariableName(hookPath),
+ );
+
+ if (nodesAssociatedWithReactHookASTNode.length !== 1) {
+ // Something went wrong, only a single desirable hook should remain here
+ throw new Error("Couldn't isolate AST Node containing hook variable.");
+ }
+ hookVariableName = getHookVariableName(
+ nodesAssociatedWithReactHookASTNode[0],
+ );
+ break;
+
+ default:
+ // Case 0:
+ // const flagState = useState(true); -> which is not accessed anywhere
+ //
+ // Case > 2 (fallback):
+ // const someState = React.useState(() => 0)
+ //
+ // const stateVariable = someState[0]
+ // const setStateVariable = someState[1]
+ //
+ // const [number2, setNumber2] = someState
+ //
+ // We assign the state variable for 'someState' to multiple variables,
+ // and hence cannot isolate a unique variable name. In such cases,
+ // default to showing 'someState'
+
+ hookVariableName = getHookVariableName(potentialReactHookASTNode);
+ break;
+ }
+
+ return hookVariableName;
+}
+
+// Extracts the variable name from hook node path
+function getHookVariableName(
+ hook: NodePath,
+ isCustomHook: boolean = false,
+): string | null {
+ const nodeType = hook.node.id.type;
+ switch (nodeType) {
+ case AST_NODE_TYPES.ARRAY_PATTERN:
+ return !isCustomHook ? (hook.node.id.elements[0]?.name ?? null) : null;
+
+ case AST_NODE_TYPES.IDENTIFIER:
+ return hook.node.id.name;
+
+ default:
+ return null;
+ }
+}
+
+function getPotentialHookDeclarationsFromAST(sourceAST: File): NodePath[] {
+ const potentialHooksFound: NodePath[] = [];
+ withSyncPerfMeasurements('traverse(sourceAST)', () =>
+ traverse(sourceAST, {
+ enter(path) {
+ if (path.isVariableDeclarator() && isPotentialHookDeclaration(path)) {
+ potentialHooksFound.push(path);
+ }
+ },
+ }),
+ );
+ return potentialHooksFound;
+}
+
+/**
+ * This function traverses the sourceAST and returns a mapping
+ * that maps locations in the source code to their corresponding
+ * Hook name, if there is a relevant Hook name for that location.
+ *
+ * A location in the source code is represented by line and column
+ * numbers as a Position object: { line, column }.
+ * - line is 1-indexed.
+ * - column is 0-indexed.
+ *
+ * A Hook name will be assigned to a Hook CallExpression if the
+ * CallExpression is for a variable declaration (i.e. it returns
+ * a value that is assigned to a variable), and if we can reliably
+ * infer the correct name to use (see comments in the function body
+ * for more details).
+ *
+ * The returned mapping is an array of locations and their assigned
+ * names, sorted by location. Specifically, each entry in the array
+ * contains a `name` and a `start` Position. The `name` of a given
+ * entry is the "assigned" name in the source code until the `start`
+ * of the **next** entry. This means that given the mapping, in order
+ * to determine the Hook name assigned for a given source location, we
+ * need to find the adjacent entries that most closely contain the given
+ * location.
+ *
+ * E.g. for the following code:
+ *
+ * 1| function Component() {
+ * 2| const [state, setState] = useState(0);
+ * 3| ^---------^ -> Cols 28 - 38: Hook CallExpression
+ * 4|
+ * 5| useEffect(() => {...}); -> call ignored since not declaring a variable
+ * 6|
+ * 7| return (...);
+ * 8| }
+ *
+ * The returned "mapping" would be something like:
+ * [
+ * {name: '', start: {line: 1, column: 0}},
+ * {name: 'state', start: {line: 2, column: 28}},
+ * {name: '', start: {line: 2, column: 38}},
+ * ]
+ *
+ * Where the Hook name `state` (corresponding to the `state` variable)
+ * is assigned to the location in the code for the CallExpression
+ * representing the call to `useState(0)` (line 2, col 28-38).
+ */
+export function getHookNamesMappingFromAST(
+ sourceAST: File,
+): $ReadOnlyArray<{name: string, start: Position}> {
+ const hookStack: Array<{name: string, start: $FlowFixMe}> = [];
+ const hookNames = [];
+ const pushFrame = (name: string, node: Node) => {
+ const nameInfo = {name, start: {...node.loc.start}};
+ hookStack.unshift(nameInfo);
+ hookNames.push(nameInfo);
+ };
+ const popFrame = (node: Node) => {
+ hookStack.shift();
+ const top = hookStack[0];
+ if (top != null) {
+ hookNames.push({name: top.name, start: {...node.loc.end}});
+ }
+ };
+
+ traverse(sourceAST, {
+ [AST_NODE_TYPES.PROGRAM]: {
+ enter(path) {
+ pushFrame(NO_HOOK_NAME, path.node);
+ },
+ exit(path) {
+ popFrame(path.node);
+ },
+ },
+ [AST_NODE_TYPES.VARIABLE_DECLARATOR]: {
+ enter(path) {
+ // Check if this variable declaration corresponds to a variable
+ // declared by calling a Hook.
+ if (isConfirmedHookDeclaration(path)) {
+ const hookDeclaredVariableName = getHookVariableName(path);
+ if (!hookDeclaredVariableName) {
+ return;
+ }
+ const callExpressionNode = assertCallExpression(path.node.init);
+
+ // Check if this variable declaration corresponds to a call to a
+ // built-in Hook that returns a tuple (useState, useReducer,
+ // useTransition).
+ // If it doesn't, we immediately use the declared variable name
+ // as the Hook name. We do this because for any other Hooks that
+ // aren't the built-in Hooks that return a tuple, we can't reliably
+ // extract a Hook name from other variable declarations derived from
+ // this one, since we don't know which of the declared variables
+ // are the relevant ones to track and show in dev tools.
+ if (!isBuiltInHookThatReturnsTuple(path)) {
+ pushFrame(hookDeclaredVariableName, callExpressionNode);
+ return;
+ }
+
+ // Check if the variable declared by the Hook call is referenced
+ // anywhere else in the code. If not, we immediately use the
+ // declared variable name as the Hook name.
+ const referencePaths =
+ hookDeclaredVariableName != null
+ ? path.scope.bindings[hookDeclaredVariableName]?.referencePaths
+ : null;
+ if (referencePaths == null) {
+ pushFrame(hookDeclaredVariableName, callExpressionNode);
+ return;
+ }
+
+ // Check each reference to the variable declared by the Hook call,
+ // and for each, we do the following:
+ let declaredVariableName = null;
+ for (let i = 0; i <= referencePaths.length; i++) {
+ const referencePath = referencePaths[i];
+ if (declaredVariableName != null) {
+ break;
+ }
+
+ // 1. Check if the reference is contained within a VariableDeclarator
+ // Node. This will allow us to determine if the variable declared by
+ // the Hook call is being used to declare other variables.
+ let variableDeclaratorPath = referencePath;
+ while (
+ variableDeclaratorPath != null &&
+ variableDeclaratorPath.node.type !==
+ AST_NODE_TYPES.VARIABLE_DECLARATOR
+ ) {
+ variableDeclaratorPath = variableDeclaratorPath.parentPath;
+ }
+
+ // 2. If we find a VariableDeclarator containing the
+ // referenced variable, we extract the Hook name from the new
+ // variable declaration.
+ // E.g., a case like the following:
+ // const countState = useState(0);
+ // const count = countState[0];
+ // const setCount = countState[1]
+ // Where the reference to `countState` is later referenced
+ // within a VariableDeclarator, so we can extract `count` as
+ // the Hook name.
+ const varDeclInit = variableDeclaratorPath?.node.init;
+ if (varDeclInit != null) {
+ switch (varDeclInit.type) {
+ case AST_NODE_TYPES.MEMBER_EXPRESSION: {
+ // When encountering a MemberExpression inside the new
+ // variable declaration, we only want to extract the variable
+ // name if we're assigning the value of the first member,
+ // which is handled by `filterMemberWithHookVariableName`.
+ // E.g.
+ // const countState = useState(0);
+ // const count = countState[0]; -> extract the name from this reference
+ // const setCount = countState[1]; -> ignore this reference
+ if (
+ filterMemberWithHookVariableName(variableDeclaratorPath)
+ ) {
+ declaredVariableName = getHookVariableName(
+ variableDeclaratorPath,
+ );
+ }
+ break;
+ }
+ case AST_NODE_TYPES.IDENTIFIER: {
+ declaredVariableName = getHookVariableName(
+ variableDeclaratorPath,
+ );
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+ // If we were able to extract a name from the new variable
+ // declaration, use it as the Hook name. Otherwise, use the
+ // original declared variable as the variable name.
+ if (declaredVariableName != null) {
+ pushFrame(declaredVariableName, callExpressionNode);
+ } else {
+ pushFrame(hookDeclaredVariableName, callExpressionNode);
+ }
+ }
+ },
+ exit(path) {
+ if (isConfirmedHookDeclaration(path)) {
+ const callExpressionNode = assertCallExpression(path.node.init);
+ popFrame(callExpressionNode);
+ }
+ },
+ },
+ });
+ return hookNames;
+}
+
+// Check if 'path' contains declaration of the form const X = useState(0);
+function isConfirmedHookDeclaration(path: NodePath): boolean {
+ const nodeInit = path.node.init;
+ if (nodeInit == null || nodeInit.type !== AST_NODE_TYPES.CALL_EXPRESSION) {
+ return false;
+ }
+ const callee = nodeInit.callee;
+ return isHook(callee);
+}
+
+// We consider hooks to be a hook name identifier or a member expression containing a hook name.
+function isHook(node: Node): boolean {
+ if (node.type === AST_NODE_TYPES.IDENTIFIER) {
+ return isHookName(node.name);
+ } else if (
+ node.type === AST_NODE_TYPES.MEMBER_EXPRESSION &&
+ !node.computed &&
+ isHook(node.property)
+ ) {
+ const obj = node.object;
+ const isPascalCaseNameSpace = /^[A-Z].*/;
+ return (
+ obj.type === AST_NODE_TYPES.IDENTIFIER &&
+ isPascalCaseNameSpace.test(obj.name)
+ );
+ } else {
+ // TODO Possibly handle inline require statements e.g. require("useStable")(...)
+ // This does not seem like a high priority, since inline requires are probably
+ // not common and are also typically in compiled code rather than source code.
+
+ return false;
+ }
+}
+
+// Catch all identifiers that begin with "use"
+// followed by an uppercase Latin character to exclude identifiers like "user".
+// Copied from packages/eslint-plugin-react-hooks/src/RulesOfHooks
+function isHookName(name: string): boolean {
+ return /^use[A-Z0-9].*$/.test(name);
+}
+
+// Check if the AST Node COULD be a React Hook
+function isPotentialHookDeclaration(path: NodePath): boolean {
+ // The array potentialHooksFound will contain all potential hook declaration cases we support
+ const nodePathInit = path.node.init;
+ if (nodePathInit != null) {
+ if (nodePathInit.type === AST_NODE_TYPES.CALL_EXPRESSION) {
+ // CASE: CallExpression
+ // 1. const [count, setCount] = useState(0); -> destructured pattern
+ // 2. const [A, setA] = useState(0), const [B, setB] = useState(0); -> multiple inline declarations
+ // 3. const [
+ // count,
+ // setCount
+ // ] = useState(0); -> multiline hook declaration
+ // 4. const ref = useRef(null); -> generic hooks
+ const callee = nodePathInit.callee;
+ return isHook(callee);
+ } else if (
+ nodePathInit.type === AST_NODE_TYPES.MEMBER_EXPRESSION ||
+ nodePathInit.type === AST_NODE_TYPES.IDENTIFIER
+ ) {
+ // CASE: MemberExpression
+ // const countState = React.useState(0);
+ // const count = countState[0];
+ // const setCount = countState[1]; -> Accessing members following hook declaration
+
+ // CASE: Identifier
+ // const countState = React.useState(0);
+ // const [count, setCount] = countState; -> destructuring syntax following hook declaration
+ return true;
+ }
+ }
+ return false;
+}
+
+/// Check whether 'node' is hook declaration of form useState(0); OR React.useState(0);
+function isReactFunction(node: Node, functionName: string): boolean {
+ return (
+ node.name === functionName ||
+ (node.type === 'MemberExpression' &&
+ node.object.name === 'React' &&
+ node.property.name === functionName)
+ );
+}
+
+// Check if 'path' is either State or Reducer hook
+function isBuiltInHookThatReturnsTuple(path: NodePath): boolean {
+ const callee = path.node.init.callee;
+ return (
+ isReactFunction(callee, 'useState') ||
+ isReactFunction(callee, 'useReducer') ||
+ isReactFunction(callee, 'useTransition')
+ );
+}
+
+// Check whether hookNode of a declaration contains obvious variable name
+function nodeContainsHookVariableName(hookNode: NodePath): boolean {
+ // We determine cases where variable names are obvious in declarations. Examples:
+ // const [tick, setTick] = useState(1); OR const ref = useRef(null);
+ // Here tick/ref are obvious hook variables in the hook declaration node itself
+ // 1. True for satisfying above cases
+ // 2. False for everything else. Examples:
+ // const countState = React.useState(0);
+ // const count = countState[0];
+ // const setCount = countState[1]; -> not obvious, hook variable can't be determined
+ // from the hook declaration node alone
+ // 3. For custom hooks we force pass true since we are only concerned with the AST node
+ // regardless of how it is accessed in source code. (See: getHookVariableName)
+
+ const node = hookNode.node.id;
+ if (
+ node.type === AST_NODE_TYPES.ARRAY_PATTERN ||
+ (node.type === AST_NODE_TYPES.IDENTIFIER &&
+ !isBuiltInHookThatReturnsTuple(hookNode))
+ ) {
+ return true;
+ }
+ return false;
+}
+
+function assertCallExpression(node: Node): Node {
+ if (node.type !== AST_NODE_TYPES.CALL_EXPRESSION) {
+ throw new Error('Expected a CallExpression node for a Hook declaration.');
+ }
+ return node;
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/generateHookMap.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/generateHookMap.js
new file mode 100644
index 0000000000000000000000000000000000000000..a8a7576cbed9c644bdb44721faee85c61bd1df71
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/generateHookMap.js
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ *
+ * @flow
+ */
+
+import {getHookNamesMappingFromAST} from './astUtils';
+import {encode, decode} from '@jridgewell/sourcemap-codec';
+
+// Missing types in @babel/types
+type File = any;
+
+export type HookMap = {
+ names: $ReadOnlyArray,
+ mappings: HookMapMappings,
+};
+
+export type EncodedHookMap = {
+ names: $ReadOnlyArray,
+ mappings: string,
+};
+
+// See generateHookMap below for more details on formatting
+export type HookMapEntry = [
+ number, // 1-indexed line number
+ number, // 0-indexed column number
+ number, // 0-indexed index into names array
+ number, // TODO: filler number to support reusing encoding from `sourcemap-codec` (see TODO below)
+];
+export type HookMapLine = HookMapEntry[];
+export type HookMapMappings = HookMapLine[];
+
+/**
+ * Given a parsed source code AST, returns a "Hook Map", which is a
+ * mapping which maps locations in the source code to their to their
+ * corresponding Hook name, if there is a relevant Hook name for that
+ * location (see getHookNamesMappingFromAST for details on the
+ * representation of the mapping).
+ *
+ * The format of the Hook Map follows a similar format as the `name`
+ * and `mappings` fields in the Source Map spec, where `names` is an
+ * array of strings, and `mappings` contains segments lines, columns,
+ * and indices into the `names` array.
+ *
+ * E.g.:
+ * {
+ * names: ["", "state"],
+ * mappings: [
+ * [ -> line 1
+ * [1, 0, 0], -> line, col, name index
+ * ],
+ * [ -> line 2
+ * [2, 5, 1], -> line, col, name index
+ * [2, 15, 0], -> line, col, name index
+ * ],
+ * ],
+ * }
+ */
+export function generateHookMap(sourceAST: File): HookMap {
+ const hookNamesMapping = getHookNamesMappingFromAST(sourceAST);
+ const namesMap: Map = new Map();
+ const names = [];
+ const mappings: Array = [];
+
+ let currentLine: $FlowFixMe | null = null;
+ hookNamesMapping.forEach(({name, start}) => {
+ let nameIndex = namesMap.get(name);
+ if (nameIndex == null) {
+ names.push(name);
+ nameIndex = names.length - 1;
+ namesMap.set(name, nameIndex);
+ }
+
+ // TODO: We add a -1 at the end of the entry so we can later
+ // encode/decode the mappings by reusing the encode/decode functions
+ // from the `sourcemap-codec` library. This library expects segments
+ // of specific sizes (i.e. of size 4) in order to encode them correctly.
+ // In the future, when we implement our own encoding, we will not
+ // need this restriction and can remove the -1 at the end.
+ const entry = [start.line, start.column, nameIndex, -1];
+
+ if (currentLine !== start.line) {
+ currentLine = start.line;
+ mappings.push([entry]);
+ } else {
+ const current = mappings[mappings.length - 1];
+ current.push(entry);
+ }
+ });
+
+ return {names, mappings};
+}
+
+/**
+ * Returns encoded version of a Hook Map that is returned
+ * by generateHookMap.
+ *
+ * **NOTE:**
+ * TODO: To encode the `mappings` in the Hook Map, we
+ * reuse the encode function from the `sourcemap-codec`
+ * library, which means that we are restricted to only
+ * encoding segments of specific sizes.
+ * Inside generateHookMap we make sure to build segments
+ * of size 4.
+ * In the future, when we implement our own encoding, we will not
+ * need this restriction and can remove the -1 at the end.
+ */
+export function generateEncodedHookMap(sourceAST: File): EncodedHookMap {
+ const hookMap = generateHookMap(sourceAST);
+ const encoded = encode(hookMap.mappings);
+ return {
+ names: hookMap.names,
+ mappings: encoded,
+ };
+}
+
+export function decodeHookMap(encodedHookMap: EncodedHookMap): HookMap {
+ return {
+ names: encodedHookMap.names,
+ mappings: decode(encodedHookMap.mappings),
+ };
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/getHookNameForLocation.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/getHookNameForLocation.js
new file mode 100644
index 0000000000000000000000000000000000000000..84aeea61f1aaceab61a8f9e712088f577bf83822
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/getHookNameForLocation.js
@@ -0,0 +1,274 @@
+/*
+ * 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.
+ *
+ * @flow strict-local
+ */
+
+import type {
+ HookMap,
+ HookMapEntry,
+ HookMapLine,
+ HookMapMappings,
+} from './generateHookMap';
+import type {Position} from './astUtils';
+import {NO_HOOK_NAME} from './astUtils';
+
+/**
+ * Finds the Hook name assigned to a given location in the source code,
+ * and a HookMap extracted from an extended source map.
+ * The given location must correspond to the location in the *original*
+ * source code (i.e. *not* the generated one).
+ *
+ * Note that all locations in the source code are guaranteed to map
+ * to a name, including a sentinel value that represents a missing
+ * Hook name: ''.
+ *
+ * For more details on the format of the HookMap, see generateHookMap
+ * and the tests for that function and this function.
+ */
+export function getHookNameForLocation(
+ location: Position,
+ hookMap: HookMap,
+): string | null {
+ const {names, mappings} = hookMap;
+
+ // The HookMap mappings are grouped by lines, so first we look up
+ // which line of mappings covers the target location.
+ // Note that we expect to find a line since all the locations in the
+ // source code are guaranteed to map to a name, including a ''
+ // name.
+ const foundLine = binSearch(location, mappings, compareLinePositions);
+ if (foundLine == null) {
+ throw new Error(
+ `Expected to find a line in the HookMap that covers the target location at line: ${location.line}, column: ${location.column}`,
+ );
+ }
+
+ let foundEntry;
+ const foundLineNumber = getLineNumberFromLine(foundLine);
+ // The line found in the mappings will never be larger than the target
+ // line, and vice-versa, so if the target line doesn't match the found
+ // line, we immediately know that it must correspond to the last mapping
+ // entry for that line.
+ if (foundLineNumber !== location.line) {
+ foundEntry = foundLine[foundLine.length - 1];
+ } else {
+ foundEntry = binSearch(location, foundLine, compareColumnPositions);
+ }
+
+ if (foundEntry == null) {
+ throw new Error(
+ `Expected to find a mapping in the HookMap that covers the target location at line: ${location.line}, column: ${location.column}`,
+ );
+ }
+
+ const foundNameIndex = getHookNameIndexFromEntry(foundEntry);
+ if (foundNameIndex == null) {
+ throw new Error(
+ `Expected to find a name index in the HookMap that covers the target location at line: ${location.line}, column: ${location.column}`,
+ );
+ }
+ const foundName = names[foundNameIndex];
+ if (foundName == null) {
+ throw new Error(
+ `Expected to find a name in the HookMap that covers the target location at line: ${location.line}, column: ${location.column}`,
+ );
+ }
+
+ if (foundName === NO_HOOK_NAME) {
+ return null;
+ }
+ return foundName;
+}
+
+function binSearch(
+ location: Position,
+ items: T[],
+ compare: (
+ location: Position,
+ items: T[],
+ index: number,
+ ) => {index: number | null, direction: number},
+): T | null {
+ let count = items.length;
+ let index = 0;
+ let firstElementIndex = 0;
+ let step;
+
+ while (count > 0) {
+ index = firstElementIndex;
+ step = Math.floor(count / 2);
+ index += step;
+
+ const comparison = compare(location, items, index);
+ if (comparison.direction === 0) {
+ if (comparison.index == null) {
+ throw new Error('Expected an index when matching element is found.');
+ }
+ firstElementIndex = comparison.index;
+ break;
+ }
+
+ if (comparison.direction > 0) {
+ index++;
+ firstElementIndex = index;
+ count -= step + 1;
+ } else {
+ count = step;
+ }
+ }
+
+ return firstElementIndex != null ? items[firstElementIndex] : null;
+}
+
+/**
+ * Compares the target line location to the current location
+ * given by the provided index.
+ *
+ * If the target line location matches the current location, returns
+ * the index of the matching line in the mappings. In order for a line
+ * to match, the target line must match the line exactly, or be within
+ * the line range of the current line entries and the adjacent line
+ * entries.
+ *
+ * If the line doesn't match, returns the search direction for the
+ * next step in the binary search.
+ */
+function compareLinePositions(
+ location: Position,
+ mappings: HookMapMappings,
+ index: number,
+): {index: number | null, direction: number} {
+ const startIndex = index;
+ const start = mappings[startIndex];
+ if (start == null) {
+ throw new Error(`Unexpected line missing in HookMap at index ${index}.`);
+ }
+ const startLine = getLineNumberFromLine(start);
+
+ let endLine;
+ let endIndex = index + 1;
+ const end = mappings[endIndex];
+ if (end != null) {
+ endLine = getLineNumberFromLine(end);
+ } else {
+ endIndex = startIndex;
+ endLine = startLine;
+ }
+
+ // When the line matches exactly, return the matching index
+ if (startLine === location.line) {
+ return {index: startIndex, direction: 0};
+ }
+ if (endLine === location.line) {
+ return {index: endIndex, direction: 0};
+ }
+
+ // If we're at the end of the mappings, and the target line is greater
+ // than the current line, then this final line must cover the
+ // target location, so we return it.
+ if (location.line > endLine && end == null) {
+ return {index: endIndex, direction: 0};
+ }
+
+ // If the location is within the current line and the adjacent one,
+ // we know that the target location must be covered by the current line.
+ if (startLine < location.line && location.line < endLine) {
+ return {index: startIndex, direction: 0};
+ }
+
+ // Otherwise, return the next direction in the search.
+ return {index: null, direction: location.line - startLine};
+}
+
+/**
+ * Compares the target column location to the current location
+ * given by the provided index.
+ *
+ * If the target column location matches the current location, returns
+ * the index of the matching entry in the mappings. In order for a column
+ * to match, the target column must match the column exactly, or be within
+ * the column range of the current entry and the adjacent entry.
+ *
+ * If the column doesn't match, returns the search direction for the
+ * next step in the binary search.
+ */
+function compareColumnPositions(
+ location: Position,
+ line: HookMapLine,
+ index: number,
+): {index: number | null, direction: number} {
+ const startIndex = index;
+ const start = line[index];
+ if (start == null) {
+ throw new Error(
+ `Unexpected mapping missing in HookMap line at index ${index}.`,
+ );
+ }
+ const startColumn = getColumnNumberFromEntry(start);
+
+ let endColumn;
+ let endIndex = index + 1;
+ const end = line[endIndex];
+ if (end != null) {
+ endColumn = getColumnNumberFromEntry(end);
+ } else {
+ endIndex = startIndex;
+ endColumn = startColumn;
+ }
+
+ // When the column matches exactly, return the matching index
+ if (startColumn === location.column) {
+ return {index: startIndex, direction: 0};
+ }
+ if (endColumn === location.column) {
+ return {index: endIndex, direction: 0};
+ }
+
+ // If we're at the end of the entries for this line, and the target
+ // column is greater than the current column, then this final entry
+ // must cover the target location, so we return it.
+ if (location.column > endColumn && end == null) {
+ return {index: endIndex, direction: 0};
+ }
+
+ // If the location is within the current column and the adjacent one,
+ // we know that the target location must be covered by the current entry.
+ if (startColumn < location.column && location.column < endColumn) {
+ return {index: startIndex, direction: 0};
+ }
+
+ // Otherwise, return the next direction in the search.
+ return {index: null, direction: location.column - startColumn};
+}
+
+function getLineNumberFromLine(line: HookMapLine): number {
+ return getLineNumberFromEntry(line[0]);
+}
+
+function getLineNumberFromEntry(entry: HookMapEntry): number {
+ const lineNumber = entry[0];
+ if (lineNumber == null) {
+ throw new Error('Unexpected line number missing in entry in HookMap');
+ }
+ return lineNumber;
+}
+
+function getColumnNumberFromEntry(entry: HookMapEntry): number {
+ const columnNumber = entry[1];
+ if (columnNumber == null) {
+ throw new Error('Unexpected column number missing in entry in HookMap');
+ }
+ return columnNumber;
+}
+
+function getHookNameIndexFromEntry(entry: HookMapEntry): number {
+ const hookNameIndex = entry[2];
+ if (hookNameIndex == null) {
+ throw new Error('Unexpected hook name index missing in entry in HookMap');
+ }
+ return hookNameIndex;
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/index.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..40725bc21fa67c3e220eae4258e7e72f500f1f7e
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/index.js
@@ -0,0 +1,62 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import type {HookSourceAndMetadata} from './loadSourceAndMetadata';
+import type {HooksNode, HooksTree} from 'react-debug-tools/src/ReactDebugHooks';
+import type {HookNames} from 'react-devtools-shared/src/frontend/types';
+import type {FetchFileWithCaching} from 'react-devtools-shared/src/devtools/views/Components/FetchFileWithCachingContext';
+
+import 'react';
+
+import {withAsyncPerfMeasurements} from 'react-devtools-shared/src/PerformanceLoggingUtils';
+import WorkerizedParseSourceAndMetadata from './parseSourceAndMetadata.worker';
+import typeof * as ParseSourceAndMetadataModule from './parseSourceAndMetadata';
+import {flattenHooksList, loadSourceAndMetadata} from './loadSourceAndMetadata';
+
+const workerizedParseHookNames: ParseSourceAndMetadataModule =
+ WorkerizedParseSourceAndMetadata();
+
+export function parseSourceAndMetadata(
+ hooksList: Array,
+ locationKeyToHookSourceAndMetadata: Map,
+): Promise {
+ return workerizedParseHookNames.parseSourceAndMetadata(
+ hooksList,
+ locationKeyToHookSourceAndMetadata,
+ );
+}
+
+export const purgeCachedMetadata = workerizedParseHookNames.purgeCachedMetadata;
+
+const EMPTY_MAP: HookNames = new Map();
+
+export async function parseHookNames(
+ hooksTree: HooksTree,
+ fetchFileWithCaching: FetchFileWithCaching | null,
+): Promise {
+ return withAsyncPerfMeasurements('parseHookNames', async () => {
+ const hooksList = flattenHooksList(hooksTree);
+ if (hooksList.length === 0) {
+ // This component tree contains no named hooks.
+ return EMPTY_MAP;
+ }
+
+ // Runs on the main/UI thread so it can reuse Network cache:
+ const locationKeyToHookSourceAndMetadata = await loadSourceAndMetadata(
+ hooksList,
+ fetchFileWithCaching,
+ );
+
+ // Runs in a Worker because it's CPU intensive:
+ return parseSourceAndMetadata(
+ hooksList,
+ locationKeyToHookSourceAndMetadata,
+ );
+ });
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/loadSourceAndMetadata.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/loadSourceAndMetadata.js
new file mode 100644
index 0000000000000000000000000000000000000000..3bfc83dd25470307fb8b8cfd3caac6ac922a75c4
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/loadSourceAndMetadata.js
@@ -0,0 +1,520 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+// Parsing source and source maps is done in a Web Worker
+// because parsing is CPU intensive and should not block the UI thread.
+//
+// Fetching source and source map files is intentionally done on the UI thread
+// so that loaded source files can reuse the browser's Network cache.
+// Requests made from within an extension do not share the page's Network cache,
+// but messages can be sent from the UI thread to the content script
+// which can make a request from the page's context (with caching).
+//
+// Some overhead may be incurred sharing (serializing) the loaded data between contexts,
+// but less than fetching the file to begin with,
+// and in some cases we can avoid serializing the source code at all
+// (e.g. when we are in an environment that supports our custom metadata format).
+//
+// The overall flow of this file is such:
+// 1. Find the Set of source files defining the hooks and load them all.
+// Then for each source file, do the following:
+//
+// a. Search loaded source file to see if a source map is available.
+// If so, load that file and pass it to a Worker for parsing.
+// The source map is used to retrieve the original source,
+// which is then also parsed in the Worker to infer hook names.
+// This is less ideal because parsing a full source map is slower,
+// since we need to evaluate the mappings in order to map the runtime code to the original source,
+// but at least the eventual source that we parse to an AST is small/fast.
+//
+// b. If no source map, pass the full source to a Worker for parsing.
+// Use the source to infer hook names.
+// This is the least optimal route as parsing the full source is very CPU intensive.
+//
+// In the future, we may add an additional optimization the above sequence.
+// This check would come before the source map check:
+//
+// a. Search loaded source file to see if a custom React metadata file is available.
+// If so, load that file and pass it to a Worker for parsing and extracting.
+// This is the fastest option since our custom metadata file is much smaller than a full source map,
+// and there is no need to convert runtime code to the original source.
+
+import {__DEBUG__} from 'react-devtools-shared/src/constants';
+import {getHookSourceLocationKey} from 'react-devtools-shared/src/hookSourceLocation';
+import {sourceMapIncludesSource} from '../SourceMapUtils';
+import {
+ withAsyncPerfMeasurements,
+ withCallbackPerfMeasurements,
+ withSyncPerfMeasurements,
+} from 'react-devtools-shared/src/PerformanceLoggingUtils';
+
+import type {
+ HooksNode,
+ HookSource,
+ HooksTree,
+} from 'react-debug-tools/src/ReactDebugHooks';
+import type {MixedSourceMap} from '../SourceMapTypes';
+import type {FetchFileWithCaching} from 'react-devtools-shared/src/devtools/views/Components/FetchFileWithCachingContext';
+
+// Prefer a cached albeit stale response to reduce download time.
+// We wouldn't want to load/parse a newer version of the source (even if one existed).
+const FETCH_OPTIONS = {cache: 'force-cache' as CacheType};
+
+const MAX_SOURCE_LENGTH = 100_000_000;
+
+export type HookSourceAndMetadata = {
+ // Generated by react-debug-tools.
+ hookSource: HookSource,
+
+ // Compiled code (React components or custom hooks) containing primitive hook calls.
+ runtimeSourceCode: string | null,
+
+ // Same as hookSource.fileName but guaranteed to be non-null.
+ runtimeSourceURL: string,
+
+ // Raw source map JSON.
+ // Either decoded from an inline source map or loaded from an externa source map file.
+ // Sources without source maps won't have this.
+ sourceMapJSON: MixedSourceMap | null,
+
+ // External URL of source map.
+ // Sources without source maps (or with inline source maps) won't have this.
+ sourceMapURL: string | null,
+};
+
+export type LocationKeyToHookSourceAndMetadata = Map<
+ string,
+ HookSourceAndMetadata,
+>;
+export type HooksList = Array;
+
+export async function loadSourceAndMetadata(
+ hooksList: HooksList,
+ fetchFileWithCaching: FetchFileWithCaching | null,
+): Promise {
+ return withAsyncPerfMeasurements('loadSourceAndMetadata()', async () => {
+ const locationKeyToHookSourceAndMetadata = withSyncPerfMeasurements(
+ 'initializeHookSourceAndMetadata',
+ () => initializeHookSourceAndMetadata(hooksList),
+ );
+
+ await withAsyncPerfMeasurements('loadSourceFiles()', () =>
+ loadSourceFiles(locationKeyToHookSourceAndMetadata, fetchFileWithCaching),
+ );
+
+ await withAsyncPerfMeasurements('extractAndLoadSourceMapJSON()', () =>
+ extractAndLoadSourceMapJSON(locationKeyToHookSourceAndMetadata),
+ );
+
+ // At this point, we've loaded JS source (text) and source map (JSON).
+ // The remaining works (parsing these) is CPU intensive and should be done in a worker.
+ return locationKeyToHookSourceAndMetadata;
+ });
+}
+
+function decodeBase64String(encoded: string): Object {
+ return atob(encoded);
+}
+
+function extractAndLoadSourceMapJSON(
+ locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
+): Promise {
+ // Deduplicate fetches, since there can be multiple location keys per source map.
+ const dedupedFetchPromises = new Map>();
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(
+ 'extractAndLoadSourceMapJSON() load',
+ locationKeyToHookSourceAndMetadata.size,
+ 'source maps',
+ );
+ }
+
+ const setterPromises = [];
+ locationKeyToHookSourceAndMetadata.forEach(hookSourceAndMetadata => {
+ const sourceMapRegex = / ?sourceMappingURL=([^\s'"]+)/gm;
+ const runtimeSourceCode =
+ hookSourceAndMetadata.runtimeSourceCode as any as string;
+
+ // TODO (named hooks) Search for our custom metadata first.
+ // If it's found, we should use it rather than source maps.
+
+ // TODO (named hooks) If this RegExp search is slow, we could try breaking it up
+ // first using an indexOf(' sourceMappingURL=') to find the start of the comment
+ // (probably at the end of the file) and then running the RegExp on the remaining substring.
+ let sourceMappingURLMatch = withSyncPerfMeasurements(
+ 'sourceMapRegex.exec(runtimeSourceCode)',
+ () => sourceMapRegex.exec(runtimeSourceCode),
+ );
+
+ if (sourceMappingURLMatch == null) {
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log('extractAndLoadSourceMapJSON() No source map found');
+ }
+
+ // Maybe file has not been transformed; we'll try to parse it as-is in parseSourceAST().
+ } else {
+ const externalSourceMapURLs = [];
+ while (sourceMappingURLMatch != null) {
+ const {runtimeSourceURL} = hookSourceAndMetadata;
+ const sourceMappingURL = sourceMappingURLMatch[1];
+ const hasInlineSourceMap = sourceMappingURL.indexOf('base64,') >= 0;
+ if (hasInlineSourceMap) {
+ try {
+ // TODO (named hooks) deduplicate parsing in this branch (similar to fetching in the other branch)
+ // since there can be multiple location keys per source map.
+
+ // Web apps like Code Sandbox embed multiple inline source maps.
+ // In this case, we need to loop through and find the right one.
+ // We may also need to trim any part of this string that isn't based64 encoded data.
+ const trimmed = (
+ sourceMappingURL.match(
+ /base64,([a-zA-Z0-9+\/=]+)/,
+ ) as any as Array
+ )[1];
+ const decoded = withSyncPerfMeasurements(
+ 'decodeBase64String()',
+ () => decodeBase64String(trimmed),
+ );
+
+ const sourceMapJSON = withSyncPerfMeasurements(
+ 'JSON.parse(decoded)',
+ () => JSON.parse(decoded),
+ );
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.groupCollapsed(
+ 'extractAndLoadSourceMapJSON() Inline source map',
+ );
+ console.log(sourceMapJSON);
+ console.groupEnd();
+ }
+
+ // Hook source might be a URL like "https://4syus.csb.app/src/App.js"
+ // Parsed source map might be a partial path like "src/App.js"
+ if (sourceMapIncludesSource(sourceMapJSON, runtimeSourceURL)) {
+ hookSourceAndMetadata.sourceMapJSON = sourceMapJSON;
+
+ // OPTIMIZATION If we've located a source map for this source,
+ // we'll use it to retrieve the original source (to extract hook names).
+ // We only fall back to parsing the full source code is when there's no source map.
+ // The source is (potentially) very large,
+ // So we can avoid the overhead of serializing it unnecessarily.
+ hookSourceAndMetadata.runtimeSourceCode = null;
+
+ break;
+ }
+ } catch (error) {
+ // We've likely encountered a string in the source code that looks like a source map but isn't.
+ // Maybe the source code contains a "sourceMappingURL" comment or soething similar.
+ // In either case, let's skip this and keep looking.
+ }
+ } else {
+ externalSourceMapURLs.push(sourceMappingURL);
+ }
+
+ // If the first source map we found wasn't a match, check for more.
+ sourceMappingURLMatch = withSyncPerfMeasurements(
+ 'sourceMapRegex.exec(runtimeSourceCode)',
+ () => sourceMapRegex.exec(runtimeSourceCode),
+ );
+ }
+
+ if (hookSourceAndMetadata.sourceMapJSON === null) {
+ externalSourceMapURLs.forEach((sourceMappingURL, index) => {
+ if (index !== externalSourceMapURLs.length - 1) {
+ // Files with external source maps should only have a single source map.
+ // More than one result might indicate an edge case,
+ // like a string in the source code that matched our "sourceMappingURL" regex.
+ // We should just skip over cases like this.
+ console.warn(
+ `More than one external source map detected in the source file; skipping "${sourceMappingURL}"`,
+ );
+ return;
+ }
+
+ const {runtimeSourceURL} = hookSourceAndMetadata;
+ let url = sourceMappingURL;
+ if (!url.startsWith('http') && !url.startsWith('/')) {
+ // Resolve paths relative to the location of the file name
+ const lastSlashIdx = runtimeSourceURL.lastIndexOf('/');
+ if (lastSlashIdx !== -1) {
+ const baseURL = runtimeSourceURL.slice(
+ 0,
+ runtimeSourceURL.lastIndexOf('/'),
+ );
+ url = `${baseURL}/${url}`;
+ }
+ }
+
+ hookSourceAndMetadata.sourceMapURL = url;
+
+ const fetchPromise =
+ dedupedFetchPromises.get(url) ||
+ fetchFile(url).then(
+ sourceMapContents => {
+ const sourceMapJSON = withSyncPerfMeasurements(
+ 'JSON.parse(sourceMapContents)',
+ () => JSON.parse(sourceMapContents),
+ );
+
+ return sourceMapJSON;
+ },
+
+ // In this case, we fall back to the assumption that the source has no source map.
+ // This might indicate an (unlikely) edge case that had no source map,
+ // but contained the string "sourceMappingURL".
+ error => null,
+ );
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ if (!dedupedFetchPromises.has(url)) {
+ console.log(
+ `extractAndLoadSourceMapJSON() External source map "${url}"`,
+ );
+ }
+ }
+
+ dedupedFetchPromises.set(url, fetchPromise);
+
+ setterPromises.push(
+ fetchPromise.then(sourceMapJSON => {
+ if (sourceMapJSON !== null) {
+ hookSourceAndMetadata.sourceMapJSON = sourceMapJSON;
+
+ // OPTIMIZATION If we've located a source map for this source,
+ // we'll use it to retrieve the original source (to extract hook names).
+ // We only fall back to parsing the full source code is when there's no source map.
+ // The source is (potentially) very large,
+ // So we can avoid the overhead of serializing it unnecessarily.
+ hookSourceAndMetadata.runtimeSourceCode = null;
+ }
+ }),
+ );
+ });
+ }
+ }
+ });
+
+ return Promise.all(setterPromises);
+}
+
+function fetchFile(
+ url: string,
+ markName: string = 'fetchFile',
+): Promise {
+ return withCallbackPerfMeasurements(`${markName}("${url}")`, done => {
+ return new Promise((resolve, reject) => {
+ // $FlowFixMe[incompatible-type]
+ fetch(url, FETCH_OPTIONS).then(
+ response => {
+ if (response.ok) {
+ response
+ .text()
+ .then(text => {
+ done();
+ resolve(text);
+ })
+ .catch(error => {
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(
+ `${markName}() Could not read text for url "${url}"`,
+ );
+ }
+ done();
+ reject(null);
+ });
+ } else {
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(`${markName}() Got bad response for url "${url}"`);
+ }
+ done();
+ reject(null);
+ }
+ },
+ error => {
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(`${markName}() Could not fetch file: ${error.message}`);
+ }
+ done();
+ reject(null);
+ },
+ );
+ });
+ });
+}
+
+export function hasNamedHooks(hooksTree: HooksTree): boolean {
+ for (let i = 0; i < hooksTree.length; i++) {
+ const hook = hooksTree[i];
+
+ if (!isUnnamedBuiltInHook(hook)) {
+ return true;
+ }
+
+ if (hook.subHooks.length > 0) {
+ if (hasNamedHooks(hook.subHooks)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+export function flattenHooksList(hooksTree: HooksTree): HooksList {
+ const hooksList: HooksList = [];
+ withSyncPerfMeasurements('flattenHooksList()', () => {
+ flattenHooksListImpl(hooksTree, hooksList);
+ });
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log('flattenHooksList() hooksList:', hooksList);
+ }
+
+ return hooksList;
+}
+
+function flattenHooksListImpl(
+ hooksTree: HooksTree,
+ hooksList: Array,
+): void {
+ for (let i = 0; i < hooksTree.length; i++) {
+ const hook = hooksTree[i];
+
+ if (isUnnamedBuiltInHook(hook)) {
+ // No need to load source code or do any parsing for unnamed hooks.
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log('flattenHooksListImpl() Skipping unnamed hook', hook);
+ }
+
+ continue;
+ }
+
+ hooksList.push(hook);
+
+ if (hook.subHooks.length > 0) {
+ flattenHooksListImpl(hook.subHooks, hooksList);
+ }
+ }
+}
+
+function initializeHookSourceAndMetadata(
+ hooksList: Array,
+): LocationKeyToHookSourceAndMetadata {
+ // Create map of unique source locations (file names plus line and column numbers) to metadata about hooks.
+ const locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata =
+ new Map();
+ for (let i = 0; i < hooksList.length; i++) {
+ const hook = hooksList[i];
+
+ const hookSource = hook.hookSource;
+ if (hookSource == null) {
+ // Older versions of react-debug-tools don't include this information.
+ // In this case, we can't continue.
+ throw Error('Hook source code location not found.');
+ }
+
+ const locationKey = getHookSourceLocationKey(hookSource);
+ if (!locationKeyToHookSourceAndMetadata.has(locationKey)) {
+ // Can't be null because getHookSourceLocationKey() would have thrown
+ const runtimeSourceURL = hookSource.fileName as any as string;
+
+ const hookSourceAndMetadata: HookSourceAndMetadata = {
+ hookSource,
+ runtimeSourceCode: null,
+ runtimeSourceURL,
+ sourceMapJSON: null,
+ sourceMapURL: null,
+ };
+
+ locationKeyToHookSourceAndMetadata.set(
+ locationKey,
+ hookSourceAndMetadata,
+ );
+ }
+ }
+
+ return locationKeyToHookSourceAndMetadata;
+}
+
+// Determines whether incoming hook is a primitive hook that gets assigned to variables.
+function isUnnamedBuiltInHook(hook: HooksNode) {
+ return ['Effect', 'ImperativeHandle', 'LayoutEffect', 'DebugValue'].includes(
+ hook.name,
+ );
+}
+
+function loadSourceFiles(
+ locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
+ fetchFileWithCaching: FetchFileWithCaching | null,
+): Promise {
+ // Deduplicate fetches, since there can be multiple location keys per file.
+ const dedupedFetchPromises = new Map>();
+
+ const setterPromises = [];
+ locationKeyToHookSourceAndMetadata.forEach(hookSourceAndMetadata => {
+ const {runtimeSourceURL} = hookSourceAndMetadata;
+
+ let fetchFileFunction = fetchFile;
+ if (fetchFileWithCaching != null) {
+ // If a helper function has been injected to fetch with caching,
+ // use it to fetch the (already loaded) source file.
+ fetchFileFunction = url => {
+ return withAsyncPerfMeasurements(
+ `fetchFileWithCaching("${url}")`,
+ () => {
+ return (fetchFileWithCaching as any as FetchFileWithCaching)(url);
+ },
+ );
+ };
+ }
+
+ const fetchPromise =
+ dedupedFetchPromises.get(runtimeSourceURL) ||
+ (runtimeSourceURL && !runtimeSourceURL.startsWith(' {
+ // TODO (named hooks) Re-think this; the main case where it matters is when there's no source-maps,
+ // because then we need to parse the full source file as an AST.
+ if (runtimeSourceCode.length > MAX_SOURCE_LENGTH) {
+ throw Error('Source code too large to parse');
+ }
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.groupCollapsed(
+ `loadSourceFiles() runtimeSourceURL "${runtimeSourceURL}"`,
+ );
+ console.log(runtimeSourceCode);
+ console.groupEnd();
+ }
+
+ return runtimeSourceCode;
+ })
+ : Promise.reject(new Error('Empty url')));
+ dedupedFetchPromises.set(runtimeSourceURL, fetchPromise);
+
+ setterPromises.push(
+ fetchPromise.then(runtimeSourceCode => {
+ hookSourceAndMetadata.runtimeSourceCode = runtimeSourceCode;
+ }),
+ );
+ });
+
+ return Promise.all(setterPromises);
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js
new file mode 100644
index 0000000000000000000000000000000000000000..4e01d6b360a915586d70f7bcb549ad15d00bed60
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js
@@ -0,0 +1,449 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+// For an overview of why the code in this file is structured this way,
+// refer to header comments in loadSourceAndMetadata.
+
+import {parse} from '@babel/parser';
+import LRU from 'lru-cache';
+import {getHookName} from '../astUtils';
+import {areSourceMapsAppliedToErrors} from '../ErrorTester';
+import {__DEBUG__} from 'react-devtools-shared/src/constants';
+import {getHookSourceLocationKey} from 'react-devtools-shared/src/hookSourceLocation';
+import {SourceMapMetadataConsumer} from '../SourceMapMetadataConsumer';
+import {
+ withAsyncPerfMeasurements,
+ withSyncPerfMeasurements,
+} from 'react-devtools-shared/src/PerformanceLoggingUtils';
+import SourceMapConsumer from '../SourceMapConsumer';
+
+import type {SourceMapConsumerType} from '../SourceMapConsumer';
+import type {
+ HooksList,
+ LocationKeyToHookSourceAndMetadata,
+} from './loadSourceAndMetadata';
+import type {HookSource} from 'react-debug-tools/src/ReactDebugHooks';
+import type {
+ HookNames,
+ LRUCache,
+} from 'react-devtools-shared/src/frontend/types';
+
+type AST = mixed;
+
+type HookParsedMetadata = {
+ // API for consuming metadfata present in extended source map.
+ metadataConsumer: SourceMapMetadataConsumer | null,
+
+ // AST for original source code; typically comes from a consumed source map.
+ originalSourceAST: AST | null,
+
+ // Source code (React components or custom hooks) containing primitive hook calls.
+ // If no source map has been provided, this code will be the same as runtimeSourceCode.
+ originalSourceCode: string | null,
+
+ // Original source URL if there is a source map, or the same as runtimeSourceURL.
+ originalSourceURL: string | null,
+
+ // Line number in original source code.
+ originalSourceLineNumber: number | null,
+
+ // Column number in original source code.
+ originalSourceColumnNumber: number | null,
+
+ // Alternate APIs from source-map for parsing source maps (if detected).
+ sourceMapConsumer: SourceMapConsumerType | null,
+};
+
+type LocationKeyToHookParsedMetadata = Map;
+
+type CachedRuntimeCodeMetadata = {
+ metadataConsumer: SourceMapMetadataConsumer | null,
+ sourceMapConsumer: SourceMapConsumerType | null,
+};
+
+const runtimeURLToMetadataCache: LRUCache =
+ new LRU({max: 50});
+
+type CachedSourceCodeMetadata = {
+ originalSourceAST: AST,
+ originalSourceCode: string,
+};
+
+const originalURLToMetadataCache: LRUCache =
+ new LRU({
+ max: 50,
+ dispose: (
+ originalSourceURL: string,
+ metadata: CachedSourceCodeMetadata,
+ ) => {
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(
+ `originalURLToMetadataCache.dispose() Evicting cached metadata for "${originalSourceURL}"`,
+ );
+ }
+ },
+ });
+
+export async function parseSourceAndMetadata(
+ hooksList: HooksList,
+ locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
+): Promise {
+ return withAsyncPerfMeasurements('parseSourceAndMetadata()', async () => {
+ const locationKeyToHookParsedMetadata = withSyncPerfMeasurements(
+ 'initializeHookParsedMetadata',
+ () => initializeHookParsedMetadata(locationKeyToHookSourceAndMetadata),
+ );
+
+ withSyncPerfMeasurements('parseSourceMaps', () =>
+ parseSourceMaps(
+ locationKeyToHookSourceAndMetadata,
+ locationKeyToHookParsedMetadata,
+ ),
+ );
+
+ withSyncPerfMeasurements('parseSourceAST()', () =>
+ parseSourceAST(
+ locationKeyToHookSourceAndMetadata,
+ locationKeyToHookParsedMetadata,
+ ),
+ );
+
+ return withSyncPerfMeasurements('findHookNames()', () =>
+ findHookNames(hooksList, locationKeyToHookParsedMetadata),
+ );
+ });
+}
+
+function findHookNames(
+ hooksList: HooksList,
+ locationKeyToHookParsedMetadata: LocationKeyToHookParsedMetadata,
+): HookNames {
+ const map: HookNames = new Map();
+
+ hooksList.map(hook => {
+ // We already guard against a null HookSource in parseHookNames()
+ const hookSource = hook.hookSource as any as HookSource;
+ const fileName = hookSource.fileName;
+ if (!fileName) {
+ return null; // Should not be reachable.
+ }
+
+ const locationKey = getHookSourceLocationKey(hookSource);
+ const hookParsedMetadata = locationKeyToHookParsedMetadata.get(locationKey);
+ if (!hookParsedMetadata) {
+ return null; // Should not be reachable.
+ }
+
+ const {lineNumber, columnNumber} = hookSource;
+ if (!lineNumber || !columnNumber) {
+ return null; // Should not be reachable.
+ }
+
+ const {
+ originalSourceURL,
+ originalSourceColumnNumber,
+ originalSourceLineNumber,
+ } = hookParsedMetadata;
+
+ if (
+ originalSourceLineNumber == null ||
+ originalSourceColumnNumber == null ||
+ originalSourceURL == null
+ ) {
+ return null; // Should not be reachable.
+ }
+
+ let name;
+ const {metadataConsumer} = hookParsedMetadata;
+ if (metadataConsumer != null) {
+ name = withSyncPerfMeasurements('metadataConsumer.hookNameFor()', () =>
+ metadataConsumer.hookNameFor({
+ line: originalSourceLineNumber,
+ column: originalSourceColumnNumber,
+ source: originalSourceURL,
+ }),
+ );
+ }
+
+ if (name == null) {
+ name = withSyncPerfMeasurements('getHookName()', () =>
+ getHookName(
+ hook,
+ hookParsedMetadata.originalSourceAST,
+ hookParsedMetadata.originalSourceCode as any as string,
+ originalSourceLineNumber as any as number,
+ originalSourceColumnNumber,
+ ),
+ );
+ }
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(`findHookNames() Found name "${name || '-'}"`);
+ }
+
+ const key = getHookSourceLocationKey(hookSource);
+ map.set(key, name);
+ });
+
+ return map;
+}
+
+function initializeHookParsedMetadata(
+ locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
+) {
+ // Create map of unique source locations (file names plus line and column numbers) to metadata about hooks.
+ const locationKeyToHookParsedMetadata: LocationKeyToHookParsedMetadata =
+ new Map();
+ locationKeyToHookSourceAndMetadata.forEach(
+ (hookSourceAndMetadata, locationKey) => {
+ const hookParsedMetadata: HookParsedMetadata = {
+ metadataConsumer: null,
+ originalSourceAST: null,
+ originalSourceCode: null,
+ originalSourceURL: null,
+ originalSourceLineNumber: null,
+ originalSourceColumnNumber: null,
+ sourceMapConsumer: null,
+ };
+
+ locationKeyToHookParsedMetadata.set(locationKey, hookParsedMetadata);
+ },
+ );
+
+ return locationKeyToHookParsedMetadata;
+}
+
+function parseSourceAST(
+ locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
+ locationKeyToHookParsedMetadata: LocationKeyToHookParsedMetadata,
+): void {
+ locationKeyToHookSourceAndMetadata.forEach(
+ (hookSourceAndMetadata, locationKey) => {
+ const hookParsedMetadata =
+ locationKeyToHookParsedMetadata.get(locationKey);
+ if (hookParsedMetadata == null) {
+ throw Error(`Expected to find HookParsedMetadata for "${locationKey}"`);
+ }
+
+ if (hookParsedMetadata.originalSourceAST !== null) {
+ // Use cached metadata.
+ return;
+ }
+
+ if (
+ hookParsedMetadata.originalSourceURL != null &&
+ hookParsedMetadata.originalSourceCode != null &&
+ hookParsedMetadata.originalSourceColumnNumber != null &&
+ hookParsedMetadata.originalSourceLineNumber != null
+ ) {
+ // Use cached metadata.
+ return;
+ }
+
+ const {lineNumber, columnNumber} = hookSourceAndMetadata.hookSource;
+ if (lineNumber == null || columnNumber == null) {
+ throw Error('Hook source code location not found.');
+ }
+
+ const {metadataConsumer, sourceMapConsumer} = hookParsedMetadata;
+ const runtimeSourceCode =
+ hookSourceAndMetadata.runtimeSourceCode as any as string;
+ let hasHookMap = false;
+ let originalSourceURL;
+ let originalSourceCode;
+ let originalSourceColumnNumber;
+ let originalSourceLineNumber;
+ if (areSourceMapsAppliedToErrors() || sourceMapConsumer === null) {
+ // Either the current environment automatically applies source maps to errors,
+ // or the current code had no source map to begin with.
+ // Either way, we don't need to convert the Error stack frame locations.
+ originalSourceColumnNumber = columnNumber;
+ originalSourceLineNumber = lineNumber;
+ // There's no source map to parse here so we can just parse the original source itself.
+ originalSourceCode = runtimeSourceCode;
+ // TODO (named hooks) This mixes runtimeSourceURLs with source mapped URLs in the same cache key space.
+ // Namespace them?
+ originalSourceURL = hookSourceAndMetadata.runtimeSourceURL;
+ } else {
+ const {column, line, sourceContent, sourceURL} =
+ sourceMapConsumer.originalPositionFor({
+ columnNumber,
+ lineNumber,
+ });
+ if (sourceContent === null || sourceURL === null) {
+ throw Error(
+ `Could not find original source for line:${lineNumber} and column:${columnNumber}`,
+ );
+ }
+
+ originalSourceColumnNumber = column;
+ originalSourceLineNumber = line;
+ originalSourceCode = sourceContent;
+ originalSourceURL = sourceURL;
+ }
+
+ hookParsedMetadata.originalSourceCode = originalSourceCode;
+ hookParsedMetadata.originalSourceURL = originalSourceURL;
+ hookParsedMetadata.originalSourceLineNumber = originalSourceLineNumber;
+ hookParsedMetadata.originalSourceColumnNumber =
+ originalSourceColumnNumber;
+
+ if (
+ metadataConsumer != null &&
+ metadataConsumer.hasHookMap(originalSourceURL)
+ ) {
+ hasHookMap = true;
+ }
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(
+ `parseSourceAST() mapped line ${lineNumber}->${originalSourceLineNumber} and column ${columnNumber}->${originalSourceColumnNumber}`,
+ );
+ }
+
+ if (hasHookMap) {
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(
+ `parseSourceAST() Found hookMap and skipping parsing for "${originalSourceURL}"`,
+ );
+ }
+ // If there's a hook map present from an extended sourcemap then
+ // we don't need to parse the source files and instead can use the
+ // hook map to extract hook names.
+ return;
+ }
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(
+ `parseSourceAST() Did not find hook map for "${originalSourceURL}"`,
+ );
+ }
+
+ // The cache also serves to deduplicate parsing by URL in our loop over location keys.
+ // This may need to change if we switch to async parsing.
+ const sourceMetadata = originalURLToMetadataCache.get(originalSourceURL);
+ if (sourceMetadata != null) {
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.groupCollapsed(
+ `parseSourceAST() Found cached source metadata for "${originalSourceURL}"`,
+ );
+ console.log(sourceMetadata);
+ console.groupEnd();
+ }
+ hookParsedMetadata.originalSourceAST = sourceMetadata.originalSourceAST;
+ hookParsedMetadata.originalSourceCode =
+ sourceMetadata.originalSourceCode;
+ } else {
+ try {
+ // TypeScript is the most commonly used typed JS variant so let's default to it
+ // unless we detect explicit Flow usage via the "@flow" pragma.
+ const plugin =
+ originalSourceCode.indexOf('@flow') > 0 ? 'flow' : 'typescript';
+
+ // TODO (named hooks) This is probably where we should check max source length,
+ // rather than in loadSourceAndMetatada -> loadSourceFiles().
+ // TODO(#22319): Support source files that are html files with inline script tags.
+ const originalSourceAST = withSyncPerfMeasurements(
+ '[@babel/parser] parse(originalSourceCode)',
+ () =>
+ parse(originalSourceCode, {
+ sourceType: 'unambiguous',
+ plugins: ['jsx', plugin],
+ }),
+ );
+ hookParsedMetadata.originalSourceAST = originalSourceAST;
+
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.log(
+ `parseSourceAST() Caching source metadata for "${originalSourceURL}"`,
+ );
+ }
+
+ originalURLToMetadataCache.set(originalSourceURL, {
+ originalSourceAST,
+ originalSourceCode,
+ });
+ } catch (error) {
+ throw new Error(
+ `Failed to parse source file: ${originalSourceURL}\n\n` +
+ `Original error: ${error}`,
+ );
+ }
+ }
+ },
+ );
+}
+
+function parseSourceMaps(
+ locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
+ locationKeyToHookParsedMetadata: LocationKeyToHookParsedMetadata,
+) {
+ locationKeyToHookSourceAndMetadata.forEach(
+ (hookSourceAndMetadata, locationKey) => {
+ const hookParsedMetadata =
+ locationKeyToHookParsedMetadata.get(locationKey);
+ if (hookParsedMetadata == null) {
+ throw Error(`Expected to find HookParsedMetadata for "${locationKey}"`);
+ }
+
+ const {runtimeSourceURL, sourceMapJSON} = hookSourceAndMetadata;
+
+ // If we've already loaded the source map info for this file,
+ // we can skip reloading it (and more importantly, re-parsing it).
+ const runtimeMetadata = runtimeURLToMetadataCache.get(runtimeSourceURL);
+ if (runtimeMetadata != null) {
+ // $FlowFixMe[constant-condition]
+ if (__DEBUG__) {
+ console.groupCollapsed(
+ `parseHookNames() Found cached runtime metadata for file "${runtimeSourceURL}"`,
+ );
+ console.log(runtimeMetadata);
+ console.groupEnd();
+ }
+
+ hookParsedMetadata.metadataConsumer = runtimeMetadata.metadataConsumer;
+ hookParsedMetadata.sourceMapConsumer =
+ runtimeMetadata.sourceMapConsumer;
+ } else {
+ if (sourceMapJSON != null) {
+ const sourceMapConsumer = withSyncPerfMeasurements(
+ 'new SourceMapConsumer(sourceMapJSON)',
+ () => SourceMapConsumer(sourceMapJSON),
+ );
+
+ const metadataConsumer = withSyncPerfMeasurements(
+ 'new SourceMapMetadataConsumer(sourceMapJSON)',
+ () => new SourceMapMetadataConsumer(sourceMapJSON),
+ );
+
+ hookParsedMetadata.metadataConsumer = metadataConsumer;
+ hookParsedMetadata.sourceMapConsumer = sourceMapConsumer;
+
+ // Only set once to avoid triggering eviction/cleanup code.
+ runtimeURLToMetadataCache.set(runtimeSourceURL, {
+ metadataConsumer: metadataConsumer,
+ sourceMapConsumer: sourceMapConsumer,
+ });
+ }
+ }
+ },
+ );
+}
+
+export function purgeCachedMetadata(): void {
+ originalURLToMetadataCache.reset();
+ runtimeURLToMetadataCache.reset();
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.worker.js b/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..ec17c197fe059362b99ab5314bdf650ca3cf30bb
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.worker.js
@@ -0,0 +1,13 @@
+/**
+ * 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.
+ */
+
+import * as parseSourceAndMetadataModule from './parseSourceAndMetadata';
+
+export const parseSourceAndMetadata =
+ parseSourceAndMetadataModule.parseSourceAndMetadata;
+export const purgeCachedMetadata =
+ parseSourceAndMetadataModule.purgeCachedMetadata;
diff --git a/github_code/react__react/packages/react-devtools-shared/src/hydration.js b/github_code/react__react/packages/react-devtools-shared/src/hydration.js
new file mode 100644
index 0000000000000000000000000000000000000000..d11c6220d4c55facc449185f93088e22efcd8aee
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/hydration.js
@@ -0,0 +1,810 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import {
+ getDataType,
+ getDisplayNameForReactElement,
+ getAllEnumerableKeys,
+ getInObject,
+ formatDataForPreview,
+ setInObject,
+} from 'react-devtools-shared/src/utils';
+
+import {REACT_LEGACY_ELEMENT_TYPE} from 'shared/ReactSymbols';
+
+import type {
+ DehydratedData,
+ InspectedElementPath,
+} from 'react-devtools-shared/src/frontend/types';
+
+import noop from 'shared/noop';
+
+export const meta = {
+ inspectable: Symbol('inspectable') as symbol,
+ inspected: Symbol('inspected') as symbol,
+ name: Symbol('name') as symbol,
+ preview_long: Symbol('preview_long') as symbol,
+ preview_short: Symbol('preview_short') as symbol,
+ readonly: Symbol('readonly') as symbol,
+ size: Symbol('size') as symbol,
+ type: Symbol('type') as symbol,
+ unserializable: Symbol('unserializable') as symbol,
+};
+
+export type Dehydrated = {
+ inspectable: boolean,
+ name: string | null,
+ preview_long: string | null,
+ preview_short: string | null,
+ readonly?: boolean,
+ size?: number,
+ type: string,
+};
+
+// Typed arrays, other complex iteratable objects (e.g. Map, Set, ImmutableJS) or Promises need special handling.
+// These objects can't be serialized without losing type information,
+// so a "Unserializable" type wrapper is used (with meta-data keys) to send nested values-
+// while preserving the original type and name.
+export type Unserializable = {
+ name: string | null,
+ preview_long: string | null,
+ preview_short: string | null,
+ readonly?: boolean,
+ size?: number,
+ type: string,
+ unserializable: boolean,
+ [string | number]: any,
+};
+
+// This threshold determines the depth at which the bridge "dehydrates" nested data.
+// Dehydration means that we don't serialize the data for e.g. postMessage or stringify,
+// unless the frontend explicitly requests it (e.g. a user clicks to expand a props object).
+//
+// Reducing this threshold will improve the speed of initial component inspection,
+// but may decrease the responsiveness of expanding objects/arrays to inspect further.
+const LEVEL_THRESHOLD = 2;
+
+/**
+ * Generate the dehydrated metadata for complex object instances
+ */
+function createDehydrated(
+ type: string,
+ inspectable: boolean,
+ data: Object,
+ cleaned: Array>,
+ path: Array,
+): Dehydrated {
+ cleaned.push(path);
+
+ const dehydrated: Dehydrated = {
+ inspectable,
+ type,
+ preview_long: formatDataForPreview(data, true),
+ preview_short: formatDataForPreview(data, false),
+ name:
+ typeof data.constructor !== 'function' ||
+ typeof data.constructor.name !== 'string' ||
+ data.constructor.name === 'Object'
+ ? ''
+ : data.constructor.name,
+ };
+
+ if (type === 'array' || type === 'typed_array') {
+ dehydrated.size = data.length;
+ } else if (type === 'object') {
+ dehydrated.size = Object.keys(data).length;
+ }
+
+ if (type === 'iterator' || type === 'typed_array') {
+ dehydrated.readonly = true;
+ }
+
+ return dehydrated;
+}
+
+/**
+ * Strip out complex data (instances, functions, and data nested > LEVEL_THRESHOLD levels deep).
+ * The paths of the stripped out objects are appended to the `cleaned` list.
+ * On the other side of the barrier, the cleaned list is used to "re-hydrate" the cleaned representation into
+ * an object with symbols as attributes, so that a sanitized object can be distinguished from a normal object.
+ *
+ * Input: {"some": {"attr": fn()}, "other": AnInstance}
+ * Output: {
+ * "some": {
+ * "attr": {"name": the fn.name, type: "function"}
+ * },
+ * "other": {
+ * "name": "AnInstance",
+ * "type": "object",
+ * },
+ * }
+ * and cleaned = [["some", "attr"], ["other"]]
+ */
+export function dehydrate(
+ data: Object,
+ cleaned: Array>,
+ unserializable: Array>,
+ path: Array,
+ isPathAllowed: (path: Array) => boolean,
+ level: number = 0,
+): DehydratedData['data'] {
+ const type = getDataType(data);
+
+ let isPathAllowedCheck;
+
+ switch (type) {
+ case 'html_element':
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data.tagName,
+ type,
+ };
+
+ case 'function':
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name:
+ typeof data.name === 'function' || !data.name
+ ? 'function'
+ : data.name,
+ type,
+ };
+
+ case 'string':
+ isPathAllowedCheck = isPathAllowed(path);
+ if (isPathAllowedCheck) {
+ return data;
+ } else {
+ return data.length <= 500 ? data : data.slice(0, 500) + '...';
+ }
+
+ case 'bigint':
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data.toString(),
+ type,
+ };
+
+ case 'symbol':
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data.toString(),
+ type,
+ };
+
+ case 'react_element': {
+ isPathAllowedCheck = isPathAllowed(path);
+
+ if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
+ cleaned.push(path);
+ return {
+ inspectable: true,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: getDisplayNameForReactElement(data) || 'Unknown',
+ type,
+ };
+ }
+
+ const unserializableValue: Unserializable = {
+ unserializable: true,
+ type,
+ readonly: true,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: getDisplayNameForReactElement(data) || 'Unknown',
+ };
+ // TODO: We can't expose type because that name is already taken on Unserializable.
+ unserializableValue.key = dehydrate(
+ data.key,
+ cleaned,
+ unserializable,
+ path.concat(['key']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ if (data.$$typeof === REACT_LEGACY_ELEMENT_TYPE) {
+ unserializableValue.ref = dehydrate(
+ data.ref,
+ cleaned,
+ unserializable,
+ path.concat(['ref']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ }
+ unserializableValue.props = dehydrate(
+ data.props,
+ cleaned,
+ unserializable,
+ path.concat(['props']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+
+ unserializable.push(path);
+ return unserializableValue;
+ }
+ case 'react_lazy': {
+ isPathAllowedCheck = isPathAllowed(path);
+
+ const payload = data._payload;
+
+ if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
+ cleaned.push(path);
+ const inspectable =
+ payload !== null &&
+ typeof payload === 'object' &&
+ (payload._status === 1 ||
+ payload._status === 2 ||
+ payload.status === 'fulfilled' ||
+ payload.status === 'rejected');
+ return {
+ inspectable,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: 'lazy()',
+ type,
+ };
+ }
+
+ const unserializableValue: Unserializable = {
+ unserializable: true,
+ type: type,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: 'lazy()',
+ };
+ // Ideally we should alias these properties to something more readable but
+ // unfortunately because of how the hydration algorithm uses a single concept of
+ // "path" we can't alias the path.
+ unserializableValue._payload = dehydrate(
+ payload,
+ cleaned,
+ unserializable,
+ path.concat(['_payload']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ unserializable.push(path);
+ return unserializableValue;
+ }
+ // ArrayBuffers error if you try to inspect them.
+ case 'array_buffer':
+ case 'data_view':
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: type === 'data_view' ? 'DataView' : 'ArrayBuffer',
+ size: data.byteLength,
+ type,
+ };
+
+ case 'array':
+ isPathAllowedCheck = isPathAllowed(path);
+ if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
+ return createDehydrated(type, true, data, cleaned, path);
+ }
+ const arr: Array = [];
+ for (let i = 0; i < data.length; i++) {
+ arr[i] = dehydrateKey(
+ data,
+ i,
+ cleaned,
+ unserializable,
+ path.concat([i]),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ }
+ return arr;
+
+ case 'html_all_collection':
+ case 'typed_array':
+ case 'iterator':
+ isPathAllowedCheck = isPathAllowed(path);
+ if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
+ return createDehydrated(type, true, data, cleaned, path);
+ } else {
+ const unserializableValue: Unserializable = {
+ unserializable: true,
+ type: type,
+ readonly: true,
+ size: type === 'typed_array' ? data.length : undefined,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name:
+ typeof data.constructor !== 'function' ||
+ typeof data.constructor.name !== 'string' ||
+ data.constructor.name === 'Object'
+ ? ''
+ : data.constructor.name,
+ };
+
+ // TRICKY
+ // Don't use [...spread] syntax for this purpose.
+ // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values.
+ // Other types (e.g. typed arrays, Sets) will not spread correctly.
+ Array.from(data).forEach(
+ (item, i) =>
+ (unserializableValue[i] = dehydrate(
+ item,
+ cleaned,
+ unserializable,
+ path.concat([i]),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ )),
+ );
+
+ unserializable.push(path);
+
+ return unserializableValue;
+ }
+
+ case 'opaque_iterator':
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data[Symbol.toStringTag],
+ type,
+ };
+
+ case 'date':
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data.toString(),
+ type,
+ };
+
+ case 'regexp':
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data.toString(),
+ type,
+ };
+
+ case 'thenable':
+ isPathAllowedCheck = isPathAllowed(path);
+
+ if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
+ cleaned.push(path);
+ return {
+ inspectable:
+ data.status === 'fulfilled' || data.status === 'rejected',
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data.toString(),
+ type,
+ };
+ }
+
+ if (
+ data.status === 'resolved_model' ||
+ data.status === 'resolve_module'
+ ) {
+ // This looks it's a lazy initialization pattern such in Flight.
+ // Since we're about to inspect it. Let's eagerly initialize it.
+ data.then(noop);
+ }
+
+ switch (data.status) {
+ case 'fulfilled': {
+ const unserializableValue: Unserializable = {
+ unserializable: true,
+ type: type,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: 'fulfilled Thenable',
+ };
+
+ unserializableValue.value = dehydrate(
+ data.value,
+ cleaned,
+ unserializable,
+ path.concat(['value']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+
+ unserializable.push(path);
+
+ return unserializableValue;
+ }
+ case 'rejected': {
+ const unserializableValue: Unserializable = {
+ unserializable: true,
+ type: type,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: 'rejected Thenable',
+ };
+
+ unserializableValue.reason = dehydrate(
+ data.reason,
+ cleaned,
+ unserializable,
+ path.concat(['reason']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+
+ unserializable.push(path);
+
+ return unserializableValue;
+ }
+ default:
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data.toString(),
+ type,
+ };
+ }
+
+ case 'object':
+ isPathAllowedCheck = isPathAllowed(path);
+
+ if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
+ return createDehydrated(type, true, data, cleaned, path);
+ } else {
+ const object: {
+ [string]: DehydratedData['data'],
+ } = {};
+ getAllEnumerableKeys(data).forEach(key => {
+ const name = key.toString();
+ object[name] = dehydrateKey(
+ data,
+ key,
+ cleaned,
+ unserializable,
+ path.concat([name]),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ });
+ return object;
+ }
+
+ case 'class_instance': {
+ isPathAllowedCheck = isPathAllowed(path);
+
+ if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
+ return createDehydrated(type, true, data, cleaned, path);
+ }
+
+ const value: Unserializable = {
+ unserializable: true,
+ type,
+ readonly: true,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name:
+ typeof data.constructor !== 'function' ||
+ typeof data.constructor.name !== 'string'
+ ? ''
+ : data.constructor.name,
+ };
+
+ getAllEnumerableKeys(data).forEach(key => {
+ const keyAsString = key.toString();
+
+ value[keyAsString] = dehydrate(
+ data[key],
+ cleaned,
+ unserializable,
+ path.concat([keyAsString]),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ });
+
+ unserializable.push(path);
+
+ return value;
+ }
+ case 'error': {
+ isPathAllowedCheck = isPathAllowed(path);
+
+ if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) {
+ return createDehydrated(type, true, data, cleaned, path);
+ }
+
+ const value: Unserializable = {
+ unserializable: true,
+ type,
+ readonly: true,
+ preview_short: formatDataForPreview(data, false),
+ preview_long: formatDataForPreview(data, true),
+ name: data.name,
+ };
+
+ // name, message, stack and cause are not enumerable yet still interesting.
+ value.message = dehydrate(
+ data.message,
+ cleaned,
+ unserializable,
+ path.concat(['message']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ value.stack = dehydrate(
+ data.stack,
+ cleaned,
+ unserializable,
+ path.concat(['stack']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+
+ if ('cause' in data) {
+ value.cause = dehydrate(
+ data.cause,
+ cleaned,
+ unserializable,
+ path.concat(['cause']),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ }
+
+ getAllEnumerableKeys(data).forEach(key => {
+ const keyAsString = key.toString();
+
+ value[keyAsString] = dehydrate(
+ data[key],
+ cleaned,
+ unserializable,
+ path.concat([keyAsString]),
+ isPathAllowed,
+ isPathAllowedCheck ? 1 : level + 1,
+ );
+ });
+
+ unserializable.push(path);
+
+ return value;
+ }
+ case 'infinity':
+ case '-infinity':
+ case 'nan':
+ case 'undefined':
+ // Some values are lossy when sent through a WebSocket.
+ // We dehydrate+rehydrate them to preserve their type.
+ cleaned.push(path);
+ return {type};
+
+ default:
+ return data;
+ }
+}
+
+function dehydrateKey(
+ parent: Object,
+ key: number | string | symbol,
+ cleaned: Array>,
+ unserializable: Array>,
+ path: Array,
+ isPathAllowed: (path: Array) => boolean,
+ level: number = 0,
+): DehydratedData['data'] {
+ try {
+ return dehydrate(
+ parent[key],
+ cleaned,
+ unserializable,
+ path,
+ isPathAllowed,
+ level,
+ );
+ } catch (error) {
+ let preview = '';
+ if (
+ typeof error === 'object' &&
+ error !== null &&
+ typeof error.stack === 'string'
+ ) {
+ preview = error.stack;
+ } else if (typeof error === 'string') {
+ preview = error;
+ }
+ cleaned.push(path);
+ return {
+ inspectable: false,
+ preview_short: '[Exception]',
+ preview_long: preview ? '[Exception: ' + preview + ']' : '[Exception]',
+ name: preview,
+ type: 'unknown',
+ };
+ }
+}
+
+export function fillInPath(
+ object: Object,
+ data: DehydratedData,
+ path: InspectedElementPath,
+ value: any,
+) {
+ const target = getInObject(object, path);
+ if (target != null) {
+ if (!target[meta.unserializable]) {
+ delete target[meta.inspectable];
+ delete target[meta.inspected];
+ delete target[meta.name];
+ delete target[meta.preview_long];
+ delete target[meta.preview_short];
+ delete target[meta.readonly];
+ delete target[meta.size];
+ delete target[meta.type];
+ }
+ }
+
+ if (value !== null && data.unserializable.length > 0) {
+ const unserializablePath = data.unserializable[0];
+ let isMatch = unserializablePath.length === path.length;
+ for (let i = 0; i < path.length; i++) {
+ if (path[i] !== unserializablePath[i]) {
+ isMatch = false;
+ break;
+ }
+ }
+ if (isMatch) {
+ upgradeUnserializable(value, value);
+ }
+ }
+
+ setInObject(object, path, value);
+}
+
+export function hydrate(
+ object: any,
+ cleaned: Array>,
+ unserializable: Array>,
+): Object {
+ cleaned.forEach((path: Array) => {
+ const length = path.length;
+ const last = path[length - 1];
+ const parent = getInObject(object, path.slice(0, length - 1));
+ if (!parent || !parent.hasOwnProperty(last)) {
+ return;
+ }
+
+ const value = parent[last];
+
+ if (!value) {
+ return;
+ } else if (value.type === 'infinity') {
+ parent[last] = Infinity;
+ } else if (value.type === '-infinity') {
+ parent[last] = -Infinity;
+ } else if (value.type === 'nan') {
+ parent[last] = NaN;
+ } else if (value.type === 'undefined') {
+ parent[last] = undefined;
+ } else {
+ // Replace the string keys with Symbols so they're non-enumerable.
+ const replaced: {[key: symbol]: boolean | string} = {};
+ replaced[meta.inspectable] = !!value.inspectable;
+ replaced[meta.inspected] = false;
+ replaced[meta.name] = value.name;
+ replaced[meta.preview_long] = value.preview_long;
+ replaced[meta.preview_short] = value.preview_short;
+ replaced[meta.size] = value.size;
+ replaced[meta.readonly] = !!value.readonly;
+ replaced[meta.type] = value.type;
+
+ parent[last] = replaced;
+ }
+ });
+ unserializable.forEach((path: Array) => {
+ const length = path.length;
+ const last = path[length - 1];
+ const parent = getInObject(object, path.slice(0, length - 1));
+ if (!parent || !parent.hasOwnProperty(last)) {
+ return;
+ }
+
+ const node = parent[last];
+
+ const replacement = {
+ ...node,
+ };
+
+ upgradeUnserializable(replacement, node);
+
+ parent[last] = replacement;
+ });
+ return object;
+}
+
+function upgradeUnserializable(destination: Object, source: Object) {
+ Object.defineProperties(destination, {
+ // $FlowFixMe[invalid-computed-prop]
+ [meta.inspected]: {
+ configurable: true,
+ enumerable: false,
+ value: !!source.inspected,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [meta.name]: {
+ configurable: true,
+ enumerable: false,
+ value: source.name,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [meta.preview_long]: {
+ configurable: true,
+ enumerable: false,
+ value: source.preview_long,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [meta.preview_short]: {
+ configurable: true,
+ enumerable: false,
+ value: source.preview_short,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [meta.size]: {
+ configurable: true,
+ enumerable: false,
+ value: source.size,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [meta.readonly]: {
+ configurable: true,
+ enumerable: false,
+ value: !!source.readonly,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [meta.type]: {
+ configurable: true,
+ enumerable: false,
+ value: source.type,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [meta.unserializable]: {
+ configurable: true,
+ enumerable: false,
+ value: !!source.unserializable,
+ },
+ });
+
+ delete destination.inspected;
+ delete destination.name;
+ delete destination.preview_long;
+ delete destination.preview_short;
+ delete destination.size;
+ delete destination.readonly;
+ delete destination.type;
+ delete destination.unserializable;
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/inspectedElementCache.js b/github_code/react__react/packages/react-devtools-shared/src/inspectedElementCache.js
new file mode 100644
index 0000000000000000000000000000000000000000..686f922231aea5a050069376f5167e8807cc26dd
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/inspectedElementCache.js
@@ -0,0 +1,294 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+import {
+ unstable_getCacheForType as getCacheForType,
+ startTransition,
+} from 'react';
+import Store from 'react-devtools-shared/src/devtools/store';
+import {inspectElement as inspectElementMutableSource} from 'react-devtools-shared/src/inspectedElementMutableSource';
+import ElementPollingCancellationError from 'react-devtools-shared/src//errors/ElementPollingCancellationError';
+
+import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
+import type {
+ Thenable,
+ FulfilledThenable,
+ RejectedThenable,
+} from 'shared/ReactTypes';
+import type {
+ Element,
+ InspectedElement as InspectedElementFrontend,
+ InspectedElementResponseType,
+ InspectedElementPath,
+} from 'react-devtools-shared/src/frontend/types';
+
+function readRecord(record: Thenable): T {
+ if (typeof React.use === 'function') {
+ // eslint-disable-next-line react-hooks-published/rules-of-hooks
+ return React.use(record);
+ }
+ if (record.status === 'fulfilled') {
+ return record.value;
+ } else if (record.status === 'rejected') {
+ throw record.reason;
+ } else {
+ throw record;
+ }
+}
+
+type InspectedElementMap = WeakMap>;
+type CacheSeedKey = () => InspectedElementMap;
+
+function createMap(): InspectedElementMap {
+ return new WeakMap();
+}
+
+function getRecordMap(): WeakMap> {
+ return getCacheForType(createMap);
+}
+
+function createCacheSeed(
+ element: Element,
+ inspectedElement: InspectedElementFrontend,
+): [CacheSeedKey, InspectedElementMap] {
+ const thenable: FulfilledThenable = {
+ then(callback: (value: any) => mixed, reject: (error: mixed) => mixed) {
+ callback(thenable.value);
+ },
+ status: 'fulfilled',
+ value: inspectedElement,
+ };
+ const map = createMap();
+ map.set(element, thenable);
+ return [createMap, map];
+}
+
+/**
+ * Fetches element props and state from the backend for inspection.
+ * This method should be called during render; it will suspend if data has not yet been fetched.
+ */
+export function inspectElement(
+ element: Element,
+ path: InspectedElementPath | null,
+ store: Store,
+ bridge: FrontendBridge,
+): InspectedElementFrontend | null {
+ const map = getRecordMap();
+ let record = map.get(element);
+ if (!record) {
+ const callbacks = new Set<(value: any) => mixed>();
+ const rejectCallbacks = new Set<(reason: mixed) => mixed>();
+ const thenable: Thenable = {
+ status: 'pending',
+ value: null,
+ reason: null,
+ then(callback: (value: any) => mixed, reject: (error: mixed) => mixed) {
+ callbacks.add(callback);
+ rejectCallbacks.add(reject);
+ },
+
+ // Optional property, read by React to name this I/O in async debug info:
+ displayName: `Inspecting ${element.displayName || 'Unknown'}`,
+ };
+
+ const wake = () => {
+ // This assumes they won't throw.
+ callbacks.forEach(callback => callback((thenable as any).value));
+ callbacks.clear();
+ rejectCallbacks.clear();
+ };
+ const wakeRejections = () => {
+ // This assumes they won't throw.
+ rejectCallbacks.forEach(callback => callback((thenable as any).reason));
+ rejectCallbacks.clear();
+ callbacks.clear();
+ };
+ record = thenable;
+
+ const rendererID = store.getRendererIDForElement(element.id);
+ if (rendererID == null) {
+ const rejectedThenable: RejectedThenable =
+ thenable as any;
+ rejectedThenable.status = 'rejected';
+ rejectedThenable.reason = new Error(
+ `Could not inspect element with id "${element.id}". No renderer found.`,
+ );
+
+ map.set(element, record);
+
+ return null;
+ }
+
+ inspectElementMutableSource(bridge, element, path, rendererID).then(
+ ([inspectedElement]: [
+ InspectedElementFrontend,
+ InspectedElementResponseType,
+ ]) => {
+ const fulfilledThenable: FulfilledThenable =
+ thenable as any;
+ fulfilledThenable.status = 'fulfilled';
+ fulfilledThenable.value = inspectedElement;
+ wake();
+ },
+
+ error => {
+ console.error(error);
+
+ const rejectedThenable: RejectedThenable =
+ thenable as any;
+ rejectedThenable.status = 'rejected';
+ rejectedThenable.reason = error;
+
+ wakeRejections();
+ },
+ );
+
+ map.set(element, record);
+ }
+
+ const response = readRecord(record);
+ return response;
+}
+
+type RefreshFunction = (
+ seedKey: CacheSeedKey,
+ cacheMap: InspectedElementMap,
+) => void;
+
+/**
+ * Asks the backend for updated props and state from an expected element.
+ * This method should never be called during render; call it from an effect or event handler.
+ * This method will schedule an update if updated information is returned.
+ */
+export function checkForUpdate({
+ bridge,
+ element,
+ refresh,
+ store,
+}: {
+ bridge: FrontendBridge,
+ element: Element,
+ refresh: RefreshFunction,
+ store: Store,
+}): void | Promise {
+ const {id} = element;
+ const rendererID = store.getRendererIDForElement(id);
+
+ if (rendererID == null) {
+ return;
+ }
+
+ return inspectElementMutableSource(
+ bridge,
+ element,
+ null,
+ rendererID,
+ true,
+ ).then(
+ ([inspectedElement, responseType]: [
+ InspectedElementFrontend,
+ InspectedElementResponseType,
+ ]) => {
+ if (responseType === 'full-data') {
+ startTransition(() => {
+ const [key, value] = createCacheSeed(element, inspectedElement);
+ refresh(key, value);
+ });
+ }
+ },
+ );
+}
+
+function createPromiseWhichResolvesInOneSecond() {
+ return new Promise(resolve => setTimeout(resolve, 1000));
+}
+
+type PollingStatus = 'idle' | 'running' | 'paused' | 'aborted';
+
+export function startElementUpdatesPolling({
+ bridge,
+ element,
+ refresh,
+ store,
+}: {
+ bridge: FrontendBridge,
+ element: Element,
+ refresh: RefreshFunction,
+ store: Store,
+}): {abort: () => void, pause: () => void, resume: () => void} {
+ let status: PollingStatus = 'idle';
+
+ function abort() {
+ status = 'aborted';
+ }
+
+ function resume() {
+ if (status === 'running' || status === 'aborted') {
+ return;
+ }
+
+ status = 'idle';
+ poll();
+ }
+
+ function pause() {
+ if (status === 'paused' || status === 'aborted') {
+ return;
+ }
+
+ status = 'paused';
+ }
+
+ function poll(): Promise {
+ status = 'running';
+
+ return Promise.allSettled([
+ checkForUpdate({bridge, element, refresh, store}),
+ createPromiseWhichResolvesInOneSecond(),
+ ])
+ .then(([{status: updateStatus, reason}]) => {
+ // There isn't much to do about errors in this case,
+ // but we should at least log them, so they aren't silent.
+ // Log only if polling is still active, we can't handle the case when
+ // request was sent, and then bridge was remounted (for example, when user did navigate to a new page),
+ // but at least we can mark that polling was aborted
+ if (updateStatus === 'rejected' && status !== 'aborted') {
+ // This is expected Promise rejection, no need to log it
+ if (reason instanceof ElementPollingCancellationError) {
+ return;
+ }
+
+ console.error(reason);
+ }
+ })
+ .finally(() => {
+ const shouldContinuePolling =
+ status !== 'aborted' && status !== 'paused';
+
+ status = 'idle';
+
+ if (shouldContinuePolling) {
+ return poll();
+ }
+ });
+ }
+
+ poll();
+
+ return {abort, resume, pause};
+}
+
+export function clearCacheBecauseOfError(refresh: RefreshFunction): void {
+ startTransition(() => {
+ const map = createMap();
+ refresh(createMap, map);
+ });
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/inspectedElementMutableSource.js b/github_code/react__react/packages/react-devtools-shared/src/inspectedElementMutableSource.js
new file mode 100644
index 0000000000000000000000000000000000000000..51612a1bb96142812172c903369e25a009a75b20
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/inspectedElementMutableSource.js
@@ -0,0 +1,183 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import LRU from 'lru-cache';
+import {
+ convertInspectedElementBackendToFrontend,
+ hydrateHelper,
+ inspectElement as inspectElementAPI,
+ inspectScreen as inspectScreenAPI,
+} from 'react-devtools-shared/src/backendAPI';
+import {fillInPath} from 'react-devtools-shared/src/hydration';
+
+import type {LRUCache} from 'react-devtools-shared/src/frontend/types';
+import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
+import type {
+ InspectElementError,
+ InspectElementFullData,
+ InspectElementHydratedPath,
+} from 'react-devtools-shared/src/backend/types';
+import UserError from 'react-devtools-shared/src/errors/UserError';
+import UnknownHookError from 'react-devtools-shared/src/errors/UnknownHookError';
+import type {
+ Element,
+ InspectedElement as InspectedElementFrontend,
+ InspectedElementResponseType,
+ InspectedElementPath,
+} from 'react-devtools-shared/src/frontend/types';
+
+// Maps element ID to inspected data.
+// We use an LRU for this rather than a WeakMap because of how the "no-change" optimization works.
+// When the frontend polls the backend for an update on the element that's currently inspected,
+// the backend will send a "no-change" message if the element hasn't updated (rendered) since the last time it was asked.
+// In this case, the frontend cache should reuse the previous (cached) value.
+// Using a WeakMap keyed on Element generally works well for this, since Elements are mutable and stable in the Store.
+// This doens't work properly though when component filters are changed,
+// because this will cause the Store to dump all roots and re-initialize the tree (recreating the Element objects).
+// So instead we key on Element ID (which is stable in this case) and use an LRU for eviction.
+const inspectedElementCache: LRUCache =
+ new LRU({
+ max: 25,
+ });
+
+type InspectElementReturnType = [
+ InspectedElementFrontend,
+ InspectedElementResponseType,
+];
+
+export function inspectElement(
+ bridge: FrontendBridge,
+ element: Element,
+ path: InspectedElementPath | null,
+ rendererID: number,
+ shouldListenToPauseEvents: boolean = false,
+): Promise {
+ const {id, parentID} = element;
+
+ // This could indicate that the DevTools UI has been closed and reopened.
+ // The in-memory cache will be clear but the backend still thinks we have cached data.
+ // In this case, we need to tell it to resend the full data.
+ const forceFullData = !inspectedElementCache.has(id);
+ const isRoot = parentID === 0;
+ const promisedElement = isRoot
+ ? inspectScreenAPI(
+ bridge,
+ forceFullData,
+ id,
+ path,
+ shouldListenToPauseEvents,
+ )
+ : inspectElementAPI(
+ bridge,
+ forceFullData,
+ id,
+ path,
+ rendererID,
+ shouldListenToPauseEvents,
+ );
+
+ return promisedElement.then((data: any) => {
+ const {type} = data;
+
+ let inspectedElement;
+ switch (type) {
+ case 'error': {
+ const {message, stack, errorType} = data as any as InspectElementError;
+
+ // create a different error class for each error type
+ // and keep useful information from backend.
+ let error;
+ if (errorType === 'user') {
+ error = new UserError(message);
+ } else if (errorType === 'unknown-hook') {
+ error = new UnknownHookError(message);
+ } else {
+ error = new Error(message);
+ }
+ // The backend's stack (where the error originated) is more meaningful than this stack.
+ error.stack = stack || error.stack;
+
+ throw error;
+ }
+
+ case 'no-change':
+ // This is a no-op for the purposes of our cache.
+ inspectedElement = inspectedElementCache.get(id);
+ if (inspectedElement != null) {
+ return [inspectedElement, type];
+ }
+
+ // We should only encounter this case in the event of a bug.
+ throw Error(`Cached data for element "${id}" not found`);
+
+ case 'not-found':
+ // This is effectively a no-op.
+ // If the Element is still in the Store, we can eagerly remove it from the Map.
+ inspectedElementCache.del(id);
+
+ throw Error(`Element "${id}" not found`);
+
+ case 'full-data':
+ const fullData = data as any as InspectElementFullData;
+
+ // New data has come in.
+ // We should replace the data in our local mutable copy.
+ inspectedElement = convertInspectedElementBackendToFrontend(
+ fullData.value,
+ );
+
+ inspectedElementCache.set(id, inspectedElement);
+
+ return [inspectedElement, type];
+
+ case 'hydrated-path':
+ const hydratedPathData = data as any as InspectElementHydratedPath;
+ const {value} = hydratedPathData;
+
+ // A path has been hydrated.
+ // Merge it with the latest copy we have locally and resolve with the merged value.
+ inspectedElement = inspectedElementCache.get(id) || null;
+ // $FlowFixMe[invalid-compare]
+ if (inspectedElement !== null) {
+ // Clone element
+ inspectedElement = {...inspectedElement};
+
+ // Merge hydrated data
+ if (path != null) {
+ fillInPath(
+ inspectedElement,
+ value,
+ path,
+ hydrateHelper(value, path),
+ );
+ }
+
+ inspectedElementCache.set(id, inspectedElement);
+
+ return [inspectedElement, type];
+ }
+ break;
+
+ default:
+ // Should never happen.
+ if (__DEV__) {
+ console.error(
+ `Unexpected inspected element response data: "${type}"`,
+ );
+ }
+ break;
+ }
+
+ throw Error(`Unable to inspect element with id "${id}"`);
+ });
+}
+
+export function clearCacheForTests(): void {
+ inspectedElementCache.reset();
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/isArray.js b/github_code/react__react/packages/react-devtools-shared/src/isArray.js
new file mode 100644
index 0000000000000000000000000000000000000000..4e5382ac3d93d7f1d4646e1e4684832eca02794d
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/isArray.js
@@ -0,0 +1,12 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+const isArray = Array.isArray;
+
+export default isArray;
diff --git a/github_code/react__react/packages/react-devtools-shared/src/registerDevToolsEventLogger.js b/github_code/react__react/packages/react-devtools-shared/src/registerDevToolsEventLogger.js
new file mode 100644
index 0000000000000000000000000000000000000000..bfc0857abb4488d205878ea55e0d0ed3091c90ad
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/registerDevToolsEventLogger.js
@@ -0,0 +1,90 @@
+/**
+ * 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.
+ *
+ * @flow strict-local
+ */
+
+import type {LoggerEvent} from 'react-devtools-shared/src/Logger';
+
+import {registerEventLogger} from 'react-devtools-shared/src/Logger';
+import {enableLogger} from 'react-devtools-feature-flags';
+
+let currentLoggingIFrame = null;
+let currentSessionId = null;
+let missedEvents: Array = [];
+let hasRegisteredEventLogger = false;
+
+type LoggerContext = {
+ page_url: ?string,
+};
+
+export function registerDevToolsEventLogger(
+ surface: string,
+ fetchAdditionalContext?:
+ | (() => LoggerContext)
+ | (() => Promise),
+): void {
+ async function logEvent(event: LoggerEvent) {
+ if (enableLogger) {
+ if (currentLoggingIFrame != null && currentSessionId != null) {
+ const {metadata, ...eventWithoutMetadata} = event;
+ const additionalContext: LoggerContext | {} =
+ fetchAdditionalContext != null ? await fetchAdditionalContext() : {};
+
+ currentLoggingIFrame?.contentWindow?.postMessage(
+ {
+ source: 'react-devtools-logging',
+ event: eventWithoutMetadata,
+ context: {
+ ...additionalContext,
+ metadata: metadata != null ? JSON.stringify(metadata) : '',
+ session_id: currentSessionId,
+ surface,
+ version: process.env.DEVTOOLS_VERSION,
+ },
+ },
+ '*',
+ );
+ } else {
+ missedEvents.push(event);
+ }
+ }
+ }
+
+ function handleLoggingIFrameLoaded(iframe: HTMLIFrameElement) {
+ currentLoggingIFrame = iframe;
+
+ if (missedEvents.length > 0) {
+ missedEvents.forEach(event => logEvent(event));
+ missedEvents = [];
+ }
+ }
+
+ // If logger is enabled, register a logger that captures logged events
+ // and render iframe where the logged events will be reported to
+ if (enableLogger) {
+ const loggingUrl = process.env.LOGGING_URL;
+ const body = document.body;
+
+ if (
+ typeof loggingUrl === 'string' &&
+ loggingUrl.length > 0 &&
+ body != null &&
+ !hasRegisteredEventLogger
+ ) {
+ hasRegisteredEventLogger = true;
+ registerEventLogger(logEvent);
+ currentSessionId = window.crypto.randomUUID();
+
+ const iframe = document.createElement('iframe');
+
+ iframe.onload = () => handleLoggingIFrameLoaded(iframe);
+ iframe.src = loggingUrl;
+
+ body.appendChild(iframe);
+ }
+ }
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/storage.js b/github_code/react__react/packages/react-devtools-shared/src/storage.js
new file mode 100644
index 0000000000000000000000000000000000000000..63dd5aee3a912671d080e146b00a328b809ea583
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/storage.js
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+export function localStorageGetItem(key: string): any {
+ try {
+ return localStorage.getItem(key);
+ } catch (error) {
+ return null;
+ }
+}
+
+export function localStorageRemoveItem(key: string): void {
+ try {
+ localStorage.removeItem(key);
+ } catch (error) {}
+}
+
+export function localStorageSetItem(key: string, value: any): void {
+ try {
+ return localStorage.setItem(key, value);
+ } catch (error) {}
+}
+
+export function sessionStorageGetItem(key: string): any {
+ try {
+ return sessionStorage.getItem(key);
+ } catch (error) {
+ return null;
+ }
+}
+
+export function sessionStorageRemoveItem(key: string): void {
+ try {
+ sessionStorage.removeItem(key);
+ } catch (error) {}
+}
+
+export function sessionStorageSetItem(key: string, value: any): void {
+ try {
+ return sessionStorage.setItem(key, value);
+ } catch (error) {}
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/symbolicateSource.js b/github_code/react__react/packages/react-devtools-shared/src/symbolicateSource.js
new file mode 100644
index 0000000000000000000000000000000000000000..ebcf161dc963a7397e8dfcf4cffb387957e38050
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/symbolicateSource.js
@@ -0,0 +1,160 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import SourceMapConsumer from 'react-devtools-shared/src/hooks/SourceMapConsumer';
+
+import type {ReactFunctionLocation} from 'shared/ReactTypes';
+import type {FetchFileWithCaching} from 'react-devtools-shared/src/devtools/views/Components/FetchFileWithCachingContext';
+
+const symbolicationCache: Map<
+ string,
+ Promise,
+> = new Map();
+
+export type SourceMappedLocation = {
+ location: ReactFunctionLocation,
+ ignored: boolean, // Whether the file for this location was ignore listed
+};
+
+export function symbolicateSourceWithCache(
+ fetchFileWithCaching: FetchFileWithCaching,
+ sourceURL: string,
+ line: number, // 1-based
+ column: number, // 1-based
+): Promise {
+ const key = `${sourceURL}:${line}:${column}`;
+ const cachedPromise = symbolicationCache.get(key);
+ if (cachedPromise != null) {
+ return cachedPromise;
+ }
+
+ const promise = symbolicateSource(
+ fetchFileWithCaching,
+ sourceURL,
+ line,
+ column,
+ );
+ symbolicationCache.set(key, promise);
+
+ return promise;
+}
+
+const SOURCE_MAP_ANNOTATION_PREFIX = 'sourceMappingURL=';
+export async function symbolicateSource(
+ fetchFileWithCaching: FetchFileWithCaching,
+ sourceURL: string,
+ lineNumber: number, // 1-based
+ columnNumber: number, // 1-based
+): Promise {
+ if (!sourceURL || sourceURL.startsWith(' null);
+ if (resource == null) {
+ return null;
+ }
+
+ const resourceLines = resource.split(/[\r\n]+/);
+ for (let i = resourceLines.length - 1; i >= 0; --i) {
+ const resourceLine = resourceLines[i];
+
+ // In case there is empty last line
+ if (!resourceLine) continue;
+ // Not an annotation? Stop looking for a source mapping url.
+ if (!resourceLine.startsWith('//#')) break;
+
+ if (resourceLine.includes(SOURCE_MAP_ANNOTATION_PREFIX)) {
+ const sourceMapAnnotationStartIndex = resourceLine.indexOf(
+ SOURCE_MAP_ANNOTATION_PREFIX,
+ );
+ const sourceMapAt = resourceLine.slice(
+ sourceMapAnnotationStartIndex + SOURCE_MAP_ANNOTATION_PREFIX.length,
+ resourceLine.length,
+ );
+
+ // Compute the absolute source map URL. If the base URL is invalid, gracefully bail.
+ let sourceMapURL;
+ try {
+ sourceMapURL = new URL(sourceMapAt, sourceURL).toString();
+ } catch (e) {
+ // Fallback: try if sourceMapAt is already an absolute URL; otherwise give up.
+ try {
+ sourceMapURL = new URL(sourceMapAt).toString();
+ } catch (_e) {
+ return null;
+ }
+ }
+ const sourceMap = await fetchFileWithCaching(sourceMapURL).catch(
+ () => null,
+ );
+ if (sourceMap != null) {
+ try {
+ const parsedSourceMap = JSON.parse(sourceMap);
+ const consumer = SourceMapConsumer(parsedSourceMap);
+ const functionName = ''; // TODO: Parse function name from sourceContent.
+ const {
+ sourceURL: possiblyURL,
+ line,
+ column: columnZeroBased,
+ ignored,
+ } = consumer.originalPositionFor({
+ lineNumber, // 1-based
+ columnNumber, // 1-based
+ });
+
+ const column = columnZeroBased + 1;
+
+ if (possiblyURL === null) {
+ return null;
+ }
+ try {
+ // sourceMapURL = https://react.dev/script.js.map
+ void new URL(possiblyURL); // test if it is a valid URL
+
+ return {
+ location: [functionName, possiblyURL, line, column],
+ ignored,
+ };
+ } catch (e) {
+ // This is not valid URL
+ if (
+ // sourceMapURL = /file
+ possiblyURL.startsWith('/') ||
+ // sourceMapURL = C:\\...
+ possiblyURL.slice(1).startsWith(':\\\\')
+ ) {
+ // This is an absolute path
+ return {
+ location: [functionName, possiblyURL, line, column],
+ ignored,
+ };
+ }
+
+ // This is a relative path
+ // possiblyURL = x.js.map, sourceMapURL = https://react.dev/script.js.map
+ const absoluteSourcePath = new URL(
+ possiblyURL,
+ sourceMapURL,
+ ).toString();
+ return {
+ location: [functionName, absoluteSourcePath, line, column],
+ ignored,
+ };
+ }
+ } catch (e) {
+ return null;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shared/src/utils.js b/github_code/react__react/packages/react-devtools-shared/src/utils.js
new file mode 100644
index 0000000000000000000000000000000000000000..c4f6c083a62cee03f30f424f13e21c78900b67cf
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shared/src/utils.js
@@ -0,0 +1,1326 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import LRU from 'lru-cache';
+import {
+ REACT_CONSUMER_TYPE,
+ REACT_CONTEXT_TYPE,
+ REACT_FORWARD_REF_TYPE,
+ REACT_FRAGMENT_TYPE,
+ REACT_LAZY_TYPE,
+ REACT_ELEMENT_TYPE,
+ REACT_LEGACY_ELEMENT_TYPE,
+ REACT_MEMO_TYPE,
+ REACT_PORTAL_TYPE,
+ REACT_PROFILER_TYPE,
+ REACT_STRICT_MODE_TYPE,
+ REACT_SUSPENSE_LIST_TYPE,
+ REACT_SUSPENSE_TYPE,
+ REACT_TRACING_MARKER_TYPE,
+ REACT_VIEW_TRANSITION_TYPE,
+} from 'shared/ReactSymbols';
+import {
+ TREE_OPERATION_ADD,
+ TREE_OPERATION_REMOVE,
+ TREE_OPERATION_REORDER_CHILDREN,
+ TREE_OPERATION_SET_SUBTREE_MODE,
+ TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS,
+ TREE_OPERATION_UPDATE_TREE_BASE_DURATION,
+ TREE_OPERATION_APPLIED_ACTIVITY_SLICE_CHANGE,
+ LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY,
+ LOCAL_STORAGE_OPEN_IN_EDITOR_URL,
+ LOCAL_STORAGE_OPEN_IN_EDITOR_URL_PRESET,
+ LOCAL_STORAGE_ALWAYS_OPEN_IN_EDITOR,
+ SESSION_STORAGE_RELOAD_AND_PROFILE_KEY,
+ SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY,
+ SUSPENSE_TREE_OPERATION_ADD,
+ SUSPENSE_TREE_OPERATION_REMOVE,
+ SUSPENSE_TREE_OPERATION_REORDER_CHILDREN,
+ SUSPENSE_TREE_OPERATION_RESIZE,
+ SUSPENSE_TREE_OPERATION_SUSPENDERS,
+} from './constants';
+import {
+ ComponentFilterActivitySlice,
+ ComponentFilterElementType,
+ ComponentFilterLocation,
+ ElementTypeHostComponent,
+} from './frontend/types';
+import {
+ ElementTypeRoot,
+ ElementTypeClass,
+ ElementTypeForwardRef,
+ ElementTypeFunction,
+ ElementTypeMemo,
+ ElementTypeVirtual,
+} from 'react-devtools-shared/src/frontend/types';
+import {
+ localStorageGetItem,
+ localStorageSetItem,
+ sessionStorageGetItem,
+ sessionStorageRemoveItem,
+ sessionStorageSetItem,
+} from 'react-devtools-shared/src/storage';
+import {meta} from './hydration';
+import isArray from './isArray';
+
+import type {
+ ComponentFilter,
+ ElementType,
+ SerializedElement as SerializedElementFrontend,
+ LRUCache,
+} from 'react-devtools-shared/src/frontend/types';
+import type {
+ ProfilingSettings,
+ SerializedElement as SerializedElementBackend,
+} from 'react-devtools-shared/src/backend/types';
+import {isSynchronousXHRSupported} from './backend/utils';
+
+// $FlowFixMe[method-unbinding]
+const hasOwnProperty = Object.prototype.hasOwnProperty;
+
+const cachedDisplayNames: WeakMap = new WeakMap();
+
+// On large trees, encoding takes significant time.
+// Try to reuse the already encoded strings.
+const encodedStringCache: LRUCache> = new LRU({
+ max: 1000,
+});
+
+// Previously, the type of `Context.Provider`.
+const LEGACY_REACT_PROVIDER_TYPE: symbol = Symbol.for('react.provider');
+
+export function alphaSortKeys(
+ a: string | number | symbol,
+ b: string | number | symbol,
+): number {
+ if (a.toString() > b.toString()) {
+ return 1;
+ } else if (b.toString() > a.toString()) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+export function getAllEnumerableKeys(
+ obj: Object,
+): Set {
+ const keys = new Set();
+ let current = obj;
+ while (current != null) {
+ const currentKeys = [
+ ...Object.keys(current),
+ ...Object.getOwnPropertySymbols(current),
+ ];
+ const descriptors = Object.getOwnPropertyDescriptors(current);
+ currentKeys.forEach(key => {
+ // $FlowFixMe[incompatible-type]: key can be a Symbol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor
+ if (descriptors[key].enumerable) {
+ keys.add(key);
+ }
+ });
+ current = Object.getPrototypeOf(current);
+ }
+ return keys;
+}
+
+// Mirror https://github.com/facebook/react/blob/7c21bf72ace77094fd1910cc350a548287ef8350/packages/shared/getComponentName.js#L27-L37
+export function getWrappedDisplayName(
+ outerType: mixed,
+ innerType: any,
+ wrapperName: string,
+ fallbackName?: string,
+): string {
+ const displayName = (outerType as any)?.displayName;
+ return (
+ displayName || `${wrapperName}(${getDisplayName(innerType, fallbackName)})`
+ );
+}
+
+export function getDisplayName(
+ type: Function,
+ 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.
+ // github.com/facebook/react-devtools/issues/803
+ 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;
+}
+
+let uidCounter: number = 0;
+
+export function getUID(): number {
+ return ++uidCounter;
+}
+
+export function utfDecodeStringWithRanges(
+ array: Array,
+ left: number,
+ right: number,
+): string {
+ let string = '';
+ for (let i = left; i <= right; i++) {
+ string += String.fromCodePoint(array[i]);
+ }
+ return string;
+}
+
+function surrogatePairToCodePoint(
+ charCode1: number,
+ charCode2: number,
+): number {
+ return ((charCode1 & 0x3ff) << 10) + (charCode2 & 0x3ff) + 0x10000;
+}
+
+// Credit for this encoding approach goes to Tim Down:
+// https://stackoverflow.com/questions/4877326/how-can-i-tell-if-a-string-contains-multibyte-characters-in-javascript
+export function utfEncodeString(string: string): Array {
+ const cached = encodedStringCache.get(string);
+ if (cached !== undefined) {
+ return cached;
+ }
+
+ 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;
+ }
+
+ encodedStringCache.set(string, encoded);
+
+ return encoded;
+}
+
+export function printOperationsArray(operations: Array) {
+ // The first two values are always rendererID and rootID
+ const rendererID = operations[0];
+ const rootID = operations[1];
+
+ const logs = [`operations for renderer:${rendererID} and root:${rootID}`];
+
+ let i = 2;
+
+ // Reassemble the string table.
+ const stringTable: Array = [
+ null, // ID = 0 corresponds to the null string.
+ ];
+ const stringTableSize = operations[i++];
+ const stringTableEnd = i + stringTableSize;
+ while (i < stringTableEnd) {
+ const nextLength = operations[i++];
+ const nextString = utfDecodeStringWithRanges(
+ operations,
+ i,
+ i + nextLength - 1,
+ );
+ stringTable.push(nextString);
+ i += nextLength;
+ }
+
+ while (i < operations.length) {
+ const operation = operations[i];
+
+ switch (operation) {
+ case TREE_OPERATION_ADD: {
+ const id = operations[i + 1] as any as number;
+ const type = operations[i + 2] as any as ElementType;
+
+ i += 3;
+
+ if (type === ElementTypeRoot) {
+ logs.push(`Add new root node ${id}`);
+
+ i++; // isStrictModeCompliant
+ i++; // supportsProfiling
+ i++; // supportsStrictMode
+ i++; // hasOwnerMetadata
+ } else {
+ const parentID = operations[i] as any as number;
+ i++;
+
+ i++; // ownerID
+
+ const displayNameStringID = operations[i];
+ const displayName = stringTable[displayNameStringID];
+ i++;
+
+ i++; // key
+ i++; // name
+
+ logs.push(
+ `Add node ${id} (${displayName || 'null'}) as child of ${parentID}`,
+ );
+ }
+ break;
+ }
+ case TREE_OPERATION_REMOVE: {
+ const removeLength = operations[i + 1] as any as number;
+ i += 2;
+
+ for (let removeIndex = 0; removeIndex < removeLength; removeIndex++) {
+ const id = operations[i] as any as number;
+ i += 1;
+
+ logs.push(`Remove node ${id}`);
+ }
+ break;
+ }
+ case TREE_OPERATION_SET_SUBTREE_MODE: {
+ const id = operations[i + 1];
+ const mode = operations[i + 2];
+
+ i += 3;
+
+ logs.push(`Mode ${mode} set for subtree with root ${id}`);
+ break;
+ }
+ case TREE_OPERATION_REORDER_CHILDREN: {
+ const id = operations[i + 1] as any as number;
+ const numChildren = operations[i + 2] as any as number;
+ i += 3;
+ const children = operations.slice(i, i + numChildren);
+ i += numChildren;
+
+ logs.push(`Re-order node ${id} children ${children.join(',')}`);
+ break;
+ }
+ case TREE_OPERATION_UPDATE_TREE_BASE_DURATION:
+ // Base duration updates are only sent while profiling is in progress.
+ // We can ignore them at this point.
+ // The profiler UI uses them lazily in order to generate the tree.
+ i += 3;
+ break;
+ case TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS: {
+ const id = operations[i + 1];
+ const numErrors = operations[i + 2];
+ const numWarnings = operations[i + 3];
+
+ i += 4;
+
+ logs.push(
+ `Node ${id} has ${numErrors} errors and ${numWarnings} warnings`,
+ );
+ break;
+ }
+ case SUSPENSE_TREE_OPERATION_ADD: {
+ const fiberID = operations[i + 1];
+ const parentID = operations[i + 2];
+ const nameStringID = operations[i + 3];
+ const isSuspended = operations[i + 4];
+ const numRects = operations[i + 5];
+
+ i += 6;
+
+ const name = stringTable[nameStringID];
+ let rects: string;
+ if (numRects === -1) {
+ rects = 'null';
+ } else {
+ rects = '[';
+ for (let rectIndex = 0; rectIndex < numRects; rectIndex++) {
+ const offset = i + rectIndex * 4;
+ const x = operations[offset + 0];
+ const y = operations[offset + 1];
+ const width = operations[offset + 2];
+ const height = operations[offset + 3];
+
+ if (rectIndex > 0) {
+ rects += ', ';
+ }
+ rects += `(${x}, ${y}, ${width}, ${height})`;
+
+ i += 4;
+ }
+ rects += ']';
+ }
+
+ logs.push(
+ `Add suspense node ${fiberID} (${String(name)},rects={${rects}}) under ${parentID} suspended ${isSuspended}`,
+ );
+ break;
+ }
+ case SUSPENSE_TREE_OPERATION_REMOVE: {
+ const removeLength = operations[i + 1] as any as number;
+ i += 2;
+
+ for (let removeIndex = 0; removeIndex < removeLength; removeIndex++) {
+ const id = operations[i] as any as number;
+ i += 1;
+
+ logs.push(`Remove suspense node ${id}`);
+ }
+
+ break;
+ }
+ case SUSPENSE_TREE_OPERATION_REORDER_CHILDREN: {
+ const id = operations[i + 1] as any as number;
+ const numChildren = operations[i + 2] as any as number;
+ i += 3;
+ const children = operations.slice(i, i + numChildren);
+ i += numChildren;
+
+ logs.push(
+ `Re-order suspense node ${id} children ${children.join(',')}`,
+ );
+ break;
+ }
+ case SUSPENSE_TREE_OPERATION_RESIZE: {
+ const id = operations[i + 1] as any as number;
+ const numRects = operations[i + 2] as any as number;
+ i += 3;
+
+ if (numRects === -1) {
+ logs.push(`Resize suspense node ${id} to null`);
+ } else {
+ let line = `Resize suspense node ${id} to [`;
+ for (let rectIndex = 0; rectIndex < numRects; rectIndex++) {
+ const x = operations[i + 0];
+ const y = operations[i + 1];
+ const width = operations[i + 2];
+ const height = operations[i + 3];
+
+ if (rectIndex > 0) {
+ line += ', ';
+ }
+ line += `(${x}, ${y}, ${width}, ${height})`;
+
+ i += 4;
+ }
+ logs.push(line + ']');
+ }
+
+ break;
+ }
+ case SUSPENSE_TREE_OPERATION_SUSPENDERS: {
+ i++;
+ const changeLength = operations[i++] as any as number;
+
+ for (let changeIndex = 0; changeIndex < changeLength; changeIndex++) {
+ const id = operations[i++];
+ const hasUniqueSuspenders = operations[i++] === 1;
+ const endTime = operations[i++] / 1000;
+ const isSuspended = operations[i++] === 1;
+ const environmentNamesLength = operations[i++];
+ i += environmentNamesLength;
+ logs.push(
+ `Suspense node ${id} unique suspenders set to ${String(hasUniqueSuspenders)} ending at ${String(endTime)} is suspended set to ${String(isSuspended)} with ${String(environmentNamesLength)} environments`,
+ );
+ }
+
+ break;
+ }
+ case TREE_OPERATION_APPLIED_ACTIVITY_SLICE_CHANGE: {
+ i++;
+ const activitySliceIDChange = operations[i++];
+ logs.push(
+ activitySliceIDChange === 0
+ ? 'Reset applied activity slice'
+ : 'Applied activity slice change to ' + activitySliceIDChange,
+ );
+ break;
+ }
+ default:
+ throw Error(`Unsupported Bridge operation "${operation}"`);
+ }
+ }
+
+ console.log(logs.join('\n '));
+}
+
+export function getDefaultComponentFilters(): Array {
+ return [
+ {
+ type: ComponentFilterElementType,
+ value: ElementTypeHostComponent,
+ isEnabled: true,
+ },
+ ];
+}
+
+export function getSavedComponentFilters(): Array {
+ try {
+ const raw = localStorageGetItem(
+ LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY,
+ );
+ if (raw != null) {
+ const parsedFilters: Array = JSON.parse(raw);
+ return persistableComponentFilters(parsedFilters);
+ }
+ } catch (error) {}
+ return getDefaultComponentFilters();
+}
+
+export function setSavedComponentFilters(
+ componentFilters: Array,
+): void {
+ localStorageSetItem(
+ LOCAL_STORAGE_COMPONENT_FILTER_PREFERENCES_KEY,
+ JSON.stringify(persistableComponentFilters(componentFilters)),
+ );
+}
+
+export function persistableComponentFilters(
+ componentFilters: Array,
+): Array {
+ // This is just an additional check to preserve the previous state
+ // Filters can be stored on the backend side or in user land (in a window object)
+ if (!Array.isArray(componentFilters)) {
+ return componentFilters;
+ }
+
+ return componentFilters.filter(f => {
+ return (
+ // Following __debugSource removal from Fiber, the new approach for finding the source location
+ // of a component, represented by the Fiber, is based on lazily generating and parsing component stack frames
+ // To find the original location, React DevTools will perform symbolication, source maps are required for that.
+ // In order to start filtering Fibers, we need to find location for all of them, which can't be done lazily.
+ // Eager symbolication can become quite expensive for large applications.
+ f.type !== ComponentFilterLocation &&
+ // Activity slice filters are based on DevTools instance IDs which do not persist across sessions.
+ f.type !== ComponentFilterActivitySlice
+ );
+ });
+}
+
+const vscodeFilepath = 'vscode://file/{path}:{line}:{column}';
+
+export function getDefaultPreset(): 'custom' | 'vscode' {
+ return typeof process.env.EDITOR_URL === 'string' ? 'custom' : 'vscode';
+}
+
+export function getDefaultOpenInEditorURL(): string {
+ return typeof process.env.EDITOR_URL === 'string'
+ ? process.env.EDITOR_URL
+ : vscodeFilepath;
+}
+
+export function getOpenInEditorURL(): string {
+ try {
+ const rawPreset = localStorageGetItem(
+ LOCAL_STORAGE_OPEN_IN_EDITOR_URL_PRESET,
+ );
+ switch (rawPreset) {
+ case '"vscode"':
+ return vscodeFilepath;
+ }
+ const raw = localStorageGetItem(LOCAL_STORAGE_OPEN_IN_EDITOR_URL);
+ if (raw != null) {
+ return JSON.parse(raw);
+ }
+ } catch (error) {}
+ return getDefaultOpenInEditorURL();
+}
+
+export function getAlwaysOpenInEditor(): boolean {
+ try {
+ const raw = localStorageGetItem(LOCAL_STORAGE_ALWAYS_OPEN_IN_EDITOR);
+ return raw === 'true';
+ } catch (error) {}
+ return false;
+}
+
+type ParseElementDisplayNameFromBackendReturn = {
+ formattedDisplayName: string | null,
+ hocDisplayNames: Array | null,
+ compiledWithForget: boolean,
+};
+export function parseElementDisplayNameFromBackend(
+ displayName: string | null,
+ type: ElementType,
+): ParseElementDisplayNameFromBackendReturn {
+ if (displayName === null) {
+ return {
+ formattedDisplayName: null,
+ hocDisplayNames: null,
+ compiledWithForget: false,
+ };
+ }
+
+ if (displayName.startsWith('Forget(')) {
+ const displayNameWithoutForgetWrapper = displayName.slice(
+ 7,
+ displayName.length - 1,
+ );
+
+ const {formattedDisplayName, hocDisplayNames} =
+ parseElementDisplayNameFromBackend(displayNameWithoutForgetWrapper, type);
+ return {formattedDisplayName, hocDisplayNames, compiledWithForget: true};
+ }
+
+ let hocDisplayNames = null;
+ switch (type) {
+ case ElementTypeClass:
+ case ElementTypeForwardRef:
+ case ElementTypeFunction:
+ case ElementTypeMemo:
+ case ElementTypeVirtual:
+ if (displayName.indexOf('(') >= 0) {
+ const matches = displayName.match(/[^()]+/g);
+ if (matches != null) {
+ // $FlowFixMe[incompatible-type]
+ displayName = matches.pop();
+ hocDisplayNames = matches;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return {
+ // $FlowFixMe[incompatible-type]
+ formattedDisplayName: displayName,
+ hocDisplayNames,
+ compiledWithForget: false,
+ };
+}
+
+// Pulled from react-compat
+// https://github.com/developit/preact-compat/blob/7c5de00e7c85e2ffd011bf3af02899b63f699d3a/src/index.js#L349
+export function shallowDiffers(prev: Object, next: Object): boolean {
+ for (const attribute in prev) {
+ if (!(attribute in next)) {
+ return true;
+ }
+ }
+ for (const attribute in next) {
+ if (prev[attribute] !== next[attribute]) {
+ return true;
+ }
+ }
+ return false;
+}
+
+export function getInObject(object: Object, path: Array): any {
+ return path.reduce((reduced: Object, attr: any): any => {
+ if (reduced) {
+ if (hasOwnProperty.call(reduced, attr)) {
+ return reduced[attr];
+ }
+ if (typeof reduced[Symbol.iterator] === 'function') {
+ // Convert iterable to array and return array[index]
+ //
+ // TRICKY
+ // Don't use [...spread] syntax for this purpose.
+ // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values.
+ // Other types (e.g. typed arrays, Sets) will not spread correctly.
+ return Array.from(reduced)[attr];
+ }
+ }
+
+ return null;
+ }, object);
+}
+
+export function deletePathInObject(
+ object: Object,
+ path: Array,
+) {
+ const length = path.length;
+ const last = path[length - 1];
+ if (object != null) {
+ const parent = getInObject(object, path.slice(0, length - 1));
+ if (parent) {
+ if (isArray(parent)) {
+ parent.splice(last as any as number, 1);
+ } else {
+ delete parent[last];
+ }
+ }
+ }
+}
+
+export function renamePathInObject(
+ object: Object,
+ oldPath: Array,
+ newPath: Array,
+) {
+ const length = oldPath.length;
+ if (object != null) {
+ const parent = getInObject(object, oldPath.slice(0, length - 1));
+ if (parent) {
+ const lastOld = oldPath[length - 1];
+ const lastNew = newPath[length - 1];
+ parent[lastNew] = parent[lastOld];
+ if (isArray(parent)) {
+ parent.splice(lastOld as any as number, 1);
+ } else {
+ delete parent[lastOld];
+ }
+ }
+ }
+}
+
+export function setInObject(
+ object: Object,
+ path: Array,
+ value: any,
+) {
+ const length = path.length;
+ const last = path[length - 1];
+ if (object != null) {
+ const parent = getInObject(object, path.slice(0, length - 1));
+ if (parent) {
+ parent[last] = value;
+ }
+ }
+}
+
+export type DataType =
+ | 'array'
+ | 'array_buffer'
+ | 'bigint'
+ | 'boolean'
+ | 'class_instance'
+ | 'data_view'
+ | 'date'
+ | 'error'
+ | 'function'
+ | 'html_all_collection'
+ | 'html_element'
+ | 'infinity'
+ | '-infinity'
+ | 'iterator'
+ | 'opaque_iterator'
+ | 'nan'
+ | 'null'
+ | 'number'
+ | 'thenable'
+ | 'object'
+ | 'react_element'
+ | 'react_lazy'
+ | 'regexp'
+ | 'string'
+ | 'symbol'
+ | 'typed_array'
+ | 'undefined'
+ | 'unknown';
+
+function isError(data: Object): boolean {
+ // If it doesn't event look like an error, it won't be an actual error.
+ if ('name' in data && 'message' in data) {
+ while (data) {
+ // $FlowFixMe[method-unbinding]
+ if (Object.prototype.toString.call(data) === '[object Error]') {
+ return true;
+ }
+ data = Object.getPrototypeOf(data);
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Get a enhanced/artificial type string based on the object instance
+ */
+export function getDataType(data: Object): DataType {
+ if (data === null) {
+ return 'null';
+ } else if (data === undefined) {
+ return 'undefined';
+ }
+
+ if (typeof HTMLElement !== 'undefined' && data instanceof HTMLElement) {
+ return 'html_element';
+ }
+
+ const type = typeof data;
+ switch (type) {
+ case 'bigint':
+ return 'bigint';
+ case 'boolean':
+ return 'boolean';
+ case 'function':
+ return 'function';
+ case 'number':
+ if (Number.isNaN(data)) {
+ return 'nan';
+ } else if (!Number.isFinite(data)) {
+ return data > 0 ? 'infinity' : '-infinity';
+ } else {
+ return 'number';
+ }
+ case 'object':
+ switch (data.$$typeof) {
+ case REACT_ELEMENT_TYPE:
+ case REACT_LEGACY_ELEMENT_TYPE:
+ return 'react_element';
+ case REACT_LAZY_TYPE:
+ return 'react_lazy';
+ }
+ if (isArray(data)) {
+ return 'array';
+ } else if (ArrayBuffer.isView(data)) {
+ return hasOwnProperty.call(data.constructor, 'BYTES_PER_ELEMENT')
+ ? 'typed_array'
+ : 'data_view';
+ } else if (data.constructor && data.constructor.name === 'ArrayBuffer') {
+ // HACK This ArrayBuffer check is gross; is there a better way?
+ // We could try to create a new DataView with the value.
+ // If it doesn't error, we know it's an ArrayBuffer,
+ // but this seems kind of awkward and expensive.
+ return 'array_buffer';
+ } else if (typeof data[Symbol.iterator] === 'function') {
+ const iterator = data[Symbol.iterator]();
+ if (!iterator) {
+ // Proxies might break assumptoins about iterators.
+ // See github.com/facebook/react/issues/21654
+ } else {
+ return iterator === data ? 'opaque_iterator' : 'iterator';
+ }
+ } else if (data.constructor && data.constructor.name === 'RegExp') {
+ return 'regexp';
+ } else if (typeof data.then === 'function') {
+ return 'thenable';
+ } else if (isError(data)) {
+ return 'error';
+ } else {
+ // $FlowFixMe[method-unbinding]
+ const toStringValue = Object.prototype.toString.call(data);
+ if (toStringValue === '[object Date]') {
+ return 'date';
+ } else if (toStringValue === '[object HTMLAllCollection]') {
+ return 'html_all_collection';
+ }
+ }
+
+ if (!isPlainObject(data)) {
+ return 'class_instance';
+ }
+
+ return 'object';
+ case 'string':
+ return 'string';
+ case 'symbol':
+ return 'symbol';
+ case 'undefined':
+ if (
+ // $FlowFixMe[method-unbinding]
+ Object.prototype.toString.call(data) === '[object HTMLAllCollection]'
+ ) {
+ return 'html_all_collection';
+ }
+ return 'undefined';
+ default:
+ return 'unknown';
+ }
+}
+
+// Fork of packages/react-is/src/ReactIs.js:30, but with legacy element type
+// Which has been changed in https://github.com/facebook/react/pull/28813
+function typeOfWithLegacyElementSymbol(object: any): mixed {
+ if (typeof object === 'object' && object !== null) {
+ const $$typeof = object.$$typeof;
+ switch ($$typeof) {
+ case REACT_ELEMENT_TYPE:
+ case REACT_LEGACY_ELEMENT_TYPE:
+ const type = object.type;
+
+ switch (type) {
+ case REACT_FRAGMENT_TYPE:
+ case REACT_PROFILER_TYPE:
+ case REACT_STRICT_MODE_TYPE:
+ case REACT_SUSPENSE_TYPE:
+ case REACT_SUSPENSE_LIST_TYPE:
+ case REACT_VIEW_TRANSITION_TYPE:
+ return type;
+ default:
+ const $$typeofType = type && type.$$typeof;
+
+ switch ($$typeofType) {
+ case REACT_CONTEXT_TYPE:
+ case REACT_FORWARD_REF_TYPE:
+ case REACT_LAZY_TYPE:
+ case REACT_MEMO_TYPE:
+ return $$typeofType;
+ case REACT_CONSUMER_TYPE:
+ return $$typeofType;
+ // Fall through
+ default:
+ return $$typeof;
+ }
+ }
+ case REACT_PORTAL_TYPE:
+ return $$typeof;
+ }
+ }
+
+ return undefined;
+}
+
+export function getDisplayNameForReactElement(
+ element: React$Element,
+): string | null {
+ const elementType = typeOfWithLegacyElementSymbol(element);
+ switch (elementType) {
+ case REACT_CONSUMER_TYPE:
+ return 'ContextConsumer';
+ case LEGACY_REACT_PROVIDER_TYPE:
+ return 'ContextProvider';
+ case REACT_CONTEXT_TYPE:
+ return 'Context';
+ case REACT_FORWARD_REF_TYPE:
+ return 'ForwardRef';
+ case REACT_FRAGMENT_TYPE:
+ return 'Fragment';
+ case REACT_LAZY_TYPE:
+ return 'Lazy';
+ case REACT_MEMO_TYPE:
+ return 'Memo';
+ case REACT_PORTAL_TYPE:
+ return 'Portal';
+ case REACT_PROFILER_TYPE:
+ return 'Profiler';
+ case REACT_STRICT_MODE_TYPE:
+ return 'StrictMode';
+ case REACT_SUSPENSE_TYPE:
+ return 'Suspense';
+ case REACT_SUSPENSE_LIST_TYPE:
+ return 'SuspenseList';
+ case REACT_VIEW_TRANSITION_TYPE:
+ return 'ViewTransition';
+ case REACT_TRACING_MARKER_TYPE:
+ return 'TracingMarker';
+ default:
+ const {type} = element;
+ if (typeof type === 'string') {
+ return type;
+ } else if (typeof type === 'function') {
+ return getDisplayName(type, 'Anonymous');
+ } else if (type != null) {
+ return 'NotImplementedInDevtools';
+ } else {
+ return 'Element';
+ }
+ }
+}
+
+const MAX_PREVIEW_STRING_LENGTH = 50;
+
+function truncateForDisplay(
+ string: string,
+ length: number = MAX_PREVIEW_STRING_LENGTH,
+) {
+ if (string.length > length) {
+ return string.slice(0, length) + '…';
+ } else {
+ return string;
+ }
+}
+
+// Attempts to mimic Chrome's inline preview for values.
+// For example, the following value...
+// {
+// foo: 123,
+// bar: "abc",
+// baz: [true, false],
+// qux: { ab: 1, cd: 2 }
+// };
+//
+// Would show a preview of...
+// {foo: 123, bar: "abc", baz: Array(2), qux: {…}}
+//
+// And the following value...
+// [
+// 123,
+// "abc",
+// [true, false],
+// { foo: 123, bar: "abc" }
+// ];
+//
+// Would show a preview of...
+// [123, "abc", Array(2), {…}]
+export function formatDataForPreview(
+ data: any,
+ showFormattedValue: boolean,
+): string {
+ if (data != null && hasOwnProperty.call(data, meta.type)) {
+ return showFormattedValue
+ ? data[meta.preview_long]
+ : data[meta.preview_short];
+ }
+
+ const type = getDataType(data);
+
+ switch (type) {
+ case 'html_element':
+ return `<${truncateForDisplay(data.tagName.toLowerCase())} />`;
+ case 'function':
+ // $FlowFixMe[invalid-compare]
+ if (typeof data.name === 'function' || data.name === '') {
+ return '() => {}';
+ }
+ return `${truncateForDisplay(data.name)}() {}`;
+ case 'string':
+ return `"${data}"`;
+ case 'bigint':
+ return truncateForDisplay(data.toString() + 'n');
+ case 'regexp':
+ return truncateForDisplay(data.toString());
+ case 'symbol':
+ return truncateForDisplay(data.toString());
+ case 'react_element':
+ return `<${truncateForDisplay(
+ getDisplayNameForReactElement(data) || 'Unknown',
+ )} />`;
+ case 'react_lazy':
+ // To avoid actually initialize a lazy to cause a side-effect we make some assumptions
+ // about the structure of the payload even though that's not really part of the contract.
+ // In practice, this is really just coming from React.lazy helper or Flight.
+ const payload = data._payload;
+ if (payload !== null && typeof payload === 'object') {
+ if (payload._status === 0) {
+ // React.lazy constructor pending
+ return `pending lazy()`;
+ }
+ if (payload._status === 1 && payload._result != null) {
+ // React.lazy constructor fulfilled
+ if (showFormattedValue) {
+ const formatted = formatDataForPreview(
+ payload._result.default,
+ false,
+ );
+ return `fulfilled lazy() {${truncateForDisplay(formatted)}}`;
+ } else {
+ return `fulfilled lazy() {…}`;
+ }
+ }
+ if (payload._status === 2) {
+ // React.lazy constructor rejected
+ if (showFormattedValue) {
+ const formatted = formatDataForPreview(payload._result, false);
+ return `rejected lazy() {${truncateForDisplay(formatted)}}`;
+ } else {
+ return `rejected lazy() {…}`;
+ }
+ }
+ if (payload.status === 'pending' || payload.status === 'blocked') {
+ // React Flight pending
+ return `pending lazy()`;
+ }
+ if (payload.status === 'fulfilled') {
+ // React Flight fulfilled
+ if (showFormattedValue) {
+ const formatted = formatDataForPreview(payload.value, false);
+ return `fulfilled lazy() {${truncateForDisplay(formatted)}}`;
+ } else {
+ return `fulfilled lazy() {…}`;
+ }
+ }
+ if (payload.status === 'rejected') {
+ // React Flight rejected
+ if (showFormattedValue) {
+ const formatted = formatDataForPreview(payload.reason, false);
+ return `rejected lazy() {${truncateForDisplay(formatted)}}`;
+ } else {
+ return `rejected lazy() {…}`;
+ }
+ }
+ }
+ // Some form of uninitialized
+ return 'lazy()';
+ case 'array_buffer':
+ return `ArrayBuffer(${data.byteLength})`;
+ case 'data_view':
+ return `DataView(${data.buffer.byteLength})`;
+ case 'array':
+ if (showFormattedValue) {
+ let formatted = '';
+ for (let i = 0; i < data.length; i++) {
+ if (i > 0) {
+ formatted += ', ';
+ }
+ formatted += formatDataForPreview(data[i], false);
+ if (formatted.length > MAX_PREVIEW_STRING_LENGTH) {
+ // Prevent doing a lot of unnecessary iteration...
+ break;
+ }
+ }
+ return `[${truncateForDisplay(formatted)}]`;
+ } else {
+ const length = hasOwnProperty.call(data, meta.size)
+ ? data[meta.size]
+ : data.length;
+ return `Array(${length})`;
+ }
+ case 'typed_array':
+ const shortName = `${data.constructor.name}(${data.length})`;
+ if (showFormattedValue) {
+ let formatted = '';
+ for (let i = 0; i < data.length; i++) {
+ if (i > 0) {
+ formatted += ', ';
+ }
+ formatted += data[i];
+ if (formatted.length > MAX_PREVIEW_STRING_LENGTH) {
+ // Prevent doing a lot of unnecessary iteration...
+ break;
+ }
+ }
+ return `${shortName} [${truncateForDisplay(formatted)}]`;
+ } else {
+ return shortName;
+ }
+ case 'iterator':
+ const name = data.constructor.name;
+
+ if (showFormattedValue) {
+ // TRICKY
+ // Don't use [...spread] syntax for this purpose.
+ // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values.
+ // Other types (e.g. typed arrays, Sets) will not spread correctly.
+ const array = Array.from(data);
+
+ let formatted = '';
+ for (let i = 0; i < array.length; i++) {
+ const entryOrEntries = array[i];
+
+ if (i > 0) {
+ formatted += ', ';
+ }
+
+ // TRICKY
+ // Browsers display Maps and Sets differently.
+ // To mimic their behavior, detect if we've been given an entries tuple.
+ // Map(2) {"abc" => 123, "def" => 123}
+ // Set(2) {"abc", 123}
+ if (isArray(entryOrEntries)) {
+ const key = formatDataForPreview(entryOrEntries[0], true);
+ const value = formatDataForPreview(entryOrEntries[1], false);
+ formatted += `${key} => ${value}`;
+ } else {
+ formatted += formatDataForPreview(entryOrEntries, false);
+ }
+
+ if (formatted.length > MAX_PREVIEW_STRING_LENGTH) {
+ // Prevent doing a lot of unnecessary iteration...
+ break;
+ }
+ }
+
+ return `${name}(${data.size}) {${truncateForDisplay(formatted)}}`;
+ } else {
+ return `${name}(${data.size})`;
+ }
+ case 'opaque_iterator': {
+ return data[Symbol.toStringTag];
+ }
+ case 'date':
+ return data.toString();
+ case 'class_instance':
+ try {
+ let resolvedConstructorName = data.constructor.name;
+ if (typeof resolvedConstructorName === 'string') {
+ return resolvedConstructorName;
+ }
+
+ resolvedConstructorName = Object.getPrototypeOf(data).constructor.name;
+ if (typeof resolvedConstructorName === 'string') {
+ return resolvedConstructorName;
+ }
+
+ try {
+ return truncateForDisplay(String(data));
+ } catch (error) {
+ return 'unserializable';
+ }
+ } catch (error) {
+ return 'unserializable';
+ }
+ case 'thenable':
+ let displayName: string;
+ if (isPlainObject(data)) {
+ displayName = 'Thenable';
+ } else {
+ let resolvedConstructorName = data.constructor.name;
+ if (typeof resolvedConstructorName !== 'string') {
+ resolvedConstructorName =
+ Object.getPrototypeOf(data).constructor.name;
+ }
+ if (typeof resolvedConstructorName === 'string') {
+ displayName = resolvedConstructorName;
+ } else {
+ displayName = 'Thenable';
+ }
+ }
+ switch (data.status) {
+ case 'pending':
+ return `pending ${displayName}`;
+ case 'fulfilled':
+ if (showFormattedValue) {
+ const formatted = formatDataForPreview(data.value, false);
+ return `fulfilled ${displayName} {${truncateForDisplay(formatted)}}`;
+ } else {
+ return `fulfilled ${displayName} {…}`;
+ }
+ case 'rejected':
+ if (showFormattedValue) {
+ const formatted = formatDataForPreview(data.reason, false);
+ return `rejected ${displayName} {${truncateForDisplay(formatted)}}`;
+ } else {
+ return `rejected ${displayName} {…}`;
+ }
+ default:
+ return displayName;
+ }
+ case 'object':
+ if (showFormattedValue) {
+ const keys = Array.from(getAllEnumerableKeys(data)).sort(alphaSortKeys);
+
+ let formatted = '';
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ if (i > 0) {
+ formatted += ', ';
+ }
+ formatted += `${key.toString()}: ${formatDataForPreview(
+ data[key],
+ false,
+ )}`;
+ if (formatted.length > MAX_PREVIEW_STRING_LENGTH) {
+ // Prevent doing a lot of unnecessary iteration...
+ break;
+ }
+ }
+ return `{${truncateForDisplay(formatted)}}`;
+ } else {
+ return '{…}';
+ }
+ case 'error':
+ return truncateForDisplay(String(data));
+ case 'boolean':
+ case 'number':
+ case 'infinity':
+ case '-infinity':
+ case 'nan':
+ case 'null':
+ case 'undefined':
+ return String(data);
+ default:
+ try {
+ return truncateForDisplay(String(data));
+ } catch (error) {
+ return 'unserializable';
+ }
+ }
+}
+
+// Basically checking that the object only has Object in its prototype chain
+export const isPlainObject = (object: Object): boolean => {
+ const objectPrototype = Object.getPrototypeOf(object);
+ if (!objectPrototype) return true;
+
+ const objectParentPrototype = Object.getPrototypeOf(objectPrototype);
+ return !objectParentPrototype;
+};
+
+export function backendToFrontendSerializedElementMapper(
+ element: SerializedElementBackend,
+): SerializedElementFrontend {
+ const {formattedDisplayName, hocDisplayNames, compiledWithForget} =
+ parseElementDisplayNameFromBackend(element.displayName, element.type);
+
+ return {
+ ...element,
+ displayName: formattedDisplayName,
+ hocDisplayNames,
+ compiledWithForget,
+ };
+}
+
+/**
+ * Should be used when treating url as a Chrome Resource URL.
+ */
+export function normalizeUrlIfValid(url: string): string {
+ try {
+ // TODO: Chrome will use the basepath to create a Resource URL.
+ return new URL(url).toString();
+ } catch {
+ // Giving up if it's not a valid URL without basepath
+ return url;
+ }
+}
+
+export function getIsReloadAndProfileSupported(): boolean {
+ // Notify the frontend if the backend supports the Storage API (e.g. localStorage).
+ // If not, features like reload-and-profile will not work correctly and must be disabled.
+ let isBackendStorageAPISupported = false;
+ try {
+ localStorage.getItem('test');
+ isBackendStorageAPISupported = true;
+ } catch (error) {}
+
+ return isBackendStorageAPISupported && isSynchronousXHRSupported();
+}
+
+// Expected to be used only by browser extension and react-devtools-inline
+export function getIfReloadedAndProfiling(): boolean {
+ return (
+ sessionStorageGetItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY) === 'true'
+ );
+}
+
+export function getProfilingSettings(): ProfilingSettings {
+ return {
+ recordChangeDescriptions:
+ sessionStorageGetItem(SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY) ===
+ 'true',
+ };
+}
+
+export function onReloadAndProfile(recordChangeDescriptions: boolean): void {
+ sessionStorageSetItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY, 'true');
+ sessionStorageSetItem(
+ SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY,
+ recordChangeDescriptions ? 'true' : 'false',
+ );
+}
+
+export function onReloadAndProfileFlagsReset(): void {
+ sessionStorageRemoveItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY);
+ sessionStorageRemoveItem(SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY);
+}
+
+export function unionOfTwoArrays(a: Array, b: Array): Array {
+ let result = a;
+ for (let i = 0; i < b.length; i++) {
+ const value = b[i];
+ if (a.indexOf(value) === -1) {
+ if (result === a) {
+ // Lazily copy
+ result = a.slice(0);
+ }
+ result.push(value);
+ }
+ }
+ return result;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/README.md b/github_code/react__react/packages/react-devtools-shell/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..0a78ebc86b1d8e832e08706d19032807d3024581
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/README.md
@@ -0,0 +1,14 @@
+Harness for testing local changes to the `react-devtools-inline` and `react-devtools-shared` packages.
+
+## Development
+
+This target should be run in parallel with the `react-devtools-inline` package. The first step then is to run that target following the instructions in the [`react-devtools-inline` README's local development section](../react-devtools-inline/README.md#local-development).
+
+The test harness can then be run as follows:
+```sh
+cd packages/react-devtools-shell
+
+yarn start
+```
+
+Once you set both up, you can view the test harness with inlined devtools in browser at http://localhost:8080/
diff --git a/github_code/react__react/packages/react-devtools-shell/constants.js b/github_code/react__react/packages/react-devtools-shell/constants.js
new file mode 100644
index 0000000000000000000000000000000000000000..aa99fff68478b3ec23fcea46fc87565fb0ae204b
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/constants.js
@@ -0,0 +1,5 @@
+const SUCCESSFUL_COMPILATION_MESSAGE = 'Compiled successfully.';
+
+module.exports = {
+ SUCCESSFUL_COMPILATION_MESSAGE,
+};
diff --git a/github_code/react__react/packages/react-devtools-shell/e2e-regression.html b/github_code/react__react/packages/react-devtools-shell/e2e-regression.html
new file mode 100644
index 0000000000000000000000000000000000000000..25ecd75ffe76d7979f9fa268c447e71333c49570
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/e2e-regression.html
@@ -0,0 +1,40 @@
+
+
+
+
+ React DevTools
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shell/e2e.html b/github_code/react__react/packages/react-devtools-shell/e2e.html
new file mode 100644
index 0000000000000000000000000000000000000000..93d8f2f3f81d2a85a8b2fed6bb49bb6712ce3c4c
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/e2e.html
@@ -0,0 +1,40 @@
+
+
+
+
+ React DevTools
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shell/index.html b/github_code/react__react/packages/react-devtools-shell/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..87352e2f82f35cc0b700a87218e8618fbb7256f0
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/index.html
@@ -0,0 +1,215 @@
+
+
+
+
+
+ React DevTools
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/github_code/react__react/packages/react-devtools-shell/multi.html b/github_code/react__react/packages/react-devtools-shell/multi.html
new file mode 100644
index 0000000000000000000000000000000000000000..57b25c376076751be4200b3e7617e58367a89e60
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/multi.html
@@ -0,0 +1,57 @@
+
+
+
+
+ React DevTools
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shell/package.json b/github_code/react__react/packages/react-devtools-shell/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..999924aefa3c26bbff1ee90a51ab0c8e77edf266
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/package.json
@@ -0,0 +1,32 @@
+{
+ "private": true,
+ "name": "react-devtools-shell",
+ "version": "0.0.0",
+ "scripts": {
+ "start": "cross-env NODE_ENV=development node ./webpack-server.js"
+ },
+ "dependencies": {
+ "immutable": "^4.0.0-rc.12",
+ "react-native-web": "0.0.0-26873b469",
+ "semver": "^6.3.0"
+ },
+ "devDependencies": {
+ "@babel/core": "^7.11.1",
+ "@babel/plugin-proposal-class-properties": "^7.10.4",
+ "@babel/plugin-transform-flow-strip-types": "^7.10.4",
+ "@babel/plugin-transform-react-jsx-source": "^7.10.5",
+ "@babel/preset-env": "^7.11.0",
+ "@babel/preset-flow": "^7.10.4",
+ "@babel/preset-react": "^7.10.4",
+ "babel-core": "^7.0.0-bridge",
+ "babel-eslint": "^9.0.0",
+ "babel-loader": "^8.0.4",
+ "cross-env": "^3.1.4",
+ "css-loader": "^1.0.1",
+ "raw-loader": "^3.1.0",
+ "style-loader": "^0.23.1",
+ "webpack": "^5.82.1",
+ "webpack-cli": "^5.1.1",
+ "webpack-dev-server": "^4.15.0"
+ }
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/perf-regression.html b/github_code/react__react/packages/react-devtools-shell/perf-regression.html
new file mode 100644
index 0000000000000000000000000000000000000000..27fd87f88dd8ac04add6d570906990e441d43110
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/perf-regression.html
@@ -0,0 +1,45 @@
+
+
+
+
+ React DevTools
+
+
+
+
+
+
+ Load DevTools
+
+
+
+
\ No newline at end of file
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ActivityTree/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/ActivityTree/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..b4782ee197b7bd4d3a6259dcbd94f2473d13198e
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ActivityTree/index.js
@@ -0,0 +1,39 @@
+import * as React from 'react';
+import {useState} from 'react';
+
+const Activity = React.Activity || React.unstable_Activity;
+
+function Profile({name}) {
+ return (
+
+
{name}
+
+
+ );
+}
+
+function Bio() {
+ return This is a bio section.
;
+}
+
+export default function ActivityTree() {
+ const [mode, setMode] = useState('hidden');
+
+ if (Activity == null) {
+ return null;
+ }
+
+ return (
+ <>
+ Activity
+ setMode(m => (m === 'visible' ? 'hidden' : 'visible'))}>
+ Toggle mode (current: {mode})
+
+
+
+
+
+ >
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..5cfdb11c0d31e3ca51c5e1da468d53e32e19e5c3
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js
@@ -0,0 +1,45 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {Fragment} from 'react';
+
+function wrapWithHoc(Component: () => any, index: number) {
+ function HOC() {
+ return ;
+ }
+
+ const displayName = (Component as any).displayName || Component.name;
+
+ HOC.displayName = `withHoc${index}(${displayName})`;
+ return HOC;
+}
+
+function wrapWithNested(Component: () => any, times: number) {
+ for (let i = 0; i < times; i++) {
+ Component = wrapWithHoc(Component, i);
+ }
+
+ return Component;
+}
+
+function Nested() {
+ return Deeply nested div
;
+}
+
+const DeeplyNested = wrapWithNested(Nested, 100);
+
+export default function DeeplyNestedComponents(): React.Node {
+ return (
+
+ Deeply nested component
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/EditableProps/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/EditableProps/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..2d4955b5211f0ce2638b221305ee8a294a4911f0
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/EditableProps/index.js
@@ -0,0 +1,175 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import type {ReactContext} from 'shared/ReactTypes';
+import * as React from 'react';
+import {
+ createContext,
+ Component,
+ forwardRef,
+ Fragment,
+ memo,
+ useCallback,
+ useDebugValue,
+ useEffect,
+ useReducer,
+ useState,
+} from 'react';
+
+const initialData = {foo: 'FOO', bar: 'BAR'};
+
+// $FlowFixMe[missing-local-annot]
+function reducer(state, action: {type: string}) {
+ switch (action.type) {
+ case 'swap':
+ return {foo: state.bar, bar: state.foo};
+ default:
+ throw new Error();
+ }
+}
+
+type StatefulFunctionProps = {name: string};
+
+function StatefulFunction({name}: StatefulFunctionProps) {
+ const [count, updateCount] = useState(0);
+ const debouncedCount = useDebounce(count, 1000);
+ const handleUpdateCountClick = useCallback(
+ () => updateCount(count + 1),
+ [count],
+ );
+
+ const [data, dispatch] = useReducer(reducer, initialData);
+ const handleUpdateReducerClick = useCallback(
+ () => dispatch({type: 'swap'}),
+ [],
+ );
+
+ return (
+
+ Name: {name}
+
+
+ Debounced count: {debouncedCount}
+
+
+
+ Reducer state: foo "{data.foo}", bar "{data.bar}"
+
+
+ Swap reducer values
+
+
+ );
+}
+
+const BoolContext = createContext(true);
+BoolContext.displayName = 'BoolContext';
+
+type Props = {name: string, toggle: boolean};
+type State = {cities: Array, state: string};
+
+class StatefulClass extends Component {
+ static contextType: ReactContext = BoolContext;
+
+ state: State = {
+ cities: ['San Francisco', 'San Jose'],
+ state: 'California',
+ };
+
+ // $FlowFixMe[missing-local-annot]
+ handleChange = ({target}): any =>
+ this.setState({
+ state: target.value,
+ });
+
+ render(): any {
+ return (
+
+ );
+ }
+}
+
+const MemoizedStatefulClass = memo(StatefulClass);
+const MemoizedStatefulFunction = memo(StatefulFunction);
+
+const ForwardRef = forwardRef<{name: string}, HTMLUListElement>(
+ ({name}, ref) => {
+ const [count, updateCount] = useState(0);
+ const debouncedCount = useDebounce(count, 1000);
+ const handleUpdateCountClick = useCallback(
+ () => updateCount(count + 1),
+ [count],
+ );
+ return (
+
+ Name: {name}
+
+
+ Debounced count: {debouncedCount}
+
+
+
+ );
+ },
+);
+
+export default function EditableProps(): React.Node {
+ return (
+
+ Editable props
+ Class
+
+ Function
+
+ Memoized Class
+
+ Memoized Function
+
+ Forward Ref
+
+
+ );
+}
+
+// Below copied from https://usehooks.com/
+function useDebounce(value: number, delay: number) {
+ // State and setters for debounced value
+ const [debouncedValue, setDebouncedValue] = useState(value);
+
+ // Show the value in DevTools
+ useDebugValue(debouncedValue);
+
+ useEffect(
+ () => {
+ // Update debounced value after delay
+ const handler = setTimeout(() => {
+ setDebouncedValue(value);
+ }, delay);
+
+ // Cancel the timeout if value changes (also on delay change or unmount)
+ // This is how we prevent debounced value from updating if value is changed ...
+ // .. within the delay period. Timeout gets cleared and restarted.
+ return () => {
+ clearTimeout(handler);
+ };
+ },
+ [value, delay], // Only re-call effect if value or delay changes
+ );
+
+ return debouncedValue;
+}
+// Above copied from https://usehooks.com/
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ElementTypes/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/ElementTypes/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..3276639c05ed887276b0601d3334adff03d509f0
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ElementTypes/index.js
@@ -0,0 +1,76 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {
+ createContext,
+ forwardRef,
+ lazy,
+ memo,
+ Component,
+ Fragment,
+ Profiler,
+ StrictMode,
+ Suspense,
+} from 'react';
+
+const Context = createContext('abc');
+Context.displayName = 'ExampleContext';
+
+class ClassComponent extends Component {
+ render(): null {
+ return null;
+ }
+}
+
+function FunctionComponent() {
+ return null;
+}
+
+const MemoFunctionComponent = memo(FunctionComponent);
+
+const ForwardRefComponentWithAnonymousFunction = forwardRef((props, ref) => (
+
+));
+const ForwardRefComponent = forwardRef(function NamedInnerFunction(props, ref) {
+ return ;
+});
+const ForwardRefComponentWithCustomDisplayName = forwardRef((props, ref) => (
+
+));
+ForwardRefComponentWithCustomDisplayName.displayName = 'Custom';
+
+const LazyComponent = lazy(() =>
+ Promise.resolve({
+ default: FunctionComponent,
+ }),
+);
+
+export default function ElementTypes(): React.Node {
+ return (
+ {}}>
+
+
+ {(value: $FlowFixMe) => null}
+
+
+ Loading...}>
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ErrorBoundaries/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/ErrorBoundaries/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..a87d853ea1b255b422f16d93447a86d6245b8ddd
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ErrorBoundaries/index.js
@@ -0,0 +1,72 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {Fragment} from 'react';
+
+class ErrorBoundary extends React.Component {
+ state: {hasError: boolean} = {hasError: false};
+
+ static getDerivedStateFromError(error: any): {hasError: boolean} {
+ return {hasError: true};
+ }
+
+ render(): any {
+ const {hasError} = this.state;
+ if (hasError) {
+ return (
+
+ An error was thrown.
+
+ );
+ }
+
+ const {children} = this.props;
+ return (
+
+ {children}
+
+ );
+ }
+}
+
+// $FlowFixMe[missing-local-annot]
+function Component({label}) {
+ return {label}
;
+}
+
+export default function ErrorBoundaries(): React.Node {
+ return (
+
+ Nested error boundaries demo
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/Hydration/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/Hydration/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..f90bd6bef12ee9f1b9eff1465b3c45635644e912
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/Hydration/index.js
@@ -0,0 +1,226 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {Fragment, useDebugValue, useState} from 'react';
+
+const div = document.createElement('div');
+const exampleFunction = () => {};
+const typedArray = new Uint8Array(3);
+typedArray[0] = 1;
+typedArray[1] = 2;
+typedArray[2] = 3;
+
+const arrayOfArrays = [
+ [
+ ['a', 'b', 'c'],
+ ['d', 'e', 'f'],
+ ['h', 'i', 'j'],
+ ],
+ [
+ ['k', 'l', 'm'],
+ ['n', 'o', 'p'],
+ ['q', 'r', 's'],
+ ],
+ [['t', 'u', 'v'], ['w', 'x', 'y'], ['z']],
+ [],
+];
+
+const objectOfObjects = {
+ foo: {
+ a: 1,
+ b: 2,
+ c: 3,
+ },
+ bar: {
+ e: 4,
+ f: 5,
+ g: 6,
+ },
+ baz: {
+ h: 7,
+ i: 8,
+ j: 9,
+ },
+ qux: {},
+ quux: {
+ k: undefined,
+ l: null,
+ },
+};
+
+function useOuterFoo() {
+ useDebugValue({
+ debugA: {
+ debugB: {
+ debugC: 'abc',
+ },
+ },
+ });
+ useState({
+ valueA: {
+ valueB: {
+ valueC: 'abc',
+ },
+ },
+ });
+ return useInnerFoo();
+}
+
+function useInnerFoo() {
+ const [value] = useState([[['a', 'b', 'c']]]);
+ return value;
+}
+
+function useOuterBar() {
+ useDebugValue({
+ debugA: {
+ debugB: {
+ debugC: 'abc',
+ },
+ },
+ });
+ return useInnerBar();
+}
+
+function useInnerBar() {
+ useDebugValue({
+ debugA: {
+ debugB: {
+ debugC: 'abc',
+ },
+ },
+ });
+ const [count] = useState(123);
+ return count;
+}
+
+function useOuterBaz() {
+ return useInnerBaz();
+}
+
+function useInnerBaz() {
+ const [count] = useState(123);
+ return count;
+}
+
+const unusedPromise = Promise.resolve();
+const usedFulfilledPromise = Promise.resolve();
+const usedFulfilledRichPromise = Promise.resolve({
+ some: {
+ deeply: {
+ nested: {
+ object: {
+ string: 'test',
+ fn: () => {},
+ },
+ },
+ },
+ },
+});
+const usedPendingPromise = new Promise(resolve => {});
+const usedRejectedPromise = Promise.reject(
+ // eslint-disable-next-line react-internal/prod-error-codes
+ new Error('test-error-do-not-surface'),
+);
+
+class DigestError extends Error {
+ digest: string;
+ constructor(message: string, options: any, digest: string) {
+ super(message, options);
+ this.digest = digest;
+ }
+}
+
+export default function Hydration(): React.Node {
+ return (
+
+ Hydration
+ }
+ array_buffer={typedArray.buffer}
+ typed_array={typedArray}
+ date={new Date()}
+ array={arrayOfArrays}
+ object={objectOfObjects}
+ unusedPromise={unusedPromise}
+ usedFulfilledPromise={usedFulfilledPromise}
+ usedFulfilledRichPromise={usedFulfilledRichPromise}
+ usedPendingPromise={usedPendingPromise}
+ usedRejectedPromise={usedRejectedPromise}
+ // eslint-disable-next-line react-internal/prod-error-codes
+ error={new Error('test')}
+ // eslint-disable-next-line react-internal/prod-error-codes
+ errorWithCause={new Error('one', {cause: new TypeError('two')})}
+ errorWithDigest={new DigestError('test', {}, 'some-digest')}
+ // $FlowFixMe[cannot-resolve-name] Flow doesn't know about DOMException
+ domexception={new DOMException('test')}
+ />
+
+
+ );
+}
+
+function Use({value}: {value: Promise}): React.Node {
+ React.use(value);
+ return null;
+}
+
+class IgnoreErrors extends React.Component {
+ state: {hasError: boolean} = {hasError: false};
+ static getDerivedStateFromError(): {hasError: boolean} {
+ return {hasError: true};
+ }
+
+ render(): React.Node {
+ if (this.state.hasError) {
+ return null;
+ }
+ return this.props.children;
+ }
+}
+
+function DehydratableProps({array, object}: any) {
+ return (
+
+ array: {JSON.stringify(array, null, 2)}
+ object: {JSON.stringify(object, null, 2)}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+function DeepHooks(props: any) {
+ const foo = useOuterFoo();
+ const bar = useOuterBar();
+ const baz = useOuterBaz();
+ return (
+
+ foo: {foo}
+ bar: {bar}
+ baz: {baz}
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/Iframe/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/Iframe/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..3f861f7beead7f1fa81741e8e6502cb39178e0c3
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/Iframe/index.js
@@ -0,0 +1,73 @@
+/** @flow */
+
+import * as React from 'react';
+import {Fragment} from 'react';
+import {createPortal} from 'react-dom';
+
+export default function Iframe(): React.Node {
+ return (
+
+ Iframe
+
+
+
+
+
+
+ );
+}
+
+const iframeStyle = {border: '2px solid #eee', height: 80};
+
+// $FlowFixMe[missing-local-annot]
+function Frame(props) {
+ const [element, setElement] = React.useState(null);
+
+ const ref = React.useRef();
+
+ React.useLayoutEffect(function () {
+ const iframe = ref.current;
+
+ // $FlowFixMe[constant-condition]
+ if (iframe) {
+ const html = `
+
+
+
+
+
+
+ `;
+
+ const document = iframe.contentDocument;
+
+ document.open();
+ document.write(html);
+ document.close();
+
+ setElement(document.getElementById('root'));
+ }
+ }, []);
+
+ return (
+
+
+
+
+ {/* $FlowFixMe[constant-condition] */}
+ {element ? createPortal(props.children, element) : null}
+
+ );
+}
+
+function Greeting() {
+ return (
+
+ Hello from within an <iframe>!
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InlineWarnings/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/InlineWarnings/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ddfac6acb4c3b35ae9b9fab2f52c44098c565dc1
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InlineWarnings/index.js
@@ -0,0 +1,207 @@
+/** @flow */
+
+import * as React from 'react';
+import {Fragment, useEffect, useRef, useState} from 'react';
+
+// $FlowFixMe[missing-local-annot]
+function WarnDuringRender({children = null}) {
+ console.warn('This warning fires during every render');
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function WarnOnMount({children = null}) {
+ useEffect(() => {
+ console.warn('This warning fires on initial mount only');
+ }, []);
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function WarnOnUpdate({children = null}) {
+ const didMountRef = useRef(false);
+ useEffect(() => {
+ if (didMountRef.current) {
+ console.warn('This warning fires on every update');
+ } else {
+ didMountRef.current = true;
+ }
+ });
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function WarnOnUnmount({children = null}) {
+ useEffect(() => {
+ return () => {
+ console.warn('This warning fires on unmount');
+ };
+ }, []);
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorDuringRender({children = null}) {
+ console.error('This error fires during every render');
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorOnMount({children = null}) {
+ useEffect(() => {
+ console.error('This error fires on initial mount only');
+ }, []);
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorOnUpdate({children = null}) {
+ const didMountRef = useRef(false);
+ useEffect(() => {
+ if (didMountRef.current) {
+ console.error('This error fires on every update');
+ } else {
+ didMountRef.current = true;
+ }
+ });
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorOnUnmount({children = null}) {
+ useEffect(() => {
+ return () => {
+ console.error('This error fires on unmount');
+ };
+ }, []);
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorAndWarningDuringRender({children = null}) {
+ console.warn('This warning fires during every render');
+ console.error('This error fires during every render');
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorAndWarningOnMount({children = null}) {
+ useEffect(() => {
+ console.warn('This warning fires on initial mount only');
+ console.error('This error fires on initial mount only');
+ }, []);
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorAndWarningOnUpdate({children = null}) {
+ const didMountRef = useRef(false);
+ useEffect(() => {
+ if (didMountRef.current) {
+ console.warn('This warning fires on every update');
+ console.error('This error fires on every update');
+ } else {
+ didMountRef.current = true;
+ }
+ });
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorAndWarningOnUnmount({children = null}) {
+ useEffect(() => {
+ return () => {
+ console.warn('This warning fires on unmount');
+ console.error('This error fires on unmount');
+ };
+ }, []);
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ReallyLongErrorMessageThatWillCauseTextToBeTruncated({
+ children = null,
+}) {
+ console.error(
+ 'This error is a really long error message that should cause the text to be truncated in DevTools',
+ );
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorWithMultipleArgs({children = null}) {
+ console.error('This error', 'passes console', 4, 'arguments');
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ErrorWithStringSubstitutions({children = null}) {
+ console.error('This error uses "%s" substitutions', 'string');
+ return children;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ReactErrorOnHostComponent({children = null}) {
+ return {children}
;
+}
+
+// $FlowFixMe[missing-local-annot]
+function DuplicateWarningsAndErrors({children = null}) {
+ console.warn('this warning is logged twice per render');
+ console.warn('this warning is logged twice per render');
+ console.error('this error is logged twice per render');
+ console.error('this error is logged twice per render');
+ return {children}
;
+}
+
+// $FlowFixMe[missing-local-annot]
+function MultipleWarningsAndErrors({children = null}) {
+ console.warn('this is the first warning logged');
+ console.warn('this is the second warning logged');
+ console.error('this is the first error logged');
+ console.error('this is the second error logged');
+ return {children}
;
+}
+
+// $FlowFixMe[missing-local-annot]
+function ComponentWithMissingKey({children}) {
+ return [
];
+}
+
+function ComponentWithSymbolWarning() {
+ console.warn('this is a symbol', Symbol('foo'));
+ console.error('this is a symbol', Symbol.for('bar'));
+ return null;
+}
+
+export default function ErrorsAndWarnings(): React.Node {
+ const [count, setCount] = useState(0);
+ const handleClick = () => setCount(count + 1);
+ return (
+
+ Inline warnings
+ Update {count > 0 ? count : ''}
+
+
+
+
+ {count === 0 ? : null}
+ {count === 0 ? : null}
+
+
+
+ {count === 0 ? : null}
+
+
+
+ {count === 0 ? : null}
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CircularReferences.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CircularReferences.js
new file mode 100644
index 0000000000000000000000000000000000000000..e918325eb1b9c6ae1bec9b7a6c93be4005bbd421
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CircularReferences.js
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+const arrayOne: $FlowFixMe = [];
+const arrayTwo: $FlowFixMe = [];
+arrayTwo.push(arrayOne);
+arrayOne.push(arrayTwo);
+
+type ObjectOne = {
+ objectTwo?: ObjectTwo,
+};
+type ObjectTwo = {
+ objectOne: ObjectOne,
+};
+
+const objectOne: ObjectOne = {};
+const objectTwo: ObjectTwo = {objectOne};
+objectOne.objectTwo = objectTwo;
+
+export default function CircularReferences(): React.Node {
+ return ;
+}
+
+function ChildComponent(props: any) {
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/Contexts.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/Contexts.js
new file mode 100644
index 0000000000000000000000000000000000000000..ebd2470ac60f79dff5176b3017979e44e2b5a383
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/Contexts.js
@@ -0,0 +1,370 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {createContext, Component, useContext, useState} from 'react';
+import PropTypes from 'prop-types';
+
+import type {ReactContext} from 'shared/ReactTypes';
+
+function someNamedFunction() {}
+
+function formatContextForDisplay(name: string, value: any | string) {
+ return (
+
+ {name}: {JSON.stringify(value, null, 2)}
+
+ );
+}
+
+const contextData = {
+ array: ['first', 'second', 'third'],
+ bool: true,
+ func: someNamedFunction,
+ number: 123,
+ object: {outer: {inner: {} as {...}}},
+ string: 'abc',
+ symbol: Symbol.for('symbol'),
+ null: null,
+ undefined: undefined,
+};
+
+class LegacyContextProvider extends Component {
+ static childContextTypes: {
+ array: any,
+ bool: any,
+ func: any,
+ null: any,
+ number: any,
+ object: any,
+ string: any,
+ symbol: any,
+ undefined: any,
+ } = {
+ array: PropTypes.array,
+ bool: PropTypes.bool,
+ func: PropTypes.func,
+ number: PropTypes.number,
+ object: PropTypes.object,
+ string: PropTypes.string,
+ symbol: PropTypes.symbol,
+ null: PropTypes.any,
+ undefined: PropTypes.any,
+ };
+
+ getChildContext(): {
+ array: Array,
+ bool: boolean,
+ func: () => void,
+ null: null,
+ number: number,
+ object: {outer: {inner: {...}}},
+ string: string,
+ symbol: symbol,
+ undefined: void,
+ } {
+ return contextData;
+ }
+
+ render(): any {
+ return this.props.children;
+ }
+}
+
+class LegacyContextConsumer extends Component {
+ static contextTypes: {
+ array: any,
+ bool: any,
+ func: any,
+ null: any,
+ number: any,
+ object: any,
+ string: any,
+ symbol: any,
+ undefined: any,
+ } = {
+ array: PropTypes.array,
+ bool: PropTypes.bool,
+ func: PropTypes.func,
+ number: PropTypes.number,
+ object: PropTypes.object,
+ string: PropTypes.string,
+ symbol: PropTypes.symbol,
+ null: PropTypes.any,
+ undefined: PropTypes.any,
+ };
+
+ render(): any {
+ return formatContextForDisplay('LegacyContextConsumer', this.context);
+ }
+}
+
+class LegacyContextProviderWithUpdates extends Component {
+ constructor(props: any) {
+ super(props);
+ this.state = {type: 'desktop'};
+ }
+
+ getChildContext(): {type: any} {
+ return {type: this.state.type};
+ }
+
+ // $FlowFixMe[missing-local-annot]
+ handleChange = event => {
+ this.setState({type: event.target.value});
+ };
+
+ render(): any {
+ return (
+ <>
+
+
+
+
+ >
+ );
+ }
+}
+
+LegacyContextProviderWithUpdates.childContextTypes = {
+ type: PropTypes.string,
+};
+
+// $FlowFixMe[missing-local-annot]
+function LegacyFunctionalContextConsumer(props: any, context) {
+ return formatContextForDisplay('LegacyFunctionContextConsumer', context.type);
+}
+LegacyFunctionalContextConsumer.contextTypes = {
+ type: PropTypes.string,
+};
+
+const ModernContext = createContext();
+ModernContext.displayName = 'ModernContext';
+const ArrayContext = createContext(contextData.array);
+ArrayContext.displayName = 'ArrayContext';
+const BoolContext = createContext(contextData.bool);
+BoolContext.displayName = 'BoolContext';
+const FuncContext = createContext(contextData.func);
+FuncContext.displayName = 'FuncContext';
+const NumberContext = createContext(contextData.number);
+NumberContext.displayName = 'NumberContext';
+const StringContext = createContext(contextData.string);
+StringContext.displayName = 'StringContext';
+const SymbolContext = createContext(contextData.symbol);
+SymbolContext.displayName = 'SymbolContext';
+const NullContext = createContext(null);
+NullContext.displayName = 'NullContext';
+const UndefinedContext = createContext(undefined);
+UndefinedContext.displayName = 'UndefinedContext';
+
+class ModernContextType extends Component {
+ static contextType: ReactContext = ModernContext;
+
+ render(): any {
+ return formatContextForDisplay('ModernContextType', this.context);
+ }
+}
+
+function FunctionalContextConsumer() {
+ const value = useContext(StringContext);
+ return formatContextForDisplay('FunctionalContextConsumer', value);
+}
+
+const StringContextWithUpdates = createContext({
+ string: contextData.string,
+ setString: (string: string) => {},
+});
+const StringContextWithUpdates2 = createContext({
+ string2: contextData.string,
+ setString2: (string: string) => {},
+});
+
+function FunctionalContextProviderWithContextUpdates() {
+ const [string, setString] = useState(contextData.string);
+ const [string2, setString2] = useState(contextData.string);
+ const value = {string, setString};
+ const value2 = {string2, setString2};
+
+ return (
+
+
+
+
+
+ );
+}
+
+function FunctionalContextConsumerWithContextUpdates() {
+ const {string, setString} = useContext(StringContextWithUpdates);
+ const {string2, setString2} = useContext(StringContextWithUpdates2);
+ const [state, setState] = useState('state');
+
+ // $FlowFixMe[missing-local-annot]
+ const handleChange = e => setString(e.target.value);
+ // $FlowFixMe[missing-local-annot]
+ const handleChange2 = e => setString2(e.target.value);
+
+ return (
+ <>
+ {formatContextForDisplay(
+ 'FunctionalContextConsumerWithUpdates',
+ `context: ${string}, context 2: ${string2}`,
+ )}
+
+ context:
+
+
+ context 2:
+
+
+ {state}
+
+ test state:{' '}
+ setState(e.target.value)} />
+
+
+ >
+ );
+}
+
+class ModernClassContextProviderWithUpdates extends Component {
+ constructor(props: any) {
+ super(props);
+ this.setString = string => {
+ this.setState({string});
+ };
+
+ this.state = {
+ string: contextData.string,
+ setString: this.setString,
+ };
+ }
+
+ render(): any {
+ return (
+
+
+
+ );
+ }
+}
+
+class ModernClassContextConsumerWithUpdates extends Component {
+ render(): any {
+ return (
+
+ {({string, setString}: {string: string, setString: string => void}) => (
+ <>
+ {formatContextForDisplay(
+ 'ModernClassContextConsumerWithUpdates',
+ string,
+ )}
+ setString(e.target.value)} />
+ >
+ )}
+
+ );
+ }
+}
+
+type LegacyContextState = {
+ supportsLegacyContext: boolean,
+};
+class LegacyContext extends React.Component {
+ state: LegacyContextState = {supportsLegacyContext: true};
+
+ static getDerivedStateFromError(error: any): LegacyContextState {
+ return {supportsLegacyContext: false};
+ }
+
+ componentDidCatch(error: any, info: any) {
+ console.info(
+ 'Assuming legacy context is not supported in this React version due to: ',
+ error,
+ info,
+ );
+ }
+
+ render(): React.Node {
+ if (!this.state.supportsLegacyContext) {
+ return This version of React does not support legacy context.
;
+ }
+
+ return (
+
+
+
+
+
+
+ );
+ }
+}
+
+export default function Contexts(): React.Node {
+ return (
+
+
Contexts
+
+
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('ModernContext.Consumer', value)
+ }
+
+
+
+
+
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('ArrayContext.Consumer', value)
+ }
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('BoolContext.Consumer', value)
+ }
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('FuncContext.Consumer', value)
+ }
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('NumberContext.Consumer', value)
+ }
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('StringContext.Consumer', value)
+ }
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('SymbolContext.Consumer', value)
+ }
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('NullContext.Consumer', value)
+ }
+
+
+ {(value: $FlowFixMe) =>
+ formatContextForDisplay('UndefinedContext.Consumer', value)
+ }
+
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js
new file mode 100644
index 0000000000000000000000000000000000000000..26af74714037d7121ad67dcf052fe786bc239bab
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js
@@ -0,0 +1,258 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {
+ createContext,
+ forwardRef,
+ Fragment,
+ memo,
+ useCallback,
+ useContext,
+ useDebugValue,
+ useEffect,
+ useOptimistic,
+ useState,
+ use,
+} from 'react';
+import {useFormState, useFormStatus} from 'react-dom';
+
+const object = {
+ string: 'abc',
+ number: 123,
+ boolean: true,
+ null: null,
+ undefined: undefined,
+ array: ['a', 'b', 'c'],
+ object: {foo: 1, bar: 2, baz: 3},
+};
+
+function useNestedInnerHook() {
+ return useState(123);
+}
+function useNestedOuterHook() {
+ return useNestedInnerHook();
+}
+
+function useCustomObject() {
+ useDebugValue(object);
+ return useState(123);
+}
+
+function useDeepHookA() {
+ useDebugValue('useDeepHookA');
+ useDeepHookB();
+}
+function useDeepHookB() {
+ useDebugValue('useDeepHookB');
+ useDeepHookC();
+}
+function useDeepHookC() {
+ useDebugValue('useDeepHookC');
+ useDeepHookD();
+}
+function useDeepHookD() {
+ useDebugValue('useDeepHookD');
+ useDeepHookE();
+}
+function useDeepHookE() {
+ useDebugValue('useDeepHookE');
+ useDeepHookF();
+}
+function useDeepHookF() {
+ useDebugValue('useDeepHookF');
+}
+
+const ContextA = createContext('A');
+const ContextB = createContext('B');
+
+function FunctionWithHooks(props: any, ref: React.RefSetter) {
+ const [count, updateCount] = useState(0);
+ // eslint-disable-next-line no-unused-vars
+ const contextValueA = useContext(ContextA);
+ useOptimistic(1);
+ use(ContextA);
+
+ // eslint-disable-next-line no-unused-vars
+ const [_, __] = useState(object);
+
+ // Custom hook with a custom debug label
+ const debouncedCount = useDebounce(count, 1000);
+
+ useCustomObject();
+
+ const onClick = useCallback(
+ function onClick() {
+ updateCount(count + 1);
+ },
+ [count],
+ );
+
+ // Tests nested custom hooks
+ useNestedOuterHook();
+
+ // eslint-disable-next-line no-unused-vars
+ const contextValueB = useContext(ContextB);
+
+ // Verify deep nesting doesn't break
+ useDeepHookA();
+
+ return Count: {debouncedCount} ;
+}
+const MemoWithHooks = memo(FunctionWithHooks);
+const ForwardRefWithHooks = forwardRef(FunctionWithHooks);
+
+function wrapWithHoc(
+ Component: (props: any, ref: React.RefSetter) => any,
+) {
+ function Hoc() {
+ return ;
+ }
+ // $FlowFixMe[prop-missing]
+ const displayName = Component.displayName || Component.name;
+ // $FlowFixMe[incompatible-type] found when upgrading Flow
+ Hoc.displayName = `withHoc(${displayName})`;
+ return Hoc;
+}
+const HocWithHooks = wrapWithHoc(FunctionWithHooks);
+
+const Suspendender = React.lazy<() => React.Node>(() => {
+ return new Promise<{default: () => React.Node, ...}>(resolve => {
+ setTimeout(() => {
+ resolve({
+ default: () => 'Finished!',
+ });
+ }, 3000);
+ });
+});
+function Transition() {
+ const [show, setShow] = React.useState(false);
+ const [isPending, startTransition] = React.useTransition();
+
+ return (
+
+
+ {isPending ? 'Pending' : null}
+ {show ? : null}
+
+ {!show && (
+ startTransition(() => setShow(true))}>
+ Transition
+
+ )}
+
+ );
+}
+
+function incrementWithDelay(previousState: number, formData: FormData) {
+ const incrementDelay = +formData.get('incrementDelay');
+ const shouldReject = formData.get('shouldReject');
+ const reason = formData.get('reason');
+
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ if (shouldReject) {
+ reject(reason);
+ } else {
+ resolve(previousState + 1);
+ }
+ }, incrementDelay);
+ });
+}
+
+function FormStatus() {
+ const status = useFormStatus();
+
+ return {JSON.stringify(status)} ;
+}
+
+function Forms() {
+ const [state, formAction] = useFormState(incrementWithDelay, 0);
+ return (
+
+ );
+}
+
+class ErrorBoundary extends React.Component<{children?: React$Node}> {
+ state: {error: any} = {error: null};
+ static getDerivedStateFromError(error: mixed): {error: any} {
+ return {error};
+ }
+ componentDidCatch(error: any, info: any) {
+ console.error(error, info);
+ }
+ render(): any {
+ if (this.state.error) {
+ return Error: {String(this.state.error)}
;
+ }
+ return this.props.children;
+ }
+}
+
+export default function CustomHooks(): React.Node {
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+// Below copied from https://usehooks.com/
+function useDebounce(value: number, delay: number) {
+ // State and setters for debounced value
+ const [debouncedValue, setDebouncedValue] = useState(value);
+
+ // Show the value in DevTools
+ useDebugValue(debouncedValue);
+
+ useEffect(
+ () => {
+ // Update debounced value after delay
+ const handler = setTimeout(() => {
+ setDebouncedValue(value);
+ }, delay);
+
+ // Cancel the timeout if value changes (also on delay change or unmount)
+ // This is how we prevent debounced value from updating if value is changed ...
+ // .. within the delay period. Timeout gets cleared and restarted.
+ return () => {
+ clearTimeout(handler);
+ };
+ },
+ [value, delay], // Only re-call effect if value or delay changes
+ );
+
+ return debouncedValue;
+}
+// Above copied from https://usehooks.com/
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CustomObject.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CustomObject.js
new file mode 100644
index 0000000000000000000000000000000000000000..f4de359f499fee68d9da560620e06195083b4486
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/CustomObject.js
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+class Custom {
+ _number = 42;
+ get number(): number {
+ return this._number;
+ }
+}
+
+export default function CustomObject(): React.Node {
+ return ;
+}
+
+function ChildComponent(props: any) {
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/EdgeCaseObjects.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/EdgeCaseObjects.js
new file mode 100644
index 0000000000000000000000000000000000000000..530152b70d1999f8bf71083f394a432f4114747d
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/EdgeCaseObjects.js
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+const objectWithModifiedHasOwnProperty = {
+ foo: 'abc',
+ bar: 123,
+ hasOwnProperty: true,
+};
+
+const objectWithNullProto = Object.create(null);
+// $FlowFixMe[prop-missing] found when upgrading Flow
+objectWithNullProto.foo = 'abc';
+// $FlowFixMe[prop-missing] found when upgrading Flow
+objectWithNullProto.bar = 123;
+
+export default function EdgeCaseObjects(): React.Node {
+ return (
+
+ );
+}
+
+function ChildComponent(props: any) {
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/InspectableElements.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/InspectableElements.js
new file mode 100644
index 0000000000000000000000000000000000000000..34f46774b188bc7ce3c27b46e19116c46363556f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/InspectableElements.js
@@ -0,0 +1,45 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {Fragment} from 'react';
+import UnserializableProps from './UnserializableProps';
+import CircularReferences from './CircularReferences';
+import Contexts from './Contexts';
+import CustomHooks from './CustomHooks';
+import CustomObject from './CustomObject';
+import EdgeCaseObjects from './EdgeCaseObjects.js';
+import NestedProps from './NestedProps';
+import SimpleValues from './SimpleValues';
+import SymbolKeys from './SymbolKeys';
+import UseMemoCache from './UseMemoCache';
+import UseEffectEvent from './UseEffectEvent';
+import UseSyncExternalStore from './UseSyncExternalStore';
+
+// TODO Add Immutable JS example
+
+export default function InspectableElements(): React.Node {
+ return (
+
+ Inspectable elements
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/NestedProps.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/NestedProps.js
new file mode 100644
index 0000000000000000000000000000000000000000..7be7526829bc70d5fda8fd1fcb037186861e3d51
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/NestedProps.js
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+const object = {
+ string: 'abc',
+ longString: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKJLMNOPQRSTUVWXYZ1234567890',
+ emptyString: '',
+ number: 123,
+ boolean: true,
+ undefined: undefined,
+ null: null,
+};
+
+export default function ObjectProps(): React.Node {
+ return (
+
+ );
+}
+
+function ChildComponent(props: any) {
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/SimpleValues.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/SimpleValues.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a17dc2279cbe72e6c88276dfbe29474d12959f3
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/SimpleValues.js
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {Component} from 'react';
+
+function noop() {}
+
+export default class SimpleValues extends Component {
+ anonymousFunction: () => void = () => {};
+
+ render(): React.Node {
+ return (
+
+ );
+ }
+}
+
+function ChildComponent(props: any) {
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/SymbolKeys.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/SymbolKeys.js
new file mode 100644
index 0000000000000000000000000000000000000000..0bd1ee258c3a443b727946b49e3bb96553d68fb3
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/SymbolKeys.js
@@ -0,0 +1,82 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+const base = Object.create(Object.prototype, {
+ enumerableStringBase: {
+ value: 1,
+ writable: true,
+ enumerable: true,
+ configurable: true,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [Symbol('enumerableSymbolBase')]: {
+ value: 1,
+ writable: true,
+ enumerable: true,
+ configurable: true,
+ },
+ nonEnumerableStringBase: {
+ value: 1,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [Symbol('nonEnumerableSymbolBase')]: {
+ value: 1,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ },
+});
+
+const data = Object.create(base, {
+ enumerableString: {
+ value: 2,
+ writable: true,
+ enumerable: true,
+ configurable: true,
+ },
+ nonEnumerableString: {
+ value: 3,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ },
+ [123]: {
+ value: 3,
+ writable: true,
+ enumerable: true,
+ configurable: true,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [Symbol('nonEnumerableSymbol')]: {
+ value: 2,
+ writable: true,
+ enumerable: false,
+ configurable: true,
+ },
+ // $FlowFixMe[invalid-computed-prop]
+ [Symbol('enumerableSymbol')]: {
+ value: 3,
+ writable: true,
+ enumerable: true,
+ configurable: true,
+ },
+});
+
+export default function SymbolKeys(): React.Node {
+ return ;
+}
+
+function ChildComponent(props: any) {
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js
new file mode 100644
index 0000000000000000000000000000000000000000..2c279a1bdbf87e31ac688a629a7d45af704c0a98
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js
@@ -0,0 +1,66 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import Immutable from 'immutable';
+
+const set = new Set(['abc', 123]);
+const map = new Map([
+ ['name', 'Brian'],
+ ['food', 'sushi'],
+]);
+const setOfSets = new Set([new Set(['a', 'b', 'c']), new Set([1, 2, 3])]);
+const mapOfMaps = new Map([
+ ['first', map],
+ ['second', map],
+]);
+const typedArray = Int8Array.from([100, -100, 0]);
+const arrayBuffer = typedArray.buffer;
+const dataView = new DataView(arrayBuffer);
+const immutable = Immutable.fromJS({
+ a: [{hello: 'there'}, 'fixed', true],
+ b: 123,
+ c: {
+ '1': 'xyz',
+ xyz: 1,
+ },
+});
+const bigInt = BigInt(123);
+
+class Foo {
+ flag = false;
+ object: Object = {
+ a: {b: {c: {d: 1}}},
+ };
+}
+
+export default function UnserializableProps(): React.Node {
+ return (
+
+ );
+}
+
+function ChildComponent(props: any) {
+ return (
+ <>
+ {props.bigInt}
+ >
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseEffectEvent.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseEffectEvent.js
new file mode 100644
index 0000000000000000000000000000000000000000..020246e8a4a710424c2826fab72a1f0107a44646
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseEffectEvent.js
@@ -0,0 +1,34 @@
+import * as React from 'react';
+
+const {useState, useEffect} = React;
+const useEffectEvent =
+ React.useEffectEvent || React.experimental_useEffectEvent;
+
+export default function UseEffectEvent(): React.Node {
+ return (
+ <>
+
+
+ >
+ );
+}
+
+function SingleHookCase() {
+ const onClick = useEffectEvent(() => {});
+
+ return
;
+}
+
+function useCustomHook() {
+ const [state, setState] = useState();
+ const onClick = useEffectEvent(() => {});
+ useEffect(() => {});
+
+ return [state, setState, onClick];
+}
+
+function HookTreeCase() {
+ const onClick = useCustomHook();
+
+ return
;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseMemoCache.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseMemoCache.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a3568c40dc0d8d2032d6cfd63ec9276865da216
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseMemoCache.js
@@ -0,0 +1,8 @@
+import * as React from 'react';
+import {c as useMemoCache} from 'react/compiler-runtime';
+
+export default function UseMemoCache(): React.Node {
+ useMemoCache(1);
+
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseSyncExternalStore.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseSyncExternalStore.js
new file mode 100644
index 0000000000000000000000000000000000000000..decb10b2db2d56cd1c5c6f65d2823b1b071cdb8d
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/UseSyncExternalStore.js
@@ -0,0 +1,133 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+const {useState, useEffect, useSyncExternalStore} = React;
+
+// Create a simple external store for demonstratio
+function createStore(initialValue: T): {
+ subscribe: (cb: () => void) => () => any,
+ getSnapshot: () => T,
+ setValue: (newValue: T) => void,
+} {
+ let value = initialValue;
+ const subscribers = new Set<() => void>();
+
+ return {
+ subscribe(callback) {
+ subscribers.add(callback);
+ return () => subscribers.delete(callback);
+ },
+ getSnapshot() {
+ return value;
+ },
+ setValue(newValue) {
+ value = newValue;
+ subscribers.forEach(callback => callback());
+ },
+ };
+}
+
+const counterStore = createStore(0);
+const themeStore = createStore('light');
+
+export default function UseSyncExternalStore(): React.Node {
+ return (
+ <>
+ useSyncExternalStore()
+
+
+
+ >
+ );
+}
+
+function SingleHookCase(): React.Node {
+ const count = useSyncExternalStore(
+ counterStore.subscribe,
+ counterStore.getSnapshot,
+ );
+
+ return (
+
+
Single hook case
+
Count: {count}
+
counterStore.setValue(count + 1)}>
+ Increment
+
+
counterStore.setValue(count - 1)}>
+ Decrement
+
+
+ );
+}
+
+function useCounter() {
+ const count = useSyncExternalStore(
+ counterStore.subscribe,
+ counterStore.getSnapshot,
+ );
+ const [localState, setLocalState] = useState(0);
+
+ useEffect(() => {
+ // Some effect
+ }, [count]);
+
+ return {count, localState, setLocalState};
+}
+
+function HookTreeCase(): React.Node {
+ const {count, localState, setLocalState} = useCounter();
+
+ return (
+
+
Hook tree case
+
External count: {count}
+
Local state: {localState}
+
counterStore.setValue(count + 1)}>
+ Increment External
+
+
setLocalState(localState + 1)}>
+ Increment Local
+
+
+ );
+}
+
+function useTheme() {
+ const theme = useSyncExternalStore(
+ themeStore.subscribe,
+ themeStore.getSnapshot,
+ );
+
+ return theme;
+}
+
+function MultipleStoresCase() {
+ const count = useSyncExternalStore(
+ counterStore.subscribe,
+ counterStore.getSnapshot,
+ );
+ const theme = useTheme();
+
+ return (
+
+
Multiple stores case
+
Count: {count}
+
Theme: {theme}
+
+ themeStore.setValue(theme === 'light' ? 'dark' : 'light')
+ }>
+ Toggle Theme
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..b44bd1e79cc2352c85ce73121f2e726ad51572fb
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/InspectableElements/index.js
@@ -0,0 +1,12 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import InspectableElements from './InspectableElements';
+
+export default InspectableElements;
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/PartiallyStrictApp/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/PartiallyStrictApp/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..498755bc3b8e89e3edd222706cce7d338535a865
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/PartiallyStrictApp/index.js
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {StrictMode} from 'react';
+
+export default function PartiallyStrictApp(): React.Node {
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
+
+function Child() {
+ return ;
+}
+
+function StrictChild() {
+ return ;
+}
+
+function Grandchild() {
+ return null;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ReactNativeWeb/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/ReactNativeWeb/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..89049dafafd670165674555138b88a331d3c407c
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ReactNativeWeb/index.js
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {Fragment, useState} from 'react';
+import {Button, Text, View} from 'react-native-web';
+
+export default function ReactNativeWeb(): React.Node {
+ const [backgroundColor, setBackgroundColor] = useState('purple');
+ const toggleColor = () =>
+ setBackgroundColor(backgroundColor === 'purple' ? 'green' : 'purple');
+ return (
+
+ ReactNativeWeb
+
+ auto (default) - english LTR
+
+ {
+ '\u0623\u062D\u0628 \u0627\u0644\u0644\u063A\u0629 \u0627\u0644\u0639\u0631\u0628\u064A\u0629 auto (default) - arabic RTL'
+ }
+
+
+ left left left left left left left left left left left left left left
+ left
+
+
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/SearchableTable/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/SearchableTable/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..f9069c6dfe885293bc29a81043e45a2fa2fd771d
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/SearchableTable/index.js
@@ -0,0 +1,81 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {Fragment} from 'react';
+
+// A large tree of similarly-named components (Table, TableRow, TableCell, ...).
+// This mirrors a real virtualized table and is meant for exercising the
+// component-tree search box in DevTools:
+// 1. Open DevTools and search "Table" — there are 100+ matches.
+// 2. Type a number into the result-index field (left of "| N") to jump
+// directly to a specific match instead of scrolling/pressing Enter.
+// 3. Select a match, clear the search, then retype the same text — the
+// search advances to the *next* match instead of snapping back.
+
+const ROWS = 25;
+const COLS = 4;
+
+function TableCell({row, col}: {row: number, col: number}): React.Node {
+ return {`r${row}c${col}`} ;
+}
+
+function TableColumnHeader({col}: {col: number}): React.Node {
+ return {`Column ${col}`} ;
+}
+
+function TableRow({row}: {row: number}): React.Node {
+ return (
+
+ {Array.from({length: COLS}, (_, col) => (
+
+ ))}
+
+ );
+}
+
+function TableHeaderRow(): React.Node {
+ return (
+
+ {Array.from({length: COLS}, (_, col) => (
+
+ ))}
+
+ );
+}
+
+function TableBody(): React.Node {
+ return (
+
+ {Array.from({length: ROWS}, (_, row) => (
+
+ ))}
+
+ );
+}
+
+function Table(): React.Node {
+ return (
+
+ );
+}
+
+export default function SearchableTable(): React.Node {
+ return (
+
+ Searchable Table
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/Segments/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/Segments/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..0677cfff777f88715eb4a9149686b7545c9d4878
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/Segments/index.js
@@ -0,0 +1,100 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+function deferred(
+ timeoutMS: number,
+ resolvedValue: T,
+ displayName: string,
+): Promise {
+ const promise = new Promise(resolve => {
+ setTimeout(() => resolve(resolvedValue), timeoutMS);
+ });
+ (promise as any).displayName = displayName;
+
+ return promise;
+}
+
+const title = deferred(100, 'Segmented Page Title', 'title');
+const content = deferred(
+ 400,
+ 'This is the content of a segmented page. It loads in multiple parts.',
+ 'content',
+);
+function Page(): React.Node {
+ return (
+
+ {title}
+ {content}
+
+ );
+}
+
+function InnerSegment({children}: {children: React.Node}): React.Node {
+ return (
+ <>
+ Inner Segment
+ Loading...}>
+
+ After inner
+
+ >
+ );
+}
+
+const cookies = deferred(200, 'Cookies: 🍪🍪🍪', 'cookies');
+function OuterSegment({children}: {children: React.Node}): React.Node {
+ return (
+ <>
+ Outer Segment
+ Loading outer}>
+ {cookies}
+ {children}
+ After outer
+
+ >
+ );
+}
+
+function Root({children}: {children: React.Node}): React.Node {
+ return (
+ <>
+ Root Segment
+ Loading root}>
+ {children}
+
+
+ >
+ );
+}
+
+const dynamicData = deferred(10, 'Dynamic Data: 📈📉📊', 'dynamicData');
+export default function Segments(): React.Node {
+ return (
+ <>
+ {dynamicData}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/SuspenseTree/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/SuspenseTree/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..f9b687cbc8792fd11af9d8121783c538e774c676
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/SuspenseTree/index.js
@@ -0,0 +1,370 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {
+ Fragment,
+ Suspense,
+ unstable_SuspenseList as SuspenseList,
+ useReducer,
+ useState,
+} from 'react';
+
+function SuspenseTree(): React.Node {
+ return (
+
+ Suspense
+ Primary to Fallback Cycle
+
+ Fallback to Primary Cycle
+
+
+
+
+
+
+ );
+}
+
+function IgnoreMePassthrough({children}: {children: React$Node}) {
+ return {children} ;
+}
+
+const suspenseTreeOperationsChildren = {
+ a: (
+
+ A
+
+ ),
+ b: (
+
+ B
+
+ ),
+ c: (
+
+
+ C
+
+
+ ),
+ d: (
+
+ D
+
+ ),
+ e: (
+
+
+
+ e1
+
+
+
+
+ e2
+
+
+
+ ),
+ eReordered: (
+
+
+
+ e2
+
+
+
+
+ e1
+
+
+
+ ),
+};
+
+function SuspenseTreeOperations() {
+ const initialChildren: any[] = [
+ suspenseTreeOperationsChildren.a,
+ suspenseTreeOperationsChildren.b,
+ suspenseTreeOperationsChildren.c,
+ suspenseTreeOperationsChildren.d,
+ suspenseTreeOperationsChildren.e,
+ ];
+ const [children, dispatch] = useReducer(
+ (
+ pendingState: any[],
+ action: 'toggle-mount' | 'reorder' | 'reorder-within-filtered',
+ ): React$Node[] => {
+ switch (action) {
+ case 'toggle-mount':
+ if (pendingState.length === 5) {
+ return [
+ suspenseTreeOperationsChildren.a,
+ suspenseTreeOperationsChildren.b,
+ suspenseTreeOperationsChildren.c,
+ suspenseTreeOperationsChildren.d,
+ ];
+ } else {
+ return [
+ suspenseTreeOperationsChildren.a,
+ suspenseTreeOperationsChildren.b,
+ suspenseTreeOperationsChildren.c,
+ suspenseTreeOperationsChildren.d,
+ suspenseTreeOperationsChildren.e,
+ ];
+ }
+ case 'reorder':
+ if (pendingState[1] === suspenseTreeOperationsChildren.b) {
+ return [
+ suspenseTreeOperationsChildren.a,
+ suspenseTreeOperationsChildren.c,
+ suspenseTreeOperationsChildren.b,
+ suspenseTreeOperationsChildren.d,
+ suspenseTreeOperationsChildren.e,
+ ];
+ } else {
+ return [
+ suspenseTreeOperationsChildren.a,
+ suspenseTreeOperationsChildren.b,
+ suspenseTreeOperationsChildren.c,
+ suspenseTreeOperationsChildren.d,
+ suspenseTreeOperationsChildren.e,
+ ];
+ }
+ case 'reorder-within-filtered':
+ if (pendingState[4] === suspenseTreeOperationsChildren.e) {
+ return [
+ suspenseTreeOperationsChildren.a,
+ suspenseTreeOperationsChildren.b,
+ suspenseTreeOperationsChildren.c,
+ suspenseTreeOperationsChildren.d,
+ suspenseTreeOperationsChildren.eReordered,
+ ];
+ } else {
+ return [
+ suspenseTreeOperationsChildren.a,
+ suspenseTreeOperationsChildren.b,
+ suspenseTreeOperationsChildren.c,
+ suspenseTreeOperationsChildren.d,
+ suspenseTreeOperationsChildren.e,
+ ];
+ }
+ default:
+ return pendingState;
+ }
+ },
+ initialChildren,
+ );
+
+ return (
+ <>
+ dispatch('toggle-mount')}>Toggle Mount
+ dispatch('reorder')}>Reorder
+ dispatch('reorder-within-filtered')}>
+ Reorder Within Filtered
+
+
+
+
+ >
+ );
+}
+
+function EmptySuspense() {
+ return ;
+}
+
+// $FlowFixMe[missing-local-annot]
+function PrimaryFallbackTest({initialSuspend}) {
+ const [suspend, setSuspend] = useState(initialSuspend);
+ const [fallbackStepIndex, fallbackStep] = useTestSequence(
+ 'fallback',
+ Fallback1,
+ Fallback2,
+ );
+ const [, primaryStep] = useTestSequence('primary', Primary1, Primary2);
+ return (
+
+
+ setSuspend(e.target.checked)}
+ type="checkbox"
+ />
+ Suspend
+
+
+
+ {suspend ? (
+
+ ) : (
+ primaryStep
+ )}
+
+
+ );
+}
+
+function useTestSequence(label: string, T1: any => any, T2: any => any) {
+ const [step, setStep] = useState(0);
+ const next: $FlowFixMe = (
+ setStep(s => (s + 1) % allSteps.length)}>
+ next {label} content
+
+ );
+ const allSteps: $FlowFixMe = [
+ {next} ,
+
+ {next} mount
+ ,
+
+ {next} update
+ ,
+
+ {next} several different {' '}
+ children
+ ,
+
+ {next} goodbye
+ ,
+ ];
+ return [step, allSteps[step]];
+}
+
+function NestedSuspenseTest() {
+ return (
+
+ Nested Suspense
+ Loading outer}>
+
+
+
+ );
+}
+
+function Parent() {
+ return (
+
+
Loading inner 1}>
+ Hello
+ {' '}
+
Loading inner 2}>
+ World
+
+
+
This will never load}>
+
+
+
+
+
+
+
+ );
+}
+
+function SuspenseListTest() {
+ return (
+ <>
+ SuspenseList
+
+
+
Loading 1}>
+ Hello
+
+
+
+
+
+
+
Loading 2}>
+ World
+
+
+
+ >
+ );
+}
+
+function LoadLater() {
+ const [loadChild, setLoadChild] = useState(false);
+ return (
+ setLoadChild(true)}>Click to load
+ }
+ name="LoadLater">
+ {loadChild ? (
+ setLoadChild(false)}>
+ Loaded! Click to suspend again.
+
+ ) : (
+
+ )}
+
+ );
+}
+
+function readRecord(promise: any): any {
+ if (typeof React.use === 'function') {
+ // eslint-disable-next-line react-hooks-published/rules-of-hooks
+ return React.use(promise);
+ }
+ switch (promise.status) {
+ case 'pending':
+ throw promise;
+ case 'rejected':
+ throw promise.reason;
+ case 'fulfilled':
+ return promise.value;
+ default:
+ promise.status = 'pending';
+ promise.then(
+ value => {
+ promise.status = 'fulfilled';
+ promise.value = value;
+ },
+ reason => {
+ promise.status = 'rejected';
+ promise.reason = reason;
+ },
+ );
+ throw promise;
+ }
+}
+
+const nevers = new Map>();
+function Never({id}: {id: string}) {
+ let promise = nevers.get(id);
+ if (!promise) {
+ promise = new Promise(() => {});
+ (promise as any).displayName = id;
+ nevers.set(id, promise);
+ }
+ readRecord(promise);
+}
+
+function Fallback1({prop, ...rest}: any) {
+ return ;
+}
+
+function Fallback2({prop, ...rest}: any) {
+ return ;
+}
+
+function Primary1({prop, ...rest}: any) {
+ return ;
+}
+
+function Primary2({prop, ...rest}: any) {
+ return ;
+}
+
+export default SuspenseTree;
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/List.css b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/List.css
new file mode 100644
index 0000000000000000000000000000000000000000..05834028402dfb90c6dde3be124867e17ccf5a86
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/List.css
@@ -0,0 +1,16 @@
+.Input {
+ font-size: 1rem;
+ padding: 0.25rem;
+}
+
+.IconButton {
+ padding: 0.25rem;
+ border: none;
+ background: none;
+ cursor: pointer;
+}
+
+.List {
+ margin: 0.5rem 0 0;
+ padding: 0;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/List.js b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/List.js
new file mode 100644
index 0000000000000000000000000000000000000000..68f0b120ffdecd9284c9d4a9da0be7b9a0cf0355
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/List.js
@@ -0,0 +1,119 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {Fragment, useCallback, useState} from 'react';
+import ListItem from './ListItem';
+import styles from './List.css';
+
+export type Item = {
+ id: number,
+ isComplete: boolean,
+ text: string,
+};
+
+type Props = {};
+
+export default function List(props: Props): React.Node {
+ const [newItemText, setNewItemText] = useState('');
+ const [items, setItems] = useState>([
+ {id: 1, isComplete: true, text: 'First'},
+ {id: 2, isComplete: true, text: 'Second'},
+ {id: 3, isComplete: false, text: 'Third'},
+ ]);
+ const [uid, setUID] = useState(4);
+
+ const handleClick = useCallback(() => {
+ if (newItemText !== '') {
+ setItems([
+ ...items,
+ {
+ id: uid,
+ isComplete: false,
+ text: newItemText,
+ },
+ ]);
+ setUID(uid + 1);
+ setNewItemText('');
+ }
+ }, [newItemText, items, uid]);
+
+ const handleKeyPress = useCallback(
+ (event: $FlowFixMe) => {
+ if (event.key === 'Enter') {
+ handleClick();
+ }
+ },
+ [handleClick],
+ );
+
+ const handleChange = useCallback(
+ (event: $FlowFixMe) => {
+ setNewItemText(event.currentTarget.value);
+ },
+ [setNewItemText],
+ );
+
+ const removeItem = useCallback(
+ (itemToRemove: $FlowFixMe) =>
+ setItems(items.filter(item => item !== itemToRemove)),
+ [items],
+ );
+
+ const toggleItem = useCallback(
+ (itemToToggle: $FlowFixMe) => {
+ // Dont use indexOf()
+ // because editing props in DevTools creates a new Object.
+ const index = items.findIndex(item => item.id === itemToToggle.id);
+
+ setItems(
+ items
+ .slice(0, index)
+ .concat({
+ ...itemToToggle,
+ isComplete: !itemToToggle.isComplete,
+ })
+ .concat(items.slice(index + 1)),
+ );
+ },
+ [items],
+ );
+
+ return (
+
+ List
+
+
+
+ ➕
+
+
+
+ {items.map(item => (
+
+ ))}
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/ListItem.css b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/ListItem.css
new file mode 100644
index 0000000000000000000000000000000000000000..77c666251cc293a054ca46e500c45268a834cd82
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/ListItem.css
@@ -0,0 +1,23 @@
+.ListItem {
+ list-style-type: none;
+}
+
+.Input {
+ cursor: pointer;
+}
+
+.Label {
+ cursor: pointer;
+ padding: 0.25rem;
+ color: #555;
+}
+.Label:hover {
+ color: #000;
+}
+
+.IconButton {
+ padding: 0.25rem;
+ border: none;
+ background: none;
+ cursor: pointer;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/ListItem.js b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/ListItem.js
new file mode 100644
index 0000000000000000000000000000000000000000..d8dbb721e8582bfbc4f6d6501b9977cc6f3a6841
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/ListItem.js
@@ -0,0 +1,49 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {memo, useCallback} from 'react';
+import styles from './ListItem.css';
+
+import type {Item} from './List';
+
+type Props = {
+ item: Item,
+ removeItem: (item: Item) => void,
+ toggleItem: (item: Item) => void,
+};
+
+function ListItem({item, removeItem, toggleItem}: Props) {
+ const handleDelete = useCallback(() => {
+ removeItem(item);
+ }, [item, removeItem]);
+
+ const handleToggle = useCallback(() => {
+ toggleItem(item);
+ }, [item, toggleItem]);
+
+ return (
+
+
+ 🗑
+
+
+ {' '}
+ {item.text}
+
+
+ );
+}
+
+export default memo(ListItem) as component(...props: Props);
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..9a35039f3c1c5af73e74c4cb665fd3631feff253
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/ToDoList/index.js
@@ -0,0 +1,12 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import List from './List';
+
+export default List;
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/Toggle/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/Toggle/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..98b816d8837ddbec704a92b9ad244df5744a813b
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/Toggle/index.js
@@ -0,0 +1,22 @@
+import * as React from 'react';
+import {useState} from 'react';
+
+export default function Toggle() {
+ const [show, setShow] = useState(false);
+ return (
+ <>
+ Toggle
+
+ <>
+ setShow(s => !s)}>Show child
+ {show && ' '}
+ {show && Hello }
+ >
+
+ >
+ );
+}
+
+function Greeting({children}) {
+ return {children}
;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/TraceUpdatesTest/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/TraceUpdatesTest/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..dd847ad7aef457f20d4520c81e137ea56d0cb0ee
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/TraceUpdatesTest/index.js
@@ -0,0 +1,87 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {useRef, useState} from 'react';
+
+const Counter = () => {
+ const [count, setCount] = useState(0);
+
+ return (
+
+
Count: {count}
+ setCount(c => c + 1)}>Increment
+
+ );
+};
+
+function DialogComponent() {
+ const dialogRef = useRef(null);
+
+ const openDialog = () => {
+ if (dialogRef.current) {
+ dialogRef.current.showModal();
+ }
+ };
+
+ const closeDialog = () => {
+ if (dialogRef.current) {
+ dialogRef.current.close();
+ }
+ };
+
+ return (
+
+ Open Dialog
+
+ Dialog Content
+
+ Close
+
+
+ );
+}
+
+function RegularComponent() {
+ return (
+
+
Regular Component
+
+
+ );
+}
+
+export default function TraceUpdatesTest(): React.Node {
+ return (
+
+
TraceUpdates Test
+
+
+
Standard Component
+
+
+
+
+
Dialog Component (top-layer element)
+
+
+
+
+
How to Test:
+
+ Open DevTools Components panel
+ Enable "Highlight updates when components render" in settings
+ Click increment buttons and observe highlights
+ Open the dialog and test increments there as well
+
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/console.js b/github_code/react__react/packages/react-devtools-shell/src/app/console.js
new file mode 100644
index 0000000000000000000000000000000000000000..5fecc27c115a1fa9312583ccd73791dda39b09ff
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/console.js
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+function ignoreStrings(
+ methodName: string,
+ stringsToIgnore: Array,
+): void {
+ // $FlowFixMe[prop-missing] index access only allowed for objects with index keys
+ console[methodName] = (...args: $ReadOnlyArray) => {
+ const maybeString = args[0];
+ if (typeof maybeString === 'string') {
+ for (let i = 0; i < stringsToIgnore.length; i++) {
+ if (maybeString.startsWith(stringsToIgnore[i])) {
+ return;
+ }
+ }
+ }
+
+ // HACKY In the test harness, DevTools overrides the parent window's console.
+ // Our test app code uses the iframe's console though.
+ // To simulate a more accurate end-to-end environment,
+ // the shell's console patching should pass through to the parent override methods.
+ window.parent.console[methodName](...args);
+ };
+}
+
+export function ignoreErrors(errorsToIgnore: Array): void {
+ ignoreStrings('error', errorsToIgnore);
+}
+
+export function ignoreWarnings(warningsToIgnore: Array): void {
+ ignoreStrings('warn', warningsToIgnore);
+}
+
+export function ignoreLogs(logsToIgnore: Array): void {
+ ignoreStrings('log', logsToIgnore);
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/devtools.js b/github_code/react__react/packages/react-devtools-shell/src/app/devtools.js
new file mode 100644
index 0000000000000000000000000000000000000000..dcf9b46afc746a4b02c910c542e91dae22c94336
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/devtools.js
@@ -0,0 +1,90 @@
+/** @flow */
+
+import {createElement} from 'react';
+import {createRoot} from 'react-dom/client';
+import {
+ activate as activateBackend,
+ initialize as initializeBackend,
+} from 'react-devtools-inline/backend';
+import {initialize as initializeFrontend} from 'react-devtools-inline/frontend';
+import {initDevTools} from 'react-devtools-shared/src/devtools';
+
+// This is a pretty gross hack to make the runtime loaded named-hooks-code work.
+// TODO (Webpack 5) Hoepfully we can remove this once we upgrade to Webpack 5.
+// $FlowFixMe[cannot-resolve-name]
+__webpack_public_path__ = '/dist/'; // eslint-disable-line no-undef
+
+const iframe = document.getElementById('target') as any as HTMLIFrameElement;
+
+const {contentDocument, contentWindow} = iframe;
+
+// Helps with positioning Overlay UI.
+contentWindow.__REACT_DEVTOOLS_TARGET_WINDOW__ = window;
+
+initializeBackend(contentWindow);
+
+// Initialize the front end and activate the backend early so that we are able
+// to pass console settings in local storage to the backend before initial render
+const DevTools = initializeFrontend(contentWindow);
+
+// Activate the backend only once the DevTools frontend Store has been initialized.
+// Otherwise the Store may miss important initial tree op codes.
+activateBackend(contentWindow);
+
+const container = document.getElementById('devtools') as any as HTMLElement;
+
+let isTestAppMounted = true;
+
+const mountButton = document.getElementById(
+ 'mountButton',
+) as any as HTMLButtonElement;
+mountButton.addEventListener('click', function () {
+ if (isTestAppMounted) {
+ if (typeof window.unmountTestApp === 'function') {
+ window.unmountTestApp();
+ mountButton.innerText = 'Mount test app';
+ isTestAppMounted = false;
+ }
+ } else {
+ if (typeof window.mountTestApp === 'function') {
+ window.mountTestApp();
+ mountButton.innerText = 'Unmount test app';
+ isTestAppMounted = true;
+ }
+ }
+});
+
+// TODO (Webpack 5) Hopefully we can remove this prop after the Webpack 5 migration.
+function hookNamesModuleLoaderFunction() {
+ return import('react-devtools-inline/hookNames');
+}
+
+inject('dist/app-index.js', () => {
+ initDevTools({
+ connect(cb) {
+ const root = createRoot(container);
+ root.render(
+ createElement(DevTools, {
+ browserTheme: 'light',
+ enabledInspectedElementContextMenu: true,
+ hookNamesModuleLoaderFunction,
+ showTabBar: true,
+ warnIfLegacyBackendDetected: true,
+ warnIfUnsupportedVersionDetected: true,
+ }),
+ );
+ },
+
+ onReload(reloadFn) {
+ iframe.onload = reloadFn;
+ },
+ });
+});
+
+function inject(sourcePath: string, callback: () => void) {
+ const script = contentDocument.createElement('script');
+ script.onload = callback;
+ script.src = sourcePath;
+
+ (contentDocument.body as any as HTMLBodyElement).appendChild(script);
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/index.js b/github_code/react__react/packages/react-devtools-shell/src/app/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..16c14070705766f2c4b2e715f34372559f9df72c
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/index.js
@@ -0,0 +1,136 @@
+/** @flow */
+
+// This test harness mounts each test app as a separate root to test multi-root applications.
+
+import semver from 'semver';
+
+import {createElement} from 'react';
+import {createRoot} from 'react-dom/client';
+
+import DeeplyNestedComponents from './DeeplyNestedComponents';
+import Iframe from './Iframe';
+import EditableProps from './EditableProps';
+import ElementTypes from './ElementTypes';
+import Hydration from './Hydration';
+import InspectableElements from './InspectableElements';
+import ReactNativeWeb from './ReactNativeWeb';
+import ToDoList from './ToDoList';
+import Toggle from './Toggle';
+import ErrorBoundaries from './ErrorBoundaries';
+import PartiallyStrictApp from './PartiallyStrictApp';
+import Segments from './Segments';
+import SuspenseTree from './SuspenseTree';
+import SearchableTable from './SearchableTable';
+import ActivityTree from './ActivityTree';
+import TraceUpdatesTest from './TraceUpdatesTest';
+import {ignoreErrors, ignoreLogs, ignoreWarnings} from './console';
+
+import './styles.css';
+
+// DevTools intentionally tests compatibility with certain legacy APIs.
+// Suppress their error messages in the local dev shell,
+// because they might mask other more serious error messages.
+ignoreErrors([
+ 'Warning: Legacy context API',
+ 'Warning: Unsafe lifecycle methods',
+ 'Warning: %s is deprecated in StrictMode.', // findDOMNode
+ 'Warning: ReactDOM.render was removed in React 19',
+ 'Warning: react-test-renderer is deprecated',
+ // Ignore prefixed and not prefixed since I don't know which
+ // React versions are being tested by this code.
+ 'Legacy context API',
+ 'Unsafe lifecycle methods',
+ '%s is deprecated in StrictMode.', // findDOMNode
+ 'ReactDOM.render was removed in React 19',
+ 'react-test-renderer is deprecated',
+]);
+ignoreWarnings([
+ 'Warning: componentWillReceiveProps has been renamed',
+ 'componentWillReceiveProps has been renamed',
+]);
+ignoreLogs([]);
+
+const unmountFunctions: Array<() => void | boolean> = [];
+
+function createContainer() {
+ const container = document.createElement('div');
+
+ (document.body as any as HTMLBodyElement).appendChild(container);
+
+ return container;
+}
+
+function mountApp(App: () => React$Node) {
+ const container = createContainer();
+
+ const root = createRoot(container);
+ root.render(createElement(App));
+
+ unmountFunctions.push(() => root.unmount());
+}
+
+// $FlowFixMe[missing-local-annot]
+function mountStrictApp(App) {
+ function StrictRoot() {
+ return createElement(App);
+ }
+
+ const container = createContainer();
+
+ const root = createRoot(container, {unstable_strictMode: true});
+ root.render(createElement(StrictRoot));
+
+ unmountFunctions.push(() => root.unmount());
+}
+
+function mountLegacyApp(App: () => React$Node) {
+ // $FlowFixMe[prop-missing]: These are removed in 19.
+ const {render, unmountComponentAtNode} = require('react-dom');
+
+ function LegacyRender() {
+ return createElement(App);
+ }
+
+ const container = createContainer();
+
+ // $FlowFixMe[not-a-function]: These are removed in 19.
+ render(createElement(LegacyRender), container);
+
+ // $FlowFixMe[not-a-function]: These are removed in 19.
+ unmountFunctions.push(() => unmountComponentAtNode(container));
+}
+
+const shouldRenderLegacy = semver.lte(
+ process.env.E2E_APP_REACT_VERSION,
+ '18.2.0',
+);
+function mountTestApp() {
+ mountStrictApp(ToDoList);
+ mountApp(InspectableElements);
+ mountApp(Hydration);
+ mountApp(ElementTypes);
+ mountApp(EditableProps);
+ mountApp(ReactNativeWeb);
+ mountApp(Toggle);
+ mountApp(ErrorBoundaries);
+ mountApp(SuspenseTree);
+ mountApp(SearchableTable);
+ mountApp(DeeplyNestedComponents);
+ mountApp(Iframe);
+ mountApp(ActivityTree);
+ mountApp(TraceUpdatesTest);
+ mountApp(Segments);
+
+ if (shouldRenderLegacy) {
+ mountLegacyApp(PartiallyStrictApp);
+ }
+}
+
+function unmountTestApp() {
+ unmountFunctions.forEach(fn => fn());
+}
+
+mountTestApp();
+
+window.parent.mountTestApp = mountTestApp;
+window.parent.unmountTestApp = unmountTestApp;
diff --git a/github_code/react__react/packages/react-devtools-shell/src/app/styles.css b/github_code/react__react/packages/react-devtools-shell/src/app/styles.css
new file mode 100644
index 0000000000000000000000000000000000000000..2a995314c154f8d4bc9226c69e0221bdac44c861
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/app/styles.css
@@ -0,0 +1,13 @@
+body {
+ /* GitHub.com frontend fonts */
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial,
+ sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
+ font-size: 14px;
+ line-height: 1.5;
+}
+
+h1 {
+ font-size: 1.5rem;
+ font-weight: bold;
+ margin-bottom: 0.5rem;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/e2e-apps/ListApp.js b/github_code/react__react/packages/react-devtools-shell/src/e2e-apps/ListApp.js
new file mode 100644
index 0000000000000000000000000000000000000000..58183467696d6950da20d9e9f8d7810979834367
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/e2e-apps/ListApp.js
@@ -0,0 +1,49 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import {useRef, useState} from 'react';
+
+export default function App(): React.Node {
+ return
;
+}
+
+function List() {
+ const [items, setItems] = useState(['one', 'two', 'three']);
+ const inputRef = useRef(null);
+
+ const addItem = () => {
+ const input = inputRef.current as any as HTMLInputElement;
+ const text = input.value;
+ input.value = '';
+
+ if (text) {
+ setItems([...items, text]);
+ }
+ };
+
+ return (
+ <>
+
+
+ Add Item
+
+
+ {items.map((label, index) => (
+
+ ))}
+
+ >
+ );
+}
+
+// $FlowFixMe[missing-local-annot]
+function ListItem({label}) {
+ return {label} ;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js b/github_code/react__react/packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js
new file mode 100644
index 0000000000000000000000000000000000000000..056bd7b2243becab6cc4f9af8b682e2a2f58be01
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/e2e-apps/ListAppLegacy.js
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+export default function App(): React.Node {
+ return
;
+}
+
+class List extends React.Component {
+ constructor(props: any) {
+ super(props);
+ this.state = {
+ items: ['one', 'two', 'three'],
+ };
+ }
+
+ addItem = () => {
+ if (this.inputRef && this.inputRef.value) {
+ this.setState({items: [...this.state.items, this.inputRef.value]});
+ this.inputRef.value = '';
+ }
+ };
+
+ render(): any {
+ return (
+
+
(this.inputRef = c)}
+ />
+
+ Add Item
+
+
+ {this.state.items.map((label, index) => (
+
+ ))}
+
+
+ );
+ }
+}
+
+// $FlowFixMe[missing-local-annot]
+function ListItem({label}) {
+ return {label} ;
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/app-legacy.js b/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/app-legacy.js
new file mode 100644
index 0000000000000000000000000000000000000000..54adbca815646958bd88f203f2962b432ecb1475
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/app-legacy.js
@@ -0,0 +1,35 @@
+/** @flow */
+
+// This test harness mounts each test app as a separate root to test multi-root applications.
+
+import * as React from 'react';
+import * as ReactDOM from 'react-dom';
+import ListApp from '../e2e-apps/ListApp';
+import ListAppLegacy from '../e2e-apps/ListAppLegacy';
+import {gte} from 'react-devtools-shared/src/backend/utils';
+
+const version = process.env.E2E_APP_REACT_VERSION;
+
+function mountApp(App: () => React$Node) {
+ const container = document.createElement('div');
+
+ (document.body as any as HTMLBodyElement).appendChild(container);
+
+ // $FlowFixMe[prop-missing]: These are removed in 19.
+ ReactDOM.render( , container);
+}
+function mountTestApp() {
+ // ListApp has hooks, which aren't available until 16.8.0
+ mountApp(gte(version, '16.8.0') ? ListApp : ListAppLegacy);
+}
+
+mountTestApp();
+
+// ReactDOM Test Selector APIs used by Playwright e2e tests
+// If they don't exist, we mock them
+window.parent.REACT_DOM_APP = {
+ createTestNameSelector: name => `[data-testname="${name}"]`,
+ findAllNodes: (container, nodes) =>
+ container.querySelectorAll(nodes.join(' ')),
+ ...ReactDOM,
+};
diff --git a/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/app.js b/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..2125369dde968a023f53b92d93fe2640ea3c7243
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/app.js
@@ -0,0 +1,30 @@
+/** @flow */
+
+// This test harness mounts each test app as a separate root to test multi-root applications.
+
+import * as React from 'react';
+import * as ReactDOMClient from 'react-dom/client';
+import ListApp from '../e2e-apps/ListApp';
+
+function mountApp(App: () => React$Node) {
+ const container = document.createElement('div');
+
+ (document.body as any as HTMLBodyElement).appendChild(container);
+
+ const root = ReactDOMClient.createRoot(container);
+ root.render( );
+}
+function mountTestApp() {
+ mountApp(ListApp);
+}
+
+mountTestApp();
+
+// ReactDOM Test Selector APIs used by Playwright e2e tests
+// If they don't exist, we mock them
+window.parent.REACT_DOM_APP = {
+ createTestNameSelector: name => `[data-testname="${name}"]`,
+ findAllNodes: (container, nodes) =>
+ container.querySelectorAll(nodes.join(' ')),
+ ...ReactDOMClient,
+};
diff --git a/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/devtools.js b/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/devtools.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e9ada823ca470fb48420dc08d1ee7d9d25351c2
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/e2e-regression/devtools.js
@@ -0,0 +1,59 @@
+import * as React from 'react';
+import * as ReactDOM from 'react-dom';
+import * as ReactDOMClient from 'react-dom/client';
+import {
+ activate as activateBackend,
+ initialize as initializeBackend,
+} from 'react-devtools-inline/backend';
+import {initialize as createDevTools} from 'react-devtools-inline/frontend';
+
+// This is a pretty gross hack to make the runtime loaded named-hooks-code work.
+// TODO (Webpack 5) Hoepfully we can remove this once we upgrade to Webpack 5.
+__webpack_public_path__ = '/dist/'; // eslint-disable-line no-undef
+
+// TODO (Webpack 5) Hopefully we can remove this prop after the Webpack 5 migration.
+function hookNamesModuleLoaderFunction() {
+ return import('react-devtools-inline/hookNames');
+}
+
+function inject(contentDocument, sourcePath, callback) {
+ const script = contentDocument.createElement('script');
+ script.onload = callback;
+ script.src = sourcePath;
+
+ ((contentDocument.body: any): HTMLBodyElement).appendChild(script);
+}
+
+function init(appIframe, devtoolsContainer, appSource) {
+ const {contentDocument, contentWindow} = appIframe;
+
+ initializeBackend(contentWindow);
+
+ const DevTools = createDevTools(contentWindow);
+
+ inject(contentDocument, appSource, () => {
+ ReactDOMClient.createRoot(devtoolsContainer).render(
+ ,
+ );
+ });
+
+ activateBackend(contentWindow);
+}
+
+const iframe = document.getElementById('iframe');
+const devtoolsContainer = document.getElementById('devtools');
+
+const {protocol, hostname} = window.location;
+const port = 8181; // secondary webpack server port
+init(
+ iframe,
+ devtoolsContainer,
+ `${protocol}//${hostname}:${port}/dist/e2e-app-regression.js`,
+);
+
+// ReactDOM Test Selector APIs used by Playwright e2e tests
+window.parent.REACT_DOM_DEVTOOLS =
+ 'createTestNameSelector' in ReactDOMClient ? ReactDOMClient : ReactDOM;
diff --git a/github_code/react__react/packages/react-devtools-shell/src/e2e/app.js b/github_code/react__react/packages/react-devtools-shell/src/e2e/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..265ebf8a7172078b53ef86c52bc79ea756cfe896
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/e2e/app.js
@@ -0,0 +1,20 @@
+/** @flow */
+
+// This test harness mounts each test app as a separate root to test multi-root applications.
+
+import * as React from 'react';
+import * as ReactDOMClient from 'react-dom/client';
+
+const container = document.createElement('div');
+
+(document.body as any as HTMLBodyElement).appendChild(container);
+
+// TODO We may want to parameterize this app
+// so that it can load things other than just ToDoList.
+const App = require('../e2e-apps/ListApp').default;
+
+const root = ReactDOMClient.createRoot(container);
+root.render( );
+
+// ReactDOM Test Selector APIs used by Playwright e2e tests
+window.parent.REACT_DOM_APP = ReactDOMClient;
diff --git a/github_code/react__react/packages/react-devtools-shell/src/e2e/devtools.js b/github_code/react__react/packages/react-devtools-shell/src/e2e/devtools.js
new file mode 100644
index 0000000000000000000000000000000000000000..89bc2b57f99c8cfe6ed126fa9bf1dd2a417f279c
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/e2e/devtools.js
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ *
+ * @noflow
+ */
+
+import * as React from 'react';
+import * as ReactDOMClient from 'react-dom/client';
+import {
+ activate as activateBackend,
+ initialize as initializeBackend,
+} from 'react-devtools-inline/backend';
+import {initialize as createDevTools} from 'react-devtools-inline/frontend';
+
+// This is a pretty gross hack to make the runtime loaded named-hooks-code work.
+// TODO (Webpack 5) Hoepfully we can remove this once we upgrade to Webpack 5.
+__webpack_public_path__ = '/dist/'; // eslint-disable-line no-undef
+
+// TODO (Webpack 5) Hopefully we can remove this prop after the Webpack 5 migration.
+function hookNamesModuleLoaderFunction() {
+ return import('react-devtools-inline/hookNames');
+}
+
+function inject(contentDocument, sourcePath, callback) {
+ const script = contentDocument.createElement('script');
+ script.onload = callback;
+ script.src = sourcePath;
+
+ ((contentDocument.body: any): HTMLBodyElement).appendChild(script);
+}
+
+function init(appIframe, devtoolsContainer, appSource) {
+ const {contentDocument, contentWindow} = appIframe;
+
+ initializeBackend(contentWindow);
+
+ const DevTools = createDevTools(contentWindow);
+
+ inject(contentDocument, appSource, () => {
+ ReactDOMClient.createRoot(devtoolsContainer).render(
+ ,
+ );
+ });
+
+ activateBackend(contentWindow);
+}
+
+const iframe = document.getElementById('iframe');
+const devtoolsContainer = document.getElementById('devtools');
+
+init(iframe, devtoolsContainer, 'dist/e2e-app.js');
+
+// ReactDOM Test Selector APIs used by Playwright e2e tests
+window.parent.REACT_DOM_DEVTOOLS = ReactDOMClient;
diff --git a/github_code/react__react/packages/react-devtools-shell/src/multi/devtools.js b/github_code/react__react/packages/react-devtools-shell/src/multi/devtools.js
new file mode 100644
index 0000000000000000000000000000000000000000..5549663cf6adae59b3c03cb679625eb26dd8e2d6
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/multi/devtools.js
@@ -0,0 +1,86 @@
+/**
+ * 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.
+ *
+ * @noflow
+ */
+
+import * as React from 'react';
+import {createRoot} from 'react-dom/client';
+import {
+ activate as activateBackend,
+ createBridge as createBackendBridge,
+ initialize as initializeBackend,
+} from 'react-devtools-inline/backend';
+import {
+ createBridge as createFrontendBridge,
+ createStore,
+ initialize as createDevTools,
+} from 'react-devtools-inline/frontend';
+import {__DEBUG__} from 'react-devtools-shared/src/constants';
+
+function inject(contentDocument, sourcePath, callback) {
+ const script = contentDocument.createElement('script');
+ script.onload = callback;
+ script.src = sourcePath;
+
+ ((contentDocument.body: any): HTMLBodyElement).appendChild(script);
+}
+
+function init(appIframe, devtoolsContainer, appSource) {
+ const {contentDocument, contentWindow} = appIframe;
+
+ // Wire each DevTools instance directly to its app.
+ // By default, DevTools dispatches "message" events on the window,
+ // but this means that only one instance of DevTools can live on a page.
+ const wall = {
+ _listeners: [],
+ listen(listener) {
+ if (__DEBUG__) {
+ console.log('[Shell] Wall.listen()');
+ }
+
+ wall._listeners.push(listener);
+ return () => {
+ const index = wall._listeners.indexOf(listener);
+ if (index !== -1) {
+ wall._listeners.splice(index, 1);
+ }
+ };
+ },
+ send(event, payload) {
+ if (__DEBUG__) {
+ console.log('[Shell] Wall.send()', {event, payload});
+ }
+
+ wall._listeners.forEach(listener => listener({event, payload}));
+ },
+ };
+
+ const backendBridge = createBackendBridge(contentWindow, wall);
+
+ initializeBackend(contentWindow);
+
+ const frontendBridge = createFrontendBridge(contentWindow, wall);
+ const store = createStore(frontendBridge);
+ const DevTools = createDevTools(contentWindow, {
+ bridge: frontendBridge,
+ store,
+ });
+
+ inject(contentDocument, appSource, () => {
+ createRoot(devtoolsContainer).render( );
+ });
+
+ activateBackend(contentWindow, {bridge: backendBridge});
+}
+
+const appIframeLeft = document.getElementById('iframe-left');
+const appIframeRight = document.getElementById('iframe-right');
+const devtoolsContainerLeft = document.getElementById('devtools-left');
+const devtoolsContainerRight = document.getElementById('devtools-right');
+
+init(appIframeLeft, devtoolsContainerLeft, 'dist/multi-left.js');
+init(appIframeRight, devtoolsContainerRight, 'dist/multi-right.js');
diff --git a/github_code/react__react/packages/react-devtools-shell/src/multi/left.js b/github_code/react__react/packages/react-devtools-shell/src/multi/left.js
new file mode 100644
index 0000000000000000000000000000000000000000..d4cddabdc1629688100dea0fa20eed688248e50a
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/multi/left.js
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+import * as React from 'react';
+import {useState} from 'react';
+import {createRoot} from 'react-dom/client';
+
+function createContainer() {
+ const container = document.createElement('div');
+
+ ((document.body: any): HTMLBodyElement).appendChild(container);
+
+ return container;
+}
+
+function StatefulCounter() {
+ const [count, setCount] = useState(0);
+ const handleClick = () => setCount(count + 1);
+ return Count {count} ;
+}
+
+createRoot(createContainer()).render( );
diff --git a/github_code/react__react/packages/react-devtools-shell/src/multi/right.js b/github_code/react__react/packages/react-devtools-shell/src/multi/right.js
new file mode 100644
index 0000000000000000000000000000000000000000..fb7d7cb0080654cd0ddcf3ab5a536e41ed3b6eab
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/multi/right.js
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+import * as React from 'react';
+import {useLayoutEffect, useRef, useState} from 'react';
+import {createRoot} from 'react-dom/client';
+
+function createContainer() {
+ const container = document.createElement('div');
+
+ ((document.body: any): HTMLBodyElement).appendChild(container);
+
+ return container;
+}
+
+function EffectWithState() {
+ const [didMount, setDidMount] = useState(0);
+
+ const renderCountRef = useRef(0);
+ renderCountRef.current++;
+
+ useLayoutEffect(() => {
+ if (!didMount) {
+ setDidMount(true);
+ }
+ }, [didMount]);
+
+ return (
+
+ Rendered {renderCountRef.current} times
+ {didMount && Mounted! }
+
+ );
+}
+
+createRoot(createContainer()).render( );
diff --git a/github_code/react__react/packages/react-devtools-shell/src/perf-regression/app.js b/github_code/react__react/packages/react-devtools-shell/src/perf-regression/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..4fa784d552335fa72d27d0a7c18705b97c9a1efb
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/perf-regression/app.js
@@ -0,0 +1,22 @@
+/** @flow */
+
+// This test harness mounts each test app as a separate root to test multi-root applications.
+
+import * as React from 'react';
+import {createRoot} from 'react-dom/client';
+import App from './apps/index';
+
+function mountApp() {
+ const container = document.createElement('div');
+
+ (document.body as any as HTMLBodyElement).appendChild(container);
+
+ const root = createRoot(container);
+ root.render(
+
+
+ ,
+ );
+}
+
+mountApp();
diff --git a/github_code/react__react/packages/react-devtools-shell/src/perf-regression/apps/LargeSubtree.js b/github_code/react__react/packages/react-devtools-shell/src/perf-regression/apps/LargeSubtree.js
new file mode 100644
index 0000000000000000000000000000000000000000..24ced50497acb28bc3035068e1373a245fe06272
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/perf-regression/apps/LargeSubtree.js
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) Meta Platforms, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+
+function generateArray(size: number) {
+ return Array.from({length: size}, () => Math.floor(Math.random() * size));
+}
+
+const arr = generateArray(50000);
+
+export default function LargeSubtree(): React.Node {
+ const [showList, setShowList] = React.useState(false);
+ const toggleList = () => {
+ const startTime = performance.now();
+ setShowList(!showList);
+ // requestAnimationFrame should happen after render+commit is done
+ window.requestAnimationFrame(() => {
+ const afterRenderTime = performance.now();
+ console.log(
+ `Time spent on ${showList ? 'unmounting' : 'mounting'} the subtree: ${
+ afterRenderTime - startTime
+ }ms`,
+ );
+ });
+ };
+ return (
+
+
Mount/Unmount a large subtree
+
Click the button to toggle the state. Open console for results.
+
toggle
+
+ dummy item
+ {showList && arr.map((num, idx) => {num} )}
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/perf-regression/apps/index.js b/github_code/react__react/packages/react-devtools-shell/src/perf-regression/apps/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..d135f2e5c38519f6ef2d370b06992bd82381694f
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/perf-regression/apps/index.js
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) Meta Platforms, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @flow
+ */
+
+import * as React from 'react';
+import LargeSubtree from './LargeSubtree';
+
+export default function Home(): React.Node {
+ return (
+
+
+
+ );
+}
diff --git a/github_code/react__react/packages/react-devtools-shell/src/perf-regression/devtools.js b/github_code/react__react/packages/react-devtools-shell/src/perf-regression/devtools.js
new file mode 100644
index 0000000000000000000000000000000000000000..424895e41b1c78b82ae7ee0a627fd2d3877e3384
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/src/perf-regression/devtools.js
@@ -0,0 +1,54 @@
+import * as React from 'react';
+import {createRoot} from 'react-dom/client';
+import {
+ activate as activateBackend,
+ initialize as initializeBackend,
+} from 'react-devtools-inline/backend';
+import {initialize as createDevTools} from 'react-devtools-inline/frontend';
+
+// This is a pretty gross hack to make the runtime loaded named-hooks-code work.
+// TODO (Webpack 5) Hoepfully we can remove this once we upgrade to Webpack 5.
+__webpack_public_path__ = '/dist/'; // eslint-disable-line no-undef
+
+// TODO (Webpack 5) Hopefully we can remove this prop after the Webpack 5 migration.
+function hookNamesModuleLoaderFunction() {
+ return import('react-devtools-inline/hookNames');
+}
+
+function inject(contentDocument, sourcePath) {
+ const script = contentDocument.createElement('script');
+ script.src = sourcePath;
+
+ ((contentDocument.body: any): HTMLBodyElement).appendChild(script);
+}
+
+function init(
+ appSource: string,
+ appIframe: HTMLIFrameElement,
+ devtoolsContainer: HTMLElement,
+ loadDevToolsButton: HTMLButtonElement,
+) {
+ const {contentDocument, contentWindow} = appIframe;
+
+ initializeBackend(contentWindow);
+
+ inject(contentDocument, appSource);
+
+ loadDevToolsButton.addEventListener('click', () => {
+ const DevTools = createDevTools(contentWindow);
+ createRoot(devtoolsContainer).render(
+ ,
+ );
+ activateBackend(contentWindow);
+ });
+}
+
+init(
+ 'dist/perf-regression-app.js',
+ document.getElementById('iframe'),
+ document.getElementById('devtools'),
+ document.getElementById('load-devtools'),
+);
diff --git a/github_code/react__react/packages/react-devtools-shell/webpack-server.js b/github_code/react__react/packages/react-devtools-shell/webpack-server.js
new file mode 100644
index 0000000000000000000000000000000000000000..4504c5ebcd00e4ee320409131ad5aedab254c030
--- /dev/null
+++ b/github_code/react__react/packages/react-devtools-shell/webpack-server.js
@@ -0,0 +1,252 @@
+const {resolve} = require('path');
+const Webpack = require('webpack');
+const WebpackDevServer = require('webpack-dev-server');
+const {
+ GITHUB_URL,
+ getVersionString,
+} = require('react-devtools-extensions/utils');
+const {resolveFeatureFlags} = require('react-devtools-shared/buildUtils');
+const semver = require('semver');
+
+const {SUCCESSFUL_COMPILATION_MESSAGE} = require('./constants');
+
+const {ReactVersion: currentReactVersion} = require('../../ReactVersions');
+
+const NODE_ENV = process.env.NODE_ENV;
+if (!NODE_ENV) {
+ console.error('NODE_ENV not set');
+ process.exit(1);
+}
+
+const EDITOR_URL = process.env.EDITOR_URL || null;
+
+const builtModulesDir = resolve(
+ __dirname,
+ '..',
+ '..',
+ 'build',
+ 'oss-experimental',
+);
+
+const __DEV__ = NODE_ENV === 'development';
+
+const DEVTOOLS_VERSION = getVersionString();
+
+// If the React version isn't set, we will use the
+// current React version instead. Likewise if the
+// React version isnt' set, we'll use the build folder
+// for both React DevTools and React
+const REACT_VERSION = process.env.REACT_VERSION
+ ? semver.coerce(process.env.REACT_VERSION).version
+ : currentReactVersion;
+
+const E2E_APP_BUILD_DIR = process.env.REACT_VERSION
+ ? resolve(__dirname, '..', '..', 'build-regression', 'node_modules')
+ : builtModulesDir;
+
+const makeConfig = (entry, alias) => ({
+ mode: __DEV__ ? 'development' : 'production',
+ devtool: __DEV__ ? 'cheap-source-map' : 'source-map',
+ stats: {
+ preset: 'normal',
+ warningsFilter: [
+ warning => {
+ const message = warning.message;
+ // We use ReactDOM legacy APIs conditionally based on the React version.
+ // react-native-web also accesses legacy APIs statically but we don't end
+ // up using them at runtime.
+ return (
+ message.startsWith(
+ `export 'findDOMNode' (imported as 'findDOMNode') was not found in 'react-dom'`,
+ ) ||
+ message.startsWith(
+ `export 'hydrate' (reexported as 'hydrate') was not found in 'react-dom'`,
+ ) ||
+ message.startsWith(
+ `export 'render' (imported as 'render') was not found in 'react-dom'`,
+ ) ||
+ message.startsWith(
+ `export 'unmountComponentAtNode' (imported as 'unmountComponentAtNode') was not found in 'react-dom'`,
+ )
+ );
+ },
+ ],
+ },
+ entry,
+ output: {
+ publicPath: '/dist/',
+ },
+ node: {
+ global: false,
+ },
+ resolve: {
+ alias,
+ },
+ optimization: {
+ minimize: false,
+ },
+ plugins: [
+ new Webpack.ProvidePlugin({
+ process: 'process/browser',
+ }),
+ new Webpack.DefinePlugin({
+ __DEV__,
+ __EXPERIMENTAL__: true,
+ __EXTENSION__: false,
+ __PROFILE__: false,
+ __TEST__: NODE_ENV === 'test',
+ 'process.env.GITHUB_URL': `"${GITHUB_URL}"`,
+ 'process.env.EDITOR_URL': EDITOR_URL != null ? `"${EDITOR_URL}"` : null,
+ 'process.env.DEVTOOLS_PACKAGE': `"react-devtools-shell"`,
+ 'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,
+ 'process.env.E2E_APP_REACT_VERSION': `"${REACT_VERSION}"`,
+ }),
+ ],
+ module: {
+ rules: [
+ {
+ test: /\.js$/,
+ loader: 'babel-loader',
+ options: {
+ configFile: resolve(
+ __dirname,
+ '..',
+ 'react-devtools-shared',
+ 'babel.config.js',
+ ),
+ },
+ },
+ {
+ test: /\.css$/,
+ use: [
+ {
+ loader: 'style-loader',
+ },
+ {
+ loader: 'css-loader',
+ options: {
+ sourceMap: true,
+ modules: true,
+ localIdentName: '[local]',
+ },
+ },
+ ],
+ },
+ ],
+ },
+});
+
+const app = makeConfig(
+ {
+ 'app-index': './src/app/index.js',
+ 'app-devtools': './src/app/devtools.js',
+ 'e2e-app': './src/e2e/app.js',
+ 'e2e-devtools': './src/e2e/devtools.js',
+ 'e2e-devtools-regression': './src/e2e-regression/devtools.js',
+ 'multi-left': './src/multi/left.js',
+ 'multi-devtools': './src/multi/devtools.js',
+ 'multi-right': './src/multi/right.js',
+ 'e2e-regression': './src/e2e-regression/app.js',
+ 'perf-regression-app': './src/perf-regression/app.js',
+ 'perf-regression-devtools': './src/perf-regression/devtools.js',
+ },
+ {
+ react: resolve(builtModulesDir, 'react'),
+ 'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
+ 'react-devtools-feature-flags': resolveFeatureFlags('shell'),
+ 'react-dom/client': resolve(builtModulesDir, 'react-dom/unstable_testing'),
+ 'react-dom': resolve(builtModulesDir, 'react-dom'),
+ 'react-is': resolve(builtModulesDir, 'react-is'),
+ scheduler: resolve(builtModulesDir, 'scheduler'),
+ },
+);
+
+// Prior to React 18, we use ReactDOM.render rather than
+// createRoot.
+// We also use a separate build folder to build the React App
+// so that we can test the current DevTools against older version of React
+const e2eRegressionApp = semver.lt(REACT_VERSION, '18.0.0')
+ ? makeConfig(
+ {
+ 'e2e-app-regression': './src/e2e-regression/app-legacy.js',
+ },
+ {
+ react: resolve(E2E_APP_BUILD_DIR, 'react'),
+ 'react-dom': resolve(E2E_APP_BUILD_DIR, 'react-dom'),
+ ...(semver.satisfies(REACT_VERSION, '16.5')
+ ? {schedule: resolve(E2E_APP_BUILD_DIR, 'schedule')}
+ : {scheduler: resolve(E2E_APP_BUILD_DIR, 'scheduler')}),
+ },
+ )
+ : makeConfig(
+ {
+ 'e2e-app-regression': './src/e2e-regression/app.js',
+ },
+ {
+ react: resolve(E2E_APP_BUILD_DIR, 'react'),
+ 'react-dom': resolve(E2E_APP_BUILD_DIR, 'react-dom'),
+ 'react-dom/client': resolve(E2E_APP_BUILD_DIR, 'react-dom/client'),
+ scheduler: resolve(E2E_APP_BUILD_DIR, 'scheduler'),
+ },
+ );
+
+const appCompiler = Webpack(app);
+const appServer = new WebpackDevServer(
+ {
+ hot: true,
+ open: true,
+ port: 8080,
+ client: {
+ logging: 'warn',
+ overlay: {
+ warnings: false,
+ runtimeErrors: error => {
+ const shouldIgnoreError =
+ error !== null &&
+ typeof error === 'object' &&
+ error.message === 'test-error-do-not-surface';
+
+ return !shouldIgnoreError;
+ },
+ },
+ },
+ static: {
+ directory: __dirname,
+ publicPath: '/',
+ },
+ },
+ appCompiler,
+);
+
+const e2eRegressionAppCompiler = Webpack(e2eRegressionApp);
+const e2eRegressionAppServer = new WebpackDevServer(
+ {
+ port: 8181,
+ client: {
+ logging: 'warn',
+ overlay: {
+ warnings: false,
+ },
+ },
+ static: {
+ publicPath: '/dist/',
+ },
+ headers: {
+ 'Access-Control-Allow-Origin': '*',
+ },
+ },
+ e2eRegressionAppCompiler,
+);
+
+const runServer = async () => {
+ console.log('Starting server...');
+
+ appServer.compiler.hooks.done.tap('done', () =>
+ console.log(SUCCESSFUL_COMPILATION_MESSAGE),
+ );
+
+ await e2eRegressionAppServer.start();
+ await appServer.start();
+};
+
+runServer();
diff --git a/github_code/react__react/packages/react-dom-bindings/package.json b/github_code/react__react/packages/react-dom-bindings/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..8fb19d332a1094819082d3805a27ca5e6f0ea85c
--- /dev/null
+++ b/github_code/react__react/packages/react-dom-bindings/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "react-dom-bindings",
+ "description": "React implementation details for react-dom.",
+ "version": "19.3.0",
+ "private": true,
+ "main": "index.js",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/react/react.git",
+ "directory": "packages/react-dom-bindings"
+ },
+ "keywords": [
+ "react"
+ ],
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/react/react/issues"
+ },
+ "homepage": "https://react.dev/",
+ "peerDependencies": {
+ "react": "^19.0.0"
+ }
+}
diff --git a/github_code/react__react/packages/react-dom-bindings/src/client/CSSPropertyOperations.js b/github_code/react__react/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
new file mode 100644
index 0000000000000000000000000000000000000000..eab6bd7ba51ce6f35112c02849e743130ac51c30
--- /dev/null
+++ b/github_code/react__react/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
@@ -0,0 +1,259 @@
+/**
+ * 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.
+ */
+
+import {shorthandToLonghand} from './CSSShorthandProperty';
+
+import hyphenateStyleName from '../shared/hyphenateStyleName';
+import warnValidStyle from '../shared/warnValidStyle';
+import isUnitlessNumber from '../shared/isUnitlessNumber';
+import {checkCSSPropertyStringCoercion} from 'shared/CheckStringCoercion';
+import {trackHostMutation} from 'react-reconciler/src/ReactFiberMutationTracking';
+
+/**
+ * Operations for dealing with CSS properties.
+ */
+
+/**
+ * This creates a string that is expected to be equivalent to the style
+ * attribute generated by server-side rendering. It by-passes warnings and
+ * security checks so it's not safe to use this value for anything other than
+ * comparison. It is only used in DEV for SSR validation.
+ */
+export function createDangerousStringForStyles(styles) {
+ if (__DEV__) {
+ let serialized = '';
+ let delimiter = '';
+ for (const styleName in styles) {
+ if (!styles.hasOwnProperty(styleName)) {
+ continue;
+ }
+ const value = styles[styleName];
+ if (value != null && typeof value !== 'boolean' && value !== '') {
+ const isCustomProperty = styleName.indexOf('--') === 0;
+ if (isCustomProperty) {
+ if (__DEV__) {
+ checkCSSPropertyStringCoercion(value, styleName);
+ }
+ serialized += delimiter + styleName + ':' + ('' + value).trim();
+ } else {
+ if (
+ typeof value === 'number' &&
+ value !== 0 &&
+ !isUnitlessNumber(styleName)
+ ) {
+ serialized +=
+ delimiter + hyphenateStyleName(styleName) + ':' + value + 'px';
+ } else {
+ if (__DEV__) {
+ checkCSSPropertyStringCoercion(value, styleName);
+ }
+ serialized +=
+ delimiter +
+ hyphenateStyleName(styleName) +
+ ':' +
+ ('' + value).trim();
+ }
+ }
+ delimiter = ';';
+ }
+ }
+ return serialized || null;
+ }
+}
+
+function setValueForStyle(style, styleName, value) {
+ const isCustomProperty = styleName.indexOf('--') === 0;
+ if (__DEV__) {
+ if (!isCustomProperty) {
+ warnValidStyle(styleName, value);
+ }
+ }
+
+ if (value == null || typeof value === 'boolean' || value === '') {
+ if (isCustomProperty) {
+ style.setProperty(styleName, '');
+ } else if (styleName === 'float') {
+ style.cssFloat = '';
+ } else {
+ style[styleName] = '';
+ }
+ } else if (isCustomProperty) {
+ style.setProperty(styleName, value);
+ } else if (
+ typeof value === 'number' &&
+ value !== 0 &&
+ !isUnitlessNumber(styleName)
+ ) {
+ style[styleName] = value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
+ } else {
+ if (styleName === 'float') {
+ style.cssFloat = value;
+ } else {
+ if (__DEV__) {
+ checkCSSPropertyStringCoercion(value, styleName);
+ }
+ style[styleName] = ('' + value).trim();
+ }
+ }
+}
+
+/**
+ * Sets the value for multiple styles on a node. If a value is specified as
+ * '' (empty string), the corresponding style property will be unset.
+ *
+ * @param {DOMElement} node
+ * @param {object} styles
+ */
+export function setValueForStyles(node, styles, prevStyles) {
+ if (styles != null && typeof styles !== 'object') {
+ throw new Error(
+ 'The `style` prop expects a mapping from style properties to values, ' +
+ "not a string. For example, style={{marginRight: spacing + 'em'}} when " +
+ 'using JSX.',
+ );
+ }
+ if (__DEV__) {
+ if (styles) {
+ // Freeze the next style object so that we can assume it won't be
+ // mutated. We have already warned for this in the past.
+ Object.freeze(styles);
+ }
+ }
+
+ const style = node.style;
+
+ if (prevStyles != null) {
+ if (__DEV__) {
+ validateShorthandPropertyCollisionInDev(prevStyles, styles);
+ }
+
+ for (const styleName in prevStyles) {
+ if (
+ prevStyles.hasOwnProperty(styleName) &&
+ (styles == null || !styles.hasOwnProperty(styleName))
+ ) {
+ // Clear style
+ const isCustomProperty = styleName.indexOf('--') === 0;
+ if (isCustomProperty) {
+ style.setProperty(styleName, '');
+ } else if (styleName === 'float') {
+ style.cssFloat = '';
+ } else {
+ style[styleName] = '';
+ }
+ trackHostMutation();
+ }
+ }
+ for (const styleName in styles) {
+ const value = styles[styleName];
+ if (styles.hasOwnProperty(styleName) && prevStyles[styleName] !== value) {
+ setValueForStyle(style, styleName, value);
+ trackHostMutation();
+ }
+ }
+ } else {
+ for (const styleName in styles) {
+ if (styles.hasOwnProperty(styleName)) {
+ const value = styles[styleName];
+ setValueForStyle(style, styleName, value);
+ }
+ }
+ }
+}
+
+function isValueEmpty(value) {
+ return value == null || typeof value === 'boolean' || value === '';
+}
+
+/**
+ * Given {color: 'red', overflow: 'hidden'} returns {
+ * color: 'color',
+ * overflowX: 'overflow',
+ * overflowY: 'overflow',
+ * }. This can be read as "the overflowY property was set by the overflow
+ * shorthand". That is, the values are the property that each was derived from.
+ */
+function expandShorthandMap(styles) {
+ const expanded = {};
+ for (const key in styles) {
+ const longhands = shorthandToLonghand[key] || [key];
+ for (let i = 0; i < longhands.length; i++) {
+ expanded[longhands[i]] = key;
+ }
+ }
+ return expanded;
+}
+
+/**
+ * When mixing shorthand and longhand property names, we warn during updates if
+ * we expect an incorrect result to occur. In particular, we warn for:
+ *
+ * Updating a shorthand property (longhand gets overwritten):
+ * {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
+ * becomes .style.font = 'baz'
+ * Removing a shorthand property (longhand gets lost too):
+ * {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
+ * becomes .style.font = ''
+ * Removing a longhand property (should revert to shorthand; doesn't):
+ * {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
+ * becomes .style.fontVariant = ''
+ */
+function validateShorthandPropertyCollisionInDev(prevStyles, nextStyles) {
+ if (__DEV__) {
+ if (!nextStyles) {
+ return;
+ }
+
+ // Compute the diff as it would happen elsewhere.
+ const expandedUpdates = {};
+ if (prevStyles) {
+ for (const key in prevStyles) {
+ if (prevStyles.hasOwnProperty(key) && !nextStyles.hasOwnProperty(key)) {
+ const longhands = shorthandToLonghand[key] || [key];
+ for (let i = 0; i < longhands.length; i++) {
+ expandedUpdates[longhands[i]] = key;
+ }
+ }
+ }
+ }
+ for (const key in nextStyles) {
+ if (
+ nextStyles.hasOwnProperty(key) &&
+ (!prevStyles || prevStyles[key] !== nextStyles[key])
+ ) {
+ const longhands = shorthandToLonghand[key] || [key];
+ for (let i = 0; i < longhands.length; i++) {
+ expandedUpdates[longhands[i]] = key;
+ }
+ }
+ }
+
+ const expandedStyles = expandShorthandMap(nextStyles);
+ const warnedAbout = {};
+ for (const key in expandedUpdates) {
+ const originalKey = expandedUpdates[key];
+ const correctOriginalKey = expandedStyles[key];
+ if (correctOriginalKey && originalKey !== correctOriginalKey) {
+ const warningKey = originalKey + ',' + correctOriginalKey;
+ if (warnedAbout[warningKey]) {
+ continue;
+ }
+ warnedAbout[warningKey] = true;
+ console.error(
+ '%s a style property during rerender (%s) when a ' +
+ 'conflicting property is set (%s) can lead to styling bugs. To ' +
+ "avoid this, don't mix shorthand and non-shorthand properties " +
+ 'for the same value; instead, replace the shorthand with ' +
+ 'separate values.',
+ isValueEmpty(nextStyles[originalKey]) ? 'Removing' : 'Updating',
+ originalKey,
+ correctOriginalKey,
+ );
+ }
+ }
+ }
+}
diff --git a/github_code/react__react/packages/react-dom-bindings/src/client/CSSShorthandProperty.js b/github_code/react__react/packages/react-dom-bindings/src/client/CSSShorthandProperty.js
new file mode 100644
index 0000000000000000000000000000000000000000..19ec1d5ceff28ec13041cf6dcd9be915df8c791d
--- /dev/null
+++ b/github_code/react__react/packages/react-dom-bindings/src/client/CSSShorthandProperty.js
@@ -0,0 +1,262 @@
+/**
+ * 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.
+ */
+
+// List derived from Firefox source code:
+// https://github.com/mozilla-firefox/firefox/blob/58f365ba0eb5761a182f1925e4654cc75212b8ac/layout/style/test/property_database.js
+export const shorthandToLonghand = {
+ animation: [
+ 'animationDelay',
+ 'animationDirection',
+ 'animationDuration',
+ 'animationFillMode',
+ 'animationIterationCount',
+ 'animationName',
+ 'animationPlayState',
+ 'animationTimingFunction',
+ ],
+ background: [
+ 'backgroundAttachment',
+ 'backgroundClip',
+ 'backgroundColor',
+ 'backgroundImage',
+ 'backgroundOrigin',
+ 'backgroundPositionX',
+ 'backgroundPositionY',
+ 'backgroundRepeat',
+ 'backgroundSize',
+ ],
+ backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
+ border: [
+ 'borderBottomColor',
+ 'borderBottomStyle',
+ 'borderBottomWidth',
+ 'borderImageOutset',
+ 'borderImageRepeat',
+ 'borderImageSlice',
+ 'borderImageSource',
+ 'borderImageWidth',
+ 'borderLeftColor',
+ 'borderLeftStyle',
+ 'borderLeftWidth',
+ 'borderRightColor',
+ 'borderRightStyle',
+ 'borderRightWidth',
+ 'borderTopColor',
+ 'borderTopStyle',
+ 'borderTopWidth',
+ ],
+ borderBlock: [
+ 'borderBlockEndColor',
+ 'borderBlockEndStyle',
+ 'borderBlockEndWidth',
+ 'borderBlockStartColor',
+ 'borderBlockStartStyle',
+ 'borderBlockStartWidth',
+ ],
+ borderBlockColor: ['borderBlockEndColor', 'borderBlockStartColor'],
+ borderBlockEnd: [
+ 'borderBlockEndColor',
+ 'borderBlockEndStyle',
+ 'borderBlockEndWidth',
+ ],
+ borderBlockStart: [
+ 'borderBlockStartColor',
+ 'borderBlockStartStyle',
+ 'borderBlockStartWidth',
+ ],
+ borderBlockStyle: ['borderBlockEndStyle', 'borderBlockStartStyle'],
+ borderBlockWidth: ['borderBlockEndWidth', 'borderBlockStartWidth'],
+ borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
+ borderColor: [
+ 'borderBottomColor',
+ 'borderLeftColor',
+ 'borderRightColor',
+ 'borderTopColor',
+ ],
+ borderImage: [
+ 'borderImageOutset',
+ 'borderImageRepeat',
+ 'borderImageSlice',
+ 'borderImageSource',
+ 'borderImageWidth',
+ ],
+ borderInline: [
+ 'borderInlineEndColor',
+ 'borderInlineEndStyle',
+ 'borderInlineEndWidth',
+ 'borderInlineStartColor',
+ 'borderInlineStartStyle',
+ 'borderInlineStartWidth',
+ ],
+ borderInlineColor: ['borderInlineEndColor', 'borderInlineStartColor'],
+ borderInlineEnd: [
+ 'borderInlineEndColor',
+ 'borderInlineEndStyle',
+ 'borderInlineEndWidth',
+ ],
+ borderInlineStart: [
+ 'borderInlineStartColor',
+ 'borderInlineStartStyle',
+ 'borderInlineStartWidth',
+ ],
+ borderInlineStyle: ['borderInlineEndStyle', 'borderInlineStartStyle'],
+ borderInlineWidth: ['borderInlineEndWidth', 'borderInlineStartWidth'],
+ borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
+ borderRadius: [
+ 'borderBottomLeftRadius',
+ 'borderBottomRightRadius',
+ 'borderTopLeftRadius',
+ 'borderTopRightRadius',
+ ],
+ borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
+ borderStyle: [
+ 'borderBottomStyle',
+ 'borderLeftStyle',
+ 'borderRightStyle',
+ 'borderTopStyle',
+ ],
+ borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
+ borderWidth: [
+ 'borderBottomWidth',
+ 'borderLeftWidth',
+ 'borderRightWidth',
+ 'borderTopWidth',
+ ],
+ colorAdjust: ['printColorAdjust'],
+ columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
+ columns: ['columnCount', 'columnWidth'],
+ containIntrinsicSize: ['containIntrinsicHeight', 'containIntrinsicWidth'],
+ container: ['containerName', 'containerType'],
+ flex: ['flexBasis', 'flexGrow', 'flexShrink'],
+ flexFlow: ['flexDirection', 'flexWrap'],
+ font: [
+ 'fontFamily',
+ 'fontFeatureSettings',
+ 'fontKerning',
+ 'fontLanguageOverride',
+ 'fontSize',
+ 'fontSizeAdjust',
+ 'fontStretch',
+ 'fontStyle',
+ 'fontVariant',
+ 'fontVariantAlternates',
+ 'fontVariantCaps',
+ 'fontVariantEastAsian',
+ 'fontVariantLigatures',
+ 'fontVariantNumeric',
+ 'fontVariantPosition',
+ 'fontWeight',
+ 'lineHeight',
+ ],
+ fontSynthesis: [
+ 'fontSynthesisPosition',
+ 'fontSynthesisSmallCaps',
+ 'fontSynthesisStyle',
+ 'fontSynthesisWeight',
+ ],
+ fontVariant: [
+ 'fontVariantAlternates',
+ 'fontVariantCaps',
+ 'fontVariantEastAsian',
+ 'fontVariantLigatures',
+ 'fontVariantNumeric',
+ 'fontVariantPosition',
+ ],
+ gap: ['columnGap', 'rowGap'],
+ grid: [
+ 'gridAutoColumns',
+ 'gridAutoFlow',
+ 'gridAutoRows',
+ 'gridTemplateAreas',
+ 'gridTemplateColumns',
+ 'gridTemplateRows',
+ ],
+ gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
+ gridColumn: ['gridColumnEnd', 'gridColumnStart'],
+ gridColumnGap: ['columnGap'],
+ gridGap: ['columnGap', 'rowGap'],
+ gridRow: ['gridRowEnd', 'gridRowStart'],
+ gridRowGap: ['rowGap'],
+ gridTemplate: [
+ 'gridTemplateAreas',
+ 'gridTemplateColumns',
+ 'gridTemplateRows',
+ ],
+ inset: ['bottom', 'left', 'right', 'top'],
+ insetBlock: ['insetBlockEnd', 'insetBlockStart'],
+ insetInline: ['insetInlineEnd', 'insetInlineStart'],
+ listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
+ margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
+ marginBlock: ['marginBlockEnd', 'marginBlockStart'],
+ marginInline: ['marginInlineEnd', 'marginInlineStart'],
+ marker: ['markerEnd', 'markerMid', 'markerStart'],
+ mask: [
+ 'maskClip',
+ 'maskComposite',
+ 'maskImage',
+ 'maskMode',
+ 'maskOrigin',
+ 'maskPositionX',
+ 'maskPositionY',
+ 'maskRepeat',
+ 'maskSize',
+ ],
+ maskPosition: ['maskPositionX', 'maskPositionY'],
+ offset: [
+ 'offsetAnchor',
+ 'offsetDistance',
+ 'offsetPath',
+ 'offsetPosition',
+ 'offsetRotate',
+ ],
+ outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
+ overflow: ['overflowX', 'overflowY'],
+ overscrollBehavior: ['overscrollBehaviorX', 'overscrollBehaviorY'],
+ padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
+ paddingBlock: ['paddingBlockEnd', 'paddingBlockStart'],
+ paddingInline: ['paddingInlineEnd', 'paddingInlineStart'],
+ pageBreakAfter: ['breakAfter'],
+ pageBreakBefore: ['breakBefore'],
+ pageBreakInside: ['breakInside'],
+ placeContent: ['alignContent', 'justifyContent'],
+ placeItems: ['alignItems', 'justifyItems'],
+ placeSelf: ['alignSelf', 'justifySelf'],
+ scrollMargin: [
+ 'scrollMarginBottom',
+ 'scrollMarginLeft',
+ 'scrollMarginRight',
+ 'scrollMarginTop',
+ ],
+ scrollMarginBlock: ['scrollMarginBlockEnd', 'scrollMarginBlockStart'],
+ scrollMarginInline: ['scrollMarginInlineEnd', 'scrollMarginInlineStart'],
+ scrollPadding: [
+ 'scrollPaddingBottom',
+ 'scrollPaddingLeft',
+ 'scrollPaddingRight',
+ 'scrollPaddingTop',
+ ],
+ scrollPaddingBlock: ['scrollPaddingBlockEnd', 'scrollPaddingBlockStart'],
+ scrollPaddingInline: ['scrollPaddingInlineEnd', 'scrollPaddingInlineStart'],
+ textDecoration: [
+ 'textDecorationColor',
+ 'textDecorationLine',
+ 'textDecorationStyle',
+ 'textDecorationThickness',
+ ],
+ textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
+ textWrap: ['textWrapMode', 'textWrapStyle'],
+ transition: [
+ 'transitionBehavior',
+ 'transitionDelay',
+ 'transitionDuration',
+ 'transitionProperty',
+ 'transitionTimingFunction',
+ ],
+ verticalAlign: ['alignmentBaseline', 'baselineShift', 'baselineSource'],
+ whiteSpace: ['textWrapMode', 'whiteSpaceCollapse'],
+ wordWrap: ['overflowWrap'],
+};
diff --git a/github_code/react__react/packages/react-dom-bindings/src/client/DOMAccessibilityRoles.js b/github_code/react__react/packages/react-dom-bindings/src/client/DOMAccessibilityRoles.js
new file mode 100644
index 0000000000000000000000000000000000000000..c7f7161f62b2e058ef1fd7b09fff71540199ee67
--- /dev/null
+++ b/github_code/react__react/packages/react-dom-bindings/src/client/DOMAccessibilityRoles.js
@@ -0,0 +1,140 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+// Below code forked from dom-accessibility-api
+
+const tagToRoleMappings = {
+ ARTICLE: 'article',
+ ASIDE: 'complementary',
+ BODY: 'document',
+ BUTTON: 'button',
+ DATALIST: 'listbox',
+ DD: 'definition',
+ DETAILS: 'group',
+ DIALOG: 'dialog',
+ DT: 'term',
+ FIELDSET: 'group',
+ FIGURE: 'figure',
+ // WARNING: Only with an accessible name
+ FORM: 'form',
+ FOOTER: 'contentinfo',
+ H1: 'heading',
+ H2: 'heading',
+ H3: 'heading',
+ H4: 'heading',
+ H5: 'heading',
+ H6: 'heading',
+ HEADER: 'banner',
+ HR: 'separator',
+ LEGEND: 'legend',
+ LI: 'listitem',
+ MATH: 'math',
+ MAIN: 'main',
+ MENU: 'list',
+ NAV: 'navigation',
+ OL: 'list',
+ OPTGROUP: 'group',
+ // WARNING: Only in certain context
+ OPTION: 'option',
+ OUTPUT: 'status',
+ PROGRESS: 'progressbar',
+ // WARNING: Only with an accessible name
+ SECTION: 'region',
+ SUMMARY: 'button',
+ TABLE: 'table',
+ TBODY: 'rowgroup',
+ TEXTAREA: 'textbox',
+ TFOOT: 'rowgroup',
+ // WARNING: Only in certain context
+ TD: 'cell',
+ TH: 'columnheader',
+ THEAD: 'rowgroup',
+ TR: 'row',
+ UL: 'list',
+};
+
+function getImplicitRole(element: Element): string | null {
+ // $FlowFixMe[invalid-computed-prop]
+ const mappedByTag = tagToRoleMappings[element.tagName];
+ if (mappedByTag !== undefined) {
+ return mappedByTag;
+ }
+
+ switch (element.tagName) {
+ case 'A':
+ case 'AREA':
+ case 'LINK':
+ if (element.hasAttribute('href')) {
+ return 'link';
+ }
+ break;
+ case 'IMG':
+ if ((element.getAttribute('alt') || '').length > 0) {
+ return 'img';
+ }
+ break;
+ case 'INPUT': {
+ const type = (element as any).type;
+ switch (type) {
+ case 'button':
+ case 'image':
+ case 'reset':
+ case 'submit':
+ return 'button';
+ case 'checkbox':
+ case 'radio':
+ return type;
+ case 'range':
+ return 'slider';
+ case 'email':
+ case 'tel':
+ case 'text':
+ case 'url':
+ if (element.hasAttribute('list')) {
+ return 'combobox';
+ }
+ return 'textbox';
+ case 'search':
+ if (element.hasAttribute('list')) {
+ return 'combobox';
+ }
+ return 'searchbox';
+ default:
+ return null;
+ }
+ }
+
+ case 'SELECT':
+ if (element.hasAttribute('multiple') || (element as any).size > 1) {
+ return 'listbox';
+ }
+ return 'combobox';
+ }
+
+ return null;
+}
+
+function getExplicitRoles(element: Element): Array | null {
+ const role = element.getAttribute('role');
+ if (role) {
+ return role.trim().split(' ');
+ }
+
+ return null;
+}
+
+// https://w3c.github.io/html-aria/#document-conformance-requirements-for-use-of-aria-attributes-in-html
+export function hasRole(element: Element, role: string): boolean {
+ const explicitRoles = getExplicitRoles(element);
+ if (explicitRoles !== null && explicitRoles.indexOf(role) >= 0) {
+ return true;
+ }
+
+ return role === getImplicitRole(element);
+}
diff --git a/github_code/react__react/packages/react-dom-bindings/src/client/DOMNamespaces.js b/github_code/react__react/packages/react-dom-bindings/src/client/DOMNamespaces.js
new file mode 100644
index 0000000000000000000000000000000000000000..528e4555ed38148ef3b7b80b2e9eb91484d544e7
--- /dev/null
+++ b/github_code/react__react/packages/react-dom-bindings/src/client/DOMNamespaces.js
@@ -0,0 +1,11 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+export const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
+export const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
diff --git a/github_code/react__react/packages/react-dom-bindings/src/client/DOMPropertyOperations.js b/github_code/react__react/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
new file mode 100644
index 0000000000000000000000000000000000000000..ee30b8034d8c4d0aead02efffa25c536c406c7f8
--- /dev/null
+++ b/github_code/react__react/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
@@ -0,0 +1,243 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import isAttributeNameSafe from '../shared/isAttributeNameSafe';
+import {enableTrustedTypesIntegration} from 'shared/ReactFeatureFlags';
+import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
+import {getFiberCurrentPropsFromNode} from './ReactDOMComponentTree';
+import {trackHostMutation} from 'react-reconciler/src/ReactFiberMutationTracking';
+
+/**
+ * Get the value for a attribute on a node. Only used in DEV for SSR validation.
+ * The third argument is used as a hint of what the expected value is. Some
+ * attributes have multiple equivalent values.
+ */
+export function getValueForAttribute(
+ node: Element,
+ name: string,
+ expected: mixed,
+): mixed {
+ if (__DEV__) {
+ if (!isAttributeNameSafe(name)) {
+ return;
+ }
+ if (!node.hasAttribute(name)) {
+ // shouldRemoveAttribute
+ switch (typeof expected) {
+ case 'function':
+ case 'symbol':
+ return expected;
+ case 'boolean': {
+ const prefix = name.toLowerCase().slice(0, 5);
+ if (prefix !== 'data-' && prefix !== 'aria-') {
+ return expected;
+ }
+ }
+ }
+ return expected === undefined ? undefined : null;
+ }
+ // When CSP is enabled, browsers hide the nonce attribute
+ // so we need to access the nonce property directly
+ // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cryptographicnonce
+ const isNonce = name.toLowerCase() === 'nonce';
+ const value = isNonce ? (node as any).nonce : node.getAttribute(name);
+ if (__DEV__) {
+ checkAttributeStringCoercion(expected, name);
+ }
+ if (value === '' + (expected as any)) {
+ return expected;
+ }
+ return value;
+ }
+}
+
+export function getValueForAttributeOnCustomComponent(
+ node: Element,
+ name: string,
+ expected: mixed,
+): mixed {
+ if (__DEV__) {
+ if (!isAttributeNameSafe(name)) {
+ return;
+ }
+ if (!node.hasAttribute(name)) {
+ // shouldRemoveAttribute
+ switch (typeof expected) {
+ case 'symbol':
+ case 'object':
+ // Symbols and objects are ignored when they're emitted so
+ // it would be expected that they end up not having an attribute.
+ return expected;
+ case 'function':
+ return expected;
+ case 'boolean':
+ if (expected === false) {
+ return expected;
+ }
+ }
+ return expected === undefined ? undefined : null;
+ }
+ // When CSP is enabled, browsers hide the nonce attribute
+ // so we need to access the nonce property directly
+ // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cryptographicnonce
+ const isNonce = name.toLowerCase() === 'nonce';
+ const value = isNonce ? (node as any).nonce : node.getAttribute(name);
+
+ if (value === '' && expected === true) {
+ return true;
+ }
+
+ if (__DEV__) {
+ checkAttributeStringCoercion(expected, name);
+ }
+ if (value === '' + (expected as any)) {
+ return expected;
+ }
+ return value;
+ }
+}
+
+export function setValueForAttribute(
+ node: Element,
+ name: string,
+ value: mixed,
+) {
+ if (isAttributeNameSafe(name)) {
+ // If the prop isn't in the special list, treat it as a simple attribute.
+ // shouldRemoveAttribute
+ if (value === null) {
+ node.removeAttribute(name);
+ return;
+ }
+ switch (typeof value) {
+ case 'undefined':
+ case 'function':
+ case 'symbol':
+ node.removeAttribute(name);
+ return;
+ case 'boolean': {
+ const prefix = name.toLowerCase().slice(0, 5);
+ if (prefix !== 'data-' && prefix !== 'aria-') {
+ node.removeAttribute(name);
+ return;
+ }
+ }
+ }
+ if (__DEV__) {
+ checkAttributeStringCoercion(value, name);
+ }
+ node.setAttribute(
+ name,
+ enableTrustedTypesIntegration ? (value as any) : '' + (value as any),
+ );
+ }
+}
+
+export function setValueForKnownAttribute(
+ node: Element,
+ name: string,
+ value: mixed,
+) {
+ if (value === null) {
+ node.removeAttribute(name);
+ return;
+ }
+ switch (typeof value) {
+ case 'undefined':
+ case 'function':
+ case 'symbol':
+ case 'boolean': {
+ node.removeAttribute(name);
+ return;
+ }
+ }
+ if (__DEV__) {
+ checkAttributeStringCoercion(value, name);
+ }
+ node.setAttribute(
+ name,
+ enableTrustedTypesIntegration ? (value as any) : '' + (value as any),
+ );
+}
+
+export function setValueForNamespacedAttribute(
+ node: Element,
+ namespace: string,
+ name: string,
+ value: mixed,
+) {
+ if (value === null) {
+ node.removeAttribute(name);
+ return;
+ }
+ switch (typeof value) {
+ case 'undefined':
+ case 'function':
+ case 'symbol':
+ case 'boolean': {
+ node.removeAttribute(name);
+ return;
+ }
+ }
+ if (__DEV__) {
+ checkAttributeStringCoercion(value, name);
+ }
+ node.setAttributeNS(
+ namespace,
+ name,
+ enableTrustedTypesIntegration ? (value as any) : '' + (value as any),
+ );
+}
+
+export function setValueForPropertyOnCustomComponent(
+ node: Element,
+ name: string,
+ value: mixed,
+) {
+ if (name[0] === 'o' && name[1] === 'n') {
+ const useCapture = name.endsWith('Capture');
+ const eventName = name.slice(2, useCapture ? name.length - 7 : undefined);
+
+ const prevProps = getFiberCurrentPropsFromNode(node);
+ // $FlowFixMe[invalid-computed-prop]
+ const prevValue = prevProps != null ? prevProps[name] : null;
+ if (typeof prevValue === 'function') {
+ node.removeEventListener(eventName, prevValue, useCapture);
+ }
+ if (typeof value === 'function') {
+ if (typeof prevValue !== 'function' && prevValue !== null) {
+ // If we previously assigned a non-function type into this node, then
+ // remove it when switching to event listener mode.
+ if (name in (node as any)) {
+ (node as any)[name] = null;
+ } else if (node.hasAttribute(name)) {
+ node.removeAttribute(name);
+ }
+ }
+ // $FlowFixMe[incompatible-type] value can't be casted to EventListener.
+ node.addEventListener(eventName, value as EventListener, useCapture);
+ return;
+ }
+ }
+
+ trackHostMutation();
+
+ if (name in (node as any)) {
+ (node as any)[name] = value;
+ return;
+ }
+
+ if (value === true) {
+ node.setAttribute(name, '');
+ return;
+ }
+
+ // From here, it's the same as any attribute
+ setValueForAttribute(node, name, value);
+}
diff --git a/github_code/react__react/packages/react-dom-bindings/src/client/HTMLNodeType.js b/github_code/react__react/packages/react-dom-bindings/src/client/HTMLNodeType.js
new file mode 100644
index 0000000000000000000000000000000000000000..34cd894944c128bd568f8e6e92d907cfbfbb204c
--- /dev/null
+++ b/github_code/react__react/packages/react-dom-bindings/src/client/HTMLNodeType.js
@@ -0,0 +1,19 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+/**
+ * HTML nodeType values that represent the type of the node
+ */
+
+export const ELEMENT_NODE = 1;
+export const TEXT_NODE = 3;
+export const COMMENT_NODE = 8;
+export const DOCUMENT_NODE = 9;
+export const DOCUMENT_TYPE_NODE = 10;
+export const DOCUMENT_FRAGMENT_NODE = 11;
diff --git a/github_code/react__react/packages/react-dom-bindings/src/client/ReactDOMComponent.js b/github_code/react__react/packages/react-dom-bindings/src/client/ReactDOMComponent.js
new file mode 100644
index 0000000000000000000000000000000000000000..59d725bde1e3898e927ddac70782818df669bbcd
--- /dev/null
+++ b/github_code/react__react/packages/react-dom-bindings/src/client/ReactDOMComponent.js
@@ -0,0 +1,3430 @@
+/**
+ * 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.
+ *
+ * @flow
+ */
+
+import type {HostContext, HostContextDev} from './ReactFiberConfigDOM';
+
+import {HostContextNamespaceNone} from './ReactFiberConfigDOM';
+
+import {
+ registrationNameDependencies,
+ possibleRegistrationNames,
+} from '../events/EventRegistry';
+
+import {checkHtmlStringCoercion} from 'shared/CheckStringCoercion';
+import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
+import {checkControlledValueProps} from '../shared/ReactControlledValuePropTypes';
+
+import {
+ getValueForAttribute,
+ getValueForAttributeOnCustomComponent,
+ setValueForPropertyOnCustomComponent,
+ setValueForKnownAttribute,
+ setValueForAttribute,
+ setValueForNamespacedAttribute,
+} from './DOMPropertyOperations';
+import {
+ validateInputProps,
+ initInput,
+ updateInput,
+ restoreControlledInputState,
+} from './ReactDOMInput';
+import {validateOptionProps} from './ReactDOMOption';
+import {
+ validateSelectProps,
+ initSelect,
+ restoreControlledSelectState,
+ updateSelect,
+} from './ReactDOMSelect';
+import {
+ validateTextareaProps,
+ initTextarea,
+ updateTextarea,
+ restoreControlledTextareaState,
+} from './ReactDOMTextarea';
+import {setSrcObject} from './ReactDOMSrcObject';
+import {validateTextNesting} from './validateDOMNesting';
+import setTextContent from './setTextContent';
+import {
+ createDangerousStringForStyles,
+ setValueForStyles,
+} from './CSSPropertyOperations';
+import {SVG_NAMESPACE, MATH_NAMESPACE} from './DOMNamespaces';
+import isCustomElement from '../shared/isCustomElement';
+import getAttributeAlias from '../shared/getAttributeAlias';
+import possibleStandardNames from '../shared/possibleStandardNames';
+import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook';
+import {validateProperties as validateInputProperties} from '../shared/ReactDOMNullInputValuePropHook';
+import {validateProperties as validateUnknownProperties} from '../shared/ReactDOMUnknownPropertyHook';
+import sanitizeURL from '../shared/sanitizeURL';
+
+import noop from 'shared/noop';
+
+import {trackHostMutation} from 'react-reconciler/src/ReactFiberMutationTracking';
+
+import {
+ enableHydrationChangeEvent,
+ enableScrollEndPolyfill,
+ enableSrcObject,
+ enableTrustedTypesIntegration,
+ enableViewTransition,
+ enableViewTransitionParentEnterExit,
+} from 'shared/ReactFeatureFlags';
+import {
+ mediaEventTypes,
+ listenToNonDelegatedEvent,
+} from '../events/DOMPluginEventSystem';
+
+let didWarnControlledToUncontrolled = false;
+let didWarnUncontrolledToControlled = false;
+let didWarnFormActionType = false;
+let didWarnFormActionName = false;
+let didWarnFormActionTarget = false;
+let didWarnFormActionMethod = false;
+let didWarnForNewBooleanPropsWithEmptyValue: {[string]: boolean};
+let didWarnPopoverTargetObject = false;
+if (__DEV__) {
+ didWarnForNewBooleanPropsWithEmptyValue = {};
+}
+
+function validatePropertiesInDevelopment(type: string, props: any) {
+ if (__DEV__) {
+ validateARIAProperties(type, props);
+ validateInputProperties(type, props);
+ validateUnknownProperties(type, props, {
+ registrationNameDependencies,
+ possibleRegistrationNames,
+ });
+ if (
+ props.contentEditable &&
+ !props.suppressContentEditableWarning &&
+ props.children != null
+ ) {
+ console.error(
+ 'A component is `contentEditable` and contains `children` managed by ' +
+ 'React. It is now your responsibility to guarantee that none of ' +
+ 'those nodes are unexpectedly modified or duplicated. This is ' +
+ 'probably not intentional.',
+ );
+ }
+ }
+}
+
+function validateFormActionInDevelopment(
+ tag: string,
+ key: string,
+ value: mixed,
+ props: any,
+) {
+ if (__DEV__) {
+ if (value == null) {
+ return;
+ }
+ if (tag === 'form') {
+ if (key === 'formAction') {
+ console.error(
+ 'You can only pass the formAction prop to or . Use the action prop on