Skip to content

Commit

Permalink
fix(core): should get correct source file for node_modules types #OSP…
Browse files Browse the repository at this point in the history
…-244
  • Loading branch information
why520crazy committed Jan 24, 2022
1 parent 9b795c5 commit 1f84bcc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
3 changes: 0 additions & 3 deletions packages/ngdoc/src/ng-parser-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ export class DefaultNgParserHost implements NgParserHost {

private getSourceFile(fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void) {
this.readFiles.push(fileName);
if (this.rootDir && !fileName.startsWith(this.rootDir)) {
return undefined;
}
const sourceText = ts.sys.readFile(fileName);
return sourceText !== undefined ? ts.createSourceFile(fileName, sourceText, languageVersion) : undefined;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/ngdoc/src/ng-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface ParserSourceFileContext {

export class NgDocParser {
static parse(pattern: string) {
return new NgDocParser({ fileGlobs: pattern }).parse(pattern);
return this.create({ fileGlobs: pattern }).parse(pattern);
}

static create(options: NgDocParserOptions) {
Expand Down Expand Up @@ -166,6 +166,7 @@ export class NgDocParser {
});
return properties;
}

private parseServiceProperties(context: ParserSourceFileContext, classDeclaration: ts.ClassDeclaration) {
const properties: NgPropertyDoc[] = [];
ts.forEachChild(classDeclaration, (node: ts.Node) => {
Expand Down Expand Up @@ -194,6 +195,7 @@ export class NgDocParser {
});
return properties;
}

private parseServiceMethods(context: ParserSourceFileContext, classDeclaration: ts.ClassDeclaration) {
const properties: NgPropertyDoc[] = [];
ts.forEachChild(classDeclaration, (node: ts.Node) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ButtonComponent implements OnInit {
* @deprecated
* @default md
*/
@Input() thySize: LoadingComponent;
@Input() thySize: ButtonSize;

@Input() set thyLoading(loading: boolean){
this.loading = loading;
Expand Down
10 changes: 7 additions & 3 deletions packages/ngdoc/test/fixtures/full/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@
"name": "thySize",
"aliasName": "",
"type": {
"name": "any",
"options": null,
"name": "ButtonSize",
"options": [
"lg",
"md",
"sm"
],
"kindName": "TypeReference"
},
"description": "Button Size",
Expand Down Expand Up @@ -226,4 +230,4 @@
}
]
}
]
]
3 changes: 2 additions & 1 deletion packages/template/src/styles/doc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ $dg-service-color: #8e24aa;
flex: 1;
display: block;
padding: 20px 0px;
font-size: $dg-font-size-md;
// font-size: $dg-font-size-md;
// white-space: break-spaces;
> :first-child {
margin-top: 0;
Expand Down Expand Up @@ -319,6 +319,7 @@ $dg-service-color: #8e24aa;
line-height: 26px;
margin-top: 0;
margin-bottom: 8px;
font-size: $dg-font-size-md;

code {
line-height: 24px;
Expand Down

0 comments on commit 1f84bcc

Please sign in to comment.