@docusaurus/types 0.0.0-6049 → 0.0.0-6052

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-6049",
3
+ "version": "0.0.0-6052",
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": "f6855e0f81535a12a66babb934ad8dcf6e9361b2"
30
+ "gitHead": "ff41451cf14cc627f2c0e002edc580ae91732eaf"
31
31
  }
package/src/config.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  import type {SiteStorage} from './context';
9
9
  import type {RuleSetRule} from 'webpack';
10
- import type {Required as RequireKeys, DeepPartial} from 'utility-types';
10
+ import type {DeepPartial, Overwrite} from 'utility-types';
11
11
  import type {I18nConfig} from './i18n';
12
12
  import type {PluginConfig, PresetConfig, HtmlTagObject} from './plugin';
13
13
 
@@ -123,7 +123,13 @@ export type StorageConfig = {
123
123
  namespace: boolean | string;
124
124
  };
125
125
 
126
+ export type FasterConfig = {
127
+ swcJsLoader: boolean;
128
+ };
129
+
126
130
  export type FutureConfig = {
131
+ experimental_faster: FasterConfig;
132
+
127
133
  experimental_storage: StorageConfig;
128
134
 
129
135
  /**
@@ -416,6 +422,9 @@ export type DocusaurusConfig = {
416
422
  * Babel loader and preset; otherwise, you can provide your custom Webpack
417
423
  * rule set.
418
424
  */
425
+ // TODO Docusaurus v4
426
+ // Use an object type ({isServer}) so that it conforms to jsLoaderFactory
427
+ // Eventually deprecate this if swc loader becomes stable?
419
428
  jsLoader: 'babel' | ((isServer: boolean) => RuleSetRule);
420
429
  };
421
430
  /** Markdown-related options. */
@@ -423,11 +432,21 @@ export type DocusaurusConfig = {
423
432
  };
424
433
 
425
434
  /**
426
- * Docusaurus config, as provided by the user (partial/unnormalized). This type
435
+ * Docusaurus config, as provided by the user (partial/un-normalized). This type
427
436
  * is used to provide type-safety / IDE auto-complete on the config file.
428
437
  * @see https://docusaurus.io/docs/typescript-support
429
438
  */
430
- export type Config = RequireKeys<
439
+ export type Config = Overwrite<
431
440
  DeepPartial<DocusaurusConfig>,
432
- 'title' | 'url' | 'baseUrl'
441
+ {
442
+ title: DocusaurusConfig['title'];
443
+ url: DocusaurusConfig['url'];
444
+ baseUrl: DocusaurusConfig['baseUrl'];
445
+ future?: Overwrite<
446
+ DeepPartial<FutureConfig>,
447
+ {
448
+ experimental_faster?: boolean | FasterConfig;
449
+ }
450
+ >;
451
+ }
433
452
  >;
package/src/plugin.d.ts CHANGED
@@ -60,7 +60,9 @@ export type ConfigureWebpackUtils = {
60
60
  ) => RuleSetRule[];
61
61
  getJSLoader: (options: {
62
62
  isServer: boolean;
63
- babelOptions?: {[key: string]: unknown};
63
+ // TODO Docusaurus v4 remove?
64
+ // not ideal because JS Loader might not use Babel...
65
+ babelOptions?: string | {[key: string]: unknown};
64
66
  }) => RuleSetRule;
65
67
  };
66
68
 
@@ -122,8 +124,9 @@ export type Plugin<Content = unknown> = {
122
124
  head: {[location: string]: HelmetServerState};
123
125
  },
124
126
  ) => Promise<void> | void;
125
- // TODO refactor the configureWebpack API surface: use an object instead of
126
- // multiple params (requires breaking change)
127
+ // TODO Docusaurus v4 ?
128
+ // refactor the configureWebpack API surface: use an object instead of
129
+ // multiple params (requires breaking change)
127
130
  configureWebpack?: (
128
131
  config: WebpackConfiguration,
129
132
  isServer: boolean,