/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/ngtools/webpack/src/ivy/cache.ts
33 строки
971 B
Ash Ramirez
refactor(@angular/cli): update aio links -> adev links
06 июн 2024, 12:12
06 июн 2024, 12:12
434a374
Код
Авторство
О чём код?
/** * @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 * as ts from 'typescript'; export class SourceFileCache extends Map<string, ts.SourceFile> { private readonly angularDiagnostics = new Map<ts.SourceFile, ts.Diagnostic[]>(); invalidate(file: string): void { const sourceFile = this.get(file); if (sourceFile) { this.delete(file); this.angularDiagnostics.delete(sourceFile); } } updateAngularDiagnostics(sourceFile: ts.SourceFile, diagnostics: ts.Diagnostic[]): void { if (diagnostics.length > 0) { this.angularDiagnostics.set(sourceFile, diagnostics); } else { this.angularDiagnostics.delete(sourceFile); } } getAngularDiagnostics(sourceFile: ts.SourceFile): ts.Diagnostic[] | undefined { return this.angularDiagnostics.get(sourceFile); } }