@nestjs/platform-express 11.0.0 → 11.0.2

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.
@@ -6,12 +6,11 @@ const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6
6
  const http_adapter_1 = require("@nestjs/core/adapters/http-adapter");
7
7
  const router_method_factory_1 = require("@nestjs/core/helpers/router-method-factory");
8
8
  const legacy_route_converter_1 = require("@nestjs/core/router/legacy-route-converter");
9
- const bodyparser = require("body-parser");
10
- const body_parser_1 = require("body-parser");
11
9
  const cors = require("cors");
12
10
  const express = require("express");
13
11
  const http = require("http");
14
12
  const https = require("https");
13
+ const path_to_regexp_1 = require("path-to-regexp");
15
14
  const stream_1 = require("stream");
16
15
  const get_body_parser_options_util_1 = require("./utils/get-body-parser-options.util");
17
16
  /**
@@ -95,6 +94,8 @@ class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
95
94
  normalizePath(path) {
96
95
  try {
97
96
  const convertedPath = legacy_route_converter_1.LegacyRouteConverter.tryConvert(path);
97
+ // Call "pathToRegexp" to trigger a TypeError if the path is invalid
98
+ (0, path_to_regexp_1.pathToRegexp)(convertedPath);
98
99
  return convertedPath;
99
100
  }
100
101
  catch (e) {
@@ -184,8 +185,8 @@ class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
184
185
  extended: true,
185
186
  });
186
187
  const parserMiddleware = {
187
- jsonParser: (0, body_parser_1.json)(bodyParserJsonOptions),
188
- urlencodedParser: (0, body_parser_1.urlencoded)(bodyParserUrlencodedOptions),
188
+ jsonParser: express.json(bodyParserJsonOptions),
189
+ urlencodedParser: express.urlencoded(bodyParserUrlencodedOptions),
189
190
  };
190
191
  Object.keys(parserMiddleware)
191
192
  .filter(parser => !this.isMiddlewareApplied(parser))
@@ -193,7 +194,7 @@ class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
193
194
  }
194
195
  useBodyParser(type, rawBody, options) {
195
196
  const parserOptions = (0, get_body_parser_options_util_1.getBodyParserOptions)(rawBody, options);
196
- const parser = bodyparser[type](parserOptions);
197
+ const parser = express[type](parserOptions);
197
198
  this.use(parser);
198
199
  return this;
199
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/platform-express",
3
- "version": "11.0.0",
3
+ "version": "11.0.2",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@platform-express)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -18,15 +18,14 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "body-parser": "1.20.3",
22
21
  "cors": "2.8.5",
23
22
  "express": "5.0.1",
24
23
  "multer": "1.4.5-lts.1",
25
24
  "tslib": "2.8.1"
26
25
  },
27
26
  "devDependencies": {
28
- "@nestjs/common": "^11.0.0",
29
- "@nestjs/core": "^11.0.0"
27
+ "@nestjs/common": "11.0.2",
28
+ "@nestjs/core": "11.0.2"
30
29
  },
31
30
  "peerDependencies": {
32
31
  "@nestjs/common": "^11.0.0",