source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/dependencies/esm_dependency_host.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: 4.1 KB
Line 
1/// <amd-module name="@angular/compiler-cli/ngcc/src/dependencies/esm_dependency_host" />
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9import * as ts from 'typescript';
10import { AbsoluteFsPath, ReadonlyFileSystem } from '../../../src/ngtsc/file_system';
11import { DependencyHostBase } from './dependency_host';
12import { ModuleResolver } from './module_resolver';
13/**
14 * Helper functions for computing dependencies.
15 */
16export declare class EsmDependencyHost extends DependencyHostBase {
17 private scanImportExpressions;
18 constructor(fs: ReadonlyFileSystem, moduleResolver: ModuleResolver, scanImportExpressions?: boolean);
19 private scanner;
20 protected canSkipFile(fileContents: string): boolean;
21 /**
22 * Extract any import paths from imports found in the contents of this file.
23 *
24 * This implementation uses the TypeScript scanner, which tokenizes source code,
25 * to process the string. This is halfway between working with the string directly,
26 * which is too difficult due to corner cases, and parsing the string into a full
27 * TypeScript Abstract Syntax Tree (AST), which ends up doing more processing than
28 * is needed.
29 *
30 * The scanning is not trivial because we must hold state between each token since
31 * the context of the token affects how it should be scanned, and the scanner does
32 * not manage this for us.
33 *
34 * Specifically, backticked strings are particularly challenging since it is possible
35 * to recursively nest backticks and TypeScript expressions within each other.
36 */
37 protected extractImports(file: AbsoluteFsPath, fileContents: string): Set<string>;
38 /**
39 * We have found an `import` token so now try to identify the import path.
40 *
41 * This method will use the current state of `this.scanner` to extract a string literal module
42 * specifier. It expects that the current state of the scanner is that an `import` token has just
43 * been scanned.
44 *
45 * The following forms of import are matched:
46 *
47 * * `import "module-specifier";`
48 * * `import("module-specifier")`
49 * * `import defaultBinding from "module-specifier";`
50 * * `import defaultBinding, * as identifier from "module-specifier";`
51 * * `import defaultBinding, {...} from "module-specifier";`
52 * * `import * as identifier from "module-specifier";`
53 * * `import {...} from "module-specifier";`
54 *
55 * @returns the import path or null if there is no import or it is not a string literal.
56 */
57 protected extractImportPath(): string | null;
58 /**
59 * We have found an `export` token so now try to identify a re-export path.
60 *
61 * This method will use the current state of `this.scanner` to extract a string literal module
62 * specifier. It expects that the current state of the scanner is that an `export` token has
63 * just been scanned.
64 *
65 * There are three forms of re-export that are matched:
66 *
67 * * `export * from '...';
68 * * `export * as alias from '...';
69 * * `export {...} from '...';
70 */
71 protected extractReexportPath(): string | null;
72 protected skipNamespacedClause(): ts.SyntaxKind | null;
73 protected skipNamedClause(): ts.SyntaxKind;
74 protected tryStringLiteral(): string | null;
75}
76/**
77 * Check whether a source file needs to be parsed for imports.
78 * This is a performance short-circuit, which saves us from creating
79 * a TypeScript AST unnecessarily.
80 *
81 * @param source The content of the source file to check.
82 *
83 * @returns false if there are definitely no import or re-export statements
84 * in this file, true otherwise.
85 */
86export declare function hasImportOrReexportStatements(source: string): boolean;
87/**
88 * Check whether the given statement is an import with a string literal module specifier.
89 * @param stmt the statement node to check.
90 * @returns true if the statement is an import with a string literal module specifier.
91 */
92export declare function isStringImportOrReexport(stmt: ts.Statement): stmt is ts.ImportDeclaration & {
93 moduleSpecifier: ts.StringLiteral;
94};
Note: See TracBrowser for help on using the repository browser.