From da0d374b303d1dc517767508922b765a46700c20 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 18 Aug 2017 11:55:47 -0700 Subject: [PATCH] Made updates to not expose methods/types that arent needed. --- src/compiler/commandLineParser.ts | 11 +++++---- src/server/project.ts | 37 +++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index d09e4cab6d2..cc3047b6d34 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1479,6 +1479,7 @@ namespace ts { } } + /*@internal*/ export function isErrorNoInputFiles(error: Diagnostic) { return error.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code; } @@ -1975,15 +1976,13 @@ namespace ts { } /** - * Expands an array of file specifications. - * - * @param fileNames The literal file names to include. - * @param include The wildcard file specifications to include. - * @param exclude The wildcard file specifications to exclude. + * Gets the file names from the provided config file specs that contain, files, include, exclude and + * other properties needed to resolve the file names + * @param spec The config file specs extracted with file names to include, wildcards to include/exclude and other details * @param basePath The base path for any relative file specifications. * @param options Compiler options. * @param host The host used to resolve files and directories. - * @param errors An array for diagnostic reporting. + * @param extraFileExtensions optionaly file extra file extension information from host */ export function getFileNamesFromConfigSpecs(spec: ConfigFileSpecs, basePath: string, options: CompilerOptions, host: ParseConfigHost, extraFileExtensions: ReadonlyArray): ExpandResult { basePath = normalizePath(basePath); diff --git a/src/server/project.ts b/src/server/project.ts index dde5d8070e4..88a08bfc863 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -158,8 +158,6 @@ namespace ts.server { private typingFiles: SortedReadonlyArray; - protected projectErrors: Diagnostic[]; - public typesVersion = 0; public isNonTsProject() { @@ -233,12 +231,12 @@ namespace ts.server { /** * Get the errors that dont have any file name associated */ - getGlobalProjectErrors() { - return filter(this.projectErrors, diagnostic => !diagnostic.file); + getGlobalProjectErrors(): ReadonlyArray { + return emptyArray; } - getAllProjectErrors() { - return this.projectErrors; + getAllProjectErrors(): ReadonlyArray { + return emptyArray; } getLanguageService(ensureSynchronized = true): LanguageService { @@ -323,7 +321,6 @@ namespace ts.server { this.program = undefined; this.builder = undefined; this.cachedUnresolvedImportsPerFile = undefined; - this.projectErrors = undefined; this.lsHost.dispose(); this.lsHost = undefined; @@ -371,6 +368,7 @@ namespace ts.server { return result; } + /*@internal*/ getRootFilesMap() { return this.rootFilesMap; } @@ -496,7 +494,7 @@ namespace ts.server { this.markAsDirty(); } - // add a root file to project + // add a root file that doesnt exist on host addMissingFileRoot(fileName: NormalizedPath) { const path = this.projectService.toPath(fileName); this.rootFilesMap.set(path, fileName); @@ -1004,6 +1002,8 @@ namespace ts.server { /** Used for configured projects which may have multiple open roots */ openRefCount = 0; + private projectErrors: Diagnostic[]; + constructor(configFileName: NormalizedPath, projectService: ProjectService, documentRegistry: DocumentRegistry, @@ -1018,7 +1018,7 @@ namespace ts.server { } /** - * Checks if the project has reload from disk pending, if thats pending, it reloads (and then updates graph as part of that) instead of just updating the graph + * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph * @returns: true if set of files in the project stays the same and false - otherwise. */ updateGraph(): boolean { @@ -1030,6 +1030,7 @@ namespace ts.server { return super.updateGraph(); } + /*@internal*/ getCachedServerHost() { return this.lsHost.host as CachedServerHost; } @@ -1119,6 +1120,20 @@ namespace ts.server { return getDirectoryPath(this.getConfigFilePath()); } + /** + * Get the errors that dont have any file name associated + */ + getGlobalProjectErrors(): ReadonlyArray { + return filter(this.projectErrors, diagnostic => !diagnostic.file); + } + + /** + * Get all the project errors + */ + getAllProjectErrors(): ReadonlyArray { + return this.projectErrors; + } + setProjectErrors(projectErrors: Diagnostic[]) { this.projectErrors = projectErrors; } @@ -1143,6 +1158,7 @@ namespace ts.server { })); } + /*@internal*/ watchWildcards(wildcardDirectories: Map) { mutateMap( this.directoriesWatchedForWildcards || (this.directoriesWatchedForWildcards = createMap()), @@ -1175,6 +1191,7 @@ namespace ts.server { this.projectService.closeDirectoryWatcher(WatchType.WildcardDirectories, this, directory, watcher, flags, closeReason); } + /*@internal*/ stopWatchingWildCards(reason: WatcherCloseReason) { if (this.directoriesWatchedForWildcards) { clearMap( @@ -1185,6 +1202,7 @@ namespace ts.server { } } + /*@internal*/ watchTypeRoots() { const newTypeRoots = arrayToSet(this.getEffectiveTypeRoots(), dir => this.projectService.toCanonicalFileName(dir)); mutateMap( @@ -1203,6 +1221,7 @@ namespace ts.server { ); } + /*@internal*/ stopWatchingTypeRoots(reason: WatcherCloseReason) { if (this.typeRootsWatchers) { clearMap(