mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 14:06:59 +02:00
fix: fix a lot of declaration semantic errors (#7194)
This commit is contained in:
parent
b154318c28
commit
7f06857e46
8 changed files with 62 additions and 61 deletions
8
packages/docusaurus-mdx-loader/src/deps.d.ts
vendored
8
packages/docusaurus-mdx-loader/src/deps.d.ts
vendored
|
@ -8,14 +8,14 @@
|
||||||
// TODO Types provided by MDX 2.0 https://github.com/mdx-js/mdx/blob/main/packages/mdx/types/index.d.ts
|
// TODO Types provided by MDX 2.0 https://github.com/mdx-js/mdx/blob/main/packages/mdx/types/index.d.ts
|
||||||
declare module '@mdx-js/mdx' {
|
declare module '@mdx-js/mdx' {
|
||||||
import type {Processor} from 'unified';
|
import type {Processor} from 'unified';
|
||||||
import type {RemarkOrRehypePlugin} from '@docusaurus/mdx-loader';
|
import type {MDXPlugin} from '@docusaurus/mdx-loader';
|
||||||
|
|
||||||
export type Options = {
|
export type Options = {
|
||||||
filepath?: string;
|
filepath?: string;
|
||||||
skipExport?: boolean;
|
skipExport?: boolean;
|
||||||
wrapExport?: string;
|
wrapExport?: string;
|
||||||
remarkPlugins?: RemarkOrRehypePlugin[];
|
remarkPlugins?: MDXPlugin[];
|
||||||
rehypePlugins?: RemarkOrRehypePlugin[];
|
rehypePlugins?: MDXPlugin[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export function sync(content: string, options?: Options): string;
|
export function sync(content: string, options?: Options): string;
|
||||||
|
@ -23,6 +23,6 @@ declare module '@mdx-js/mdx' {
|
||||||
export function createCompiler(options?: Options): Processor;
|
export function createCompiler(options?: Options): Processor;
|
||||||
export default function mdx(
|
export default function mdx(
|
||||||
content: string,
|
content: string,
|
||||||
options?: mdx.Options,
|
options?: Options,
|
||||||
): Promise<string>;
|
): Promise<string>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
|
|
||||||
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
|
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
|
||||||
import type {BlogPost} from './types';
|
import type {BlogPost} from './types';
|
||||||
import {
|
import {normalizeUrl, readOutputHTMLFile} from '@docusaurus/utils';
|
||||||
normalizeUrl,
|
|
||||||
mapAsyncSequential,
|
|
||||||
readOutputHTMLFile,
|
|
||||||
} from '@docusaurus/utils';
|
|
||||||
import {load as cheerioLoad} from 'cheerio';
|
import {load as cheerioLoad} from 'cheerio';
|
||||||
import type {DocusaurusConfig} from '@docusaurus/types';
|
import type {DocusaurusConfig} from '@docusaurus/types';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
@ -61,7 +57,8 @@ async function generateBlogFeed({
|
||||||
return {name: author.name, link: author.url, email: author.email};
|
return {name: author.name, link: author.url, email: author.email};
|
||||||
}
|
}
|
||||||
|
|
||||||
await mapAsyncSequential(blogPosts, async (post) => {
|
await Promise.all(
|
||||||
|
blogPosts.map(async (post) => {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
metadata: {
|
metadata: {
|
||||||
|
@ -99,8 +96,9 @@ async function generateBlogFeed({
|
||||||
feedItem.author = feedItemAuthors;
|
feedItem.author = feedItemAuthors;
|
||||||
}
|
}
|
||||||
|
|
||||||
feed.addItem(feedItem);
|
return feedItem;
|
||||||
});
|
}),
|
||||||
|
).then((items) => items.forEach(feed.addItem));
|
||||||
|
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,8 @@ declare module '@endiliey/react-ideal-image' {
|
||||||
|
|
||||||
type ThemeKey = 'placeholder' | 'img' | 'icon' | 'noscript';
|
type ThemeKey = 'placeholder' | 'img' | 'icon' | 'noscript';
|
||||||
|
|
||||||
export interface ImageProps extends ComponentProps<'img'> {
|
export interface ImageProps
|
||||||
|
extends Omit<ComponentProps<'img'>, 'srcSet' | 'placeholder'> {
|
||||||
/**
|
/**
|
||||||
* This function decides what icon to show based on the current state of the
|
* This function decides what icon to show based on the current state of the
|
||||||
* component.
|
* component.
|
||||||
|
|
|
@ -66,7 +66,7 @@ declare module '@docusaurus/plugin-pwa' {
|
||||||
tagName: string;
|
tagName: string;
|
||||||
href?: string;
|
href?: string;
|
||||||
content?: string;
|
content?: string;
|
||||||
[attributeName: string]: string | boolean;
|
[attributeName: string]: string | boolean | undefined;
|
||||||
}[];
|
}[];
|
||||||
/**
|
/**
|
||||||
* Useful for additional Workbox rules. You can do whatever a service worker
|
* Useful for additional Workbox rules. You can do whatever a service worker
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
/// <reference types="@docusaurus/module-type-aliases" />
|
/// <reference types="@docusaurus/module-type-aliases" />
|
||||||
|
|
||||||
declare module '@theme-init/CodeBlock' {
|
declare module '@theme-init/CodeBlock' {
|
||||||
import type CodeBlock, {Props as BaseProps} from '@theme/CodeBlock';
|
import type CodeBlock from '@theme/CodeBlock';
|
||||||
|
import type {Props as BaseProps} from '@theme/CodeBlock';
|
||||||
|
|
||||||
export interface Props extends BaseProps {
|
export interface Props extends BaseProps {
|
||||||
live?: boolean;
|
live?: boolean;
|
||||||
|
|
|
@ -145,7 +145,7 @@ async function buildLocale({
|
||||||
new ReactLoadableSSRAddon({
|
new ReactLoadableSSRAddon({
|
||||||
filename: clientManifestPath,
|
filename: clientManifestPath,
|
||||||
}),
|
}),
|
||||||
].filter(Boolean),
|
].filter(<T>(x: T | undefined | false): x is T => Boolean(x)),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ You can also set the deploymentBranch property in docusaurus.config.js .`);
|
||||||
if (!cliOptions.skipBuild) {
|
if (!cliOptions.skipBuild) {
|
||||||
// Build site, then push to deploymentBranch branch of specified repo.
|
// Build site, then push to deploymentBranch branch of specified repo.
|
||||||
try {
|
try {
|
||||||
await runDeploy(await build(siteDir, cliOptions, false));
|
await build(siteDir, cliOptions, false).then(runDeploy);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('Deployment of the build output failed.');
|
logger.error('Deployment of the build output failed.');
|
||||||
throw err;
|
throw err;
|
||||||
|
|
25
packages/docusaurus/src/deps.d.ts
vendored
25
packages/docusaurus/src/deps.d.ts
vendored
|
@ -8,6 +8,8 @@
|
||||||
declare module 'remark-admonitions';
|
declare module 'remark-admonitions';
|
||||||
|
|
||||||
declare module 'react-loadable-ssr-addon-v5-slorber' {
|
declare module 'react-loadable-ssr-addon-v5-slorber' {
|
||||||
|
import type {WebpackPluginInstance, Compiler} from 'webpack';
|
||||||
|
|
||||||
type Asset = {
|
type Asset = {
|
||||||
file: string;
|
file: string;
|
||||||
hash: string;
|
hash: string;
|
||||||
|
@ -26,15 +28,14 @@ declare module 'react-loadable-ssr-addon-v5-slorber' {
|
||||||
modulesToBeLoaded: string[],
|
modulesToBeLoaded: string[],
|
||||||
): {js: Asset[]; css: Asset[]};
|
): {js: Asset[]; css: Asset[]};
|
||||||
|
|
||||||
type ReactLoadableSSRAddon = {
|
export default class ReactLoadableSSRAddon implements WebpackPluginInstance {
|
||||||
new (props: {filename: string});
|
constructor(props: {filename: string});
|
||||||
};
|
apply(compiler: Compiler): void;
|
||||||
|
}
|
||||||
const plugin: ReactLoadableSSRAddon;
|
|
||||||
export default plugin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@slorber/static-site-generator-webpack-plugin' {
|
declare module '@slorber/static-site-generator-webpack-plugin' {
|
||||||
|
import type {WebpackPluginInstance, Compiler} from 'webpack';
|
||||||
import type {HelmetServerState} from 'react-helmet-async';
|
import type {HelmetServerState} from 'react-helmet-async';
|
||||||
|
|
||||||
export type Locals = {
|
export type Locals = {
|
||||||
|
@ -53,18 +54,18 @@ declare module '@slorber/static-site-generator-webpack-plugin' {
|
||||||
noIndex: boolean;
|
noIndex: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StaticSiteGeneratorPlugin = {
|
export default class StaticSiteGeneratorPlugin
|
||||||
new (props: {
|
implements WebpackPluginInstance
|
||||||
|
{
|
||||||
|
constructor(props: {
|
||||||
entry: string;
|
entry: string;
|
||||||
locals: Locals;
|
locals: Locals;
|
||||||
paths: string[];
|
paths: string[];
|
||||||
preferFoldersOutput?: boolean;
|
preferFoldersOutput?: boolean;
|
||||||
globals: {[key: string]: unknown};
|
globals: {[key: string]: unknown};
|
||||||
});
|
});
|
||||||
};
|
apply(compiler: Compiler): void;
|
||||||
|
}
|
||||||
const plugin: StaticSiteGeneratorPlugin;
|
|
||||||
export default plugin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'webpack/lib/HotModuleReplacementPlugin' {
|
declare module 'webpack/lib/HotModuleReplacementPlugin' {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue