https://github.com/blink1073/phosphor-plugins

A module for building plugin-based applications.

https://github.com/blink1073/phosphor-plugins

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary

Keywords from Contributors

notebook jupyterlab
Last synced: 9 months ago · JSON representation

Repository

A module for building plugin-based applications.

Basic Info
  • Host: GitHub
  • Owner: blink1073
  • License: bsd-3-clause
  • Language: TypeScript
  • Default Branch: master
  • Size: 155 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Created over 10 years ago · Last pushed over 10 years ago
Metadata Files
Readme License

README.md

phosphor-plugins

Build Status Coverage Status

A module for building plugin-based applications.

API Docs

Package Install

Prerequisites - node

bash npm install --save phosphor-plugins

Source Build

Prerequisites - git - node

bash git clone https://github.com/phosphorjs/phosphor-plugins.git cd phosphor-plugins npm install

Rebuild bash npm run clean npm run build

Run Tests

Follow the source build instructions first.

```bash

run tests in Firefox

npm test

run tests in Chrome

npm run test:chrome

run tests in IE

npm run test:ie ```

Build Docs

Follow the source build instructions first.

bash npm run docs

Navigate to docs/index.html.

Build Examples

Follow the source build instructions first.

bash npm run build:examples

Navigate to one of the examples/ and start a server.

Supported Runtimes

The runtime versions which are currently known to work are listed below. Earlier versions may also work, but come with no guarantees.

  • IE 11+
  • Firefox 32+
  • Chrome 38+

Plugin Specification

Plugins are specified in the top level package.json file of a package, using the phosphor-plugin field. A plugin name is the same as the name of the package which contains the plugin specification.

The phosphor-plugin field is an object with the following properties:

  • extensionPoints - Optional. An array of extension point specifications.
  • extensions - Optional. An array of extension specifications.

An extension point is specified as an object with the following fields:

  • id - Required. The globally unique id of the extension point.
  • main - Optional. The path to the extension point main module. This path is assumed to be relative to the plugin. For example, for a plugin named foo and an extension point main path of lib/index.js, the foo/lib/index.js module is loaded.
  • factory - Optional. The name of a function in the main module which creates the receiver for the extension point. The function should take no arguments and return void | IReceiver | Promise<IReceiver>.

An extension is specified as an object with the following fields:

  • id - Required. The globally unique id of the extension.
  • point - Required. The identifier of the target extension point.
  • main - Optional. The path to the extension main module. This path is assumed to be relative to the plugin. For example, for a plugin named bar and an extension main path of lib/index.js, the bar/lib/index.js module is loaded.
  • factory - Optional. The name of a function in the main module which creates the contribution for the extension. The function should take no arguments and return void | IContrib | Promise<IContrib>.
  • data - Optional. The path to the JSON data file for the extension. Some extension points are able to consume data from JSON files, such as menu and key binding specifications. This path is relative to the plugin.
  • config - Optional. Extra static configuration data for the extension. Some extension points are able to consume static configuration data along with the actual extension object.

Paths are loaded using System.import, which must be configured to load the plugin package by name. See the examples/ folder for configurations using SystemJS and StealJS.

Usage Examples

Note: This module is fully compatible with Node/Babel/ES6/ES5. Simply omit the type declarations when using a language other than TypeScript.

Register a plugin and load its JSON specification. The plugin's extensions and extension points are automatically registered. For each extension, the registry is scanned for a matching extension point. If a match is found, the extension and extension point are instantiated and paired.

```typescript import { listPlugins, registerPlugin } from 'phosphor-plugins';

let disposable = registerPlugin('my-plugin');

console.log(listPlugins()); // ['my-plugin']

disposable.dispose(); // unregister and unload the plugin ```

Dynamically register an extension point which is created at runtime:

```typescript import { IExtensionPoint, registerExtensionPoint } from 'phosphor-plugins';

let point: IExtensionPoint = {

id: 'my-plugin:my-dynamic-point',

isDisposed: false,

dispose: () => { point.isDisposed = true; console.log('disposed'); },

add: extension => { console.log('Add extension', extension.id, extension.item); },

remove: id => { console.log('Remove extension', id); }, };

registerExtensionPoint(point); ```

Dynamically register an extension which is created at runtime:

```typescript import { IExtension, registerExtension } from 'phosphor-plugins';

let ext: IExtension = {

id: 'my-other-plugin:my-dynamic-ext',

point: 'my-plugin:my-dynamic-point',

item: { value: 42 },

data: null,

config: null,

isDisposed: false,

dispose: () => { ext.isDisposed = true, console.log('disposed'); }, };

registerExtension(extension); ```

Owner

  • Name: Steven Silvester
  • Login: blink1073
  • Kind: user
  • Company: MongoDB

GitHub Events

Total
Last Year

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 121
  • Total Committers: 3
  • Avg Commits per committer: 40.333
  • Development Distribution Score (DDS): 0.512
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Steven Silvester s****r@i****g 59
S. Chris Colbert s****t@g****m 52
Dave Willmer d****r@g****m 10
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

examples/stealjs/package.json npm
  • foo ^0.1.0
  • phosphor-disposable ^1.0.5
  • steal ^0.12.7
examples/systemjs/package.json npm
  • phosphor-disposable ^1.0.5
  • system-css ^0.1.0
  • systemjs ^0.19.6
  • systemjs-plugin-json ^0.1.0
package.json npm
  • coveralls ^2.11.4 development
  • expect.js ^0.3.1 development
  • fs-extra ^0.26.2 development
  • istanbul ^0.3.19 development
  • karma ^0.13.9 development
  • karma-chrome-launcher ^0.2.0 development
  • karma-coverage ^0.5.0 development
  • karma-firefox-launcher ^0.1.6 development
  • karma-ie-launcher ^0.2.0 development
  • karma-mocha ^0.2.0 development
  • karma-mocha-reporter ^1.1.1 development
  • karma-systemjs ^0.9.0 development
  • mocha ^2.2.5 development
  • rimraf ^2.4.2 development
  • system-css ^0.1.0 development
  • systemjs ^0.19.6 development
  • systemjs-plugin-json ^0.1.0 development
  • typedoc ^0.3.11 development
  • typescript ^1.6.2 development
  • phosphor-disposable ^1.0.5