http-proxy-middleware 0.22.0-alpha → 1.0.3
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/CHANGELOG.md +19 -1
- package/README.md +81 -56
- package/dist/handlers.js +1 -8
- package/dist/http-proxy-middleware.d.ts +2 -2
- package/dist/http-proxy-middleware.js +7 -2
- package/dist/index.d.ts +2 -2
- package/dist/types.d.ts +13 -13
- package/package.json +23 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v1.0.3](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.3)
|
|
4
|
+
|
|
5
|
+
- build(package): exclude build artifact tsconfig.tsbuildinfo ([#415](https://github.com/chimurai/http-proxy-middleware/pull/415))
|
|
6
|
+
|
|
7
|
+
## [v1.0.2](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.2)
|
|
8
|
+
|
|
9
|
+
- fix(router): handle rejected promise in custom router ([#410](https://github.com/chimurai/http-proxy-middleware/pull/413)) ([bforbis](https://github.com/bforbis))
|
|
10
|
+
|
|
11
|
+
## [v1.0.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.1)
|
|
12
|
+
|
|
13
|
+
- fix(typescript): fix proxyRes and router types ([#410](https://github.com/chimurai/http-proxy-middleware/issues/410)) ([dylang](https://github.com/dylang))
|
|
14
|
+
|
|
15
|
+
## [v1.0.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.0)
|
|
16
|
+
|
|
17
|
+
- feat(createProxyMiddleware): explicit import http-proxy-middleware ([BREAKING CHANGE](https://github.com/chimurai/http-proxy-middleware/releases))([#400](https://github.com/chimurai/http-proxy-middleware/issues/400#issuecomment-587162378))
|
|
18
|
+
- feat(typescript): export http-proxy-middleware types ([#400](https://github.com/chimurai/http-proxy-middleware/issues/400))
|
|
19
|
+
- fix(typescript): ES6 target - TS1192 ([#400](https://github.com/chimurai/http-proxy-middleware/issues/400#issuecomment-587064349))
|
|
20
|
+
|
|
3
21
|
## [v0.21.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v0.21.0)
|
|
4
22
|
|
|
5
23
|
- feat(http-proxy): bump to v1.18.0
|
|
6
|
-
- feat: async router ([#379](https://github.com/chimurai/http-proxy-middleware/issues/
|
|
24
|
+
- feat: async router ([#379](https://github.com/chimurai/http-proxy-middleware/issues/379)) ([LiranBri](https://github.com/LiranBri))
|
|
7
25
|
- feat(typescript): types support ([#369](https://github.com/chimurai/http-proxy-middleware/pull/369))
|
|
8
26
|
- feat: async pathRewrite ([#397](https://github.com/chimurai/http-proxy-middleware/pull/397)) ([rsethc](https://github.com/rsethc))
|
|
9
27
|
|
package/README.md
CHANGED
|
@@ -10,20 +10,40 @@ Node.js proxying made simple. Configure proxy middleware with ease for [connect]
|
|
|
10
10
|
|
|
11
11
|
Powered by the popular Nodejitsu [`http-proxy`](https://github.com/nodejitsu/node-http-proxy). [](https://github.com/nodejitsu/node-http-proxy)
|
|
12
12
|
|
|
13
|
+
## ⚠️ Note
|
|
14
|
+
|
|
15
|
+
This page is showing documentation for version v1.x.x ([release notes](https://github.com/chimurai/http-proxy-middleware/releases))
|
|
16
|
+
|
|
17
|
+
If you're looking for v0.x documentation. Go to:
|
|
18
|
+
https://github.com/chimurai/http-proxy-middleware/tree/v0.21.0#readme
|
|
19
|
+
|
|
13
20
|
## TL;DR
|
|
14
21
|
|
|
15
22
|
Proxy `/api` requests to `http://www.example.org`
|
|
16
23
|
|
|
17
24
|
```javascript
|
|
18
|
-
|
|
19
|
-
var proxy = require('http-proxy-middleware');
|
|
25
|
+
// javascript
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
const express = require('express');
|
|
28
|
+
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
22
29
|
|
|
23
|
-
app
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
);
|
|
30
|
+
const app = express();
|
|
31
|
+
|
|
32
|
+
app.use('/api', createProxyMiddleware({ target: 'http://www.example.org', changeOrigin: true }));
|
|
33
|
+
app.listen(3000);
|
|
34
|
+
|
|
35
|
+
// http://localhost:3000/api/foo/bar -> http://www.example.org/api/foo/bar
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// typescript
|
|
40
|
+
|
|
41
|
+
import * as express from 'express';
|
|
42
|
+
import { createProxyMiddleware, Filter, Options, RequestHandler } from 'http-proxy-middleware';
|
|
43
|
+
|
|
44
|
+
const app = express();
|
|
45
|
+
|
|
46
|
+
app.use('/api', createProxyMiddleware({ target: 'http://www.example.org', changeOrigin: true }));
|
|
27
47
|
app.listen(3000);
|
|
28
48
|
|
|
29
49
|
// http://localhost:3000/api/foo/bar -> http://www.example.org/api/foo/bar
|
|
@@ -68,15 +88,15 @@ $ npm install --save-dev http-proxy-middleware
|
|
|
68
88
|
|
|
69
89
|
Proxy middleware configuration.
|
|
70
90
|
|
|
71
|
-
####
|
|
91
|
+
#### createProxyMiddleware([context,] config)
|
|
72
92
|
|
|
73
93
|
```javascript
|
|
74
|
-
|
|
94
|
+
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
75
95
|
|
|
76
|
-
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
96
|
+
const apiProxy = createProxyMiddleware('/api', { target: 'http://www.example.org' });
|
|
97
|
+
// \____/ \_____________________________/
|
|
98
|
+
// | |
|
|
99
|
+
// context options
|
|
80
100
|
|
|
81
101
|
// 'apiProxy' is now ready to be used as middleware in a server.
|
|
82
102
|
```
|
|
@@ -87,11 +107,11 @@ var apiProxy = proxy('/api', { target: 'http://www.example.org' });
|
|
|
87
107
|
|
|
88
108
|
(full list of [`http-proxy-middleware` configuration options](#options))
|
|
89
109
|
|
|
90
|
-
####
|
|
110
|
+
#### createProxyMiddleware(uri [, config])
|
|
91
111
|
|
|
92
112
|
```javascript
|
|
93
113
|
// shorthand syntax for the example above:
|
|
94
|
-
|
|
114
|
+
const apiProxy = createProxyMiddleware('http://www.example.org/api');
|
|
95
115
|
```
|
|
96
116
|
|
|
97
117
|
More about the [shorthand configuration](#shorthand).
|
|
@@ -102,11 +122,11 @@ An example with `express` server.
|
|
|
102
122
|
|
|
103
123
|
```javascript
|
|
104
124
|
// include dependencies
|
|
105
|
-
|
|
106
|
-
|
|
125
|
+
const express = require('express');
|
|
126
|
+
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
107
127
|
|
|
108
128
|
// proxy middleware options
|
|
109
|
-
|
|
129
|
+
const options = {
|
|
110
130
|
target: 'http://www.example.org', // target host
|
|
111
131
|
changeOrigin: true, // needed for virtual hosted sites
|
|
112
132
|
ws: true, // proxy websockets
|
|
@@ -122,10 +142,10 @@ var options = {
|
|
|
122
142
|
};
|
|
123
143
|
|
|
124
144
|
// create the proxy (without context)
|
|
125
|
-
|
|
145
|
+
const exampleProxy = createProxyMiddleware(options);
|
|
126
146
|
|
|
127
147
|
// mount `exampleProxy` in web server
|
|
128
|
-
|
|
148
|
+
const app = express();
|
|
129
149
|
app.use('/api', exampleProxy);
|
|
130
150
|
app.listen(3000);
|
|
131
151
|
```
|
|
@@ -145,24 +165,24 @@ Providing an alternative way to decide which requests should be proxied; In case
|
|
|
145
165
|
|
|
146
166
|
- **path matching**
|
|
147
167
|
|
|
148
|
-
- `
|
|
149
|
-
- `
|
|
150
|
-
- `
|
|
168
|
+
- `createProxyMiddleware({...})` - matches any path, all requests will be proxied.
|
|
169
|
+
- `createProxyMiddleware('/', {...})` - matches any path, all requests will be proxied.
|
|
170
|
+
- `createProxyMiddleware('/api', {...})` - matches paths starting with `/api`
|
|
151
171
|
|
|
152
172
|
- **multiple path matching**
|
|
153
173
|
|
|
154
|
-
- `
|
|
174
|
+
- `createProxyMiddleware(['/api', '/ajax', '/someotherpath'], {...})`
|
|
155
175
|
|
|
156
176
|
- **wildcard path matching**
|
|
157
177
|
|
|
158
178
|
For fine-grained control you can use wildcard matching. Glob pattern matching is done by _micromatch_. Visit [micromatch](https://www.npmjs.com/package/micromatch) or [glob](https://www.npmjs.com/package/glob) for more globbing examples.
|
|
159
179
|
|
|
160
|
-
- `
|
|
161
|
-
- `
|
|
162
|
-
- `
|
|
163
|
-
- `
|
|
164
|
-
- `
|
|
165
|
-
- `
|
|
180
|
+
- `createProxyMiddleware('**', {...})` matches any path, all requests will be proxied.
|
|
181
|
+
- `createProxyMiddleware('**/*.html', {...})` matches any path which ends with `.html`
|
|
182
|
+
- `createProxyMiddleware('/*.html', {...})` matches paths directly under path-absolute
|
|
183
|
+
- `createProxyMiddleware('/api/**/*.html', {...})` matches requests ending with `.html` in the path of `/api`
|
|
184
|
+
- `createProxyMiddleware(['/api/**', '/ajax/**'], {...})` combine multiple patterns
|
|
185
|
+
- `createProxyMiddleware(['/api/**', '!**/bad.json'], {...})` exclusion
|
|
166
186
|
|
|
167
187
|
**Note**: In multiple path matching, you cannot use string paths and wildcard paths together.
|
|
168
188
|
|
|
@@ -174,11 +194,13 @@ Providing an alternative way to decide which requests should be proxied; In case
|
|
|
174
194
|
/**
|
|
175
195
|
* @return {Boolean}
|
|
176
196
|
*/
|
|
177
|
-
|
|
197
|
+
const filter = function(pathname, req) {
|
|
178
198
|
return pathname.match('^/api') && req.method === 'GET';
|
|
179
199
|
};
|
|
180
200
|
|
|
181
|
-
|
|
201
|
+
const apiProxy = createProxyMiddleware(filter, {
|
|
202
|
+
target: 'http://www.example.org'
|
|
203
|
+
});
|
|
182
204
|
```
|
|
183
205
|
|
|
184
206
|
## Options
|
|
@@ -202,11 +224,10 @@ Providing an alternative way to decide which requests should be proxied; In case
|
|
|
202
224
|
|
|
203
225
|
// custom rewriting, returning Promise
|
|
204
226
|
pathRewrite: async function (path, req) {
|
|
205
|
-
|
|
227
|
+
const should_add_something = await httpRequestToDecideSomething(path);
|
|
206
228
|
if (should_add_something) path += "something";
|
|
207
229
|
return path;
|
|
208
230
|
}
|
|
209
|
-
|
|
210
231
|
```
|
|
211
232
|
|
|
212
233
|
- **option.router**: object/function, re-target `option.target` for specific requests.
|
|
@@ -221,11 +242,20 @@ Providing an alternative way to decide which requests should be proxied; In case
|
|
|
221
242
|
'/rest' : 'http://localhost:8004' // path only
|
|
222
243
|
}
|
|
223
244
|
|
|
224
|
-
// Custom router function
|
|
245
|
+
// Custom router function (string target)
|
|
225
246
|
router: function(req) {
|
|
226
247
|
return 'http://localhost:8004';
|
|
227
248
|
}
|
|
228
249
|
|
|
250
|
+
// Custom router function (target object)
|
|
251
|
+
router: function(req) {
|
|
252
|
+
return {
|
|
253
|
+
protocol: 'https:', // The : is required
|
|
254
|
+
host: 'localhost',
|
|
255
|
+
port: 8004
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
229
259
|
// Asynchronous router function which returns promise
|
|
230
260
|
router: async function(req) {
|
|
231
261
|
const url = await doSomeIO();
|
|
@@ -248,9 +278,9 @@ Providing an alternative way to decide which requests should be proxied; In case
|
|
|
248
278
|
```javascript
|
|
249
279
|
// verbose replacement
|
|
250
280
|
function logProvider(provider) {
|
|
251
|
-
|
|
281
|
+
const logger = new (require('winston').Logger)();
|
|
252
282
|
|
|
253
|
-
|
|
283
|
+
const myCustomProvider = {
|
|
254
284
|
log: logger.log,
|
|
255
285
|
debug: logger.debug,
|
|
256
286
|
info: logger.info,
|
|
@@ -272,9 +302,7 @@ Subscribe to [http-proxy events](https://github.com/nodejitsu/node-http-proxy#li
|
|
|
272
302
|
res.writeHead(500, {
|
|
273
303
|
'Content-Type': 'text/plain'
|
|
274
304
|
});
|
|
275
|
-
res.end(
|
|
276
|
-
'Something went wrong. And we are reporting a custom error message.'
|
|
277
|
-
);
|
|
305
|
+
res.end('Something went wrong. And we are reporting a custom error message.');
|
|
278
306
|
}
|
|
279
307
|
```
|
|
280
308
|
|
|
@@ -401,14 +429,14 @@ The following options are provided by the underlying [http-proxy](https://github
|
|
|
401
429
|
Use the shorthand syntax when verbose configuration is not needed. The `context` and `option.target` will be automatically configured when shorthand is used. Options can still be used if needed.
|
|
402
430
|
|
|
403
431
|
```javascript
|
|
404
|
-
|
|
405
|
-
//
|
|
432
|
+
createProxyMiddleware('http://www.example.org:8000/api');
|
|
433
|
+
// createProxyMiddleware('/api', {target: 'http://www.example.org:8000'});
|
|
406
434
|
|
|
407
|
-
|
|
408
|
-
//
|
|
435
|
+
createProxyMiddleware('http://www.example.org:8000/api/books/*/**.json');
|
|
436
|
+
// createProxyMiddleware('/api/books/*/**.json', {target: 'http://www.example.org:8000'});
|
|
409
437
|
|
|
410
|
-
|
|
411
|
-
//
|
|
438
|
+
createProxyMiddleware('http://www.example.org:8000/api', { changeOrigin: true });
|
|
439
|
+
// createProxyMiddleware('/api', {target: 'http://www.example.org:8000', changeOrigin: true});
|
|
412
440
|
```
|
|
413
441
|
|
|
414
442
|
### app.use(path, proxy)
|
|
@@ -417,10 +445,7 @@ If you want to use the server's `app.use` `path` parameter to match requests;
|
|
|
417
445
|
Create and mount the proxy without the http-proxy-middleware `context` parameter:
|
|
418
446
|
|
|
419
447
|
```javascript
|
|
420
|
-
app.use(
|
|
421
|
-
'/api',
|
|
422
|
-
proxy({ target: 'http://www.example.org', changeOrigin: true })
|
|
423
|
-
);
|
|
448
|
+
app.use('/api', createProxyMiddleware({ target: 'http://www.example.org', changeOrigin: true }));
|
|
424
449
|
```
|
|
425
450
|
|
|
426
451
|
`app.use` documentation:
|
|
@@ -433,13 +458,13 @@ app.use(
|
|
|
433
458
|
|
|
434
459
|
```javascript
|
|
435
460
|
// verbose api
|
|
436
|
-
|
|
461
|
+
createProxyMiddleware('/', { target: 'http://echo.websocket.org', ws: true });
|
|
437
462
|
|
|
438
463
|
// shorthand
|
|
439
|
-
|
|
464
|
+
createProxyMiddleware('http://echo.websocket.org', { ws: true });
|
|
440
465
|
|
|
441
466
|
// shorter shorthand
|
|
442
|
-
|
|
467
|
+
createProxyMiddleware('ws://echo.websocket.org');
|
|
443
468
|
```
|
|
444
469
|
|
|
445
470
|
### External WebSocket upgrade
|
|
@@ -447,12 +472,12 @@ proxy('ws://echo.websocket.org');
|
|
|
447
472
|
In the previous WebSocket examples, http-proxy-middleware relies on a initial http request in order to listen to the http `upgrade` event. If you need to proxy WebSockets without the initial http request, you can subscribe to the server's http `upgrade` event manually.
|
|
448
473
|
|
|
449
474
|
```javascript
|
|
450
|
-
|
|
475
|
+
const wsProxy = createProxyMiddleware('ws://echo.websocket.org', { changeOrigin: true });
|
|
451
476
|
|
|
452
|
-
|
|
477
|
+
const app = express();
|
|
453
478
|
app.use(wsProxy);
|
|
454
479
|
|
|
455
|
-
|
|
480
|
+
const server = app.listen(3000);
|
|
456
481
|
server.on('upgrade', wsProxy.upgrade); // <-- subscribe to http 'upgrade'
|
|
457
482
|
```
|
|
458
483
|
|
package/dist/handlers.js
CHANGED
|
@@ -13,14 +13,7 @@ function init(proxy, option) {
|
|
|
13
13
|
exports.init = init;
|
|
14
14
|
function getHandlers(options) {
|
|
15
15
|
// https://github.com/nodejitsu/node-http-proxy#listening-for-proxy-events
|
|
16
|
-
const proxyEvents = [
|
|
17
|
-
'error',
|
|
18
|
-
'proxyReq',
|
|
19
|
-
'proxyReqWs',
|
|
20
|
-
'proxyRes',
|
|
21
|
-
'open',
|
|
22
|
-
'close'
|
|
23
|
-
];
|
|
16
|
+
const proxyEvents = ['error', 'proxyReq', 'proxyReqWs', 'proxyRes', 'open', 'close'];
|
|
24
17
|
const handlers = {};
|
|
25
18
|
for (const event of proxyEvents) {
|
|
26
19
|
// all handlers for the http-proxy events are prefixed with 'on'.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Filter,
|
|
1
|
+
import { Filter, RequestHandler, Options } from './types';
|
|
2
2
|
export declare class HttpProxyMiddleware {
|
|
3
3
|
private logger;
|
|
4
4
|
private config;
|
|
@@ -7,7 +7,7 @@ export declare class HttpProxyMiddleware {
|
|
|
7
7
|
private proxy;
|
|
8
8
|
private pathRewriter;
|
|
9
9
|
constructor(context: Filter | Options, opts?: Options);
|
|
10
|
-
middleware:
|
|
10
|
+
middleware: RequestHandler;
|
|
11
11
|
private catchUpgradeRequest;
|
|
12
12
|
private handleUpgrade;
|
|
13
13
|
/**
|
|
@@ -24,8 +24,13 @@ class HttpProxyMiddleware {
|
|
|
24
24
|
// https://github.com/Microsoft/TypeScript/wiki/'this'-in-TypeScript#red-flags-for-this
|
|
25
25
|
this.middleware = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
if (this.shouldProxy(this.config.context, req)) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
try {
|
|
28
|
+
const activeProxyOptions = yield this.prepareProxyRequest(req);
|
|
29
|
+
this.proxy.web(req, res, activeProxyOptions);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
next(err);
|
|
33
|
+
}
|
|
29
34
|
}
|
|
30
35
|
else {
|
|
31
36
|
next();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Filter, Options } from './types';
|
|
2
|
-
export declare function createProxyMiddleware(context: Filter | Options, options?: Options): import("./types").
|
|
3
|
-
export { Options } from './types';
|
|
2
|
+
export declare function createProxyMiddleware(context: Filter | Options, options?: Options): import("./types").RequestHandler;
|
|
3
|
+
export { Filter, Options, RequestHandler } from './types';
|
package/dist/types.d.ts
CHANGED
|
@@ -3,29 +3,29 @@ import * as express from 'express';
|
|
|
3
3
|
import * as http from 'http';
|
|
4
4
|
import * as httpProxy from 'http-proxy';
|
|
5
5
|
import * as net from 'net';
|
|
6
|
-
export interface
|
|
6
|
+
export interface Request extends express.Request {
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface Response extends express.Response {
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
11
|
-
upgrade?: (req:
|
|
10
|
+
export interface RequestHandler extends express.RequestHandler {
|
|
11
|
+
upgrade?: (req: Request, socket: net.Socket, head: any) => void;
|
|
12
12
|
}
|
|
13
|
-
export declare type Filter = string | string[] | ((pathname: string, req:
|
|
13
|
+
export declare type Filter = string | string[] | ((pathname: string, req: Request) => boolean);
|
|
14
14
|
export interface Options extends httpProxy.ServerOptions {
|
|
15
15
|
pathRewrite?: {
|
|
16
16
|
[regexp: string]: string;
|
|
17
|
-
} | ((path: string, req:
|
|
17
|
+
} | ((path: string, req: Request) => string) | ((path: string, req: Request) => Promise<string>);
|
|
18
18
|
router?: {
|
|
19
|
-
[hostOrPath: string]:
|
|
20
|
-
} | ((req:
|
|
19
|
+
[hostOrPath: string]: httpProxy.ServerOptions['target'];
|
|
20
|
+
} | ((req: Request) => httpProxy.ServerOptions['target']) | ((req: Request) => Promise<httpProxy.ServerOptions['target']>);
|
|
21
21
|
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
22
22
|
logProvider?(provider: LogProvider): LogProvider;
|
|
23
|
-
onError?(err: Error, req:
|
|
24
|
-
onProxyRes?(proxyRes: http.
|
|
25
|
-
onProxyReq?(proxyReq: http.ClientRequest, req:
|
|
26
|
-
onProxyReqWs?(proxyReq: http.ClientRequest, req:
|
|
23
|
+
onError?(err: Error, req: Request, res: Response): void;
|
|
24
|
+
onProxyRes?(proxyRes: http.IncomingMessage, req: Request, res: Response): void;
|
|
25
|
+
onProxyReq?(proxyReq: http.ClientRequest, req: Request, res: Response): void;
|
|
26
|
+
onProxyReqWs?(proxyReq: http.ClientRequest, req: Request, socket: net.Socket, options: httpProxy.ServerOptions, head: any): void;
|
|
27
27
|
onOpen?(proxySocket: net.Socket): void;
|
|
28
|
-
onClose?(res:
|
|
28
|
+
onClose?(res: Response, socket: net.Socket, head: any): void;
|
|
29
29
|
}
|
|
30
30
|
interface LogProvider {
|
|
31
31
|
log: Logger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "http-proxy-middleware",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "The one-liner node.js proxy middleware for connect, express and browser-sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"lint:fix": "prettier --write \"**/*.{js,ts,md}\"",
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"pretest": "yarn build",
|
|
18
|
-
"test": "jest
|
|
18
|
+
"test": "jest",
|
|
19
19
|
"precover": "yarn clean && yarn build",
|
|
20
|
-
"cover": "jest --
|
|
20
|
+
"cover": "jest --coverage",
|
|
21
21
|
"precoveralls": "yarn clean && yarn build",
|
|
22
|
-
"coveralls": "jest --
|
|
22
|
+
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
|
|
23
23
|
"postcoveralls": "yarn clean",
|
|
24
|
-
"prepare": "yarn clean && yarn build"
|
|
24
|
+
"prepare": "yarn clean && yarn build && rm dist/tsconfig.tsbuildinfo"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
@@ -48,29 +48,33 @@
|
|
|
48
48
|
"bugs": {
|
|
49
49
|
"url": "https://github.com/chimurai/http-proxy-middleware/issues"
|
|
50
50
|
},
|
|
51
|
-
"homepage": "https://github.com/chimurai/http-proxy-middleware",
|
|
51
|
+
"homepage": "https://github.com/chimurai/http-proxy-middleware#readme",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@commitlint/cli": "^8.
|
|
54
|
-
"@commitlint/config-conventional": "^8.
|
|
55
|
-
"@types/express": "^4.17.
|
|
56
|
-
"@types/is-glob": "^4.0.
|
|
57
|
-
"@types/jest": "^25.1.
|
|
53
|
+
"@commitlint/cli": "^8.3.5",
|
|
54
|
+
"@commitlint/config-conventional": "^8.3.4",
|
|
55
|
+
"@types/express": "^4.17.2",
|
|
56
|
+
"@types/is-glob": "^4.0.1",
|
|
57
|
+
"@types/jest": "^25.1.3",
|
|
58
58
|
"@types/lodash": "^4.14.149",
|
|
59
59
|
"@types/micromatch": "^4.0.1",
|
|
60
|
-
"@types/node": "^
|
|
60
|
+
"@types/node": "^13.7.4",
|
|
61
|
+
"@types/supertest": "^2.0.8",
|
|
61
62
|
"browser-sync": "^2.26.7",
|
|
62
|
-
"connect": "^3.
|
|
63
|
+
"connect": "^3.7.0",
|
|
63
64
|
"coveralls": "^3.0.5",
|
|
64
|
-
"express": "^4.
|
|
65
|
-
"husky": "^
|
|
65
|
+
"express": "^4.17.1",
|
|
66
|
+
"husky": "^4.2.3",
|
|
66
67
|
"jest": "^25.1.0",
|
|
68
|
+
"lint-staged": "^10.0.7",
|
|
69
|
+
"mockttp": "^0.19.3",
|
|
67
70
|
"open": "^7.0.2",
|
|
68
71
|
"prettier": "^1.19.1",
|
|
72
|
+
"supertest": "^4.0.2",
|
|
69
73
|
"ts-jest": "^25.2.0",
|
|
70
74
|
"tslint": "^6.0.0",
|
|
71
75
|
"tslint-config-prettier": "^1.18.0",
|
|
72
|
-
"typescript": "^3.
|
|
73
|
-
"ws": "^7.1
|
|
76
|
+
"typescript": "^3.8.2",
|
|
77
|
+
"ws": "^7.2.1"
|
|
74
78
|
},
|
|
75
79
|
"dependencies": {
|
|
76
80
|
"@types/http-proxy": "^1.17.3",
|
|
@@ -84,7 +88,8 @@
|
|
|
84
88
|
},
|
|
85
89
|
"husky": {
|
|
86
90
|
"hooks": {
|
|
87
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
91
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
92
|
+
"pre-commit": "lint-staged"
|
|
88
93
|
}
|
|
89
94
|
},
|
|
90
95
|
"commitlint": {
|