http-proxy-middleware 3.0.0-beta.0 → 3.0.0-beta.1

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 CHANGED
@@ -1,13 +1,13 @@
1
1
  # http-proxy-middleware
2
2
 
3
- [![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/chimurai/http-proxy-middleware/CI/master?style=flat-square)](https://github.com/chimurai/http-proxy-middleware/actions?query=branch%3Amaster)
4
- [![Coveralls](https://img.shields.io/coveralls/chimurai/http-proxy-middleware.svg?style=flat-square)](https://coveralls.io/r/chimurai/http-proxy-middleware)
5
- [![dependency Status](https://snyk.io/test/npm/http-proxy-middleware/badge.svg?style=flat-square)](https://snyk.io/test/npm/http-proxy-middleware)
6
- [![npm](https://img.shields.io/npm/v/http-proxy-middleware?color=%23CC3534&style=flat-square)](https://www.npmjs.com/package/http-proxy-middleware)
3
+ [![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/chimurai/http-proxy-middleware/ci.yml?branch=master&logo=github-actions&logoColor=white&style=flat-square)](https://github.com/chimurai/http-proxy-middleware/actions/workflows/ci.yml?query=branch%3Amaster)
4
+ [![Coveralls](https://img.shields.io/coveralls/chimurai/http-proxy-middleware.svg?style=flat-square&logo=coveralls)](https://coveralls.io/r/chimurai/http-proxy-middleware)
5
+ [![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/chimurai/http-proxy-middleware?logo=snyk&style=flat-square)](https://security.snyk.io/package/npm/http-proxy-middleware)
6
+ [![npm](https://img.shields.io/npm/v/http-proxy-middleware?color=%23CC3534&style=flat-square&logo=npm)](https://www.npmjs.com/package/http-proxy-middleware)
7
7
 
8
8
  Node.js proxying made simple. Configure proxy middleware with ease for [connect](https://github.com/senchalabs/connect), [express](https://github.com/expressjs/express), [next.js](https://github.com/vercel/next.js) and [many more](#compatible-servers).
9
9
 
10
- Powered by the popular Nodejitsu [`http-proxy`](https://github.com/nodejitsu/node-http-proxy). [![GitHub stars](https://img.shields.io/github/stars/nodejitsu/node-http-proxy.svg?style=social&label=Star)](https://github.com/nodejitsu/node-http-proxy)
10
+ Powered by the popular Nodejitsu [`http-proxy`](https://github.com/http-party/node-http-proxy). [![GitHub stars](https://img.shields.io/github/stars/http-party/node-http-proxy.svg?style=social&label=Star)](https://github.com/http-party/node-http-proxy)
11
11
 
12
12
  ## ⚠️ Note <!-- omit in toc -->
13
13
 
@@ -45,7 +45,7 @@ app.use(
45
45
  app.listen(3000);
46
46
 
47
47
  // proxy and change the base path from "/api" to "/secret"
48
- // http://localhost:3000/api/foo/bar -> http://www.example.org/secret/foo/bar
48
+ // http://127.0.0.1:3000/api/foo/bar -> http://www.example.org/secret/foo/bar
49
49
  ```
50
50
 
51
51
  ```typescript
@@ -67,7 +67,7 @@ app.use(
67
67
  app.listen(3000);
68
68
 
69
69
  // proxy and keep the same base path "/api"
70
- // http://localhost:3000/api/foo/bar -> http://www.example.org/api/foo/bar
70
+ // http://127.0.0.1:3000/api/foo/bar -> http://www.example.org/api/foo/bar
71
71
  ```
72
72
 
73
73
  _All_ `http-proxy` [options](https://github.com/nodejitsu/node-http-proxy#options) can be used, along with some extra `http-proxy-middleware` [options](#options).
@@ -81,7 +81,7 @@ _All_ `http-proxy` [options](https://github.com/nodejitsu/node-http-proxy#option
81
81
  - [Express Server Example](#express-server-example)
82
82
  - [app.use(path, proxy)](#appusepath-proxy)
83
83
  - [Options](#options)
84
- - [`pathFilter` (string, []string, glob, []glob, function)](#pathfilter-string-string-glob-glob-function)
84
+ - [`pathFilter` (string, \[\]string, glob, \[\]glob, function)](#pathfilter-string-string-glob-glob-function)
85
85
  - [`pathRewrite` (object/function)](#pathrewrite-objectfunction)
86
86
  - [`router` (object/function)](#router-objectfunction)
87
87
  - [`plugins` (Array)](#plugins-array)
@@ -93,6 +93,7 @@ _All_ `http-proxy` [options](https://github.com/nodejitsu/node-http-proxy#option
93
93
  - [External WebSocket upgrade](#external-websocket-upgrade)
94
94
  - [Intercept and manipulate requests](#intercept-and-manipulate-requests)
95
95
  - [Intercept and manipulate responses](#intercept-and-manipulate-responses)
96
+ - [Node.js 17+: ECONNREFUSED issue with IPv6 and localhost (#705)](#nodejs-17-econnrefused-issue-with-ipv6-and-localhost-705)
96
97
  - [Debugging](#debugging)
97
98
  - [Working examples](#working-examples)
98
99
  - [Recipes](#recipes)
@@ -140,15 +141,12 @@ const { createProxyMiddleware } = require('http-proxy-middleware');
140
141
 
141
142
  const app = express();
142
143
 
143
- // proxy middleware options
144
- /** @type {import('http-proxy-middleware/dist/types').Options} */
145
- const options = {
144
+ // create the proxy
145
+ /** @type {import('http-proxy-middleware/dist/types').RequestHandler<express.Request, express.Response>} */
146
+ const exampleProxy = createProxyMiddleware({
146
147
  target: 'http://www.example.org/api', // target host with the same base path
147
148
  changeOrigin: true, // needed for virtual hosted sites
148
- };
149
-
150
- // create the proxy
151
- const exampleProxy = createProxyMiddleware(options);
149
+ });
152
150
 
153
151
  // mount `exampleProxy` in web server
154
152
  app.use('/api', exampleProxy);
@@ -257,22 +255,22 @@ Re-target `option.target` for specific requests.
257
255
  // Use `host` and/or `path` to match requests. First match will be used.
258
256
  // The order of the configuration matters.
259
257
  router: {
260
- 'integration.localhost:3000' : 'http://localhost:8001', // host only
261
- 'staging.localhost:3000' : 'http://localhost:8002', // host only
262
- 'localhost:3000/api' : 'http://localhost:8003', // host + path
263
- '/rest' : 'http://localhost:8004' // path only
258
+ 'integration.localhost:3000' : 'http://127.0.0.1:8001', // host only
259
+ 'staging.localhost:3000' : 'http://127.0.0.1:8002', // host only
260
+ 'localhost:3000/api' : 'http://127.0.0.1:8003', // host + path
261
+ '/rest' : 'http://127.0.0.1:8004' // path only
264
262
  }
265
263
 
266
264
  // Custom router function (string target)
267
265
  router: function(req) {
268
- return 'http://localhost:8004';
266
+ return 'http://127.0.0.1:8004';
269
267
  }
270
268
 
271
269
  // Custom router function (target object)
272
270
  router: function(req) {
273
271
  return {
274
272
  protocol: 'https:', // The : is required
275
- host: 'localhost',
273
+ host: '127.0.0.1',
276
274
  port: 8004
277
275
  };
278
276
  }
@@ -488,7 +486,7 @@ The following options are provided by the underlying [http-proxy](https://github
488
486
  req,
489
487
  res,
490
488
  {
491
- target: 'http://localhost:4003/',
489
+ target: 'http://127.0.0.1:4003/',
492
490
  buffer: streamify(req.rawBody),
493
491
  },
494
492
  next
@@ -573,6 +571,21 @@ const proxy = createProxyMiddleware({
573
571
 
574
572
  Check out [interception recipes](https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/response-interceptor.md#readme) for more examples.
575
573
 
574
+ ## Node.js 17+: ECONNREFUSED issue with IPv6 and localhost ([#705](https://github.com/chimurai/http-proxy-middleware/issues/705))
575
+
576
+ Node.js 17+ no longer prefers IPv4 over IPv6 for DNS lookups.
577
+ E.g. It's **not** guaranteed that `localhost` will be resolved to `127.0.0.1` – it might just as well be `::1` (or some other IP address).
578
+
579
+ If your target server only accepts IPv4 connections, trying to proxy to `localhost` will fail if resolved to `::1` (IPv6).
580
+
581
+ Ways to solve it:
582
+
583
+ - Change `target: "http://localhost"` to `target: "http://127.0.0.1"` (IPv4).
584
+ - Change the target server to (also) accept IPv6 connections.
585
+ - Add this flag when running `node`: `node index.js --dns-result-order=ipv4first`. (Not recommended.)
586
+
587
+ > Note: There’s a thing called [Happy Eyeballs](https://en.wikipedia.org/wiki/Happy_Eyeballs) which means connecting to both IPv4 and IPv6 in parallel, which Node.js doesn’t have, but explains why for example `curl` can connect.
588
+
576
589
  ## Debugging
577
590
 
578
591
  Configure the `DEBUG` environment variable enable debug logging.
@@ -1,2 +1,2 @@
1
1
  import { Options } from './types';
2
- export declare function verifyConfig(options: Options): void;
2
+ export declare function verifyConfig<TReq, TRes>(options: Options<TReq, TRes>): void;
@@ -1,2 +1,2 @@
1
1
  import type { Options, Plugin } from './types';
2
- export declare function getPlugins(options: Options): Plugin[];
2
+ export declare function getPlugins<TReq, TRes>(options: Options<TReq, TRes>): Plugin<TReq, TRes>[];
@@ -1,7 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import type * as http from 'http';
3
- import type { Request } from '../types';
3
+ export declare type BodyParserLikeRequest = http.IncomingMessage & {
4
+ body: any;
5
+ };
4
6
  /**
5
7
  * Fix proxied body if bodyParser is involved.
6
8
  */
7
- export declare function fixRequestBody(proxyReq: http.ClientRequest, req: Request): void;
9
+ export declare function fixRequestBody<TReq = http.IncomingMessage>(proxyReq: http.ClientRequest, req: TReq): void;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import type * as http from 'http';
3
- declare type Interceptor = (buffer: Buffer, proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => Promise<Buffer | string>;
4
+ declare type Interceptor<TReq = http.IncomingMessage, TRes = http.ServerResponse> = (buffer: Buffer, proxyRes: TReq, req: TReq, res: TRes) => Promise<Buffer | string>;
4
5
  /**
5
6
  * Intercept responses from upstream.
6
7
  * Automatically decompress (deflate, gzip, brotli).
@@ -8,5 +9,5 @@ declare type Interceptor = (buffer: Buffer, proxyRes: http.IncomingMessage, req:
8
9
  *
9
10
  * NOTE: must set options.selfHandleResponse=true (prevent automatic call of res.end())
10
11
  */
11
- export declare function responseInterceptor(interceptor: Interceptor): (proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
12
+ export declare function responseInterceptor<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse>(interceptor: Interceptor<TReq, TRes>): (proxyRes: TReq, req: TReq, res: TRes) => Promise<void>;
12
13
  export {};
@@ -1,11 +1,11 @@
1
1
  import type { RequestHandler, Options } from './types';
2
- export declare class HttpProxyMiddleware {
2
+ export declare class HttpProxyMiddleware<TReq, TRes> {
3
3
  private wsInternalSubscribed;
4
4
  private serverOnCloseSubscribed;
5
5
  private proxyOptions;
6
6
  private proxy;
7
7
  private pathRewriter;
8
- constructor(options: Options);
8
+ constructor(options: Options<TReq, TRes>);
9
9
  middleware: RequestHandler;
10
10
  private registerPlugins;
11
11
  private catchUpgradeRequest;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import type { Options, RequestHandler } from './types';
2
- export declare function createProxyMiddleware(options: Options): RequestHandler;
1
+ /// <reference types="node" />
2
+ import type { Options, RequestHandler, NextFunction } from './types';
3
+ import type * as http from 'http';
4
+ export declare function createProxyMiddleware<TReq = http.IncomingMessage, TRes = http.ServerResponse, TNext = NextFunction>(options: Options<TReq, TRes>): RequestHandler<TReq, TRes, TNext>;
3
5
  export * from './handlers';
4
6
  export type { Filter, Options, RequestHandler } from './types';
5
7
  /**
@@ -1,11 +1,13 @@
1
+ /// <reference types="node" />
1
2
  import { Filter, RequestHandler } from '../types';
2
3
  import { LegacyOptions } from './types';
4
+ import type * as http from 'http';
3
5
  /**
4
6
  * @deprecated
5
7
  * This function is deprecated and will be removed in a future version.
6
8
  *
7
9
  * Use {@link createProxyMiddleware} instead.
8
10
  */
9
- export declare function legacyCreateProxyMiddleware(shortHand: string): RequestHandler;
10
- export declare function legacyCreateProxyMiddleware(legacyOptions: LegacyOptions): RequestHandler;
11
- export declare function legacyCreateProxyMiddleware(legacyContext: Filter, legacyOptions: LegacyOptions): RequestHandler;
11
+ export declare function legacyCreateProxyMiddleware<TReq = http.IncomingMessage, TRes = http.ServerResponse>(shortHand: string): RequestHandler<TReq, TRes>;
12
+ export declare function legacyCreateProxyMiddleware<TReq = http.IncomingMessage, TRes = http.ServerResponse>(legacyOptions: LegacyOptions<TReq, TRes>): RequestHandler<TReq, TRes>;
13
+ export declare function legacyCreateProxyMiddleware<TReq = http.IncomingMessage, TRes = http.ServerResponse>(legacyContext: Filter<TReq>, legacyOptions: LegacyOptions<TReq, TRes>): RequestHandler<TReq, TRes>;
@@ -3,4 +3,4 @@ import { LegacyOptions } from './types';
3
3
  /**
4
4
  * Convert {@link LegacyOptions legacy Options} to new {@link Options}
5
5
  */
6
- export declare function legacyOptionsAdapter(legacyContext: Filter | LegacyOptions, legacyOptions: LegacyOptions): Options;
6
+ export declare function legacyOptionsAdapter<TReq, TRes>(legacyContext: Filter<TReq> | LegacyOptions<TReq, TRes>, legacyOptions: LegacyOptions<TReq, TRes>): Options<TReq, TRes>;
@@ -1,10 +1,12 @@
1
+ /// <reference types="node" />
2
+ import type * as http from 'http';
1
3
  import { Options } from '..';
2
4
  /**
3
5
  * @deprecated
4
6
  *
5
7
  * Will be removed in a future version.
6
8
  */
7
- export interface LegacyOptions extends Options {
9
+ export interface LegacyOptions<TReq = http.IncomingMessage, TRes = http.ServerResponse> extends Options<TReq, TRes> {
8
10
  /**
9
11
  * @deprecated
10
12
  * Use `on.error` instead.
@@ -1,2 +1,4 @@
1
- import type { Filter, Request } from './types';
2
- export declare function matchPathFilter(pathFilter: Filter, uri: string, req: Request): boolean;
1
+ /// <reference types="node" />
2
+ import type { Filter } from './types';
3
+ import type * as http from 'http';
4
+ export declare function matchPathFilter<TReq = http.IncomingMessage>(pathFilter: Filter<TReq>, uri: string, req: http.IncomingMessage): boolean;
@@ -23,7 +23,8 @@ const loggerPlugin = (proxyServer, options) => {
23
23
  proxyServer.on('proxyRes', (proxyRes, req, res) => {
24
24
  var _a;
25
25
  // BrowserSync uses req.originalUrl
26
- const originalUrl = (_a = req.originalUrl) !== null && _a !== void 0 ? _a : `${req.baseUrl}${req.path}`;
26
+ // Next.js doesn't have req.baseUrl
27
+ const originalUrl = (_a = req.originalUrl) !== null && _a !== void 0 ? _a : `${req.baseUrl || ''}${req.url}`;
27
28
  const exchange = `[HPM] ${req.method} ${originalUrl} -> ${proxyRes.req.protocol}//${proxyRes.req.host}${proxyRes.req.path} [${proxyRes.statusCode}]`;
28
29
  logger.info(exchange);
29
30
  });
package/dist/types.d.ts CHANGED
@@ -3,40 +3,56 @@
3
3
  * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6f529c6c67a447190f86bfbf894d1061e41e07b7/types/http-proxy-middleware/index.d.ts
4
4
  */
5
5
  /// <reference types="node" />
6
+ /// <reference types="node" />
7
+ /// <reference types="node" />
6
8
  import type * as http from 'http';
7
9
  import type * as httpProxy from 'http-proxy';
8
10
  import type * as net from 'net';
9
- export declare type Request<T = http.IncomingMessage> = T;
10
- export declare type Response<T = http.ServerResponse> = T;
11
11
  export declare type NextFunction<T = (err?: any) => void> = T;
12
- export interface RequestHandler {
13
- (req: Request, res: Response, next?: NextFunction): void | Promise<void>;
14
- upgrade?: (req: Request, socket: net.Socket, head: any) => void;
12
+ export interface RequestHandler<TReq = http.IncomingMessage, TRes = http.ServerResponse, TNext = NextFunction> {
13
+ (req: TReq, res: TRes, next?: TNext): void | Promise<void>;
14
+ upgrade?: (req: http.IncomingMessage, socket: net.Socket, head: any) => void;
15
+ }
16
+ export declare type Filter<TReq = http.IncomingMessage> = string | string[] | ((pathname: string, req: TReq) => boolean);
17
+ export interface Plugin<TReq = http.IncomingMessage, TRes = http.ServerResponse> {
18
+ (proxyServer: httpProxy<TReq, TRes>, options: Options<TReq, TRes>): void;
15
19
  }
16
- export declare type Filter = string | string[] | ((pathname: string, req: Request) => boolean);
17
- export declare type Plugin = (proxyServer: httpProxy, options: Options) => void;
18
- export declare type OnProxyEvent = {
19
- error?: httpProxy.ErrorCallback;
20
- proxyReq?: httpProxy.ProxyReqCallback;
21
- proxyReqWs?: httpProxy.ProxyReqWsCallback;
22
- proxyRes?: httpProxy.ProxyResCallback;
20
+ export interface OnProxyEvent<TReq = http.IncomingMessage, TRes = http.ServerResponse> {
21
+ error?: httpProxy.ErrorCallback<Error, TReq, TRes>;
22
+ proxyReq?: httpProxy.ProxyReqCallback<http.ClientRequest, TReq, TRes>;
23
+ proxyReqWs?: httpProxy.ProxyReqWsCallback<http.ClientRequest, TReq>;
24
+ proxyRes?: httpProxy.ProxyResCallback<TReq, TRes>;
23
25
  open?: httpProxy.OpenCallback;
24
- close?: httpProxy.CloseCallback;
25
- start?: httpProxy.StartCallback;
26
- end?: httpProxy.EndCallback;
27
- econnreset?: httpProxy.EconnresetCallback;
28
- };
26
+ close?: httpProxy.CloseCallback<TReq>;
27
+ start?: httpProxy.StartCallback<TReq, TRes>;
28
+ end?: httpProxy.EndCallback<TReq, TRes>;
29
+ econnreset?: httpProxy.EconnresetCallback<Error, TReq, TRes>;
30
+ }
29
31
  export declare type Logger = Pick<Console, 'info' | 'warn' | 'error'>;
30
- export interface Options extends httpProxy.ServerOptions {
32
+ export interface Options<TReq = http.IncomingMessage, TRes = http.ServerResponse> extends httpProxy.ServerOptions {
31
33
  /**
32
34
  * Narrow down requests to proxy or not.
33
35
  * Filter on {@link http.IncomingMessage.url `pathname`} which is relative to the proxy's "mounting" point in the server.
34
36
  * Or use the {@link http.IncomingMessage `req`} object for more complex filtering.
37
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/pathFilter.md
38
+ * @since v3.0.0
39
+ */
40
+ pathFilter?: Filter<TReq>;
41
+ /**
42
+ * Modify request paths before requests are send to the target.
43
+ * @example
44
+ * ```js
45
+ * createProxyMiddleware({
46
+ * pathRewrite: {
47
+ * '^/api/old-path': '/api/new-path', // rewrite path
48
+ * }
49
+ * });
50
+ * ```
51
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/pathRewrite.md
35
52
  */
36
- pathFilter?: Filter;
37
53
  pathRewrite?: {
38
54
  [regexp: string]: string;
39
- } | ((path: string, req: Request) => string) | ((path: string, req: Request) => Promise<string>);
55
+ } | ((path: string, req: TReq) => string) | ((path: string, req: TReq) => Promise<string>);
40
56
  /**
41
57
  * Access the internal http-proxy server instance to customize behavior
42
58
  *
@@ -50,12 +66,15 @@ export interface Options extends httpProxy.ServerOptions {
50
66
  * }]
51
67
  * });
52
68
  * ```
69
+ * @link https://github.com/chimurai/http-proxy-middleware#plugins-array
70
+ * @since v3.0.0
53
71
  */
54
- plugins?: Plugin[];
72
+ plugins?: Plugin<TReq, TRes>[];
55
73
  /**
56
74
  * Eject pre-configured plugins.
57
75
  * NOTE: register your own error handlers to prevent server from crashing.
58
76
  *
77
+ * @link https://github.com/chimurai/http-proxy-middleware#ejectplugins-boolean-default-false
59
78
  * @since v3.0.0
60
79
  */
61
80
  ejectPlugins?: boolean;
@@ -72,11 +91,25 @@ export interface Options extends httpProxy.ServerOptions {
72
91
  * }
73
92
  * });
74
93
  * ```
94
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/proxy-events.md
95
+ * @since v3.0.0
96
+ */
97
+ on?: OnProxyEvent<TReq, TRes>;
98
+ /**
99
+ * Dynamically set the {@link Options.target `options.target`}.
100
+ * @example
101
+ * ```js
102
+ * createProxyMiddleware({
103
+ * router: async (req) => {
104
+ * return 'http://127:0.0.1:3000';
105
+ * }
106
+ * });
107
+ * ```
108
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/router.md
75
109
  */
76
- on?: OnProxyEvent;
77
110
  router?: {
78
111
  [hostOrPath: string]: httpProxy.ServerOptions['target'];
79
- } | ((req: Request) => httpProxy.ServerOptions['target']) | ((req: Request) => Promise<httpProxy.ServerOptions['target']>);
112
+ } | ((req: TReq) => httpProxy.ServerOptions['target']) | ((req: TReq) => Promise<httpProxy.ServerOptions['target']>);
80
113
  /**
81
114
  * Log information from http-proxy-middleware
82
115
  * @example
@@ -85,6 +118,8 @@ export interface Options extends httpProxy.ServerOptions {
85
118
  * logger: console
86
119
  * });
87
120
  * ```
121
+ * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/logger.md
122
+ * @since v3.0.0
88
123
  */
89
124
  logger?: Logger | any;
90
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "http-proxy-middleware",
3
- "version": "3.0.0-beta.0",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "The one-liner node.js proxy middleware for connect, express, next.js and more",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,21 +8,18 @@
8
8
  "dist"
9
9
  ],
10
10
  "scripts": {
11
- "clean": "rm -rf dist && rm -rf coverage",
11
+ "clean": "rm -rf dist coverage tsconfig.tsbuildinfo .eslintcache",
12
12
  "lint": "yarn prettier && yarn eslint",
13
13
  "lint:fix": "yarn prettier:fix && yarn eslint:fix",
14
- "eslint": "eslint '{src,test}/**/*.ts'",
14
+ "eslint": "eslint '{src,test}/**/*.ts' --cache",
15
15
  "eslint:fix": "yarn eslint --fix",
16
16
  "prettier": "prettier --list-different \"**/*.{js,ts,md,yml,json,html}\"",
17
17
  "prettier:fix": "prettier --write \"**/*.{js,ts,md,yml,json,html}\"",
18
- "prebuild": "yarn clean",
19
- "build": "tsc",
20
- "pretest": "yarn build",
18
+ "build": "tsc --build",
21
19
  "test": "jest",
22
- "precoverage": "yarn build",
23
- "coverage": "jest --coverage --coverageReporters=lcov",
20
+ "coverage": "jest --coverage",
24
21
  "prepare": "husky install",
25
- "prepack": "yarn build && rm dist/tsconfig.tsbuildinfo",
22
+ "prepack": "yarn clean && yarn test && yarn build",
26
23
  "spellcheck": "npx --yes cspell --show-context --show-suggestions '**/*.*'"
27
24
  },
28
25
  "repository": {
@@ -54,56 +51,45 @@
54
51
  },
55
52
  "homepage": "https://github.com/chimurai/http-proxy-middleware#readme",
56
53
  "devDependencies": {
57
- "@commitlint/cli": "16.2.3",
58
- "@commitlint/config-conventional": "16.2.1",
54
+ "@commitlint/cli": "17.4.4",
55
+ "@commitlint/config-conventional": "17.4.4",
59
56
  "@types/debug": "4.1.7",
60
- "@types/express": "4.17.13",
57
+ "@types/express": "4.17.17",
61
58
  "@types/is-glob": "4.0.2",
62
- "@types/jest": "27.4.1",
59
+ "@types/jest": "29.4.0",
63
60
  "@types/micromatch": "4.0.2",
64
- "@types/node": "17.0.25",
61
+ "@types/node": "18.14.5",
65
62
  "@types/supertest": "2.0.12",
66
- "@types/ws": "8.5.3",
67
- "@typescript-eslint/eslint-plugin": "5.20.0",
68
- "@typescript-eslint/parser": "5.20.0",
69
- "body-parser": "1.20.0",
70
- "browser-sync": "2.27.9",
63
+ "@types/ws": "8.5.4",
64
+ "@typescript-eslint/eslint-plugin": "5.54.0",
65
+ "@typescript-eslint/parser": "5.54.0",
66
+ "body-parser": "1.20.2",
67
+ "browser-sync": "2.28.1",
71
68
  "connect": "3.7.0",
72
- "eslint": "8.13.0",
73
- "eslint-config-prettier": "8.5.0",
74
- "eslint-plugin-prettier": "4.0.0",
75
- "express": "4.17.3",
69
+ "eslint": "8.35.0",
70
+ "eslint-config-prettier": "8.6.0",
71
+ "eslint-plugin-prettier": "4.2.1",
72
+ "express": "4.18.2",
76
73
  "get-port": "5.1.1",
77
- "husky": "7.0.4",
78
- "jest": "27.5.1",
79
- "lint-staged": "12.3.8",
80
- "mockttp": "2.7.0",
81
- "open": "8.4.0",
82
- "prettier": "2.6.2",
83
- "supertest": "6.2.2",
84
- "ts-jest": "27.1.4",
85
- "typescript": "4.6.3",
86
- "ws": "8.5.0"
74
+ "husky": "8.0.3",
75
+ "jest": "29.4.3",
76
+ "lint-staged": "13.1.2",
77
+ "mockttp": "3.7.0",
78
+ "open": "8.4.2",
79
+ "prettier": "2.8.4",
80
+ "supertest": "6.3.3",
81
+ "ts-jest": "29.0.5",
82
+ "typescript": "4.9.5",
83
+ "ws": "8.12.1"
87
84
  },
88
85
  "dependencies": {
89
- "@types/http-proxy": "^1.17.8",
86
+ "@types/http-proxy": "^1.17.10",
90
87
  "debug": "^4.3.4",
91
88
  "http-proxy": "^1.18.1",
92
89
  "is-glob": "^4.0.1",
93
90
  "is-plain-obj": "^3.0.0",
94
91
  "micromatch": "^4.0.5"
95
92
  },
96
- "peerDependencies": {
97
- "@types/express": "^4.17.13"
98
- },
99
- "peerDependenciesMeta": {
100
- "@types/express": {
101
- "optional": true
102
- }
103
- },
104
- "resolutions": {
105
- "browser-sync/portscanner": "2.2.0"
106
- },
107
93
  "engines": {
108
94
  "node": ">=12.0.0"
109
95
  },