mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-16 10:37:20 +02:00
refactor(content-docs): deduplicate types, JSDoc for some APIs (#7027)
* refactor(content-docs): deduplicate types, JSDoc for some APIs * little refactor
This commit is contained in:
parent
b842197ac6
commit
2bcac29cd4
38 changed files with 715 additions and 521 deletions
|
@ -11,6 +11,7 @@ import {
|
|||
normalizeUrl,
|
||||
docuHash,
|
||||
aliasedSitePath,
|
||||
getContentPathList,
|
||||
reportMessage,
|
||||
posixPath,
|
||||
addTrailingPathSeparator,
|
||||
|
@ -27,18 +28,14 @@ import {
|
|||
addDocNavigation,
|
||||
getMainDocId,
|
||||
} from './docs';
|
||||
import {getDocsDirPaths, readVersionsMetadata} from './versions';
|
||||
|
||||
import {readVersionsMetadata} from './versions';
|
||||
import type {
|
||||
LoadedContent,
|
||||
SourceToPermalink,
|
||||
DocMetadataBase,
|
||||
VersionMetadata,
|
||||
LoadedVersion,
|
||||
DocFile,
|
||||
DocsMarkdownOption,
|
||||
VersionTag,
|
||||
DocFrontMatter,
|
||||
} from './types';
|
||||
import type {RuleSetRule} from 'webpack';
|
||||
import {cliDocsVersionCommand} from './cli';
|
||||
|
@ -55,6 +52,9 @@ import {createVersionRoutes} from './routes';
|
|||
import type {
|
||||
PropTagsListPage,
|
||||
PluginOptions,
|
||||
DocMetadataBase,
|
||||
VersionMetadata,
|
||||
DocFrontMatter,
|
||||
} from '@docusaurus/plugin-content-docs';
|
||||
import {createSidebarsUtils} from './sidebars/utils';
|
||||
import {getCategoryGeneratedIndexMetadataList} from './categoryGeneratedIndex';
|
||||
|
@ -114,7 +114,7 @@ export default async function pluginContentDocs(
|
|||
function getVersionPathsToWatch(version: VersionMetadata): string[] {
|
||||
const result = [
|
||||
...options.include.flatMap((pattern) =>
|
||||
getDocsDirPaths(version).map(
|
||||
getContentPathList(version).map(
|
||||
(docsDirPath) => `${docsDirPath}/${pattern}`,
|
||||
),
|
||||
),
|
||||
|
@ -228,7 +228,7 @@ export default async function pluginContentDocs(
|
|||
const tagsProp: PropTagsListPage['tags'] = Object.values(
|
||||
versionTags,
|
||||
).map((tagValue) => ({
|
||||
name: tagValue.name,
|
||||
name: tagValue.label,
|
||||
permalink: tagValue.permalink,
|
||||
count: tagValue.docIds.length,
|
||||
}));
|
||||
|
@ -331,7 +331,7 @@ export default async function pluginContentDocs(
|
|||
};
|
||||
|
||||
function createMDXLoaderRule(): RuleSetRule {
|
||||
const contentDirs = versionsMetadata.flatMap(getDocsDirPaths);
|
||||
const contentDirs = versionsMetadata.flatMap(getContentPathList);
|
||||
return {
|
||||
test: /\.mdx?$/i,
|
||||
include: contentDirs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue