mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
This commit updates scripts within `packages/compiler-cli` to relative imports as a prep work to the upcoming infra updates. PR Close #60625
18 lines
637 B
TypeScript
18 lines
637 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
import {ClassDeclaration, isNamedClassDeclaration} from '../../src/ngtsc/reflection';
|
|
import ts from 'typescript';
|
|
|
|
export function getClass(sf: ts.SourceFile, name: string): ClassDeclaration<ts.ClassDeclaration> {
|
|
for (const stmt of sf.statements) {
|
|
if (isNamedClassDeclaration(stmt) && stmt.name.text === name) {
|
|
return stmt;
|
|
}
|
|
}
|
|
throw new Error(`Class ${name} not found in file: ${sf.fileName}: ${sf.text}`);
|
|
}
|