internal-page-components

页面插件

定义了所有 md 页面的位置

module.exports = (options, ctx) => {
  const { pages } = ctx;
  // const componentNames = Object.keys(layoutComponentMap)

  return {
    name: "@vuepress/internal-page-components",

    async clientDynamicModules() {
      const code = `export default {\n${pages
        .filter(({ _filePath }) => _filePath)
        .map(
          ({ key, _filePath }) =>
            `  ${JSON.stringify(key)}: () => import(${JSON.stringify(
              _filePath
            )})`
        )
        .join(",\n")} \n}`;
      return { name: "page-components.js", content: code, dirname: "internal" };
    }
  };
};

temp 生成的对应 page-components 文件

/**
 * Generated by "@vuepress/internal-page-components"
 */
export default {
  "v-9d2814e2": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/README.md"
    ),
  "v-51b9691e": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/cli/start.md"
    ),
  "v-41fccc24": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/markdown/createMarkdown.md"
    ),
  "v-4cdcb0b8": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/cli/dev.md"
    ),
  "v-1538efe6": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/pages/internal-routes.md"
    ),
  "v-cba2f5e8": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/pages/resolvePages.md"
    ),
  "v-b6a02ac4": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/start/cli.md"
    ),
  "v-f5e1ccd8": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/start/require.md"
    ),
  "v-ad0d43a8": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/webpack/configAnalysis.md"
    ),
  "v-d01381e8": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/webpack/createServer.md"
    ),
  "v-21f8c386": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/AliasOption.md"
    ),
  "v-89b88028": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/ClientDynamicModulesOption.md"
    ),
  "v-347038ec": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/DefineOption.md"
    ),
  "v-41caedac": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/EnhanceAppFilesOptions.md"
    ),
  "v-f9967ba8": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/GlobalUIComponentsOption.md"
    ),
  "v-67eebb5f": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/README.md"
    ),
  "v-51c6d34c": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/internal-layout-components.md"
    ),
  "v-35a39d6c": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/internal-page-components.md"
    ),
  "v-5be8b2fc": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/plugin/pluginAPI.md"
    ),
  "v-8a516fe8": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/theme/theme-analysis.md"
    ),
  "v-02aefb2c": () =>
    import(
      "/Users/xiangxiao/Documents/work/workspace/vuepress-analysis/docs/main/webpack/webpackconfig.md"
    )
};