Socket
Socket
Sign inDemoInstall

fastify-plugin

Package Overview
Dependencies
1
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.2.1

4

package.json
{
"name": "fastify-plugin",
"version": "1.2.0",
"version": "1.2.1",
"description": "Plugin helper for Fastify",

@@ -30,3 +30,3 @@ "main": "index.js",

"proxyquire": "^2.0.1",
"standard": "^11.0.1",
"standard": "^12.0.0",
"tap": "^12.0.0",

@@ -33,0 +33,0 @@ "ts-node": "^7.0.0",

@@ -14,5 +14,3 @@ # fastify-plugin

In addition if you use this module when creating new plugins, you can declare the dependencies, the name and the expected Fastify version that your plugin needs.
#### Usage
## Usage
`fastify-plugin` can do three things for you:

@@ -33,2 +31,6 @@ - Add the `skip-override` hidden property

## Metadata
In addition if you use this module when creating new plugins, you can declare the dependencies, the name and the expected Fastify version that your plugin needs.
#### Fastify version
If you need to set a bare-minimum version of Fastify for your plugin, just add the [semver](http://semver.org/) range that you need:

@@ -41,3 +43,3 @@ ```js

next()
}, { fastify: '0.x' })
}, { fastify: '1.x' })
```

@@ -49,3 +51,4 @@

You can also pass some metadata that will be handled by Fastify, such as the dependencies of your plugin.
#### Name
Fastify uses this option to validate dependency graph. On one hand it makes sure that no name collision occurs. On the other hand it makes possible to perform [dependency check](https://github.com/fastify/fastify-plugin#dependencies).
```js

@@ -60,3 +63,20 @@ const fp = require('fastify-plugin')

module.exports = fp(plugin, {
fastify: '0.x',
fastify: '1.x',
name: 'your-plugin-name'
})
```
#### Dependencies
You can also check if the `plugins` and `decorators` which your plugin intend to use are present in the dependency graph.
> *Note:* This is the point where registering `name` of the plugins become important, because you can reference `plugin` dependencies by their [name](https://github.com/fastify/fastify-plugin#name).
```js
const fp = require('fastify-plugin')
function plugin (fastify, opts, next) {
// your plugin code
next()
}
module.exports = fp(plugin, {
fastify: '1.x',
decorators: {

@@ -63,0 +83,0 @@ fastify: ['plugin1', 'plugin2'],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc