@gasket/plugin-fastify 6.47.0 → 7.0.0-7.0.1-canary.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/create-servers.js +3 -2
- package/lib/index.d.ts +12 -11
- package/lib/index.js +3 -3
- package/package.json +4 -4
package/lib/create-servers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@gasket/plugin-https" />
|
|
2
|
-
/// <reference types="@gasket/plugin-
|
|
2
|
+
/// <reference types="@gasket/plugin-logger" />
|
|
3
3
|
|
|
4
4
|
const fastify = require('fastify');
|
|
5
5
|
const middie = require('middie');
|
|
@@ -11,7 +11,7 @@ const debug = require('diagnostics')('gasket:fastify');
|
|
|
11
11
|
* Create the Fastify instance and setup the lifecycle hooks.
|
|
12
12
|
* Fastify is compatible with express middleware out of the box, so we can
|
|
13
13
|
* use the same middleware lifecycles.
|
|
14
|
-
* @type {import('@gasket/
|
|
14
|
+
* @type {import('@gasket/core').HookHandler<'createServers'>}
|
|
15
15
|
*/
|
|
16
16
|
// eslint-disable-next-line max-statements
|
|
17
17
|
module.exports = async function createServers(gasket, serverOpts) {
|
|
@@ -44,6 +44,7 @@ module.exports = async function createServers(gasket, serverOpts) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const middlewares = [];
|
|
47
|
+
|
|
47
48
|
await gasket.execApply('middleware', async (plugin, handler) => {
|
|
48
49
|
const middleware = await handler(app);
|
|
49
50
|
if (middleware) {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { MaybeAsync, MaybeMultiple } from '@gasket/
|
|
1
|
+
import type { MaybeAsync, MaybeMultiple } from '@gasket/core';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
3
|
+
Fastify,
|
|
4
4
|
FastifyRequest,
|
|
5
5
|
FastifyReply,
|
|
6
6
|
FastifyServerOptions
|
|
7
7
|
} from 'fastify';
|
|
8
8
|
|
|
9
|
-
declare module '@gasket/
|
|
9
|
+
declare module '@gasket/core' {
|
|
10
10
|
export interface GasketConfig {
|
|
11
11
|
fastify?: {
|
|
12
12
|
/** Enable compression */
|
|
@@ -31,11 +31,7 @@ declare module '@gasket/engine' {
|
|
|
31
31
|
* Handler function type - The middie middleware is added for express
|
|
32
32
|
* compatibility
|
|
33
33
|
*/
|
|
34
|
-
type Handler = (
|
|
35
|
-
req: FastifyRequest,
|
|
36
|
-
res: FastifyReply,
|
|
37
|
-
next: (error?: Error) => void
|
|
38
|
-
) => void;
|
|
34
|
+
type Handler = (req: any, res: any, next: (error?: Error) => void) => void;
|
|
39
35
|
|
|
40
36
|
/** Error handler function type */
|
|
41
37
|
type ErrorHandler = (
|
|
@@ -47,16 +43,21 @@ declare module '@gasket/engine' {
|
|
|
47
43
|
|
|
48
44
|
export interface HookExecTypes {
|
|
49
45
|
middleware(
|
|
50
|
-
fastify:
|
|
46
|
+
fastify: Fastify
|
|
51
47
|
): MaybeAsync<MaybeMultiple<Handler> & { paths?: (string | RegExp)[] }>;
|
|
52
|
-
fastify(fastify:
|
|
48
|
+
fastify(fastify: Fastify): MaybeAsync<void>;
|
|
53
49
|
errorMiddleware(): MaybeAsync<MaybeMultiple<ErrorHandler>>;
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
declare module '
|
|
53
|
+
declare module 'create-gasket-app' {
|
|
58
54
|
export interface CreateContext {
|
|
59
55
|
/** Flag indicating if API app is enabled */
|
|
60
56
|
apiApp?: boolean;
|
|
61
57
|
}
|
|
62
58
|
}
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
name: '@gasket/plugin-fastify',
|
|
62
|
+
hooks: {}
|
|
63
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/// <reference types="@gasket/
|
|
1
|
+
/// <reference types="@gasket/core" />
|
|
2
2
|
/// <reference types="@gasket/plugin-metadata" />
|
|
3
3
|
|
|
4
4
|
const { peerDependencies, name } = require('../package.json');
|
|
5
5
|
const createServers = require('./create-servers');
|
|
6
6
|
|
|
7
|
-
/** @type {import('@gasket/
|
|
7
|
+
/** @type {import('@gasket/core').Plugin} */
|
|
8
8
|
const plugin = {
|
|
9
9
|
name,
|
|
10
10
|
hooks: {
|
|
@@ -15,7 +15,7 @@ const plugin = {
|
|
|
15
15
|
fastify: peerDependencies.fastify
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
if (context.apiApp) {
|
|
18
|
+
if ('apiApp' in context && context.apiApp) {
|
|
19
19
|
context.files.add(`${generatorDir}/**/*`);
|
|
20
20
|
|
|
21
21
|
context.gasketConfig.add('fastify', {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/plugin-fastify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-7.0.1-canary.11.0",
|
|
4
4
|
"description": "Adds fastify support to your application",
|
|
5
|
-
"main": "lib",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"middie": "^5.4.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@gasket/
|
|
48
|
+
"@gasket/core": "^7.0.0-7.0.1-canary.11.0",
|
|
49
49
|
"cross-env": "^7.0.3",
|
|
50
50
|
"eslint": "^8.56.0",
|
|
51
51
|
"eslint-config-godaddy": "^7.1.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"eslintIgnore": [
|
|
77
77
|
"generator"
|
|
78
78
|
],
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "ee3641e5f9218418d54690c04456fb24b63dc339"
|
|
80
80
|
}
|