-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Types): Add types for plugins as plugins (#5)
Adds typed plugins. A typed plugin is plugin that references another plugin containing information about the type.
- Loading branch information
Showing
16 changed files
with
336 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## FAQ | ||
##### Why not just node modules that you include with a `require`? | ||
TBD | ||
##### Can external modules provide plugins? | ||
TBD | ||
##### What's the impact on performance of the plugin auto discovery? | ||
TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// @flow | ||
|
||
import type { PluginTypeLoaderInterface } from '../types/common'; | ||
|
||
const PluginLoaderBase = require('./PluginLoaderBase'); | ||
|
||
/** | ||
* @classdesc | ||
* Loader for plugins representing types. | ||
* @class | ||
* PluginTypeLoaderBase | ||
*/ | ||
class PluginTypeLoaderBase extends PluginLoaderBase implements PluginTypeLoaderInterface { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
export(options: Object): Object { | ||
return { | ||
props: this.definePluginProperties(), | ||
plugins: this.findPlugins(), | ||
}; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
definePluginProperties() { | ||
throw new Error('You need to override this method in the actual plugin implementation.'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
findPlugins() { | ||
return this.manager.all().filter(({ type }) => type === this.pluginId); | ||
} | ||
} | ||
|
||
module.exports = PluginTypeLoaderBase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.