source: trip-planner-front/node_modules/@schematics/angular/utility/ast-utils.d.ts@ 188ee53

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

initial commit

  • Property mode set to 100644
File size: 5.3 KB
Line 
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.io/license
7 */
8import * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescript';
9import { Change } from './change';
10/**
11 * Add Import `import { symbolName } from fileName` if the import doesn't exit
12 * already. Assumes fileToEdit can be resolved and accessed.
13 * @param fileToEdit (file we want to add import to)
14 * @param symbolName (item to import)
15 * @param fileName (path to the file)
16 * @param isDefault (if true, import follows style for importing default exports)
17 * @return Change
18 */
19export declare function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string, fileName: string, isDefault?: boolean): Change;
20/**
21 * Find all nodes from the AST in the subtree of node of SyntaxKind kind.
22 * @param node
23 * @param kind
24 * @param max The maximum number of items to return.
25 * @param recursive Continue looking for nodes of kind recursive until end
26 * the last child even when node of kind has been found.
27 * @return all nodes of kind, or [] if none is found
28 */
29export declare function findNodes(node: ts.Node, kind: ts.SyntaxKind, max?: number, recursive?: boolean): ts.Node[];
30/**
31 * Find all nodes from the AST in the subtree that satisfy a type guard.
32 * @param node
33 * @param guard
34 * @param max The maximum number of items to return.
35 * @param recursive Continue looking for nodes of kind recursive until end
36 * the last child even when node of kind has been found.
37 * @return all nodes that satisfy the type guard, or [] if none is found
38 */
39export declare function findNodes<T extends ts.Node>(node: ts.Node, guard: (node: ts.Node) => node is T, max?: number, recursive?: boolean): T[];
40/**
41 * Get all the nodes from a source.
42 * @param sourceFile The source file object.
43 * @returns {Array<ts.Node>} An array of all the nodes in the source.
44 */
45export declare function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[];
46export declare function findNode(node: ts.Node, kind: ts.SyntaxKind, text: string): ts.Node | null;
47/**
48 * Insert `toInsert` after the last occurence of `ts.SyntaxKind[nodes[i].kind]`
49 * or after the last of occurence of `syntaxKind` if the last occurence is a sub child
50 * of ts.SyntaxKind[nodes[i].kind] and save the changes in file.
51 *
52 * @param nodes insert after the last occurence of nodes
53 * @param toInsert string to insert
54 * @param file file to insert changes into
55 * @param fallbackPos position to insert if toInsert happens to be the first occurence
56 * @param syntaxKind the ts.SyntaxKind of the subchildren to insert after
57 * @return Change instance
58 * @throw Error if toInsert is first occurence but fall back is not set
59 */
60export declare function insertAfterLastOccurrence(nodes: ts.Node[], toInsert: string, file: string, fallbackPos: number, syntaxKind?: ts.SyntaxKind): Change;
61export declare function getDecoratorMetadata(source: ts.SourceFile, identifier: string, module: string): ts.Node[];
62export declare function getMetadataField(node: ts.ObjectLiteralExpression, metadataField: string): ts.ObjectLiteralElement[];
63export declare function addSymbolToNgModuleMetadata(source: ts.SourceFile, ngModulePath: string, metadataField: string, symbolName: string, importPath?: string | null): Change[];
64/**
65 * Custom function to insert a declaration (component, pipe, directive)
66 * into NgModule declarations. It also imports the component.
67 */
68export declare function addDeclarationToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
69/**
70 * Custom function to insert an NgModule into NgModule imports. It also imports the module.
71 */
72export declare function addImportToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
73/**
74 * Custom function to insert a provider into NgModule. It also imports it.
75 */
76export declare function addProviderToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
77/**
78 * Custom function to insert an export into NgModule. It also imports it.
79 */
80export declare function addExportToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
81/**
82 * Custom function to insert an export into NgModule. It also imports it.
83 */
84export declare function addBootstrapToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
85/**
86 * Determine if an import already exists.
87 */
88export declare function isImported(source: ts.SourceFile, classifiedName: string, importPath: string): boolean;
89/**
90 * This function returns the name of the environment export
91 * whether this export is aliased or not. If the environment file
92 * is not imported, then it will return `null`.
93 */
94export declare function getEnvironmentExportName(source: ts.SourceFile): string | null;
95/**
96 * Returns the RouterModule declaration from NgModule metadata, if any.
97 */
98export declare function getRouterModuleDeclaration(source: ts.SourceFile): ts.Expression | undefined;
99/**
100 * Adds a new route declaration to a router module (i.e. has a RouterModule declaration)
101 */
102export declare function addRouteDeclarationToModule(source: ts.SourceFile, fileToAdd: string, routeLiteral: string): Change;
Note: See TracBrowser for help on using the repository browser.