@finesoft/front 0.1.27 → 0.1.28

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/dist/index.cjs CHANGED
@@ -2297,14 +2297,31 @@ function vercelAdapter() {
2297
2297
  fs.rmSync(outputDir, { recursive: true, force: true });
2298
2298
  const entrySource = generateSSREntry(ctx, {
2299
2299
  platformImport: `import { getRequestListener } from "@hono/node-server";`,
2300
- platformExport: `export default getRequestListener(app.fetch);`
2300
+ platformExport: [
2301
+ `const _listener = getRequestListener(app.fetch);`,
2302
+ `export default (req, res) => {`,
2303
+ ` const m = req.headers["x-now-route-matches"];`,
2304
+ ` if (typeof m === "string") {`,
2305
+ ` try {`,
2306
+ ` const p = new URLSearchParams(m);`,
2307
+ ` const c = p.get("1");`,
2308
+ ` if (c != null) {`,
2309
+ ` const qi = (req.url || "").indexOf("?");`,
2310
+ ` const qs = qi !== -1 ? req.url.slice(qi) : "";`,
2311
+ ` req.url = "/" + decodeURIComponent(c) + qs;`,
2312
+ ` }`,
2313
+ ` } catch {}`,
2314
+ ` }`,
2315
+ ` return _listener(req, res);`,
2316
+ `};`
2317
+ ].join("\n")
2301
2318
  });
2302
2319
  const tempEntry = path.resolve(root, ".vercel-entry.tmp.mjs");
2303
2320
  fs.writeFileSync(tempEntry, entrySource);
2304
2321
  try {
2305
2322
  const funcDir = path.resolve(
2306
2323
  root,
2307
- ".vercel/output/functions/[[...path]].func"
2324
+ ".vercel/output/functions/ssr.func"
2308
2325
  );
2309
2326
  await buildBundle(ctx, {
2310
2327
  entry: ".vercel-entry.tmp.mjs",
@@ -2334,7 +2351,7 @@ function vercelAdapter() {
2334
2351
  version: 3,
2335
2352
  routes: [
2336
2353
  { handle: "filesystem" },
2337
- { src: "/(.*)", dest: "/functions/[[...path]]" }
2354
+ { src: "/(.*)", dest: "/ssr" }
2338
2355
  ]
2339
2356
  },
2340
2357
  null,