UNPKG

2.82 kBTypeScriptView Raw
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 */
8/// <amd-module name="@angular/language-service/ivy/adapters" />
9/** @fileoverview provides adapters for communicating with the ng compiler */
10import { ConfigurationHost } from '@angular/compiler-cli';
11import { NgCompilerAdapter } from '@angular/compiler-cli/src/ngtsc/core/api';
12import { AbsoluteFsPath, FileStats, PathSegment, PathString } from '@angular/compiler-cli/src/ngtsc/file_system';
13import * as ts from 'typescript/lib/tsserverlibrary';
14export declare class LanguageServiceAdapter implements NgCompilerAdapter {
15 private readonly project;
16 readonly entryPoint: null;
17 readonly constructionDiagnostics: ts.Diagnostic[];
18 readonly ignoreForEmit: Set<ts.SourceFile>;
19 readonly factoryTracker: null;
20 readonly unifiedModulesHost: null;
21 readonly rootDirs: AbsoluteFsPath[];
22 /**
23 * Map of resource filenames to the version of the file last read via `readResource`.
24 *
25 * Used to implement `getModifiedResourceFiles`.
26 */
27 private readonly lastReadResourceVersion;
28 constructor(project: ts.server.Project);
29 isShim(sf: ts.SourceFile): boolean;
30 fileExists(fileName: string): boolean;
31 readFile(fileName: string): string | undefined;
32 getCurrentDirectory(): string;
33 getCanonicalFileName(fileName: string): string;
34 /**
35 * Return the real path of a symlink. This method is required in order to
36 * resolve symlinks in node_modules.
37 */
38 realpath(path: string): string;
39 /**
40 * readResource() is an Angular-specific method for reading files that are not
41 * managed by the TS compiler host, namely templates and stylesheets.
42 * It is a method on ExtendedTsCompilerHost, see
43 * packages/compiler-cli/src/ngtsc/core/api/src/interfaces.ts
44 */
45 readResource(fileName: string): string;
46 getModifiedResourceFiles(): Set<string> | undefined;
47}
48/**
49 * Used to read configuration files.
50 *
51 * A language service parse configuration host is independent of the adapter
52 * because signatures of calls like `FileSystem#readFile` are a bit stricter
53 * than those on the adapter.
54 */
55export declare class LSParseConfigHost implements ConfigurationHost {
56 private readonly serverHost;
57 constructor(serverHost: ts.server.ServerHost);
58 exists(path: AbsoluteFsPath): boolean;
59 readFile(path: AbsoluteFsPath): string;
60 lstat(path: AbsoluteFsPath): FileStats;
61 pwd(): AbsoluteFsPath;
62 extname(path: AbsoluteFsPath | PathSegment): string;
63 resolve(...paths: string[]): AbsoluteFsPath;
64 dirname<T extends PathString>(file: T): T;
65 join<T extends PathString>(basePath: T, ...paths: string[]): T;
66}