Skip to content

Exported files

Status

Accepted.

Context

POLAR is consumed as a library. It has to be decided which parts of the core and of the plugins are part of the public API, since everything that is exported has to be maintained and is subject to SemVer.

Consumers need to read and change state at runtime (e.g. to react to a selected feature or to open a plugin's UI programmatically). At the same time, plugins are not only state, but also UI, locales and options that need to be usable as a whole. However, we want to allow users to use the state with a custom UI.

Decision

  • We export a public-facing store for the core and for each plugin. The store exports everything that is used by the UI.
  • We export the whole plugin, i.e. its UI components, locales, options and store, as a single unit.

Consequences

  • (+) The public API is explicit and can be documented and typed.
  • (+) Consumers can use a plugin as a whole without having to assemble UI, locales and store themselves.