From dca45c052fff17d16ff39aa1e1af8d99c254e98a Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 24 Jan 2021 09:51:45 -0600 Subject: [PATCH] refactor: plural --- packages/core/package.json | 1 + packages/core/src/index.js | 4 +++- packages/json/src/index.js | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index dc48387..70fd8ad 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -23,6 +23,7 @@ "@latus/core": "^2.0.0", "debug": "4.3.1", "glob": "^7.1.6", + "lodash.flatten": "^4.4.0", "natsort": "^2.0.2" }, "devDependencies": { diff --git a/packages/core/src/index.js b/packages/core/src/index.js index 121d35b..3f242e4 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -1,3 +1,5 @@ +import flatten from 'lodash.flatten'; + import {projects, user} from './state'; export * from './state'; @@ -8,7 +10,7 @@ export default { 'resource-renderers': [], }), '@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 R = Renderers.find(({matcher}) => uri.match(matcher)); return R ? R.Component : ({buffer}) => buffer.toString(); diff --git a/packages/json/src/index.js b/packages/json/src/index.js index 267d8b9..3167a9d 100644 --- a/packages/json/src/index.js +++ b/packages/json/src/index.js @@ -22,6 +22,8 @@ export default { draft.projects.resources[`${project}${uri}`] = JSONB.bufferify(json).toString('base64'); }); }, - '@persea/core/resource-renderers': () => JsonResourceComponent, + '@persea/core/resource-renderers': () => [ + JsonResourceComponent, + ], }, };