source: trip-planner-front/node_modules/@angular/cdk/schematics/ng-update/migrations/class-names.mjs@ 84d0fbb

Last change on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 13.7 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.ClassNamesMigration = void 0;
11const ts = require("typescript");
12const migration_1 = require("../../update-tool/migration");
13const imports_1 = require("../typescript/imports");
14const module_specifiers_1 = require("../typescript/module-specifiers");
15const upgrade_data_1 = require("../upgrade-data");
16/**
17 * Migration that walks through every identifier that is part of Angular Material or thr CDK
18 * and replaces the outdated name with the new one if specified in the upgrade data.
19 */
20// TODO: rework this rule to identify symbols using the import identifier resolver. This
21// makes it more robust, less AST convoluted and is more TypeScript AST idiomatic. COMP-300.
22class ClassNamesMigration extends migration_1.Migration {
23 constructor() {
24 super(...arguments);
25 /** Change data that upgrades to the specified target version. */
26 this.data = upgrade_data_1.getVersionUpgradeData(this, 'classNames');
27 /**
28 * List of identifier names that have been imported from `@angular/material` or `@angular/cdk`
29 * in the current source file and therefore can be considered trusted.
30 */
31 this.trustedIdentifiers = new Set();
32 /** List of namespaces that have been imported from `@angular/material` or `@angular/cdk`. */
33 this.trustedNamespaces = new Set();
34 // Only enable the migration rule if there is upgrade data.
35 this.enabled = this.data.length !== 0;
36 }
37 visitNode(node) {
38 if (ts.isIdentifier(node)) {
39 this._visitIdentifier(node);
40 }
41 }
42 /** Method that is called for every identifier inside of the specified project. */
43 _visitIdentifier(identifier) {
44 // For identifiers that aren't listed in the className data, the whole check can be
45 // skipped safely.
46 if (!this.data.some(data => data.replace === identifier.text)) {
47 return;
48 }
49 // For namespace imports that are referring to Angular Material or the CDK, we store the
50 // namespace name in order to be able to safely find identifiers that don't belong to the
51 // developer's application.
52 if (imports_1.isNamespaceImportNode(identifier) && module_specifiers_1.isMaterialImportDeclaration(identifier)) {
53 this.trustedNamespaces.add(identifier.text);
54 return this._createFailureWithReplacement(identifier);
55 }
56 // For export declarations that are referring to Angular Material or the CDK, the identifier
57 // can be immediately updated to the new name.
58 if (imports_1.isExportSpecifierNode(identifier) && module_specifiers_1.isMaterialExportDeclaration(identifier)) {
59 return this._createFailureWithReplacement(identifier);
60 }
61 // For import declarations that are referring to Angular Material or the CDK, the name of
62 // the import identifiers. This allows us to identify identifiers that belong to Material and
63 // the CDK, and we won't accidentally touch a developer's identifier.
64 if (imports_1.isImportSpecifierNode(identifier) && module_specifiers_1.isMaterialImportDeclaration(identifier)) {
65 this.trustedIdentifiers.add(identifier.text);
66 return this._createFailureWithReplacement(identifier);
67 }
68 // In case the identifier is part of a property access expression, we need to verify that the
69 // property access originates from a namespace that has been imported from Material or the CDK.
70 if (ts.isPropertyAccessExpression(identifier.parent)) {
71 const expression = identifier.parent.expression;
72 if (ts.isIdentifier(expression) && this.trustedNamespaces.has(expression.text)) {
73 return this._createFailureWithReplacement(identifier);
74 }
75 }
76 else if (this.trustedIdentifiers.has(identifier.text)) {
77 return this._createFailureWithReplacement(identifier);
78 }
79 }
80 /** Creates a failure and replacement for the specified identifier. */
81 _createFailureWithReplacement(identifier) {
82 const classData = this.data.find(data => data.replace === identifier.text);
83 const filePath = this.fileSystem.resolve(identifier.getSourceFile().fileName);
84 this.fileSystem.edit(filePath)
85 .remove(identifier.getStart(), identifier.getWidth())
86 .insertRight(identifier.getStart(), classData.replaceWith);
87 }
88}
89exports.ClassNamesMigration = ClassNamesMigration;
90//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3MtbmFtZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL3NjaGVtYXRpY3MvbmctdXBkYXRlL21pZ3JhdGlvbnMvY2xh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IgdGhlIHNwZWNpZmllZCBpZGVudGlmaWVyLiAqL1xuICBwcml2YXRlIF9jcmVhdGVGYWlsdXJlV2l0aFJlcGxhY2VtZW50KGlkZW50aWZpZXI6IHRzLklkZW50aWZpZXIpIHtcbiAgICBjb25zdCBjbGFzc0RhdGEgPSB0aGlzLmRhdGEuZmluZChkYXRhID0+IGRhdGEucmVwbGFjZSA9PT0gaWRlbnRpZmllci50ZXh0KSE7XG4gICAgY29uc3QgZmlsZVBhdGggPSB0aGlzLmZpbGVTeXN0ZW0ucmVzb2x2ZShpZGVudGlmaWVyLmdldFNvdXJjZUZpbGUoKS5maWxlTmFtZSk7XG5cbiAgICB0aGlzLmZpbGVTeXN0ZW0uZWRpdChmaWxlUGF0aClcbiAgICAgIC5yZW1vdmUoaWRlbnRpZmllci5nZXRTdGFydCgpLCBpZGVudGlmaWVyLmdldFdpZHRoKCkpXG4gICAgICAuaW5zZXJ0UmlnaHQoaWRlbnRpZmllci5nZXRTdGFydCgpLCBjbGFzc0RhdGEucmVwbGFjZVdpdGgpO1xuICB9XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.