From fd836b1c088167e56b6aec19a2c521766ffc4ae2 Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Mon, 4 Dec 2023 21:22:12 +0800 Subject: [PATCH] docs: tweaks --- README.md | 4 ++-- docs/advanced/architecture.md | 2 +- docs/advanced/cookbook/markdown-and-vue-sfc.md | 15 ++++++++------- docs/advanced/cookbook/usage-of-client-config.md | 6 +++--- docs/guide/plugin.md | 2 +- docs/reference/default-theme/config.md | 5 ++++- docs/reference/default-theme/markdown.md | 15 ++++++++------- docs/reference/node-api.md | 6 +++++- docs/reference/plugin-api.md | 4 ++-- docs/reference/plugin/container.md | 6 ++++-- docs/reference/plugin/pwa.md | 7 ++----- docs/reference/plugin/register-components.md | 6 +++--- docs/reference/plugin/shiki.md | 4 ++-- docs/zh/README.md | 2 +- docs/zh/advanced/cookbook/markdown-and-vue-sfc.md | 15 ++++++++------- .../cookbook/passing-data-to-client-code.md | 1 - .../advanced/cookbook/usage-of-client-config.md | 4 ++-- docs/zh/guide/README.md | 2 +- docs/zh/guide/bundler.md | 2 +- docs/zh/guide/deployment.md | 10 +++++----- docs/zh/guide/markdown.md | 1 - docs/zh/guide/plugin.md | 2 +- docs/zh/reference/components.md | 2 +- docs/zh/reference/default-theme/config.md | 5 ++++- docs/zh/reference/default-theme/markdown.md | 15 ++++++++------- docs/zh/reference/node-api.md | 8 +++----- docs/zh/reference/plugin-api.md | 9 +++++---- docs/zh/reference/plugin/container.md | 6 ++++-- docs/zh/reference/plugin/git.md | 1 - docs/zh/reference/plugin/google-analytics.md | 2 +- docs/zh/reference/plugin/pwa.md | 5 +---- docs/zh/reference/plugin/register-components.md | 6 +++--- 32 files changed, 94 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index cb86b27e..b3d0249b 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ VuePress documentation repository. ## Deployments -- Release deployment: https://v2.vuepress.vuejs.org -- Developer deployment: https://vuepress.github.io +- Release deployment: +- Developer deployment: ## License diff --git a/docs/advanced/architecture.md b/docs/advanced/architecture.md index b80f495a..4fe32a04 100644 --- a/docs/advanced/architecture.md +++ b/docs/advanced/architecture.md @@ -33,4 +33,4 @@ The above figure shows the core process of VuePress Node App and the hooks of [P - In the **dev / build** stage: - Bundler will be resolved: - [extendsBundlerOptions](../reference/plugin-api.md#extendsbundleroptions) hook will be processed to create bundler configuration. - - [alias](../reference/plugin-api.md#alias) hook and [define](../reference/plugin-api.md#define) hook would be used in bundler configuration, so they will be processed here. \ No newline at end of file + - [alias](../reference/plugin-api.md#alias) hook and [define](../reference/plugin-api.md#define) hook would be used in bundler configuration, so they will be processed here. diff --git a/docs/advanced/cookbook/markdown-and-vue-sfc.md b/docs/advanced/cookbook/markdown-and-vue-sfc.md index cdbc1771..ed4c940f 100644 --- a/docs/advanced/cookbook/markdown-and-vue-sfc.md +++ b/docs/advanced/cookbook/markdown-and-vue-sfc.md @@ -60,13 +60,14 @@ _Current count is: {{ count }}_ diff --git a/docs/advanced/cookbook/usage-of-client-config.md b/docs/advanced/cookbook/usage-of-client-config.md index 8dd27dce..542f48cb 100644 --- a/docs/advanced/cookbook/usage-of-client-config.md +++ b/docs/advanced/cookbook/usage-of-client-config.md @@ -12,7 +12,7 @@ const pluginOrTheme = { } ``` -Inside the client config file, `@vuepress/client` package provides a helper function [defineClientConfig](../../reference/client-api.md#defineclientconfig) to help you define the client config: +Inside the client config file, `@vuepress/client` package provides a helper function [defineClientConfig](../../reference/client-api.md#defineclientconfig) to help you define the client config: ```ts import { defineClientConfig } from '@vuepress/client' @@ -119,7 +119,7 @@ export default defineClientConfig({ // provide a value that can be injected by layouts, pages and other components const count = ref(0) provide('count', count) - } + }, }) ``` @@ -139,7 +139,7 @@ export default defineClientConfig({ // use DOM API after mounted document.querySelector('#app') }) - } + }, }) ``` diff --git a/docs/guide/plugin.md b/docs/guide/plugin.md index 1af5d805..88d48fd0 100644 --- a/docs/guide/plugin.md +++ b/docs/guide/plugin.md @@ -14,7 +14,7 @@ import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics' export default { plugins: [ googleAnalyticsPlugin({ - id: 'G-XXXXXXXXXX' + id: 'G-XXXXXXXXXX', }), ], } diff --git a/docs/reference/default-theme/config.md b/docs/reference/default-theme/config.md index c34bc9ac..4f71bbd6 100644 --- a/docs/reference/default-theme/config.md +++ b/docs/reference/default-theme/config.md @@ -392,7 +392,10 @@ export default { { text: 'Bundlers Reference', collapsible: true, - children: ['/reference/bundler/vite.md', '/reference/bundler/webpack.md'], + children: [ + '/reference/bundler/vite.md', + '/reference/bundler/webpack.md', + ], }, ], }, diff --git a/docs/reference/default-theme/markdown.md b/docs/reference/default-theme/markdown.md index 09c31d66..81c25905 100644 --- a/docs/reference/default-theme/markdown.md +++ b/docs/reference/default-theme/markdown.md @@ -15,13 +15,14 @@ The `type` is required, and the `title` and `content` are optional. Supported `type` : - - `tip` - - `warning` - - `danger` - - `details` - - Alias of [CodeGroup](./components.md#codegroup) and [CodeGroupItem](./components.md#codegroupitem): - - `code-group` - - `code-group-item` + + - `tip` + - `warning` + - `danger` + - `details` + - Alias of [CodeGroup](./components.md#codegroup) and [CodeGroupItem](./components.md#codegroupitem): + - `code-group` + - `code-group-item` - Example 1 (default title): diff --git a/docs/reference/node-api.md b/docs/reference/node-api.md index 5fb978a9..c8e87b84 100644 --- a/docs/reference/node-api.md +++ b/docs/reference/node-api.md @@ -1,3 +1,7 @@ +--- +icon: fa6-brands:node-js +--- + # Node API @@ -357,7 +361,7 @@ export default { Hello, world. `, - }) + }), ) }, } diff --git a/docs/reference/plugin-api.md b/docs/reference/plugin-api.md index 7771d196..a8478111 100644 --- a/docs/reference/plugin-api.md +++ b/docs/reference/plugin-api.md @@ -117,7 +117,7 @@ const __dirname = getDirname(import.meta.url) export default { clientConfigFile: path.resolve( __dirname, - './path/to/clientConfig.js' + './path/to/clientConfig.js', ), } ``` @@ -263,7 +263,7 @@ export default { Page options extension. This hook accepts a function that will receive the options of `createPage`. - + This hook can be used for modifying page options - Example: diff --git a/docs/reference/plugin/container.md b/docs/reference/plugin/container.md index 960db6a3..e5362529 100644 --- a/docs/reference/plugin/container.md +++ b/docs/reference/plugin/container.md @@ -95,7 +95,9 @@ export default { ```ts (info: string): string => - `
${info ? `

${info}

` : ''}\n` + `
${ + info ? `

${info}

` : '' + }\n` ``` - Details: @@ -134,7 +136,7 @@ type MarkdownItContainerRenderFunction = ( index: number, options: any, env: MarkdownEnv, - self: Renderer + self: Renderer, ) => string ``` diff --git a/docs/reference/plugin/pwa.md b/docs/reference/plugin/pwa.md index 12c3dd3c..c999be18 100644 --- a/docs/reference/plugin/pwa.md +++ b/docs/reference/plugin/pwa.md @@ -125,7 +125,7 @@ But if you omit `skipWaiting` or set it to `false`, you have to activate the new - Details: Returns the event emitter of this plugin. - + You can add listener function to events that provided by [register-service-worker](https://github.com/yyx990803/register-service-worker). - Example: @@ -158,10 +158,7 @@ export default { - Example: ```ts -import { - usePwaEvent, - useSkipWaiting, -} from '@vuepress/plugin-pwa/client' +import { usePwaEvent, useSkipWaiting } from '@vuepress/plugin-pwa/client' export default { setup() { diff --git a/docs/reference/plugin/register-components.md b/docs/reference/plugin/register-components.md index 8a9c87ca..30c7fbf7 100644 --- a/docs/reference/plugin/register-components.md +++ b/docs/reference/plugin/register-components.md @@ -99,12 +99,12 @@ import { defineAsyncComponent } from 'vue' app.component( 'FooBar', - defineAsyncComponent(() => import('/path/to/components/FooBar.vue')) + defineAsyncComponent(() => import('/path/to/components/FooBar.vue')), ) app.component( 'Baz', - defineAsyncComponent(() => import('/path/to/components/Baz.vue')) + defineAsyncComponent(() => import('/path/to/components/Baz.vue')), ) ``` @@ -129,7 +129,7 @@ app.component( - Details: A function to get component name from the filename. - + It will only take effect on the files in the [componentsDir](#componentsdir) which are matched with the [componentsPatterns](#componentspatterns). Notice that the `filename` is a filepath relative to [componentsDir](#componentsdir). diff --git a/docs/reference/plugin/shiki.md b/docs/reference/plugin/shiki.md index 44bd5132..d9637de5 100644 --- a/docs/reference/plugin/shiki.md +++ b/docs/reference/plugin/shiki.md @@ -40,7 +40,7 @@ export default { Theme of shiki. - This option will be forwarded to `getHighlighter()` method of shiki. + This option will be forwarded to `getHighlighter()` method of shiki. - Also see: - [shiki > themes](https://github.com/shikijs/shiki/blob/master/docs/themes.md) @@ -55,7 +55,7 @@ export default { Languages of shiki. - This option will be forwarded to `getHighlighter()` method of shiki. + This option will be forwarded to `getHighlighter()` method of shiki. If no languages are provided, shiki will load all available languages automatically. diff --git a/docs/zh/README.md b/docs/zh/README.md index 0a437d03..a7dac4df 100644 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -22,5 +22,5 @@ features: details: 灵活的插件API,使得插件可以为你的站点提供许多即插即用的功能。 - title: 打包工具 details: 默认的打包工具是 Vite ,也同样支持 Webpack 。选一个你喜欢的来使用吧! -footer: MIT Licensed | Copyright © 2018-present VuePress Community +footer: MIT 协议 | 版权所有 © 2018-至今 VuePress 社区 --- diff --git a/docs/zh/advanced/cookbook/markdown-and-vue-sfc.md b/docs/zh/advanced/cookbook/markdown-and-vue-sfc.md index d077f365..2ff01d7d 100644 --- a/docs/zh/advanced/cookbook/markdown-and-vue-sfc.md +++ b/docs/zh/advanced/cookbook/markdown-and-vue-sfc.md @@ -27,13 +27,14 @@ _当前计数为: {{ count }}_ diff --git a/docs/zh/advanced/cookbook/passing-data-to-client-code.md b/docs/zh/advanced/cookbook/passing-data-to-client-code.md index e4b84c67..3e2fa98a 100644 --- a/docs/zh/advanced/cookbook/passing-data-to-client-code.md +++ b/docs/zh/advanced/cookbook/passing-data-to-client-code.md @@ -21,7 +21,6 @@ export default (options) => ({ 然后,在客户端代码中直接使用它们: - ```ts const foo = __FOO__ const obj = __OBJ__ diff --git a/docs/zh/advanced/cookbook/usage-of-client-config.md b/docs/zh/advanced/cookbook/usage-of-client-config.md index 98938cd6..035045e3 100644 --- a/docs/zh/advanced/cookbook/usage-of-client-config.md +++ b/docs/zh/advanced/cookbook/usage-of-client-config.md @@ -119,7 +119,7 @@ export default defineClientConfig({ // 供给一个值,可以被布局、页面和其他组件注入 const count = ref(0) provide('count', count) - } + }, }) ``` @@ -139,7 +139,7 @@ export default defineClientConfig({ // 在 mounted 之后使用 DOM API document.querySelector('#app') }) - } + }, }) ``` diff --git a/docs/zh/guide/README.md b/docs/zh/guide/README.md index baf7d5a4..1848728c 100644 --- a/docs/zh/guide/README.md +++ b/docs/zh/guide/README.md @@ -12,7 +12,7 @@ VuePress 诞生的初衷是为了支持 Vue.js 及其子项目的文档需求, 在开发过程中,我们启动一个常规的开发服务器 (dev-server) ,并将 VuePress 站点作为一个常规的 SPA。如果你以前使用过 Vue 的话,你在使用时会感受到非常熟悉的开发体验。 -在构建过程中,我们会为 VuePress 站点创建一个服务端渲染 (SSR) 的版本,然后通过虚拟访问每一条路径来渲染对应的 HTML 。这种做法的灵感来源于 [Nuxt](https://nuxtjs.org/) 的 `nuxt generate` 命令,以及其他的一些项目,比如 [Gatsby](https://www.gatsbyjs.org/)。 +在构建过程中,我们会为 VuePress 站点创建一个服务端渲染 (SSR) 的版本,然后通过虚拟访问每一条路径来渲染对应的 HTML 。这种做法的灵感来源于 [Nuxt](https://nuxtjs.org/) 的 `nuxt generate` 命令,以及其他的一些项目,比如 [Gatsby](https://www.gatsbyjs.org/)。 ## 为什么不是 ...? diff --git a/docs/zh/guide/bundler.md b/docs/zh/guide/bundler.md index 8579829d..c10d9b0f 100644 --- a/docs/zh/guide/bundler.md +++ b/docs/zh/guide/bundler.md @@ -1,6 +1,6 @@ # 打包工具 -VuePress 一直以来都在使用 [Webpack](https://webpack.js.org/) 作为打包工具来进行网站的开发和构建。从 VuePress v2 开始,我们还支持使用其他的打包工具,并且现在使用 [Vite](https://vitejs.dev/) 作为默认的打包工具。当然,你仍然可以选择使用 Webpack 。 +VuePress 一直以来都在使用 [Webpack](https://webpack.js.org/) 作为打包工具来进行网站的开发和构建。从 VuePress v2 开始,我们还支持使用其他的打包工具,并且现在使用 [Vite](https://vitejs.dev/) 作为默认的打包工具。当然,你仍然可以选择使用 Webpack 。 ## 选择一个打包工具 diff --git a/docs/zh/guide/deployment.md b/docs/zh/guide/deployment.md index 1e7515d7..4923ac76 100644 --- a/docs/zh/guide/deployment.md +++ b/docs/zh/guide/deployment.md @@ -19,13 +19,13 @@ 1. 设置正确的 [base](../reference/config.md#base) 选项。 - 如果你准备发布到 `https://.github.io/` ,你可以省略这一步,因为 `base` 默认就是 `"/"` 。 + 如果你准备发布到 `https://.github.io/` ,你可以省略这一步,因为 `base` 默认就是 `"/"` 。 - 如果你准备发布到 `https://.github.io//` ,也就是说你的仓库地址是 `https://github.com//` ,则将 `base` 设置为 `"//"`。 + 如果你准备发布到 `https://.github.io//` ,也就是说你的仓库地址是 `https://github.com//` ,则将 `base` 设置为 `"//"`。 2. 选择你想要使用的 CI 工具。这里我们以 [GitHub Actions](https://github.com/features/actions) 为例。 - 创建 `.github/workflows/docs.yml` 文件来配置工作流。 + 创建 `.github/workflows/docs.yml` 文件来配置工作流。 ::: details 点击展开配置样例 ```yaml @@ -91,9 +91,9 @@ jobs: 1. 设置正确的 [base](../reference/config.md#base) 选项。 - 如果你准备发布到 `https://.gitlab.io/` ,你可以省略这一步,因此 `base` 默认就是 `"/"` 。 + 如果你准备发布到 `https://.gitlab.io/` ,你可以省略这一步,因此 `base` 默认就是 `"/"` 。 - 如果你准备发布到 `https://.gitlab.io//` ,也就是说你的仓库地址是 `https://gitlab.com//` ,则将 `base` 设置为 `"//"`。 + 如果你准备发布到 `https://.gitlab.io//` ,也就是说你的仓库地址是 `https://gitlab.com//` ,则将 `base` 设置为 `"//"`。 2. 创建 `.gitlab-ci.yml` 文件来配置 [GitLab CI](https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/) 工作流。 diff --git a/docs/zh/guide/markdown.md b/docs/zh/guide/markdown.md index bee8e9ce..930c5e72 100644 --- a/docs/zh/guide/markdown.md +++ b/docs/zh/guide/markdown.md @@ -243,7 +243,6 @@ const line3 = 'This is line 3' 为了避免你的代码块被 Vue 编译, VuePress 默认会在你的代码块添加 [v-pre](https://v3.vuejs.org/api/directives.html#v-pre) 指令。这一默认行为可以在配置中关闭。 - 你可以在代码块添加 `:v-pre` / `:no-v-pre` 标记来覆盖配置项中的设置。 ::: warning diff --git a/docs/zh/guide/plugin.md b/docs/zh/guide/plugin.md index bef30308..9201051c 100644 --- a/docs/zh/guide/plugin.md +++ b/docs/zh/guide/plugin.md @@ -14,7 +14,7 @@ import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics' export default { plugins: [ googleAnalyticsPlugin({ - id: 'G-XXXXXXXXXX' + id: 'G-XXXXXXXXXX', }), ], } diff --git a/docs/zh/reference/components.md b/docs/zh/reference/components.md index 3b2a3145..047b375d 100644 --- a/docs/zh/reference/components.md +++ b/docs/zh/reference/components.md @@ -18,7 +18,7 @@ 如果一个组件在 `setup()` 中直接使用 浏览器 / DOM API ,它会导致构建过程报错,因为这些 API 在 Node.js 的环境中是无法使用的。在这种情况下,你可以选择一种方式: - - 修改这个组件,只在 `onBeforeMount()` 或 `onMounted()` Hook 中使用 浏览器 / DOM API 。 + - 修改这个组件,只在 `onBeforeMount()` 或 `onMounted()` Hook 中使用 浏览器 / DOM API 。 - 使用 `` 包裹这个组件。 ## Content diff --git a/docs/zh/reference/default-theme/config.md b/docs/zh/reference/default-theme/config.md index 28a69f93..fffa2b55 100644 --- a/docs/zh/reference/default-theme/config.md +++ b/docs/zh/reference/default-theme/config.md @@ -392,7 +392,10 @@ export default { { text: 'Bundlers Reference', collapsible: true, - children: ['/reference/bundler/vite.md', '/reference/bundler/webpack.md'], + children: [ + '/reference/bundler/vite.md', + '/reference/bundler/webpack.md', + ], }, ], }, diff --git a/docs/zh/reference/default-theme/markdown.md b/docs/zh/reference/default-theme/markdown.md index 46318309..4e079d26 100644 --- a/docs/zh/reference/default-theme/markdown.md +++ b/docs/zh/reference/default-theme/markdown.md @@ -15,13 +15,14 @@ `type` 是必需的, `title` 和 `content` 是可选的。 支持的 `type` 有: - - `tip` - - `warning` - - `danger` - - `details` - - [CodeGroup](./components.md#codegroup) 和 [CodeGroupItem](./components.md#codegroupitem) 的别名: - - `code-group` - - `code-group-item` + + - `tip` + - `warning` + - `danger` + - `details` + - [CodeGroup](./components.md#codegroup) 和 [CodeGroupItem](./components.md#codegroupitem) 的别名: + - `code-group` + - `code-group-item` - 示例 1 (默认标题): diff --git a/docs/zh/reference/node-api.md b/docs/zh/reference/node-api.md index d877f187..2f5a1040 100644 --- a/docs/zh/reference/node-api.md +++ b/docs/zh/reference/node-api.md @@ -240,8 +240,8 @@ writeTemp(file: string, content: string): Promise export default { // 在 onPrepared hook 中写入临时文件 async onPrepared() { - await app.writeTemp('foo.js', 'export const foo = \'bar\'') - } + await app.writeTemp('foo.js', "export const foo = 'bar'") + }, } ``` @@ -354,7 +354,7 @@ export default { 你好,世界。 `, - }) + }), ) }, } @@ -533,7 +533,6 @@ interface MarkdownLink { 该 Page 内容中包含的链接。 - ### markdownEnv - 类型: `Record` @@ -599,7 +598,6 @@ interface MarkdownLink { - [Frontmatter > permalink](./frontmatter.md#permalink) - [Frontmatter > permalinkPattern](./frontmatter.md#permalinkpattern) - ### routeMeta - 类型: `Record` diff --git a/docs/zh/reference/plugin-api.md b/docs/zh/reference/plugin-api.md index cfbc3fd7..441b5552 100644 --- a/docs/zh/reference/plugin-api.md +++ b/docs/zh/reference/plugin-api.md @@ -1,3 +1,7 @@ +--- +icon: fa6-solid:plug +--- + # 插件 API @@ -115,10 +119,7 @@ import { getDirname, path } from '@vuepress/utils' const __dirname = getDirname(import.meta.url) export default { - clientConfigFile: path.resolve( - __dirname, - './path/to/clientConfig.js' - ), + clientConfigFile: path.resolve(__dirname, './path/to/clientConfig.js'), } ``` diff --git a/docs/zh/reference/plugin/container.md b/docs/zh/reference/plugin/container.md index 8836c527..730fe078 100644 --- a/docs/zh/reference/plugin/container.md +++ b/docs/zh/reference/plugin/container.md @@ -95,7 +95,9 @@ export default { ```ts (info: string): string => - `
${info ? `

${info}

` : ''}\n` + `
${ + info ? `

${info}

` : '' + }\n` ``` - 详情: @@ -134,7 +136,7 @@ type MarkdownItContainerRenderFunction = ( index: number, options: any, env: MarkdownEnv, - self: Renderer + self: Renderer, ) => string ``` diff --git a/docs/zh/reference/plugin/git.md b/docs/zh/reference/plugin/git.md index 8dc98697..fd658561 100644 --- a/docs/zh/reference/plugin/git.md +++ b/docs/zh/reference/plugin/git.md @@ -68,7 +68,6 @@ export default { 是否收集页面的贡献者。 - ## Frontmatter ### gitInclude diff --git a/docs/zh/reference/plugin/google-analytics.md b/docs/zh/reference/plugin/google-analytics.md index d1301c73..05e6939c 100644 --- a/docs/zh/reference/plugin/google-analytics.md +++ b/docs/zh/reference/plugin/google-analytics.md @@ -75,4 +75,4 @@ export default { }), ], } -``` \ No newline at end of file +``` diff --git a/docs/zh/reference/plugin/pwa.md b/docs/zh/reference/plugin/pwa.md index 8f774743..020495a6 100644 --- a/docs/zh/reference/plugin/pwa.md +++ b/docs/zh/reference/plugin/pwa.md @@ -158,10 +158,7 @@ export default { - 示例: ```ts -import { - usePwaEvent, - useSkipWaiting, -} from '@vuepress/plugin-pwa/client' +import { usePwaEvent, useSkipWaiting } from '@vuepress/plugin-pwa/client' export default { setup() { diff --git a/docs/zh/reference/plugin/register-components.md b/docs/zh/reference/plugin/register-components.md index 072af502..622158e1 100644 --- a/docs/zh/reference/plugin/register-components.md +++ b/docs/zh/reference/plugin/register-components.md @@ -99,12 +99,12 @@ import { defineAsyncComponent } from 'vue' app.component( 'FooBar', - defineAsyncComponent(() => import('/path/to/components/FooBar.vue')) + defineAsyncComponent(() => import('/path/to/components/FooBar.vue')), ) app.component( 'Baz', - defineAsyncComponent(() => import('/path/to/components/Baz.vue')) + defineAsyncComponent(() => import('/path/to/components/Baz.vue')), ) ``` @@ -129,7 +129,7 @@ app.component( - 详情: 用于从文件名获取对应组件名称的函数。 - + 它只会对 [componentsDir](#componentsdir) 目录下匹配了 [componentsPatterns](#componentspatterns) 的文件生效。 注意,这里的 `filename` 是相对于 [componentsPatterns](#componentspatterns) 目录的文件路径。