[6a3a178] | 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 | */
|
---|
| 9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 10 | exports.MiscTemplateMigration = void 0;
|
---|
| 11 | const target_version_1 = require("../../update-tool/target-version");
|
---|
| 12 | const migration_1 = require("../../update-tool/migration");
|
---|
| 13 | const literal_1 = require("../typescript/literal");
|
---|
| 14 | /**
|
---|
| 15 | * Migration that walks through every template and reports if there are
|
---|
| 16 | * instances of outdated Angular CDK API that can't be migrated automatically.
|
---|
| 17 | */
|
---|
| 18 | class MiscTemplateMigration extends migration_1.Migration {
|
---|
| 19 | constructor() {
|
---|
| 20 | super(...arguments);
|
---|
| 21 | // Only enable this rule if the migration targets version 6. The rule
|
---|
| 22 | // currently only includes migrations for V6 deprecations.
|
---|
| 23 | this.enabled = this.targetVersion === target_version_1.TargetVersion.V6;
|
---|
| 24 | }
|
---|
| 25 | visitTemplate(template) {
|
---|
| 26 | // Migration for https://github.com/angular/components/pull/10325 (v6)
|
---|
| 27 | literal_1.findAllSubstringIndices(template.content, 'cdk-focus-trap').forEach(offset => {
|
---|
| 28 | this.failures.push({
|
---|
| 29 | filePath: template.filePath,
|
---|
| 30 | position: template.getCharacterAndLineOfPosition(template.start + offset),
|
---|
| 31 | message: `Found deprecated element selector "cdk-focus-trap" which has been ` +
|
---|
| 32 | `changed to an attribute selector "[cdkTrapFocus]".`
|
---|
| 33 | });
|
---|
| 34 | });
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 | exports.MiscTemplateMigration = MiscTemplateMigration;
|
---|
| 38 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlzYy10ZW1wbGF0ZS5qcyIsInNvdXJjZVJvb3Q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