mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-29 00:47:03 +02:00
refactor: improve setup of type declaration files (#5914)
This commit is contained in:
parent
334470b5d4
commit
d1308a8736
33 changed files with 872 additions and 868 deletions
18
packages/docusaurus-mdx-loader/src/mdx-loader.d.ts
vendored
Normal file
18
packages/docusaurus-mdx-loader/src/mdx-loader.d.ts
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import type {Plugin} from 'unified';
|
||||
|
||||
export type RemarkOrRehypePlugin =
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[Plugin<any[]>, Record<string, unknown>] | Plugin<any[]>;
|
||||
export type RemarkAndRehypePluginOptions = {
|
||||
remarkPlugins: RemarkOrRehypePlugin[];
|
||||
rehypePlugins: RemarkOrRehypePlugin[];
|
||||
beforeDefaultRemarkPlugins: RemarkOrRehypePlugin[];
|
||||
beforeDefaultRehypePlugins: RemarkOrRehypePlugin[];
|
||||
};
|
43
packages/docusaurus-mdx-loader/src/types.d.ts
vendored
43
packages/docusaurus-mdx-loader/src/types.d.ts
vendored
|
@ -1,43 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
declare module '@docusaurus/mdx-loader' {
|
||||
import type {Plugin} from 'unified';
|
||||
|
||||
export type RemarkOrRehypePlugin =
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[Plugin<any[]>, Record<string, unknown>] | Plugin<any[]>;
|
||||
export type RemarkAndRehypePluginOptions = {
|
||||
remarkPlugins: RemarkOrRehypePlugin[];
|
||||
rehypePlugins: RemarkOrRehypePlugin[];
|
||||
beforeDefaultRemarkPlugins: RemarkOrRehypePlugin[];
|
||||
beforeDefaultRehypePlugins: RemarkOrRehypePlugin[];
|
||||
};
|
||||
}
|
||||
|
||||
// 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' {
|
||||
import type {Processor} from 'unified';
|
||||
import type {RemarkOrRehypePlugin} from '@docusaurus/mdx-loader';
|
||||
|
||||
namespace mdx {
|
||||
interface Options {
|
||||
filepath?: string;
|
||||
skipExport?: boolean;
|
||||
wrapExport?: string;
|
||||
remarkPlugins?: RemarkOrRehypePlugin[];
|
||||
rehypePlugins?: RemarkOrRehypePlugin[];
|
||||
}
|
||||
|
||||
function sync(content: string, options?: Options): string;
|
||||
function createMdxAstCompiler(options?: Options): Processor;
|
||||
function createCompiler(options?: Options): Processor;
|
||||
}
|
||||
function mdx(content: string, options?: mdx.Options): Promise<string>;
|
||||
|
||||
export default mdx;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue