feat(plugins): supports predefined configurations (#365)
See vatesfr/xo-web#1289
This commit is contained in:
parent
83d68ca293
commit
728c5aa86e
@ -224,7 +224,8 @@ async function registerPlugin (pluginPath, pluginName) {
|
|||||||
// Supports both “normal” CommonJS and Babel's ES2015 modules.
|
// Supports both “normal” CommonJS and Babel's ES2015 modules.
|
||||||
const {
|
const {
|
||||||
default: factory = plugin,
|
default: factory = plugin,
|
||||||
configurationSchema
|
configurationSchema,
|
||||||
|
configurationPresets
|
||||||
} = plugin
|
} = plugin
|
||||||
|
|
||||||
// The default export can be either a factory or directly a plugin
|
// The default export can be either a factory or directly a plugin
|
||||||
@ -237,6 +238,7 @@ async function registerPlugin (pluginPath, pluginName) {
|
|||||||
pluginName,
|
pluginName,
|
||||||
instance,
|
instance,
|
||||||
configurationSchema,
|
configurationSchema,
|
||||||
|
configurationPresets,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -50,11 +50,13 @@ export default class {
|
|||||||
name,
|
name,
|
||||||
instance,
|
instance,
|
||||||
configurationSchema,
|
configurationSchema,
|
||||||
|
configurationPresets,
|
||||||
version
|
version
|
||||||
) {
|
) {
|
||||||
const id = name
|
const id = name
|
||||||
const plugin = this._plugins[id] = {
|
const plugin = this._plugins[id] = {
|
||||||
configured: !configurationSchema,
|
configured: !configurationSchema,
|
||||||
|
configurationPresets,
|
||||||
configurationSchema,
|
configurationSchema,
|
||||||
id,
|
id,
|
||||||
instance,
|
instance,
|
||||||
@ -101,6 +103,7 @@ export default class {
|
|||||||
|
|
||||||
async _getPlugin (id) {
|
async _getPlugin (id) {
|
||||||
const {
|
const {
|
||||||
|
configurationPresets,
|
||||||
configurationSchema,
|
configurationSchema,
|
||||||
loaded,
|
loaded,
|
||||||
name,
|
name,
|
||||||
@ -120,6 +123,7 @@ export default class {
|
|||||||
unloadable,
|
unloadable,
|
||||||
version,
|
version,
|
||||||
configuration,
|
configuration,
|
||||||
|
configurationPresets,
|
||||||
configurationSchema
|
configurationSchema
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user