@docusaurus/types 3.3.0 → 3.4.0

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.3.0",
3
+ "version": "3.4.0",
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": "2ec4e078b5ca0c57f2cc04f2fe564d524bb5e858"
30
+ "gitHead": "49e9a2143274a8dd795659b417b470bc42abbd6e"
31
31
  }
package/src/config.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ import type {SiteStorage} from './context';
8
9
  import type {RuleSetRule} from 'webpack';
9
10
  import type {Required as RequireKeys, DeepPartial} from 'utility-types';
10
11
  import type {I18nConfig} from './i18n';
@@ -16,6 +17,8 @@ export type RemarkRehypeOptions = ProcessorOptions['remarkRehypeOptions'];
16
17
 
17
18
  export type ReportingSeverity = 'ignore' | 'log' | 'warn' | 'throw';
18
19
 
20
+ export type RouterType = 'browser' | 'hash';
21
+
19
22
  export type ThemeConfig = {
20
23
  [key: string]: unknown;
21
24
  };
@@ -115,6 +118,33 @@ export type MarkdownConfig = {
115
118
  anchors: MarkdownAnchorsConfig;
116
119
  };
117
120
 
121
+ export type StorageConfig = {
122
+ type: SiteStorage['type'];
123
+ namespace: boolean | string;
124
+ };
125
+
126
+ export type FutureConfig = {
127
+ experimental_storage: StorageConfig;
128
+
129
+ /**
130
+ * Docusaurus can work with 2 router types.
131
+ *
132
+ * - The "browser" router is the main/default router of Docusaurus.
133
+ * It will use the browser history and regular urls to navigate from
134
+ * one page to another. A static file will be emitted for each page.
135
+ *
136
+ * - The "hash" router can be useful in very specific situations (such as
137
+ * distributing your app for offline-first usage), but should be avoided
138
+ * in most cases. All pages paths will be prefixed with a /#/.
139
+ * It will opt out of static site generation, only emit a single index.html
140
+ * entry point, and use the browser hash for routing. The Docusaurus site
141
+ * content will be rendered client-side, like a regular single page
142
+ * application.
143
+ * @see https://github.com/facebook/docusaurus/issues/3825
144
+ */
145
+ experimental_router: RouterType;
146
+ };
147
+
118
148
  /**
119
149
  * Docusaurus config, after validation/normalization.
120
150
  */
@@ -171,6 +201,11 @@ export type DocusaurusConfig = {
171
201
  * @see https://docusaurus.io/docs/api/docusaurus-config#i18n
172
202
  */
173
203
  i18n: I18nConfig;
204
+ /**
205
+ * Docusaurus future flags and experimental features.
206
+ * Similar to Remix future flags, see https://remix.run/blog/future-flags
207
+ */
208
+ future: FutureConfig;
174
209
  /**
175
210
  * This option adds `<meta name="robots" content="noindex, nofollow">` to
176
211
  * every page to tell search engines to avoid indexing your site.
package/src/context.d.ts CHANGED
@@ -27,6 +27,25 @@ export type SiteMetadata = {
27
27
  readonly pluginVersions: {[pluginName: string]: PluginVersionInformation};
28
28
  };
29
29
 
30
+ export type SiteStorage = {
31
+ /**
32
+ * Which browser storage do you want to use?
33
+ * Between "localStorage" and "sessionStorage".
34
+ * The default is "localStorage".
35
+ */
36
+ type: 'localStorage' | 'sessionStorage';
37
+
38
+ /**
39
+ * Applies a namespace to the theme storage key
40
+ * For readability, the namespace is applied at the end of the key
41
+ * The final storage key will be = `${key}${namespace}`
42
+ *
43
+ * The default namespace is "" for retro-compatibility reasons
44
+ * If you want a separator, the namespace should contain it ("-myNamespace")
45
+ */
46
+ namespace: string;
47
+ };
48
+
30
49
  export type GlobalData = {[pluginName: string]: {[pluginId: string]: unknown}};
31
50
 
32
51
  export type LoadContext = {
@@ -50,6 +69,11 @@ export type LoadContext = {
50
69
  baseUrl: string;
51
70
  i18n: I18n;
52
71
  codeTranslations: CodeTranslations;
72
+
73
+ /**
74
+ * Defines the default browser storage behavior for a site
75
+ */
76
+ siteStorage: SiteStorage;
53
77
  };
54
78
 
55
79
  export type Props = LoadContext & {
package/src/index.d.ts CHANGED
@@ -7,11 +7,14 @@
7
7
 
8
8
  export {
9
9
  ReportingSeverity,
10
+ RouterType,
10
11
  ThemeConfig,
11
12
  MarkdownConfig,
12
13
  DefaultParseFrontMatter,
13
14
  ParseFrontMatter,
14
15
  DocusaurusConfig,
16
+ FutureConfig,
17
+ StorageConfig,
15
18
  Config,
16
19
  } from './config';
17
20
 
@@ -20,6 +23,7 @@ export {
20
23
  DocusaurusContext,
21
24
  GlobalData,
22
25
  LoadContext,
26
+ SiteStorage,
23
27
  Props,
24
28
  } from './context';
25
29