@fastify/compress 8.0.0-pre.fv5.1 → 8.0.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/.c8rc +14 -0
- package/.github/workflows/ci.yml +1 -1
- package/index.js +6 -6
- package/package.json +8 -8
- package/test/global-compress.test.js +493 -492
- package/test/global-decompress.test.js +70 -60
- package/test/regression/issue-288.test.js +4 -4
- package/test/routes-compress.test.js +80 -72
- package/test/routes-decompress.test.js +45 -41
- package/test/utils.test.js +52 -48
- package/.taprc +0 -3
package/.c8rc
ADDED
package/.github/workflows/ci.yml
CHANGED
package/index.js
CHANGED
|
@@ -118,7 +118,7 @@ const recommendedDefaultBrotliOptions = {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
function processCompressParams (opts) {
|
|
121
|
-
/*
|
|
121
|
+
/* c8 ignore next 3 */
|
|
122
122
|
if (!opts) {
|
|
123
123
|
return
|
|
124
124
|
}
|
|
@@ -148,7 +148,7 @@ function processCompressParams (opts) {
|
|
|
148
148
|
params.uncompressStream = {
|
|
149
149
|
// Currently params.uncompressStream.br() is never called as we do not have any way to autodetect brotli compression in `fastify-compress`
|
|
150
150
|
// Brotli documentation reference: [RFC 7932](https://www.rfc-editor.org/rfc/rfc7932)
|
|
151
|
-
br: /*
|
|
151
|
+
br: /* c8 ignore next */ () => ((opts.zlib || zlib).createBrotliDecompress || zlib.createBrotliDecompress)(params.brotliOptions),
|
|
152
152
|
gzip: () => ((opts.zlib || zlib).createGunzip || zlib.createGunzip)(params.zlibOptions),
|
|
153
153
|
deflate: () => ((opts.zlib || zlib).createInflate || zlib.createInflate)(params.zlibOptions)
|
|
154
154
|
}
|
|
@@ -165,7 +165,7 @@ function processCompressParams (opts) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
function processDecompressParams (opts) {
|
|
168
|
-
/*
|
|
168
|
+
/* c8 ignore next 3 */
|
|
169
169
|
if (!opts) {
|
|
170
170
|
return
|
|
171
171
|
}
|
|
@@ -525,8 +525,8 @@ function zipStream (deflate, encoding) {
|
|
|
525
525
|
function unzipStream (inflate, maxRecursion) {
|
|
526
526
|
if (!(maxRecursion >= 0)) maxRecursion = 3
|
|
527
527
|
return peek({ newline: false, maxBuffer: 10 }, function (data, swap) {
|
|
528
|
-
/* istanbul ignore if */
|
|
529
528
|
// This path is never taken, when `maxRecursion` < 0 it is automatically set back to 3
|
|
529
|
+
/* c8 ignore next */
|
|
530
530
|
if (maxRecursion < 0) return swap(new Error('Maximum recursion reached'))
|
|
531
531
|
switch (isCompressed(data)) {
|
|
532
532
|
case 1: return swap(null, pumpify(inflate.gzip(), unzipStream(inflate, maxRecursion - 1)))
|
|
@@ -555,7 +555,7 @@ function createError (code, message, statusCode) {
|
|
|
555
555
|
|
|
556
556
|
FastifyCompressError.prototype[Symbol.toStringTag] = 'Error'
|
|
557
557
|
|
|
558
|
-
/*
|
|
558
|
+
/* c8 ignore next 3 */
|
|
559
559
|
FastifyCompressError.prototype.toString = function () {
|
|
560
560
|
return `${this.name} [${this.code}]: ${this.message}`
|
|
561
561
|
}
|
|
@@ -566,7 +566,7 @@ function createError (code, message, statusCode) {
|
|
|
566
566
|
}
|
|
567
567
|
|
|
568
568
|
module.exports = fp(fastifyCompress, {
|
|
569
|
-
fastify: '
|
|
569
|
+
fastify: '5.x',
|
|
570
570
|
name: '@fastify/compress'
|
|
571
571
|
})
|
|
572
572
|
module.exports.default = fastifyCompress
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastify/compress",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Fastify compression utils",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@fastify/accept-negotiator": "^
|
|
10
|
-
"fastify-plugin": "^
|
|
9
|
+
"@fastify/accept-negotiator": "^2.0.0",
|
|
10
|
+
"fastify-plugin": "^5.0.0",
|
|
11
11
|
"mime-db": "^1.52.0",
|
|
12
12
|
"minipass": "^7.0.4",
|
|
13
13
|
"peek-stream": "^1.1.3",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@fastify/pre-commit": "^2.1.0",
|
|
20
|
-
"@types/node": "^
|
|
20
|
+
"@types/node": "^22.0.0",
|
|
21
21
|
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
22
22
|
"@typescript-eslint/parser": "^7.6.0",
|
|
23
23
|
"adm-zip": "^0.5.12",
|
|
24
|
-
"
|
|
24
|
+
"c8": "^10.1.2",
|
|
25
|
+
"fastify": "^5.0.0-alpha.4",
|
|
25
26
|
"jsonstream": "^1.0.3",
|
|
26
27
|
"standard": "^17.1.0",
|
|
27
|
-
"tap": "^18.7.2",
|
|
28
28
|
"tsd": "^0.31.0",
|
|
29
29
|
"typescript": "^5.4.5"
|
|
30
30
|
},
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"lint:fix:typescript": "npm run lint:fix -- --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin \"**/*.d.ts\"",
|
|
35
35
|
"test": "npm run test:unit && npm run test:typescript",
|
|
36
36
|
"test:typescript": "tsd",
|
|
37
|
-
"test:unit": "
|
|
38
|
-
"test:coverage": "
|
|
37
|
+
"test:unit": "node --test",
|
|
38
|
+
"test:coverage": "c8 node --test && c8 report --reporter=html",
|
|
39
39
|
"test:unit:verbose": "npm run test:unit -- -Rspec"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|