Skip to content

Commit 4b6c259

Browse files
committed
chore[react-devtools]: add global for native and use it to fork backend implementation
1 parent 33e54fa commit 4b6c259

File tree

9 files changed

+9
-2
lines changed

9 files changed

+9
-2
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ module.exports = {
496496
__IS_CHROME__: 'readonly',
497497
__IS_FIREFOX__: 'readonly',
498498
__IS_EDGE__: 'readonly',
499+
__IS_NATIVE__: 'readonly',
499500
__IS_INTERNAL_VERSION__: 'readonly',
500501
},
501502
},

packages/react-devtools-core/webpack.backend.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ module.exports = {
7171
__IS_FIREFOX__: false,
7272
__IS_CHROME__: false,
7373
__IS_EDGE__: false,
74+
__IS_NATIVE__: true,
7475
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-core"`,
7576
'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,
7677
'process.env.GITHUB_URL': `"${GITHUB_URL}"`,

packages/react-devtools-extensions/webpack.backend.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ module.exports = {
7777
__IS_CHROME__: IS_CHROME,
7878
__IS_FIREFOX__: IS_FIREFOX,
7979
__IS_EDGE__: IS_EDGE,
80+
__IS_NATIVE__: false,
8081
}),
8182
new Webpack.SourceMapDevToolPlugin({
8283
filename: '[file].map',

packages/react-devtools-extensions/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ module.exports = {
112112
__IS_CHROME__: IS_CHROME,
113113
__IS_FIREFOX__: IS_FIREFOX,
114114
__IS_EDGE__: IS_EDGE,
115+
__IS_NATIVE__: false,
115116
__IS_INTERNAL_VERSION__: IS_INTERNAL_VERSION,
116117
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-extensions"`,
117118
'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,

packages/react-devtools-inline/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ module.exports = {
7777
__IS_CHROME__: false,
7878
__IS_FIREFOX__: false,
7979
__IS_EDGE__: false,
80+
__IS_NATIVE__: false,
8081
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-inline"`,
8182
'process.env.DEVTOOLS_VERSION': `"${DEVTOOLS_VERSION}"`,
8283
'process.env.EDITOR_URL': EDITOR_URL != null ? `"${EDITOR_URL}"` : null,

packages/react-devtools-shared/src/backend/console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export function patch({
294294
// formatting. Otherwise it is left alone. So we prefix it. Otherwise we just override it
295295
// to our own stack.
296296
fakeError.stack =
297-
__IS_CHROME__ || __IS_EDGE__
297+
__IS_CHROME__ || __IS_EDGE__ || __IS_NATIVE__
298298
? (enableOwnerStacks
299299
? 'Error Stack:'
300300
: 'Error Component Stack:') + componentStack

packages/react-devtools-shared/src/backend/shared/DevToolsComponentStackFrame.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function describeBuiltInComponentFrame(name: string): string {
3030
}
3131
}
3232
let suffix = '';
33-
if (__IS_CHROME__ || __IS_EDGE__) {
33+
if (__IS_CHROME__ || __IS_EDGE__ || __IS_NATIVE__) {
3434
suffix = ' (<anonymous>)';
3535
} else if (__IS_FIREFOX__) {
3636
suffix = '@unknown:0:0';

scripts/flow/react-devtools.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ declare const __TEST__: boolean;
1515
declare const __IS_FIREFOX__: boolean;
1616
declare const __IS_CHROME__: boolean;
1717
declare const __IS_EDGE__: boolean;
18+
declare const __IS_NATIVE__: boolean;

scripts/jest/devtools/setupEnv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ global.__TEST__ = true;
1414
global.__IS_FIREFOX__ = false;
1515
global.__IS_CHROME__ = false;
1616
global.__IS_EDGE__ = false;
17+
global.__IS_NATIVE__ = false;
1718

1819
const ReactVersionTestingAgainst = process.env.REACT_VERSION || ReactVersion;
1920

0 commit comments

Comments
 (0)