Skip to content

Commit f9daf9d

Browse files
committed
feat: Support disabling sources
Closes #808
1 parent df14d12 commit f9daf9d

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/lib/converter/plugins/SourcePlugin.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ import { Component, ConverterComponent } from '../components';
88
import { BasePath } from '../utils/base-path';
99
import { Converter } from '../converter';
1010
import { Context } from '../context';
11+
import { BindOption } from '../../utils';
1112

1213
/**
1314
* A handler that attaches source file information to reflections.
1415
*/
1516
@Component({name: 'source'})
1617
export class SourcePlugin extends ConverterComponent {
18+
@BindOption('disableSources')
19+
readonly disableSources!: boolean;
20+
1721
/**
1822
* Helper for resolving the base path of all source files.
1923
*/
@@ -87,7 +91,7 @@ export class SourcePlugin extends ConverterComponent {
8791
* @param node The node that is currently processed if available.
8892
*/
8993
private onDeclaration(context: Context, reflection: Reflection, node?: ts.Node) {
90-
if (!node) {
94+
if (!node || this.disableSources) {
9195
return;
9296
}
9397
const sourceFile = node.getSourceFile();

src/lib/utils/options/declaration.ts

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface TypeDocOptionMap {
5353
excludePrivate: boolean;
5454
excludeProtected: boolean;
5555
ignoreCompilerErrors: boolean;
56+
disableSources: boolean;
5657
includes: string;
5758
media: string;
5859

src/lib/utils/options/sources/typedoc.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ export function addTypeDocOptions(options: Options) {
7474
});
7575
options.addDeclaration({
7676
name: 'ignoreCompilerErrors',
77-
help: 'Should TypeDoc generate documentation pages even after the compiler has returned errors?',
77+
help: 'Skips checking for TypeScript compilation errors if set.',
78+
type: ParameterType.Boolean
79+
});
80+
options.addDeclaration({
81+
name: 'disableSources',
82+
help: 'Disables setting the source of a reflection when documenting it.',
7883
type: ParameterType.Boolean
7984
});
8085
options.addDeclaration({

0 commit comments

Comments
 (0)