Socket
Socket
Sign inDemoInstall

fastify

Package Overview
Dependencies
65
Maintainers
4
Versions
280
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.25.0 to 4.25.1

2

fastify.js
'use strict'
const VERSION = '4.25.0'
const VERSION = '4.25.1'

@@ -5,0 +5,0 @@ const Avvio = require('avvio')

@@ -139,5 +139,5 @@ 'use strict'

function checkPluginHealthiness (fn, pluginName = 'anonymous') {
function checkPluginHealthiness (fn, pluginName) {
if (fn.constructor.name === 'AsyncFunction' && fn.length === 3) {
FSTWRN002(pluginName)
FSTWRN002(pluginName || 'anonymous')
}

@@ -147,3 +147,3 @@ }

function registerPlugin (fn) {
const pluginName = registerPluginName.call(this, fn)
const pluginName = registerPluginName.call(this, fn) || getPluginName(fn)
checkPluginHealthiness.call(this, fn, pluginName)

@@ -150,0 +150,0 @@ checkVersion.call(this, fn)

{
"name": "fastify",
"version": "4.25.0",
"version": "4.25.1",
"description": "Fast and low overhead web framework, for Node.js",

@@ -5,0 +5,0 @@ "main": "fastify.js",

@@ -380,6 +380,6 @@ <div align="center"> <a href="https://fastify.dev/">

src="https://github.com/openjs-foundation/artwork/blob/main/openjs_foundation/openjs_foundation-logo-horizontal-color.png?raw=true"
width="250px;"/>](https://openjsf.org/projects/#growth)
width="250px;"/>](https://openjsf.org/projects)
We are a [Growth
Project](https://github.com/openjs-foundation/cross-project-council/blob/HEAD/PROJECT_PROGRESSION.md#growth-stage)
We are a [At-Large
Project](https://github.com/openjs-foundation/cross-project-council/blob/HEAD/PROJECT_PROGRESSION.md#at-large-projects)
in the [OpenJS Foundation](https://openjsf.org/).

@@ -386,0 +386,0 @@

@@ -419,16 +419,23 @@ 'use strict'

test('registering plugins with mixed style should return a warning', async t => {
t.plan(4)
t.plan(12)
const pluginNames = ['error-plugin', 'anonymous', 'anotherPlugin', 'anotherPluginNamed']
const oldWarnings = process.listeners('warning')
process.removeAllListeners('warning')
process.on('warning', onWarning)
function onWarning (warning) {
t.match(warning.message, new RegExp(`.*${pluginNames.shift()} plugin being registered mixes async and callback styles.*`))
t.equal(warning.name, 'FastifyWarning')
t.equal(warning.code, 'FSTWRN002')
}
t.teardown(() => {
process.removeListener('warning', onWarning)
for (const warning of oldWarnings) {
process.on('warning', warning)
}
})
const fastify = Fastify()
const anonymousPlugin = async (app, opts, done) => {
done()
}
const pluginName = 'error-plugin'

@@ -441,6 +448,18 @@ const errorPlugin = async (app, opts, done) => {

async function anotherPlugin (app, opts, done) {
done()
}
const anotherPluginNamed = async function (app, opts, done) {
done()
}
fastify.register(namedPlugin)
fastify.register(anonymousPlugin)
fastify.register(async (app, opts, done) => {
done()
})
fastify.register(anotherPlugin)
fastify.register(anotherPluginNamed)
await fastify.ready()
})

@@ -447,15 +447,8 @@ import { FastifyError } from '@fastify/error'

constraints: {
something: {
name: 'secret',
storage: function () {
return {
get: (type) => {
return null
},
set: (type, store) => {}
}
},
deriveConstraint: (req, ctx, done) => {},
mustMatchWhenDerived: true
}
// constraints value should accept any value
number: 12,
date: new Date(),
boolean: true,
function: () => {},
object: { foo: 'bar' }
}

@@ -462,0 +455,0 @@ }))

import { FastifyError } from '@fastify/error'
import { ConstraintStrategy } from 'find-my-way'
import { FastifyRequestContext } from './context'

@@ -15,3 +16,2 @@ import { onErrorMetaHookHandler, onRequestAbortMetaHookHandler, onRequestMetaHookHandler, onResponseMetaHookHandler, onSendMetaHookHandler, onTimeoutMetaHookHandler, preHandlerMetaHookHandler, preParsingMetaHookHandler, preSerializationMetaHookHandler, preValidationMetaHookHandler } from './hooks'

import { ContextConfigDefault, HTTPMethods, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase, RawServerDefault } from './utils'
import { ConstraintStrategy } from 'find-my-way'

@@ -29,2 +29,8 @@ export interface FastifyRouteConfig {

export interface RouteConstraint {
version?: string
host?: RegExp | string
[name: string]: unknown
}
/**

@@ -53,3 +59,3 @@ * Route shorthand options for the various shorthand methods

version?: string;
constraints?: { version: string } | {host: RegExp | string} | {[name: string]: RouteConstraintType },
constraints?: RouteConstraint,
prefixTrailingSlash?: 'slash'|'no-slash'|'both';

@@ -56,0 +62,0 @@ errorHandler?: (

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