mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
refactor: enforce type import specifiers (#6230)
* refactor: enforce type import specifiers * fix * Upgrade esbuild * Fix (haha)
This commit is contained in:
parent
24d65d9bdd
commit
cb1aa30286
192 changed files with 484 additions and 337 deletions
|
@ -92,6 +92,10 @@ module.exports = {
|
||||||
],
|
],
|
||||||
'react/no-unstable-nested-components': [WARNING, {allowAsProps: true}],
|
'react/no-unstable-nested-components': [WARNING, {allowAsProps: true}],
|
||||||
'@typescript-eslint/no-inferrable-types': OFF,
|
'@typescript-eslint/no-inferrable-types': OFF,
|
||||||
|
'@typescript-eslint/consistent-type-imports': [
|
||||||
|
WARNING,
|
||||||
|
{disallowTypeAnnotations: false},
|
||||||
|
],
|
||||||
'import/first': OFF,
|
'import/first': OFF,
|
||||||
'import/order': OFF,
|
'import/order': OFF,
|
||||||
'import/prefer-default-export': OFF,
|
'import/prefer-default-export': OFF,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {HandlerEvent, HandlerResponse} from '@netlify/functions';
|
import type {HandlerEvent, HandlerResponse} from '@netlify/functions';
|
||||||
|
|
||||||
const CookieName = 'DocusaurusPlaygroundName';
|
const CookieName = 'DocusaurusPlaygroundName';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Handler} from '@netlify/functions';
|
import type {Handler} from '@netlify/functions';
|
||||||
|
|
||||||
import {createPlaygroundResponse} from '../functionUtils/playgroundUtils';
|
import {createPlaygroundResponse} from '../functionUtils/playgroundUtils';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Handler} from '@netlify/functions';
|
import type {Handler} from '@netlify/functions';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
readPlaygroundName,
|
readPlaygroundName,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Handler} from '@netlify/functions';
|
import type {Handler} from '@netlify/functions';
|
||||||
|
|
||||||
import {createPlaygroundResponse} from '../functionUtils/playgroundUtils';
|
import {createPlaygroundResponse} from '../functionUtils/playgroundUtils';
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,8 @@
|
||||||
"@types/shelljs": "^0.8.6",
|
"@types/shelljs": "^0.8.6",
|
||||||
"@types/wait-on": "^5.2.0",
|
"@types/wait-on": "^5.2.0",
|
||||||
"@types/webpack-dev-server": "^4.5.0",
|
"@types/webpack-dev-server": "^4.5.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||||
"@typescript-eslint/parser": "^5.4.0",
|
"@typescript-eslint/parser": "^5.8.1",
|
||||||
"concurrently": "^6.2.1",
|
"concurrently": "^6.2.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^8.2.0",
|
"eslint": "^8.2.0",
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import logger from '@docusaurus/logger';
|
import logger from '@docusaurus/logger';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import {execSync} from 'child_process';
|
import {execSync} from 'child_process';
|
||||||
import prompts, {Choice} from 'prompts';
|
import prompts, {type Choice} from 'prompts';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import shell from 'shelljs';
|
import shell from 'shelljs';
|
||||||
import {kebabCase, sortBy} from 'lodash';
|
import {kebabCase, sortBy} from 'lodash';
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import chalk, {Chalk} from 'chalk';
|
import chalk, {type Chalk} from 'chalk';
|
||||||
|
|
||||||
type InterpolatableValue = string | number | (string | number)[];
|
type InterpolatableValue = string | number | (string | number)[];
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
/* Based on remark-slug (https://github.com/remarkjs/remark-slug) and gatsby-remark-autolink-headers (https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-remark-autolink-headers) */
|
/* Based on remark-slug (https://github.com/remarkjs/remark-slug) and gatsby-remark-autolink-headers (https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-remark-autolink-headers) */
|
||||||
|
|
||||||
import {parseMarkdownHeadingId, createSlugger} from '@docusaurus/utils';
|
import {parseMarkdownHeadingId, createSlugger} from '@docusaurus/utils';
|
||||||
import visit, {Visitor} from 'unist-util-visit';
|
import visit, {type Visitor} from 'unist-util-visit';
|
||||||
import toString from 'mdast-util-to-string';
|
import toString from 'mdast-util-to-string';
|
||||||
import type {Transformer} from 'unified';
|
import type {Transformer} from 'unified';
|
||||||
import type {Parent} from 'unist';
|
import type {Parent} from 'unist';
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {parse, ParserOptions} from '@babel/parser';
|
import {parse, type ParserOptions} from '@babel/parser';
|
||||||
import type {Identifier} from '@babel/types';
|
import type {Identifier} from '@babel/types';
|
||||||
import traverse from '@babel/traverse';
|
import traverse from '@babel/traverse';
|
||||||
import stringifyObject from 'stringify-object';
|
import stringifyObject from 'stringify-object';
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import toString from 'mdast-util-to-string';
|
import toString from 'mdast-util-to-string';
|
||||||
import visit, {Visitor} from 'unist-util-visit';
|
import visit from 'unist-util-visit';
|
||||||
import {toValue} from '../utils';
|
import {toValue} from '../utils';
|
||||||
import type {TOCItem} from '@docusaurus/types';
|
import type {TOCItem} from '@docusaurus/types';
|
||||||
import type {Node} from 'unist';
|
import type {Node} from 'unist';
|
||||||
|
@ -26,7 +26,7 @@ interface SearchItem {
|
||||||
export default function search(node: Node): TOCItem[] {
|
export default function search(node: Node): TOCItem[] {
|
||||||
const headings: SearchItem[] = [];
|
const headings: SearchItem[] = [];
|
||||||
|
|
||||||
const visitor: Visitor<Heading> = (child, _index, parent) => {
|
visit(node, 'heading', (child: Heading, _index, parent) => {
|
||||||
const value = toString(child);
|
const value = toString(child);
|
||||||
|
|
||||||
// depth:1 headings are titles and not included in the TOC
|
// depth:1 headings are titles and not included in the TOC
|
||||||
|
@ -44,9 +44,7 @@ export default function search(node: Node): TOCItem[] {
|
||||||
level: child.depth,
|
level: child.depth,
|
||||||
parentIndex: -1,
|
parentIndex: -1,
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
visit(node, 'heading', visitor);
|
|
||||||
|
|
||||||
// Keep track of which previous index would be the current heading's direcy parent.
|
// Keep track of which previous index would be the current heading's direcy parent.
|
||||||
// Each entry <i> is the last index of the `headings` array at heading level <i>.
|
// Each entry <i> is the last index of the `headings` array at heading level <i>.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import importFresh from 'import-fresh';
|
import importFresh from 'import-fresh';
|
||||||
import {createConfigFile} from '../index';
|
import {createConfigFile} from '../index';
|
||||||
import {VersionOneConfig} from '../types';
|
import type {VersionOneConfig} from '../types';
|
||||||
|
|
||||||
describe('create config', () => {
|
describe('create config', () => {
|
||||||
test('simple test', () => {
|
test('simple test', () => {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {RawData, Data} from './types';
|
import type {RawData, Data} from './types';
|
||||||
|
|
||||||
function splitHeader(content: string): RawData {
|
function splitHeader(content: string): RawData {
|
||||||
// New line characters need to handle all operating systems.
|
// New line characters need to handle all operating systems.
|
||||||
|
|
|
@ -11,7 +11,7 @@ import logger from '@docusaurus/logger';
|
||||||
import glob from 'glob';
|
import glob from 'glob';
|
||||||
import Color from 'color';
|
import Color from 'color';
|
||||||
|
|
||||||
import {
|
import type {
|
||||||
ClassicPresetEntries,
|
ClassicPresetEntries,
|
||||||
SidebarEntry,
|
SidebarEntry,
|
||||||
SidebarEntries,
|
SidebarEntries,
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jscodeshift, {
|
import jscodeshift, {
|
||||||
ArrowFunctionExpression,
|
type ArrowFunctionExpression,
|
||||||
AssignmentExpression,
|
AssignmentExpression,
|
||||||
ASTPath,
|
type ASTPath,
|
||||||
Collection,
|
type Collection,
|
||||||
TemplateElement,
|
type TemplateElement,
|
||||||
VariableDeclarator,
|
VariableDeclarator,
|
||||||
} from 'jscodeshift';
|
} from 'jscodeshift';
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ declare module '@docusaurus/constants' {
|
||||||
|
|
||||||
declare module '@docusaurus/ErrorBoundary' {
|
declare module '@docusaurus/ErrorBoundary' {
|
||||||
import type {ReactNode} from 'react';
|
import type {ReactNode} from 'react';
|
||||||
import ErrorComponent from '@theme/Error';
|
import type ErrorComponent from '@theme/Error';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
readonly fallback?: typeof ErrorComponent;
|
readonly fallback?: typeof ErrorComponent;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {PluginContext, UserPluginOptions} from '../types';
|
import type {PluginContext, UserPluginOptions} from '../types';
|
||||||
import collectRedirects from '../collectRedirects';
|
import collectRedirects from '../collectRedirects';
|
||||||
import normalizePluginOptions from '../normalizePluginOptions';
|
import normalizePluginOptions from '../normalizePluginOptions';
|
||||||
import {removeTrailingSlash} from '@docusaurus/utils';
|
import {removeTrailingSlash} from '@docusaurus/utils';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import normalizePluginOptions, {
|
import normalizePluginOptions, {
|
||||||
DefaultPluginOptions,
|
DefaultPluginOptions,
|
||||||
} from '../normalizePluginOptions';
|
} from '../normalizePluginOptions';
|
||||||
import {CreateRedirectsFnOption} from '../types';
|
import type {CreateRedirectsFnOption} from '../types';
|
||||||
|
|
||||||
describe('normalizePluginOptions', () => {
|
describe('normalizePluginOptions', () => {
|
||||||
test('should return default options for undefined user options', () => {
|
test('should return default options for undefined user options', () => {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {uniqBy, difference, groupBy} from 'lodash';
|
import {uniqBy, difference, groupBy} from 'lodash';
|
||||||
import {
|
import type {
|
||||||
PluginContext,
|
PluginContext,
|
||||||
RedirectMetadata,
|
RedirectMetadata,
|
||||||
PluginOptions,
|
PluginOptions,
|
||||||
|
@ -19,7 +19,7 @@ import {
|
||||||
import {validateRedirect} from './redirectValidation';
|
import {validateRedirect} from './redirectValidation';
|
||||||
import {
|
import {
|
||||||
applyTrailingSlash,
|
applyTrailingSlash,
|
||||||
ApplyTrailingSlashParams,
|
type ApplyTrailingSlashParams,
|
||||||
} from '@docusaurus/utils-common';
|
} from '@docusaurus/utils-common';
|
||||||
|
|
||||||
import logger from '@docusaurus/logger';
|
import logger from '@docusaurus/logger';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
removeSuffix,
|
removeSuffix,
|
||||||
removeTrailingSlash,
|
removeTrailingSlash,
|
||||||
} from '@docusaurus/utils';
|
} from '@docusaurus/utils';
|
||||||
import {RedirectMetadata} from './types';
|
import type {RedirectMetadata} from './types';
|
||||||
|
|
||||||
const ExtensionAdditionalMessage =
|
const ExtensionAdditionalMessage =
|
||||||
'If the redirect extension system is not good enough for your usecase, you can create redirects yourself with the "createRedirects" plugin option.';
|
'If the redirect extension system is not good enough for your usecase, you can create redirects yourself with the "createRedirects" plugin option.';
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {LoadContext, Plugin, Props} from '@docusaurus/types';
|
import type {LoadContext, Plugin, Props} from '@docusaurus/types';
|
||||||
import {UserPluginOptions, PluginContext, RedirectMetadata} from './types';
|
import type {UserPluginOptions, PluginContext, RedirectMetadata} from './types';
|
||||||
|
|
||||||
import normalizePluginOptions from './normalizePluginOptions';
|
import normalizePluginOptions from './normalizePluginOptions';
|
||||||
import collectRedirects from './collectRedirects';
|
import collectRedirects from './collectRedirects';
|
||||||
import writeRedirectFiles, {
|
import writeRedirectFiles, {
|
||||||
toRedirectFilesMetadata,
|
toRedirectFilesMetadata,
|
||||||
RedirectFileMetadata,
|
type RedirectFileMetadata,
|
||||||
} from './writeRedirectFiles';
|
} from './writeRedirectFiles';
|
||||||
import {removePrefix, addLeadingSlash} from '@docusaurus/utils';
|
import {removePrefix, addLeadingSlash} from '@docusaurus/utils';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {PluginOptions, RedirectOption, UserPluginOptions} from './types';
|
import type {PluginOptions, RedirectOption, UserPluginOptions} from './types';
|
||||||
import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
|
import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
|
||||||
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {RedirectMetadata} from './types';
|
import type {RedirectMetadata} from './types';
|
||||||
import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
|
import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
|
||||||
|
|
||||||
const RedirectSchema = Joi.object<RedirectMetadata>({
|
const RedirectSchema = Joi.object<RedirectMetadata>({
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Props} from '@docusaurus/types';
|
import type {Props} from '@docusaurus/types';
|
||||||
|
|
||||||
export type PluginOptions = {
|
export type PluginOptions = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {memoize} from 'lodash';
|
import {memoize} from 'lodash';
|
||||||
|
|
||||||
import {PluginContext, RedirectMetadata} from './types';
|
import type {PluginContext, RedirectMetadata} from './types';
|
||||||
import createRedirectPageContent from './createRedirectPageContent';
|
import createRedirectPageContent from './createRedirectPageContent';
|
||||||
import {normalizeUrl} from '@docusaurus/utils';
|
import {normalizeUrl} from '@docusaurus/utils';
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BlogPostFrontMatter,
|
type BlogPostFrontMatter,
|
||||||
validateBlogPostFrontMatter,
|
validateBlogPostFrontMatter,
|
||||||
} from '../blogFrontMatter';
|
} from '../blogFrontMatter';
|
||||||
import escapeStringRegexp from 'escape-string-regexp';
|
import escapeStringRegexp from 'escape-string-regexp';
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {generateBlogFeed} from '../feed';
|
import {generateBlogFeed} from '../feed';
|
||||||
import {LoadContext, I18n} from '@docusaurus/types';
|
import type {LoadContext, I18n} from '@docusaurus/types';
|
||||||
import {PluginOptions, BlogContentPaths} from '../types';
|
import type {PluginOptions, BlogContentPaths} from '../types';
|
||||||
import {DEFAULT_OPTIONS} from '../pluginOptionSchema';
|
import {DEFAULT_OPTIONS} from '../pluginOptionSchema';
|
||||||
import {generateBlogPosts} from '../blogUtils';
|
import {generateBlogPosts} from '../blogUtils';
|
||||||
import {Feed} from 'feed';
|
import type {Feed} from 'feed';
|
||||||
|
|
||||||
const DefaultI18N: I18n = {
|
const DefaultI18N: I18n = {
|
||||||
currentLocale: 'en',
|
currentLocale: 'en',
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import pluginContentBlog from '../index';
|
import pluginContentBlog from '../index';
|
||||||
import {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
|
import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
|
||||||
import {PluginOptionSchema} from '../pluginOptionSchema';
|
import {PluginOptionSchema} from '../pluginOptionSchema';
|
||||||
import {PluginOptions, EditUrlFunction, BlogPost} from '../types';
|
import type {PluginOptions, EditUrlFunction, BlogPost} from '../types';
|
||||||
import {Joi} from '@docusaurus/utils-validation';
|
import type {Joi} from '@docusaurus/utils-validation';
|
||||||
import {posixPath} from '@docusaurus/utils';
|
import {posixPath} from '@docusaurus/utils';
|
||||||
|
|
||||||
function findByTitle(
|
function findByTitle(
|
||||||
|
|
|
@ -7,8 +7,12 @@
|
||||||
|
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {linkify, LinkifyParams, getSourceToPermalink} from '../blogUtils';
|
import {linkify, type LinkifyParams, getSourceToPermalink} from '../blogUtils';
|
||||||
import {BlogBrokenMarkdownLink, BlogContentPaths, BlogPost} from '../types';
|
import type {
|
||||||
|
BlogBrokenMarkdownLink,
|
||||||
|
BlogContentPaths,
|
||||||
|
BlogPost,
|
||||||
|
} from '../types';
|
||||||
|
|
||||||
const siteDir = path.join(__dirname, '__fixtures__', 'website');
|
const siteDir = path.join(__dirname, '__fixtures__', 'website');
|
||||||
const contentPaths: BlogContentPaths = {
|
const contentPaths: BlogContentPaths = {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BlogPost, BlogContent, PluginOptions} from '../types';
|
import type {BlogPost, BlogContent, PluginOptions} from '../types';
|
||||||
import {getTranslationFiles, translateContent} from '../translations';
|
import {getTranslationFiles, translateContent} from '../translations';
|
||||||
import {DEFAULT_OPTIONS} from '../pluginOptionSchema';
|
import {DEFAULT_OPTIONS} from '../pluginOptionSchema';
|
||||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Author, BlogContentPaths} from './types';
|
import type {Author, BlogContentPaths} from './types';
|
||||||
import {getDataFileData} from '@docusaurus/utils';
|
import {getDataFileData} from '@docusaurus/utils';
|
||||||
import {Joi, URISchema} from '@docusaurus/utils-validation';
|
import {Joi, URISchema} from '@docusaurus/utils-validation';
|
||||||
import {
|
import type {
|
||||||
BlogPostFrontMatter,
|
BlogPostFrontMatter,
|
||||||
BlogPostFrontMatterAuthor,
|
BlogPostFrontMatterAuthor,
|
||||||
BlogPostFrontMatterAuthors,
|
BlogPostFrontMatterAuthors,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import readingTime from 'reading-time';
|
import readingTime from 'reading-time';
|
||||||
import {keyBy, mapValues} from 'lodash';
|
import {keyBy, mapValues} from 'lodash';
|
||||||
import {
|
import type {
|
||||||
PluginOptions,
|
PluginOptions,
|
||||||
BlogPost,
|
BlogPost,
|
||||||
BlogContentPaths,
|
BlogContentPaths,
|
||||||
|
@ -30,9 +30,9 @@ import {
|
||||||
groupTaggedItems,
|
groupTaggedItems,
|
||||||
getContentPathList,
|
getContentPathList,
|
||||||
} from '@docusaurus/utils';
|
} from '@docusaurus/utils';
|
||||||
import {LoadContext} from '@docusaurus/types';
|
import type {LoadContext} from '@docusaurus/types';
|
||||||
import {validateBlogPostFrontMatter} from './blogFrontMatter';
|
import {validateBlogPostFrontMatter} from './blogFrontMatter';
|
||||||
import {AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
||||||
import logger from '@docusaurus/logger';
|
import logger from '@docusaurus/logger';
|
||||||
|
|
||||||
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Feed, Author as FeedAuthor, Item as FeedItem} from 'feed';
|
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
|
||||||
import {PluginOptions, Author, BlogPost, FeedType} from './types';
|
import type {PluginOptions, Author, BlogPost, FeedType} from './types';
|
||||||
import {normalizeUrl, mdxToHtml} from '@docusaurus/utils';
|
import {normalizeUrl, mdxToHtml} from '@docusaurus/utils';
|
||||||
import {DocusaurusConfig} from '@docusaurus/types';
|
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
} from '@docusaurus/utils';
|
} from '@docusaurus/utils';
|
||||||
import {translateContent, getTranslationFiles} from './translations';
|
import {translateContent, getTranslationFiles} from './translations';
|
||||||
|
|
||||||
import {
|
import type {
|
||||||
PluginOptions,
|
PluginOptions,
|
||||||
BlogTags,
|
BlogTags,
|
||||||
BlogContent,
|
BlogContent,
|
||||||
|
@ -35,7 +35,7 @@ import {
|
||||||
Assets,
|
Assets,
|
||||||
} from './types';
|
} from './types';
|
||||||
import {PluginOptionSchema} from './pluginOptionSchema';
|
import {PluginOptionSchema} from './pluginOptionSchema';
|
||||||
import {
|
import type {
|
||||||
LoadContext,
|
LoadContext,
|
||||||
ConfigureWebpackUtils,
|
ConfigureWebpackUtils,
|
||||||
Props,
|
Props,
|
||||||
|
@ -44,13 +44,13 @@ import {
|
||||||
OptionValidationContext,
|
OptionValidationContext,
|
||||||
ValidationResult,
|
ValidationResult,
|
||||||
} from '@docusaurus/types';
|
} from '@docusaurus/types';
|
||||||
import {Configuration} from 'webpack';
|
import type {Configuration} from 'webpack';
|
||||||
import {
|
import {
|
||||||
generateBlogPosts,
|
generateBlogPosts,
|
||||||
getSourceToPermalink,
|
getSourceToPermalink,
|
||||||
getBlogTags,
|
getBlogTags,
|
||||||
} from './blogUtils';
|
} from './blogUtils';
|
||||||
import {BlogPostFrontMatter} from './blogFrontMatter';
|
import type {BlogPostFrontMatter} from './blogFrontMatter';
|
||||||
import {createBlogFeedFiles} from './feed';
|
import {createBlogFeedFiles} from './feed';
|
||||||
|
|
||||||
export default async function pluginContentBlog(
|
export default async function pluginContentBlog(
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import {truncate, linkify} from './blogUtils';
|
import {truncate, linkify} from './blogUtils';
|
||||||
import {parseQuery} from 'loader-utils';
|
import {parseQuery} from 'loader-utils';
|
||||||
import {BlogMarkdownLoaderOptions} from './types';
|
import type {BlogMarkdownLoaderOptions} from './types';
|
||||||
import type {LoaderContext} from 'webpack';
|
import type {LoaderContext} from 'webpack';
|
||||||
|
|
||||||
export default function markdownLoader(
|
export default function markdownLoader(
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
URISchema,
|
URISchema,
|
||||||
} from '@docusaurus/utils-validation';
|
} from '@docusaurus/utils-validation';
|
||||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||||
import {PluginOptions} from './types';
|
import type {PluginOptions} from './types';
|
||||||
|
|
||||||
export const DEFAULT_OPTIONS: PluginOptions = {
|
export const DEFAULT_OPTIONS: PluginOptions = {
|
||||||
feedOptions: {type: ['rss', 'atom'], copyright: ''},
|
feedOptions: {type: ['rss', 'atom'], copyright: ''},
|
||||||
|
|
|
@ -11,8 +11,8 @@ import type {
|
||||||
BrokenMarkdownLink,
|
BrokenMarkdownLink,
|
||||||
ContentPaths,
|
ContentPaths,
|
||||||
} from '@docusaurus/utils/lib/markdownLinks';
|
} from '@docusaurus/utils/lib/markdownLinks';
|
||||||
import {Overwrite} from 'utility-types';
|
import type {Overwrite} from 'utility-types';
|
||||||
import {BlogPostFrontMatter} from './blogFrontMatter';
|
import type {BlogPostFrontMatter} from './blogFrontMatter';
|
||||||
|
|
||||||
export type BlogContentPaths = ContentPaths;
|
export type BlogContentPaths = ContentPaths;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {cliDocsVersionCommand} from '../cli';
|
import {cliDocsVersionCommand} from '../cli';
|
||||||
import {PathOptions, SidebarOptions} from '../types';
|
import type {PathOptions, SidebarOptions} from '../types';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import {
|
import {
|
||||||
getVersionedDocsDirPath,
|
getVersionedDocsDirPath,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {validateDocFrontMatter} from '../docFrontMatter';
|
import {validateDocFrontMatter} from '../docFrontMatter';
|
||||||
import {DocFrontMatter} from '../types';
|
import type {DocFrontMatter} from '../types';
|
||||||
import escapeStringRegexp from 'escape-string-regexp';
|
import escapeStringRegexp from 'escape-string-regexp';
|
||||||
|
|
||||||
function testField(params: {
|
function testField(params: {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import type {
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import type {LoadContext} from '@docusaurus/types';
|
import type {LoadContext} from '@docusaurus/types';
|
||||||
import {DEFAULT_OPTIONS} from '../options';
|
import {DEFAULT_OPTIONS} from '../options';
|
||||||
import {Optional} from 'utility-types';
|
import type {Optional} from 'utility-types';
|
||||||
import {createSlugger, posixPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
import {createSlugger, posixPath, DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||||
import {createSidebarsUtils} from '../sidebars/utils';
|
import {createSidebarsUtils} from '../sidebars/utils';
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
DisabledNumberPrefixParser,
|
DisabledNumberPrefixParser,
|
||||||
} from '../numberPrefix';
|
} from '../numberPrefix';
|
||||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||||
import {PluginOptions} from '../types';
|
import type {PluginOptions} from '../types';
|
||||||
|
|
||||||
// the type of remark/rehype plugins is function
|
// the type of remark/rehype plugins is function
|
||||||
const markdownPluginsFunctionStub = () => {};
|
const markdownPluginsFunctionStub = () => {};
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {LoadedContent, DocMetadata, LoadedVersion} from '../types';
|
import type {LoadedContent, DocMetadata, LoadedVersion} from '../types';
|
||||||
import {CURRENT_VERSION_NAME} from '../constants';
|
import {CURRENT_VERSION_NAME} from '../constants';
|
||||||
import {
|
import {
|
||||||
getLoadedContentTranslationFiles,
|
getLoadedContentTranslationFiles,
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
} from '../versions';
|
} from '../versions';
|
||||||
import {DEFAULT_OPTIONS} from '../options';
|
import {DEFAULT_OPTIONS} from '../options';
|
||||||
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
||||||
import {PluginOptions, VersionMetadata} from '../types';
|
import type {PluginOptions, VersionMetadata} from '../types';
|
||||||
import type {I18n} from '@docusaurus/types';
|
import type {I18n} from '@docusaurus/types';
|
||||||
|
|
||||||
const DefaultI18N: I18n = {
|
const DefaultI18N: I18n = {
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CategoryGeneratedIndexMetadata, DocMetadataBase} from './types';
|
import type {CategoryGeneratedIndexMetadata, DocMetadataBase} from './types';
|
||||||
import {SidebarItemCategoryWithGeneratedIndex} from './sidebars/types';
|
import type {SidebarItemCategoryWithGeneratedIndex} from './sidebars/types';
|
||||||
import {SidebarsUtils, toNavigationLink} from './sidebars/utils';
|
import {type SidebarsUtils, toNavigationLink} from './sidebars/utils';
|
||||||
import {createDocsByIdIndex} from './docs';
|
import {createDocsByIdIndex} from './docs';
|
||||||
|
|
||||||
function getCategoryGeneratedIndexMetadata({
|
function getCategoryGeneratedIndexMetadata({
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActivePlugin,
|
type ActivePlugin,
|
||||||
getActivePlugin,
|
getActivePlugin,
|
||||||
getLatestVersion,
|
getLatestVersion,
|
||||||
getActiveDocContext,
|
getActiveDocContext,
|
||||||
getActiveVersion,
|
getActiveVersion,
|
||||||
getDocVersionSuggestions,
|
getDocVersionSuggestions,
|
||||||
} from '../docsClientUtils';
|
} from '../docsClientUtils';
|
||||||
import {GlobalPluginData, GlobalVersion} from '../../types';
|
import type {GlobalPluginData, GlobalVersion} from '../../types';
|
||||||
import {shuffle} from 'lodash';
|
import {shuffle} from 'lodash';
|
||||||
|
|
||||||
describe('docsClientUtils', () => {
|
describe('docsClientUtils', () => {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import {matchPath} from '@docusaurus/router';
|
import {matchPath} from '@docusaurus/router';
|
||||||
|
|
||||||
import {GlobalPluginData, GlobalVersion, GlobalDoc} from '../types';
|
import type {GlobalPluginData, GlobalVersion, GlobalDoc} from '../types';
|
||||||
|
|
||||||
// This code is not part of the api surface, not in ./theme on purpose
|
// This code is not part of the api surface, not in ./theme on purpose
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
import type {LoadContext} from '@docusaurus/types';
|
import type {LoadContext} from '@docusaurus/types';
|
||||||
|
|
||||||
import {getFileLastUpdate} from './lastUpdate';
|
import {getFileLastUpdate} from './lastUpdate';
|
||||||
import {
|
import type {
|
||||||
DocFile,
|
DocFile,
|
||||||
DocMetadataBase,
|
DocMetadataBase,
|
||||||
DocMetadata,
|
DocMetadata,
|
||||||
|
@ -38,11 +38,8 @@ import {CURRENT_VERSION_NAME} from './constants';
|
||||||
import {getDocsDirPaths} from './versions';
|
import {getDocsDirPaths} from './versions';
|
||||||
import {stripPathNumberPrefixes} from './numberPrefix';
|
import {stripPathNumberPrefixes} from './numberPrefix';
|
||||||
import {validateDocFrontMatter} from './docFrontMatter';
|
import {validateDocFrontMatter} from './docFrontMatter';
|
||||||
import {
|
import type {SidebarsUtils} from './sidebars/utils';
|
||||||
SidebarsUtils,
|
import {toDocNavigationLink, toNavigationLink} from './sidebars/utils';
|
||||||
toDocNavigationLink,
|
|
||||||
toNavigationLink,
|
|
||||||
} from './sidebars/utils';
|
|
||||||
|
|
||||||
type LastUpdateOptions = Pick<
|
type LastUpdateOptions = Pick<
|
||||||
PluginOptions,
|
PluginOptions,
|
||||||
|
|
|
@ -29,7 +29,7 @@ import {
|
||||||
} from './docs';
|
} from './docs';
|
||||||
import {getDocsDirPaths, readVersionsMetadata} from './versions';
|
import {getDocsDirPaths, readVersionsMetadata} from './versions';
|
||||||
|
|
||||||
import {
|
import type {
|
||||||
PluginOptions,
|
PluginOptions,
|
||||||
LoadedContent,
|
LoadedContent,
|
||||||
SourceToPermalink,
|
SourceToPermalink,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {linkify} from '../linkify';
|
import {linkify} from '../linkify';
|
||||||
import {
|
import type {
|
||||||
DocsMarkdownOption,
|
DocsMarkdownOption,
|
||||||
SourceToPermalink,
|
SourceToPermalink,
|
||||||
VersionMetadata,
|
VersionMetadata,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {linkify} from './linkify';
|
import {linkify} from './linkify';
|
||||||
import {DocsMarkdownOption} from '../types';
|
import type {DocsMarkdownOption} from '../types';
|
||||||
import type {LoaderContext} from 'webpack';
|
import type {LoaderContext} from 'webpack';
|
||||||
|
|
||||||
export default function markdownLoader(
|
export default function markdownLoader(
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {DocsMarkdownOption} from '../types';
|
import type {DocsMarkdownOption} from '../types';
|
||||||
import {getDocsDirPaths} from '../versions';
|
import {getDocsDirPaths} from '../versions';
|
||||||
import {replaceMarkdownLinks} from '@docusaurus/utils';
|
import {replaceMarkdownLinks} from '@docusaurus/utils';
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {PluginContentLoadedActions, RouteConfig} from '@docusaurus/types';
|
import type {PluginContentLoadedActions, RouteConfig} from '@docusaurus/types';
|
||||||
import {docuHash, createSlugger} from '@docusaurus/utils';
|
import {docuHash, createSlugger} from '@docusaurus/utils';
|
||||||
import {
|
import type {
|
||||||
CategoryGeneratedIndexMetadata,
|
CategoryGeneratedIndexMetadata,
|
||||||
DocMetadata,
|
DocMetadata,
|
||||||
LoadedVersion,
|
LoadedVersion,
|
||||||
|
|
|
@ -5,8 +5,11 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CategoryMetadataFile, DefaultSidebarItemsGenerator} from '../generator';
|
import {
|
||||||
import {Sidebar, SidebarItemsGenerator} from '../types';
|
DefaultSidebarItemsGenerator,
|
||||||
|
type CategoryMetadataFile,
|
||||||
|
} from '../generator';
|
||||||
|
import type {Sidebar, SidebarItemsGenerator} from '../types';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {processSidebars, SidebarProcessorParams} from '../processor';
|
import {processSidebars, type SidebarProcessorParams} from '../processor';
|
||||||
import type {
|
import type {
|
||||||
SidebarItem,
|
SidebarItem,
|
||||||
SidebarItemsGenerator,
|
SidebarItemsGenerator,
|
||||||
|
@ -14,7 +14,7 @@ import type {
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import {DefaultSidebarItemsGenerator} from '../generator';
|
import {DefaultSidebarItemsGenerator} from '../generator';
|
||||||
import {createSlugger} from '@docusaurus/utils';
|
import {createSlugger} from '@docusaurus/utils';
|
||||||
import {VersionMetadata} from '../../types';
|
import type {VersionMetadata} from '../../types';
|
||||||
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
import {DefaultNumberPrefixParser} from '../../numberPrefix';
|
||||||
|
|
||||||
describe('processSidebars', () => {
|
describe('processSidebars', () => {
|
||||||
|
|
|
@ -12,12 +12,12 @@ import {
|
||||||
collectSidebarLinks,
|
collectSidebarLinks,
|
||||||
transformSidebarItems,
|
transformSidebarItems,
|
||||||
collectSidebarsDocIds,
|
collectSidebarsDocIds,
|
||||||
SidebarNavigation,
|
type SidebarNavigation,
|
||||||
toDocNavigationLink,
|
toDocNavigationLink,
|
||||||
toNavigationLink,
|
toNavigationLink,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import type {Sidebar, Sidebars} from '../types';
|
import type {Sidebar, Sidebars} from '../types';
|
||||||
import {DocMetadataBase, DocNavLink} from '../../types';
|
import type {DocMetadataBase, DocNavLink} from '../../types';
|
||||||
|
|
||||||
describe('createSidebarsUtils', () => {
|
describe('createSidebarsUtils', () => {
|
||||||
const sidebar1: Sidebar = [
|
const sidebar1: Sidebar = [
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {validateSidebars, validateCategoryMetadataFile} from '../validation';
|
import {validateSidebars, validateCategoryMetadataFile} from '../validation';
|
||||||
import {CategoryMetadataFile} from '../generator';
|
import type {CategoryMetadataFile} from '../generator';
|
||||||
import {SidebarsConfig} from '../types';
|
import type {SidebarsConfig} from '../types';
|
||||||
|
|
||||||
describe('validateSidebars', () => {
|
describe('validateSidebars', () => {
|
||||||
// TODO add more tests
|
// TODO add more tests
|
||||||
|
|
|
@ -11,7 +11,7 @@ import type {SidebarsConfig, Sidebars, NormalizedSidebars} from './types';
|
||||||
import type {NormalizeSidebarsParams, PluginOptions} from '../types';
|
import type {NormalizeSidebarsParams, PluginOptions} from '../types';
|
||||||
import {validateSidebars} from './validation';
|
import {validateSidebars} from './validation';
|
||||||
import {normalizeSidebars} from './normalization';
|
import {normalizeSidebars} from './normalization';
|
||||||
import {processSidebars, SidebarProcessorParams} from './processor';
|
import {processSidebars, type SidebarProcessorParams} from './processor';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {createSlugger} from '@docusaurus/utils';
|
import {createSlugger} from '@docusaurus/utils';
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import {DefaultSidebarItemsGenerator} from './generator';
|
||||||
import {mapValues, memoize, pick} from 'lodash';
|
import {mapValues, memoize, pick} from 'lodash';
|
||||||
import combinePromises from 'combine-promises';
|
import combinePromises from 'combine-promises';
|
||||||
import {normalizeItem} from './normalization';
|
import {normalizeItem} from './normalization';
|
||||||
import {Slugger} from '@docusaurus/utils';
|
import type {Slugger} from '@docusaurus/utils';
|
||||||
|
|
||||||
export type SidebarProcessorParams = {
|
export type SidebarProcessorParams = {
|
||||||
sidebarItemsGenerator: SidebarItemsGeneratorOption;
|
sidebarItemsGenerator: SidebarItemsGeneratorOption;
|
||||||
|
|
|
@ -5,14 +5,13 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type {Optional} from 'utility-types';
|
import type {Optional, Required} from 'utility-types';
|
||||||
import type {
|
import type {
|
||||||
DocMetadataBase,
|
DocMetadataBase,
|
||||||
VersionMetadata,
|
VersionMetadata,
|
||||||
NumberPrefixParser,
|
NumberPrefixParser,
|
||||||
SidebarOptions,
|
SidebarOptions,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import {Required} from 'utility-types';
|
|
||||||
|
|
||||||
// Makes all properties visible when hovering over the type
|
// Makes all properties visible when hovering over the type
|
||||||
type Expand<T extends Record<string, unknown>> = {[P in keyof T]: T[P]};
|
type Expand<T extends Record<string, unknown>> = {[P in keyof T]: T[P]};
|
||||||
|
|
|
@ -15,17 +15,15 @@ import type {
|
||||||
SidebarItemType,
|
SidebarItemType,
|
||||||
SidebarCategoriesShorthand,
|
SidebarCategoriesShorthand,
|
||||||
SidebarItemConfig,
|
SidebarItemConfig,
|
||||||
} from './types';
|
|
||||||
|
|
||||||
import {mapValues, difference, uniq} from 'lodash';
|
|
||||||
import {getElementsAround, toMessageRelativeFilePath} from '@docusaurus/utils';
|
|
||||||
import {DocMetadataBase, DocNavLink} from '../types';
|
|
||||||
import {
|
|
||||||
SidebarItemCategoryWithGeneratedIndex,
|
SidebarItemCategoryWithGeneratedIndex,
|
||||||
SidebarItemCategoryWithLink,
|
SidebarItemCategoryWithLink,
|
||||||
SidebarNavigationItem,
|
SidebarNavigationItem,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
|
import {mapValues, difference, uniq} from 'lodash';
|
||||||
|
import {getElementsAround, toMessageRelativeFilePath} from '@docusaurus/utils';
|
||||||
|
import type {DocMetadataBase, DocNavLink} from '../types';
|
||||||
|
|
||||||
export function isCategoriesShorthand(
|
export function isCategoriesShorthand(
|
||||||
item: SidebarItemConfig,
|
item: SidebarItemConfig,
|
||||||
): item is SidebarCategoriesShorthand {
|
): item is SidebarCategoriesShorthand {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import type {
|
||||||
SidebarItemCategoryLinkGeneratedIndex,
|
SidebarItemCategoryLinkGeneratedIndex,
|
||||||
} from './types';
|
} from './types';
|
||||||
import {isCategoriesShorthand} from './utils';
|
import {isCategoriesShorthand} from './utils';
|
||||||
import {CategoryMetadataFile} from './generator';
|
import type {CategoryMetadataFile} from './generator';
|
||||||
|
|
||||||
const sidebarItemBaseSchema = Joi.object<SidebarItemBase>({
|
const sidebarItemBaseSchema = Joi.object<SidebarItemBase>({
|
||||||
className: Joi.string(),
|
className: Joi.string(),
|
||||||
|
|
|
@ -11,17 +11,17 @@ import useGlobalData, {
|
||||||
usePluginData,
|
usePluginData,
|
||||||
} from '@docusaurus/useGlobalData';
|
} from '@docusaurus/useGlobalData';
|
||||||
|
|
||||||
import {GlobalPluginData, GlobalVersion} from '../../types';
|
import type {GlobalPluginData, GlobalVersion} from '../../types';
|
||||||
import {
|
import {
|
||||||
getActivePlugin,
|
getActivePlugin,
|
||||||
getLatestVersion,
|
getLatestVersion,
|
||||||
getActiveVersion,
|
getActiveVersion,
|
||||||
getActiveDocContext,
|
getActiveDocContext,
|
||||||
getDocVersionSuggestions,
|
getDocVersionSuggestions,
|
||||||
ActivePlugin,
|
type ActivePlugin,
|
||||||
ActiveDocContext,
|
type ActiveDocContext,
|
||||||
DocVersionSuggestions,
|
type DocVersionSuggestions,
|
||||||
GetActivePluginOptions,
|
type GetActivePluginOptions,
|
||||||
} from '../../client/docsClientUtils';
|
} from '../../client/docsClientUtils';
|
||||||
|
|
||||||
// Important to use a constant object to avoid React useEffect executions etc...,
|
// Important to use a constant object to avoid React useEffect executions etc...,
|
||||||
|
|
|
@ -23,10 +23,10 @@ import type {
|
||||||
TranslationFileContent,
|
TranslationFileContent,
|
||||||
TranslationFile,
|
TranslationFile,
|
||||||
TranslationFiles,
|
TranslationFiles,
|
||||||
|
TranslationMessage,
|
||||||
} from '@docusaurus/types';
|
} from '@docusaurus/types';
|
||||||
import {mergeTranslations} from '@docusaurus/utils';
|
import {mergeTranslations} from '@docusaurus/utils';
|
||||||
import {CURRENT_VERSION_NAME} from './constants';
|
import {CURRENT_VERSION_NAME} from './constants';
|
||||||
import {TranslationMessage} from '@docusaurus/types';
|
|
||||||
|
|
||||||
function getVersionFileName(versionName: string): string {
|
function getVersionFileName(versionName: string): string {
|
||||||
if (versionName === CURRENT_VERSION_NAME) {
|
if (versionName === CURRENT_VERSION_NAME) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {PluginOptionSchema, DEFAULT_OPTIONS} from '../pluginOptionSchema';
|
import {PluginOptionSchema, DEFAULT_OPTIONS} from '../pluginOptionSchema';
|
||||||
import {PluginOptions} from '../types';
|
import type {PluginOptions} from '../types';
|
||||||
|
|
||||||
export default function normalizePluginOptions(
|
export default function normalizePluginOptions(
|
||||||
options: Partial<PluginOptions>,
|
options: Partial<PluginOptions>,
|
||||||
|
|
|
@ -20,18 +20,18 @@ import {
|
||||||
normalizeUrl,
|
normalizeUrl,
|
||||||
DEFAULT_PLUGIN_ID,
|
DEFAULT_PLUGIN_ID,
|
||||||
} from '@docusaurus/utils';
|
} from '@docusaurus/utils';
|
||||||
import {
|
import type {
|
||||||
LoadContext,
|
LoadContext,
|
||||||
Plugin,
|
Plugin,
|
||||||
OptionValidationContext,
|
OptionValidationContext,
|
||||||
ValidationResult,
|
ValidationResult,
|
||||||
ConfigureWebpackUtils,
|
ConfigureWebpackUtils,
|
||||||
} from '@docusaurus/types';
|
} from '@docusaurus/types';
|
||||||
import {Configuration} from 'webpack';
|
import type {Configuration} from 'webpack';
|
||||||
import admonitions from 'remark-admonitions';
|
import admonitions from 'remark-admonitions';
|
||||||
import {PluginOptionSchema} from './pluginOptionSchema';
|
import {PluginOptionSchema} from './pluginOptionSchema';
|
||||||
|
|
||||||
import {
|
import type {
|
||||||
PluginOptions,
|
PluginOptions,
|
||||||
LoadedContent,
|
LoadedContent,
|
||||||
Metadata,
|
Metadata,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {PluginOptions} from './types';
|
import type {PluginOptions} from './types';
|
||||||
import {
|
import {
|
||||||
Joi,
|
Joi,
|
||||||
RemarkPluginsSchema,
|
RemarkPluginsSchema,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {LoadContext, Plugin} from '@docusaurus/types';
|
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||||
import {docuHash, normalizeUrl, posixPath} from '@docusaurus/utils';
|
import {docuHash, normalizeUrl, posixPath} from '@docusaurus/utils';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {ReactNode} from 'react';
|
import React, {type ReactNode} from 'react';
|
||||||
import Head from '@docusaurus/Head';
|
import Head from '@docusaurus/Head';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
|
@ -13,7 +13,7 @@ import LogPlugin from '@docusaurus/core/lib/webpack/plugins/LogPlugin';
|
||||||
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import webpack, {Configuration} from 'webpack';
|
import webpack, {type Configuration} from 'webpack';
|
||||||
import Terser from 'terser-webpack-plugin';
|
import Terser from 'terser-webpack-plugin';
|
||||||
|
|
||||||
import {injectManifest} from 'workbox-build';
|
import {injectManifest} from 'workbox-build';
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import createSitemap from '../createSitemap';
|
import createSitemap from '../createSitemap';
|
||||||
import {DocusaurusConfig} from '@docusaurus/types';
|
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||||
import {EnumChangefreq} from 'sitemap';
|
import {EnumChangefreq} from 'sitemap';
|
||||||
|
|
||||||
describe('createSitemap', () => {
|
describe('createSitemap', () => {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import {SitemapStream, streamToPromise} from 'sitemap';
|
import {SitemapStream, streamToPromise} from 'sitemap';
|
||||||
import type {Options} from '@docusaurus/plugin-sitemap';
|
import type {Options} from '@docusaurus/plugin-sitemap';
|
||||||
import {DocusaurusConfig} from '@docusaurus/types';
|
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||||
import {addTrailingSlash} from '@docusaurus/utils';
|
import {addTrailingSlash} from '@docusaurus/utils';
|
||||||
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import type {Options} from '@docusaurus/plugin-sitemap';
|
import type {Options} from '@docusaurus/plugin-sitemap';
|
||||||
import createSitemap from './createSitemap';
|
import createSitemap from './createSitemap';
|
||||||
import {
|
import type {
|
||||||
LoadContext,
|
LoadContext,
|
||||||
Props,
|
Props,
|
||||||
OptionValidationContext,
|
OptionValidationContext,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {EnumChangefreq} from 'sitemap';
|
import type {EnumChangefreq} from 'sitemap';
|
||||||
|
|
||||||
export type Options = {
|
export type Options = {
|
||||||
changefreq?: EnumChangefreq;
|
changefreq?: EnumChangefreq;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {getTranslationFiles, translateThemeConfig} from '../translations';
|
import {getTranslationFiles, translateThemeConfig} from '../translations';
|
||||||
import {ThemeConfig} from '@docusaurus/theme-common';
|
import type {ThemeConfig} from '@docusaurus/theme-common';
|
||||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||||
|
|
||||||
const ThemeConfigSample: ThemeConfig = {
|
const ThemeConfigSample: ThemeConfig = {
|
||||||
|
|
|
@ -5,7 +5,11 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {DocusaurusContext, Plugin, PostCssOptions} from '@docusaurus/types';
|
import type {
|
||||||
|
DocusaurusContext,
|
||||||
|
Plugin,
|
||||||
|
PostCssOptions,
|
||||||
|
} from '@docusaurus/types';
|
||||||
import type {ThemeConfig} from '@docusaurus/theme-common';
|
import type {ThemeConfig} from '@docusaurus/theme-common';
|
||||||
import {getTranslationFiles, translateThemeConfig} from './translations';
|
import {getTranslationFiles, translateThemeConfig} from './translations';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
|
@ -107,7 +107,7 @@ declare module '@theme/BlogLayout' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@theme/CodeBlock' {
|
declare module '@theme/CodeBlock' {
|
||||||
import {ReactElement} from 'react';
|
import type {ReactElement} from 'react';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
readonly children: string | ReactElement;
|
readonly children: string | ReactElement;
|
||||||
|
@ -182,7 +182,7 @@ declare module '@theme/EditThisPage' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@theme/ErrorPageContent' {
|
declare module '@theme/ErrorPageContent' {
|
||||||
import ErrorComponent from '@theme/Error';
|
import type ErrorComponent from '@theme/Error';
|
||||||
|
|
||||||
const ErrorPageContent: typeof ErrorComponent;
|
const ErrorPageContent: typeof ErrorComponent;
|
||||||
export default ErrorPageContent;
|
export default ErrorPageContent;
|
||||||
|
@ -220,7 +220,7 @@ declare module '@theme/hooks/useLockBodyScroll' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@theme/hooks/usePrismTheme' {
|
declare module '@theme/hooks/usePrismTheme' {
|
||||||
import defaultTheme from 'prism-react-renderer/themes/palenight';
|
import type defaultTheme from 'prism-react-renderer/themes/palenight';
|
||||||
|
|
||||||
const usePrismTheme: () => typeof defaultTheme;
|
const usePrismTheme: () => typeof defaultTheme;
|
||||||
export default usePrismTheme;
|
export default usePrismTheme;
|
||||||
|
@ -582,7 +582,7 @@ declare module '@theme/ThemedImage' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@theme/Details' {
|
declare module '@theme/Details' {
|
||||||
import {Details, DetailsProps} from '@docusaurus/theme-common';
|
import {Details, type DetailsProps} from '@docusaurus/theme-common';
|
||||||
|
|
||||||
export interface Props extends DetailsProps {}
|
export interface Props extends DetailsProps {}
|
||||||
export default Details;
|
export default Details;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import {Props} from '@theme/Admonition';
|
import type {Props} from '@theme/Admonition';
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
note: (
|
note: (
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import React, {isValidElement, useEffect, useState} from 'react';
|
import React, {isValidElement, useEffect, useState} from 'react';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import Highlight, {defaultProps, Language} from 'prism-react-renderer';
|
import Highlight, {defaultProps, type Language} from 'prism-react-renderer';
|
||||||
import copy from 'copy-text-to-clipboard';
|
import copy from 'copy-text-to-clipboard';
|
||||||
import Translate, {translate} from '@docusaurus/Translate';
|
import Translate, {translate} from '@docusaurus/Translate';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {ReactNode} from 'react';
|
import React, {type ReactNode} from 'react';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import {
|
import type {
|
||||||
PropSidebarItemCategory,
|
PropSidebarItemCategory,
|
||||||
PropSidebarItemLink,
|
PropSidebarItemLink,
|
||||||
} from '@docusaurus/plugin-content-docs';
|
} from '@docusaurus/plugin-content-docs';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import DocCard from '@theme/DocCard';
|
import DocCard from '@theme/DocCard';
|
||||||
import {PropSidebarItem} from '@docusaurus/plugin-content-docs';
|
import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
|
||||||
|
|
||||||
export default function DocCardList({
|
export default function DocCardList({
|
||||||
items,
|
items,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import LastUpdated from '@theme/LastUpdated';
|
||||||
import type {Props} from '@theme/DocItem';
|
import type {Props} from '@theme/DocItem';
|
||||||
import EditThisPage from '@theme/EditThisPage';
|
import EditThisPage from '@theme/EditThisPage';
|
||||||
import TagsListInline, {
|
import TagsListInline, {
|
||||||
Props as TagsListInlineProps,
|
type Props as TagsListInlineProps,
|
||||||
} from '@theme/TagsListInline';
|
} from '@theme/TagsListInline';
|
||||||
|
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {ReactNode, useState, useCallback} from 'react';
|
import React, {type ReactNode, useState, useCallback} from 'react';
|
||||||
import {MDXProvider} from '@mdx-js/react';
|
import {MDXProvider} from '@mdx-js/react';
|
||||||
|
|
||||||
import renderRoutes from '@docusaurus/renderRoutes';
|
import renderRoutes from '@docusaurus/renderRoutes';
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
useThemeConfig,
|
useThemeConfig,
|
||||||
useAnnouncementBar,
|
useAnnouncementBar,
|
||||||
MobileSecondaryMenuFiller,
|
MobileSecondaryMenuFiller,
|
||||||
MobileSecondaryMenuComponent,
|
type MobileSecondaryMenuComponent,
|
||||||
ThemeClassNames,
|
ThemeClassNames,
|
||||||
useScrollPosition,
|
useScrollPosition,
|
||||||
} from '@docusaurus/theme-common';
|
} from '@docusaurus/theme-common';
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {ComponentType} from 'react';
|
import React, {type ComponentType} from 'react';
|
||||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import Translate from '@docusaurus/Translate';
|
import Translate from '@docusaurus/Translate';
|
||||||
import {
|
import {
|
||||||
useActivePlugin,
|
useActivePlugin,
|
||||||
useDocVersionSuggestions,
|
useDocVersionSuggestions,
|
||||||
GlobalVersion,
|
type GlobalVersion,
|
||||||
} from '@theme/hooks/useDocs';
|
} from '@theme/hooks/useDocs';
|
||||||
import {
|
import {
|
||||||
ThemeClassNames,
|
ThemeClassNames,
|
||||||
|
|
|
@ -10,15 +10,15 @@ import clsx from 'clsx';
|
||||||
|
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import {
|
import {
|
||||||
FooterLinkItem,
|
type FooterLinkItem,
|
||||||
useThemeConfig,
|
useThemeConfig,
|
||||||
MultiColumnFooter,
|
type MultiColumnFooter,
|
||||||
SimpleFooter,
|
type SimpleFooter,
|
||||||
} from '@docusaurus/theme-common';
|
} from '@docusaurus/theme-common';
|
||||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||||
import isInternalUrl from '@docusaurus/isInternalUrl';
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
import ThemedImage, {Props as ThemedImageProps} from '@theme/ThemedImage';
|
import ThemedImage, {type Props as ThemedImageProps} from '@theme/ThemedImage';
|
||||||
import IconExternalLink from '@theme/IconExternalLink';
|
import IconExternalLink from '@theme/IconExternalLink';
|
||||||
|
|
||||||
function FooterLink({
|
function FooterLink({
|
||||||
|
|
|
@ -5,7 +5,11 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {ComponentProps, isValidElement, ReactElement} from 'react';
|
import React, {
|
||||||
|
type ComponentProps,
|
||||||
|
isValidElement,
|
||||||
|
type ReactElement,
|
||||||
|
} from 'react';
|
||||||
import Head from '@docusaurus/Head';
|
import Head from '@docusaurus/Head';
|
||||||
import Link from '@docusaurus/Link';
|
import Link from '@docusaurus/Link';
|
||||||
import CodeBlock from '@theme/CodeBlock';
|
import CodeBlock from '@theme/CodeBlock';
|
||||||
|
|
|
@ -21,7 +21,7 @@ import useHideableNavbar from '@theme/hooks/useHideableNavbar';
|
||||||
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
|
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
|
||||||
import useWindowSize from '@theme/hooks/useWindowSize';
|
import useWindowSize from '@theme/hooks/useWindowSize';
|
||||||
import {useActivePlugin} from '@theme/hooks/useDocs';
|
import {useActivePlugin} from '@theme/hooks/useDocs';
|
||||||
import NavbarItem, {Props as NavbarItemConfig} from '@theme/NavbarItem';
|
import NavbarItem, {type Props as NavbarItemConfig} from '@theme/NavbarItem';
|
||||||
import Logo from '@theme/Logo';
|
import Logo from '@theme/Logo';
|
||||||
import IconMenu from '@theme/IconMenu';
|
import IconMenu from '@theme/IconMenu';
|
||||||
import IconClose from '@theme/IconClose';
|
import IconClose from '@theme/IconClose';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
||||||
import {
|
import {
|
||||||
useActiveVersion,
|
useActiveVersion,
|
||||||
useLatestVersion,
|
useLatestVersion,
|
||||||
GlobalVersion,
|
type GlobalVersion,
|
||||||
} from '@theme/hooks/useDocs';
|
} from '@theme/hooks/useDocs';
|
||||||
import type {Props} from '@theme/NavbarItem/DocsVersionNavbarItem';
|
import type {Props} from '@theme/NavbarItem/DocsVersionNavbarItem';
|
||||||
import {useDocsPreferredVersion} from '@docusaurus/theme-common';
|
import {useDocsPreferredVersion} from '@docusaurus/theme-common';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
||||||
import DropdownNavbarItem, {
|
import DropdownNavbarItem, {
|
||||||
Props as DropdownNavbarItemProps,
|
type Props as DropdownNavbarItemProps,
|
||||||
} from '@theme/NavbarItem/DropdownNavbarItem';
|
} from '@theme/NavbarItem/DropdownNavbarItem';
|
||||||
import LocaleDropdownNavbarItem from '@theme/NavbarItem/LocaleDropdownNavbarItem';
|
import LocaleDropdownNavbarItem from '@theme/NavbarItem/LocaleDropdownNavbarItem';
|
||||||
import SearchNavbarItem from '@theme/NavbarItem/SearchNavbarItem';
|
import SearchNavbarItem from '@theme/NavbarItem/SearchNavbarItem';
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
import React, {useMemo} from 'react';
|
import React, {useMemo} from 'react';
|
||||||
import type {TOCItemsProps} from '@theme/TOCItems';
|
import type {TOCItemsProps} from '@theme/TOCItems';
|
||||||
import {TOCItem} from '@docusaurus/types';
|
import type {TOCItem} from '@docusaurus/types';
|
||||||
import {
|
import {
|
||||||
TOCHighlightConfig,
|
type TOCHighlightConfig,
|
||||||
useThemeConfig,
|
useThemeConfig,
|
||||||
useTOCFilter,
|
useTOCFilter,
|
||||||
useTOCHighlight,
|
useTOCHighlight,
|
||||||
|
|
|
@ -10,7 +10,7 @@ import React, {
|
||||||
cloneElement,
|
cloneElement,
|
||||||
Children,
|
Children,
|
||||||
isValidElement,
|
isValidElement,
|
||||||
ReactElement,
|
type ReactElement,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import useIsBrowser from '@docusaurus/useIsBrowser';
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
||||||
import useUserPreferencesContext from '@theme/hooks/useUserPreferencesContext';
|
import useUserPreferencesContext from '@theme/hooks/useUserPreferencesContext';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Tag from '@theme/Tag';
|
import Tag from '@theme/Tag';
|
||||||
import type {Props} from '@theme/TagsListByLetter';
|
import type {Props} from '@theme/TagsListByLetter';
|
||||||
import {listTagsByLetters, TagLetterEntry} from '@docusaurus/theme-common';
|
import {listTagsByLetters, type TagLetterEntry} from '@docusaurus/theme-common';
|
||||||
|
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import React, {useState, useRef, memo} from 'react';
|
import React, {useState, useRef, memo} from 'react';
|
||||||
import type {Props} from '@theme/Toggle';
|
import type {Props} from '@theme/Toggle';
|
||||||
import {useThemeConfig, ColorModeConfig} from '@docusaurus/theme-common';
|
import {useThemeConfig, type ColorModeConfig} from '@docusaurus/theme-common';
|
||||||
import useIsBrowser from '@docusaurus/useIsBrowser';
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
||||||
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {TranslationFile, TranslationFileContent} from '@docusaurus/types';
|
import type {TranslationFile, TranslationFileContent} from '@docusaurus/types';
|
||||||
import {
|
import type {
|
||||||
ThemeConfig,
|
ThemeConfig,
|
||||||
Navbar,
|
Navbar,
|
||||||
NavbarItem,
|
NavbarItem,
|
||||||
|
|
|
@ -11,10 +11,10 @@ import React, {
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
useCallback,
|
useCallback,
|
||||||
RefObject,
|
type RefObject,
|
||||||
Dispatch,
|
type Dispatch,
|
||||||
SetStateAction,
|
type SetStateAction,
|
||||||
ReactNode,
|
type ReactNode,
|
||||||
useLayoutEffect,
|
useLayoutEffect,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {ComponentProps, ReactElement, useRef, useState} from 'react';
|
import React, {
|
||||||
|
type ComponentProps,
|
||||||
|
type ReactElement,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
import useIsBrowser from '@docusaurus/useIsBrowser';
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import {useCollapsible, Collapsible} from '../Collapsible';
|
import {useCollapsible, Collapsible} from '../Collapsible';
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
DocsSidebarProvider,
|
DocsSidebarProvider,
|
||||||
findSidebarCategory,
|
findSidebarCategory,
|
||||||
} from '../docsUtils';
|
} from '../docsUtils';
|
||||||
import {
|
import type {
|
||||||
PropSidebar,
|
PropSidebar,
|
||||||
PropSidebarItem,
|
PropSidebarItem,
|
||||||
PropSidebarItemCategory,
|
PropSidebarItemCategory,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {TOCItem} from '@docusaurus/types';
|
import type {TOCItem} from '@docusaurus/types';
|
||||||
import {filterTOC} from '../tocUtils';
|
import {filterTOC} from '../tocUtils';
|
||||||
|
|
||||||
describe('filterTOC', () => {
|
describe('filterTOC', () => {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import React, {
|
||||||
useEffect,
|
useEffect,
|
||||||
useCallback,
|
useCallback,
|
||||||
useMemo,
|
useMemo,
|
||||||
ReactNode,
|
type ReactNode,
|
||||||
useContext,
|
useContext,
|
||||||
createContext,
|
createContext,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
|
@ -7,16 +7,16 @@
|
||||||
|
|
||||||
import React, {
|
import React, {
|
||||||
createContext,
|
createContext,
|
||||||
ReactNode,
|
type ReactNode,
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
useMemo,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import {useThemeConfig, DocsVersionPersistence} from '../useThemeConfig';
|
import {useThemeConfig, type DocsVersionPersistence} from '../useThemeConfig';
|
||||||
import {isDocsPluginEnabled} from '../docsUtils';
|
import {isDocsPluginEnabled} from '../docsUtils';
|
||||||
|
|
||||||
import {useAllDocsData, GlobalPluginData} from '@theme/hooks/useDocs';
|
import {useAllDocsData, type GlobalPluginData} from '@theme/hooks/useDocs';
|
||||||
|
|
||||||
import DocsPreferredVersionStorage from './DocsPreferredVersionStorage';
|
import DocsPreferredVersionStorage from './DocsPreferredVersionStorage';
|
||||||
|
|
||||||
|
|
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