@@ -46,20 +46,36 @@ export interface ITypescriptPluginOptions {
4646 * @default false
4747 */
4848 includeNonExportedMembers ?: boolean ;
49+
50+ /** Path to tsconfig file. */
51+ tsconfigPath ?: string ;
52+
53+ /**
54+ * If enabled, logs messages and compiler errors to the console.
55+ * Note that compiler errors are ignored by Typedoc so they do not affect docs generation.
56+ * @default false
57+ */
58+ verbose ?: boolean ;
4959}
5060
5161export class TypescriptPlugin implements IPlugin < ITypescriptPluginData > {
5262 private app : TypedocApp ;
5363 public constructor ( private options : ITypescriptPluginOptions = { } ) {
54- const { includeDeclarations = false , includePrivateMembers = false } = options ;
55- this . app = new TypedocApp ( {
64+ const { includeDeclarations = false , includePrivateMembers = false , tsconfigPath, verbose = false } = options ;
65+ // options docs: https://gist.github.com/mootari/d39895574c8deacc57d0fc04eb0d21ca#file-options-md
66+ const typedocOptions : any = {
5667 exclude : "**/node_modules/**" ,
5768 excludePrivate : ! includePrivateMembers ,
5869 ignoreCompilerErrors : true ,
5970 includeDeclarations,
60- logger : "none" ,
71+ logger : verbose ? console . log : "none" ,
6172 mode : "modules" ,
62- } ) ;
73+ } ;
74+ if ( options . tsconfigPath != null ) {
75+ // typedoc complains if given `undefined`, so only set if necessary
76+ typedocOptions . tsconfig = tsconfigPath ;
77+ }
78+ this . app = new TypedocApp ( typedocOptions ) ;
6379 }
6480
6581 public compile ( files : IFile [ ] , compiler : ICompiler ) : ITypescriptPluginData {
0 commit comments