mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
wip
This commit is contained in:
+1
@@ -174,6 +174,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
|
||||
},
|
||||
);
|
||||
|
||||
console.log({devToolsSettingsManager, asdf: 'yaya2'});
|
||||
if (devToolsSettingsManager != null && bridge != null) {
|
||||
bridge.addListener('updateConsolePatchSettings', consolePatchSettings =>
|
||||
cacheConsolePatchSettings(
|
||||
|
||||
+31
-1
@@ -18,13 +18,17 @@ import {castBool, castBrowserTheme} from 'react-devtools-shared/src/utils';
|
||||
// provided by React Native may not include all of this type's fields.
|
||||
export type DevToolsSettingsManager = {
|
||||
getConsolePatchSettings: ?() => string,
|
||||
setConsolePatchSettings: ?(key: string) => void,
|
||||
setConsolePatchSettings: ?(settings: string) => void,
|
||||
|
||||
getProfilingSettings: ?() => string,
|
||||
setProfilingSettings: ?(settings: string) => void,
|
||||
};
|
||||
|
||||
export function initializeUsingCachedSettings(
|
||||
devToolsSettingsManager: DevToolsSettingsManager,
|
||||
) {
|
||||
initializeConsolePatchSettings(devToolsSettingsManager);
|
||||
initializeProfilingSettings(devToolsSettingsManager);
|
||||
}
|
||||
|
||||
function initializeConsolePatchSettings(
|
||||
@@ -75,3 +79,29 @@ export function cacheConsolePatchSettings(
|
||||
}
|
||||
devToolsSettingsManager.setConsolePatchSettings(JSON.stringify(value));
|
||||
}
|
||||
|
||||
function initializeProfilingSettings(
|
||||
devToolsSettingsManager: DevToolsSettingsManager,
|
||||
): void {
|
||||
if (devToolsSettingsManager.getProfilingSettings == null) {
|
||||
return;
|
||||
}
|
||||
const profilingDataString = devToolsSettingsManager.getProfilingSettings();
|
||||
const profilingData = parseProfilingData(profilingDataString);
|
||||
if (profilingData.isProfiling) {
|
||||
console.log('congrats you profiling');
|
||||
} else {
|
||||
console.log('no profile');
|
||||
}
|
||||
}
|
||||
|
||||
type ProfilingData = {
|
||||
isProfiling: boolean,
|
||||
};
|
||||
|
||||
function parseProfilingData(profilingDataString: string): ProfilingData {
|
||||
const parsedValue = JSON.parse(profilingDataString);
|
||||
return {
|
||||
isProfiling: castBool(parsedValue.isProfiling) ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -81,6 +81,22 @@ module.exports = {
|
||||
'process.env.LIGHT_MODE_DIMMED_ERROR_COLOR': `"${LIGHT_MODE_DIMMED_ERROR_COLOR}"`,
|
||||
'process.env.LIGHT_MODE_DIMMED_LOG_COLOR': `"${LIGHT_MODE_DIMMED_LOG_COLOR}"`,
|
||||
}),
|
||||
{
|
||||
apply: compiler => {
|
||||
compiler.hooks.afterEmit.tap('AfterEmitPlugin', compilation => {
|
||||
require('child_process').exec(
|
||||
`
|
||||
cp ~/react/packages/react-devtools-core/dist/* ~/rn-test/FooProj/node_modules/react-devtools-core/dist/
|
||||
`,
|
||||
(err, stdout, stderr) => {
|
||||
if (stdout) process.stdout.write(stdout);
|
||||
if (stderr) process.stderr.write(stderr);
|
||||
console.log('DONe');
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
optimization: {
|
||||
minimize: false,
|
||||
|
||||
Reference in New Issue
Block a user