fastify-plugin
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -21,3 +21,3 @@ /// <reference types="fastify" /> | ||
declare namespace fastifyPlugin { | ||
type nextCallback = () => void; | ||
type nextCallback = (err?: Error) => void; | ||
interface PluginOptions { | ||
@@ -38,2 +38,2 @@ /** Bare-minimum version of Fastify for your plugin, just add the semver range that you need. */ | ||
export = fastifyPlugin; | ||
export = fastifyPlugin; |
@@ -5,6 +5,4 @@ 'use strict' | ||
const console = require('console') | ||
const extractPluginName = require('./stackParser') | ||
const fpStackTracePattern = new RegExp('at\\s{1}(?:.*\\.)?plugin\\s{1}.*\\n\\s*(.*)') | ||
const fileNamePattern = new RegExp('(?:\\/|\\\\)(\\w*(\\.\\w*)*)\\..*') | ||
function plugin (fn, options = {}) { | ||
@@ -48,5 +46,3 @@ if (typeof fn !== 'function') { | ||
} catch (e) { | ||
const stack = e.stack | ||
let m = stack.match(fpStackTracePattern) | ||
return m ? m[1].match(fileNamePattern)[1] : 'anonymous' | ||
return extractPluginName(e.stack) | ||
} | ||
@@ -53,0 +49,0 @@ } |
{ | ||
"name": "fastify-plugin", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Plugin helper for Fastify", | ||
@@ -28,3 +28,3 @@ "main": "index.js", | ||
"@types/node": "^9.6.22", | ||
"fastify": "^1.7.0", | ||
"fastify": "^1.13.0", | ||
"proxyquire": "^2.0.1", | ||
@@ -31,0 +31,0 @@ "standard": "^12.0.0", |
Sorry, the diff of this file is not supported yet
18722
18
386