Skip to content

Commit

Permalink
Revert "composedPlugin should have its own prefix context (#368)"
Browse files Browse the repository at this point in the history
This reverts commit c1685f4.
  • Loading branch information
climba03003 authored and jean-michelet committed Jun 17, 2024
1 parent a26d1e4 commit 65c3dd1
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 150 deletions.
12 changes: 3 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,16 @@ const fastifyAutoload = async function autoload (fastify, options) {
// encapsulate hooks at plugin level
app.register(hookPlugin)
}
registerAllPlugins(app, pluginFiles, true)
registerAllPlugins(app, pluginFiles)
}

fastify.register(composedPlugin, { prefix: options.options?.prefix ?? prefix })
fastify.register(composedPlugin)
}
}

function registerAllPlugins (app, pluginFiles, composed = false) {
function registerAllPlugins (app, pluginFiles) {
for (const pluginFile of pluginFiles) {
// find plugins for this prefix, based on filename stored in registerPlugins()
const plugin = metas.find((i) => i.filename === pluginFile.file)

if (composed) {
plugin.options.prefix = undefined
}

// register plugins at fastify level
if (plugin) registerPlugin(app, plugin, pluginsMeta)
}
Expand Down
19 changes: 0 additions & 19 deletions test/issues/326/autohooks/index.js

This file was deleted.

7 changes: 0 additions & 7 deletions test/issues/326/autohooks/routes-a/child/.autohooks.js

This file was deleted.

7 changes: 0 additions & 7 deletions test/issues/326/autohooks/routes-a/child/routes.js

This file was deleted.

7 changes: 0 additions & 7 deletions test/issues/326/autohooks/routes-a/sibling/.autohooks.js

This file was deleted.

7 changes: 0 additions & 7 deletions test/issues/326/autohooks/routes-a/sibling/routes.js

This file was deleted.

7 changes: 0 additions & 7 deletions test/issues/326/autohooks/routes-b/child/.autohooks.js

This file was deleted.

7 changes: 0 additions & 7 deletions test/issues/326/autohooks/routes-b/child/routes.js

This file was deleted.

80 changes: 0 additions & 80 deletions test/issues/326/test.js

This file was deleted.

0 comments on commit 65c3dd1

Please sign in to comment.