source: trip-planner-front/node_modules/@angular/material/schematics/ng-update/migrations/hammer-gestures-v9/import-manager.d.ts

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

initial commit

  • Property mode set to 100644
File size: 5.1 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 { FileSystem } from '@angular/cdk/schematics';
9import * as ts from 'typescript';
10/**
11 * Import manager that can be used to add or remove TypeScript imports within source
12 * files. The manager ensures that multiple transformations are applied properly
13 * without shifted offsets and that existing imports are re-used.
14 */
15export declare class ImportManager {
16 private _fileSystem;
17 private _printer;
18 /** Map of source-files and their previously used identifier names. */
19 private _usedIdentifierNames;
20 /** Map of source files and their analyzed imports. */
21 private _importCache;
22 constructor(_fileSystem: FileSystem, _printer: ts.Printer);
23 /**
24 * Analyzes the import of the specified source file if needed. In order to perform
25 * modifications to imports of a source file, we store all imports in memory and
26 * update the source file once all changes have been made. This is essential to
27 * ensure that we can re-use newly added imports and not break file offsets.
28 */
29 private _analyzeImportsIfNeeded;
30 /**
31 * Checks whether the given specifier, which can be relative to the base path,
32 * matches the passed module name.
33 */
34 private _isModuleSpecifierMatching;
35 /** Deletes a given named binding import from the specified source file. */
36 deleteNamedBindingImport(sourceFile: ts.SourceFile, symbolName: string, moduleName: string): void;
37 /** Deletes the import that matches the given import declaration if found. */
38 deleteImportByDeclaration(declaration: ts.ImportDeclaration): void;
39 /**
40 * Adds an import to the given source file and returns the TypeScript expression that
41 * can be used to access the newly imported symbol.
42 *
43 * Whenever an import is added to a source file, it's recommended that the returned
44 * expression is used to reference th symbol. This is necessary because the symbol
45 * could be aliased if it would collide with existing imports in source file.
46 *
47 * @param sourceFile Source file to which the import should be added.
48 * @param symbolName Name of the symbol that should be imported. Can be null if
49 * the default export is requested.
50 * @param moduleName Name of the module of which the symbol should be imported.
51 * @param typeImport Whether the symbol is a type.
52 * @param ignoreIdentifierCollisions List of identifiers which can be ignored when
53 * the import manager checks for import collisions.
54 */
55 addImportToSourceFile(sourceFile: ts.SourceFile, symbolName: string | null, moduleName: string, typeImport?: boolean, ignoreIdentifierCollisions?: ts.Identifier[]): ts.Expression;
56 /**
57 * Applies the recorded changes in the update recorders of the corresponding source files.
58 * The changes are applied separately after all changes have been recorded because otherwise
59 * file offsets will change and the source files would need to be re-parsed after each change.
60 */
61 recordChanges(): void;
62 /**
63 * Corrects the line and character position of a given node. Since nodes of
64 * source files are immutable and we sometimes make changes to the containing
65 * source file, the node position might shift (e.g. if we add a new import before).
66 *
67 * This method can be used to retrieve a corrected position of the given node. This
68 * is helpful when printing out error messages which should reflect the new state of
69 * source files.
70 */
71 correctNodePosition(node: ts.Node, offset: number, position: ts.LineAndCharacter): ts.LineAndCharacter;
72 /**
73 * Returns an unique identifier name for the specified symbol name.
74 * @param sourceFile Source file to check for identifier collisions.
75 * @param symbolName Name of the symbol for which we want to generate an unique name.
76 * @param ignoreIdentifierCollisions List of identifiers which should be ignored when
77 * checking for identifier collisions in the given source file.
78 */
79 private _getUniqueIdentifier;
80 /**
81 * Checks whether the specified identifier name is used within the given source file.
82 * @param sourceFile Source file to check for identifier collisions.
83 * @param name Name of the identifier which is checked for its uniqueness.
84 * @param ignoreIdentifierCollisions List of identifiers which should be ignored when
85 * checking for identifier collisions in the given source file.
86 */
87 private _isUniqueIdentifierName;
88 /**
89 * Records that the given identifier is used within the specified source file. This
90 * is necessary since we do not apply changes to source files per change, but still
91 * want to avoid conflicts with newly imported symbols.
92 */
93 private _recordUsedIdentifier;
94 /**
95 * Determines the full end of a given node. By default the end position of a node is
96 * before all trailing comments. This could mean that generated imports shift comments.
97 */
98 private _getEndPositionOfNode;
99}
Note: See TracBrowser for help on using the repository browser.