@docusaurus/types 2.0.0-beta.1b0acc554 → 2.0.0-beta.2

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/index.d.ts +16 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/types",
3
- "version": "2.0.0-beta.1b0acc554",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "Common types for Docusaurus packages.",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  "commander": "^5.1.0",
18
18
  "joi": "^17.4.0",
19
19
  "querystring": "0.2.0",
20
- "webpack": "^5.37.0",
21
- "webpack-merge": "^5.7.3"
20
+ "webpack": "^5.40.0",
21
+ "webpack-merge": "^5.8.0"
22
22
  },
23
- "gitHead": "20372a8567c378da38b3de385f7e8bc85af5f2aa"
23
+ "gitHead": "883f07fddffaf1657407c8e202e370cc436e25f7"
24
24
  }
package/src/index.d.ts CHANGED
@@ -26,7 +26,7 @@ export type ThemeConfig = {
26
26
  export interface DocusaurusConfig {
27
27
  baseUrl: string;
28
28
  baseUrlIssueBanner: boolean;
29
- favicon: string;
29
+ favicon?: string;
30
30
  tagline?: string;
31
31
  title: string;
32
32
  url: string;
@@ -198,7 +198,7 @@ export interface Props extends LoadContext, InjectedHtmlTags {
198
198
  siteMetadata: DocusaurusSiteMetadata;
199
199
  routes: RouteConfig[];
200
200
  routesPaths: string[];
201
- plugins: Plugin<unknown>[];
201
+ plugins: LoadedPlugin<unknown>[];
202
202
  }
203
203
 
204
204
  export interface PluginContentLoadedActions {
@@ -233,10 +233,12 @@ export interface Plugin<Content> {
233
233
  routesLoaded?(routes: RouteConfig[]): void; // TODO remove soon, deprecated (alpha-60)
234
234
  postBuild?(props: Props): void;
235
235
  postStart?(props: Props): void;
236
+ // TODO refactor the configureWebpack API surface: use an object instead of multiple params (requires breaking change)
236
237
  configureWebpack?(
237
238
  config: Configuration,
238
239
  isServer: boolean,
239
240
  utils: ConfigureWebpackUtils,
241
+ content: Content,
240
242
  ): Configuration & {mergeStrategy?: ConfigureWebpackFnMergeStrategy};
241
243
  configurePostCss?(options: PostCssOptions): PostCssOptions;
242
244
  getThemePath?(): string;
@@ -244,7 +246,9 @@ export interface Plugin<Content> {
244
246
  getPathsToWatch?(): string[];
245
247
  getClientModules?(): string[];
246
248
  extendCli?(cli: Command): void;
247
- injectHtmlTags?(): {
249
+ injectHtmlTags?({
250
+ content: Content,
251
+ }): {
248
252
  headTags?: HtmlTags;
249
253
  preBodyTags?: HtmlTags;
250
254
  postBodyTags?: HtmlTags;
@@ -279,6 +283,13 @@ export interface Plugin<Content> {
279
283
  }): ThemeConfig;
280
284
  }
281
285
 
286
+ export type InitializedPlugin = Plugin<unknown> & {
287
+ readonly options: PluginOptions;
288
+ readonly version: DocusaurusPluginVersionInformation;
289
+ };
290
+
291
+ export type LoadedPlugin = InitializedPlugin & {readonly content: unknown};
292
+
282
293
  export type PluginModule = {
283
294
  <T, X>(context: LoadContext, options: T): Plugin<X>;
284
295
  validateOptions?<T>(data: OptionValidationContext<T>): T;
@@ -333,7 +344,8 @@ export interface RouteConfig {
333
344
  priority?: number;
334
345
  }
335
346
 
336
- export interface ThemeAlias {
347
+ // Aliases used for Webpack resolution (when using docusaurus swizzle)
348
+ export interface ThemeAliases {
337
349
  [alias: string]: string;
338
350
  }
339
351