mirror of
https://github.com/XTLS/Xray-docs-next.git
synced 2025-01-30 22:41:40 +03:00
update dependences
This commit is contained in:
parent
362754555b
commit
abfeb40477
@ -1,8 +1,13 @@
|
|||||||
import { defineUserConfig } from "@vuepress/cli";
|
import { viteBundler } from "@vuepress/bundler-vite";
|
||||||
import type { DefaultThemeOptions } from "@vuepress/theme-default";
|
import { webpackBundler } from "@vuepress/bundler-webpack";
|
||||||
import * as sidebar from "./config/sidebar";
|
import { UserConfig, defineUserConfig } from "@vuepress/cli";
|
||||||
|
import { searchPlugin } from "@vuepress/plugin-search";
|
||||||
|
import markdownItFootnote from "markdown-it-footnote";
|
||||||
|
import { defaultTheme } from "vuepress";
|
||||||
import * as navbar from "./config/navbar";
|
import * as navbar from "./config/navbar";
|
||||||
import * as path from "path";
|
import { MermaidPlugin } from "./config/plugins/mermaidPlugin";
|
||||||
|
import * as sidebar from "./config/sidebar";
|
||||||
|
import { docsPlugin } from "./theme/index";
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === "production";
|
const isProduction = process.env.NODE_ENV === "production";
|
||||||
const forMainRepo = process.env.XRAY_DOCS_MAIN_REPO === "true";
|
const forMainRepo = process.env.XRAY_DOCS_MAIN_REPO === "true";
|
||||||
@ -14,20 +19,15 @@ console.log(
|
|||||||
isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite"
|
isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite"
|
||||||
);
|
);
|
||||||
|
|
||||||
export default defineUserConfig<DefaultThemeOptions>({
|
export default defineUserConfig(<UserConfig>{
|
||||||
theme: path.join(__dirname, "./theme"),
|
|
||||||
plugins: [
|
plugins: [
|
||||||
[
|
searchPlugin({
|
||||||
"@vuepress/plugin-search",
|
locales: {
|
||||||
{
|
"/": {
|
||||||
locales: {
|
placeholder: "搜索",
|
||||||
"/": {
|
|
||||||
placeholder: "搜索",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
}),
|
||||||
["@vuepress/plugin-debug", !isProduction],
|
|
||||||
],
|
],
|
||||||
base: forMainRepo ? "/" : "/Xray-docs-next/",
|
base: forMainRepo ? "/" : "/Xray-docs-next/",
|
||||||
locales: {
|
locales: {
|
||||||
@ -42,7 +42,8 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||||||
description: "Official document of Xray",
|
description: "Official document of Xray",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
themeConfig: {
|
theme: defaultTheme({
|
||||||
|
...docsPlugin,
|
||||||
smoothScroll: true,
|
smoothScroll: true,
|
||||||
repo: "xtls/xray-core",
|
repo: "xtls/xray-core",
|
||||||
docsRepo: "xtls/Xray-docs-next",
|
docsRepo: "xtls/Xray-docs-next",
|
||||||
@ -56,6 +57,7 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||||||
},
|
},
|
||||||
locales: {
|
locales: {
|
||||||
"/": {
|
"/": {
|
||||||
|
navbar: navbar.hans,
|
||||||
repoLabel: "查看源码",
|
repoLabel: "查看源码",
|
||||||
editLinkText: "帮助我们改善此页面!",
|
editLinkText: "帮助我们改善此页面!",
|
||||||
tip: "提示",
|
tip: "提示",
|
||||||
@ -72,31 +74,30 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||||||
"入站代理",
|
"入站代理",
|
||||||
"出站代理",
|
"出站代理",
|
||||||
"底层传输",
|
"底层传输",
|
||||||
"/config/"
|
"/config/",
|
||||||
),
|
),
|
||||||
"/document/": sidebar.getDocumentSidebar(
|
"/document/": sidebar.getDocumentSidebar(
|
||||||
"快速入门文档",
|
"快速入门文档",
|
||||||
"/document/"
|
"/document/",
|
||||||
),
|
),
|
||||||
"/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
"/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
||||||
"小小白白话文",
|
"小小白白话文",
|
||||||
"/document/level-0/"
|
"/document/level-0/",
|
||||||
),
|
),
|
||||||
"/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
"/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
||||||
"入门技巧",
|
"入门技巧",
|
||||||
"/document/level-1/"
|
"/document/level-1/",
|
||||||
),
|
),
|
||||||
"/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
"/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
||||||
"进阶技巧",
|
"进阶技巧",
|
||||||
"/document/level-2/"
|
"/document/level-2/",
|
||||||
),
|
),
|
||||||
"/development/": sidebar.getDevelopmentSidebar(
|
"/development/": sidebar.getDevelopmentSidebar(
|
||||||
"开发指南",
|
"开发指南",
|
||||||
"协议详解",
|
"协议详解",
|
||||||
"/development/"
|
"/development/",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
navbar: navbar.hans,
|
|
||||||
},
|
},
|
||||||
"/en/": {
|
"/en/": {
|
||||||
repoLabel: "Source",
|
repoLabel: "Source",
|
||||||
@ -114,30 +115,30 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||||||
"Inbound Protocol",
|
"Inbound Protocol",
|
||||||
"Outbound Protocol",
|
"Outbound Protocol",
|
||||||
"Stream Transport Protocol",
|
"Stream Transport Protocol",
|
||||||
"/en/config/"
|
"/en/config/",
|
||||||
),
|
),
|
||||||
"/en/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
"/en/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
||||||
"Beginner Tutorial",
|
"Beginner Tutorial",
|
||||||
"/en/document/level-0/"
|
"/en/document/level-0/",
|
||||||
),
|
),
|
||||||
"/en/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
"/en/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
||||||
"Getting Started Tips",
|
"Getting Started Tips",
|
||||||
"/en/document/level-1/"
|
"/en/document/level-1/",
|
||||||
),
|
),
|
||||||
"/en/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
"/en/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
||||||
"Advanced Documentation",
|
"Advanced Documentation",
|
||||||
"/en/document/level-2/"
|
"/en/document/level-2/",
|
||||||
),
|
),
|
||||||
"/en/development/": sidebar.getDevelopmentSidebar(
|
"/en/development/": sidebar.getDevelopmentSidebar(
|
||||||
"Developer Guide",
|
"Developer Guide",
|
||||||
"Protocol Details",
|
"Protocol Details",
|
||||||
"/en/development/"
|
"/en/development/",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
navbar: navbar.en,
|
navbar: navbar.en,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
head: [["link", { rel: "icon", href: `/logo.png` }]],
|
head: [["link", { rel: "icon", href: `/logo.png` }]],
|
||||||
markdown: {
|
markdown: {
|
||||||
toc: {
|
toc: {
|
||||||
@ -145,7 +146,9 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
extendsMarkdown: (md) => {
|
extendsMarkdown: (md) => {
|
||||||
md.use(require("markdown-it-footnote"));
|
md.use(markdownItFootnote);
|
||||||
|
md.use(MermaidPlugin);
|
||||||
},
|
},
|
||||||
bundler: isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite",
|
bundler:
|
||||||
|
process.env.DOCS_BUNDLER === "webpack" ? webpackBundler() : viteBundler(),
|
||||||
});
|
});
|
||||||
|
5
docs/.vuepress/theme/plugin/mermaidPlugin.ts → docs/.vuepress/config/plugins/mermaidPlugin.ts
Normal file → Executable file
5
docs/.vuepress/theme/plugin/mermaidPlugin.ts → docs/.vuepress/config/plugins/mermaidPlugin.ts
Normal file → Executable file
@ -1,9 +1,8 @@
|
|||||||
// Reference: https://github.com/mermaid-js/mermaid
|
// Reference: https://github.com/mermaid-js/mermaid
|
||||||
|
|
||||||
import { PluginSimple } from "markdown-it/lib";
|
|
||||||
import { hash } from "@vuepress/utils";
|
import { hash } from "@vuepress/utils";
|
||||||
|
|
||||||
const MermaidPlugin: PluginSimple = function (md) {
|
const MermaidPlugin = function (md) {
|
||||||
const fence = md.renderer.rules.fence;
|
const fence = md.renderer.rules.fence;
|
||||||
md.renderer.rules.fence = (...args) => {
|
md.renderer.rules.fence = (...args) => {
|
||||||
const [tokens, idx] = args;
|
const [tokens, idx] = args;
|
||||||
@ -13,7 +12,7 @@ const MermaidPlugin: PluginSimple = function (md) {
|
|||||||
const key = `mermaid_${hash(idx)}`;
|
const key = `mermaid_${hash(idx)}`;
|
||||||
let { content } = token;
|
let { content } = token;
|
||||||
return `<Mermaid identifier="${key}" graph="${encodeURI(
|
return `<Mermaid identifier="${key}" graph="${encodeURI(
|
||||||
content
|
content,
|
||||||
)}"></Mermaid>`;
|
)}"></Mermaid>`;
|
||||||
}
|
}
|
||||||
const rawCode = fence(...args);
|
const rawCode = fence(...args);
|
@ -1,16 +1,14 @@
|
|||||||
import { path } from "@vuepress/utils";
|
|
||||||
import { Theme } from "@vuepress/core";
|
import { Theme } from "@vuepress/core";
|
||||||
import { MermaidPlugin } from "./plugin/mermaidPlugin";
|
import { path } from "@vuepress/utils";
|
||||||
|
import { defaultTheme } from "vuepress";
|
||||||
|
|
||||||
export const docsPlugin: Theme = (options, app) => {
|
export const docsPlugin: Theme = (options, app) => {
|
||||||
return {
|
return defaultTheme({
|
||||||
name: "xray-docs-theme",
|
name: "xray-docs-theme",
|
||||||
extends: "@vuepress/theme-default",
|
extends: "@vuepress/theme-default",
|
||||||
clientAppEnhanceFiles: path.resolve(__dirname, "clientAppEnhance.ts"),
|
clientAppEnhanceFiles: path.resolve(__dirname, "clientAppEnhance.ts"),
|
||||||
extendsMarkdown: (md) => {
|
|
||||||
md.use(MermaidPlugin);
|
});
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default docsPlugin;
|
export default docsPlugin;
|
||||||
|
29
package.json
29
package.json
@ -10,19 +10,22 @@
|
|||||||
"@types/jquery": "^3.5.14",
|
"@types/jquery": "^3.5.14",
|
||||||
"@types/mermaid": "^9.2.0",
|
"@types/mermaid": "^9.2.0",
|
||||||
"@types/node": "^20.11.0",
|
"@types/node": "^20.11.0",
|
||||||
"@vuepress/bundler-vite": "^2.0.0-beta.25",
|
"@vuepress/bundler-vite": "^2.0.0-rc.0",
|
||||||
"@vuepress/plugin-back-to-top": "^2.0.0-beta.25",
|
"@vuepress/bundler-webpack": "2.0.0-rc.0",
|
||||||
"@vuepress/plugin-debug": "^2.0.0-beta.25",
|
"@vuepress/plugin-back-to-top": "^2.0.0-rc.0",
|
||||||
"@vuepress/plugin-search": "^2.0.0-beta.25",
|
"@vuepress/plugin-debug": "^2.0.0-beta.33",
|
||||||
|
"@vuepress/plugin-search": "^2.0.0-rc.0",
|
||||||
|
"typescript": "^5.2.2",
|
||||||
"postcss-loader": "^8.0.0",
|
"postcss-loader": "^8.0.0",
|
||||||
"prettier": "^3.2.2",
|
"prettier": "^3.2.2",
|
||||||
"sass": "^1.51.0",
|
"sass": "^1.51.0",
|
||||||
"sass-loader": "^14.0.0",
|
"sass-loader": "^13.3.2",
|
||||||
"vue-property-decorator": "^9.1.2",
|
"vue-property-decorator": "^9.1.2",
|
||||||
"vuepress": "^2.0.0-beta.25"
|
"vuepress": "^2.0.0-rc.0"
|
||||||
},
|
},
|
||||||
|
"packageManager": "pnpm@8.10.5",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docs:dev": "vuepress dev docs --clean-temp --clean-cache --host 127.0.0.1",
|
"docs:dev": "vuepress dev docs",
|
||||||
"docs:build": "vuepress build docs",
|
"docs:build": "vuepress build docs",
|
||||||
"lint": "prettier --write ."
|
"lint": "prettier --write ."
|
||||||
},
|
},
|
||||||
@ -33,6 +36,16 @@
|
|||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
"markdown-it-footnote": "^4.0.0",
|
"markdown-it-footnote": "^4.0.0",
|
||||||
"mermaid": "^10.7.0",
|
"mermaid": "^10.7.0",
|
||||||
"vuepress-plugin-mermaidjs": "^2.0.0-beta.2"
|
"vuepress-plugin-mermaidjs": "^2.0.0-beta.2",
|
||||||
|
"@vuepress/cli": "2.0.0-rc.0",
|
||||||
|
"@vuepress/client": "2.0.0-rc.0",
|
||||||
|
"@vuepress/core": "2.0.0-rc.0",
|
||||||
|
"@vuepress/plugin-google-analytics": "2.0.0-rc.0",
|
||||||
|
"@vuepress/plugin-register-components": "2.0.0-rc.0",
|
||||||
|
"@vuepress/plugin-shiki": "2.0.0-rc.0",
|
||||||
|
"@vuepress/theme-default": "2.0.0-rc.0",
|
||||||
|
"@vuepress/utils": "2.0.0-rc.0",
|
||||||
|
"anywhere": "^1.6.0",
|
||||||
|
"vue": "^3.4.15"
|
||||||
}
|
}
|
||||||
}
|
}
|
6045
pnpm-lock.yaml
generated
Normal file
6045
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user