12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- "use strict";
- /**
- * @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
- */
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.Migration = void 0;
- const ts = require("typescript");
- class Migration {
- constructor(
- /** TypeScript program for the migration. */
- program,
- /** TypeChecker instance for the analysis program. */
- typeChecker,
- /**
- * Version for which the migration rule should run. Null if the migration
- * is invoked manually.
- */
- targetVersion,
- /** Context data for the migration. */
- context,
- /** Upgrade data passed to the migration. */
- upgradeData,
- /** File system that can be used for modifying files. */
- fileSystem,
- /** Logger that can be used to print messages as part of the migration. */
- logger) {
- this.program = program;
- this.typeChecker = typeChecker;
- this.targetVersion = targetVersion;
- this.context = context;
- this.upgradeData = upgradeData;
- this.fileSystem = fileSystem;
- this.logger = logger;
- /** List of migration failures that need to be reported. */
- this.failures = [];
- }
- /** Method can be used to perform global analysis of the program. */
- init() { }
- /**
- * Method that will be called once all nodes, templates and stylesheets
- * have been visited.
- */
- postAnalysis() { }
- /**
- * Method that will be called for each node in a given source file. Unlike tslint, this
- * function will only retrieve TypeScript nodes that need to be casted manually. This
- * allows us to only walk the program source files once per program and not per
- * migration rule (significant performance boost).
- */
- visitNode(node) { }
- /** Method that will be called for each Angular template in the program. */
- visitTemplate(template) { }
- /** Method that will be called for each stylesheet in the program. */
- visitStylesheet(stylesheet) { }
- /** Creates a failure with a specified message at the given node location. */
- createFailureAtNode(node, message) {
- const sourceFile = node.getSourceFile();
- this.failures.push({
- filePath: this.fileSystem.resolve(sourceFile.fileName),
- position: ts.getLineAndCharacterOfPosition(sourceFile, node.getStart()),
- message: message,
- });
- }
- }
- exports.Migration = Migration;
- //# sourceMappingURL=migration.js.map
|