style(compiler-cli): reformat of codebase with new clang-format version (#36520)
This commit reformats the packages/compiler-cli tree using the new version of clang-format. PR Close #36520
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*/
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {AbsoluteFsPath, absoluteFrom, basename} from '../../file_system';
|
||||
import {absoluteFrom, AbsoluteFsPath, basename} from '../../file_system';
|
||||
import {ImportRewriter} from '../../imports';
|
||||
import {isNonDeclarationTsPath} from '../../util/src/typescript';
|
||||
|
||||
@ -24,15 +24,21 @@ const STRIP_NG_FACTORY = /(.*)NgFactory$/;
|
||||
export class FactoryGenerator implements ShimGenerator {
|
||||
private constructor(private map: Map<AbsoluteFsPath, AbsoluteFsPath>) {}
|
||||
|
||||
get factoryFileMap(): Map<AbsoluteFsPath, AbsoluteFsPath> { return this.map; }
|
||||
get factoryFileMap(): Map<AbsoluteFsPath, AbsoluteFsPath> {
|
||||
return this.map;
|
||||
}
|
||||
|
||||
get factoryFileNames(): AbsoluteFsPath[] { return Array.from(this.map.keys()); }
|
||||
get factoryFileNames(): AbsoluteFsPath[] {
|
||||
return Array.from(this.map.keys());
|
||||
}
|
||||
|
||||
recognize(fileName: AbsoluteFsPath): boolean { return this.map.has(fileName); }
|
||||
recognize(fileName: AbsoluteFsPath): boolean {
|
||||
return this.map.has(fileName);
|
||||
}
|
||||
|
||||
generate(genFilePath: AbsoluteFsPath, readFile: (fileName: string) => ts.SourceFile | null):
|
||||
ts.SourceFile|null {
|
||||
const originalPath = this.map.get(genFilePath) !;
|
||||
const originalPath = this.map.get(genFilePath)!;
|
||||
const original = readFile(originalPath);
|
||||
if (original === null) {
|
||||
return null;
|
||||
@ -53,7 +59,7 @@ export class FactoryGenerator implements ShimGenerator {
|
||||
decl => isExported(decl) && decl.decorators !== undefined &&
|
||||
decl.name !== undefined)
|
||||
// Grab the symbol name.
|
||||
.map(decl => decl.name !.text);
|
||||
.map(decl => decl.name!.text);
|
||||
|
||||
|
||||
let sourceText = '';
|
||||
@ -71,8 +77,8 @@ export class FactoryGenerator implements ShimGenerator {
|
||||
// This will encompass a lot of symbols which don't need factories, but that's okay
|
||||
// because it won't miss any that do.
|
||||
const varLines = symbolNames.map(
|
||||
name =>
|
||||
`export const ${name}NgFactory: i0.ɵNgModuleFactory<any> = new i0.ɵNgModuleFactory(${name});`);
|
||||
name => `export const ${
|
||||
name}NgFactory: i0.ɵNgModuleFactory<any> = new i0.ɵNgModuleFactory(${name});`);
|
||||
sourceText += [
|
||||
// This might be incorrect if the current package being compiled is Angular core, but it's
|
||||
// okay to leave in at type checking time. TypeScript can handle this reference via its path
|
||||
@ -136,7 +142,7 @@ function transformFactorySourceFile(
|
||||
return file;
|
||||
}
|
||||
|
||||
const {moduleSymbolNames, sourceFilePath} = factoryMap.get(file.fileName) !;
|
||||
const {moduleSymbolNames, sourceFilePath} = factoryMap.get(file.fileName)!;
|
||||
|
||||
file = ts.getMutableClone(file);
|
||||
|
||||
|
@ -32,7 +32,7 @@ export class FactoryTracker {
|
||||
|
||||
track(sf: ts.SourceFile, factorySymbolName: string): void {
|
||||
if (this.sourceToFactorySymbols.has(sf.fileName)) {
|
||||
this.sourceToFactorySymbols.get(sf.fileName) !.add(factorySymbolName);
|
||||
this.sourceToFactorySymbols.get(sf.fileName)!.add(factorySymbolName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {AbsoluteFsPath, absoluteFrom} from '../../file_system';
|
||||
import {absoluteFrom, AbsoluteFsPath} from '../../file_system';
|
||||
import {isNonDeclarationTsPath} from '../../util/src/typescript';
|
||||
|
||||
import {ShimGenerator} from './api';
|
||||
@ -17,13 +17,17 @@ import {generatedModuleName} from './util';
|
||||
export class SummaryGenerator implements ShimGenerator {
|
||||
private constructor(private map: Map<AbsoluteFsPath, AbsoluteFsPath>) {}
|
||||
|
||||
getSummaryFileNames(): AbsoluteFsPath[] { return Array.from(this.map.keys()); }
|
||||
getSummaryFileNames(): AbsoluteFsPath[] {
|
||||
return Array.from(this.map.keys());
|
||||
}
|
||||
|
||||
recognize(fileName: AbsoluteFsPath): boolean { return this.map.has(fileName); }
|
||||
recognize(fileName: AbsoluteFsPath): boolean {
|
||||
return this.map.has(fileName);
|
||||
}
|
||||
|
||||
generate(genFilePath: AbsoluteFsPath, readFile: (fileName: string) => ts.SourceFile | null):
|
||||
ts.SourceFile|null {
|
||||
const originalPath = this.map.get(genFilePath) !;
|
||||
const originalPath = this.map.get(genFilePath)!;
|
||||
const original = readFile(originalPath);
|
||||
if (original === null) {
|
||||
return null;
|
||||
|
@ -22,7 +22,9 @@ import {ShimGenerator} from './api';
|
||||
export class TypeCheckShimGenerator implements ShimGenerator {
|
||||
constructor(private typeCheckFile: AbsoluteFsPath) {}
|
||||
|
||||
recognize(fileName: AbsoluteFsPath): boolean { return fileName === this.typeCheckFile; }
|
||||
recognize(fileName: AbsoluteFsPath): boolean {
|
||||
return fileName === this.typeCheckFile;
|
||||
}
|
||||
|
||||
generate(genFileName: AbsoluteFsPath, readFile: (fileName: string) => ts.SourceFile | null):
|
||||
ts.SourceFile|null {
|
||||
|
Reference in New Issue
Block a user