From d868cd640594ec84380b7cc88c228fcf48e9bcf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Thu, 10 Jan 2019 07:14:18 -0800 Subject: [PATCH] PluginDebugger correct pluginPath Summary: The path where a plugin was loaded from was not displayed correctly before, but pointed to Flipper's cache directory. Plugins that are bundled with Flippers application package are now marked as bundled. Dynamically loaded plugins show the path where they are loaded from. Reviewed By: passy Differential Revision: D13622148 fbshipit-source-id: 7951ecd37e45d2d4b3a55bd7dc126697367c7e69 --- src/chrome/PluginDebugger.js | 47 +++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/src/chrome/PluginDebugger.js b/src/chrome/PluginDebugger.js index 9cb9148be..6a57d1672 100644 --- a/src/chrome/PluginDebugger.js +++ b/src/chrome/PluginDebugger.js @@ -120,7 +120,7 @@ class PluginDebugger extends Component { pluginPath: ?string, ) { return { - key: name, + key: name.toLowerCase(), columns: { lamp: {value: }, name: {value: {name}}, @@ -142,14 +142,13 @@ class PluginDebugger extends Component { value: this.getSupportedClients(name), }, source: { - value: - pluginPath && pluginPath.startsWith(remote.app.getAppPath()) ? ( - bundled - ) : ( - - {pluginPath} - - ), + value: pluginPath ? ( + + {pluginPath} + + ) : ( + bundled + ), }, }, }; @@ -168,6 +167,12 @@ class PluginDebugger extends Component { getRows() { let rows = []; + + // bundled plugins are loaded from the defaultPlugins directory within + // Flipper's package. + const externalPluginPath = (p: PluginDefinition) => + p.out.startsWith('./defaultPlugins/') ? null : p.entry; + this.props.gatekeepedPlugins.forEach(plugin => rows.push( this.buildRow( @@ -176,7 +181,7 @@ class PluginDebugger extends Component { 'GK disabled', plugin.gatekeeper, false, - plugin.entry, + externalPluginPath(plugin), ), ), ); @@ -191,7 +196,7 @@ class PluginDebugger extends Component { plugin.gatekeeper, true, // $FlowFixMe: Flow doesn't know this is inherited from FlipperBasePlugin - plugin.entry, + externalPluginPath(plugin), ), ), ); @@ -206,20 +211,34 @@ class PluginDebugger extends Component { plugin.gatekeeper, true, // $FlowFixMe: Flow doesn't know this is inherited from FlipperBasePlugin - plugin.entry, + externalPluginPath(plugin), ), ), ); this.props.disabledPlugins.forEach(plugin => rows.push( - this.buildRow(plugin.name, false, 'disabled', null, null, plugin.entry), + this.buildRow( + plugin.name, + false, + 'disabled', + null, + null, + externalPluginPath(plugin), + ), ), ); this.props.failedPlugins.forEach(([plugin, status]) => rows.push( - this.buildRow(plugin.name, false, status, null, null, plugin.entry), + this.buildRow( + plugin.name, + false, + status, + null, + null, + externalPluginPath(plugin), + ), ), );