@docusaurus/types 3.8.1 → 3.9.0-canary-6403
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/config.d.ts +4 -102
- package/src/i18n.d.ts +24 -0
- package/src/index.d.ts +12 -4
- package/src/markdown.d.ts +175 -0
- package/src/reporting.d.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0-canary-6403",
|
|
4
4
|
"description": "Common types for Docusaurus packages.",
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@mdx-js/mdx": "^3.0.0",
|
|
17
17
|
"@types/history": "^4.7.11",
|
|
18
|
+
"@types/mdast": "^4.0.2",
|
|
18
19
|
"@types/react": "*",
|
|
19
20
|
"commander": "^5.1.0",
|
|
20
21
|
"joi": "^17.9.2",
|
|
@@ -27,5 +28,5 @@
|
|
|
27
28
|
"react": "^18.0.0 || ^19.0.0",
|
|
28
29
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
29
30
|
},
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "22c95f8cb5c070ce47e115be376fa9b828dd54df"
|
|
31
32
|
}
|
package/src/config.d.ts
CHANGED
|
@@ -10,12 +10,8 @@ import type {RuleSetRule} from 'webpack';
|
|
|
10
10
|
import type {DeepPartial, Overwrite} from 'utility-types';
|
|
11
11
|
import type {I18nConfig} from './i18n';
|
|
12
12
|
import type {PluginConfig, PresetConfig, HtmlTagObject} from './plugin';
|
|
13
|
-
|
|
14
|
-
import type {
|
|
15
|
-
|
|
16
|
-
export type RemarkRehypeOptions = ProcessorOptions['remarkRehypeOptions'];
|
|
17
|
-
|
|
18
|
-
export type ReportingSeverity = 'ignore' | 'log' | 'warn' | 'throw';
|
|
13
|
+
import type {ReportingSeverity} from './reporting';
|
|
14
|
+
import type {MarkdownConfig} from './markdown';
|
|
19
15
|
|
|
20
16
|
export type RouterType = 'browser' | 'hash';
|
|
21
17
|
|
|
@@ -23,101 +19,6 @@ export type ThemeConfig = {
|
|
|
23
19
|
[key: string]: unknown;
|
|
24
20
|
};
|
|
25
21
|
|
|
26
|
-
export type MarkdownPreprocessor = (args: {
|
|
27
|
-
filePath: string;
|
|
28
|
-
fileContent: string;
|
|
29
|
-
}) => string;
|
|
30
|
-
|
|
31
|
-
export type MDX1CompatOptions = {
|
|
32
|
-
comments: boolean;
|
|
33
|
-
admonitions: boolean;
|
|
34
|
-
headingIds: boolean;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type ParseFrontMatterParams = {filePath: string; fileContent: string};
|
|
38
|
-
export type ParseFrontMatterResult = {
|
|
39
|
-
frontMatter: {[key: string]: unknown};
|
|
40
|
-
content: string;
|
|
41
|
-
};
|
|
42
|
-
export type DefaultParseFrontMatter = (
|
|
43
|
-
params: ParseFrontMatterParams,
|
|
44
|
-
) => Promise<ParseFrontMatterResult>;
|
|
45
|
-
export type ParseFrontMatter = (
|
|
46
|
-
params: ParseFrontMatterParams & {
|
|
47
|
-
defaultParseFrontMatter: DefaultParseFrontMatter;
|
|
48
|
-
},
|
|
49
|
-
) => Promise<ParseFrontMatterResult>;
|
|
50
|
-
|
|
51
|
-
export type MarkdownAnchorsConfig = {
|
|
52
|
-
/**
|
|
53
|
-
* Preserves the case of the heading text when generating anchor ids.
|
|
54
|
-
*/
|
|
55
|
-
maintainCase: boolean;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export type MarkdownConfig = {
|
|
59
|
-
/**
|
|
60
|
-
* The Markdown format to use by default.
|
|
61
|
-
*
|
|
62
|
-
* This is the format passed down to the MDX compiler, impacting the way the
|
|
63
|
-
* content is parsed.
|
|
64
|
-
*
|
|
65
|
-
* Possible values:
|
|
66
|
-
* - `'mdx'`: use the MDX format (JSX support)
|
|
67
|
-
* - `'md'`: use the CommonMark format (no JSX support)
|
|
68
|
-
* - `'detect'`: select the format based on file extension (.md / .mdx)
|
|
69
|
-
*
|
|
70
|
-
* @see https://mdxjs.com/packages/mdx/#optionsformat
|
|
71
|
-
* @default 'mdx'
|
|
72
|
-
*/
|
|
73
|
-
format: 'mdx' | 'md' | 'detect';
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* A function callback that lets users parse the front matter themselves.
|
|
77
|
-
* Gives the opportunity to read it from a different source, or process it.
|
|
78
|
-
*
|
|
79
|
-
* @see https://github.com/facebook/docusaurus/issues/5568
|
|
80
|
-
*/
|
|
81
|
-
parseFrontMatter: ParseFrontMatter;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Allow mermaid language code blocks to be rendered into Mermaid diagrams:
|
|
85
|
-
*
|
|
86
|
-
* - `true`: code blocks with language mermaid will be rendered.
|
|
87
|
-
* - `false` | `undefined` (default): code blocks with language mermaid
|
|
88
|
-
* will be left as code blocks.
|
|
89
|
-
*
|
|
90
|
-
* @see https://docusaurus.io/docs/markdown-features/diagrams/
|
|
91
|
-
* @default false
|
|
92
|
-
*/
|
|
93
|
-
mermaid: boolean;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Gives opportunity to preprocess the MDX string content before compiling.
|
|
97
|
-
* A good escape hatch that can be used to handle edge cases.
|
|
98
|
-
*
|
|
99
|
-
* @param args
|
|
100
|
-
*/
|
|
101
|
-
preprocessor?: MarkdownPreprocessor;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Set of flags make it easier to upgrade from MDX 1 to MDX 2
|
|
105
|
-
* See also https://github.com/facebook/docusaurus/issues/4029
|
|
106
|
-
*/
|
|
107
|
-
mdx1Compat: MDX1CompatOptions;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Ability to provide custom remark-rehype options
|
|
111
|
-
* See also https://github.com/remarkjs/remark-rehype#options
|
|
112
|
-
*/
|
|
113
|
-
remarkRehypeOptions: RemarkRehypeOptions;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Options to control the behavior of anchors generated from Markdown headings
|
|
117
|
-
*/
|
|
118
|
-
anchors: MarkdownAnchorsConfig;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
22
|
export type StorageConfig = {
|
|
122
23
|
type: SiteStorage['type'];
|
|
123
24
|
namespace: boolean | string;
|
|
@@ -258,7 +159,8 @@ export type DocusaurusConfig = {
|
|
|
258
159
|
* @see https://docusaurus.io/docs/api/docusaurus-config#onBrokenMarkdownLinks
|
|
259
160
|
* @default "warn"
|
|
260
161
|
*/
|
|
261
|
-
|
|
162
|
+
// TODO Docusaurus v4 remove
|
|
163
|
+
onBrokenMarkdownLinks: ReportingSeverity | undefined;
|
|
262
164
|
/**
|
|
263
165
|
* The behavior of Docusaurus when it detects any [duplicate
|
|
264
166
|
* routes](https://docusaurus.io/docs/creating-pages#duplicate-routes).
|
package/src/i18n.d.ts
CHANGED
|
@@ -32,6 +32,30 @@ export type I18nLocaleConfig = {
|
|
|
32
32
|
* name.
|
|
33
33
|
*/
|
|
34
34
|
path: string;
|
|
35
|
+
/**
|
|
36
|
+
* Should we attempt to translate this locale?
|
|
37
|
+
* By default, it will only be run if the `./i18n/<locale>` exists.
|
|
38
|
+
*/
|
|
39
|
+
translate: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* For i18n sites deployed to distinct domains, it is recommended to configure
|
|
43
|
+
* a site url on a per-locale basis.
|
|
44
|
+
*/
|
|
45
|
+
url: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An explicit baseUrl to use for this locale, overriding the default one:
|
|
49
|
+
* Default values:
|
|
50
|
+
* - Default locale: `/${siteConfig.baseUrl}/`
|
|
51
|
+
* - Other locales: `/${siteConfig.baseUrl}/<locale>/`
|
|
52
|
+
*
|
|
53
|
+
* Exception: when using the CLI with a single `--locale` parameter, the
|
|
54
|
+
* `/<locale>/` path segment is not included. This is a better default for
|
|
55
|
+
* sites looking to deploy each locale to a different subdomain, such as
|
|
56
|
+
* `https://<locale>.docusaurus.io`
|
|
57
|
+
*/
|
|
58
|
+
baseUrl: string;
|
|
35
59
|
};
|
|
36
60
|
|
|
37
61
|
export type I18nConfig = {
|
package/src/index.d.ts
CHANGED
|
@@ -6,19 +6,27 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export {
|
|
9
|
-
ReportingSeverity,
|
|
10
9
|
RouterType,
|
|
11
10
|
ThemeConfig,
|
|
12
|
-
MarkdownConfig,
|
|
13
|
-
DefaultParseFrontMatter,
|
|
14
|
-
ParseFrontMatter,
|
|
15
11
|
DocusaurusConfig,
|
|
16
12
|
FutureConfig,
|
|
13
|
+
FutureV4Config,
|
|
17
14
|
FasterConfig,
|
|
18
15
|
StorageConfig,
|
|
19
16
|
Config,
|
|
20
17
|
} from './config';
|
|
21
18
|
|
|
19
|
+
export {
|
|
20
|
+
MarkdownConfig,
|
|
21
|
+
MarkdownHooks,
|
|
22
|
+
DefaultParseFrontMatter,
|
|
23
|
+
ParseFrontMatter,
|
|
24
|
+
OnBrokenMarkdownLinksFunction,
|
|
25
|
+
OnBrokenMarkdownImagesFunction,
|
|
26
|
+
} from './markdown';
|
|
27
|
+
|
|
28
|
+
export {ReportingSeverity} from './reporting';
|
|
29
|
+
|
|
22
30
|
export {
|
|
23
31
|
SiteMetadata,
|
|
24
32
|
DocusaurusContext,
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {ProcessorOptions} from '@mdx-js/mdx';
|
|
9
|
+
import type {Image, Definition, Link} from 'mdast';
|
|
10
|
+
|
|
11
|
+
import type {ReportingSeverity} from './reporting';
|
|
12
|
+
|
|
13
|
+
export type RemarkRehypeOptions = ProcessorOptions['remarkRehypeOptions'];
|
|
14
|
+
|
|
15
|
+
export type MarkdownPreprocessor = (args: {
|
|
16
|
+
filePath: string;
|
|
17
|
+
fileContent: string;
|
|
18
|
+
}) => string;
|
|
19
|
+
|
|
20
|
+
export type MDX1CompatOptions = {
|
|
21
|
+
comments: boolean;
|
|
22
|
+
admonitions: boolean;
|
|
23
|
+
headingIds: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type ParseFrontMatterParams = {filePath: string; fileContent: string};
|
|
27
|
+
export type ParseFrontMatterResult = {
|
|
28
|
+
frontMatter: {[key: string]: unknown};
|
|
29
|
+
content: string;
|
|
30
|
+
};
|
|
31
|
+
export type DefaultParseFrontMatter = (
|
|
32
|
+
params: ParseFrontMatterParams,
|
|
33
|
+
) => Promise<ParseFrontMatterResult>;
|
|
34
|
+
export type ParseFrontMatter = (
|
|
35
|
+
params: ParseFrontMatterParams & {
|
|
36
|
+
defaultParseFrontMatter: DefaultParseFrontMatter;
|
|
37
|
+
},
|
|
38
|
+
) => Promise<ParseFrontMatterResult>;
|
|
39
|
+
|
|
40
|
+
export type MarkdownAnchorsConfig = {
|
|
41
|
+
/**
|
|
42
|
+
* Preserves the case of the heading text when generating anchor ids.
|
|
43
|
+
*/
|
|
44
|
+
maintainCase: boolean;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type OnBrokenMarkdownLinksFunction = (params: {
|
|
48
|
+
/**
|
|
49
|
+
* Path of the source file on which the broken link was found
|
|
50
|
+
* Relative to the site dir.
|
|
51
|
+
* Example: "docs/category/myDoc.mdx"
|
|
52
|
+
*/
|
|
53
|
+
sourceFilePath: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The Markdown link url that couldn't be resolved.
|
|
57
|
+
* Technically, in this context, it's more a "relative file path", but let's
|
|
58
|
+
* name it url for consistency with usual Markdown names and the MDX AST
|
|
59
|
+
* Example: "relative/dir/myTargetDoc.mdx?query#hash"
|
|
60
|
+
*/
|
|
61
|
+
url: string;
|
|
62
|
+
/**
|
|
63
|
+
* The Markdown Link AST node.
|
|
64
|
+
*/
|
|
65
|
+
node: Link | Definition;
|
|
66
|
+
}) => void | string;
|
|
67
|
+
|
|
68
|
+
export type OnBrokenMarkdownImagesFunction = (params: {
|
|
69
|
+
/**
|
|
70
|
+
* Path of the source file on which the broken image was found
|
|
71
|
+
* Relative to the site dir.
|
|
72
|
+
* Example: "docs/category/myDoc.mdx"
|
|
73
|
+
*/
|
|
74
|
+
sourceFilePath: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The Markdown image url that couldn't be resolved.
|
|
78
|
+
* Technically, in this context, it's more a "relative file path", but let's
|
|
79
|
+
* name it url for consistency with usual Markdown names and the MDX AST
|
|
80
|
+
* Example: "relative/dir/myImage.png"
|
|
81
|
+
*/
|
|
82
|
+
url: string;
|
|
83
|
+
/**
|
|
84
|
+
* The Markdown Image AST node.
|
|
85
|
+
*/
|
|
86
|
+
node: Image;
|
|
87
|
+
}) => void | string;
|
|
88
|
+
|
|
89
|
+
export type MarkdownHooks = {
|
|
90
|
+
/**
|
|
91
|
+
* The behavior of Docusaurus when it detects any broken Markdown link.
|
|
92
|
+
*
|
|
93
|
+
* // TODO refactor doc links!
|
|
94
|
+
* @see https://docusaurus.io/docs/api/docusaurus-config#onBrokenMarkdownLinks
|
|
95
|
+
* @default "warn"
|
|
96
|
+
*/
|
|
97
|
+
onBrokenMarkdownLinks: ReportingSeverity | OnBrokenMarkdownLinksFunction;
|
|
98
|
+
|
|
99
|
+
onBrokenMarkdownImages: ReportingSeverity | OnBrokenMarkdownImagesFunction;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type MarkdownConfig = {
|
|
103
|
+
/**
|
|
104
|
+
* The Markdown format to use by default.
|
|
105
|
+
*
|
|
106
|
+
* This is the format passed down to the MDX compiler, impacting the way the
|
|
107
|
+
* content is parsed.
|
|
108
|
+
*
|
|
109
|
+
* Possible values:
|
|
110
|
+
* - `'mdx'`: use the MDX format (JSX support)
|
|
111
|
+
* - `'md'`: use the CommonMark format (no JSX support)
|
|
112
|
+
* - `'detect'`: select the format based on file extension (.md / .mdx)
|
|
113
|
+
*
|
|
114
|
+
* @see https://mdxjs.com/packages/mdx/#optionsformat
|
|
115
|
+
* @default 'mdx'
|
|
116
|
+
*/
|
|
117
|
+
format: 'mdx' | 'md' | 'detect';
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* A function callback that lets users parse the front matter themselves.
|
|
121
|
+
* Gives the opportunity to read it from a different source, or process it.
|
|
122
|
+
*
|
|
123
|
+
* @see https://github.com/facebook/docusaurus/issues/5568
|
|
124
|
+
*/
|
|
125
|
+
parseFrontMatter: ParseFrontMatter;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Allow mermaid language code blocks to be rendered into Mermaid diagrams:
|
|
129
|
+
*
|
|
130
|
+
* - `true`: code blocks with language mermaid will be rendered.
|
|
131
|
+
* - `false` | `undefined` (default): code blocks with language mermaid
|
|
132
|
+
* will be left as code blocks.
|
|
133
|
+
*
|
|
134
|
+
* @see https://docusaurus.io/docs/markdown-features/diagrams/
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
mermaid: boolean;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Allow remark-emoji to convert emoji shortcodes to Unicode emoji.
|
|
141
|
+
* - `true` (default): enables the remark-emoji plugin to convert shortcodes
|
|
142
|
+
* - `false`: disables the remark-emoji plugin
|
|
143
|
+
*
|
|
144
|
+
* @see https://github.com/rhysd/remark-emoji
|
|
145
|
+
* @default true
|
|
146
|
+
*/
|
|
147
|
+
emoji: boolean;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Gives opportunity to preprocess the MDX string content before compiling.
|
|
151
|
+
* A good escape hatch that can be used to handle edge cases.
|
|
152
|
+
*
|
|
153
|
+
* @param args
|
|
154
|
+
*/
|
|
155
|
+
preprocessor?: MarkdownPreprocessor;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Set of flags make it easier to upgrade from MDX 1 to MDX 2
|
|
159
|
+
* See also https://github.com/facebook/docusaurus/issues/4029
|
|
160
|
+
*/
|
|
161
|
+
mdx1Compat: MDX1CompatOptions;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Ability to provide custom remark-rehype options
|
|
165
|
+
* See also https://github.com/remarkjs/remark-rehype#options
|
|
166
|
+
*/
|
|
167
|
+
remarkRehypeOptions: RemarkRehypeOptions;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Options to control the behavior of anchors generated from Markdown headings
|
|
171
|
+
*/
|
|
172
|
+
anchors: MarkdownAnchorsConfig;
|
|
173
|
+
|
|
174
|
+
hooks: MarkdownHooks;
|
|
175
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type ReportingSeverity = 'ignore' | 'log' | 'warn' | 'throw';
|