TypeScript icon, indicating that this package has built-in type declarations

1.5.15 • Public • Published


license dependencies travis coverage npm

Plugin framework using ES Modules and Dynamic Import.


This project provides a Javascript framework for defining plugins which may be dynamically discovered and imported into a running Javascript process.

Key Features

  • Universal support for both NodeJS and browser Javascript runtimes
  • Dynamic plugin import using Javascript dynamic import
  • ES2015 module based
  • Written in Typescript

Key Concepts

The framework's key concepts are borrowed from the Eclipse Project's extension framework. The key concepts are:

  • A HostApplication instantiates a PluginManager
  • The PluginManager provides an ExtensionPointRegister
  • The HostApplication can declare ExtensionPoints in the ExtensionPointRegister
  • A Plugin provides one or more Extensions for one or more ExtensionPoints
  • A Plugin provides an ExtensionDescriptor for each Extension it provides
  • A PluginManager scans for and registers Plugins which provide Extensions for the known ExtensionPoints
  • A HostApplication uses the PluginManager to query for and select an Extension for a desired ExtensionPoint
  • The PluginManager uses an ExtensionFactory declared in an ExtensionDescriptor to instantiate a selected Extension

The following high level class diagram illustrates these relationships:

High Level Class Diagram

The following sequence diagram illustrates the key steps for a HostApplication to use a PluginManager for discovery and registration of Plugins:

Registration Sequence Diagram

Once registration has been performed, the HostApplication may query for and instantiate Extensions for known ExtensionPoints:

Query and Instantiation Sequence Diagram

As ExtensionPoints are simply Javascript classes, for the purposes of testing or validation, it is possible to bypass the framework altogether and import an Extension and use it directly:

Direct Instantiation Sequence Diagram


The following example projects are available which all support execution in NodeJS and a browser:

Code Documentation

Typescript documentation



npm install

Note: The warnings regarding peer dependencies are caused by dependencies or sub-dependencies which have yet to update their peer-dependencies. They can safely be ignored.

Build: npm run build

Watch: npm run watch

Test: npm test

Lint: npm run lint

Docs: npm run docs

The following diagram provides an overview of the main classes:

Implementation Class Diagram

Further Details

Further details on project configuration files and Javascript version support can be found in the template for this project.


  • js-plugins - also provides a plugin framework following Eclipse Project's framework. Relies on plugin declarations in package.json instead of Typescript interfaces. Does not support browser or ES2015 modules.
  • oclif plugins - very much tied to the Oclif CLI. Relies on available plugins being declared in package.json. Does not support browser or ES2015 modules.


MIT © Flowscripter

Package Sidebar


npm i @flowscripter/esm-dynamic-plugins

Weekly Downloads






Unpacked Size

2.98 MB

Total Files


Last publish


  • vectronic