vike-lite 1.15.15 → 1.15.16
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/__internal/client.mjs +1 -1
- package/dist/vite.mjs +13 -9
- package/package.json +2 -2
|
@@ -138,7 +138,7 @@ async function resolveHydrationView(initialContext, isHydration, routes, errorRo
|
|
|
138
138
|
Head: null
|
|
139
139
|
};
|
|
140
140
|
if (!isHydration) return emptyView;
|
|
141
|
-
if ((initialContext.is404 || initialContext.is500 || initialContext.errorMessage)
|
|
141
|
+
if (errorRoute && (initialContext.is404 || initialContext.is500 || initialContext.errorMessage)) return loadViewModules(errorRoute);
|
|
142
142
|
const matched = matchRoute(initialContext.urlPathname ?? globalThis.location.pathname, routes);
|
|
143
143
|
return matched ? loadViewModules(matched.route) : emptyView;
|
|
144
144
|
}
|
package/dist/vite.mjs
CHANGED
|
@@ -209,7 +209,7 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
209
209
|
} : VIRTUAL.entryServer,
|
|
210
210
|
output: {
|
|
211
211
|
format: "esm",
|
|
212
|
-
entryFileNames: "
|
|
212
|
+
entryFileNames: "[name].mjs",
|
|
213
213
|
chunkFileNames: (chunkInfo) => {
|
|
214
214
|
if (chunkInfo.facadeModuleId?.includes(`/${pagesDir}/`)) return "assets/pages/[name].[hash].mjs";
|
|
215
215
|
return "assets/chunks/[name].[hash].mjs";
|
|
@@ -221,7 +221,7 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
221
221
|
};
|
|
222
222
|
},
|
|
223
223
|
configResolved(config) {
|
|
224
|
-
if (!config.plugins.some((plugin) => plugin.name?.startsWith("vike-lite-") && SUPPORTED_RENDERERS.includes(plugin.name.replace("vike-lite-", "")))) throw new Error(
|
|
224
|
+
if (!config.plugins.some((plugin) => plugin.name?.startsWith("vike-lite-") && SUPPORTED_RENDERERS.includes(plugin.name.replace("vike-lite-", "")))) throw new Error(`❌ No UI adapter plugin found in 'vite.config': please install and configure one of ${SUPPORTED_RENDERERS.map((r) => `vike-lite-${r}`).join(", ")}`);
|
|
225
225
|
},
|
|
226
226
|
resolveId(id) {
|
|
227
227
|
if (VIRTUAL_VALUES.has(id)) return "\0" + id;
|
|
@@ -283,7 +283,7 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
283
283
|
break;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
if (!serverEntryPath) throw new Error(
|
|
286
|
+
if (!serverEntryPath) throw new Error(`❌ serverEntry ${serverEntry} file not found`);
|
|
287
287
|
serverEntryPath = serverEntryPath.replaceAll("\\", "/");
|
|
288
288
|
return importSetup + `export*from'${serverEntryPath}';export{default}from'${serverEntryPath}';`;
|
|
289
289
|
}
|
|
@@ -314,7 +314,7 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
314
314
|
}
|
|
315
315
|
if (shouldPrerender) {
|
|
316
316
|
if (route.path.includes(":") && dynamicUrls.length === 0) {
|
|
317
|
-
console.warn(
|
|
317
|
+
console.warn(`⚠️ Skipping dynamic route ${route.path}: no URLs provided by +prerender. Return an array of URLs to prerender it.`);
|
|
318
318
|
continue;
|
|
319
319
|
}
|
|
320
320
|
if (!route.path.includes(":")) urlsToPrerender.add(route.path);
|
|
@@ -322,7 +322,7 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
if (urlsToPrerender.size === 0) return;
|
|
325
|
-
console.log("
|
|
325
|
+
console.log("📦 Starting Static Site Generation (SSG)…");
|
|
326
326
|
let generatedCount = 0;
|
|
327
327
|
const clientDir = path.join(viteConfigRoot, outDir, "client");
|
|
328
328
|
for (const urlPath of urlsToPrerender) {
|
|
@@ -331,18 +331,22 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
331
331
|
const outDirRoute = path.join(clientDir, urlPath === "/" ? "" : urlPath);
|
|
332
332
|
fs.mkdirSync(outDirRoute, { recursive: true });
|
|
333
333
|
fs.writeFileSync(path.join(outDirRoute, "index.html"), await htmlRes.text());
|
|
334
|
-
} else throw new Error(
|
|
334
|
+
} else throw new Error(`❌ SSG HTML Error for "${urlPath}"`);
|
|
335
335
|
const jsonTarget = urlPath === "/" ? "/index" : urlPath;
|
|
336
336
|
const jsonRes = await renderPage(new Request(`http://localhost${baseUrl}${jsonTarget}.pageContext.json`));
|
|
337
337
|
if (jsonRes?.ok) {
|
|
338
338
|
const jsonOutPath = path.join(clientDir, `${jsonTarget}.pageContext.json`);
|
|
339
339
|
fs.mkdirSync(path.dirname(jsonOutPath), { recursive: true });
|
|
340
340
|
fs.writeFileSync(jsonOutPath, await jsonRes.text());
|
|
341
|
-
} else throw new Error(
|
|
342
|
-
console.log(` → ${urlPath}`);
|
|
341
|
+
} else throw new Error(`❌ SSG JSON Error for "${jsonTarget}"`);
|
|
342
|
+
console.log(` route → ${urlPath}`);
|
|
343
343
|
generatedCount++;
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
if (urlsToPrerender.size === 0) {
|
|
346
|
+
console.warn("ℹ️ No static routes to generate. If you don't want to use SSG, in the 'vite.config', set \"prerender\" option as \"false\" or remove.");
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
console.log(`✨ SSG Completed! Generated ${generatedCount} static routes`);
|
|
346
350
|
},
|
|
347
351
|
configureServer(server) {
|
|
348
352
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike-lite",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@types/node": "^26.1.1",
|
|
85
|
-
"tsdown": "^0.22.
|
|
85
|
+
"tsdown": "^0.22.11",
|
|
86
86
|
"vite": "^8.1.5",
|
|
87
87
|
"vitest": "^4.1.10"
|
|
88
88
|
},
|