First commit

This commit is contained in:
2026-01-12 13:12:46 +01:00
parent b2d9501f6d
commit a1fbd8acf5
4413 changed files with 1245183 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
'use strict'
const t = require('tap')
const test = t.test
const fastifySuccess = require('./dist/success')
const fastifyFailPlugin = require('./dist/failPlugin')
test('Bundled package should work', (t) => {
t.plan(4)
fastifySuccess.ready((err) => {
t.error(err)
fastifySuccess.inject(
{
method: 'GET',
url: '/'
},
(error, res) => {
t.error(error)
t.equal(res.statusCode, 200)
t.same(res.json(), { hello: 'world' })
}
)
})
})
test('Bundled package should not work with bad plugin version', (t) => {
t.plan(1)
fastifyFailPlugin.ready((err) => {
t.match(err.message, /expected '9.x' fastify version/i)
})
})

11
node_modules/fastify/test/bundler/webpack/package.json generated vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"version":"0.0.1",
"scripts": {
"bundle": "webpack",
"test": "npm run bundle && node bundler-test.js"
},
"devDependencies": {
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2"
}
}

View File

@@ -0,0 +1,14 @@
'use strict'
const fp = require('fastify-plugin')
const fastify = require('../../../../')()
fastify.get('/', function (request, reply) {
reply.send({ hello: 'world' })
})
fastify.register(fp((instance, opts, done) => {
done()
}, { fastify: '9.x' }))
module.exports = fastify

View File

@@ -0,0 +1,9 @@
'use strict'
const fastify = require('../../../../')()
// Declare a route
fastify.get('/', function (request, reply) {
reply.send({ hello: 'world' })
})
module.exports = fastify

View File

@@ -0,0 +1,15 @@
'use strict'
const path = require('node:path')
module.exports = {
entry: { success: './src/index.js', failPlugin: './src/fail-plugin-version.js' },
target: 'node',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
library: {
type: 'commonjs2'
}
}
}