File tree 2 files changed +8
-2
lines changed
packages/api-docs-builder
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -482,7 +482,7 @@ const extractInfoFromType = async (
482
482
* @param filename The filename where its defined (to infer the package)
483
483
* @returns an array of import command
484
484
*/
485
- const getHookImports = ( name : string , filename : string ) => {
485
+ const defaultGetHookImports = ( name : string , filename : string ) => {
486
486
const githubPath = toGitHubPath ( filename ) ;
487
487
const rootImportPath = githubPath . replace (
488
488
/ \/ p a c k a g e s \/ m u i (?: - ( .+ ?) ) ? \/ s r c \/ .* / ,
@@ -552,6 +552,8 @@ export default async function generateHookApi(
552
552
if ( annotatedDescriptionMatch !== null ) {
553
553
reactApi . description = reactApi . description . slice ( 0 , annotatedDescriptionMatch . index ) . trim ( ) ;
554
554
}
555
+
556
+ const { getHookImports = defaultGetHookImports } = projectSettings ;
555
557
reactApi . filename = filename ;
556
558
reactApi . name = name ;
557
559
reactApi . imports = getHookImports ( name , filename ) ;
Original file line number Diff line number Diff line change @@ -74,9 +74,13 @@ export interface ProjectSettings {
74
74
*/
75
75
importTranslationPagesDirectory ?: string ;
76
76
/**
77
- * Returns an array of import commands used for the API page header.
77
+ * Returns an array of import commands used for the component API page header.
78
78
*/
79
79
getComponentImports ?: ( name : string , filename : string ) => string [ ] ;
80
+ /**
81
+ * Returns an array of import commands used for the hook API page header.
82
+ */
83
+ getHookImports ?: ( name : string , filename : string ) => string [ ] ;
80
84
/**
81
85
* Settings to configure props definition tests.
82
86
*/
You can’t perform that action at this time.
0 commit comments