vike-lite 1.13.3 → 1.14.0
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/{server-BFTxx6MH.mjs → server-CTx_3HFS.mjs} +22 -24
- package/dist/server.mjs +1 -1
- package/dist/vite.d.mts +2 -2
- package/dist/vite.mjs +9 -5
- package/package.json +1 -1
|
@@ -21,27 +21,7 @@ function withBase(file) {
|
|
|
21
21
|
return `${BASE_URL === "/" ? "" : BASE_URL.endsWith("/") ? BASE_URL.slice(0, -1) : BASE_URL}${file.startsWith("/") ? file : `/${file}`}`;
|
|
22
22
|
}
|
|
23
23
|
const assetsCache = /* @__PURE__ */ new WeakMap();
|
|
24
|
-
function
|
|
25
|
-
if (!isProd) return computeAssets(route, nonce);
|
|
26
|
-
const nonceKey = nonce || "";
|
|
27
|
-
let routeCache = assetsCache.get(route);
|
|
28
|
-
if (!routeCache) {
|
|
29
|
-
routeCache = /* @__PURE__ */ new Map();
|
|
30
|
-
assetsCache.set(route, routeCache);
|
|
31
|
-
}
|
|
32
|
-
let assets = routeCache.get(nonceKey);
|
|
33
|
-
if (!assets) {
|
|
34
|
-
assets = computeAssets(route, nonce);
|
|
35
|
-
routeCache.set(nonceKey, assets);
|
|
36
|
-
}
|
|
37
|
-
return assets;
|
|
38
|
-
}
|
|
39
|
-
function computeAssets(route, nonce) {
|
|
40
|
-
if (!isProd) return {
|
|
41
|
-
cssLinks: "",
|
|
42
|
-
jsPreloads: "",
|
|
43
|
-
entryClient: withBase("@id/virtual:vike-lite/entry-client")
|
|
44
|
-
};
|
|
24
|
+
function computeAssetFiles(route) {
|
|
45
25
|
const cssFiles = /* @__PURE__ */ new Set();
|
|
46
26
|
const jsFiles = /* @__PURE__ */ new Map();
|
|
47
27
|
const { manifest } = store;
|
|
@@ -68,11 +48,29 @@ function computeAssets(route, nonce) {
|
|
|
68
48
|
const criticalJs = [];
|
|
69
49
|
const sharedJs = [];
|
|
70
50
|
for (const [file, isCritical] of jsFiles) (isCritical ? criticalJs : sharedJs).push(file);
|
|
51
|
+
return {
|
|
52
|
+
cssFiles: [...cssFiles],
|
|
53
|
+
criticalJs,
|
|
54
|
+
sharedJs,
|
|
55
|
+
entryClientFile: manifest[virtualEntryClientKey].file
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function getAssets(route, nonce) {
|
|
59
|
+
if (!isProd) return {
|
|
60
|
+
cssLinks: "",
|
|
61
|
+
jsPreloads: "",
|
|
62
|
+
entryClient: withBase("@id/virtual:vike-lite/entry-client")
|
|
63
|
+
};
|
|
64
|
+
let files = assetsCache.get(route);
|
|
65
|
+
if (!files) {
|
|
66
|
+
files = computeAssetFiles(route);
|
|
67
|
+
assetsCache.set(route, files);
|
|
68
|
+
}
|
|
71
69
|
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
72
70
|
return {
|
|
73
|
-
cssLinks:
|
|
74
|
-
jsPreloads: [...criticalJs.map((href) => `<link rel="modulepreload" href="${withBase(href)}" crossorigin fetchpriority="high"${nonceAttr}>`), ...sharedJs.map((href) => `<link rel="modulepreload" href="${withBase(href)}" crossorigin${nonceAttr}>`)].join(""),
|
|
75
|
-
entryClient: withBase(
|
|
71
|
+
cssLinks: files.cssFiles.map((href) => `<link rel="stylesheet" href="${withBase(href)}"${nonceAttr}>`).join(""),
|
|
72
|
+
jsPreloads: [...files.criticalJs.map((href) => `<link rel="modulepreload" href="${withBase(href)}" crossorigin fetchpriority="high"${nonceAttr}>`), ...files.sharedJs.map((href) => `<link rel="modulepreload" href="${withBase(href)}" crossorigin${nonceAttr}>`)].join(""),
|
|
73
|
+
entryClient: withBase(files.entryClientFile)
|
|
76
74
|
};
|
|
77
75
|
}
|
|
78
76
|
async function buildPageContext(urlPathname, urlOriginal, isJsonRequest) {
|
package/dist/server.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as renderPage } from "./server-
|
|
1
|
+
import { t as renderPage } from "./server-CTx_3HFS.mjs";
|
|
2
2
|
export { renderPage };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from "vite";
|
|
2
2
|
//#region src/vite/index.d.ts
|
|
3
|
-
declare function
|
|
3
|
+
declare function vikeLite({ pagesDir, serverEntry, apiPrefix, prerender }?: {
|
|
4
4
|
/**
|
|
5
5
|
* The directory where your page components are located.
|
|
6
6
|
* This is where the plugin will look for your page files to generate routes.
|
|
@@ -27,4 +27,4 @@ declare function routerPlugin({ pagesDir, serverEntry, apiPrefix, prerender }?:
|
|
|
27
27
|
prerender?: boolean;
|
|
28
28
|
}): Plugin;
|
|
29
29
|
//#endregion
|
|
30
|
-
export {
|
|
30
|
+
export { vikeLite as default };
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as renderPage } from "./server-
|
|
1
|
+
import { t as renderPage } from "./server-CTx_3HFS.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { Readable } from "node:stream";
|
|
@@ -96,10 +96,14 @@ async function injectFOUCStyles(server, html) {
|
|
|
96
96
|
}
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/config.ts
|
|
99
|
-
const SUPPORTED_RENDERERS = [
|
|
99
|
+
const SUPPORTED_RENDERERS = [
|
|
100
|
+
"react",
|
|
101
|
+
"solid",
|
|
102
|
+
"vue"
|
|
103
|
+
];
|
|
100
104
|
//#endregion
|
|
101
105
|
//#region src/vite/index.ts
|
|
102
|
-
function
|
|
106
|
+
function vikeLite({ pagesDir = "pages", serverEntry = "server/index", apiPrefix = "/api", prerender = false } = {}) {
|
|
103
107
|
const isProd = process.env.NODE_ENV === "production";
|
|
104
108
|
let viteConfigRoot;
|
|
105
109
|
let outDir;
|
|
@@ -151,7 +155,7 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index", apiPre
|
|
|
151
155
|
codeSplitting: { groups: [
|
|
152
156
|
{
|
|
153
157
|
name: "framework",
|
|
154
|
-
test: /[\\/]vike-lite(?:-\w+)?[\\/]|[\\/](?:solid-js|@
|
|
158
|
+
test: /[\\/]vike-lite(?:-\w+)?[\\/]|[\\/](?:solid-js|vue|@vue|react|react-dom)[\\/]|^\0virtual:vike-lite\/(setup|renderer)$/,
|
|
155
159
|
priority: 30
|
|
156
160
|
},
|
|
157
161
|
{
|
|
@@ -390,4 +394,4 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index", apiPre
|
|
|
390
394
|
};
|
|
391
395
|
}
|
|
392
396
|
//#endregion
|
|
393
|
-
export {
|
|
397
|
+
export { vikeLite as default };
|