@docusaurus/types 2.0.0-beta.15d451942 → 2.0.0-beta.18
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 +9 -7
- package/src/index.d.ts +198 -131
- package/src/index.js +0 -10
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/types",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.18",
|
|
4
4
|
"description": "Common types for Docusaurus packages.",
|
|
5
|
-
"main": "./src/index.js",
|
|
6
5
|
"types": "./src/index.d.ts",
|
|
7
6
|
"publishConfig": {
|
|
8
7
|
"access": "public"
|
|
@@ -13,12 +12,15 @@
|
|
|
13
12
|
"directory": "packages/docusaurus-types"
|
|
14
13
|
},
|
|
15
14
|
"license": "MIT",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "tsc -p ."
|
|
17
|
+
},
|
|
16
18
|
"dependencies": {
|
|
17
19
|
"commander": "^5.1.0",
|
|
18
|
-
"joi": "^17.
|
|
19
|
-
"
|
|
20
|
-
"webpack": "^5.
|
|
21
|
-
"webpack-merge": "^5.
|
|
20
|
+
"joi": "^17.6.0",
|
|
21
|
+
"utility-types": "^3.10.0",
|
|
22
|
+
"webpack": "^5.70.0",
|
|
23
|
+
"webpack-merge": "^5.8.0"
|
|
22
24
|
},
|
|
23
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "1a945d06993d53376e61bed2c942799fe07dc336"
|
|
24
26
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -5,17 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import type {
|
|
11
|
-
import type {Command} from 'commander';
|
|
8
|
+
import type {RuleSetRule, Configuration as WebpackConfiguration} from 'webpack';
|
|
9
|
+
import type {CustomizeRuleString} from 'webpack-merge/dist/types';
|
|
10
|
+
import type {CommanderStatic} from 'commander';
|
|
12
11
|
import type {ParsedUrlQueryInput} from 'querystring';
|
|
13
12
|
import type Joi from 'joi';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// see https://github.com/survivejs/webpack-merge/issues/179
|
|
18
|
-
type MergeStrategy = 'match' | 'merge' | 'append' | 'prepend' | 'replace';
|
|
13
|
+
import type {Overwrite, DeepPartial} from 'utility-types';
|
|
14
|
+
import type {Location} from 'history';
|
|
15
|
+
import type Loadable from 'react-loadable';
|
|
19
16
|
|
|
20
17
|
export type ReportingSeverity = 'ignore' | 'log' | 'warn' | 'error' | 'throw';
|
|
21
18
|
|
|
@@ -23,13 +20,17 @@ export type ThemeConfig = {
|
|
|
23
20
|
[key: string]: unknown;
|
|
24
21
|
};
|
|
25
22
|
|
|
23
|
+
// Docusaurus config, after validation/normalization
|
|
26
24
|
export interface DocusaurusConfig {
|
|
27
25
|
baseUrl: string;
|
|
28
26
|
baseUrlIssueBanner: boolean;
|
|
29
|
-
favicon
|
|
30
|
-
tagline
|
|
27
|
+
favicon?: string;
|
|
28
|
+
tagline: string;
|
|
31
29
|
title: string;
|
|
32
30
|
url: string;
|
|
31
|
+
// trailingSlash undefined = legacy retrocompatible behavior
|
|
32
|
+
// /file => /file/index.html
|
|
33
|
+
trailingSlash: boolean | undefined;
|
|
33
34
|
i18n: I18nConfig;
|
|
34
35
|
onBrokenLinks: ReportingSeverity;
|
|
35
36
|
onBrokenMarkdownLinks: ReportingSeverity;
|
|
@@ -37,25 +38,27 @@ export interface DocusaurusConfig {
|
|
|
37
38
|
noIndex: boolean;
|
|
38
39
|
organizationName?: string;
|
|
39
40
|
projectName?: string;
|
|
41
|
+
deploymentBranch?: string;
|
|
40
42
|
githubHost?: string;
|
|
41
43
|
githubPort?: string;
|
|
42
|
-
plugins
|
|
43
|
-
themes
|
|
44
|
-
presets
|
|
44
|
+
plugins: PluginConfig[];
|
|
45
|
+
themes: PluginConfig[];
|
|
46
|
+
presets: PresetConfig[];
|
|
45
47
|
themeConfig: ThemeConfig;
|
|
46
48
|
customFields?: {
|
|
47
49
|
[key: string]: unknown;
|
|
48
50
|
};
|
|
49
|
-
scripts
|
|
51
|
+
scripts: (
|
|
50
52
|
| string
|
|
51
53
|
| {
|
|
52
54
|
src: string;
|
|
53
55
|
[key: string]: unknown;
|
|
54
56
|
}
|
|
55
57
|
)[];
|
|
56
|
-
clientModules
|
|
58
|
+
clientModules: string[];
|
|
57
59
|
ssrTemplate?: string;
|
|
58
|
-
|
|
60
|
+
staticDirectories: string[];
|
|
61
|
+
stylesheets: (
|
|
59
62
|
| string
|
|
60
63
|
| {
|
|
61
64
|
href: string;
|
|
@@ -68,13 +71,27 @@ export interface DocusaurusConfig {
|
|
|
68
71
|
};
|
|
69
72
|
}
|
|
70
73
|
|
|
74
|
+
// Docusaurus config, as provided by the user (partial/unnormalized)
|
|
75
|
+
// This type is used to provide type-safety / IDE auto-complete on the config
|
|
76
|
+
// file. See https://docusaurus.io/docs/typescript-support
|
|
77
|
+
export type Config = Overwrite<
|
|
78
|
+
Partial<DocusaurusConfig>,
|
|
79
|
+
{
|
|
80
|
+
title: Required<DocusaurusConfig['title']>;
|
|
81
|
+
url: Required<DocusaurusConfig['url']>;
|
|
82
|
+
baseUrl: Required<DocusaurusConfig['baseUrl']>;
|
|
83
|
+
i18n?: DeepPartial<DocusaurusConfig['i18n']>;
|
|
84
|
+
}
|
|
85
|
+
>;
|
|
86
|
+
|
|
71
87
|
/**
|
|
72
88
|
* - `type: 'package'`, plugin is in a different package.
|
|
73
89
|
* - `type: 'project'`, plugin is in the same docusaurus project.
|
|
74
|
-
* - `type: 'local'`, none of plugin's ancestor
|
|
90
|
+
* - `type: 'local'`, none of the plugin's ancestor directories contains a
|
|
91
|
+
* package.json.
|
|
75
92
|
* - `type: 'synthetic'`, docusaurus generated internal plugin.
|
|
76
93
|
*/
|
|
77
|
-
export type
|
|
94
|
+
export type PluginVersionInformation =
|
|
78
95
|
| {
|
|
79
96
|
readonly type: 'package';
|
|
80
97
|
readonly name?: string;
|
|
@@ -87,7 +104,7 @@ export type DocusaurusPluginVersionInformation =
|
|
|
87
104
|
export interface DocusaurusSiteMetadata {
|
|
88
105
|
readonly docusaurusVersion: string;
|
|
89
106
|
readonly siteVersion?: string;
|
|
90
|
-
readonly pluginVersions:
|
|
107
|
+
readonly pluginVersions: {[pluginName: string]: PluginVersionInformation};
|
|
91
108
|
}
|
|
92
109
|
|
|
93
110
|
// Inspired by Chrome JSON, because it's a widely supported i18n format
|
|
@@ -97,35 +114,41 @@ export interface DocusaurusSiteMetadata {
|
|
|
97
114
|
// https://docs.transifex.com/formats/chrome-json
|
|
98
115
|
// https://help.phrase.com/help/chrome-json-messages
|
|
99
116
|
export type TranslationMessage = {message: string; description?: string};
|
|
100
|
-
export type TranslationFileContent =
|
|
117
|
+
export type TranslationFileContent = {[key: string]: TranslationMessage};
|
|
101
118
|
export type TranslationFile = {path: string; content: TranslationFileContent};
|
|
102
119
|
export type TranslationFiles = TranslationFile[];
|
|
103
120
|
|
|
104
121
|
export type I18nLocaleConfig = {
|
|
105
122
|
label: string;
|
|
123
|
+
htmlLang: string;
|
|
106
124
|
direction: string;
|
|
107
125
|
};
|
|
108
126
|
|
|
109
127
|
export type I18nConfig = {
|
|
110
128
|
defaultLocale: string;
|
|
111
129
|
locales: [string, ...string[]];
|
|
112
|
-
localeConfigs:
|
|
130
|
+
localeConfigs: {[locale: string]: Partial<I18nLocaleConfig>};
|
|
113
131
|
};
|
|
114
132
|
|
|
115
133
|
export type I18n = {
|
|
116
134
|
defaultLocale: string;
|
|
117
135
|
locales: [string, ...string[]];
|
|
118
136
|
currentLocale: string;
|
|
119
|
-
localeConfigs:
|
|
137
|
+
localeConfigs: {[locale: string]: I18nLocaleConfig};
|
|
120
138
|
};
|
|
121
139
|
|
|
140
|
+
export type GlobalData = {[pluginName: string]: {[pluginId: string]: unknown}};
|
|
141
|
+
|
|
122
142
|
export interface DocusaurusContext {
|
|
123
143
|
siteConfig: DocusaurusConfig;
|
|
124
144
|
siteMetadata: DocusaurusSiteMetadata;
|
|
125
|
-
globalData:
|
|
145
|
+
globalData: GlobalData;
|
|
126
146
|
i18n: I18n;
|
|
127
|
-
codeTranslations:
|
|
128
|
-
|
|
147
|
+
codeTranslations: {[msgId: string]: string};
|
|
148
|
+
|
|
149
|
+
// Don't put mutable values here, to avoid triggering re-renders
|
|
150
|
+
// We could reconsider that choice if context selectors are implemented
|
|
151
|
+
// isBrowser: boolean; // Not here on purpose!
|
|
129
152
|
}
|
|
130
153
|
|
|
131
154
|
export interface Preset {
|
|
@@ -133,10 +156,15 @@ export interface Preset {
|
|
|
133
156
|
themes?: PluginConfig[];
|
|
134
157
|
}
|
|
135
158
|
|
|
136
|
-
export type
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
159
|
+
export type PresetModule = {
|
|
160
|
+
<T>(context: LoadContext, presetOptions: T): Preset;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type ImportedPresetModule = PresetModule & {
|
|
164
|
+
default?: PresetModule;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export type PresetConfig = string | [string, {[key: string]: unknown}];
|
|
140
168
|
|
|
141
169
|
export type HostPortCLIOptions = {
|
|
142
170
|
host?: string;
|
|
@@ -178,10 +206,10 @@ export interface LoadContext {
|
|
|
178
206
|
siteConfig: DocusaurusConfig;
|
|
179
207
|
siteConfigPath: string;
|
|
180
208
|
outDir: string;
|
|
181
|
-
baseUrl: string;
|
|
209
|
+
baseUrl: string; // TODO to remove: useless, there's already siteConfig.baseUrl!
|
|
182
210
|
i18n: I18n;
|
|
183
|
-
ssrTemplate
|
|
184
|
-
codeTranslations:
|
|
211
|
+
ssrTemplate: string;
|
|
212
|
+
codeTranslations: {[msgId: string]: string};
|
|
185
213
|
}
|
|
186
214
|
|
|
187
215
|
export interface InjectedHtmlTags {
|
|
@@ -193,56 +221,56 @@ export interface InjectedHtmlTags {
|
|
|
193
221
|
export type HtmlTags = string | HtmlTagObject | (string | HtmlTagObject)[];
|
|
194
222
|
|
|
195
223
|
export interface Props extends LoadContext, InjectedHtmlTags {
|
|
196
|
-
siteMetadata: DocusaurusSiteMetadata;
|
|
197
|
-
routes: RouteConfig[];
|
|
198
|
-
routesPaths: string[];
|
|
199
|
-
plugins:
|
|
224
|
+
readonly siteMetadata: DocusaurusSiteMetadata;
|
|
225
|
+
readonly routes: RouteConfig[];
|
|
226
|
+
readonly routesPaths: string[];
|
|
227
|
+
readonly plugins: LoadedPlugin[];
|
|
200
228
|
}
|
|
201
229
|
|
|
202
230
|
export interface PluginContentLoadedActions {
|
|
203
|
-
addRoute(config: RouteConfig)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
setGlobalData<T = unknown>(data: T): void;
|
|
231
|
+
addRoute: (config: RouteConfig) => void;
|
|
232
|
+
createData: (name: string, data: string) => Promise<string>;
|
|
233
|
+
setGlobalData: (data: unknown) => void;
|
|
207
234
|
}
|
|
208
235
|
|
|
209
|
-
export type AllContent =
|
|
210
|
-
string
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
>
|
|
215
|
-
>;
|
|
236
|
+
export type AllContent = {
|
|
237
|
+
[pluginName: string]: {
|
|
238
|
+
[pluginID: string]: unknown;
|
|
239
|
+
};
|
|
240
|
+
};
|
|
216
241
|
|
|
217
242
|
// TODO improve type (not exposed by postcss-loader)
|
|
218
|
-
export type PostCssOptions =
|
|
243
|
+
export type PostCssOptions = {[key: string]: unknown} & {plugins: unknown[]};
|
|
219
244
|
|
|
220
|
-
export interface Plugin<Content> {
|
|
245
|
+
export interface Plugin<Content = unknown> {
|
|
221
246
|
name: string;
|
|
222
|
-
loadContent
|
|
223
|
-
contentLoaded
|
|
224
|
-
content
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
allContent: AllContent; // content loaded by ALL the plugins
|
|
247
|
+
loadContent?: () => Promise<Content>;
|
|
248
|
+
contentLoaded?: (args: {
|
|
249
|
+
/** the content loaded by this plugin instance */
|
|
250
|
+
content: Content; //
|
|
251
|
+
/** content loaded by ALL the plugins */
|
|
252
|
+
allContent: AllContent;
|
|
229
253
|
actions: PluginContentLoadedActions;
|
|
230
|
-
})
|
|
231
|
-
routesLoaded
|
|
232
|
-
postBuild
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
254
|
+
}) => Promise<void>;
|
|
255
|
+
routesLoaded?: (routes: RouteConfig[]) => void; // TODO remove soon, deprecated (alpha-60)
|
|
256
|
+
postBuild?: (props: Props & {content: Content}) => Promise<void>;
|
|
257
|
+
// TODO refactor the configureWebpack API surface: use an object instead of
|
|
258
|
+
// multiple params (requires breaking change)
|
|
259
|
+
configureWebpack?: (
|
|
260
|
+
config: WebpackConfiguration,
|
|
236
261
|
isServer: boolean,
|
|
237
262
|
utils: ConfigureWebpackUtils,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
263
|
+
content: Content,
|
|
264
|
+
) => WebpackConfiguration & {
|
|
265
|
+
mergeStrategy?: ConfigureWebpackFnMergeStrategy;
|
|
266
|
+
};
|
|
267
|
+
configurePostCss?: (options: PostCssOptions) => PostCssOptions;
|
|
268
|
+
getThemePath?: () => string;
|
|
269
|
+
getTypeScriptThemePath?: () => string;
|
|
270
|
+
getPathsToWatch?: () => string[];
|
|
271
|
+
getClientModules?: () => string[];
|
|
272
|
+
extendCli?: (cli: CommanderStatic) => void;
|
|
273
|
+
injectHtmlTags?: (args: {content: Content}) => {
|
|
246
274
|
headTags?: HtmlTags;
|
|
247
275
|
preBodyTags?: HtmlTags;
|
|
248
276
|
postBodyTags?: HtmlTags;
|
|
@@ -250,38 +278,55 @@ export interface Plugin<Content> {
|
|
|
250
278
|
// TODO before/afterDevServer implementation
|
|
251
279
|
|
|
252
280
|
// translations
|
|
253
|
-
getTranslationFiles
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
content: Content;
|
|
257
|
-
}): Promise<TranslationFiles>;
|
|
258
|
-
getDefaultCodeTranslationMessages?(): Promise<
|
|
259
|
-
Record<
|
|
260
|
-
string, // id
|
|
261
|
-
string // message
|
|
262
|
-
>
|
|
263
|
-
>;
|
|
264
|
-
translateContent?({
|
|
265
|
-
content,
|
|
266
|
-
translationFiles,
|
|
267
|
-
}: {
|
|
281
|
+
getTranslationFiles?: (args: {content: Content}) => Promise<TranslationFiles>;
|
|
282
|
+
getDefaultCodeTranslationMessages?: () => Promise<{[id: string]: string}>;
|
|
283
|
+
translateContent?: (args: {
|
|
268
284
|
content: Content; // the content loaded by this plugin instance
|
|
269
285
|
translationFiles: TranslationFiles;
|
|
270
|
-
})
|
|
271
|
-
translateThemeConfig
|
|
272
|
-
themeConfig,
|
|
273
|
-
translationFiles,
|
|
274
|
-
}: {
|
|
286
|
+
}) => Content;
|
|
287
|
+
translateThemeConfig?: (args: {
|
|
275
288
|
themeConfig: ThemeConfig;
|
|
276
289
|
translationFiles: TranslationFiles;
|
|
277
|
-
})
|
|
290
|
+
}) => ThemeConfig;
|
|
278
291
|
}
|
|
279
292
|
|
|
293
|
+
export type InitializedPlugin<Content = unknown> = Plugin<Content> & {
|
|
294
|
+
readonly options: Required<PluginOptions>;
|
|
295
|
+
readonly version: PluginVersionInformation;
|
|
296
|
+
/**
|
|
297
|
+
* The absolute path to the folder containing the entry point file.
|
|
298
|
+
*/
|
|
299
|
+
readonly path: string;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export type LoadedPlugin<Content = unknown> = InitializedPlugin<Content> & {
|
|
303
|
+
readonly content: Content;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export type SwizzleAction = 'eject' | 'wrap';
|
|
307
|
+
export type SwizzleActionStatus = 'safe' | 'unsafe' | 'forbidden';
|
|
308
|
+
|
|
309
|
+
export type SwizzleComponentConfig = {
|
|
310
|
+
actions: {[action in SwizzleAction]: SwizzleActionStatus};
|
|
311
|
+
description?: string;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
export type SwizzleConfig = {
|
|
315
|
+
components: {[componentName: string]: SwizzleComponentConfig};
|
|
316
|
+
// Other settings could be added here,
|
|
317
|
+
// For example: the ability to declare the config as exhaustive
|
|
318
|
+
// so that we can emit errors
|
|
319
|
+
};
|
|
320
|
+
|
|
280
321
|
export type PluginModule = {
|
|
281
|
-
<
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
322
|
+
<Options, Content>(context: LoadContext, options: Options):
|
|
323
|
+
| Plugin<Content>
|
|
324
|
+
| Promise<Plugin<Content>>;
|
|
325
|
+
validateOptions?: <T, U>(data: OptionValidationContext<T, U>) => U;
|
|
326
|
+
validateThemeConfig?: <T>(data: ThemeConfigValidationContext<T>) => T;
|
|
327
|
+
|
|
328
|
+
getSwizzleComponentList?: () => string[] | undefined; // TODO deprecate this one later
|
|
329
|
+
getSwizzleConfig?: () => SwizzleConfig | undefined;
|
|
285
330
|
};
|
|
286
331
|
|
|
287
332
|
export type ImportedPluginModule = PluginModule & {
|
|
@@ -289,15 +334,16 @@ export type ImportedPluginModule = PluginModule & {
|
|
|
289
334
|
};
|
|
290
335
|
|
|
291
336
|
export type ConfigureWebpackFn = Plugin<unknown>['configureWebpack'];
|
|
292
|
-
export type ConfigureWebpackFnMergeStrategy =
|
|
337
|
+
export type ConfigureWebpackFnMergeStrategy = {
|
|
338
|
+
[key: string]: CustomizeRuleString;
|
|
339
|
+
};
|
|
293
340
|
export type ConfigurePostCssFn = Plugin<unknown>['configurePostCss'];
|
|
294
341
|
|
|
295
|
-
export type PluginOptions = {id?: string} &
|
|
342
|
+
export type PluginOptions = {id?: string} & {[key: string]: unknown};
|
|
296
343
|
|
|
297
344
|
export type PluginConfig =
|
|
298
|
-
| [string, PluginOptions]
|
|
299
|
-
| [string]
|
|
300
345
|
| string
|
|
346
|
+
| [string, PluginOptions]
|
|
301
347
|
| [PluginModule, PluginOptions]
|
|
302
348
|
| PluginModule;
|
|
303
349
|
|
|
@@ -329,9 +375,36 @@ export interface RouteConfig {
|
|
|
329
375
|
routes?: RouteConfig[];
|
|
330
376
|
exact?: boolean;
|
|
331
377
|
priority?: number;
|
|
378
|
+
[propName: string]: unknown;
|
|
332
379
|
}
|
|
333
380
|
|
|
334
|
-
export interface
|
|
381
|
+
export interface RouteContext {
|
|
382
|
+
/**
|
|
383
|
+
* Plugin-specific context data.
|
|
384
|
+
*/
|
|
385
|
+
data?: object | undefined;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Top-level plugin routes automatically add some context data to the route.
|
|
390
|
+
* This permits us to know which plugin is handling the current route.
|
|
391
|
+
*/
|
|
392
|
+
export interface PluginRouteContext extends RouteContext {
|
|
393
|
+
plugin: {
|
|
394
|
+
id: string;
|
|
395
|
+
name: string;
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export type Route = {
|
|
400
|
+
readonly path: string;
|
|
401
|
+
readonly component: ReturnType<typeof Loadable>;
|
|
402
|
+
readonly exact?: boolean;
|
|
403
|
+
readonly routes?: Route[];
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// Aliases used for Webpack resolution (when using docusaurus swizzle)
|
|
407
|
+
export interface ThemeAliases {
|
|
335
408
|
[alias: string]: string;
|
|
336
409
|
}
|
|
337
410
|
|
|
@@ -344,20 +417,8 @@ export interface ConfigureWebpackUtils {
|
|
|
344
417
|
) => RuleSetRule[];
|
|
345
418
|
getJSLoader: (options: {
|
|
346
419
|
isServer: boolean;
|
|
347
|
-
babelOptions?:
|
|
420
|
+
babelOptions?: {[key: string]: unknown};
|
|
348
421
|
}) => RuleSetRule;
|
|
349
|
-
|
|
350
|
-
// TODO deprecated: remove before end of 2021?
|
|
351
|
-
getCacheLoader: (
|
|
352
|
-
isServer: boolean,
|
|
353
|
-
cacheOptions?: Record<string, unknown>,
|
|
354
|
-
) => RuleSetRule | null;
|
|
355
|
-
|
|
356
|
-
// TODO deprecated: remove before end of 2021?
|
|
357
|
-
getBabelLoader: (
|
|
358
|
-
isServer: boolean,
|
|
359
|
-
options?: Record<string, unknown>,
|
|
360
|
-
) => RuleSetRule;
|
|
361
422
|
}
|
|
362
423
|
|
|
363
424
|
interface HtmlTagObject {
|
|
@@ -365,9 +426,7 @@ interface HtmlTagObject {
|
|
|
365
426
|
* Attributes of the html tag
|
|
366
427
|
* E.g. `{'disabled': true, 'value': 'demo', 'rel': 'preconnect'}`
|
|
367
428
|
*/
|
|
368
|
-
attributes?: {
|
|
369
|
-
[attributeName: string]: string | boolean;
|
|
370
|
-
};
|
|
429
|
+
attributes?: Partial<{[key: string]: string | boolean}>;
|
|
371
430
|
/**
|
|
372
431
|
* The tag name e.g. `div`, `script`, `link`, `meta`
|
|
373
432
|
*/
|
|
@@ -378,27 +437,35 @@ interface HtmlTagObject {
|
|
|
378
437
|
innerHTML?: string;
|
|
379
438
|
}
|
|
380
439
|
|
|
381
|
-
export type ValidationResult<T> = T;
|
|
382
|
-
|
|
383
440
|
export type ValidationSchema<T> = Joi.ObjectSchema<T>;
|
|
384
441
|
|
|
385
|
-
export type Validate<T> = (
|
|
386
|
-
validationSchema: ValidationSchema<
|
|
387
|
-
options:
|
|
388
|
-
) =>
|
|
442
|
+
export type Validate<T, U> = (
|
|
443
|
+
validationSchema: ValidationSchema<U>,
|
|
444
|
+
options: T,
|
|
445
|
+
) => U;
|
|
389
446
|
|
|
390
|
-
export
|
|
391
|
-
validate: Validate<T>;
|
|
392
|
-
options:
|
|
393
|
-
}
|
|
447
|
+
export type OptionValidationContext<T, U> = {
|
|
448
|
+
validate: Validate<T, U>;
|
|
449
|
+
options: T;
|
|
450
|
+
};
|
|
394
451
|
|
|
395
452
|
export interface ThemeConfigValidationContext<T> {
|
|
396
|
-
validate: Validate<T>;
|
|
453
|
+
validate: Validate<T, T>;
|
|
397
454
|
themeConfig: Partial<T>;
|
|
398
455
|
}
|
|
399
456
|
|
|
400
|
-
export
|
|
457
|
+
export type TOCItem = {
|
|
401
458
|
readonly value: string;
|
|
402
459
|
readonly id: string;
|
|
403
|
-
readonly
|
|
404
|
-
}
|
|
460
|
+
readonly level: number;
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
export type RouteChunksTree = {[x: string | number]: string | RouteChunksTree};
|
|
464
|
+
|
|
465
|
+
export type ClientModule = {
|
|
466
|
+
onRouteUpdate?: (args: {
|
|
467
|
+
previousLocation: Location | null;
|
|
468
|
+
location: Location;
|
|
469
|
+
}) => void;
|
|
470
|
+
onRouteUpdateDelayed?: (args: {location: Location}) => void;
|
|
471
|
+
};
|
package/src/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
/* eslint-disable */
|
|
9
|
-
'use strict';
|
|
10
|
-
Object.defineProperty(exports, '__esModule', {value: true});
|