http-proxy-middleware 1.0.2 → 1.0.6

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.0.6](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.6)
4
+
5
+ - chore(deps): lodash 4.17.20 ([#475](https://github.com/chimurai/http-proxy-middleware/pull/475))
6
+
7
+ ## [v1.0.5](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.6)
8
+
9
+ - chore(deps): lodash 4.17.19 ([#454](https://github.com/chimurai/http-proxy-middleware/pull/454))
10
+
11
+ ## [v1.0.4](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.4)
12
+
13
+ - chore(deps): http-proxy 1.18.1 ([#442](https://github.com/chimurai/http-proxy-middleware/pull/442))
14
+
15
+ ## [v1.0.3](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.3)
16
+
17
+ - build(package): exclude build artifact tsconfig.tsbuildinfo ([#415](https://github.com/chimurai/http-proxy-middleware/pull/415))
18
+
3
19
  ## [v1.0.2](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.0.2)
4
20
 
5
21
  - fix(router): handle rejected promise in custom router ([#410](https://github.com/chimurai/http-proxy-middleware/pull/413)) ([bforbis](https://github.com/bforbis))
package/README.md CHANGED
@@ -132,13 +132,13 @@ const options = {
132
132
  ws: true, // proxy websockets
133
133
  pathRewrite: {
134
134
  '^/api/old-path': '/api/new-path', // rewrite path
135
- '^/api/remove/path': '/path' // remove base path
135
+ '^/api/remove/path': '/path', // remove base path
136
136
  },
137
137
  router: {
138
138
  // when request.headers.host == 'dev.localhost:3000',
139
139
  // override target 'http://www.example.org' to 'http://localhost:8000'
140
- 'dev.localhost:3000': 'http://localhost:8000'
141
- }
140
+ 'dev.localhost:3000': 'http://localhost:8000',
141
+ },
142
142
  };
143
143
 
144
144
  // create the proxy (without context)
@@ -194,12 +194,12 @@ Providing an alternative way to decide which requests should be proxied; In case
194
194
  /**
195
195
  * @return {Boolean}
196
196
  */
197
- const filter = function(pathname, req) {
197
+ const filter = function (pathname, req) {
198
198
  return pathname.match('^/api') && req.method === 'GET';
199
199
  };
200
200
 
201
201
  const apiProxy = createProxyMiddleware(filter, {
202
- target: 'http://www.example.org'
202
+ target: 'http://www.example.org',
203
203
  });
204
204
  ```
205
205
 
@@ -285,7 +285,7 @@ Providing an alternative way to decide which requests should be proxied; In case
285
285
  debug: logger.debug,
286
286
  info: logger.info,
287
287
  warn: logger.warn,
288
- error: logger.error
288
+ error: logger.error,
289
289
  };
290
290
  return myCustomProvider;
291
291
  }
@@ -300,7 +300,7 @@ Subscribe to [http-proxy events](https://github.com/nodejitsu/node-http-proxy#li
300
300
  ```javascript
301
301
  function onError(err, req, res) {
302
302
  res.writeHead(500, {
303
- 'Content-Type': 'text/plain'
303
+ 'Content-Type': 'text/plain',
304
304
  });
305
305
  res.end('Something went wrong. And we are reporting a custom error message.');
306
306
  }
@@ -417,7 +417,7 @@ The following options are provided by the underlying [http-proxy](https://github
417
417
  res,
418
418
  {
419
419
  target: 'http://localhost:4003/',
420
- buffer: streamify(req.rawBody)
420
+ buffer: streamify(req.rawBody),
421
421
  },
422
422
  next
423
423
  );
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createConfig = void 0;
3
4
  const _ = require("lodash");
4
5
  const url = require("url");
5
6
  const errors_1 = require("./errors");
@@ -9,7 +10,7 @@ function createConfig(context, opts) {
9
10
  // structure of config object to be returned
10
11
  const config = {
11
12
  context: undefined,
12
- options: {}
13
+ options: {},
13
14
  };
14
15
  // app.use('/api', proxy({target:'http://localhost:9000'}));
15
16
  if (isContextless(context, opts)) {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.match = void 0;
3
4
  const isGlob = require("is-glob");
4
5
  const _ = require("lodash");
5
6
  const micromatch = require("micromatch");
package/dist/errors.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERRORS = void 0;
3
4
  var ERRORS;
4
5
  (function (ERRORS) {
5
6
  ERRORS["ERR_CONFIG_FACTORY_TARGET_MISSING"] = "[HPM] Missing \"target\" option. Example: {target: \"http://www.example.org\"}";
package/dist/handlers.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getHandlers = exports.init = void 0;
3
4
  const _ = require("lodash");
4
5
  const logger_1 = require("./logger");
5
6
  const logger = logger_1.getInstance();
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HttpProxyMiddleware = void 0;
12
13
  const httpProxy = require("http-proxy");
13
14
  const _ = require("lodash");
14
15
  const config_factory_1 = require("./config-factory");
@@ -40,7 +41,7 @@ class HttpProxyMiddleware {
40
41
  this.catchUpgradeRequest(req.connection.server);
41
42
  }
42
43
  });
43
- this.catchUpgradeRequest = server => {
44
+ this.catchUpgradeRequest = (server) => {
44
45
  if (!this.wsInternalSubscribed) {
45
46
  server.on('upgrade', this.handleUpgrade);
46
47
  // prevent duplicate upgrade handling;
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createProxyMiddleware = void 0;
3
4
  const http_proxy_middleware_1 = require("./http-proxy-middleware");
4
5
  function createProxyMiddleware(context, options) {
5
6
  const { middleware } = new http_proxy_middleware_1.HttpProxyMiddleware(context, options);
package/dist/logger.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getArrow = exports.getInstance = void 0;
3
4
  const _ = require("lodash");
4
5
  const util = require("util");
5
6
  let loggerInstance;
@@ -9,7 +10,7 @@ const defaultProvider = {
9
10
  debug: console.log,
10
11
  info: console.info,
11
12
  warn: console.warn,
12
- error: console.error
13
+ error: console.error,
13
14
  };
14
15
  // log level 'weight'
15
16
  var LEVELS;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPathRewriter = void 0;
3
4
  const _ = require("lodash");
4
5
  const errors_1 = require("./errors");
5
6
  const logger_1 = require("./logger");
@@ -25,7 +26,7 @@ function createPathRewriter(rewriteConfig) {
25
26
  }
26
27
  function rewritePath(path) {
27
28
  let result = path;
28
- _.forEach(rulesCache, rule => {
29
+ _.forEach(rulesCache, (rule) => {
29
30
  if (rule.regex.test(path)) {
30
31
  result = result.replace(rule.regex, rule.value);
31
32
  logger.debug('[HPM] Rewriting path from "%s" to "%s"', path, result);
@@ -58,7 +59,7 @@ function parsePathRewriteRules(rewriteConfig) {
58
59
  _.forIn(rewriteConfig, (value, key) => {
59
60
  rules.push({
60
61
  regex: new RegExp(key),
61
- value: rewriteConfig[key]
62
+ value: rewriteConfig[key],
62
63
  });
63
64
  logger.info('[HPM] Proxy rewrite rule created: "%s" ~> "%s"', key, rewriteConfig[key]);
64
65
  });
package/dist/router.js CHANGED
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getTarget = void 0;
12
13
  const _ = require("lodash");
13
14
  const logger_1 = require("./logger");
14
15
  const logger = logger_1.getInstance();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "http-proxy-middleware",
3
- "version": "1.0.2",
3
+ "version": "1.0.6",
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",
@@ -16,12 +16,8 @@
16
16
  "build": "tsc",
17
17
  "pretest": "yarn build",
18
18
  "test": "jest",
19
- "precover": "yarn clean && yarn build",
20
- "cover": "jest --coverage",
21
- "precoveralls": "yarn clean && yarn build",
22
- "coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
23
- "postcoveralls": "yarn clean",
24
- "prepare": "yarn clean && yarn build"
19
+ "coverage": "jest --coverage --coverageReporters=lcov",
20
+ "prepare": "yarn clean && yarn build && rm dist/tsconfig.tsbuildinfo"
25
21
  },
26
22
  "repository": {
27
23
  "type": "git",
@@ -50,37 +46,36 @@
50
46
  },
51
47
  "homepage": "https://github.com/chimurai/http-proxy-middleware#readme",
52
48
  "devDependencies": {
53
- "@commitlint/cli": "^8.3.5",
54
- "@commitlint/config-conventional": "^8.3.4",
55
- "@types/express": "^4.17.2",
49
+ "@commitlint/cli": "^11.0.0",
50
+ "@commitlint/config-conventional": "^11.0.0",
51
+ "@types/express": "^4.17.3",
56
52
  "@types/is-glob": "^4.0.1",
57
- "@types/jest": "^25.1.3",
58
- "@types/lodash": "^4.14.149",
53
+ "@types/jest": "^26.0.14",
54
+ "@types/lodash": "^4.14.162",
59
55
  "@types/micromatch": "^4.0.1",
60
- "@types/node": "^13.7.4",
61
- "@types/supertest": "^2.0.8",
62
- "browser-sync": "^2.26.7",
56
+ "@types/node": "^14.11.8",
57
+ "@types/supertest": "^2.0.10",
58
+ "browser-sync": "^2.26.12",
63
59
  "connect": "^3.7.0",
64
- "coveralls": "^3.0.5",
65
60
  "express": "^4.17.1",
66
- "husky": "^4.2.3",
67
- "jest": "^25.1.0",
68
- "lint-staged": "^10.0.7",
69
- "mockttp": "^0.19.3",
70
- "open": "^7.0.2",
71
- "prettier": "^1.19.1",
72
- "supertest": "^4.0.2",
73
- "ts-jest": "^25.2.0",
74
- "tslint": "^6.0.0",
61
+ "husky": "^4.3.0",
62
+ "jest": "^26.5.3",
63
+ "lint-staged": "^10.4.0",
64
+ "mockttp": "^1.0.2",
65
+ "open": "^7.3.0",
66
+ "prettier": "^2.1.2",
67
+ "supertest": "^5.0.0",
68
+ "ts-jest": "^26.4.1",
69
+ "tslint": "^6.1.3",
75
70
  "tslint-config-prettier": "^1.18.0",
76
- "typescript": "^3.8.2",
77
- "ws": "^7.2.1"
71
+ "typescript": "^4.0.3",
72
+ "ws": "^7.3.1"
78
73
  },
79
74
  "dependencies": {
80
- "@types/http-proxy": "^1.17.3",
81
- "http-proxy": "^1.18.0",
75
+ "@types/http-proxy": "^1.17.4",
76
+ "http-proxy": "^1.18.1",
82
77
  "is-glob": "^4.0.1",
83
- "lodash": "^4.17.15",
78
+ "lodash": "^4.17.20",
84
79
  "micromatch": "^4.0.2"
85
80
  },
86
81
  "engines": {