@finesoft/front 0.1.21 → 0.1.23

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
@@ -1823,35 +1823,40 @@ function copyStaticAssets(ctx, destDir, opts) {
1823
1823
  fs.rmSync(path.join(destDir, "index.html"), { force: true });
1824
1824
  }
1825
1825
  }
1826
- async function prerenderRoutes(ctx, routesExport = "src/lib/bootstrap.ts") {
1826
+ async function prerenderRoutes(ctx) {
1827
1827
  const { fs, path, root, vite } = ctx;
1828
1828
  const { pathToFileURL } = await import(
1829
1829
  /* @vite-ignore */
1830
1830
  "url"
1831
1831
  );
1832
- await vite.build({
1833
- root,
1834
- build: {
1835
- ssr: routesExport,
1836
- outDir: path.resolve(root, "dist/server"),
1837
- emptyOutDir: false,
1838
- rollupOptions: {
1839
- output: { entryFileNames: "_routes_prerender.mjs" }
1840
- }
1841
- },
1842
- resolve: ctx.resolvedResolve
1843
- });
1844
- const routesPath = pathToFileURL(
1845
- path.resolve(root, "dist/server/_routes_prerender.mjs")
1846
- ).href;
1847
- const routesMod = await import(
1848
- /* @vite-ignore */
1849
- routesPath
1850
- );
1851
- const routes = routesMod.routes ?? routesMod.default ?? [];
1852
- fs.rmSync(path.resolve(root, "dist/server/_routes_prerender.mjs"), {
1853
- force: true
1854
- });
1832
+ const routesExport = ctx.bootstrapEntry ?? "src/lib/bootstrap.ts";
1833
+ let routes = [];
1834
+ const routesFileExists = fs.existsSync(path.resolve(root, routesExport));
1835
+ if (routesFileExists) {
1836
+ await vite.build({
1837
+ root,
1838
+ build: {
1839
+ ssr: routesExport,
1840
+ outDir: path.resolve(root, "dist/server"),
1841
+ emptyOutDir: false,
1842
+ rollupOptions: {
1843
+ output: { entryFileNames: "_routes_prerender.mjs" }
1844
+ }
1845
+ },
1846
+ resolve: ctx.resolvedResolve
1847
+ });
1848
+ const routesPath = pathToFileURL(
1849
+ path.resolve(root, "dist/server/_routes_prerender.mjs")
1850
+ ).href;
1851
+ const routesMod = await import(
1852
+ /* @vite-ignore */
1853
+ routesPath
1854
+ );
1855
+ routes = routesMod.routes ?? routesMod.default ?? [];
1856
+ fs.rmSync(path.resolve(root, "dist/server/_routes_prerender.mjs"), {
1857
+ force: true
1858
+ });
1859
+ }
1855
1860
  const prerenderPaths = /* @__PURE__ */ new Set();
1856
1861
  for (const r of routes) {
1857
1862
  if (r.renderMode === "prerender" && r.path && !r.path.includes(":")) {
@@ -2299,7 +2304,7 @@ function vercelAdapter() {
2299
2304
  try {
2300
2305
  const funcDir = path.resolve(
2301
2306
  root,
2302
- ".vercel/output/functions/ssr.func"
2307
+ ".vercel/output/functions/[[...path]].func"
2303
2308
  );
2304
2309
  await buildBundle(ctx, {
2305
2310
  entry: ".vercel-entry.tmp.mjs",
@@ -2327,10 +2332,7 @@ function vercelAdapter() {
2327
2332
  JSON.stringify(
2328
2333
  {
2329
2334
  version: 3,
2330
- routes: [
2331
- { handle: "filesystem" },
2332
- { src: "/(.*)", dest: "/ssr/$1" }
2333
- ]
2335
+ routes: [{ handle: "filesystem" }]
2334
2336
  },
2335
2337
  null,
2336
2338
  2
@@ -2360,16 +2362,6 @@ function vercelAdapter() {
2360
2362
  contentType: "text/html; charset=utf-8"
2361
2363
  };
2362
2364
  }
2363
- const isrRoutes = prerendered.map(({ url }) => ({
2364
- src: `^${url.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/?$`,
2365
- dest: url,
2366
- has: [{ type: "header", key: "x-vercel-isr" }]
2367
- }));
2368
- config.routes = [
2369
- ...isrRoutes,
2370
- { handle: "filesystem" },
2371
- { src: "/(.*)", dest: "/ssr/$1" }
2372
- ];
2373
2365
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
2374
2366
  }
2375
2367
  console.log(" Vercel output \u2192 .vercel/output/\n");
@@ -2879,6 +2871,7 @@ function finesoftFrontViteConfig(options = {}) {
2879
2871
  root,
2880
2872
  ssrEntry,
2881
2873
  setupPath: typeof options.setup === "string" ? options.setup : void 0,
2874
+ bootstrapEntry: options.bootstrapEntry,
2882
2875
  locales,
2883
2876
  defaultLocale,
2884
2877
  templateHtml,