From 281f2d9974c5bf33af40fd637db3ab67f5c53c8a Mon Sep 17 00:00:00 2001 From: device Date: Mon, 17 May 2021 12:35:53 -0400 Subject: [PATCH] [ADD] types definitions --- index.d.ts | 6 ++++++ index.js | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..685745c --- /dev/null +++ b/index.d.ts @@ -0,0 +1,6 @@ +/// + +import { FastifyPluginCallback } from 'fastify'; +export interface FastifyMsgpackOptions { } +declare const fastifyMsgpack: FastifyPluginCallback; +export default fastifyMsgpack; \ No newline at end of file diff --git a/index.js b/index.js index 0c94768..69ff44b 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ const msgpack = require('@msgpack/msgpack') * @param {*} options * @param {*} next */ -function msgpackSerializerPlugin(fastify, options, next) { +function fastifyMsgpack(fastify, options, next) { fastify.register(require('fastify-accepts-serializer'), { serializers: [ { @@ -34,10 +34,7 @@ function msgpackSerializerPlugin(fastify, options, next) { next() } -const fastifyMsgpack = fp(msgpackSerializerPlugin, { +module.exports = fp(fastifyMsgpack, { fastify: '3.x', - name: 'fastify-msgpack', - dependencies: ['fastify-accepts-serializer'] + name: 'fastify-msgpack' }) - -module.exports = fastifyMsgpack