@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 +2 -2
- package/src/bundler.d.ts +17 -0
- package/src/config.d.ts +1 -0
- package/src/index.d.ts +2 -0
- package/src/plugin.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/types",
|
|
3
|
-
"version": "0.0.0-
|
|
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": "
|
|
30
|
+
"gitHead": "88a9e6f7cb97ad1b99679b12437bcb40eecb3fa0"
|
|
31
31
|
}
|
package/src/bundler.d.ts
ADDED
|
@@ -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
package/src/index.d.ts
CHANGED
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
|
-
|
|
135
|
+
configureWebpackUtils: ConfigureWebpackUtils,
|
|
134
136
|
content: Content,
|
|
135
137
|
) => WebpackConfiguration & {
|
|
136
138
|
mergeStrategy?: {
|