canmove, Confirmed users, Bureaucrats and Sysops emeriti
1,093
edits
No edit summary |
No edit summary |
||
| Line 90: | Line 90: | ||
// If it's a lua file, it will see that this plugin can handle | // If it's a lua file, it will see that this plugin can handle | ||
// lua. | // lua. | ||
"bespin.syntax.simple": { | entryPoints: { | ||
"bespin.syntax.simple": { | |||
extensions: ["lua"] | |||
} | |||
} | } | ||
} | } | ||
| Line 108: | Line 110: | ||
Plugin modules are implemented not as Dojo modules, but rather as [https://wiki.mozilla.org/ServerJS/Modules/SecurableModules ServerJS Securable Modules]. This would allow seamless interop for plugins that have both client and server side JS components. | Plugin modules are implemented not as Dojo modules, but rather as [https://wiki.mozilla.org/ServerJS/Modules/SecurableModules ServerJS Securable Modules]. This would allow seamless interop for plugins that have both client and server side JS components. | ||
=== Plugin installation === | |||
New commands will allow you to work with plugins: | |||
;plugin install URL|Bespin file path:Install a plugin. You can point it at a single file plugin, or at a zip file or tarball. If it's a zip or tgz, it needs to have a single .js file in it or contain a directory that includes a plugin.json. plugin.json provides the equivalent of the info object above. You can also give it a Bespin file path pointing to a directory or file where there is a plugin. | |||
;plugin uninstall PluginName:If installed from a remote location, the plugin files will be deleted. If it was a Bespin path, the plugin is just removed from the installed plugin data. | |||
;plugin reload:generally used in development of a plugin. | |||
;plugin list:list the installed plugins. | |||
Bespin keeps track of installed plugins in a file called BespinSettings/plugins.metadata. The plugins themselves are installed into BespinSettings/plugins/. The metadata file includes all of the info objects from all of the plugins. Additionally, it stores where the plugin came form and where it is located within Bespin. | |||
When a plugin is installed, the module is loaded and the info object is extracted. For this reason, plugin modules should not actually *do* anything when they are loaded. The call to activate() is the time when the plugin should actually do something. | |||
=== Plugin loading === | |||
The idea behind this plugin system is to load as little as possible. Bespin will always load the plugins.metadata file. Based on the metadata, Bespin will decide when to load a plugin. The exact timing of loading the code will depend on what the plugin does. For example, syntax highlighters are loaded when a file of the appropriate type is opened. | |||
It will be possible to have a plugin load immediately, but the goal is to seek out ways to allow plugins to load more lazily. | |||
=== Wordpress-like === | === Wordpress-like === | ||