@docusaurus/module-type-aliases 2.0.0-beta.ff31de0ff → 2.0.0-rc.1
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 +13 -6
- package/src/index.d.ts +197 -84
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/module-type-aliases",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"description": "Docusaurus module type aliases.",
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -11,13 +11,20 @@
|
|
|
11
11
|
"url": "https://github.com/facebook/docusaurus.git",
|
|
12
12
|
"directory": "packages/docusaurus-module-type-aliases"
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@docusaurus/react-loadable": "5.5.2",
|
|
16
|
+
"@docusaurus/types": "2.0.0-rc.1",
|
|
17
|
+
"@types/history": "^4.7.11",
|
|
15
18
|
"@types/react": "*",
|
|
16
|
-
"@types/react-helmet": "*",
|
|
17
|
-
"@types/react-loadable": "*",
|
|
18
19
|
"@types/react-router-config": "*",
|
|
19
|
-
"@types/react-router-dom": "*"
|
|
20
|
+
"@types/react-router-dom": "*",
|
|
21
|
+
"react-helmet-async": "*",
|
|
22
|
+
"react-loadable": "npm:@docusaurus/react-loadable@5.5.2"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "*",
|
|
26
|
+
"react-dom": "*"
|
|
20
27
|
},
|
|
21
28
|
"license": "MIT",
|
|
22
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "c8ddd02a8e68dfaf515c20465a049a83153bd205"
|
|
23
30
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -6,118 +6,184 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
declare module '@generated/client-modules' {
|
|
9
|
-
|
|
9
|
+
import type {ClientModule} from '@docusaurus/types';
|
|
10
|
+
|
|
11
|
+
const clientModules: readonly (ClientModule & {default?: ClientModule})[];
|
|
10
12
|
export default clientModules;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
declare module '@generated/docusaurus.config' {
|
|
14
|
-
|
|
16
|
+
import type {DocusaurusConfig} from '@docusaurus/types';
|
|
17
|
+
|
|
18
|
+
const config: DocusaurusConfig;
|
|
15
19
|
export default config;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
declare module '@generated/site-metadata' {
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
import type {SiteMetadata} from '@docusaurus/types';
|
|
24
|
+
|
|
25
|
+
const siteMetadata: SiteMetadata;
|
|
26
|
+
export = siteMetadata;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
declare module '@generated/registry' {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
import type {Registry} from '@docusaurus/types';
|
|
31
|
+
|
|
32
|
+
const registry: Registry;
|
|
27
33
|
export default registry;
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
declare module '@generated/routes' {
|
|
31
|
-
type
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
import type {RouteConfig as RRRouteConfig} from 'react-router-config';
|
|
38
|
+
import type Loadable from 'react-loadable';
|
|
39
|
+
|
|
40
|
+
type RouteConfig = RRRouteConfig & {
|
|
41
|
+
path: string;
|
|
42
|
+
component: ReturnType<typeof Loadable>;
|
|
35
43
|
};
|
|
36
|
-
const routes:
|
|
44
|
+
const routes: RouteConfig[];
|
|
37
45
|
export default routes;
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
declare module '@generated/routesChunkNames' {
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
import type {RouteChunkNames} from '@docusaurus/types';
|
|
50
|
+
|
|
51
|
+
const routesChunkNames: RouteChunkNames;
|
|
52
|
+
export = routesChunkNames;
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
declare module '@generated/globalData' {
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
import type {GlobalData} from '@docusaurus/types';
|
|
57
|
+
|
|
58
|
+
const globalData: GlobalData;
|
|
59
|
+
export = globalData;
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
declare module '@generated/i18n' {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
localeConfigs: Record<string, {label: string; direction: string}>;
|
|
56
|
-
};
|
|
57
|
-
export default i18n;
|
|
63
|
+
import type {I18n} from '@docusaurus/types';
|
|
64
|
+
|
|
65
|
+
const i18n: I18n;
|
|
66
|
+
export = i18n;
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
declare module '@generated/codeTranslations' {
|
|
61
|
-
|
|
62
|
-
export default codeTranslations;
|
|
63
|
-
}
|
|
70
|
+
import type {CodeTranslations} from '@docusaurus/types';
|
|
64
71
|
|
|
65
|
-
|
|
72
|
+
const codeTranslations: CodeTranslations;
|
|
73
|
+
export = codeTranslations;
|
|
74
|
+
}
|
|
66
75
|
|
|
67
76
|
declare module '@theme-original/*';
|
|
77
|
+
declare module '@theme-init/*';
|
|
68
78
|
|
|
69
|
-
declare module '@
|
|
79
|
+
declare module '@theme/Error' {
|
|
80
|
+
import type {FallbackParams} from '@docusaurus/ErrorBoundary';
|
|
70
81
|
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
export interface Props extends FallbackParams {}
|
|
83
|
+
export default function Error(props: Props): JSX.Element;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare module '@theme/Layout' {
|
|
73
87
|
import type {ReactNode} from 'react';
|
|
74
88
|
|
|
75
|
-
export
|
|
89
|
+
export interface Props {
|
|
90
|
+
readonly children?: ReactNode;
|
|
91
|
+
}
|
|
92
|
+
export default function Layout(props: Props): JSX.Element;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare module '@theme/Loading' {
|
|
96
|
+
import type {LoadingComponentProps} from 'react-loadable';
|
|
76
97
|
|
|
77
|
-
|
|
78
|
-
export default Head;
|
|
98
|
+
export default function Loading(props: LoadingComponentProps): JSX.Element;
|
|
79
99
|
}
|
|
80
100
|
|
|
81
|
-
declare module '@
|
|
101
|
+
declare module '@theme/NotFound' {
|
|
102
|
+
export default function NotFound(): JSX.Element;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare module '@theme/Root' {
|
|
82
106
|
import type {ReactNode} from 'react';
|
|
83
107
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
108
|
+
export interface Props {
|
|
109
|
+
readonly children: ReactNode;
|
|
110
|
+
}
|
|
111
|
+
export default function Root({children}: Props): JSX.Element;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare module '@theme/SiteMetadata' {
|
|
115
|
+
export default function SiteMetadata(): JSX.Element;
|
|
116
|
+
}
|
|
93
117
|
|
|
94
|
-
|
|
95
|
-
|
|
118
|
+
declare module '@docusaurus/constants' {
|
|
119
|
+
export const DEFAULT_PLUGIN_ID: 'default';
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare module '@docusaurus/ErrorBoundary' {
|
|
123
|
+
import type {ReactNode} from 'react';
|
|
124
|
+
|
|
125
|
+
export type FallbackParams = {
|
|
126
|
+
readonly error: Error;
|
|
127
|
+
readonly tryAgain: () => void;
|
|
96
128
|
};
|
|
97
|
-
|
|
98
|
-
export
|
|
129
|
+
|
|
130
|
+
export type FallbackFunction = (params: FallbackParams) => JSX.Element;
|
|
131
|
+
|
|
132
|
+
export interface Props {
|
|
133
|
+
readonly fallback?: FallbackFunction;
|
|
134
|
+
readonly children: ReactNode;
|
|
135
|
+
}
|
|
136
|
+
export default function ErrorBoundary(props: Props): JSX.Element;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare module '@docusaurus/Head' {
|
|
140
|
+
import type {ReactNode} from 'react';
|
|
141
|
+
import type {HelmetProps} from 'react-helmet-async';
|
|
142
|
+
|
|
143
|
+
export type Props = HelmetProps & {children: ReactNode};
|
|
144
|
+
|
|
145
|
+
export default function Head(props: Props): JSX.Element;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
declare module '@docusaurus/Link' {
|
|
149
|
+
import type {CSSProperties, ComponentProps} from 'react';
|
|
150
|
+
import type {NavLinkProps as RRNavLinkProps} from 'react-router-dom';
|
|
151
|
+
|
|
152
|
+
type NavLinkProps = Partial<RRNavLinkProps>;
|
|
153
|
+
export type Props = NavLinkProps &
|
|
154
|
+
ComponentProps<'a'> & {
|
|
155
|
+
readonly className?: string;
|
|
156
|
+
readonly style?: CSSProperties;
|
|
157
|
+
readonly isNavLink?: boolean;
|
|
158
|
+
readonly to?: string;
|
|
159
|
+
readonly href?: string;
|
|
160
|
+
readonly autoAddBaseUrl?: boolean;
|
|
161
|
+
|
|
162
|
+
/** Escape hatch in case broken links check doesn't make sense. */
|
|
163
|
+
readonly 'data-noBrokenLinkCheck'?: boolean;
|
|
164
|
+
};
|
|
165
|
+
export default function Link(props: Props): JSX.Element;
|
|
99
166
|
}
|
|
100
167
|
|
|
101
168
|
declare module '@docusaurus/Interpolate' {
|
|
102
169
|
import type {ReactNode} from 'react';
|
|
103
170
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
171
|
+
export type ExtractInterpolatePlaceholders<Str extends string> =
|
|
172
|
+
Str extends `${string}{${infer Key}}${infer Rest}`
|
|
173
|
+
? Key | ExtractInterpolatePlaceholders<Rest>
|
|
174
|
+
: never;
|
|
108
175
|
|
|
109
|
-
export type InterpolateValues<
|
|
110
|
-
Str
|
|
111
|
-
|
|
112
|
-
> = Record<ExtractInterpolatePlaceholders<Str>, Value>;
|
|
176
|
+
export type InterpolateValues<Str extends string, Value extends ReactNode> = {
|
|
177
|
+
[key in ExtractInterpolatePlaceholders<Str>]: Value;
|
|
178
|
+
};
|
|
113
179
|
|
|
114
|
-
//
|
|
180
|
+
// If all the values are plain strings, interpolate returns a simple string
|
|
115
181
|
export function interpolate<Str extends string>(
|
|
116
182
|
text: Str,
|
|
117
183
|
values?: InterpolateValues<Str, string | number>,
|
|
118
184
|
): string;
|
|
119
185
|
|
|
120
|
-
// If values contain any ReactNode,
|
|
186
|
+
// If values contain any ReactNode, the return is a ReactNode
|
|
121
187
|
export function interpolate<Str extends string, Value extends ReactNode>(
|
|
122
188
|
text: Str,
|
|
123
189
|
values?: InterpolateValues<Str, Value>,
|
|
@@ -134,18 +200,23 @@ declare module '@docusaurus/Interpolate' {
|
|
|
134
200
|
}
|
|
135
201
|
|
|
136
202
|
declare module '@docusaurus/Translate' {
|
|
137
|
-
import type {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
203
|
+
import type {ReactNode} from 'react';
|
|
204
|
+
import type {InterpolateValues} from '@docusaurus/Interpolate';
|
|
205
|
+
|
|
206
|
+
// TS type to ensure that at least one of id or message is always provided
|
|
207
|
+
// (Generic permits to handled message provided as React children)
|
|
208
|
+
type IdOrMessage<
|
|
209
|
+
MessageKey extends 'children' | 'message',
|
|
210
|
+
Str extends string,
|
|
211
|
+
> =
|
|
212
|
+
| ({[key in MessageKey]: Str} & {id?: string})
|
|
213
|
+
| ({[key in MessageKey]?: Str} & {id: string});
|
|
141
214
|
|
|
142
|
-
export type TranslateParam<Str extends string> =
|
|
143
|
-
|
|
215
|
+
export type TranslateParam<Str extends string> = IdOrMessage<
|
|
216
|
+
'message',
|
|
217
|
+
Str
|
|
144
218
|
> & {
|
|
145
|
-
message: Str;
|
|
146
|
-
id?: string;
|
|
147
219
|
description?: string;
|
|
148
|
-
values?: InterpolateValues<Str, string | number>;
|
|
149
220
|
};
|
|
150
221
|
|
|
151
222
|
export function translate<Str extends string>(
|
|
@@ -153,9 +224,12 @@ declare module '@docusaurus/Translate' {
|
|
|
153
224
|
values?: InterpolateValues<Str, string | number>,
|
|
154
225
|
): string;
|
|
155
226
|
|
|
156
|
-
export type TranslateProps<Str extends string> =
|
|
157
|
-
|
|
227
|
+
export type TranslateProps<Str extends string> = IdOrMessage<
|
|
228
|
+
'children',
|
|
229
|
+
Str
|
|
230
|
+
> & {
|
|
158
231
|
description?: string;
|
|
232
|
+
values?: InterpolateValues<Str, ReactNode>;
|
|
159
233
|
};
|
|
160
234
|
|
|
161
235
|
export default function Translate<Str extends string>(
|
|
@@ -165,11 +239,23 @@ declare module '@docusaurus/Translate' {
|
|
|
165
239
|
|
|
166
240
|
declare module '@docusaurus/router' {
|
|
167
241
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
168
|
-
export
|
|
242
|
+
export {useHistory, useLocation, Redirect, matchPath} from 'react-router-dom';
|
|
169
243
|
}
|
|
170
244
|
|
|
171
245
|
declare module '@docusaurus/useDocusaurusContext' {
|
|
172
|
-
|
|
246
|
+
import type {DocusaurusContext} from '@docusaurus/types';
|
|
247
|
+
|
|
248
|
+
export default function useDocusaurusContext(): DocusaurusContext;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
declare module '@docusaurus/useRouteContext' {
|
|
252
|
+
import type {PluginRouteContext} from '@docusaurus/types';
|
|
253
|
+
|
|
254
|
+
export default function useRouteContext(): PluginRouteContext;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
declare module '@docusaurus/useIsBrowser' {
|
|
258
|
+
export default function useIsBrowser(): boolean;
|
|
173
259
|
}
|
|
174
260
|
|
|
175
261
|
declare module '@docusaurus/useBaseUrl' {
|
|
@@ -203,20 +289,18 @@ declare module '@docusaurus/ExecutionEnvironment' {
|
|
|
203
289
|
declare module '@docusaurus/ComponentCreator' {
|
|
204
290
|
import type Loadable from 'react-loadable';
|
|
205
291
|
|
|
206
|
-
function ComponentCreator(
|
|
292
|
+
export default function ComponentCreator(
|
|
207
293
|
path: string,
|
|
208
294
|
hash: string,
|
|
209
295
|
): ReturnType<typeof Loadable>;
|
|
210
|
-
export default ComponentCreator;
|
|
211
296
|
}
|
|
212
297
|
|
|
213
298
|
declare module '@docusaurus/BrowserOnly' {
|
|
214
|
-
export
|
|
215
|
-
children?: () => JSX.Element;
|
|
216
|
-
fallback?: JSX.Element;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export default BrowserOnly;
|
|
299
|
+
export interface Props {
|
|
300
|
+
readonly children?: () => JSX.Element;
|
|
301
|
+
readonly fallback?: JSX.Element;
|
|
302
|
+
}
|
|
303
|
+
export default function BrowserOnly(props: Props): JSX.Element | null;
|
|
220
304
|
}
|
|
221
305
|
|
|
222
306
|
declare module '@docusaurus/isInternalUrl' {
|
|
@@ -236,17 +320,39 @@ declare module '@docusaurus/renderRoutes' {
|
|
|
236
320
|
}
|
|
237
321
|
|
|
238
322
|
declare module '@docusaurus/useGlobalData' {
|
|
239
|
-
|
|
323
|
+
import type {GlobalData, UseDataOptions} from '@docusaurus/types';
|
|
324
|
+
|
|
325
|
+
export function useAllPluginInstancesData(
|
|
326
|
+
pluginName: string,
|
|
327
|
+
options: {failfast: true},
|
|
328
|
+
): GlobalData[string];
|
|
329
|
+
|
|
330
|
+
export function useAllPluginInstancesData(
|
|
331
|
+
pluginName: string,
|
|
332
|
+
options?: UseDataOptions,
|
|
333
|
+
): GlobalData[string] | undefined;
|
|
334
|
+
|
|
335
|
+
export function usePluginData(
|
|
240
336
|
pluginName: string,
|
|
241
|
-
|
|
337
|
+
pluginId: string | undefined,
|
|
338
|
+
options: {failfast: true},
|
|
339
|
+
): NonNullable<GlobalData[string][string]>;
|
|
242
340
|
|
|
243
|
-
export function usePluginData
|
|
341
|
+
export function usePluginData(
|
|
244
342
|
pluginName: string,
|
|
245
343
|
pluginId?: string,
|
|
246
|
-
|
|
344
|
+
options?: UseDataOptions,
|
|
345
|
+
): GlobalData[string][string];
|
|
346
|
+
|
|
347
|
+
export default function useGlobalData(): GlobalData;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
declare module '*.svg' {
|
|
351
|
+
import type {ComponentType, SVGProps} from 'react';
|
|
247
352
|
|
|
248
|
-
|
|
249
|
-
|
|
353
|
+
const ReactComponent: ComponentType<SVGProps<SVGSVGElement>>;
|
|
354
|
+
|
|
355
|
+
export default ReactComponent;
|
|
250
356
|
}
|
|
251
357
|
|
|
252
358
|
declare module '*.module.css' {
|
|
@@ -258,3 +364,10 @@ declare module '*.css' {
|
|
|
258
364
|
const src: string;
|
|
259
365
|
export default src;
|
|
260
366
|
}
|
|
367
|
+
|
|
368
|
+
interface Window {
|
|
369
|
+
docusaurus: {
|
|
370
|
+
prefetch: (url: string) => false | Promise<void[]>;
|
|
371
|
+
preload: (url: string) => false | Promise<void[]>;
|
|
372
|
+
};
|
|
373
|
+
}
|