Skip to content

Commit

Permalink
Fix dependencies across directories (#415)
Browse files Browse the repository at this point in the history
* Fix dependencies across directories

Signed-off-by: Matteo Collina <hello@matteocollina.com>

* fixup

Signed-off-by: Matteo Collina <hello@matteocollina.com>

---------

Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina authored Oct 8, 2024
1 parent df32f50 commit 630bc84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ const fastifyAutoload = async function autoload (fastify, options) {
}

async function loadPlugins ({ pluginTree, options, opts, fastify }) {
const nodes = []
const pluginsMeta = {}
for (const key in pluginTree) {
const node = {
...pluginTree[key],
pluginsMeta: {},
pluginsMeta,
hooksMeta: {}
}
nodes.push(node)

await Promise.all(node.plugins.map(({ file, type, prefix }) => {
return loadPlugin({ file, type, directoryPrefix: prefix, options: opts, log: fastify.log })
Expand All @@ -55,7 +58,9 @@ async function loadPlugins ({ pluginTree, options, opts, fastify }) {
throw enrichError(err)
})
}))
}

for (const node of nodes) {
registerNode(node, fastify)
}
}
Expand Down

0 comments on commit 630bc84

Please sign in to comment.