vitepress 0.21.2 → 0.21.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.
package/dist/node/cli.js
CHANGED
package/dist/node/index.js
CHANGED
|
@@ -12306,12 +12306,19 @@ const SHARED_PATH = path__default["default"].join(DIST_CLIENT_PATH, "shared");
|
|
|
12306
12306
|
const DEFAULT_THEME_PATH = path__default["default"].join(DIST_CLIENT_PATH, "theme-default");
|
|
12307
12307
|
const SITE_DATA_ID = "@siteData";
|
|
12308
12308
|
const SITE_DATA_REQUEST_PATH = "/" + SITE_DATA_ID;
|
|
12309
|
-
|
|
12309
|
+
const vueRuntimePath = "vue/dist/vue.runtime.esm-bundler.js";
|
|
12310
|
+
function resolveAliases(root, themeDir) {
|
|
12310
12311
|
const paths = {
|
|
12311
12312
|
"/@theme": themeDir,
|
|
12312
12313
|
"/@shared": SHARED_PATH,
|
|
12313
12314
|
[SITE_DATA_ID]: SITE_DATA_REQUEST_PATH
|
|
12314
12315
|
};
|
|
12316
|
+
let vuePath;
|
|
12317
|
+
try {
|
|
12318
|
+
vuePath = require.resolve(vueRuntimePath, { paths: [root] });
|
|
12319
|
+
} catch (e) {
|
|
12320
|
+
vuePath = require.resolve(vueRuntimePath);
|
|
12321
|
+
}
|
|
12315
12322
|
const aliases = [
|
|
12316
12323
|
...Object.keys(paths).map((p) => ({
|
|
12317
12324
|
find: p,
|
|
@@ -12328,7 +12335,7 @@ function resolveAliases(themeDir) {
|
|
|
12328
12335
|
{ find: /^vitepress\//, replacement: PKG_ROOT + "/" },
|
|
12329
12336
|
{
|
|
12330
12337
|
find: /^vue$/,
|
|
12331
|
-
replacement:
|
|
12338
|
+
replacement: vuePath
|
|
12332
12339
|
}
|
|
12333
12340
|
];
|
|
12334
12341
|
return aliases;
|
|
@@ -13373,7 +13380,7 @@ async function resolveConfig(root = process.cwd(), command = "serve", mode = "de
|
|
|
13373
13380
|
outDir,
|
|
13374
13381
|
tempDir: resolve(root, ".temp"),
|
|
13375
13382
|
markdown: userConfig.markdown,
|
|
13376
|
-
alias: resolveAliases(themeDir),
|
|
13383
|
+
alias: resolveAliases(root, themeDir),
|
|
13377
13384
|
vue: userConfig.vue,
|
|
13378
13385
|
vite: userConfig.vite,
|
|
13379
13386
|
shouldPreload: userConfig.shouldPreload,
|
|
@@ -40056,7 +40063,15 @@ async function renderPage(config, page, result, appChunk, cssChunk, pageToHashMa
|
|
|
40056
40063
|
const routePath = `/${page.replace(/\.md$/, "")}`;
|
|
40057
40064
|
const siteData = resolveSiteDataByRoute(config.site, routePath);
|
|
40058
40065
|
router.go(routePath);
|
|
40059
|
-
|
|
40066
|
+
let rendererPath;
|
|
40067
|
+
try {
|
|
40068
|
+
rendererPath = require.resolve("vue/server-renderer", {
|
|
40069
|
+
paths: [config.root]
|
|
40070
|
+
});
|
|
40071
|
+
} catch (e) {
|
|
40072
|
+
rendererPath = require.resolve("vue/server-renderer");
|
|
40073
|
+
}
|
|
40074
|
+
const content = await require(rendererPath).renderToString(app);
|
|
40060
40075
|
const pageName = page.replace(/\//g, "_");
|
|
40061
40076
|
const pageServerJsFileName = pageName + ".js";
|
|
40062
40077
|
const pageHash = pageToHashMap[pageName.toLowerCase()];
|