This commit is contained in:
CHEVALLIER Abel
2025-11-13 16:23:22 +01:00
parent de9c515a47
commit cb235644dc
34924 changed files with 3811102 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/**
* @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';
import { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { AttributeSelectorUpgradeData } from '../data/attribute-selectors';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every string literal, template and stylesheet
* in order to switch deprecated attribute selectors to the updated selector.
*/
export declare class AttributeSelectorsMigration extends Migration<UpgradeData> {
/** Required upgrade changes for specified target version. */
data: AttributeSelectorUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
visitTemplate(template: ResolvedResource): void;
visitStylesheet(stylesheet: ResolvedResource): void;
private _visitStringLiteralLike;
private _replaceSelector;
}

View File

@@ -0,0 +1,71 @@
"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.AttributeSelectorsMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every string literal, template and stylesheet
* in order to switch deprecated attribute selectors to the updated selector.
*/
class AttributeSelectorsMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Required upgrade changes for specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'attributeSelectors');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isStringLiteralLike(node)) {
this._visitStringLiteralLike(node);
}
}
visitTemplate(template) {
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(template.content, selector.replace)
.map(offset => template.start + offset)
.forEach(start => this._replaceSelector(template.filePath, start, selector));
});
}
visitStylesheet(stylesheet) {
this.data.forEach(selector => {
const currentSelector = `[${selector.replace}]`;
const updatedSelector = `[${selector.replaceWith}]`;
(0, literal_1.findAllSubstringIndices)(stylesheet.content, currentSelector)
.map(offset => stylesheet.start + offset)
.forEach(start => this._replaceSelector(stylesheet.filePath, start, {
replace: currentSelector,
replaceWith: updatedSelector,
}));
});
}
_visitStringLiteralLike(literal) {
if (literal.parent && literal.parent.kind !== ts.SyntaxKind.CallExpression) {
return;
}
const literalText = literal.getText();
const filePath = this.fileSystem.resolve(literal.getSourceFile().fileName);
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(literalText, selector.replace)
.map(offset => literal.getStart() + offset)
.forEach(start => this._replaceSelector(filePath, start, selector));
});
}
_replaceSelector(filePath, start, data) {
this.fileSystem
.edit(filePath)
.remove(start, data.replace.length)
.insertRight(start, data.replaceWith);
}
}
exports.AttributeSelectorsMigration = AttributeSelectorsMigration;
//# sourceMappingURL=attribute-selectors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"attribute-selectors.js","sourceRoot":"","sources":["attribute-selectors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AAGjC,2DAAsD;AAEtD,mDAA8D;AAC9D,kDAAmE;AAEnE;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,qBAAsB;IAAvE;;QACE,6DAA6D;QAC7D,SAAI,GAAG,IAAA,oCAAqB,EAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QAEzD,2DAA2D;QAC3D,YAAO,GAAY,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAyD5C,CAAC;IAvDU,SAAS,CAAC,IAAa;QAC9B,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAEQ,aAAa,CA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,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC;QAE3E,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,IAAA,iCAAuB,EAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC;iBACnD,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC;iBAC1C,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,gBAAgB,CACtB,QAAuB,EACvB,KAAa,EACb,IAAkC;QAElC,IAAI,CAAC,UAAU;aACZ,IAAI,CAAC,QAAQ,CAAC;aACd,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;aAClC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;CACF;AA9DD,kEA8DC"}

View File

@@ -0,0 +1,26 @@
/**
* @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';
import { Migration } from '../../update-tool/migration';
import { PropertyNameUpgradeData } from '../data/property-names';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that identifies class declarations that extend CDK or Material classes
* which had a public property change.
*/
export declare class ClassInheritanceMigration extends Migration<UpgradeData> {
/**
* Map of classes that have been updated. Each class name maps to the according property
* change data.
*/
propertyNames: Map<string, PropertyNameUpgradeData>;
enabled: boolean;
init(): void;
visitNode(node: ts.Node): void;
private _visitClassDeclaration;
}

View File

@@ -0,0 +1,58 @@
"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.ClassInheritanceMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const base_types_1 = require("../typescript/base-types");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that identifies class declarations that extend CDK or Material classes
* which had a public property change.
*/
class ClassInheritanceMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/**
* Map of classes that have been updated. Each class name maps to the according property
* change data.
*/
this.propertyNames = new Map();
// Only enable the migration rule if there is upgrade data.
this.enabled = this.propertyNames.size !== 0;
}
init() {
(0, upgrade_data_1.getVersionUpgradeData)(this, 'propertyNames')
.filter(data => data.limitedTo && data.limitedTo.classes)
.forEach(data => data.limitedTo.classes.forEach(name => this.propertyNames.set(name, data)));
}
visitNode(node) {
if (ts.isClassDeclaration(node)) {
this._visitClassDeclaration(node);
}
}
_visitClassDeclaration(node) {
const baseTypes = (0, base_types_1.determineBaseTypes)(node);
const className = node.name ? node.name.text : '{unknown-name}';
if (!baseTypes) {
return;
}
baseTypes.forEach(typeName => {
const data = this.propertyNames.get(typeName);
if (data) {
this.createFailureAtNode(node, `Found class "${className}" which extends class ` +
`"${typeName}". Please note that the base class property ` +
`"${data.replace}" has changed to "${data.replaceWith}". ` +
`You may need to update your class as well.`);
}
});
}
}
exports.ClassInheritanceMigration = ClassInheritanceMigration;
//# sourceMappingURL=class-inheritance.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"class-inheritance.js","sourceRoot":"","sources":["class-inheritance.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AACjC,2DAAsD;AAEtD,yDAA4D;AAC5D,kDAAmE;AAEnE;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,qBAAsB;IAArE;;QACE;;;WAGG;QACH,kBAAa,GAAG,IAAI,GAAG,EAAmC,CAAC;QAE3D,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,CAAC;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A4CC"}

View File

@@ -0,0 +1,32 @@
/**
* @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';
import { Migration } from '../../update-tool/migration';
import { ClassNameUpgradeData } from '../data';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every identifier that is part of Angular Material or thr CDK
* and replaces the outdated name with the new one if specified in the upgrade data.
*/
export declare class ClassNamesMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: ClassNameUpgradeData[];
/**
* List of identifier names that have been imported from `@angular/material` or `@angular/cdk`
* in the current source file and therefore can be considered trusted.
*/
trustedIdentifiers: Set<string>;
/** List of namespaces that have been imported from `@angular/material` or `@angular/cdk`. */
trustedNamespaces: Set<string>;
enabled: boolean;
visitNode(node: ts.Node): void;
/** Method that is called for every identifier inside of the specified project. */
private _visitIdentifier;
/** Creates a failure and replacement for the specified identifier. */
private _createFailureWithReplacement;
}

View File

@@ -0,0 +1,91 @@
"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.ClassNamesMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const imports_1 = require("../typescript/imports");
const module_specifiers_1 = require("../typescript/module-specifiers");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every identifier that is part of Angular Material or thr CDK
* and replaces the outdated name with the new one if specified in the upgrade data.
*/
// TODO: rework this rule to identify symbols using the import identifier resolver. This
// makes it more robust, less AST convoluted and is more TypeScript AST idiomatic. COMP-300.
class ClassNamesMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'classNames');
/**
* List of identifier names that have been imported from `@angular/material` or `@angular/cdk`
* in the current source file and therefore can be considered trusted.
*/
this.trustedIdentifiers = new Set();
/** List of namespaces that have been imported from `@angular/material` or `@angular/cdk`. */
this.trustedNamespaces = new Set();
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isIdentifier(node)) {
this._visitIdentifier(node);
}
}
/** Method that is called for every identifier inside of the specified project. */
_visitIdentifier(identifier) {
// For identifiers that aren't listed in the className data, the whole check can be
// skipped safely.
if (!this.data.some(data => data.replace === identifier.text)) {
return;
}
// For namespace imports that are referring to Angular Material or the CDK, we store the
// namespace name in order to be able to safely find identifiers that don't belong to the
// developer's application.
if ((0, imports_1.isNamespaceImportNode)(identifier) && (0, module_specifiers_1.isMaterialImportDeclaration)(identifier)) {
this.trustedNamespaces.add(identifier.text);
return this._createFailureWithReplacement(identifier);
}
// For export declarations that are referring to Angular Material or the CDK, the identifier
// can be immediately updated to the new name.
if ((0, imports_1.isExportSpecifierNode)(identifier) && (0, module_specifiers_1.isMaterialExportDeclaration)(identifier)) {
return this._createFailureWithReplacement(identifier);
}
// For import declarations that are referring to Angular Material or the CDK, the name of
// the import identifiers. This allows us to identify identifiers that belong to Material and
// the CDK, and we won't accidentally touch a developer's identifier.
if ((0, imports_1.isImportSpecifierNode)(identifier) && (0, module_specifiers_1.isMaterialImportDeclaration)(identifier)) {
this.trustedIdentifiers.add(identifier.text);
return this._createFailureWithReplacement(identifier);
}
// In case the identifier is part of a property access expression, we need to verify that the
// property access originates from a namespace that has been imported from Material or the CDK.
if (ts.isPropertyAccessExpression(identifier.parent)) {
const expression = identifier.parent.expression;
if (ts.isIdentifier(expression) && this.trustedNamespaces.has(expression.text)) {
return this._createFailureWithReplacement(identifier);
}
}
else if (this.trustedIdentifiers.has(identifier.text)) {
return this._createFailureWithReplacement(identifier);
}
}
/** Creates a failure and replacement for the specified identifier. */
_createFailureWithReplacement(identifier) {
const classData = this.data.find(data => data.replace === identifier.text);
const filePath = this.fileSystem.resolve(identifier.getSourceFile().fileName);
this.fileSystem
.edit(filePath)
.remove(identifier.getStart(), identifier.getWidth())
.insertRight(identifier.getStart(), classData.replaceWith);
}
}
exports.ClassNamesMigration = ClassNamesMigration;
//# sourceMappingURL=class-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"class-names.js","sourceRoot":"","sources":["class-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AACjC,2DAAsD;AAGtD,mDAI+B;AAC/B,uEAGyC;AACzC,kDAAmE;AAEnE;;;GAGG;AACH,wFAAwF;AACxF,4FAA4F;AAC5F,MAAa,mBAAoB,SAAQ,qBAAsB;IAA/D;;QACE,iEAAiE;QACjE,SAAI,GAA2B,IAAA,oCAAqB,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAEzE;;;WAGG;QACH,uBAAkB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAE5C,6FAA6F;QAC7F,sBAAiB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAE3C,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IA+DnC,CAAC;IA7DU,SAAS,CAAC,IAAa;QAC9B,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,kFAAkF;IAC1E,gBAAgB,CAAC,UAAyB;QAChD,mFAAmF;QACnF,kBAAkB;QAClB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9D,OAAO;QACT,CAAC;QAED,wFAAwF;QACxF,yFAAyF;QACzF,2BAA2B;QAC3B,IAAI,IAAA,+BAAqB,EAAC,UAAU,CAAC,IAAI,IAAA,+CAA2B,EAAC,UAAU,CAAC,EAAE,CAAC;YACjF,IAAI,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AAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,IAAI,CAAE,CAAC;QAC5E,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC;QAE9E,IAAI,CAAC,UAAU;aACZ,IAAI,CAAC,QAAQ,CAAC;aACd,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC;aACpD,WAAW,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/D,CAAC;CACF;AA7ED,kDA6EC"}

View File

@@ -0,0 +1,29 @@
/**
* @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';
import { Migration } from '../../update-tool/migration';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that visits every TypeScript new expression or super call and checks if
* the parameter type signature is invalid and needs to be updated manually.
*/
export declare class ConstructorSignatureMigration extends Migration<UpgradeData> {
data: string[];
enabled: boolean;
visitNode(node: ts.Node): void;
/**
* Method that will be called for each source file of the upgrade project. In order to
* properly determine invalid constructor signatures, we take advantage of the pre-emit
* diagnostics from TypeScript.
*
* By using the diagnostics, the migration can handle type assignability. Not using
* diagnostics would mean that we need to use simple type equality checking which is
* too strict. See related issue: https://github.com/Microsoft/TypeScript/issues/9879
*/
private _visitSourceFile;
}

View File

@@ -0,0 +1,139 @@
"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.ConstructorSignatureMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const version_changes_1 = require("../../update-tool/version-changes");
/**
* List of diagnostic codes that refer to pre-emit diagnostics which indicate invalid
* new expression or super call signatures. See the list of diagnostics here:
*
* https://github.com/Microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
*/
const signatureErrorDiagnostics = [
// Type not assignable error diagnostic.
2345,
// Constructor argument length invalid diagnostics
2554, 2555, 2556, 2557,
];
/**
* Migration that visits every TypeScript new expression or super call and checks if
* the parameter type signature is invalid and needs to be updated manually.
*/
class ConstructorSignatureMigration extends migration_1.Migration {
constructor() {
super(...arguments);
// Note that the data for this rule is not distinguished based on the target version because
// we don't keep track of the new signature and don't want to update incrementally.
// See: https://github.com/angular/components/pull/12970#issuecomment-418337566
this.data = (0, version_changes_1.getAllChanges)(this.upgradeData.constructorChecks);
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isSourceFile(node)) {
this._visitSourceFile(node);
}
}
/**
* Method that will be called for each source file of the upgrade project. In order to
* properly determine invalid constructor signatures, we take advantage of the pre-emit
* diagnostics from TypeScript.
*
* By using the diagnostics, the migration can handle type assignability. Not using
* diagnostics would mean that we need to use simple type equality checking which is
* too strict. See related issue: https://github.com/Microsoft/TypeScript/issues/9879
*/
_visitSourceFile(sourceFile) {
// List of classes of which the constructor signature has changed.
const diagnostics = ts
.getPreEmitDiagnostics(this.program, sourceFile)
.filter(diagnostic => signatureErrorDiagnostics.includes(diagnostic.code))
.filter(diagnostic => diagnostic.start !== undefined);
for (const diagnostic of diagnostics) {
const node = findConstructorNode(diagnostic, sourceFile);
if (!node) {
continue;
}
const classType = this.typeChecker.getTypeAtLocation(node.expression);
const className = classType.symbol && classType.symbol.name;
const isNewExpression = ts.isNewExpression(node);
// Determine the class names of the actual construct signatures because we cannot assume that
// the diagnostic refers to a constructor of the actual expression. In case the constructor
// is inherited, we need to detect that the owner-class of the constructor is added to the
// constructor checks upgrade data. e.g. `class CustomCalendar extends MatCalendar {}`.
const signatureClassNames = classType
.getConstructSignatures()
.map(signature => getClassDeclarationOfSignature(signature))
.map(declaration => (declaration && declaration.name ? declaration.name.text : null))
.filter(Boolean);
// Besides checking the signature class names, we need to check the actual class name because
// there can be classes without an explicit constructor.
if (!this.data.includes(className) &&
!signatureClassNames.some(name => this.data.includes(name))) {
continue;
}
const classSignatures = classType
.getConstructSignatures()
.map(signature => getParameterTypesFromSignature(signature, this.typeChecker));
const expressionName = isNewExpression ? `new ${className}` : 'super';
const signatures = classSignatures
.map(signature => signature.map(t => (t === null ? 'any' : this.typeChecker.typeToString(t))))
.map(signature => `${expressionName}(${signature.join(', ')})`)
.join(' or ');
this.createFailureAtNode(node, `Found "${className}" constructed with ` +
`an invalid signature. Please manually update the ${expressionName} expression to ` +
`match the new signature${classSignatures.length > 1 ? 's' : ''}: ${signatures}`);
}
}
}
exports.ConstructorSignatureMigration = ConstructorSignatureMigration;
/** Resolves the type for each parameter in the specified signature. */
function getParameterTypesFromSignature(signature, typeChecker) {
return signature
.getParameters()
.map(param => param.declarations ? typeChecker.getTypeAtLocation(param.declarations[0]) : null);
}
/**
* Walks through each node of a source file in order to find a new-expression node or super-call
* expression node that is captured by the specified diagnostic.
*/
function findConstructorNode(diagnostic, sourceFile) {
let resolvedNode = null;
const _visitNode = (node) => {
// Check whether the current node contains the diagnostic. If the node contains the diagnostic,
// walk deeper in order to find all constructor expression nodes.
if (node.getStart() <= diagnostic.start && node.getEnd() >= diagnostic.start) {
if (ts.isNewExpression(node) ||
(ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.SuperKeyword)) {
resolvedNode = node;
}
ts.forEachChild(node, _visitNode);
}
};
ts.forEachChild(sourceFile, _visitNode);
return resolvedNode;
}
/** Determines the class declaration of the specified construct signature. */
function getClassDeclarationOfSignature(signature) {
let node = signature.getDeclaration();
// Handle signatures which don't have an actual declaration. This happens if a class
// does not have an explicitly written constructor.
if (!node) {
return null;
}
while (!ts.isSourceFile((node = node.parent))) {
if (ts.isClassDeclaration(node)) {
return node;
}
}
return null;
}
//# sourceMappingURL=constructor-signature.js.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AAC;gBACxB,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAClF,CAAC;gBACD,YAAY,GAAG,IAAI,CAAC;YACtB,CAAC;YAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACpC,CAAC;IACH,CAAC,CAAC;IAEF,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAExC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,6EAA6E;AAC7E,SAAS,8BAA8B,CAAC,SAAuB;IAC7D,IAAI,IAAI,GAAY,SAAS,CAAC,cAAc,EAAE,CAAC;IAC/C,oFAAoF;IACpF,mDAAmD;IACnD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC9C,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}

View File

@@ -0,0 +1,26 @@
/**
* @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';
import { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { CssSelectorUpgradeData } from '../data/css-selectors';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every string literal, template and stylesheet in
* order to migrate outdated CSS selectors to the new selector.
*/
export declare class CssSelectorsMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: CssSelectorUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
visitTemplate(template: ResolvedResource): void;
visitStylesheet(stylesheet: ResolvedResource): void;
private _visitStringLiteralLike;
private _replaceSelector;
}

View File

@@ -0,0 +1,75 @@
"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.CssSelectorsMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every string literal, template and stylesheet in
* order to migrate outdated CSS selectors to the new selector.
*/
class CssSelectorsMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'cssSelectors');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isStringLiteralLike(node)) {
this._visitStringLiteralLike(node);
}
}
visitTemplate(template) {
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.html) {
return;
}
(0, literal_1.findAllSubstringIndices)(template.content, data.replace)
.map(offset => template.start + offset)
.forEach(start => this._replaceSelector(template.filePath, start, data));
});
}
visitStylesheet(stylesheet) {
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.stylesheet) {
return;
}
(0, literal_1.findAllSubstringIndices)(stylesheet.content, data.replace)
.map(offset => stylesheet.start + offset)
.forEach(start => this._replaceSelector(stylesheet.filePath, start, data));
});
}
_visitStringLiteralLike(node) {
if (node.parent && node.parent.kind !== ts.SyntaxKind.CallExpression) {
return;
}
const textContent = node.getText();
const filePath = this.fileSystem.resolve(node.getSourceFile().fileName);
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.tsStringLiterals) {
return;
}
(0, literal_1.findAllSubstringIndices)(textContent, data.replace)
.map(offset => node.getStart() + offset)
.forEach(start => this._replaceSelector(filePath, start, data));
});
}
_replaceSelector(filePath, start, data) {
this.fileSystem
.edit(filePath)
.remove(start, data.replace.length)
.insertRight(start, data.replaceWith);
}
}
exports.CssSelectorsMigration = CssSelectorsMigration;
//# sourceMappingURL=css-selectors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css-selectors.js","sourceRoot":"","sources":["css-selectors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AAGjC,2DAAsD;AAEtD,mDAA8D;AAC9D,kDAAmE;AAEnE;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,qBAAsB;IAAjE;;QACE,iEAAiE;QACjE,SAAI,GAA6B,IAAA,oCAAqB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAE7E,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAyDnC,CAAC;IAvDU,SAAS,CAAC,IAAa;QAC9B,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAEQ,aAAa,CAAC,QAA0B;QAC/C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;gBAC3C,OAAO;YACT,CAAC;YAED,IAAA,iCAAuB,EAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;iBACpD,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC;iBACtC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;IACL,CAAC;IAEQ,eAAe,CA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AAK,EAAE,IAAI,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,gBAAgB,CAAC,QAAuB,EAAE,KAAa,EAAE,IAA4B;QAC3F,IAAI,CAAC,UAAU;aACZ,IAAI,CAAC,QAAQ,CAAC;aACd,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;aAClC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;CACF;AA9DD,sDA8DC"}

View File

@@ -0,0 +1,26 @@
/**
* @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';
import { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { CssTokenUpgradeData } from '../data/css-tokens';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every string literal, template and stylesheet in
* order to migrate outdated CSS tokens to their new name.
*/
export declare class CssTokensMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: CssTokenUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
visitTemplate(template: ResolvedResource): void;
visitStylesheet(stylesheet: ResolvedResource): void;
private _visitStringLiteralLike;
private _replaceSelector;
}

View File

@@ -0,0 +1,83 @@
"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.CssTokensMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/** Characters that can be part of a valid token name. */
const TOKEN_CHARACTER = /[-_a-z0-9]/i;
/**
* Migration that walks through every string literal, template and stylesheet in
* order to migrate outdated CSS tokens to their new name.
*/
class CssTokensMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'cssTokens');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isStringLiteralLike(node)) {
this._visitStringLiteralLike(node);
}
}
visitTemplate(template) {
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.html) {
return;
}
(0, literal_1.findAllSubstringIndices)(template.content, data.replace)
.map(offset => template.start + offset)
// Filter out matches that are followed by a valid token character, so that we don't match
// partial token names.
.filter(start => !TOKEN_CHARACTER.test(template.content[start + data.replace.length] || ''))
.forEach(start => this._replaceSelector(template.filePath, start, data));
});
}
visitStylesheet(stylesheet) {
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.stylesheet) {
return;
}
(0, literal_1.findAllSubstringIndices)(stylesheet.content, data.replace)
.map(offset => stylesheet.start + offset)
// Filter out matches that are followed by a valid token character, so that we don't match
// partial token names.
.filter(start => !TOKEN_CHARACTER.test(stylesheet.content[start + data.replace.length] || ''))
.forEach(start => this._replaceSelector(stylesheet.filePath, start, data));
});
}
_visitStringLiteralLike(node) {
const textContent = node.getText();
const filePath = this.fileSystem.resolve(node.getSourceFile().fileName);
this.data.forEach(data => {
if (data.replaceIn && !data.replaceIn.tsStringLiterals) {
return;
}
(0, literal_1.findAllSubstringIndices)(textContent, data.replace)
.map(offset => node.getStart() + offset)
// Filter out matches that are followed by a valid token character, so that we don't match
// partial token names.
.filter(start => !TOKEN_CHARACTER.test(textContent[start + data.replace.length] || ''))
.forEach(start => this._replaceSelector(filePath, start, data));
});
}
_replaceSelector(filePath, start, data) {
this.fileSystem
.edit(filePath)
.remove(start, data.replace.length)
.insertRight(start, data.replaceWith);
}
}
exports.CssTokensMigration = CssTokensMigration;
//# sourceMappingURL=css-tokens.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css-tokens.js","sourceRoot":"","sources":["css-tokens.ts"],"names":[],"mappings":";AAAA;;;;;;GAM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M,CAAC;gBACxC,0FAA0F;gBAC1F,uBAAuB;iBACtB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;iBACtF,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,gBAAgB,CAAC,QAAuB,EAAE,KAAa,EAAE,IAAyB;QACxF,IAAI,CAAC,UAAU;aACZ,IAAI,CAAC,QAAQ,CAAC;aACd,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;aAClC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;CACF;AArED,gDAqEC"}

View File

@@ -0,0 +1,26 @@
/**
* @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';
import { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { ElementSelectorUpgradeData } from '../data/element-selectors';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every string literal, template and stylesheet in order
* to migrate outdated element selectors to the new one.
*/
export declare class ElementSelectorsMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: ElementSelectorUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
visitTemplate(template: ResolvedResource): void;
visitStylesheet(stylesheet: ResolvedResource): void;
private _visitStringLiteralLike;
private _replaceSelector;
}

View File

@@ -0,0 +1,66 @@
"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.ElementSelectorsMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every string literal, template and stylesheet in order
* to migrate outdated element selectors to the new one.
*/
class ElementSelectorsMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'elementSelectors');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isStringLiteralLike(node)) {
this._visitStringLiteralLike(node);
}
}
visitTemplate(template) {
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(template.content, selector.replace)
.map(offset => template.start + offset)
.forEach(start => this._replaceSelector(template.filePath, start, selector));
});
}
visitStylesheet(stylesheet) {
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(stylesheet.content, selector.replace)
.map(offset => stylesheet.start + offset)
.forEach(start => this._replaceSelector(stylesheet.filePath, start, selector));
});
}
_visitStringLiteralLike(node) {
if (node.parent && node.parent.kind !== ts.SyntaxKind.CallExpression) {
return;
}
const textContent = node.getText();
const filePath = this.fileSystem.resolve(node.getSourceFile().fileName);
this.data.forEach(selector => {
(0, literal_1.findAllSubstringIndices)(textContent, selector.replace)
.map(offset => node.getStart() + offset)
.forEach(start => this._replaceSelector(filePath, start, selector));
});
}
_replaceSelector(filePath, start, data) {
this.fileSystem
.edit(filePath)
.remove(start, data.replace.length)
.insertRight(start, data.replaceWith);
}
}
exports.ElementSelectorsMigration = ElementSelectorsMigration;
//# sourceMappingURL=element-selectors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"element-selectors.js","sourceRoot":"","sources":["element-selectors.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AAGjC,2DAAsD;AAEtD,mDAA8D;AAC9D,kDAAmE;AAEnE;;;GA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,CAAC,IAA0B;QACxD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;YACrE,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC;QAExE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,IAAA,iCAAuB,EAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC;iBACnD,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC;iBACvC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,gBAAgB,CACtB,QAAuB,EACvB,KAAa,EACb,IAAgC;QAEhC,IAAI,CAAC,UAAU;aACZ,IAAI,CAAC,QAAQ,CAAC;aACd,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;aAClC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;CACF;AAtDD,8DAsDC"}

View File

@@ -0,0 +1,26 @@
/**
* @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 { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { InputNameUpgradeData } from '../data';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every template or stylesheet and replaces outdated input
* names to the new input name. Selectors in stylesheets could also target input
* bindings declared as static attribute. See for example:
*
* e.g. `<my-component color="primary">` becomes `my-component[color]`
*/
export declare class InputNamesMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: InputNameUpgradeData[];
enabled: boolean;
visitStylesheet(stylesheet: ResolvedResource): void;
visitTemplate(template: ResolvedResource): void;
private _replaceInputName;
}

View File

@@ -0,0 +1,59 @@
"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.InputNamesMigration = void 0;
const angular_1 = require("../html-parsing/angular");
const migration_1 = require("../../update-tool/migration");
const literal_1 = require("../typescript/literal");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every template or stylesheet and replaces outdated input
* names to the new input name. Selectors in stylesheets could also target input
* bindings declared as static attribute. See for example:
*
* e.g. `<my-component color="primary">` becomes `my-component[color]`
*/
class InputNamesMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'inputNames');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitStylesheet(stylesheet) {
this.data.forEach(name => {
const currentSelector = `[${name.replace}]`;
const updatedSelector = `[${name.replaceWith}]`;
(0, literal_1.findAllSubstringIndices)(stylesheet.content, currentSelector)
.map(offset => stylesheet.start + offset)
.forEach(start => this._replaceInputName(stylesheet.filePath, start, currentSelector.length, updatedSelector));
});
}
visitTemplate(template) {
this.data.forEach(name => {
const limitedTo = name.limitedTo;
const relativeOffsets = [];
if (limitedTo.attributes) {
relativeOffsets.push(...(0, angular_1.findInputsOnElementWithAttr)(template.content, name.replace, limitedTo.attributes));
}
if (limitedTo.elements) {
relativeOffsets.push(...(0, angular_1.findInputsOnElementWithTag)(template.content, name.replace, limitedTo.elements));
}
relativeOffsets
.map(offset => template.start + offset)
.forEach(start => this._replaceInputName(template.filePath, start, name.replace.length, name.replaceWith));
});
}
_replaceInputName(filePath, start, width, newName) {
this.fileSystem.edit(filePath).remove(start, width).insertRight(start, newName);
}
}
exports.InputNamesMigration = InputNamesMigration;
//# sourceMappingURL=input-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"input-names.js","sourceRoot":"","sources":["input-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH,qDAAgG;AAEhG,2DAAsD;AAGtD,mDAA8D;AAC9D,kDAAmE;AAEnE;;;;;;GAMG;AACH,MAAa,mBAAoB,SAAQ,qBAAsB;IAA/D;;QACE,iEAAiE;QACjE,SAAI,GAA2B,IAAA,oCAAqB,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAEzE,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAqDnC,CAAC;IAnDU,eAAe,CAAC,UAA4B;QACnD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC;YAC5C,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC;YAEhD,IAAA,iCAAuB,EAAC,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC;iBACzD,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC;iBACxC,OAAO,CAAC,KAAK,CAAC,EAAE,CACf,IAAI,CAAC,iBAAiB,CACpB,UAAU,CAAC,QAAQ,EACnB,KAAK,EACL,eAAe,CAAC,MAAM,EACtB,eAAe,CAChB,CACF,CAAC;QACN,CAAC,CAAC,CAAC;IACL,CAAC;IAEQ,aAAa,CAAC,QAA0B;QAC/C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YACjC,MAAM,eAAe,GAAa,EAAE,CAAC;YAErC,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;gBACzB,eAAe,CAAC,IAAI,CAClB,GAAG,IAAA,qCAA2B,EAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,CACrF,CAAC;YACJ,CAAC;YAED,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;gBACvB,eAAe,CAAC,IAAI,CAClB,GAAG,IAAA,oCAA0B,EAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,CAClF,CAAC;YACJ,CAAC;YAED,eAAe;iBACZ,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC;iBACtC,OAAO,CAAC,KAAK,CAAC,EAAE,CACf,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CACxF,CAAC;QACN,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB,CACvB,QAAuB,EACvB,KAAa,EACb,KAAa,EACb,OAAe;QAEf,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;CACF;AA1DD,kDA0DC"}

View File

@@ -0,0 +1,22 @@
/**
* @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';
import { Migration } from '../../update-tool/migration';
import { MethodCallUpgradeData } from '../data';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that visits every TypeScript method call expression and checks if the
* argument count is invalid and needs to be *manually* updated.
*/
export declare class MethodCallArgumentsMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: MethodCallUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
private _checkPropertyAccessMethodCall;
}

View File

@@ -0,0 +1,62 @@
"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.MethodCallArgumentsMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that visits every TypeScript method call expression and checks if the
* argument count is invalid and needs to be *manually* updated.
*/
class MethodCallArgumentsMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'methodCallChecks');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {
this._checkPropertyAccessMethodCall(node);
}
}
_checkPropertyAccessMethodCall(node) {
const propertyAccess = node.expression;
if (!ts.isIdentifier(propertyAccess.name)) {
return;
}
const hostType = this.typeChecker.getTypeAtLocation(propertyAccess.expression);
const hostTypeName = hostType.symbol && hostType.symbol.name;
const methodName = propertyAccess.name.text;
if (!hostTypeName) {
return;
}
// TODO(devversion): Revisit the implementation of this upgrade rule. It seems difficult
// and ambiguous to maintain the data for this rule. e.g. consider a method which has the
// same amount of arguments but just had a type change. In that case we could still add
// new entries to the upgrade data that match the current argument length to just show
// a failure message, but adding that data becomes painful if the method has optional
// parameters and it would mean that the error message would always show up, even if the
// argument is in some cases still assignable to the new parameter type. We could re-use
// the logic we have in the constructor-signature checks to check for assignability and
// to make the upgrade data less verbose.
const failure = this.data
.filter(data => data.method === methodName && data.className === hostTypeName)
.map(data => data.invalidArgCounts.find(f => f.count === node.arguments.length))[0];
if (!failure) {
return;
}
this.createFailureAtNode(node, `Found call to "${hostTypeName + '.' + methodName}" ` +
`with ${failure.count} arguments. Message: ${failure.message}`);
}
}
exports.MethodCallArgumentsMigration = MethodCallArgumentsMigration;
//# sourceMappingURL=method-call-arguments.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"method-call-arguments.js","sourceRoot":"","sources":["method-call-arguments.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AACjC,2DAAsD;AAGtD,kDAAmE;AAEnE;;;GAGG;AACH,MAAa,4BAA6B,SAAQ,qBAAsB;IAAxE;;QACE,iEAAiE;QACjE,SAAI,GAA4B,IAAA,oCAAqB,EAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;QAEhF,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IA8CnC,CAAC;IA5CU,SAAS,CAAC,IAAa;QAC9B,IAAI,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAChF,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAEO,8BAA8B,CAAC,IAAuB;QAC5D,MAAM,cAAc,GAAG,IAAI,CAAC,UAAyC,CAAC;QAEtE,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAC/E,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;QAC7D,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;QAE5C,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,wFAAwF;QACxF,yFAAyF;QACzF,uFAAuF;QACvF,sFAAsF;QACtF,qFAAqF;QACrF,wFAAwF;QACxF,wFAAwF;QACxF,uFAAuF;QACvF,yCAAyC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI;aACtB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,IAAI,CAAC,SAAS,KAAK,YAAY,CAAC;aAC7E,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QAED,IAAI,CAAC,mBAAmB,CACtB,IAAI,EACJ,kBAAkB,YAAY,GAAG,GAAG,GAAG,UAAU,IAAI;YACnD,QAAQ,OAAO,CAAC,KAAK,wBAAwB,OAAO,CAAC,OAAO,EAAE,CACjE,CAAC;IACJ,CAAC;CACF;AAnDD,oEAmDC"}

View File

@@ -0,0 +1,18 @@
/**
* @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 { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every template and reports if there are
* instances of outdated Angular CDK API that can't be migrated automatically.
*/
export declare class MiscTemplateMigration extends Migration<UpgradeData> {
enabled: boolean;
visitTemplate(template: ResolvedResource): void;
}

View File

@@ -0,0 +1,25 @@
"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.MiscTemplateMigration = void 0;
const migration_1 = require("../../update-tool/migration");
/**
* Migration that walks through every template and reports if there are
* instances of outdated Angular CDK API that can't be migrated automatically.
*/
class MiscTemplateMigration extends migration_1.Migration {
constructor() {
super(...arguments);
// There are currently no migrations for V19 deprecations.
this.enabled = false;
}
visitTemplate(template) { }
}
exports.MiscTemplateMigration = MiscTemplateMigration;
//# sourceMappingURL=misc-template.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"misc-template.js","sourceRoot":"","sources":["misc-template.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH,2DAAsD;AAGtD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,qBAAsB;IAAjE;;QACE,0DAA0D;QAC1D,YAAO,GAAG,KAAK,CAAC;IAGlB,CAAC;IADU,aAAa,CAAC,QAA0B,IAAS,CAAC;CAC5D;AALD,sDAKC"}

View File

@@ -0,0 +1,22 @@
/**
* @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 { ResolvedResource } from '../../update-tool/component-resource-collector';
import { Migration } from '../../update-tool/migration';
import { OutputNameUpgradeData } from '../data';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every inline or external HTML template and switches
* changed output binding names to the proper new output name.
*/
export declare class OutputNamesMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: OutputNameUpgradeData[];
enabled: boolean;
visitTemplate(template: ResolvedResource): void;
private _replaceOutputName;
}

View File

@@ -0,0 +1,46 @@
"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.OutputNamesMigration = void 0;
const migration_1 = require("../../update-tool/migration");
const angular_1 = require("../html-parsing/angular");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every inline or external HTML template and switches
* changed output binding names to the proper new output name.
*/
class OutputNamesMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'outputNames');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitTemplate(template) {
this.data.forEach(name => {
const limitedTo = name.limitedTo;
const relativeOffsets = [];
if (limitedTo.attributes) {
relativeOffsets.push(...(0, angular_1.findOutputsOnElementWithAttr)(template.content, name.replace, limitedTo.attributes));
}
if (limitedTo.elements) {
relativeOffsets.push(...(0, angular_1.findOutputsOnElementWithTag)(template.content, name.replace, limitedTo.elements));
}
relativeOffsets
.map(offset => template.start + offset)
.forEach(start => this._replaceOutputName(template.filePath, start, name.replace.length, name.replaceWith));
});
}
_replaceOutputName(filePath, start, width, newName) {
this.fileSystem.edit(filePath).remove(start, width).insertRight(start, newName);
}
}
exports.OutputNamesMigration = OutputNamesMigration;
//# sourceMappingURL=output-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"output-names.js","sourceRoot":"","sources":["output-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,2DAAsD;AAGtD,qDAAkG;AAClG,kDAAmE;AAEnE;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,qBAAsB;IAAhE;;QACE,iEAAiE;QACjE,SAAI,GAA4B,IAAA,oCAAqB,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAE3E,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAmCnC,CAAC;IAjCU,aAAa,CAAC,QAA0B;QAC/C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YACjC,MAAM,eAAe,GAAa,EAAE,CAAC;YAErC,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;gBACzB,eAAe,CAAC,IAAI,CAClB,GAAG,IAAA,sCAA4B,EAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,CACtF,CAAC;YACJ,CAAC;YAED,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;gBACvB,eAAe,CAAC,IAAI,CAClB,GAAG,IAAA,qCAA2B,EAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,CACnF,CAAC;YACJ,CAAC;YAED,eAAe;iBACZ,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC;iBACtC,OAAO,CAAC,KAAK,CAAC,EAAE,CACf,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CACzF,CAAC;QACN,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,kBAAkB,CACxB,QAAuB,EACvB,KAAa,EACb,KAAa,EACb,OAAe;QAEf,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;CACF;AAxCD,oDAwCC"}

View File

@@ -0,0 +1,22 @@
/**
* @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';
import { Migration } from '../../update-tool/migration';
import { PropertyNameUpgradeData } from '../data';
import { UpgradeData } from '../upgrade-data';
/**
* Migration that walks through every property access expression and updates
* accessed properties that have been updated to a new name.
*/
export declare class PropertyNamesMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: PropertyNameUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
private _visitPropertyAccessExpression;
}

View File

@@ -0,0 +1,60 @@
"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.PropertyNamesMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const upgrade_data_1 = require("../upgrade-data");
/**
* Migration that walks through every property access expression and updates
* accessed properties that have been updated to a new name.
*/
class PropertyNamesMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'propertyNames');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (ts.isPropertyAccessExpression(node)) {
this._visitPropertyAccessExpression(node);
}
}
_visitPropertyAccessExpression(node) {
const hostType = this.typeChecker.getTypeAtLocation(node.expression);
const typeNames = [];
if (hostType) {
if (hostType.isIntersection()) {
hostType.types.forEach(type => {
if (type.symbol) {
typeNames.push(type.symbol.getName());
}
});
}
else if (hostType.symbol) {
typeNames.push(hostType.symbol.getName());
}
}
this.data.forEach(data => {
if (node.name.text !== data.replace) {
return;
}
if (!data.limitedTo || typeNames.some(type => data.limitedTo.classes.includes(type))) {
this.fileSystem
.edit(this.fileSystem.resolve(node.getSourceFile().fileName))
.remove(node.name.getStart(), node.name.getWidth())
.insertRight(node.name.getStart(), data.replaceWith);
}
});
}
}
exports.PropertyNamesMigration = PropertyNamesMigration;
//# sourceMappingURL=property-names.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"property-names.js","sourceRoot":"","sources":["property-names.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AACjC,2DAAsD;AAGtD,kDAAmE;AAEnE;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,qBAAsB;IAAlE;;QACE,iEAAiE;QACjE,SAAI,GAA8B,IAAA,oCAAqB,EAA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AC,EAAE,CAAC;gBACrF,IAAI,CAAC,UAAU;qBACZ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC;qBAC5D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;qBAClD,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YACzD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1CD,wDA0CC"}

View File

@@ -0,0 +1,18 @@
/**
* @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';
import { Migration } from '../../update-tool/migration';
import { SymbolRemovalUpgradeData } from '../data';
import { UpgradeData } from '../upgrade-data';
/** Migration that flags imports for symbols that have been removed. */
export declare class SymbolRemovalMigration extends Migration<UpgradeData> {
/** Change data that upgrades to the specified target version. */
data: SymbolRemovalUpgradeData[];
enabled: boolean;
visitNode(node: ts.Node): void;
}

View File

@@ -0,0 +1,47 @@
"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.SymbolRemovalMigration = void 0;
const ts = require("typescript");
const migration_1 = require("../../update-tool/migration");
const upgrade_data_1 = require("../upgrade-data");
/** Migration that flags imports for symbols that have been removed. */
class SymbolRemovalMigration extends migration_1.Migration {
constructor() {
super(...arguments);
/** Change data that upgrades to the specified target version. */
this.data = (0, upgrade_data_1.getVersionUpgradeData)(this, 'symbolRemoval');
// Only enable the migration rule if there is upgrade data.
this.enabled = this.data.length !== 0;
}
visitNode(node) {
if (!ts.isImportDeclaration(node) || !ts.isStringLiteral(node.moduleSpecifier)) {
return;
}
const namedBindings = node.importClause && node.importClause.namedBindings;
if (!namedBindings || !ts.isNamedImports(namedBindings)) {
return;
}
const moduleNameMatches = this.data.filter(entry => node.moduleSpecifier.text === entry.module);
if (!moduleNameMatches.length) {
return;
}
namedBindings.elements.forEach(element => {
var _a;
const elementName = ((_a = element.propertyName) === null || _a === void 0 ? void 0 : _a.text) || element.name.text;
moduleNameMatches.forEach(match => {
if (match.name === elementName) {
this.createFailureAtNode(element, match.message);
}
});
});
}
}
exports.SymbolRemovalMigration = SymbolRemovalMigration;
//# sourceMappingURL=symbol-removal.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"symbol-removal.js","sourceRoot":"","sources":["symbol-removal.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAiC;AACjC,2DAAsD;AAEtD,kDAAmE;AAEnE,uEAAuE;AACvE,MAAa,sBAAuB,SAAQ,qBAAsB;IAAlE;;QACE,iEAAiE;QACjE,SAAI,GAA+B,IAAA,oCAAqB,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAEhF,2DAA2D;QAC3D,YAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IA+BnC,CAAC;IA7BU,SAAS,CAAC,IAAa;QAC9B,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YAC/E,OAAO;QACT,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;QAE3E,IAAI,CAAC,aAAa,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC;YACxD,OAAO;QACT,CAAC;QAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CACxC,KAAK,CAAC,EAAE,CAAE,IAAI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