docs:更新文档

This commit is contained in:
张益铭
2021-03-01 15:06:11 +08:00
parent 1542135ab0
commit 9064b372e8
5835 changed files with 904126 additions and 161722 deletions

10
node_modules/vitepress/dist/node/shared/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { SiteData } from '/@types/shared';
export declare function resolveSiteDataByRoute(siteData: SiteData, route: string): {
themeConfig: any;
locales: {};
lang: string;
title: string;
description: string;
base: string;
head: import("../../../types/shared").HeadConfig[];
};

55
node_modules/vitepress/dist/node/shared/config.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveSiteDataByRoute = void 0;
const inBrowser = typeof window !== 'undefined';
function findMatchRoot(route, roots) {
// first match to the routes with the most deep level.
roots.sort((a, b) => {
const levelDelta = b.split('/').length - a.split('/').length;
if (levelDelta !== 0) {
return levelDelta;
}
else {
return b.length - a.length;
}
});
for (const r of roots) {
if (route.startsWith(r))
return r;
}
return undefined;
}
function resolveLocales(locales, route) {
const localeRoot = findMatchRoot(route, Object.keys(locales));
return localeRoot ? locales[localeRoot] : undefined;
}
// this merges the locales data to the main data by the route
function resolveSiteDataByRoute(siteData, route) {
route = cleanRoute(siteData, route);
const localeData = resolveLocales(siteData.locales || {}, route) || {};
const localeThemeConfig = resolveLocales((siteData.themeConfig && siteData.themeConfig.locales) || {}, route) || {};
return {
...siteData,
...localeData,
themeConfig: {
...siteData.themeConfig,
...localeThemeConfig,
// clean the locales to reduce the bundle size
locales: {}
},
locales: {}
};
}
exports.resolveSiteDataByRoute = resolveSiteDataByRoute;
/**
* Clean up the route by removing the `base` path if it's set in config.
*/
function cleanRoute(siteData, route) {
if (!inBrowser) {
return route;
}
const base = siteData.base;
const baseWithoutSuffix = base.endsWith('/') ? base.slice(0, -1) : base;
return route.slice(baseWithoutSuffix.length);
}
//# sourceMappingURL=config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/node/shared/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