@docusaurus/types 2.0.0-beta.20 → 2.0.0-beta.22

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/src/index.d.ts CHANGED
@@ -5,745 +5,73 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import type {RuleSetRule, Configuration as WebpackConfiguration} from 'webpack';
9
- import type {CustomizeRuleString} from 'webpack-merge/dist/types';
10
- import type {CommanderStatic} from 'commander';
11
- import type {ParsedUrlQueryInput} from 'querystring';
12
- import type Joi from 'joi';
13
- import type {HelmetServerState} from 'react-helmet-async';
14
- import type {
15
- DeepRequired,
16
- Required as RequireKeys,
17
- DeepPartial,
18
- } from 'utility-types';
19
- import type {Location} from 'history';
20
-
21
- // === Configuration ===
22
-
23
- export type ReportingSeverity = 'ignore' | 'log' | 'warn' | 'error' | 'throw';
24
-
25
- export type PluginOptions = {id?: string} & {[key: string]: unknown};
26
-
27
- export type PluginConfig =
28
- | string
29
- | [string, PluginOptions]
30
- | [PluginModule, PluginOptions]
31
- | PluginModule
32
- | false
33
- | null;
34
-
35
- export type PresetConfig =
36
- | string
37
- | [string, {[key: string]: unknown}]
38
- | false
39
- | null;
40
-
41
- export type ThemeConfig = {
42
- [key: string]: unknown;
43
- };
44
-
45
- export type I18nLocaleConfig = {
46
- /** The label displayed for this locale in the locales dropdown. */
47
- label: string;
48
- /**
49
- * BCP 47 language tag to use in `<html lang="...">` and in
50
- * `<link ... hreflang="...">`
51
- */
52
- htmlLang: string;
53
- /** Used to select the locale's CSS and html meta attribute. */
54
- direction: 'ltr' | 'rtl';
55
- /**
56
- * The [calendar](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar)
57
- * used to calculate the date era. Note that it doesn't control the actual
58
- * string displayed: `MM/DD/YYYY` and `DD/MM/YYYY` are both gregory. To choose
59
- * the format (`DD/MM/YYYY` or `MM/DD/YYYY`), set your locale name to `en-GB`
60
- * or `en-US` (`en` means `en-US`).
61
- */
62
- calendar: string;
63
- };
64
-
65
- export type I18nConfig = {
66
- /**
67
- * The locale that:
68
- * 1. Does not have its name in the base URL
69
- * 2. Gets started with `docusaurus start` without `--locale` option
70
- * 3. Will be used for the `<link hrefLang="x-default">` tag
71
- */
72
- defaultLocale: string;
73
- /** List of locales deployed on your site. Must contain `defaultLocale`. */
74
- locales: [string, ...string[]];
75
- /** Individual options for each locale. */
76
- localeConfigs: {[locale: string]: Partial<I18nLocaleConfig>};
77
- };
78
-
79
- /**
80
- * Docusaurus config, after validation/normalization.
81
- */
82
- export type DocusaurusConfig = {
83
- /**
84
- * Title for your website. Will be used in metadata and as browser tab title.
85
- *
86
- * @see https://docusaurus.io/docs/api/docusaurus-config#title
87
- */
88
- title: string;
89
- /**
90
- * URL for your website. This can also be considered the top-level hostname.
91
- * For example, `https://facebook.github.io` is the URL of
92
- * https://facebook.github.io/metro/, and `https://docusaurus.io` is the URL
93
- * for https://docusaurus.io.
94
- *
95
- * @see https://docusaurus.io/docs/api/docusaurus-config#url
96
- */
97
- url: string;
98
- /**
99
- * Can be considered as the path after the host. For example, `/metro/` is the
100
- * base URL of https://facebook.github.io/metro/. For URLs that have no path,
101
- * it should be set to `/`. Always has both leading and trailing slash.
102
- *
103
- * @see https://docusaurus.io/docs/api/docusaurus-config#baseUrl
104
- */
105
- baseUrl: string;
106
- /**
107
- * Path to your site favicon; must be a URL that can be used in link's href.
108
- *
109
- * @see https://docusaurus.io/docs/api/docusaurus-config#favicon
110
- */
111
- favicon?: string;
112
- /**
113
- * Allow to customize the presence/absence of a trailing slash at the end of
114
- * URLs/links, and how static HTML files are generated:
115
- *
116
- * - `undefined` (default): keeps URLs untouched, and emit
117
- * `/docs/myDoc/index.html` for `/docs/myDoc.md`
118
- * - `true`: add trailing slashes to URLs/links, and emit
119
- * `/docs/myDoc/index.html` for `/docs/myDoc.md`
120
- * - `false`: remove trailing slashes from URLs/links, and emit
121
- * `/docs/myDoc.html` for `/docs/myDoc.md`
122
- *
123
- * @see https://github.com/slorber/trailing-slash-guide
124
- * @see https://docusaurus.io/docs/api/docusaurus-config#trailingSlash
125
- * @default undefined
126
- */
127
- trailingSlash: boolean | undefined;
128
- /**
129
- * The i18n configuration object to [localize your
130
- * site](https://docusaurus.io/docs/i18n/introduction).
131
- *
132
- * @see https://docusaurus.io/docs/api/docusaurus-config#i18n
133
- */
134
- i18n: I18nConfig;
135
- /**
136
- * This option adds `<meta name="robots" content="noindex, nofollow">` to
137
- * every page to tell search engines to avoid indexing your site.
138
- *
139
- * @see https://moz.com/learn/seo/robots-meta-directives
140
- * @see https://docusaurus.io/docs/api/docusaurus-config#noIndex
141
- * @default false
142
- */
143
- noIndex: boolean;
144
- /**
145
- * The behavior of Docusaurus when it detects any broken link.
146
- *
147
- * @see https://docusaurus.io/docs/api/docusaurus-config#onBrokenLinks
148
- * @default "throw"
149
- */
150
- onBrokenLinks: ReportingSeverity;
151
- /**
152
- * The behavior of Docusaurus when it detects any broken markdown link.
153
- *
154
- * @see https://docusaurus.io/docs/api/docusaurus-config#onBrokenMarkdownLinks
155
- * @default "warn"
156
- */
157
- onBrokenMarkdownLinks: ReportingSeverity;
158
- /**
159
- * The behavior of Docusaurus when it detects any [duplicate
160
- * routes](https://docusaurus.io/docs/creating-pages#duplicate-routes).
161
- *
162
- * @see https://docusaurus.io/docs/api/docusaurus-config#onDuplicateRoutes
163
- * @default "warn"
164
- */
165
- onDuplicateRoutes: ReportingSeverity;
166
- /**
167
- * The tagline for your website.
168
- *
169
- * @see https://docusaurus.io/docs/api/docusaurus-config#tagline
170
- * @default ""
171
- */
172
- tagline: string;
173
- /**
174
- * The GitHub user or organization that owns the repository. You don't need
175
- * this if you are not using the `docusaurus deploy` command.
176
- *
177
- * @see https://docusaurus.io/docs/api/docusaurus-config#organizationName
178
- */
179
- organizationName?: string;
180
- /**
181
- * The name of the GitHub repository. You don't need this if you are not using
182
- * the `docusaurus deploy` command.
183
- *
184
- * @see https://docusaurus.io/docs/api/docusaurus-config#projectName
185
- */
186
- projectName?: string;
187
- /**
188
- * The name of the branch to deploy the static files to. You don't need this
189
- * if you are not using the `docusaurus deploy` command.
190
- *
191
- * @see https://docusaurus.io/docs/api/docusaurus-config#deploymentBranch
192
- */
193
- deploymentBranch?: string;
194
- /**
195
- * The hostname of your server. Useful if you are using GitHub Enterprise. You
196
- * don't need this if you are not using the `docusaurus deploy` command.
197
- *
198
- * @see https://docusaurus.io/docs/api/docusaurus-config#githubHost
199
- */
200
- githubHost?: string;
201
- /**
202
- * The port of your server. Useful if you are using GitHub Enterprise. You
203
- * don't need this if you are not using the `docusaurus deploy` command.
204
- *
205
- * @see https://docusaurus.io/docs/api/docusaurus-config#githubPort
206
- */
207
- githubPort?: string;
208
- /**
209
- * The [theme configuration](https://docusaurus.io/docs/api/themes/configuration)
210
- * object to customize your site UI like navbar and footer.
211
- *
212
- * @see https://docusaurus.io/docs/api/docusaurus-config#themeConfig
213
- * @default {}
214
- */
215
- themeConfig: ThemeConfig;
216
- /**
217
- * List of plugins.
218
- *
219
- * @see https://docusaurus.io/docs/api/docusaurus-config#plugins
220
- * @default []
221
- */
222
- plugins: PluginConfig[];
223
- /**
224
- * List of themes.
225
- *
226
- * @see https://docusaurus.io/docs/api/docusaurus-config#themes
227
- * @default []
228
- */
229
- themes: PluginConfig[];
230
- /**
231
- * List of presets.
232
- *
233
- * @see https://docusaurus.io/docs/api/docusaurus-config#presets
234
- * @default []
235
- */
236
- presets: PresetConfig[];
237
- /**
238
- * Docusaurus guards `docusaurus.config.js` from unknown fields. To add a
239
- * custom field, define it on `customFields`.
240
- *
241
- * @see https://docusaurus.io/docs/api/docusaurus-config#customFields
242
- * @default {}
243
- */
244
- customFields?: {
245
- [key: string]: unknown;
246
- };
247
- /**
248
- * An array of paths, relative to the site's directory or absolute. Files
249
- * under these paths will be copied to the build output as-is.
250
- *
251
- * @see https://docusaurus.io/docs/api/docusaurus-config#staticDirectories
252
- * @default ["static"]
253
- */
254
- staticDirectories: string[];
255
- /**
256
- * An array of scripts to load. The values can be either strings or plain
257
- * objects of attribute-value maps. The `<script>` tags will be inserted in
258
- * the HTML `<head>`.
259
- *
260
- * Note that `<script>` added here are render-blocking, so you might want to
261
- * add `async: true`/`defer: true` to the objects.
262
- *
263
- * @see https://docusaurus.io/docs/api/docusaurus-config#scripts
264
- * @default []
265
- */
266
- scripts: (
267
- | string
268
- | {
269
- src: string;
270
- [key: string]: string | boolean | undefined;
271
- }
272
- )[];
273
- /**
274
- * An array of CSS sources to load. The values can be either strings or plain
275
- * objects of attribute-value maps. The `<link>` tags will be inserted in the
276
- * HTML `<head>`.
277
- *
278
- * @see https://docusaurus.io/docs/api/docusaurus-config#stylesheets
279
- * @default []
280
- */
281
- stylesheets: (
282
- | string
283
- | {
284
- href: string;
285
- [key: string]: string | boolean | undefined;
286
- }
287
- )[];
288
- /**
289
- * An array of [client modules](https://docusaurus.io/docs/advanced/client#client-modules)
290
- * to load globally on your site.
291
- *
292
- * @see https://docusaurus.io/docs/api/docusaurus-config#clientModules
293
- * @default []
294
- */
295
- clientModules: string[];
296
- /**
297
- * An HTML template written in [Eta's syntax](https://eta.js.org/docs/syntax#syntax-overview)
298
- * that will be used to render your application. This can be used to set
299
- * custom attributes on the `body` tags, additional `meta` tags, customize the
300
- * `viewport`, etc. Please note that Docusaurus will rely on the template to
301
- * be correctly structured in order to function properly, once you do
302
- * customize it, you will have to make sure that your template is compliant
303
- * with the requirements from upstream.
304
- *
305
- * @see https://docusaurus.io/docs/api/docusaurus-config#ssrTemplate
306
- */
307
- ssrTemplate?: string;
308
- /**
309
- * Will be used as title delimiter in the generated `<title>` tag.
310
- *
311
- * @see https://docusaurus.io/docs/api/docusaurus-config#titleDelimiter
312
- * @default "|"
313
- */
314
- titleDelimiter: string;
315
- /**
316
- * When enabled, will show a banner in case your site can't load its CSS or
317
- * JavaScript files, which is a very common issue, often related to a wrong
318
- * `baseUrl` in site config.
319
- *
320
- * @see https://docusaurus.io/docs/api/docusaurus-config#baseUrlIssueBanner
321
- * @default true
322
- */
323
- baseUrlIssueBanner: boolean;
324
- /** Webpack-related options. */
325
- webpack?: {
326
- /**
327
- * Configuration for alternative JS loaders. "babel" will use the built-in
328
- * Babel loader and preset; otherwise, you can provide your custom Webpack
329
- * rule set.
330
- */
331
- jsLoader: 'babel' | ((isServer: boolean) => RuleSetRule);
332
- };
333
- };
334
-
335
- /**
336
- * Docusaurus config, as provided by the user (partial/unnormalized). This type
337
- * is used to provide type-safety / IDE auto-complete on the config file.
338
- * @see https://docusaurus.io/docs/typescript-support
339
- */
340
- export type Config = RequireKeys<
341
- DeepPartial<DocusaurusConfig>,
342
- 'title' | 'url' | 'baseUrl'
343
- >;
344
-
345
- // === Data loading ===
346
-
347
- /**
348
- * - `type: 'package'`, plugin is in a different package.
349
- * - `type: 'project'`, plugin is in the same docusaurus project.
350
- * - `type: 'local'`, none of the plugin's ancestor directories contains a
351
- * package.json.
352
- * - `type: 'synthetic'`, docusaurus generated internal plugin.
353
- */
354
- export type PluginVersionInformation =
355
- | {
356
- readonly type: 'package';
357
- readonly name?: string;
358
- readonly version?: string;
359
- }
360
- | {readonly type: 'project'}
361
- | {readonly type: 'local'}
362
- | {readonly type: 'synthetic'};
363
-
364
- export type SiteMetadata = {
365
- readonly docusaurusVersion: string;
366
- readonly siteVersion?: string;
367
- readonly pluginVersions: {[pluginName: string]: PluginVersionInformation};
368
- };
369
-
370
- /**
371
- * Inspired by Chrome JSON, because it's a widely supported i18n format
372
- * @see https://developer.chrome.com/apps/i18n-messages
373
- * @see https://support.crowdin.com/file-formats/chrome-json/
374
- * @see https://www.applanga.com/docs/formats/chrome_i18n_json
375
- * @see https://docs.transifex.com/formats/chrome-json
376
- * @see https://help.phrase.com/help/chrome-json-messages
377
- */
378
- export type TranslationMessage = {message: string; description?: string};
379
- export type TranslationFileContent = {[msgId: string]: TranslationMessage};
380
- /**
381
- * An abstract representation of how a translation file exists on disk. The core
382
- * would handle the file reading/writing; plugins just need to deal with
383
- * translations in-memory.
384
- */
385
- export type TranslationFile = {
386
- /**
387
- * Relative to the directory where it's expected to be found. For plugin
388
- * files, it's relative to `i18n/<locale>/<pluginName>/<pluginId>`. Should NOT
389
- * have any extension.
390
- */
391
- path: string;
392
- content: TranslationFileContent;
393
- };
394
-
395
- export type I18n = DeepRequired<I18nConfig> & {currentLocale: string};
396
-
397
- export type GlobalData = {[pluginName: string]: {[pluginId: string]: unknown}};
398
-
399
- export type CodeTranslations = {[msgId: string]: string};
400
-
401
- export type DocusaurusContext = {
402
- siteConfig: DocusaurusConfig;
403
- siteMetadata: SiteMetadata;
404
- globalData: GlobalData;
405
- i18n: I18n;
406
- codeTranslations: CodeTranslations;
407
-
408
- // Don't put mutable values here, to avoid triggering re-renders
409
- // We could reconsider that choice if context selectors are implemented
410
- // isBrowser: boolean; // Not here on purpose!
411
- };
412
-
413
- export type LoadContext = {
414
- siteDir: string;
415
- generatedFilesDir: string;
416
- siteConfig: DocusaurusConfig;
417
- siteConfigPath: string;
418
- outDir: string;
419
- /**
420
- * Duplicated from `siteConfig.baseUrl`, but probably worth keeping. We mutate
421
- * `siteConfig` to make `baseUrl` there localized as well, but that's mostly
422
- * for client-side. `context.baseUrl` is still more convenient for plugins.
423
- */
424
- baseUrl: string;
425
- i18n: I18n;
426
- codeTranslations: CodeTranslations;
427
- };
428
-
429
- export type Props = LoadContext & {
430
- headTags: string;
431
- preBodyTags: string;
432
- postBodyTags: string;
433
- siteMetadata: SiteMetadata;
434
- routes: RouteConfig[];
435
- routesPaths: string[];
436
- plugins: LoadedPlugin[];
437
- };
438
-
439
- // === Plugin ===
440
-
441
- export type PluginContentLoadedActions = {
442
- addRoute: (config: RouteConfig) => void;
443
- createData: (name: string, data: string) => Promise<string>;
444
- setGlobalData: (data: unknown) => void;
445
- };
446
-
447
- export type ConfigureWebpackUtils = {
448
- getStyleLoaders: (
449
- isServer: boolean,
450
- cssOptions: {[key: string]: unknown},
451
- ) => RuleSetRule[];
452
- getJSLoader: (options: {
453
- isServer: boolean;
454
- babelOptions?: {[key: string]: unknown};
455
- }) => RuleSetRule;
456
- };
457
-
458
- export type AllContent = {
459
- [pluginName: string]: {
460
- [pluginID: string]: unknown;
461
- };
462
- };
463
-
464
- // TODO improve type (not exposed by postcss-loader)
465
- export type PostCssOptions = {plugins: unknown[]; [key: string]: unknown};
466
-
467
- type HtmlTagObject = {
468
- /**
469
- * Attributes of the html tag.
470
- * E.g. `{ disabled: true, value: "demo", rel: "preconnect" }`
471
- */
472
- attributes?: Partial<{[key: string]: string | boolean}>;
473
- /** The tag name, e.g. `div`, `script`, `link`, `meta` */
474
- tagName: string;
475
- /** The inner HTML */
476
- innerHTML?: string;
477
- };
478
-
479
- export type HtmlTags = string | HtmlTagObject | (string | HtmlTagObject)[];
480
-
481
- export type ValidationSchema<T> = Joi.ObjectSchema<T>;
482
-
483
- export type Validate<T, U> = (
484
- validationSchema: ValidationSchema<U>,
485
- options: T,
486
- ) => U;
487
-
488
- export type OptionValidationContext<T, U> = {
489
- validate: Validate<T, U>;
490
- options: T;
491
- };
492
-
493
- export type ThemeConfigValidationContext<T> = {
494
- validate: Validate<T, T>;
495
- themeConfig: Partial<T>;
496
- };
497
-
498
- export type Plugin<Content = unknown> = {
499
- name: string;
500
- loadContent?: () => Promise<Content> | Content;
501
- contentLoaded?: (args: {
502
- /** The content loaded by this plugin instance */
503
- content: Content; //
504
- /** Content loaded by ALL the plugins */
505
- allContent: AllContent;
506
- actions: PluginContentLoadedActions;
507
- }) => Promise<void> | void;
508
- postBuild?: (
509
- props: Props & {
510
- content: Content;
511
- head: {[location: string]: HelmetServerState};
512
- },
513
- ) => Promise<void> | void;
514
- // TODO refactor the configureWebpack API surface: use an object instead of
515
- // multiple params (requires breaking change)
516
- configureWebpack?: (
517
- config: WebpackConfiguration,
518
- isServer: boolean,
519
- utils: ConfigureWebpackUtils,
520
- content: Content,
521
- ) => WebpackConfiguration & {
522
- mergeStrategy?: {
523
- [key: string]: CustomizeRuleString;
524
- };
525
- };
526
- configurePostCss?: (options: PostCssOptions) => PostCssOptions;
527
- getThemePath?: () => string;
528
- getTypeScriptThemePath?: () => string;
529
- getPathsToWatch?: () => string[];
530
- getClientModules?: () => string[];
531
- extendCli?: (cli: CommanderStatic) => void;
532
- injectHtmlTags?: (args: {content: Content}) => {
533
- headTags?: HtmlTags;
534
- preBodyTags?: HtmlTags;
535
- postBodyTags?: HtmlTags;
536
- };
537
- // TODO before/afterDevServer implementation
538
-
539
- // translations
540
- getTranslationFiles?: (args: {
541
- content: Content;
542
- }) => Promise<TranslationFile[]> | TranslationFile[];
543
- getDefaultCodeTranslationMessages?: () =>
544
- | Promise<{[id: string]: string}>
545
- | {[id: string]: string};
546
- translateContent?: (args: {
547
- /** The content loaded by this plugin instance. */
548
- content: Content;
549
- translationFiles: TranslationFile[];
550
- }) => Content;
551
- translateThemeConfig?: (args: {
552
- themeConfig: ThemeConfig;
553
- translationFiles: TranslationFile[];
554
- }) => ThemeConfig;
555
- };
556
-
557
- export type InitializedPlugin = Plugin & {
558
- readonly options: Required<PluginOptions>;
559
- readonly version: PluginVersionInformation;
560
- /** The absolute path to the folder containing the entry point file. */
561
- readonly path: string;
562
- };
563
-
564
- export type LoadedPlugin = InitializedPlugin & {
565
- readonly content: unknown;
566
- };
567
-
568
- export type SwizzleAction = 'eject' | 'wrap';
569
- export type SwizzleActionStatus = 'safe' | 'unsafe' | 'forbidden';
570
-
571
- export type SwizzleComponentConfig = {
572
- actions: {[action in SwizzleAction]: SwizzleActionStatus};
573
- description?: string;
574
- };
575
-
576
- export type SwizzleConfig = {
577
- components: {[componentName: string]: SwizzleComponentConfig};
578
- // Other settings could be added here, like the ability to declare the config
579
- // as exhaustive so that we can emit errors
580
- };
581
-
582
- export type PluginModule = {
583
- (context: LoadContext, options: unknown): Plugin | Promise<Plugin>;
584
- validateOptions?: <T, U>(data: OptionValidationContext<T, U>) => U;
585
- validateThemeConfig?: <T>(data: ThemeConfigValidationContext<T>) => T;
586
-
587
- getSwizzleComponentList?: () => string[] | undefined; // TODO deprecate this one later
588
- getSwizzleConfig?: () => SwizzleConfig | undefined;
589
- };
590
-
591
- export type Preset = {
592
- plugins?: PluginConfig[];
593
- themes?: PluginConfig[];
594
- };
595
-
596
- export type PresetModule = {
597
- (context: LoadContext, presetOptions: unknown): Preset;
598
- };
599
-
600
- // === Route registry ===
601
-
602
- /**
603
- * A "module" represents a unit of serialized data emitted from the plugin. It
604
- * will be imported on client-side and passed as props, context, etc.
605
- *
606
- * If it's a string, it's a file path that Webpack can `require`; if it's
607
- * an object, it can also contain `query` or other metadata.
608
- */
609
- export type Module =
610
- | {
611
- /**
612
- * A marker that tells the route generator this is an import and not a
613
- * nested object to recurse.
614
- */
615
- __import?: boolean;
616
- path: string;
617
- query?: ParsedUrlQueryInput;
618
- }
619
- | string;
620
-
621
- /**
622
- * Represents the data attached to each route. Since the routes.js is a
623
- * monolithic data file, any data (like props) should be serialized separately
624
- * and registered here as file paths (a {@link Module}), so that we could
625
- * code-split.
626
- */
627
- export type RouteModules = {
628
- [propName: string]: Module | RouteModules | RouteModules[];
629
- };
630
-
631
- /**
632
- * Represents a "slice" of the final route structure returned from the plugin
633
- * `addRoute` action.
634
- */
635
- export type RouteConfig = {
636
- /** With leading slash. Trailing slash will be normalized by config. */
637
- path: string;
638
- /** Component used to render this route, a path that Webpack can `require`. */
639
- component: string;
640
- /**
641
- * Props. Each entry should be `[propName]: pathToPropModule` (created with
642
- * `createData`)
643
- */
644
- modules?: RouteModules;
645
- /**
646
- * The route context will wrap the `component`. Use `useRouteContext` to
647
- * retrieve what's declared here. Note that all custom route context declared
648
- * here will be namespaced under {@link RouteContext.data}.
649
- */
650
- context?: RouteModules;
651
- /** Nested routes config. */
652
- routes?: RouteConfig[];
653
- /** React router config option: `exact` routes would not match subroutes. */
654
- exact?: boolean;
655
- /** Used to sort routes. Higher-priority routes will be placed first. */
656
- priority?: number;
657
- /** Extra props; will be copied to routes.js. */
658
- [propName: string]: unknown;
659
- };
660
-
661
- export type RouteContext = {
662
- /**
663
- * Plugin-specific context data.
664
- */
665
- data?: object | undefined;
666
- };
667
-
668
- /**
669
- * Top-level plugin routes automatically add some context data to the route.
670
- * This permits us to know which plugin is handling the current route.
671
- */
672
- export type PluginRouteContext = RouteContext & {
673
- plugin: {
674
- id: string;
675
- name: string;
676
- };
677
- };
678
-
679
- /**
680
- * The shape would be isomorphic to {@link RouteModules}:
681
- * {@link Module} -> `string`, `RouteModules[]` -> `ChunkNames[]`.
682
- *
683
- * Each `string` chunk name will correlate with one key in the {@link Registry}.
684
- */
685
- export type ChunkNames = {
686
- [propName: string]: string | ChunkNames | ChunkNames[];
687
- };
688
-
689
- /**
690
- * A map from route paths (with a hash) to the chunk names of each module, which
691
- * the bundler will collect.
692
- *
693
- * Chunk keys are routes with a hash, because 2 routes can conflict with each
694
- * other if they have the same path, e.g.: parent=/docs, child=/docs
695
- *
696
- * @see https://github.com/facebook/docusaurus/issues/2917
697
- */
698
- export type RouteChunkNames = {
699
- [routePathHashed: string]: ChunkNames;
700
- };
701
-
702
- /**
703
- * Each key is the chunk name, which you can get from `routeChunkNames` (see
704
- * {@link RouteChunkNames}). The values are the opts data that react-loadable
705
- * needs. For example:
706
- *
707
- * ```js
708
- * const options = {
709
- * optsLoader: {
710
- * component: () => import('./Pages.js'),
711
- * content.foo: () => import('./doc1.md'),
712
- * },
713
- * optsModules: ['./Pages.js', './doc1.md'],
714
- * optsWebpack: [
715
- * require.resolveWeak('./Pages.js'),
716
- * require.resolveWeak('./doc1.md'),
717
- * ],
718
- * }
719
- * ```
720
- *
721
- * @see https://github.com/jamiebuilds/react-loadable#declaring-which-modules-are-being-loaded
722
- */
723
- export type Registry = {
724
- readonly [chunkName: string]: [
725
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
726
- Loader: () => Promise<any>,
727
- ModuleName: string,
728
- ResolvedModuleName: string,
729
- ];
730
- };
731
-
732
- export type ClientModule = {
733
- onRouteDidUpdate?: (args: {
734
- previousLocation: Location | null;
735
- location: Location;
736
- }) => (() => void) | void;
737
- onRouteUpdate?: (args: {
738
- previousLocation: Location | null;
739
- location: Location;
740
- }) => (() => void) | void;
741
- };
742
-
743
- export type UseDataOptions = {
744
- /**
745
- * Throw an error, or simply return undefined if the data cannot be found. Use
746
- * `true` if you are sure the data must exist.
747
- */
748
- failfast?: boolean;
749
- };
8
+ export {
9
+ ReportingSeverity,
10
+ ThemeConfig,
11
+ DocusaurusConfig,
12
+ Config,
13
+ } from './config';
14
+
15
+ export {
16
+ SiteMetadata,
17
+ DocusaurusContext,
18
+ GlobalData,
19
+ LoadContext,
20
+ Props,
21
+ } from './context';
22
+
23
+ export {ClientModule} from './clientModule';
24
+
25
+ export {
26
+ SwizzleAction,
27
+ SwizzleActionStatus,
28
+ SwizzleConfig,
29
+ SwizzleComponentConfig,
30
+ WrapperProps,
31
+ } from './swizzle';
32
+
33
+ export {
34
+ I18nConfig,
35
+ I18nLocaleConfig,
36
+ I18n,
37
+ CodeTranslations,
38
+ TranslationFileContent,
39
+ TranslationMessage,
40
+ TranslationFile,
41
+ } from './i18n';
42
+
43
+ export {
44
+ Plugin,
45
+ InitializedPlugin,
46
+ LoadedPlugin,
47
+ PluginModule,
48
+ PluginOptions,
49
+ PluginConfig,
50
+ PluginContentLoadedActions,
51
+ PluginVersionInformation,
52
+ Preset,
53
+ PresetConfig,
54
+ PresetModule,
55
+ OptionValidationContext,
56
+ ThemeConfigValidationContext,
57
+ Validate,
58
+ ValidationSchema,
59
+ AllContent,
60
+ ConfigureWebpackUtils,
61
+ PostCssOptions,
62
+ HtmlTagObject,
63
+ HtmlTags,
64
+ } from './plugin';
65
+
66
+ export {
67
+ RouteConfig,
68
+ RouteContext,
69
+ PluginRouteContext,
70
+ Registry,
71
+ RouteChunkNames,
72
+ RouteModules,
73
+ Module,
74
+ ChunkNames,
75
+ } from './routing';
76
+
77
+ export {UseDataOptions} from './utils';