Mosaic Plugins are lifecycle-based hooks that are called on every source at different stages. You will never need to invoke a lifecycle method directly as their execution is managed by a plugin runner.

Plugins enable Mosaic to have a lightweight and flexible, modular architecture by encapsulating features and functionality as plugins.

yarn add @jpmorganchase/mosaic-plugins

Plugins are added to the plugins collection of the mosaic config file. Like sources, plugins have an options property that can be used to provide plugin specific configuration.

PropertyDescriptionRequired
modulePathThe path to the installed plugin moduleYes
disabledExclude this plugin completely. Defaults to falseNo
runtimeOnlyExclude this plugin when generating a snapshot. Defaults to falseNo
previewDisabledExclude this plugin for "preview" sourcesNo
allowMultipleAllow multiple instances of this plugin to run.No
priorityThe importance of this plugin. Plugins with the highest priority run firstNo
optionsCollection of other configuration valuesNo
Tip

There is no need to import the plugin module directly. As long as the plugin is installed, Mosaic will be able to import it using the built-in plugin loader.

The following plugins are always included by Mosaic, regardless of whether they are present in the plugins collection of the Mosaic config file:

  1. $TagPlugin
  2. $AliasPlugin
  3. $CodeModPlugin
  4. $RefPlugin

Should a plugin fail, the failure will not cause a source to close or for any other plugin to not run.

Instead plugin errors are tracked by Mosaic and can be viewed in the pluginErrors property available on each source listed by the list sources admin API.

Plugin errors will be split by lifecycle event and only the lifecycle events used by the loaded plugins used will be shown.

By default, Mosaic will only run one instance of a plugin.

It may be the case that you wish to run the same plugin twice with a slightly different config. To do this, you must have 2 instances listed in the plugins collection and they both must set the allowMultiple option to true.

For example, the config below runs the SidebarPlugin twice:

Mosaic BETA

Coming soon