@docusaurus/types 0.0.0-4235 → 0.0.0-4242
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/index.d.ts +28 -28
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-4242",
|
|
4
4
|
"description": "Common types for Docusaurus packages.",
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"webpack": "^5.61.0",
|
|
24
24
|
"webpack-merge": "^5.8.0"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "36ef25aaf6fe06e24e66feb89208d77f51ae6a48"
|
|
27
27
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -220,10 +220,10 @@ export interface Props extends LoadContext, InjectedHtmlTags {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
export interface PluginContentLoadedActions {
|
|
223
|
-
addRoute(config: RouteConfig)
|
|
223
|
+
addRoute: (config: RouteConfig) => void;
|
|
224
224
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
225
|
-
createData(name: string, data: any)
|
|
226
|
-
setGlobalData<T = unknown>(data: T)
|
|
225
|
+
createData: (name: string, data: any) => Promise<string>;
|
|
226
|
+
setGlobalData: <T = unknown>(data: T) => void;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
export type AllContent = Record<
|
|
@@ -239,32 +239,32 @@ export type PostCssOptions = Record<string, unknown> & {plugins: unknown[]};
|
|
|
239
239
|
|
|
240
240
|
export interface Plugin<Content = unknown> {
|
|
241
241
|
name: string;
|
|
242
|
-
loadContent
|
|
243
|
-
contentLoaded
|
|
242
|
+
loadContent?: () => Promise<Content>;
|
|
243
|
+
contentLoaded?: ({
|
|
244
244
|
content,
|
|
245
245
|
actions,
|
|
246
246
|
}: {
|
|
247
247
|
content: Content; // the content loaded by this plugin instance
|
|
248
248
|
allContent: AllContent; // content loaded by ALL the plugins
|
|
249
249
|
actions: PluginContentLoadedActions;
|
|
250
|
-
})
|
|
251
|
-
routesLoaded
|
|
252
|
-
postBuild
|
|
253
|
-
postStart
|
|
250
|
+
}) => Promise<void>;
|
|
251
|
+
routesLoaded?: (routes: RouteConfig[]) => void; // TODO remove soon, deprecated (alpha-60)
|
|
252
|
+
postBuild?: (props: Props) => void;
|
|
253
|
+
postStart?: (props: Props) => void;
|
|
254
254
|
// TODO refactor the configureWebpack API surface: use an object instead of multiple params (requires breaking change)
|
|
255
|
-
configureWebpack
|
|
255
|
+
configureWebpack?: (
|
|
256
256
|
config: Configuration,
|
|
257
257
|
isServer: boolean,
|
|
258
258
|
utils: ConfigureWebpackUtils,
|
|
259
259
|
content: Content,
|
|
260
|
-
)
|
|
261
|
-
configurePostCss
|
|
262
|
-
getThemePath
|
|
263
|
-
getTypeScriptThemePath
|
|
264
|
-
getPathsToWatch
|
|
265
|
-
getClientModules
|
|
266
|
-
extendCli
|
|
267
|
-
injectHtmlTags
|
|
260
|
+
) => Configuration & {mergeStrategy?: ConfigureWebpackFnMergeStrategy};
|
|
261
|
+
configurePostCss?: (options: PostCssOptions) => PostCssOptions;
|
|
262
|
+
getThemePath?: () => string;
|
|
263
|
+
getTypeScriptThemePath?: () => string;
|
|
264
|
+
getPathsToWatch?: () => string[];
|
|
265
|
+
getClientModules?: () => string[];
|
|
266
|
+
extendCli?: (cli: Command) => void;
|
|
267
|
+
injectHtmlTags?: ({content}: {content: Content}) => {
|
|
268
268
|
headTags?: HtmlTags;
|
|
269
269
|
preBodyTags?: HtmlTags;
|
|
270
270
|
postBodyTags?: HtmlTags;
|
|
@@ -272,31 +272,31 @@ export interface Plugin<Content = unknown> {
|
|
|
272
272
|
// TODO before/afterDevServer implementation
|
|
273
273
|
|
|
274
274
|
// translations
|
|
275
|
-
getTranslationFiles
|
|
275
|
+
getTranslationFiles?: ({
|
|
276
276
|
content,
|
|
277
277
|
}: {
|
|
278
278
|
content: Content;
|
|
279
|
-
})
|
|
280
|
-
getDefaultCodeTranslationMessages
|
|
279
|
+
}) => Promise<TranslationFiles>;
|
|
280
|
+
getDefaultCodeTranslationMessages?: () => Promise<
|
|
281
281
|
Record<
|
|
282
282
|
string, // id
|
|
283
283
|
string // message
|
|
284
284
|
>
|
|
285
285
|
>;
|
|
286
|
-
translateContent
|
|
286
|
+
translateContent?: ({
|
|
287
287
|
content,
|
|
288
288
|
translationFiles,
|
|
289
289
|
}: {
|
|
290
290
|
content: Content; // the content loaded by this plugin instance
|
|
291
291
|
translationFiles: TranslationFiles;
|
|
292
|
-
})
|
|
293
|
-
translateThemeConfig
|
|
292
|
+
}) => Content;
|
|
293
|
+
translateThemeConfig?: ({
|
|
294
294
|
themeConfig,
|
|
295
295
|
translationFiles,
|
|
296
296
|
}: {
|
|
297
297
|
themeConfig: ThemeConfig;
|
|
298
298
|
translationFiles: TranslationFiles;
|
|
299
|
-
})
|
|
299
|
+
}) => ThemeConfig;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
export type InitializedPlugin<Content = unknown> = Plugin<Content> & {
|
|
@@ -310,9 +310,9 @@ export type LoadedPlugin<Content = unknown> = InitializedPlugin<Content> & {
|
|
|
310
310
|
|
|
311
311
|
export type PluginModule = {
|
|
312
312
|
<T, X>(context: LoadContext, options: T): Plugin<X>;
|
|
313
|
-
validateOptions
|
|
314
|
-
validateThemeConfig
|
|
315
|
-
getSwizzleComponentList
|
|
313
|
+
validateOptions?: <T>(data: OptionValidationContext<T>) => T;
|
|
314
|
+
validateThemeConfig?: <T>(data: ThemeConfigValidationContext<T>) => T;
|
|
315
|
+
getSwizzleComponentList?: () => string[];
|
|
316
316
|
};
|
|
317
317
|
|
|
318
318
|
export type ImportedPluginModule = PluginModule & {
|