@docusaurus/types 0.0.0-5899 → 0.0.0-5901

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": "0.0.0-5899",
3
+ "version": "0.0.0-5901",
4
4
  "description": "Common types for Docusaurus packages.",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
@@ -27,5 +27,5 @@
27
27
  "react": "^18.0.0",
28
28
  "react-dom": "^18.0.0"
29
29
  },
30
- "gitHead": "e8e1f914293e8dade7f4e0907d9a00bd1df80470"
30
+ "gitHead": "a66ccfd1b9e2716166f237995de747747885eb1d"
31
31
  }
package/src/context.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  import type {DocusaurusConfig} from './config';
8
8
  import type {CodeTranslations, I18n} from './i18n';
9
9
  import type {LoadedPlugin, PluginVersionInformation} from './plugin';
10
- import type {RouteConfig} from './routing';
10
+ import type {PluginRouteConfig} from './routing';
11
11
 
12
12
  export type DocusaurusContext = {
13
13
  siteConfig: DocusaurusConfig;
@@ -57,7 +57,7 @@ export type Props = LoadContext & {
57
57
  preBodyTags: string;
58
58
  postBodyTags: string;
59
59
  siteMetadata: SiteMetadata;
60
- routes: RouteConfig[];
60
+ routes: PluginRouteConfig[];
61
61
  routesPaths: string[];
62
62
  plugins: LoadedPlugin[];
63
63
  };
package/src/index.d.ts CHANGED
@@ -70,6 +70,7 @@ export {
70
70
 
71
71
  export {
72
72
  RouteConfig,
73
+ PluginRouteConfig,
73
74
  RouteMetadata,
74
75
  RouteContext,
75
76
  PluginRouteContext,
package/src/plugin.d.ts CHANGED
@@ -49,7 +49,7 @@ export type PluginVersionInformation =
49
49
 
50
50
  export type PluginContentLoadedActions = {
51
51
  addRoute: (config: RouteConfig) => void;
52
- createData: (name: string, data: string) => Promise<string>;
52
+ createData: (name: string, data: string | object) => Promise<string>;
53
53
  setGlobalData: (data: unknown) => void;
54
54
  };
55
55
 
package/src/routing.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import type {ParsedUrlQueryInput} from 'querystring';
9
+ import type {PluginIdentifier} from './plugin';
9
10
 
10
11
  /**
11
12
  * A "module" represents a unit of serialized data emitted from the plugin. It
@@ -110,9 +111,23 @@ export type RouteConfig = {
110
111
  */
111
112
  metadata?: RouteMetadata;
112
113
  /**
113
- * Extra props; will be available on the client side.
114
+ * Optional props object; will be converted to a module and injected as props
115
+ * into the route component.
114
116
  */
115
- [propName: string]: unknown;
117
+ props?: {[propName: string]: unknown};
118
+ /**
119
+ * Extra route attribute; will be available on the client side route object.
120
+ */
121
+ [attributeName: string]: unknown;
122
+ };
123
+
124
+ export type PluginRouteConfig = RouteConfig & {
125
+ /**
126
+ * Routes are always created by Docusaurus plugins
127
+ * A plugin identifier is available at the top of a routing tree
128
+ * (child routes are implicitly created by the same plugin as their parent)
129
+ */
130
+ plugin: PluginIdentifier;
116
131
  };
117
132
 
118
133
  export type RouteContext = {