refactor(compiler-cli): setup compilation mode to enable generating linker code (#38938)
This is a precursor to introducing the Angular linker. As an initial step, a compiler option to configure the compilation mode is introduced. This option is initially internal until the linker is considered ready. PR Close #38938
This commit is contained in:
@ -48,7 +48,7 @@ runInEachFileSystem(() => {
|
||||
'analyze',
|
||||
'register',
|
||||
'resolve',
|
||||
'compile',
|
||||
'compileFull',
|
||||
]);
|
||||
// Only detect the Component and Directive decorators
|
||||
handler.detect.and.callFake(
|
||||
@ -95,7 +95,7 @@ runInEachFileSystem(() => {
|
||||
});
|
||||
// The "test" compilation result is just the name of the decorator being compiled
|
||||
// (suffixed with `(compiled)`)
|
||||
(handler.compile as any).and.callFake((decl: ts.Declaration, analysis: any) => {
|
||||
(handler.compileFull as any).and.callFake((decl: ts.Declaration, analysis: any) => {
|
||||
logs.push(`compile: ${(decl as any).name.text}@${analysis.decoratorName} (resolved: ${
|
||||
analysis.resolved})`);
|
||||
return `@${analysis.decoratorName} (compiled)`;
|
||||
@ -414,7 +414,7 @@ runInEachFileSystem(() => {
|
||||
expect(testHandler.analyze).toHaveBeenCalled();
|
||||
expect(testHandler.register).not.toHaveBeenCalled();
|
||||
expect(testHandler.resolve).not.toHaveBeenCalled();
|
||||
expect(testHandler.compile).not.toHaveBeenCalled();
|
||||
expect(testHandler.compileFull).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should report resolve diagnostics to the `diagnosticHandler` callback', () => {
|
||||
@ -436,7 +436,7 @@ runInEachFileSystem(() => {
|
||||
expect(testHandler.analyze).toHaveBeenCalled();
|
||||
expect(testHandler.register).toHaveBeenCalled();
|
||||
expect(testHandler.resolve).toHaveBeenCalled();
|
||||
expect(testHandler.compile).not.toHaveBeenCalled();
|
||||
expect(testHandler.compileFull).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@ -452,7 +452,7 @@ runInEachFileSystem(() => {
|
||||
analyze(): AnalysisOutput<unknown> {
|
||||
throw new Error('analyze should not have been called');
|
||||
}
|
||||
compile(): CompileResult {
|
||||
compileFull(): CompileResult {
|
||||
throw new Error('compile should not have been called');
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ class DetectDecoratorHandler implements DecoratorHandler<unknown, unknown, unkno
|
||||
return {};
|
||||
}
|
||||
|
||||
compile(node: ClassDeclaration): CompileResult|CompileResult[] {
|
||||
compileFull(node: ClassDeclaration): CompileResult|CompileResult[] {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ class DiagnosticProducingHandler implements DecoratorHandler<unknown, unknown, u
|
||||
return {diagnostics: [makeDiagnostic(9999, node, 'test diagnostic')]};
|
||||
}
|
||||
|
||||
compile(node: ClassDeclaration): CompileResult|CompileResult[] {
|
||||
compileFull(node: ClassDeclaration): CompileResult|CompileResult[] {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ class TestHandler implements DecoratorHandler<unknown, unknown, unknown> {
|
||||
return {};
|
||||
}
|
||||
|
||||
compile(node: ClassDeclaration): CompileResult|CompileResult[] {
|
||||
compileFull(node: ClassDeclaration): CompileResult|CompileResult[] {
|
||||
this.log.push(this.name + ':compile:' + node.name.text);
|
||||
return [];
|
||||
}
|
||||
|
Reference in New Issue
Block a user