refactor: plural
This commit is contained in:
parent
ad4709aabe
commit
dca45c052f
|
@ -23,6 +23,7 @@
|
||||||
"@latus/core": "^2.0.0",
|
"@latus/core": "^2.0.0",
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
|
"lodash.flatten": "^4.4.0",
|
||||||
"natsort": "^2.0.2"
|
"natsort": "^2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import flatten from 'lodash.flatten';
|
||||||
|
|
||||||
import {projects, user} from './state';
|
import {projects, user} from './state';
|
||||||
|
|
||||||
export * from './state';
|
export * from './state';
|
||||||
|
@ -8,7 +10,7 @@ export default {
|
||||||
'resource-renderers': [],
|
'resource-renderers': [],
|
||||||
}),
|
}),
|
||||||
'@latus/core/starting': async (latus) => {
|
'@latus/core/starting': async (latus) => {
|
||||||
const Renderers = await latus.invokeOrdered('@persea/core/resource-renderers');
|
const Renderers = flatten(await latus.invokeOrdered('@persea/core/resource-renderers'));
|
||||||
const Renderer = (uri) => {
|
const Renderer = (uri) => {
|
||||||
const R = Renderers.find(({matcher}) => uri.match(matcher));
|
const R = Renderers.find(({matcher}) => uri.match(matcher));
|
||||||
return R ? R.Component : ({buffer}) => buffer.toString();
|
return R ? R.Component : ({buffer}) => buffer.toString();
|
||||||
|
|
|
@ -22,6 +22,8 @@ export default {
|
||||||
draft.projects.resources[`${project}${uri}`] = JSONB.bufferify(json).toString('base64');
|
draft.projects.resources[`${project}${uri}`] = JSONB.bufferify(json).toString('base64');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'@persea/core/resource-renderers': () => JsonResourceComponent,
|
'@persea/core/resource-renderers': () => [
|
||||||
|
JsonResourceComponent,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user