@remix-run/compression-middleware 0.1.7 → 0.1.9
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/README.md +18 -18
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ npm i remix
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
20
|
```ts
|
|
21
|
-
import { createRouter } from 'remix/
|
|
22
|
-
import { compression } from 'remix/compression
|
|
21
|
+
import { createRouter } from 'remix/router'
|
|
22
|
+
import { compression } from 'remix/middleware/compression'
|
|
23
23
|
|
|
24
24
|
let router = createRouter({
|
|
25
25
|
middleware: [compression()],
|
|
@@ -40,8 +40,8 @@ The middleware will automatically compress responses for compressible MIME types
|
|
|
40
40
|
Set the minimum response size in bytes to compress:
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
|
-
import { createRouter } from 'remix/
|
|
44
|
-
import { compression } from 'remix/compression
|
|
43
|
+
import { createRouter } from 'remix/router'
|
|
44
|
+
import { compression } from 'remix/middleware/compression'
|
|
45
45
|
|
|
46
46
|
let router = createRouter({
|
|
47
47
|
middleware: [
|
|
@@ -59,8 +59,8 @@ let router = createRouter({
|
|
|
59
59
|
Customize which compression algorithms to support:
|
|
60
60
|
|
|
61
61
|
```ts
|
|
62
|
-
import { createRouter } from 'remix/
|
|
63
|
-
import { compression } from 'remix/compression
|
|
62
|
+
import { createRouter } from 'remix/router'
|
|
63
|
+
import { compression } from 'remix/middleware/compression'
|
|
64
64
|
|
|
65
65
|
let router = createRouter({
|
|
66
66
|
middleware: [
|
|
@@ -74,8 +74,8 @@ let router = createRouter({
|
|
|
74
74
|
The `encodings` option can also be a function that receives the response:
|
|
75
75
|
|
|
76
76
|
```ts
|
|
77
|
-
import { createRouter } from 'remix/
|
|
78
|
-
import { compression } from 'remix/compression
|
|
77
|
+
import { createRouter } from 'remix/router'
|
|
78
|
+
import { compression } from 'remix/middleware/compression'
|
|
79
79
|
|
|
80
80
|
let router = createRouter({
|
|
81
81
|
middleware: [
|
|
@@ -94,13 +94,13 @@ let router = createRouter({
|
|
|
94
94
|
|
|
95
95
|
### Filter Media Type
|
|
96
96
|
|
|
97
|
-
**Default:** Uses `isCompressibleMimeType()` from [
|
|
97
|
+
**Default:** Uses `isCompressibleMimeType()` from [`remix/mime`](https://github.com/remix-run/remix/tree/main/packages/mime)
|
|
98
98
|
|
|
99
99
|
You can customize this behavior with the `filterMediaType` option:
|
|
100
100
|
|
|
101
101
|
```ts
|
|
102
|
-
import { createRouter } from 'remix/
|
|
103
|
-
import { compression } from 'remix/compression
|
|
102
|
+
import { createRouter } from 'remix/router'
|
|
103
|
+
import { compression } from 'remix/middleware/compression'
|
|
104
104
|
import { isCompressibleMimeType } from 'remix/mime'
|
|
105
105
|
|
|
106
106
|
let router = createRouter({
|
|
@@ -122,8 +122,8 @@ let router = createRouter({
|
|
|
122
122
|
You can pass options options to the underlying Node.js `zlib` and `brotli` compressors for fine-grained control:
|
|
123
123
|
|
|
124
124
|
```ts
|
|
125
|
-
import { createRouter } from 'remix/
|
|
126
|
-
import { compression } from 'remix/compression
|
|
125
|
+
import { createRouter } from 'remix/router'
|
|
126
|
+
import { compression } from 'remix/middleware/compression'
|
|
127
127
|
import { zlib } from 'node:zlib'
|
|
128
128
|
|
|
129
129
|
let router = createRouter({
|
|
@@ -146,8 +146,8 @@ Like `encodings`, both `zlib` and `brotli` options can also be functions that re
|
|
|
146
146
|
|
|
147
147
|
```ts
|
|
148
148
|
import zlib from 'node:zlib'
|
|
149
|
-
import { createRouter } from 'remix/
|
|
150
|
-
import { compression } from 'remix/compression
|
|
149
|
+
import { createRouter } from 'remix/router'
|
|
150
|
+
import { compression } from 'remix/middleware/compression'
|
|
151
151
|
|
|
152
152
|
let router = createRouter({
|
|
153
153
|
middleware: [
|
|
@@ -167,9 +167,9 @@ let router = createRouter({
|
|
|
167
167
|
|
|
168
168
|
## Related Packages
|
|
169
169
|
|
|
170
|
-
- [
|
|
171
|
-
- [
|
|
172
|
-
- [
|
|
170
|
+
- [`remix/router`](https://github.com/remix-run/remix/tree/main/packages/fetch-router) - Router for the web Fetch API
|
|
171
|
+
- [`remix/mime`](https://github.com/remix-run/remix/tree/main/packages/mime) - MIME type utilities
|
|
172
|
+
- [`remix/response`](https://github.com/remix-run/remix/tree/main/packages/response) - Response helpers
|
|
173
173
|
|
|
174
174
|
## License
|
|
175
175
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix-run/compression-middleware",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Middleware for compressing HTTP responses",
|
|
5
5
|
"author": "Michael Jackson <mjijackson@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^24.6.0",
|
|
30
30
|
"@typescript/native-preview": "7.0.0-dev.20251125.1",
|
|
31
|
-
"@remix-run/
|
|
32
|
-
"@remix-run/
|
|
33
|
-
"@remix-run/response": "0.3.3",
|
|
31
|
+
"@remix-run/assert": "0.2.1",
|
|
32
|
+
"@remix-run/fetch-router": "0.19.1",
|
|
34
33
|
"@remix-run/mime": "0.4.1",
|
|
35
|
-
"@remix-run/
|
|
34
|
+
"@remix-run/response": "0.3.5",
|
|
35
|
+
"@remix-run/test": "0.4.1"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@remix-run/fetch-router": "^0.
|
|
39
|
-
"@remix-run/
|
|
40
|
-
"@remix-run/
|
|
38
|
+
"@remix-run/fetch-router": "^0.19.1",
|
|
39
|
+
"@remix-run/response": "^0.3.5",
|
|
40
|
+
"@remix-run/mime": "^0.4.1"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"fetch",
|