Skip to content

Commit

Permalink
Extend typedoc plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Oct 16, 2024
1 parent 4973a9d commit f2732fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/knip/src/plugins/typedoc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ const config = [
];

const resolveConfig: ResolveConfig<TypeDocConfig | { typedocOptions: TypeDocConfig }> = config => {
config = 'typedocOptions' in config ? config.typedocOptions : config; // exception for `tsconfig.json`
return (config?.plugin ?? []).map(toDeferResolve);
const cfg = 'typedocOptions' in config ? config.typedocOptions : config; // exception for `tsconfig.json`
const plugins = cfg?.plugin ?? [];
const themes = cfg?.theme ?? [];
return [...plugins, ...themes].map(toDeferResolve);
};

const args = {
resolve: ['plugin', 'theme'],
};

export default {
Expand All @@ -35,4 +41,5 @@ export default {
packageJsonPath,
config,
resolveConfig,
args,
} satisfies Plugin;
1 change: 1 addition & 0 deletions packages/knip/src/plugins/typedoc/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export type TypeDocConfig = {
plugin?: string[];
theme?: string[];
};

0 comments on commit f2732fa

Please sign in to comment.