vike-lite 1.13.2 → 1.13.3
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/server/store.d.ts
|
|
2
2
|
interface VikeState {
|
|
3
|
-
routes: typeof import('virtual:routes')['routes'];
|
|
4
|
-
errorRoute: typeof import('virtual:routes')['errorRoute'] | null;
|
|
5
|
-
config: typeof import('virtual:routes')['config'] | null;
|
|
6
|
-
manifest: typeof import('virtual:client-manifest')['default'] | null;
|
|
3
|
+
routes: typeof import('virtual:vike-lite/routes')['routes'];
|
|
4
|
+
errorRoute: typeof import('virtual:vike-lite/routes')['errorRoute'] | null;
|
|
5
|
+
config: typeof import('virtual:vike-lite/routes')['config'] | null;
|
|
6
|
+
manifest: typeof import('virtual:vike-lite/client-manifest')['default'] | null;
|
|
7
7
|
}
|
|
8
8
|
declare const store: VikeState;
|
|
9
9
|
declare function setVikeState(newState: Partial<VikeState>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/__internal/shared/matchRoute.d.ts
|
|
2
|
-
declare function matchRoute(urlPathname: string, routes: typeof import('virtual:routes').routes): {
|
|
2
|
+
declare function matchRoute(urlPathname: string, routes: typeof import('virtual:vike-lite/routes').routes): {
|
|
3
3
|
route: any;
|
|
4
4
|
routeParams: Record<string, string>;
|
|
5
5
|
} | null;
|
|
@@ -40,7 +40,7 @@ function computeAssets(route, nonce) {
|
|
|
40
40
|
if (!isProd) return {
|
|
41
41
|
cssLinks: "",
|
|
42
42
|
jsPreloads: "",
|
|
43
|
-
entryClient: withBase("@id/virtual:entry-client")
|
|
43
|
+
entryClient: withBase("@id/virtual:vike-lite/entry-client")
|
|
44
44
|
};
|
|
45
45
|
const cssFiles = /* @__PURE__ */ new Set();
|
|
46
46
|
const jsFiles = /* @__PURE__ */ new Map();
|
package/dist/server.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as renderPage } from "./server-
|
|
1
|
+
import { t as renderPage } from "./server-BFTxx6MH.mjs";
|
|
2
2
|
export { renderPage };
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as renderPage } from "./server-
|
|
1
|
+
import { t as renderPage } from "./server-BFTxx6MH.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { Readable } from "node:stream";
|
|
@@ -105,14 +105,14 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index", apiPre
|
|
|
105
105
|
let outDir;
|
|
106
106
|
let hasAnyPrerender;
|
|
107
107
|
const VIRTUAL = {
|
|
108
|
-
routes: "virtual:routes",
|
|
109
|
-
manifest: "virtual:client-manifest",
|
|
108
|
+
routes: "virtual:vike-lite/routes",
|
|
109
|
+
manifest: "virtual:vike-lite/client-manifest",
|
|
110
110
|
client: "virtual:vike-lite/client",
|
|
111
111
|
server: "virtual:vike-lite/server",
|
|
112
|
-
entryClient: "virtual:entry-client",
|
|
113
112
|
setup: "virtual:vike-lite/setup",
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
entryClient: "virtual:vike-lite/entry-client",
|
|
114
|
+
entryServer: "virtual:vike-lite/entry-server",
|
|
115
|
+
entryPrerender: "virtual:vike-lite/entry-prerender"
|
|
116
116
|
};
|
|
117
117
|
const VIRTUAL_VALUES = new Set(Object.values(VIRTUAL));
|
|
118
118
|
const RESOLVED = Object.fromEntries(Object.entries(VIRTUAL).map(([k, v]) => [k, `\0${v}`]));
|
|
@@ -217,7 +217,7 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index", apiPre
|
|
|
217
217
|
if (id === RESOLVED.routes) {
|
|
218
218
|
const { routes, errorRoute } = generateRoutes(viteConfigRoot, pagesDir);
|
|
219
219
|
const isSSR = options.ssr;
|
|
220
|
-
let code = `import
|
|
220
|
+
let code = `import{onRenderHtml}from'${VIRTUAL.server}';export const config={onRenderHtml};export const routes=[`;
|
|
221
221
|
for (const r of routes) {
|
|
222
222
|
code += `{path:'${r.path}',page:'${r.page}',Page:()=>import('/${r.page}'),`;
|
|
223
223
|
if (r.head) code += `head:'${r.head}',Head:()=>import('/${r.head}'),`;
|
|
@@ -232,23 +232,26 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index", apiPre
|
|
|
232
232
|
}
|
|
233
233
|
code += "},";
|
|
234
234
|
}
|
|
235
|
-
code += "]
|
|
235
|
+
code += "];";
|
|
236
236
|
if (errorRoute) {
|
|
237
237
|
const e = errorRoute;
|
|
238
238
|
code += `export const errorRoute={path:'${e.path}',page:'${e.page}',Page:()=>import('/${e.page}'),`;
|
|
239
239
|
if (e.layout) code += `layout:'${e.layout}',Layout:()=>import('/${e.layout}'),`;
|
|
240
240
|
if (e.head) code += `head:'${e.head}',Head:()=>import('/${e.head}'),`;
|
|
241
|
-
code += "}
|
|
242
|
-
} else code += "export const errorRoute=null
|
|
241
|
+
code += "};";
|
|
242
|
+
} else code += "export const errorRoute=null;";
|
|
243
243
|
return code;
|
|
244
244
|
}
|
|
245
245
|
if (id === RESOLVED.manifest) {
|
|
246
|
-
if (!isProd || !options?.ssr) return "export default
|
|
246
|
+
if (!isProd || !options?.ssr) return "export default{}";
|
|
247
247
|
const manifestPath = path.join(viteConfigRoot, outDir, "client/.vite/manifest.json");
|
|
248
248
|
return `export default ${fs.readFileSync(manifestPath, "utf8")}`;
|
|
249
249
|
}
|
|
250
|
-
if (id === RESOLVED.entryClient) return `import{routes,errorRoute}from'${VIRTUAL.routes}';import{onRenderClient}from'${VIRTUAL.client}';await
|
|
251
|
-
if (id === RESOLVED.setup)
|
|
250
|
+
if (id === RESOLVED.entryClient) return `import{routes,errorRoute}from'${VIRTUAL.routes}';import{onRenderClient}from'${VIRTUAL.client}';await(await onRenderClient()).default({routes,errorRoute});`;
|
|
251
|
+
if (id === RESOLVED.setup) {
|
|
252
|
+
const manifestContent = isProd ? `(await import('${VIRTUAL.manifest}')).default` : "null";
|
|
253
|
+
return `import{routes,errorRoute,config}from'${VIRTUAL.routes}';import{setVikeState}from'vike-lite/__internal/server';const manifest=${manifestContent};setVikeState({routes,errorRoute,config,manifest});`;
|
|
254
|
+
}
|
|
252
255
|
if (id === RESOLVED.entryServer) {
|
|
253
256
|
if (serverEntry) {
|
|
254
257
|
const basePath = path.resolve(viteConfigRoot, serverEntry);
|
|
@@ -264,8 +267,8 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index", apiPre
|
|
|
264
267
|
if (!serverEntryPath) throw new Error(`[vike-lite] serverEntry ${serverEntry} file not found`);
|
|
265
268
|
return `import '${VIRTUAL.setup}';export * from'${serverEntryPath}';export{default}from'${serverEntryPath}';`;
|
|
266
269
|
}
|
|
267
|
-
const
|
|
268
|
-
return `import
|
|
270
|
+
const defaultServerEntryContent = isProd ? fs.readFileSync(path.resolve(viteConfigRoot, "defaultServerEntry.mjs"), "utf8") : `import{renderPage}from'vike-lite/server'\n`;
|
|
271
|
+
return `import'${VIRTUAL.setup}'\n` + defaultServerEntryContent + "export default{fetch:renderPage}\n";
|
|
269
272
|
}
|
|
270
273
|
if (id === RESOLVED.entryPrerender) return `import'${VIRTUAL.setup}';export{routes}from'${VIRTUAL.routes}';`;
|
|
271
274
|
},
|
|
@@ -320,7 +323,7 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index", apiPre
|
|
|
320
323
|
fs.mkdirSync(path.dirname(jsonOutPath), { recursive: true });
|
|
321
324
|
fs.writeFileSync(jsonOutPath, await jsonRes.text());
|
|
322
325
|
} else throw new Error(`[vike-lite] ❌ SSG JSON Error for "${jsonTarget}"`);
|
|
323
|
-
console.log(`
|
|
326
|
+
console.log(` → ${urlPath}`);
|
|
324
327
|
generatedCount++;
|
|
325
328
|
}
|
|
326
329
|
console.log(`[vike-lite] ✨ SSG Completed! Generated ${generatedCount} static routes`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike-lite",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/node": "^26.1.1",
|
|
54
|
-
"tsdown": "^0.22.
|
|
54
|
+
"tsdown": "^0.22.7",
|
|
55
55
|
"vite": "^8.1.4"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|