@finesoft/front 0.1.21 → 0.1.22

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(":")) {
@@ -2879,6 +2884,7 @@ function finesoftFrontViteConfig(options = {}) {
2879
2884
  root,
2880
2885
  ssrEntry,
2881
2886
  setupPath: typeof options.setup === "string" ? options.setup : void 0,
2887
+ bootstrapEntry: options.bootstrapEntry,
2882
2888
  locales,
2883
2889
  defaultLocale,
2884
2890
  templateHtml,