File tree 5 files changed +52
-3
lines changed
5 files changed +52
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { Plugin } from 'fastify'
2
+ import { Server , IncomingMessage , ServerResponse } from 'http'
3
+
4
+ declare const fastifyCompress : Plugin <
5
+ Server ,
6
+ IncomingMessage ,
7
+ ServerResponse ,
8
+ {
9
+ global ?: boolean
10
+ threshold ?: number
11
+ customTypes ?: RegExp
12
+ brotli ?: NodeModule
13
+ zlib ?: NodeModule
14
+ inflateIfDeflated ?: boolean
15
+ }
16
+ >
17
+
18
+ export = fastifyCompress
Original file line number Diff line number Diff line change 19
19
"unzipper" : " ^0.9.11"
20
20
},
21
21
"devDependencies" : {
22
+ "@types/node" : " ^11.13.9" ,
23
+ "@typescript-eslint/parser" : " ^1.7.0" ,
24
+ "eslint-plugin-typescript" : " ^0.14.0" ,
22
25
"fastify" : " ^2.0.0" ,
23
26
"iltorb" : " ^2.3.0" ,
24
27
"jsonstream" : " ^1.0.3" ,
25
28
"pre-commit" : " ^1.2.2" ,
26
29
"standard" : " ^12.0.0" ,
30
+ "typescript" : " ^3.4.5" ,
27
31
"tap" : " ^12.6.6"
28
32
},
29
33
"scripts" : {
30
- "unit" : " tap test.js" ,
31
- "test" : " standard && npm run unit" ,
34
+ "unit" : " tap test/test.js" ,
35
+ "test" : " standard && npm run unit && npm run typescript" ,
36
+ "lint:typescript" : " standard --fix --parser @typescript-eslint/parser --plugin typescript test/types/*.ts" ,
37
+ "typescript" : " tsc --project ./test/types/tsconfig.json" ,
32
38
"coverage" : " npm run unit -- --cov" ,
33
39
"coverage-report" : " npm run coverage && tap --coverage-report=lcov"
34
40
},
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const JSONStream = require('jsonstream')
9
9
const createReadStream = fs . createReadStream
10
10
const readFileSync = fs . readFileSync
11
11
const Fastify = require ( 'fastify' )
12
- const compressPlugin = require ( './index' )
12
+ const compressPlugin = require ( '.. /index' )
13
13
14
14
test ( 'should send a deflated data' , t => {
15
15
t . plan ( 4 )
Original file line number Diff line number Diff line change
1
+ import * as fastify from 'fastify'
2
+ import * as fastifyCompress from '../..'
3
+
4
+ const zlib = require ( 'zlib' )
5
+ const iltorb = require ( 'iltorb' )
6
+
7
+ const app = fastify ( )
8
+
9
+ app . register ( fastifyCompress , {
10
+ global : true ,
11
+ threshold : 10 ,
12
+ brotli : iltorb ,
13
+ zlib : zlib ,
14
+ inflateIfDeflated : true ,
15
+ customTypes : / x - p r o t o b u f $ /
16
+ } )
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "target" : " es6" ,
4
+ "module" : " commonjs" ,
5
+ "noEmit" : true ,
6
+ "strict" : true
7
+ },
8
+ "files" : [" ./index.ts" ]
9
+ }
You can’t perform that action at this time.
0 commit comments