@gasket/plugin-fastify 7.3.5 → 7.3.6

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.
@@ -8,17 +8,19 @@ const { getAppInstance } = require('./utils.js');
8
8
  * use the same middleware lifecycles.
9
9
  * @type {import('@gasket/core').HookHandler<'createServers'>}
10
10
  */
11
- // eslint-disable-next-line max-statements
12
11
  module.exports = async function createServers(gasket, serverOpts) {
13
- const app = getAppInstance(gasket);
12
+ /** Cast to Fastify + Express hybrid because Gasket adds `.use()` via @fastify/express plugin */
13
+ const app = /** @type {import('fastify').FastifyInstance & { use: Function }} */ (getAppInstance(gasket));
14
14
 
15
15
  // allow consuming apps to directly append options to their server
16
- // @ts-ignore
17
16
  await gasket.exec('fastify', app);
18
17
 
19
18
  const postRenderingStacks = (await gasket.exec('errorMiddleware')).filter(Boolean);
20
- // @ts-ignore
21
- postRenderingStacks.forEach((stack) => app.use(stack));
19
+ postRenderingStacks.forEach((stack) => {
20
+ /** @type {import('connect').NextHandleFunction} */
21
+ const middleware = stack;
22
+ app.use(middleware);
23
+ });
22
24
 
23
25
  return {
24
26
  ...serverOpts,
package/lib/index.d.ts CHANGED
@@ -20,6 +20,11 @@ export interface FastifyConfig {
20
20
  disableRequestLogging?: boolean;
21
21
  }
22
22
 
23
+ export type FastifyOptions = FastifyServerOptions & {
24
+ https?: any,
25
+ http2?: boolean | object
26
+ }
27
+
23
28
  declare module '@gasket/core' {
24
29
  export interface GasketActions {
25
30
  /** @deprecated */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasket/plugin-fastify",
3
- "version": "7.3.5",
3
+ "version": "7.3.6",
4
4
  "description": "Adds fastify support to your application",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -22,9 +22,11 @@
22
22
  "bugs": "https://github.com/godaddy/gasket/issues",
23
23
  "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-plugin-fastify",
24
24
  "dependencies": {
25
+ "@fastify/express": "^3.0.0",
25
26
  "fastify": "^4.29.0"
26
27
  },
27
28
  "devDependencies": {
29
+ "@types/connect": "^3.4.38",
28
30
  "@types/jest": "^29.5.14",
29
31
  "@types/node": "^20.17.19",
30
32
  "cross-env": "^7.0.3",
@@ -35,12 +37,12 @@
35
37
  "eslint-plugin-unicorn": "^55.0.0",
36
38
  "fastify": "^4.29.0",
37
39
  "jest": "^29.7.0",
38
- "typescript": "^5.7.3",
39
- "@gasket/core": "7.4.0",
40
- "@gasket/plugin-https": "7.3.4",
41
- "@gasket/plugin-logger": "7.3.3",
42
- "@gasket/plugin-metadata": "7.3.6",
43
- "create-gasket-app": "7.3.5"
40
+ "typescript": "^5.8.2",
41
+ "@gasket/core": "7.4.1",
42
+ "@gasket/plugin-https": "7.3.5",
43
+ "@gasket/plugin-logger": "7.3.4",
44
+ "@gasket/plugin-metadata": "7.3.7",
45
+ "create-gasket-app": "7.3.7"
44
46
  },
45
47
  "peerDependencies": {
46
48
  "fastify": "^4.29.0"