Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/converters/component/component.converter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('Component converter', () => {
template: '',
styles: '',
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
{
type: NgParselOutputType.COMPONENT,
Expand All @@ -33,6 +34,7 @@ describe('Component converter', () => {
template: '',
styles: '',
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
{
type: NgParselOutputType.COMPONENT,
Expand All @@ -48,6 +50,7 @@ describe('Component converter', () => {
template: '',
styles: '',
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
];

Expand Down
3 changes: 3 additions & 0 deletions src/converters/directive/directive.converter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('Directive converter', () => {
outputs: [],
implementation: '',
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
{
type: NgParselOutputType.DIRECTIVE,
Expand All @@ -25,6 +26,7 @@ describe('Directive converter', () => {
outputs: [],
implementation: '',
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
{
type: NgParselOutputType.DIRECTIVE,
Expand All @@ -36,6 +38,7 @@ describe('Directive converter', () => {
outputs: [],
implementation: '',
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
},
];

Expand Down
2 changes: 2 additions & 0 deletions src/parser/component/component.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgParselOutput } from '../shared/model/types.model.js';
import { NgParselFieldDecorator } from '../shared/model/decorator.model.js';
import { NgParselMethod } from '../shared/model/method.model.js';
import { NgParselField } from '../shared/model/field.model.js';

export interface NgParselComponent extends NgParselOutput {
className: string;
Expand All @@ -14,5 +15,6 @@ export interface NgParselComponent extends NgParselOutput {
template: string;
styles: string | string[];
methodsPublicExplicit: NgParselMethod[];
fieldsPublicExplicit: NgParselField[];
classJsDoc?: string | undefined;
}
8 changes: 8 additions & 0 deletions src/parser/component/component.parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ describe('ComponentParser', () => {
@Input() foo: string;
@Output() bar = new EventEmitter();

public value = signal<string>('');

public foo(bar: string): string {
}

Expand Down Expand Up @@ -69,6 +71,11 @@ describe('ComponentParser', () => {
returnType: 'string',
},
],
fieldsPublicExplicit: [{
name: 'value',
type: 'inferred',
value: `signal<string>('')`,
}],
};
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);

Expand Down Expand Up @@ -137,6 +144,7 @@ describe('ComponentParser', () => {
returnType: 'string',
},
],
fieldsPublicExplicit: [],
};
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);

Expand Down
2 changes: 2 additions & 0 deletions src/parser/component/component.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { parseClassName, parseClassJsDoc } from '../shared/parser/class.parser.j

import { NgParselComponent } from './component.model.js';
import { getDecoratorProperties } from '../shared/parser/decorator.parser.js';
import { parseExplicitPublicFields } from '../shared/parser/field.parser.js';

export function parseComponent(ast: ts.SourceFile, componentFilePath: string): NgParselComponent {
const componentDecorators = getDecoratorProperties(ast);
Expand Down Expand Up @@ -39,6 +40,7 @@ export function parseComponent(ast: ts.SourceFile, componentFilePath: string): N
inputs: inputsAndOutputs.inputs,
outputs: inputsAndOutputs.outputs,
methodsPublicExplicit: parseExplicitPublicMethods(ast),
fieldsPublicExplicit: parseExplicitPublicFields(ast),
classJsDoc: parseClassJsDoc(ast),
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/parser/directive/directive.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgParselOutput } from '../shared/model/types.model.js';
import { NgParselFieldDecorator } from '../shared/model/decorator.model.js';
import { NgParselMethod } from '../shared/model/method.model.js';
import { NgParselField } from '../shared/model/field.model.js';

export interface NgParselDirective extends NgParselOutput {
className: string;
Expand All @@ -10,5 +11,6 @@ export interface NgParselDirective extends NgParselOutput {
inputs: NgParselFieldDecorator[];
outputs: NgParselFieldDecorator[];
methodsPublicExplicit: NgParselMethod[];
fieldsPublicExplicit: NgParselField[];
classJsDoc?: string | undefined;
}
8 changes: 8 additions & 0 deletions src/parser/directive/directive.parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ describe('DirectiveParser', () => {
const implementation = `export class MyTestDirective {
@Input() foo: string;
@Output() bar = new EventEmitter();

public value = signal<string>('');
}`;

const ast = tsquery.ast(`
Expand Down Expand Up @@ -49,6 +51,11 @@ describe('DirectiveParser', () => {
],
implementation,
methodsPublicExplicit: [],
fieldsPublicExplicit: [{
name: 'value',
type: 'inferred',
value: `signal<string>('')`,
}]
};
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);

Expand Down Expand Up @@ -95,6 +102,7 @@ describe('DirectiveParser', () => {
],
implementation,
methodsPublicExplicit: [],
fieldsPublicExplicit: [],
};
jest.spyOn(fs, 'readFileSync').mockReturnValue(implementation);

Expand Down
2 changes: 2 additions & 0 deletions src/parser/directive/directive.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { parseInputsAndOutputs } from '../shared/parser/field-decorator.parser.j

import { NgParselDirective } from './directive.model.js';
import { parseExplicitPublicMethods } from '../shared/parser/method.parser.js';
import { parseExplicitPublicFields } from '../shared/parser/field.parser.js';

export function parseDirective(ast: ts.SourceFile, directiveFilePath: string): NgParselDirective {
const directiveDecorators = getDecoratorProperties(ast);
Expand All @@ -26,6 +27,7 @@ export function parseDirective(ast: ts.SourceFile, directiveFilePath: string): N
inputs: inputsAndOutputs.inputs,
outputs: inputsAndOutputs.outputs,
methodsPublicExplicit: parseExplicitPublicMethods(ast),
fieldsPublicExplicit: parseExplicitPublicFields(ast),
classJsDoc: parseClassJsDoc(ast),
};
}
Loading