@docusaurus/types 3.10.2 → 4.0.0-canary-6809

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/types",
3
- "version": "3.10.2",
3
+ "version": "4.0.0-canary-6809",
4
4
  "description": "Common types for Docusaurus packages.",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
@@ -13,20 +13,20 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@mdx-js/mdx": "^3.0.0",
16
+ "@mdx-js/mdx": "^3.1.1",
17
17
  "@types/history": "^4.7.11",
18
- "@types/mdast": "^4.0.2",
19
- "@types/react": "*",
18
+ "@types/mdast": "^4.0.4",
19
+ "@types/react": "19.3.0",
20
20
  "commander": "^5.1.0",
21
- "joi": "^17.9.2",
21
+ "joi": "^18.2.8",
22
22
  "react-helmet-async": "npm:@slorber/react-helmet-async@1.3.0",
23
- "utility-types": "^3.10.0",
24
- "webpack": "^5.95.0",
25
- "webpack-merge": "^5.9.0"
23
+ "utility-types": "^3.11.0",
24
+ "webpack": "^5.110.3",
25
+ "webpack-merge": "^6.0.1"
26
26
  },
27
27
  "peerDependencies": {
28
- "react": "^18.0.0 || ^19.0.0",
29
- "react-dom": "^18.0.0 || ^19.0.0"
28
+ "react": "^19.3.0",
29
+ "react-dom": "^19.3.0"
30
30
  },
31
- "gitHead": "f37f9035584917a97a260b91fc2842cba4f8b94f"
31
+ "gitHead": "db942b07f3529b5359bcae27ab3796cb07dec10e"
32
32
  }
package/src/config.d.ts CHANGED
@@ -37,7 +37,6 @@ export type FasterConfig = {
37
37
  };
38
38
 
39
39
  export type FutureV4Config = {
40
- removeLegacyPostBuildHeadAttribute: boolean;
41
40
  useCssCascadeLayers: boolean;
42
41
  siteStorageNamespacing: boolean;
43
42
  fasterByDefault: boolean;
package/src/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export {
28
28
  ParseFrontMatter,
29
29
  OnBrokenMarkdownLinksFunction,
30
30
  OnBrokenMarkdownImagesFunction,
31
+ OnUnusedMarkdownDirectivesFunction,
31
32
  } from './markdown';
32
33
 
33
34
  export {ReportingSeverity} from './reporting';
package/src/markdown.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  import type {ProcessorOptions} from '@mdx-js/mdx';
9
9
  import type {Image, Definition, Link} from 'mdast';
10
+ import type {Directives} from 'mdast-util-directive';
10
11
 
11
12
  import type {ReportingSeverity} from './reporting';
12
13
 
@@ -86,6 +87,21 @@ export type OnBrokenMarkdownImagesFunction = (params: {
86
87
  node: Image;
87
88
  }) => void | string;
88
89
 
90
+ export type OnUnusedMarkdownDirectivesFunction = (params: {
91
+ /**
92
+ * Path of the source file on which the unused directive was found
93
+ * Relative to the site dir.
94
+ * Example: "docs/category/myDoc.mdx"
95
+ */
96
+ sourceFilePath: string;
97
+
98
+ /**
99
+ * The Markdown directives that were unused.
100
+ * Example: "myDirective"
101
+ */
102
+ directives: Directives[];
103
+ }) => void | string;
104
+
89
105
  export type MarkdownHooks = {
90
106
  /**
91
107
  * The behavior of Docusaurus when it detects any broken Markdown link.
@@ -97,6 +113,10 @@ export type MarkdownHooks = {
97
113
  onBrokenMarkdownLinks: ReportingSeverity | OnBrokenMarkdownLinksFunction;
98
114
 
99
115
  onBrokenMarkdownImages: ReportingSeverity | OnBrokenMarkdownImagesFunction;
116
+
117
+ onUnusedMarkdownDirectives:
118
+ | ReportingSeverity
119
+ | OnUnusedMarkdownDirectivesFunction;
100
120
  };
101
121
 
102
122
  export type MarkdownConfig = {
package/src/plugin.d.ts CHANGED
@@ -10,7 +10,6 @@ import type {RuleSetRule, Configuration as WebpackConfiguration} from 'webpack';
10
10
  import type {CustomizeRuleString} from 'webpack-merge/dist/types';
11
11
  import type {CommanderStatic} from 'commander';
12
12
  import type Joi from 'joi';
13
- import type {HelmetServerState} from 'react-helmet-async';
14
13
  import type {ThemeConfig} from './config';
15
14
  import type {LoadContext, Props} from './context';
16
15
  import type {SwizzleConfig} from './swizzle';
@@ -137,10 +136,6 @@ export type Plugin<Content = unknown> = {
137
136
  postBuild?: (
138
137
  props: Props & {
139
138
  content: Content;
140
- // TODO Docusaurus v4: remove old messy unserializable "head" API
141
- // breaking change, replaced by routesBuildMetadata
142
- // Reason: https://github.com/facebook/docusaurus/pull/10826
143
- head: {[location: string]: HelmetServerState};
144
139
  routesBuildMetadata: {[location: string]: RouteBuildMetadata};
145
140
  },
146
141
  ) => Promise<void> | void;
@@ -208,10 +203,10 @@ export type LoadedPlugin = InitializedPlugin & {
208
203
  };
209
204
 
210
205
  export type PluginModule<Content = unknown> = {
211
- (context: LoadContext, options: unknown):
212
- | Plugin<Content>
213
- | null
214
- | Promise<Plugin<Content> | null>;
206
+ (
207
+ context: LoadContext,
208
+ options: unknown,
209
+ ): Plugin<Content> | null | Promise<Plugin<Content> | null>;
215
210
 
216
211
  validateOptions?: <T, U>(data: OptionValidationContext<T, U>) => U;
217
212
  validateThemeConfig?: <T>(data: ThemeConfigValidationContext<T>) => T;
package/src/swizzle.d.ts CHANGED
@@ -32,12 +32,11 @@ export type SwizzleConfig = {
32
32
  export type WrapperProps<
33
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
34
  T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
35
- > = T extends JSXElementConstructor<infer P>
36
- ? unknown extends P
37
- ? // eslint-disable-next-line @typescript-eslint/ban-types
38
- {}
39
- : P
40
- : T extends keyof JSX.IntrinsicElements
41
- ? JSX.IntrinsicElements[T]
42
- : // eslint-disable-next-line @typescript-eslint/ban-types
43
- {};
35
+ > =
36
+ T extends JSXElementConstructor<infer P>
37
+ ? unknown extends P
38
+ ? {}
39
+ : P
40
+ : T extends keyof JSX.IntrinsicElements
41
+ ? JSX.IntrinsicElements[T]
42
+ : {};