Skip to content

Commit 3dadcde

Browse files
committed
feat: Support disabling sources
Closes #808
1 parent 802c408 commit 3dadcde

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/lib/converter/plugins/SourcePlugin.ts

Lines changed: 5 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ export function addTypeDocOptions(options: Options) {
7878
});
7979
options.addDeclaration({
8080
name: 'ignoreCompilerErrors',
81-
help: 'Should TypeDoc generate documentation pages even after the compiler has returned errors?',
81+
help: 'Skips checking for TypeScript compilation errors if set.',
82+
type: ParameterType.Boolean
83+
});
84+
options.addDeclaration({
85+
name: 'disableSources',
86+
help: 'Disables setting the source of a reflection when documenting it.',
8287
type: ParameterType.Boolean
8388
});
8489
options.addDeclaration({

0 commit comments

Comments
 (0)