/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/schematics/angular/refactor/jasmine-vitest/utils/refactor-context.ts
46 строк
2 KB
Younes Jaaidi
feat(@schematics/angular): migrate fake async to Vitest fake timers
04 май 2026, 20:23
04 май 2026, 20:23
d227e69
Код
Авторство
О чём код?
/** * @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 ts from 'typescript'; import { RefactorReporter } from './refactor-reporter'; /** * A context object that provides access to shared utilities and state * throughout the transformation process. */ export interface RefactorContext { /** The root ts.SourceFile node of the file being transformed. */ readonly sourceFile: ts.SourceFile; /** The reporter for logging changes and TODOs. */ readonly reporter: RefactorReporter; /** The official context from the TypeScript Transformer API. */ readonly tsContext: ts.TransformationContext; /** A set of Vitest value imports to be added to the file. */ readonly pendingVitestValueImports: Set<string>; /** A set of Vitest type imports to be added to the file. */ readonly pendingVitestTypeImports: Set<string>; /** * Map of module specifier -> names to remove from that import. * Used when transforming identifiers that become inlined (e.g. flush -> vi.runAllTimersAsync). */ readonly pendingImportSpecifierRemovals: Map<string, Set<string>>; } /** * A generic transformer function that operates on a specific type of ts.Node. * @template T The specific type of AST node this transformer works on (e.g., ts.CallExpression). */ export type NodeTransformer<T extends ts.Node> = ( node: T, refactorCtx: RefactorContext, ) => ts.Node | readonly ts.Node[];