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
This commit is contained in:
Daniel Büchele
2019-01-10 07:14:18 -08:00
committed by Facebook Github Bot
parent 972f8b91d6
commit d868cd6405

View File

@@ -120,7 +120,7 @@ class PluginDebugger extends Component<Props> {
pluginPath: ?string,
) {
return {
key: name,
key: name.toLowerCase(),
columns: {
lamp: {value: <Lamp on={loaded} />},
name: {value: <Ellipsis>{name}</Ellipsis>},
@@ -142,14 +142,13 @@ class PluginDebugger extends Component<Props> {
value: this.getSupportedClients(name),
},
source: {
value:
pluginPath && pluginPath.startsWith(remote.app.getAppPath()) ? (
<i>bundled</i>
) : (
<Ellipsis code title={pluginPath}>
{pluginPath}
</Ellipsis>
),
value: pluginPath ? (
<Ellipsis code title={pluginPath}>
{pluginPath}
</Ellipsis>
) : (
<i>bundled</i>
),
},
},
};
@@ -168,6 +167,12 @@ class PluginDebugger extends Component<Props> {
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<Props> {
'GK disabled',
plugin.gatekeeper,
false,
plugin.entry,
externalPluginPath(plugin),
),
),
);
@@ -191,7 +196,7 @@ class PluginDebugger extends Component<Props> {
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<Props> {
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),
),
),
);