Skip to content

Introduce an option to encapsulate the plugin #197

@dwickern

Description

@dwickern

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Introduce an option encapsulate?: boolean. Defaults to false. When set to true, keep the plugin encapsulated.

Motivation

fastify-plugin currently makes all plugins accessible by setting skip-override. It would be nice to have an option to keep it encapsulated, so you can set a plugin's name, metadata, etc without affecting the plugin's scope.

Would you consider a PR for this?

Example

module.exports = fp(plugin, {
  fastify: '4.x',
  decorators: {
    fastify: ['plugin1', 'plugin2'],
    reply: ['compress']
  },
  dependencies: ['plugin1-name', 'plugin2-name'],
  encapsulate: true,
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerssemver-minorIssue or PR that should land as semver minor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions