1 | {"version":3,"file":"ast-utils.js","sourceRoot":"","sources":["../../../../../modules/schematics/schematics-core/utility/ast-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B;;;;;;GAMG;AACH,+BAAiC;AACjC,mCAQkB;AAGlB;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,IAAa,EACb,IAAmB,EACnB,GAAc;;IAAd,oBAAA,EAAA,cAAc;IAEd,IAAI,CAAC,IAAI,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACvB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACf,GAAG,EAAE,CAAC;IACR,CAAC;IACD,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;;YACZ,KAAoB,IAAA,KAAA,SAAA,IAAI,CAAC,WAAW,EAAE,CAAA,gBAAA,4BAAE,CAAC;gBAApC,IAAM,KAAK,WAAA;gBACd,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI;oBACvC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;wBACZ,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACjB,CAAC;oBACD,GAAG,EAAE,CAAC;gBACR,CAAC,CAAC,CAAC;gBAEH,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;oBACb,MAAM;gBACR,CAAC;YACH,CAAC;;;;;;;;;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AA9BD,8BA8BC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,UAAyB;IACtD,IAAM,KAAK,GAAc,CAAC,UAAU,CAAC,CAAC;IACtC,IAAM,MAAM,GAAG,EAAE,CAAC;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IAAI,CAAC,IAAI,CAAC;gBAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,YAAY;QAF/B,CAE+B,CAClC,CACF,CAAC;AACJ,CAAC;AAbD,4CAaC","sourcesContent":["/* istanbul ignore file */\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport * as ts from 'typescript';\nimport {\n Change,\n InsertChange,\n NoopChange,\n createReplaceChange,\n ReplaceChange,\n RemoveChange,\n createRemoveChange,\n} from './change';\nimport { Path } from '@angular-devkit/core';\n\n/**\n * Find all nodes from the AST in the subtree of node of SyntaxKind kind.\n * @param node\n * @param kind\n * @param max The maximum number of items to return.\n * @return all nodes of kind, or [] if none is found\n */\nexport function findNodes(\n node: ts.Node,\n kind: ts.SyntaxKind,\n max = Infinity\n): ts.Node[] {\n if (!node || max == 0) {\n return [];\n }\n\n const arr: ts.Node[] = [];\n if (node.kind === kind) {\n arr.push(node);\n max--;\n }\n if (max > 0) {\n for (const child of node.getChildren()) {\n findNodes(child, kind, max).forEach((node) => {\n if (max > 0) {\n arr.push(node);\n }\n max--;\n });\n\n if (max <= 0) {\n break;\n }\n }\n }\n\n return arr;\n}\n\n/**\n * Get all the nodes from a source.\n * @param sourceFile The source file object.\n * @returns {Observable<ts.Node>} An observable of all the nodes in the source.\n */\nexport function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[] {\n const nodes: ts.Node[] = [sourceFile];\n const result = [];\n\n while (nodes.length > 0) {\n const node = nodes.shift();\n\n if (node) {\n result.push(node);\n if (node.getChildCount(sourceFile) >= 0) {\n nodes.unshift(...node.getChildren());\n }\n }\n }\n\n return result;\n}\n\n/**\n * Helper for sorting nodes.\n * @return function to sort nodes in increasing order of position in sourceFile\n */\nfunction nodesByPosition(first: ts.Node, second: ts.Node): number {\n return first.pos - second.pos;\n}\n\n/**\n * Insert `toInsert` after the last occurence of `ts.SyntaxKind[nodes[i].kind]`\n * or after the last of occurence of `syntaxKind` if the last occurence is a sub child\n * of ts.SyntaxKind[nodes[i].kind] and save the changes in file.\n *\n * @param nodes insert after the last occurence of nodes\n * @param toInsert string to insert\n * @param file file to insert changes into\n * @param fallbackPos position to insert if toInsert happens to be the first occurence\n * @param syntaxKind the ts.SyntaxKind of the subchildren to insert after\n * @return Change instance\n * @throw Error if toInsert is first occurence but fall back is not set\n */\nexport function insertAfterLastOccurrence(\n nodes: ts.Node[],\n toInsert: string,\n file: string,\n fallbackPos: number,\n syntaxKind?: ts.SyntaxKind\n): Change {\n let lastItem = nodes.sort(nodesByPosition).pop();\n if (!lastItem) {\n throw new Error();\n }\n if (syntaxKind) {\n lastItem = findNodes(lastItem, syntaxKind).sort(nodesByPosition).pop();\n }\n if (!lastItem && fallbackPos == undefined) {\n throw new Error(\n `tried to insert ${toInsert} as first occurence with no fallback position`\n );\n }\n const lastItemPosition: number = lastItem ? lastItem.end : fallbackPos;\n\n return new InsertChange(file, lastItemPosition, toInsert);\n}\n\nexport function getContentOfKeyLiteral(\n _source: ts.SourceFile,\n node: ts.Node\n): string | null {\n if (node.kind == ts.SyntaxKind.Identifier) {\n return (node as ts.Identifier).text;\n } else if (node.kind == ts.SyntaxKind.StringLiteral) {\n return (node as ts.StringLiteral).text;\n } else {\n return null;\n }\n}\n\nfunction _angularImportsFromNode(\n node: ts.ImportDeclaration,\n _sourceFile: ts.SourceFile\n): { [name: string]: string } {\n const ms = node.moduleSpecifier;\n let modulePath: string;\n switch (ms.kind) {\n case ts.SyntaxKind.StringLiteral:\n modulePath = (ms as ts.StringLiteral).text;\n break;\n default:\n return {};\n }\n\n if (!modulePath.startsWith('@angular/')) {\n return {};\n }\n\n if (node.importClause) {\n if (node.importClause.name) {\n // This is of the form `import Name from 'path'`. Ignore.\n return {};\n } else if (node.importClause.namedBindings) {\n const nb = node.importClause.namedBindings;\n if (nb.kind == ts.SyntaxKind.NamespaceImport) {\n // This is of the form `import * as name from 'path'`. Return `name.`.\n return {\n [(nb as ts.NamespaceImport).name.text + '.']: modulePath,\n };\n } else {\n // This is of the form `import {a,b,c} from 'path'`\n const namedImports = nb as ts.NamedImports;\n\n return namedImports.elements\n .map((is: ts.ImportSpecifier) =>\n is.propertyName ? is.propertyName.text : is.name.text\n )\n .reduce((acc: { [name: string]: string }, curr: string) => {\n acc[curr] = modulePath;\n\n return acc;\n }, {});\n }\n }\n\n return {};\n } else {\n // This is of the form `import 'path';`. Nothing to do.\n return {};\n }\n}\n\nexport function getDecoratorMetadata(\n source: ts.SourceFile,\n identifier: string,\n module: string\n): ts.Node[] {\n const angularImports: { [name: string]: string } = findNodes(\n source,\n ts.SyntaxKind.ImportDeclaration\n )\n .map((node) =>\n _angularImportsFromNode(node as ts.ImportDeclaration, source)\n )\n .reduce(\n (\n acc: { [name: string]: string },\n current: { [name: string]: string }\n ) => {\n for (const key of Object.keys(current)) {\n acc[key] = current[key];\n }\n\n return acc;\n },\n {}\n );\n\n return getSourceNodes(source)\n .filter((node) => {\n return (\n node.kind == ts.SyntaxKind.Decorator &&\n (node as ts.Decorator).expression.kind == ts.SyntaxKind.CallExpression\n );\n })\n .map((node) => (node as ts.Decorator).expression as ts.CallExpression)\n .filter((expr) => {\n if (expr.expression.kind == ts.SyntaxKind.Identifier) {\n const id = expr.expression as ts.Identifier;\n\n return (\n id.getFullText(source) == identifier &&\n angularImports[id.getFullText(source)] === module\n );\n } else if (\n expr.expression.kind == ts.SyntaxKind.PropertyAccessExpression\n ) {\n // This covers foo.NgModule when importing * as foo.\n const paExpr = expr.expression as ts.PropertyAccessExpression;\n // If the left expression is not an identifier, just give up at that point.\n if (paExpr.expression.kind !== ts.SyntaxKind.Identifier) {\n return false;\n }\n\n const id = paExpr.name.text;\n const moduleId = (paExpr.expression as ts.Identifier).getText(source);\n\n return id === identifier && angularImports[moduleId + '.'] === module;\n }\n\n return false;\n })\n .filter(\n (expr) =>\n expr.arguments[0] &&\n expr.arguments[0].kind == ts.SyntaxKind.ObjectLiteralExpression\n )\n .map((expr) => expr.arguments[0] as ts.ObjectLiteralExpression);\n}\n\nfunction _addSymbolToNgModuleMetadata(\n source: ts.SourceFile,\n ngModulePath: string,\n metadataField: string,\n symbolName: string,\n importPath: string\n): Change[] {\n const nodes = getDecoratorMetadata(source, 'NgModule', '@angular/core');\n let node: any = nodes[0]; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n // Find the decorator declaration.\n if (!node) {\n return [];\n }\n\n // Get all the children property assignment of object literals.\n const matchingProperties: ts.ObjectLiteralElement[] = (\n node as ts.ObjectLiteralExpression\n ).properties\n .filter((prop) => prop.kind == ts.SyntaxKind.PropertyAssignment)\n // Filter out every fields that's not \"metadataField\". Also handles string literals\n // (but not expressions).\n .filter((prop: any) => {\n const name = prop.name;\n switch (name.kind) {\n case ts.SyntaxKind.Identifier:\n return (name as ts.Identifier).getText(source) == metadataField;\n case ts.SyntaxKind.StringLiteral:\n return (name as ts.StringLiteral).text == metadataField;\n }\n\n return false;\n });\n\n // Get the last node of the array literal.\n if (!matchingProperties) {\n return [];\n }\n if (matchingProperties.length == 0) {\n // We haven't found the field in the metadata declaration. Insert a new field.\n const expr = node as ts.ObjectLiteralExpression;\n let position: number;\n let toInsert: string;\n if (expr.properties.length == 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${metadataField}: [${symbolName}]\\n`;\n } else {\n node = expr.properties[expr.properties.length - 1];\n position = node.getEnd();\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n\\s*/);\n if (matches.length > 0) {\n toInsert = `,${matches[0]}${metadataField}: [${symbolName}]`;\n } else {\n toInsert = `, ${metadataField}: [${symbolName}]`;\n }\n }\n const newMetadataProperty = new InsertChange(\n ngModulePath,\n position,\n toInsert\n );\n const newMetadataImport = insertImport(\n source,\n ngModulePath,\n symbolName.replace(/\\..*$/, ''),\n importPath\n );\n\n return [newMetadataProperty, newMetadataImport];\n }\n\n const assignment = matchingProperties[0] as ts.PropertyAssignment;\n\n // If it's not an array, nothing we can do really.\n if (assignment.initializer.kind !== ts.SyntaxKind.ArrayLiteralExpression) {\n return [];\n }\n\n const arrLiteral = assignment.initializer as ts.ArrayLiteralExpression;\n if (arrLiteral.elements.length == 0) {\n // Forward the property.\n node = arrLiteral;\n } else {\n node = arrLiteral.elements;\n }\n\n if (!node) {\n console.log(\n 'No app module found. Please add your new class to your component.'\n );\n\n return [];\n }\n\n if (Array.isArray(node)) {\n const nodeArray = node as {} as Array<ts.Node>;\n const symbolsArray = nodeArray.map((node) => node.getText());\n if (symbolsArray.includes(symbolName)) {\n return [];\n }\n\n node = node[node.length - 1];\n\n const effectsModule = nodeArray.find(\n (node) =>\n (node.getText().includes('EffectsModule.forRoot') &&\n symbolName.includes('EffectsModule.forRoot')) ||\n (node.getText().includes('EffectsModule.forFeature') &&\n symbolName.includes('EffectsModule.forFeature'))\n );\n\n if (effectsModule && symbolName.includes('EffectsModule')) {\n const effectsArgs = (effectsModule as any).arguments.shift();\n\n if (\n effectsArgs &&\n effectsArgs.kind === ts.SyntaxKind.ArrayLiteralExpression\n ) {\n const effectsElements = (effectsArgs as ts.ArrayLiteralExpression)\n .elements;\n const [, effectsSymbol] = (<any>symbolName).match(/\\[(.*)\\]/);\n\n let epos;\n if (effectsElements.length === 0) {\n epos = effectsArgs.getStart() + 1;\n return [new InsertChange(ngModulePath, epos, effectsSymbol)];\n } else {\n const lastEffect = effectsElements[\n effectsElements.length - 1\n ] as ts.Expression;\n epos = lastEffect.getEnd();\n // Get the indentation of the last element, if any.\n const text: any = lastEffect.getFullText(source);\n\n let effectInsert: string;\n if (text.match('^\\r?\\r?\\n')) {\n effectInsert = `,${text.match(/^\\r?\\n\\s+/)[0]}${effectsSymbol}`;\n } else {\n effectInsert = `, ${effectsSymbol}`;\n }\n\n return [new InsertChange(ngModulePath, epos, effectInsert)];\n }\n } else {\n return [];\n }\n }\n }\n\n let toInsert: string;\n let position = node.getEnd();\n if (node.kind == ts.SyntaxKind.ObjectLiteralExpression) {\n // We haven't found the field in the metadata declaration. Insert a new\n // field.\n const expr = node as ts.ObjectLiteralExpression;\n if (expr.properties.length == 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${metadataField}: [${symbolName}]\\n`;\n } else {\n node = expr.properties[expr.properties.length - 1];\n position = node.getEnd();\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n if (text.match('^\\r?\\r?\\n')) {\n toInsert = `,${\n text.match(/^\\r?\\n\\s+/)[0]\n }${metadataField}: [${symbolName}]`;\n } else {\n toInsert = `, ${metadataField}: [${symbolName}]`;\n }\n }\n } else if (node.kind == ts.SyntaxKind.ArrayLiteralExpression) {\n // We found the field but it's empty. Insert it just before the `]`.\n position--;\n toInsert = `${symbolName}`;\n } else {\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n if (text.match(/^\\r?\\n/)) {\n toInsert = `,${text.match(/^\\r?\\n(\\r?)\\s+/)[0]}${symbolName}`;\n } else {\n toInsert = `, ${symbolName}`;\n }\n }\n const insert = new InsertChange(ngModulePath, position, toInsert);\n const importInsert: Change = insertImport(\n source,\n ngModulePath,\n symbolName.replace(/\\..*$/, ''),\n importPath\n );\n\n return [insert, importInsert];\n}\n\nfunction _addSymbolToComponentMetadata(\n source: ts.SourceFile,\n componentPath: string,\n metadataField: string,\n symbolName: string,\n importPath: string\n): Change[] {\n const nodes = getDecoratorMetadata(source, 'Component', '@angular/core');\n let node: any = nodes[0]; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n // Find the decorator declaration.\n if (!node) {\n return [];\n }\n\n // Get all the children property assignment of object literals.\n const matchingProperties: ts.ObjectLiteralElement[] = (\n node as ts.ObjectLiteralExpression\n ).properties\n .filter((prop) => prop.kind == ts.SyntaxKind.PropertyAssignment)\n // Filter out every fields that's not \"metadataField\". Also handles string literals\n // (but not expressions).\n .filter((prop: any) => {\n const name = prop.name;\n switch (name.kind) {\n case ts.SyntaxKind.Identifier:\n return (name as ts.Identifier).getText(source) == metadataField;\n case ts.SyntaxKind.StringLiteral:\n return (name as ts.StringLiteral).text == metadataField;\n }\n\n return false;\n });\n\n // Get the last node of the array literal.\n if (!matchingProperties) {\n return [];\n }\n if (matchingProperties.length == 0) {\n // We haven't found the field in the metadata declaration. Insert a new field.\n const expr = node as ts.ObjectLiteralExpression;\n let position: number;\n let toInsert: string;\n if (expr.properties.length == 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${metadataField}: [${symbolName}]\\n`;\n } else {\n node = expr.properties[expr.properties.length - 1];\n position = node.getEnd();\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n\\s*/);\n if (matches.length > 0) {\n toInsert = `,${matches[0]}${metadataField}: [${symbolName}]`;\n } else {\n toInsert = `, ${metadataField}: [${symbolName}]`;\n }\n }\n const newMetadataProperty = new InsertChange(\n componentPath,\n position,\n toInsert\n );\n const newMetadataImport = insertImport(\n source,\n componentPath,\n symbolName.replace(/\\..*$/, ''),\n importPath\n );\n\n return [newMetadataProperty, newMetadataImport];\n }\n\n const assignment = matchingProperties[0] as ts.PropertyAssignment;\n\n // If it's not an array, nothing we can do really.\n if (assignment.initializer.kind !== ts.SyntaxKind.ArrayLiteralExpression) {\n return [];\n }\n\n const arrLiteral = assignment.initializer as ts.ArrayLiteralExpression;\n if (arrLiteral.elements.length == 0) {\n // Forward the property.\n node = arrLiteral;\n } else {\n node = arrLiteral.elements;\n }\n\n if (!node) {\n console.log(\n 'No component found. Please add your new class to your component.'\n );\n\n return [];\n }\n\n if (Array.isArray(node)) {\n const nodeArray = node as {} as Array<ts.Node>;\n const symbolsArray = nodeArray.map((node) => node.getText());\n if (symbolsArray.includes(symbolName)) {\n return [];\n }\n\n node = node[node.length - 1];\n }\n\n let toInsert: string;\n let position = node.getEnd();\n if (node.kind == ts.SyntaxKind.ObjectLiteralExpression) {\n // We haven't found the field in the metadata declaration. Insert a new\n // field.\n const expr = node as ts.ObjectLiteralExpression;\n if (expr.properties.length == 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${metadataField}: [${symbolName}]\\n`;\n } else {\n node = expr.properties[expr.properties.length - 1];\n position = node.getEnd();\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n if (text.match('^\\r?\\r?\\n')) {\n toInsert = `,${\n text.match(/^\\r?\\n\\s+/)[0]\n }${metadataField}: [${symbolName}]`;\n } else {\n toInsert = `, ${metadataField}: [${symbolName}]`;\n }\n }\n } else if (node.kind == ts.SyntaxKind.ArrayLiteralExpression) {\n // We found the field but it's empty. Insert it just before the `]`.\n position--;\n toInsert = `${symbolName}`;\n } else {\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n if (text.match(/^\\r?\\n/)) {\n toInsert = `,${text.match(/^\\r?\\n(\\r?)\\s+/)[0]}${symbolName}`;\n } else {\n toInsert = `, ${symbolName}`;\n }\n }\n const insert = new InsertChange(componentPath, position, toInsert);\n const importInsert: Change = insertImport(\n source,\n componentPath,\n symbolName.replace(/\\..*$/, ''),\n importPath\n );\n\n return [insert, importInsert];\n}\n\n/**\n * Custom function to insert a declaration (component, pipe, directive)\n * into NgModule declarations. It also imports the component.\n */\nexport function addDeclarationToModule(\n source: ts.SourceFile,\n modulePath: string,\n classifiedName: string,\n importPath: string\n): Change[] {\n return _addSymbolToNgModuleMetadata(\n source,\n modulePath,\n 'declarations',\n classifiedName,\n importPath\n );\n}\n\n/**\n * Custom function to insert a declaration (component, pipe, directive)\n * into NgModule declarations. It also imports the component.\n */\nexport function addImportToModule(\n source: ts.SourceFile,\n modulePath: string,\n classifiedName: string,\n importPath: string\n): Change[] {\n return _addSymbolToNgModuleMetadata(\n source,\n modulePath,\n 'imports',\n classifiedName,\n importPath\n );\n}\n\n/**\n * Custom function to insert a provider into NgModule. It also imports it.\n */\nexport function addProviderToModule(\n source: ts.SourceFile,\n modulePath: string,\n classifiedName: string,\n importPath: string\n): Change[] {\n return _addSymbolToNgModuleMetadata(\n source,\n modulePath,\n 'providers',\n classifiedName,\n importPath\n );\n}\n\n/**\n * Custom function to insert a provider into Component. It also imports it.\n */\nexport function addProviderToComponent(\n source: ts.SourceFile,\n componentPath: string,\n classifiedName: string,\n importPath: string\n): Change[] {\n return _addSymbolToComponentMetadata(\n source,\n componentPath,\n 'providers',\n classifiedName,\n importPath\n );\n}\n\n/**\n * Custom function to insert an export into NgModule. It also imports it.\n */\nexport function addExportToModule(\n source: ts.SourceFile,\n modulePath: string,\n classifiedName: string,\n importPath: string\n): Change[] {\n return _addSymbolToNgModuleMetadata(\n source,\n modulePath,\n 'exports',\n classifiedName,\n importPath\n );\n}\n\n/**\n * Custom function to insert an export into NgModule. It also imports it.\n */\nexport function addBootstrapToModule(\n source: ts.SourceFile,\n modulePath: string,\n classifiedName: string,\n importPath: string\n): Change[] {\n return _addSymbolToNgModuleMetadata(\n source,\n modulePath,\n 'bootstrap',\n classifiedName,\n importPath\n );\n}\n\n/**\n * Add Import `import { symbolName } from fileName` if the import doesn't exit\n * already. Assumes fileToEdit can be resolved and accessed.\n * @param fileToEdit (file we want to add import to)\n * @param symbolName (item to import)\n * @param fileName (path to the file)\n * @param isDefault (if true, import follows style for importing default exports)\n * @return Change\n */\n\nexport function insertImport(\n source: ts.SourceFile,\n fileToEdit: string,\n symbolName: string,\n fileName: string,\n isDefault = false\n): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter((node) => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node\n .getChildren()\n .filter((child) => child.kind === ts.SyntaxKind.StringLiteral)\n .map((n) => (n as ts.StringLiteral).text);\n\n return importFiles.filter((file) => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach((n) => {\n Array.prototype.push.apply(\n imports,\n findNodes(n, ts.SyntaxKind.Identifier)\n );\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(\n (n) => (n as ts.Identifier).text === symbolName\n );\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(\n relevantImports[0],\n ts.SyntaxKind.CloseBraceToken\n )[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(\n imports,\n `, ${symbolName}`,\n fileToEdit,\n fallbackPos\n );\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral).filter(\n (n) => n.getText() === 'use strict'\n );\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert =\n `${separator}import ${open}${symbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral\n );\n}\n\nexport function replaceImport(\n sourceFile: ts.SourceFile,\n path: Path,\n importFrom: string,\n importAsIs: string,\n importToBe: string\n): (ReplaceChange | RemoveChange)[] {\n const imports = sourceFile.statements\n .filter(ts.isImportDeclaration)\n .filter(\n ({ moduleSpecifier }) =>\n moduleSpecifier.getText(sourceFile) === `'${importFrom}'` ||\n moduleSpecifier.getText(sourceFile) === `\"${importFrom}\"`\n );\n\n if (imports.length === 0) {\n return [];\n }\n\n const importText = (specifier: ts.ImportSpecifier) => {\n if (specifier.name.text) {\n return specifier.name.text;\n }\n\n // if import is renamed\n if (specifier.propertyName && specifier.propertyName.text) {\n return specifier.propertyName.text;\n }\n\n return '';\n };\n\n const changes = imports.map((p) => {\n const namedImports = p?.importClause?.namedBindings as ts.NamedImports;\n if (!namedImports) {\n return [];\n }\n\n const importSpecifiers = namedImports.elements;\n const isAlreadyImported = importSpecifiers\n .map(importText)\n .includes(importToBe);\n\n const importChanges = importSpecifiers.map((specifier, index) => {\n const text = importText(specifier);\n\n // import is not the one we're looking for, can be skipped\n if (text !== importAsIs) {\n return undefined;\n }\n\n // identifier has not been imported, simply replace the old text with the new text\n if (!isAlreadyImported) {\n return createReplaceChange(\n sourceFile,\n specifier,\n importAsIs,\n importToBe\n );\n }\n\n const nextIdentifier = importSpecifiers[index + 1];\n // identifer is not the last, also clean up the comma\n if (nextIdentifier) {\n return createRemoveChange(\n sourceFile,\n specifier,\n specifier.getStart(sourceFile),\n nextIdentifier.getStart(sourceFile)\n );\n }\n\n // there are no imports following, just remove it\n return createRemoveChange(\n sourceFile,\n specifier,\n specifier.getStart(sourceFile),\n specifier.getEnd()\n );\n });\n\n return importChanges.filter(Boolean) as (ReplaceChange | RemoveChange)[];\n });\n\n return changes.reduce((imports, curr) => imports.concat(curr), []);\n}\n\nexport function containsProperty(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string\n) {\n return (\n objectLiteral &&\n objectLiteral.properties.some(\n (prop) =>\n ts.isPropertyAssignment(prop) &&\n ts.isIdentifier(prop.name) &&\n prop.name.text === propertyName\n )\n );\n}\n"]} |