mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
chore: enable import/order rule (#7418)
This commit is contained in:
parent
a4c54aba45
commit
0838884f67
300 changed files with 712 additions and 727 deletions
30
.eslintrc.js
30
.eslintrc.js
|
@ -220,7 +220,35 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
],
|
||||
'import/order': OFF,
|
||||
'import/order': [
|
||||
WARNING,
|
||||
{
|
||||
groups: [
|
||||
'builtin',
|
||||
'external',
|
||||
'internal',
|
||||
['parent', 'sibling', 'index'],
|
||||
'type',
|
||||
],
|
||||
pathGroups: [
|
||||
{pattern: '@jest/globals', group: 'builtin', position: 'before'},
|
||||
{pattern: 'react', group: 'builtin', position: 'before'},
|
||||
{pattern: 'fs-extra', group: 'builtin'},
|
||||
{pattern: 'lodash', group: 'external', position: 'before'},
|
||||
{pattern: 'clsx', group: 'external', position: 'before'},
|
||||
// 'Bit weird to not use the `import/internal-regex` option, but this
|
||||
// way, we can make `import type { Props } from "@theme/*"` appear
|
||||
// before `import styles from "styles.module.css"`, which is what we
|
||||
// always did. This should be removable once we stop using ambient
|
||||
// module declarations for theme aliases.
|
||||
{pattern: '@theme/**', group: 'internal'},
|
||||
{pattern: '@site/**', group: 'internal'},
|
||||
{pattern: '@theme-init/**', group: 'internal'},
|
||||
{pattern: '@theme-original/**', group: 'internal'},
|
||||
],
|
||||
pathGroupsExcludedImportTypes: [],
|
||||
},
|
||||
],
|
||||
'import/prefer-default-export': OFF,
|
||||
|
||||
'jest/consistent-test-it': WARNING,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {Globby} from '@docusaurus/utils';
|
||||
import fs from 'fs-extra';
|
||||
import {Globby} from '@docusaurus/utils';
|
||||
|
||||
type PackageJsonFile = {
|
||||
file: string;
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {Handler} from '@netlify/functions';
|
||||
|
||||
import {createPlaygroundResponse} from '../functionUtils/playgroundUtils';
|
||||
import type {Handler} from '@netlify/functions';
|
||||
|
||||
export const handler: Handler = async function handler() {
|
||||
return createPlaygroundResponse('codesandbox');
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {Handler} from '@netlify/functions';
|
||||
|
||||
import {
|
||||
readPlaygroundName,
|
||||
createPlaygroundResponse,
|
||||
createPlaygroundDocumentationResponse,
|
||||
} from '../functionUtils/playgroundUtils';
|
||||
import type {Handler} from '@netlify/functions';
|
||||
|
||||
export const handler: Handler = async (event) => {
|
||||
const playgroundName = readPlaygroundName(event);
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {Handler} from '@netlify/functions';
|
||||
|
||||
import {createPlaygroundResponse} from '../functionUtils/playgroundUtils';
|
||||
import type {Handler} from '@netlify/functions';
|
||||
|
||||
export const handler: Handler = async function handler() {
|
||||
return createPlaygroundResponse('stackblitz');
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import sharp from 'sharp';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import imageSize from 'image-size';
|
||||
import {fileURLToPath} from 'url';
|
||||
import logger from '@docusaurus/logger';
|
||||
import sharp from 'sharp';
|
||||
import imageSize from 'image-size';
|
||||
|
||||
const allImages = (
|
||||
await fs.readdir(new URL('../../website/src/data/showcase', import.meta.url))
|
||||
|
|
8
jest/snapshotPathNormalizer.ts
vendored
8
jest/snapshotPathNormalizer.ts
vendored
|
@ -8,13 +8,13 @@
|
|||
// Forked from https://github.com/tribou/jest-serializer-path/blob/master/lib/index.js
|
||||
// Added some project-specific handlers
|
||||
|
||||
import _ from 'lodash';
|
||||
import {escapePath} from '@docusaurus/utils';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import {version} from '@docusaurus/core/package.json';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import _ from 'lodash';
|
||||
import {escapePath} from '@docusaurus/utils';
|
||||
import {version} from '@docusaurus/core/package.json';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
|
||||
export function print(
|
||||
val: unknown,
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
// @ts-check
|
||||
|
||||
import path from 'path';
|
||||
import {createRequire} from 'module';
|
||||
import logger from '@docusaurus/logger';
|
||||
import semver from 'semver';
|
||||
import path from 'path';
|
||||
import {program} from 'commander';
|
||||
import {createRequire} from 'module';
|
||||
|
||||
const packageJson = createRequire(import.meta.url)('../package.json');
|
||||
const requiredVersion = packageJson.engines.node;
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import logger from '@docusaurus/logger';
|
||||
import fs from 'fs-extra';
|
||||
import {fileURLToPath} from 'url';
|
||||
import prompts, {type Choice} from 'prompts';
|
||||
import path from 'path';
|
||||
import shell from 'shelljs';
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
import shell from 'shelljs';
|
||||
import prompts, {type Choice} from 'prompts';
|
||||
import supportsColor from 'supports-color';
|
||||
|
||||
type CLIOptions = {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Layout from '@theme/Layout';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import styles from './index.module.css';
|
||||
import Layout from '@theme/Layout';
|
||||
import HomepageFeatures from '@site/src/components/HomepageFeatures';
|
||||
|
||||
import styles from './index.module.css';
|
||||
|
||||
function HomepageHeader() {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Layout from '@theme/Layout';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import styles from './index.module.css';
|
||||
import Layout from '@theme/Layout';
|
||||
import HomepageFeatures from '@site/src/components/HomepageFeatures';
|
||||
|
||||
import styles from './index.module.css';
|
||||
|
||||
function HomepageHeader() {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
|
|
|
@ -6,21 +6,23 @@
|
|||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import {createCompiler} from '@mdx-js/mdx';
|
||||
import logger from '@docusaurus/logger';
|
||||
import emoji from 'remark-emoji';
|
||||
import {
|
||||
parseFrontMatter,
|
||||
parseMarkdownContentTitle,
|
||||
escapePath,
|
||||
getFileLoaderUtils,
|
||||
} from '@docusaurus/utils';
|
||||
import {createCompiler} from '@mdx-js/mdx';
|
||||
import emoji from 'remark-emoji';
|
||||
import stringifyObject from 'stringify-object';
|
||||
|
||||
import headings from './remark/headings';
|
||||
import toc from './remark/toc';
|
||||
import unwrapMdxCodeBlocks from './remark/unwrapMdxCodeBlocks';
|
||||
import transformImage from './remark/transformImage';
|
||||
import transformLinks from './remark/transformLinks';
|
||||
|
||||
import type {LoaderContext} from 'webpack';
|
||||
import type {Processor, Plugin} from 'unified';
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
*/
|
||||
|
||||
import {parse, type ParserOptions} from '@babel/parser';
|
||||
import type {Identifier} from '@babel/types';
|
||||
import traverse from '@babel/traverse';
|
||||
import stringifyObject from 'stringify-object';
|
||||
import toString from 'mdast-util-to-string';
|
||||
import visit from 'unist-util-visit';
|
||||
import {toValue} from '../utils';
|
||||
|
||||
import type {Identifier} from '@babel/types';
|
||||
import type {TOCItem} from '../..';
|
||||
import type {Node, Parent} from 'unist';
|
||||
import type {Heading, Literal} from 'mdast';
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
import fs from 'fs-extra';
|
||||
import {promisify} from 'util';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {
|
||||
toMessageRelativeFilePath,
|
||||
posixPath,
|
||||
|
@ -13,15 +18,10 @@ import {
|
|||
findAsyncSequential,
|
||||
} from '@docusaurus/utils';
|
||||
import visit from 'unist-util-visit';
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
import fs from 'fs-extra';
|
||||
import escapeHtml from 'escape-html';
|
||||
import sizeOf from 'image-size';
|
||||
import {promisify} from 'util';
|
||||
import type {Transformer} from 'unified';
|
||||
import type {Image, Literal} from 'mdast';
|
||||
import logger from '@docusaurus/logger';
|
||||
|
||||
const {
|
||||
loaders: {inlineMarkdownImageFileLoader},
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
import fs from 'fs-extra';
|
||||
import {
|
||||
toMessageRelativeFilePath,
|
||||
posixPath,
|
||||
|
@ -13,9 +16,6 @@ import {
|
|||
findAsyncSequential,
|
||||
} from '@docusaurus/utils';
|
||||
import visit from 'unist-util-visit';
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
import fs from 'fs-extra';
|
||||
import escapeHtml from 'escape-html';
|
||||
import {stringifyContent} from '../utils';
|
||||
import type {Transformer} from 'unified';
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
// @ts-check
|
||||
|
||||
import path from 'path';
|
||||
import {createRequire} from 'module';
|
||||
import logger from '@docusaurus/logger';
|
||||
import semver from 'semver';
|
||||
import cli from 'commander';
|
||||
import path from 'path';
|
||||
import {createRequire} from 'module';
|
||||
|
||||
const moduleRequire = createRequire(import.meta.url);
|
||||
const requiredVersion = moduleRequire('../package.json').engines.node;
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
|
||||
import {jest} from '@jest/globals';
|
||||
import {migrateDocusaurusProject} from '../index';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import {posixPath} from '@docusaurus/utils';
|
||||
import {migrateDocusaurusProject} from '../index';
|
||||
|
||||
async function testMigration(siteDir: string, newDir: string) {
|
||||
const writeMock = jest.spyOn(fs, 'outputFile').mockImplementation(() => {});
|
||||
|
|
|
@ -5,22 +5,23 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import importFresh from 'import-fresh';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {Globby} from '@docusaurus/utils';
|
||||
import importFresh from 'import-fresh';
|
||||
import Color from 'color';
|
||||
|
||||
import extractMetadata, {shouldQuotifyFrontMatter} from './frontMatter';
|
||||
import migratePage from './transform';
|
||||
import sanitizeMD from './sanitizeMD';
|
||||
|
||||
import type {
|
||||
SidebarEntry,
|
||||
SidebarEntries,
|
||||
VersionOneConfig,
|
||||
VersionTwoConfig,
|
||||
} from './types';
|
||||
import extractMetadata, {shouldQuotifyFrontMatter} from './frontMatter';
|
||||
import migratePage from './transform';
|
||||
import sanitizeMD from './sanitizeMD';
|
||||
import path from 'path';
|
||||
|
||||
const DOCUSAURUS_VERSION = (importFresh('../package.json') as {version: string})
|
||||
.version;
|
||||
|
|
|
@ -136,8 +136,8 @@ declare module '@docusaurus/ErrorBoundary' {
|
|||
}
|
||||
|
||||
declare module '@docusaurus/Head' {
|
||||
import type {HelmetProps} from 'react-helmet-async';
|
||||
import type {ReactNode} from 'react';
|
||||
import type {HelmetProps} from 'react-helmet-async';
|
||||
|
||||
export type Props = HelmetProps & {children: ReactNode};
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {PluginContext} from '../types';
|
||||
import collectRedirects from '../collectRedirects';
|
||||
import {validateOptions} from '../options';
|
||||
import {removeTrailingSlash} from '@docusaurus/utils';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
import collectRedirects from '../collectRedirects';
|
||||
import {validateOptions} from '../options';
|
||||
import type {Options} from '../options';
|
||||
import type {PluginContext} from '../types';
|
||||
|
||||
function createTestPluginContext(
|
||||
options?: Options,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||
import type {Options} from '../options';
|
||||
|
||||
function testValidate(options: Options) {
|
||||
|
|
|
@ -6,19 +6,18 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import type {PluginOptions, RedirectOption} from './options';
|
||||
import type {PluginContext, RedirectMetadata} from './types';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {
|
||||
applyTrailingSlash,
|
||||
type ApplyTrailingSlashParams,
|
||||
} from '@docusaurus/utils-common';
|
||||
import {
|
||||
createFromExtensionsRedirects,
|
||||
createToExtensionsRedirects,
|
||||
} from './extensionRedirects';
|
||||
import {validateRedirect} from './redirectValidation';
|
||||
import {
|
||||
applyTrailingSlash,
|
||||
type ApplyTrailingSlashParams,
|
||||
} from '@docusaurus/utils-common';
|
||||
|
||||
import logger from '@docusaurus/logger';
|
||||
import type {PluginOptions, RedirectOption} from './options';
|
||||
import type {PluginContext, RedirectMetadata} from './types';
|
||||
|
||||
export default function collectRedirects(
|
||||
pluginContext: PluginContext,
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import * as eta from 'eta';
|
||||
import redirectPageTemplate from './templates/redirectPage.template.html';
|
||||
import _ from 'lodash';
|
||||
|
||||
const getCompiledRedirectPageTemplate = _.memoize(() =>
|
||||
eta.compile(redirectPageTemplate.trim()),
|
||||
|
|
|
@ -5,16 +5,15 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {PluginContext, RedirectMetadata} from './types';
|
||||
import type {PluginOptions, Options} from './options';
|
||||
|
||||
import {removePrefix, addLeadingSlash} from '@docusaurus/utils';
|
||||
import collectRedirects from './collectRedirects';
|
||||
import writeRedirectFiles, {
|
||||
toRedirectFilesMetadata,
|
||||
type RedirectFileMetadata,
|
||||
} from './writeRedirectFiles';
|
||||
import {removePrefix, addLeadingSlash} from '@docusaurus/utils';
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {PluginContext, RedirectMetadata} from './types';
|
||||
import type {PluginOptions, Options} from './options';
|
||||
|
||||
export default function pluginClientRedirectsPages(
|
||||
context: LoadContext,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {OptionValidationContext} from '@docusaurus/types';
|
||||
import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
|
||||
import type {OptionValidationContext} from '@docusaurus/types';
|
||||
|
||||
export type RedirectOption = {
|
||||
to: string;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {RedirectMetadata} from './types';
|
||||
import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
|
||||
import type {RedirectMetadata} from './types';
|
||||
|
||||
const RedirectSchema = Joi.object<RedirectMetadata>({
|
||||
from: PathnameSchema.required(),
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {normalizeUrl} from '@docusaurus/utils';
|
||||
|
||||
import createRedirectPageContent from './createRedirectPageContent';
|
||||
|
||||
import type {PluginContext, RedirectMetadata} from './types';
|
||||
import createRedirectPageContent from './createRedirectPageContent';
|
||||
import {normalizeUrl} from '@docusaurus/utils';
|
||||
import logger from '@docusaurus/logger';
|
||||
|
||||
export type WriteFilesPluginContext = Pick<PluginContext, 'baseUrl' | 'outDir'>;
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import {
|
||||
type AuthorsMap,
|
||||
getAuthorsMap,
|
||||
getBlogPostAuthors,
|
||||
validateAuthorsMap,
|
||||
} from '../authors';
|
||||
import path from 'path';
|
||||
|
||||
describe('getBlogPostAuthors', () => {
|
||||
it('can read no authors', () => {
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
*/
|
||||
|
||||
import {jest} from '@jest/globals';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {
|
||||
truncate,
|
||||
parseBlogFileName,
|
||||
|
@ -14,13 +16,8 @@ import {
|
|||
paginateBlogPosts,
|
||||
type LinkifyParams,
|
||||
} from '../blogUtils';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import type {
|
||||
BlogBrokenMarkdownLink,
|
||||
BlogContentPaths,
|
||||
BlogPost,
|
||||
} from '../types';
|
||||
import type {BlogBrokenMarkdownLink, BlogContentPaths} from '../types';
|
||||
import type {BlogPost} from '@docusaurus/plugin-content-blog';
|
||||
|
||||
describe('truncate', () => {
|
||||
it('truncates texts', () => {
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
import {jest} from '@jest/globals';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import {DEFAULT_OPTIONS} from '../options';
|
||||
import {generateBlogPosts} from '../blogUtils';
|
||||
import {createBlogFeedFiles} from '../feed';
|
||||
import type {LoadContext, I18n} from '@docusaurus/types';
|
||||
import type {BlogContentPaths} from '../types';
|
||||
import {DEFAULT_OPTIONS} from '../options';
|
||||
import {generateBlogPosts} from '../blogUtils';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-content-blog';
|
||||
|
||||
const DefaultI18N: I18n = {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {validateBlogPostFrontMatter} from '../frontMatter';
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
import {validateBlogPostFrontMatter} from '../frontMatter';
|
||||
import type {BlogPostFrontMatter} from '@docusaurus/plugin-content-blog';
|
||||
|
||||
// TODO this abstraction reduce verbosity but it makes it harder to debug
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
import {jest} from '@jest/globals';
|
||||
import path from 'path';
|
||||
import pluginContentBlog from '../index';
|
||||
import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
|
||||
import {validateOptions} from '../options';
|
||||
import type {BlogPost} from '../types';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
import {posixPath, getFileCommitDate} from '@docusaurus/utils';
|
||||
import pluginContentBlog from '../index';
|
||||
import {validateOptions} from '../options';
|
||||
import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
|
||||
import type {
|
||||
BlogPost,
|
||||
PluginOptions,
|
||||
EditUrlFunction,
|
||||
} from '@docusaurus/plugin-content-blog';
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||
import type {Options} from '@docusaurus/plugin-content-blog';
|
||||
|
||||
function testValidate(options: Options) {
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {BlogPost, BlogContent} from '../types';
|
||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||
import {getTranslationFiles, translateContent} from '../translations';
|
||||
import {DEFAULT_OPTIONS} from '../options';
|
||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-content-blog';
|
||||
import type {
|
||||
PluginOptions,
|
||||
BlogPost,
|
||||
BlogContent,
|
||||
} from '@docusaurus/plugin-content-blog';
|
||||
|
||||
const sampleBlogOptions: PluginOptions = {
|
||||
...DEFAULT_OPTIONS,
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {BlogContentPaths} from './types';
|
||||
import {getDataFileData} from '@docusaurus/utils';
|
||||
import {Joi, URISchema} from '@docusaurus/utils-validation';
|
||||
import type {BlogContentPaths} from './types';
|
||||
import type {
|
||||
Author,
|
||||
BlogPostFrontMatter,
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import readingTime from 'reading-time';
|
||||
import _ from 'lodash';
|
||||
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
|
||||
import logger from '@docusaurus/logger';
|
||||
import readingTime from 'reading-time';
|
||||
import {
|
||||
parseMarkdownString,
|
||||
normalizeUrl,
|
||||
|
@ -24,10 +24,9 @@ import {
|
|||
getFileCommitDate,
|
||||
getContentPathList,
|
||||
} from '@docusaurus/utils';
|
||||
import type {LoadContext} from '@docusaurus/types';
|
||||
import {validateBlogPostFrontMatter} from './frontMatter';
|
||||
import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
||||
import logger from '@docusaurus/logger';
|
||||
import type {LoadContext} from '@docusaurus/types';
|
||||
import type {
|
||||
PluginOptions,
|
||||
ReadingTimeFunction,
|
||||
|
@ -35,6 +34,7 @@ import type {
|
|||
BlogTags,
|
||||
BlogPaginated,
|
||||
} from '@docusaurus/plugin-content-blog';
|
||||
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
|
||||
|
||||
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
||||
return fileString.split(truncateMarker, 1).shift()!;
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
|
||||
import {normalizeUrl, readOutputHTMLFile} from '@docusaurus/utils';
|
||||
import {load as cheerioLoad} from 'cheerio';
|
||||
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
|
||||
import {normalizeUrl, readOutputHTMLFile} from '@docusaurus/utils';
|
||||
import {blogPostContainerID} from '@docusaurus/utils-common';
|
||||
import {load as cheerioLoad} from 'cheerio';
|
||||
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||
import type {
|
||||
FeedType,
|
||||
PluginOptions,
|
||||
Author,
|
||||
BlogPost,
|
||||
} from '@docusaurus/plugin-content-blog';
|
||||
import {blogPostContainerID} from '@docusaurus/utils-common';
|
||||
import logger from '@docusaurus/logger';
|
||||
|
||||
async function generateBlogFeed({
|
||||
blogPosts,
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
|
||||
import path from 'path';
|
||||
import admonitions from 'remark-admonitions';
|
||||
import footnoteIDFixer from './remark/footnoteIDFixer';
|
||||
import {
|
||||
normalizeUrl,
|
||||
docuHash,
|
||||
|
@ -23,17 +21,19 @@ import {
|
|||
type TagsListItem,
|
||||
type TagModule,
|
||||
} from '@docusaurus/utils';
|
||||
import {translateContent, getTranslationFiles} from './translations';
|
||||
|
||||
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
|
||||
import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
|
||||
import admonitions from 'remark-admonitions';
|
||||
import {
|
||||
generateBlogPosts,
|
||||
getSourceToPermalink,
|
||||
getBlogTags,
|
||||
paginateBlogPosts,
|
||||
} from './blogUtils';
|
||||
import footnoteIDFixer from './remark/footnoteIDFixer';
|
||||
import {translateContent, getTranslationFiles} from './translations';
|
||||
import {createBlogFeedFiles} from './feed';
|
||||
|
||||
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
|
||||
import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
|
||||
import type {
|
||||
PluginOptions,
|
||||
BlogPostFrontMatter,
|
||||
|
|
|
@ -538,11 +538,11 @@ declare module '@theme/BlogTagsListPage' {
|
|||
}
|
||||
|
||||
declare module '@theme/BlogTagsPostsPage' {
|
||||
import type {Content} from '@theme/BlogPostPage';
|
||||
import type {
|
||||
BlogSidebar,
|
||||
BlogPaginatedMetadata,
|
||||
} from '@docusaurus/plugin-content-blog';
|
||||
import type {Content} from '@theme/BlogPostPage';
|
||||
import type {TagModule} from '@docusaurus/utils';
|
||||
|
||||
export interface Props {
|
||||
|
|
Binary file not shown.
|
@ -8,6 +8,8 @@
|
|||
import {jest} from '@jest/globals';
|
||||
import path from 'path';
|
||||
import {loadContext} from '@docusaurus/core/src/server/index';
|
||||
import {createSlugger, posixPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||
import {createSidebarsUtils} from '../sidebars/utils';
|
||||
import {
|
||||
processDocMetadata,
|
||||
readVersionDocs,
|
||||
|
@ -17,8 +19,9 @@ import {
|
|||
type DocEnv,
|
||||
} from '../docs';
|
||||
import {loadSidebars} from '../sidebars';
|
||||
import type {Sidebars} from '../sidebars/types';
|
||||
import {readVersionsMetadata} from '../versions';
|
||||
import {DEFAULT_OPTIONS} from '../options';
|
||||
import type {Sidebars} from '../sidebars/types';
|
||||
import type {DocFile} from '../types';
|
||||
import type {
|
||||
MetadataOptions,
|
||||
|
@ -29,10 +32,7 @@ import type {
|
|||
PropNavigationLink,
|
||||
} from '@docusaurus/plugin-content-docs';
|
||||
import type {LoadContext} from '@docusaurus/types';
|
||||
import {DEFAULT_OPTIONS} from '../options';
|
||||
import type {Optional} from 'utility-types';
|
||||
import {createSlugger, posixPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||
import {createSidebarsUtils} from '../sidebars/utils';
|
||||
|
||||
jest.setTimeout(15000);
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
import {validateDocFrontMatter} from '../frontMatter';
|
||||
import type {DocFrontMatter} from '@docusaurus/plugin-content-docs';
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
|
||||
function testField(params: {
|
||||
prefix: string;
|
||||
|
|
|
@ -7,32 +7,27 @@
|
|||
|
||||
import {jest} from '@jest/globals';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'lodash';
|
||||
import {isMatch} from 'picomatch';
|
||||
import commander from 'commander';
|
||||
import _ from 'lodash';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import pluginContentDocs from '../index';
|
||||
import webpack from 'webpack';
|
||||
import {loadContext} from '@docusaurus/core/src/server/index';
|
||||
import {applyConfigureWebpack} from '@docusaurus/core/src/webpack/utils';
|
||||
import type {RouteConfig} from '@docusaurus/types';
|
||||
import {posixPath} from '@docusaurus/utils';
|
||||
import {sortConfig} from '@docusaurus/core/src/server/plugins/routeConfig';
|
||||
|
||||
import * as cliDocs from '../cli';
|
||||
import {validateOptions} from '../options';
|
||||
import {posixPath} from '@docusaurus/utils';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
import type {LoadedVersion} from '../types';
|
||||
import type {
|
||||
SidebarItem,
|
||||
SidebarItemsGeneratorOption,
|
||||
SidebarItemsGeneratorOptionArgs,
|
||||
} from '../sidebars/types';
|
||||
import {toSidebarsProp} from '../props';
|
||||
|
||||
import webpack from 'webpack';
|
||||
import pluginContentDocs from '../index';
|
||||
import {toSidebarsProp} from '../props';
|
||||
import {DefaultSidebarItemsGenerator} from '../sidebars/generator';
|
||||
import {DisabledSidebars} from '../sidebars';
|
||||
import * as cliDocs from '../cli';
|
||||
import {validateOptions} from '../options';
|
||||
|
||||
import type {RouteConfig} from '@docusaurus/types';
|
||||
import type {LoadedVersion} from '@docusaurus/plugin-content-docs';
|
||||
import type {SidebarItem, SidebarItemsGeneratorOption} from '../sidebars/types';
|
||||
|
||||
function findDocById(version: LoadedVersion, unversionedId: string) {
|
||||
return version.docs.find((item) => item.unversionedId === unversionedId);
|
||||
|
@ -768,14 +763,14 @@ describe('site with custom sidebar items generator', () => {
|
|||
const customSidebarItemsGeneratorMock = jest.fn(async () => []);
|
||||
const {siteDir} = await loadSite(customSidebarItemsGeneratorMock);
|
||||
|
||||
const generatorArg: SidebarItemsGeneratorOptionArgs =
|
||||
const generatorArg: Parameters<SidebarItemsGeneratorOption>[0] =
|
||||
customSidebarItemsGeneratorMock.mock.calls[0][0];
|
||||
|
||||
// Make test pass even if docs are in different order and paths are
|
||||
// absolutes
|
||||
function makeDeterministic(
|
||||
arg: SidebarItemsGeneratorOptionArgs,
|
||||
): SidebarItemsGeneratorOptionArgs {
|
||||
arg: Parameters<SidebarItemsGeneratorOption>[0],
|
||||
): Parameters<SidebarItemsGeneratorOption>[0] {
|
||||
return {
|
||||
...arg,
|
||||
docs: _.orderBy(arg.docs, 'id'),
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {createTempRepo} from '@testing-utils/git';
|
||||
import {jest} from '@jest/globals';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import shell from 'shelljs';
|
||||
import {createTempRepo} from '@testing-utils/git';
|
||||
|
||||
import {getFileLastUpdate} from '../lastUpdate';
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||
import {DefaultSidebarItemsGenerator} from '../sidebars/generator';
|
||||
import {
|
||||
DefaultNumberPrefixParser,
|
||||
DisabledNumberPrefixParser,
|
||||
} from '../numberPrefix';
|
||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||
import type {Options} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
// The type of remark/rehype plugins can be function/object
|
||||
|
|
|
@ -5,14 +5,17 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {LoadedContent, LoadedVersion} from '../types';
|
||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||
import {CURRENT_VERSION_NAME} from '../constants';
|
||||
import {
|
||||
getLoadedContentTranslationFiles,
|
||||
translateLoadedContent,
|
||||
} from '../translations';
|
||||
import type {DocMetadata} from '@docusaurus/plugin-content-docs';
|
||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||
import type {
|
||||
DocMetadata,
|
||||
LoadedContent,
|
||||
LoadedVersion,
|
||||
} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
function createSampleDoc(doc: Pick<DocMetadata, 'id'>): DocMetadata {
|
||||
return {
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {type SidebarsUtils, toNavigationLink} from './sidebars/utils';
|
||||
import {createDocsByIdIndex} from './docs';
|
||||
import type {
|
||||
CategoryGeneratedIndexMetadata,
|
||||
DocMetadataBase,
|
||||
} from '@docusaurus/plugin-content-docs';
|
||||
import type {SidebarItemCategoryWithGeneratedIndex} from './sidebars/types';
|
||||
import {type SidebarsUtils, toNavigationLink} from './sidebars/utils';
|
||||
import {createDocsByIdIndex} from './docs';
|
||||
|
||||
function getCategoryGeneratedIndexMetadata({
|
||||
category,
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||
import {
|
||||
getVersionsFilePath,
|
||||
getVersionDocsDirPath,
|
||||
|
@ -12,13 +16,9 @@ import {
|
|||
getDocsDirPathLocalized,
|
||||
} from './versions/files';
|
||||
import {validateVersionName} from './versions/validation';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-content-docs';
|
||||
import {loadSidebarsFileUnsafe} from './sidebars';
|
||||
import {CURRENT_VERSION_NAME} from './constants';
|
||||
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||
import logger from '@docusaurus/logger';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-content-docs';
|
||||
import type {LoadContext} from '@docusaurus/types';
|
||||
|
||||
async function createVersionedSidebarFile({
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import {
|
||||
getActivePlugin,
|
||||
getLatestVersion,
|
||||
|
@ -17,7 +18,6 @@ import type {
|
|||
GlobalVersion,
|
||||
ActivePlugin,
|
||||
} from '@docusaurus/plugin-content-docs/client';
|
||||
import _ from 'lodash';
|
||||
|
||||
describe('docsClientUtils', () => {
|
||||
it('getActivePlugin', () => {
|
||||
|
|
|
@ -19,15 +19,12 @@ import {
|
|||
Globby,
|
||||
normalizeFrontMatterTags,
|
||||
} from '@docusaurus/utils';
|
||||
import type {LoadContext} from '@docusaurus/types';
|
||||
|
||||
import {getFileLastUpdate} from './lastUpdate';
|
||||
import type {DocFile} from './types';
|
||||
import getSlug from './slug';
|
||||
import {CURRENT_VERSION_NAME} from './constants';
|
||||
import {stripPathNumberPrefixes} from './numberPrefix';
|
||||
import {validateDocFrontMatter} from './frontMatter';
|
||||
import type {SidebarsUtils} from './sidebars/utils';
|
||||
import {toDocNavigationLink, toNavigationLink} from './sidebars/utils';
|
||||
import type {
|
||||
MetadataOptions,
|
||||
|
@ -41,6 +38,9 @@ import type {
|
|||
DocFrontMatter,
|
||||
LoadedVersion,
|
||||
} from '@docusaurus/plugin-content-docs';
|
||||
import type {LoadContext} from '@docusaurus/types';
|
||||
import type {SidebarsUtils} from './sidebars/utils';
|
||||
import type {DocFile} from './types';
|
||||
|
||||
type LastUpdateOptions = Pick<
|
||||
PluginOptions,
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import type {Sidebars} from './sidebars/types';
|
||||
import {getMainDocId} from './docs';
|
||||
import type {FullVersion} from './types';
|
||||
import type {
|
||||
|
@ -18,6 +17,7 @@ import type {
|
|||
GlobalSidebar,
|
||||
GlobalDoc,
|
||||
} from '@docusaurus/plugin-content-docs/client';
|
||||
import type {Sidebars} from './sidebars/types';
|
||||
|
||||
function toGlobalDataDoc(doc: DocMetadata): GlobalDoc {
|
||||
return {
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {
|
||||
normalizeUrl,
|
||||
docuHash,
|
||||
|
@ -19,20 +20,15 @@ import {
|
|||
createSlugger,
|
||||
DEFAULT_PLUGIN_ID,
|
||||
} from '@docusaurus/utils';
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import {loadSidebars, resolveSidebarPathOption} from './sidebars';
|
||||
import {CategoryMetadataFilenamePattern} from './sidebars/generator';
|
||||
import type {DocEnv} from './docs';
|
||||
import {readVersionDocs, processDocMetadata, addDocNavigation} from './docs';
|
||||
import {
|
||||
readVersionDocs,
|
||||
processDocMetadata,
|
||||
addDocNavigation,
|
||||
type DocEnv,
|
||||
} from './docs';
|
||||
import {readVersionsMetadata} from './versions';
|
||||
import type {
|
||||
SourceToPermalink,
|
||||
DocFile,
|
||||
DocsMarkdownOption,
|
||||
VersionTag,
|
||||
FullVersion,
|
||||
} from './types';
|
||||
import type {RuleSetRule} from 'webpack';
|
||||
import {cliDocsVersionCommand} from './cli';
|
||||
import {VERSIONS_JSON_FILE} from './constants';
|
||||
import {toGlobalDataVersion} from './globalData';
|
||||
|
@ -42,9 +38,10 @@ import {
|
|||
translateLoadedContent,
|
||||
getLoadedContentTranslationFiles,
|
||||
} from './translations';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {getVersionTags} from './tags';
|
||||
import {createVersionRoutes} from './routes';
|
||||
import {createSidebarsUtils} from './sidebars/utils';
|
||||
|
||||
import type {
|
||||
PropTagsListPage,
|
||||
PluginOptions,
|
||||
|
@ -54,8 +51,15 @@ import type {
|
|||
LoadedContent,
|
||||
LoadedVersion,
|
||||
} from '@docusaurus/plugin-content-docs';
|
||||
import {createSidebarsUtils} from './sidebars/utils';
|
||||
import _ from 'lodash';
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {
|
||||
SourceToPermalink,
|
||||
DocFile,
|
||||
DocsMarkdownOption,
|
||||
VersionTag,
|
||||
FullVersion,
|
||||
} from './types';
|
||||
import type {RuleSetRule} from 'webpack';
|
||||
|
||||
export default async function pluginContentDocs(
|
||||
context: LoadContext,
|
||||
|
|
|
@ -9,13 +9,13 @@ import {jest} from '@jest/globals';
|
|||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {linkify} from '../linkify';
|
||||
import {VERSIONED_DOCS_DIR, CURRENT_VERSION_NAME} from '../../constants';
|
||||
import type {
|
||||
DocsMarkdownOption,
|
||||
SourceToPermalink,
|
||||
DocBrokenMarkdownLink,
|
||||
} from '../../types';
|
||||
import type {VersionMetadata} from '@docusaurus/plugin-content-docs';
|
||||
import {VERSIONED_DOCS_DIR, CURRENT_VERSION_NAME} from '../../constants';
|
||||
|
||||
function createFakeVersion({
|
||||
versionName,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {DocsMarkdownOption} from '../types';
|
||||
import {replaceMarkdownLinks, getContentPathList} from '@docusaurus/utils';
|
||||
import type {DocsMarkdownOption} from '../types';
|
||||
|
||||
function getVersion(filePath: string, options: DocsMarkdownOption) {
|
||||
const versionFound = options.versionsMetadata.find((version) =>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {PluginOptions, Options} from '@docusaurus/plugin-content-docs';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {
|
||||
Joi,
|
||||
RemarkPluginsSchema,
|
||||
|
@ -14,15 +14,14 @@ import {
|
|||
URISchema,
|
||||
} from '@docusaurus/utils-validation';
|
||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||
|
||||
import type {OptionValidationContext} from '@docusaurus/types';
|
||||
import logger from '@docusaurus/logger';
|
||||
import admonitions from 'remark-admonitions';
|
||||
import {DefaultSidebarItemsGenerator} from './sidebars/generator';
|
||||
import {
|
||||
DefaultNumberPrefixParser,
|
||||
DisabledNumberPrefixParser,
|
||||
} from './numberPrefix';
|
||||
import type {OptionValidationContext} from '@docusaurus/types';
|
||||
import type {PluginOptions, Options} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
export const DEFAULT_OPTIONS: Omit<PluginOptions, 'id' | 'sidebarPath'> = {
|
||||
path: 'docs', // Path to data on filesystem, relative to site dir.
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import {createDocsByIdIndex} from './docs';
|
||||
import type {VersionTag} from './types';
|
||||
import type {
|
||||
SidebarItemDoc,
|
||||
|
@ -24,8 +26,6 @@ import type {
|
|||
DocMetadata,
|
||||
LoadedVersion,
|
||||
} from '@docusaurus/plugin-content-docs';
|
||||
import _ from 'lodash';
|
||||
import {createDocsByIdIndex} from './docs';
|
||||
|
||||
export function toSidebarsProp(loadedVersion: LoadedVersion): PropSidebars {
|
||||
const docsById = createDocsByIdIndex(loadedVersion.docs);
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {PluginContentLoadedActions, RouteConfig} from '@docusaurus/types';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {docuHash, createSlugger} from '@docusaurus/utils';
|
||||
import {toVersionMetadataProp} from './props';
|
||||
import type {PluginContentLoadedActions, RouteConfig} from '@docusaurus/types';
|
||||
import type {FullVersion} from './types';
|
||||
import type {
|
||||
CategoryGeneratedIndexMetadata,
|
||||
DocMetadata,
|
||||
} from '@docusaurus/plugin-content-docs';
|
||||
import {toVersionMetadataProp} from './props';
|
||||
import logger from '@docusaurus/logger';
|
||||
|
||||
export async function createCategoryGeneratedIndexRoutes({
|
||||
version,
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
import {jest} from '@jest/globals';
|
||||
import {DefaultSidebarItemsGenerator} from '../generator';
|
||||
import type {SidebarItemsGenerator} from '../types';
|
||||
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
||||
import {isCategoryIndex} from '../../docs';
|
||||
import type {SidebarItemsGenerator} from '../types';
|
||||
|
||||
describe('DefaultSidebarItemsGenerator', () => {
|
||||
function testDefaultSidebarItemsGenerator(
|
||||
|
|
|
@ -9,8 +9,8 @@ import {jest} from '@jest/globals';
|
|||
import path from 'path';
|
||||
import {createSlugger} from '@docusaurus/utils';
|
||||
import {loadSidebars, DisabledSidebars} from '../index';
|
||||
import type {SidebarProcessorParams} from '../types';
|
||||
import {DefaultSidebarItemsGenerator} from '../generator';
|
||||
import type {SidebarProcessorParams} from '../types';
|
||||
import type {DocMetadata} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
describe('loadSidebars', () => {
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
*/
|
||||
|
||||
import {jest} from '@jest/globals';
|
||||
import {createSlugger} from '@docusaurus/utils';
|
||||
import {processSidebars} from '../processor';
|
||||
import {DefaultSidebarItemsGenerator} from '../generator';
|
||||
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
||||
import {isCategoryIndex} from '../../docs';
|
||||
import type {
|
||||
SidebarItem,
|
||||
SidebarItemsGenerator,
|
||||
|
@ -16,11 +20,7 @@ import type {
|
|||
CategoryMetadataFile,
|
||||
ProcessedSidebars,
|
||||
} from '../types';
|
||||
import {DefaultSidebarItemsGenerator} from '../generator';
|
||||
import {createSlugger} from '@docusaurus/utils';
|
||||
import type {VersionMetadata} from '@docusaurus/plugin-content-docs';
|
||||
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
||||
import {isCategoryIndex} from '../../docs';
|
||||
|
||||
describe('processSidebars', () => {
|
||||
function createStaticSidebarItemGenerator(
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {addTrailingSlash} from '@docusaurus/utils';
|
||||
import {createDocsByIdIndex, toCategoryIndexMatcherParam} from '../docs';
|
||||
import type {
|
||||
SidebarItemDoc,
|
||||
SidebarItemsGenerator,
|
||||
|
@ -13,11 +18,6 @@ import type {
|
|||
NormalizedSidebarItem,
|
||||
SidebarItemCategoryLinkConfig,
|
||||
} from './types';
|
||||
import _ from 'lodash';
|
||||
import {addTrailingSlash} from '@docusaurus/utils';
|
||||
import logger from '@docusaurus/logger';
|
||||
import path from 'path';
|
||||
import {createDocsByIdIndex, toCategoryIndexMatcherParam} from '../docs';
|
||||
|
||||
const BreadcrumbSeparator = '/';
|
||||
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {Globby} from '@docusaurus/utils';
|
||||
import Yaml from 'js-yaml';
|
||||
import combinePromises from 'combine-promises';
|
||||
import importFresh from 'import-fresh';
|
||||
import type {SidebarsConfig, Sidebars, SidebarProcessorParams} from './types';
|
||||
import {validateSidebars, validateCategoryMetadataFile} from './validation';
|
||||
import {normalizeSidebars} from './normalization';
|
||||
import {processSidebars} from './processor';
|
||||
import {postProcessSidebars} from './postProcessor';
|
||||
import path from 'path';
|
||||
import {Globby} from '@docusaurus/utils';
|
||||
import logger from '@docusaurus/logger';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-content-docs';
|
||||
import Yaml from 'js-yaml';
|
||||
import _ from 'lodash';
|
||||
import combinePromises from 'combine-promises';
|
||||
import type {SidebarsConfig, Sidebars, SidebarProcessorParams} from './types';
|
||||
|
||||
export const DefaultSidebars: SidebarsConfig = {
|
||||
defaultSidebar: [
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {isCategoriesShorthand} from './utils';
|
||||
import type {
|
||||
NormalizedSidebarItem,
|
||||
NormalizedSidebar,
|
||||
|
@ -16,9 +19,6 @@ import type {
|
|||
SidebarsConfig,
|
||||
NormalizedSidebarItemCategory,
|
||||
} from './types';
|
||||
import {isCategoriesShorthand} from './utils';
|
||||
import _ from 'lodash';
|
||||
import logger from '@docusaurus/logger';
|
||||
|
||||
function normalizeCategoriesShorthand(
|
||||
sidebar: SidebarCategoriesShorthand,
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import {normalizeUrl} from '@docusaurus/utils';
|
||||
import {getDocIds} from '../docs';
|
||||
import type {
|
||||
SidebarItem,
|
||||
Sidebars,
|
||||
|
@ -15,8 +17,6 @@ import type {
|
|||
ProcessedSidebars,
|
||||
SidebarItemCategoryLink,
|
||||
} from './types';
|
||||
import {getDocIds} from '../docs';
|
||||
import _ from 'lodash';
|
||||
|
||||
type SidebarPostProcessorParams = SidebarProcessorParams & {
|
||||
draftIds: Set<string>;
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import combinePromises from 'combine-promises';
|
||||
import {DefaultSidebarItemsGenerator} from './generator';
|
||||
import {validateSidebars} from './validation';
|
||||
import {isCategoryIndex} from '../docs';
|
||||
import type {
|
||||
DocMetadataBase,
|
||||
VersionMetadata,
|
||||
|
@ -22,11 +27,6 @@ import type {
|
|||
SidebarProcessorParams,
|
||||
CategoryMetadataFile,
|
||||
} from './types';
|
||||
import {DefaultSidebarItemsGenerator} from './generator';
|
||||
import {validateSidebars} from './validation';
|
||||
import _ from 'lodash';
|
||||
import combinePromises from 'combine-promises';
|
||||
import {isCategoryIndex} from '../docs';
|
||||
|
||||
function toSidebarItemsGeneratorDoc(
|
||||
doc: DocMetadataBase,
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import {toMessageRelativeFilePath} from '@docusaurus/utils';
|
||||
import type {
|
||||
Sidebars,
|
||||
Sidebar,
|
||||
|
@ -18,9 +20,6 @@ import type {
|
|||
SidebarItemCategoryWithGeneratedIndex,
|
||||
SidebarNavigationItem,
|
||||
} from './types';
|
||||
|
||||
import _ from 'lodash';
|
||||
import {toMessageRelativeFilePath} from '@docusaurus/utils';
|
||||
import type {
|
||||
DocMetadataBase,
|
||||
PropNavigationLink,
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import {groupTaggedItems} from '@docusaurus/utils';
|
||||
import type {VersionTags} from './types';
|
||||
import type {DocMetadata} from '@docusaurus/plugin-content-docs';
|
||||
import _ from 'lodash';
|
||||
|
||||
export function getVersionTags(docs: DocMetadata[]): VersionTags {
|
||||
const groups = groupTaggedItems(docs, (doc) => doc.tags);
|
||||
|
|
|
@ -5,6 +5,14 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import {mergeTranslations} from '@docusaurus/utils';
|
||||
import {CURRENT_VERSION_NAME} from './constants';
|
||||
import {
|
||||
collectSidebarCategories,
|
||||
transformSidebarItems,
|
||||
collectSidebarLinks,
|
||||
} from './sidebars/utils';
|
||||
import type {
|
||||
LoadedVersion,
|
||||
LoadedContent,
|
||||
|
@ -15,20 +23,11 @@ import type {
|
|||
SidebarItemCategoryLink,
|
||||
Sidebars,
|
||||
} from './sidebars/types';
|
||||
|
||||
import _ from 'lodash';
|
||||
import {
|
||||
collectSidebarCategories,
|
||||
transformSidebarItems,
|
||||
collectSidebarLinks,
|
||||
} from './sidebars/utils';
|
||||
import type {
|
||||
TranslationFileContent,
|
||||
TranslationFile,
|
||||
TranslationMessage,
|
||||
} from '@docusaurus/types';
|
||||
import {mergeTranslations} from '@docusaurus/utils';
|
||||
import {CURRENT_VERSION_NAME} from './constants';
|
||||
|
||||
function getVersionFileName(versionName: string): string {
|
||||
if (versionName === CURRENT_VERSION_NAME) {
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
import {jest} from '@jest/globals';
|
||||
import path from 'path';
|
||||
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||
import {readVersionsMetadata} from '../index';
|
||||
import {DEFAULT_OPTIONS} from '../../options';
|
||||
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||
import type {I18n} from '@docusaurus/types';
|
||||
import type {
|
||||
PluginOptions,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import {getPluginI18nPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||
import {
|
||||
VERSIONS_JSON_FILE,
|
||||
VERSIONED_DOCS_DIR,
|
||||
|
@ -14,7 +15,6 @@ import {
|
|||
CURRENT_VERSION_NAME,
|
||||
} from '../constants';
|
||||
import {validateVersionNames} from './validation';
|
||||
import {getPluginI18nPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||
import type {
|
||||
PluginOptions,
|
||||
VersionMetadata,
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
|
||||
import path from 'path';
|
||||
import {CURRENT_VERSION_NAME} from '../constants';
|
||||
import {normalizeUrl, posixPath} from '@docusaurus/utils';
|
||||
import {CURRENT_VERSION_NAME} from '../constants';
|
||||
import {validateVersionsOptions} from './validation';
|
||||
import {
|
||||
getDocsDirPathLocalized,
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
import path from 'path';
|
||||
import {loadContext} from '@docusaurus/core/lib/server';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
|
||||
import pluginContentPages from '../index';
|
||||
import {validateOptions} from '../options';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
|
||||
describe('docusaurus-plugin-content-pages', () => {
|
||||
it('loads simple pages', async () => {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
import {validateOptions, DEFAULT_OPTIONS} from '../options';
|
||||
import type {Options} from '@docusaurus/plugin-content-pages';
|
||||
|
||||
function testValidate(options: Options) {
|
||||
|
|
|
@ -21,10 +21,10 @@ import {
|
|||
DEFAULT_PLUGIN_ID,
|
||||
parseMarkdownString,
|
||||
} from '@docusaurus/utils';
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import admonitions from 'remark-admonitions';
|
||||
import {validatePageFrontMatter} from './frontMatter';
|
||||
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {PagesContentPaths} from './types';
|
||||
import type {
|
||||
PluginOptions,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {PluginOptions, Options} from '@docusaurus/plugin-content-pages';
|
||||
import {
|
||||
Joi,
|
||||
RemarkPluginsSchema,
|
||||
|
@ -14,6 +13,7 @@ import {
|
|||
} from '@docusaurus/utils-validation';
|
||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||
import type {OptionValidationContext} from '@docusaurus/types';
|
||||
import type {PluginOptions, Options} from '@docusaurus/plugin-content-pages';
|
||||
|
||||
export const DEFAULT_OPTIONS: PluginOptions = {
|
||||
path: 'src/pages', // Path to data on filesystem, relative to site dir.
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import {docuHash, normalizeUrl, posixPath} from '@docusaurus/utils';
|
||||
import path from 'path';
|
||||
import {docuHash, normalizeUrl, posixPath} from '@docusaurus/utils';
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
|
||||
export default function pluginDebug({
|
||||
siteConfig: {baseUrl},
|
||||
|
|
|
@ -6,12 +6,10 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import DebugJsonView from '@theme/DebugJsonView';
|
||||
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
|
||||
export default function DebugMetadata(): JSX.Element {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import useGlobalData from '@docusaurus/useGlobalData';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import DebugJsonView from '@theme/DebugJsonView';
|
||||
import useGlobalData from '@docusaurus/useGlobalData';
|
||||
|
||||
export default function DebugMetadata(): JSX.Element {
|
||||
const globalData = useGlobalData();
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import registry from '@generated/registry';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
export default function DebugRegistry(): JSX.Element {
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import routes from '@generated/routes';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import DebugJsonView from '@theme/DebugJsonView';
|
||||
import routes from '@generated/routes';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
export default function DebugRoutes(): JSX.Element {
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
export default function DebugMetadata(): JSX.Element {
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {Joi} from '@docusaurus/utils-validation';
|
||||
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
||||
import type {
|
||||
LoadContext,
|
||||
Plugin,
|
||||
OptionValidationContext,
|
||||
} from '@docusaurus/types';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-ideal-image';
|
||||
import {Joi} from '@docusaurus/utils-validation';
|
||||
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
||||
|
||||
export default function pluginIdealImage(
|
||||
context: LoadContext,
|
||||
|
|
|
@ -5,18 +5,16 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {HtmlTags, LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-pwa';
|
||||
import path from 'path';
|
||||
import webpack, {type Configuration} from 'webpack';
|
||||
import Terser from 'terser-webpack-plugin';
|
||||
import {injectManifest} from 'workbox-build';
|
||||
import {normalizeUrl} from '@docusaurus/utils';
|
||||
import {compile} from '@docusaurus/core/lib/webpack/utils';
|
||||
import LogPlugin from '@docusaurus/core/lib/webpack/plugins/LogPlugin';
|
||||
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
||||
|
||||
import path from 'path';
|
||||
import webpack, {type Configuration} from 'webpack';
|
||||
import Terser from 'terser-webpack-plugin';
|
||||
|
||||
import {injectManifest} from 'workbox-build';
|
||||
import type {HtmlTags, LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-pwa';
|
||||
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import React, {useState} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Translate, {translate} from '@docusaurus/Translate';
|
||||
|
||||
import type {Props} from '@theme/PwaReloadPopup';
|
||||
|
||||
import styles from './styles.module.css';
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {EnumChangefreq} from 'sitemap';
|
||||
import createSitemap from '../createSitemap';
|
||||
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||
import {EnumChangefreq} from 'sitemap';
|
||||
|
||||
describe('createSitemap', () => {
|
||||
it('simple site', async () => {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {validateOptions, DEFAULT_OPTIONS, type Options} from '../options';
|
||||
import {normalizePluginOptions} from '@docusaurus/utils-validation';
|
||||
import {validateOptions, DEFAULT_OPTIONS, type Options} from '../options';
|
||||
|
||||
function testValidate(options: Options) {
|
||||
return validateOptions({validate: normalizePluginOptions, options});
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {ReactElement} from 'react';
|
||||
import {SitemapStream, streamToPromise} from 'sitemap';
|
||||
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
||||
import {createMatcher} from '@docusaurus/utils';
|
||||
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||
import type {HelmetServerState} from 'react-helmet-async';
|
||||
import type {PluginOptions} from './options';
|
||||
import type {ReactElement} from 'react';
|
||||
|
||||
export default async function createSitemap(
|
||||
siteConfig: DocusaurusConfig,
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import vfile from 'to-vfile';
|
||||
import mdx from 'remark-mdx';
|
||||
import remark from 'remark';
|
||||
import npm2yarn from '../index';
|
||||
import vfile from 'to-vfile';
|
||||
import path from 'path';
|
||||
import mdx from 'remark-mdx';
|
||||
|
||||
const processFixture = async (name: string, options?: {sync?: boolean}) => {
|
||||
const filePath = path.join(__dirname, '__fixtures__', `${name}.md`);
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import visit from 'unist-util-visit';
|
||||
import npmToYarn from 'npm-to-yarn';
|
||||
import type {Code, Content, Literal} from 'mdast';
|
||||
import type {Plugin} from 'unified';
|
||||
import type {Node, Parent} from 'unist';
|
||||
import visit from 'unist-util-visit';
|
||||
import npmToYarn from 'npm-to-yarn';
|
||||
|
||||
type PluginOptions = {
|
||||
sync?: boolean;
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||
import {getTranslationFiles, translateThemeConfig} from '../translations';
|
||||
import type {ThemeConfig} from '@docusaurus/theme-common';
|
||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||
|
||||
const ThemeConfigSample: ThemeConfig = {
|
||||
colorMode: {},
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import {ThemeConfigSchema, DEFAULT_CONFIG} from '../validateThemeConfig';
|
||||
|
||||
import {normalizeThemeConfig} from '@docusaurus/utils-validation';
|
||||
import theme from 'prism-react-renderer/themes/github';
|
||||
import darkTheme from 'prism-react-renderer/themes/dracula';
|
||||
import {ThemeConfigSchema, DEFAULT_CONFIG} from '../validateThemeConfig';
|
||||
|
||||
function testValidateThemeConfig(partialThemeConfig: {[key: string]: unknown}) {
|
||||
return normalizeThemeConfig(ThemeConfigSchema, {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
*/
|
||||
|
||||
import path from 'path';
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {ThemeConfig} from '@docusaurus/theme-common';
|
||||
import {getTranslationFiles, translateThemeConfig} from './translations';
|
||||
import {createRequire} from 'module';
|
||||
import type {Plugin as PostCssPlugin} from 'postcss';
|
||||
import rtlcss from 'rtlcss';
|
||||
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
||||
import {getTranslationFiles, translateThemeConfig} from './translations';
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import type {ThemeConfig} from '@docusaurus/theme-common';
|
||||
import type {Plugin as PostCssPlugin} from 'postcss';
|
||||
import type {Options} from '@docusaurus/theme-classic';
|
||||
import type webpack from 'webpack';
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import Layout from '@theme/Layout';
|
||||
import Link from '@docusaurus/Link';
|
||||
import type {ArchiveBlogPost, Props} from '@theme/BlogArchivePage';
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
import {PageMetadata} from '@docusaurus/theme-common';
|
||||
import Layout from '@theme/Layout';
|
||||
import type {ArchiveBlogPost, Props} from '@theme/BlogArchivePage';
|
||||
|
||||
type YearProp = {
|
||||
year: string;
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import BlogLayout from '@theme/BlogLayout';
|
||||
import BlogPostItem from '@theme/BlogPostItem';
|
||||
import BlogListPaginator from '@theme/BlogListPaginator';
|
||||
import type {Props} from '@theme/BlogListPage';
|
||||
import {
|
||||
PageMetadata,
|
||||
HtmlClassNameProvider,
|
||||
ThemeClassNames,
|
||||
} from '@docusaurus/theme-common';
|
||||
import BlogLayout from '@theme/BlogLayout';
|
||||
import BlogPostItem from '@theme/BlogPostItem';
|
||||
import BlogListPaginator from '@theme/BlogListPaginator';
|
||||
import SearchMetadata from '@theme/SearchMetadata';
|
||||
import clsx from 'clsx';
|
||||
import type {Props} from '@theme/BlogListPage';
|
||||
|
||||
function BlogListPageMetadata(props: Props): JSX.Element {
|
||||
const {metadata} = props;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import type {Props} from '@theme/BlogPostAuthors';
|
||||
import BlogPostAuthor from '@theme/BlogPostAuthor';
|
||||
import type {Props} from '@theme/BlogPostAuthors';
|
||||
|
||||
import styles from './styles.module.css';
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ import {usePluralForm} from '@docusaurus/theme-common';
|
|||
import {blogPostContainerID} from '@docusaurus/utils-common';
|
||||
import MDXContent from '@theme/MDXContent';
|
||||
import EditThisPage from '@theme/EditThisPage';
|
||||
import TagsListInline from '@theme/TagsListInline';
|
||||
import BlogPostAuthors from '@theme/BlogPostAuthors';
|
||||
import type {Props} from '@theme/BlogPostItem';
|
||||
|
||||
import styles from './styles.module.css';
|
||||
import TagsListInline from '@theme/TagsListInline';
|
||||
import BlogPostAuthors from '@theme/BlogPostAuthors';
|
||||
|
||||
// Very simple pluralization: probably good enough for now
|
||||
function useReadingTimePlural() {
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import BlogLayout from '@theme/BlogLayout';
|
||||
import BlogPostItem from '@theme/BlogPostItem';
|
||||
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
||||
import type {Props} from '@theme/BlogPostPage';
|
||||
import clsx from 'clsx';
|
||||
import {
|
||||
PageMetadata,
|
||||
HtmlClassNameProvider,
|
||||
ThemeClassNames,
|
||||
} from '@docusaurus/theme-common';
|
||||
import BlogLayout from '@theme/BlogLayout';
|
||||
import BlogPostItem from '@theme/BlogPostItem';
|
||||
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
||||
import TOC from '@theme/TOC';
|
||||
import clsx from 'clsx';
|
||||
import type {Props} from '@theme/BlogPostPage';
|
||||
|
||||
function BlogPostPageMetadata(props: Props): JSX.Element {
|
||||
const {content: BlogPostContents} = props;
|
||||
|
|
|
@ -9,9 +9,9 @@ import React from 'react';
|
|||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
import type {Props} from '@theme/BlogSidebar/Desktop';
|
||||
|
||||
import styles from './styles.module.css';
|
||||
import type {Props} from '@theme/BlogSidebar/Desktop';
|
||||
|
||||
export default function BlogSidebarDesktop({sidebar}: Props): JSX.Element {
|
||||
return (
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {useWindowSize} from '@docusaurus/theme-common';
|
||||
import BlogSidebarDesktop from '@theme/BlogSidebar/Desktop';
|
||||
import BlogSidebarMobile from '@theme/BlogSidebar/Mobile';
|
||||
import {useWindowSize} from '@docusaurus/theme-common';
|
||||
import type {Props} from '@theme/BlogSidebar';
|
||||
|
||||
export default function BlogSidebar({sidebar}: Props): JSX.Element | null {
|
||||
|
|
|
@ -6,18 +6,17 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import BlogLayout from '@theme/BlogLayout';
|
||||
import TagsListByLetter from '@theme/TagsListByLetter';
|
||||
import type {Props} from '@theme/BlogTagsListPage';
|
||||
import clsx from 'clsx';
|
||||
import {
|
||||
PageMetadata,
|
||||
HtmlClassNameProvider,
|
||||
ThemeClassNames,
|
||||
translateTagsPageTitle,
|
||||
} from '@docusaurus/theme-common';
|
||||
import BlogLayout from '@theme/BlogLayout';
|
||||
import TagsListByLetter from '@theme/TagsListByLetter';
|
||||
import type {Props} from '@theme/BlogTagsListPage';
|
||||
import SearchMetadata from '../SearchMetadata';
|
||||
import clsx from 'clsx';
|
||||
|
||||
export default function BlogTagsListPage({tags, sidebar}: Props): JSX.Element {
|
||||
const title = translateTagsPageTitle();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue