mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-12 06:18:02 +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
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
BlogPostFrontMatter,
|
||||
type BlogPostFrontMatter,
|
||||
validateBlogPostFrontMatter,
|
||||
} from '../blogFrontMatter';
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
import path from 'path';
|
||||
import {generateBlogFeed} from '../feed';
|
||||
import {LoadContext, I18n} from '@docusaurus/types';
|
||||
import {PluginOptions, BlogContentPaths} from '../types';
|
||||
import type {LoadContext, I18n} from '@docusaurus/types';
|
||||
import type {PluginOptions, BlogContentPaths} from '../types';
|
||||
import {DEFAULT_OPTIONS} from '../pluginOptionSchema';
|
||||
import {generateBlogPosts} from '../blogUtils';
|
||||
import {Feed} from 'feed';
|
||||
import type {Feed} from 'feed';
|
||||
|
||||
const DefaultI18N: I18n = {
|
||||
currentLocale: 'en',
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import pluginContentBlog from '../index';
|
||||
import {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
|
||||
import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
|
||||
import {PluginOptionSchema} from '../pluginOptionSchema';
|
||||
import {PluginOptions, EditUrlFunction, BlogPost} from '../types';
|
||||
import {Joi} from '@docusaurus/utils-validation';
|
||||
import type {PluginOptions, EditUrlFunction, BlogPost} from '../types';
|
||||
import type {Joi} from '@docusaurus/utils-validation';
|
||||
import {posixPath} from '@docusaurus/utils';
|
||||
|
||||
function findByTitle(
|
||||
|
|
|
@ -7,8 +7,12 @@
|
|||
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {linkify, LinkifyParams, getSourceToPermalink} from '../blogUtils';
|
||||
import {BlogBrokenMarkdownLink, BlogContentPaths, BlogPost} from '../types';
|
||||
import {linkify, type LinkifyParams, getSourceToPermalink} from '../blogUtils';
|
||||
import type {
|
||||
BlogBrokenMarkdownLink,
|
||||
BlogContentPaths,
|
||||
BlogPost,
|
||||
} from '../types';
|
||||
|
||||
const siteDir = path.join(__dirname, '__fixtures__', 'website');
|
||||
const contentPaths: BlogContentPaths = {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 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 {DEFAULT_OPTIONS} from '../pluginOptionSchema';
|
||||
import {updateTranslationFileMessages} from '@docusaurus/utils';
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 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 {Joi, URISchema} from '@docusaurus/utils-validation';
|
||||
import {
|
||||
import type {
|
||||
BlogPostFrontMatter,
|
||||
BlogPostFrontMatterAuthor,
|
||||
BlogPostFrontMatterAuthors,
|
||||
|
|
|
@ -9,7 +9,7 @@ import fs from 'fs-extra';
|
|||
import path from 'path';
|
||||
import readingTime from 'reading-time';
|
||||
import {keyBy, mapValues} from 'lodash';
|
||||
import {
|
||||
import type {
|
||||
PluginOptions,
|
||||
BlogPost,
|
||||
BlogContentPaths,
|
||||
|
@ -30,9 +30,9 @@ import {
|
|||
groupTaggedItems,
|
||||
getContentPathList,
|
||||
} from '@docusaurus/utils';
|
||||
import {LoadContext} from '@docusaurus/types';
|
||||
import type {LoadContext} from '@docusaurus/types';
|
||||
import {validateBlogPostFrontMatter} from './blogFrontMatter';
|
||||
import {AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
||||
import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
|
||||
import logger from '@docusaurus/logger';
|
||||
|
||||
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {Feed, Author as FeedAuthor, Item as FeedItem} from 'feed';
|
||||
import {PluginOptions, Author, BlogPost, FeedType} from './types';
|
||||
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
|
||||
import type {PluginOptions, Author, BlogPost, FeedType} from './types';
|
||||
import {normalizeUrl, mdxToHtml} from '@docusaurus/utils';
|
||||
import {DocusaurusConfig} from '@docusaurus/types';
|
||||
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
} from '@docusaurus/utils';
|
||||
import {translateContent, getTranslationFiles} from './translations';
|
||||
|
||||
import {
|
||||
import type {
|
||||
PluginOptions,
|
||||
BlogTags,
|
||||
BlogContent,
|
||||
|
@ -35,7 +35,7 @@ import {
|
|||
Assets,
|
||||
} from './types';
|
||||
import {PluginOptionSchema} from './pluginOptionSchema';
|
||||
import {
|
||||
import type {
|
||||
LoadContext,
|
||||
ConfigureWebpackUtils,
|
||||
Props,
|
||||
|
@ -44,13 +44,13 @@ import {
|
|||
OptionValidationContext,
|
||||
ValidationResult,
|
||||
} from '@docusaurus/types';
|
||||
import {Configuration} from 'webpack';
|
||||
import type {Configuration} from 'webpack';
|
||||
import {
|
||||
generateBlogPosts,
|
||||
getSourceToPermalink,
|
||||
getBlogTags,
|
||||
} from './blogUtils';
|
||||
import {BlogPostFrontMatter} from './blogFrontMatter';
|
||||
import type {BlogPostFrontMatter} from './blogFrontMatter';
|
||||
import {createBlogFeedFiles} from './feed';
|
||||
|
||||
export default async function pluginContentBlog(
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import {truncate, linkify} from './blogUtils';
|
||||
import {parseQuery} from 'loader-utils';
|
||||
import {BlogMarkdownLoaderOptions} from './types';
|
||||
import type {BlogMarkdownLoaderOptions} from './types';
|
||||
import type {LoaderContext} from 'webpack';
|
||||
|
||||
export default function markdownLoader(
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
URISchema,
|
||||
} from '@docusaurus/utils-validation';
|
||||
import {GlobExcludeDefault} from '@docusaurus/utils';
|
||||
import {PluginOptions} from './types';
|
||||
import type {PluginOptions} from './types';
|
||||
|
||||
export const DEFAULT_OPTIONS: PluginOptions = {
|
||||
feedOptions: {type: ['rss', 'atom'], copyright: ''},
|
||||
|
|
|
@ -11,8 +11,8 @@ import type {
|
|||
BrokenMarkdownLink,
|
||||
ContentPaths,
|
||||
} from '@docusaurus/utils/lib/markdownLinks';
|
||||
import {Overwrite} from 'utility-types';
|
||||
import {BlogPostFrontMatter} from './blogFrontMatter';
|
||||
import type {Overwrite} from 'utility-types';
|
||||
import type {BlogPostFrontMatter} from './blogFrontMatter';
|
||||
|
||||
export type BlogContentPaths = ContentPaths;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue