@samitouri / QOS-React-2 / commits / 6abda7f4f2

[DevTools] Access metadata in source maps correctly accounting for different formats (#22096)

## Summary Follow up from https://github.com/facebook/react/pull/22010. The initial implementation of named hooks and for looking up hook name metadata in an extended source map both assumed that the source maps would always have a `sources` field available, and didn't account for the source maps in the [Index Map](https://sourcemaps.info/spec.html#h.535es3xeprgt) format, which contain a list of `sections` and don't have the `source` field available directly. In order to properly access metadata in extended source maps, this commit: - Adds a new `SourceMapMetadataConsumer` api, which is a fork / very similar in structure to the corresponding [consumer in Metro](https://github.com/facebook/metro/blob/2b44ec39b4bca93e3e1cf1f268b4be66f894924a/packages/metro-symbolicate/src/SourceMetadataMapConsumer.js#L56) (as specified by @motiz88 in https://github.com/facebook/react/issues/21782. - Updates `parseHookNames` to use this new api ## Test Plan - yarn flow - yarn test - yarn test-build-devtools - added new regression tests covering the index map format - named hooks still work on manual test of browser extension on a few different apps (code sandbox, create-react-app, internally).

Juan committed Aug 18, 2021 at 14:30 UTC 6abda7f4f24a955aa79a145f91dafae2805735ad
105 files changed +3505 -160
packages/react-devtools-extensions/src/SourceMapMetadataConsumer.js new
+197
@@ -0,0 +1,197 @@
1 +/*
2 + * Copyright (c) Facebook, Inc. and its affiliates.
3 + *
4 + * This source code is licensed under the MIT license found in the
5 + * LICENSE file in the root directory of this source tree.
6 + *
7 + * @flow strict-local
8 + */
9 +
10 +import type {Position} from './astUtils';
11 +import type {
12 + ReactSourceMetadata,
13 + IndexSourceMap,
14 + BasicSourceMap,
15 + MixedSourceMap,
16 +} from './SourceMapTypes';
17 +import type {HookMap} from './generateHookMap';
18 +import * as util from 'source-map/lib/util';
19 +import {decodeHookMap} from './generateHookMap';
20 +import {getHookNameForLocation} from './getHookNameForLocation';
21 +
22 +type MetadataMap = Map<string, ?ReactSourceMetadata>;
23 +
24 +const HOOK_MAP_INDEX_IN_REACT_METADATA = 0;
25 +const REACT_METADATA_INDEX_IN_FB_METADATA = 1;
26 +const REACT_SOURCES_EXTENSION_KEY = 'x_react_sources';
27 +const FB_SOURCES_EXTENSION_KEY = 'x_facebook_sources';
28 +
29 +/**
30 + * Extracted from the logic in source-map@0.8.0-beta.0's SourceMapConsumer.
31 + * By default, source names are normalized using the same logic that the
32 + * `source-map@0.8.0-beta.0` package uses internally. This is crucial for keeping the
33 + * sources list in sync with a `SourceMapConsumer` instance.
34 + */
35 +function normalizeSourcePath(
36 + sourceInput: string,
37 + map: {+sourceRoot?: ?string, ...},
38 +): string {
39 + const {sourceRoot} = map;
40 + let source = sourceInput;
41 +
42 + // eslint-disable-next-line react-internal/no-primitive-constructors
43 + source = String(source);
44 + return util.computeSourceURL(sourceRoot, source);
45 +}
46 +
47 +/**
48 + * Consumes the `x_react_sources` or `x_facebook_sources` metadata field from a
49 + * source map and exposes ways to query the React DevTools specific metadata
50 + * included in those fields.
51 + */
52 +export class SourceMapMetadataConsumer {
53 + _sourceMap: MixedSourceMap;
54 + _decodedHookMapCache: Map<string, HookMap>;
55 + _metadataBySource: ?MetadataMap;
56 +
57 + constructor(sourcemap: MixedSourceMap) {
58 + this._sourceMap = sourcemap;
59 + this._decodedHookMapCache = new Map();
60 + this._metadataBySource = null;
61 + }
62 +
63 + /**
64 + * Returns the Hook name assigned to a given location in the source code,
65 + * and a HookMap extracted from an extended source map.
66 + * See `getHookNameForLocation` for more details on implementation.
67 + *
68 + * When used with the `source-map` package, you'll first use
69 + * `SourceMapConsumer#originalPositionFor` to retrieve a source location,
70 + * then pass that location to `hookNameFor`.
71 + */
72 + hookNameFor({
73 + line,
74 + column,
75 + source,
76 + }: {|
77 + ...Position,
78 + +source: ?string,
79 + |}): ?string {
80 + if (source == null) {
81 + return null;
82 + }
83 +
84 + const hookMap = this._getHookMapForSource(source);
85 + if (hookMap == null) {
86 + return null;
87 + }
88 +
89 + return getHookNameForLocation({line, column}, hookMap);
90 + }
91 +
92 + hasHookMap(source: ?string) {
93 + if (source == null) {
94 + return null;
95 + }
96 + return this._getHookMapForSource(source) != null;
97 + }
98 +
99 + /**
100 + * Prepares and caches a lookup table of metadata by source name.
101 + */
102 + _getMetadataBySource(): MetadataMap {
103 + if (this._metadataBySource == null) {
104 + this._metadataBySource = this._getMetadataObjectsBySourceNames(
105 + this._sourceMap,
106 + );
107 + }
108 +
109 + return this._metadataBySource;
110 + }
111 +
112 + /**
113 + * Collects source metadata from the given map using the current source name
114 + * normalization function. Handles both index maps (with sections) and plain
115 + * maps.
116 + *
117 + * NOTE: If any sources are repeated in the map (which shouldn't usually happen,
118 + * but is technically possible because of index maps) we only keep the
119 + * metadata from the last occurrence of any given source.
120 + */
121 + _getMetadataObjectsBySourceNames(sourcemap: MixedSourceMap): MetadataMap {
122 + if (sourcemap.mappings === undefined) {
123 + const indexSourceMap: IndexSourceMap = sourcemap;
124 + const metadataMap = new Map();
125 + indexSourceMap.sections.forEach(section => {
126 + const metadataMapForIndexMap = this._getMetadataObjectsBySourceNames(
127 + section.map,
128 + );
129 + metadataMapForIndexMap.forEach((value, key) => {
130 + metadataMap.set(key, value);
131 + });
132 + });
133 + return metadataMap;
134 + }
135 +
136 + const metadataMap = new Map();
137 + const basicMap: BasicSourceMap = sourcemap;
138 + const updateMap = (metadata: ReactSourceMetadata, sourceIndex: number) => {
139 + let source = basicMap.sources[sourceIndex];
140 + if (source != null) {
141 + source = normalizeSourcePath(source, basicMap);
142 + metadataMap.set(source, metadata);
143 + }
144 + };
145 +
146 + if (
147 + sourcemap.hasOwnProperty(REACT_SOURCES_EXTENSION_KEY) &&
148 + sourcemap[REACT_SOURCES_EXTENSION_KEY] != null
149 + ) {
150 + const reactMetadataArray = sourcemap[REACT_SOURCES_EXTENSION_KEY];
151 + reactMetadataArray.filter(Boolean).forEach(updateMap);
152 + } else if (
153 + sourcemap.hasOwnProperty(FB_SOURCES_EXTENSION_KEY) &&
154 + sourcemap[FB_SOURCES_EXTENSION_KEY] != null
155 + ) {
156 + const fbMetadataArray = sourcemap[FB_SOURCES_EXTENSION_KEY];
157 + if (fbMetadataArray != null) {
158 + fbMetadataArray.forEach((fbMetadata, sourceIndex) => {
159 + // When extending source maps with React metadata using the
160 + // x_facebook_sources field, the position at index 1 on the
161 + // metadata tuple is reserved for React metadata
162 + const reactMetadata =
163 + fbMetadata != null
164 + ? fbMetadata[REACT_METADATA_INDEX_IN_FB_METADATA]
165 + : null;
166 + if (reactMetadata != null) {
167 + updateMap(reactMetadata, sourceIndex);
168 + }
169 + });
170 + }
171 + }
172 +
173 + return metadataMap;
174 + }
175 +
176 + /**
177 + * Decodes the function name mappings for the given source if needed, and
178 + * retrieves a sorted, searchable array of mappings.
179 + */
180 + _getHookMapForSource(source: string): ?HookMap {
181 + if (this._decodedHookMapCache.has(source)) {
182 + return this._decodedHookMapCache.get(source);
183 + }
184 + let hookMap = null;
185 + const metadataBySource = this._getMetadataBySource();
186 + const normalized = normalizeSourcePath(source, this._sourceMap);
187 + const metadata = metadataBySource.get(normalized);
188 + if (metadata != null) {
189 + const encodedHookMap = metadata[HOOK_MAP_INDEX_IN_REACT_METADATA];
190 + hookMap = encodedHookMap != null ? decodeHookMap(encodedHookMap) : null;
191 + }
192 + if (hookMap != null) {
193 + this._decodedHookMapCache.set(source, hookMap);
194 + }
195 + return hookMap;
196 + }
197 +}
packages/react-devtools-extensions/src/SourceMapTypes.js
+5 -5
@@ -27,8 +27,8 @@ export type BasicSourceMap = {|
27 +x_react_sources?: ReactSourcesArray,
28 |};
29
30 -export type IndexMapSection = {
31 - map: IndexMap | BasicSourceMap,
30 +export type IndexSourceMapSection = {
31 + map: IndexSourceMap | BasicSourceMap,
32 offset: {
33 line: number,
34 column: number,
@@ -37,14 +37,14 @@ export type IndexMapSection = {
37 ...
38 };
39
40 -export type IndexMap = {|
40 +export type IndexSourceMap = {|
41 +file?: string,
42 +mappings?: void, // avoids SourceMap being a disjoint union
43 +sourcesContent?: void,
44 - +sections: Array<IndexMapSection>,
44 + +sections: Array<IndexSourceMapSection>,
45 +version: number,
46 +x_facebook_sources?: FBSourcesArray,
47 +x_react_sources?: ReactSourcesArray,
48 |};
49
50 -export type MixedSourceMap = IndexMap | BasicSourceMap;
50 +export type MixedSourceMap = IndexSourceMap | BasicSourceMap;
packages/react-devtools-extensions/src/SourceMapUtils.js new
+34
@@ -0,0 +1,34 @@
1 +/*
2 + * Copyright (c) Facebook, Inc. and its affiliates.
3 + *
4 + * This source code is licensed under the MIT license found in the
5 + * LICENSE file in the root directory of this source tree.
6 + *
7 + * @flow strict-local
8 + */
9 +
10 +import type {
11 + BasicSourceMap,
12 + MixedSourceMap,
13 + IndexSourceMap,
14 +} from './SourceMapTypes';
15 +
16 +export function sourceMapIncludesSource(
17 + sourcemap: MixedSourceMap,
18 + source: ?string,
19 +): boolean {
20 + if (source == null) {
21 + return false;
22 + }
23 + if (sourcemap.mappings === undefined) {
24 + const indexSourceMap: IndexSourceMap = sourcemap;
25 + return indexSourceMap.sections.some(section => {
26 + return sourceMapIncludesSource(section.map, source);
27 + });
28 + }
29 +
30 + const basicMap: BasicSourceMap = sourcemap;
31 + return basicMap.sources.some(
32 + s => s === 'Inline Babel script' || source.endsWith(s),
33 + );
34 +}
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentUsingHooksIndirectly.js new
+45
@@ -0,0 +1,45 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const countState = (0, _react.useState)(0);
24 + const count = countState[0];
25 + const setCount = countState[1];
26 + const darkMode = useIsDarkMode();
27 + const [isDarkMode] = darkMode;
28 + (0, _react.useEffect)(() => {// ...
29 + }, []);
30 +
31 + const handleClick = () => setCount(count + 1);
32 +
33 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
34 + onClick: handleClick
35 + }, "Update count"));
36 +}
37 +
38 +function useIsDarkMode() {
39 + const darkModeState = (0, _react.useState)(false);
40 + const [isDarkMode] = darkModeState;
41 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
42 + }, []);
43 + return [isDarkMode, () => {}];
44 +}
45 +//# sourceMappingURL=ComponentUsingHooksIndirectly.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentUsingHooksIndirectly.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentUsingHooksIndirectly.js"],"names":["Component","countState","count","setCount","darkMode","useIsDarkMode","isDarkMode","handleClick","darkModeState","useEffectCreate"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAMC,UAAU,GAAG,qBAAS,CAAT,CAAnB;AACA,QAAMC,KAAK,GAAGD,UAAU,CAAC,CAAD,CAAxB;AACA,QAAME,QAAQ,GAAGF,UAAU,CAAC,CAAD,CAA3B;AAEA,QAAMG,QAAQ,GAAGC,aAAa,EAA9B;AACA,QAAM,CAACC,UAAD,IAAeF,QAArB;AAEA,wBAAU,MAAM,CACd;AACD,GAFD,EAEG,EAFH;;AAIA,QAAMG,WAAW,GAAG,MAAMJ,QAAQ,CAACD,KAAK,GAAG,CAAT,CAAlC;;AAEA,sBACE,yEACE,yDAAiBI,UAAjB,CADF,eAEE,qDAAaJ,KAAb,CAFF,eAGE;AAAQ,IAAA,OAAO,EAAEK;AAAjB,oBAHF,CADF;AAOD;;AAED,SAASF,aAAT,GAAyB;AACvB,QAAMG,aAAa,GAAG,qBAAS,KAAT,CAAtB;AACA,QAAM,CAACF,UAAD,IAAeE,aAArB;AAEA,wBAAU,SAASC,eAAT,GAA2B,CACnC;AACD,GAFD,EAEG,EAFH;AAIA,SAAO,CAACH,UAAD,EAAa,MAAM,CAAE,CAArB,CAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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, {useEffect, useState} from 'react';\n\nexport function Component() {\n const countState = useState(0);\n const count = countState[0];\n const setCount = countState[1];\n\n const darkMode = useIsDarkMode();\n const [isDarkMode] = darkMode;\n\n useEffect(() => {\n // ...\n }, []);\n\n const handleClick = () => setCount(count + 1);\n\n return (\n <>\n <div>Dark mode? {isDarkMode}</div>\n <div>Count: {count}</div>\n <button onClick={handleClick}>Update count</button>\n </>\n );\n}\n\nfunction useIsDarkMode() {\n const darkModeState = useState(false);\n const [isDarkMode] = darkModeState;\n\n useEffect(function useEffectCreate() {\n // Here is where we may listen to a \"theme\" event...\n }, []);\n\n return [isDarkMode, () => {}];\n}\n"],"x_facebook_sources":[[null,[{"names":["<no-hook>","count","darkMode","isDarkMode"],"mappings":"CAAD;aqBCA,AWDA;iBbEA,AeFA;oCVGA,AeHA"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithCustomHook.js new
+41
@@ -0,0 +1,41 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + const isDarkMode = useIsDarkMode();
25 + (0, _react.useEffect)(() => {// ...
26 + }, []);
27 +
28 + const handleClick = () => setCount(count + 1);
29 +
30 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
31 + onClick: handleClick
32 + }, "Update count"));
33 +}
34 +
35 +function useIsDarkMode() {
36 + const [isDarkMode] = (0, _react.useState)(false);
37 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
38 + }, []);
39 + return isDarkMode;
40 +}
41 +//# sourceMappingURL=ComponentWithCustomHook.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithCustomHook.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithCustomHook.js"],"names":["Component","count","setCount","isDarkMode","useIsDarkMode","handleClick","useEffectCreate"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AACA,QAAMC,UAAU,GAAGC,aAAa,EAAhC;AAEA,wBAAU,MAAM,CACd;AACD,GAFD,EAEG,EAFH;;AAIA,QAAMC,WAAW,GAAG,MAAMH,QAAQ,CAACD,KAAK,GAAG,CAAT,CAAlC;;AAEA,sBACE,yEACE,yDAAiBE,UAAjB,CADF,eAEE,qDAAaF,KAAb,CAFF,eAGE;AAAQ,IAAA,OAAO,EAAEI;AAAjB,oBAHF,CADF;AAOD;;AAED,SAASD,aAAT,GAAyB;AACvB,QAAM,CAACD,UAAD,IAAe,qBAAS,KAAT,CAArB;AAEA,wBAAU,SAASG,eAAT,GAA2B,CACnC;AACD,GAFD,EAEG,EAFH;AAIA,SAAOH,UAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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, {useEffect, useState} from 'react';\n\nexport function Component() {\n const [count, setCount] = useState(0);\n const isDarkMode = useIsDarkMode();\n\n useEffect(() => {\n // ...\n }, []);\n\n const handleClick = () => setCount(count + 1);\n\n return (\n <>\n <div>Dark mode? {isDarkMode}</div>\n <div>Count: {count}</div>\n <button onClick={handleClick}>Update count</button>\n </>\n );\n}\n\nfunction useIsDarkMode() {\n const [isDarkMode] = useState(false);\n\n useEffect(function useEffectCreate() {\n // Here is where we may listen to a \"theme\" event...\n }, []);\n\n return isDarkMode;\n}\n"],"x_facebook_sources":[[null,[{"names":["<no-hook>","count","isDarkMode"],"mappings":"CAAD;a4BCA,AWDA;clBEA,AeFA;gCbEA,AeFA"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithExternalCustomHooks.js new
+26
@@ -0,0 +1,26 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireDefault(require("react"));
9 +
10 +var _useTheme = _interopRequireDefault(require("./useTheme"));
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const theme = (0, _useTheme.default)();
24 + return /*#__PURE__*/_react.default.createElement("div", null, "theme: ", theme);
25 +}
26 +//# sourceMappingURL=ComponentWithExternalCustomHooks.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithExternalCustomHooks.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithExternalCustomHooks.js"],"names":["Component","theme"],"mappings":";;;;;;;AASA;;AACA;;;;AAVA;;;;;;;;AAYO,SAASA,SAAT,GAAqB;AAC1B,QAAMC,KAAK,GAAG,wBAAd;AAEA,sBAAO,qDAAaA,KAAb,CAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 from 'react';\nimport useTheme from './useTheme';\n\nexport function Component() {\n const theme = useTheme();\n\n return <div>theme: {theme}</div>;\n}\n"],"x_facebook_sources":[[null,[{"names":["<no-hook>","theme"],"mappings":"CAAD;cgBCA,AUDA"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js new
+30
@@ -0,0 +1,30 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = require("react");
9 +
10 +/**
11 + * Copyright (c) Facebook, Inc. and its affiliates.
12 + *
13 + * This source code is licensed under the MIT license found in the
14 + * LICENSE file in the root directory of this source tree.
15 + *
16 + * @flow
17 + */
18 +const A = /*#__PURE__*/(0, _react.createContext)(1);
19 +const B = /*#__PURE__*/(0, _react.createContext)(2);
20 +
21 +function Component() {
22 + const a = (0, _react.useContext)(A);
23 + const b = (0, _react.useContext)(B); // prettier-ignore
24 +
25 + const c = (0, _react.useContext)(A),
26 + d = (0, _react.useContext)(B); // eslint-disable-line one-var
27 +
28 + return a + b + c + d;
29 +}
30 +//# sourceMappingURL=ComponentWithMultipleHooksPerLine.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithMultipleHooksPerLine.js"],"names":["A","B","Component","a","b","c","d"],"mappings":";;;;;;;AASA;;AATA;;;;;;;;AAWA,MAAMA,CAAC,gBAAG,0BAAc,CAAd,CAAV;AACA,MAAMC,CAAC,gBAAG,0BAAc,CAAd,CAAV;;AAEO,SAASC,SAAT,GAAqB;AAC1B,QAAMC,CAAC,GAAG,uBAAWH,CAAX,CAAV;AACA,QAAMI,CAAC,GAAG,uBAAWH,CAAX,CAAV,CAF0B,CAI1B;;AACA,QAAMI,CAAC,GAAG,uBAAWL,CAAX,CAAV;AAAA,QAAyBM,CAAC,GAAG,uBAAWL,CAAX,CAA7B,CAL0B,CAKkB;;AAE5C,SAAOE,CAAC,GAAGC,CAAJ,GAAQC,CAAR,GAAYC,CAAnB;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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} from 'react';\n\nconst A = createContext(1);\nconst B = createContext(2);\n\nexport function Component() {\n const a = useContext(A);\n const b = useContext(B);\n\n // prettier-ignore\n const c = useContext(A), d = useContext(B); // eslint-disable-line one-var\n\n return a + b + c + d;\n}\n"],"x_facebook_sources":[[null,[{"names":["<no-hook>","a","b","c","d"],"mappings":"CAAD;gBYCA,AaDA;iBbEA,AaFA;oBbGA,AaHA,AMIA,AaJA"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithNestedHooks.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +/**
4 + * Copyright (c) Facebook, Inc. and its affiliates.
5 + *
6 + * This source code is licensed under the MIT license found in the
7 + * LICENSE file in the root directory of this source tree.
8 + *
9 + * @flow
10 + */
11 +const {
12 + useMemo,
13 + useState
14 +} = require('react');
15 +
16 +function Component(props) {
17 + const InnerComponent = useMemo(() => () => {
18 + const [state] = useState(0);
19 + return state;
20 + });
21 + props.callback(InnerComponent);
22 + return null;
23 +}
24 +
25 +module.exports = {
26 + Component
27 +};
28 +//# sourceMappingURL=ComponentWithNestedHooks.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithNestedHooks.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithNestedHooks.js"],"names":["useMemo","useState","require","Component","props","InnerComponent","state","callback","module","exports"],"mappings":";;AAAA;;;;;;;;AAQA,MAAM;AAACA,EAAAA,OAAD;AAAUC,EAAAA;AAAV,IAAsBC,OAAO,CAAC,OAAD,CAAnC;;AAEA,SAASC,SAAT,CAAmBC,KAAnB,EAA0B;AACxB,QAAMC,cAAc,GAAGL,OAAO,CAAC,MAAM,MAAM;AACzC,UAAM,CAACM,KAAD,IAAUL,QAAQ,CAAC,CAAD,CAAxB;AAEA,WAAOK,KAAP;AACD,GAJ6B,CAA9B;AAKAF,EAAAA,KAAK,CAACG,QAAN,CAAeF,cAAf;AAEA,SAAO,IAAP;AACD;;AAEDG,MAAM,CAACC,OAAP,GAAiB;AAACN,EAAAA;AAAD,CAAjB","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 */\nconst {useMemo, useState} = require('react');\n\nfunction Component(props) {\n const InnerComponent = useMemo(() => () => {\n const [state] = useState(0);\n\n return state;\n });\n props.callback(InnerComponent);\n\n return null;\n}\n\nmodule.exports = {Component};\n"],"x_facebook_sources":[[null,[{"names":["<no-hook>","InnerComponent","state"],"mappings":"CAAD;YyBCA;aLCA,AWDA;gB3BDA"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ContainingStringSourceMappingURL.js new
+29
@@ -0,0 +1,29 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +// ?sourceMappingURL=([^\s'"]+)/gm
23 +function Component() {
24 + const [count, setCount] = (0, _react.useState)(0);
25 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
26 + onClick: () => setCount(count + 1)
27 + }, "Click me"));
28 +}
29 +//# sourceMappingURL=ContainingStringSourceMappingURL.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ContainingStringSourceMappingURL.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ContainingStringSourceMappingURL.js"],"names":["Component","count","setCount"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWA;AAEO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AAEA,sBACE,uDACE,wDAAgBD,KAAhB,WADF,eAEE;AAAQ,IAAA,OAAO,EAAE,MAAMC,QAAQ,CAACD,KAAK,GAAG,CAAT;AAA/B,gBAFF,CADF;AAMD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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\n// ?sourceMappingURL=([^\\s'\"]+)/gm\n\nexport function Component() {\n const [count, setCount] = useState(0);\n\n return (\n <div>\n <p>You clicked {count} times</p>\n <button onClick={() => setCount(count + 1)}>Click me</button>\n </div>\n );\n}\n"],"x_facebook_sources":[[null,[{"names":["<no-hook>","count"],"mappings":"CAAD;e4BCA,AWDA"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/Example.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
25 + onClick: () => setCount(count + 1)
26 + }, "Click me"));
27 +}
28 +//# sourceMappingURL=Example.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/Example.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["Example.js"],"names":["Component","count","setCount"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AAEA,sBACE,uDACE,wDAAgBD,KAAhB,WADF,eAEE;AAAQ,IAAA,OAAO,EAAE,MAAMC,QAAQ,CAACD,KAAK,GAAG,CAAT;AAA/B,gBAFF,CADF;AAMD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 <div>\n <p>You clicked {count} times</p>\n <button onClick={() => setCount(count + 1)}>Click me</button>\n </div>\n );\n}\n"],"x_facebook_sources":[[null,[{"names":["<no-hook>","count"],"mappings":"CAAD;a4BCA,AWDA"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/InlineRequire.js new
+21
@@ -0,0 +1,21 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +/**
9 + * Copyright (c) Facebook, Inc. and its affiliates.
10 + *
11 + * This source code is licensed under the MIT license found in the
12 + * LICENSE file in the root directory of this source tree.
13 + *
14 + * @flow
15 + */
16 +function Component() {
17 + const [count] = require('react').useState(0);
18 +
19 + return count;
20 +}
21 +//# sourceMappingURL=InlineRequire.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/InlineRequire.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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_facebook_sources":[[null,[{"names":["<no-hook>"],"mappings":"CAAD"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ToDoList.js new
+106
@@ -0,0 +1,106 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.ListItem = ListItem;
7 +exports.List = List;
8 +
9 +var React = _interopRequireWildcard(require("react"));
10 +
11 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
12 +
13 +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; }
14 +
15 +/**
16 + * Copyright (c) Facebook, Inc. and its affiliates.
17 + *
18 + * This source code is licensed under the MIT license found in the
19 + * LICENSE file in the root directory of this source tree.
20 + *
21 + * @flow
22 + */
23 +function ListItem({
24 + item,
25 + removeItem,
26 + toggleItem
27 +}) {
28 + const handleDelete = (0, React.useCallback)(() => {
29 + removeItem(item);
30 + }, [item, removeItem]);
31 + const handleToggle = (0, React.useCallback)(() => {
32 + toggleItem(item);
33 + }, [item, toggleItem]);
34 + return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("button", {
35 + onClick: handleDelete
36 + }, "Delete"), /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
37 + checked: item.isComplete,
38 + onChange: handleToggle,
39 + type: "checkbox"
40 + }), ' ', item.text));
41 +}
42 +
43 +function List(props) {
44 + const [newItemText, setNewItemText] = (0, React.useState)('');
45 + const [items, setItems] = (0, React.useState)([{
46 + id: 1,
47 + isComplete: true,
48 + text: 'First'
49 + }, {
50 + id: 2,
51 + isComplete: true,
52 + text: 'Second'
53 + }, {
54 + id: 3,
55 + isComplete: false,
56 + text: 'Third'
57 + }]);
58 + const [uid, setUID] = (0, React.useState)(4);
59 + const handleClick = (0, React.useCallback)(() => {
60 + if (newItemText !== '') {
61 + setItems([...items, {
62 + id: uid,
63 + isComplete: false,
64 + text: newItemText
65 + }]);
66 + setUID(uid + 1);
67 + setNewItemText('');
68 + }
69 + }, [newItemText, items, uid]);
70 + const handleKeyPress = (0, React.useCallback)(event => {
71 + if (event.key === 'Enter') {
72 + handleClick();
73 + }
74 + }, [handleClick]);
75 + const handleChange = (0, React.useCallback)(event => {
76 + setNewItemText(event.currentTarget.value);
77 + }, [setNewItemText]);
78 + const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
79 + const toggleItem = (0, React.useCallback)(itemToToggle => {
80 + // Dont use indexOf()
81 + // because editing props in DevTools creates a new Object.
82 + const index = items.findIndex(item => item.id === itemToToggle.id);
83 + setItems(items.slice(0, index).concat({ ...itemToToggle,
84 + isComplete: !itemToToggle.isComplete
85 + }).concat(items.slice(index + 1)));
86 + }, [items]);
87 + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "List"), /*#__PURE__*/React.createElement("input", {
88 + type: "text",
89 + placeholder: "New list item...",
90 + value: newItemText,
91 + onChange: handleChange,
92 + onKeyPress: handleKeyPress
93 + }), /*#__PURE__*/React.createElement("button", {
94 + disabled: newItemText === '',
95 + onClick: handleClick
96 + }, /*#__PURE__*/React.createElement("span", {
97 + role: "img",
98 + "aria-label": "Add item"
99 + }, "Add")), /*#__PURE__*/React.createElement("ul", null, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
100 + key: item.id,
101 + item: item,
102 + removeItem: removeItem,
103 + toggleItem: toggleItem
104 + }))));
105 +}
106 +//# sourceMappingURL=ToDoList.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/ToDoList.js.map new
+1
@@ -0,0 +1 @@
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;;;;;;AATA;;;;;;;;AAYO,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;AAC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,IAAA,KAAK,EAAEF,WAHT;AAIE,IAAA,QAAQ,EAAEW,YAJZ;AAKE,IAAA,UAAU,EAAEH;AALd,IAFF,eASE;AAAQ,IAAA,QAAQ,EAAER,WAAW,KAAK,EAAlC;AAAsC,IAAA,OAAO,EAAEO;AAA/C,kBACE;AAAM,IAAA,IAAI,EAAC,KAAX;AAAiB,kBAAW;AAA5B,WADF,CATF,eAcE,gCACGL,KAAK,CAACmB,GAAN,CAAU9B,IAAI,iBACb,oBAAC,QAAD;AACE,IAAA,GAAG,EAAEA,IAAI,CAACa,EADZ;AAEE,IAAA,IAAI,EAAEb,IAFR;AAGE,IAAA,UAAU,EAAEC,UAHd;AAIE,IAAA,UAAU,EAAEC;AAJd,IADD,CADH,CAdF,CADF;AA2BD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 <li>\n <button onClick={handleDelete}>Delete</button>\n <label>\n <input\n checked={item.isComplete}\n onChange={handleToggle}\n type=\"checkbox\"\n />{' '}\n {item.text}\n </label>\n </li>\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 <Fragment>\n <h1>List</h1>\n <input\n type=\"text\"\n placeholder=\"New list item...\"\n value={newItemText}\n onChange={handleChange}\n onKeyPress={handleKeyPress}\n />\n <button disabled={newItemText === ''} onClick={handleClick}>\n <span role=\"img\" aria-label=\"Add item\">\n Add\n </span>\n </button>\n <ul>\n {items.map(item => (\n <ListItem\n key={item.id}\n item={item}\n removeItem={removeItem}\n toggleItem={toggleItem}\n />\n ))}\n </ul>\n </Fragment>\n );\n}\n"],"x_facebook_sources":[[null,[{"names":["<no-hook>","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
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/index.js new
+89
@@ -0,0 +1,89 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
7 + enumerable: true,
8 + get: function () {
9 + return _ComponentUsingHooksIndirectly.Component;
10 + }
11 +});
12 +Object.defineProperty(exports, "ComponentWithCustomHook", {
13 + enumerable: true,
14 + get: function () {
15 + return _ComponentWithCustomHook.Component;
16 + }
17 +});
18 +Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
19 + enumerable: true,
20 + get: function () {
21 + return _ComponentWithExternalCustomHooks.Component;
22 + }
23 +});
24 +Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
25 + enumerable: true,
26 + get: function () {
27 + return _ComponentWithMultipleHooksPerLine.Component;
28 + }
29 +});
30 +Object.defineProperty(exports, "ComponentWithNestedHooks", {
31 + enumerable: true,
32 + get: function () {
33 + return _ComponentWithNestedHooks.Component;
34 + }
35 +});
36 +Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
37 + enumerable: true,
38 + get: function () {
39 + return _ContainingStringSourceMappingURL.Component;
40 + }
41 +});
42 +Object.defineProperty(exports, "Example", {
43 + enumerable: true,
44 + get: function () {
45 + return _Example.Component;
46 + }
47 +});
48 +Object.defineProperty(exports, "InlineRequire", {
49 + enumerable: true,
50 + get: function () {
51 + return _InlineRequire.Component;
52 + }
53 +});
54 +Object.defineProperty(exports, "useTheme", {
55 + enumerable: true,
56 + get: function () {
57 + return _useTheme.default;
58 + }
59 +});
60 +exports.ToDoList = void 0;
61 +
62 +var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
63 +
64 +var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
65 +
66 +var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
67 +
68 +var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
69 +
70 +var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
71 +
72 +var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
73 +
74 +var _Example = require("./Example");
75 +
76 +var _InlineRequire = require("./InlineRequire");
77 +
78 +var ToDoList = _interopRequireWildcard(require("./ToDoList"));
79 +
80 +exports.ToDoList = ToDoList;
81 +
82 +var _useTheme = _interopRequireDefault(require("./useTheme"));
83 +
84 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
85 +
86 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
87 +
88 +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; }
89 +//# sourceMappingURL=index.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/index.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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_facebook_sources":[[null,[{"names":["<no-hook>"],"mappings":"CAAD"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/useTheme.js new
+27
@@ -0,0 +1,27 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = useTheme;
7 +exports.ThemeContext = void 0;
8 +
9 +var _react = require("react");
10 +
11 +/**
12 + * Copyright (c) Facebook, Inc. and its affiliates.
13 + *
14 + * This source code is licensed under the MIT license found in the
15 + * LICENSE file in the root directory of this source tree.
16 + *
17 + * @flow
18 + */
19 +const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
20 +exports.ThemeContext = ThemeContext;
21 +
22 +function useTheme() {
23 + const theme = (0, _react.useContext)(ThemeContext);
24 + (0, _react.useDebugValue)(theme);
25 + return theme;
26 +}
27 +//# sourceMappingURL=useTheme.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/fb-sources-extended/index-map/useTheme.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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_facebook_sources":[[null,[{"names":["<no-hook>","theme"],"mappings":"CAAD;egBCA,AwBDA"}]]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentUsingHooksIndirectly.js new
+45
@@ -0,0 +1,45 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const countState = (0, _react.useState)(0);
24 + const count = countState[0];
25 + const setCount = countState[1];
26 + const darkMode = useIsDarkMode();
27 + const [isDarkMode] = darkMode;
28 + (0, _react.useEffect)(() => {// ...
29 + }, []);
30 +
31 + const handleClick = () => setCount(count + 1);
32 +
33 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
34 + onClick: handleClick
35 + }, "Update count"));
36 +}
37 +
38 +function useIsDarkMode() {
39 + const darkModeState = (0, _react.useState)(false);
40 + const [isDarkMode] = darkModeState;
41 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
42 + }, []);
43 + return [isDarkMode, () => {}];
44 +}
45 +//# sourceMappingURL=ComponentUsingHooksIndirectly.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentUsingHooksIndirectly.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentUsingHooksIndirectly.js"],"names":["Component","countState","count","setCount","darkMode","useIsDarkMode","isDarkMode","handleClick","darkModeState","useEffectCreate"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAMC,UAAU,GAAG,qBAAS,CAAT,CAAnB;AACA,QAAMC,KAAK,GAAGD,UAAU,CAAC,CAAD,CAAxB;AACA,QAAME,QAAQ,GAAGF,UAAU,CAAC,CAAD,CAA3B;AAEA,QAAMG,QAAQ,GAAGC,aAAa,EAA9B;AACA,QAAM,CAACC,UAAD,IAAeF,QAArB;AAEA,wBAAU,MAAM,CACd;AACD,GAFD,EAEG,EAFH;;AAIA,QAAMG,WAAW,GAAG,MAAMJ,QAAQ,CAACD,KAAK,GAAG,CAAT,CAAlC;;AAEA,sBACE,yEACE,yDAAiBI,UAAjB,CADF,eAEE,qDAAaJ,KAAb,CAFF,eAGE;AAAQ,IAAA,OAAO,EAAEK;AAAjB,oBAHF,CADF;AAOD;;AAED,SAASF,aAAT,GAAyB;AACvB,QAAMG,aAAa,GAAG,qBAAS,KAAT,CAAtB;AACA,QAAM,CAACF,UAAD,IAAeE,aAArB;AAEA,wBAAU,SAASC,eAAT,GAA2B,CACnC;AACD,GAFD,EAEG,EAFH;AAIA,SAAO,CAACH,UAAD,EAAa,MAAM,CAAE,CAArB,CAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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, {useEffect, useState} from 'react';\n\nexport function Component() {\n const countState = useState(0);\n const count = countState[0];\n const setCount = countState[1];\n\n const darkMode = useIsDarkMode();\n const [isDarkMode] = darkMode;\n\n useEffect(() => {\n // ...\n }, []);\n\n const handleClick = () => setCount(count + 1);\n\n return (\n <>\n <div>Dark mode? {isDarkMode}</div>\n <div>Count: {count}</div>\n <button onClick={handleClick}>Update count</button>\n </>\n );\n}\n\nfunction useIsDarkMode() {\n const darkModeState = useState(false);\n const [isDarkMode] = darkModeState;\n\n useEffect(function useEffectCreate() {\n // Here is where we may listen to a \"theme\" event...\n }, []);\n\n return [isDarkMode, () => {}];\n}\n"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentWithCustomHook.js new
+41
@@ -0,0 +1,41 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + const isDarkMode = useIsDarkMode();
25 + (0, _react.useEffect)(() => {// ...
26 + }, []);
27 +
28 + const handleClick = () => setCount(count + 1);
29 +
30 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
31 + onClick: handleClick
32 + }, "Update count"));
33 +}
34 +
35 +function useIsDarkMode() {
36 + const [isDarkMode] = (0, _react.useState)(false);
37 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
38 + }, []);
39 + return isDarkMode;
40 +}
41 +//# sourceMappingURL=ComponentWithCustomHook.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentWithCustomHook.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithCustomHook.js"],"names":["Component","count","setCount","isDarkMode","useIsDarkMode","handleClick","useEffectCreate"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AACA,QAAMC,UAAU,GAAGC,aAAa,EAAhC;AAEA,wBAAU,MAAM,CACd;AACD,GAFD,EAEG,EAFH;;AAIA,QAAMC,WAAW,GAAG,MAAMH,QAAQ,CAACD,KAAK,GAAG,CAAT,CAAlC;;AAEA,sBACE,yEACE,yDAAiBE,UAAjB,CADF,eAEE,qDAAaF,KAAb,CAFF,eAGE;AAAQ,IAAA,OAAO,EAAEI;AAAjB,oBAHF,CADF;AAOD;;AAED,SAASD,aAAT,GAAyB;AACvB,QAAM,CAACD,UAAD,IAAe,qBAAS,KAAT,CAArB;AAEA,wBAAU,SAASG,eAAT,GAA2B,CACnC;AACD,GAFD,EAEG,EAFH;AAIA,SAAOH,UAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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, {useEffect, useState} from 'react';\n\nexport function Component() {\n const [count, setCount] = useState(0);\n const isDarkMode = useIsDarkMode();\n\n useEffect(() => {\n // ...\n }, []);\n\n const handleClick = () => setCount(count + 1);\n\n return (\n <>\n <div>Dark mode? {isDarkMode}</div>\n <div>Count: {count}</div>\n <button onClick={handleClick}>Update count</button>\n </>\n );\n}\n\nfunction useIsDarkMode() {\n const [isDarkMode] = useState(false);\n\n useEffect(function useEffectCreate() {\n // Here is where we may listen to a \"theme\" event...\n }, []);\n\n return isDarkMode;\n}\n"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentWithExternalCustomHooks.js new
+26
@@ -0,0 +1,26 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireDefault(require("react"));
9 +
10 +var _useTheme = _interopRequireDefault(require("./useTheme"));
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const theme = (0, _useTheme.default)();
24 + return /*#__PURE__*/_react.default.createElement("div", null, "theme: ", theme);
25 +}
26 +//# sourceMappingURL=ComponentWithExternalCustomHooks.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentWithExternalCustomHooks.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithExternalCustomHooks.js"],"names":["Component","theme"],"mappings":";;;;;;;AASA;;AACA;;;;AAVA;;;;;;;;AAYO,SAASA,SAAT,GAAqB;AAC1B,QAAMC,KAAK,GAAG,wBAAd;AAEA,sBAAO,qDAAaA,KAAb,CAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 from 'react';\nimport useTheme from './useTheme';\n\nexport function Component() {\n const theme = useTheme();\n\n return <div>theme: {theme}</div>;\n}\n"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentWithMultipleHooksPerLine.js new
+30
@@ -0,0 +1,30 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = require("react");
9 +
10 +/**
11 + * Copyright (c) Facebook, Inc. and its affiliates.
12 + *
13 + * This source code is licensed under the MIT license found in the
14 + * LICENSE file in the root directory of this source tree.
15 + *
16 + * @flow
17 + */
18 +const A = /*#__PURE__*/(0, _react.createContext)(1);
19 +const B = /*#__PURE__*/(0, _react.createContext)(2);
20 +
21 +function Component() {
22 + const a = (0, _react.useContext)(A);
23 + const b = (0, _react.useContext)(B); // prettier-ignore
24 +
25 + const c = (0, _react.useContext)(A),
26 + d = (0, _react.useContext)(B); // eslint-disable-line one-var
27 +
28 + return a + b + c + d;
29 +}
30 +//# sourceMappingURL=ComponentWithMultipleHooksPerLine.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentWithMultipleHooksPerLine.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithMultipleHooksPerLine.js"],"names":["A","B","Component","a","b","c","d"],"mappings":";;;;;;;AASA;;AATA;;;;;;;;AAWA,MAAMA,CAAC,gBAAG,0BAAc,CAAd,CAAV;AACA,MAAMC,CAAC,gBAAG,0BAAc,CAAd,CAAV;;AAEO,SAASC,SAAT,GAAqB;AAC1B,QAAMC,CAAC,GAAG,uBAAWH,CAAX,CAAV;AACA,QAAMI,CAAC,GAAG,uBAAWH,CAAX,CAAV,CAF0B,CAI1B;;AACA,QAAMI,CAAC,GAAG,uBAAWL,CAAX,CAAV;AAAA,QAAyBM,CAAC,GAAG,uBAAWL,CAAX,CAA7B,CAL0B,CAKkB;;AAE5C,SAAOE,CAAC,GAAGC,CAAJ,GAAQC,CAAR,GAAYC,CAAnB;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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} from 'react';\n\nconst A = createContext(1);\nconst B = createContext(2);\n\nexport function Component() {\n const a = useContext(A);\n const b = useContext(B);\n\n // prettier-ignore\n const c = useContext(A), d = useContext(B); // eslint-disable-line one-var\n\n return a + b + c + d;\n}\n"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentWithNestedHooks.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +/**
4 + * Copyright (c) Facebook, Inc. and its affiliates.
5 + *
6 + * This source code is licensed under the MIT license found in the
7 + * LICENSE file in the root directory of this source tree.
8 + *
9 + * @flow
10 + */
11 +const {
12 + useMemo,
13 + useState
14 +} = require('react');
15 +
16 +function Component(props) {
17 + const InnerComponent = useMemo(() => () => {
18 + const [state] = useState(0);
19 + return state;
20 + });
21 + props.callback(InnerComponent);
22 + return null;
23 +}
24 +
25 +module.exports = {
26 + Component
27 +};
28 +//# sourceMappingURL=ComponentWithNestedHooks.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ComponentWithNestedHooks.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithNestedHooks.js"],"names":["useMemo","useState","require","Component","props","InnerComponent","state","callback","module","exports"],"mappings":";;AAAA;;;;;;;;AAQA,MAAM;AAACA,EAAAA,OAAD;AAAUC,EAAAA;AAAV,IAAsBC,OAAO,CAAC,OAAD,CAAnC;;AAEA,SAASC,SAAT,CAAmBC,KAAnB,EAA0B;AACxB,QAAMC,cAAc,GAAGL,OAAO,CAAC,MAAM,MAAM;AACzC,UAAM,CAACM,KAAD,IAAUL,QAAQ,CAAC,CAAD,CAAxB;AAEA,WAAOK,KAAP;AACD,GAJ6B,CAA9B;AAKAF,EAAAA,KAAK,CAACG,QAAN,CAAeF,cAAf;AAEA,SAAO,IAAP;AACD;;AAEDG,MAAM,CAACC,OAAP,GAAiB;AAACN,EAAAA;AAAD,CAAjB","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 */\nconst {useMemo, useState} = require('react');\n\nfunction Component(props) {\n const InnerComponent = useMemo(() => () => {\n const [state] = useState(0);\n\n return state;\n });\n props.callback(InnerComponent);\n\n return null;\n}\n\nmodule.exports = {Component};\n"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ContainingStringSourceMappingURL.js new
+29
@@ -0,0 +1,29 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +// ?sourceMappingURL=([^\s'"]+)/gm
23 +function Component() {
24 + const [count, setCount] = (0, _react.useState)(0);
25 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
26 + onClick: () => setCount(count + 1)
27 + }, "Click me"));
28 +}
29 +//# sourceMappingURL=ContainingStringSourceMappingURL.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ContainingStringSourceMappingURL.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ContainingStringSourceMappingURL.js"],"names":["Component","count","setCount"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWA;AAEO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AAEA,sBACE,uDACE,wDAAgBD,KAAhB,WADF,eAEE;AAAQ,IAAA,OAAO,EAAE,MAAMC,QAAQ,CAACD,KAAK,GAAG,CAAT;AAA/B,gBAFF,CADF;AAMD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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\n// ?sourceMappingURL=([^\\s'\"]+)/gm\n\nexport function Component() {\n const [count, setCount] = useState(0);\n\n return (\n <div>\n <p>You clicked {count} times</p>\n <button onClick={() => setCount(count + 1)}>Click me</button>\n </div>\n );\n}\n"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/Example.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
25 + onClick: () => setCount(count + 1)
26 + }, "Click me"));
27 +}
28 +//# sourceMappingURL=Example.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/Example.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["Example.js"],"names":["Component","count","setCount"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AAEA,sBACE,uDACE,wDAAgBD,KAAhB,WADF,eAEE;AAAQ,IAAA,OAAO,EAAE,MAAMC,QAAQ,CAACD,KAAK,GAAG,CAAT;AAA/B,gBAFF,CADF;AAMD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 <div>\n <p>You clicked {count} times</p>\n <button onClick={() => setCount(count + 1)}>Click me</button>\n </div>\n );\n}\n"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/InlineRequire.js new
+21
@@ -0,0 +1,21 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +/**
9 + * Copyright (c) Facebook, Inc. and its affiliates.
10 + *
11 + * This source code is licensed under the MIT license found in the
12 + * LICENSE file in the root directory of this source tree.
13 + *
14 + * @flow
15 + */
16 +function Component() {
17 + const [count] = require('react').useState(0);
18 +
19 + return count;
20 +}
21 +//# sourceMappingURL=InlineRequire.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/InlineRequire.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ToDoList.js new
+106
@@ -0,0 +1,106 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.ListItem = ListItem;
7 +exports.List = List;
8 +
9 +var React = _interopRequireWildcard(require("react"));
10 +
11 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
12 +
13 +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; }
14 +
15 +/**
16 + * Copyright (c) Facebook, Inc. and its affiliates.
17 + *
18 + * This source code is licensed under the MIT license found in the
19 + * LICENSE file in the root directory of this source tree.
20 + *
21 + * @flow
22 + */
23 +function ListItem({
24 + item,
25 + removeItem,
26 + toggleItem
27 +}) {
28 + const handleDelete = (0, React.useCallback)(() => {
29 + removeItem(item);
30 + }, [item, removeItem]);
31 + const handleToggle = (0, React.useCallback)(() => {
32 + toggleItem(item);
33 + }, [item, toggleItem]);
34 + return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("button", {
35 + onClick: handleDelete
36 + }, "Delete"), /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
37 + checked: item.isComplete,
38 + onChange: handleToggle,
39 + type: "checkbox"
40 + }), ' ', item.text));
41 +}
42 +
43 +function List(props) {
44 + const [newItemText, setNewItemText] = (0, React.useState)('');
45 + const [items, setItems] = (0, React.useState)([{
46 + id: 1,
47 + isComplete: true,
48 + text: 'First'
49 + }, {
50 + id: 2,
51 + isComplete: true,
52 + text: 'Second'
53 + }, {
54 + id: 3,
55 + isComplete: false,
56 + text: 'Third'
57 + }]);
58 + const [uid, setUID] = (0, React.useState)(4);
59 + const handleClick = (0, React.useCallback)(() => {
60 + if (newItemText !== '') {
61 + setItems([...items, {
62 + id: uid,
63 + isComplete: false,
64 + text: newItemText
65 + }]);
66 + setUID(uid + 1);
67 + setNewItemText('');
68 + }
69 + }, [newItemText, items, uid]);
70 + const handleKeyPress = (0, React.useCallback)(event => {
71 + if (event.key === 'Enter') {
72 + handleClick();
73 + }
74 + }, [handleClick]);
75 + const handleChange = (0, React.useCallback)(event => {
76 + setNewItemText(event.currentTarget.value);
77 + }, [setNewItemText]);
78 + const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
79 + const toggleItem = (0, React.useCallback)(itemToToggle => {
80 + // Dont use indexOf()
81 + // because editing props in DevTools creates a new Object.
82 + const index = items.findIndex(item => item.id === itemToToggle.id);
83 + setItems(items.slice(0, index).concat({ ...itemToToggle,
84 + isComplete: !itemToToggle.isComplete
85 + }).concat(items.slice(index + 1)));
86 + }, [items]);
87 + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "List"), /*#__PURE__*/React.createElement("input", {
88 + type: "text",
89 + placeholder: "New list item...",
90 + value: newItemText,
91 + onChange: handleChange,
92 + onKeyPress: handleKeyPress
93 + }), /*#__PURE__*/React.createElement("button", {
94 + disabled: newItemText === '',
95 + onClick: handleClick
96 + }, /*#__PURE__*/React.createElement("span", {
97 + role: "img",
98 + "aria-label": "Add item"
99 + }, "Add")), /*#__PURE__*/React.createElement("ul", null, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
100 + key: item.id,
101 + item: item,
102 + removeItem: removeItem,
103 + toggleItem: toggleItem
104 + }))));
105 +}
106 +//# sourceMappingURL=ToDoList.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/ToDoList.js.map new
+1
@@ -0,0 +1 @@
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;;;;;;AATA;;;;;;;;AAYO,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,QAAM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,IAAA,UAAU,EAAEH;AALd,IAFF,eASE;AAAQ,IAAA,QAAQ,EAAER,WAAW,KAAK,EAAlC;AAAsC,IAAA,OAAO,EAAEO;AAA/C,kBACE;AAAM,IAAA,IAAI,EAAC,KAAX;AAAiB,kBAAW;AAA5B,WADF,CATF,eAcE,gCACGL,KAAK,CAACmB,GAAN,CAAU9B,IAAI,iBACb,oBAAC,QAAD;AACE,IAAA,GAAG,EAAEA,IAAI,CAACa,EADZ;AAEE,IAAA,IAAI,EAAEb,IAFR;AAGE,IAAA,UAAU,EAAEC,UAHd;AAIE,IAAA,UAAU,EAAEC;AAJd,IADD,CADH,CAdF,CADF;AA2BD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 <li>\n <button onClick={handleDelete}>Delete</button>\n <label>\n <input\n checked={item.isComplete}\n onChange={handleToggle}\n type=\"checkbox\"\n />{' '}\n {item.text}\n </label>\n </li>\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 <Fragment>\n <h1>List</h1>\n <input\n type=\"text\"\n placeholder=\"New list item...\"\n value={newItemText}\n onChange={handleChange}\n onKeyPress={handleKeyPress}\n />\n <button disabled={newItemText === ''} onClick={handleClick}>\n <span role=\"img\" aria-label=\"Add item\">\n Add\n </span>\n </button>\n <ul>\n {items.map(item => (\n <ListItem\n key={item.id}\n item={item}\n removeItem={removeItem}\n toggleItem={toggleItem}\n />\n ))}\n </ul>\n </Fragment>\n );\n}\n"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/index.js new
+89
@@ -0,0 +1,89 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
7 + enumerable: true,
8 + get: function () {
9 + return _ComponentUsingHooksIndirectly.Component;
10 + }
11 +});
12 +Object.defineProperty(exports, "ComponentWithCustomHook", {
13 + enumerable: true,
14 + get: function () {
15 + return _ComponentWithCustomHook.Component;
16 + }
17 +});
18 +Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
19 + enumerable: true,
20 + get: function () {
21 + return _ComponentWithExternalCustomHooks.Component;
22 + }
23 +});
24 +Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
25 + enumerable: true,
26 + get: function () {
27 + return _ComponentWithMultipleHooksPerLine.Component;
28 + }
29 +});
30 +Object.defineProperty(exports, "ComponentWithNestedHooks", {
31 + enumerable: true,
32 + get: function () {
33 + return _ComponentWithNestedHooks.Component;
34 + }
35 +});
36 +Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
37 + enumerable: true,
38 + get: function () {
39 + return _ContainingStringSourceMappingURL.Component;
40 + }
41 +});
42 +Object.defineProperty(exports, "Example", {
43 + enumerable: true,
44 + get: function () {
45 + return _Example.Component;
46 + }
47 +});
48 +Object.defineProperty(exports, "InlineRequire", {
49 + enumerable: true,
50 + get: function () {
51 + return _InlineRequire.Component;
52 + }
53 +});
54 +Object.defineProperty(exports, "useTheme", {
55 + enumerable: true,
56 + get: function () {
57 + return _useTheme.default;
58 + }
59 +});
60 +exports.ToDoList = void 0;
61 +
62 +var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
63 +
64 +var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
65 +
66 +var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
67 +
68 +var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
69 +
70 +var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
71 +
72 +var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
73 +
74 +var _Example = require("./Example");
75 +
76 +var _InlineRequire = require("./InlineRequire");
77 +
78 +var ToDoList = _interopRequireWildcard(require("./ToDoList"));
79 +
80 +exports.ToDoList = ToDoList;
81 +
82 +var _useTheme = _interopRequireDefault(require("./useTheme"));
83 +
84 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
85 +
86 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
87 +
88 +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; }
89 +//# sourceMappingURL=index.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/index.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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"]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/useTheme.js new
+27
@@ -0,0 +1,27 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = useTheme;
7 +exports.ThemeContext = void 0;
8 +
9 +var _react = require("react");
10 +
11 +/**
12 + * Copyright (c) Facebook, Inc. and its affiliates.
13 + *
14 + * This source code is licensed under the MIT license found in the
15 + * LICENSE file in the root directory of this source tree.
16 + *
17 + * @flow
18 + */
19 +const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
20 +exports.ThemeContext = ThemeContext;
21 +
22 +function useTheme() {
23 + const theme = (0, _react.useContext)(ThemeContext);
24 + (0, _react.useDebugValue)(theme);
25 + return theme;
26 +}
27 +//# sourceMappingURL=useTheme.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/index-map/useTheme.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentUsingHooksIndirectly.js new
+45
@@ -0,0 +1,45 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const countState = (0, _react.useState)(0);
24 + const count = countState[0];
25 + const setCount = countState[1];
26 + const darkMode = useIsDarkMode();
27 + const [isDarkMode] = darkMode;
28 + (0, _react.useEffect)(() => {// ...
29 + }, []);
30 +
31 + const handleClick = () => setCount(count + 1);
32 +
33 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
34 + onClick: handleClick
35 + }, "Update count"));
36 +}
37 +
38 +function useIsDarkMode() {
39 + const darkModeState = (0, _react.useState)(false);
40 + const [isDarkMode] = darkModeState;
41 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
42 + }, []);
43 + return [isDarkMode, () => {}];
44 +}
45 +//# sourceMappingURL=ComponentUsingHooksIndirectly.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentUsingHooksIndirectly.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentUsingHooksIndirectly.js"],"names":["Component","countState","count","setCount","darkMode","useIsDarkMode","isDarkMode","handleClick","darkModeState","useEffectCreate"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAMC,UAAU,GAAG,qBAAS,CAAT,CAAnB;AACA,QAAMC,KAAK,GAAGD,UAAU,CAAC,CAAD,CAAxB;AACA,QAAME,QAAQ,GAAGF,UAAU,CAAC,CAAD,CAA3B;AAEA,QAAMG,QAAQ,GAAGC,aAAa,EAA9B;AACA,QAAM,CAACC,UAAD,IAAeF,QAArB;AAEA,wBAAU,MAAM,CACd;AACD,GAFD,EAEG,EAFH;;AAIA,QAAMG,WAAW,GAAG,MAAMJ,QAAQ,CAACD,KAAK,GAAG,CAAT,CAAlC;;AAEA,sBACE,yEACE,yDAAiBI,UAAjB,CADF,eAEE,qDAAaJ,KAAb,CAFF,eAGE;AAAQ,IAAA,OAAO,EAAEK;AAAjB,oBAHF,CADF;AAOD;;AAED,SAASF,aAAT,GAAyB;AACvB,QAAMG,aAAa,GAAG,qBAAS,KAAT,CAAtB;AACA,QAAM,CAACF,UAAD,IAAeE,aAArB;AAEA,wBAAU,SAASC,eAAT,GAA2B,CACnC;AACD,GAFD,EAEG,EAFH;AAIA,SAAO,CAACH,UAAD,EAAa,MAAM,CAAE,CAArB,CAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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, {useEffect, useState} from 'react';\n\nexport function Component() {\n const countState = useState(0);\n const count = countState[0];\n const setCount = countState[1];\n\n const darkMode = useIsDarkMode();\n const [isDarkMode] = darkMode;\n\n useEffect(() => {\n // ...\n }, []);\n\n const handleClick = () => setCount(count + 1);\n\n return (\n <>\n <div>Dark mode? {isDarkMode}</div>\n <div>Count: {count}</div>\n <button onClick={handleClick}>Update count</button>\n </>\n );\n}\n\nfunction useIsDarkMode() {\n const darkModeState = useState(false);\n const [isDarkMode] = darkModeState;\n\n useEffect(function useEffectCreate() {\n // Here is where we may listen to a \"theme\" event...\n }, []);\n\n return [isDarkMode, () => {}];\n}\n"],"x_react_sources":[[{"names":["<no-hook>","count","darkMode","isDarkMode"],"mappings":"CAAD;aqBCA,AWDA;iBbEA,AeFA;oCVGA,AeHA"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithCustomHook.js new
+41
@@ -0,0 +1,41 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + const isDarkMode = useIsDarkMode();
25 + (0, _react.useEffect)(() => {// ...
26 + }, []);
27 +
28 + const handleClick = () => setCount(count + 1);
29 +
30 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
31 + onClick: handleClick
32 + }, "Update count"));
33 +}
34 +
35 +function useIsDarkMode() {
36 + const [isDarkMode] = (0, _react.useState)(false);
37 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
38 + }, []);
39 + return isDarkMode;
40 +}
41 +//# sourceMappingURL=ComponentWithCustomHook.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithCustomHook.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithCustomHook.js"],"names":["Component","count","setCount","isDarkMode","useIsDarkMode","handleClick","useEffectCreate"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AACA,QAAMC,UAAU,GAAGC,aAAa,EAAhC;AAEA,wBAAU,MAAM,CACd;AACD,GAFD,EAEG,EAFH;;AAIA,QAAMC,WAAW,GAAG,MAAMH,QAAQ,CAACD,KAAK,GAAG,CAAT,CAAlC;;AAEA,sBACE,yEACE,yDAAiBE,UAAjB,CADF,eAEE,qDAAaF,KAAb,CAFF,eAGE;AAAQ,IAAA,OAAO,EAAEI;AAAjB,oBAHF,CADF;AAOD;;AAED,SAASD,aAAT,GAAyB;AACvB,QAAM,CAACD,UAAD,IAAe,qBAAS,KAAT,CAArB;AAEA,wBAAU,SAASG,eAAT,GAA2B,CACnC;AACD,GAFD,EAEG,EAFH;AAIA,SAAOH,UAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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, {useEffect, useState} from 'react';\n\nexport function Component() {\n const [count, setCount] = useState(0);\n const isDarkMode = useIsDarkMode();\n\n useEffect(() => {\n // ...\n }, []);\n\n const handleClick = () => setCount(count + 1);\n\n return (\n <>\n <div>Dark mode? {isDarkMode}</div>\n <div>Count: {count}</div>\n <button onClick={handleClick}>Update count</button>\n </>\n );\n}\n\nfunction useIsDarkMode() {\n const [isDarkMode] = useState(false);\n\n useEffect(function useEffectCreate() {\n // Here is where we may listen to a \"theme\" event...\n }, []);\n\n return isDarkMode;\n}\n"],"x_react_sources":[[{"names":["<no-hook>","count","isDarkMode"],"mappings":"CAAD;a4BCA,AWDA;clBEA,AeFA;gCbEA,AeFA"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithExternalCustomHooks.js new
+26
@@ -0,0 +1,26 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireDefault(require("react"));
9 +
10 +var _useTheme = _interopRequireDefault(require("./useTheme"));
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const theme = (0, _useTheme.default)();
24 + return /*#__PURE__*/_react.default.createElement("div", null, "theme: ", theme);
25 +}
26 +//# sourceMappingURL=ComponentWithExternalCustomHooks.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithExternalCustomHooks.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithExternalCustomHooks.js"],"names":["Component","theme"],"mappings":";;;;;;;AASA;;AACA;;;;AAVA;;;;;;;;AAYO,SAASA,SAAT,GAAqB;AAC1B,QAAMC,KAAK,GAAG,wBAAd;AAEA,sBAAO,qDAAaA,KAAb,CAAP;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 from 'react';\nimport useTheme from './useTheme';\n\nexport function Component() {\n const theme = useTheme();\n\n return <div>theme: {theme}</div>;\n}\n"],"x_react_sources":[[{"names":["<no-hook>","theme"],"mappings":"CAAD;cgBCA,AUDA"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js new
+30
@@ -0,0 +1,30 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = require("react");
9 +
10 +/**
11 + * Copyright (c) Facebook, Inc. and its affiliates.
12 + *
13 + * This source code is licensed under the MIT license found in the
14 + * LICENSE file in the root directory of this source tree.
15 + *
16 + * @flow
17 + */
18 +const A = /*#__PURE__*/(0, _react.createContext)(1);
19 +const B = /*#__PURE__*/(0, _react.createContext)(2);
20 +
21 +function Component() {
22 + const a = (0, _react.useContext)(A);
23 + const b = (0, _react.useContext)(B); // prettier-ignore
24 +
25 + const c = (0, _react.useContext)(A),
26 + d = (0, _react.useContext)(B); // eslint-disable-line one-var
27 +
28 + return a + b + c + d;
29 +}
30 +//# sourceMappingURL=ComponentWithMultipleHooksPerLine.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithMultipleHooksPerLine.js"],"names":["A","B","Component","a","b","c","d"],"mappings":";;;;;;;AASA;;AATA;;;;;;;;AAWA,MAAMA,CAAC,gBAAG,0BAAc,CAAd,CAAV;AACA,MAAMC,CAAC,gBAAG,0BAAc,CAAd,CAAV;;AAEO,SAASC,SAAT,GAAqB;AAC1B,QAAMC,CAAC,GAAG,uBAAWH,CAAX,CAAV;AACA,QAAMI,CAAC,GAAG,uBAAWH,CAAX,CAAV,CAF0B,CAI1B;;AACA,QAAMI,CAAC,GAAG,uBAAWL,CAAX,CAAV;AAAA,QAAyBM,CAAC,GAAG,uBAAWL,CAAX,CAA7B,CAL0B,CAKkB;;AAE5C,SAAOE,CAAC,GAAGC,CAAJ,GAAQC,CAAR,GAAYC,CAAnB;AACD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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} from 'react';\n\nconst A = createContext(1);\nconst B = createContext(2);\n\nexport function Component() {\n const a = useContext(A);\n const b = useContext(B);\n\n // prettier-ignore\n const c = useContext(A), d = useContext(B); // eslint-disable-line one-var\n\n return a + b + c + d;\n}\n"],"x_react_sources":[[{"names":["<no-hook>","a","b","c","d"],"mappings":"CAAD;gBYCA,AaDA;iBbEA,AaFA;oBbGA,AaHA,AMIA,AaJA"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithNestedHooks.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +/**
4 + * Copyright (c) Facebook, Inc. and its affiliates.
5 + *
6 + * This source code is licensed under the MIT license found in the
7 + * LICENSE file in the root directory of this source tree.
8 + *
9 + * @flow
10 + */
11 +const {
12 + useMemo,
13 + useState
14 +} = require('react');
15 +
16 +function Component(props) {
17 + const InnerComponent = useMemo(() => () => {
18 + const [state] = useState(0);
19 + return state;
20 + });
21 + props.callback(InnerComponent);
22 + return null;
23 +}
24 +
25 +module.exports = {
26 + Component
27 +};
28 +//# sourceMappingURL=ComponentWithNestedHooks.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithNestedHooks.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ComponentWithNestedHooks.js"],"names":["useMemo","useState","require","Component","props","InnerComponent","state","callback","module","exports"],"mappings":";;AAAA;;;;;;;;AAQA,MAAM;AAACA,EAAAA,OAAD;AAAUC,EAAAA;AAAV,IAAsBC,OAAO,CAAC,OAAD,CAAnC;;AAEA,SAASC,SAAT,CAAmBC,KAAnB,EAA0B;AACxB,QAAMC,cAAc,GAAGL,OAAO,CAAC,MAAM,MAAM;AACzC,UAAM,CAACM,KAAD,IAAUL,QAAQ,CAAC,CAAD,CAAxB;AAEA,WAAOK,KAAP;AACD,GAJ6B,CAA9B;AAKAF,EAAAA,KAAK,CAACG,QAAN,CAAeF,cAAf;AAEA,SAAO,IAAP;AACD;;AAEDG,MAAM,CAACC,OAAP,GAAiB;AAACN,EAAAA;AAAD,CAAjB","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 */\nconst {useMemo, useState} = require('react');\n\nfunction Component(props) {\n const InnerComponent = useMemo(() => () => {\n const [state] = useState(0);\n\n return state;\n });\n props.callback(InnerComponent);\n\n return null;\n}\n\nmodule.exports = {Component};\n"],"x_react_sources":[[{"names":["<no-hook>","InnerComponent","state"],"mappings":"CAAD;YyBCA;aLCA,AWDA;gB3BDA"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ContainingStringSourceMappingURL.js new
+29
@@ -0,0 +1,29 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +// ?sourceMappingURL=([^\s'"]+)/gm
23 +function Component() {
24 + const [count, setCount] = (0, _react.useState)(0);
25 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
26 + onClick: () => setCount(count + 1)
27 + }, "Click me"));
28 +}
29 +//# sourceMappingURL=ContainingStringSourceMappingURL.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ContainingStringSourceMappingURL.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["ContainingStringSourceMappingURL.js"],"names":["Component","count","setCount"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWA;AAEO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AAEA,sBACE,uDACE,wDAAgBD,KAAhB,WADF,eAEE;AAAQ,IAAA,OAAO,EAAE,MAAMC,QAAQ,CAACD,KAAK,GAAG,CAAT;AAA/B,gBAFF,CADF;AAMD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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\n// ?sourceMappingURL=([^\\s'\"]+)/gm\n\nexport function Component() {\n const [count, setCount] = useState(0);\n\n return (\n <div>\n <p>You clicked {count} times</p>\n <button onClick={() => setCount(count + 1)}>Click me</button>\n </div>\n );\n}\n"],"x_react_sources":[[{"names":["<no-hook>","count"],"mappings":"CAAD;e4BCA,AWDA"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/Example.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
25 + onClick: () => setCount(count + 1)
26 + }, "Click me"));
27 +}
28 +//# sourceMappingURL=Example.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/Example.js.map new
+1
@@ -0,0 +1 @@
1 +{"version":3,"sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"sources":["Example.js"],"names":["Component","count","setCount"],"mappings":";;;;;;;AASA;;;;;;AATA;;;;;;;;AAWO,SAASA,SAAT,GAAqB;AAC1B,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAS,CAAT,CAA1B;AAEA,sBACE,uDACE,wDAAgBD,KAAhB,WADF,eAEE;AAAQ,IAAA,OAAO,EAAE,MAAMC,QAAQ,CAACD,KAAK,GAAG,CAAT;AAA/B,gBAFF,CADF;AAMD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 <div>\n <p>You clicked {count} times</p>\n <button onClick={() => setCount(count + 1)}>Click me</button>\n </div>\n );\n}\n"],"x_react_sources":[[{"names":["<no-hook>","count"],"mappings":"CAAD;a4BCA,AWDA"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire.js new
+21
@@ -0,0 +1,21 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +/**
9 + * Copyright (c) Facebook, Inc. and its affiliates.
10 + *
11 + * This source code is licensed under the MIT license found in the
12 + * LICENSE file in the root directory of this source tree.
13 + *
14 + * @flow
15 + */
16 +function Component() {
17 + const [count] = require('react').useState(0);
18 +
19 + return count;
20 +}
21 +//# sourceMappingURL=InlineRequire.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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":["<no-hook>"],"mappings":"CAAD"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ToDoList.js new
+106
@@ -0,0 +1,106 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.ListItem = ListItem;
7 +exports.List = List;
8 +
9 +var React = _interopRequireWildcard(require("react"));
10 +
11 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
12 +
13 +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; }
14 +
15 +/**
16 + * Copyright (c) Facebook, Inc. and its affiliates.
17 + *
18 + * This source code is licensed under the MIT license found in the
19 + * LICENSE file in the root directory of this source tree.
20 + *
21 + * @flow
22 + */
23 +function ListItem({
24 + item,
25 + removeItem,
26 + toggleItem
27 +}) {
28 + const handleDelete = (0, React.useCallback)(() => {
29 + removeItem(item);
30 + }, [item, removeItem]);
31 + const handleToggle = (0, React.useCallback)(() => {
32 + toggleItem(item);
33 + }, [item, toggleItem]);
34 + return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("button", {
35 + onClick: handleDelete
36 + }, "Delete"), /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
37 + checked: item.isComplete,
38 + onChange: handleToggle,
39 + type: "checkbox"
40 + }), ' ', item.text));
41 +}
42 +
43 +function List(props) {
44 + const [newItemText, setNewItemText] = (0, React.useState)('');
45 + const [items, setItems] = (0, React.useState)([{
46 + id: 1,
47 + isComplete: true,
48 + text: 'First'
49 + }, {
50 + id: 2,
51 + isComplete: true,
52 + text: 'Second'
53 + }, {
54 + id: 3,
55 + isComplete: false,
56 + text: 'Third'
57 + }]);
58 + const [uid, setUID] = (0, React.useState)(4);
59 + const handleClick = (0, React.useCallback)(() => {
60 + if (newItemText !== '') {
61 + setItems([...items, {
62 + id: uid,
63 + isComplete: false,
64 + text: newItemText
65 + }]);
66 + setUID(uid + 1);
67 + setNewItemText('');
68 + }
69 + }, [newItemText, items, uid]);
70 + const handleKeyPress = (0, React.useCallback)(event => {
71 + if (event.key === 'Enter') {
72 + handleClick();
73 + }
74 + }, [handleClick]);
75 + const handleChange = (0, React.useCallback)(event => {
76 + setNewItemText(event.currentTarget.value);
77 + }, [setNewItemText]);
78 + const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
79 + const toggleItem = (0, React.useCallback)(itemToToggle => {
80 + // Dont use indexOf()
81 + // because editing props in DevTools creates a new Object.
82 + const index = items.findIndex(item => item.id === itemToToggle.id);
83 + setItems(items.slice(0, index).concat({ ...itemToToggle,
84 + isComplete: !itemToToggle.isComplete
85 + }).concat(items.slice(index + 1)));
86 + }, [items]);
87 + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "List"), /*#__PURE__*/React.createElement("input", {
88 + type: "text",
89 + placeholder: "New list item...",
90 + value: newItemText,
91 + onChange: handleChange,
92 + onKeyPress: handleKeyPress
93 + }), /*#__PURE__*/React.createElement("button", {
94 + disabled: newItemText === '',
95 + onClick: handleClick
96 + }, /*#__PURE__*/React.createElement("span", {
97 + role: "img",
98 + "aria-label": "Add item"
99 + }, "Add")), /*#__PURE__*/React.createElement("ul", null, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
100 + key: item.id,
101 + item: item,
102 + removeItem: removeItem,
103 + toggleItem: toggleItem
104 + }))));
105 +}
106 +//# sourceMappingURL=ToDoList.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/ToDoList.js.map new
+1
@@ -0,0 +1 @@
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"],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UlB,KAAK,CAACiB,KAAN,CAAYF,KAAK,GAAG,CAApB,CANV,CADM,CAAR;AASD,GAfgB,EAgBjB,CAACf,KAAD,CAhBiB,CAAnB;AAmBA,sBACE,oBAAC,cAAD,qBACE,uCADF,eAEE;AACE,IAAA,IAAI,EAAC,MADP;AAEE,IAAA,WAAW,EAAC,kBAFd;AAGE,IAAA,KAAK,EAAEF,WAHT;AAIE,IAAA,QAAQ,EAAEW,YAJZ;AAKE,IAAA,UAAU,EAAEH;AALd,IAFF,eASE;AAAQ,IAAA,QAAQ,EAAER,WAAW,KAAK,EAAlC;AAAsC,IAAA,OAAO,EAAEO;AAA/C,kBACE;AAAM,IAAA,IAAI,EAAC,KAAX;AAAiB,kBAAW;AAA5B,WADF,CATF,eAcE,gCACGL,KAAK,CAACmB,GAAN,CAAU9B,IAAI,iBACb,oBAAC,QAAD;AACE,IAAA,GAAG,EAAEA,IAAI,CAACa,EADZ;AAEE,IAAA,IAAI,EAAEb,IAFR;AAGE,IAAA,UAAU,EAAEC,UAHd;AAIE,IAAA,UAAU,EAAEC;AAJd,IADD,CADH,CAdF,CADF;AA2BD","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its 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 <li>\n <button onClick={handleDelete}>Delete</button>\n <label>\n <input\n checked={item.isComplete}\n onChange={handleToggle}\n type=\"checkbox\"\n />{' '}\n {item.text}\n </label>\n </li>\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 <Fragment>\n <h1>List</h1>\n <input\n type=\"text\"\n placeholder=\"New list item...\"\n value={newItemText}\n onChange={handleChange}\n onKeyPress={handleKeyPress}\n />\n <button disabled={newItemText === ''} onClick={handleClick}>\n <span role=\"img\" aria-label=\"Add item\">\n Add\n </span>\n </button>\n <ul>\n {items.map(item => (\n <ListItem\n key={item.id}\n item={item}\n removeItem={removeItem}\n toggleItem={toggleItem}\n />\n ))}\n </ul>\n </Fragment>\n );\n}\n"],"x_react_sources":[[{"names":["<no-hook>","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
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/index.js new
+89
@@ -0,0 +1,89 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
7 + enumerable: true,
8 + get: function () {
9 + return _ComponentUsingHooksIndirectly.Component;
10 + }
11 +});
12 +Object.defineProperty(exports, "ComponentWithCustomHook", {
13 + enumerable: true,
14 + get: function () {
15 + return _ComponentWithCustomHook.Component;
16 + }
17 +});
18 +Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
19 + enumerable: true,
20 + get: function () {
21 + return _ComponentWithExternalCustomHooks.Component;
22 + }
23 +});
24 +Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
25 + enumerable: true,
26 + get: function () {
27 + return _ComponentWithMultipleHooksPerLine.Component;
28 + }
29 +});
30 +Object.defineProperty(exports, "ComponentWithNestedHooks", {
31 + enumerable: true,
32 + get: function () {
33 + return _ComponentWithNestedHooks.Component;
34 + }
35 +});
36 +Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
37 + enumerable: true,
38 + get: function () {
39 + return _ContainingStringSourceMappingURL.Component;
40 + }
41 +});
42 +Object.defineProperty(exports, "Example", {
43 + enumerable: true,
44 + get: function () {
45 + return _Example.Component;
46 + }
47 +});
48 +Object.defineProperty(exports, "InlineRequire", {
49 + enumerable: true,
50 + get: function () {
51 + return _InlineRequire.Component;
52 + }
53 +});
54 +Object.defineProperty(exports, "useTheme", {
55 + enumerable: true,
56 + get: function () {
57 + return _useTheme.default;
58 + }
59 +});
60 +exports.ToDoList = void 0;
61 +
62 +var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
63 +
64 +var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
65 +
66 +var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
67 +
68 +var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
69 +
70 +var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
71 +
72 +var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
73 +
74 +var _Example = require("./Example");
75 +
76 +var _InlineRequire = require("./InlineRequire");
77 +
78 +var ToDoList = _interopRequireWildcard(require("./ToDoList"));
79 +
80 +exports.ToDoList = ToDoList;
81 +
82 +var _useTheme = _interopRequireDefault(require("./useTheme"));
83 +
84 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
85 +
86 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
87 +
88 +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; }
89 +//# sourceMappingURL=index.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/index.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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":["<no-hook>"],"mappings":"CAAD"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/useTheme.js new
+27
@@ -0,0 +1,27 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = useTheme;
7 +exports.ThemeContext = void 0;
8 +
9 +var _react = require("react");
10 +
11 +/**
12 + * Copyright (c) Facebook, Inc. and its affiliates.
13 + *
14 + * This source code is licensed under the MIT license found in the
15 + * LICENSE file in the root directory of this source tree.
16 + *
17 + * @flow
18 + */
19 +const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
20 +exports.ThemeContext = ThemeContext;
21 +
22 +function useTheme() {
23 + const theme = (0, _react.useContext)(ThemeContext);
24 + (0, _react.useDebugValue)(theme);
25 + return theme;
26 +}
27 +//# sourceMappingURL=useTheme.js.map
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/external/react-sources-extended/index-map/useTheme.js.map new
+1
@@ -0,0 +1 @@
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) Facebook, Inc. and its 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":["<no-hook>","theme"],"mappings":"CAAD;egBCA,AwBDA"}]]}}]}
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentUsingHooksIndirectly.js new
+45
@@ -0,0 +1,45 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const countState = (0, _react.useState)(0);
24 + const count = countState[0];
25 + const setCount = countState[1];
26 + const darkMode = useIsDarkMode();
27 + const [isDarkMode] = darkMode;
28 + (0, _react.useEffect)(() => {// ...
29 + }, []);
30 +
31 + const handleClick = () => setCount(count + 1);
32 +
33 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
34 + onClick: handleClick
35 + }, "Update count"));
36 +}
37 +
38 +function useIsDarkMode() {
39 + const darkModeState = (0, _react.useState)(false);
40 + const [isDarkMode] = darkModeState;
41 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
42 + }, []);
43 + return [isDarkMode, () => {}];
44 +}
45 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50U3RhdGUiLCJjb3VudCIsInNldENvdW50IiwiZGFya01vZGUiLCJ1c2VJc0RhcmtNb2RlIiwiaXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwiZGFya01vZGVTdGF0ZSIsInVzZUVmZmVjdENyZWF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7QUFUQTs7Ozs7Ozs7QUFXTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU1DLFVBQVUsR0FBRyxxQkFBUyxDQUFULENBQW5CO0FBQ0EsUUFBTUMsS0FBSyxHQUFHRCxVQUFVLENBQUMsQ0F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s+IiwiY291bnQiLCJkYXJrTW9kZSIsImlzRGFya01vZGUiXSwibWFwcGluZ3MiOiJDQUFEO2FxQkNBLEFXREE7aUJiRUEsQWVGQTtvQ1ZHQSxBZUhBIn1dXV19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithCustomHook.js new
+41
@@ -0,0 +1,41 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + const isDarkMode = useIsDarkMode();
25 + (0, _react.useEffect)(() => {// ...
26 + }, []);
27 +
28 + const handleClick = () => setCount(count + 1);
29 +
30 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
31 + onClick: handleClick
32 + }, "Update count"));
33 +}
34 +
35 +function useIsDarkMode() {
36 + const [isDarkMode] = (0, _react.useState)(false);
37 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
38 + }, []);
39 + return isDarkMode;
40 +}
41 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhDdXN0b21Ib29rLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiLCJpc0RhcmtNb2RlIiwidXNlSXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwidXNlRWZmZWN0Q3JlYXRlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7Ozs7OztBQVRBOzs7Ozs7OztBQVdPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUNBLFFBQU1DLFVBQVUsR0FBR0MsYUFBYSxFQUFoQztBQUVBLHdCQUFVLE1BQU0sQ0FDZDtBQUNELEdBRkQsRUFFRyxFQUZIOztBQUlBLFFBQU1DLFdBQVcsR0FBRyxNQUFNSCxRQUFRLENBQUNELEtBQUssR0FBRyxDQUFULENBQWxDOztBQUVBLHNCQUNFLHlFQUNFLHlEQUFpQkUsVUFBakIsQ0FERixlQUVFLHFEQUFhRixLQUFiLENBRkYsZUFHRTtBQUFRLElBQUEsT0FBTyxFQUFFSTtBQUFqQixvQkFIRixDQURGO0FBT0Q7O0FBRUQsU0FBU0QsYUFBVCxHQUF5QjtBQUN2QixRQUFNLENBQUNELFVBQUQsSUFBZSxx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TW9kZV0gPSB1c2VTdGF0ZShmYWxzZSk7XG5cbiAgdXNlRWZmZWN0KGZ1bmN0aW9uIHVzZUVmZmVjdENyZWF0ZSgpIHtcbiAgICAvLyBIZXJlIGlzIHdoZXJlIHdlIG1heSBsaXN0ZW4gdG8gYSBcInRoZW1lXCIgZXZlbnQuLi5cbiAgfSwgW10pO1xuXG4gIHJldHVybiBpc0RhcmtNb2RlO1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsImNvdW50IiwiaXNEYXJrTW9kZSJdLCJtYXBwaW5ncyI6IkNBQUQ7YTRCQ0EsQVdEQTtjbEJFQSxBZUZBO2dDYkVBLEFlRkEifV1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithExternalCustomHooks.js new
+26
@@ -0,0 +1,26 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireDefault(require("react"));
9 +
10 +var _useTheme = _interopRequireDefault(require("./useTheme"));
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const theme = (0, _useTheme.default)();
24 + return /*#__PURE__*/_react.default.createElement("div", null, "theme: ", theme);
25 +}
26 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7QUFWQTs7Ozs7Ozs7QUFZTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU1DLEtBQUssR0FBRyx3QkFBZDtBQUVBLHNCQUFPLHFEQUFhQSxLQUFiLENBQVA7QUFDRCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSBGYWNlYm9vaywgSW5jLiBhbmQgaXRzIGFmZmlsaWF0ZXMuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UgZm91bmQgaW4gdGhlXG4gKiBMSUNFTlNFIGZpbGUgaW4gdGhlIHJvb3QgZGlyZWN0b3J5IG9mIHRoaXMgc291cmNlIHRyZWUuXG4gKlxuICogQGZsb3dcbiAqL1xuXG5pbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IHVzZVRoZW1lIGZyb20gJy4vdXNlVGhlbWUnO1xuXG5leHBvcnQgZnVuY3Rpb24gQ29tcG9uZW50KCkge1xuICBjb25zdCB0aGVtZSA9IHVzZVRoZW1lKCk7XG5cbiAgcmV0dXJuIDxkaXY+dGhlbWU6IHt0aGVtZX08L2Rpdj47XG59XG4iXSwieF9mYWNlYm9va19zb3VyY2VzIjpbW251bGwsW3sibmFtZXMiOlsiPG5vLWhvb2s+IiwidGhlbWUiXSwibWFwcGluZ3MiOiJDQUFEO2NnQkNBLEFVREEifV1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js new
+30
@@ -0,0 +1,30 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = require("react");
9 +
10 +/**
11 + * Copyright (c) Facebook, Inc. and its affiliates.
12 + *
13 + * This source code is licensed under the MIT license found in the
14 + * LICENSE file in the root directory of this source tree.
15 + *
16 + * @flow
17 + */
18 +const A = /*#__PURE__*/(0, _react.createContext)(1);
19 +const B = /*#__PURE__*/(0, _react.createContext)(2);
20 +
21 +function Component() {
22 + const a = (0, _react.useContext)(A);
23 + const b = (0, _react.useContext)(B); // prettier-ignore
24 +
25 + const c = (0, _react.useContext)(A),
26 + d = (0, _react.useContext)(B); // eslint-disable-line one-var
27 +
28 + return a + b + c + d;
29 +}
30 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZS5qcyJdLCJuYW1lcyI6WyJBIiwiQiIsIkNvbXBvbmVudCIsImEiLCJiIiwiYyIsImQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7QUFUQTs7Ozs7Ozs7QUFXQSxNQUFNQSxDQUFDLGdCQUFHLDBCQUFjLENBQWQsQ0FBVjtBQUNBLE1BQU1DLENBQUMsZ0JBQUcsMEJBQWMsQ0FBZCxDQUFWOztBQUVPLFNBQVNDLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsQ0FBQyxHQUFHLHVCQUFXSCxDQUFYLENBQVY7QUFDQSxRQUFNSSxDQUFDLEdBQUcsdUJBQVdILENBQVgsQ0FBVixDQUYwQixDQUkxQjs7QUFDQSxRQUFNSSxDQUFDLEdBQUcsdUJBQVdMLENBQVgsQ0FBVjtBQUFBLFFBQXlCTSxDQUFDLEdBQUcsdUJBQVdMLENBQVgsQ0FBN0IsQ0FMMEIsQ0FLa0I7O0FBRTVDLFNBQU9FLENBQUMsR0FBR0MsQ0FBSixHQUFRQyxDQUFSLEdBQVlDLENBQW5CO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0fSBmcm9tICdyZWFjdCc7XG5cbmNvbnN0IEEgPSBjcmVhdGVDb250ZXh0KDEpO1xuY29uc3QgQiA9IGNyZWF0ZUNvbnRleHQoMik7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IGEgPSB1c2VDb250ZXh0KEEpO1xuICBjb25zdCBiID0gdXNlQ29udGV4dChCKTtcblxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgY29uc3QgYyA9IHVzZUNvbnRleHQoQSksIGQgPSB1c2VDb250ZXh0KEIpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG9uZS12YXJcblxuICByZXR1cm4gYSArIGIgKyBjICsgZDtcbn1cbiJdLCJ4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJhIiwiYiIsImMiLCJkIl0sIm1hcHBpbmdzIjoiQ0FBRDtnQllDQSxBYURBO2lCYkVBLEFhRkE7b0JiR0EsQWFIQSxBTUlBLEFhSkEifV1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithNestedHooks.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +/**
4 + * Copyright (c) Facebook, Inc. and its affiliates.
5 + *
6 + * This source code is licensed under the MIT license found in the
7 + * LICENSE file in the root directory of this source tree.
8 + *
9 + * @flow
10 + */
11 +const {
12 + useMemo,
13 + useState
14 +} = require('react');
15 +
16 +function Component(props) {
17 + const InnerComponent = useMemo(() => () => {
18 + const [state] = useState(0);
19 + return state;
20 + });
21 + props.callback(InnerComponent);
22 + return null;
23 +}
24 +
25 +module.exports = {
26 + Component
27 +};
28 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhOZXN0ZWRIb29rcy5qcyJdLCJuYW1lcyI6WyJ1c2VNZW1vIiwidXNlU3RhdGUiLCJyZXF1aXJlIiwiQ29tcG9uZW50IiwicHJvcHMiLCJJbm5lckNvbXBvbmVudCIsInN0YXRlIiwiY2FsbGJhY2siLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7OztBQVFBLE1BQU07QUFBQ0EsRUFBQUEsT0FBRDtBQUFVQyxFQUFBQTtBQUFWLElBQXNCQyxPQUFPLENBQUMsT0FBRCxDQUFuQzs7QUFFQSxTQUFTQyxTQUFULENBQW1CQyxLQUFuQixFQUEwQjtBQUN4QixRQUFNQyxjQUFjLEdBQUdMLE9BQU8sQ0FBQyxNQUFNLE1BQU07QUFDekMsVUFBTSxDQUFDTSxLQUFELElBQVVMLFFBQVEsQ0FBQyxDQUFELENBQXhCO0FBRUEsV0FBT0ssS0FBUDtBQUNELEdBSjZCLENBQTlCO0FBS0FGLEVBQUFBLEtBQUssQ0FBQ0csUUFBTixDQUFlRixjQUFmO0FBRUEsU0FBTyxJQUFQO0FBQ0Q7O0FBRURHLE1BQU0sQ0FBQ0MsT0FBUCxHQUFpQjtBQUFDTixFQUFBQTtBQUFELENBQWpCIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5jb25zdCB7dXNlTWVtbywgdXNlU3RhdGV9ID0gcmVxdWlyZSgncmVhY3QnKTtcblxuZnVuY3Rpb24gQ29tcG9uZW50KHByb3BzKSB7XG4gIGNvbnN0IElubmVyQ29tcG9uZW50ID0gdXNlTWVtbygoKSA9PiAoKSA9PiB7XG4gICAgY29uc3QgW3N0YXRlXSA9IHVzZVN0YXRlKDApO1xuXG4gICAgcmV0dXJuIHN0YXRlO1xuICB9KTtcbiAgcHJvcHMuY2FsbGJhY2soSW5uZXJDb21wb25lbnQpO1xuXG4gIHJldHVybiBudWxsO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtDb21wb25lbnR9O1xuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsIklubmVyQ29tcG9uZW50Iiwic3RhdGUiXSwibWFwcGluZ3MiOiJDQUFEO1l5QkNBO2FMQ0EsQVdEQTtnQjNCREEifV1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ContainingStringSourceMappingURL.js new
+29
@@ -0,0 +1,29 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +// ?sourceMappingURL=([^\s'"]+)/gm
23 +function Component() {
24 + const [count, setCount] = (0, _react.useState)(0);
25 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
26 + onClick: () => setCount(count + 1)
27 + }, "Click me"));
28 +}
29 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7Ozs7O0FBVEE7Ozs7Ozs7O0FBV0E7QUFFTyx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O2U0QkNBLEFXREEifV1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/Example.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
25 + onClick: () => setCount(count + 1)
26 + }, "Click me"));
27 +}
28 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4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4X2ZhY2Vib29rX3NvdXJjZXMiOltbbnVsbCxbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCJdLCJtYXBwaW5ncyI6IkNBQUQ7YTRCQ0EsQVdEQSJ9XV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/InlineRequire.js new
+21
@@ -0,0 +1,21 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +/**
9 + * Copyright (c) Facebook, Inc. and its affiliates.
10 + *
11 + * This source code is licensed under the MIT license found in the
12 + * LICENSE file in the root directory of this source tree.
13 + *
14 + * @flow
15 + */
16 +function Component() {
17 + const [count] = require('react').useState(0);
18 +
19 + return count;
20 +}
21 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/ToDoList.js new
+106
@@ -0,0 +1,106 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.ListItem = ListItem;
7 +exports.List = List;
8 +
9 +var React = _interopRequireWildcard(require("react"));
10 +
11 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
12 +
13 +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; }
14 +
15 +/**
16 + * Copyright (c) Facebook, Inc. and its affiliates.
17 + *
18 + * This source code is licensed under the MIT license found in the
19 + * LICENSE file in the root directory of this source tree.
20 + *
21 + * @flow
22 + */
23 +function ListItem({
24 + item,
25 + removeItem,
26 + toggleItem
27 +}) {
28 + const handleDelete = (0, React.useCallback)(() => {
29 + removeItem(item);
30 + }, [item, removeItem]);
31 + const handleToggle = (0, React.useCallback)(() => {
32 + toggleItem(item);
33 + }, [item, toggleItem]);
34 + return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("button", {
35 + onClick: handleDelete
36 + }, "Delete"), /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
37 + checked: item.isComplete,
38 + onChange: handleToggle,
39 + type: "checkbox"
40 + }), ' ', item.text));
41 +}
42 +
43 +function List(props) {
44 + const [newItemText, setNewItemText] = (0, React.useState)('');
45 + const [items, setItems] = (0, React.useState)([{
46 + id: 1,
47 + isComplete: true,
48 + text: 'First'
49 + }, {
50 + id: 2,
51 + isComplete: true,
52 + text: 'Second'
53 + }, {
54 + id: 3,
55 + isComplete: false,
56 + text: 'Third'
57 + }]);
58 + const [uid, setUID] = (0, React.useState)(4);
59 + const handleClick = (0, React.useCallback)(() => {
60 + if (newItemText !== '') {
61 + setItems([...items, {
62 + id: uid,
63 + isComplete: false,
64 + text: newItemText
65 + }]);
66 + setUID(uid + 1);
67 + setNewItemText('');
68 + }
69 + }, [newItemText, items, uid]);
70 + const handleKeyPress = (0, React.useCallback)(event => {
71 + if (event.key === 'Enter') {
72 + handleClick();
73 + }
74 + }, [handleClick]);
75 + const handleChange = (0, React.useCallback)(event => {
76 + setNewItemText(event.currentTarget.value);
77 + }, [setNewItemText]);
78 + const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
79 + const toggleItem = (0, React.useCallback)(itemToToggle => {
80 + // Dont use indexOf()
81 + // because editing props in DevTools creates a new Object.
82 + const index = items.findIndex(item => item.id === itemToToggle.id);
83 + setItems(items.slice(0, index).concat({ ...itemToToggle,
84 + isComplete: !itemToToggle.isComplete
85 + }).concat(items.slice(index + 1)));
86 + }, [items]);
87 + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "List"), /*#__PURE__*/React.createElement("input", {
88 + type: "text",
89 + placeholder: "New list item...",
90 + value: newItemText,
91 + onChange: handleChange,
92 + onKeyPress: handleKeyPress
93 + }), /*#__PURE__*/React.createElement("button", {
94 + disabled: newItemText === '',
95 + onClick: handleClick
96 + }, /*#__PURE__*/React.createElement("span", {
97 + role: "img",
98 + "aria-label": "Add item"
99 + }, "Add")), /*#__PURE__*/React.createElement("ul", null, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
100 + key: item.id,
101 + item: item,
102 + removeItem: removeItem,
103 + toggleItem: toggleItem
104 + }))));
105 +}
106 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRvRG9MaXN0LmpzIl0sIm5hbWVzIjpbIkxpc3RJdGVtIiwiaXRlbSIsInJlbW92ZUl0ZW0iLCJ0b2dnbGVJdGVtIiwiaGFuZGxlRGVsZXRlIiwiaGFuZGxlVG9nZ2xlIiwiaXNDb21wbGV0ZSIsInRleHQiLCJMaXN0IiwicHJvcHMiLCJuZXdJdGVtVGV4dCIsInNldE5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJzZXRJdGVtcyIsImlkIiwidWlkIiwic2V0VUlEIiwiaGFuZGxlQ2xpY2siLCJoYW5kbGVLZXlQcmVzcyIsImV2ZW50Iiwia2V5IiwiaGFuZGxlQ2hhbmdlIiwiY3VycmVudFRhcmdldCIsInZhbHVlIiwiaXRlbVRvUmVtb3ZlIiwiZmlsdGVyIiwiaXRlbVRvVG9nZ2xlIiwiaW5kZXgiLCJmaW5kSW5kZXgiLCJzbGljZSIsImNvbmNhdCIsIm1hcCJdLCJtYX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KGl0ZW0gPT4gKFxuICAgICAgICAgIDxMaXN0SXRlbVxuICAgICAgICAgICAga2V5PXtpdGVtLmlkfVxuICAgICAgICAgICAgaXRlbT17aXRlbX1cbiAgICAgICAgICAgIHJlbW92ZUl0ZW09e3JlbW92ZUl0ZW19XG4gICAgICAgICAgICB0b2dnbGVJdGVtPXt0b2dnbGVJdGVtfVxuICAgICAgICAgIC8+XG4gICAgICAgICkpfVxuICAgICAgPC91bD5cbiAgICA8L0ZyYWdtZW50PlxuICApO1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsImhhbmRsZURlbGV0ZSIsImhhbmRsZVRvZ2dsZSIsIm5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJ1aWQiLCJoYW5kbGVDbGljayIsImhhbmRsZUtleVByZXNzIiwiaGFuZGxlQ2hhbmdlIiwicmVtb3ZlSXRlbSIsInRvZ2dsZUl0ZW0iXSwibWFwcGluZ3MiOiJDQUFEO2N1QkNBO2dCQ0RBO2tCREVBO29CQ0ZBO3NDZ0JHQSxBWUhBO3VDeEJJQTsyQ3hCSkE7NENvQktBLEFXTEE7OENiTUE7MkRTTkE7NkROT0E7b0V0QlBBO3NFb0JRQTsyRXBCUkE7NkVrQlNBO2dGbEJUQTtrRmtCVUE7bUdsQlZBIn1dXV19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/index.js new
+89
@@ -0,0 +1,89 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
7 + enumerable: true,
8 + get: function () {
9 + return _ComponentUsingHooksIndirectly.Component;
10 + }
11 +});
12 +Object.defineProperty(exports, "ComponentWithCustomHook", {
13 + enumerable: true,
14 + get: function () {
15 + return _ComponentWithCustomHook.Component;
16 + }
17 +});
18 +Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
19 + enumerable: true,
20 + get: function () {
21 + return _ComponentWithExternalCustomHooks.Component;
22 + }
23 +});
24 +Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
25 + enumerable: true,
26 + get: function () {
27 + return _ComponentWithMultipleHooksPerLine.Component;
28 + }
29 +});
30 +Object.defineProperty(exports, "ComponentWithNestedHooks", {
31 + enumerable: true,
32 + get: function () {
33 + return _ComponentWithNestedHooks.Component;
34 + }
35 +});
36 +Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
37 + enumerable: true,
38 + get: function () {
39 + return _ContainingStringSourceMappingURL.Component;
40 + }
41 +});
42 +Object.defineProperty(exports, "Example", {
43 + enumerable: true,
44 + get: function () {
45 + return _Example.Component;
46 + }
47 +});
48 +Object.defineProperty(exports, "InlineRequire", {
49 + enumerable: true,
50 + get: function () {
51 + return _InlineRequire.Component;
52 + }
53 +});
54 +Object.defineProperty(exports, "useTheme", {
55 + enumerable: true,
56 + get: function () {
57 + return _useTheme.default;
58 + }
59 +});
60 +exports.ToDoList = void 0;
61 +
62 +var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
63 +
64 +var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
65 +
66 +var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
67 +
68 +var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
69 +
70 +var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
71 +
72 +var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
73 +
74 +var _Example = require("./Example");
75 +
76 +var _InlineRequire = require("./InlineRequire");
77 +
78 +var ToDoList = _interopRequireWildcard(require("./ToDoList"));
79 +
80 +exports.ToDoList = ToDoList;
81 +
82 +var _useTheme = _interopRequireDefault(require("./useTheme"));
83 +
84 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
85 +
86 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
87 +
88 +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; }
89 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFTQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7OztBQUVBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3V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jZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/fb-sources-extended/index-map/useTheme.js new
+27
@@ -0,0 +1,27 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = useTheme;
7 +exports.ThemeContext = void 0;
8 +
9 +var _react = require("react");
10 +
11 +/**
12 + * Copyright (c) Facebook, Inc. and its affiliates.
13 + *
14 + * This source code is licensed under the MIT license found in the
15 + * LICENSE file in the root directory of this source tree.
16 + *
17 + * @flow
18 + */
19 +const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
20 +exports.ThemeContext = ThemeContext;
21 +
22 +function useTheme() {
23 + const theme = (0, _react.useContext)(ThemeContext);
24 + (0, _react.useDebugValue)(theme);
25 + return theme;
26 +}
27 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl0sInhfZmFjZWJvb2tfc291cmNlcyI6W1tudWxsLFt7Im5hbWVzIjpbIjxuby1ob29rPiIsInRoZW1lIl0sIm1hcHBpbmdzIjoiQ0FBRDtlZ0JDQSxBd0JEQSJ9XV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/ComponentUsingHooksIndirectly.js new
+45
@@ -0,0 +1,45 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const countState = (0, _react.useState)(0);
24 + const count = countState[0];
25 + const setCount = countState[1];
26 + const darkMode = useIsDarkMode();
27 + const [isDarkMode] = darkMode;
28 + (0, _react.useEffect)(() => {// ...
29 + }, []);
30 +
31 + const handleClick = () => setCount(count + 1);
32 +
33 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
34 + onClick: handleClick
35 + }, "Update count"));
36 +}
37 +
38 +function useIsDarkMode() {
39 + const darkModeState = (0, _react.useState)(false);
40 + const [isDarkMode] = darkModeState;
41 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
42 + }, []);
43 + return [isDarkMode, () => {}];
44 +}
45 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIs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ZSA9IHVzZVN0YXRlKGZhbHNlKTtcbiAgY29uc3QgW2lzRGFya01vZGVdID0gZGFya01vZGVTdGF0ZTtcblxuICB1c2VFZmZlY3QoZnVuY3Rpb24gdXNlRWZmZWN0Q3JlYXRlKCkge1xuICAgIC8vIEhlcmUgaXMgd2hlcmUgd2UgbWF5IGxpc3RlbiB0byBhIFwidGhlbWVcIiBldmVudC4uLlxuICB9LCBbXSk7XG5cbiAgcmV0dXJuIFtpc0RhcmtNb2RlLCAoKSA9PiB7fV07XG59XG4iXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/ComponentWithCustomHook.js new
+41
@@ -0,0 +1,41 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + const isDarkMode = useIsDarkMode();
25 + (0, _react.useEffect)(() => {// ...
26 + }, []);
27 +
28 + const handleClick = () => setCount(count + 1);
29 +
30 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
31 + onClick: handleClick
32 + }, "Update count"));
33 +}
34 +
35 +function useIsDarkMode() {
36 + const [isDarkMode] = (0, _react.useState)(false);
37 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
38 + }, []);
39 + return isDarkMode;
40 +}
41 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhDdXN0b21Ib29rLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiLCJpc0RhcmtNb2RlIiwidXNlSXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwidXNlRWZmZWN0Q3JlYXRlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7Ozs7OztBQVRBOzs7Ozs7OztBQVdPLFNBQVNBLFNBQVQsR0FBcUI7QUFDMUIsUUFBTSxDQUFDQyxLQUFELEVBQVFDLFFBQVIsSUFBb0IscUJBQVMsQ0FBVCxDQUExQjtBQUNBLFFBQU1DLFVBQVUsR0FBR0MsYUFBYSxFQUFoQztBQUVBLHdCQUFVLE1BQU0sQ0FDZDtBQUNELEdBRkQsRUFFRyxFQUZIOztBQUlBLFFBQU1DLFdBQVcsR0FBRyxNQUFNSCxRQUFRLENBQUNELEtBQUssR0FBRyxDQUFULENBQWxDOztBQUVBLHNCQUNFLHlFQUNFLHlEQUFpQkUsVUFBakIsQ0FERix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cbiAgICAgIDxidXR0b24gb25DbGljaz17aGFuZGxlQ2xpY2t9PlVwZGF0ZSBjb3VudDwvYnV0dG9uPlxuICAgIDwvPlxuICApO1xufVxuXG5mdW5jdGlvbiB1c2VJc0RhcmtNb2RlKCkge1xuICBjb25zdCBbaXNEYXJrTW9kZV0gPSB1c2VTdGF0ZShmYWxzZSk7XG5cbiAgdXNlRWZmZWN0KGZ1bmN0aW9uIHVzZUVmZmVjdENyZWF0ZSgpIHtcbiAgICAvLyBIZXJlIGlzIHdoZXJlIHdlIG1heSBsaXN0ZW4gdG8gYSBcInRoZW1lXCIgZXZlbnQuLi5cbiAgfSwgW10pO1xuXG4gIHJldHVybiBpc0RhcmtNb2RlO1xufVxuIl19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/ComponentWithExternalCustomHooks.js new
+26
@@ -0,0 +1,26 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireDefault(require("react"));
9 +
10 +var _useTheme = _interopRequireDefault(require("./useTheme"));
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const theme = (0, _useTheme.default)();
24 + return /*#__PURE__*/_react.default.createElement("div", null, "theme: ", theme);
25 +}
26 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7QUFWQTs7Ozs7Ozs7QUFZTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU1DLEtBQUssR0FBRyx3QkFBZDtBQUVBLHNCQUFPLHFEQUFhQSxLQUFiLENBQVA7QUFDRCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSBGYWNlYm9vaywgSW5jLiBhbmQgaXRzIGFmZmlsaWF0ZXMuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UgZm91bmQgaW4gdGhlXG4gKiBMSUNFTlNFIGZpbGUgaW4gdGhlIHJvb3QgZGlyZWN0b3J5IG9mIHRoaXMgc291cmNlIHRyZWUuXG4gKlxuICogQGZsb3dcbiAqL1xuXG5pbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IHVzZVRoZW1lIGZyb20gJy4vdXNlVGhlbWUnO1xuXG5leHBvcnQgZnVuY3Rpb24gQ29tcG9uZW50KCkge1xuICBjb25zdCB0aGVtZSA9IHVzZVRoZW1lKCk7XG5cbiAgcmV0dXJuIDxkaXY+dGhlbWU6IHt0aGVtZX08L2Rpdj47XG59XG4iXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/ComponentWithMultipleHooksPerLine.js new
+30
@@ -0,0 +1,30 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = require("react");
9 +
10 +/**
11 + * Copyright (c) Facebook, Inc. and its affiliates.
12 + *
13 + * This source code is licensed under the MIT license found in the
14 + * LICENSE file in the root directory of this source tree.
15 + *
16 + * @flow
17 + */
18 +const A = /*#__PURE__*/(0, _react.createContext)(1);
19 +const B = /*#__PURE__*/(0, _react.createContext)(2);
20 +
21 +function Component() {
22 + const a = (0, _react.useContext)(A);
23 + const b = (0, _react.useContext)(B); // prettier-ignore
24 +
25 + const c = (0, _react.useContext)(A),
26 + d = (0, _react.useContext)(B); // eslint-disable-line one-var
27 +
28 + return a + b + c + d;
29 +}
30 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZS5qcyJdLCJuYW1lcyI6WyJBIiwiQiIsIkNvbXBvbmVudCIsImEiLCJiIiwiYyIsImQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7QUFUQTs7Ozs7Ozs7QUFXQSxNQUFNQSxDQUFDLGdCQUFHLDBCQUFjLENBQWQsQ0FBVjtBQUNBLE1BQU1DLENBQUMsZ0JBQUcsMEJBQWMsQ0FBZCxDQUFWOztBQUVPLFNBQVNDLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsQ0FBQyxHQUFHLHVCQUFXSCxDQUFYLENBQVY7QUFDQSxRQUFNSSxDQUFDLEdBQUcsdUJBQVdILENBQVgsQ0FBVixDQUYwQixDQUkxQjs7QUFDQSxRQUFNSSxDQUFDLEdBQUcsdUJBQVdMLENBQVgsQ0FBVjtBQUFBLFFBQXlCTSxDQUFDLEdBQUcsdUJBQVdMLENBQVgsQ0FBN0IsQ0FMMEIsQ0FLa0I7O0FBRTVDLFNBQU9FLENBQUMsR0FBR0MsQ0FBSixHQUFRQyxDQUFSLEdBQVlDLENBQW5CO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0fSBmcm9tICdyZWFjdCc7XG5cbmNvbnN0IEEgPSBjcmVhdGVDb250ZXh0KDEpO1xuY29uc3QgQiA9IGNyZWF0ZUNvbnRleHQoMik7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IGEgPSB1c2VDb250ZXh0KEEpO1xuICBjb25zdCBiID0gdXNlQ29udGV4dChCKTtcblxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgY29uc3QgYyA9IHVzZUNvbnRleHQoQSksIGQgPSB1c2VDb250ZXh0KEIpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG9uZS12YXJcblxuICByZXR1cm4gYSArIGIgKyBjICsgZDtcbn1cbiJdfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/ComponentWithNestedHooks.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +/**
4 + * Copyright (c) Facebook, Inc. and its affiliates.
5 + *
6 + * This source code is licensed under the MIT license found in the
7 + * LICENSE file in the root directory of this source tree.
8 + *
9 + * @flow
10 + */
11 +const {
12 + useMemo,
13 + useState
14 +} = require('react');
15 +
16 +function Component(props) {
17 + const InnerComponent = useMemo(() => () => {
18 + const [state] = useState(0);
19 + return state;
20 + });
21 + props.callback(InnerComponent);
22 + return null;
23 +}
24 +
25 +module.exports = {
26 + Component
27 +};
28 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7Imx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1xuICovXG5jb25zdCB7dXNlTWVtbywgdXNlU3RhdGV9ID0gcmVxdWlyZSgncmVhY3QnKTtcblxuZnVuY3Rpb24gQ29tcG9uZW50KHByb3BzKSB7XG4gIGNvbnN0IElubmVyQ29tcG9uZW50ID0gdXNlTWVtbygoKSA9PiAoKSA9PiB7XG4gICAgY29uc3QgW3N0YXRlXSA9IHVzZVN0YXRlKDApO1xuXG4gICAgcmV0dXJuIHN0YXRlO1xuICB9KTtcbiAgcHJvcHMuY2FsbGJhY2soSW5uZXJDb21wb25lbnQpO1xuXG4gIHJldHVybiBudWxsO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtDb21wb25lbnR9O1xuIl19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/ContainingStringSourceMappingURL.js new
+29
@@ -0,0 +1,29 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +// ?sourceMappingURL=([^\s'"]+)/gm
23 +function Component() {
24 + const [count, setCount] = (0, _react.useState)(0);
25 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
26 + onClick: () => setCount(count + 1)
27 + }, "Click me"));
28 +}
29 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7Ozs7O0FBVEE7Ozs7Ozs7O0FBV0E7QUFFTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxFQUFRQyxRQUFSLElBQW9CLHFCQUFTLENBQVQsQ0FBMUI7QUFFQSxzQkFDRSx1REFDRSx3REFBZ0JELEtBQWhCLFdBREYsZUFFRTtBQUFRLElBQUEsT0FBTyxFQUFFLE1BQU1DLFFBQVEsQ0FBQ0QsS0FBSyxHQUFHLENBQVQ7QUFBL0IsZ0JBRkYsQ0FERjtBQU1EIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCwge3VzZVN0YXRlfSBmcm9tICdyZWFjdCc7XG5cbi8vID9zb3VyY2VNYXBwaW5nVVJMPShbXlxccydcIl0rKS9nbVxuXG5leHBvcnQgZnVuY3Rpb24gQ29tcG9uZW50KCkge1xuICBjb25zdCBbY291bnQsIHNldENvdW50XSA9IHVzZVN0YXRlKDApO1xuXG4gIHJldHVybiAoXG4gICAgPGRpdj5cbiAgICAgIDxwPllvdSBjbGlja2VkIHtjb3VudH0gdGltZXM8L3A+XG4gICAgICA8YnV0dG9uIG9uQ2xpY2s9eygpID0+IHNldENvdW50KGNvdW50ICsgMSl9PkNsaWNrIG1lPC9idXR0b24+XG4gICAgPC9kaXY+XG4gICk7XG59XG4iXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/Example.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
25 + onClick: () => setCount(count + 1)
26 + }, "Click me"));
27 +}
28 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJzZXRDb3VudCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7QUFUQTs7Ozs7Ozs7QUFXTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxFQUFRQyxRQUFSLElBQW9CLHFCQUFTLENBQVQsQ0FBMUI7QUFFQSxzQkFDRSx1REFDRSx3REFBZ0JELEtBQWhCLFdBREYsZUFFRTtBQUFRLElBQUEsT0FBTyxFQUFFLE1BQU1DLFFBQVEsQ0FBQ0QsS0FBSyxHQUFHLENBQVQ7QUFBL0IsZ0JBRkYsQ0FERjtBQU1EIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCwge3VzZVN0YXRlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IFtjb3VudCwgc2V0Q291bnRdID0gdXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2PlxuICAgICAgPHA+WW91IGNsaWNrZWQge2NvdW50fSB0aW1lczwvcD5cbiAgICAgIDxidXR0b24gb25DbGljaz17KCkgPT4gc2V0Q291bnQoY291bnQgKyAxKX0+Q2xpY2sgbWU8L2J1dHRvbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn1cbiJdfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/InlineRequire.js new
+21
@@ -0,0 +1,21 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +/**
9 + * Copyright (c) Facebook, Inc. and its affiliates.
10 + *
11 + * This source code is licensed under the MIT license found in the
12 + * LICENSE file in the root directory of this source tree.
13 + *
14 + * @flow
15 + */
16 +function Component() {
17 + const [count] = require('react').useState(0);
18 +
19 + return count;
20 +}
21 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/ToDoList.js new
+106
@@ -0,0 +1,106 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.ListItem = ListItem;
7 +exports.List = List;
8 +
9 +var React = _interopRequireWildcard(require("react"));
10 +
11 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
12 +
13 +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; }
14 +
15 +/**
16 + * Copyright (c) Facebook, Inc. and its affiliates.
17 + *
18 + * This source code is licensed under the MIT license found in the
19 + * LICENSE file in the root directory of this source tree.
20 + *
21 + * @flow
22 + */
23 +function ListItem({
24 + item,
25 + removeItem,
26 + toggleItem
27 +}) {
28 + const handleDelete = (0, React.useCallback)(() => {
29 + removeItem(item);
30 + }, [item, removeItem]);
31 + const handleToggle = (0, React.useCallback)(() => {
32 + toggleItem(item);
33 + }, [item, toggleItem]);
34 + return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("button", {
35 + onClick: handleDelete
36 + }, "Delete"), /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
37 + checked: item.isComplete,
38 + onChange: handleToggle,
39 + type: "checkbox"
40 + }), ' ', item.text));
41 +}
42 +
43 +function List(props) {
44 + const [newItemText, setNewItemText] = (0, React.useState)('');
45 + const [items, setItems] = (0, React.useState)([{
46 + id: 1,
47 + isComplete: true,
48 + text: 'First'
49 + }, {
50 + id: 2,
51 + isComplete: true,
52 + text: 'Second'
53 + }, {
54 + id: 3,
55 + isComplete: false,
56 + text: 'Third'
57 + }]);
58 + const [uid, setUID] = (0, React.useState)(4);
59 + const handleClick = (0, React.useCallback)(() => {
60 + if (newItemText !== '') {
61 + setItems([...items, {
62 + id: uid,
63 + isComplete: false,
64 + text: newItemText
65 + }]);
66 + setUID(uid + 1);
67 + setNewItemText('');
68 + }
69 + }, [newItemText, items, uid]);
70 + const handleKeyPress = (0, React.useCallback)(event => {
71 + if (event.key === 'Enter') {
72 + handleClick();
73 + }
74 + }, [handleClick]);
75 + const handleChange = (0, React.useCallback)(event => {
76 + setNewItemText(event.currentTarget.value);
77 + }, [setNewItemText]);
78 + const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
79 + const toggleItem = (0, React.useCallback)(itemToToggle => {
80 + // Dont use indexOf()
81 + // because editing props in DevTools creates a new Object.
82 + const index = items.findIndex(item => item.id === itemToToggle.id);
83 + setItems(items.slice(0, index).concat({ ...itemToToggle,
84 + isComplete: !itemToToggle.isComplete
85 + }).concat(items.slice(index + 1)));
86 + }, [items]);
87 + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "List"), /*#__PURE__*/React.createElement("input", {
88 + type: "text",
89 + placeholder: "New list item...",
90 + value: newItemText,
91 + onChange: handleChange,
92 + onKeyPress: handleKeyPress
93 + }), /*#__PURE__*/React.createElement("button", {
94 + disabled: newItemText === '',
95 + onClick: handleClick
96 + }, /*#__PURE__*/React.createElement("span", {
97 + role: "img",
98 + "aria-label": "Add item"
99 + }, "Add")), /*#__PURE__*/React.createElement("ul", null, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
100 + key: item.id,
101 + item: item,
102 + removeItem: removeItem,
103 + toggleItem: toggleItem
104 + }))));
105 +}
106 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRvRG9MaXN0LmpzIl0sIm5hbWVzIjpbIkxpc3RJdGVtIiwiaXRlbSIsInJlbW92ZUl0ZW0iLCJ0b2dnbGVJdGVtIiwiaGFuZGxlRGVsZXRlIiwiaGFuZGxlVG9nZ2xlIiwiaXNDb21wbGV0ZSIsInRleHQiLCJMaXN0IiwicHJvcHMiLCJuZXdJdGVtVGV4dCIsInNldE5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJzZXRJdGVtcyIsImlkIiwidWlkIiwic2V0VUlEIiwiaGFuZGxlQ2xpY2siLCJoYW5kbGVLZXlQcmVzcyIsImV2Z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GxlQ2xpY2t9PlxuICAgICAgICA8c3BhbiByb2xlPVwiaW1nXCIgYXJpYS1sYWJlbD1cIkFkZCBpdGVtXCI+XG4gICAgICAgICAgQWRkXG4gICAgICAgIDwvc3Bhbj5cbiAgICAgIDwvYnV0dG9uPlxuICAgICAgPHVsPlxuICAgICAgICB7aXRlbXMubWFwKGl0ZW0gPT4gKFxuICAgICAgICAgIDxMaXN0SXRlbVxuICAgICAgICAgICAga2V5PXtpdGVtLmlkfVxuICAgICAgICAgICAgaXRlbT17aXRlbX1cbiAgICAgICAgICAgIHJlbW92ZUl0ZW09e3JlbW92ZUl0ZW19XG4gICAgICAgICAgICB0b2dnbGVJdGVtPXt0b2dnbGVJdGVtfVxuICAgICAgICAgIC8+XG4gICAgICAgICkpfVxuICAgICAgPC91bD5cbiAgICA8L0ZyYWdtZW50PlxuICApO1xufVxuIl19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/index.js new
+89
@@ -0,0 +1,89 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
7 + enumerable: true,
8 + get: function () {
9 + return _ComponentUsingHooksIndirectly.Component;
10 + }
11 +});
12 +Object.defineProperty(exports, "ComponentWithCustomHook", {
13 + enumerable: true,
14 + get: function () {
15 + return _ComponentWithCustomHook.Component;
16 + }
17 +});
18 +Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
19 + enumerable: true,
20 + get: function () {
21 + return _ComponentWithExternalCustomHooks.Component;
22 + }
23 +});
24 +Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
25 + enumerable: true,
26 + get: function () {
27 + return _ComponentWithMultipleHooksPerLine.Component;
28 + }
29 +});
30 +Object.defineProperty(exports, "ComponentWithNestedHooks", {
31 + enumerable: true,
32 + get: function () {
33 + return _ComponentWithNestedHooks.Component;
34 + }
35 +});
36 +Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
37 + enumerable: true,
38 + get: function () {
39 + return _ContainingStringSourceMappingURL.Component;
40 + }
41 +});
42 +Object.defineProperty(exports, "Example", {
43 + enumerable: true,
44 + get: function () {
45 + return _Example.Component;
46 + }
47 +});
48 +Object.defineProperty(exports, "InlineRequire", {
49 + enumerable: true,
50 + get: function () {
51 + return _InlineRequire.Component;
52 + }
53 +});
54 +Object.defineProperty(exports, "useTheme", {
55 + enumerable: true,
56 + get: function () {
57 + return _useTheme.default;
58 + }
59 +});
60 +exports.ToDoList = void 0;
61 +
62 +var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
63 +
64 +var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
65 +
66 +var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
67 +
68 +var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
69 +
70 +var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
71 +
72 +var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
73 +
74 +var _Example = require("./Example");
75 +
76 +var _InlineRequire = require("./InlineRequire");
77 +
78 +var ToDoList = _interopRequireWildcard(require("./ToDoList"));
79 +
80 +exports.ToDoList = ToDoList;
81 +
82 +var _useTheme = _interopRequireDefault(require("./useTheme"));
83 +
84 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
85 +
86 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
87 +
88 +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; }
89 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFTQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7OztBQUVBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5fSBmcm9tICcuL0NvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5JztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhDdXN0b21Ib29rfSBmcm9tICcuL0NvbXBvbmVudFdpdGhDdXN0b21Ib29rJztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzfSBmcm9tICcuL0NvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzJztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZX0gZnJvbSAnLi9Db21wb25lbnRXaXRoTXVsdGlwbGVIb29rc1BlckxpbmUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgQ29tcG9uZW50V2l0aE5lc3RlZEhvb2tzfSBmcm9tICcuL0NvbXBvbmVudFdpdGhOZXN0ZWRIb29rcyc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBDb250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTH0gZnJvbSAnLi9Db250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTCc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBFeGFtcGxlfSBmcm9tICcuL0V4YW1wbGUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgSW5saW5lUmVxdWlyZX0gZnJvbSAnLi9JbmxpbmVSZXF1aXJlJztcbmltcG9ydCAqIGFzIFRvRG9MaXN0IGZyb20gJy4vVG9Eb0xpc3QnO1xuZXhwb3J0IHtUb0RvTGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/index-map/useTheme.js new
+27
@@ -0,0 +1,27 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = useTheme;
7 +exports.ThemeContext = void 0;
8 +
9 +var _react = require("react");
10 +
11 +/**
12 + * Copyright (c) Facebook, Inc. and its affiliates.
13 + *
14 + * This source code is licensed under the MIT license found in the
15 + * LICENSE file in the root directory of this source tree.
16 + *
17 + * @flow
18 + */
19 +const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
20 +exports.ThemeContext = ThemeContext;
21 +
22 +function useTheme() {
23 + const theme = (0, _react.useContext)(ThemeContext);
24 + (0, _react.useDebugValue)(theme);
25 + return theme;
26 +}
27 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentUsingHooksIndirectly.js new
+45
@@ -0,0 +1,45 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const countState = (0, _react.useState)(0);
24 + const count = countState[0];
25 + const setCount = countState[1];
26 + const darkMode = useIsDarkMode();
27 + const [isDarkMode] = darkMode;
28 + (0, _react.useEffect)(() => {// ...
29 + }, []);
30 +
31 + const handleClick = () => setCount(count + 1);
32 +
33 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
34 + onClick: handleClick
35 + }, "Update count"));
36 +}
37 +
38 +function useIsDarkMode() {
39 + const darkModeState = (0, _react.useState)(false);
40 + const [isDarkMode] = darkModeState;
41 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
42 + }, []);
43 + return [isDarkMode, () => {}];
44 +}
45 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5LmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50U3RhdGUiLCJjb3VudCIsInNldENvdW50IiwiZGFya01vZGUiLCJ1c2VJc0RhcmtNb2RlIiwiaXNEYXJrTW9kZSIsImhhbmRsZUNsaWNrIiwiZGFya01vZGVTdGF0ZSIsInVzZUVmZmVjdENyZWF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7QUFUQTs7Ozs7Ozs7QUFXTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU1DLFVBQVUsR0FBRyxxQkFBUyxDQUFULENBQW5CO0FBQ0EsUUFBTUMsS0FBSyxHQUFHRCxVQUFVLENBQUMsQ0FBRCxDQUF4QjtBQUNBLFFBQU1FLFFBQVEsR0FBR0YsVUFBVSxDQUFDLENBQUQsQ0FBM0I7QUFFQSxRQUFNRyxRQUFRLEdBQUdDLGFBQWEsRUFBOUI7QUFDQSxRQUFNLENBQUNDLFVBQUQsSUFBZUYsUUFBck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G4gIGNvbnN0IHNldENvdW50ID0gY291bnRTdGF0ZVsxXTtcblxuICBjb25zdCBkYXJrTW9kZSA9IHVzZUlzRGFya01vZGUoKTtcbiAgY29uc3QgW2lzRGFya01vZGVdID0gZGFya01vZGU7XG5cbiAgdXNlRWZmZWN0KCgpID0+IHtcbiAgICAvLyAuLi5cbiAgfSwgW10pO1xuXG4gIGNvbnN0IGhhbmRsZUNsaWNrID0gKCkgPT4gc2V0Q291bnQoY291bnQgKyAxKTtcblxuICByZXR1cm4gKFxuICAgIDw+XG4gICAgICA8ZGl2PkRhcmsgbW9kZT8ge2lzRGFya01vZGV9PC9kaXY+XG4gICAgICA8ZGl2PkNvdW50OiB7Y291bnR9PC9kaXY+XG4gICAgICA8YnV0dG9uIG9uQ2xpY2s9e2hhbmRsZUNsaWNrfT5VcGRhdGUgY291bnQ8L2J1dHRvbj5cbiAgICA8Lz5cbiAgKTtcbn1cblxuZnVuY3Rpb24gdXNlSXNEYXJrTW9kZSgpIHtcbiAgY29uc3QgZGFya01vZGVTdGF0ZSA9IHVzZVN0YXRlKGZhbHNlKTtcbiAgY29uc3QgW2lzRGFya01vZGVdID0gZGFya01vZGVTdGF0ZTtcblxuICB1c2VFZmZlY3QoZnVuY3Rpb24gdXNlRWZmZWN0Q3JlYXRlKCkge1xuICAgIC8vIEhlcmUgaXMgd2hlcmUgd2UgbWF5IGxpc3RlbiB0byBhIFwidGhlbWVcIiBldmVudC4uLlxuICB9LCBbXSk7XG5cbiAgcmV0dXJuIFtpc0RhcmtNb2RlLCAoKSA9PiB7fV07XG59XG4iXSwieF9yZWFjdF9zb3VyY2VzIjpbW3sibmFtZXMiOlsiPG5vLWhvb2s+IiwiY291bnQiLCJkYXJrTW9kZSIsImlzRGFya01vZGUiXSwibWFwcGluZ3MiOiJDQUFEO2FxQkNBLEFXREE7aUJiRUEsQWVGQTtvQ1ZHQSxBZUhBIn1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithCustomHook.js new
+41
@@ -0,0 +1,41 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + const isDarkMode = useIsDarkMode();
25 + (0, _react.useEffect)(() => {// ...
26 + }, []);
27 +
28 + const handleClick = () => setCount(count + 1);
29 +
30 + return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, "Dark mode? ", isDarkMode), /*#__PURE__*/_react.default.createElement("div", null, "Count: ", count), /*#__PURE__*/_react.default.createElement("button", {
31 + onClick: handleClick
32 + }, "Update count"));
33 +}
34 +
35 +function useIsDarkMode() {
36 + const [isDarkMode] = (0, _react.useState)(false);
37 + (0, _react.useEffect)(function useEffectCreate() {// Here is where we may listen to a "theme" event...
38 + }, []);
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ZlbnQuLi5cbiAgfSwgW10pO1xuXG4gIHJldHVybiBpc0RhcmtNb2RlO1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsImNvdW50IiwiaXNEYXJrTW9kZSJdLCJtYXBwaW5ncyI6IkNBQUQ7YTRCQ0EsQVdEQTtjbEJFQSxBZUZBO2dDYkVBLEFlRkEifV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithExternalCustomHooks.js new
+26
@@ -0,0 +1,26 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireDefault(require("react"));
9 +
10 +var _useTheme = _interopRequireDefault(require("./useTheme"));
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const theme = (0, _useTheme.default)();
24 + return /*#__PURE__*/_react.default.createElement("div", null, "theme: ", theme);
25 +}
26 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsInRoZW1lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBU0E7O0FBQ0E7Ozs7QUFWQTs7Ozs7Ozs7QUFZTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU1DLEtBQUssR0FBRyx3QkFBZDtBQUVBLHNCQUFPLHFEQUFhQSxLQUFiLENBQVA7QUFDRCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSBGYWNlYm9vaywgSW5jLiBhbmQgaXRzIGFmZmlsaWF0ZXMuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2UgZm91bmQgaW4gdGhlXG4gKiBMSUNFTlNFIGZpbGUgaW4gdGhlIHJvb3QgZGlyZWN0b3J5IG9mIHRoaXMgc291cmNlIHRyZWUuXG4gKlxuICogQGZsb3dcbiAqL1xuXG5pbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IHVzZVRoZW1lIGZyb20gJy4vdXNlVGhlbWUnO1xuXG5leHBvcnQgZnVuY3Rpb24gQ29tcG9uZW50KCkge1xuICBjb25zdCB0aGVtZSA9IHVzZVRoZW1lKCk7XG5cbiAgcmV0dXJuIDxkaXY+dGhlbWU6IHt0aGVtZX08L2Rpdj47XG59XG4iXSwieF9yZWFjdF9zb3VyY2VzIjpbW3sibmFtZXMiOlsiPG5vLWhvb2s+IiwidGhlbWUiXSwibWFwcGluZ3MiOiJDQUFEO2NnQkNBLEFVREEifV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine.js new
+30
@@ -0,0 +1,30 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = require("react");
9 +
10 +/**
11 + * Copyright (c) Facebook, Inc. and its affiliates.
12 + *
13 + * This source code is licensed under the MIT license found in the
14 + * LICENSE file in the root directory of this source tree.
15 + *
16 + * @flow
17 + */
18 +const A = /*#__PURE__*/(0, _react.createContext)(1);
19 +const B = /*#__PURE__*/(0, _react.createContext)(2);
20 +
21 +function Component() {
22 + const a = (0, _react.useContext)(A);
23 + const b = (0, _react.useContext)(B); // prettier-ignore
24 +
25 + const c = (0, _react.useContext)(A),
26 + d = (0, _react.useContext)(B); // eslint-disable-line one-var
27 +
28 + return a + b + c + d;
29 +}
30 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZS5qcyJdLCJuYW1lcyI6WyJBIiwiQiIsIkNvbXBvbmVudCIsImEiLCJiIiwiYyIsImQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7QUFUQTs7Ozs7Ozs7QUFXQSxNQUFNQSxDQUFDLGdCQUFHLDBCQUFjLENBQWQsQ0FBVjtBQUNBLE1BQU1DLENBQUMsZ0JBQUcsMEJBQWMsQ0FBZCxDQUFWOztBQUVPLFNBQVNDLFNBQVQsR0FBcUI7QUFDMUIsUUFBTUMsQ0FBQyxHQUFHLHVCQUFXSCxDQUFYLENBQVY7QUFDQSxRQUFNSSxDQUFDLEdBQUcsdUJBQVdILENBQVgsQ0FBVixDQUYwQixDQUkxQjs7QUFDQSxRQUFNSSxDQUFDLEdBQUcsdUJBQVdMLENBQVgsQ0FBVjtBQUFBLFFBQXlCTSxDQUFDLEdBQUcsdUJBQVdMLENBQVgsQ0FBN0IsQ0FMMEIsQ0FLa0I7O0FBRTVDLFNBQU9FLENBQUMsR0FBR0MsQ0FBSixHQUFRQyxDQUFSLEdBQVlDLENBQW5CO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0fSBmcm9tICdyZWFjdCc7XG5cbmNvbnN0IEEgPSBjcmVhdGVDb250ZXh0KDEpO1xuY29uc3QgQiA9IGNyZWF0ZUNvbnRleHQoMik7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IGEgPSB1c2VDb250ZXh0KEEpO1xuICBjb25zdCBiID0gdXNlQ29udGV4dChCKTtcblxuICAvLyBwcmV0dGllci1pZ25vcmVcbiAgY29uc3QgYyA9IHVzZUNvbnRleHQoQSksIGQgPSB1c2VDb250ZXh0KEIpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG9uZS12YXJcblxuICByZXR1cm4gYSArIGIgKyBjICsgZDtcbn1cbiJdLCJ4X3JlYWN0X3NvdXJjZXMiOltbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJhIiwiYiIsImMiLCJkIl0sIm1hcHBpbmdzIjoiQ0FBRDtnQllDQSxBYURBO2lCYkVBLEFhRkE7b0JiR0EsQWFIQSxBTUlBLEFhSkEifV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithNestedHooks.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +/**
4 + * Copyright (c) Facebook, Inc. and its affiliates.
5 + *
6 + * This source code is licensed under the MIT license found in the
7 + * LICENSE file in the root directory of this source tree.
8 + *
9 + * @flow
10 + */
11 +const {
12 + useMemo,
13 + useState
14 +} = require('react');
15 +
16 +function Component(props) {
17 + const InnerComponent = useMemo(() => () => {
18 + const [state] = useState(0);
19 + return state;
20 + });
21 + props.callback(InnerComponent);
22 + return null;
23 +}
24 +
25 +module.exports = {
26 + Component
27 +};
28 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbXBvbmVudFdpdGhOZXN0ZWRIb29rcy5qcyJdLCJuYW1lcyI6WyJ1c2VNZW1vIiwidXNlU3RhdGUiLCJyZXF1aXJlIiwiQ29tcG9uZW50IiwicHJvcHMiLCJJbm5lckNvbXBvbmVudCIsInN0YXRlIiwiY2FsbGJhY2siLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7OztBQVFBLE1BQU07QUFBQ0EsRUFBQUEsT0FBRDtBQUFVQyxFQUFBQTtBQUFWLElBQXNCQyxPQUFPLENBQUMsT0FBRCxDQUFuQzs7QUFFQSxTQUFTQyxTQUFULENBQW1CQyxLQUFuQixFQUEwQjtBQUN4QixRQUFNQyxjQUFjLEdBQUdMLE9BQU8sQ0FBQyxNQUFNLE1BQU07QUFDekMsVUFBTSxDQUFDTSxLQUFELElBQVVMLFFBQVEsQ0FBQyxDQUFELENBQXhCO0FBRUEsV0FBT0ssS0FBUDtBQUNELEdBSjZCLENBQTlCO0FBS0FGLEVBQUFBLEtBQUssQ0FBQ0csUUFBTixDQUFlRixjQUFmO0FBRUEsU0FBTyxJQUFQO0FBQ0Q7O0FBRURHLE1BQU0sQ0FBQ0MsT0FBUCxHQUFpQjtBQUFDTixFQUFBQTtBQUFELENBQWpCIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5jb25zdCB7dXNlTWVtbywgdXNlU3RhdGV9ID0gcmVxdWlyZSgncmVhY3QnKTtcblxuZnVuY3Rpb24gQ29tcG9uZW50KHByb3BzKSB7XG4gIGNvbnN0IElubmVyQ29tcG9uZW50ID0gdXNlTWVtbygoKSA9PiAoKSA9PiB7XG4gICAgY29uc3QgW3N0YXRlXSA9IHVzZVN0YXRlKDApO1xuXG4gICAgcmV0dXJuIHN0YXRlO1xuICB9KTtcbiAgcHJvcHMuY2FsbGJhY2soSW5uZXJDb21wb25lbnQpO1xuXG4gIHJldHVybiBudWxsO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtDb21wb25lbnR9O1xuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsIklubmVyQ29tcG9uZW50Iiwic3RhdGUiXSwibWFwcGluZ3MiOiJDQUFEO1l5QkNBO2FMQ0EsQVdEQTtnQjNCREEifV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ContainingStringSourceMappingURL.js new
+29
@@ -0,0 +1,29 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +// ?sourceMappingURL=([^\s'"]+)/gm
23 +function Component() {
24 + const [count, setCount] = (0, _react.useState)(0);
25 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
26 + onClick: () => setCount(count + 1)
27 + }, "Click me"));
28 +}
29 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvbnRhaW5pbmdTdHJpbmdTb3VyY2VNYXBwaW5nVVJMLmpzIl0sIm5hbWVzIjpbIkNvbXBvbmVudCIsImNvdW50Iiwic2V0Q291bnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFTQTs7Ozs7O0FBVEE7Ozs7Ozs7O0FBV0E7QUFFTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxFQUFRQyxRQUFSLElBQW9CLHFCQUFTLENBQVQsQ0FBMUI7QUFFQSxzQkFDRSx1REFDRSx3REFBZ0JELEtBQWhCLFdBREYsZUFFRTtBQUFRLElBQUEsT0FBTyxFQUFFLE1BQU1DLFFBQVEsQ0FBQ0QsS0FBSyxHQUFHLENBQVQ7QUFBL0IsZ0JBRkYsQ0FERjtBQU1EIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCwge3VzZVN0YXRlfSBmcm9tICdyZWFjdCc7XG5cbi8vID9zb3VyY2VNYXBwaW5nVVJMPShbXlxccydcIl0rKS9nbVxuXG5leHBvcnQgZnVuY3Rpb24gQ29tcG9uZW50KCkge1xuICBjb25zdCBbY291bnQsIHNldENvdW50XSA9IHVzZVN0YXRlKDApO1xuXG4gIHJldHVybiAoXG4gICAgPGRpdj5cbiAgICAgIDxwPllvdSBjbGlja2VkIHtjb3VudH0gdGltZXM8L3A+XG4gICAgICA8YnV0dG9uIG9uQ2xpY2s9eygpID0+IHNldENvdW50KGNvdW50ICsgMSl9PkNsaWNrIG1lPC9idXR0b24+XG4gICAgPC9kaXY+XG4gICk7XG59XG4iXSwieF9yZWFjdF9zb3VyY2VzIjpbW3sibmFtZXMiOlsiPG5vLWhvb2s+IiwiY291bnQiXSwibWFwcGluZ3MiOiJDQUFEO2U0QkNBLEFXREEifV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/Example.js new
+28
@@ -0,0 +1,28 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +var _react = _interopRequireWildcard(require("react"));
9 +
10 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
11 +
12 +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; }
13 +
14 +/**
15 + * Copyright (c) Facebook, Inc. and its affiliates.
16 + *
17 + * This source code is licensed under the MIT license found in the
18 + * LICENSE file in the root directory of this source tree.
19 + *
20 + * @flow
21 + */
22 +function Component() {
23 + const [count, setCount] = (0, _react.useState)(0);
24 + return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "You clicked ", count, " times"), /*#__PURE__*/_react.default.createElement("button", {
25 + onClick: () => setCount(count + 1)
26 + }, "Click me"));
27 +}
28 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkV4YW1wbGUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJzZXRDb3VudCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQVNBOzs7Ozs7QUFUQTs7Ozs7Ozs7QUFXTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxFQUFRQyxRQUFSLElBQW9CLHFCQUFTLENBQVQsQ0FBMUI7QUFFQSxzQkFDRSx1REFDRSx3REFBZ0JELEtBQWhCLFdBREYsZUFFRTtBQUFRLElBQUEsT0FBTyxFQUFFLE1BQU1DLFFBQVEsQ0FBQ0QsS0FBSyxHQUFHLENBQVQ7QUFBL0IsZ0JBRkYsQ0FERjtBQU1EIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmltcG9ydCBSZWFjdCwge3VzZVN0YXRlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBmdW5jdGlvbiBDb21wb25lbnQoKSB7XG4gIGNvbnN0IFtjb3VudCwgc2V0Q291bnRdID0gdXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIChcbiAgICA8ZGl2PlxuICAgICAgPHA+WW91IGNsaWNrZWQge2NvdW50fSB0aW1lczwvcD5cbiAgICAgIDxidXR0b24gb25DbGljaz17KCkgPT4gc2V0Q291bnQoY291bnQgKyAxKX0+Q2xpY2sgbWU8L2J1dHRvbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn1cbiJdLCJ4X3JlYWN0X3NvdXJjZXMiOltbeyJuYW1lcyI6WyI8bm8taG9vaz4iLCJjb3VudCJdLCJtYXBwaW5ncyI6IkNBQUQ7YTRCQ0EsQVdEQSJ9XV19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/InlineRequire.js new
+21
@@ -0,0 +1,21 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.Component = Component;
7 +
8 +/**
9 + * Copyright (c) Facebook, Inc. and its affiliates.
10 + *
11 + * This source code is licensed under the MIT license found in the
12 + * LICENSE file in the root directory of this source tree.
13 + *
14 + * @flow
15 + */
16 +function Component() {
17 + const [count] = require('react').useState(0);
18 +
19 + return count;
20 +}
21 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIklubGluZVJlcXVpcmUuanMiXSwibmFtZXMiOlsiQ29tcG9uZW50IiwiY291bnQiLCJyZXF1aXJlIiwidXNlU3RhdGUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7Ozs7QUFTTyxTQUFTQSxTQUFULEdBQXFCO0FBQzFCLFFBQU0sQ0FBQ0MsS0FBRCxJQUFVQyxPQUFPLENBQUMsT0FBRCxDQUFQLENBQWlCQyxRQUFqQixDQUEwQixDQUExQixDQUFoQjs7QUFFQSxTQUFPRixLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuZXhwb3J0IGZ1bmN0aW9uIENvbXBvbmVudCgpIHtcbiAgY29uc3QgW2NvdW50XSA9IHJlcXVpcmUoJ3JlYWN0JykudXNlU3RhdGUoMCk7XG5cbiAgcmV0dXJuIGNvdW50O1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/ToDoList.js new
+106
@@ -0,0 +1,106 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.ListItem = ListItem;
7 +exports.List = List;
8 +
9 +var React = _interopRequireWildcard(require("react"));
10 +
11 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
12 +
13 +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; }
14 +
15 +/**
16 + * Copyright (c) Facebook, Inc. and its affiliates.
17 + *
18 + * This source code is licensed under the MIT license found in the
19 + * LICENSE file in the root directory of this source tree.
20 + *
21 + * @flow
22 + */
23 +function ListItem({
24 + item,
25 + removeItem,
26 + toggleItem
27 +}) {
28 + const handleDelete = (0, React.useCallback)(() => {
29 + removeItem(item);
30 + }, [item, removeItem]);
31 + const handleToggle = (0, React.useCallback)(() => {
32 + toggleItem(item);
33 + }, [item, toggleItem]);
34 + return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("button", {
35 + onClick: handleDelete
36 + }, "Delete"), /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
37 + checked: item.isComplete,
38 + onChange: handleToggle,
39 + type: "checkbox"
40 + }), ' ', item.text));
41 +}
42 +
43 +function List(props) {
44 + const [newItemText, setNewItemText] = (0, React.useState)('');
45 + const [items, setItems] = (0, React.useState)([{
46 + id: 1,
47 + isComplete: true,
48 + text: 'First'
49 + }, {
50 + id: 2,
51 + isComplete: true,
52 + text: 'Second'
53 + }, {
54 + id: 3,
55 + isComplete: false,
56 + text: 'Third'
57 + }]);
58 + const [uid, setUID] = (0, React.useState)(4);
59 + const handleClick = (0, React.useCallback)(() => {
60 + if (newItemText !== '') {
61 + setItems([...items, {
62 + id: uid,
63 + isComplete: false,
64 + text: newItemText
65 + }]);
66 + setUID(uid + 1);
67 + setNewItemText('');
68 + }
69 + }, [newItemText, items, uid]);
70 + const handleKeyPress = (0, React.useCallback)(event => {
71 + if (event.key === 'Enter') {
72 + handleClick();
73 + }
74 + }, [handleClick]);
75 + const handleChange = (0, React.useCallback)(event => {
76 + setNewItemText(event.currentTarget.value);
77 + }, [setNewItemText]);
78 + const removeItem = (0, React.useCallback)(itemToRemove => setItems(items.filter(item => item !== itemToRemove)), [items]);
79 + const toggleItem = (0, React.useCallback)(itemToToggle => {
80 + // Dont use indexOf()
81 + // because editing props in DevTools creates a new Object.
82 + const index = items.findIndex(item => item.id === itemToToggle.id);
83 + setItems(items.slice(0, index).concat({ ...itemToToggle,
84 + isComplete: !itemToToggle.isComplete
85 + }).concat(items.slice(index + 1)));
86 + }, [items]);
87 + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "List"), /*#__PURE__*/React.createElement("input", {
88 + type: "text",
89 + placeholder: "New list item...",
90 + value: newItemText,
91 + onChange: handleChange,
92 + onKeyPress: handleKeyPress
93 + }), /*#__PURE__*/React.createElement("button", {
94 + disabled: newItemText === '',
95 + onClick: handleClick
96 + }, /*#__PURE__*/React.createElement("span", {
97 + role: "img",
98 + "aria-label": "Add item"
99 + }, "Add")), /*#__PURE__*/React.createElement("ul", null, items.map(item => /*#__PURE__*/React.createElement(ListItem, {
100 + key: item.id,
101 + item: item,
102 + removeItem: removeItem,
103 + toggleItem: toggleItem
104 + }))));
105 +}
106 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRvRG9MaXN0LmpzIl0sIm5hbWVzIjpbIkxpc3RJdGVtIiwiaXRlbSIsInJlbW92ZUl0ZW0iLCJ0b2dnbGVJdGVtIiwiaGFuZGxlRGVsZXRlIiwiaGFuZGxlVG9nZ2xlIiwiaXNDb21wbGV0ZSIsInRleHQiLCJMaXN0IiwicHJvcHMiLCJuZXdJdGVtVGV4dCIsInNldE5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJzZXRJdGVtcyIsImlkIiwidWlkIiwic2V0VUlEIiwiaGFuZGxlQ2xpY2siLCJoYW5kbGVLZXlQcmVzcyIsImV2ZW50Iiwia2V5IiwiaGFuZGxlQ2hhbmdlIiwiY3VycmVudFRhcmdldCIsInZhbHVlIiwiaXRlbVRvUmVtb3ZlIiwiZmlsdGVyIiwiaXRlbVRvVG9nZ2xlIiwiaW5kZXgiLCJmaW5kSW5kZXgiLCJzbGljZSIsImNvbmNhdCIsIm1hcCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFTQTs7Ozs7O0FBVEE7Ozs7Ozs7O0FBWU8sU0FBU0EsUUFBVCxDQUFrQjtBQUFDQyxFQUFBQSxJQUFEO0FBQU9DLEVBQUFBLFVBQVA7QUFBbUJDLEVBQUFBO0FBQW5CLENBQWxCLEVBQWtEO0FBQ3ZELFFBQU1DLFlBQVksR0FBRyx1QkFBWSxNQUFNO0FBQ3JDRixJQUFBQSxVQUF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AgICA8L0ZyYWdtZW50PlxuICApO1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsImhhbmRsZURlbGV0ZSIsImhhbmRsZVRvZ2dsZSIsIm5ld0l0ZW1UZXh0IiwiaXRlbXMiLCJ1aWQiLCJoYW5kbGVDbGljayIsImhhbmRsZUtleVByZXNzIiwiaGFuZGxlQ2hhbmdlIiwicmVtb3ZlSXRlbSIsInRvZ2dsZUl0ZW0iXSwibWFwcGluZ3MiOiJDQUFEO2N1QkNBO2dCQ0RBO2tCREVBO29CQ0ZBO3NDZ0JHQSxBWUhBO3VDeEJJQTsyQ3hCSkE7NENvQktBLEFXTEE7OENiTUE7MkRTTkE7NkROT0E7b0V0QlBBO3NFb0JRQTsyRXBCUkE7NkVrQlNBO2dGbEJUQTtrRmtCVUE7bUdsQlZBIn1dXX19XX0=
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/index.js new
+89
@@ -0,0 +1,89 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +Object.defineProperty(exports, "ComponentUsingHooksIndirectly", {
7 + enumerable: true,
8 + get: function () {
9 + return _ComponentUsingHooksIndirectly.Component;
10 + }
11 +});
12 +Object.defineProperty(exports, "ComponentWithCustomHook", {
13 + enumerable: true,
14 + get: function () {
15 + return _ComponentWithCustomHook.Component;
16 + }
17 +});
18 +Object.defineProperty(exports, "ComponentWithExternalCustomHooks", {
19 + enumerable: true,
20 + get: function () {
21 + return _ComponentWithExternalCustomHooks.Component;
22 + }
23 +});
24 +Object.defineProperty(exports, "ComponentWithMultipleHooksPerLine", {
25 + enumerable: true,
26 + get: function () {
27 + return _ComponentWithMultipleHooksPerLine.Component;
28 + }
29 +});
30 +Object.defineProperty(exports, "ComponentWithNestedHooks", {
31 + enumerable: true,
32 + get: function () {
33 + return _ComponentWithNestedHooks.Component;
34 + }
35 +});
36 +Object.defineProperty(exports, "ContainingStringSourceMappingURL", {
37 + enumerable: true,
38 + get: function () {
39 + return _ContainingStringSourceMappingURL.Component;
40 + }
41 +});
42 +Object.defineProperty(exports, "Example", {
43 + enumerable: true,
44 + get: function () {
45 + return _Example.Component;
46 + }
47 +});
48 +Object.defineProperty(exports, "InlineRequire", {
49 + enumerable: true,
50 + get: function () {
51 + return _InlineRequire.Component;
52 + }
53 +});
54 +Object.defineProperty(exports, "useTheme", {
55 + enumerable: true,
56 + get: function () {
57 + return _useTheme.default;
58 + }
59 +});
60 +exports.ToDoList = void 0;
61 +
62 +var _ComponentUsingHooksIndirectly = require("./ComponentUsingHooksIndirectly");
63 +
64 +var _ComponentWithCustomHook = require("./ComponentWithCustomHook");
65 +
66 +var _ComponentWithExternalCustomHooks = require("./ComponentWithExternalCustomHooks");
67 +
68 +var _ComponentWithMultipleHooksPerLine = require("./ComponentWithMultipleHooksPerLine");
69 +
70 +var _ComponentWithNestedHooks = require("./ComponentWithNestedHooks");
71 +
72 +var _ContainingStringSourceMappingURL = require("./ContainingStringSourceMappingURL");
73 +
74 +var _Example = require("./Example");
75 +
76 +var _InlineRequire = require("./InlineRequire");
77 +
78 +var ToDoList = _interopRequireWildcard(require("./ToDoList"));
79 +
80 +exports.ToDoList = ToDoList;
81 +
82 +var _useTheme = _interopRequireDefault(require("./useTheme"));
83 +
84 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
85 +
86 +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
87 +
88 +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; }
89 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFTQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7QUFDQTs7OztBQUVBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIEZhY2Vib29rLCBJbmMuIGFuZCBpdHMgYWZmaWxpYXRlcy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKiBAZmxvd1xuICovXG5cbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5fSBmcm9tICcuL0NvbXBvbmVudFVzaW5nSG9va3NJbmRpcmVjdGx5JztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhDdXN0b21Ib29rfSBmcm9tICcuL0NvbXBvbmVudFdpdGhDdXN0b21Ib29rJztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzfSBmcm9tICcuL0NvbXBvbmVudFdpdGhFeHRlcm5hbEN1c3RvbUhvb2tzJztcbmV4cG9ydCB7Q29tcG9uZW50IGFzIENvbXBvbmVudFdpdGhNdWx0aXBsZUhvb2tzUGVyTGluZX0gZnJvbSAnLi9Db21wb25lbnRXaXRoTXVsdGlwbGVIb29rc1BlckxpbmUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgQ29tcG9uZW50V2l0aE5lc3RlZEhvb2tzfSBmcm9tICcuL0NvbXBvbmVudFdpdGhOZXN0ZWRIb29rcyc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBDb250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTH0gZnJvbSAnLi9Db250YWluaW5nU3RyaW5nU291cmNlTWFwcGluZ1VSTCc7XG5leHBvcnQge0NvbXBvbmVudCBhcyBFeGFtcGxlfSBmcm9tICcuL0V4YW1wbGUnO1xuZXhwb3J0IHtDb21wb25lbnQgYXMgSW5saW5lUmVxdWlyZX0gZnJvbSAnLi9JbmxpbmVSZXF1aXJlJztcbmltcG9ydCAqIGFzIFRvRG9MaXN0IGZyb20gJy4vVG9Eb0xpc3QnO1xuZXhwb3J0IHtUb0RvTGlzdH07XG5leHBvcnQge2RlZmF1bHQgYXMgdXNlVGhlbWV9IGZyb20gJy4vdXNlVGhlbWUnO1xuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiJdLCJtYXBwaW5ncyI6IkNBQUQifV1dfX1dfQ==
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/__source__/__compiled__/inline/react-sources-extended/index-map/useTheme.js new
+27
@@ -0,0 +1,27 @@
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = useTheme;
7 +exports.ThemeContext = void 0;
8 +
9 +var _react = require("react");
10 +
11 +/**
12 + * Copyright (c) Facebook, Inc. and its affiliates.
13 + *
14 + * This source code is licensed under the MIT license found in the
15 + * LICENSE file in the root directory of this source tree.
16 + *
17 + * @flow
18 + */
19 +const ThemeContext = /*#__PURE__*/(0, _react.createContext)('bright');
20 +exports.ThemeContext = ThemeContext;
21 +
22 +function useTheme() {
23 + const theme = (0, _react.useContext)(ThemeContext);
24 + (0, _react.useDebugValue)(theme);
25 + return theme;
26 +}
27 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzZWN0aW9ucyI6W3sib2Zmc2V0Ijp7ImxpbmUiOjAsImNvbHVtbiI6MH0sIm1hcCI6eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVzZVRoZW1lLmpzIl0sIm5hbWVzIjpbIlRoZW1lQ29udGV4dCIsInVzZVRoZW1lIiwidGhlbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBU0E7O0FBVEE7Ozs7Ozs7O0FBV08sTUFBTUEsWUFBWSxnQkFBRywwQkFBYyxRQUFkLENBQXJCOzs7QUFFUSxTQUFTQyxRQUFULEdBQW9CO0FBQ2pDLFFBQU1DLEtBQUssR0FBRyx1QkFBV0YsWUFBWCxDQUFkO0FBQ0EsNEJBQWNFLEtBQWQ7QUFDQSxTQUFPQSxLQUFQO0FBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgRmFjZWJvb2ssIEluYy4gYW5kIGl0cyBhZmZpbGlhdGVzLlxuICpcbiAqIFRoaXMgc291cmNlIGNvZGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqIEBmbG93XG4gKi9cblxuaW1wb3J0IHtjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VEZWJ1Z1ZhbHVlfSBmcm9tICdyZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBUaGVtZUNvbnRleHQgPSBjcmVhdGVDb250ZXh0KCdicmlnaHQnKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gdXNlVGhlbWUoKSB7XG4gIGNvbnN0IHRoZW1lID0gdXNlQ29udGV4dChUaGVtZUNvbnRleHQpO1xuICB1c2VEZWJ1Z1ZhbHVlKHRoZW1lKTtcbiAgcmV0dXJuIHRoZW1lO1xufVxuIl0sInhfcmVhY3Rfc291cmNlcyI6W1t7Im5hbWVzIjpbIjxuby1ob29rPiIsInRoZW1lIl0sIm1hcHBpbmdzIjoiQ0FBRDtlZ0JDQSxBd0JEQSJ9XV19fV19
\ No newline at end of file
packages/react-devtools-extensions/src/__tests__/parseHookNames-test.js
+217 -46
@@ -193,6 +193,8 @@ describe('parseHookNames', () => {
193 await test('./__source__/Example'); // original source (uncompiled)
194 await test('./__source__/__compiled__/inline/Example'); // inline source map
195 await test('./__source__/__compiled__/external/Example'); // external source map
196 + await test('./__source__/__compiled__/inline/index-map/Example'); // inline index map source map
197 + await test('./__source__/__compiled__/external/index-map/Example'); // external index map source map
198 await test('./__source__/__compiled__/bundle/index', 'Example'); // bundle source map
199 await test('./__source__/__compiled__/no-columns/Example'); // simulated Webpack 'cheap-module-source-map'
200 });
@@ -225,6 +227,8 @@ describe('parseHookNames', () => {
227 await test('./__source__/ToDoList'); // original source (uncompiled)
228 await test('./__source__/__compiled__/inline/ToDoList'); // inline source map
229 await test('./__source__/__compiled__/external/ToDoList'); // external source map
230 + await test('./__source__/__compiled__/inline/index-map/ToDoList'); // inline index map source map
231 + await test('./__source__/__compiled__/external/index-map/ToDoList'); // external index map source map
232 await test('./__source__/__compiled__/bundle', 'ToDoList'); // bundle source map
233 await test('./__source__/__compiled__/no-columns/ToDoList'); // simulated Webpack 'cheap-module-source-map'
234 });
@@ -243,6 +247,12 @@ describe('parseHookNames', () => {
247 await test('./__source__/ComponentWithCustomHook'); // original source (uncompiled)
248 await test('./__source__/__compiled__/inline/ComponentWithCustomHook'); // inline source map
249 await test('./__source__/__compiled__/external/ComponentWithCustomHook'); // external source map
250 + await test(
251 + './__source__/__compiled__/inline/index-map/ComponentWithCustomHook',
252 + ); // inline index map source map
253 + await test(
254 + './__source__/__compiled__/external/index-map/ComponentWithCustomHook',
255 + ); // external index map source map
256 await test('./__source__/__compiled__/bundle', 'ComponentWithCustomHook'); // bundle source map
257 await test(
258 './__source__/__compiled__/no-columns/ComponentWithCustomHook',
@@ -266,6 +276,12 @@ describe('parseHookNames', () => {
276 await test(
277 './__source__/__compiled__/external/ComponentUsingHooksIndirectly',
278 ); // external source map
279 + await test(
280 + './__source__/__compiled__/inline/index-map/ComponentUsingHooksIndirectly',
281 + ); // inline index map source map
282 + await test(
283 + './__source__/__compiled__/external/index-map/ComponentUsingHooksIndirectly',
284 + ); // external index map source map
285 await test(
286 './__source__/__compiled__/bundle',
287 'ComponentUsingHooksIndirectly',
@@ -295,6 +311,12 @@ describe('parseHookNames', () => {
311
312 await test('./__source__/__compiled__/inline/ComponentWithNestedHooks'); // inline source map
313 await test('./__source__/__compiled__/external/ComponentWithNestedHooks'); // external source map
314 + await test(
315 + './__source__/__compiled__/inline/index-map/ComponentWithNestedHooks',
316 + ); // inline index map source map
317 + await test(
318 + './__source__/__compiled__/external/index-map/ComponentWithNestedHooks',
319 + ); // external index map source map
320 await test(
321 './__source__/__compiled__/bundle',
322 'ComponentWithNestedHooks',
@@ -323,6 +345,12 @@ describe('parseHookNames', () => {
345 await test(
346 './__source__/__compiled__/external/ComponentWithExternalCustomHooks',
347 ); // external source map
348 + await test(
349 + './__source__/__compiled__/inline/index-map/ComponentWithExternalCustomHooks',
350 + ); // inline index map source map
351 + await test(
352 + './__source__/__compiled__/external/index-map/ComponentWithExternalCustomHooks',
353 + ); // external index map source map
354 await test(
355 './__source__/__compiled__/bundle',
356 'ComponentWithExternalCustomHooks',
@@ -350,6 +378,12 @@ describe('parseHookNames', () => {
378 await test(
379 './__source__/__compiled__/external/ComponentWithMultipleHooksPerLine',
380 ); // external source map
381 + await test(
382 + './__source__/__compiled__/inline/index-map/ComponentWithMultipleHooksPerLine',
383 + ); // inline index map source map
384 + await test(
385 + './__source__/__compiled__/external/index-map/ComponentWithMultipleHooksPerLine',
386 + ); // external index map source map
387 await test(
388 './__source__/__compiled__/bundle',
389 'ComponentWithMultipleHooksPerLine',
@@ -389,6 +423,8 @@ describe('parseHookNames', () => {
423 await test('./__source__/InlineRequire'); // original source (uncompiled)
424 await test('./__source__/__compiled__/inline/InlineRequire'); // inline source map
425 await test('./__source__/__compiled__/external/InlineRequire'); // external source map
426 + await test('./__source__/__compiled__/inline/index-map/InlineRequire'); // inline index map source map
427 + await test('./__source__/__compiled__/external/index-map/InlineRequire'); // external index map source map
428 await test('./__source__/__compiled__/bundle', 'InlineRequire'); // bundle source map
429 await test('./__source__/__compiled__/no-columns/InlineRequire'); // simulated Webpack 'cheap-module-source-map'
430 });
@@ -412,6 +448,12 @@ describe('parseHookNames', () => {
448 await test(
449 './__source__/__compiled__/external/ContainingStringSourceMappingURL',
450 ); // external source map
451 + await test(
452 + './__source__/__compiled__/inline/index-map/ContainingStringSourceMappingURL',
453 + ); // inline index map source map
454 + await test(
455 + './__source__/__compiled__/external/index-map/ContainingStringSourceMappingURL',
456 + ); // external index map source map
457 await test(
458 './__source__/__compiled__/bundle',
459 'ContainingStringSourceMappingURL',
@@ -423,21 +465,11 @@ describe('parseHookNames', () => {
465 });
466
467 describe('extended source maps', () => {
426 - let parseMock;
427 -
468 beforeEach(() => {
429 - parseMock = jest.fn();
430 - jest.mock('@babel/parser', () => {
431 - const actual = jest.requireActual('@babel/parser');
432 - const parse = (...args) => {
433 - parseMock();
434 - return actual.parse(...args);
435 - };
436 - return {
437 - parse,
438 - ...actual,
439 - };
440 - });
469 + const babelParser = require('@babel/parser');
470 + const generateHookMapModule = require('../generateHookMap');
471 + jest.spyOn(babelParser, 'parse');
472 + jest.spyOn(generateHookMapModule, 'decodeHookMap');
473 });
474
475 it('should work for simple components', async () => {
@@ -447,22 +479,37 @@ describe('parseHookNames', () => {
479 expectHookNamesToEqual(hookNames, [
480 'count', // useState
481 ]);
450 - expect(parseMock).toHaveBeenCalledTimes(0);
482 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
483 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
484 }
485
453 - await test('./__source__/Example'); // original source (uncompiled)
486 await test(
487 './__source__/__compiled__/inline/fb-sources-extended/Example',
456 - ); // x_fb_sources extended inline source map
488 + ); // x_facebook_sources extended inline source map
489 await test(
490 './__source__/__compiled__/external/fb-sources-extended/Example',
459 - ); // x_fb_sources extended external source map
491 + ); // x_facebook_sources extended external source map
492 await test(
493 './__source__/__compiled__/inline/react-sources-extended/Example',
494 ); // x_react_sources extended inline source map
495 await test(
496 './__source__/__compiled__/external/react-sources-extended/Example',
497 ); // x_react_sources extended external source map
498 +
499 + // Using index map format for source maps
500 + await test(
501 + './__source__/__compiled__/inline/fb-sources-extended/index-map/Example',
502 + ); // x_facebook_sources extended inline index map source map
503 + await test(
504 + './__source__/__compiled__/external/fb-sources-extended/index-map/Example',
505 + ); // x_facebook_sources extended external index map source map
506 + await test(
507 + './__source__/__compiled__/inline/react-sources-extended/index-map/Example',
508 + ); // x_react_sources extended inline index map source map
509 + await test(
510 + './__source__/__compiled__/external/react-sources-extended/index-map/Example',
511 + ); // x_react_sources extended external index map source map
512 +
513 // TODO test no-columns and bundle cases with extended source maps
514 });
515
@@ -490,22 +537,37 @@ describe('parseHookNames', () => {
537 'handleToggle', // useCallback
538 ]);
539
493 - expect(parseMock).toHaveBeenCalledTimes(0);
540 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
541 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
542 }
543
496 - await test('./__source__/ToDoList'); // original source (uncompiled)
544 await test(
545 './__source__/__compiled__/inline/fb-sources-extended/ToDoList',
499 - ); // x_fb_sources extended inline source map
546 + ); // x_facebook_sources extended inline source map
547 await test(
548 './__source__/__compiled__/external/fb-sources-extended/ToDoList',
502 - ); // x_fb_sources extended external source map
549 + ); // x_facebook_sources extended external source map
550 await test(
551 './__source__/__compiled__/inline/react-sources-extended/ToDoList',
552 ); // x_react_sources extended inline source map
553 await test(
554 './__source__/__compiled__/external/react-sources-extended/ToDoList',
555 ); // x_react_sources extended external source map
556 +
557 + // Using index map format for source maps
558 + await test(
559 + './__source__/__compiled__/inline/fb-sources-extended/index-map/ToDoList',
560 + ); // x_facebook_sources extended inline index map source map
561 + await test(
562 + './__source__/__compiled__/external/fb-sources-extended/index-map/ToDoList',
563 + ); // x_facebook_sources extended external index map source map
564 + await test(
565 + './__source__/__compiled__/inline/react-sources-extended/index-map/ToDoList',
566 + ); // x_react_sources extended inline index map source map
567 + await test(
568 + './__source__/__compiled__/external/react-sources-extended/index-map/ToDoList',
569 + ); // x_react_sources extended external index map source map
570 +
571 // TODO test no-columns and bundle cases with extended source maps
572 });
573
@@ -518,22 +580,37 @@ describe('parseHookNames', () => {
580 'isDarkMode', // useIsDarkMode()
581 'isDarkMode', // useIsDarkMode -> useState()
582 ]);
521 - expect(parseMock).toHaveBeenCalledTimes(0);
583 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
584 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
585 }
586
524 - await test('./__source__/ComponentWithCustomHook'); // original source (uncompiled)
587 await test(
588 './__source__/__compiled__/inline/fb-sources-extended/ComponentWithCustomHook',
527 - ); // x_fb_sources extended inline source map
589 + ); // x_facebook_sources extended inline source map
590 await test(
591 './__source__/__compiled__/external/fb-sources-extended/ComponentWithCustomHook',
530 - ); // x_fb_sources extended external source map
592 + ); // x_facebook_sources extended external source map
593 await test(
594 './__source__/__compiled__/inline/react-sources-extended/ComponentWithCustomHook',
595 ); // x_react_sources extended inline source map
596 await test(
597 './__source__/__compiled__/external/react-sources-extended/ComponentWithCustomHook',
598 ); // x_react_sources extended external source map
599 +
600 + // Using index map format for source maps
601 + await test(
602 + './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithCustomHook',
603 + ); // x_facebook_sources extended inline index map source map
604 + await test(
605 + './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithCustomHook',
606 + ); // x_facebook_sources extended external index map source map
607 + await test(
608 + './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithCustomHook',
609 + ); // x_react_sources extended inline index map source map
610 + await test(
611 + './__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithCustomHook',
612 + ); // x_react_sources extended external index map source map
613 +
614 // TODO test no-columns and bundle cases with extended source maps
615 });
616
@@ -546,21 +623,37 @@ describe('parseHookNames', () => {
623 'darkMode', // useDarkMode()
624 'isDarkMode', // useState()
625 ]);
549 - expect(parseMock).toHaveBeenCalledTimes(0);
626 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
627 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
628 }
629
630 await test(
631 './__source__/__compiled__/inline/fb-sources-extended/ComponentUsingHooksIndirectly',
554 - ); // x_fb_sources extended inline source map
632 + ); // x_facebook_sources extended inline source map
633 await test(
634 './__source__/__compiled__/external/fb-sources-extended/ComponentUsingHooksIndirectly',
557 - ); // x_fb_sources extended external source map
635 + ); // x_facebook_sources extended external source map
636 await test(
637 './__source__/__compiled__/inline/react-sources-extended/ComponentUsingHooksIndirectly',
638 ); // x_react_sources extended inline source map
639 await test(
640 './__source__/__compiled__/external/react-sources-extended/ComponentUsingHooksIndirectly',
641 ); // x_react_sources extended external source map
642 +
643 + // Using index map format for source maps
644 + await test(
645 + './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentUsingHooksIndirectly',
646 + ); // x_facebook_sources extended inline index map source map
647 + await test(
648 + './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentUsingHooksIndirectly',
649 + ); // x_facebook_sources extended external index map source map
650 + await test(
651 + './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentUsingHooksIndirectly',
652 + ); // x_react_sources extended inline index map source map
653 + await test(
654 + './__source__/__compiled__/external/react-sources-extended/index-map/ComponentUsingHooksIndirectly',
655 + ); // x_react_sources extended external index map source map
656 +
657 // TODO test no-columns and bundle cases with extended source maps
658 });
659
@@ -580,21 +673,37 @@ describe('parseHookNames', () => {
673 expectHookNamesToEqual(innerHookNames, [
674 'state', // useState()
675 ]);
583 - expect(parseMock).toHaveBeenCalledTimes(0);
676 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
677 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
678 }
679
680 await test(
681 './__source__/__compiled__/inline/fb-sources-extended/ComponentWithNestedHooks',
588 - ); // x_fb_sources extended inline source map
682 + ); // x_facebook_sources extended inline source map
683 await test(
684 './__source__/__compiled__/external/fb-sources-extended/ComponentWithNestedHooks',
591 - ); // x_fb_sources extended external source map
685 + ); // x_facebook_sources extended external source map
686 await test(
687 './__source__/__compiled__/inline/react-sources-extended/ComponentWithNestedHooks',
688 ); // x_react_sources extended inline source map
689 await test(
690 './__source__/__compiled__/external/react-sources-extended/ComponentWithNestedHooks',
691 ); // x_react_sources extended external source map
692 +
693 + // Using index map format for source maps
694 + await test(
695 + './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithNestedHooks',
696 + ); // x_facebook_sources extended inline index map source map
697 + await test(
698 + './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithNestedHooks',
699 + ); // x_facebook_sources extended external index map source map
700 + await test(
701 + './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithNestedHooks',
702 + ); // x_react_sources extended inline index map source map
703 + await test(
704 + './__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithNestedHooks',
705 + ); // x_react_sources extended external index map source map
706 +
707 // TODO test no-columns and bundle cases with extended source maps
708 });
709
@@ -606,7 +715,8 @@ describe('parseHookNames', () => {
715 'theme', // useTheme()
716 'theme', // useContext()
717 ]);
609 - expect(parseMock).toHaveBeenCalledTimes(0);
718 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
719 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
720 }
721
722 // We can't test the uncompiled source here, because it either needs to get transformed,
@@ -614,16 +724,31 @@ describe('parseHookNames', () => {
724
725 await test(
726 './__source__/__compiled__/inline/fb-sources-extended/ComponentWithExternalCustomHooks',
617 - ); // x_fb_sources extended inline source map
727 + ); // x_facebook_sources extended inline source map
728 await test(
729 './__source__/__compiled__/external/fb-sources-extended/ComponentWithExternalCustomHooks',
620 - ); // x_fb_sources extended external source map
730 + ); // x_facebook_sources extended external source map
731 await test(
732 './__source__/__compiled__/inline/react-sources-extended/ComponentWithExternalCustomHooks',
733 ); // x_react_sources extended inline source map
734 await test(
735 './__source__/__compiled__/external/react-sources-extended/ComponentWithExternalCustomHooks',
736 ); // x_react_sources extended external source map
737 +
738 + // Using index map format for source maps
739 + await test(
740 + './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithExternalCustomHooks',
741 + ); // x_facebook_sources extended inline index map source map
742 + await test(
743 + './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithExternalCustomHooks',
744 + ); // x_facebook_sources extended external index map source map
745 + await test(
746 + './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithExternalCustomHooks',
747 + ); // x_react_sources extended inline index map source map
748 + await test(
749 + './__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithExternalCustomHooks',
750 + ); // x_react_sources extended external index map source map
751 +
752 // TODO test no-columns and bundle cases with extended source maps
753 });
754
@@ -637,21 +762,37 @@ describe('parseHookNames', () => {
762 'c', // useContext()
763 'd', // useContext()
764 ]);
640 - expect(parseMock).toHaveBeenCalledTimes(0);
765 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
766 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
767 }
768
769 await test(
770 './__source__/__compiled__/inline/fb-sources-extended/ComponentWithMultipleHooksPerLine',
645 - ); // x_fb_sources extended inline source map
771 + ); // x_facebook_sources extended inline source map
772 await test(
773 './__source__/__compiled__/external/fb-sources-extended/ComponentWithMultipleHooksPerLine',
648 - ); // x_fb_sources extended external source map
774 + ); // x_facebook_sources extended external source map
775 await test(
776 './__source__/__compiled__/inline/react-sources-extended/ComponentWithMultipleHooksPerLine',
777 ); // x_react_sources extended inline source map
778 await test(
779 './__source__/__compiled__/external/react-sources-extended/ComponentWithMultipleHooksPerLine',
780 ); // x_react_sources extended external source map
781 +
782 + // Using index map format for source maps
783 + await test(
784 + './__source__/__compiled__/inline/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
785 + ); // x_facebook_sources extended inline index map source map
786 + await test(
787 + './__source__/__compiled__/external/fb-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
788 + ); // x_facebook_sources extended external index map source map
789 + await test(
790 + './__source__/__compiled__/inline/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
791 + ); // x_react_sources extended inline index map source map
792 + await test(
793 + './__source__/__compiled__/external/react-sources-extended/index-map/ComponentWithMultipleHooksPerLine',
794 + ); // x_react_sources extended external index map source map
795 +
796 // TODO test no-columns and bundle cases with extended source maps
797 });
798
@@ -665,22 +806,37 @@ describe('parseHookNames', () => {
806 expectHookNamesToEqual(hookNames, [
807 'count', // useState()
808 ]);
668 - expect(parseMock).toHaveBeenCalledTimes(0);
809 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
810 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
811 }
812
671 - await test('./__source__/InlineRequire'); // original source (uncompiled)
813 await test(
814 './__source__/__compiled__/inline/fb-sources-extended/InlineRequire',
674 - ); // x_fb_sources extended inline source map
815 + ); // x_facebook_sources extended inline source map
816 await test(
817 './__source__/__compiled__/external/fb-sources-extended/InlineRequire',
677 - ); // x_fb_sources extended external source map
818 + ); // x_facebook_sources extended external source map
819 await test(
820 './__source__/__compiled__/inline/react-sources-extended/InlineRequire',
821 ); // x_react_sources extended inline source map
822 await test(
823 './__source__/__compiled__/external/react-sources-extended/InlineRequire',
824 ); // x_react_sources extended external source map
825 +
826 + // Using index map format for source maps
827 + await test(
828 + './__source__/__compiled__/inline/fb-sources-extended/index-map/InlineRequire',
829 + ); // x_facebook_sources extended inline index map source map
830 + await test(
831 + './__source__/__compiled__/external/fb-sources-extended/index-map/InlineRequire',
832 + ); // x_facebook_sources extended external index map source map
833 + await test(
834 + './__source__/__compiled__/inline/react-sources-extended/index-map/InlineRequire',
835 + ); // x_react_sources extended inline index map source map
836 + await test(
837 + './__source__/__compiled__/external/react-sources-extended/index-map/InlineRequire',
838 + ); // x_react_sources extended external index map source map
839 +
840 // TODO test no-columns and bundle cases with extended source maps
841 });
842
@@ -691,25 +847,40 @@ describe('parseHookNames', () => {
847 expectHookNamesToEqual(hookNames, [
848 'count', // useState()
849 ]);
694 - expect(parseMock).toHaveBeenCalledTimes(0);
850 + expect(require('@babel/parser').parse).toHaveBeenCalledTimes(0);
851 + expect(require('../generateHookMap').decodeHookMap).toHaveBeenCalled();
852 }
853
854 // We expect the inline sourceMappingURL to be invalid in this case; mute the warning.
855 console.warn = () => {};
856
700 - await test('./__source__/ContainingStringSourceMappingURL'); // original source (uncompiled)
857 await test(
858 './__source__/__compiled__/inline/fb-sources-extended/ContainingStringSourceMappingURL',
703 - ); // x_fb_sources extended inline source map
859 + ); // x_facebook_sources extended inline source map
860 await test(
861 './__source__/__compiled__/external/fb-sources-extended/ContainingStringSourceMappingURL',
706 - ); // x_fb_sources extended external source map
862 + ); // x_facebook_sources extended external source map
863 await test(
864 './__source__/__compiled__/inline/react-sources-extended/ContainingStringSourceMappingURL',
865 ); // x_react_sources extended inline source map
866 await test(
867 './__source__/__compiled__/external/react-sources-extended/ContainingStringSourceMappingURL',
868 ); // x_react_sources extended external source map
869 +
870 + // Using index map format for source maps
871 + await test(
872 + './__source__/__compiled__/inline/fb-sources-extended/index-map/ContainingStringSourceMappingURL',
873 + ); // x_facebook_sources extended inline index map source map
874 + await test(
875 + './__source__/__compiled__/external/fb-sources-extended/index-map/ContainingStringSourceMappingURL',
876 + ); // x_facebook_sources extended external index map source map
877 + await test(
878 + './__source__/__compiled__/inline/react-sources-extended/index-map/ContainingStringSourceMappingURL',
879 + ); // x_react_sources extended inline index map source map
880 + await test(
881 + './__source__/__compiled__/external/react-sources-extended/index-map/ContainingStringSourceMappingURL',
882 + ); // x_react_sources extended external index map source map
883 +
884 // TODO test no-columns and bundle cases with extended source maps
885 });
886 });
packages/react-devtools-extensions/src/__tests__/updateMockSourceMaps.js
+124 -2
@@ -24,11 +24,21 @@ const externalDir = resolve(buildRoot, 'external');
24 const inlineDir = resolve(buildRoot, 'inline');
25 const bundleDir = resolve(buildRoot, 'bundle');
26 const noColumnsDir = resolve(buildRoot, 'no-columns');
27 +const inlineIndexMapDir = resolve(inlineDir, 'index-map');
28 +const externalIndexMapDir = resolve(externalDir, 'index-map');
29 const inlineFbSourcesExtendedDir = resolve(inlineDir, 'fb-sources-extended');
30 const externalFbSourcesExtendedDir = resolve(
31 externalDir,
32 'fb-sources-extended',
33 );
34 +const inlineFbSourcesIndexMapExtendedDir = resolve(
35 + inlineFbSourcesExtendedDir,
36 + 'index-map',
37 +);
38 +const externalFbSourcesIndexMapExtendedDir = resolve(
39 + externalFbSourcesExtendedDir,
40 + 'index-map',
41 +);
42 const inlineReactSourcesExtendedDir = resolve(
43 inlineDir,
44 'react-sources-extended',
@@ -37,6 +47,14 @@ const externalReactSourcesExtendedDir = resolve(
47 externalDir,
48 'react-sources-extended',
49 );
50 +const inlineReactSourcesIndexMapExtendedDir = resolve(
51 + inlineReactSourcesExtendedDir,
52 + 'index-map',
53 +);
54 +const externalReactSourcesIndexMapExtendedDir = resolve(
55 + externalReactSourcesExtendedDir,
56 + 'index-map',
57 +);
58
59 // Remove previous builds
60 emptyDirSync(buildRoot);
@@ -44,10 +62,16 @@ mkdirSync(externalDir);
62 mkdirSync(inlineDir);
63 mkdirSync(bundleDir);
64 mkdirSync(noColumnsDir);
65 +mkdirSync(inlineIndexMapDir);
66 +mkdirSync(externalIndexMapDir);
67 mkdirSync(inlineFbSourcesExtendedDir);
68 mkdirSync(externalFbSourcesExtendedDir);
69 mkdirSync(inlineReactSourcesExtendedDir);
70 mkdirSync(externalReactSourcesExtendedDir);
71 +mkdirSync(inlineFbSourcesIndexMapExtendedDir);
72 +mkdirSync(externalFbSourcesIndexMapExtendedDir);
73 +mkdirSync(inlineReactSourcesIndexMapExtendedDir);
74 +mkdirSync(externalReactSourcesIndexMapExtendedDir);
75
76 function compile(fileName) {
77 const code = readFileSync(resolve(sourceDir, fileName), 'utf8');
@@ -124,8 +148,44 @@ function compile(fileName) {
148 'utf8',
149 );
150
127 - // Generate compiled output with an extended sourcemap that
128 - // includes a map of hook names.
151 + // Artificially construct a source map that uses the index map format
152 + // (https://sourcemaps.info/spec.html#h.535es3xeprgt)
153 + const indexMap = {
154 + version: sourceMap.version,
155 + file: sourceMap.file,
156 + sections: [
157 + {
158 + offset: {
159 + line: 0,
160 + column: 0,
161 + },
162 + map: {...sourceMap},
163 + },
164 + ],
165 + };
166 +
167 + // Generate compiled output using external source maps using index map format
168 + writeFileSync(
169 + resolve(externalIndexMapDir, fileName),
170 + transformed.code + `\n//# sourceMappingURL=${fileName}.map`,
171 + 'utf8',
172 + );
173 + writeFileSync(
174 + resolve(externalIndexMapDir, `${fileName}.map`),
175 + JSON.stringify(indexMap),
176 + 'utf8',
177 + );
178 +
179 + // Generate compiled output with inline base64 source maps using index map format
180 + writeFileSync(
181 + resolve(inlineIndexMapDir, fileName),
182 + transformed.code +
183 + '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
184 + btoa(JSON.stringify(indexMap)),
185 + 'utf8',
186 + );
187 +
188 + // Generate compiled output with an extended sourcemap that includes a map of hook names.
189 const parsed = parse(code, {
190 sourceType: 'module',
191 plugins: ['jsx', 'flow'],
@@ -139,12 +199,38 @@ function compile(fileName) {
199 // the second item.
200 x_facebook_sources: [[null, [encodedHookMap]]],
201 };
202 + const fbSourcesExtendedIndexMap = {
203 + version: fbSourcesExtendedSourceMap.version,
204 + file: fbSourcesExtendedSourceMap.file,
205 + sections: [
206 + {
207 + offset: {
208 + line: 0,
209 + column: 0,
210 + },
211 + map: {...fbSourcesExtendedSourceMap},
212 + },
213 + ],
214 + };
215 const reactSourcesExtendedSourceMap = {
216 ...sourceMap,
217 // When using the x_react_sources extension field, the first item
218 // for a given source is reserved for the Hook Map.
219 x_react_sources: [[encodedHookMap]],
220 };
221 + const reactSourcesExtendedIndexMap = {
222 + version: reactSourcesExtendedSourceMap.version,
223 + file: reactSourcesExtendedSourceMap.file,
224 + sections: [
225 + {
226 + offset: {
227 + line: 0,
228 + column: 0,
229 + },
230 + map: {...reactSourcesExtendedSourceMap},
231 + },
232 + ],
233 + };
234
235 // Using the x_facebook_sources field
236 writeFileSync(
@@ -164,6 +250,24 @@ function compile(fileName) {
250 JSON.stringify(fbSourcesExtendedSourceMap),
251 'utf8',
252 );
253 + // Using the x_facebook_sources field on an index map format
254 + writeFileSync(
255 + resolve(inlineFbSourcesIndexMapExtendedDir, fileName),
256 + transformed.code +
257 + '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
258 + btoa(JSON.stringify(fbSourcesExtendedIndexMap)),
259 + 'utf8',
260 + );
261 + writeFileSync(
262 + resolve(externalFbSourcesIndexMapExtendedDir, fileName),
263 + transformed.code + `\n//# sourceMappingURL=${fileName}.map`,
264 + 'utf8',
265 + );
266 + writeFileSync(
267 + resolve(externalFbSourcesIndexMapExtendedDir, `${fileName}.map`),
268 + JSON.stringify(fbSourcesExtendedIndexMap),
269 + 'utf8',
270 + );
271
272 // Using the x_react_sources field
273 writeFileSync(
@@ -183,6 +287,24 @@ function compile(fileName) {
287 JSON.stringify(reactSourcesExtendedSourceMap),
288 'utf8',
289 );
290 + // Using the x_react_sources field on an index map format
291 + writeFileSync(
292 + resolve(inlineReactSourcesIndexMapExtendedDir, fileName),
293 + transformed.code +
294 + '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' +
295 + btoa(JSON.stringify(reactSourcesExtendedIndexMap)),
296 + 'utf8',
297 + );
298 + writeFileSync(
299 + resolve(externalReactSourcesIndexMapExtendedDir, fileName),
300 + transformed.code + `\n//# sourceMappingURL=${fileName}.map`,
301 + 'utf8',
302 + );
303 + writeFileSync(
304 + resolve(externalReactSourcesIndexMapExtendedDir, `${fileName}.map`),
305 + JSON.stringify(reactSourcesExtendedIndexMap),
306 + 'utf8',
307 + );
308 }
309
310 async function bundle() {
packages/react-devtools-extensions/src/parseHookNames/parseHookNames.js
+75 -107
@@ -14,11 +14,9 @@ import {getHookName} from '../astUtils';
14 import {areSourceMapsAppliedToErrors} from '../ErrorTester';
15 import {__DEBUG__} from 'react-devtools-shared/src/constants';
16 import {getHookSourceLocationKey} from 'react-devtools-shared/src/hookNamesCache';
17 -import {decodeHookMap} from '../generateHookMap';
18 -import {getHookNameForLocation} from '../getHookNameForLocation';
17 +import {sourceMapIncludesSource} from '../SourceMapUtils';
18 +import {SourceMapMetadataConsumer} from '../SourceMapMetadataConsumer';
19
20 -import type {MixedSourceMap} from '../SourceMapTypes';
21 -import type {HookMap} from '../generateHookMap';
20 import type {
21 HooksNode,
22 HookSource,
@@ -30,18 +28,16 @@ import type {SourceConsumer} from '../astUtils';
28
29 const SOURCE_MAP_REGEX = / ?sourceMappingURL=([^\s'"]+)/gm;
30 const MAX_SOURCE_LENGTH = 100_000_000;
33 -const REACT_SOURCES_EXTENSION_KEY = 'x_react_sources';
34 -const FB_SOURCES_EXTENSION_KEY = 'x_facebook_sources';
31
32 type AST = mixed;
33
34 type HookSourceData = {|
39 - // Hook map extracted from extended source map
40 - hookMap: HookMap | null,
41 -
35 // Generated by react-debug-tools.
36 hookSource: HookSource,
37
38 + // API for consuming metadfata present in extended source map.
39 + metadataConsumer: SourceMapMetadataConsumer | null,
40 +
41 // AST for original source code; typically comes from a consumed source map.
42 originalSourceAST: AST | null,
43
@@ -68,6 +64,7 @@ type HookSourceData = {|
64
65 type CachedRuntimeCodeMetadata = {|
66 sourceConsumer: SourceConsumer | null,
67 + metadataConsumer: SourceMapMetadataConsumer | null,
68 |};
69
70 const runtimeURLToMetadataCache: LRUCache<
@@ -137,8 +134,8 @@ export async function parseHookNames(
134 const runtimeSourceURL = ((hookSource.fileName: any): string);
135
136 const hookSourceData: HookSourceData = {
140 - hookMap: null,
137 hookSource,
138 + metadataConsumer: null,
139 originalSourceAST: null,
140 originalSourceCode: null,
141 originalSourceURL: null,
@@ -162,6 +159,7 @@ export async function parseHookNames(
159 console.groupEnd();
160 }
161 hookSourceData.sourceConsumer = runtimeMetadata.sourceConsumer;
162 + hookSourceData.metadataConsumer = runtimeMetadata.metadataConsumer;
163 }
164
165 locationKeyToHookSourceData.set(locationKey, hookSourceData);
@@ -213,8 +211,11 @@ function extractAndLoadSourceMaps(
211
212 const setPromises = [];
213 locationKeyToHookSourceData.forEach(hookSourceData => {
216 - if (hookSourceData.sourceConsumer != null) {
217 - // Use cached source map consumer.
214 + if (
215 + hookSourceData.sourceConsumer != null &&
216 + hookSourceData.metadataConsumer != null
217 + ) {
218 + // Use cached source map and metadata consumers.
219 return;
220 }
221
@@ -230,8 +231,8 @@ function extractAndLoadSourceMaps(
231 for (let i = 0; i < sourceMappingURLs.length; i++) {
232 const {runtimeSourceURL} = hookSourceData;
233 const sourceMappingURL = sourceMappingURLs[i];
233 - const index = sourceMappingURL.indexOf('base64,');
234 - if (index >= 0) {
234 + const hasInlineSourceMap = sourceMappingURL.indexOf('base64,') >= 0;
235 + if (hasInlineSourceMap) {
236 // TODO (named hooks) deduplicate parsing in this branch (similar to fetching in the other branch)
237 // since there can be multiple location keys per source map.
238
@@ -254,16 +255,10 @@ function extractAndLoadSourceMaps(
255
256 // Hook source might be a URL like "https://4syus.csb.app/src/App.js"
257 // Parsed source map might be a partial path like "src/App.js"
257 - const sourceIndex = parsed.sources.findIndex(
258 - source =>
259 - source === 'Inline Babel script' ||
260 - runtimeSourceURL.endsWith(source),
261 - );
262 - if (sourceIndex !== -1) {
263 - const hookMap = extractHookMapFromSourceMap(parsed, sourceIndex);
264 - if (hookMap != null) {
265 - hookSourceData.hookMap = hookMap;
266 - }
258 + if (sourceMapIncludesSource(parsed, runtimeSourceURL)) {
259 + hookSourceData.metadataConsumer = new SourceMapMetadataConsumer(
260 + parsed,
261 + );
262 setPromises.push(
263 new SourceMapConsumer(parsed).then(sourceConsumer => {
264 hookSourceData.sourceConsumer = sourceConsumer;
@@ -304,19 +299,10 @@ function extractAndLoadSourceMaps(
299 fetchFile(url).then(
300 sourceMapContents => {
301 const parsed = JSON.parse(sourceMapContents);
307 - const sourceIndex = parsed.sources.findIndex(source =>
308 - runtimeSourceURL.endsWith(source),
309 - );
310 - if (sourceIndex !== -1) {
311 - const hookMap = extractHookMapFromSourceMap(
312 - parsed,
313 - sourceIndex,
314 - );
315 - if (hookMap != null) {
316 - hookSourceData.hookMap = hookMap;
317 - }
318 - }
319 - return new SourceMapConsumer(parsed);
302 + return new SourceMapConsumer(parsed).then(sourceConsumer => ({
303 + sourceConsumer,
304 + metadataConsumer: new SourceMapMetadataConsumer(parsed),
305 + }));
306 },
307 // In this case, we fall back to the assumption that the source has no source map.
308 // This might indicate an (unlikely) edge case that had no source map,
@@ -334,8 +320,10 @@ function extractAndLoadSourceMaps(
320
321 fetchPromises.set(url, fetchPromise);
322 setPromises.push(
337 - fetchPromise.then(sourceConsumer => {
338 - hookSourceData.sourceConsumer = sourceConsumer;
323 + fetchPromise.then(result => {
324 + hookSourceData.metadataConsumer =
325 + result?.metadataConsumer ?? null;
326 + hookSourceData.sourceConsumer = result?.sourceConsumer ?? null;
327 }),
328 );
329 break;
@@ -404,7 +392,7 @@ function findHookNames(
392 return null; // Should not be reachable.
393 }
394
407 - const sourceConsumer = hookSourceData.sourceConsumer;
395 + const {originalSourceURL, sourceConsumer} = hookSourceData;
396
397 let originalSourceColumnNumber;
398 let originalSourceLineNumber;
@@ -435,22 +423,24 @@ function findHookNames(
423 }
424
425 if (
438 - originalSourceLineNumber === null ||
439 - originalSourceColumnNumber === null
426 + originalSourceLineNumber == null ||
427 + originalSourceColumnNumber == null ||
428 + originalSourceURL == null
429 ) {
430 return null;
431 }
432
433 let name;
445 - if (hookSourceData.hookMap != null) {
446 - name = getHookNameForLocation(
447 - {
448 - line: originalSourceLineNumber,
449 - column: originalSourceColumnNumber,
450 - },
451 - hookSourceData.hookMap,
452 - );
453 - } else {
434 + const {metadataConsumer} = hookSourceData;
435 + if (metadataConsumer != null) {
436 + name = metadataConsumer.hookNameFor({
437 + line: originalSourceLineNumber,
438 + column: originalSourceColumnNumber,
439 + source: originalSourceURL,
440 + });
441 + }
442 +
443 + if (name == null) {
444 name = getHookName(
445 hook,
446 hookSourceData.originalSourceAST,
@@ -513,16 +503,12 @@ async function parseSourceAST(
503 // Use cached metadata.
504 return;
505 }
516 - if (hookSourceData.hookMap != null) {
517 - // If there's a hook map present from an extended sourcemap then
518 - // we don't need to parse the source files and instead can use the
519 - // hook map to extract hook names.
520 - return;
521 - }
506
523 - const {sourceConsumer} = hookSourceData;
507 + const {metadataConsumer, sourceConsumer} = hookSourceData;
508 const runtimeSourceCode = ((hookSourceData.runtimeSourceCode: any): string);
525 - let originalSourceURL, originalSourceCode;
509 + let hasHookMap = false;
510 + let originalSourceURL;
511 + let originalSourceCode;
512 if (sourceConsumer !== null) {
513 // Parse and extract the AST from the source map.
514 const {lineNumber, columnNumber} = hookSourceData.hookSource;
@@ -563,6 +549,13 @@ async function parseSourceAST(
549 console.log(originalSourceCode);
550 console.groupEnd();
551 }
552 +
553 + if (
554 + metadataConsumer != null &&
555 + metadataConsumer.hasHookMap(originalSourceURL)
556 + ) {
557 + hasHookMap = true;
558 + }
559 } else {
560 // There's no source map to parse here so we can just parse the original source itself.
561 originalSourceCode = runtimeSourceCode;
@@ -574,6 +567,13 @@ async function parseSourceAST(
567 hookSourceData.originalSourceCode = originalSourceCode;
568 hookSourceData.originalSourceURL = originalSourceURL;
569
570 + if (hasHookMap) {
571 + // If there's a hook map present from an extended sourcemap then
572 + // we don't need to parse the source files and instead can use the
573 + // hook map to extract hook names.
574 + return;
575 + }
576 +
577 // The cache also serves to deduplicate parsing by URL in our loop over
578 // location keys. This may need to change if we switch to async parsing.
579 const sourceMetadata = originalURLToMetadataCache.get(originalSourceURL);
@@ -645,58 +645,26 @@ function isUnnamedBuiltInHook(hook: HooksNode) {
645 function updateLruCache(
646 locationKeyToHookSourceData: Map<string, HookSourceData>,
647 ): Promise<*> {
648 - locationKeyToHookSourceData.forEach(({sourceConsumer, runtimeSourceURL}) => {
649 - // Only set once to avoid triggering eviction/cleanup code.
650 - if (!runtimeURLToMetadataCache.has(runtimeSourceURL)) {
651 - if (__DEBUG__) {
652 - console.log(
653 - `updateLruCache() Caching runtime metadata for "${runtimeSourceURL}"`,
654 - );
655 - }
648 + locationKeyToHookSourceData.forEach(
649 + ({metadataConsumer, sourceConsumer, runtimeSourceURL}) => {
650 + // Only set once to avoid triggering eviction/cleanup code.
651 + if (!runtimeURLToMetadataCache.has(runtimeSourceURL)) {
652 + if (__DEBUG__) {
653 + console.log(
654 + `updateLruCache() Caching runtime metadata for "${runtimeSourceURL}"`,
655 + );
656 + }
657
657 - runtimeURLToMetadataCache.set(runtimeSourceURL, {
658 - sourceConsumer,
659 - });
660 - }
661 - });
658 + runtimeURLToMetadataCache.set(runtimeSourceURL, {
659 + metadataConsumer,
660 + sourceConsumer,
661 + });
662 + }
663 + },
664 + );
665 return Promise.resolve();
666 }
667
665 -function extractHookMapFromSourceMap(
666 - sourcemap: MixedSourceMap,
667 - sourceIndex: number,
668 -): HookMap | null {
669 - let reactMetadataForSource;
670 - if (
671 - sourcemap.hasOwnProperty(REACT_SOURCES_EXTENSION_KEY) &&
672 - sourcemap[REACT_SOURCES_EXTENSION_KEY] != null
673 - ) {
674 - // When using the x_react_sources extension field, the first item
675 - // for a given source is reserved for the Hook Map, which is why
676 - // we look up the index at position 0.
677 - reactMetadataForSource =
678 - sourcemap[REACT_SOURCES_EXTENSION_KEY][sourceIndex];
679 - } else if (
680 - sourcemap.hasOwnProperty(FB_SOURCES_EXTENSION_KEY) &&
681 - sourcemap[FB_SOURCES_EXTENSION_KEY] != null
682 - ) {
683 - // When using the x_facebook_sources extension field, the first item
684 - // for a given source is reserved for the Function Map, and the
685 - // React sources metadata (which includes the Hook Map) is added as
686 - // the second item, which is why we look up the index at position 1.
687 - const fbMetadataForSource =
688 - sourcemap[FB_SOURCES_EXTENSION_KEY][sourceIndex];
689 - reactMetadataForSource =
690 - fbMetadataForSource != null ? fbMetadataForSource[1] : null;
691 - }
692 - const hookMap =
693 - reactMetadataForSource != null ? reactMetadataForSource[0] : null;
694 - if (hookMap != null) {
695 - return decodeHookMap(hookMap);
696 - }
697 - return null;
698 -}
699 -
668 export function purgeCachedMetadata(): void {
669 originalURLToMetadataCache.reset();
670 runtimeURLToMetadataCache.reset();