util.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.dev/license
  7. */
  8. import { Tree } from '@angular-devkit/schematics';
  9. import ts from '../../third_party/github.com/Microsoft/TypeScript/lib/typescript';
  10. import { Change } from '../change';
  11. /**
  12. * Finds the main file of a project.
  13. * @param tree File tree for the project.
  14. * @param projectName Name of the project in which to search.
  15. */
  16. export declare function getMainFilePath(tree: Tree, projectName: string): Promise<string>;
  17. /**
  18. * Gets a TypeScript source file at a specific path.
  19. * @param tree File tree of a project.
  20. * @param path Path to the file.
  21. */
  22. export declare function getSourceFile(tree: Tree, path: string): ts.SourceFile;
  23. /** Finds the call to `bootstrapApplication` within a file. */
  24. export declare function findBootstrapApplicationCall(tree: Tree, mainFilePath: string): ts.CallExpression;
  25. /**
  26. * Applies a set of changes to a file.
  27. * @param tree File tree of the project.
  28. * @param path Path to the file that is being changed.
  29. * @param changes Changes that should be applied to the file.
  30. */
  31. export declare function applyChangesToFile(tree: Tree, path: string, changes: Change[]): void;
  32. /** Checks whether a node is a call to `mergeApplicationConfig`. */
  33. export declare function isMergeAppConfigCall(node: ts.Node): node is ts.CallExpression;
  34. /** Finds the `providers` array literal within an application config. */
  35. export declare function findProvidersLiteral(config: ts.ObjectLiteralExpression): ts.ArrayLiteralExpression | null;