@fastify/react 1.1.3 → 1.1.5

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/routing.js +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastify/react",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "The official @fastify/vite renderer for React",
5
5
  "keywords": [
6
6
  "fastify",
@@ -74,10 +74,10 @@
74
74
  "mlly": "^1.7.4",
75
75
  "react": "^19.2.3",
76
76
  "react-dom": "^19.2.3",
77
- "react-router": "^7.5.1",
77
+ "react-router": "^7.12.0",
78
78
  "valtio": "latest",
79
79
  "youch": "^3.3.4",
80
- "@fastify/vite": "^8.2.3"
80
+ "@fastify/vite": "^8.4.0"
81
81
  },
82
82
  "scripts": {}
83
83
  }
package/routing.js CHANGED
@@ -105,7 +105,7 @@ export async function createRoute({ client, errorHandler, route }, scope, config
105
105
  handler = (_, reply) => reply.html()
106
106
  } else {
107
107
  const { id } = route
108
- const htmlPath = id.replace(/pages\/(.*?)\.(j|t)sx/, 'html/$1.html')
108
+ const htmlPath = id.replace('pages/', 'html/').replace(/\.(j|t)sx$/, '.html')
109
109
  let distDir = config.vite.build.outDir
110
110
  if (!isAbsolute(config.vite.build.outDir)) {
111
111
  distDir = join(config.vite.root, distDir)
@@ -116,7 +116,7 @@ export async function createRoute({ client, errorHandler, route }, scope, config
116
116
  }
117
117
 
118
118
  // Replace wildcard routes with Fastify compatible syntax
119
- const routePath = route.path.replace(/:[^+]+\+/, '*')
119
+ const routePath = route.path.replace(/:\w[\w-]*\+/, '*')
120
120
 
121
121
  unshiftHook(route, 'onRequest', onRequest)
122
122
  unshiftHook(route, 'preHandler', preHandler)
@@ -134,7 +134,7 @@ export async function createRoute({ client, errorHandler, route }, scope, config
134
134
  scope.get(`/-/data${routePath}`, {
135
135
  onRequest,
136
136
  async handler(req, reply) {
137
- reply.send(await route.getData(req.route))
137
+ return reply.send(await route.getData(req.route))
138
138
  },
139
139
  })
140
140
  }