@nestjs/core 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "11.0.0",
3
+ "version": "11.0.2",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@core)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "uid": "2.0.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@nestjs/common": "^11.0.0"
42
+ "@nestjs/common": "11.0.2"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@nestjs/common": "^11.0.0",
@@ -12,7 +12,7 @@ class LegacyRouteConverter {
12
12
  * @returns The converted route, or the original route if it cannot be converted.
13
13
  */
14
14
  static tryConvert(route) {
15
- // Normalize path to eliminate additional conditions.
15
+ // Normalize path to eliminate additional if statements.
16
16
  const routeWithLeadingSlash = route.startsWith('/') ? route : `/${route}`;
17
17
  const normalizedRoute = route.endsWith('/')
18
18
  ? routeWithLeadingSlash
@@ -35,13 +35,21 @@ class LegacyRouteConverter {
35
35
  this.printWarning(route);
36
36
  return route.replace('/+', '/*path');
37
37
  }
38
+ // When route includes any wildcard segments in the middle.
39
+ if (normalizedRoute.includes('/*/')) {
40
+ this.printWarning(route);
41
+ // Replace each /*/ segment with a named parameter using different name for each segment.
42
+ return route.replaceAll('/*/', (match, offset) => {
43
+ return `/*path${offset}/`;
44
+ });
45
+ }
38
46
  return route;
39
47
  }
40
48
  static printError(route) {
41
49
  this.logger.error(UNSUPPORTED_PATH_MESSAGE `${route}`);
42
50
  }
43
51
  static printWarning(route) {
44
- this.logger.warn(UNSUPPORTED_PATH_MESSAGE `${route}` + ' Attempting to convert...');
52
+ this.logger.warn(UNSUPPORTED_PATH_MESSAGE `${route}` + ' Attempting to auto-convert...');
45
53
  }
46
54
  }
47
55
  exports.LegacyRouteConverter = LegacyRouteConverter;