@docusaurus/types 0.0.0-6072 → 0.0.0-6079

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-6072",
3
+ "version": "0.0.0-6079",
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": "0489236d6e7d2912ca71b3b251d155e30bb8cd4d"
30
+ "gitHead": "88a9e6f7cb97ad1b99679b12437bcb40eecb3fa0"
31
31
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import type webpack from 'webpack';
9
+
10
+ // We use Webpack and Rspack interchangeably because most Rspack APIs are
11
+ // compatible with Webpack. So it's ok to use Webpack types for Rspack too.
12
+ // When compatibility doesn't work, use "CurrentBundler.name"
13
+ // See https://github.com/facebook/docusaurus/pull/10402
14
+ export type CurrentBundler = {
15
+ name: 'webpack' | 'rspack';
16
+ instance: typeof webpack;
17
+ };
package/src/config.d.ts CHANGED
@@ -127,6 +127,7 @@ export type FasterConfig = {
127
127
  swcJsLoader: boolean;
128
128
  swcJsMinimizer: boolean;
129
129
  mdxCrossCompilerCache: boolean;
130
+ rspackBundler: boolean;
130
131
  };
131
132
 
132
133
  export type FutureConfig = {
package/src/index.d.ts CHANGED
@@ -73,6 +73,8 @@ export {
73
73
  HtmlTags,
74
74
  } from './plugin';
75
75
 
76
+ export {CurrentBundler} from './bundler';
77
+
76
78
  export {
77
79
  RouteConfig,
78
80
  PluginRouteConfig,
package/src/plugin.d.ts CHANGED
@@ -15,6 +15,7 @@ import type {ThemeConfig} from './config';
15
15
  import type {LoadContext, Props} from './context';
16
16
  import type {SwizzleConfig} from './swizzle';
17
17
  import type {RouteConfig} from './routing';
18
+ import type {CurrentBundler} from './bundler';
18
19
 
19
20
  export type PluginOptions = {id?: string} & {[key: string]: unknown};
20
21
 
@@ -54,6 +55,7 @@ export type PluginContentLoadedActions = {
54
55
  };
55
56
 
56
57
  export type ConfigureWebpackUtils = {
58
+ currentBundler: CurrentBundler;
57
59
  getStyleLoaders: (
58
60
  isServer: boolean,
59
61
  cssOptions: {[key: string]: unknown},
@@ -130,7 +132,7 @@ export type Plugin<Content = unknown> = {
130
132
  configureWebpack?: (
131
133
  config: WebpackConfiguration,
132
134
  isServer: boolean,
133
- utils: ConfigureWebpackUtils,
135
+ configureWebpackUtils: ConfigureWebpackUtils,
134
136
  content: Content,
135
137
  ) => WebpackConfiguration & {
136
138
  mergeStrategy?: {