fix: providers
This commit is contained in:
parent
147c42fc4a
commit
7073706e7c
|
@ -188,10 +188,31 @@ export default class Latus {
|
|||
const parts = hook.split('/');
|
||||
const key = parts.pop();
|
||||
const plugins = this.config[parts.join('/')][key].concat();
|
||||
if (!plugins) {
|
||||
return [];
|
||||
}
|
||||
let finalPlugins = [];
|
||||
const index = plugins.findIndex((plugin) => '...' === plugin);
|
||||
if (-1 !== index) {
|
||||
const before = plugins.slice(0, index);
|
||||
const after = plugins.slice(index + 1);
|
||||
const rest = without(
|
||||
this.hooks[hook].map(({plugin}) => plugin),
|
||||
...before.concat(after),
|
||||
);
|
||||
finalPlugins = [
|
||||
...before,
|
||||
...rest,
|
||||
...after,
|
||||
];
|
||||
}
|
||||
else {
|
||||
finalPlugins = plugins;
|
||||
}
|
||||
const promises = [];
|
||||
while (plugins.length > 0) {
|
||||
while (finalPlugins.length > 0) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
promises.push(this.invokePlugin(hook, plugins.shift(), ...(args.concat(this))));
|
||||
promises.push(this.invokePlugin(hook, finalPlugins.shift(), ...(args.concat(this))));
|
||||
}
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ export {default as usePrevious} from './hooks/use-previous';
|
|||
export default {
|
||||
hooks: {
|
||||
'@latus/core/config': () => ({
|
||||
providers: [],
|
||||
providers: ['...'],
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user