diff --git a/packages/compiler-cli/src/ngcc/src/host/esm5_host.ts b/packages/compiler-cli/src/ngcc/src/host/esm5_host.ts index cab372ec3e..35e86b7895 100644 --- a/packages/compiler-cli/src/ngcc/src/host/esm5_host.ts +++ b/packages/compiler-cli/src/ngcc/src/host/esm5_host.ts @@ -10,7 +10,7 @@ import * as ts from 'typescript'; import {ClassMember, ClassMemberKind, Decorator, FunctionDefinition, Parameter} from '../../../ngtsc/host'; import {reflectObjectLiteral} from '../../../ngtsc/metadata'; import {getNameText} from '../utils'; -import {CONSTRUCTOR_PARAMS, Esm2015ReflectionHost, getPropertyValueFromSymbol} from './esm2015_host'; +import {CONSTRUCTOR_PARAMS, Fesm2015ReflectionHost, getPropertyValueFromSymbol} from './fesm2015_host'; /** * ESM5 packages contain ECMAScript IIFE functions that act like classes. For example: @@ -29,7 +29,7 @@ import {CONSTRUCTOR_PARAMS, Esm2015ReflectionHost, getPropertyValueFromSymbol} f * a static method called `ctorParameters`. * */ -export class Esm5ReflectionHost extends Esm2015ReflectionHost { +export class Esm5ReflectionHost extends Fesm2015ReflectionHost { constructor(checker: ts.TypeChecker) { super(checker); } /** diff --git a/packages/compiler-cli/src/ngcc/src/host/esm2015_host.ts b/packages/compiler-cli/src/ngcc/src/host/fesm2015_host.ts similarity index 99% rename from packages/compiler-cli/src/ngcc/src/host/esm2015_host.ts rename to packages/compiler-cli/src/ngcc/src/host/fesm2015_host.ts index 451ffbcbd2..5a03b789f1 100644 --- a/packages/compiler-cli/src/ngcc/src/host/esm2015_host.ts +++ b/packages/compiler-cli/src/ngcc/src/host/fesm2015_host.ts @@ -46,7 +46,7 @@ export const CONSTRUCTOR_PARAMS = 'ctorParameters' as ts.__String; * * Constructor parameters decorators are found on an object returned from * a static method called `ctorParameters`. */ -export class Esm2015ReflectionHost extends TypeScriptReflectionHost implements NgccReflectionHost { +export class Fesm2015ReflectionHost extends TypeScriptReflectionHost implements NgccReflectionHost { constructor(checker: ts.TypeChecker) { super(checker); } /** diff --git a/packages/compiler-cli/src/ngcc/src/transform/package_transformer.ts b/packages/compiler-cli/src/ngcc/src/transform/package_transformer.ts index 8ce7d995df..9d0f77c72d 100644 --- a/packages/compiler-cli/src/ngcc/src/transform/package_transformer.ts +++ b/packages/compiler-cli/src/ngcc/src/transform/package_transformer.ts @@ -14,8 +14,8 @@ import {DtsFileTransformer} from '../../../ngtsc/transform'; import {AnalyzedFile, Analyzer} from '../analyzer'; import {IMPORT_PREFIX} from '../constants'; -import {Esm2015ReflectionHost} from '../host/esm2015_host'; import {Esm5ReflectionHost} from '../host/esm5_host'; +import {Fesm2015ReflectionHost} from '../host/fesm2015_host'; import {NgccReflectionHost} from '../host/ngcc_host'; import {Esm2015FileParser} from '../parsing/esm2015_parser'; import {Esm5FileParser} from '../parsing/esm5_parser'; @@ -95,7 +95,7 @@ export class PackageTransformer { switch (format) { case 'esm2015': case 'fesm2015': - return new Esm2015ReflectionHost(program.getTypeChecker()); + return new Fesm2015ReflectionHost(program.getTypeChecker()); case 'esm5': case 'fesm5': return new Esm5ReflectionHost(program.getTypeChecker()); diff --git a/packages/compiler-cli/src/ngcc/test/analyzer_spec.ts b/packages/compiler-cli/src/ngcc/test/analyzer_spec.ts index 96fc978071..d33e8ea7c3 100644 --- a/packages/compiler-cli/src/ngcc/test/analyzer_spec.ts +++ b/packages/compiler-cli/src/ngcc/test/analyzer_spec.ts @@ -9,7 +9,7 @@ import * as ts from 'typescript'; import {Decorator} from '../../ngtsc/host'; import {DecoratorHandler} from '../../ngtsc/transform'; import {AnalyzedFile, Analyzer} from '../src/analyzer'; -import {Esm2015ReflectionHost} from '../src/host/esm2015_host'; +import {Fesm2015ReflectionHost} from '../src/host/fesm2015_host'; import {ParsedClass} from '../src/parsing/parsed_class'; import {ParsedFile} from '../src/parsing/parsed_file'; import {getDeclaration, makeProgram} from './helpers/utils'; @@ -80,7 +80,7 @@ describe('Analyzer', () => { program = makeProgram(TEST_PROGRAM); const file = createParsedFile(program); const analyzer = new Analyzer( - program.getTypeChecker(), new Esm2015ReflectionHost(program.getTypeChecker())); + program.getTypeChecker(), new Fesm2015ReflectionHost(program.getTypeChecker())); testHandler = createTestHandler(); analyzer.handlers = [testHandler]; result = analyzer.analyzeFile(file); diff --git a/packages/compiler-cli/src/ngcc/test/host/esm2015_host_spec.ts b/packages/compiler-cli/src/ngcc/test/host/esm2015_host_spec.ts index b693399b81..602f7d2792 100644 --- a/packages/compiler-cli/src/ngcc/test/host/esm2015_host_spec.ts +++ b/packages/compiler-cli/src/ngcc/test/host/esm2015_host_spec.ts @@ -8,7 +8,7 @@ import * as ts from 'typescript'; import {ClassMemberKind, Import} from '../../../ngtsc/host'; -import {Esm2015ReflectionHost} from '../../src/host/esm2015_host'; +import {Fesm2015ReflectionHost} from '../../src/host/fesm2015_host'; import {getDeclaration, makeProgram} from '../helpers/utils'; const SOME_DIRECTIVE_FILE = { @@ -390,7 +390,7 @@ describe('Esm2015ReflectionHost', () => { describe('getDecoratorsOfDeclaration()', () => { it('should find the decorators on a class', () => { const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode) !; @@ -408,7 +408,7 @@ describe('Esm2015ReflectionHost', () => { it('should return null if the symbol is not a class', () => { const program = makeProgram(FOO_FUNCTION_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const functionNode = getDeclaration(program, FOO_FUNCTION_FILE.name, 'foo', ts.isFunctionDeclaration); const decorators = host.getDecoratorsOfDeclaration(functionNode); @@ -417,7 +417,7 @@ describe('Esm2015ReflectionHost', () => { it('should return null if there are no decorators', () => { const program = makeProgram(SIMPLE_CLASS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SIMPLE_CLASS_FILE.name, 'EmptyClass', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode); @@ -426,7 +426,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore `decorators` if it is not an array literal', () => { const program = makeProgram(INVALID_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_DECORATORS_FILE.name, 'NotArrayLiteral', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode); @@ -435,7 +435,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore decorator elements that are not object literals', () => { const program = makeProgram(INVALID_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_DECORATORS_FILE.name, 'NotObjectLiteral', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode) !; @@ -446,7 +446,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore decorator elements that have no `type` property', () => { const program = makeProgram(INVALID_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_DECORATORS_FILE.name, 'NoTypeProperty', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode) !; @@ -457,7 +457,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore decorator elements whose `type` value is not an identifier', () => { const program = makeProgram(INVALID_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_DECORATORS_FILE.name, 'NotIdentifier', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode) !; @@ -468,11 +468,11 @@ describe('Esm2015ReflectionHost', () => { it('should use `getImportOfIdentifier()` to retrieve import info', () => { const mockImportInfo = {} as Import; - const spy = spyOn(Esm2015ReflectionHost.prototype, 'getImportOfIdentifier') + const spy = spyOn(Fesm2015ReflectionHost.prototype, 'getImportOfIdentifier') .and.returnValue(mockImportInfo); const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode) !; @@ -487,7 +487,7 @@ describe('Esm2015ReflectionHost', () => { describe('(returned decorators `args`)', () => { it('should be an empty array if decorator has no `args` property', () => { const program = makeProgram(INVALID_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_DECORATOR_ARGS_FILE.name, 'NoArgsProperty', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode) !; @@ -499,7 +499,7 @@ describe('Esm2015ReflectionHost', () => { it('should be an empty array if decorator\'s `args` has no property assignment', () => { const program = makeProgram(INVALID_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_DECORATOR_ARGS_FILE.name, 'NoPropertyAssignment', ts.isClassDeclaration); @@ -512,7 +512,7 @@ describe('Esm2015ReflectionHost', () => { it('should be an empty array if `args` property value is not an array literal', () => { const program = makeProgram(INVALID_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_DECORATOR_ARGS_FILE.name, 'NotArrayLiteral', ts.isClassDeclaration); const decorators = host.getDecoratorsOfDeclaration(classNode) !; @@ -527,7 +527,7 @@ describe('Esm2015ReflectionHost', () => { describe('getMembersOfClass()', () => { it('should find decorated properties on a class', () => { const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -545,7 +545,7 @@ describe('Esm2015ReflectionHost', () => { it('should find non decorated properties on a class', () => { const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -559,7 +559,7 @@ describe('Esm2015ReflectionHost', () => { it('should find static methods on a class', () => { const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -572,7 +572,7 @@ describe('Esm2015ReflectionHost', () => { it('should find static properties on a class', () => { const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -586,7 +586,7 @@ describe('Esm2015ReflectionHost', () => { it('should throw if the symbol is not a class', () => { const program = makeProgram(FOO_FUNCTION_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const functionNode = getDeclaration(program, FOO_FUNCTION_FILE.name, 'foo', ts.isFunctionDeclaration); expect(() => { @@ -596,7 +596,7 @@ describe('Esm2015ReflectionHost', () => { it('should return an empty array if there are no prop decorators', () => { const program = makeProgram(SIMPLE_CLASS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SIMPLE_CLASS_FILE.name, 'EmptyClass', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -607,7 +607,7 @@ describe('Esm2015ReflectionHost', () => { it('should not process decorated properties in `propDecorators` if it is not an object literal', () => { const program = makeProgram(INVALID_PROP_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_PROP_DECORATORS_FILE.name, 'NotObjectLiteral', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -617,7 +617,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore prop decorator elements that are not object literals', () => { const program = makeProgram(INVALID_PROP_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_PROP_DECORATORS_FILE.name, 'NotObjectLiteralProp', ts.isClassDeclaration); @@ -633,7 +633,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore prop decorator elements that have no `type` property', () => { const program = makeProgram(INVALID_PROP_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_PROP_DECORATORS_FILE.name, 'NoTypeProperty', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -646,7 +646,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore prop decorator elements whose `type` value is not an identifier', () => { const program = makeProgram(INVALID_PROP_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_PROP_DECORATORS_FILE.name, 'NotIdentifier', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -660,13 +660,13 @@ describe('Esm2015ReflectionHost', () => { it('should use `getImportOfIdentifier()` to retrieve import info', () => { let callCount = 0; const spy = - spyOn(Esm2015ReflectionHost.prototype, 'getImportOfIdentifier').and.callFake(() => { + spyOn(Fesm2015ReflectionHost.prototype, 'getImportOfIdentifier').and.callFake(() => { callCount++; return {name: `name${callCount}`, from: `from${callCount}`}; }); const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const members = host.getMembersOfClass(classNode); @@ -688,7 +688,7 @@ describe('Esm2015ReflectionHost', () => { describe('(returned prop decorators `args`)', () => { it('should be an empty array if prop decorator has no `args` property', () => { const program = makeProgram(INVALID_PROP_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_PROP_DECORATOR_ARGS_FILE.name, 'NoArgsProperty', ts.isClassDeclaration); @@ -703,7 +703,7 @@ describe('Esm2015ReflectionHost', () => { it('should be an empty array if prop decorator\'s `args` has no property assignment', () => { const program = makeProgram(INVALID_PROP_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_PROP_DECORATOR_ARGS_FILE.name, 'NoPropertyAssignment', ts.isClassDeclaration); @@ -718,7 +718,7 @@ describe('Esm2015ReflectionHost', () => { it('should be an empty array if `args` property value is not an array literal', () => { const program = makeProgram(INVALID_PROP_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_PROP_DECORATOR_ARGS_FILE.name, 'NotArrayLiteral', ts.isClassDeclaration); @@ -736,7 +736,7 @@ describe('Esm2015ReflectionHost', () => { describe('getConstructorParameters()', () => { it('should find the decorated constructor parameters', () => { const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -752,7 +752,7 @@ describe('Esm2015ReflectionHost', () => { it('should throw if the symbol is not a class', () => { const program = makeProgram(FOO_FUNCTION_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const functionNode = getDeclaration(program, FOO_FUNCTION_FILE.name, 'foo', ts.isFunctionDeclaration); expect(() => { host.getConstructorParameters(functionNode); }) @@ -762,7 +762,7 @@ describe('Esm2015ReflectionHost', () => { it('should return `null` if there is no constructor', () => { const program = makeProgram(SIMPLE_CLASS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SIMPLE_CLASS_FILE.name, 'EmptyClass', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -771,7 +771,7 @@ describe('Esm2015ReflectionHost', () => { it('should return an array even if there are no decorators', () => { const program = makeProgram(SIMPLE_CLASS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, SIMPLE_CLASS_FILE.name, 'NoDecoratorConstructorClass', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -784,7 +784,7 @@ describe('Esm2015ReflectionHost', () => { it('should return an empty array if there are no constructor parameters', () => { const program = makeProgram(INVALID_CTOR_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATORS_FILE.name, 'NoParameters', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -794,7 +794,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore `ctorParameters` if it is not an arrow function', () => { const program = makeProgram(INVALID_CTOR_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATORS_FILE.name, 'NotArrowFunction', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -808,7 +808,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore `ctorParameters` if it does not return an array literal', () => { const program = makeProgram(INVALID_CTOR_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATORS_FILE.name, 'NotArrayLiteral', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -823,7 +823,7 @@ describe('Esm2015ReflectionHost', () => { describe('(returned parameters `decorators`)', () => { it('should ignore param decorator elements that are not object literals', () => { const program = makeProgram(INVALID_CTOR_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATORS_FILE.name, 'NotObjectLiteral', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -841,7 +841,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore param decorator elements that have no `type` property', () => { const program = makeProgram(INVALID_CTOR_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATORS_FILE.name, 'NoTypeProperty', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -853,7 +853,7 @@ describe('Esm2015ReflectionHost', () => { it('should ignore param decorator elements whose `type` value is not an identifier', () => { const program = makeProgram(INVALID_CTOR_DECORATORS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATORS_FILE.name, 'NotIdentifier', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -865,11 +865,11 @@ describe('Esm2015ReflectionHost', () => { it('should use `getImportOfIdentifier()` to retrieve import info', () => { const mockImportInfo = {} as Import; - const spy = spyOn(Esm2015ReflectionHost.prototype, 'getImportOfIdentifier') + const spy = spyOn(Fesm2015ReflectionHost.prototype, 'getImportOfIdentifier') .and.returnValue(mockImportInfo); const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const parameters = host.getConstructorParameters(classNode); @@ -886,7 +886,7 @@ describe('Esm2015ReflectionHost', () => { describe('(returned parameters `decorators.args`)', () => { it('should be an empty array if param decorator has no `args` property', () => { const program = makeProgram(INVALID_CTOR_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATOR_ARGS_FILE.name, 'NoArgsProperty', ts.isClassDeclaration); @@ -901,7 +901,7 @@ describe('Esm2015ReflectionHost', () => { it('should be an empty array if param decorator\'s `args` has no property assignment', () => { const program = makeProgram(INVALID_CTOR_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATOR_ARGS_FILE.name, 'NoPropertyAssignment', ts.isClassDeclaration); @@ -915,7 +915,7 @@ describe('Esm2015ReflectionHost', () => { it('should be an empty array if `args` property value is not an array literal', () => { const program = makeProgram(INVALID_CTOR_DECORATOR_ARGS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration( program, INVALID_CTOR_DECORATOR_ARGS_FILE.name, 'NotArrayLiteral', ts.isClassDeclaration); @@ -932,7 +932,7 @@ describe('Esm2015ReflectionHost', () => { describe('getDefinitionOfFunction()', () => { it('should return an object describing the function declaration passed as an argument', () => { const program = makeProgram(FUNCTION_BODY_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const fooNode = getDeclaration(program, FUNCTION_BODY_FILE.name, 'foo', ts.isFunctionDeclaration) !; @@ -994,7 +994,7 @@ describe('Esm2015ReflectionHost', () => { describe('getImportOfIdentifier()', () => { it('should find the import of an identifier', () => { const program = makeProgram(...IMPORTS_FILES); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const variableNode = getDeclaration(program, IMPORTS_FILES[1].name, 'b', ts.isVariableDeclaration); const importOfIdent = host.getImportOfIdentifier(variableNode.initializer as ts.Identifier); @@ -1004,7 +1004,7 @@ describe('Esm2015ReflectionHost', () => { it('should find the name by which the identifier was exported, not imported', () => { const program = makeProgram(...IMPORTS_FILES); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const variableNode = getDeclaration(program, IMPORTS_FILES[1].name, 'c', ts.isVariableDeclaration); const importOfIdent = host.getImportOfIdentifier(variableNode.initializer as ts.Identifier); @@ -1014,7 +1014,7 @@ describe('Esm2015ReflectionHost', () => { it('should return null if the identifier was not imported', () => { const program = makeProgram(...IMPORTS_FILES); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const variableNode = getDeclaration(program, IMPORTS_FILES[1].name, 'd', ts.isVariableDeclaration); const importOfIdent = host.getImportOfIdentifier(variableNode.initializer as ts.Identifier); @@ -1026,7 +1026,7 @@ describe('Esm2015ReflectionHost', () => { describe('getDeclarationOfIdentifier()', () => { it('should return the declaration of a locally defined identifier', () => { const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const ctrDecorators = host.getConstructorParameters(classNode) !; @@ -1042,7 +1042,7 @@ describe('Esm2015ReflectionHost', () => { it('should return the declaration of an externally defined identifier', () => { const program = makeProgram(SOME_DIRECTIVE_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const classNode = getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); const classDecorators = host.getDecoratorsOfDeclaration(classNode) !; @@ -1062,7 +1062,7 @@ describe('Esm2015ReflectionHost', () => { describe('getExportsOfModule()', () => { it('should return a map of all the exports from a given module', () => { const program = makeProgram(...EXPORTS_FILES); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const file = program.getSourceFile(EXPORTS_FILES[1].name) !; const exportDeclarations = host.getExportsOfModule(file); expect(exportDeclarations).not.toBe(null); @@ -1097,7 +1097,7 @@ describe('Esm2015ReflectionHost', () => { describe('isClass()', () => { it('should return true if a given node is a TS class declaration', () => { const program = makeProgram(SIMPLE_CLASS_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const node = getDeclaration(program, SIMPLE_CLASS_FILE.name, 'EmptyClass', ts.isClassDeclaration); expect(host.isClass(node)).toBe(true); @@ -1105,7 +1105,7 @@ describe('Esm2015ReflectionHost', () => { it('should return false if a given node is a TS function declaration', () => { const program = makeProgram(FOO_FUNCTION_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const node = getDeclaration(program, FOO_FUNCTION_FILE.name, 'foo', ts.isFunctionDeclaration); expect(host.isClass(node)).toBe(false); }); diff --git a/packages/compiler-cli/src/ngcc/test/host/esm5_host_spec.ts b/packages/compiler-cli/src/ngcc/test/host/esm5_host_spec.ts index 7b0b6973ec..f09d865fca 100644 --- a/packages/compiler-cli/src/ngcc/test/host/esm5_host_spec.ts +++ b/packages/compiler-cli/src/ngcc/test/host/esm5_host_spec.ts @@ -8,8 +8,8 @@ import * as ts from 'typescript'; import {ClassMemberKind, Import} from '../../../ngtsc/host'; -import {Esm2015ReflectionHost} from '../../src/host/esm2015_host'; import {Esm5ReflectionHost} from '../../src/host/esm5_host'; +import {Fesm2015ReflectionHost} from '../../src/host/fesm2015_host'; import {getDeclaration, makeProgram} from '../helpers/utils'; const SOME_DIRECTIVE_FILE = { @@ -1128,7 +1128,7 @@ describe('Esm5ReflectionHost', () => { let superGetClassSymbolSpy: jasmine.Spy; beforeEach(() => { - superGetClassSymbolSpy = spyOn(Esm2015ReflectionHost.prototype, 'getClassSymbol'); + superGetClassSymbolSpy = spyOn(Fesm2015ReflectionHost.prototype, 'getClassSymbol'); }); it('should return the class symbol returned by the superclass (if any)', () => { @@ -1194,7 +1194,7 @@ describe('Esm5ReflectionHost', () => { host = new Esm5ReflectionHost(null as any); mockNode = {} as any; - superIsClassSpy = spyOn(Esm2015ReflectionHost.prototype, 'isClass'); + superIsClassSpy = spyOn(Fesm2015ReflectionHost.prototype, 'isClass'); getClassSymbolSpy = spyOn(Esm5ReflectionHost.prototype, 'getClassSymbol'); }); diff --git a/packages/compiler-cli/src/ngcc/test/parsing/esm2015_parser_spec.ts b/packages/compiler-cli/src/ngcc/test/parsing/esm2015_parser_spec.ts index 4607d4a9cf..9c8385f898 100644 --- a/packages/compiler-cli/src/ngcc/test/parsing/esm2015_parser_spec.ts +++ b/packages/compiler-cli/src/ngcc/test/parsing/esm2015_parser_spec.ts @@ -8,7 +8,7 @@ import * as ts from 'typescript'; -import {Esm2015ReflectionHost} from '../../src/host/esm2015_host'; +import {Fesm2015ReflectionHost} from '../../src/host/fesm2015_host'; import {Esm2015FileParser} from '../../src/parsing/esm2015_parser'; import {makeProgram} from '../helpers/utils'; @@ -39,7 +39,7 @@ describe('Esm2015PackageParser', () => { describe('getDecoratedClasses()', () => { it('should return an array of object for each class that is exported and decorated', () => { const program = makeProgram(BASIC_FILE); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const parser = new Esm2015FileParser(program, host); const parsedFiles = parser.parseFile(program.getSourceFile(BASIC_FILE.name) !); diff --git a/packages/compiler-cli/src/ngcc/test/rendering/esm2015_renderer_spec.ts b/packages/compiler-cli/src/ngcc/test/rendering/esm2015_renderer_spec.ts index 9bcd127c7f..2b540491b2 100644 --- a/packages/compiler-cli/src/ngcc/test/rendering/esm2015_renderer_spec.ts +++ b/packages/compiler-cli/src/ngcc/test/rendering/esm2015_renderer_spec.ts @@ -9,13 +9,13 @@ import * as ts from 'typescript'; import MagicString from 'magic-string'; import {makeProgram} from '../helpers/utils'; import {Analyzer} from '../../src/analyzer'; -import {Esm2015ReflectionHost} from '../../src/host/esm2015_host'; +import {Fesm2015ReflectionHost} from '../../src/host/fesm2015_host'; import {Esm2015FileParser} from '../../src/parsing/esm2015_parser'; import {Esm2015Renderer} from '../../src/rendering/esm2015_renderer'; function setup(file: {name: string, contents: string}) { const program = makeProgram(file); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const parser = new Esm2015FileParser(program, host); const analyzer = new Analyzer(program.getTypeChecker(), host); const renderer = new Esm2015Renderer(host); diff --git a/packages/compiler-cli/src/ngcc/test/rendering/renderer_spec.ts b/packages/compiler-cli/src/ngcc/test/rendering/renderer_spec.ts index 003c02c22b..a298e7a25c 100644 --- a/packages/compiler-cli/src/ngcc/test/rendering/renderer_spec.ts +++ b/packages/compiler-cli/src/ngcc/test/rendering/renderer_spec.ts @@ -12,7 +12,7 @@ import MagicString from 'magic-string'; import {fromObject, generateMapFileComment} from 'convert-source-map'; import {makeProgram} from '../helpers/utils'; import {AnalyzedClass, Analyzer} from '../../src/analyzer'; -import {Esm2015ReflectionHost} from '../../src/host/esm2015_host'; +import {Fesm2015ReflectionHost} from '../../src/host/fesm2015_host'; import {Esm2015FileParser} from '../../src/parsing/esm2015_parser'; import {Renderer} from '../../src/rendering/renderer'; @@ -32,7 +32,7 @@ class TestRenderer extends Renderer { } function createTestRenderer() { - const renderer = new TestRenderer({} as Esm2015ReflectionHost); + const renderer = new TestRenderer({} as Fesm2015ReflectionHost); spyOn(renderer, 'addImports').and.callThrough(); spyOn(renderer, 'addDefinitions').and.callThrough(); spyOn(renderer, 'removeDecorators').and.callThrough(); @@ -41,7 +41,7 @@ function createTestRenderer() { function analyze(file: {name: string, contents: string}) { const program = makeProgram(file); - const host = new Esm2015ReflectionHost(program.getTypeChecker()); + const host = new Fesm2015ReflectionHost(program.getTypeChecker()); const parser = new Esm2015FileParser(program, host); const analyzer = new Analyzer(program.getTypeChecker(), host);