vike-lite 1.6.0 → 1.6.1
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/server.d.mts +2 -2
- package/dist/server.mjs +2 -2
- package/dist/vite.mjs +8 -7
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@ import { t as Config } from "../index-Dt5n1zWh.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/server/store.d.ts
|
|
4
4
|
interface VikeState {
|
|
5
|
-
routes:
|
|
6
|
-
errorRoute:
|
|
5
|
+
routes: any[];
|
|
6
|
+
errorRoute: any | null;
|
|
7
7
|
config: Config | null;
|
|
8
8
|
manifest: Manifest | undefined;
|
|
9
9
|
}
|
package/dist/server.mjs
CHANGED
|
@@ -74,8 +74,8 @@ async function buildPageContext(urlPathname, urlOriginal, isJsonRequest) {
|
|
|
74
74
|
urlPathname
|
|
75
75
|
};
|
|
76
76
|
const [dataMod, titleMod, PageModule, HeadModule, LayoutModule] = await Promise.all([
|
|
77
|
-
route.
|
|
78
|
-
route.
|
|
77
|
+
route.data?.() ?? null,
|
|
78
|
+
route.title?.() ?? null,
|
|
79
79
|
isJsonRequest ? null : route.Page(),
|
|
80
80
|
isJsonRequest ? null : route.Head?.() ?? null,
|
|
81
81
|
isJsonRequest ? null : route.Layout?.() ?? null
|
package/dist/vite.mjs
CHANGED
|
@@ -23,13 +23,15 @@ function generateRoutes(viteRoot, pagesDir) {
|
|
|
23
23
|
const currentHead = headFile ? `${importPath}/${headFile}` : parentHead;
|
|
24
24
|
const pageFile = findFile(files, "+Page", pageExtensionsX);
|
|
25
25
|
if (pageFile) {
|
|
26
|
+
const dataFile = findFile(files, "+data", pageExtensions);
|
|
27
|
+
const titleFile = findFile(files, "+title", pageExtensions);
|
|
26
28
|
const route = {
|
|
27
29
|
path: routePath || "/",
|
|
28
|
-
page: `${importPath}/${pageFile}
|
|
30
|
+
page: `${importPath}/${pageFile}`,
|
|
31
|
+
hasData: dataFile !== void 0,
|
|
32
|
+
hasTitle: titleFile !== void 0
|
|
29
33
|
};
|
|
30
|
-
const dataFile = findFile(files, "+data", pageExtensions);
|
|
31
34
|
if (dataFile) route.data = `${importPath}/${dataFile}`;
|
|
32
|
-
const titleFile = findFile(files, "+title", pageExtensions);
|
|
33
35
|
if (titleFile) route.title = `${importPath}/${titleFile}`;
|
|
34
36
|
if (currentLayout) route.layout = currentLayout;
|
|
35
37
|
if (currentHead) route.head = currentHead;
|
|
@@ -183,11 +185,10 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index", apiPre
|
|
|
183
185
|
code += `{path:'${r.path}',page:'${r.page}',Page:()=>import('/${r.page}'),`;
|
|
184
186
|
if (r.head) code += `head:'${r.head}',Head:()=>import('/${r.head}'),`;
|
|
185
187
|
if (r.layout) code += `layout:'${r.layout}',Layout:()=>import('/${r.layout}'),`;
|
|
186
|
-
|
|
187
|
-
if (r.title) code += `title:'${r.title}',`;
|
|
188
|
+
code += `hasData:${r.hasData},hasTitle:${r.hasTitle},`;
|
|
188
189
|
if (isSSR) {
|
|
189
|
-
if (r.
|
|
190
|
-
if (r.
|
|
190
|
+
if (r.hasData) code += `data:()=>import('/${r.data}'),`;
|
|
191
|
+
if (r.hasTitle) code += `title:()=>import('/${r.title}'),`;
|
|
191
192
|
}
|
|
192
193
|
code += "},";
|
|
193
194
|
}
|